akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>

using namespace std;

#define S scanf
#define P printf
#define G getline
#define SZ size()
#define C clear()
#define B begin()
#define F front()
#define T top()
#define E end()
#define EM empty()
#define V vector
#define Q queue
#define DQ deque
#define PQ priority_queue
#define ST stack
#define FI first
#define SE second
#define PI acos(-1)
#define PS push
#define PP pop()
#define PSF push_front
#define PSB push_back
#define PPF pop_front()
#define PPB pop_back()
#define MP make_pair
#define LL long long int
#define ULL unsigned long long int
#define PII pair<int,int>
#define PSI pair<string,int>
#define PIS pair<int,string>
#define PLI pair<long long int,int>
#define PLL pair<long long int,long long int>
#define MII map<int,int>
#define MSI map<string,int>
#define MIS map<int,string>
#define MLI map<long long int,int>
#define FAST() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)





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





int main()
{
    FAST();

//    freopen("input.txt","r",stdin);
//    freopen("input.txt","w",stdout);

    int n;
    string s;
    cin >> n >> s;
    if(n < 3200)
    {
        cout << "red";
        return 0;
    }
    cout << s;
    return 0;
}


Measured memory_bytes: 256
package main

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

var (
	sc = bufio.NewScanner(os.Stdin)
	wtr = bufio.NewWriter(os.Stdout)
)

func scanInt() int {
	sc.Scan()
	a,_ := strconv.Atoi(sc.Text())
	return a
}

func scanInts(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ { res[i] = scanInt() }
	return res
}

func scanText() string {
	sc.Scan()
	return sc.Text()
}

func main() {
	sc.Split(bufio.ScanWords)

	a, b := int64(scanInt()), int64(scanInt())

	fact := factorization(euclidean(a,b))

	ans := len(fact) + 1

	fmt.Println(ans)

}

func euclidean(a,b int64) int64 {
	r, x := a%b, b
	for r != 0 {
		x, r = r, x%r
	}
	return x
}

func factorization(n int64) map[int64]int {
	res := make(map[int64]int, 0)
	for i := int64(2); i*i <= n; i++ {
		for n%i == 0 {
			res[i]++
			n /= i
		}
	}
	if n!=1 {
		res[n] = 1
	}
	return res
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
#define rep(i, n) for(int i = 0;i < (int)n;i++)
#define repb(i, n) for(int i = (int)n;i >= 0;i--)
#define reps(i, m, n) for(int i = (int)m;i < (int)n;i++)
#define repsb(i, m, n) for(int i = (int)m;i >= (int)n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define pb(a) push_back(a)
#define INF 999999999999999999
using namespace std;
int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};
using namespace std;
int main(int argc, char const *argv[]) {
    int a,b;
    cin>>a>>b;
    cout<<max(a+b,max(a-b,a*b))<<endl;
 return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <cmath>
#include <iomanip>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cassert>
#include <cstring>

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> V;
typedef map<int, int> M;

constexpr ll INF = 1e18;
constexpr ll MOD = 1e9 + 7;
constexpr double PI = 3.14159265358979323846;
constexpr int dx[] = {0, 0, 1, -1};
constexpr int dy[] = {1, -1, 0, 0};

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

    int h, w;
    string a[510];

    cin >> h >> w;
    REP(i, h)
    cin >> a[i];

    string red[510], blue[510];

    REP(i, h)
    {
        red[i] = "";
        blue[i] = "";
        REP(j, w)
        {
            red[i] += ".";
            blue[i] += ".";
        }
    }

    REP(i, h)
    {
        red[i][0] = '#';
        blue[i][w - 1] = '#';

        if (i % 2)
        {
            REP(j, w - 1)
            red[i][j] = '#';
        }
        else
        {
            REP(j, w - 1)
            blue[i][j + 1] = '#';
        }
    }

    REP(i, h)
    {
        REP(j, w)
        {
            if (a[i][j] != '#')
                continue;

            if (i % 2)
                blue[i][j] = '#';
            else
                red[i][j] = '#';
        }
    }

    REP(i, h)
    cout << red[i] << endl;
    cout << endl;
    REP(i, h)
    cout << blue[i] << endl;

    return 0;
}

Measured memory_bytes: 1664
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define ALL(x) (x).begin(), (x).end()
typedef long long ll;
typedef pair<int, int> P;
typedef vector<vector<int> > Matrix;

vector<ll> divisor(ll n){
    vector<ll> res;
    for (ll i = 1; i*i <= n; i++){
        if (n % i == 0){
            res.push_back(i);
            if (i != n / i) res.push_back(n / i);
        }
    }
    return res;
}

int main(){
    ll n;
    cin >> n;
    vector<ll> x = divisor(n);
    ll ans = 9999999999999;
    for (int i = 0; i < x.size(); i++){
        ll z = x[i];
        ll y = n / z;
        ans = min(ans, y + z - 2);
    }
    cout << ans << endl;
}

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

using namespace std;

#define INF 1001000100010001000
#define MOD 1000000007
#define EPS 1e-10
#define int long long
#define rep(i, N) for (int i = 0; i < N; i++)
#define Rep(i, N) for (int i = 1; i < N; i++)
#define For(i, a, b) for (int i = (a); i < (b); i++)
#define pb push_back
#define eb emplece_back
#define mp make_pair
#define i_i pair<int, int>
#define vi vector<int>
#define vvi vector<vi >
#define vb vector<bool>
#define vvb vector<vb >
#define vp vector< i_i >
#define Edge pair< i_i, int>
#define all(a) (a).begin(), (a).end()
#define Int(x) int x; scanf("%lld", &x);
#define int2(x, y) int x, y; scanf("%lld %lld", &x, &y);
#define fir first
#define sec second
#define ffir first.first
#define fsec first.second
#define sfir second.first
#define ssec second.second
 
int dxy[5] = {0, 1, 0, -1, 0};
int dx[9] = {-1, 0, 1, -1, 1, -1, 0, 1, 0};
int dy[9] = {-1, -1, -1, 0, 0, 1, 1, 1, 0};
// assign
 
signed main()
{
    int2(h, w);
    Int(n);

    map<i_i, int > mp;

    rep(i, n) {
        int2(x, y);
        x--; y--;
        rep(j, 9) {
            int nx = x + dx[j], ny = y + dy[j];
            if (0 <= nx && 0 <= ny && nx < h && ny < w) {
                /*
                if (mp.find(i_i(nx, ny)) == mp.end()) {
                    mp.insert(i_i(nx, ny), 1);
                } else {
                    mp[i_i(nx,ny)]++;
                }*/
                mp[i_i(nx,ny)]++;
            }
        }
    }

    vi ans(10, 0);
    auto i = mp.rbegin();
    //cout << "=======" << endl;
    for ( ; i != mp.rend(); i++) {
        /*
        cout << i->first.first << " " << i->first.second << " ";
        cout << i->second << endl;
        */
        int nx = i->first.first, ny = i->first.second;
        if (0 < nx && nx < h-1 && 0 < ny && ny < w-1) {
            ans[i->second]++;
        }
    }
    //cout << "=======" << endl;
    int z = (h-2) * (w-2);
    Rep(i, 10) {
        z -= ans[i];
    }
    cout << z << endl;
    Rep(i, 10) {
        cout << ans[i] << endl;
    }

    return 0;
}



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

int main()
{
    string weather ;
    int x ;
    cin >> weather ;

    if (weather[0]=='S')
        x=1 ;
    else if (weather[0]=='C')
        x=2;
    else
        x=3;

    x=++x%3;

    if (x==1)
        weather="Sunny" ;
    else if (x==2)
        weather="Cloudy";
    else
        weather="Rainy";

    cout <<weather;


    return 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        LinkedList<Integer> dp = new LinkedList<Integer>();
        dp.add(1);
        dp.add(1);
        if(n<=1)
            System.out.println(1);
        else{
            for(int i=2;i<=n;i++){
                dp.add(dp.get(i-1)+dp.get(i-2));
            }
            System.out.println(dp.get(n));
        }
    }
}



Measured memory_bytes: 26336
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <cmath>
#include <iomanip>
#include <cassert>
#include <bitset>
using namespace std;

typedef pair<int, int> P;
#define rep(i, n) for (int i=0; i<(n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end())
#define index(xs, x) (int)(lower_bound(all(xs), x) - xs.begin())
#define _1 first
#define _2 second
#define pb push_back
#define INF 1145141919
#define MOD 1000000007

int N, K;
int A[100000], B[100000];

signed main() {
  ios::sync_with_stdio(false); cin.tie(0);
  cin >> N >> K;
  rep(i, N) cin >> A[i] >> B[i];

  K++;
  long long m = 0;
  int border = 0;
  for (int i=30; i>=0; i--) {
    bool k = ((1<<i)&K) > 0;
    if (k) {
      long long s = 0;
      long long e = border | (1<<i)-1;
      rep(j, N) {
        if ((A[j] | e) == e) s += B[j];
      }
      m = max(m, s);
      border |= 1<<i;
    }
    else {
    }
  }
  cout << m << "\n";
  return 0;
}


Measured memory_bytes: 1152
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define frst first
#define sec second
#define fast cin.tie(0) , ios_base :: sync_with_stdio(0)
#define db double
#define mod 1000000007
void online_judge()
{
#ifndef ONLINE_JUDGE
	freopen("Input.txt", "r", stdin);
	freopen("Output.txt", "w", stdout);
#endif
}


ll lpp(string s)
{
	string rev = s;
	reverse(rev.begin() , rev.end());
	s = s + '#' + rev;
	////cout << s << " ";
	vector<ll> z(s.size() , 0);
	ll l = 0 , r = 0;
	for (int i = 1; i < s.size(); ++i)
	{
		if (i > r) {
			l = r = i;
			while (s[r] == s[r - l]) {
				r++;
			}
			z[i] = (r - l);
			r--;
		}
		else {
			if (z[i - l] + i <= r)z[i] = z[i - l];
			else {
				l = i;
				while (s[r] == s[r - l])r++;
				z[i] = (r - l);
				r--;
			}
		}
	}
	ll ans = 0;
	for (int i = 0; i < s.size(); ++i)
	{
		if (z[i] + i == s.size()) {
			ans = max(ans , z[i]);
		}
	}
	return ans;
}

string binary(ll n)
{
	string s;
	while (n) {
		if ((n & 1))s += '1';
		else s += '0';
		n >>= 1;
	}
	reverse(s.begin() , s.end());
	return s;
}

bool pos(vector<ll> &v , ll val , ll painters)
{
	ll cur = 0;
	ll k = 1;
	for (int i = 0; i < v.size(); ++i)
	{
		if (v[i] > val)return 0;
		if (cur + v[i] <= val)cur += v[i];
		else {
			k++;
			cur = v[i];
		}
	}
	cout << k << endl;
	return (k <= painters);
}

class node {
	node* next;
	node* random;
	ll val;
	node(ll x)
	{
		next = random = NULL;
		val = x;
	}
};

ll dp[101][101][1001];

ll cal(ll a[] , ll cur , ll n , ll sum , ll c , ll tot)
{
	if (n == 0)
	{
		///cout << cur << " " << sum << " " << c << endl;
		if (cur == tot / 2)return abs((sum - c) - c);
		return 1e8;
	}
	if (dp[n][cur][c] != 1e8) {
		///cout << dp[n][cur][c] << " ";
		return dp[n][cur][c];
	}
	///cout << dp[n][cur][c] << " ";
	dp[n][cur][c] = cal(a , cur , n - 1 , sum , c , tot);
	dp[n][cur][c] = min(dp[n][cur][c] ,
	                    cal(a , cur + 1 , n - 1 , sum, c + a[n - 1] , tot));
	//cout << ans << endl;
	return dp[n][cur][c];
}


void go() {
	ll n;
	cin >> n;
	ll a[n] , b[n] , c[n];
	for (int i = 0; i < n; ++i)cin >> a[i] >> b[i] >> c[i];
	ll dp[n][3];
	for (int i = 0; i < n; ++i) {
		dp[i][0] = dp[i][1] = dp[i][2] = -1e18;
	}
	for (int i = 0; i < n; ++i)
	{
		dp[i][0] = a[i];
		dp[i][1] = b[i];
		dp[i][2] = c[i];
		///cout << dp[i][0] << " ";
		if (i > 0) {
			dp[i][0] = max(dp[i - 1][1] , dp[i - 1][2]) + dp[i][0];
			dp[i][1] = max(dp[i - 1][0] , dp[i - 1][2]) + dp[i][1];
			dp[i][2] = max(dp[i - 1][0] , dp[i - 1][1]) + dp[i][2];
		}
	}
	cout << max(dp[n - 1][0] , max(dp[n - 1][1] , dp[n - 1][2]));
}


int main() {
	fast;
	//online_judge();
	go();
}

Measured memory_bytes: 4992
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main() {
	int a, b, c, d, e, k;
	cin >> a >> b >> c >> d >> e >> k;
	if (e - a <= k) cout << "Yay!" << endl;
	else cout << ":(" << endl;
	return 0;
}

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

using ll = long long;

template<typename T>
using vec = vector<T>;
template<typename T>
using mat = vector<vec<T>>;

using pi = pair<int,int>;

#define rep(a,b) for(int a=0; a<b; ++a)
#define Rep(a,b,c) for(int a=b; a<c; ++a)

int main(){
	int N,t; cin>>N>>t;
	vec<pi> v(N);
	double tangent=0.0000000;
	rep(i,N){
		cin>>v[i].first>>v[i].second;
		tangent=max(tangent,(double)v[i].second/(double)v[i].first);
	}
	cout<<fixed<<setprecision(10)<<tangent*t<<endl;
}



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

public class Main{
	final static int MOD = 1000000007;
	final static int INF = 1000000000;

	public static void main(String[] args) throws IOException{
		NScanner sc = new NScanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		System.out.printf("%d %d %.6f", a/b, a%b, (double)a/b);
		
	}
	

}

class NScanner {

	private BufferedReader br;
	private StringTokenizer tok;

	public NScanner(InputStream is) throws IOException{
		br = new BufferedReader(new InputStreamReader(is));
		getLine();
	}

	private void getLine() throws IOException{
		while(tok == null || !hasNext()){
			tok = new StringTokenizer(br.readLine());
		}
	}

	private boolean hasNext(){
		return tok.hasMoreTokens();
	}

	public String next() throws IOException{
		if(hasNext()){
			return tok.nextToken();
		}else{
			getLine();
			return tok.nextToken();
		}
	}

	public int nextInt() throws IOException{
		if(hasNext()){
			return Integer.parseInt(tok.nextToken());
		}else{
			getLine();
			return Integer.parseInt(tok.nextToken());
		}
	}

	public long nextLong() throws IOException{
		if(hasNext()){
			return Long.parseLong(tok.nextToken());
		}else{
			getLine();
			return Long.parseLong(tok.nextToken());
		}
	}

	public double nextDouble() throws IOException{
		if(hasNext()){
			return Double.parseDouble(tok.nextToken());
		}else{
			getLine();
			return Double.parseDouble(tok.nextToken());
		}
	}
}


Measured memory_bytes: 24912
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <queue>
#include <sstream>
#include <stack>
#include <time.h>
#include <vector>
#include <complex>
#include <map>
#include <set>
#include <iomanip>
#include <math.h>
#include <stdlib.h>
#include <list>
#include <utility>
#include <memory>
#include <cstring>
#include <fstream>
#include <numeric>
#include <assert.h>
#include <bits/stdc++.h>
using namespace std;
int n,ans=2e9;
int a=0,b=0,c=0,t[11];
int A,B,C,num=0;
void dfs(int x){
	if (x==n+1){
		if (a==0 || b==0 || c==0) return;
		ans=min(ans,abs(a-A)+abs(b-B)+abs(c-C)+num*10); 
		return;
	}
	dfs(x+1);
	if (a!=0) num++;
	a+=t[x];
	dfs(x+1); 
	a-=t[x];
	if (a!=0) num--;
	if (b!=0) num++;
	b+=t[x];
	dfs(x+1);
	b-=t[x];
	if (b!=0) num--;
	if (c!=0) num++;
	c+=t[x];
	dfs(x+1);
	c-=t[x];
	if (c!=0) num--;
}
int main(){
	cin>>n>>A>>B>>C;
	for (int i=1;i<=n;i++) cin>>t[i];
	dfs(1);
	cout<<ans;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define REP(i, s) for (int i = 0; i < s; ++i)
#define ALL(v) (v).begin(), (v).end()
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define DEBUG
#define int long long
#define INF 1e18
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; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }
template<class T>void show(vector<T>v){for (int i = 0; i < v.size(); i++){cerr<<v[i]<<" ";}cerr<<"\n";}
typedef long long ll;


signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n;
    cin>>n;
    vector<int>a(n);
    for (int i = 0; i < n; i++)
    {
        cin>>a[i];
    }
    sort(ALL(a));
    reverse(ALL(a));
    if(n==2){
        cout<<a[0]<<endl;
        return 0;
    }
    priority_queue<int>pq;
    pq.push(a[0]);
    int cnt=0;
    for (int i = 1; i < n; i++)
    {
        int v=pq.top();
        pq.pop();
        cnt+=v;
        if(n==1){
            pq.push(a[i]);
        }
        else{
            pq.push(a[i]);
            pq.push(a[i]);
        }
    }
    cout<<cnt<<endl;

    return 0;
}

Measured memory_bytes: 6892
n,t=map(int,input().split())
s=[list(map(int,input().split())) for _ in range(n)]

dp=[[0]*(t) for i in range(n+1)]
s.sort()


for i in range(n):
    for j in range(t):
        if j-s[i][0]>=0:
            dp[i+1][j]=max(dp[i][j],dp[i][j-s[i][0]]+s[i][1])

        else:
            dp[i+1][j]=dp[i][j]

ans=0
for i in range(n):
    ans=max(ans,dp[i][t-1]+s[i][1])

print(ans)





         


        




Measured memory_bytes: 116568
#include <bits/stdc++.h>
#include <unordered_map>
// #include <unordered_set>
using namespace std;
class Pos {
  public:
    int y;
    int x;
    size_t hashed;
    Pos(int _y, int _x):
      y(_y),
      x(_x) {
      hashed = 0;
    }
    bool operator==(Pos right) const {
      return (y == right.y && x == right.x);
    }
    // bool operator<(Pos right) const {
    // }
};

namespace std {
  template <>
  struct hash<Pos> {
    size_t operator()(Pos const &pos) const {
      return pos.hashed;
    }
  };
}

int main() {
  int H, W;
  while(cin >> W >> H, W || H) {
    unordered_map<Pos, unordered_set<Pos> > loads;
    for(int h = 0; h < H; ++h) {
      for(int w = 0; w < W - 1; ++w) {
        bool isHrizWall;
        cin >> isHrizWall;
        if(!isHrizWall) {
          Pos a = Pos(h, w);
          Pos b = Pos(h, w + 1);
          loads[a].insert(b); 
          loads[b].insert(a);
        }
      }
      if(h < H - 1) for(int w = 0; w < W; ++w) {
        bool isVertWall;
        cin >> isVertWall;
        if(!isVertWall) {
          Pos a = Pos(h, w);
          Pos b = Pos(h + 1, w);
          loads[a].insert(b);
          loads[b].insert(a);
        }
      }
    }
    Pos goal = Pos(H - 1, W - 1);
    unordered_map<Pos, int> marked;
    queue<Pos> bfq;
    bfq.push(Pos(0, 0));
    marked[Pos(0, 0)] = 1;
    bool answered = false;
    while(!bfq.empty()) {
      Pos crtPos = bfq.front();
      bfq.pop();
      if(crtPos == goal) {
        answered = true;
        cout << marked[crtPos] << endl;
        break;
      }
      for(auto i = loads[crtPos].begin(); i != loads[crtPos].end(); ++i) {
        // cout << (*i).y << ',' << (*i).x << endl;
        if(marked.count(*i) == 0) {
          marked[*i] = marked[crtPos] + 1;
          bfq.push(*i);
        }
      }
    }
    if(!answered) cout << 0 << endl;
  // for(auto i = marked.begin(); i != marked.end(); ++i) {
  //   cout << (*i).first.y << ',' << (*i).first.x << ':' << (*i).second << endl;
  // }
  //
  // for(auto i = loads.begin(); i != loads.end(); ++i) {
  //   for(auto j = i->second.begin(); j != i->second.end(); ++j) {
  //     cout << i->first.y << ',' << i->first.x << ':' << j->y << ',' << j->x << ' ';
  //   }
  //   cout << endl;
  // }
  }
  return 0;
}

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

int main(){
  string s;
  cin >> s;
  
  int ans = 0;
  
  if (s.at(0) == 'A')
    ans++;
  
  int c = 0;
  for (int i=2 ; i<s.size()-1 ; i++){
    if (s.at(i) == 'C')
      c++;
  }
  if (c == 1)
    ans++;
  
  int upper = 0;
  for (int i=0 ; i<s.size() ; i++){
    if (isupper(s.at(i)))
      upper++;
  }
  if (upper == 2)
    ans++;
  
  if (ans == 3)
    cout << "AC" << endl;
  else
    cout << "WA" << endl;
}

Measured memory_bytes: 3628
#include "bits/stdc++.h"
using namespace std;

typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define REP(i, a, b) for(ll i = a; i < b; i++)
#define out(x) std::cout << x << '\n'
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define sz(x) ((int)(x).size())
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { ll g = gcd(a, b); return a / g * b; }
const int dx[4] = { 1, 0, -1,  0 };
const int dy[4] = { 0, 1,  0, -1 };
const int INF = INT_MAX / 2;
const ll  inf = LLONG_MAX / 2;
const int mod = 1000000007;
const int MAX_N = 101010;
const long double PI = acos(-1);

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

	int n;
	cin >> n;
	vector<int> b(1000001, 0);

	rep(i, n) {
		int a;
		cin >> a;
		b[a]++;
	}

	for (int i = 1; i < 1000001; i++) {
		if (b[i] > 0) {
			for (int j = 2 * i; j < 1000001; j += i) {
				b[j] = 0;
			}
		}
	}

	int ans = 0;
	for (int i = 1; i < 1000001; i++) {
		if (b[i] == 1) {
			ans++;
		}
	}

	out(ans);

	return 0;
}

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

int main(){
  int n; cin >> n;
  int M = 1e06 + 5;
  vector<int> a(n), cnt(M);  
  rep(i, n) cin >> a[i];
  
  for(int x : a){
    if(cnt[x]!=0){cnt[x]=2; continue;}
    for(int i = x; i < M; i += x) cnt[i]++;
  }
  
  int ans = 0;
  for(int x : a) if(cnt[x]==1) ans++;
      
  cout << ans << endl;
  return 0;
}


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

int main() {
    vector <int> abc(3, 0);
    cin >> abc.at(0) >> abc.at(1) >> abc.at(2);
    sort(abc.begin(), abc.end());
    long long ans=0;
    if ((abc.at(1)-abc.at(0))%2==0) {
        ans += (abc.at(1)-abc.at(0))/2; 
        ans += abc.at(2)-abc.at(1);
    }
    else {
        abc.at(0)++;
        abc.at(2)++;
        ans++;
        ans += (abc.at(1)-abc.at(0))/2; 
        ans += abc.at(2)-abc.at(1);
    }
    cout << ans;
}

Measured memory_bytes: 3520
using System;
using System.Collections.Generic;

namespace ABC106B
{
    class MainClass
    {
        public static void Main(string[] args)
        {

            // N M みたいな入力
            string[] input1 = Console.ReadLine().Split(' ');
            int N = int.Parse(input1[0]);


            List<int> M = new List<int>();
            int ans = 0;
            for (int i = 1; i <= N;i++){
                M.Add(0);
                for (int j = 1; j <= i;j++){
                    if(i % j ==0 && i%2==1){
                        M[i - 1]++;
                    }
                    if( M[i-1] == 8){
                        ans++;
                    }
                }
            }

            //出力
            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 13140
n, y = map(int, input().split())

for i in range(n+1):
    for j in range(n+1-i):
        if 10000*i + 5000*j + (n-i-j)*1000 == y:
            print(i,j,n-i-j)
            exit()
print(-1,-1,-1)    

Measured memory_bytes: 3060
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <cstring>
#include <map>
#include <set>
#include <algorithm>

using namespace std;

int main()
{
  int N, M, C;
  int B[21];
  cin >> N >> M >> C;
  for (int i=0;i<M;i++) {
    cin >> B[i];
  }
  int ans = 0;
  for (int i=0;i<N;i++) {
    int a;
    int val = C;
    for (int j=0;j<M;j++) {
      cin >> a;
      val += B[j]*a;
    }
    if (val > 0) ans++;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include<cstdio>

int gcd(int a, int b){
    if(a == b)
        return a;
    else if(a > b)
        a -= b;
    else if(a < b)
        b -= a;
    return gcd(a, b);
}

int lcm(int a, int b){

    return (a / gcd(a, b)) * (b / gcd(a, b)) * gcd(a, b);
}

int main(){
    int a, b;
    while(scanf("%d", &a) != EOF){
        scanf("%d", &b);
        printf("%d %d\n", gcd(a, b), lcm(a, b));
    }
    return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
typedef long long int uli;
uli f(uli a,uli b,uli c){
   if(c==0)return 0;
   if(c%a==0)return a*(c/a)*2ll;
   uli ans=a*(c/a)*2ll + a+c%a;
   ans+=f(c%a,a,a-c%a);
   return ans;
}
int main(){
   uli n,x;
   cin>>n>>x;
   uli ans=x+f(n-x,n,x);
   printf("%lld\n",ans);
   return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
int dp[3005][3005];
int main() {
	long long N,K;
	cin >> N >> K;
	vector<long long>A(N); 
	vector<long long>F(N);
	for (int n = 0;n<N;++n) {
		cin >> A[n];
	}
	for (int n = 0; n < N; ++n) {
		cin >> F[n];
	}  
	sort(A.begin(), A.end());
	sort(F.rbegin(), F.rend());
	long long l = -1;
	long long r = 1000000000000;
	//[l,r)
	while (l + 1 < r) {
		long long c = (l + r) / 2;
		long long tmp = 0;
		for (int n = 0; n < N; ++n) {
			tmp += max(0ll, A[n] - c / F[n]);
		}
		if (tmp > K) {
			l = c;
		}
		else {
			r = c;
		}
	}
	cout << r << endl;
	return 0;
}

Measured memory_bytes: 6348
#include <iostream>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>
#include <complex>
#include <functional>
#include <numeric>

// output
#define SPBR(w, n) std::cout<<(w + 1 == n ? '\n' : ' ');
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
// utility
#define ALL(i) (i).begin(), (i).end()
#define FOR(i, a, n) for(int i=(a);i<(n);++i)
#define RFOR(i, a, n) for(int i=(n)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<int(n);++i)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define IN(a, x, b) (a<=x && x<b)
#define OUT(a, x, b) (x<a || b<=x)
template<class T> inline T chmax(T & a, const T b) { return a = (a < b) ? b : a; }
template<class T> inline T chmin(T& a, const T b) { return a = (a > b) ? b : a; }

// type/const
#define int ll
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const int MOD = 1000000007;
/* const int MOD = 998244353; */
const int INF = 1e18;
const double PI = acos(-1);

using namespace std;

int H, W; 
vector<string> s(100);
vector<vector<bool>> visited(50, vector<bool>(50, false));

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

int dfs(int x, int y){
  int ret = 1;
  visited[x][y] = true;
  REP(i, 4){
    int xx = x+dx[i];
    int yy = y+dy[i];
    if(OUT(0, xx, H)) continue;
    if(OUT(0, yy, W)) continue;
    if(visited[xx][yy]) continue;
    if(s[xx][yy] == '.') continue;
    ret += dfs(xx, yy);
  }
  return ret;
}
signed main() {
  cin >> H >> W;

  REP(i, H) cin >> s[i];

  bool ans = true;
  REP(i, H) REP(j, W){
    if(visited[i][j]) continue;
    if(s[i][j] == '.') continue;
    if(dfs(i, j) < 2) ans = false;
  }

  ans? Yes: No;

  return 0;
}

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

#define rep(i,n) for(ll i = 0; i < n; i++)
#define per(i,n) for(ll i = n-1; i >= 0; i--)
#define REP(i,n) for(ll i = 1; i < n; i++)
#define PER(i,n) for(ll i = n; i >= 1; i--)
#define sz(x) int(x.size())
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define YesorNo(a) printf(a ? "Yes\n" : "No\n")
#define endl '\n'
#define fi first
#define se second
using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
using vi = vector<int>;
using vii = vector<vi>;
using vl = vector<ll>;
using vll = vector<vl>;
using vs = vector<string>;
using vb = vector<bool>;
using vc = vector<char>;
using vcc = vector<vc>;
using vP = vector<P>;
using vPP = vector<vP>;
using vPl = vector<Pl>;
const int dx[] = {0,1,0,-1,1,1,-1,-1};
const int dy[] = {1,0,-1,0,1,-1,-1,1};
const int inf = (1<<30)-1;
const ll infll = (1LL<<62)-1;
ll ceil(const ll &a, const ll &b){return ((a)+(b)-1)/b;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }


struct UnionFind { // UnionFindTree
  vector<int> d;
  UnionFind(int n): d(n,-1) {}
  int find(int x) {
    if(d[x] < 0) return x;
    return d[x] = find(d[x]);
  }
  bool unite(int x, int y) {
    x = find(x);
    y = find(y);
    if(x == y) return false;
    if(-d[x] < -d[y]) swap(x,y);
    d[x] += d[y];
    d[y] = x;
    return true;
  }
  bool same(int x, int y) { return find(x) == find(y); }
  long long size(int x) { return -d[find(x)]; }
};


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

  ll n, m;
  cin >> n >> m;
  vector<P> e(m);
  rep(i,m) {
    int a, b;
    cin >> a >> b;
    a--; b--;
    e[i] = make_pair(a,b);
  }
  vl ans(m);
  ans[m-1] = n*(n-1)/2;
  UnionFind uf(n);
  for(int i = m-2; i >= 0; i--) {
    int a = e[i+1].fi;
    int b = e[i+1].se;
    ans[i] = ans[i+1];
    if(uf.find(a) == uf.find(b)) continue;
    ans[i] -= uf.size(a) * uf.size(b);
    uf.unite(a,b);
  }
  rep(i,m) cout << ans[i] << endl;
}

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

// #define int long long
#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) int(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vs = vector<string>;
using vpll = vector<pair<ll, ll>>;
using vtp = vector<tuple<ll,ll,ll>>;
using vb = vector<bool>;

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

const ll INF = 1e15;
const int MOD = 1e9+7;
const ll LINF = 1e18;


ll n,k;
vll G[100005];
ll dist[100005];

signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  cin>>n>>k;
  rep(i,n-1){
    ll a,b; cin>>a>>b; a--,b--;
    G[a].push_back(b);
    G[b].push_back(a);
  }
  queue<pll> q;
  q.emplace(0,0);
  vb visited(n);
  dist[0]=k;
  
  while(!q.empty()){
    auto p=q.front(); q.pop();
    ll v=p.first, c=p.second;
    visited[v]=true;
    
    ll color;
    if(c==0) color=k;
    else color=k-1;
    
    for(auto nv: G[v]){
      if(visited[nv]) continue;
      dist[nv]=--color;
      q.emplace(nv,c+1);
    }
  }
  
  ll ans=1;
  rep(i,n){
    ans*=dist[i];
    ans%=MOD;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 8948
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<cstdio>
#include<cstring>
#include<cmath>
using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(n) rep(i,n)
string s;
#define maxn 200010
int int_sort( const void * a , const void * b ) {
  if( *( int * )a < *( int * )b ) {
    return -1;
  }
  else
  if( *( int * )a == *( int * )b ) {
    return 0;
  }
  return 1;
}


int main()
{
	int n, x[maxn] = {}, y[maxn] = {};
	cin >> n;
	REP(n)
	{
		cin >> x[i];
		y[i] = x[i];	
	}
	qsort((void*)y, n, sizeof(y[0]), int_sort);

	REP(n)
	{
		if(x[i] <= y[n / 2 - 1]){ cout <<y[n / 2] << endl;}
		else {cout << y[n / 2 - 1] << endl;}
	}

    return 0;
}


Measured memory_bytes: 3820
#include <stdio.h>
#define SWAP(type,a,b) { type temp = a; a = b; b = temp; }
#define N 36

typedef struct element{
  char mark;
  int num;
}card;
 

int main(){
  int i, j, n, minj, judge=0;
  card ca[N], cb[N];
  char s;

  scanf("%d%c",&n,&s);
  for(i=0;i<n;i++){
    scanf("%c%d%c",&ca[i].mark,&ca[i].num,&s);
    cb[i] = ca[i];
  }

  for(i=0;i<n-1;i++){
    for(j=n-1;j>i;j--){
      if(ca[j].num < ca[j-1].num){
	SWAP(card,ca[j],ca[j-1]);
      }
    }
  }


  for(i=0;i<n;i++){
    minj = i;
    for(j=i;j<n;j++){
      if(cb[minj].num > cb[j].num){
	minj = j;
      }
    }
    SWAP(card,cb[minj],cb[i]);
  }

  for(i=0;i<n;i++){
    if(i==n-1) printf("%c%d\n",ca[i].mark,ca[i].num);
    else printf("%c%d ",ca[i].mark,ca[i].num);
  }

  
  printf("Stable\n");

  
  for(i=0;i<n;i++){
    if(i==n-1) printf("%c%d\n",cb[i].mark,cb[i].num);
    else printf("%c%d ",cb[i].mark,cb[i].num);
  }


  
  for(i=0;i<n;i++){
    if(ca[i].mark != cb[i].mark) judge=1;
  }
  if(judge==1) printf("Not stable\n");
  else printf("Stable\n");


  
  return 0;
}



Measured memory_bytes: 2088
#include <iostream>
#include <cstring>
#include <cstdio>
#include <queue>
using namespace std;
int d[4][2]={{-1,0},{1,0},{0,-1},{0,1}};
int h,w;
struct pos
{
    int r;
    int x,y,d,N;
    char s[50],mp[15][15];
};
queue<pos>q;
int getdirection(char s)
{
    if(s=='U') return 1;
    if(s=='D') return 0;
    if(s=='R') return 2;
    if(s=='L') return 3;
}
bool isin(int x,int y)
{
    if(x<0||x>=h) return false;
    if(y<0||y>=w) return false;
    return true;
}
char getmove(int sx,int sy,int ex,int ey)
{
    if(sx==ex)
    {
        if(sy<ey) return 'R';
        if(sy>ey) return 'L';

    }
    else
    {
        if(sx<ex) return 'D';
        if(sx>ex) return 'U';
    }
}
void bfs()
{
    bool f=false;
    while(!q.empty()&&f==false)
    {
        struct pos t=q.front();q.pop();
        for(int i=0;i<4;i++)
        {
            if(i==t.d) continue;
            struct pos tp=t;
            bool ok=false;
            int dx=tp.x+d[i][0],dy=tp.y+d[i][1];
            while(isin(dx,dy))
            {
                if(tp.mp[dx][dy]=='o')
                {
                    ok=true;
                    break;
                }
                dx+=d[i][0],dy+=d[i][1];
            }
            if(ok)
            {
                tp.r=t.r-1;
                tp.mp[dx][dy]='.';
                tp.s[tp.N++]=getmove(t.x,t.y,dx,dy);
                tp.x=dx;tp.y=dy;
                tp.d=getdirection(tp.s[tp.N-1]);
                q.push(tp);
            }
        }
        if(t.r==0)
        {
            f=true;
            for(int i=0;i<t.N;i++) printf("%c",t.s[i]);
            printf("\n");
        }
    }
}
int main()
{
    scanf("%d%d",&h,&w);getchar();
    struct pos t;
    for(int i=0;i<h;i++) gets(t.mp[i]);
    t.N=t.r=0;
    for(int i=0;i<h;i++)
        for(int j=0;j<w;j++)
        {
            if(t.mp[i][j]=='o') t.r++;
            if(t.mp[i][j]!='.'&&t.mp[i][j]!='o')
            {
                t.d=getdirection(t.mp[i][j]);
                t.x=i;t.y=j;
            }
        }
    t.mp[t.x][t.y]='.';
    while(!q.empty())q.pop();
    q.push(t);
    bfs();
    return 0;
}

Measured memory_bytes: 2588
#include <bits/stdc++.h> 
using namespace std;
#define rep(i, N) for(int i=0; i<N; i++)
typedef long long ll;
#define dump(x) cerr<<#x<<"="<<x<<endl
using P = pair<int, int>;

int main() {
    vector<vector<P>> a(3);
    rep(i, 3) rep(j, 3) {
        int x; cin >> x;
        a.at(i).push_back(make_pair(x,0));
    }

    int n; cin >> n;
    rep(i, n){
        int b; cin >> b;
        rep(j, 3) rep(k, 3){
            if(a.at(j).at(k).first==b){
                a.at(j).at(k).second=1;
            }
        } 
    }

    rep(i, 3){
        if(a.at(0).at(i).second!=1)  break; 
        if(i==2) {
            cout << "Yes" << endl;
            return 0;
        }
    }
    
    rep(i, 3){
        if(a.at(1).at(i).second!=1)  break; 
        if(i==2) {
            cout << "Yes" << endl;
            return 0;
        }
    }
    
    rep(i, 3){
        if(a.at(2).at(i).second!=1)  break; 
        if(i==2) {
            cout << "Yes" << endl;
            return 0;
        }
    }
    
    rep(i, 3){
        if(a.at(i).at(0).second!=1)  break; 
        if(i==2) {
            cout << "Yes" << endl;
            return 0;
        }
    }

    rep(i, 3){
        if(a.at(i).at(1).second!=1)  break; 
        if(i==2) {
            cout << "Yes" << endl;
            return 0;
        }
    }

    rep(i, 3){
        if(a.at(i).at(2).second!=1)  break; 
        if(i==2) {
            cout << "Yes" << endl;
            return 0;
        }
    }

    if(a.at(0).at(0).second==1 && a.at(1).at(1).second==1 && a.at(2).at(2).second==1){
        cout << "Yes" << endl;
        return 0;
    }

    if(a.at(2).at(0).second==1 && a.at(1).at(1).second==1 && a.at(0).at(2).second==1){
        cout << "Yes" << endl;
        return 0;
    }


    cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
n = input()
A = [int(raw_input()) for i in xrange(n)]
ans = 0
for i in xrange(n):
    if A[i] > 1:
        pair = A[i]/2
        ans += pair
        A[i] -= pair*2
    if i<n-1 and A[i] > 0 and A[i+1] > 1:
        A[i] -= 1
        A[i+1] -= 1
        ans += 1
print ans


Measured memory_bytes: 5764
#include<bits/stdc++.h>
using namespace std;
const long long MOD = 1e9+7;
#define rep(i,n) for(int i=0;i<n;++i)
typedef long long int ll;
typedef unsigned long long ull;
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
typedef pair<ll,ll> P;


int main()
{
    int x,y;
    cin >> x >> y;
    if(y%2==1){
        cout<<"No"<<endl;
        return 0;
    }
    int a=y/2;
    for(int i=0;i<=a;i++){
        int kame=2*i;
        if((y-kame)%4!=0)continue;
        int turu=(y-kame)/4;
        if(i+turu==x)
        {
            cout<<"Yes"<<endl;
            return 0;
        }
    
    }
    cout<<"No"<<endl;
    return 0;

}


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

int main(){
    int A, B, max;
    cin >> A >> B;
    int wa = A + B;
    int sa = A - B;
    int seki = A * B;

    max = wa;
    if(max < sa){
        max = sa;
    }
    if(max < seki){
        max = seki;
    }

    cout << max << endl;
    
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
int main(){
  char x[8]={0};
  int a, b, n;
  while(scanf("%d %d",&a,&b) != EOF){
    a+=b;
    sprintf(x,"%d",a);
    n=strlen(x);
    printf("%d\n",n);
  }
  return 0;
}

Measured memory_bytes: 612
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define ALL(a) (a).begin(), (a).end()
const ll mod = 1e9 + 7;

int main()
{
    ll n, k;
    cin >> n >> k;
    ll ans = 0;
    if (k == 0)
    {
        cout << n * n << endl;
        return 0;
    }
    for (int i = 1; i <= n; i++)
    { //bを固定
        ans += max(0ll, i - k) * (n / i);
        ans += max(0ll, n % i - k + 1);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	string b;
	cin>>b;
	if(b[0]=='A')
		cout<<"T";
	if(b[0]=='C')
		cout<<"G";
	if(b[0]=='T')
		cout<<"A";
	if(b[0]=='G')
		cout<<"C";
}

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

#define int long long

using namespace std;

const int N = 1e5+2;

int t, n, m, k, L, R, d;

int32_t main()
{
    cin>>n;
    vector<int> a(n);
    int cnt = 0;
    for(int &x:a)
        cin>>x;
    for(int i = 0; i<n; i+=2)
        if(a[i]%2)
            cnt++;
    cout<<cnt<<endl;
}


Measured memory_bytes: 3596
def resolve():
	n, k = map(int, input().split())
	h = list(map(int, input().split()))
	dp = [float('inf')]*n
	dp[0], dp[1] = 0, abs(h[0] - h[1])
	for i in range(2, n):
		s = []
		for j in range(1, k+1):
			if i-j >= 0:
				s.append(dp[i-j] + abs(h[i-j] - h[i]))
		dp[i] = min(s)
	print(dp[-1])
resolve()

Measured memory_bytes: 55008
#include <bits/stdc++.h>
#define pb push_back
#define vii vector<int>
#define task "COLORING"
#define pll pair<ll, ll>
#define pii pair< ll, pair< ll, ll > >
#define fi first
#define se second

using ll = long long;
using ld = long double;
using ull = unsigned long long;
const int mod = 1e9 + 7;
using namespace std;
const int N =  3e5 + 5;
ll m, n, k, t, ans, T, a[N];
pll b[N];
string s;
inline void sol()
{
	cin >> n;
	for(int i = 1; i <= n; i ++)
    {
        cin >> s;
        if(s == "AC")++m;
        else if(s == "WA")++k;
        else if(s == "TLE")++t;
        else ++ T;
    }
    cout << "AC x " << m<<'\n';
    cout << "WA x " << k<<'\n';
    cout << "TLE x " << t<<'\n';
    cout << "RE x " << T<<'\n';
}
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    if(fopen(task".INP", "r"))
    {
		freopen(task".INP","r",stdin);
		freopen(task".OUT","w",stdout);
    }
    sol();

}


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

int main() {
  int r, D, x;
  cin >> r >> D >> x;
  rep(i, 10) {
    x = r * x - D;
    cout << x << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <stdio.h>
#include <stdlib.h>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <string.h>
#include <stack>
#include <assert.h>
#include <bitset>
#define Endl endl
#define mp make_pair
#define ll long long 
#define ull unsigned long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define over(A) {cout<<A<<endl;exit(0);}
#define all(A) A.begin(),A.end()
#define ceil(a,b) ((a-1)/b+1)
#define quickcin ios_base::sync_with_stdio(false);
const int mod=1e9+7;
const int inf=1039074182;
const ll llinf=1LL*inf*inf;
using namespace std;
template <typename T1,typename T2> inline void chmin(T1 &x,T2 b) {if(b<x) x=b;}
template <typename T1,typename T2> inline void chmax(T1 &x,T2 b) {if(b>x) x=b;}
template <typename T1,typename T2> inline void chadd(T1 &x,T2 b) {x+=b;if(x>=mod) x-=mod;}
template <typename T1,typename T2> inline void chmul(T1 &x,T2 b) {x=1LL*x*b%mod;}
template <typename T1,typename T2> inline void chmod(T1 &x,T2 b) {x%=b,x+=b;if(x>=b) x-=b;}
int dp[3005][3005][2];
int n,m;

int main()
{
//	freopen("input.txt","r",stdin);
	cin>>n>>m;
	for(int a=0;a<=n;a++)
	{
		if(0-(a+1-n)>=0 && 0-(a+1-n)<=n-1) dp[0][0-(a+1-n)][(0-(a+1-n))==0]++;
		if(1-(a+1-n)>=0 && 1-(a+1-n)<=n-1) dp[0][1-(a+1-n)][(1-(a+1-n))==0]++;
	}
	m--;
	for(int i=0;i<m;i++)
	{
		for(int j=0;j<=n-1;j++)
		{
			for(int k=0;k<2;k++)
			{
				if(j==0 && k==0) assert(dp[i][j][k]==0);
				if(j) chadd(dp[i+1][j-1][k | (j-1==0)],dp[i][j][k]);
				chadd(dp[i+1][j][k],2*dp[i][j][k]%mod);
				chadd(dp[i+1][j+1][k],dp[i][j][k]);
			}
		}
	}
	int res=0;
	for(int i=0;i<=n-1;i++)
	{
		chadd(res,dp[m][i][1]);
	}
	cout<<res*2%mod<<endl;
	return 0;
}

Measured memory_bytes: 73860
package main

import (
	"fmt"
	"os"
	"bufio"

)

func Abs(x int) int {
	if x < 0 {
		return -1 * x
	}
	return x
}

func main(){
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var k, n int
	fmt.Fscanf(in, "%d %d\n", &k, &n)

	a := make([]int, n)

	for i := 0 ; i < n ; i ++ {
		fmt.Fscanf(in, "%d", &a[i])
	}
	fmt.Fscanf(in, "\n")

	a = append(a, k + a[0])

	maxi := 0
	for i := 0 ; i < n ; i ++ {
		if Abs(a[i + 1] - a[i]) > maxi {
			maxi = Abs(a[i + 1] - a[i])
		}
	}
	fmt.Println(k - maxi)
}


Measured memory_bytes: 5888
#include <bits/stdc++.h>
using namespace std;
//#include <boost/multiprecision/cpp_int.hpp>
//using multiInt = boost::multiprecision::cpp_int;

using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
template <typename Q_type>
using smaller_queue = priority_queue<Q_type, vector<Q_type>, greater<Q_type>>;

const int MOD_TYPE = 1;
const ll MOD = (MOD_TYPE == 1 ? (ll)(1e9 + 7) : 998244353);
const int INF = (int)1e9;
const ll LINF = (ll)4e18;
const double PI = acos(-1.0);

#define REP(i, m, n) for (ll i = m; i < (ll)(n); ++i)
#define rep(i, n) REP(i, 0, n)
#define MP make_pair
#define MT make_tuple
#define YES(n) cout << ((n) ? "YES" : "NO") << endl
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << endl
#define possible(n) cout << ((n) ? "possible" : "impossible") << endl
#define Yay(n) cout << ((n) ? "Yay!" : ":(") << endl
#define all(v) v.begin(), v.end()
#define NP(v) next_permutation(all(v))
#define dbg(x) cerr << #x << ":" << x << endl;

vector<int> Dx = {0, 0, -1, 1, -1, 1, -1, 1, 0};
vector<int> Dy = {1, -1, 0, 0, -1, -1, 1, 1, 0};

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

  ll n;
  scanf("%d", &n);
  printf("%d:", n);
  for (ll p = 2; p * p <= n; p++)
  {
    while (n % p == 0)
    {
      printf(" %d", p);
      n /= p;
    }
  }
  if (n != 1)
    printf(" %d", n);
  printf("\n");
  return 0;
}



Measured memory_bytes: 3264
A,B = map(int,input().split())

x = 0
while True:
    if (x*2) // 25 == A and x//10 == B:
        print(x)
        exit()
    if (x*2) // 25 > A and x//10 > B:
        print(-1)
        exit()
    
    x += 1

Measured memory_bytes: 3060
#include<cstdio>
#include<iostream>
#define f(i,a,b) for(register int i=(a);i<=(b);i=-(~(i)))
int n;
long long ans;
int a[100010];
int main()
{
	scanf("%d",&n);
	f(i,1,n)scanf("%d",&a[i]);
	f(i,1,n)
	{
		ans+=a[i]/2;
		if((a[i]&1)&&i<n&&a[i+1]>0)++ans,--a[i+1];
	}return printf("%lld\n",ans),0;
}

Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <queue>

#define pb push_back
#define mp make_pair
#define contains(c, x) (c).find(x) != (c).end()
#define rep(i, n) for(int i = 0; i < n; ++i)

using namespace std;

int h, w;
vector<string> grid(21);
string pattern;
int g[21][21];

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

int p2i(int Time)
{
	switch (pattern[Time % pattern.size()] - '0') {
		case 5: return 0;
		case 8: return 2;
		case 6: return 4;
		case 4: return 1;
		case 2: return 3;
	}
}

int main()
{
	while (true) {
		cin >> h >> w; if (h == 0 && w == 0) break;
		rep(i, h) cin >> grid[i];
		cin >> pattern;
		
		pair<int, int> a, b;
		rep(i, h) rep(j, w)
			if (grid[i][j] == 'A') a = mp(i, j);
			else if (grid[i][j] == 'B') b = mp(i, j);

		rep(i, h) rep(j, w) g[i][j] = -1;
		queue<pair<int, int> > q;
		map<pair<int, int>, int> m;
		q.push(a);
		m[a] = 0;
		while (!q.empty()) {
			pair<int, int> t = q.front(); q.pop();
			g[t.first][t.second] = m[t];
			rep(i, 5) {
				int dr = t.first + dy[i];
				int dc = t.second + dx[i];
				pair<int, int> next = mp(dr, dc);
				if (dr < 0 || dr >= h || dc < 0 || dc >= w) continue;
				if (grid[dr][dc] == '#' || contains(m, next)) continue;
				q.push(next);
				m[next] = m[t] + 1;
			}
		}
		int T = 1;
		while (T < 10000) {
			rep(i, pattern.size()) {
				int k = p2i(T-1);
				int br = b.first + dy[k];
				int bc = b.second + dx[k];
				if (0 <= br && br < h && 0 <= bc && bc < w)
					b = mp(b.first + dy[k], b.second + dx[k]);
				br = b.first;
				bc = b.second;
				if (g[br][bc] >= 0 && g[br][bc] <= T) {
					cout << max(g[br][bc], T) << " " << br << " " << bc << endl;
					goto CONTINUE;
				}
				T++;
			}
		}
		cout << "impossible" << endl;
CONTINUE:;
	}
	return 0;
}

Measured memory_bytes: 0
#include<cstdio>
#include<algorithm>
using namespace std;

int gcd(int a, int b) {
  int m = max(a, b);
  int n = min(a, b);
  int tmp;

  do {
    tmp = n;
    n = m % n;
    m = tmp;
  } while (n != 0);

  return m;
}

int main() {
  int x, y;
  scanf("%d %d", &x, &y);
  printf("%d\n", gcd(x, y));

  return 0;
}



Measured memory_bytes: 2732