akhauriyash/Code-Regression huggingface dataset:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringJoiner;
import java.util.StringTokenizer;
import java.util.function.IntUnaryOperator;
import java.util.function.LongUnaryOperator;

class Main {
    static In in = new In();
    static Out out = new Out();
    static long mod = 1000000007;
    static long inf = 0xfffffffffffffffL;

    void solve() {
        int a = in.nextInt();
        int b = in.nextInt();
        int c = in.nextInt();
        if (c == b && b != a) {
            System.out.println("Yes");
        } else if (a == c && c != b) {
            System.out.println("Yes");
        } else if (a == b && b != c) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }

    public static void main(String[]$) {
        new Main().solve();
        out.flush();
    }
}

class In {
    private BufferedReader reader = new BufferedReader(new InputStreamReader(System.in), 0x10000);
    private StringTokenizer tokenizer;

    String next() {
        try {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                tokenizer = new StringTokenizer(reader.readLine());
            }
        } catch (IOException ignored) {
        }
        return tokenizer.nextToken();
    }

    int nextInt() {
        return Integer.parseInt(next());
    }

    long nextLong() {
        return Long.parseLong(next());
    }

    char[][] nextCharArray(int n, int m) {
        char[][] a = new char[n][m];
        for (int i = 0; i < n; i++) {
            a[i] = next().toCharArray();
        }
        return a;
    }

    int[] nextIntArray(int n) {
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = nextInt();
        }
        return a;
    }

    int[] nextIntArray(int n, IntUnaryOperator op) {
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = op.applyAsInt(nextInt());
        }
        return a;
    }

    long[] nextLongArray(int n) {
        long[] a = new long[n];
        for (int i = 0; i < n; i++) {
            a[i] = nextLong();
        }
        return a;
    }

    long[] nextLongArray(int n, LongUnaryOperator op) {
        long[] a = new long[n];
        for (int i = 0; i < n; i++) {
            a[i] = op.applyAsLong(nextLong());
        }
        return a;
    }
}

class Out {
    private static PrintWriter out = new PrintWriter(System.out);

    void println(Object... a) {
        StringJoiner joiner = new StringJoiner(" ");
        for (Object obj : a) {
            joiner.add(String.valueOf(obj));
        }
        out.println(joiner);
    }

    void flush() {
        out.flush();
    }
}


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

int main(){
	int r, D, x2000;
	cin >> r >> D >> x2000;
	int x[10];
	x[0] = r * x2000 - D;
	for(int i = 1; i < 10; i++) x[i] = r * x[i-1] - D;
	for(int i = 0; i < 10; i++) cout << x[i] << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
#define mod 1000000007
#define endl '\n'

int main() {
// #ifndef ONLINE_JUDGE
//     freopen("input.txt", "rt", stdin);
//     freopen("output.txt", "w", stdout);
// #endif
    fast
    int n;cin>>n;
    string s;cin>>s;
    int q;cin>>q;
    set<int> st;
    vector<set<int> > v(26, st);
    //vector<int> last(26, -1);
    for(int i=0; i<s.length(); ++i){
    	//cout<<s[i]-'a'<<" "<<i+1<<endl;
    	v[s[i]-'a'].insert(i+1);
    	//last[s[i]-'a']=i+1;
    }
    
    // for(int i=0; i<26; i++){
    // 	set<int> temp=v[i];
    // 	set<int>:: iterator it;
    // 	for(it=temp.begin(); it!=temp.end(); it++){
    // 		cout<<*it<<" ";
    // 	}cout<<endl;
    // }
    //cout<<endl;
    while(q--){
    	int x;cin>>x;
    	if(x==1){
    		int pos;cin>>pos;
    		char c;cin>>c;
    		char x=s[pos-1];
    		v[x-'a'].erase(pos);
    		v[c-'a'].insert(pos);
    		s[pos-1]=c;
    	}
    	else{
    		int l,r;cin>>l>>r;
    		int cnt=0;
    		for(int i=0; i<26; ++i){
    			set<int> :: iterator it;
    			//cout<<" i: "<<i<<endl;
    			it=v[i].lower_bound(l);
    			if(it==v[i].end()) continue;
    			//cout<<l<<" "<<*it<<endl;
    			if(*it<=r && *it>=l) cnt++;
    			//cout<<"cnt:"<<cnt<<endl;
    		}
    		cout<<cnt<<endl;
    	}
    }

    return 0;
}

Measured memory_bytes: 24220
using System;
using System.Collections.Generic;
using System.Linq;
using static Input;

public class Prog
{
    public struct Pair { public int x, y; public Pair(int x, int y) { this.x = x; this.y = y; } }
    public static void Solve()
    {
        int H = NextInt(), W = NextInt();
        List<int>[] a = Enumerable.Range(0, H).Select(v => LineInt().Select(x => x %= 2).ToList()).ToArray();

        List<int[]> ans = new List<int[]>();
        for (int i = 0; i < H; i++)
            for (int j = 0; j < W - 1; j++)
                if (a[i][j] == 1)
                {
                    ans.Add(new int[4] { (i + 1), (j + 1), (i + 1), (j + 2) });
                    a[i][j] = 0;
                    a[i][j + 1] += 1;
                    a[i][j + 1] %= 2;
                }
        for (int i = 0; i < H - 1; i++)
            if (a[i][W - 1] == 1)
            {
                ans.Add(new int[4] { (i + 1), W, (i + 2), W });
                a[i][W - 1] = 0;
                a[i + 1][W - 1] += 1;
                a[i + 1][W - 1] %= 2;
            }
        Console.WriteLine(ans.Count());
        ans.ForEach(v => Console.WriteLine(string.Join(" ", v)));
    }
    public static void Main()
    {
        var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
        Console.SetOut(sw);
        Solve();
        Console.Out.Flush();
    }
    public static long RepPow(long x, long p, long m = 1000000007)
    {
        if (p == 0) return 1;
        if (p == 1) return x % m;
        long b = RepPow(x, p / 2, m) % m;
        if (p % 2 == 0) { return (b * b) % m; }
        else { return (x * ((b * b) % m)) % m; }
    }
}

public class Input
{
    public const long MOD = 1000000007;
    public const int INF = 1000000007;
    private static Queue<string> q = new Queue<string>();
    private static void Confirm() { if (q.Count == 0) foreach (var s in Console.ReadLine().Split(' ')) q.Enqueue(s); }
    public static int NextInt() { Confirm(); return int.Parse(q.Dequeue()); }
    public static long NextLong() { Confirm(); return long.Parse(q.Dequeue()); }
    public static string NextString() { Confirm(); return q.Dequeue(); }
    public static double NextDouble() { Confirm(); return double.Parse(q.Dequeue()); }
    public static int[] LineInt() { return Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); }
    public static long[] LineLong() { return Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); }
    public static string[] LineString() { return Console.ReadLine().Split(' ').ToArray(); }
    public static double[] LineDouble() { return Console.ReadLine().Split(' ').Select(double.Parse).ToArray(); }
    public long Abs(long a, long b) => Math.Abs(a - b);
}


Measured memory_bytes: 30636
open Batteries
open Printf
let () =
  let n = Scanf.scanf "%d " (fun a -> a) in
  let l = Scanf.scanf "%d " (fun a -> a) in
  let s_l = Array.to_list @@ Array.init n (fun _ -> Scanf.scanf "%s " (fun a -> a)) in

  let s_ls = List.sort compare s_l in

  Printf.printf "%s\n" @@
  List.fold_left (^) "" s_ls


Measured memory_bytes: 1664
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		Scanner sc = new Scanner(System.in);
      
		int X = sc.nextInt();
		int N = sc.nextInt();
		List<Integer> list = new ArrayList<Integer>();

		for (int i = 0; i < N; i++) {
			list.add(sc.nextInt());

		}
		for (int i = 0; true; i++) {
			if (!list.contains(X - i)) {
				System.out.println(X - i);
				break;
			} else if (!list.contains(X + i)) {
				System.out.println(X + i);
				break;
			}
		}
	}
}

Measured memory_bytes: 27256
#D - Friends
N,M = map(int,input().split())
par = [i for i in range(N)]
rank = [1] * (N)

def find(x):
    if par[x] == x:
        return x
    else:
        par[x] = find(par[x]) #経路圧縮
        return par[x]

def size(x):
    return par.count(find(x))

def unite(x,y):
    x = find(x)
    y = find(y)
    if x == y : return 0
    if par[x] > par[y]:
        x,y = y,x
    par[y] = x
#    par[x] = x
    if par[x] == par[y]:
        rank[x] += rank[y]
#        rank[y] += rank[x]
#print(par)
#print(rank)
for i in range(M):
    a,b = map(int,input().split())
    a -= 1
    b -= 1
    unite(a,b)
#    print(par)
#    print(rank)
group_count = 0

group_count = max(rank)

# 出力
print(group_count)


Measured memory_bytes: 24588
import java.util.Scanner;

public class Main {

    public static void main( String[] args ){

        Scanner in = new Scanner(System.in);

        String[] params = in.nextLine().split(" ");
        double w = Double.parseDouble(params[0]);
        double h = Double.parseDouble(params[1]);
        double x = Double.parseDouble(params[2]);
        double y = Double.parseDouble(params[3]);


        // 直線上にある場合　面積の半分＋0
        if( x == 0 || y == 0 || x == w || y == h ){
            System.out.println( ( String.format("%.6f", w * h / 2 )) + " 0" );
            return;
        }

        // 図の中心にある場合　面積の半分+1
        if( w / 2 == x && h / 2 == y ){
            System.out.println( ( String.format("%.6f", w * h / 2 )) + " 1");
            return;
        }

        // 対角線上にある場合　面積の半分＋0
        if( h / w == y / x ){
            System.out.println( ( String.format("%.6f", w * h / 2 )) + " 0");
            return;
        }
        if( h/w == (y-h) / -x ){
            System.out.println( ( String.format("%.6f", w * h / 2 )) + " 0");
            return;
        }

//        // h/2==yの場合　面積の半分＋1
//        if( h/2 == y){
//            System.out.println( ( String.format("%.6f", w * h / 2 )) + " 1");
//            return;
//        }
//
//        // w/2==xの場合　面積の半分+1
//        if( w/2 == x){
//            System.out.println( ( String.format("%.6f", w * h / 2 )) + " 1");
//            return;
//        }

        // 上記以外は面積の半分+0
        System.out.println( ( String.format("%.6f", w * h / 2 )) + " 0");
        return;

    }
}

Measured memory_bytes: 21844
using System;
class Program
{
    static void Main(string[] args)
    {
        // スペース区切りの整数の入力
        string[] input = Console.ReadLine().Split(' ');
        int N = int.Parse(input[0]);
        int M = int.Parse(input[1]);

        string[] input2 = Console.ReadLine().Split(' ');
        int sum = 0;
        foreach(var i in input2)
        {
            sum += int.Parse(i);
        }

        int count = 0;
        bool result = false;
        foreach(var i in input2)
        {
            if ( int.Parse(i) >=(float)sum / ((float)4.0f*M))
            {
                count++;
            }

            if ( count >= M)
            {
                result = true;
                break;
            }
        }

        Console.WriteLine((result)?"Yes":"No");

    }
}

Measured memory_bytes: 11092
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> PA;
typedef priority_queue<int, vector<int>, greater<int> > PQG;
#define REP(i, a, n) for(ll i = (ll) a;i < (ll) n;i++)
#define fi first
#define se second
#define pb push_back
#define INF 1000000009
#define MOD 1000000007
#define MAXN 53
#define MAXM 200
#define MAXV 1000000009

int n, m, a[MAXM], b[MAXM], ans, d[MAXN], cnt[MAXN][MAXN];
vector<int> G[MAXN];

bool bfs(int s, int g){
    queue<int> que;
    que.push(s);
    REP(i, 0, n + 1){
        d[i] = INF;
    }
    while(que.size()){
        int pos = que.front();
        que.pop();
        if(pos == g){
            //printf("false s = %d g = %d\n", s, g);
            return false;
        }
        d[pos] = 0;
        REP(i, 0, (int)G[pos].size()){
            if(!(pos == s && G[pos][i] == g || d[G[pos][i]] != INF)){
                que.push(G[pos][i]);
                //printf("s = %d pos = %d G[%d][%d] = %d g = %d\n", s, pos, pos, i, G[pos][i], g);
            }
        }
    }
    return true;
}

int main()
{
    cin >> n >> m;
    REP(i, 0, m){
        cin >> a[i] >> b[i];
        G[a[i]].pb(b[i]);
        G[b[i]].pb(a[i]);
    }
    REP(i, 1, n + 1){
        REP(j, 0, (int)G[i].size()){
            if(bfs(i, G[i][j])){
                cnt[i][G[i][j]] = 1;
            }
        }
    }
    REP(i, 1, n + 1){
        REP(j, i, n + 1){
            if(cnt[i][j] == 1 || cnt[j][i] == 1){
                //printf("i = %d j = %d\n", i, j);
                ans++;
            }
        }
    }
    cout << ans << endl;

    return 0;
}
/*
5 8
0 1 3
1 2 5
2 3 5
3 4 3
4 0 7
0 3 4
2 0 4
4 1 6
*/















Measured memory_bytes: 256
n, m = map(int, input().split())
x = list(map(int, input().split()))
x.sort()

if n < m:
    x_far = [abs(x[i + 1] - x[i]) for i in range(m - 1)]
    x_far.sort()
    ans = 0
    for i in range (m - n):
        ans += x_far[i]
    print(ans)
else:
    print(0)


Measured memory_bytes: 13968
#include<stdio.h>

int main(void)
{

    int q, c, a, n, b[100] = {0}, i;

    scanf("%d", &q);

    for(i = 0; i < q; i++) {
        scanf("%d %d %d", &c, &a, &n);
        while(n) {
            if(c > 0 && a > 0) {
                b[i]++;
                c--;
                a--;
                n--;
            }
            else
                break;
        }
        while(a) {
            if(c >= 2) {
                b[i]++;
                c -= 2;
                a--;
            }
            else
                break;
       }
       b[i] += c / 3;
    }

    for(i = 0; i < q; i++)
        printf("%d\n", b[i]);

    return 0;
}

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

using namespace std;

int main(){
  int convert_num,convert_strings;
  char hairetsu[100000][2];  
  while(cin >> convert_num && convert_num != 0){
    //    cout << convert_num << endl;
    for(int i=0;i<convert_num;i++){

    cin >> hairetsu[i][0] >> hairetsu[i][1];
    //    cout << hairetsu[i][0] << " " << hairetsu[i][1];
    //    cout << endl;
    }
    
    cin >> convert_strings;
    for(int j=0;j<convert_strings;j++){
      char t;
      cin >> t;
      for(int k=0;k<convert_num;k++){
	if(t == hairetsu[k][0]){ 
	  t = hairetsu[k][1];
	  break;
	}
      }
      cout << t;
    }
    cout << endl;
    
  }
  
  
}

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

string S; int dp[100009][13], mod = 1000000007;

int main() {
	cin >> S;
	dp[0][0] = 1;
	for (int i = 0; i < S.size(); i++) {
		for (int j = 0; j < 13; j++) {
			for (int k = 0; k < 10; k++) {
				if (S[i] != '?' && S[i] != ('0' + k)) continue;
				dp[i + 1][(j * 10 + k) % 13] += dp[i][j];
				dp[i + 1][(j * 10 + k) % 13] %= mod;
			}
		}
	}
	cout << dp[S.size()][5] << endl;
	return 0;
}

Measured memory_bytes: 5504
#include <cstdio>
#include <algorithm>
using namespace std;
 
#define iter(i, n) for (int i = 1; i <= n; ++i)
#define forw(i, a, b) for (int i = a; i <= b; ++i)
int n, c[500];


int main() {
	scanf("%d", &n);
	int mind = n;
	iter(i, n) {
		int d;
		scanf("%d", &d); ++c[d];
		mind = min(mind, d);
	}
	if (c[mind] > 2) { puts("Impossible"); return 0; }
	int len = 2 * mind - (c[mind] == 2);
	forw(i, mind + 1, len) if (c[i] < 2) { puts("Impossible"); return 0; }
	forw(i, len + 1, n) if (c[i] > 0) { puts("Impossible"); return 0; }
	puts("Possible");
	return 0;
}

Measured memory_bytes: 128
import java.io.*;
import java.util.*;

class Main {

    public static void main(String[] args) {
       MyScanner sc = new MyScanner();
       int A = sc.nextInt();
       int B = sc.nextInt();

       int ans = Math.max(A+B, A-B);
       ans = Math.max(ans, A*B);
       System.out.println(ans);
    }

    static class MyScanner {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in), 1 << 15);
        StringTokenizer tokenizer;
    
        String next() {
            try {
                while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                    tokenizer = new StringTokenizer(reader.readLine());
                }
            } catch (IOException ignored) {
            }
            return tokenizer.nextToken();
        }
    
        int nextInt() {
            return Integer.parseInt(next());
        }
    
        long nextLong() {
            return Long.parseLong(next());
        }
    }
}

Measured memory_bytes: 22100
//Optional FAST

//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,fma,abm,mmx,avx,avx2,tune=native")

//Required Libraries

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>

//Required namespaces

using namespace std;
using namespace __gnu_pbds;

//Required defines

#define endl '\n'

#define READ(X) cin>>X;
#define READV(X) long long X; cin>>X;
#define READAR(A,N) long long A[N]; for(long long i=0;i<N;i++) {cin>>A[i];}
#define rz(A,N) A.resize(N);
#define sz(X) (long long)(X.size())
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define FORI(a,b,c) for(long long a=b;a<c;a++)
#define FORD(a,b,c) for(long long a=b;a>c;a--)

//Required typedefs

typedef tree<long long,null_type,less<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
typedef tree<long long,null_type,greater<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set1;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<long long,long long> pll;

//Required Constants

const long long inf=(long long)1e18;
const long long MOD=(long long)(1e9+7);
const long long INIT=(long long)(1e6+1);
const long double PI=3.14159265358979;

//Required Functions

ll power(ll x,ll y) 
{ 
    if (y == 0) 
        return 1; 
    ll p = power(x, y/2) % MOD; 
    p = (p * p) % MOD; 
  
    return (y%2 == 0)? p : (x * p) % MOD; 
}
ll modInverse(ll a) 
{ 
   return power(a,MOD-2); 
   
}

//Work

int main()
{
    #ifndef ONLINE_JUDGE
    if (fopen("INPUT.txt", "r"))
    {
        freopen ("INPUT.txt" , "r" , stdin);
        //freopen ("OUTPUT.txt" , "w" , stdout);
    }
    #endif
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    clock_t clk;
    clk = clock();
//-----------------------------------------------------------------------------------------------------------//

    string S;
    cin>>S;
    ll N=S.length();
    FORI(i,0,N)
    {
        if(S[i]=='?')
        {
            cout<<'D';
        }
        else
        {
            cout<<S[i];
        }
    }
    cout<<endl;

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


    clk = clock() - clk;
    cerr << fixed << setprecision(6) << "Time: " << ((double)clk)/CLOCKS_PER_SEC << endl;

    return 0;
}

Measured memory_bytes: 3980
#include <iostream>
#include<cassert>
#include <string>
#include <queue>
#include <cmath>
#include <map>

using namespace std;

#define N 4
#define N2 16
#define L 100

static const int dx[4] = {0,-1,0,1};
static const int dy[4] = {1,0,-1,0};
static const char dir[4] = {'r','u','l','d'};

struct Puzzle{
  int f[N2];
  int space;
  int MD;
};

Puzzle state;
int limit,path[L];
int MDT[N2][N2];


bool isSolved();
bool dfs(int depth,int prev);
int Get(Puzzle pz);
string ID(Puzzle in);

int main(void){
  int i,j;
  string ans;
  Puzzle in;
  
  for(i = 0;i < N2;i++){
    for(j = 0;j < N2;j++){
      MDT[i][j] = abs(i/N-j/N) + abs(i%N-j%N);
    }
  }
    
  for(i = 0;i < N2;i++){
    cin >> in.f[i];
      
    if(in.f[i] == 0){
      in.f[i] = N2;
      in.space = i;
    }
  }
    
  ans = ID(in);
  cout << ans.size() << endl;
    
  return 0;
}






bool isSolved(){
  int i;
  
  for(i = 0;i < N2;i++){
    if(state.f[i] != i+1){
      return false;
    }
  }
    
  return true;
}



bool dfs(int depth,int prev){
  int r;
  Puzzle temp;
  
  if(state.MD == 0){
    return true;
  }
    
  if(depth+state.MD > limit){
    return false;
  }
    
  int sx = state.space/N;
  int sy = state.space%N;
    
  for(r = 0;r < 4;r++){
    int tx = sx+dx[r];
    int ty = sy+dy[r];
	
    if(tx < 0 || ty < 0 || tx >= N || ty >= N){
      continue;
    }
	
    if(max(prev,r) - min(prev,r) == 2){
      continue;
    }
	
    temp = state;
	
    state.MD -= MDT[tx*N+ty][state.f[tx*N+ty]-1];
    state.MD += MDT[sx*N+sy][state.f[tx*N+ty]-1];
	
    swap(state.f[tx*N+ty] , state.f[sx*N+sy]);
	
    state.space = tx*N + ty;
	
    if(dfs(depth+1,r)){
      path[depth] = r;
      return true;
    }
	
    state = temp;
  }
    
  return false;
}



int Get(Puzzle pz){
  int i;
  int sum = 0;
  
  for(i = 0;i < N2;i++){
    if(pz.f[i] == N2){
      continue;
    }
	
    sum += MDT[i][pz.f[i]-1];
  }
    
  return sum;
}



string ID(Puzzle in)
{
  int i;
  
  in.MD = Get(in);
    
  for(limit = in.MD;limit <= L;limit++){
      state=in;
      
      if(dfs(0,-100)){
	  string ans = "";
	    
	  for(i = 0;i < limit;i++){
	      ans += dir[path[i]];
	    }
	    
	  return ans;
        }
    }
    
  return "unsolvable";
}



Measured memory_bytes: 3232
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    
    /*-----------------Code Begins Here------------------*/
    
    ll n; cin>>n;
    ll c0=0,c1=0,c2=0,c3=0;
    while(n--){
        string s; cin>>s;
        if(s == "AC") c0++;
        else if(s == "WA") c1++;
        else if(s == "TLE") c2++;
        else c3++;
    }
    cout<<"AC x "<<c0<<'\n';
    cout<<"WA x "<<c1<<'\n';
    cout<<"TLE x "<<c2<<'\n';
    cout<<"RE x "<<c3;
    
    /*------------------Code Ends Here-------------------*/
    
    return 0;
}

Measured memory_bytes: 3652
#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <algorithm>
#include <cstring>
using namespace std;

typedef long long ll;

int pw[50],N;

class UnionFind {
public:
  vector<int> data;
  UnionFind(int size) : data(size, -1) { }
  bool unionSet(int x, int y) {
    x = root(x); y = root(y);
    if (x != y) {
      if (data[y] < data[x]) swap(x, y);
      data[x] += data[y]; data[y] = x;
    }
    return x != y;
  }
  bool findSet(int x, int y) {
    return root(x) == root(y);
  }
  int root(int x) {
    return data[x] < 0 ? x : data[x] = root(data[x]);
  }
  int size(int x) {
    return -data[root(x)];
  }
};

class Edge
{
public:
	int src, dst;
	Edge(int src, int dst)
	:src(src),dst(dst)
	{}
};

typedef vector<vector<Edge> > Graph;

ll paint[40], rest[40];
ll relt;

ll dfs(int p, ll used, ll score, Graph& g, vector<int>& group)
{	
	if(p==group.size()) return score;
	if(used >> group[p] & 1) return dfs(p+1, used, score, g, group);
	if(score + rest[group[p]] <= relt) return 0;

	ll res = score;
	ll tmp = used | paint[group[p]];
	res = max(res, dfs(p+1, tmp, score+pw[group[p]], g, group));
	res = max(res, dfs(p+1, used, score, g, group));
	
	relt = max(res, relt);
	return res;
}

int main()
{
	while(cin >> N, N) {
		memset(rest, 0, sizeof(rest));

		int gcnt = 0;
		map<string, int> dic;
		Graph graph(N);
		UnionFind uf(N);

		for(int i=0; i<N; i++) {
			string src;
			cin >> src;

			if(!dic.count(src)) dic[src] = gcnt++;
			int s = dic[src];

			cin >> pw[s];
	
			int M;
			cin >> M;
			
			for(int i=0; i<M; i++) {
				string dst;
				cin >> dst;
				
				if(!dic.count(dst)) dic[dst] = gcnt++;
				int t = dic[dst];

				graph[s].push_back(Edge(s,t));
				uf.unionSet(s,t);
			}
		}

		for(int i=0; i<N; i++) {
			paint[i] = (1LL << i);
			for(int j=0; j<graph[i].size(); j++) {
				paint[i] |= (1LL << graph[i][j].dst);
			}
		}

		vector<vector<int> > groups(N);

		for(int i=0; i<N; i++) {
			groups[uf.root(i)].push_back(i);
			rest[uf.root(i)] += pw[i];
		}

		for(int i=0; i<N; i++) {
		for(int j=0; j<groups[i].size(); j++)
			rest[groups[i][j]] = rest[uf.root(groups[i][j])];
		}

		for(int i=0; i<groups.size(); i++) {
			for(int j=1; j<groups[i].size(); j++) {
				rest[groups[i][j]] = rest[groups[i][j-1]] - pw[groups[i][j-1]];
			}
		} 

		ll res = pw[0];
		ll init = paint[0];
		for(int i=0; i<groups.size(); i++) {
			if(groups[i].size() == 0) continue;
			relt = 0;
			res += dfs(0, init, 0, graph, groups[i]);
		} 

		cout << res << endl;
	}
}

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

int main() {
    int n, w[110];
    cin >> n;
    int sum1 = 0;;
    for (int i = 0; i < n; i++) {
        cin >> w[i];
        sum1 += w[i];
    }

    int sum2 = 0, ans = 1000100;
    for (int i = 0; i < n; i++) {
        sum2 += w[i];
        ans = min(ans, abs((sum1 - sum2) - sum2));
    }

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
using ll=long long;
#define rep(i,a,n) for(int i=a;i<n;i++)
#define ALL(s) s.begin(),s.end()
#define P pair<ll,ll>
#define vl vector<ll>
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vvl vector<vector<ll>>
#define print(n) cout<<n<<endl
const int M=100111;
const int mod=1000000007;
const long long inf=1000000000000000007;
int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};
int ddx[8]={1,-1,0,0,1,-1,-1,1},ddy[8]={0,0,1,-1,1,-1,1,-1};

int div(int x){
	if(x%4==0)return 2;
	else if(x%2==0)return 1;
	else return 0;
}

int main(){
	int n;
	int a[M];
	cin>>n;
	rep(i,0,n){
		cin>>a[i];
		a[i]=div(a[i]);
	}
	int num=0;
	rep(i,0,n)num+=a[i];
	if(n%2==0)num--;
	if(num>=n-1)print("Yes");
	else print("No");
}

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

#define fi first
#define se second
#define ll long long
#define pb push_back
#define mp make_pair
#define mt make_tuple

using namespace std;

int niz[100010];
int mapa[100010];
int mark[100010];
vector<int> graf[100010];

void dfs(int x, int boja)
{
    mark[x] = boja;
    for(int i = 0; i < graf[x].size(); i++)
    {
        int cvor = graf[x][i];
        if(mark[cvor] == 0) dfs(cvor, boja);
    }
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int n, m;
    cin >> n >> m;
    for(int i = 1; i <= n; i++)
    {
        cin >> niz[i];
        mapa[niz[i]] = i;
    }
    for(int i = 0; i < m; i++)
    {
        int a, b;
        cin >> a >> b;
        graf[a].pb(b);
        graf[b].pb(a);
    }
    int boja = 1;
    for(int i = 1; i <= n; i++)
    {
        if(mark[i] == 0)
        {
            dfs(i, boja);
            boja++;
        }
    }
    int res = 0;
    for(int i = 1; i <= n; i++)
        if(mark[mapa[i]] == mark[i]) res++;

    cout << res;

    return 0;
}


Measured memory_bytes: 9984
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define FOR(i, a, b) for(ll i = a; i < b; i++)
#define rep(i, n) FOR(i, 0, n)
#define rFOR(i, a, b) for(ll i = a - 1; i >= b; i--)
#define rrep(i, a) rFOR(i, a, 0)
#define pb push_back
using namespace std;
using ll = long long;
using ld = long double;
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<P> vP;
typedef vector<char> vc;
typedef vector<vc> vvc;
const ll MOD = 1000000007;
const ll MOD2 = 998244353;
const ld PI = acos(-1);
const ll INF = 1e18;
struct edge{ll to, cost;};

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

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

class UnionFind {
public:
    vector<int> par;
    vector<int> rnk;
    vector<ll> siz;
    UnionFind(int N): par(N), rnk(N), siz(N){
        for(int i = 0; i < N; i++){
            par[i] = i, rnk[i] = 0, siz[i] = 1;
        }
    }
    //根
    int find(int x){
        if(par[x] ==x )return x;
        return par[x] = find(par[x]);
    }
    void unite(int x, int y){
        int rx = find(x);
        int ry = find(y);
        if (rx == ry) return;
        if(rnk[rx] < rnk[ry]){
            par[rx] = ry;
            siz[ry] += siz[rx];
            siz[rx] = 0;
        }
        else{
            par[ry] = rx;
            siz[rx] += siz[ry];
            siz[ry] = 0;
            if(rnk[rx] == rnk[ry]){
                rnk[rx]++;
            }
        }
    }
    //集合が同じか
    bool same(int x, int y){
        return find(x) == find(y);
    }
    //集合の大きさ
    int size(int x){
        return siz[find(x)];
    }
};

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N;
    cin >> N;
    int K,L;
    cin >> K >> L;
    UnionFind tree0(N),tree1(N);
    rep(i,K){
        int a,b;
        cin >> a >> b;
        a--;b--;
        tree0.unite(a,b);
    }
    rep(i,L){
        int a,b;
        cin >> a >> b;
        a--;b--;
        tree1.unite(a,b);
    }
    map<P,int> mp;
    rep(i,N){
        mp[{tree0.find(i),tree1.find(i)}]++;
    }
    rep(i,N){
        cout << mp[{tree0.find(i),tree1.find(i)}] << ' ';
    }
}
/*
overflow checked?
corner case checked?
boundary checked?
not TLE in worst case checked?
*/

Measured memory_bytes: 20464
import qualified Data.ByteString.Char8 as C
import Data.Maybe (fromJust)
import Data.Ratio
import Data.List 

getParms :: IO [Int]
getParms = map (fst . fromJust . C.readInt) . C.words <$> C.getLine

main :: IO ()
main = do
  as <- getParms
  let (sw,s) = select as
  putStrLn $ show sw ++ " " ++ show s

type SW = Int -- SugarWater
type S  = Int -- Sugar

ratio :: (SW, S) -> Maybe (Ratio Int)
ratio (a,b) = if a==0 then Nothing 
                      else Just (b % a) 

combinations :: [Int] -> [(SW,S)]
combinations [a,b,c,d,_e,f] 
  = [(w + s,s)
      | let fa = f `div` (100*a)
      , na <- [0 .. fa]
      , let fb = (f-100*a*na) `div` (100*b)
      , nb <- [0 .. fb]
      , let w = 100*(a*na + b*nb)
      , let fc = (f-w) `div` c
      , nc <- [0 .. fc]
      , let fd = (f-w-c*nc) `div` d
      , nd <- [0 .. fd]
      , let s = c*nc + d*nd
--      , na + nb > 0
--      , nc + nd > 0
      ]

select :: [Int] -> (SW,S)
select as@[a,b,c,d,e,f] = h e ls l
  where
    (l:ls) = combinations as

    h :: Int -> [(SW,S)] -> (SW,S) -> (SW,S)
    h _ []     best     = best
    h e (m:ms) best
      | rmax < ratio best = h e ms m
      | rmax == rm      = m
      | rmax <  rm      = h e ms best
      | ratio best < rm
          && rm < rmax  = h e ms m
      | otherwise       = h e ms best
      where
        rm = ratio m
        rmax = ratio (e+100, e)


Measured memory_bytes: 2428
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
#include <functional>
#include <cctype>

using namespace std;

#define REP(i,n) for(int i = 0; i < (int)n; ++i)

int main()
{
	int n,quant;
	string name;
	int time;
	queue< pair<string, int> > proc;

	cin  >> n >> quant;
	REP(i, n) {
		cin >> name >> time;
		proc.push(make_pair(name, time));
	}

	int c = 0;

	while(!proc.empty()) {
		pair<string, int> p;
		p = proc.front();
		proc.pop();
		if(p.second <= quant) {
			c += p.second;
			cout << p.first << ' ' << c << endl;
		}
		else {
			c += quant;
			p.second -= quant;
			proc.push(p);
		}
	}
	return 0;
}

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

#define ll long long
#define ii pair<int, int>
#define vi vector<int>
#define vl vector<ll>
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define pi 3.14159265

using namespace std;
#define prime 1000000007

const ll N = 300005;

#define W(x) cerr << "\033[31m" << #x << " = " << x << "\033[0m" << endl;

ll k, a, b;

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

    if(a >= b || a >= k){
        printf("%lld\n", 1+k);
        return 0;
    }

    printf("%lld\n", max(1+k, b+( ((k-a-1)/2) * (b-a)   ) + ((k-a+1)%2) ));


    
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);			//文字の入力
		int N = sc.nextInt();
		int Q = sc.nextInt();
		String ss = sc.next();
		int[] l = new int[Q];
		int[] r = new int[Q];

		for(int i = 0;i < Q;i++){
			l[i] = sc.nextInt();
			r[i] = sc.nextInt();
		}

		int[] ruisekiwa = new int[N+1];
		ruisekiwa[0] = 0;
		for(int i = 0;i < N-1;i++){
			if(ss.charAt(i) == 'A' && ss.charAt(i+1) == 'C'){
				ruisekiwa[i+1] = ruisekiwa[i] + 1;
			}else{
				ruisekiwa[i+1] = ruisekiwa[i];
			}
		}
		
		
		int[] ans = new int[Q];

		for(int i = 0;i < Q;i++){
			int count = 0;
			ans[i] = ruisekiwa[r[i]-1] - ruisekiwa[l[i]-1];
		}

		for(int i = 0;i < Q;i++){
			System.out.println(ans[i]);
		}


	}


}


class Pair implements Comparable{
	int from;
	int end;
	@Override
	public int compareTo(Object other) {
		Pair otherpair = (Pair)other;

		return from - otherpair.from;
	}
}




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

#define ll long long

ll dp[3003][3003];
ll n, k, arr[3003], sum = 0;

int32_t main()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> arr[i];
		sum += arr[i];
	}

	for (int l = n - 1; l >= 0; l--) {
		for (int r = l; r <= n - 1; r++) {
			int x = r - l + 1, turn;
			if (((x & 1) && (n & 1)) || ((n % 2 == 0) && (x % 2 == 0))) {
				turn = 0;
			}
			else {
				turn = 1;
			}
			
			if (turn == 0) {
				if (l == r) {
					dp[l][r] = arr[r];
					continue;
				}
				dp[l][r] = max(arr[l] + dp[l + 1][r], arr[r] + dp[l][r - 1]);
			}
			else {
				if (l == r) {
					dp[l][r] = 0;
					continue;
				}
				dp[l][r] = min (dp[l + 1][r], dp[l][r - 1]);
			}
		}
	}

	ll x = dp[0][n - 1];
	ll y = sum - x;
	ll ans = x - y; // 2x - sum
	cout << ans;


	return 0;
}


Measured memory_bytes: 70016
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, o, n) for (auto i = (o); (i) < (n); ++(i))
#define FOR1(i, n) FOR(i, 1, n+1)
#define REP(i, n) FOR(i, 0, n)
#define REPR(i, n) for (auto i = (n)-1; (i) >= 0; --i)
#define REPI(itr, v) for (auto itr = v.begin(); itr != v.end(); ++itr)
#define REPIR(itr, v) for (auto itr = v.rbegin(); itr != v.rend(); ++itr)
#define fi first
#define se second
#define ll long long
#define int long long
#define V2(name, h, w) vector<vector<int> > name((h), vector<int>(w));

#define dl(line) cerr << "RUN: until " << (line) << "th line." << endl
#define dv(name, value) cerr << (name) << " is " << (value) << endl
#define da(v)  cerr << "["; REPI(itr, v){cerr << *itr << (itr != --v.end() ? ", " : "");} cerr << "]" << endl


void solve(long long N, std::string S){
  int cnt = 0;
  FOR(x, 0, (ll)S.size()-2) {
    if(S.at(x) == 'A' and S.at(x+1) == 'B' and S.at(x+2) == 'C') {
      cnt += 1;
    }
  }
  cout << cnt << endl;
}

signed main(){
  long long N;
  scanf("%lld",&N);
  std::string S;
  std::cin >> S;
  solve(N, S);
}


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


#define FOR(i, start, end) for(uint64_t i=start; i<end; i++)
#define REP(i, n) FOR(i, 0, n)

// 最大公約数gcd
// 最小公倍数lcm=m*n/gcd
uint64_t gcd(uint64_t m, uint64_t n) {
  uint64_t temp;
  while (m % n != 0){
    temp = n;
    n = m % n;
    m = temp;
  }
  return n;
}

uint64_t lcm(uint64_t m, uint64_t n) {
  return (m*n)/gcd(m,n);
}

void comb(vector<vector <uint64_t> > &v){
  for(uint64_t i = 0;i <v.size(); i++){
    v[i][0]=1;
    v[i][i]=1;
  }
  for(uint64_t k = 1;k <v.size();k++){
    for(uint64_t j = 1;j<k;j++){
      v[k][j]=(v[k-1][j-1]+v[k-1][j]);
    }
  }
}

// 掛け算オーバーフロー判定
bool is_product_overflow(uint64_t a, uint64_t b) {

	uint64_t prod = a * b;
	
	return (prod / b != a);
}

//素因数分解
void primeFactorization(uint64_t a, list<uint64_t> &factors){ //素因数分解を出力するプログラム
  long i,sq;
  if(a%2==0){ //偶数の場合
    factors.push_back(2);
    primeFactorization(a/2,factors); //2で割った値で再帰
    return;
  }
  sq = sqrt(a);
  for(i=3;i<=sq;i+=2){ //3以上√a以下の奇数の場合
	if(a%i==0){
	  factors.push_back(i);
      primeFactorization(a/i,factors); //割れた値で再帰
      return;
	}
  }
  //偶数でも3以上√a以下の奇数の場合でも割り切れない場合
  if(a!=1){ //aが1でないなら、a自身は素数
    factors.push_back(a);
  }
}

// 円周率
// M_PI

// #include <iomanip> // setprecisionを使用するのに必要
// cout << std::fixed << std::setprecision(15) << y << endl;

// 昇順
// priority_queue<int, vector<int>, greater<int> > queue;

signed main() {
  double a,b,C;
  cin >> a >> b >> C;
  double h = b*sin(C*M_PI/180.0);
  double area = a*h/2.0;
  double a1 = b*cos(C*M_PI/180.0);
  double x = sqrt(h*h + (a-a1)*(a-a1));
  cout << fixed << setprecision(5) << area << endl;
  cout << fixed << setprecision(5) << a+b+x << endl;
  cout << fixed << setprecision(5) << h << endl;
  return 0;
}


Measured memory_bytes: 3576
#include <iostream>
#include <algorithm>
using namespace std;
#define INF 100000000

int map[100][100];
int n,k,cou,tmin;
int dd[101],col[100];

int main(){
  int t,a,b,c,d,e;
  cin >> n >> k;
  while(n!=0&&k!=0){
    for (int i=0;i<10000;i++)map[i/100][i%100]=0;
    for (int i=0;i<k;i++){
      cin >> t;
      //      for (int y=0;y<k;y++){
      //for (int x=0;x<k;x++)
      //  cout << map[y][x] << " ";
      //cout << endl;
      //}
      if (t == 0){
	cin >> a >> b;
	for (int j=0;j<101;j++)dd[j]=INF;
	for (int j=0;j<101;j++)col[j]=0;
	dd[a-1]=0;
	cou = 1;
	col[a-1]=1;
	for (int m=0;m<n;m++)
	  if(map[a-1][m]>0)
	    dd[m]=min(dd[m],dd[a-1]+map[a-1][m]);

	while (cou < n){
	  tmin=100;
	  for (int m=0;m<n;m++) 
	    if (col[m]==0)
	      if (dd[tmin]>dd[m]) tmin = m;

	  // for (int m=0;m<n;m++)cout << dd[m] << " ";//Dbg
	  // cout << endl;//Dbg

	  col[tmin]=1;
	  cou ++;

	  for (int m=0;m<n;m++)
	    if(map[tmin][m]>0)
	      dd[m]=min(dd[m],dd[tmin]+map[tmin][m]);
	}
	if (dd[b-1]==INF)cout << -1 << endl;
	else cout << dd[b-1] <<endl;
      }else{
	cin >> c >> d >> e;
	c--;d--;
	if (map[c][d]==0){
	  map[c][d]=e;
	  map[d][c]=e;
	}
	map[c][d]=min(map[c][d],e);
	map[d][c]=min(map[d][c],e);
      }
    }
    cin >> n >> k;
  }
  return 0;
}

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

int main() {
    int N;
    cin >> N;
    //vector<int> x(N),y(N),h(N);
    vector<vector<int>> hxy(N,vector<int>(3));
    for ( int i = 0; i < N; ++i){
        cin >> hxy[i][1] >> hxy[i][2] >> hxy[i][0];
    }
    
    //sort(hxy.begin(),hxy.end(),greater<int>());
    sort(hxy.begin(),hxy.end());
    reverse(hxy.begin(),hxy.end());
    
    /*for ( vector<int> p : hxy ){
        cout << p[0] << " " << p[1] << " " << p[2] << endl;
    }*/
    
    
    int ansx = 0;
    int ansy = 0;
    int ansh = 0;
    for ( int cx = 0; cx <= 100; ++cx){
        for ( int cy = 0; cy <= 100; ++cy){
            int h;
            h = hxy[0][0] + abs(cx-hxy[0][1]) + abs(cy-hxy[0][2]);
            bool flg = true;
            for ( int i = 1; i < N; ++i){
                int hi;
                hi = max( h - abs(cx-hxy[i][1]) - abs(cy-hxy[i][2]),0);
                if ( hi != hxy[i][0] ) {
                    flg = false;
                    break;
                }
            }
            if ( flg ){
                ansx = cx;
                ansy = cy;
                ansh = h;
            }
        }
    }
    cout << ansx << " " << ansy << " " << ansh << endl;
    
    return 0;
}

Measured memory_bytes: 3668
#include<stdio.h>
int main(){
  int e[4]={0,0,0,0},i,j,k=0;
  scanf("%d%d%d%d",&e[0],&e[1],&e[2],&e[3]);
  if(e[0]==e[3]&&e[1]==e[2]||e[1]==e[2]&&e[0]==e[3]||e[2]==e[3]&&e[0]==e[1]){
    printf("yes\n");
  }else{
    printf("no\n");
  }
  return 0;
}

Measured memory_bytes: 580
use itertools::Itertools;
use proconio::input;
use proconio::marker::Usize1;

fn main() {
    input! {
        n: usize, m: u64, q: usize,
        query: [(Usize1, Usize1, u64, u64); q]
    }
    let ans = (1..=m)
        .combinations_with_replacement(n)
        .map(|seq| {
            query
                .iter()
                .filter(|&&(a, b, c, _)| seq[b] - seq[a] == c)
                .map(|&(_, _, _, d)| d)
                .sum::<u64>()
        })
        .max()
        .unwrap();
    println!("{}", ans);
}


Measured memory_bytes: 2196
//                        DushtuBunny
//                        Rahul Halder    
//    Indian Institute of Engineering Science & Technology,Shibpur


#include <bits/stdc++.h>

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long
#define f first
#define se second
#define LB lower_bound
#define UB upper_bound
#define pb push_back
#define mp make_pair
#define vll vector<ll>
#define vi vector<int>
#define vc vector<char>
#define vpll vector<pair<ll,ll>>
const unsigned int MOD = 1000000007;

using namespace std;

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

    IOS;
    int T;
    // cin>>T;
    T=1;

    while(T--)
    {
        string s;
        cin>>s;

        if(s[1]=='B')
            cout<<"ARC";
        else
            cout<<"ABC";
    }
    

    return 0;
}

Measured memory_bytes: 3640
#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
using namespace std;
#define int long long
#define REP(i,m,n) for(int i=(m);i<(n);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define all(a) a.begin(),a.end()
#define rall(c) (c).rbegin(),(c).rend()
#define mp make_pair
#define endl '\n'
typedef long long ll;
typedef pair<ll,ll> pll;
typedef long double ld;
const ll inf=1e9+7;
const ll mod=998244353;
signed main(){
    map<ll,ll>minbit;
    ll n;cin>>n;
    ll grundy=0;
    rep(i,n){
        ll a;cin>>a;
        ll k=0;
        rep(j,64){
            if(a&(1LL<<j)){
                k=j;
                break;
            }
        }
        minbit[k]++;
        grundy^=a;
    }
    bool f=1;
    ll cnt=0;
    for(int i=63;i>=0;i--){
        if(grundy&(1LL<<i)){
            if(minbit[i]==0)f=0;
            else{
                ll k=(1LL<<(i+1))-1;
                grundy^=k;
                cnt++;
            }
        }
    }
    if(f)cout<<cnt<<endl;
    else cout<<-1<<endl;
}

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

const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};


mint dp[10005][105][2];

int main() {
  string s;
  cin >> s;
  int n;
  cin >> n;
  dp[0][0][0] = 1;
  rep(i,s.size())rep(j,n)rep(k,2){
    int nd = s[i]-'0';
    rep(d,10) {
      int ni = i+1, nj = (j+d)%n, nk = k;
      if (k == 0) {
        if (d > nd) continue;
        if (d < nd) nk = 1;
      }
      dp[ni][nj][nk] += dp[i][j][k];
    }
  }
  mint ans = dp[s.size()][0][0];
  ans += dp[s.size()][0][1];
  ans -=1;
  cout << ans.x << endl;
  return 0;
}


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

int main()
{
	string s;
	int i;
	cin >> s;
	for(i=0;i<s.size()-1;i++)
		if(s[i]=='A' && s[i+1]=='C') break;
	if(i==s.size()-1) cout << "No\n"; 
	else cout << "Yes\n";
}

Measured memory_bytes: 256
s=int(input())

L=[s]
N=s
for i in range(10000000):
    if N%2==0:
        if N//2 in L:
            print(i+2)
            #print(L)
            break
        else:
            L.append(N//2)
            N=N//2
    else:
        if 3*N+1 in L:
            print(i+2)
            #print(L)
            break
        else:
            L.append(3*N+1)
            N=3*N+1

Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define int long long
#define fi first
#define se second
#define mp make_pair
#define pii pair<int,int>
using namespace std;

const int N=2e5+5;
const int mod=998244353;
const int div2=(mod+1)/2;
int n;
pii a[N],b[N];

void solve()
{
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        int l,r;
        cin>>l>>r;
        a[i]=mp(l,r);
        b[i]=mp(r,l);
    }
    sort(a+1,a+n+1);
    sort(b+1,b+n+1);
    if(n%2)
    {
        int x=a[n/2+1].fi;
        int y=b[n/2+1].fi;
        cout<<y-x+1;
        return ;
    }
    int x1=a[n/2].fi;
    int y1=b[n/2].fi;
    int x2=a[n/2+1].fi;
    int y2=b[n/2+1].fi;
    cout<<(y2-x2+1)+(y1-x1);
}


main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    //int t;
    //cin>>t;
    //while(t--)
        solve();
}


Measured memory_bytes: 9900
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = getString(sc);

		String[] sArr = s.split("");

		int max = 0;
		int tmp = 0;
		for (String str : sArr) {
			if (str.equals("A") || str.equals("C") || str.equals("G") || str.equals("T")) {
				tmp++;
			} else {
				if (max < tmp) {
					max = tmp;
				}
				tmp = 0;
			}
		}

		if (max < tmp) {
			max = tmp;
		}
		System.out.println(max);
	}

	/**
	 * *汎用メソッド <br>
	 * スキャナーからの入力値をlongで返却
	 *
	 * @return
	 */
	public static long getLong(Scanner sc) {

		return Long.parseLong(sc.next());
	}

	/**
	 * *汎用メソッド <br>
	 * スキャナーからの入力値をintで返却
	 *
	 * @return
	 */
	public static int getInt(Scanner sc) {

		return Integer.parseInt(sc.next());
	}

	/**
	 * *汎用メソッド <br>
	 * スキャナーからの入力値をStringで返却
	 *
	 * @return
	 */
	public static String getString(Scanner sc) {

		return sc.next();
	}

	/**
	 * *汎用メソッド <br>
	 * スキャナーからの入力値をint配列で返却
	 *
	 * @return
	 */
	public static int[] getIntArray(Scanner sc) {
		String line = "";
		// 直前にnext()を実行していると改行コードだけ取ってしまうのでその対策
		while (line.equals("")) {
			line = sc.nextLine();
		}

		String[] strArray = line.split(" ");
		int[] intArray = new int[strArray.length];
		for (int i = 0; i < strArray.length; i++) {
			intArray[i] = Integer.parseInt(strArray[i]);
		}
		return intArray;
	}

}


Measured memory_bytes: 23252
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using db = double;
#define fi first
#define se second
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define siz(v) (ll)(v).size()
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define repn(i,n) for(ll i=0;i<=(ll)(n);i++)
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
const ll mod = 1000000007;
const ll INF = 1000000099;
vector<ll> dx={-1,1,0,0},dy={0,0,-1,1};
//cin.tie(0);
//ios::sync_with_stdio(false);



signed main(){
    ll n,ans=0;cin>>n;



    if(9<=n){
        ans+=9;
    }else{
        ans+=n;
        cout<<ans<<endl;
        return 0;
    }

    if(999<=n){
        ans+=900;
    }else{
        ans+=max(n-99,0ll);
        cout<<ans<<endl;
        return 0;
    }
    
    if(99999<=n){
        ans+=90000;
    }else{
        ans+=max(n-9999,0ll);
    }
    cout<<ans<<endl;

}

Measured memory_bytes: 256