akhauriyash/Code-Regression huggingface dataset:
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
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;
        MyScanner in = new MyScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        D solver = new D();
        solver.solve(1, in, out);
        out.close();
    }

    static class D {
        static long MOD = (long) (1e9 + 7);
        private static int MAX = 2000000;
        private static long[] xs = new long[MAX + 1];
        private static long[] ys = new long[MAX + 1];

        public void solve(int testNumber, MyScanner in, PrintWriter out) {
            int X = in.nextInt();
            int Y = in.nextInt();

            int m = (Y * 2 - X) / 3;
            int n = Y - m * 2;
            if ((X + Y) % 3 != 0 || 2 * n + m != X || n + 2 * m != Y) {
                out.println(0);
            } else {
                out.println(comb(n + m, n));
            }
        }

        private long comb(int n, int r) {
            if (r < 0 || r > n) return 0;
            if (xs[0] == 0) {
                xs[0] = 1;
                for (int i = 1; i <= MAX; i++) {
                    xs[i] = xs[i - 1] * i % MOD;
                }
                long inv = modpow(xs[MAX]);
                ys[MAX] = inv;
                for (int i = MAX; i >= 1; i--) {
                    inv = inv * i % MOD;
                    ys[i - 1] = inv;
                }
            }
            return xs[n] * (ys[r] * ys[n - r] % MOD) % MOD;
        }

        private long modpow(long a) {
            return modpow(a, MOD - 2);
        }

        private long modpow(long a, long n) {
            long r = 1;
            while (n > 0) {
                r = r * ((n % 2) != 0 ? a : 1) % MOD;
                a = a * a % MOD;
                n >>= 1;
            }
            return r;
        }

    }

    static class MyScanner {
        private BufferedReader in;
        private StringTokenizer st;

        public MyScanner(InputStream stream) {
            in = new BufferedReader(new InputStreamReader(stream));
        }

        public String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    String rl = in.readLine();
                    if (rl == null) {
                        return null;
                    }
                    st = new StringTokenizer(rl);
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return st.nextToken();
        }

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

    }
}



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

#define INF INT_MAX
#define UINF UINT_MAX
#define MOD 1000000007
#define REP(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()

typedef long long ll;
typedef std::pair<int,int> pii;

using namespace std;

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

    ll m,a,b;
    cin >> a >> b >> m;
    vector<ll> aa(a);
    vector<ll> bb(b);
    
    REP(i,a)cin >> aa[i];
    REP(i,b)cin >> bb[i];

    vector<ll> aaaa = aa;
    vector<ll> bbbb = bb;

    sort(all(aa));
    sort(all(bb));

    ll ab = aa[0] + bb[0];

    REP(i,m){
        ll aaa,bbb,ccc;
        cin >> aaa >> bbb >> ccc;
        if(ab > aaaa[aaa-1] + bbbb[bbb-1] - ccc){
            ab = aaaa[aaa-1] + bbbb[bbb-1] - ccc;
        }
    }

    ll ans = ab;

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

Measured memory_bytes: 3456
N = int(input())
M = N * (N - 1) // 2 - N // 2
S = N // 2 * 2 + 1

print(M)

for i in range(1, N):
    for j in range(i + 1, N + 1):
        if i + j == S:
            continue
        print(i, j)

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

int main(){
    ll n;
    std::cin >> n;
    std::vector<ll> h(n);
    for (int i = 0; i < n; i++) {
        std::cin >> h[i];
    }
    for (int i = 1; i < n; i++) {
        if(h[i-1]-h[i]>=2){
            std::cout << "No" << std::endl;
            return 0;
        }
    }
    ll nowm = h[0];
    for (int i = 0; i < n; i++) {
        if(nowm-h[i]>=2){
            std::cout << "No" << std::endl;
            return 0;
        }
        nowm = max(nowm,h[i]);
    }
    
    std::cout << "Yes" << std::endl;
}


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

typedef unsigned long ul;
typedef unsigned long long ull;
typedef long long ll;
typedef vector<ll> vint;
typedef vector< vector<ll> > vvint;
typedef vector< vector< vector<ll> > > vvvint;
typedef vector<string> vstring;
typedef vector< vector<string> > vvstring;
typedef vector<char> vchar;
typedef vector< vector<char> > vvchar;
typedef vector<long double> vdouble;
typedef vector< vector<long double> > vvdouble;
typedef vector< vector< vector<long double> > > vvvdouble;
typedef pair<ll,ll> pint;
typedef vector<pint> vpint;
typedef vector<bool> vbool;

#define rep(i,n) for(ll i=0;i<n;i++)
#define repf(i,f,n) for(ll i=f;i<n;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define ALL(obj) (obj).begin(), (obj).end()
// #define LLONG_MAX 9223372036854775806
#define MOD 1000000007
const double PI=3.14159265358979323846;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<typename T> T Ceil(T a, T b){return (a+b-1)/b;}

int dy[]={0, 0, 1, -1, 1, -1, -1, 1};
int dx[]={1, -1, 0, 0, 1, 1, -1, -1};

void printv(vint &v){
    for(auto e:v) cout<<e<<" ";
        cout<<endl;
    }

int main() {
    cout<<fixed<<setprecision(10);

    ll n; cin>>n;
    vint a(n-1); rep(i,n-1) cin>>a[i];
    vint ans(n,0);
    for(auto e:a) ans[e-1]++;
    for(auto e:ans) cout<<e<<endl;

    return 0;

}

Measured memory_bytes: 6428
#include <bits/stdc++.h>
using namespace std;
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
int main() {
    cin.sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cin.exceptions(cin.failbit);
    int n, ans = 0;
    cin >> n;
    string s;
    cin >> s;
    rep(i, 0, 1000){
        string temp = to_string(i);
        if (sz(temp) == 1) temp = "00" + temp;
        else if (sz(temp) == 2) temp = "0" + temp;
        //cout << temp << '\n';
        int cnt = 0, j = 0;
        while (cnt < 3 && j < n){
            if (temp[cnt] == s[j]) cnt++;
            j++;
        }
        if (cnt == 3)
            ans++;
    }
    cout << ans << '\n';
    return 0;
}


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

#define fi first
#define se second
#define be begin
#define en end
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define ALL(a) (a).be() , (a).en()
#define REP(i,n) for(int (i)=0;(i)<(n);(i)++)        //repeat n times
#define REP2(i,s,n) for(int (i)=(s);(i)<(n);(i)++)   //repeat from s to n 
#define REPD(i,n) for(int (i)=(n);(i)>=0;(i)--)      //repeat from n to 0
#define REPD2(i,s,e) for(int (i)=(s);(i)>=(e);(i)--) //repeat from s to e
#define RANGE(i,v) for(auto &(i):v)                  //repeat range
#define ASIZE(a) (sizeof(a) / sizeof(a[0]))          //array size

using LL = long long;

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

    int ans = 0;
    REP(i,2){
        if(a<b){
            ans += b;
            b--;
        }else{
            ans += a;
            a--;
        }
    }

    cout<<ans<<endl;

    return 0;
}

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

using namespace std;

int main() {
    int x, y, z, e, ans;

    while (cin >> e) {
        if (!e) { break; }
        ans = e;

        for (int z = 0; z*z*z <= e; z++) {
            for (int y = 0; y*y + z*z*z <= e; y++) {
                x = e - y*y - z*z*z;
                ans = min(ans, x+y+z);
            }
        }
        cout << ans << endl;
    }
    return 0;
}


Measured memory_bytes: 3004
import java.util.Scanner;

public class Main{
	public static void main(String[] args){
		int s[]=new int[5];
		int h,h1,h2,okirum,m,m1,m2,k,ans;
		Scanner sc = new Scanner(System.in);
			h1= sc.nextInt();
			m1= sc.nextInt();
			h2= sc.nextInt();
			m2= sc.nextInt();
			k= sc.nextInt();
			h=h2-h1;
			m=m2-m1;
			okirum=m+60*h;
			if(okirum<=k){
				System.out.printf("0");
			}
			else{
				ans=okirum-k;
				System.out.printf("%d",ans);
			}

	}
}


Measured memory_bytes: 35752
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
using namespace std;
const int N=3003;
const int mod=1000000007;
int n,m;
int a[N];
int dp[N][N];
int fpow(int x,int b)
{
	int res=1;
	while(b)
	{
		if(b&1) res=1ll*res*x%mod;
		x=1ll*x*x%mod;
		b>>=1;
	}
	return res;
}
int main()
{
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++)
		scanf("%d",&a[i]);
	for(int i=1;i<=n;i++)
		for(int j=1;j<=n;j++)
			dp[i][j]=(a[i]>a[j]);
	int inv=fpow(2,mod-2);
	for(int i=1;i<=m;i++)
	{
		int x,y;
		scanf("%d%d",&x,&y);
		dp[x][y]=dp[y][x]=1ll*(dp[x][y]+dp[y][x])%mod*inv%mod;
		for(int j=1;j<=n;j++)
		{
			if(j==x||j==y) continue;
			dp[x][j]=dp[y][j]=1ll*(dp[x][j]+dp[y][j])%mod*inv%mod;
			dp[j][x]=dp[j][y]=1ll*(dp[j][x]+dp[j][y])%mod*inv%mod;
		}
	}
	int ans=0,num=fpow(2,m);
	for(int i=1;i<=n;i++)
		for(int j=i+1;j<=n;j++)
			ans=(ans+1ll*dp[i][j]*num%mod)%mod;
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 35456
#include <iostream>
#include <vector>
#include <math.h>
using namespace std;

int main()
{
  int H, A, n, rem;
  
  cin >> H;
  cin >> A;
  
  n = H / A;
  rem = H % A;
  
  if(rem == 0)
    cout << n;
  else
    cout << n + 1;
  

  system("pause");
  return 0;
}

Measured memory_bytes: 504
N = int(input())
ans = 0
float(ans)

for i in range(N):
	x,u = input().split()

	if str(u) == 'JPY':
		ans = float(ans) + float(x)
	
	if str(u) == 'BTC':
		ans = float(ans) + float(x) * 380000

print(ans)

Measured memory_bytes: 3060
///   ***   ---   |||         In the name of ALLAH        |||   ---   ***   ///



#include<bits/stdc++.h>
using namespace std;


typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef double dl;

#define endl '\n'
#define PB push_back
#define F first
#define S second
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define sz(x) (int)x.size()

const double PI = acos(-1);
const double eps = 1e-9;
const int inf = 2000000000;
const ll infLL = 9000000000000000000;
#define MOD 1000000007

#define mem(a,b) memset(a, b, sizeof(a) )
#define sqr(a) ((a) * (a))

#define optimize() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define fraction() cout.unsetf(ios::floatfield); cout.precision(10); cout.setf(ios::fixed,ios::floatfield);
#define file() freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);

#define dbg(args...) do {cerr << #args << " : "; faltu(args); } while(0)
void faltu () {            cerr << endl;}
template < typename T, typename ... hello>void faltu( T arg, const hello &... rest) {cerr << arg << ' ';faltu(rest...);}


int main()
{
    optimize();

    ll n, two = infLL, five = 0, ten = 0;
    cin >> n;
    if ( n % 2 ) return cout << 0 << endl, 0;
    ll tmp = n >> 1;


    while ( tmp > 0 ) {
        five += ( tmp / 5 );
        tmp /= 5;
    }


    cout << min ( two, five ) << endl;

    return 0;
}


















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

using namespace std;
using ll = long long;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
	REP(i, v.size()) { if (i)os << " "; os << v[i]; }return os;
}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
	REP(i, v.size()) { if (i)os << endl; os << v[i]; }return os;
}

const ll INF = LLONG_MAX;
ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;

#define int long long

inline void my_io() {

	std::ios::sync_with_stdio(false);

	std::cin.tie(0);

	cout << fixed << setprecision(16);

	//cout << setprecision(10) << scientific << ans << endl;
}

signed main() {
	ll n;

	cin >> n;

	vector<ll> v(n);

	REP(i, n) {
		cin >> v[i];
	}

	ll ans = 0;

	REP(i, n) {
		REP(j, n) {
			ans = max(ans, abs(v[i] - v[j]));
		}
	}

	cout << ans << 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>;

int main(){
    int n;
    cin >> n;
    vector<int> l(n);
    rep(i, n) cin >> l[i];
    sort(l.begin(), l.end());
    ll ans;
    for (int i = 0; i < n - 2; i++){
        for (int j = i + 1; j < n - 1; j++){
            for (int k = j + 1; k < n; k++){
                if(l[i] + l[j] <= l[k]) break;
                ans++;
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long int
#define MOD 1000000007
using namespace std;
void solve() {
        int n;
        cin >> n;
        int a[n-1];
        for(int i=0;i<n-1;i++)
                cin >> a[i];
        int start = INT_MAX;
        int end = INT_MAX;
        int sum = 0;
        for(int i=0;i<n-1;i++) {
                if(i == 0)
                        sum += min(start, a[i]);
                if(i == n-2)
                        sum += min(end, a[i]);
                else
                        sum += min(a[i], a[i+1]);
        }
        cout << sum << endl;
        return ;
}

int32_t main() {
        ios_base::sync_with_stdio(false);
        cin.tie(NULL);
        cout.tie(NULL);
        solve();
        return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef string str;
#define rep(i, n) for(int i=0; i<n; ++i)
#define REP(i, n) for(int i=1; i<=n; ++i)
#define all(obj) (obj).begin(), (obj).end()
const int inf = 1e9;
const ll INF = 1e18;
const ll MOD = 1e9+7;
const ll MAX = 1e9+7;

int main(){
    int n; cin >> n;
    vector<bool> dp(1e6+1, true);
    vector<int> a(n), a_ori;
    rep(i, n) cin >> a[i];
    sort(all(a));
    a_ori = a;
    a.erase(unique(all(a)), a.end());
    ll multi, ans = 0;
    rep(i, a.size()){
        multi = 2;
        if(dp[a[i]] == true){
            while(a[i] * multi <= 1e6){
                dp[a[i] * multi] = false;
                multi++;
            }
        }
    }
    vector<int> b;
    int cur_idx = 0;
    int cur_num = a_ori[0];
    int count = 1;
    while(cur_idx < a_ori.size()){
        cur_idx++;
        if(cur_num == a_ori[cur_idx]) count++;
        else{
            if(count == 1) b.push_back(cur_num);
            cur_num = a_ori[cur_idx];
            count = 1;
        }
    }
    rep(i, b.size()) if(dp[b[i]] == true) ans++;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 5952
#include <bits/stdc++.h>
using namespace std;
#define modulo 1000000007
#define mod(mod_x) (((long long)mod_x)%modulo)


int main(){
	
	int W,H,x,y;
	cin>>W>>H>>x>>y;
	
	cout<<(double)W*H/2<<' ';
	if(x*2==W&&y*2==H){
		cout<<1<<endl;
	}
	else{
		cout<<0<<endl;
	}
	
	
	return 0;
}


Measured memory_bytes: 256
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author Kein Yukiyoshi
 */

#include "bits/stdc++.h"
#define int long long
#define rep(i, n)           for (int i = 0; i < (int)(n); i++)
#define REP(i, a, b)        for (int i = (int)(a); i < (int)(b); i++)
#define FOR(i, a)           for (auto &i : a)
#define ALL(obj)            begin(obj), end(obj)
#define MAX(x)              *max_element(ALL(x))
#define MIN(x)              *min_element(ALL(x))
#define SUM(x)              accumulate(ALL(x), 0LL)
#define LOWER_BOUND(A, key) distance(A.begin(), lower_bound(ALL(A), key))
#define UPPER_BOUND(A, key) distance(A.begin(), upper_bound(ALL(A), key))

using namespace std;
const int MOD    = (int)(1e9 + 7);
const int INF    = (int)(1e13 + 7);
const double EPS = 1e-14;
const double PI  = acos(-1);

int CEIL(int a, int b) { return (a >= 0 ? (a + (b - 1)) / b : (a - (b - 1)) / b); } //ceil() for int
int mod(int a, int b) { return a >= 0 ? a % b : a - (b * CEIL(a, b)); }             //always return positive num
int bpm(int a, int b) {                                                             //return x^y in order(log(y))
  int res = 1;
  for (a %= MOD; b; a = a * a % MOD, b >>= 1)
    if (b & 1) res = res * a % MOD;
  return res;
}

class CXYZTriplets {
public:
  static void solve(istream &cin, ostream &cout) {
    int N;
    cin >> N;
    vector<int> ans(100000);
    REP(x, 1, 101) {
      REP(y, 1, 101) {
        REP(z, 1, 101) {
          if (x * x + y * y + z * z + x * y + y * z + z * x < 10000 + 100) {
            ans[x * x + y * y + z * z + x * y + y * z + z * x]++;
          }
        }
      }
    }
    rep(i, N) {
      cout << ans[i + 1] << endl;
    }
  }
};


signed main() {
  cin.tie(0);
  cout.tie(0);
  ios_base::sync_with_stdio(false);
  cout<<fixed<<setprecision(15);
  CXYZTriplets solver;
  std::istream& in(std::cin);
  std::ostream& out(std::cout);
  solver.solve(in, out);
  return 0;
}


Measured memory_bytes: 3968
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int x,mx =0;
  cin >> x;
  
  if(x == 1 || x == 2 || x == 3){
    cout << 1 << endl;
    return 0;
  }
  for(int i=2;pow(i,2)<= x;i++)
    for(int j=2;pow(i,j)<=x;j++)
      {int a ;
	a =pow(i,j);
	mx =max(a,mx);
      }
  cout << mx << endl;
  return 0;
}


Measured memory_bytes: 512
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<queue>
#include<functional>
#include<iomanip>

using namespace std;

typedef long long ll;

int N;
vector<vector<int>> E;

void dfs(int pos, int bef, vector<int>& dis) {
	for (int i = 0; i < E[pos].size(); i++) {
		int nxt = E[pos][i];
		if (nxt == bef)continue;
		dis[nxt] = dis[pos] + 1;
		dfs(nxt, pos, dis);
	}
}

int get_diameter() {
	vector<int> dis(N);
	dfs(0, -1, dis);
	int longest = 0, idx = -1;
	for (int i = 0; i < N; i++) {
		if (longest < dis[i]) {
			longest = dis[i], idx = i;
		}
	}

	dis.clear();
	dis.resize(N);
	dfs(idx, -1, dis);

	int res = -1;
	for (int i = 0; i < N; i++) {
		if (res < dis[i])res = dis[i];
	}
	return res;
}

int main() {

	cin >> N;
	E.resize(N);

	for (int i = 0; i < N - 1; i++) {
		int a, b;
		cin >> a >> b;
		a--, b--;
		E[a].push_back(b), E[b].push_back(a);
	}

	int dm = get_diameter();

	if (dm % 3 == 1) {
		cout << "Second" << endl;
	}
	else 
		cout << "First" << endl;

	return 0;
}


Measured memory_bytes: 24448
import sys
input = sys.stdin.readline
N = int(input())
A = [int(x) for x in input().split()]

ans = 10**10

for t in range(1,N) :
    S1 = sum(A[:t])
    S2 = sum(A[t:])
    diff = abs(S1-S2)
    ans = min(ans,diff)

print(ans)


Measured memory_bytes: 3060
#include <stdio.h>

int main(void){

  int a[3][3];
  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 3; j++) {
      scanf("%d", &a[i][j]);
    }
  }
  int n;
  scanf("%d", &n);
  int b[n];
  for (int i = 0; i < n; i++) {
    scanf("%d", &b[i]);
  }

  int bingo[3][3];
  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 3; j++) {
      bingo[i][j] = 0;
      for (int k = 0; k < n; k++) {
        if (b[k] == a[i][j]) {
          bingo[i][j] = 1;
          break;
        }
      }
    }
  }

  if (bingo[0][0] == 1 && bingo[0][1] == 1 && bingo[0][2] == 1) {
    printf("Yes\n");
  } else if (bingo[1][0] == 1 && bingo[1][1] == 1 && bingo[1][2] == 1) {
    printf("Yes\n");
  } else if (bingo[2][0] == 1 && bingo[2][1] == 1 && bingo[2][2] == 1) {
    printf("Yes\n");
  } else if (bingo[0][0] == 1 && bingo[1][0] == 1 && bingo[2][0] == 1) {
    printf("Yes\n");
  } else if (bingo[0][1] == 1 && bingo[1][1] == 1 && bingo[2][1] == 1) {
    printf("Yes\n");
  } else if (bingo[0][2] == 1 && bingo[1][2] == 1 && bingo[2][2] == 1) {
    printf("Yes\n");
  } else if (bingo[0][0] == 1 && bingo[1][1] == 1 && bingo[2][2] == 1) {
    printf("Yes\n");
  } else if (bingo[0][2] == 1 && bingo[1][1] == 1 && bingo[2][0] == 1) {
    printf("Yes\n");
  } else {
    printf("No\n");
  }

  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define LL long long
using namespace std;
struct Node {
    string s;
    int p,id;
}a[105];
bool cmp(const Node &a,const Node &b) {
    return a.s == b.s ? a.p > b.p : a.s < b.s;
}
int main() {
    ios::sync_with_stdio(false),cin.tie(0);
    int n;
    cin >> n;
    for (int i = 1;i <= n;i++)
        cin >> a[i].s >> a[i].p,a[i].id = i;
    sort(a+1,a+n+1,cmp);
    for (int i = 1;i <= n;i++)
        cout << a[i].id << endl;
    return 0;
}


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>;
 
int main() {
  ll a;
  double b;
  cin >> a >> b;
  ll ib = b*100+0.5;
  a *= ib;
  a /= 100;
  printf("%lld\n", a);
  return 0;
}

Measured memory_bytes: 3796
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
int main() {
  int H, W;
  cin >> H >> W;
  string str;
  rep(i, H) {
    cin >> str;
    cout << str << endl;
    cout << str << endl;
  }
}
  

Measured memory_bytes: 3640
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <string>
#include <stdio.h>
#include <cmath>
#include <limits.h>
using namespace std;

typedef long long ll;

#define min(a, b) (((a) < (b))? (a):(b))
#define max(a, b) (((a) > (b))? (a):(b))
#define REP(i, a, n) for(int i=(a); i<(n); ++i)
#define rep(i, n) REP(i, 0, (n))
#define square(a) (a)*(a)
#define pb push_back


int n,k,s,a[55];
int main(void) {
    int i;
    cin >> n >> k;
    for(i = 0;n>i;i++) cin >> a[i];
    sort(a,a+n);
    for(i = n-k;i<n;i++)s += a[i];
    cout << s;
}


Measured memory_bytes: 256
program count_abc
    implicit none
    character(50):: s
    integer(4):: n, i, c

    read*, n
    read*, s
    c=0
    do i=1, len_trim(s)-2
        if (s(i:i+2) == 'ABC') c=c+1
    end do
    print*, c
end program count_abc

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define Tree int h,int l,int r,int L,int R
#define left 2*h,l,(l+r)/2,L,R
#define right 2*h+1,(l+r)/2+1,r,L,R
#define F first
#define S second
#define Pb push_back
using namespace std;
long long x,y;
main ()
{
	cin>>x>>y;
	
	cout<<x+y/2<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define N 100005
typedef long long ll;
ll MOD = 1000000007;
ll dp[100005][13];
int main()
{
    string s;
    cin >> s;
    ll n = s.size();
    dp[0][0] = 1;
    for(int i = 0 ; i < n ; i++){
    	for(int j = 0 ; j < 10 ; j++){
    		ll nxt = s[ i ] - '0';
    		if(s[i] == '?'){
    			nxt = j;
    		}
    		for(int k = 0 ; k < 13 ; k++){
    			ll rem = (10*k + nxt) % 13;
    			dp[i + 1][rem] += dp[i][k];
    			dp[i + 1][rem] %= MOD;
    		}
    		if(s[i] != '?')
    			break;
    	}
    }
    cout << dp[n][5] << endl;
}

Measured memory_bytes: 10624
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<stdlib.h>
#include<time.h>
#include<math.h>
#include<vector>
#include<numeric>
#include<random>
#define all(v) v.begin(),v.end()
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;

int main(){
	int n;
	long int tmp;
	long int maxv=-10000000000;
	long int minv=10000000000;
	cin >> n;

	rep(i, n) {
		cin >> tmp;
		maxv = max(maxv, tmp - minv);
		minv = min(tmp, minv);
	}
	cout << maxv << endl;
	return 0;
}


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

int main() {
  ll n,k;
  cin >> n >> k;
  ll a=n%k;
  ll ans=min(a, k-a);
  cout << ans << endl;
  return 0;
  
}

Measured memory_bytes: 256
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

n, m = na()
pys = []
for i in range(m):
    x = na()
    x = [x[0], x[1], i]
    pys.append(x)

pys.sort()
pp = -1
lid = 0
ans = [0] * m
for i in range(m):
    if pys[i][0] == pp:
        lid += 1
    else:
        lid = 1
    ans[pys[i][2]] = pys[i][0] * 1000000 + lid
    pp = pys[i][0]
for v in ans:
    print("{:012d}".format(v))


Measured memory_bytes: 29380
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<string>
#include<iostream>
using namespace std;
typedef long long ll;
ll mod = 1000000007;
ll dp[3002][3002];
int dat[3002];
int rui[3002];
int main()
{
	int num, way;
	scanf("%d%d", &num, &way);
	string s;
	cin >> s;
	reverse(s.begin(), s.end());
	s.push_back('0');
	reverse(s.begin(), s.end());
	num++;
	for (int i = 1; i < num; i++)rui[i] = rui[i - 1] + s[i] - '0';
	for (int i = 0; i < num; i++)dat[i] = i;
	for (int i = 0; i < way; i++)
	{
		int za, zb;
		scanf("%d%d", &za, &zb);
		dat[za] = max(dat[za], zb);
	}
	for (int i = 1; i < num; i++)dat[i] = max(dat[i], dat[i - 1]);
	dp[0][0] = 1;
	for (int i = 1; i < num; i++)
	{
		int a0 = (dat[i] - dat[i - 1]) - (rui[dat[i]] - rui[dat[i - 1]]);
		int a1 = (rui[dat[i]] - rui[dat[i - 1]]);
		int sum = dat[i - 1] - (i - 1);
		//printf("%d %d %d\n", a0, a1, sum);
		for (int j = 0; j <= sum; j++)
		{
			if (sum - j + a0 != 0)dp[i][j + a1] += dp[i - 1][j], dp[i][j + a1] %= mod;
			if (j + a1 != 0)dp[i][j + a1 - 1] += dp[i - 1][j], dp[i][j + a1 - 1] %= mod;
		}
		//for (int j = 0; j < num; j++)printf("%lld ", dp[i][j]); printf("\n");
	}
	printf("%lld\n", dp[num - 1][0]);
}

Measured memory_bytes: 12800
#include <stdio.h>

int main()
{
    int n,a,b;
    scanf("%d",&n);
    a=n;
    b=0;
    for(int i=0;i<9;i++){
        b+=n%10;
        n/=10;
    }
    if(a%b==0)
    printf("Yes\n");
    else
    printf("No\n");
    return 0;
}


Measured memory_bytes: 128
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

class Program{
    public static void Main(){
        int N = int.Parse(ReadLine());
        int total = 0;
        
        for(int cake = 0; cake < 15; cake++){
            for(int donut = 0; donut < 15; donut++){
                total = 4 * cake + 7 * donut;
                if(total == N){
                    WriteLine("Yes");
                    break;
                }
            }
            if(total == N){
                break;
            }
        }
        if(total != N){
            WriteLine("No");
        }
    } 
}

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

const int MAX = 10;
bool D[MAX][MAX];

int dfs(int v, int n, bool visited[MAX]){
    bool all_visited = true;
    for(int i = 0; i < n; i++){
        if(visited[i] == false){
            all_visited = false;
            break;
        }
    }

    if(all_visited){
        return 1;
    }

    int ret = 0;
    for(int i = 0; i < n; i++){
        if(D[v][i] == false){
            continue;
        }
        if(visited[i]){
            continue;
        }
        visited[i] = true;
        ret += dfs(i, n, visited);
        visited[i] = false; // ?
    }
    return ret;
}

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

    int n, m;
    cin >> n >> m;

    for(int i = 0; i < m; i++){
        int a, b;
        cin >> a >> b;
        a--; b--;
        D[a][b] = true;
        D[b][a] = true;
    }

    bool visited[MAX];
    for(int i = 0; i < n; i++){
        visited[i] = false;
    }

    visited[0] = true;

    cout << dfs(0, n, visited) << endl;

    return 0;
}

Measured memory_bytes: 256
package main

import "fmt"

/**
Problem Statement
文字列Sの書かれたボールがA個、文字列Tの書かれたボールがB個あります。
高橋君は、文字列Uの書かれたボールを1個選んで捨てました。
文字列S,Tの書かれたボールがそれぞれ何個残っているか求めてください

Sample input1
red blue
3 4
red
*/
func main() {

	var s, t, u string
	var sCnt, tCnt int

	fmt.Scan(&s, &t)
	fmt.Scan(&sCnt, &tCnt)
	fmt.Scan(&u)

	if s == u {
		sCnt -= 1
	}
	if t == u {
		tCnt -= 1
	}

	fmt.Println(sCnt, tCnt)
}


Measured memory_bytes: 512
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
    int a,b;
    cin>>a>>b;
    double c=a*b;
    c/=3.305785;
    printf("%.20f\n",c);
    return 0;
}

Measured memory_bytes: 1192
#!/usr/bin/env python

from collections import deque
import itertools as it
import sys
import math

sys.setrecursionlimit(10000000)

N = input()
T = map(int, raw_input().split())
V = map(int, raw_input().split())

upper = []

Ts = 0
for i in range(N):
    upper.append((Ts, V[i]))
    Ts += T[i]
    upper.append((Ts, V[i]))

S = sum(T)
upper.append((0, 0))
upper.append((S, 0))

ans = [0]
Ts = 0
for i in range(N):
    dt = 0
    while True:
        dt += 0.5
        t = Ts + dt
        v = V[i]
        for p in upper:
            v = min(v, p[1] + abs(p[0] - t))
        ans.append(v)
        if dt == T[i]:
            break
    Ts += T[i]

print (sum(ans[1:]) + sum(ans[:-1])) / 4

Measured memory_bytes: 34668
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int a[12];
int cnt = 1;
int N;
int d[3] = { 1,0,-1 };
vector<int> v[10];

int main() {
	int N;
	cin >> N;
	
	for (int j = 0; j < N; j++) {
		cin >> a[j];
		for (int i = 0; i < 3; i++) {
			if ((a[j] + d[i]) % 2 != 0) {
				v[j].push_back(1);
			}
		}
	}
	for (int i = 0; i < N; i++) {
		cnt *= v[i].size();
	}
	cout << (int)pow(3,N)-cnt << endl;
	return 0;
}

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

int main()
{
  int N;
  cin >> N;
  char S[N];
  for(int i=0;i<N;i++) cin >> S[i];

  int total = 0;
  for(int i=1;i<N;i++)
  {
    if(S[i] == 'E') total++;
  }

  int res = total;
  for(int i=1;i<N;i++)
  {
    if(S[i] == 'E' && S[i-1] == 'E') total--;
    if(S[i] == 'W' && S[i-1] == 'W') total++;
    if(res > total) res = total;
  }
  cout << res << endl;
}

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

const int N = 100010;

std::vector <int> e[N];
bool vis[N];
std::vector <int> ans[2];

int dfs(int u, int type){
	ans[type].push_back(u);
	vis[u] = true;
	for (auto v : e[u]){
		if (!vis[v]){
			dfs(v, type);
			break;
		}
	}
}

int n, m;

int main(){
	scanf("%d%d", &n, &m);
	for (int i = 0, u, v; i < m; ++ i){
		scanf("%d%d", &u, &v);
		e[u].push_back(v);
		e[v].push_back(u);
	}
	dfs(1, 0);
	dfs(1, 1);
	printf("%d\n", (int) ans[0].size() + (int) ans[1].size() - 1);
	for (int i = (int) ans[1].size() - 1; i; -- i){
		printf("%d ", ans[1][i]);
	}
	for (auto u : ans[0]){
		printf("%d ", u);
	}
	return printf("\n"), 0;
}

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

using namespace std;

int main(){
  int N,answer;
  string S;
  cin >> N >> S;
  vector<int> w(N);
  vector<int> e(N);
  answer=1000000;
  //累積和を取る
  for (int i = 0; i < N-1; i++) {
    if (S[i] == 'W'){
      w[i+1] = w[i] + 1;
    }
    else {
      w[i+1] = w[i];
    }
  }

  for (int i = N-1; i > 0; i--) {
    if (S[i] == 'E'){
      e[i-1] = e[i] + 1;
    }
    else {
      e[i-1] = e[i];
    }
  }

  for (int i = 0; i < N; i++) {
    answer = min(answer, e[i] + w[i]);
  }
  cout << answer << endl;
}


Measured memory_bytes: 3076
import scala.io.{StdIn => in}

object Main extends App {
  val Array(n, k) = in.readLine.split(" ").map(_.toInt)
  val seq = in.readLine.split(" ").map(_.toInt)
  val ans = ((n-1) + (k-2)) / (k-1)
  println(ans)
}

Measured memory_bytes: 41948
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    ll n,m;
    cin>>n>>m;
    set<ll>* a = new set<ll>[n+1];
    for(int i=0;i<m;i++)
    {
        ll temp1 , temp2;
        cin>>temp1>>temp2;
        ll mini = min( temp2 , temp1 );
        ll maxi = max( temp2 , temp1);
        a[mini ].insert( maxi);
    }
    bool found = false;
    auto it = a[1].begin() ;
    for( ;it!= a[1].end( ) ;it++)
    {
        if(  a[ *it  ].find(n) != a[*it].end()  )
        {
            found = true;
            break;
        }
    }
    if( found) cout<<"POSSIBLE";
        else cout<<"IMPOSSIBLE";
}

Measured memory_bytes: 22332
#include<bits/stdc++.h>
using namespace std;
int n;
string s;
int st;
bool a[200005];
int times;
long long ans;
const int mod=1e9+7; 
int main() {
	cin>>n>>s;
	if(s[0]=='W'||s[2*n-1]=='W') {
		cout<<0;
		return 0;
	}
	times=1;
	a[2*n]=0;
	for(int i=2*n-2;i>=0;i--) {
		if((s[i]=='W'&&times%2)||(s[i]=='B'&&times%2==0)) times++;
		else a[i+1]=1,times--;
		if(times<0) {
			cout<<0;
			return 0;
		}
	}
	if(times!=0) {
		cout<<0;
		return 0;
	}
	ans=1;
	for(int i=1;i<=n;i++) {
		ans*=i;
		ans%=mod;
	}
	times=0;
	for(int i=2*n;i>0;i--) 
		if(a[i]==1) {
			ans*=times;
			times--;
			ans%=mod;
		}
		else times++;
	cout<<ans;
	return 0;
}

Measured memory_bytes: 772
S=list(input())
n=len(S)
ans=0

for i in range(2**n):
    stack=""
    l=[]
    for j in range(n):
        stack=stack+S[j]
        if ((i >> j) & 1)or j==n-1:
            l.append(int(stack))
            stack=""
    ans+=sum(l)
    if len(l)==len(S):
        break
print(ans)

Measured memory_bytes: 3064
var GET=(function(){function f(s){return new g(s);}function g(s){this._s=s.trim().split("\n");this._y=0;}g.prototype.a=function(f){var s=this._s, y=this._y, r;if(typeof s[y]==="string")s[y]=s[y].split(" ").reverse();r=s[y].pop();if(!s[y].length)this._y++;return f?r:+r;};g.prototype.l=function(f){var s=this._s[this._y++].split(" ");return f?s:s.map(a=>+a);};g.prototype.m=function(n,f){var r=this._s.slice(this._y,this._y+=n).map(a=>a.split(" "));return f?r:r.map(a=>a.map(a=>+a));};g.prototype.r=function(n,f){var r=this._s.slice(this._y,this._y+=n);return f?r:r.map(a=>+a);};return f;})();
var o=GET(require("fs").readFileSync("/dev/stdin","utf8"));

console.log(main());
function main(){
  var n = o.a();
  var a = o.r(n);
  var ans = "second";
  for(var i = 0; i < n; i++){
    if(a[i] % 2 === 1){
      ans = "first";
      break;
    }
  }
  return ans;
}

Measured memory_bytes: 28000
#include<bits/stdc++.h>
#define QS ios_base::sync_with_stdio(false);
typedef long long ll;
const ll INF = 1e18;
const int MOD = 1e9+7;
using namespace std;

int cnt[41];
bool take[41] = {0};
int main(){
//freopen("output.txt", "w", stdout);
    QS
    int n; ll k; cin >> n >> k;
    ll a[n];
    for(int i = 0; i < n; ++i) cin >> a[i];
    for(int i = 0; i < n; ++i){
        ll t = a[i];
        for(int j = 0; j < 41; ++j){
            cnt[j] += ((t>>j)&1);
        }
    }
    for(int i = 0; i < 41; ++i){
        if(2*cnt[i] < n){
            take[i] = 1;
        }
       // cout << take[i] << '\n';
    }

    ll XX = 0;
    for(ll i = 40;i >= 0; --i){
        if(take[i]){ll tmp = XX + (1LL<<i);
        //cout << XX << ' ' << tmp << '\n';
        if(tmp <= k) XX = tmp;}
    }
    //cout << XX << '\n';
    ll res = 0, mul = 1;
    for(int i = 0; i < 41; ++i){
        if(((XX>>i)&1)){
            res += mul*(n-cnt[i]);
        }
        else res += mul*cnt[i];
        mul *= 2;
    }
    cout << res << '\n';
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define ll long long
using namespace std;
struct node
{
    ll x,y;
    int id;
}a[100005];
bool cmp(node p1,node p2)
{
    return p1.x-p2.y>p2.x-p1.y;
}
int main()
{
    int n;
    ll ans1=0,ans2=0;
    scanf("%d",&n);
    for(int i=1;i<=n;i++) scanf("%lld%lld",&a[i].x,&a[i].y);
    sort(a+1,a+1+n,cmp);
    bool flag=true;
    for(int i=1;i<=n;i++)
    {
        if(flag) ans1+=a[i].x;
        else ans2+=a[i].y;
        flag=!flag;
    }
    printf("%lld\n",ans1-ans2);
}


Measured memory_bytes: 2560
package main

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

func getScanner(fp *os.File) *bufio.Scanner {
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 500001), 500000)
	return scanner
}

func getNextString(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}

func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}

func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}

func main() {
	fp := os.Stdin
	if len(os.Args) > 1 {
		fp, _ = os.Open(os.Args[1])
	}

	scanner := getScanner(fp)
	writer := bufio.NewWriter(os.Stdout)

	n := getNextInt(scanner)

	aa := make([]int, n)
	bb := make([]int, n)
	mb := make([]int, n)
	for i := 0; i < n; i++ {
		aa[i] = getNextInt(scanner)
	}
	for i := 0; i < n; i++ {
		bb[i] = getNextInt(scanner)
	}

	ans := 0

	ms := MergeSort{}
	ms.init(n)

	for i := 0; i < 30; i++ {
		t := 1 << uint(i)
		for ii := 0; ii < n; ii++ {
			mb[ii] = bb[ii] % (t << 1)
		}
		ms.sort(0, n, mb)

		c := 0
		for ii := 0; ii < n; ii++ {
			c += n
			l := 0
			ma := aa[ii] % (t << 1)
			for iii := 1; iii <= 3; iii++ {
				r := n
				v := t*iii - ma
				for l < r {
					m := (l + r) >> 1
					if mb[m] >= v {
						r = m
						continue
					}
					l = m + 1
				}
				if iii%2 == 1 {
					c -= l
					continue
				}
				c += l
			}
		}
		c %= 2
		ans |= c << uint(i)
	}

	fmt.Fprintln(writer, ans)

	writer.Flush()
}

func bsearch(a, n, t int, mb []int) int {
	l := 0
	r := n
	for l < r {
		m := (l + r) >> 1
		if a+mb[m] >= t {
			r = m
			continue
		}
		l = m + 1
	}
	return l
}

type MergeSort struct {
	n      int
	ll, rr []int
}

func (ms *MergeSort) init(n int) {
	ms.n = n
	ms.ll = make([]int, n/2+2)
	ms.rr = make([]int, n/2+2)
}

func (ms *MergeSort) sort(l, r int, aa []int) {
	if l+1 < r {
		m := (l + r) >> 1
		ms.sort(l, m, aa)
		ms.sort(m, r, aa)
	}
	ms.merge(l, r, aa)
}

func (ms *MergeSort) merge(l, r int, aa []int) {
	ll := ms.ll
	rr := ms.rr
	m := (l + r) >> 1
	for i := l; i < m; i++ {
		ll[i-l] = aa[i]
	}
	for i := m; i < r; i++ {
		rr[i-m] = aa[i]
	}

	ll[m-l] = 1 << 30
	rr[r-m] = 1 << 30
	lpos := 0
	rpos := 0
	for i := l; i < r; i++ {
		if ll[lpos] <= rr[rpos] {
			aa[i] = ll[lpos]
			lpos++
			continue
		}
		aa[i] = rr[rpos]
		rpos++
	}
}


Measured memory_bytes: 11648
/*
 *  Author : Jun_SH
 *  Solution for ABC 140 A
 */
#include<bits/stdc++.h>
#define int long long
#define sd(a) scanf("%lld",&a)
using namespace std;
const int inf=0x3f3f3f3f;
main(){
    int n;
    cin>>n;
    cout<<n*n*n<<endl;
}


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

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

    int diff = b - a;
    int sum = 0;
    for(int i = 0; i < diff; i++){
        sum += i;
    }

    cout << sum - a << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
typedef vector<int> VI;
typedef pair<int, int> pii;
typedef vector<pii> VP;
typedef vector<string> VS;
typedef priority_queue<int> PQ;
template<class T>bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
#define fore(i,a) for(auto &i:a)
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
//priority_queue<int,vector<int>, greater<int> > q2;



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

	bool F = 1;
	string S;
	cin >> S;
	if (S[0] != 'A')F = false;
	bool f = false;
	int a;
	eFOR(i, 2, S.size() - 2) {

		if (f && S[i] == 'C')F = false;
		if (S[i] == 'C') {
			f = 1;
			a = i;
		}
	}
	REP(i, S.size()) {
		if (i == 0 || i == a)continue;
		if ('a' <= S[i] && S[i] <= 'z')continue;
		F = false;
	}


	if (F && f)cout << "AC" << endl;
	else cout << "WA" << endl;

	

	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
long long int c;
string s, s1;
int main(){
	//ios::sync_with_stdio(0), cin.tie(0);
	//cout<< fixed<< setprecision(10) << x << endl;
	cin>>s>>s1;
	for(int a = 0; a < 3; a++){
        if(s[a] == s1[a])c++;
	}
	cout<<c<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
template <typename T>
vector<pair<T, T>> prime_factor(T n) {
    vector<pair<T, T>> ret;
    for (T i = 2; i * i <= n; i++) {
        T tmp = 0;
        while (n % i == 0) {
            tmp++;
            n /= i;
        }
        ret.push_back(make_pair(i, tmp));
    }
    if (n != 1) ret.push_back(make_pair(n, 1));
    return ret;
}
int main() {
    ll N, M; cin >> N >> M;
    vector<P>A = prime_factor(M);
    long long ans = 1;
    for (ll i = 0; i < A.size(); i++) {
        if (A.at(i).second >= N) ans *= pow(A.at(i).first, (A.at(i).second / N));
    }
    cout << ans << endl;
}


Measured memory_bytes: 11504
#include<iostream>
#include<algorithm>
using namespace std;
signed main() {
	int a, b, c; cin >> a >> b >> c;
	int ans = (c / (a * 7 + b)) * 7; c %= (a * 7 + b);
	cout << ans + min((c + a - 1) / a, 7) << endl;
}


Measured memory_bytes: 3120
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,m,x,y,a[100],b[100];
    cin>>n>>m>>x>>y;
    for(int i=0;i<n;i++)cin>>a[i];
    for(int i=0;i<m;i++)cin>>b[i];
    sort(a,a+n);
    sort(b,b+m);
    bool ans=true;
    if(x>=y||x>=b[0])ans=false;
    if(a[n-1]>=b[0]||a[n-1]>=y)ans=false;
    if(ans==true)puts("No War");
    else puts("War");
    return 0;
}

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

// #undef DEBUG  // Uncomment this line to forcefully disable debug print.
#if DEBUG
template <typename T>
void debug(T value) {
  std::cerr << value;
}
template <typename T, typename... Ts>
void debug(T value, Ts... args) {
  std::cerr << value << ", ";
  debug(args...);
}
#define dbg(...)                              \
  do {                                        \
    cerr << #__VA_ARGS__ << ": ";             \
    debug(__VA_ARGS__);                       \
    cerr << " (L" << __LINE__ << ")" << endl; \
  } while (0)
#else
#define dbg(...)
#endif

void read_from_cin() {}
template <typename T, typename... Ts>
void read_from_cin(T& value, Ts&... args) {
  std::cin >> value;
  read_from_cin(args...);
}
#define in(type, ...) \
  type __VA_ARGS__;   \
  read_from_cin(__VA_ARGS__);

template <typename T>
void write_to_cout(const T& value) {
  std::cout << value << std::endl;
}
template <typename T, typename... Ts>
void write_to_cout(const T& value, const Ts&... args) {
  std::cout << value << ' ';
  write_to_cout(args...);
}
#define out(...) write_to_cout(__VA_ARGS__);

#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)

using ll = long long;

using namespace std;

int main() {
  in(ll, n);
  ll ans = 1LL << 60;
  for (ll i = 1; i * i <= n; ++i) {
    if (n % i == 0) {
      ans = min(ans, (i - 1) + (n / i - 1));
    }
  }
  out(ans);
}


Measured memory_bytes: 256
unittest
{
	assert( [ "4", "3 4 3 2" ].parse.expand.solve == "6 8" );
	assert( [ "5", "3 4 100 3 2" ].parse.expand.solve == "-1" );
	assert( [ "10", "2 2 2 2 2 2 2 2 2 2" ].parse.expand.solve == "2 3" );
	
	assert( [ "4", "2 5 3 2" ].parse.expand.solve == "6 9" );		// 追加ケース
	assert( [ "5", "5 2 5 3 2" ].parse.expand.solve == "-1" );		// 追加ケース
	assert( [ "5", "6 2 5 3 2" ].parse.expand.solve == "6 11" );		// 追加ケース
}



import std.conv;
import std.format;
import std.math;
import std.range;
import std.stdio;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	input.popFront;
	auto as = input.front.split.to!( long[] );
	return tuple( as );
}

auto solve( long[] as )
{
	auto mi = 2L;
	auto ma = 2L;
	foreach_reverse( a; as )
	{
		auto di = cast( long )( a * ( cast( real ) mi / a ).ceil );
		auto da = cast( long )( a * ( cast( real ) ma / a ).floor + a - 1 );
		if( ma < di ) return "-1";
		mi = di;
		ma = da;
	}
	return format( "%s %s", mi, ma );
}


Measured memory_bytes: 6452
s = input()
now = s[0]
c = []
count = 1
for i in range(1,len(s)):
    if (now == s[i]):
        count += 1
    else:
        c.append(count)
        now = s[i]
        count = 1
c.append(count)
#print(c)

def ta(n):
    ans = 0
    for i in range(1,n+1):
        ans += i
    return ans

if (s[0] == "<"):
    a = []
    for i in range(len(c)//2):
        a.append(max(c[2*i],c[2*i+1]))
        a.append(min(c[2*i],c[2*i+1])-1)
    if (len(c)%2==1):
        a.append(c[-1])
    #print(a)
    ans = 0
    for i in a:
        ans += ta(i)
    print(ans)
else:
    a = []
    a.append(c[0])
    for i in range((len(c)-1)//2):
        a.append(max(c[2*i+1],c[2*i+2]))
        a.append(min(c[2*i+1],c[2*i+2])-1)
    if (len(c)%2==0):
        a.append(c[-1])
    ans = 0
    for i in a:
        ans += ta(i)
    print(ans)

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

int main(void){
    char s[11];
    int n;
    scanf("%d %s",&n,s);
    if(n>3199){
        printf("%s",s);
    }else{
        printf("red");
    }
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
 
#define pb push_back
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define ll long long
using namespace std;
void file(){
	#ifndef ONLINE_JUDGE
    	freopen("tst.txt", "r", stdin);
	#endif	
}
const int N=1e5+5,MAX=3e7,MOD=1e9+7;


int n;
map<char,int>occ;
int main()
{	
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);

	string a;

	cin>>a;

	for(auto c : a)occ[c]++;

	for(char i = 'A';i<='Z';i++)if(occ[i]>0 && occ[i]!=2)return cout<<"No\n",0;

	cout<<"Yes\n";
	
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define INF 2000000000000000000
#define ll long long
#define pb push_back
using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  ll N;
  cin >> N;
  ll m = INF;
  ll ans = 0;
  for (ll i = 0; i < N; ++i) {
    ll p;
    cin >> p;
    if (p < m) {
      ans += 1;
      m = p;
    }
  }
  cout << ans << "\n";
}


Measured memory_bytes: 3648
{-# LANGUAGE BangPatterns #-}

import Control.Monad
import Data.List
import Data.Maybe
import qualified Data.ByteString.Char8 as C8

type Pair = (Int, Int)

main :: IO ()
main = do
  [n,m] <- readInts
  ps <- sortOn fst <$> replicateM n readPair
  print $ solve m ps
 
solve :: Int -> [Pair] -> Int
solve m = fst . foldl' f e
  where
    e = (0,0)
    f (!s,!n) (a,b)
      | n == m = (s,n)
      | c > m = until ((m==).snd) (\(!s,!n) -> (s+a,n+1)) (s,n)
      | otherwise = (s+a*b, c)
      where
        c = n+b

-- utils
readInts :: IO [Int]
readInts = map (fst . fromJust . C8.readInt) . C8.words <$> C8.getLine

readPair :: IO Pair
readPair = do
  [x,y] <- readInts
  return (x,y)

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

int main() {
  int N, K;
  int t = 1;
  
  cin >> N >> K;
  
  for(int i = 0; i < N; i++) {
    if(t + K >= 2 * t) {
      t *= 2;
    }
    
    else {
      t += K;
    }
  }
  cout << t << endl;
}

Measured memory_bytes: 256