akhauriyash/Code-Regression huggingface dataset:
#include	<bits/stdc++.h>
using	namespace	std;
typedef	long long ll;

// int/long:		-2,147,483,648 - 2,147,483,647 (-2^31 <= int < 2^31)
// long/long long:	-9,223,372,036,854,775,808 - 9,223,372,036,854,775,807 (-2^63 <= long < 2^63)

// lower_bound(A.begin(), A.end(), N)
// upper_bound(...

// A.erase(unique(A.begin(), A.end()), A.end())

// bit: &/and, |/or, ^/xor, ~/not

// getline(cin, String)
// while (getline(cin, S)) {}

// cout <<fixed <<setprecision(10)

// priority_queue<int> q;
// priority_queue<int, vector<int>, less<int>> q; // Default: vector, less
// priority_queue<vector<int>, vector<vector<int>>, greater<vector<int>>> q;

// Graph
// Warshall-Floyd: Distance between each node, N^3
// Dijkstra: Distance from the start node, N^2
// DFS(Depth-First Search)

//
// Notes
//
// When specified less than N, try full scan.
// RE: empty vector
// Check Qs
// long/int
// xor -> count each bit
// Check values
// 	1,000,000 -> Loop
// 	100,000	-> vector(int:400KB, long:800KB) 

#define	INF (1<<30)
//1,073,741,824
//= 536,870,912 *2

#define	MOD 1000000007

#define	Rep0(i, n)	for (int i=0; i<n; i++)
#define	Rep1(i, n)	for (int i=1; i<=n; i++)
#define Sort(P)	sort(P.begin(), P.end())
#define Rev(P)	reverse(P.begin(), P.end())

int	main() {
	string S;
	cin >>S;
	Rep0(i, S.size())
		cout <<'x';
	cout <<endl;
	return 0;
}



Measured memory_bytes: 256
using System;

namespace AtCoder.Problems
{
    public class ProblemB
    {
        public static void Main(string[] args)
        {
            var s = new SolveB();
            s.Solve();
        }

        public class Scanner
        {
            private string[] _s;
            private int _i;
            private readonly char[] _separators = new char[] { ' ' };

            public Scanner()
            {
                _s = new string[0];
                _i = 0;
            }

            public string Next()
            {
                if (_i < _s.Length) return _s[_i++];
                string st = Console.ReadLine();
                while (st == "") st = Console.ReadLine();
                _s = st.Split(_separators, StringSplitOptions.RemoveEmptyEntries);
                if (_s.Length == 0) return Next();
                _i = 0;
                return _s[_i++];
            }

            public int NextInt() => int.Parse(Next());
            public long NextLong() => long.Parse(Next());
            public ulong NextULong() => ulong.Parse(Next());
            public double NextDouble() => double.Parse(Next());

            public int[] GetIntArray(int n, int add = 0)
            {
                int[] array = new int[n];
                for (int i = 0; i < n; i++)
                {
                    array[i] = NextInt() + add;
                }
                return array;
            }

            public long[] GetLongArray(int n, long add = 0)
            {
                long[] array = new long[n];
                for (int i = 0; i < n; i++)
                {
                    array[i] = NextLong() + add;
                }
                return array;
            }

            public double[] GetDoubleArray(int n, double add = 0)
            {
                double[] array = new double[n];
                for (int i = 0; i < n; i++)
                {
                    array[i] = NextDouble() + add;
                }
                return array;
            }
        }
    }

    public class SolveB
    {
        public void Solve()
        {
            var cin = new ProblemB.Scanner();
            var n = cin.NextLong();
            var a = cin.NextLong();
            var b = cin.NextLong();

            var result = GetAnswer(n, a, b);
            Console.WriteLine(result);
        }

        public long GetAnswer(long n, long a, long b)
        {
            return n / (a + b) * a + Math.Min(n % (a + b), a);
        }
    }
}


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

using namespace std;

namespace IO {
	const int SIZE = 1 << 20;
	char buf[SIZE + 10], *iS, *iT;
	inline char Getc() {
		return iS == iT && (iT = (iS = buf) + fread(buf, 1, SIZE, stdin), iS == iT) ? EOF : *iS++;
	}
	template <class TT>
	inline void Read(TT &x) {
		x = 0; register char cc = '\0'; TT fff = 1;
		for (; cc < '0' || cc > '9'; cc = Getc())
			if (cc == '-') fff = -1;
		for (; cc >= '0' && cc <= '9'; cc = Getc())
			x = (x << 1) + (x << 3) + (cc & 15);
		x *= fff;
	}
}
using IO::Read;

typedef long long LL;

bool flag;
int q, n, flen, lim, L, R, mid, A, B, C, D;

inline char Query(int pos) {
	if (pos <= lim) {
		return pos % (flen + 1) ? 'A' : 'B';
	} else {
		pos = n - pos + 1;
		return pos % (flen + 1) ? 'B' : 'A';
	}
}

inline int Divup(int x, int y) { return max(0, (x + y - 1) / y); }

inline bool Check() {
	if ((LL)B * (flen + 1) + flen < mid) return false;
	int numb = B - Divup(mid - flen, flen + 1);
	int numa = A - (mid - Divup(mid - flen, flen + 1));
	if ((LL)numa * flen + flen >= numb) return true;
	return false;
}

int main()
{
	Read(q);
	while (q--) {
		Read(A), Read(B), Read(C), Read(D);
		flen = Divup(max(A, B), min(A, B) + 1);
		n = A + B;
		L = 0, R = n, mid = 0, lim = 0;
		while (L <= R) {
			mid = (L + R) >> 1;
			if (mid != 0 && mid % (flen + 1) == 0) {
				if (mid != L) --mid;
				else if (mid != R) ++mid;
				else break;
			}
			if (Check())
				lim = mid, L = mid + 1;
			else 
				R = mid - 1;
		}
		/* printf("%d %d\n", flen, lim); */
		for (int i = C; i <= D; ++i)
			putchar(Query(i));
		putchar('\n');
	}

	return 0;
}


Measured memory_bytes: 384
/*
		Author : Kaustubh Gangwar
		||S||A||M||R||A||T||
*/
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define ld long double
#define pb push_back
#define gcd __gcd
#define mp make_pair
#define vii vector<int>
#define vll vector<long long>
#define all(x) x.begin(),x.end()
#define f(i,a,b) for(int i=a;i<b;i++)
#define fe(i,a,b) for(int i=a;i<=b;i++)
typedef long long  ll;
typedef pair<int,int> pii;

ll bpow(ll a, ll b) {
	a=a;
    long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}

int main()
{	ios_base::sync_with_stdio(false);
	cin.tie(0),cout.tie(0);
	ll test=1;
	//cin>>test;
	while(test--)
	{ 
		int x,y;
		cin>>x>>y;
		if((y/2-x)>=0 && (2*x - y/2)>=0 && (y%2==0))
		cout<<"Yes\n";
		else
		cout<<"No\n";
		
		
		
		
	}
return 0;
}


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

#define int         long long
#define pb          push_back
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define x           first
#define y           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define rep(i,a,b)  for(int i=a;i<b;i++)
using namespace std;

void solve(){
    int n,ans=0;
    map<char,set<string>> mp;
    cin>>n;
    rep(i,0,n){
        string s;
        cin>>s;
        mp[s[0]].insert(s);
    }
    int x[]={sz(mp['M']),sz(mp['A']),sz(mp['R']),sz(mp['C']),sz(mp['H'])};
    rep(i,0,5){
        rep(j,i+1,5){
            rep(k,j+1,5){
                ans=(ans+x[i]*x[j]*x[k]);
            }
        }
    }
    cout<<ans;
}

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t=1;
    // cin>>t;
    while(t--){
        solve();
    }
    return 0;
}

Measured memory_bytes: 9600
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskC solver = new TaskC();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskC {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.readInt();
            int k = in.readInt();
            int[] a = in.readIntArray(n);
            int ans = 0;
            for (int i = 0; i < n - 1; i += k) {
                i--;
                ans++;
            }
            out.println(ans);
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1)
                throw new InputMismatchException();
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public int readInt() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null)
                return filter.isSpaceChar(c);
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public int[] readIntArray(int size) {
            int[] ans = new int[size];
            for (int i = 0; i < size; i++) ans[i] = readInt();
            return ans;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}



Measured memory_bytes: 21716
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		try (Scanner sc = new Scanner(System.in)) {
			int n = sc.nextInt();
			int k = sc.nextInt();
			Integer a[] = new Integer[n];
			for (int i = 0; i < n; i++) {
				a[i] = sc.nextInt();
			}

			Arrays.sort(a);
			int count = 1;

			for (int i = 0; i < n - 1; i++) {
				if (a[i] == a[i + 1]) {
					count++;
				} else {
					break;
				}
			}

			if ((n - count) % (k - 1) != 0) {
				System.out.println((n - count) / (k - 1) + 1);
			} else {
				System.out.println((n - count) / (k - 1));
			}
		}
	}
}

Measured memory_bytes: 61308
//	Author : amnptl 
//	   Godbless
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define NeedForSpeed() ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define mod (1000000007) // 1e9+7

ll power(ll base, ll exponent, ll modx = mod) 
{
    ll ret = 1 % modx;
    base %= modx;
    while(exponent) 
    {
        if(exponent & 1) 
        {
            ret = (ret * base) % modx;
        }
        base = (base * base) % modx;
        exponent >>= 1;
    }
    return ret;
}

int main()
{
	NeedForSpeed();
	ll n,k; cin>>k; ll ans = 0; n = 3;
	ll dp[k+1] = {0}; 
	for(int i=1; i<=k; i++) dp[i] = power((k/i),n);
	for(int i=k; i>=1; i--)
	{
		for(int j=(k/i)*i; j>i; j-=i)
		{
			dp[i] -= dp[j]; 
			dp[i] += mod;
			dp[i] %= mod;
		}
	}
	for(int i=1; i<=k; i++)
	{
		ans += (i*dp[i]);
		ans %= mod;
	}
	cout<<ans<<endl;		
	return 0;
}

Measured memory_bytes: 3596
#include "bits/stdc++.h"

#define ALL(g) (g).begin(),(g).end()
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i, x, n) for(int i = x; i >= n; i--)
#define rrep(i, n) RREP(i,n,0)
#define pb push_back
#define show_table(n, k, table) rep(i,n){ rep(j,k) cout << table[i][j] << " "; cout << endl;}

template<class T> void chmax(T& a,const T& b){a=max(a,b);}
template<class T> void chmin(T& a,const T& b){a=min(a,b);}

using namespace std;

using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
using vi = vector<int>;
using vvi = vector<vi>;

const int mod=1e9+7,INF=1<<30;
const double EPS=1e-12,PI=3.1415926535897932384626;
const ll lmod = 1e9+7,LINF=1LL<<60;
const int MAX_N = 100005;

string s[802];
int a[802][802];
vi dx = {-1, 0, 1, 0}; 
vi dy = { 0, 1, 0,-1}; 

int main(){
  int H,W,K; cin >> H >> W >> K;
  rep(i,H) cin >> s[i];
  queue<P> que1,que2;
  rep(i,H) rep(j,W){
    a[i][j] = -1;
    if(s[i][j]=='S'){
      a[i][j] = 0;
      que1.push(P(i,j));
    }
  }
  rep(ss,2){
    while(!que1.empty()){
      int i,j; tie(i,j) = que1.front();
      if(i==0 || i==H-1 || j==0 || j==W-1){
        // cout << i <<  "," << j << " " << a[i][j] << endl;
        cout << (a[i][j]-1)/K + 1 << endl;
        return 0;
      }
      que1.pop();
      rep(ii,4){
        int x = dx[ii]; int y = dy[ii];
        if(i+x>=0 && i+x<H && j+y>=0 && j+y<W && a[i+x][j+y]==-1){
          if(ss==0) if(s[i+x][j+y]=='#'||a[i][j]==K) continue;
          a[i+x][j+y] = a[i][j]+1;
          que1.push(P(i+x,j+y));
        }
      }
    }
    rep(i,H) rep(j,W){
      if(a[i][j]!=-1){
        a[i][j] = K;
        // cout << i <<  "," << j << " " << a[i][j] << endl;
        que1.push(P(i,j));
      }
    }
  }
  return 0;
}

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

/* 全体でO((N+Q)√N) */

int main() {
	long N, L, Q, B;
	long x[100001];
	long i, j, k;
	long a, b, tmp;
	long move1day[100001];
	long moveBday[100001] = {0};
	long right;
	long ans[100001] = {0};
	
	scanf("%ld", &N);
	B = sqrt(N);
	for(i=1;i<=N;i++) scanf("%ld", &x[i]);
	scanf("%ld", &L);
	scanf("%ld", &Q);
	
	/* 各ホテルから1日でどこまでいけるか計算 O(N) */
	right = 2;
	for(i=1;i<=N;i++) {
		for(j=right;j<=N;j++) {
			if(x[j] - x[i] > L) {
				j--;
				break;
			}
		}
		move1day[i] = j;
		right = j;
	}
	
	/* 各ホテルから√N日でどこまでいけるか計算 O(N√N) */
	for(i=1;i<=N;i++) {
		k = i;
		for(j=0;j<B;j++) {
			if(k >= N) break;
			k = move1day[k];
		}
		if(j == B) moveBday[i] = k;
	}
	
	/* O(Q√N) */
	for(i=1;i<=Q;i++) {
		scanf("%ld %ld", &a, &b);
		if(a > b) { tmp = a; a = b; b = tmp; }
		
		/* まず√N日ずつ移動 */
		j = a;
		while(moveBday[j] > 0 && moveBday[j] < b) {
			j = moveBday[j];
			ans[i] += B;
		}
		
		/* 次に1日ずつ移動 */
		while(j < b) {
			j = move1day[j];
			ans[i]++;
		}
	}
	
	for(i=1;i<=Q;i++) printf("%ld\n", ans[i]);
	
	return 0;
}

Measured memory_bytes: 3840
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace atCorder_A1222
{
    class Program
    {
        static void Main(string[] args)
        {
            string line = Console.ReadLine();
            int cnt = 0;
            for (int i = 0; i < 4; i++)
            {
                if ("2" == line.Substring(i, 1))
                {
                    cnt++;
                }
            }
            Console.WriteLine(cnt);
        }
    }
}


Measured memory_bytes: 11092
def merge(A, left, mid, right):
    count = 0
    INF = 1_000_000_001
    n1 = mid - left
    n2 = right - mid
    L = A[left:mid] + [INF]
    R = A[mid:right] + [INF]

    i, j = 0, 0

    for k in range (left, right):
        count += 1
        if L[i] <= R[j]:
            A[k] = L[i]
            i += 1
        else:
            A[k] = R[j]
            j += 1

    return count

def mergeSort(A, left, right):
    if left + 1 < right:
        mid = (left + right) // 2
        countL = mergeSort(A, left, mid)
        countR = mergeSort(A, mid, right)
        return merge(A, left, mid, right) + countL + countR
    return 0


if __name__ == "__main__":
    n = int(input())
    nums = list(map(int, input().split()))
    count = mergeSort(nums, 0, n)
    print(*nums)
    print(count)



Measured memory_bytes: 63696
s = list(input())
t = list(input())

s_num = len(s)
t_num = len(t)

max_count = 0
for i in range(s_num - t_num + 1):
    count = 0
    for j in range(t_num):
        if s[i + j] == t[j]:
            count += 1
    if count > max_count:
        max_count = count

print(t_num - max_count)


Measured memory_bytes: 64852
#include <bits/stdc++.h>
//#pragma GCC optimize("Ofast")
//#pragma GCC target("avx,avx2,fma")
//#pragma GCC optimization ("unroll-loops")
 
#define int long long 
#define pb emplace_back
#define all(s) s.begin(),s.end()
#define pii pair<int,int>
#define fr first
#define sc second
#define bst ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define endl "\n"
#define no cout << "No" << endl;
#define yes cout << "Yes" << endl;

using namespace std;

const int N = 5e5 + 10, mod = 1e9 + 7, inf = 1e18 + 7, logn = 23;
const double pi = acos(-1);

int get(int x, int y) {
	return x * x + y * y;
}

void solve() {
	//soln
	int n, d;
	cin >> n >> d;
	int ans = 0;
	for(int i = 0; i < n; i++) {
		int x, y;
		cin >> x >> y;
		ans += (get(x, y) <= d * d);
	}
	cout << ans << endl;
}

main() {
	bst;
	int t = 1;
	//cin >> t;
	while(t--) {
		solve();
	}
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define pb emplace_back
typedef long long ll;
typedef pair<int,int> pint;

pint ss[10001];
vector<pint> p[10001];
int c[10001];
int main(){
    int n,m,r,q;
    while(cin>>n>>m,n){
        rep(i,m) p[i].clear();
        cin>>r;
        int t,pc,st,s;
        rep(i,r){
            cin>>t>>pc>>st>>s;
            if(s==1){
                ++c[st];
                if(c[st]==1) ss[st].first=t;
            }
            else{
                --c[st];
                if(c[st]==0) ss[st].second=t,p[st].pb(ss[st]);
            }
        }
        cin>>q;
        rep(i,q){
            int ts,te,tm;
            cin>>ts>>te>>tm;
            int ans=0;
            for(auto it:p[tm]){
                ans+=max(0,min(it.second,te)-max(it.first,ts));
            }
            cout<<ans<<endl;
        }
    }
    return 0;
}



Measured memory_bytes: 3380
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
using namespace std;
typedef long long ll;
int INF = (1LL << 30) - 1;
int MOD = 1e9+7;
main(){
    ll N,M;
    cin >> N >> M;
    vector<int> A(N),B(M);
    rep(i,0,N)cin >> A[i];
    rep(i,0,M)cin >> B[i];
    sort(A.begin(), A.end());
    sort(B.begin(), B.end());
    rep(i,1,N){
        if(A[i-1] == A[i]){
            cout << 0 << endl;
            return 0;
        }
    }
    rep(i,1,M){
        if(B[i-1] == B[i]){
            cout << 0 << endl;
            return 0;
        }
    }
    ll adx = N-1, bdx = M-1;
    ll acnt = 0, bcnt = 0;
    ll ans = 1;
    for(ll i = N*M;i >= 1;i--){
        if(A[adx] != i && B[bdx] != i){
            ans *= max(0LL, acnt * bcnt - (N*M-i) ) % MOD;
        }else if(A[adx] == i && B[bdx] == i){
            adx = max(0LL, adx-1);
            bdx = max(0LL, bdx-1);
            acnt++,bcnt++;
        }else{
            if(A[adx] == i){
                ans *= bcnt;
                adx = max(0LL, adx-1);
                acnt++;
            }else{
                ans *= acnt;
                bdx = max(0LL, bdx-1);
                bcnt++;
            }
        }
        ans %= MOD;
        //cout << adx << " " << bdx << " " << ans << endl;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define FORUL(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i))
#define FORULE(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define FOREACH(it, X) for(__typeof((X).begin()) it = (X).begin(); it != (X).end(); it++)
#if defined(_MSC_VER) || __cplusplus > 199711L
#define AUTOVAR(newvar,v) auto newvar = (v)
#else
#define AUTOVAR(newvar,v) __typeof(newvar) r = (v)
#endif
#define PB(x) push_back(x)
#define MP(x,y) make_pair((x),(y))
#define MEMSET(m,v) memset(m,v,sizeof(m))

typedef long long				 ll;
typedef unsigned long long		ull;

#define DEBUG 1

#if DEBUG
#define DOUT cout<<"["<<__LINE__<<"]:"
#else
#define DOUT 0 && cout
#endif

using namespace std;

#define MAX_N (1000*100)
#define MQX_M (1000*100)
int N,M;
int X[MAX_N+2];
int Y[MAX_N+2];
int Z[MAX_N+2];
// vector<set<int> > vsets;
list<int> G[MAX_N+2];
bool visit[MAX_N+2];

bool dfs(int v)
{
	if (visit[v]) {
		return 0;
	}
	int ret = 1;
	visit[v] = true;
	for(list<int>::iterator it=G[v].begin();
			it!=G[v].end(); it++) {
		ret += dfs(*it);
	}
	return ret;
}

int main(int argc, char *argv[])
{
	ios::sync_with_stdio(false);

	cin >> N >> M;
	FOR(m,M) {
		int x, y, z;
		cin >> x >> y >> z;
		x--;y--;
		X[m] = x;
		Y[m] = y;
		Z[m] = z;
		G[x].push_back(y);
		G[y].push_back(x);
	}
	int ans = 0;
	FOR(n,N) {
		if (dfs(n)>0) {
			ans++;
		}
	}

	cout << ans << endl;

	return 0;
}




Measured memory_bytes: 12416
#include <bits/stdc++.h> // Include every standard library 
using namespace std; 
  
typedef long long ll; 
typedef vector<int> vi; 
typedef vector<vi> vvi; 
  
#define fi first 
#define se second 
#define mp make_pair 
#define pb push_back 
#define all(v) v.begin(), v.end() 
#define input_arr(a,n) for(int i=0;i<n;i++)cin>>a[i];
#define print_arr(a,n) for(int i=0;i<n;i++)cout<<a[i]<<" ";



main(){
    int n,k;
    cin>>n;
    vector<vector<ll>> h(n,vector<ll> (3));
    for(int i=0;i<n;i++){
        cin>>h[i][0];
        cin>>h[i][1];
        cin>>h[i][2];
    }
    
    vector<vector<ll>> dp(n,vector<ll> (3,0));
    for(int i=0;i<n;i++){
        if(i==0){
            for(int j=0;j<=2;j++)
            dp[i][j]=h[i][j];
            }
        else{
        dp[i][0]=h[i][0]+max(dp[i-1][1],dp[i-1][2]);
        dp[i][1]=h[i][1]+max(dp[i-1][0],dp[i-1][2]);
        dp[i][2]=h[i][2]+max(dp[i-1][1],dp[i-1][0]);}
    }
    cout<<max(dp[n-1][0],max(dp[n-1][1],dp[n-1][2]));
}
	
	





Measured memory_bytes: 11136
// atcoder/abc128/B/main.cpp
// author: @___Johniel
// github: https://github.com/johniel/

#include <bits/stdc++.h>

#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))

using namespace std;

typedef long long int lli;
typedef unsigned long long ull;
typedef complex<double> point;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << "," << p.second << ")"; return os; }
template<typename P, typename Q> istream& operator >> (istream& is, pair<P, Q>& p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; each (i, v) os << i << ","; os << ")"; return os; }
template<typename T> istream& operator >> (istream& is, vector<T>& v) { each (i, v) is >> i; return is; }

template<typename T> inline T setmax(T& a, T b) { return a = std::max(a, b); }
template<typename T> inline T setmin(T& a, T b) { return a = std::min(a, b); }

int main(int argc, char *argv[])
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);

  int n;
  while (cin >> n) {
    vector<pair<string, int>> v(n);
    cin >> v;
    each (i, v) i.second *= -1;
    vector<int> u;
    for (int i = 0; i < n; ++i) {
      u.push_back(i);
    }
    sort(u.begin(), u.end(), [&] (int i, int j) {
      return v[i] < v[j];
    });
    each (i, u) cout << i + 1 << endl;
  }

  return 0;
}


Measured memory_bytes: 256
N,M=map(int,input().split())
H=list(map(int,input().split()))
#tenbo=[x for x in range(1,N+1)]
tenbo=[1]*N
ABlist=[]
count=N
for i in range(M):
  A,B=map(int,input().split())
  if H[A-1]<H[B-1]:
    tenbo[A-1]=0
  elif H[B-1]<H[A-1]:
    tenbo[B-1]=0
  elif H[A-1]==H[B-1]:
    tenbo[A-1]=tenbo[B-1]=0

#print(tenbo)
print(tenbo.count(1))

Measured memory_bytes: 20008
# Union Find 木
from sys import setrecursionlimit


def find(parent, i):
    t = parent[i]
    if t < 0:
        return i
    t = find(parent, t)
    parent[i] = t
    return t


def unite(parent, i, j):
    i = find(parent, i)
    j = find(parent, j)
    if i == j:
        return
    parent[j] += parent[i]
    parent[i] = j


setrecursionlimit(10 ** 5)

N, M = map(int, input().split())
AB = [[int(c) - 1 for c in input().split()] for _ in range(M)]

parent = [-1] * N
inconvenience = N * (N - 1) // 2
result = []
for a, b in AB[::-1]:
    result.append(inconvenience)
    pa, pb = find(parent, a), find(parent, b)
    if pa != pb:
        inconvenience -= parent[pa] * parent[pb]
    unite(parent, a, b)
print(*result[::-1])


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

int main() {
  int N, left, right;
  int total = 0;
  cin >> N;
  for(int i=0; i<N; i++) {
    cin >> left >> right;
    total += right - left + 1;
  }
  cout << total << endl;

}


Measured memory_bytes: 256
dic = {}

def inn(s):
  if s in dic:
    dic[s] += 1
  else:
    dic[s] = 1

n = int(input())
s = [inn(input()) for _ in range(n)]

m = max(dic.values())
s = list(filter(lambda n:dic[n]==m, dic))

for ss in sorted(s):
  print(ss)

Measured memory_bytes: 33796
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vi;
#define REP(i, n) for (ll i = 0; i < (n); ++i)
#define OUT(x) cout << (x) << endl;
#define OUTA(a, n) \
    REP(i, n) { cout << (a[i]) << (i == n - 1 ? "\n" : " "); }
#define ALL(a) (a).begin(), (a).end()
#define SORT(a) sort(ALL(a))
#define RSORT(a) \
    SORT(a);     \
    reverse(ALL(a))

const ll INF = 1e18;
const ll MOD = 1e9 + 7;

ll N, M;
vector<vi> A;

int main()
{
    cin >> N >> M;
    A = vector<vi>(N);
    REP(i, N)
    {
        A[i] = vi(M);
        REP(j, M)
        {
            cin >> A[i][j];
        }
    }

    for (ll k = 1; k <= N; ++k)
    {
        vi P = vi(N, 0);
        bool ok = false;
        set<ll> used;
        REP(l, M)
        {
            vi D = vi(M + 1, 0);
            REP(i, N)
            {
                ++D[A[i][P[i]]];
            }
            ll m = 0;
            REP(i, M + 1)
            {
                if (D[i] > D[m])
                {
                    m = i;
                }
            }
            if (D[m] <= k)
            {
                ok = true;
                break;
            }
            used.insert(m);
            REP(i, N)
            {
                while (P[i] < M and used.count(A[i][P[i]]))
                {
                    ++P[i];
                }
            }
        }
        if (ok)
        {
            OUT(k);
            break;
        }
    }
}


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

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

struct RollingHash {
	static const ll mo0=1000000021,mo1=1000000009;
	static ll mul0,mul1;
	static const ll add0=1000010007, add1=1003333331;
	static vector<ll> pmo[2];
	string s; int l; vector<ll> hash_[2];
	void init(string s) {
		this->s=s; l=s.size(); int i,j;
		hash_[0]=hash_[1]=vector<ll>(1,0);
		if(!mul0) mul0=10009+(((ll)&mul0)>>5)%259,mul1=10007+(((ll)&mul1)>>5)%257;
		if(pmo[0].empty()) pmo[0].push_back(1),pmo[1].push_back(1);
		FOR(i,l) hash_[0].push_back((hash_[0].back()*mul0+add0+s[i])%mo0);
		FOR(i,l) hash_[1].push_back((hash_[1].back()*mul1+add1+s[i])%mo1);
	}
	pair<ll,ll> hash(int l,int r) { // s[l..r]
		if(l>r) return make_pair(0,0);
		while(pmo[0].size()<r+2)
			pmo[0].push_back(pmo[0].back()*mul0%mo0), pmo[1].push_back(pmo[1].back()*mul1%mo1);
		return make_pair((hash_[0][r+1]+(mo0-hash_[0][l]*pmo[0][r+1-l]%mo0))%mo0,
			             (hash_[1][r+1]+(mo1-hash_[1][l]*pmo[1][r+1-l]%mo1))%mo1);
	}
	pair<ll,ll> hash(string s) { init(s); return hash(0,s.size()-1); }
	static pair<ll,ll> concat(pair<ll,ll> L,pair<ll,ll> R,int RL) { // hash(L+R) RL=len-of-R
		while(pmo[0].size()<RL+2) pmo[0].push_back(pmo[0].back()*mul0%mo0), pmo[1].push_back(pmo[1].back()*mul1%mo1);
		return make_pair((R.first + L.first*pmo[0][RL])%mo0,(R.second + L.second*pmo[1][RL])%mo1);
	}
};
vector<ll> RollingHash::pmo[2]; ll RollingHash::mul0,RollingHash::mul1;

RollingHash RS,RT;
string S,T;
int A,B;
int num[2020202];

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>S>>T;
	A=S.size();
	B=T.size();
	S+=S+S;
	T+=T;
	RS.init(S);
	RT.init(T);
	
	int PS,PT;
	for(x=1;x<=A;x++) if(A%x==0) {
		for(i=x;i<A;i+=x) if(RS.hash(0,x-1)!=RS.hash(i,i+x-1)) break;
		if(i==A) {
			PS=x;
			break;
		}
	}
	for(x=1;x<=B;x++) if(B%x==0) {
		for(i=x;i<B;i+=x) if(RT.hash(0,x-1)!=RT.hash(i,i+x-1)) break;
		if(i==B) {
			PT=x;
			break;
		}
	}
	
	if(PS==PT) {
		FOR(y,PS) {
			if(RT.hash(0,PT-1)==RS.hash(y,y+PS-1)) {
				cout<<-1<<endl;
				return;
			}
		}
		cout<<0<<endl;
		return;
	}
	
	int ma=0;
	FOR(x,A) {
		if(x>=B && num[x-B]) {
			num[x]=num[x-B]-1;
		}
		else {
			FOR(i,A) {
				if(x+(i+1)*B>3*A) break;
				if(RT.hash(0,B-1)!=RS.hash(x+i*B,x+(i+1)*B-1)) break;
			}
			num[x]=i;
		}
		ma=max(ma,num[x]);
	}
	cout<<ma<<endl;
	
}


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


Measured memory_bytes: 96996
#include <bits/stdc++.h>
using namespace std;
int main() {
  int64_t a,b;
  cin>>a>>b;
  if(a>0){
    cout<<"Positive";
  }
  if(a*b<=0){
    cout<<"Zero";
  }
  if(b<0&&(b-a)%2==0){
    cout<<"Negative";
  }
  if(b<0&&(b-a)%2==1){
    cout<<"Positive";
  }
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
string s;
int ans[26],Ans=10000000;
vector<int> v[26];
int main(){
    cin>>s;
    for(int i=0;i<26;i++)v[i].push_back(-1);
    for(int i=0;i<s.size();i++){
        v[s[i]-'a'].push_back(i);
    }
    for(int i=0;i<26;i++){
        v[i].push_back(s.size());
        for(int j=1;j<v[i].size();j++){
            ans[i]=max(ans[i],v[i][j]-v[i][j-1]-1);
        }
        Ans=min(Ans,ans[i]);
    }
    cout<<Ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string> 
#include <vector>
#include <iomanip>
#include <math.h>
#include <map>
using namespace std;

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

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

#define ll long long

int main()
{
  ll k,n;
  cin >> n >> k;
  ll i,ans=0;
  for(i=1;i<=n;i++)
  {
    if((2*i)%k!=0)
      continue;
    ll up=(ll)floor((1.0*(i+n))/k);
    ll down=(ll)ceil((1.0*(i+1))/k);
    ans+=(up-down+1)*(up-down+1);
  }
  cout << ans;
}


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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
template<class T> inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template<class T> inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
int64_t abs(int64_t n) {
  if (n < 0) {
    n = -n;
  }
  return n;
}
int ctoi(char c) {
  if (c >= '0' && c <= '9') {
    return c - '0';
  }
  return 0;
}

int f(int a, int b) {
  string s, t;
  s = to_string(a);
  t = to_string(b);
  return max(s.size(), t.size());
}

int main() {
  long long n;
  cin >> n;
  int min = 10;
  for (int64_t i = 1; i <= (int64_t)pow(n, 0.5); i++) {
    if (n%i == 0) {
      if (min > f(i, n/i)) {
        min = f(i, n/i);
      }
    }
  }
  cout << min << endl;
}

Measured memory_bytes: 256
import heapq
x, y, z, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))

a = sorted([-aa for aa in a])
b = sorted([-bb for bb in b])
c = sorted([-cc for cc in c])
a_diff = [a[i+1]-a[i] for i in range(x-1)]
b_diff = [b[i+1]-b[i] for i in range(y-1)]
c_diff = [c[i+1]-c[i] for i in range(z-1)]

que = [(a[0]+b[0]+c[0], (0, 0, 0))]
heapq.heapify(que)
s = set([(0, 0, 0)])
while k > 0:
    ans, (ia, ib, ic) = heapq.heappop(que)
    print(-ans)
    # print(-ans, (ia, ib, ic))
    k -= 1

    if ia < x-1 and (ia+1, ib, ic) not in s:
        heapq.heappush(que, (ans+a_diff[ia], (ia+1, ib, ic)))
        s.add((ia+1, ib, ic))
    if ib < y-1 and (ia, ib+1, ic) not in s:
        heapq.heappush(que, (ans+b_diff[ib], (ia, ib+1, ic)))
        s.add((ia, ib+1, ic))
    if ic < z-1 and (ia, ib, ic+1) not in s:
        heapq.heappush(que, (ans+c_diff[ic], (ia, ib, ic+1)))
        s.add((ia, ib, ic+1))


Measured memory_bytes: 5236
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <climits>
#include <cstring>

#define rep(i, m, n) for(int i=int(m);i<int(n);i++)
#define all(c) begin(c),end(c)

template<typename T1, typename T2>
inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }

template<typename T1, typename T2>
inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }

//改造
typedef long long int ll;
using namespace std;
#define INF (1 << 30) - 1
#define INFl (ll)5e15
#define DEBUG 0 //デバッグする時1にしてね
#define dump(x)  cerr << #x << " = " << (x) << endl
#define MOD 1000000007


//ここから編集する
class Solve {
public:
    void input() {

    }

    void solve() {
        input();
        int N, Q;
        cin >> N >> Q;
        string s;
        cin >> s;

        vector<int> rui(N);
        for (int i = 0; i + 1 < N; ++i) {
            string tmp = s.substr(i, 2);
            if (tmp == "AC") {
                rui[i + 1] = 1;
            }
        }

        for (int i = 0; i + 1 < N; ++i) {
            rui[i + 1] += rui[i];
        }

        while (Q--) {
            int l, r;
            cin >> l >> r;
            l--, r--;
            int ans = rui[r] - rui[l - 1];
            if (l > 0) {
                string tmp = s.substr(l - 1, 2);
                if (tmp == "AC") ans--;
            }
            cout << ans << endl;

        }

    }
};


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);

    Solve().solve();


    return 0;
}


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

#define ll long long
using namespace std;

set<string> sv;
vector<string> v;

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

	string s;
	cin >> s;
	
	int n=s.size(), k;
	cin >> k;

	for(int i=0; i<n; i++){
		string t = "";
		for(int j=0; j<5 && i+j<n; j++){
			string t1 = t+s[i+j];
			sv.insert(t1);
			t = t1;
		}
	}

	for(string t : sv)
		v.push_back(t);

	sort(v.begin(), v.end());
	
	cout << v[k-1] << endl;

	return 0;
}

Measured memory_bytes: 1920
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
typedef long long LL;
int N;
int M;
int A[100001];
int B[100001];
int C[100001];
vector<int>G[100001];
typedef pair<int,int>P;
vector<P>v;
bool used[100001];
void dfs(int x,int p){
	used[x]=true;
	REP(i,G[x].size()){
		int nxt=(A[G[x][i]]^B[G[x][i]]^x);
		//int nxt=A[G[x][i]]^B[G[x][i]]^x；
		if(used[nxt]==false){
			dfs(nxt,x);
		}
	}
	v.push_back(P(x,p));
}
void PP(int x){
	//cout<<A[x]<<" "<<B[x]<<" "<<C[x]<<endl;
}

int main(){
	cin>>N>>M;
	REP(i,M){
		cin>>A[i]>>B[i];
		A[i]--;
		B[i]--;
		G[A[i]].push_back(i);
		G[B[i]].push_back(i);
		C[i]=0;
	}
	if(M%2!=0){
		cout<<-1<<endl;
	}else{
		REP(i,N){
			used[i]=false;
		}
		dfs(0,-1);
		REP(i,v.size()){
			int x=v[i].first;
			//cout<<x<<endl;
			int y=v[i].second;
			int cnt=0;
			int pre=-1;
			REP(j,G[x].size()){
				int nxt=G[x][j];
				if(x==A[nxt]&&C[nxt]==1){
					cnt++;
				}
				if(x==B[nxt]&&C[nxt]==2){
					cnt++;
				}
				if(C[nxt]==0&&y!=A[nxt]&&y!=B[nxt]){
					cnt++;
					if(x==A[nxt]){
						C[nxt]=1;//AからB
						//cout<<"a"<<endl;
					}else{
						C[nxt]=2;//BからA
						//cout<<"b"<<endl;
					}
					//cout<<C[nxt]<<endl;
					PP(nxt);
					//cout<<"aa"<<endl;
				}

				
				if(y==A[nxt]||y==B[nxt]){
					pre=j;
				}
			}
			if(pre!=-1){
				int nxt=G[x][pre];
				if(cnt%2==0){
					if(A[nxt]==x){
						C[nxt]=2;
					}else{
						C[nxt]=1;
					}
					PP(nxt);
				}else{
					if(A[nxt]==x){
						C[nxt]=1;
					}else{
						C[nxt]=2;
					}
					PP(nxt);
				}
			}
			
		}
		REP(i,M){
			if(C[i]==1){
				cout<<A[i]+1<<" "<<B[i]+1<<endl;
			}else{
				cout<<B[i]+1<<" "<<A[i]+1<<endl;
			}
		}
	}
}

Measured memory_bytes: 15348
#include<iostream>
#include<string.h>
#include<cstdio>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<cmath>
#include<utility>
#define ll long long int
#define ld long double
#define INF 1000000000
#define EPS 0.0000000001
#define rep(i,n) for(i=0;i<n;i++)
using namespace std;
typedef pair<int, int> P;

char str[100005];

int main()
{
  int i,j,k;

  cin>>str;
  cin>>k;
  rep(i,strlen(str)){
    if(str[i]=='a')
      continue;
    if('z'-str[i]>=k)
      continue;
    for(j=0;j<30;j++)
      if(str[i]+j=='z')
	break;
    k-=j+1;
    str[i]='a';
  }
  if(k)
    str[strlen(str)-1]+=k%26;

  /*
  if(k)
    for(i=strlen(str)-1;i>=0;i--){
      if('z'-str[i]<k){
	str[i]='a';
	for(j=0;j<30;j++)
	  if(str[i]+j=='z')break;
	k-=j+1;
      }else{
	str[i]=str[i]+k;
	break;
      }
    }
  */
  printf("%s\n",str);

}


Measured memory_bytes: 512
#include<stdio.h>
#include<stdlib.h>

int main(void){
	char s[131072];
	int g=0,p=0,i,n;
	scanf("%s",s);
	n=strlen(s);
	for(i=1;i<=n;i++){
		if(s[i] == 'g'){g++;}
		if(s[i] == 'p'){p++;}
	}
	printf("%d\n",(n/2)-p);
	return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <cmath>
#include <algorithm>
#include <utility>
#include <functional>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const int MOD = 1000000007;
const double EPS = 1e-9;


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

  string s;
  cin>>s;
  if(s[0] == '9' || s[1] == '9') {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }

  return 0;
}


Measured memory_bytes: 256
import Control.Monad
import qualified Data.Vector.Unboxed as U

solve n goods w = U.last $ foldl f initial goods where
  f acc (w, v) = U.zipWith max acc pick where
    pick = U.map (v+) $ U.replicate w (-v) U.++ acc
  initial = U.replicate (w+1) (0::Int)

main = do
  [n,w] <- map read.words <$> getLine
  goods <- replicateM n $ (\[a,b]->(a,b)).map read.words <$> getLine
  print $ solve n goods w

Measured memory_bytes: 12412
def nCk(n, k, mod=10 ** 9 + 7):
    if n < k:
        return 0
    k = min(k, n - k)
    numer = 1
    for x in range(n - k + 1, n + 1):
        numer = (numer * x) % mod
    denom = 1
    for x in range(1, k + 1):
        denom = (denom * x) % mod
    return numer * pow(denom, mod - 2, mod) % mod

X, Y = map(int, input().split())

b = (2 * X - Y) // 3
a = (-X + 2 * Y) // 3

if (X + Y) % 3 != 0 or a < 0 or b < 0:
    print(0)
else:
    print(nCk(a + b, a))

Measured memory_bytes: 3064
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll MOD = (1e+9) + 7;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
typedef complex<ld> Point;
const ld eps = 1e-11;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;
typedef pair<ld, ld> LDP;
int dp[500001][4];
int main() {
	string s[3]; string o;
	rep(i, 3)cin >> s[i];
	rep(i, 3)o += char('A' + (s[i][0] - 'a'));
	cout << o << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define long long int int
#define endl '\n'
int main()
{
    int n,s=0;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
    }
    for(int i=0;i<n-1;i++)
    {
        for(int j=i+1;j<n;j++)
        {
            s=s+a[i]*a[j];
        }
    }
    cout<<s;
    return 0;
}

Measured memory_bytes: 256
// C++ 14
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define loop(__x, __start, __end) for(int __x = __start; __x < __end; __x++)

template <class T, class T2>
void group(T &xs, vector<pair<T2, int> > &result) {
  int i=0, j;
  while (i<xs.size()) {
    j=i;
    while (j < xs.size() and xs[j] == xs[i]) j++;
    result.push_back({ xs[i], j-i });
    if (j==i) i++;
    i=j;
  }
}

/*
 * BWが左右２つに分かれる時、必ず1手で完了する.
 * 3つの時、必ず2手で完了する.
 * 4: 3
 * 5: 4
 * 6: 5
 */
int main() {
  string s; cin >> s;
  vector<pair<char, int> > G;
  group(s, G);
  cout << G.size() - 1 << endl;
  return 0;
}


Measured memory_bytes: 4468
#include <iostream>
using namespace std;
#define MAX 50004
#define MAXL 3000
int dp[MAX], d[MAX];

int main(){
	int n, m = 0;
	static bool c[MAX]={true, true};
	for(int i = 2;i < MAX;i++){
		if(!c[i]){
			for(int j = 2;i*j < MAX;j++)c[i*j] = true;
			d[m++] = i;
		}
	}
	
	for(int i = 0;i < MAXL;i++)
		for(int j = i;d[i]+d[j] < MAX-3;j++)
			dp[d[i] + d[j]]++;
	while(cin >> n, n)cout << dp[n] << endl;
	return 0;
}

Measured memory_bytes: 3332
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sstream>
#include <iostream>
#include <math.h>
#include <time.h>
#include <unistd.h>
#include <algorithm>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <set>
#include <string>
 
#ifndef ONLINE_JUDGE
	#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#else
	#define DEBUG(x) do {} while(0);
#endif
 
#define pb push_back
#define mp make_pair
#define ALL(x) (x).begin(), (x).end()
#define PER(i, N) for(int (i) = (N)-1; (i) >= 0; (i)--)
#define REP(i, N) for(int (i) = 0; (i) < (int)(N); (i)++)
 #include <iomanip>
using namespace std;
typedef long long ll;
inline bool EQ(double a, double b) { return fabs(a-b) < 1e-9; }

template <typename T, typename U> std::istream&operator>>(std::istream&i, pair<T,U>&p) {i >> p.x >> p.y; return i;}
template<typename T>std::istream&operator>>(std::istream&i,vector<T>&t) {for(auto&v:t){i>>v;}return i;}
template <typename T, typename U> std::ostream&operator<<(std::ostream&o, const pair<T,U>&p) {o << p.x << ' ' << p.y; return o;}
template<typename T>std::ostream&operator<<(std::ostream&o,const vector<T>&t) {if(t.empty())o<<'\n';for(size_t i=0;i<t.size();++i){o<<t[i]<<" \n"[i == t.size()-1];}return o;}
template<typename T> using minheap = priority_queue<T, vector<T>, greater<T>>;
template<typename T> using maxheap = priority_queue<T, vector<T>, less<T>>;
template<typename T> T gcd(T a,T b) { if (a<b) swap(a,b); return b?gcd(b,a%b):a; }

int w,s;

void solve(istream& cin, ostream& cout) {
	string S;
	cin >> S;
	if(S == "ABC")
		cout <<"ARC"<<endl;
	else
		cout <<"ABC"<<endl;
}


int main() {
    ios_base::sync_with_stdio(false);
	cin.tie(nullptr); cout.tie(nullptr);
	solve(cin, cout);
	/*
	{
		istringstream instr("2\n2\n14");
		solve(instr, cout);
	}
 */
	return 0;
}


Measured memory_bytes: 3128
#include <iostream>
#include <stdio.h>
#include <string>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <math.h>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>

using namespace std;

typedef unsigned long long ull;
typedef long long ll;

int main(){
	ull n;
	cin >> n;
	ull a[n];
	for(ull i=0; i<n; i++){
		cin >> a[i];
	}
	sort(a, a+n, greater<ull>());
	ull ans=0;
	for(ull i=0; i<n; i++){
		if(a[i]==a[i+1]) i++;
		else ans++;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1024
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func init() {
	sc.Split(bufio.ScanWords)
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func main() {
	a := nextInt()
	b := nextInt()
	c := nextInt()

	if a + b + c >= 22 {
		fmt.Printf("bust")
	} else {
		fmt.Printf("win")
	}
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
int main(){
  int i,N;
  long double x,ans=0;
  string ss;
  cin>>N;
  for(i=0;i<N;i++){
    cin>>x>>ss;
    if(ss[0]=='J'){ans+=x;}
    else{ans+=x*380000.0;}
  }
  cout <<ans;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define vi vector<int>
#define ll long long
long long cnt = 0;
int main() {

	int n;
	cin >> n;
	vi arr(n), ans;
	for (int i = 0; i < n; i++) {
		cin >> arr[i];
	}
	for (int i = 0; i + 1 < n; i++) {
		if (arr[i] >= arr[i + 1])
			cnt++;
		else {
			ans.push_back(cnt);
			cnt = 0;
		}
	}
	ans.push_back(cnt);
	sort(ans.begin(), ans.end());
	cout << ans.back();
	return 0;
}

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

int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  vector<int> B(N);
  int cnt = 0;
  for(int i = 0; i < N; i++) {
    cin >> A.at(i);
  }
  for(int i = 0; i < N; i++) {
    B.at(A.at(i)-1) = i+1;
  }
  for(int i = 0; i < N; i++) {
    cout << B.at(i) << " ";
  }
}


Measured memory_bytes: 3992
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int n;
    int l[110];
    cin >> n;
    for(int i=0;i<n;i++)cin >> l[i];
    
    sort(l,l+n,greater<int>());
    
    int other = 0;
    
    for(int i=1;i<n;i++){
        other+=l[i];
    }
    
    if(l[0]>=other) cout << "No";
    else cout << "Yes";
    
    return 0;
}


Measured memory_bytes: 3588
#include <iostream>

int main(){
    
    int n, x = 0;
    int N = 0;
    int x0, x1 = 0;
    int y0, y1 = 0;
    while(std::cin >> n >> x){
        if(n==0 && x==0){ return 0;}
        N = 0;
        for(int i=n; i>2; i--){
            x0 = i;
            x1 = x - x0;
            if( x1 < 3) continue;
            for(int j=x1; j>1; j--){
                y0 = j;
                y1 = x1 - y0;
                if(x0 <= y0 || y0 <= y1 || y1 == 0) continue;
                N++;
            }
        }
        std::cout <<  N << std::endl;
    }
    return 0;
}


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

public class Main {
	static class FS {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer("");

		String next() {
			while (!st.hasMoreTokens())
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}

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

		double nextDouble() {
			return Double.parseDouble(next());
		}

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

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

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

	static final FS sc = new FS();
	static final PrintWriter out = new PrintWriter(System.out);
	static final int mod = 1000000007;

	public static void main(String[] args) {
		solve();
		out.close();
	}

	static void solve() {
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		if (b - a == c - b) {
			out.println("YES");
		} else {
			out.println("NO");
		}

	}

}


Measured memory_bytes: 32928
n,k=map(int,input().split())
dp=[0]*(k+1)
# for i in range(n+1):
# 	dp[i]=[0]*(k+1)
arr=list(map(int,input().split()))
for i in range(1,k+1):
	for j in range(n):
		if i-arr[j]<0:
			continue
		elif i-arr[j]==0:
			dp[i]=1
		else:
			dp[i]|=not dp[i-arr[j]]
# print(dp)
if dp[i]:
	print("First")
else:
	print("Second")


Measured memory_bytes: 41836