akhauriyash/Code-Regression huggingface dataset:
// INCLUDES
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>
#include<assert.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp>
//DEFINES
#define MAX 1000001
#define pii pair<int, int>
#define F first
#define S second
#define all(s) begin(s),end(s)
#define MIN3POS(a, b, c) (a) =< (b) ? ((a) =< (c) ? 1 : 3) : ((b) =< (c) ? 2 : 3)
#define MAX3POS(a,b,c) (a) >= (b) ? ((a) >= (c) ? 1 : 3) : ((b) >= (c) ? 2:3)
#define endl '\n'
#define int long long
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define FOR(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define what_is(x) cerr << #x << 'is' << x << endl;
#define IOS   ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args);}
//NAMESPACES
using namespace __gnu_pbds; 
using namespace std;
//HELPERS
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
cerr << *it << '=' << a << endl;
err(++it, args...);
}
vector<int> powers2(32,0);void initialize(){ for(int i=1;i<powers2.size();i++) powers2[i] = powers2[i-1]*2;}
int32_t main()
{
IOS
int h,a;
cin>>h>>a;
if(h%a == 0)
cout<<h/a;
else
cout<<h/a+1;    
return 0;
}
// Use emplace back in place of pushback
// Use tie function , for object destructuring

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;

int main() {
	vector<char> s(4);
    for(int i=0;i<=3;i++){
      cin >> s.at(i);
    }
    sort(s.begin(),s.end());
    if(s.at(0) == s.at(1) && s.at(1) != s.at(2) && s.at(2) == s.at(3)){
      cout << "Yes" << endl;
    }
    else{
      cout << "No" << endl;
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>

using namespace std;

using uint = unsigned int;
using ll = long long;
using ld = long double;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define dbg(...) cerr << #__VA_ARGS__ << " ->", debug_out(__VA_ARGS__)
#define dbg_p(x) cerr<<#x": "<<(x).first<<' '<<(x).second<<endl
#define dbg_v(x, n) {cerr<<#x"[]: ";for(long long _=0;_<n;++_)cerr<<(x)[_]<<' ';cerr<<endl;}
#define all(v) v.begin(), v.end()
#define fi first
#define se second
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) { cerr << " " << H; debug_out(T...);}
 
template<typename T1, typename T2>
ostream& operator <<(ostream &out, const pair<T1, T2> &item) {
	out << '(' << item.first << ", " << item.second << ')';
	return out;
}
 
template <typename T>
ostream& operator <<(ostream &out, const vector<T>& v) {
	for(const auto &item : v) out << item << ' ';
	return out;
}

string s;
ll k;

ll comb(ll n, ll k)
{
	if (k == 0)
		return 1;
	if (k == 1)
		return n;
	if (k == 2)
		return n*(n-1)/2;
	if (k == 3)
		return n*(n-1)*(n-2)/6;

	assert(false);
}

ll put(ll x, ll k)
{
	ll ans = 1;
	for (ll i=1; i<=k; i++)
		ans *= x;
	return ans;
}

ll solve(const string &s, ll k, ll start)
{
	ll rest = s.size() - start - 1;
	if (k == 0)
		return 1;

	if(start == s.size())
		return 0;

	ll x = s[start] - '0';
	if (x == 0)
		return solve(s, k, start+1);

	ll zero = 0, plus = 0;
	plus = (x - 1) * comb(rest, k-1) * put(9, k-1); 
	if (k <= rest)
		zero = comb(rest, k) * put(9, k);

	return plus + zero + solve(s, k-1, start+1);
}

int main()
{
	ios_base::sync_with_stdio(false);

	cin>>s;
	cin>>k;

	if (k > s.size())
	{
		cout<<0;
	}
	else
	{
		cout<<solve(s, k, 0);
	}
	cout<<'\n';
	return 0;
}

Measured memory_bytes: 256
/*================================================================
rehtegot!
*   
*   File Name：AGC40A.cpp
*   Author：YaliKiWi
*   Date：2019年11月05日
*   Discribe：
*
================================================================*/


#include<bits/stdc++.h>
using namespace std;
#define fo(i,s,e) for(register int i=s,i%:%:_end=e;i<=i%:%:_end;i++)
#define max_(x,y) ((x)>(y)?(x):(y))
#define min_(x,y) ((x)<(y)?(x):(y))
#define dd double
#define ull unsigned long long
#define ll long long
#define file(x) freopen(x".in","r",stdin),freopen(x".out","w",stdout)
#define maxn 500010
#define int ll
char s[maxn];
int a[maxn],ans;
signed main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	scanf("%s",s+1);
	int n=strlen(s+1)+1;
	fo(i,1,n-1){
		if(s[i]=='<')
			a[i]=max_(a[i-1]+1,a[i]);
	}
	for(register int i=n-1;i;i--){
		if(s[i]=='>')
			a[i-1]=max_(a[i-1],a[i]+1);
	}
	fo(i,0,n-1){
		ans+=a[i];
//		cerr<<a[i]<<" ";
	}
//	cerr<<endl;
	printf("%lld",ans);
	return 0;
}


Measured memory_bytes: 4608
import sys

ans = 0
input = sys.stdin.readline
N = int(input())
S = input().rstrip()

list_S = list(S)

for i in range(N - 2):
    if list_S[i] == 'A':
        if list_S[i + 1] == 'B':
            if list_S[i + 2] == 'C':
                ans += 1
print(ans)

Measured memory_bytes: 3060
#!/usr/bin/env python3

n, m = map(int, input().split())
edges = []
graph = [ [] for _ in range(n) ]

for i in range(m):
    a, b = map(int, input().split())
    a -= 1; b -= 1;
    edges.append( (a, b) )

    graph[a].append(b)
    graph[b].append(a)

def dfs(u, v):
    is_visited = [ False ]*n
    st = []
    is_visited[0] = True
    st.append(0)

    while st:
        cur = st.pop()
        for adj in graph[cur]:
            if is_visited[adj]: continue
            if cur == u and adj == v: continue
            if cur == v and adj == u: continue
            is_visited[adj] = True
            st.append(adj)

    return all(is_visited)

ans = 0
for u, v in edges:
    if not dfs(u, v):
        ans += 1

print(ans)


Measured memory_bytes: 3064
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;

int main(){
    int h, w;
    cin >> h >> w;
    for (int i=0; i < w+2; i++) {
        cout << "#";
    }
    cout << endl;
    for (int i=0; i < h; i++) {
        string a;
        cin >> a;
        cout << "#" << a << "#" << endl;
    }
    for (int i=0; i < w+2; i++) {
        cout << "#";
    }
    cout << endl;
}

Measured memory_bytes: 256
// template.cpp

// Defines.
//#define DEBUG
#define NUMBER_OF_DIGITS 6

// Includes.
#include <bits/stdc++.h>

#ifdef DEBUG
#include <chrono>
#endif

// Usings.
using namespace std;

// Main function.
int main()
{
#ifdef DEBUG
	chrono::system_clock::time_point start, end;
	
	start = chrono::system_clock::now();
#endif
	
	// settings.
	ios::sync_with_stdio(false);
	
	//cout << fixed;
	//cout << setprecision(NUMBER_OF_DIGITS);
	
	// logic.
	int n;
	cin >> n;
	string s;
	cin >> s;
	
	int counter = 0;
	for (int i = 0; i < (n - 2); i++)
	{
		if ((s[i] == 'A') && (s[i + 1] == 'B') && (s[i + 2] == 'C'))
		{
			counter++;
		}
	}
	cout << counter << endl;

#ifdef DEBUG
	end = chrono::system_clock::now();
	
	double elapsed = chrono::duration_cast<std::chrono::milliseconds>(end-start).count();
	cout << elapsed << "[ms]" << endl;
#endif
	
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <math.h>
#include <cstdlib> //絶対値 abs()
using namespace std;

int gojo(int64_t a, int64_t b) {
  while(1) {
    if(a < b) swap(a, b);
    if(!b) break;
    a %= b;
  }
  return a;
}


int main(){

	int64_t a,b;
	cin >> a >> b;
	int64_t g = gojo(a,b);

  
	int64_t c = a/g;
	int64_t d = b/g;

	int64_t ans = c*d*g;

	cout << ans << endl;

}

Measured memory_bytes: 256
#ifdef DEBUG
#define _GLIBCXX_DEBUG
#endif

#include <bits/stdc++.h>

using namespace std;

typedef long double ld;
typedef long long ll;

#ifdef DEBUG
#define eprintf(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
#else
#define eprintf(...) ;
#endif

#define pb push_back
#define mp make_pair
#define sz(x) ((int) (x).size())
#define TASK "text"

const int inf = (int) 1.01e9;
const ld eps = 1e-9;
const ld pi = acos((ld) -1);

mt19937 mrand(random_device{} ()); 

int rnd(int x) {
  return mrand() % x;
}

void precalc() {
}

const int maxn = 505;
int n;
int x[maxn];
int a[maxn * maxn];

int read() {
  if (scanf("%d", &n) < 1) {
    return false;
  }
  for (int i = 0; i < n; i++) {
    scanf("%d", &x[i]);
    x[i]--;
  }
  return true;
}

pair<int, int> ev[maxn];

void solve() {
  for (int i = 0; i < n * n; i++) {
    a[i] = -1;
  }
  for (int i = 0; i < n; i++) {
    ev[i] = make_pair(x[i], i);
  }
  sort(ev, ev + n);
  for (int i = 0, pos = 0; i < n; i++) {
    int p = ev[i].first, id = ev[i].second;
    a[p] = id;
    int cnt = id;
    while (cnt) {
      while (pos < p && a[pos] != -1) {
        pos++;
      }
      if (pos == p) {
        printf("No\n");
        return;
      }
      a[pos] = id;
      cnt--;
    }
  }
  for (int i = n - 1, pos = n * n - 1; i >= 0; i--) {
    int p = ev[i].first, id = ev[i].second;
    int cnt = n - id - 1;
    while (cnt) {
      while (pos > p && a[pos] != -1) {
        pos--;
      }
      if (pos == p) {
        printf("No\n");
        return;
      }
      a[pos] = id;
      cnt--;
    }
  }
  printf("Yes\n");
  for (int i = 0; i < n * n; i++) {
    printf("%d ", a[i] + 1);
  }
  printf("\n");
}

int main() {
  precalc();
#ifdef LOCAL
  assert(freopen(TASK ".in", "r", stdin));
  assert(freopen(TASK ".out", "w", stdout));
#endif
  while (true) {
    if (!read()) {
      break;
    }
    solve();
#ifdef DEBUG
    eprintf("Time %.2f\n", (double) clock() / CLOCKS_PER_SEC);
#endif
  }
  return 0;
}


Measured memory_bytes: 2176
import sys
from math import log2,floor,ceil,sqrt
# import bisect
# from collections import deque

# from types import GeneratorType
# def bootstrap(func, stack=[]):
#     def wrapped_function(*args, **kwargs):
#         if stack:
#             return func(*args, **kwargs)
#         else:
#             call = func(*args, **kwargs)
#             while True:
#                 if type(call) is GeneratorType:
#                     stack.append(call)
#                     call = next(call)
#                 else:
#                     stack.pop()
#                     if not stack:
#                         break
#                     call = stack[-1].send(call)
#             return call
#     return wrapped_function

Ri = lambda : [int(x) for x in sys.stdin.readline().split()]
ri = lambda : sys.stdin.readline().strip()
 
def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
INF = 10 ** 18
MOD = 10**9+7

a,b = Ri()
print(a*b)

Measured memory_bytes: 62216
L = [int(i) for i in input()]
l = len(L)

# L以下の整数は「上からi桁目まで同じで、それ以降違う」で考える。　あるL以下の整数=A+B
# L[i]=0のときAとBの桁は(0,0), L[i]=1のときAとBの桁は(0,1)(1,0)のどちらか
mod = 10 ** 9 + 7
answer = 0
mod_pow = [0] * (l + 1)
prev = 1
mod_pow[0] = 1


for i in range(1, l + 1):
    prev *= 3
    prev %= mod
    mod_pow[i] = prev

prev = 1
for i, j in enumerate(L, 1):
    if j == 0:
        continue
    answer += prev * mod_pow[l - i]
    answer %= mod
    prev *= 2
    prev %= mod

answer += prev
answer %= mod
print(answer)


Measured memory_bytes: 7836
#include <iostream>
#include <stdio.h>
using namespace std;

void solve()
{
	int dx[] = {1, 0, -1, 0, 1, 1, -1, -1, 2, 0, -2, 0};
	int dy[] = {0, -1, 0, 1, 1, -1, 1, -1, 0, -2, 0, 2};
	int field[10][10] = {0};
	int x, y, size;
	while(scanf("%d,%d,%d", &x, &y, &size) != EOF)
	{
		++field[x][y];
		int n = 4 * size;
		for(int i = 0; i < n; ++i)
		{
			if((0 <= x + dx[i] && x + dx[i] < 10) && (0 <= y + dy[i] && y + dy[i] < 10))
			{
				++field[x + dx[i]][y + dy[i]];
			}
		}
	}
	int count = 0;
	int max = 0;
	for(int i = 0; i < 10; ++i)
	{
		for(int j = 0; j < 10; ++j)
		{
			if(field[i][j] >= 1)
			{
				++count;
			}
			if(field[i][j] > max)
			{
				max = field[i][j];
			}
		}
	}
	cout << 100 - count << endl;
	cout << max << endl;
}

int main()
{
	solve();
	return(0);
}

Measured memory_bytes: 1208
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val a = sc.nextInt()
    val b = sc.nextInt()
    val x = sc.nextInt()
    println(problem094a(a, b, x))
}

fun problem094a(a: Int, b: Int, x: Int): String {
    return if (a > x || a + b < x) "NO" else "YES"
}

Measured memory_bytes: 31400
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		
		if (a == 1){
			System.out.println("Hello World");
			return;
		}
		
		int b = sc.nextInt();
		int c = sc.nextInt();
		
		System.out.println(b+c);
		
		
	}

}


Measured memory_bytes: 22996
#include<stdio.h>
#include<string.h>
int arr[26];
int main()
{
    char str[1200];
    char ch;
    int x;
    scanf("%[^\t]", str);
    int a=strlen(str);

    for(x=0;x<a;x++)
    {
        ch=tolower(str[x]);
        if(ch>=97 && ch<=122)
        {
            arr[ch-97]++;
        }
    }
    for(x=97;x<=122;x++)
        printf("%c : %d\n",x,arr[x-97]);
    return 0;
}


Measured memory_bytes: 2088
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stdio.h>
#include <string.h>
using namespace std;

int main() {
    int64_t x;
    cin >> x;

    for (int64_t i = 0;; i++) {
        int64_t t = i * (i + 1) / 2;
        if (t >= x) {
            cout << i << endl;
            break;
        }
    }

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;

int main(){ 
  string T;
  cin >> T;
  ll t = T.size();
  string S(t,'a');
  for(int i = 0; i < t; i++){
    if(T.at(i) == '?'){
      S.at(i) = 'D';
    }
    else S.at(i) = T.at(i);
  }
  cout << S << endl;
      
}


Measured memory_bytes: 3924
#include<stdio.h>
#include<stdlib.h>
#include<math.h>

int main(void){

    int i;
    int P, Q,R;

    scanf("%d %d %d", &P, &Q, &R);

    int min = P+Q;

    if(Q+R < min) min = Q+R;
    if(P+R < min) min = P+R;

    printf("%d\n", min);
    
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
 
using namespace std;
 
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
 
    int n, k;
    cin>>n>>k;
 
    vector<int> A(n);
    for(int i=0;i<n;i++){
        cin>>A[i];
    }
    vector<vector<int>> dp(2, vector<int>(k+1));
 
    int MOD=1e9+7;
 
    for(int j=0;j<=min(k, A[0]);j++){
        dp[0][j]=1;
    }
 
    for(int i=1;i<n;i++){
        int current=i%2;
        int last=!current;
        dp[current][0]=1;
        long long temp=1;
        for(int j=1;j<=A[i];j++){
            temp=(temp+(long long)dp[last][j])%(long long)MOD;
            dp[current][j]=temp;
        }
 
        for(int j=A[i]+1; j<=k; j++){
            if(j-A[i]-1>=0){
                temp=(temp-(long long)dp[last][j-A[i]-1]+MOD)%(long long)MOD;
            }
            temp=(temp+(long long)dp[last][j])%(long long)MOD;
            dp[current][j]=temp;
            
        }
    }
 
    int current=(n-1)%2;
    cout<<dp[current][k]<<endl;
}


Measured memory_bytes: 4472
#include <stdio.h>
	#define MAX 10000

	void preParse(int );
	void inParse(int );
	void postParse(int);

	struct Node{
		int p;
		int l;
		int r;
	};
	struct Node T[MAX];
	int num;
	int main(){
		int i,v,l,r,root;
		scanf("%d",&num);
	for(i=0;i<num;i++){
		T[i].p=-1;
	}

	for(i=0;i<num;i++){
		scanf("%d %d %d",&v,&l,&r);
		T[v].l=l;
		T[v].r=r;
		if(l != -1 ) T[l].p = v;
		if(r != -1) T[r].p = v;
	}
		for(i=0;i<num;i++) if(T[i].p == -1) root=i;

		printf("Preorder\n");
		preParse(root);
		printf("\n");
		printf("Inorder\n");
		inParse(root);
		printf("\n");
		printf("Postorder\n");
		postParse(root);
		printf("\n");

		return 0;
	}
	void preParse(int n){
		if(n == -1) return;
		printf(" %d",n);
		preParse(T[n].l);
		preParse(T[n].r);
	}

	void inParse(int n){
		if (n == -1) return ;
		inParse(T[n].l);
		printf(" %d",n);
		inParse(T[n].r);
	}

	void postParse(int n){
		if (n == -1) return ;
		postParse(T[n].l);
		postParse(T[n].r);
		printf(" %d",n);
	}

Measured memory_bytes: 616
#include <iostream>
#include <iomanip>
#include <vector>
#include <array>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <set>
#include <tuple>
#include <cmath>
#include <algorithm>
#include <functional>
#include <numeric>
#include <cfloat>
#include <climits>
#include <cassert>
#include <random>
struct Monster {
	int position; long long int health;
};
int main() {
	int n, range; long long int damage; std::cin >> n >> range >> damage;
	std::vector<Monster> monsters(n); for (auto& m : monsters) std::cin >> m.position >> m.health;
	std::sort(monsters.begin(), monsters.end(), [](const Monster a, const Monster b) {return a.position < b.position; });
	std::queue<std::pair<int, int>> queue;
	long long int count = 0, sum = 0;
	for (auto m : monsters) {
		while (!queue.empty() && queue.front().first + range < m.position) {
			count -= queue.front().second;
			queue.pop();
		}
		m.health -= count * damage;
		if (m.health > 0) {
			queue.emplace(m.position + range, (m.health + damage - 1) / damage);
			count += (m.health + damage - 1) / damage;
			sum += (m.health + damage - 1) / damage;
		}
	}
	std::cout << sum << std::endl;
}

Measured memory_bytes: 4224
// E.

#include <iostream>
#include <sstream>
#include <algorithm>
#include <vector>

using namespace std;

typedef long long LL;

int main(int argc, char* argv[]) {
	const LL INF = 1LL << 60;
	while (true) {
		int n = -1, m = -1, l = -1, q = -1, a, b, c, s, t;
		cin >> n >> m >> l;
		if (n <= 0) break;
		vector<vector<LL>> d(n, vector<LL>(n, INF)), h(n, vector<LL>(n, INF));
		for (int i = 0; i < m; ++i) {
			cin >> a >> b >> c;
			d[a - 1][b - 1] = c;
			d[b - 1][a - 1] = c;
		}
		for (int k = 0; k < n; ++k) {
			for (int i = 0; i < n; ++i) {
				for (int j = 0; j < n; ++j) {
					d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
					if (d[i][j] <= l) {
						h[i][j] = 1;
					}
				}
			}
		}
		for (int k = 0; k < n; ++k) {
			for (int i = 0; i < n; ++i) {
				for (int j = 0; j < n; ++j) {
					h[i][j] = min(h[i][j], h[i][k] + h[k][j]);
				}
			}
		}
		cin >> q;
		for (int i = 0; i < q; ++i) {
			cin >> s >> t;
			LL dist = h[s - 1][t - 1];
			cout << (dist < INF ? dist - 1 : -1) << endl;
		}
	}
	return 0;
}


Measured memory_bytes: 1920
#include <bits/stdc++.h>
#include <string>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define inf 1001001001
typedef pair<int,int> P;
#define mod 1000000007



int main(){
   int x,a,b;
   cin >> x >> a >> b;
   int c=b-a;
   if(c<=0) cout << "delicious" << endl;
   else if(x>=c) cout << "safe" << endl;
   else cout << "dangerous" << endl;
    return 0;
}

Measured memory_bytes: 384
def main():
    T = [i for i in range(2, 14)]
    T.append(1)

    A, B = map(int, input().split())
    hoge = T.index(A)
    fuga = T.index(B)
    if hoge > fuga:
        print("Alice")
    elif hoge < fuga:
        print("Bob")
    else:
        print("Draw")


if __name__ == "__main__":
    main()

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define int ll
#define pb push_back
#define setbits(x)          __builtin_popcountll(x)
#define endl "\n"
typedef long long ll;
int32_t main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
 bool fg=0;
    ll n,m=100,t,f=0,s=0;
    cin>>n;
 while(1)
 {
     if(n<=m)
        break;
     m+=(m/100);
     f++;
 }
 cout<<f<<endl;
   
    return 0;
}


Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
const int maxn=100100;
struct node{
	int A,B;
}a[maxn];
struct val{
	long long x,y;
	void operator = (const int &B){
		x=B,y=1;
	}
};
void print(val A){
	printf("val=%lld/%lld\n",A.x,A.y);
}
val operator + (const val &A,const int B){
	val ret=A;
	ret.x=ret.x+B*A.y;
	return ret;
}
bool operator < (const val &A,const val &B){
	long long v1=A.x/A.y,v2=B.x/B.y;
	if(v1<v2) return 1;
	else if(v1>v2) return 0;
	return (A.x%A.y)*B.y<(B.x%B.y)*A.y;
}
bool operator < (const node &A,const node &B){
	return A.A<B.A;
}
bool cmp(const node &A,const node &B){
	return A.B<B.B;
}
priority_queue<node> q;
void chkmax(val &A,val B){
	A=A<B?B:A;
}
long long gcd(long long x,long long y){
	long long r;
	while(y){
		r=x%y;
		x=y;
		y=r;
	}
	return x;
}
bool ccp(const node &A,const node &B){
	return A.B<B.B;
}
int main(){
//	freopen("D.in","r",stdin);
//	freopen("D.out","w",stdout);
	int n;
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
		scanf("%d%d",&a[i].A,&a[i].B);
	sort(a+1,a+n+1,cmp);
	long long tot=0,sum=0;
	int cnt=0;
	val ans,st;
	ans=0,st=0;
	for(int i=1;i<=n;i++)
		if(a[i].A<a[i].B)
			tot+=a[i].B-a[i].A;
	for(int i=1;i<=n;i++){
		while(sum>tot){
			sum-=(q.top()).A;
			cnt--;
			q.pop();
		}
		if(a[i].A<a[i].B){
			if(tot-sum>=a[i].B)
				st=cnt+1;
			else{
				st=(val){tot-sum,a[i].B};
				st=st+cnt;
			}
			chkmax(ans,st);
			tot-=a[i].B-a[i].A;
			while(sum>tot){
				sum-=(q.top()).A;
				cnt--;
				q.pop();
			}
		}
		if(a[i].A<=(tot-sum))
			st=cnt+1;
		else{
			st=(val){a[i].A-(tot-sum),a[i].B};
			if(st.x>st.y) st.x=0;
			else st.x=st.y-st.x;
			st=st+cnt;
		}
		chkmax(ans,st);
		q.push(a[i]);
		sum+=a[i].A;
		cnt++;
	}
	if(ans.x==0){
		printf("0 1\n");
		return 0;
	}
//	cerr<<3211685239.0/(5528829200/20)<<endl;
	ans.y*=n;
	long long r=gcd(ans.x,ans.y);
	ans.x/=r,ans.y/=r;
	printf("%lld %lld\n",ans.x,ans.y);
	return 0;
}


Measured memory_bytes: 2168
#include <iostream>
#include <sstream>
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <functional>

#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define REPS(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREPS(i,x) for(int i=((int)(x));i>0;i--)
#define all(x) (x).begin(),(x).end()

#ifdef LOCAL
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
#define eprintf(...) 42
#endif

typedef long long ll;

using namespace std;

ll N, M;

ll solve(){
    if(2 * N >= M){
        return M / 2;
    }else{
        return N + (M - 2 * N) / 4;
    }
}

int main() {
    // to shorten execution time for iostream
    cin.tie(0);
    ios::sync_with_stdio(false);

    cin >> N;
    cin >> M;

    cout << solve() << "\n";
    return 0;
}


Measured memory_bytes: 256
n,k = gets.chomp.split(' ').map(&:to_i)
trees = []
n.times do
  trees << gets.chomp.to_i
end
trees.sort!
min = 10000000000
for i in 0..(n-k) do
  tmp = (trees[i] - trees[i+k-1]).abs
  if (tmp < min)
    min = tmp
  end
end
puts min

Measured memory_bytes: 3704
#include <bits/stdc++.h>
using namespace std;
string s,data[9]={
    ".,!? ",
    "abc",
    "def",
    "ghi",
    "jkl",
    "mno",
    "pqrs",
    "tuv",
    "wxyz"
};
int n,i,p,t;
int main(){
	cin>>n;while(n--){
		cin>>s,t=1,p=s[0]-'0';
		for(i=1;i<s.length();i++){
			if(s[i]=='0'){if(p!=0)cout<<data[p-1][(t-1)%data[p-1].length()];i++,p=s[i]-'0',t=1;}else if(p==0)p=s[i]-'0';
			else t++;
		}cout<<endl;
	}
}

Measured memory_bytes: 3140
#include<bits/stdc++.h>
using namespace std;
     
#define int long long
#define hell 1000000007  
#define endl "\n"
#define io ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define MAX_SIZE 100002



int32_t main()
{   
    io
    
    int n;
    string s;
    cin>>n>>s;

    int dp[n+1][n+1];
    memset(dp, 0, sizeof(dp));

    int max_size=0;

    for(int i=0;i<=n;i++)
    {
        for(int j=0;j<=n;j++)
        {
            if(i==0 || j==0)
                dp[i][j]=0;

            else
            {
                if(s[i-1]==s[j-1] && j-i>dp[i-1][j-1])
                {
                    dp[i][j] = dp[i-1][j-1]+1;
                    max_size = max(max_size, dp[i][j]);
                }
            }

        }

    }

    cout<<max_size;

return 0;
}

Measured memory_bytes: 195712
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod=998244353;

ll factorial[1000001];
ll factorialinv[1000001];
ll calc(ll a,ll b,ll c){
  if(b==0)return 1;
  else if(b%2==0){
    ll d=calc(a,b/2,c);
    return d*d%c;
  }
  else {
    return a*calc(a,b-1,c)%c;
  }
}

int main(){
  ll n,a,b,k,count=0;
  cin >> n >> a >> b >> k;

  factorial[0]=1;
  factorialinv[0]=1;
  for(ll i=1;i<=n;i++){
    factorial[i]=factorial[i-1]*i%mod;
    factorialinv[i]=factorialinv[i-1]*calc(i,mod-2,mod)%mod;
  }
  for (ll i=0;i<=n;i++){
    ll j=(k-a*i)/b;
    if(j>n)continue;
    if (j>=0 && a*i+b*j==k) {
      long long int alpha=1,beta=1;
      alpha=factorial[n]*factorialinv[i]%mod*factorialinv[n-i]%mod;
      beta=factorial[n]*factorialinv[j]%mod*factorialinv[n-j]%mod;
      count=(count+alpha*beta%mod)%mod;
  }
}
cout << count << endl;
}

Measured memory_bytes: 8448
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>
// *テンプレート*
#define int long long
#define rep(i, n) for (int i = 0; i < (n); i++)
#define P pair<int, int>
#define sz(x) x.size()
// aよりbの方が小さかったら、aの値をbの値に置き換える。(swapではない！)
template<class T> inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
// aよりbの方が大きかったら、aの値をbの値に置き換える。
template<class T> inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}

using namespace std;
typedef long long ll;
using Graph = vector<vector<int>>;
//最大公約数
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	return gcd(b, a % b);
}
//最小公倍数
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
// 素数かどうか判定
bool prime(int n) {
	for (int i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}


const long long MOD = 1000000007;
const long long INF = 1LL << 60;
// *テンプレートここまで*

// pair -> vector<pair<int,int>> 
//		   AandB.push_back(make_pair(a[i],b[i]))

vector<int>to[200005];
vector<int>ans;

void dfs(int v, int p = -1) {
	for (int u : to[v]) {
		if (u == p)continue;
		ans[u] += ans[v];
		dfs(u, v);
	}
}

signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n, q; cin >> n >> q;

	rep(i, n - 1) {
		int a, b; cin >> a >> b; a--; b--;
		to[a].push_back(b); to[b].push_back(a);
	}
	ans.resize(n);
	rep(i, q) {
		int p, x; cin >> p >> x; p--;
		ans[p] += x;
	}
	dfs(0);
	rep(i, n) {
		cout << ans[i] << endl;
	}

	return 0;
}

Measured memory_bytes: 24320
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <utility>
#include <functional>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <climits>

using namespace std;

inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v;}
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str();}

typedef vector<int> vi;
typedef vector<vi>  vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;

#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n) FOR(i,0,n-1)

const double EPS = 1e-10;
const double PI = acos(-1.0);

int main() {
	int N, A, B, C;
	vi topping(0);

	cin >> N >> A >> B >> C;

	int tmp;
	REP(i, N) {
		cin >> tmp;
		topping.push_back(tmp);
	}

	sort(RALL(topping));

	double cal = C, cos = A;
	double ans = C/A;

	REP(i, N) {
		cal += topping[i];
		cos += B;

		if(ans < cal/cos) {
			ans = cal/cos;
		} else {
			break;
		}
	}

	cout << floor(ans) << endl;
}

Measured memory_bytes: 1292
#include<iostream>
using namespace std;
int main(){
  long long n, ans=0;
  cin >> n ;
  for(int i=0;i<=n;i++){
  	if(i%5!=0 && i%3!=0){
    	ans+=i;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3584
import math

A, B, H, M = map(int, input().rstrip().split())

rad_A = (2 * math.pi / 12) * (H + M / 60)
rad_B = (2 * math.pi / 60) * M

rad = abs(rad_A - rad_B)
rad = min(rad, 2*math.pi - rad)

c_2 = A**2 + B**2 - 2*A*B*math.cos(rad)
c = math.sqrt(c_2)

print(c)


Measured memory_bytes: 9452
#include<bits/stdc++.h>
#define X first
#define Y second
using namespace std;
const int inf = 1e9;

int n, bas, bel[100005], cc;
bool vis[100005];

vector<int> adj[100005], rev[100005], ind[10005], post;
vector<pair<int,int> > ord;

void addedge (int A, int B) {
	adj[A].push_back(B);
	rev[B].push_back(A);
}

void addedge (int A, int S, int E) {
	S += bas; E += bas;
	while(S<=E) {
		if(S%2==1) addedge(A, S++);
		if(E%2==0) addedge(A, E--);
		S>>=1; E>>=1;
	}
}

void dfs (int cur) {
	if(vis[cur]) return;
	vis[cur] = true;
	for(auto &nxt : adj[cur]) dfs(nxt);
	post.push_back(cur);
}

void rdfs (int cur) {
	if(!vis[cur]) return;
	bel[cur] = cc;
	vis[cur] = false;
	for(auto &nxt : rev[cur]) rdfs(nxt);
}

int getidx (int val) {
	return lower_bound(ord.begin(), ord.end(), make_pair(val, -inf)) - ord.begin();
}

bool can (int piv) {
	for(int i=1;i<2*bas;i++) {
		adj[i].clear();
		rev[i].clear();
	}
	for(int i=1;i<bas;i++) {
		addedge(i, 2*i);
		addedge(i, 2*i+1);
	}
	for(int i=1;i<=n;i++) {
		addedge(ind[i][1] + bas, getidx(ord[ind[i][0]].X-piv+1), ind[i][0]-1);
		addedge(ind[i][1] + bas, ind[i][0] + 1, getidx(ord[ind[i][0]].X+piv)-1);
		addedge(ind[i][0] + bas, getidx(ord[ind[i][1]].X-piv+1), ind[i][1]-1);
		addedge(ind[i][0] + bas, ind[i][1] + 1, getidx(ord[ind[i][1]].X+piv)-1);
	}
	post.clear(); cc = 0;
	for(int i=1; i<2*bas; i++) dfs(i);
	for(int i=2*bas-1; i--; ) {
		if(vis[post[i]]) {cc++; rdfs(post[i]);}
	}
	for(int i=1;i<=n;i++) {
		if(bel[ind[i][0]+bas] == bel[ind[i][1]+bas]) return false;
	}
	return true;
}

int main()
{
	scanf("%d",&n);
	for(bas = 1; bas <= 2*n; bas <<= 1);
	for(int i=1;i<=n;i++) {
		int A, B;
		scanf("%d%d",&A,&B);
		ord.push_back({A, i});
		ord.push_back({B, i});
	}
	sort(ord.begin(), ord.end());
	for(int i=0;i<ord.size();i++) {
		ind[ord[i].Y].push_back(i);
	}
	int S = 0, E = inf;
	while(S<E) {
		int mid = (1ll * S + E) / 2 + 1;
		can(mid) ? S = mid : E = mid-1;
	}
	printf("%d\n",S);
}


Measured memory_bytes: 21756
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int N;
    cin >> N;
    vector<int> apple(N);
    string ans = "second";
    for (int i = 0; i < N; i++){
        cin >> apple[i];
        if (apple[i]%2 == 1){
            ans = "first";
            break;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 640
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<string.h>
#include<math.h>
#include<map>
#include<iomanip>
#include<queue>

const long long INF = 1e17+7;
const long long MOD = 1e9+7;
const double PI=acos(-1);

using namespace std;

int main(){
	long long a;
	double b;
	cin >> a >> b;
	long long temp=(b*100)+0.5;
	long long ans=(a*temp)/100;
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3720
#include <iostream>
#include <cstdint>
#include <vector>

template <unsigned long long Mod>
class ModInt
{
    using u64 = unsigned long long;

public:
    u64 num;
    constexpr ModInt(const u64 x = 0) noexcept : num(x % Mod) {}
    constexpr u64 &value() noexcept { return num; }
    constexpr const u64 &value() const noexcept { return num; }
    constexpr ModInt operator+(const ModInt rhs) const noexcept
    {
        return ModInt(*this) += rhs;
    }
    constexpr ModInt operator-(const ModInt rhs) const noexcept
    {
        return ModInt(*this) -= rhs;
    }
    constexpr ModInt operator*(const ModInt rhs) const noexcept
    {
        return ModInt(*this) *= rhs;
    }
    constexpr ModInt operator/(const ModInt rhs) const noexcept
    {
        return ModInt(*this) /= rhs;
    }
    constexpr ModInt &operator+=(const ModInt rhs) noexcept
    {
        num += rhs.num;
        if (num >= Mod)
        {
            num -= Mod;
        }
        return *this;
    }
    constexpr ModInt &operator-=(const ModInt rhs) noexcept
    {
        if (num < rhs.num)
        {
            num += Mod;
        }
        num -= rhs.num;
        return *this;
    }
    constexpr ModInt &operator*=(const ModInt rhs) noexcept
    {
        num = num * rhs.num % Mod;
        return *this;
    }
    constexpr ModInt &operator/=(ModInt rhs) noexcept
    {
        u64 exp = Mod - 2;
        while (exp)
        {
            if (exp % 2)
            {
                *this *= rhs;
            }
            rhs *= rhs;
            exp /= 2;
        }
        return *this;
    }
    constexpr ModInt &operator=(const u64 num) noexcept
    {
        this->num = num % Mod;
        return *this;
    }

    constexpr ModInt pow(u64 k)
    {
        return pow(num, k);
    }

    static constexpr ModInt pow(ModInt x, u64 k)
    {
        if (k == 0)
            return 1;
        if (k % 2 == 0)
            return pow((x * x).num % Mod, k / 2);
        else
            return (x * pow(x, k - 1)).num % Mod;
    }
};

template <unsigned long long Mod>
std::ostream &operator<<(std::ostream &out, const ModInt<Mod> &m)
{
    out << m.num;
    return out;
}

template <unsigned long long Mod>
std::istream &operator>>(std::istream &in, ModInt<Mod> &m)
{
    in >> m.num;
    if (m.num >= Mod)
    {
        m.num %= Mod;
    }
    return in;
}

using namespace std;

static const int INF = 1e9 + 7;
int n, a, b;

ModInt<INF> getC(int a, int b)
{
    ModInt<INF> ans = 1;
    if (b > a / 2)
    {
        return getC(a, a - b);
    }
    ModInt<INF> div = 1;
    for (int i = 0; i < b; i++)
    {
        ans *= a - i;
        div *= i + 1;
    }
    ans *= ModInt<INF>::pow(div, INF - 2);
    return ans;
}

int main()
{
    cin >> n >> a >> b;
    ModInt<INF> ans = ModInt<INF>::pow(2, n) - 1;
    ModInt<INF> aC = getC(n, a), bC = getC(n, b);
    if (ans.num < aC.num)
    {
        ans.num += INF - aC.num;
        ans.num %= INF;
    }
    else
    {
        ans -= aC;
    }
    if (ans.num < bC.num)
    {
        ans.num += INF - bC.num;
        ans.num %= INF;
    }
    else
    {
        ans -= bC;
    }
    cout << ans << "\n";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define all(a) (a).begin(),(a).end()
using namespace std;

inline int ham(pair<int,int> a,pair<int,int>b){
    return abs(a.first - b.first) + abs(a.second-b.second) ;
}

signed main(){
    ios_base::sync_with_stdio(false);

    int n;
    cin >> n;

    vector<int>a,b;

    for(int i=0;i<n;i++){
        int u , v;
        cin >> u >> v;

        a.push_back(u-v);
        b.push_back(u+v);
    }


    sort(all(a));
    sort(all(b));

    cout << max( abs(b.back() - b[0]) , abs(a.back() - a[0] ))  << endl;
    return 0;
}


Measured memory_bytes: 6736
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "

int main(void){
    char  c;cin>>c;
    co(char(c+1));
}


Measured memory_bytes: 256
using System;

namespace AtCoder
{
    internal static class ProgramC
    {
        private class Solver
        {
            public void Solve()
            {
                int k = int.Parse(Console.ReadLine());

                long test = 0;
                long memo = 0;
                for (int i = 0;; ++i)
                {
                    test = test*10 + 7;
                    if (test < k) continue;

                    test = test%k;
                    if (test == 0)
                    {
                        Console.WriteLine(i + 1);
                        return;
                    }
                    if (memo == 0)
                    {
                        memo = test;
                        continue;
                    }
                    if (memo == test)
                    {
                        Console.WriteLine(-1);
                        return;
                    }
                }
            }

            private static void Main(string[] args)
            {
                new Solver().Solve();
            }
        }
    }
}

Measured memory_bytes: 27528
#include <stdio.h>

int main(){

	int a,b;
	char op;

	while(1){
        scanf("%d %c %d",&a,&op,&b);
        if(op == '?') break;
        
        switch(op)
        {
            case '+':
            printf("%d\n",a+b);
		    break;
            
            case '-':
		    printf("%d\n",a-b);
            break;
            
            case '/':
            printf("%d\n",a/b);
            break;
            
            case '*':
            printf("%d\n",a*b);
            break;
        }

    }

    return 0;
}


Measured memory_bytes: 2732
#include <stdio.h>

int main(void)
{
	int n, quantum, i;
	scanf("%d", &n);			// ??????????????°
	scanf("%d", &quantum);		// ???????????????

	char pname[100000][10];
	int ptime[100000];
	for (i=0; i<n; i++) {
		scanf("%s", &pname[i]);	// ???????????????
		scanf("%d", &ptime[i]);	// ????????????????????????
	}

	int time=0;					// ????????????
	int prev_time = time;		// ??????????????¨????????°
	while (1) {
		for (i=0; i<n; i++) {
			if (ptime[i]>0) {
				if (ptime[i]-quantum<=0) {
					time += ptime[i];
					ptime[i] = 0;
					printf("%s ", pname[i]);
					printf("%d\n", time);
				} else {
					ptime[i] -= quantum;
					time += quantum;
				}
			}
		}
		if (prev_time == time) return 0;
		prev_time = time;
	}

}

/*

from: http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_3_B&lang=jp

example:

5 100
p1 150
p2 80
p3 200
p4 350
p5 20

*/

Measured memory_bytes: 2372
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using product = pair<ll,ll>;
using graph = vector<vector<ll>>;
using vll = vector<ll>;

int main(){
    ll N;
    cin>>N;
    vll A(N);
    ll negative;
    ll mi=LLONG_MAX;
    ll res=0;
    for(ll i=0;i<N;i++)
    {
        cin>>A[i];
        if(A[i]<=0) negative++;
    }
    for(ll i=0;i<N;i++)
    {
        mi=min(abs(A[i]),mi);
        res+=abs(A[i]);
    }
    if(negative%2==0)cout<<res;
    else cout<<res-mi*2;
    return 0;
}

Measured memory_bytes: 4040
#include <bits/stdc++.h> 
using namespace std; 



int main(){
    string s;
    string t;
	cin>>s;
	cin>>t;
    int count=0;
    for(int i=0;i<3;i++){
        if(s[i]==t[i])
            count++;
    }
    cout<<count;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){
  int R[200000];
  int j,n;
  int maxv;
  int minv;
  scanf("%d",&n);
  for(j=0 ; j<n ; j++) scanf("%d",&R[j]);

  maxv = R[1] - R[0];
  minv = R[0];
  
  for(j=1 ; j<n ; j++){
    if(maxv < R[j]-minv) maxv = R[j] - minv;
    if(minv > R[j]) minv = R[j];
  }

  printf("%d\n",maxv);
  return 0;
}

Measured memory_bytes: 1376
#include <iostream>
#include <vector>
#include <algorithm>
#define rep(i, n) for(int i = 0; i < (int)(n); ++i)
#define REP(i, n) for(int i = 1; i < (int)(n); ++i)
using namespace std;

int main() {
    string S, T;
    cin >> S >> T;
    rep(i, 26) {
        string s = S;
        s.push_back('a' + i);
        if (s == T) {
            cout << "Yes\n";
            return 0;
        }
    }
    cout << "No\n";
    return 0;
}


Measured memory_bytes: 3604
#include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <utility>
#include <functional>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <deque>
 
using namespace std;
 
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define pb push_back
#define mp make_pair
#define all(r) r.begin(),r.end()
#define fi first
#define se second
#define println(X) cout<<X<<endl;
#define DBG(X) cout<<#X<<" : "<<X<<endl;
 
 
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<ll> vl;
typedef vector<vl> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int INF = 1e9;


int main(){
	int m, n;
	while(cin>>m&&m){
		vector<pii> v(m);
		int a, b;
		rep(i, m){
			cin>>v[i].fi>>v[i].se;
			if(i == 0) a = v[0].fi, b = v[0].se;
			v[i].fi-=a, v[i].se-=b;
		}
		cin>>n;
		pii p;
		set<pii> st;
		rep(i, n){
			cin>>p.fi>>p.se;
			p.fi-=a; p.se-=b;
			st.insert(p);
		}
		bool f;
		for(auto it = st.begin(); it != st.end(); it++){
			f=true;
			rep(i, m){
				if(st.count(pii(it->fi+v[i].fi, it->se+v[i].se))==0){
					f=false;
					break;
				}
			}
			if(f){
				cout<<it->fi<<" "<<it->se<<endl;
				break;
			}
		}
	}
}

Measured memory_bytes: 3140
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
const int INF = 1e9 + 100;
const lli INF64 = (1LL << 61) + 100;
const lli MOD = 1000*1000*1000+7;
lli bpow(lli a, lli b) {
	if(b == 0) return 1;
	if(b == 1) return a % MOD;
	lli r = bpow(a, b >> 1);
	r = (r * r) % MOD;
	return (r * (((b&1)?a:1) % MOD)) % MOD;
}
lli multInverse(lli a) {
	return bpow(a, MOD - 2);
}
lli modMult(lli a, lli b) {
	return (a * b) % MOD;
}
lli modSub(lli a, lli b) {
	a += MOD;
	lli r = a - b;
	if(r >= MOD) return r - MOD;
	return r;
}
lli modAdd(lli a, lli b) {
	lli r = a + b;
	if(r >= MOD) return r - MOD;
	return r;
}
signed main() {
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	//	freopen("input.txt", "r", stdin);
	//	freopen("output.txt", "w", stdout);
	lli a, b, c;
	cin >> a >> b >> c;
	if(c - b - a < 0) {
		cout << "No\n";
		return 0;
	}
	if(4*a*b < c*c + b*b + a*a - 2*b*c - 2*a*c + 2*a*b)
		cout << "Yes\n";
	else
		cout << "No\n";
	
	return 0;
}

Measured memory_bytes: 256
use std::io;
fn get_parms() -> Vec<i32> {
    let mut buf = String::new();
    io::stdin().read_line(&mut buf).expect("stdin error");
    return buf
        .split_whitespace()
        .map(|x| x.parse().expect("Parse failed"))
        .collect();
}

fn main() {
    let parms = get_parms();
    let (a, b) = (parms[0], parms[1]);
    if a > b {
        println!("a > b");
    } else if a == b {
        println!("a == b");
    } else {
        println!("a < b");
    }
}



Measured memory_bytes: 5028
#include <bits/stdc++.h>
using namespace std;

const double PI = acos(-1);
using ll = long long;
using ull = unsigned long long;
const int inf = 2e9;
const ll INF = 2e18;
const ll MOD = 1e9+7;
typedef pair<ll,int> P;

#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define REP(i,n) FOR(i,0,n)
#define sz(s) (s).size()
#define pb push_back
#define fi first
#define se second

ll n;
ll dp[65][3];

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);

  cin >> n;

  for (ll i = 60; i >= 0; i--) {
    if (n >> i) {
      dp[i][0] = 1LL;
      dp[i][1] = 1LL;
      break;
    }
  }

  for (int i = 61; i >= 1; i--) {
    if ((n>>i) == 0) continue;
    ll k = (n>>(i-1));
    for (ll a = 0; a < 2; a++) {
      ll aa = ((n>>i) - a) * 2LL;
      for (ll b = 0; b < 3; b++) {
        ll bb = aa + b;
        if (bb > k) continue;
        dp[i-1][min(2LL,k-bb)] += dp[i][a];
        dp[i-1][min(2LL,k-bb)] %= MOD;
      }
    }
    dp[i-1][2] += dp[i][2] * 3LL;
    dp[i-1][2] %= MOD;
  }

  cout << (dp[0][2] + dp[0][1] + dp[0][0]) % MOD << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i = (a); i < (b); i++)
using namespace std;

int main()
{
    int n; cin>>n;
    int x,p,cur,ans;
    cin>>p; cur=ans=0;
    FOR(i,1,n)
    {
        cin>>x;
        if(x<=p) cur++,ans=max(ans,cur);
        else cur=0;
        p=x;
    }
    cout<<ans<<'\n';

    return 0;
}

Measured memory_bytes: 256
n=int(input())
a=list(map(int,input().split()))

s=sum(a)

ans=[]

s1=0

for i in range(n):
  if i%2==1:
    s1+=a[i]
    
ans.append(str(s-s1*2))
for j in range(n-1):
  ans.append(str(a[j]*2-int(ans[-1])))
  
print(' '.join(ans))

Measured memory_bytes: 22052
//#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#define mem(a,b) memset(a,b,sizeof(a))
#define rep(i,a,n) for(int i=a; i<n; ++i)
#define rep1(i,a,n) for(int i=n-1; i>=a; --i)
#define sd(a) scanf("%d",&a)
#define sf(a) scanf("%lf",&a)
#define sll(a) scanf("%lld",&a)
#define test(a) cout<<a<<endl
#define test2(a,b) cout<<a<<" "<<b<<endl
#define inf(a) memset(a,0x3f,sizeof(a))
#define While(a) for(;a;)
#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
using namespace std;
typedef long long ll;
const int N=1e4+10;
const ll  MAXN=1e18;
const int MAX=1e5+10;
//const int mod=1e9+7;
const int inf=0x3f3f3f3f;
const ll INF=0x3f3f3f3f3f3f3f3f;
const double eps=1e-12;



inline void solve(){
    ll x,y;
    int ans=0;
    sll(x); sll(y);
    while(x<=y){
        x<<=1;
        ans++;
    }
    printf("%d\n",ans);
    return ;
}
//int t=1;
int main(){
#ifdef local
    freopen("in.txt","r",stdin);
//    freopen("out.txt","w",stdout);
#endif
    int casen=1;
//    IOS;
//    cin >> casen;
//    sd(casen);
//    init();
    int t=1;
//    init();
    While(casen--){
//        printf("Case %d: ",t++);
//          cout << "Case "<< t++ << ": ";
//        test(qpow(2,10));
        solve();
    }
    fclose(stdin);
//    fclose(stdout);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)

int main() {
	int R,G,B,N,r=0;
	cin >> R >> G >> B >> N;

	rep(i,N/R+1)
		rep(j,(N-R*i)/G+1)
			if((N-R*i-G*j)%B == 0)
				++r;
	cout << r << endl;

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main(){
  int A, B;
  cin >> A >> B;
  int x = A + B;
  int y = A - B;
  int z = A * B;
  cout << max(x, max(y,z)) << endl;
    
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

char *subString(char *str, int from, int length);

int main(){
	char s[10];
	char *str2;
	int num = 753;
	int x;
	int diff = (int)pow(10, 10);
	scanf("%s", s);

	for (int i = 0; i < strlen(s) - 2; i++){
         str2 = subString(s, i, 3);
         x = atoi(str2);
         if (pow(x-num, 2) < pow(diff, 2)){
         	if (x-num >= 0){
                diff = x - num;
         	}else{
         		diff = num - x;
         	}
         }
	}

	printf("%d\n", diff);

}

char *subString(char *str, int from, int length){
    char *str2;
    str2 = (char *)malloc(sizeof(char) * length);
    for (int i = 0; i < length; i++){
    	str2[i] = str[from + i];
    }
    
    return str2;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; ++i)
using namespace std;
typedef long long ll;

int asc(const void *a, const void *b) {
  return *(int *)a - *(int *)b;
}

int main() {
	string s;
	cin >> s;
	for(int i = 0; i < s.size(); i += 2) cout << s[i];
}

Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <iomanip>
#include <cstdio>
#include <set>
#include <map>
#include <list>
#include <cstdlib>
#include <queue>
#include <stack>

using namespace std;

#define MOD 1000000007
#define PI 3.1415926535897932
#define rep(i, n) for (int i = 0; i < n; i++)
#define repe(i, j, n) for (int i = j; i < n; i++)
#define repi(i, n) for (int i = 0; i <= n; i++)
#define repie(i, j, n) for (int i = j; i <= n; i++)
#define all(x) x.begin(), x.end()
#define println() cout << endl
#define P pair<int, int>
#define fi first
#define se second

typedef long long ll;

long long modinv(long long a, long long m)
{
    long long b = m, u = 1, v = 0;
    while (b)
    {
        long long t = a / b;
        a -= t * b;
        swap(a, b);
        u -= t * v;
        swap(u, v);
    }
    u %= m;
    if (u < 0)
        u += m;
    return u;
}

void solve1()
{
    int x; cin >> x;
    if(!x) {
        cout << 1 << endl;
    } else {
        cout << 0 << endl;
    }
}

int main()
{
    solve1();
}


Measured memory_bytes: 3592