akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std; int a, b, c, i, n;
int main(){
    while(true){
        n=0;
        cin>>a>>b>>c;
        if(!a){
            break;
        }
        while(n<c){
            if(a<2){
                goto E;
            }
            for(i=2; i*i<=a;i++){
                if (a%i==0){
                    goto E;
                }
            }
            n++;
        E:;
            a+=b;
        }
        printf("%d\n",a-b);
    }
}

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

int main(){
    int n;
    string S;
    cin >> n >> S;
    int match = 0;
    rep(k, 2, n){
        multiset<char> left, right, intersection;
        // left
        rep(i, 0, k){
            left.insert(S.at(i));
        }
        rep(i, k, n){
            right.insert(S.at(i));
        }
        set_intersection(left.begin(), left.end(),
                         right.begin(), right.end(),
                         inserter(intersection, intersection.end()));
        set<char> i;
        for(auto itr = intersection.begin(); itr != intersection.end(); ++itr) {
            i.insert(*itr);
        }
        int num_match = i.size();
        if (num_match > match) match = num_match;
        // printf("k=%d match=%d\n", k, num_match);        
    }
    cout << match << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
   
int main(){
    string x;
    while (cin >> x){
        if (x == "0") break;
        long s = 0;
        for (long i = 0; i < x.size(); i++) s += x[i] - '0';
        cout << s << endl;
    }
    return 0;
}

Measured memory_bytes: 1188
#include "bits/stdc++.h"
using namespace std;
long long Count[13];
char Name[13];

void PreProcess(){
    Count[0] = 0LL;
    Count[1] = 26LL;

    for( int i = 2 ; i <= 11 ; ++i )
        Count[i] = Count[i - 1] * 26;
}

int FindNameLength( long long N ){
    int i , length;
    long long Cur = 0LL;

    for( i = 1 ; i <= 11 ; ++i ){
        Cur = Cur + Count[i];
        if( Cur >= N ){
            length = i;
            break;
        } 
    }

    return length;
}

void FindCharsName( long long Rem , int index , int length ){
    if( index == length - 1 ){
        Name[index] = 'a' + ( Rem - 1LL );
        return;
    }

    long long Cur = 0LL;

    for( int i = 0 ; i < 26 ; ++i ){
        Cur += Count[length - index - 1];
        
        if( Cur >= Rem ){
            Cur -= Count[length - index - 1];
            Name[index] = 'a' + i;
            FindCharsName( Rem - Cur , index + 1 , length );
            break;
        }
    }
}

void FindName( long long N ){
    int i , length = FindNameLength( N );
    long long Sum = 0LL;

    for( i = 1 ; i < length ; ++i )
        Sum += Count[i];

    // cout << "fu1 " << length << " " << Sum << endl;
    FindCharsName( N - Sum , 0 , length );
    Name[length] = '\0';
}

int main(){
    long long N;
    scanf( "%lld" , &N );
    PreProcess();
    FindName( N );
    printf( "%s\n" , Name );
    return 0;
}

Measured memory_bytes: 3756
import java.util.*;
public class Main{
	public static void main(String args[]){
		Scanner gio = new Scanner(System.in);
		char[] alice = gio.nextLine().toCharArray();
		char[] bob = gio.nextLine().toCharArray();
		char[] charlie = gio.nextLine().toCharArray();
		int currentPlayer = 0;//0 == alice, 1 == bob, 2 == charlie
		char winner = 0;
		while(true){
			if(currentPlayer == 0){
				//loop through alice's deck
				boolean mayLaman = false;
				for(int q = 0; q < alice.length; q++){
					if(alice[q] != 0){
						mayLaman = true;
						if(alice[q] == 'a'){
							currentPlayer = 0;
						}
						else if(alice[q] == 'b'){
							currentPlayer = 1;
						}
						else if(alice[q] == 'c'){
							currentPlayer = 2;
						}
						else{
							System.out.println("wtf?");
						}
						alice[q] = 0;
						break;
					}
				}
				if(!mayLaman){
					winner = 'A';
					break;
				}
			}
			else if(currentPlayer == 1){
				//loop through bob's deck
				boolean mayLaman = false;
				for(int q = 0; q < bob.length; q++){
					if(bob[q] != 0){
						mayLaman = true;
						if(bob[q] == 'a'){
							currentPlayer = 0;
						}
						else if(bob[q] == 'b'){
							currentPlayer = 1;
						}
						else if(bob[q] == 'c'){
							currentPlayer = 2;
						}
						else{
							System.out.println("wtf?");
						}
						bob[q] = 0;
						break;
					}
				}
				if(!mayLaman){
					winner = 'B';
					break;
				}
			}
			else if(currentPlayer == 2){
				//loop through charlie's deck
				boolean mayLaman = false;
				for(int q = 0; q < charlie.length; q++){
					if(charlie[q] != 0){
						mayLaman = true;
						if(charlie[q] == 'a'){
							currentPlayer = 0;
						}
						else if(charlie[q] == 'b'){
							currentPlayer = 1;
						}
						else if(charlie[q] == 'c'){
							currentPlayer = 2;
						}
						else{
							System.out.println("wtf?");
						}
						charlie[q] = 0;
						break;
					}
				}
				if(!mayLaman){
					winner = 'C';
					break;
				}
			}
		}
		System.out.println(winner);
	}
}

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

int main() {
	int A[9];
	for (int i = 0; i < 9; i++) cin >> A[i];
	int N;
	cin >> N;
	for (int i = 0; i < N; i++) {
		int b;
		cin >> b;
		for (int j = 0; j < 9; j++) if (A[j] == b) A[j] = 0;
	}
	if (A[0] + A[1] + A[2] == 0 ||
		A[3] + A[4] + A[5] == 0 ||
		A[6] + A[7] + A[8] == 0 ||
		A[0] + A[3] + A[6] == 0 ||
		A[1] + A[4] + A[7] == 0 ||
		A[2] + A[5] + A[8] == 0 ||
		A[0] + A[4] + A[8] == 0 ||
		A[2] + A[4] + A[6] == 0) cout << "Yes" << endl;
	else cout << "No" << endl;

}

Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;
class Program
{
  static void Main(string[] args)
  {
    int[] input = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
    int N = input[0];
    int A = input[1];

    int[] x = new int[] { 0 };
    x = x.Concat(Console.ReadLine().Split(' ').Select(int.Parse)).ToArray();

    long[,,] dp = new long[N + 1, N + 1, N * A + 1];

    for (int i = 0; i < N; ++i) dp[i, 0, 0] = 1;

    for (int i = 1; i <= N; ++i)
    {
      for (int j = 1; j <= i; ++j)
      {
        for (int k = 1; k <= N * A; ++k)
        {
          if (k < x[i])
          {
            dp[i, j, k] = dp[i - 1, j, k];
          }
          else
          {
            dp[i, j, k] = dp[i - 1, j, k] + dp[i - 1, j - 1, k - x[i]];
          }
        }
      }
    }

    long ans = 0;
    for (int j = 1; j <= N; ++j)
    {
      ans += dp[N, j, j * A];
    }

    Console.WriteLine(ans);
  }
}


Measured memory_bytes: 60256
#include"bits/stdc++.h"
#define rep(i,n) for(ll i=0;i<n;++i)
#define ALL(x) x.begin(),x.end()
#define MOD 1000000007
#define INF INT_MAX

using namespace std;
typedef long long ll;

template<typename T>
T gcd(T a, T b) {
    if (a % b == 0) {
        return(b);
    }
    else {
        return(gcd(b, a % b));
    }
}

template<typename T>
T lcm(T a, T b) {
    return a / gcd(a, b) * b;
}


int main(void) {
    int k;
    cin>>k;
    rep(i,k){
        cout<<"ACL";
    }
}


/*

*/

Measured memory_bytes: 3620
import sys
sys.setrecursionlimit(100000)
#ノードの数,橋の数
N,M = map(int, input().split())

#最初は自分自身が親（根）
par = [i for i in range(N+1)]
#ランク(深さ）
rank = [0]*(N+1)
#各要素が属するグループのサイズ（連結成分の個数）
size = [1]*(N+1)

#木の根を求める
def root(x):
    if par[x] == x:  #自分が親のときは自分が根ということ
        return x
    else:
        #経路圧縮
        par[x] = root(par[x])#自分が親ではないときは，根を自分の親に設定
        return par[x]

#xとyが同じ集合（連結成分）に属するかどうか
def same(x, y):
    return root(x) == root(y)

#xとyの属する集合を併合
def unite(x,y):
    xx = root(x)
    yy = root(y)
    #xとyのルートが同じなので操作は必要ない（同じ集合に属する）
    if xx == yy:
        return
    ####ランクあり
    #if rank[xx] < rank[yy]:
    #    par[xx] = yy
    #    size[yy] += size[xx]
    #else:
    #    par[yy] = xx
    #    size[xx] += size[yy]
    #    if rank[xx] == rank[yy]:
    #        rank[yy] += 1

    ####ランクなし
    ###
    ### #ｘとyのrootが異なるので,xの親をyのrootに設定
    par[xx] = yy
    size[yy] += size[xx]

#出力する不便度
ans = [0]*M
#すべての橋が壊れているときの不満度はN個の島から2個の島の選び方の総数と等しい
ans[M-1] = N*(N-1)//2

#橋の情報
B = [list(map(int,input().split())) for i in range(M)]

#橋の情報を逆順に取り出す
for i in range(M-1,0,-1):
    a = B[i][0]
    b = B[i][1]
    if root(a) != root(b):
        ans[i-1] = ans[i] -size[root(a)]*size[root(b)]
    else:
        ans[i-1] = ans[i]
    #橋をつなげる
    unite(a,b)

for a in ans:
    print(a)


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

using namespace std;

int main() {
  int n;cin>>n;
  for(int i=0;i<=25;i++){
    for(int j=0;j<=15;j++){
      if(4*i+7*j==n){
        cout<<"Yes"<<endl;
        return 0;
      }
    }
  }
  cout<<"No"<<endl;
}

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

#define ALL(v) (v).begin(), (v).end()
#define rep(i, n) for (ll i = 0, __##i##_length = (n); i < __##i##_length; i++)
#define rep_reverse(i, n) for (ll i = (n)-1; 0 <= i; i--)
#define FOR(i, from, to) for (ll i = (from), __##i##_end = (to); i < __##i##_end; i++)
#define FOR_REVERSE(i, from, to) for (ll i = (to)-1, __##i##_end = (from); __##i##_end <= i; i--)
#define foreach(e, v) for (const auto e : (v))
#define vfree(v) std::vector<int>().swap(v)
#define DEBUG(x) cout << #x << " = " << (x) << endl

using namespace std;
typedef int64_t ll;
typedef vector<ll> llv;
typedef vector<llv> llvv;
constexpr ll ll_max = numeric_limits<ll>::max();

void dfs(vector<llvv>& G, llv& mindist, ll x)
{
  rep(i, G[x].size())
  {
    llv t = G[x][i];
    if (mindist[t[0]] != -1)
      continue;
    ll a = mindist[x];
    ll b = t[1];
    mindist[t[0]] = a + b;
    dfs(G, mindist, t[0]);
  }
}

int main()
{
  ll N, Q, K;
  cin >> N;
  vector<llvv> G(N);

  rep(i, N - 1)
  {
    ll a, b, c;
    cin >> a >> b >> c;
    G[a - 1].push_back(llv({b - 1, c}));
    G[b - 1].push_back(llv({a - 1, c}));
  }

  llv mindist(N, -1);
  cin >> Q >> K;
  mindist[K - 1] = 0;

  dfs(G, mindist, K - 1);

  rep(i, Q)
  {
    ll x, y;
    cin >> x >> y;
    cout << mindist[x-1] + mindist[y-1] << endl;
  }

  return 0;
}


Measured memory_bytes: 28416
#include<stdio.h>
int main(){

int i,j,H,W;
while(1){scanf("%d %d",&H,&W);
         if(H==0 && W==0)break;

         for(i=1;i<=H;i++){
             for(j=1;j<=W;j++){
                 printf("#");}
             printf("\n");
           }
        printf("\n"); }

return 0;
    }



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

using namespace std;

using ll = long long;
constexpr ll MOD = 998244353;

ll Solve() {
    string s;
    cin >> s;

    const int n = s.size();
    vector<int> b(2 * n + 1), r(2 * n + 1);
    for (int i = 1; i <= n; ++i) {
        if (s[i - 1] == '0') r[i] = 2;
        else if (s[i - 1] == '2') b[i] = 2;
        else { ++r[i]; ++b[i]; }
    }
    for (int i = 1; i <= 2 * n; ++i) {
        r[i] += r[i - 1];
        b[i] += b[i - 1];
    }

    vector<vector<ll>> dp(2 * n + 1, vector<ll>(r[2 * n] + 1));
    dp[0][0] = 1;
    for (int i = 1; i <= 2 * n; ++i) {
        for (int j = max(0, i - b[i]); j <= r[i] && 0 <= i - j; ++j) {
            if (0 < j) (dp[i][j] += dp[i - 1][j - 1]) %= MOD;
            (dp[i][j] += dp[i - 1][j]) %= MOD;
        }
    }
    return dp[2 * n][r[2 * n]];
}

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

    cout << Solve() << endl;

    return 0;
}


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

int main() {
	int k;
  	cin >> k;
  	long long int ans = 0;
  	for (int i = 1 ; i <= k ; i++) {
    	for (int j = 1 ; j <= k ; j++) {
        	for (int jj = 1 ; jj <= k ; jj++) {
            	ans += (__gcd(i, __gcd(j,jj)));
            }
        }
    }
	cout << ans << endl;
 	return 0;
}

Measured memory_bytes: 3604
#include<cstdio>
#include<cstdlib>
#include<cstring>
struct Node{
    int key;
    Node *prev, *next;
};
Node *nil;
void init(){
    nil=(Node *)malloc(sizeof(Node));
    nil->next =nil;
    nil->prev=nil;
}

void insert(int k){
    Node *x=(Node *)malloc(sizeof(Node));
    x->key=k;
    x->next=nil->next;
    nil->next->prev=x;
    nil->next=x;
    x->prev=nil;
}

void deleteN(Node* t){
    if(t==nil)return;
    t->prev->next=t->next;
    t->next->prev=t->prev;
    free(t);
}

Node* search(int k){
    Node *c=nil->next;
    while(c!=nil&&c->key!=k){
        c=c->next;
    }
    return c;
}
void print(){
    Node *c=nil->next;
    int is=0;
    while(1){
        if(c==nil)break;
        if(is++>0)printf(" ");
        printf("%d",c->key);
        c=c->next;
    }
    printf("\n");
}
int main(){
    int k,n,i;
    int size=0;
    char com[20];
    int np=0,nd=0;
    scanf("%d", &n);
    init();
    for(int i=0;i<n;i++){
        scanf("%s%d",com,&k);
        if(com[0]=='i'){
            insert(k);
            np++;
            size++;
        }else if(com[0]=='d'){
            if(strlen(com)>6){
                if(com[6]=='F')deleteN(nil->next);
                else if(com[6]=='L')deleteN(nil->prev);
            }else{
                deleteN(search(k));
            }
            size--;
        }
    }
    print();
    return 0;
}


Measured memory_bytes: 33952
#include<stdio.h>
#include<string.h>
int main(void){
   int A,B,C;
   scanf("%d %d %d",&A,&B,&C);
   if((A==B)&&(A!=C)){
      printf("Yes");
   }else if((C==B)&&(A!=B)){
      printf("Yes");
   }else if((A==C)&&(B!=C)){
      printf("Yes");
   }else{
      printf("No");
   }
   

   return 0;
}


Measured memory_bytes: 128
import bisect

def find_lt(a, x):
    i = bisect.bisect_left(a, x)
    if i:
        return i
    return 0

def find_l(a, x):
    i = bisect.bisect_right(a, x)
    if i == 0:
        return len(a)
    else:
        return len(a) - i

def main():
    N = int(input())

    partA = list(map(int, input().split()))
    partA.sort()
    partB = list(map(int, input().split()))
    partB.sort()
    partC = list(map(int, input().split()))
    partC.sort()
    cnt = 0


    for b in partB:
        A = find_lt(partA, b)
        #print (A)
        B = find_l(partC, b)
        #print (B)
        cnt += (A * B)

    print(cnt)

if __name__ == '__main__':
    main()

Measured memory_bytes: 24052
#include<bits/stdc++.h>
using namespace std;
int n,a[200010],ans[200010],la;
int main(){
	cin>>n;
	for(int i=1;i<=n;i++) scanf("%d",&a[i]);
	for(int i=1;i<=n/2;i++) swap(a[i],a[n-i+1]);
	for(int i=1;i<=n;i++){
		if(ans[la]<=a[i]) ans[++la]=a[i];
		else{
			int p=upper_bound(ans+1,ans+la+1,a[i])-ans;
			ans[p]=a[i];
		}
	}
	cout<<la<<endl;
	return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#include <cmath>
#include <climits>
#include <string>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <queue>
#include <bitset>
#include <stack>

typedef long long ll;
const ll     INF = LLONG_MAX /10;

int main(int argc, char* argv[])
{
  ll N, A, B;
  std::cin >> N >> A >> B;

  std::vector< ll > vx(N, 0);
  std::vector< ll >::iterator it;

  for (ll i = 0; i < N; i++) {
    std::cin >> vx[i];
  }

  ll ans = 0;
  for (ll i = 1; i < N; i++) {
    ans += std::min((vx[i] - vx[i-1])*A, B);
  }

  std::cout << ans << std::endl;

  return 0;
}




Measured memory_bytes: 1024
N, upper_bit = gets.split.map(&:to_i)
A = gets.split.map(&:to_i)
already_min = false

ans = 0
39.step(0, -1) do |digest|
  mask = 1 << digest
  ones = A.count { |str| (str & mask) > 0 }
  if ones * 2 >= N
    already_min = true if upper_bit[digest] == 1
    ans += mask * ones
  else
    if already_min || (upper_bit[digest] == 1)
      ans += mask * (N - ones)
    else
      ans += mask * ones
    end
  end
end
p ans


Measured memory_bytes: 10788
#include <stdio.h>
#include <string.h>

int main (void) {
    char s[101], t[101];
    int i = 0, len;

    gets(s);
    gets(t);

    len = strlen(s);

    while (t[i] != '\0') {
        if (s[0] == t[i] && memcmp(&s[0], &t[i], len - i) == 0 && memcmp(&s[len - i], &t[0], i) == 0) {
            puts("Yes");
            return 0;
        }
        i++;
    }
    puts("No");
    return 0;
}

Measured memory_bytes: 128
def grading(m,f,r):
	mf = m+f
	if mf >= 80:
		grade = 'A'
	elif mf >= 65:
		grade = 'B'
	elif mf >= 50:
		grade = 'C'
	elif mf >= 30:
		grade = 'D'
	else:
		grade = 'F'
	if -1 in [m,f]:
		grade = 'F'
	if grade == 'D' and r >= 50:
		grade = 'C'
	return grade

data = []
while True:
	temp = [int(s) for s in input().split(' ')]
	if temp == [-1,-1,-1]:
		break
	else:
		data.append(temp)

grades = [grading(*points) for points in data]
[print(g) for g in grades]

Measured memory_bytes: 7712
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan = new Scanner(System.in);
		int x = scan.nextInt();
		if (x >= 30) {
			System.out.println("Yes");
		} else
			System.out.println("No");
	}
}

Measured memory_bytes: 35608
#include <iostream>
#include <cstring>
#include <string>    
#include <vector>
#include <queue>
#include <map>
#include <algorithm>
#include <cmath>
using namespace std;
typedef long long ll;
ll n, m, l, r, d, pos[100008];
bool used[100008];
vector<ll> edge[100008];
map<pair<ll, ll>, ll> info;
string ans = "Yes";

void dfs(ll now){
	used[now] = true;
	for(ll i = 0; i < edge[now].size(); i++){
		ll next = edge[now][i];
		if(used[next]){
			if(pos[next]-pos[now] != info.at(make_pair(now, next))){ans = "No";}
		}
		else{
			pos[next] = pos[now] + info.at(make_pair(now, next));
			dfs(next);
		}
	}
}

int main(){
	cin >> n >> m;
	for(ll j = 1; j <= m; j++){
		cin >> l >> r >> d;
		edge[l].push_back(r);
		edge[r].push_back(l);
		info.insert(make_pair(make_pair(l, r), d));
		info.insert(make_pair(make_pair(r, l), -d));
	}
	
	memset(used, 0, sizeof(used));
	for(ll i = 1; i <= n; i++){
		if(!used[i]){
			pos[i] = 0;
			dfs(i);
		}
	}
	
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 37504
#include "bits/stdc++.h"
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define MOD 1e9+7;
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long LL;
typedef vector<int> VI;
typedef vector<vector<int> > VVI;
typedef vector<string> VS;

int main(){
    LL N, K, cnt = 1, temp;
    cin >> N >> K;
	temp = K;
    while (N >= K){
        cnt++;
        K*=temp;
    }
	cout << cnt << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define M 1000000007
long long int power(int a,int b)
{
    if(b==0)
        return 1;
    long long int k=power(a,b/2);
    if(b%2==0)
        return ((k%M)*(k%M))%M;
    else
        return ((k%M)*(k%M)*(a%M))%M;
}
long long int fact(long long int n)
{
    if(n==1 || n==0)
        return 1;
    else
        return ((n%M)*(fact(n-1)%M))%M;

}
int div(int n)
{  int c=0;
    for(int i=1;i<sqrt(n);i++)
    {
        if(n%i==0)
        {
          c++;
        }
    }
    c=c*2;
    if(pow(sqrt(n),2)==(sqrt(n)*sqrt(n)))
        c++;
    return  c;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
     #ifndef ONLINE_JUDGE
 
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
 
   #endif
   
   int n,m,x,y;
   cin>>n>>m;
   cin>>x>>y;
   vector<int> a,b;
   a.push_back(x);
   b.push_back(y);
   while(n--)
   {
    int s;
    cin>>s;
    a.push_back(s);
   }
   while(m--)
   {
    int s;
    cin>>s;
    b.push_back(s);
   }
   sort(a.begin(),a.end());
   sort(b.begin(),b.end());
   if(a[a.size()-1]>=b[0])
    cout<<"War";
 else
    cout<<"No War";




 return 0;
}








Measured memory_bytes: 3612
fun longList() = readLine()?.split(" ")?.map(String::toLong) ?: TODO()
fun main() {
    val (a, b) = longList()
    if (a == b) {
        println(a.toString())
        return
    }
    if (a % 2 == 0L) {
        val c = b - a + 1
        if (c % 2 == 0L) {
            if (c / 2 % 2 == 0L) {
                println("0")
            } else {
                println("1")
            }
        } else {
            if (c / 2 % 2 == 0L) {
                println(b.toString())
            } else {
                println((b xor 1).toString())
            }
        }
    } else {
        val c = b - a
        if (c % 2 == 0L) {
            if (c / 2 % 2 == 0L) {
                println(a.toString())
            } else {
                println((a xor 1).toString())
            }
        } else {
            if (c / 2 % 2 == 0L) {
                println((a xor b).toString())
            } else {
                println((a xor b xor 1).toString())
            }
        }
    }
}

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

using namespace std;

int main(){
    int n;
    string S;
    cin >> n >> S;

    const int p = 1e9 + 7;
    const array<int64_t, 2> B = {390186038, 231964045};

    auto check = [&](int len){
        array<int64_t, 2> H = {};
        array<int64_t, 2> C = {1, 1};
        array<map<int, int>, 2> M;
        for (int i = len - 1; i >= 0; i--){
            for (int j = 0; j < 2; j++){
                C[j] = (C[j] * B[j]) % p;
                H[j] = (H[j] + S[i] * C[j]) % p;
            }
        }
        for (int i = 0; i < 2; i++)
            M[i][H[i]] = -1;

        for (int l = 0; l + len < n; l++){
            int r = l + len;
            array<bool, 2> flags = {};
            for (int i = 0; i < 2; i++){
                H[i] = ((H[i] - S[l] * C[i] % p + p) * B[i]  + S[r] * B[i]) % p;
                if (M[i].count(H[i])){
                    flags[i] = l - M[i][H[i]] >= len;
                } else{
                    M[i][H[i]] = l;
                }
            }

            if (all_of(flags.begin(), flags.end(), [](bool x){return x;}))
                return true;
        }

        return false;
    };

    int ok = 0, ng = n;
    while (abs(ok - ng) > 1){
        int mid = (ok + ng) / 2;
        if (check(mid)){
            ok = mid;
        }else{
            ng = mid;
        }
    }

    cout << ok << endl;

}


Measured memory_bytes: 768
/*
    AUTHOR:hruday pabbisetty
    NIT ROURKElA
*/
#include <bits/stdc++.h>
#include <tr1/unordered_map>
using namespace std;
using namespace std::tr1;
#define opt ios_base::sync_with_stdio(0)
#define lli long long int
#define ulli unsigned long long int
#define I int
#define S string
#define D double
#define rep(i,a,b) for(i=a;i<b;i++)
#define repr(i,a,b) for(i=a;i>b;i--)
#define in(n) scanf("%lld",&n)
#define in2(a,b) scanf("%lld %lld",&a,&b)
#define in3(a,b,c) scanf("%lld %lld %lld",&a,&b,&c)
#define out(n) printf("%lld\n",n)
#define inu(a) scanf("%lld",&a)
#define outu(a) printf("%llu",a)
#define ins(s) scanf("%s",&s)
#define outs(s) printf("%s",s)
#define mod 1000000007
#define inf 100000000000000000
typedef long long       ll;
typedef pair<lli,lli>  plli;
typedef vector<lli>     vlli;
typedef vector<ulli>    vulli;
typedef vector<ll>      vll;
typedef vector<string>  vs;
typedef vector<plli>     vplli;
#define MM(a,x)  memset(a,x,sizeof(a));
#define ALL(x)   (x).begin(), (x).end()
#define P(x)       cerr<<"{"#x<<" = "<<(x)<<"}"<<endl;
#define P2(x,y)       cerr<<"{"#x" = "<<(x)<<", "#y" = "<<(y)<<"}"<<endl;
#define P3(x,y,z)  cerr<<"{"#x" = "<<(x)<<", "#y" = "<<(y)<<", "#z" = "<<(z)<<"}"<<endl;
#define P4(x,y,z,w)cerr<<"{"#x" = "<<(x)<<", "#y" = "<<(y)<<", "#z" = "<<(z)<<", "#w" = "<<(w)<<"}"<<endl;
#define PP(x,i)     cerr<<"{"#x"["<<i<<"] = "<<x[i]<<"}"<<endl;
#define TM(a,b)     cerr<<"{"#a" -> "#b": "<<1000*(b-a)/CLOCKS_PER_SEC<<"ms}\n";
#define UN(v)    sort(ALL(v)), v.resize(unique(ALL(v))-v.begin())
#define mp make_pair
#define pb push_back
#define F first
#define S second
#define sz() size()
#define nl cout<<"\n"
#define MX1 100005
#define MX2 1000005
#define bs binary_search
#define lb lower_bound
#define ub upper_bound
lli dx[]={0,0,-1,1,-1,-1,1,1};
lli dy[]={1,-1,0,0,1,-1,-1,1};
lli power(lli a,lli b)
    {
    lli value;
    if(b==0)
        {
        return 1;
    }
    else if(b%2==0)
        {
        value=power(a,b/2)%mod;
        return(value*value)%mod;
    }
    else
        {
        value=power(a,b/2)%mod;
        return ((a*value)%mod*(value))%mod;
    }
}

lli Prefix[2*MX2+1];

int main()
{
      /*  #ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
        #endif*/
    opt;

    lli N,i;
    cin>>N;

    lli Min=inf,Ans=0LL;

    lli x[N+1],s[N+1];

    rep(i,1,N+1)
    {
        cin>>x[i]>>s[i];

        Prefix[i] = Prefix[i-1]+s[i];

        Ans = max(Ans,Prefix[i]-x[i]-Min);
        Ans =max(Ans,s[i]);

        Min = min(Min,Prefix[i-1]-x[i]);
    }

    cout<<Ans;



    return 0;
}


Measured memory_bytes: 4992
class WeightedUnionFind(object):
    __slots__ = ["nodes", "weight"]

    def __init__(self, n: int) -> None:
        self.nodes = [-1]*n
        self.weight = [0]*n

    def get_root(self, x: int) -> int:
        if x < 0:
            raise ValueError("Negative Index")

        if self.nodes[x] < 0:
            return x
        else:
            root = self.get_root(self.nodes[x])
            self.weight[x] += self.weight[self.nodes[x]]
            self.nodes[x] = root
            return root

    def relate(self, smaller: int, bigger: int, diff_weight: int) -> None:
        if smaller < 0 or bigger < 0:
            raise ValueError("Negative Index")

        root_a, root_b = self.get_root(smaller), self.get_root(bigger)
        new_weight = diff_weight + self.weight[smaller] - self.weight[bigger]

        if root_a == root_b:
            # 問題によっては必要かも（情報に矛盾があるなら-1を出力など）
            if self.weight[smaller] + diff_weight == self.weight[bigger]:
                return
            raise ValueError("relateに矛盾あり")

        if self.nodes[root_a] > self.nodes[root_b]:
            root_a, root_b, new_weight = root_b, root_a, -new_weight

        self.nodes[root_a] += self.nodes[root_b]
        self.nodes[root_b] = root_a
        self.weight[root_b] = new_weight

    def diff(self, x: int, y: int) -> int:
        root_x, root_y = self.get_root(x), self.get_root(y)
        if root_x != root_y:
            return None
        return self.weight[y] - self.weight[x]


while True:
    N = int(input())
    if not N:
        break
    uf, d = WeightedUnionFind(N*2), dict()
    queries = [input().split() for _ in [0]*N]
    try:
        for _, a, _, n, b in queries:
            n = int(n[3:])
            d[a] = d[a] if a in d else len(d)
            d[b] = d[b] if b in d else len(d)
            uf.relate(d[a], d[b], n)
        print("Yes")
    except ValueError as e:
        print("No")



Measured memory_bytes: 5640
N=int(input())
s=[int(input()) for i in range(N)]
a=sum(s)
if a%10!=0:
    print(a)
else:
    s.sort()
    for i in range(N):
        if s[i]%10!=0:
            print(a-s[i])
            break
    else:
        print(0)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
// iostream is too mainstream
#include <cstdio>
// bitch please
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <cmath>
#include <iomanip>
#include <time.h>
#define dibs reserve
#define OVER9000 1234567890
#define ALL_THE(CAKE,LIE) for(auto LIE =CAKE.begin(); LIE != CAKE.end(); LIE++)
#define tisic 47
#define soclose 1e-8
#define chocolate win
// so much chocolate
#define patkan 9
#define ff first
#define ss second
#define abs(x) ((x < 0)?-(x):x)
#define uint unsigned int
#define dbl long double
#define pi 3.14159265358979323846
using namespace std;
// mylittledoge

typedef long long cat;

#ifdef DONLINE_JUDGE
	// palindromic tree is better than splay tree!
	#define lld I64d
#endif

int main() {
	cin.sync_with_stdio(0);
	cin.tie(0);
	cout << fixed << setprecision(10);
	int N;
	cin >> N;
	int sg = 0;
	for(int i = 0; i < N; i++) {
		int A, K;
		cin >> A >> K;
		while(A%K != 0) {
			// A -= A/K+1 times (A%K) / (A/K+1)
			if(A/K+1 <= A%K) A -= (A/K+1) * ( (A%K) / (A/K+1) );
			else A -= A/K+1;
		}
		sg ^= (A/K);
	}
	cout << (sg ? "Takahashi" : "Aoki") << "\n";
	return 0;}

// look at my code
// my code is amazing


Measured memory_bytes: 384
#include<iostream>
#include<cmath>
#include<algorithm>
#include<vector>
#include<functional>
#include<string>
#include<iomanip>
#include<map>
#include<utility>
#include<string>
#include<unordered_map>
#include<queue>

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; }

using namespace std;

#define min_3(a, b, c) min(a, min(b, c))
#define max_3(a, b, c) max(a, max(b, c))
typedef long long ll;
typedef pair<int, int> P;
const ll INF = 1e9+7;

int main(){
   int x; cin >> x;
   int ans = 0;
   ans += x/500*1000;
   x %= 500;
   ans += x/5*5;
   cout << ans << endl;
   return 0;
}


Measured memory_bytes: 256
from collections import defaultdict, deque
def main():
  N, M, *L = map(int, open(0).read().split())
  dic = defaultdict(list)
  par =  [None]*N
  cnt = [0]*(N+1)
  cnt[0] = 1
  for a,b in zip(*[iter(L)]*2):
    dic[a].append(b)
    cnt[b] += 1

  for i, m in enumerate(cnt):
    if m==0:
      q = deque([i])
      par[i-1] = '0'
      break
  
  while q:
    m = q.popleft()
    for c in dic[m]:
      cnt[c] -= 1
      if cnt[c]==0:
        par[c-1] = str(m)
        q.append(c)

  ans = '\n'.join(par)
  print(ans)
  
if __name__== '__main__':
  main()


Measured memory_bytes: 37228
#include <math.h>

#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    unsigned long long int total;
    sort(a.begin(), a.end());
    int ind;
    bool have_case = true;
    if (n % 2 == 1) {
        if (a[0] == 0) {
            ind = 1;
            while (ind < n - 1) {
                if (a[ind] != a[ind - 1] + 2 || a[ind + 1] != a[ind - 1] + 2) {
                    have_case = false;
                    break;
                }
                ind += 2;
            }
        } else
            have_case = false;
    } else {
        if (a[0] == 1 && a[1] == 1) {
            ind = 2;
            while (ind < n - 1) {
                if (a[ind] != a[ind - 1] + 2 || a[ind + 1] != a[ind - 1] + 2) {
                    have_case = false;
                    break;
                }
                ind += 2;
            }
        } else
            have_case = false;
    }

    if (have_case) {
        int n_div = pow(10, 9) + 7;
        total = 1;
        for (int i = 0; i < n / 2; i++) {
            total *= 2;
            total %= n_div;
        }
    } else {
        total = 0;
    }
    cout << total << endl;
    return 0;
}

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

int ri() {
	int n;
	scanf("%d", &n);
	return n;
}
struct SegTree {
	int n;
	std::vector<int> data;
	SegTree (int n_) {
		for (n = 1; n < n_; n <<= 1);
		data.resize(n << 1);
	}
	void add(int i, int val) {
		for (i += n; i; i >>= 1) data[i] += val;
	}
	int sum(int l, int r) {
		int res = 0;
		for (l += n, r += n; l < r; l >>= 1, r >>= 1) {
			if (r & 1) res += data[--r];
			if (l & 1) res += data[l++];
		}
		return res;
	}
};
struct Points2D {
	std::vector<std::pair<int, int> > pts;
	struct Query {
		int x1;
		int x2;
		int y1;
		int y2;
		int *res;
	};
	std::vector<Query> queries;
	void add(std::pair<int, int> pt) {
		pts.push_back(pt);
	}
	void query(Query query) {
		queries.push_back(query);
	}
	void calculate() {
		int sz = queries.size();
		for (int i = 0; i < sz; i++) {
			*queries[i].res = 0;
			queries.push_back({queries[i].x1, queries[i].x2, queries[i].y2, 1, queries[i].res});
			queries[i].y2 = -1;
		}
		std::sort(pts.begin(), pts.end(), [] (auto &a, auto &b) { return a.second < b.second; });
		std::sort(queries.begin(), queries.end(), [] (Query &a, Query &b) { return a.y1 < b.y1; });
		int n = pts.size();
		int head = 0;
		SegTree tree(300001);
		for (auto &i : queries) {
			while (head < n && pts[head].second < i.y1) tree.add(pts[head++].first, 1);
			*i.res += i.y2 * tree.sum(i.x1, i.x2);
		}
	}
};

int main() {
	int n = ri(), m = ri();
	int l[n], r[n];
	Points2D points;
	for (int i = 0; i < n; i++) l[i] = ri(), r[i] = ri(), points.add({l[i], r[i]});
	std::vector<int> res(m, 0);
	for (int i = 1; i <= m; i++)
		for (int j = 0; j < m; j += i) points.query({j + 1, std::min(m + 1, j + i), j + 1, std::min(m + 1, j + i), &res[i - 1]});
	points.calculate();
	for (int i = 1; i <= m; i++) std::cout << n - res[i - 1] << std::endl;
	return 0;
}


Measured memory_bytes: 109404
#include <cstdio>
#include <algorithm>
#include <vector>
using namespace std;
int N, U, V, ans = 0;
vector<int> adjlist[100000];
int sp[100000][2];
void dfs(int v, int p) {
	for (int i: adjlist[v]) {
		if (i == p) continue;
		sp[i][0] = sp[v][0] + 1;
		dfs(i, v);
	}
}
void escape(int v, int p) {
	if (adjlist[v].size() > 1) ans = max(ans, sp[v][0]);
	for (int i: adjlist[v]) {
		if (i == p) continue;
		if (sp[i][0] <= sp[v][1]) continue;
		sp[i][1] = sp[v][1] + 1;
		escape(i, v);
	}
}
int main() {
	int X, Y;
	scanf("%d %d %d", &N, &U, &V);
	for (int i = 1; i < N; ++i) {
		scanf("%d %d", &X, &Y);
		adjlist[X - 1].push_back(Y - 1);
		adjlist[Y - 1].push_back(X - 1);
	}
	sp[V - 1][0] = sp[U - 1][1] = 0;
	dfs(V - 1, -1);
	escape(U - 1, -1);
	printf("%d", ans);
	return 0;
	for (int i = 0; i < N; ++i) printf("%d ", sp[i][0]);
	printf("\n");
	for (int i = 0; i < N; ++i) printf("%d ", sp[i][1]);
	return 0;
}

Measured memory_bytes: 10368
import std.stdio, std.conv, std.string, std.range, std.typecons, std.format;
import std.algorithm.searching, std.algorithm.sorting, std.algorithm.iteration, std.algorithm.mutation;

void main()
{
    int[] input = readln().split.to!(int[]);
    int N = input[0];
    int M = input[1];
    int[] targets = readln().split.to!(int[]);
    if(N>=M)
    {
        writeln(0);
        return;
    }

    int[] saList;
    saList.length = targets.length-1;
    auto sortedTarget = targets.sort();
    for(int i = 0;i < sortedTarget.length-1;i++)
    {
        saList[i] = sortedTarget[i+1] - sortedTarget[i];
    }
    writeln(saList.sort()[0..$-(N-1)].sum());
}


Measured memory_bytes: 4332
n = int(input())

a = tuple(map(int, input().split()))

ans = 0

for j in range(61):
    one = 0
    zero = 0
    for i in a:
        if (i >> j) & 1 == 1:
            one += 1
        else:
            zero += 1
    ans += one*zero*2**j
    ans %= 10**9 + 7

print(ans)

Measured memory_bytes: 131056
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1e16;
const ll mod = 1000000007;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
  rep(i, 5) {
    ll a; cin >> a;
    if (a == 0) {
      cout << i+1 << endl;
      break;
    }
  }
}

Measured memory_bytes: 3584
#include<bits/stdc++.h>
#define int long long
#define fo(i, n) for(int i = 1; i <= (n); i ++)
#define out(x) cout << #x << " = " << x << "\n"
using namespace std;
//by piano
template<typename tp> inline void read(tp &x) {
  x = 0; char c = getchar(); bool f = 0;
  for(; c < '0' || c > '9'; f |= (c == '-'), c = getchar());
  for(; c >= '0' && c <= '9'; x = (x << 3) + (x << 1) + c - '0', c = getchar());
  if(f) x = -x;
}
#define P pair<int, int>
#define MP make_pair
#define fi first
#define se second
const int N = 3e5 + 233;
int pre[N], n, m, a[N];
int ans = 0, has = 0, kuai = 0;
vector<int> vec[N], p;
inline int find(int u) {
  return pre[u] == u ? u : pre[u] = find(pre[u]);
}

main(void) {
  read(n); read(m);
  fo(i, n) {
    read(a[i]);
    pre[i] = i;
  }
  fo(i, m) {
    int x, y;
    read(x); read(y);
    ++ x; ++ y;
    int fx = find(x), fy = find(y);
    if(fx != fy) 
      pre[fy] = fx;
  }
  fo(i, n) vec[find(i)].push_back(a[i]);
  fo(i, n)
    if(vec[i].size()) {
      sort(vec[i].begin(), vec[i].end());
      ans += vec[i][0];
      kuai ++;
      for(int k = 1; k < (int)vec[i].size(); k ++)
        p.push_back(vec[i][k]);
    }
  if(kuai == 1) return cout << "0\n", 0;
  int need = (n - 1 - m) * 2 - kuai;
  if(p.size() < need) cout << "Impossible\n";
  else {
    sort(p.begin(), p.end());
    for(int i = 0; i < need; i ++)
      ans += p[i];
    cout << ans << "\n";
  }
}


Measured memory_bytes: 13568
<?php

$sc = new Scanner();
$out = new out();
$n = $sc->nextInt();
$a = [];
for($i = 0 ; $i < $n; $i++) {
    $a[] = $sc->nextInt();
}
$deal = 0;
for($i = 0 ; $i < $n; $i++) {
    $t = $a[$i] - $sc->nextInt();
    if ($t > 0) {
        $deal -= $t;
    } else {
        $deal += floor(-$t/2);

    }
}
if ($deal >= 0) {
    $out->println("Yes");
} else {
    $out->println("No");
}

class Scanner {
    private $arr = [];
    private $count = 0;
    private $pointer = 0;
    public function next() {
        if($this->pointer >= $this->count) {
            $str = trim(fgets(STDIN));
            $this->arr = explode(' ', $str);
            $this->count = count($this->arr);
            $this->pointer = 0;
        }
        $result = $this->arr[$this->pointer];
        $this->pointer++;
        return $result;
    }
    public function hasNext() {
        return $this->pointer < $this->count;
    }
    public function nextInt() {
        return (int)$this->next();
    }
    public function nextDouble() {
        return (double)$this->next();
    }
}
class out {
    public static function println($str = "") {
        echo $str . PHP_EOL;
    }
}

Measured memory_bytes: 6648
#include <stdio.h>

int num[1005];

void CalcPrime(int n);

typedef long long ll;

int main() {

	int N;

	scanf("%d",&N);

	int i;

	for (i = 1; i <= N; i++) {
		CalcPrime(i);
	}

	ll ans = 1ll;

	for (i = 2; i <= N; i++) {
		ans *= (ll)(num[i] + 1ll);
		ans %= 1000000007;
	}

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


	return 0;
}
void CalcPrime(int n) {

	int a = 2;
	while (n >= a * a) {
		if (n % a == 0) {
			num[a]++;
			n /= a;
		}
		else {
			a++;
		}
	}
	num[n]++;
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <utility>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <istream>
#include <ostream>

#include <cstdlib>
#include <cmath>
#include <cstdio>

using namespace std;

#define fi first
#define se second
#define mkp make_pair
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define rep(i,n) for(ll i=0; i < (n); ++i)
#define rrep(i,n) for(ll i=((n)-1); i >= 0; --i)

#define OPLT(T) bool operator<(const T & lop_, const T & rop_)
#define OPEQ(T) bool operator==(const T & lop_, const T & rop_)

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

istream& operator>>(istream& istr, __float128& obj) { double d; istr >> d; obj = d; return istr; };
ostream& operator<<(ostream& ostr, __float128& obj) { ostr << static_cast<double>(obj); return ostr; };

int main() {
	int N;
	cin >> N;
	vector<ll> A(N);
	rep(i,N) cin >> A[i];
	ll mx = 2;
	ll res = A[0]-1;
	for(int i = 1; i < A.size(); i++) {
		if(A[i] <= mx) {
			mx = max(mx, A[i]+1);
		}
		else {
			res += A[i]/mx;
			if(A[i] % mx == 0) {
				res--;
			}
		}
	}
	cout << res << endl;
	return 0;
}


Measured memory_bytes: 1152
using System;
using System.Linq;

namespace Program
{
    class C
    {
        static void Main(string[] args)
        {
            var K = int.Parse(Console.ReadLine());
            int ret = -1;
            if (K % 7 == 0)
            {
                K /= 7;
            }

            if (K % 5 == 0 || K % 2 == 0)
            {
                ret = -1;
            }
            else
            {
                K *= 9;
                int res = -1;
                for (int i = 0; i < 1000000; i++)
                {
                    if (res == -1)
                    {
                        if (Power(10, i) >= K)
                        {
                            res = Power(10, i) % K;
                        }
                    }
                    else if (res == 1)
                    {
                        ret = i-2;
                        break;
                    }
                    else
                    {
                        res = (10 * res) % K;
                    }

                }
            }
            Console.WriteLine(ret);
        }
        public static int Power(int x, int n)
        {
            int ret = 1;

            for (int i = 0; i < n - 1; i++)
            {
                ret *= x;
            }
            return ret;

        }
    }
}


Measured memory_bytes: 27472
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
using namespace std;
using ll = long long;
using lll = __int128_t;
typedef pair<ll,ll> P;
#define REP(i,b,e) for(ll i=(ll)b;i<(ll)e;i++)
#define rep0(i,n) REP(i,0ll,n)
#define rep1(i,n) REP(i,1ll,n+1)
const ll longinf=1ll<<60;
const int inf=(1<<30)-1;

vector<int> child[200001];
int parent[200001];
int visited[200001];
vector<int> adj[200001];

ll ans[200001];
ll qu[200001];

void calc(int par){
      for(auto ch:adj[par]){
            if(!visited[ch]){
                  parent[ch]=par;
                  child[par].push_back(ch);
                  visited[ch]=true;
                  calc(ch);
            }
      }
}

void calc2(ll pos,int par){
      for(auto ch:child[par]){
            ans[ch]=(pos+qu[ch]);
            //cout<<ans[ch]<<" "<<ch<<endl;
            calc2(ans[ch],ch);
      }
}

int main(){
      ll n,q;
      cin>>n>>q;
      rep1(i,n-1){
            ll a,b;
            cin>>a>>b;
            adj[a].push_back(b);
            adj[b].push_back(a);
      }
      fill(visited,visited+n+1,false);
      visited[1]=true;
      calc(1);
      fill(qu,qu+n+1,0);
      rep0(i,q){
            ll p,x;
            cin>>p>>x;
            qu[p]+=x;
      }
      calc2(qu[1],1);
      ans[1]=qu[1];
      //cout<<ans[1]<<endl;
       rep1(i,n){
            cout<<ans[i]<<" ";
      }
      cout<<endl;
      return 0;
}

Measured memory_bytes: 41472
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <deque>
#include <iterator>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <cmath>
#include <cstring>

using namespace std;

#define REPI(x) for(int i=0;i<x;i++)
#define REPJ(x) for(int j=0;j<x;j++)
#define SCANFD(x) scanf("%d",&x)

#define MAX 101

int main(){
    int A,B,C;

    cin >> A >> B >> C;
    if(B/A>=C)
        cout << C << endl;
    else
        cout << B/A << endl; 

    
    return 0;
}


Measured memory_bytes: 256
N = int(input())
S = ["00"]
for i in range(N):
    S.append(str(input()))

print("AC x " + str(S.count('AC')))
print("WA x " + str(S.count('WA')))
print("TLE x " + str(S.count('TLE')))
print("RE x " + str(S.count('RE')))


Measured memory_bytes: 16272
//
// Created on 2020/05/29.
//


#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
#include <ios>
#include <iomanip>
#include <numeric>

#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
typedef long long ll;
using namespace std;
const long long LINF =1e18;
const int INF = 1e9;

vector< int64_t > divisor(int64_t n) {
  vector< int64_t > ret;
  for(int64_t i = 1; i * i <= n; i++) {
    if(n % i == 0) {
      ret.push_back(i);
      if(i * i != n) ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret));
  return (ret);
}

int main() {
    int n;
    cin>>n;
    int ans = 0;
    for (int i = 1; i <= n; ++i) {
        vector<int64_t> yakusuu = divisor(i);
        if(yakusuu.size() == 8 && i % 2 == 1) {
            ans ++;
        }
    }
    cout<<ans<<endl;

    return 0;
}


Measured memory_bytes: 384
import bisect
N = int(input())
#ソートしておく
L = sorted(list(map(int, input().split())))
ans = 0

#短い2辺を総当たりで選択
for i in range(N - 2):
  for j in range(i + 1, N - 1):
    #小さい順に並べた時の成立条件
    # l1 + l2 > l3
    l12 = L[i] + L[j]
    #l2の隣から　l12以下のところまで全部が対象、成立しない場合
    #ans += max(bisect.bisect_left(L, l12) - j - 1, 0)
    ans += bisect.bisect_left(L, l12) - j - 1
print(ans)

Measured memory_bytes: 3188
from collections import defaultdict, deque
import sys
import heapq
import bisect
import math
import itertools
import string
import queue
import copy
import time
import numpy as np
from fractions import gcd

sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7

def inp(): return int(sys.stdin.readline())
 
def inp_list(): return list(map(int, sys.stdin.readline().split()))

def lcm(x, y): return (x * y) // gcd(x, y)


a, b = inp_list()
for n in range(1251):
    wo_tax_a = int(n * 0.08)
    wo_tax_b = int(n * 0.10)
    if wo_tax_a == a and wo_tax_b == b:
        print(n)
        exit()
print(-1)


Measured memory_bytes: 13648
#include <iostream>
#include <algorithm>

using namespace std;

void solve() {
    int n, k;
    cin >> n >> k;
    int ans=0;
    for(int i=0; i<n; ++i) {
        int xi;
        cin >> xi;
        ans += 2*(min(abs(xi), abs(xi-k)));
    }
    cout << ans;
}

int main() {

	solve();
    return 0;
}


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

using namespace std;

int main() {
    string S;
    cin >> S;

    vector<string> vec = {"SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"};

    int cnt = 0;
    for (string x:vec) {
        if (S == x) {
            cout << 7 - cnt << endl;
        } else {
            cnt++;
        }
    }
}

Measured memory_bytes: 3600
using System;
using System.Linq;

namespace ABC072Cother
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int[] a = Console.ReadLine().Split(' ').Select(temp => int.Parse(temp)).ToArray();

            int[] all = new int[3 * n];
            for (int i = 0; i < n; i++)
            {
                all[i] = a[i];
                all[i + n] = a[i] - 1;
                all[i + n + n] = a[i] + 1;
            }

            Array.Sort(all);
            int before = -1111;
            int cur = 1;
            int max = 1;
            for (int i = 0; i < n * 3; i++)
            {
                if (all[i] == before)
                {
                    cur++;
                }
                else
                {
                    cur = 1;
                }

                before = all[i];
                if (cur > max)
                {
                    max = cur;
                }
            }
            Console.WriteLine(max);
        }
    }
}

Measured memory_bytes: 19296