akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <iostream>
#include <string>
#include <sstream>
#include <stack>
#include <algorithm>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <cstdlib>
#include <bitset>
#include <tuple>
#include <assert.h>
#include <deque>
#include <bitset>
#include <iomanip>
#include <limits>
#include <chrono>
#include <random>
#include <array>
#include <unordered_map>
#include <functional>
#include <complex>
#include <numeric>
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

constexpr long long MAX = 5100000;
constexpr long long INF = 1LL << 60;
constexpr int inf = 1 << 28;
constexpr long long mod = 1000000007LL;
//constexpr long long mod = 998244353LL;

using namespace std;
typedef unsigned long long ull;
typedef long long ll;

void solve() {
	ll T; scanf("%lld", &T); if (T == 0) exit(0);
	vector<ll> t(T); for (int i = 0; i < T; i++) scanf("%lld", &t[i]);
	ll N; scanf("%lld", &N);
	vector<ll> work(101, 24);
	for (int i = 0; i < N; i++) {
		ll d, m; scanf("%lld %lld", &d, &m);
		chmin(work[d], m);
	}
	vector<vector<ll>> dp(101, vector<ll>(T, INF));
	dp[0][0] = 0;
	for (int i = 1; i <= 100; i++) {
		for (int j = 0; j < T; j++) {
			if (work[i] >= t[j]) chmin(dp[i][(j + 1) % T], dp[i - 1][j]);
			chmin(dp[i][1 % T], dp[i - 1][j] + 1);
		}
	}
	cout << *min_element(dp[100].begin(), dp[100].end()) << "\n";
}

int main()
{
	/*
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	*/

	int kkt = 89;
	while (kkt) {
		solve();
	}
	return 0;
}


Measured memory_bytes: 3144
#include <stdio.h>
#include <stdlib.h>
int *G[100000];
int n, m;
int dist[100000];
int q[100000], head, tail;
void bfs(int st) {
	for (int i = 0; i < n; i++) {
		dist[i] = -1;
	}
	dist[st] = 0;
	head = tail = 0;
	q[tail] = st;
	tail++;
	while (head != tail) {
		// q[head] -> no ?
		for (int i = 0; G[q[head]][i] != -1; i++) {
			int no = G[q[head]][i];
			if (0 <= no && no < n && dist[no] == -1) {
				dist[no] = dist[q[head]] + 1;
				q[tail] = no;
				tail++;
			}
		}
		head++;
	}
}
int main() {
	int cnts[100000] = {0}, pos[100000] = {0};
	int a[200000] = {0}, b[200000] = {0};
	scanf("%d%d", &n, &m);
	for (int i = 0; i < m; i++) {
		scanf("%d%d", &a[i], &b[i]);
		a[i]--;
		b[i]--;
		cnts[a[i]]++;
		cnts[b[i]]++;
	}
	for (int i = 0; i < n; i++) {
		G[i] = malloc(sizeof(int) * (cnts[i] + 1));
		if (G[i] == NULL) {
			return -1;
		}
	}
	for (int i = 0; i < m; i++) {
		G[a[i]][pos[a[i]]] = b[i];
		pos[a[i]]++;
		G[b[i]][pos[b[i]]] = a[i];
		pos[b[i]]++;
	}
	for (int i = 0; i < n; i++) {
		G[i][pos[i]] = -1;
	}
	bfs(0);
	printf("Yes\n");
	for (int i = 1; i < n; i++) {
		for (int j = 0; G[i][j] != -1; j++) {
			if (dist[G[i][j]] - dist[i] == -1) {
				printf("%d\n", G[i][j] + 1);
				break;
			}
		}
	}
	for (int i = 0; i < n; i++) {
		free(G[i]);
	}
	return 0;
}


Measured memory_bytes: 9036
#include<iostream>
#include<vector>
#include<algorithm>
#include<utility>
using namespace std;
typedef long long L;
typedef pair<L,L> P;

int main() {
	int n, m;
	while (cin >> n >> m) {
		if (n == 0 && m == 0)break;

		vector<P>v;
		long long sum = 0;
		for (int i = 0;i < n;i++) {
			long long a, b;
			cin >> a >> b;
			v.push_back(make_pair(a,b));
			sum += a*b;
		}

		L p[11] = {};
		for (int i = 0;i < n;i++) {
			p[v[i].second ] += v[i].first;
		}
		
		for (int i = 10;i > -1;i--) {
			if (0 < m) {
				if (m >= p[i])sum -= p[i] * i;
				else sum -= m*i;

				m -= p[i];
			}
		}
		
		if (sum < 0)sum = 0;
		cout <<sum << endl;
	}
	return 0;
}

Measured memory_bytes: 3340
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>

using namespace std;

int X;
long double x=0.0, y=0.0;
long double PI = 3.14159265358979;
int main(void) {

	cin >> X;

	int K = 0;

	while (1) {
		x += cos(X*PI / 180.0*K); y += sin(X*PI / 180.0*K);
		//cout << x<< " " << y<< endl;

		K++;
		
		if (abs(x) < 0.00001 && abs(y) < 0.00001) { break; }
	}

	cout << K << endl;

	return 0;
}

Measured memory_bytes: 4020
#include<stdio.h>
int main(){
  int a,b,c,d,e;
  scanf("%d%d%d",&a,&b,&c);
  d = a<b?b-a:a-b;
  e = a<c?c-a:a-c;
  printf(d<e?"A":"B");
  return 0;} 

Measured memory_bytes: 128
// https://atcoder.jp/contests/abc083/tasks/abc083_a
#include <bits/stdc++.h>
using namespace std;

int main(void){
  int A,B,C,D;
  cin >> A >> B >> C >> D;
  int L = A + B;
  int R = C + D;

  if(L>R)
    cout << "Left" << endl;
  else if (L<R)
    cout << "Right" << endl;
  else
    cout << "Balanced" << endl;
}

Measured memory_bytes: 256
S = input()
S_a = int(S[0] + S[1])
S_b = int(S[2] + S[3])
if((S_a >= 1 and S_a <= 12) and (S_b < 1 or S_b > 12)):
  print('MMYY')
elif((S_a < 1 or S_a > 12) and (S_b >= 1 and S_b <= 12)):
  print('YYMM')
elif((S_a >= 1 and S_a <= 12) and (S_b >= 1 and S_b <= 12)):
  print('AMBIGUOUS')
else:
  print('NA')

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

using namespace std;

int evaluate_expression(string expression);

int do_operation(char opt, int m, int n);

bool isOperator(char c);

bool isdigit(char c);

int main() {
    string exp;
    getline(cin, exp);
    int res = evaluate_expression(exp);
    printf("%d\n", res);
    return 0;
}

int evaluate_expression(string exp){
    stack<int>con;

    for(int i =0; i< exp.length(); i++){
        if(exp[i] == ' ') continue;
        else if(isOperator(exp[i])){
            int num2 = con.top(); con.pop();
            int num1 = con.top(); con.pop();

            int res = do_operation(exp[i], num1, num2);
            con.push(res);
        }
        else if(isdigit(exp[i])){
            int num = 0;
            while(i<exp.length() && isdigit(exp[i])){
                num = (num*10)+(exp[i]-'0');
                i++;
            }
            i--;
            con.push(num);
        }
    }
    return con.top();
}

bool isdigit(char c){
    if(c >= '0' && c<= '9') return true;
    return false;
}

bool isOperator(char c){
    if(c == '+' || c == '-' || c == '*' || c == '/') return true;
	return false;
}

int do_operation(char opt, int m, int n)
{
	if(opt == '+') return m +n;
	else if(opt == '-') return m - n;
	else if(opt == '*') return m * n;
	else if(opt == '/') return m / n;
	return -1;
}







Measured memory_bytes: 3336
import java.util.HashMap;
import java.util.Scanner;

public class Main {
	static Scanner sc = new Scanner(System.in);
	static int N, Q;
	static HashMap<Long, Integer> map = new HashMap<Long, Integer>(100000);

	public static void main(String[] args) {
		StringBuilder sb = new StringBuilder();
		int[] A = new int[100000];
		while (true) {
			N = Integer.parseInt(sc.next());
			if (N == 0) break;
			int S = Integer.parseInt(sc.next());
			int W = Integer.parseInt(sc.next());
			Q = Integer.parseInt(sc.next());
			int g = S;
			for (int i = 0; i < N; ++i) {
				A[i] = (g / 7) % 10;
				if (g % 2 == 0) {
					g = g / 2;
				} else {
					g = (g / 2) ^ W;
				}
			}
			sb.append(solve(A) + "\n");
		}
		System.out.print(sb);
	}

	static long solve(int[] A) {
		long ans = 0;
		if (Q == 2 || Q == 5) {
			int nonzero = 0;
			for (int i = 0; i < N; ++i) {
				if (A[i] != 0) ++nonzero;
				if (A[i] % Q == 0) {
					ans += nonzero;
				}
			}
			return ans;
		}
		map.clear();
		long sum = 0;
		long base = 1;
		for (int i = 0; i < N; ++i) {
			sum += A[N - 1 - i] * base;
			sum %= Q;
			base *= 10;
			base %= Q;
			Integer ci = map.get(sum);
			int c = ci == null ? 0 : ci.intValue();
			if (A[N - 1 - i] != 0) {
				ans += c;
				if (sum == 0) ans++;
			}
			map.put(sum, c + 1);
		}
		return ans;
	}

}

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


int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N, left=0, right=0, min=INF;
  cin >> N;
  vector<int> V(N);
  REP(i,N) {
    cin >> V[i];
    right+=V[i];
  }
  REP(i,N) {
    left+=V[i];
    right-=V[i];
    if(abs(right-left)<=min) min=abs(right-left);
  }
  cout << min << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <map>
using namespace std;

int main(int argc, const char * argv[]) {
    int N;
    cin >> N;
    
    map<std::string,int> gacha;
    for (int i = 0; i < N; i++) {
        string s;
        cin >> s;
        auto itr = gacha.find(s);
        if( itr == gacha.end() ) {
            // 設定されていない場合の処理
            gacha[s] = 1;
        }
    }
    
    cout << gacha.size() << endl;
    return 0;
}


Measured memory_bytes: 19156
def main():
    N = int(input())
    ans = []
    if N % 2 == 0:
        for i in range(1, N+1):
            for j in range(i+1, N+1):
                if i+j != N+1:
                    ans.append((i, j))
    else:
        for i in range(1, N+1):
            for j in range(i+1, N+1):
                if i+j != N:
                    ans.append((i, j))
    print(len(ans))
    for a in ans:
        print(*a)


if __name__ == '__main__':
    main()


Measured memory_bytes: 42736
#include <algorithm>
#include <cstdio>
#define LL long long
struct node{
	int u,v;
	LL w;
}g[400005];
int n,m,fa[200005],num;
LL d[200005],tot;
void add(int x,int y,int z)
{
	g[++num].u=x;  g[num].v=y;  g[num].w=z;
	return;
}
LL min(LL x,LL y)
{
	return x<y?x:y;
}
bool cmp(node x,node y)
{
	return x.w<y.w;
}
int find(int x)
{
	if (fa[x]==x) return x;
	return fa[x]=find(fa[x]);
}
void Kruskal()
{
	int i,j,k,fu,fv,cnt;
	for (i=0;i<n;i++)
	  fa[i]=i;
	std::sort(g+1,g+num+1,cmp);
	for (i=1;i<=num;i++)
	{
		fu=find(g[i].u);
		fv=find(g[i].v);
		if (fu!=fv)
		{
			fa[fv]=fu;
			//cnt++;
			tot+=g[i].w;
			//if (cnt==n-1) return;
		}
	}  
	return;
}
int main()
{
	int i,j,k,x,y;
	LL z;
	scanf("%d%d",&n,&m);
	for (i=0;i<n;i++)
	  d[i]=1e18;
	for (i=1;i<=m;i++)
	{
		scanf("%d%d%lld",&x,&y,&z);
		add(x,y,z);
		if (z+1<d[x]) d[x]=z+1;
		if (z+2<d[y]) d[y]=z+2;
	}
	for (k=1;k<=2;k++)
	  for (i=0;i<n;i++)
	    d[i]=min(d[i],d[(i+n-1)%n]+2);
	for (i=0;i<n;i++)
	  add(i,(i+1)%n,d[i]);
	Kruskal();  
//	printf("%d\n",num);  
	printf("%lld",tot);
	return 0;      
}

Measured memory_bytes: 8704
#include<iostream>
#include<cmath>
#include<cstdlib>
#include<string>
#include<cstring>
#include<algorithm>
#include<vector>
#include<map>
#include<iomanip>
#include<queue>

using namespace std;

typedef long long ll;

typedef std::pair<int, int> ipair;
bool lessPair(const ipair& l, const ipair& r){return l.second < r.second;}
bool morePair(const ipair& l, const ipair& r){return l.second > r.second;}

template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

const ll MOD = 1e9 + 7;
// const long long INF = 1LL<<60;
void add(long long &a, long long b) { a += b; if (a >= MOD) a -= MOD; }
void sub(long long &a, long long b) { a -= b; if (a < 0) a += MOD; }
void mul(long long &a, long long b) { a *= b; a %= MOD; }
ll llmin(ll a, ll b) { if (a < b) return a; else return b; }
ll llmax(ll a, ll b) { if (a < b) return b; else return a; }
ll llabs(ll a) { if (a >= 0) return a; else return - a; }
ll llmodpow(ll a, ll n) {
   if (n == 0) return 1;
   ll tmp = llmodpow(a, n / 2);
   mul(tmp, tmp);
   if (n & 1) mul(tmp, a);
   return tmp;
}

int main() {
   string s;
   cin >> s;
   int a = -1, z = -1;
   for (int i = 0; i < (int)s.size(); i++) {
      if (a == -1 && s[i] == 'A') a = i;
      if (s[i] == 'Z') z = i;
   }
   cout << z - a + 1 << endl;
   return 0;
}


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

using namespace std;

void hawawa()
{
  int a[3];
  for (auto&& i : a) {
    cin >> i;
  }
  int ans = 0;
  sort(begin(a), end(a));
  while (a[0] != a[2]) {
    if (a[1] == a[2]) {
      a[0] += 2;
    }
    else {
      a[0]++;
      a[1]++;
    }
    sort(begin(a), end(a));
    ans++;
  }
  cout << ans << "\n";
}

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define ff first
#define ss second
typedef long long ll;
ll power(ll a, ll b){//a^b
    ll res=1;
    a=a%MOD;
    while(b>0){
        if(b&1){res=(res*a)%MOD;b--;}
        a=(a*a)%MOD;
        b>>=1;
    }
    return res;
}
ll fermat_inv(ll y){return power(y,MOD-2);}
ll gcd(ll a, ll b){return (b==0)?a:gcd(b,a%b);}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll t=1;
    //cin>>t;
    while(t--){
        int n,x,t;
        cin>>n>>x>>t;
        int val=(n/x);
        if(n%x!=0)
            val++;
        cout<<(val*t)<<"\n";
    }
    return 0;
}

Measured memory_bytes: 3644
s = input()
t = input()

ans = "UNRESTORABLE"

for i in range(len(s)-len(t)+1):

    for j in range(len(t)):
        isRestorable = True
        if not s[j+i] == t[j] and not s[j+i] == "?":
            isRestorable = False
            break
            
    if isRestorable:
        ans = s[0:i] + t + s[i+len(t):len(s)]
        ans = ans.replace("?", "a")
        
print(ans)

Measured memory_bytes: 38384
#include <algorithm>
#include <cmath>
#include <iostream>
#include <vector>

int main() {
  std::string S, T;
  std::cin >> S >> T;

  uint32_t count = 0;
  for (size_t i = 0; i < S.size(); i++){
    if(S[i] != T[i]) count++;
  }
  
  std::cout << count << std::endl;

  return 0;
}

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

const ll MOD = 1e9+7;
ll mpow(ll m,ll n){
    if(n == 0){
        return 1;
    }
    if(n%2==1){
        return mpow(m,(n-1)/2)*mpow(m,(n-1)/2)%MOD*m%MOD;
    }else{
        return mpow(m,n/2)*mpow(m,n/2)%MOD;
    }
}

int main() {
    ll m,n;
    std::cin >> m>>n;
    std::cout << mpow(m,n) << std::endl;
}



Measured memory_bytes: 3104
s = [1 if i in ["A", "C", "G", "T"] else 0 for i in input()]
r = [0]
c = 0
for i, si in enumerate(s):
    if si == 1:
        c += 1
    if si == 0 or i == len(s) - 1:
        if c != 0:
            r.append(c)
            c = 0
print(max(r))

Measured memory_bytes: 3060
import java.awt.Point;
import java.io.FileInputStream;
import java.io.PrintStream;
import java.util.ArrayList;
import java.util.Scanner;
 
public class Main {
     
    static int a, b, n;
	
    private static int[] primetable(int max)
    {
    	int[] ret = new int[max + 1];
    	int loop;
    	
    	for (int i = 0; i < max + 1; i++) ret[i] = 1;
    	ret[0] = ret[1] = 0;
    	loop = (int)(Math.sqrt(max) + 1);
    	
    	for (int i = 2; i <= loop; i++) {
			if (ret[i] == 0) {
				continue;
			}
			for (int j = i*2; j < max+1; j+=i) {
				ret[j] = 0;
			}
		}
    	return ret;
    }
    
    static void start()
    {
    	int[] prime = primetable(1000000);
    	
    	int count = 0;
    	while (true) {
			if(prime[a] == 1) count++;
			if(n == count)
			{
				System.out.println(a);
				return;
			}
			a += b;
		}
    }
     
    public static void main(String[] args)
    {
        Scanner sca = new Scanner(System.in);
        
        while(true)
        {
        	a = sca.nextInt();
        	b = sca.nextInt();
        	n = sca.nextInt();
        	if(n == 0) break;
            
            start();
        }
        
    }
}

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

#define INF 1.1e9
#define LINF 1.1e18
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define BIT(x,n) bitset<n>(x)
#define PI 3.14159265358979323846

typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> PP;

struct edge {
	int to, cost;
	edge(int t,int c):to(t),cost(c) {}
};


//-----------------------------------------------------------------------------

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

	int a[3];REP(i,3) cin>>a[i];
	sort(a,a+3);
	if(a[0]==a[1]&&a[0]==5&&a[2]==7) cout<<"YES"<<endl;
	else cout<<"NO"<<endl;

	return 0;
}


Measured memory_bytes: 256
#include <cstring>
#include <map>
#include <unordered_map>
#include <string>
#include <list>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <cstdio>
#include <iostream>
#include <set>
#include <unordered_set>
using namespace std;

#define MAX(a,b) (a>b?a:b)
#define MIN(a,b) (a<b?a:b)
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef pair<int, int> pii;

int gi() {
    int a;
    scanf("%d", &a);
    return a;
}

ll gli() {
    ll a;
#ifndef ONLINE_JUDGE
    scanf("%lld", &a);
#else
    scanf("%I64d", &a);
#endif
    return a;
}

int gcd(int a, int b) {
    return (b == 0 ? a : gcd(b, a%b));
}

int main() {
    int n = gi();
    int r = gi();
    for (int i = 1; i < n; i++)
        r = gcd(r, gi());

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

    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++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define itn int

typedef long long ll;
typedef pair<ll,ll> p;


int main()
{
  ll x;
  cin >> x;
  ll tmp = x % 11;
  ll ans = (x / 11) * 2;
  if(tmp > 0 && tmp <= 6) ans++;
  else if(tmp > 0) ans += 2;
  cout << ans << endl;

}

Measured memory_bytes: 256
from collections import deque

DLL = deque()

n = int(input())
for _ in range(n):
    command = input()
    if command == 'deleteFirst':
        DLL.popleft()
    elif command == 'deleteLast':
        DLL.pop()
    else:
        command, x = command.split()
        if command == 'insert':
            DLL.appendleft(x)
        elif command == 'delete':
            try:
                DLL.remove(x)
            except ValueError:
                pass
            
print(' '.join(DLL))


Measured memory_bytes: 69736
#include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int H,W;
string S[303];

int R[2003][2003];
int L[2003][2003];


void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>H>>W;
	FOR(y,H) cin>>S[y];
	FOR(y,2000) FOR(x,2000) {
		if(y&&x) R[y][x]=R[y-1][x-1];
		if(y) L[y][x]=L[y-1][x+1];
		if(y-700>=0 && y-700<H && x-700>=0 && x-700<W) {
			R[y][x]+=S[y-700][x-700]=='#';
			L[y][x]+=S[y-700][x-700]=='#';
		}
		
	}
	
	ll ret=0;
	FOR(y,H) FOR(x,W) {
		for(l=1;l<=300;l++) {
			int num[11]={};
			if(y-l>=0) num[8]=S[y-l][x]=='#';
			if(y+l<H) num[2]=S[y+l][x]=='#';
			if(x-l>=0) num[4]=S[y][x-l]=='#';
			if(x+l<W) num[6]=S[y][x+l]=='#';
			num[7]=L[y+700][x-l+700]-L[y-l+700][x+700]-num[4];
			num[3]=L[y+l+700][x+700]-L[y+700][x+l+700]-num[2];
			num[9]=R[y+700][x+l+700]-R[y-l+700][x+700]-num[6];
			num[1]=R[y+l+700][x+700]-R[y+700][x-l+700]-num[2];
			ll p=ret;
			ret+=num[2]*(num[6]*num[8]+num[4]*num[8]+num[4]*num[6]);
			ret+=num[4]*num[6]*num[8];
			ret+=num[1]*num[6]*num[8];
			ret+=num[3]*num[4]*num[8];
			ret+=num[9]*num[2]*num[4];
			ret+=num[7]*num[2]*num[6];
		}
	}
	
	cout<<ret<<endl;
	
	
	
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


Measured memory_bytes: 31744
C = input()

alfa = {'a': 'b', 'b': 'c', 'c': 'd', 'd': 'e', 'e': 'f', 'f': 'g', 'g': 'h', 'h': 'i', 'i': 'j', 'j': 'k', 'k': 'l', 'l': 'm',
        'm': 'n', 'n': 'o', 'o': 'p', 'p': 'q', 'q': 'r', 'r': 's', 's': 't', 't': 'u', 'u': 'v', 'v': 'w', 'w': 'x', 'x': 'y', 'y': 'z'}
print(alfa[C])


Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <string>

using namespace std;
int main()
{
    int n, m, x;
    cin >> n >> m >> x;

    vector<vector<int32_t>> a;
    vector<int32_t> c(n);

    a.resize(n);
    for(int i=0; i<n; i++)
    {
        cin >> c[i];
        a[i].resize(m);
        for(int j=0; j<m; j++)
        {
            cin >> a[i][j];
        }
    }

    // cout << total << endl;
    // bit 全探索

    int ans = 0;
    int min_cost = 10000001;
    int ini_cost = min_cost;

    for (int r = 0; r < (1 << n); r++)
    {
        int sum_cost = 0;
        vector<int> sum(m);
        for (int i =0; i<n; i++)
        {
            if((r >> i) & 1)
            {
                sum_cost += c[i];
                for(int j =0; j<m; j++)
                {
                    sum[j] += a[i][j];

                }
            }
        }

        bool success = true;
        for(int j=0; j<m; j++)
        {
            if(sum[j] < x)
            {
                success = false;
                break;
            }
        }

        if(success && min_cost > sum_cost)
        {
            min_cost = sum_cost;
        }

    }

    if(min_cost != ini_cost)
    {
        cout << min_cost << endl;
    }
    else {
        cout << -1 << endl;
    }
    return 0;
}

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

int main() {
  int a, b;
  cin >> a >> b;
  string A, B;
  for( int i = 0; i < b; i++ )
    A += to_string(a);
  for( int i = 0; i < a; i++ )
    B += to_string(b);

  if( A <= B )
    cout << A << endl;
  else
    cout << B << endl;  
  return 0;
}

Measured memory_bytes: 256
import java.util.*;
 
public class Main {
	public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.next());
        sc.close();

        int[][] c = new int[10][10];
        
        for(int i = 1; i <= N; i++){
            int head, tail, tmpi = i;
            head = tail = tmpi % 10;
            while(tmpi > 0){
                head = tmpi % 10;
                tmpi /= 10;
            }
            c[head][tail]++;
        }

        long ans = 0L;
        for(int i = 1; i < 10; i++){
            for(int j = 1; j < 10; j++){
                ans += c[i][j] * c[j][i];
            }
        }

        System.out.println(ans);
    }
}

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

int main(){
	int N, i, j, ans = 0;
	scanf("%d", &N);
	vector<int> d(N);
	for(i = 0; i < N; i++){
		scanf("%d", &d[i]);
	}
	for(i = 0; i < N; i++){
		for(j = i + 1; j < N; j++){
			ans += d[i] * d[j];
		}
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define y1 zzz
#define fi first
#define se second
#define PII pair<int,int>
#define PII2 pair<int,PII >
#define PII3 pair<PII,int >
#define PII4 pair<PII,PII >
#define all(x) (x).begin(),(x).end()
#define pb push_back
int n,f[100010][2],ok[100010],mod=1e9+7;
vector<int> adj[100010];
void dfs(int u)
{
    ok[u]=1;
    f[u][0]=f[u][1]=1;
    for(int v:adj[u])
    {
        if(!ok[v])
        {
            dfs(v);
            f[u][0]*=(f[v][0]+f[v][1]);
            f[u][1]*=f[v][0];
            f[u][0]%=mod;
            f[u][1]%=mod;
        }
    }
}
void solve()
{
    cin>>n;
    for(int i=0;i<n-1;i++)
    {
        int u,v;
        cin>>u>>v;
        adj[u].pb(v);
        adj[v].pb(u);
    }
    dfs(1);
    cout<<(f[1][0]+f[1][1])%mod;
}
int32_t main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    //freopen("XORQUERY.inp","r",stdin);
    //freopen("XORQUERY.out","w",stdout);
    //int t;cin>>t;while(t--)
    solve();
    return 0;
}


Measured memory_bytes: 12288
#include<stdio.h>
#include<iostream>
#include<string>
#include<vector>
#include<math.h>


#define CI cin >>
#define CO cout <<
#define E << endl;

using namespace std;

int main(void) {
	double a, b = 0;
	double result[1000000];
	int check = 0;
	string op;
	for (int i = 0; i < 1000000;++i) {
		CI a >> op >> b;

		if (op == "?") {
			check = i;
			break;
		}
		if (op == "+") {
			result[i] = a + b;
		}
		if (op == "-") {
			result[i] = a - b;
		}
		if (op == "*") {
			result[i] = a * b;
		}
		if (op == "/") {
			result[i] = (int)(a / b);
		}
	}
	for (int i = 0; i < check;++i) {
		CO (int)result[i] E
	}
}

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

int main() {
  int a, b;
  cin >> a >> b;

  string A;
  string B;

  rep(i, b) {
    A += to_string(a);
  }
  rep(i, a) {
    B += to_string(b);
  }
  if (A > B) {
    cout << B << endl;
  } else {
    cout << A << endl;
  } 

  return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main{
    public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
        
        int A1 = sc.nextInt();
        int A2 = sc.nextInt();
        int A3 = sc.nextInt();
        
        int sum = A1 + A2 + A3;
        
        if(sum>21){
        	System.out.println("bust");
        }else{
        	System.out.println("win");
        }
    }
}

Measured memory_bytes: 21844
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.LinkedList;
import java.util.PriorityQueue;
import java.util.TreeSet;
 
 
 
public class Main {
  public static void main(String[] args) {
    InputReader sc = new InputReader(System.in);
 
    int[] ns = new int[1000001];
    TreeSet<Integer> memory = new TreeSet<Integer>();
    ns[1] = sc.nextInt();
    memory.add(ns[1]);
    for(int i = 2; i <= 1000001; i++){
      if(ns[i-1] % 2 == 1){
        ns[i] = ns[i-1] * 3 + 1;
      }else{
        ns[i] = ns[i-1] / 2;
      }
      if(memory.contains(ns[i])){
        System.out.println(i);
        break;
      }else{
        memory.add(ns[i]);
      }
    }

 
  }
 
 //ここからテンプレ
  static class InputReader {
      private InputStream stream;
      private byte[] buf = new byte[1024];
      private int curChar;
      private int numChars;
      private SpaceCharFilter filter;
 
      public InputReader(InputStream stream) {
          this.stream = stream;
      }
 
      public int next() {
          if (numChars == -1)
              throw new InputMismatchException();
          if (curChar >= numChars) {
              curChar = 0;
              try {
                  numChars = stream.read(buf);
              } catch (IOException e) {
                  throw new InputMismatchException();
              }
              if (numChars <= 0)
                  return -1;
          }
          return buf[curChar++];
      }
 
      public String nextStr() {
        int c = next();
        while(isSpaceChar(c)){c = next();}
        StringBuffer str = new StringBuffer();
        do{
          str.append((char)c);
          c = next();
        }while(!isSpaceChar(c));
        return str.toString();
      }
 
      public char nextChar() {
        int c = next();
        while(isSpaceChar(c)){c = next();}
        char ret;
        do{
          ret = (char)c;
          c = next();
        }while(!isSpaceChar(c));
        return ret;
      }
 
      public int nextInt() {
          int c = next();
          while (isSpaceChar(c))
              c = next();
          int sgn = 1;
          if (c == '-') {
              sgn = -1;
              c = next();
          }
          int res = 0;
          do {
              if (c < '0' || c > '9')
                  throw new InputMismatchException();
              res *= 10;
              res += c - '0';
              c = next();
          } while (!isSpaceChar(c));
          return res * sgn;
      }
 
      public boolean isSpaceChar(int c) {
          if (filter != null)
              return filter.isSpaceChar(c);
          return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
      }
 
      public interface SpaceCharFilter {
          public boolean isSpaceChar(int ch);
      }
  }
}

Measured memory_bytes: 26708
#include<iostream>
using namespace std;
int main()
{
    int n;
    cin>>n;
    for(int i=1;i<=9;++i)
    {
        for(int j=1;j<=9;++j)
        {
            if(i*j==n)
            {
                cout<<"Yes"<<endl;
                return 0;
            }
        }
    }
    cout<<"No"<<endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int array[] = {1,1,1,2,1,2,1,5,2,2,1,5,1,2,1,14,1,5,1,5,2,2,1,15,2,2,5,4,1,4,1,51};

		int a = sc.nextInt() - 1 ;

		System.out.println(array[a]);

	}
}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
using P = pair<ll, ll>;
using mat = vector<vector<ll>>;

inline void IOS() { ios::sync_with_stdio(false), cin.tie(0); }

template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
	fill((T *)array, (T *)(array + N), val);
}

const ll INF = 1e16;
const ll MOD = 1e9 + 7;
//int dx[4] = {1,0,-1,0};
//int dy[4] = {0,1,0,-1};
//ll pas[5001][5002];
ll dp[114514][3];
ll a[114514][3];
signed main(){
	IOS();
	ll n;
	cin >> n;
	for (int i = 0;i < n;++i) {
		for (int j = 0;j < 3;++j) {
			cin >> a[i][j];
		}
	}

	Fill(dp, 0);
	for (int i = 0;i < 3;++i) {
		dp[0][i] = a[0][i];
	}
	for (int i = 1;i < n;++i) {
		for(int j = 0;j < 3;++j) {
			if(j == 0)dp[i][j] = max(dp[i - 1][1], dp[i - 1][2]) + a[i][0];
			if(j == 1)dp[i][j] = max(dp[i - 1][0], dp[i - 1][2]) + a[i][1];
			if(j == 2)dp[i][j] = max(dp[i - 1][1], dp[i - 1][0]) + a[i][2];
		}
	}
	ll ans = 0;
	for (int i = 0;i < 3;++i) {
		ans = max(ans, dp[n - 1][i]);
	}
	cout << ans << endl;
	
}

Measured memory_bytes: 5632
#B-754
S = gets.chomp.split('').map(&:to_i)
ans = 643
target = 753
for i in 0..S.length-3 do
    if (S[i]*100+S[i+1]*10+S[i+2] - target).abs < ans
        ans = (S[i]*100+S[i+1]*10+S[i+2] - target).abs
    end
end
puts ans

Measured memory_bytes: 1788
#include <stdio.h>
int main(){
  int n,a[100],i,j,cnt=0,array,flag=1;
  scanf("%d",&n);
  for(i=0;i<n;i++)scanf("%d",&a[i]);
  while(flag){
    flag=0;
    for(j=n-1;j>0;j--){
      if(a[j]<a[j-1]){
	array=a[j];
	a[j]=a[j-1];
	a[j-1]=array;
	cnt++;
	flag=1;
      }
    }
  }
  for(i=0;i<n;i++){
    printf("%d",a[i]);
    if(i!=n-1)printf(" ");
  }
  printf("\n%d\n",cnt);
  return 0;
}



Measured memory_bytes: 2756
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
//#include<bits/stdc++.h>
#include<cstdio>
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) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

const int cm = 1 << 17;
char cn[cm], * ci = cn + cm, ct;
inline char getcha() {
	if (ci - cn == cm) { fread_unlocked(cn, 1, cm, stdin); ci = cn; }
	return *ci++;
}
inline int getint() {
	int A = 0;
	int pn = 1;
	if (ci - cn + 16 > cm) {
		if ((ct = getcha()) == '-') { pn = -1; ct = getcha(); }
		A = ct - '0';
		while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';;
		return pn * A;
	}
	else {
		if ((ct = *ci++) == '-') { pn = -1; ct = *ci++; }
		A = ct - '0';
		while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';;
		return pn * A;
	}
}
void pakuri_sort(int N, int A[]) {
	const int b = 8;
	int tmp[200001];
	rep(k, 4) {
		int kazu[1 << b] = {}, kazu2[1 << b] = {};
		rep(i, N) kazu[A[i] >> k * b & ((1 << b) - 1)]++;
		rep(i, (1 << b) - 1) kazu[i + 1] += kazu[i];
		for (int i = N - 1; i >= 0; i--) tmp[--kazu[A[i] >> k * b & ((1 << b) - 1)]] = A[i];
		k++;
		rep(i, N) kazu2[tmp[i] >> k * b & ((1 << b) - 1)]++;
		rep(i, (1 << b) - 1) kazu2[i + 1] += kazu2[i];
		for (int i = N - 1; i >= 0; i--) A[--kazu2[tmp[i] >> k * b & ((1 << b) - 1)]] = tmp[i];
	}
}

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


	int N = getint();
	ll K = 0;
	while ((ct = *ci++) >= '0') K = K * 10 + ct - '0';

	int A[200000];
	int *sei = A, *fu = A + 199999;
	int zero = 0;
	rep(i, N) {
		int a = getint();
		if (a > 0) *sei++ = a;
		else if (a < 0) *fu-- = -a;
		else zero++;
	}
	int seik = sei - A;
	int fuk = A + 199999 - fu;
	sei = A;
	fu++;
	pakuri_sort(seik, sei);
	pakuri_sort(fuk, fu);
	ll k0 = ll(seik) * fuk + ll(zero) * (zero - 1) / 2 + ll(zero) * (N - zero);

	ll L = -1000000000000000001, R = 1000000000000000000;
	while (L + 1 < R) {
		ll M = (L + R) / 2;
		ll k = 0;
		if (M >= 0) {
			k += k0;
			if (k >= K) { R = M; continue; }
			int i = 0;
			int j = seik - 1;
			while (i < seik) {
				while (j > i && ll(sei[i]) * sei[j] > M) j--;
				if (i == j) break;
				k += j - i;
				i++;
			}
			if (k >= K) { R = M; continue; }
			i = 0;
			j = fuk - 1;
			while (i < fuk) {
				while (j > i && ll(fu[i]) * fu[j] > M) j--;
				if (i == j) break;
				k += j - i;
				i++;
			}
		}
		else {
			int j = 0;
			rep(i, seik) {
				while (j < fuk && ll(sei[i]) * fu[fuk - j - 1] >= -M) j++;
				k += j;
			}
		}
		if (k >= K) R = M;
		else L = M;
	}

	printf("%lld\n", R);

	Would you please return 0;
}

Measured memory_bytes: 1664
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

const int MAX_N = 60;

int main(int argc, char const *argv[])
{
	int n, a[MAX_N];
	vector<pair<int, int> > pos, neg, ans;
	cin >> n;
	for (int i = 0; i < n; ++i) {
		cin >> a[i];
		if (a[i]<0) neg.push_back(make_pair(a[i], i));
		else pos.push_back(make_pair(a[i], i));
	}
	sort(neg.begin(), neg.end());
	sort(pos.begin(), pos.end());

	if (neg.size()==0) {
		for (int i = 1; i < n; ++i) {
			if (a[i-1]>a[i]) {
				a[i]+=a[i-1];
				ans.push_back(make_pair(i-1, i));
			}
			else continue;
		}
	}
	else if (pos.size()==0) {
		for (int i = n-2; i >= 0; --i) {
			if (a[i+1]<a[i]) {
				a[i] += a[i+1];
				ans.push_back(make_pair(i+1, i));
			}
			else continue;
		}
	}
	else if (-1*neg[0].first > pos[pos.size()-1].first) {
		for (int i = 0; i < n; ++i) {
			a[i] += neg[0].first;
			ans.push_back(make_pair(neg[0].second, i));
		}
		for (int i = n-2; i >= 0; --i) {
			if (a[i+1]<a[i]) {
				a[i] += a[i+1];
				ans.push_back(make_pair(i+1, i));
			}
			else continue;
		}
	}
	else {
		for (int i = 0; i < n; ++i) {
			a[i]+=pos[pos.size()-1].first;
			ans.push_back(make_pair(pos[pos.size()-1].second, i));
		}
		for (int i = 1; i < n; ++i) {
			if (a[i-1]>a[i]) {
				a[i]+=a[i-1];
				ans.push_back(make_pair(i-1, i));
			}
			else continue;
		}
	}

	cout << ans.size() << endl;
	for (int i = 0; i < ans.size(); ++i) {
		cout << ans[i].first+1 << ' ' << ans[i].second+1 << endl;
	}
	return 0;
}

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

#define int long long

signed main() {
  string s;
  while ( cin >> s, s != "#" ) {
    reverse(s.begin(), s.end());
    int a = 0, n = 0, d = 1;
    int p = 0;
    while ( p < (int)s.size() ) {
      if ( s[p] == 'h' ) {
	if ( d > 1 ) {
	  n *= 2;
	  n -= 90;
	}
	d *= 2;
	p += 5;
      } else {
	if ( d > 1 ) {
	  n *= 2;
	  n += 90;
	} else {
	  n = 90;
	}
	d *= 2;	
	p += 4;	
      }
    }

    d /= 2;
    int g = __gcd(n, d);    
    if ( d/g == 1 ) cout << n/g << endl;
    else cout << n/g << '/' << d/g << endl;
  }
  
  return 0;
}



Measured memory_bytes: 3188
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <algorithm>
using namespace std;

template <typename Tp> inline void getint(Tp &num){
	register int ch, neg = 0;
	while(!isdigit(ch = getchar())) if(ch == '-') neg = 1;
	num = ch & 15;
	while(isdigit(ch = getchar())) num = num * 10 + (ch & 15);
	if(neg) num = -num;
}

int cnt = 0;
char S[18];

int main(){
	scanf("%s", S);
	for(register char *it = S; *it != '\0'; it++) if(*it == 'x') cnt++;
	return puts(cnt <= 7 ? "YES" : "NO"), 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, e) for(int (i) = 0; (i) < (e); ++(i))
#define FOR(i, b, e) for(int (i) = (b); (i) < (e); ++(i))
#define ALL(c) (c).begin(), (c).end()
#define PRINT(x) cout << (x) << "\n"
using namespace std;
using ll = long long; using pint = pair<int, int>; using pll = pair<ll, ll>;
template<typename T> auto compare = [](T x, T y) -> bool{return (x < y);};
const int MOD = 1000000007;

ll N;
ll A[200010];

signed main(){
    cin >> N;
    REP(i, N) cin >> A[i];
    map<ll, ll> mp;
    ll ans = 0;
    for(ll i = 0; i < N; i++){
        ans += mp[i - A[i]];
        mp[i + A[i]]++;
    }
    PRINT(ans);
    return 0;
}

Measured memory_bytes: 27880
#include <iostream>
#include <bitset>
#include <vector>
#include <string>
using namespace std;
using ll = long long int;
const ll MOD = 1e9 + 7;

ll power(ll n, ll k)
{
    ll ret = 1;
    if (k == 0)
    {
        return ret;
    }
    for (ll _ = 0; _ < k; _++)
    {
        ret *= n;
        ret %= MOD;
    }
    return ret;
}

int main()
{
    ll N;
    cin >> N;
    vector<bitset<60>> A(N);

    for (ll i = 0; i < N; i++)
    {
        ll ai;
        cin >> ai;
        A[i] = bitset<60>(ai);
    }

    vector<ll> bits(60, 0);
    for (ll i = 0; i < N; i++)
    {
        for (ll j = 0; j < 60; j++)
        {
            bits[j] += A[i][j];
        }
    }

    ll ans = 0;
    for (ll i = 0; i < 60; i++)
    {
        ll sum = bits[i] * (N - bits[i]);

        sum %= MOD;
        sum *= power(2, i);
        sum %= MOD;

        ans += sum;
        ans %= MOD;
    }
    cout << ans << endl;
}

Measured memory_bytes: 2560
<?php

$n = trim(fgets(STDIN));

$nums = [
    1,
    2,
    3,
    4,
    5,
    6,
    7,
    8,
    9,
];

$result = false;
foreach ($nums as $num) {
    if (in_array($n / $num, $nums)) {
        $result = true;
        break;
    }
}

echo $result ? 'Yes' : 'No';


Measured memory_bytes: 4604
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <cstdio>
#include <string>
#include <cmath>
#include <queue>
#include <tuple>
//#include <bits/stdc++.h>
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repr(i, n) for (int i = (n) - 1; i >= 0; i--)
#define FOR(i,i0,n) for(int (i)=(i0);(i)<(n);(i)++)
#define FORR(i,i0,n) for(int (i)=(n)-1; (i)>=(i0);(i)--)
#define SORT(x) sort(x.begin(),x.end())
#define rn return
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
typedef std::pair<int,int> P;
using namespace std;
using ll = long long;


int main(){
    string s;
    cin >> s;
    if (s[2] == s[3] && s[4] == s[5]){
        cout << "Yes";
    }
    else cout << "No";
}


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

using Square = std::vector<std::vector<int>>;

Square init_square(int width, int height) {
        Square square;
        square.resize(width);
        for (auto &block: square) {
                block.resize(height);
                for (int j = 0; j < height; j++) {
                        block[j] = 0;
                }
        }
        return square;
}

void paint(Square &square, int width, int height) {
        int x = 0;
        int y = 0;
        int a = 0;
        while (std::cin >> x && std::cin >> y && std::cin >> a) {
                switch (a) {
                case 1:
                        for (int i = 0; i <= x - 1; i++) {
                                for (int j = 0; j < height; j++) {
                                        square[i][j] = 1;
                                }
                        }
                        break;
                case 2:
                        for (int k = width - 1; k >= x; k--) {
                                for (int l = 0; l < height; l++) {
                                        square[k][l] = 1;
                                }
                        }
                        break;
                case 3:
                        for (int m = 0; m < width; m++) {
                                for (int n = 0; n < y; n++) {
                                        square[m][n] = 1;
                                }
                        }
                        break;
                case 4:
                        for (int o = 0; o < width; o++) {
                                for (int p = height - 1; p >= y; p--) {
                                        square[o][p] = 1;
                                }
                        }
                        break;
                }
        }
}

int calc_white(Square const &square) {
        int result = 0;
        for (auto &block: square) {
                for (int i = 0; i < block.size(); i++) {
                        if (block[i] == 0) {
                                result++;
                        }
                }
        }
        return result;
}


int main(int argc, char *argv[]) {
        int width = 0;
        int height = 0;
        int num_of_point = 0;

        std::cin >> width;
        std::cin >> height;
        std::cin >> num_of_point;

        Square square(init_square(width, height));

        paint(square, width, height);

        std::cout << calc_white(square) << std::endl;
        return 0;
}

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

int main() {
    int x, n;
    cin >> x >> n;
    vector<bool> p(101);
    for (int i = 0; i < n; i++) {
        int a;
        cin >> a;
        p.at(a) = true;
    }

    int ans = 101;
    for (int i = 100; i >= 1; i--) {
        if (!p.at(i)) {
            if (abs(x - i) <= abs(ans - x)) {
                ans = i;
            }
        }
    }
    
    if (abs(0 - x) <= abs(ans - x)) {
        ans = 0;
    }

    cout << ans << endl;


}

Measured memory_bytes: 3624
#include<stdio.h>

int main(){
	int num[100];
	int i,j,k;
	int ch;
	int cnt = 0;
	int n;


while(scanf("%d",&n),n){
	for(i = 0; i < n; i++)
			scanf("%d",&num[i]);
	
	for(j = 0; j < n-1; j++){
		for(k = 0; k < n-1-j; k++){
			if(num[k] > num[k+1]){
				ch = num[k];
				num[k] = num[k+1];
				num[k+1] = ch;
				cnt++;
			}
		}
	}
	
		printf("%d\n",cnt);
		cnt = 0;
	}

	return 0;
}

Measured memory_bytes: 1028
#include<iostream>
using namespace std;
int a[105];
int main()
{
	int m,n,num=0,sum=0;
	cin>>n>>m;
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
		sum += a[i];
	}
	double x;
	x = double(sum)/(4*m);
	for (int i=0;i<n;i++)
		if(a[i]>=x) num += 1;
	if (num>=m) cout<<"Yes"; else cout<<"No";
} 

Measured memory_bytes: 256
mod = 10**9 + 7
def add(a,b):#mod下の加算
    return (a+b)%mod

N,K = [int(i) for i in input().split()]
S = [int(i) for i in input().split()]
T = [int(i) for i in input().split()]
Slen = len(S);Tlen=len(T)
DP = [[0 for j in range(Tlen)] for i in range(Slen)]#DP[i][j]は、Sのi文字目、Tのj文字目までで一致する部分和
DP[0][0] = 1 + (S[0] == T[0])
for i,s in enumerate(S):
    for j,t in enumerate(T):
        if i==0 and j==0:continue
        if s == t:
            if i==0:
                DP[i][j]=DP[i][j-1]+1
            elif j==0:
                DP[i][j]=DP[i-1][j]+1
            else:
                DP[i][j]=(DP[i-1][j]+ DP[i][j-1])%mod
        else:
            if i==0:
                DP[i][j]=DP[i][j-1]
            if j==0:
                DP[i][j]=DP[i-1][j]
            else:
                DP[i][j]=(DP[i-1][j] + DP[i][j-1] - DP[i-1][j-1])%mod
print(DP[Slen-1][Tlen-1]%mod)
            

Measured memory_bytes: 75228
#![allow(non_snake_case)]
#![allow(unused_variables)]
#![allow(dead_code)]

fn main() {
    let R: i64 = {
        let mut line: String = String::new();
        std::io::stdin().read_line(&mut line).unwrap();
        line.trim().parse().unwrap()
    };
    let G: i64 = {
        let mut line: String = String::new();
        std::io::stdin().read_line(&mut line).unwrap();
        line.trim().parse().unwrap()
    };

    let ans = 2 * G - R;

    println!("{}", ans);
}


Measured memory_bytes: 4352
#include <iostream>
#include <climits>
#include <stack>
#include <queue>
#include <string>
#include <random>
#include <utility>
#include <cmath>
#include <string.h>
#include <iomanip>
#include <stdlib.h>
#include <algorithm>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
long long int INF = 1e18;
double Pi = 3.141592653589;
const int mod = 1000000007;
// memset(a,0,sizeof(a)); →全部０にする
 
struct edge{int to,cost;};
vector<int> G[100005];
 
int dx[8]={1,0,-1,0,1,1,-1,-1};
int dy[8]={0,1,0,-1,1,-1,-1,1};
 
std::vector<P> tree[100010];
ll i,j;

ll n,m,ans=0;
ll a,b,c,k,num=0;
ll d[500005];

int main(){
	cin>>n>>a>>b;
	memset(d,0,sizeof(d));
	c = a*b;
	if((a+b>n+1) || (a*b<n)){
		cout<<-1;
	}else if(a!=1){
		d[1]=b;
		n-=b;

		for(i=2;i<=a;i++){
			d[i]=n/(a-1);
		}
		for(i=2;i<=1+n%(a-1);i++){
			d[i]++;
		}
		for(i=1;i<=a;i++){
			num += d[i];
			for(j=1;j<=d[i];j++){
				printf("%d ",num-j+1);
			}
		}
	}else{
		for(i=n;i>=1;i--){
			printf("%d ",i);
		}
	}
	cout<<endl;
	return 0;
}

Measured memory_bytes: 10752
#include <iostream>
using namespace std;

int main(void){
	int l;
	while(cin>>l,l){
		int ans = -1;
		for(int i=0;i<12;i++){
			int n,m;
			cin>>m>>n;
			l -= m - n;
			if(ans == -1 && l <= 0) ans = i + 1;
		}

		if(ans == -1) cout<<"NA\n";
		else cout<<ans<<endl;
	}

	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using PII = pair<ll, ll>;
#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
template<typename T> void chmin(T &a, const T &b) { a = min(a, b); }
template<typename T> void chmax(T &a, const T &b) { a = max(a, b); }
struct FastIO {FastIO() { cin.tie(0); ios::sync_with_stdio(0); }}fastiofastio;
#ifdef DEBUG_ 
#include "../program_contest_library/memo/dump.hpp"
#else
#define dump(...)
#endif
const ll INF = 1LL<<60;

using int128 = __int128_t;
using uint128 = __uint128_t;
ostream &operator<<(ostream &os, int128 value) {
    ostream::sentry s(os);
    if (s) {
        uint128 tmp = value < 0 ? -value : value;
        char buffer[128];
        char *d = end(buffer);
        do {
            --d;
            *d = "0123456789"[tmp % 10];
            tmp /= 10;
        } while (tmp != 0);
        if (value < 0) --d, *d = '-';
        int len = end(buffer) - d;
        if (os.rdbuf()->sputn(d, len) != len) {
            os.setstate(ios_base::badbit);
        }
    }
    return os;
}
istream &operator>>(istream &is, int128 &val) {
    string s; is >> s;
    val = 0;
    REP(i, s.size()) if ('0' <= s[i] && s[i] <= '9') {
        val = 10 * val + s[i] - '0';
    }
    return is;
}

int main(void) {
    int128 t1, t2, a1, a2, b1, b2;
    cin >> t1 >> t2 >> a1 >> a2 >> b1 >> b2;

    auto naive = [&] {
        int128 p = (a1-b1)*t1, q = (a2-b2)*t2;
        if(p > 0) p *= -1, q *= -1;

        if(p + q < 0) return (int128)0;
        if(p + q == 0) return (int128)-1;

        int128 x = (-p) / (p+q);
        int128 r = (-p) % (p+q);
        return x*2 + !!r;
    };

    auto solve = [&] {
        auto check = [&](int128 mid) {
            int128 nowx = (mid+1)/2*t1*a1 + mid/2*t2*a2;
            int128 nowy = (mid+1)/2*t1*b1 + mid/2*t2*b2;
            int128 prex = mid/2*t1*a1 + (mid-1)/2*t2*a2;
            int128 prey = mid/2*t1*b1 + (mid-1)/2*t2*b2;

            bool iscross = false;
            iscross |= prex < prey && prey <= nowx && prex <= nowy && nowy <= nowx;
            iscross |= prey < prex && prex <= nowy && prey <= nowx && nowx <= nowy;
            return iscross;
        };

        if((a1-b1)*t1 + (a2-b2)*t2 == 0) return (int128)-1;

        int128 lb = 1, ub = 1e22;
        if(check(ub)) return (int128)-1;
        while(ub-lb > 1) {
            int128 mid = (lb+ub)/2;
            if(check(mid)) lb = mid;
            else ub = mid;
        }
        return lb-1;
    };

    ll ret = solve();
    if(ret == -1) cout << "infinity" << endl;
    else cout << ret << endl;

    // REP(loop, 100000) {
    //     t1 = rand() % 100 + 1, t2 = rand() % 100 + 1;
    //     a1 = rand() % 100 + 1, a2 = rand() % 100 + 1;
    //     b1 = rand() % 100 + 1, b2 = rand() % 100 + 1;

    //     ll nans = naive();
    //     ll ans = solve();

    //     if(ans != nans) {
    //         dump(ans, nans);
    //         dump(t1, t2, a1, a2, b1, b2);
    //     }
    // }

    return 0;
}

Measured memory_bytes: 256