akhauriyash/Code-Regression huggingface dataset:
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<string>
#include<math.h>
#include<vector>
#include<queue>
#include<map>
#include<stack>
#include<fstream>
#include<stdlib.h>
#include<set>
#include<climits>
#include<cmath> 
#include<memory.h> 
#include<sstream>
#include<time.h>
using namespace std;
const long long BIGER=1000000000000000;
const int BIG=1000000000;
const int MOD=1000000007;
vector<char>vt;
int g1=0,g2=0,g3=0;
bool ypa(int k)
{
	if(g1==0&&g2==0&&g3==0)
	{
		return true;
	}
	if(k>2)
	{
		if(g1>0&&vt[k-2]!='a'&&vt[k-3]!='a')
		{
			vt.push_back('a');
			g1--;
			if(ypa(k+1))
			{
				return true;
			}
			vt.pop_back();
			g1++;
		}
		if(g2>0&&vt[k-2]!='b'&&vt[k-3]!='b')
		{
			vt.push_back('b');
			g2--;
			if(ypa(k+1))
			{
				return true;
			}
			vt.pop_back();
			g2++;
		}
		if(g3>0&&vt[k-2]!='c'&&vt[k-3]!='c')
		{
			vt.push_back('c');
			g3--;
			if(ypa(k+1))
			{
				return true;
			}
			vt.pop_back();
			g3++;
		}
	}
	else
	{
		if(g1>0&&vt[k-2]!='a')
		{
			vt.push_back('a');
			g1--;
			if(ypa(k+1))
			{
				return true;
			}
			vt.pop_back();
			g1++;
		}
		if(g2>0&&vt[k-2]!='b')
		{
			vt.push_back('b');
			g2--;
			if(ypa(k+1))
			{
				return true;
			}
			vt.pop_back();
			g2++;
		}
		if(g3>0&&vt[k-2]!='c')
		{
			vt.push_back('c');
			g3--;
			if(ypa(k+1))
			{
				return true;
			}
			vt.pop_back();
			g3++;
		}
	}
	return false;
}
int main()
{
    string st;
    cin>>st;
	for(int i=0;i<st.size();i++)
	{
		if(st[i]=='a')g1++;
		if(st[i]=='b')g2++;
		if(st[i]=='c')g3++;
	}
	if(g1>0)
	{
		vt.push_back('a');
		g1--;
		if(ypa(2))
		{
			cout<<"YES";
			return 0;
		}
		vt.pop_back();
		g1++;
	}
	if(g2>0)
	{
		vt.push_back('b');
		g2--;
		if(ypa(2))
		{
			cout<<"YES";
			return 0;
		}
		vt.pop_back();
		g2++;
	}
	if(g3>0)
	{
		vt.push_back('c');
		g3--;
		if(ypa(2))
		{
			cout<<"YES";
			return 0;
		}
		vt.pop_back();
		g3++;
	}
	cout<<"NO";
    return 0;
}

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

int main(){
	int c[5];
	int i, n, s;
	while(~scanf("%d,%d,%d,%d,%d", &c[0], &c[1], &c[2], &c[3], &c[4])){
		sort(c, c+5);
		n = 0;
		s = 0;
		for (i = 0; i < 4; i++) {
			if(c[i] == c[i+1]){
				n++;
			}
			if(c[i]+1 == c[i+1]){
				s++;
			}
		}
		if (n == 3 && c[1] == c[3]) {
			cout << "four card" << endl;
		}else if (n == 3) {
			cout << "full house" << endl;
		}else if (s == 4 || (s==3 && c[0] == 1 && c[1]==10 && c[4]==13)) {
			cout << "straight" << endl;
		}else if (n == 2 && (c[0]==c[2] || c[1]==c[3] || c[2]==c[4])) {
			cout << "three card" << endl;
		}else if (n == 2) {
			cout << "two pair" << endl;
		}else if(n ==1){
			cout << "one pair" << endl;
		}else{
			cout << "null" << endl;
		}
	}
	return 0;
}

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

using namespace std;

#define f0r(a, b) for (long long a = 0; a < b; a++)
#define f1r(a, b, c) for (long long a = b; a < c; a++)
#define f0rd(a, b) for (long long a = b; a >= 0; a--)
#define f1rd(a, b, c) for (long long a = b; a >= c; a--)
#define ms(arr, v) memset(arr, v, sizeof(arr))
#define mp(a, b) make_pair(a, b)
#define pb push_back
#define f first
#define s second

#define ao(a, n) {for (int ele = 0; ele < n; ele++) { if (ele) cout << " "; cout << a[ele]; } cout << endl;}

typedef long long ll;
typedef double ld;
typedef long double lld;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pii> vpi;
typedef vector<pll> vpl;

const ll inf = 1e12;
const ll mod = 1e9 + 7;

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

  string s;
  cin >> s;

  if (s == "SUN")
    cout << "7\n";
  else if (s == "MON")
    cout << "6\n";
  else if (s == "TUE")
    cout << "5\n";
  else if (s == "WED")
    cout << "4\n";
  else if (s == "THU")
    cout << "3\n";
  else if (s == "FRI")
    cout << "2\n";
  else
    cout << "1\n";
}

Measured memory_bytes: 3656
N, W = map(int, input().split())
value, weight = [0], [0]
for _ in range(N):
  v, w = map(int, input().split())
  value.append(v)
  weight.append(w)
dp = [[-1]*(W+1) for _ in range(N+1)]
dp[0][0] = 0

for i in range(1, N+1):
  for j in range(W+1):
    if 0 <= j-weight[i]:
      dp[i][j] = max(dp[i-1][j-weight[i]]+value[i], dp[i][j-weight[i]]+value[i])
    dp[i][j] = max(dp[i][j], dp[i-1][j])

print(max(dp[N]))


Measured memory_bytes: 41896
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <tuple>
#include <stack>
#include <bitset>
#include <utility>
#include<iomanip>
// #include <numeric>
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 INT_MAX 2147483647
#define LLONG_MAX 9223372036854775807
#define vmax(vec) *max_element(vec.begin(), vec.end())
#define vmin(vec) *min_element(vec.begin(), vec.end())
#define vsort(vec) sort(vec.begin(), vec.end())
#define vsortgr(vec) sort(vec.begin(), vec.end(), greater<ll>())
#define DIVIDER 1000000007


//
// struct Node{
//   vint children;
//   ll index;
//   ll prop;
// };
// struct edge{ll to; ll cost;};



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

// ll X,Y,Z,K;
// ll pmax = 30000000000;
// vint A,B,C;




// struct UnionFind {
//     vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2
//
//     UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
//         for(int i = 0; i < N; i++) par[i] = i;
//     }
//
//     int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
//         if (par[x] == x) return x;
//         return par[x] = root(par[x]);
//     }
//
//     void unite(int x, int y) { // xとyの木を併合
//         int rx = root(x); //xの根をrx
//         int ry = root(y); //yの根をry
//         if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
//         par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
//     }
//
//     bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
//         int rx = root(x);
//         int ry = root(y);
//         return rx == ry;
//     }
// };
//
vint divisor(ll n){ // nの約数
  vint ret;
  for(ll i=1;i*i<=n;i++){
    if(n%i == 0){
      ret.pb(i);
      if(i*i!=n) ret.pb(n/i);
    }
  }
  vsort(ret);
  return ret;
}

ll my_pow(ll x,ll y){
  ll rtn=1;
  rep(i,y) rtn*=x;
  return rtn;
}

ll get_digit_in(ll n, ll i){ // i桁目の数字を得る。
  for(ll j=0;j<i-1;j++){
    n/=10;
  }
  return n%10;
}

ll get_digit(ll n){
  ll rtn=0;
  while(n>0){
    n/=10;
    rtn++;
  }
  return rtn;
}



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




  ll w,h,x,y;
  cin>>w>>h>>x>>y;

  double ans = w*h/2.0;
  cout<<ans<<" ";

  if(w%2==0 && h%2==0 && w/2==x && h/2==y){
    cout << 1 <<endl;
  }else{
    cout<< 0 << endl;
  }





}




//


Measured memory_bytes: 256
import math
a, b, x = map(float, input().split())
h = x / a ** 2
S = a * h
if S <= a * b / 2:
  c = 2 * S / b
  print(math.atan(b / c) / math.pi * 180)
else:
  c = 2 * (b - h)
  print(math.atan(c / a) / math.pi * 180)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define all(x) (x).begin(), (x).end()
using ll = long long;
using namespace std;
template <typename T> using vec = std::vector<T>;

int main() {
    string s;
    string t;
    cin >> s >> t;
    vec<vec<int>> dp(s.size() + 1, vec<int>(t.size() + 1, 0));
    for (int i = 1; i <= s.size(); ++i)
        for (int j = 1; j <= t.size(); ++j) {
            dp[i][j] = max({dp[i - 1][j - 1], dp[i][j - 1], dp[i - 1][j]});
            if (s[i - 1] == t[j - 1])
                dp[i][j] = max(dp[i][j], dp[i - 1][j - 1] + 1);
        }

    string ans = "";
    int i      = s.size();
    int j      = t.size();
    while (i >= 1 && j >= 1) {
        int a = dp[i - 1][j - 1];
        int b = dp[i][j - 1];
        int c = dp[i - 1][j];
        if (a == b && a == c && a == dp[i][j] -1) {
            ans = ans + s[i-1];
            --i, --j;
        } else if(a == b && a == c){
            --i,--j;
        } else if(b > c){
            --j;
        } else {
            --i;
        }
    }

    reverse(all(ans));
    cout << ans << '\n';
}


Measured memory_bytes: 38820
n = int(input())
i = 1

while i<=n:
    x = i
    if  x % 3 == 0:
        print(" ", end="")
        print(i, end="")
    else:
        while x:
            if  x % 10 == 3 :
                print(" ", end="")
                print(i, end="")
                break
            x = x//10
    i+=1
print()


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

#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef complex<double> point;
#define xx real()
#define yy imag()

#define REP(i, a, b) for(int i = (a); i < (int)(b); i++)
#define REPN(i, a, b) for(int i = (a); i <= (int)(b); i++)
#define FA(it, x) for(__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++)
#define SZ(x) (int)(x).size()
#define BE(x) (x).begin(), (x).end()
#define SORT(x) sort(BE(x))
#define _1 first
#define _2 second

#define x1 gray_cat_x1
#define y1 gray_cat_y1

template<class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }

#define file "I1"

const double EPS = 1e-9;
const double PI = acos(-1.);
const int INF = 1e9;
const ll MOD = 1e9 + 7;

const int MAXN = 1e3 + 5;

ll bin_pow(ll a, ll st){
	ll ans = 1ll;
	for(; st; st /= 2ll){
		if (st & 1){
			ans = (ans * a) % MOD;
		}
		a = (a * a) % MOD;
	}
	return ans;
}

ll get_inv(ll a){
	return bin_pow(a, MOD - 2);
}

ll c[MAXN][MAXN];
ll dp[MAXN];
ll inv[MAXN];
ll f[MAXN];
ll f_inv[MAXN];

void solve(){
	int n, A, B, C, D;
	scanf("%d%d%d%d%d", &n, &A, &B, &C, &D);
	f[0] = f_inv[0] = 1ll;
	REPN(i, 1, n){
		inv[i] = get_inv(i);
		f[i] = (f[i - 1] * i) % MOD;
		f_inv[i] = (f_inv[i - 1] * inv[i]) % MOD;
	}
	REPN(i, 0, n){
		c[i][0] = 1;
		REPN(j, 1, i){
			c[i][j] = (c[i - 1][j - 1] + c[i - 1][j]) % MOD;
		}
	}

	dp[0] = 1;
	REPN(k, A, B){
		for(int i = n - 1; i >= 0; i--){
			ll cnt = (f[(C - 1) * k] * f_inv[C - 1]) % MOD;
			cnt = (cnt * get_inv(bin_pow(f[k], C - 1))) % MOD;
			REPN(j, C, D){
				int ind = i + k * j;
				if (ind > n){
					break;
				}
				cnt = (cnt * c[k * j][k]) % MOD;
				cnt = (cnt * inv[j]) % MOD;
				
				ll tmp = (c[ind][i] * dp[i]) % MOD;
				tmp = (tmp * cnt) % MOD;
				dp[ind] = (dp[ind] + tmp) % MOD;
			}
		}
	}
	
	printf("%lld\n", dp[n]);
}   

int main(){

    //freopen(file".in", "r", stdin); freopen(file".out", "w", stdout);
    int t = 1;
    //cin >> t;
    while(t--){
        solve();    
    }
}


Measured memory_bytes: 7552
#import random

def putmx(lis,mx):
  ret=[]
  for (i,j) in zip(range(len(lis)),lis):
    if j==mx:
      ret.append(i)
  return ret
  

h,w,m=map(int,input().split())
hb=[0]*h
wb=[0]*w
bmb=[]
for i in range(h):
  bmb.append({-1})
for i in range(m):
  hh,ww=map(int,input().split())
  hh-=1
  ww-=1
  bmb[hh].add(ww)
  hb[hh]+=1
  wb[ww]+=1
mhb=max(hb)
mwb=max(wb)
hmx=putmx(hb,mhb)
wmx=set(putmx(wb,mwb))

#print(hb,wb,hmx,wmx)
fl=False
for i in hmx:
  if wmx|bmb[i]!=bmb[i]:
    print(mhb+mwb)
    break
else:
  print(mhb+mwb-1)

#print(hmx,wmx,bmb)


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

typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9 + 7;
using namespace std;

//ループマクロ
#define FOR(i , a , b)  for(int i = (a) ; i < (b) ; i++)
#define REP(i , n)      for(int i = 0 ; i < n ; i++)
#define REPR(i , n)     for(int i = n ; 0 <= i ; i--)

//入出力
#define SCOUT(x) cout << (x) << " "
#define VECCIN(x) for(auto& ele : (x) ) cin >> ele
#define CEVCOUT(x) for(auto& ele : (x) ) cout << ele << " "; cout << endl;

//その他
#define ALL(obj) (obj).begin() , (obj).end()
#define P pair<int , int>
#define V vector<int>
#define M map<int,int>
#define S set<int>
#define PQ priority_queue<int>
#define PQG priority_queue<int , V , greater<int>>

int main(void){

  int M1, D1, M2, D2;
  cin >> M1 >> D1 >> M2 >> D2;
  if(M1 + 1 == M2 && D2 == 1)
    cout << 1 << endl;
  else
    cout << 0 << endl;
  
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
#define ll long long
const int N = 1e5+507;
ll n,i,sum,q,b,c,a[N],f[N];
int main ()
{
    cin>>n;
    for (i=1;i<=n;++i)
        cin>>a[i],f[a[i]]++,sum+=a[i];
    cin>>q;
    for (i=1;i<=q;++i)
    {
        cin>>b>>c;
        sum-=f[b]*b;
        sum+=f[b]*c;
        f[c]+=f[b];
        f[b]=0;
        cout<<sum<<"\n";
    }
}



Measured memory_bytes: 5188
import java.util.Scanner;

public class Main {
	
		void main() {
			try(Scanner sc =new Scanner(System.in)) {
			for(;;) {
				int x =sc.nextInt();
				int y =sc.nextInt();
				if(x == 0 && y == 0) break;
				System.out.println(Math.min(x, y) + " "+Math.max(x,y));
			}
		}
	}
		
	public static void main(String[] args) {
		new Main().main();
	

	}

}



Measured memory_bytes: 35680
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using static MyIO;


public class C
{
	public static void Main()
	{
		int N = getInt();
		int[] num = new int[4];
		for(int i = 0; i < N; i++)
			num[getInt() % 4]++;
		if(num[1] + num[3] <= num[0])
		{
			Console.WriteLine("Yes");
		}
		else if((num[1] + num[3] == num[0] + 1) && (num[2] == 0))
		{
			Console.WriteLine("Yes");
		}
		else
		{
			Console.WriteLine("No");
		}
	}
}


public static class MyIO
{
	private static string[] args = null;
	private static int num = -1;
	private static int used = -1;

	private static string getArg()
	{
		if(used == num)
		{
			args = Console.ReadLine().Split(' ');
			num = args.Length;
			used = 0;
		}
		return args[used++];
	}

	public static int getInt(){ return int.Parse(getArg()); }
	public static long getLong(){ return long.Parse(getArg()); }
	public static double getDouble(){ return double.Parse(getArg()); }
	public static string getString(){ return getArg(); }
}


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

using namespace std;
using ll = long long;
// #define int ll
using PII = pair<ll, ll>;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()

template<typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template<typename T> bool IN(T a, T b, T x) { return a<=x&&x<b; }
template<typename T> T ceil(T a, T b) { return a/b + !!(a%b); }

template<typename T> vector<T> make_v(size_t a) { return vector<T>(a); }
template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts) {
    return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}
template<typename T,typename V> typename enable_if<is_class<T>::value==0>::type
fill_v(T &t, const V &v) { t=v; }
template<typename T,typename V> typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t, const V &v ) { for(auto &e:t) fill_v(e,v); }

template<class S,class T>
ostream &operator <<(ostream& out,const pair<S,T>& a) {
    out<<'('<<a.first<<','<<a.second<<')'; return out;
}
template<class T>
ostream &operator <<(ostream& out,const vector<T>& a){
    out<<'[';
    for(const T &i: a) out<<i<<',';
    out<<']';
    return out;
}
template<class T>
ostream &operator <<(ostream& out, const set<T>& a) {
    out<<'{';
    for(const T &i: a) out<<i<<',';
    out<<'}';
    return out;
}
template<class T, class S>
ostream &operator <<(ostream& out, const map<T,S>& a) {
    out<<'{';
    for(auto &i: a) out<<i<<',';
    out<<'}';
    return out;
}

int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0}; // DRUL
const int INF = 1<<30;
const ll LLINF = 1LL<<60;
const ll MOD = 1000000007;

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

    while(1) {
        ll n, m;
        cin >> n >> m;
        if(!n) break;
        vector<vector<ll>> g(n);
        REP(i, m) {
            ll a, b;
            cin >> a >> b;
            a--, b--;
            g[a].push_back(b);
            g[b].push_back(a);
        }

        vector<ll> col(n, -1);
        function<bool(ll,ll)> dfs = [&](ll v, ll c) {
            col[v] = c;
            for(auto to: g[v]) {
                if(col[to] == c) return false;
                if(col[to] == -1 && !dfs(to, !c)) return false;
            }
            return true;
        };

        bool flag = true;
        REP(i, n) {
            if(col[i] == -1) {
                if(!dfs(i, 0)) {
                    flag = false;
                }
            }
        }

        if(flag) {
            ll cnt0 = 0, cnt1 = 0;
            REP(i, n) {
                if(col[i] == 0) cnt0++;
                else cnt1++;
            }
            vector<ll> ans;
            if(cnt0%2 == 0) ans.push_back(cnt0/2);
            if(cnt1%2 == 0) ans.push_back(cnt1/2);
            sort(ALL(ans));
            ans.erase(unique(ALL(ans)), ans.end());
            cout << ans.size() << endl;
            for(auto i: ans) cout << i << endl;
        } else {
            cout << 0 << endl;
        }
    }


    return 0;
}



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

using namespace std;
typedef long long lint;

#define RPT(i, b, e) for (int i = ((int)b); i <= ((int)e); i++)
#define RPT0(i, n) RPT(i, 0, ((int)n) - 1)
#define RPT1(i, n) RPT(i, 1, (n))
#define EACH(it, v) for (const auto& it : v)
#define ALL(v) v.begin(), v.end()

void resolve()
{
    lint N;
    cin >> N;

    map<lint, lint> sb;
    while (N != 1) {
        lint M = N;
        for (lint i = 2; i <= sqrt(N); i++) {
            if (N % i == 0) {
                sb[i]++;
                N /= i;
                break;
            }
        }
        if (N == M) {
            sb[N]++;
            break;
        }
    }

    lint cnt = 0;
    for (auto it : sb) {
        lint X = it.second;
        lint i = 0;
        while (X > i) {
            cnt++;
            i++;
            X -= i;
        }
    }

    cout << cnt << endl;
}

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


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

int main()
{
    int n = 32;
    string s1,s2,s3;
    cin >> s1 >> s2 >> s3;
    s1[0] = toupper(s1[0]);
    s2[0] = toupper(s2[0]);
    s3[0] = toupper(s3[0]);

    cout << s1[0] << s2[0] << s3[0] << endl;
    return 0;
}

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

mt19937 mt(time(nullptr));
// uniform_int_distribution< int > rand_int(0, 10) // rand[0, 10] inclusive

int main(void)
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed;
  int a, b, c;
  cin >> a >> b >> c;
  swap(a, b);
  swap(a, c);
  cout << a << " " << b << " " << c << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int maxn=2e5+10;
map<char ,char>ma;
int main()
{
     char c;
     cin>>c;
   if(c=='A')
    cout<<'T';
   else if(c=='T')
    cout<<'A';
   else if(c=='G')
    cout<<'C';
   else
    cout<<'G';
   cout<<endl;

    return 0;
}


Measured memory_bytes: 256
// 2020-09-20 17:26:09
// clang-format off
#include <bits/stdc++.h>
#ifdef LOCAL
#include "lib/debug.hpp"
#else
#define debug(...) 1
#endif
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define rep(i, n) REP(i, 0, (n))
#define repc(i, n) REPC(i, 0, (n))
#define REP(i, n, m) for (int i = (int)(n); i < (int)(m); i++)
#define REPC(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define REPCM(i, n, m) for (int i = (int)(n); i >= (int)(m); i--)
using namespace std;
using ll = long long;
using ld = long double;
using pr = pair<ll, ll>;
using vll = vector<ll>;
using vpr = vector<pr>;
using P = pair<int, int>;
template<class T> inline bool chmin(T& a, const T& b) { if (a > b) { a = b; return true; } else return false; }
template<class T> inline bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; } else return false; }
// #include <atcoder/convolution>
// #include <atcoder/dsu>
// #include <atcoder/fenwicktree>
// #include <atcoder/lazysegtree>
// #include <atcoder/math>
// #include <atcoder/maxflow>
// #include <atcoder/mincostflow>
// #include <atcoder/modint>
#include <atcoder/scc>
// #include <atcoder/segtree>
// #include <atcoder/string>
// #include <atcoder/twosat>
// #include <atcoder/all>
using namespace atcoder;

// clang-format on
void answer() {
  int n, m;
  cin >> n >> m;
  scc_graph G(n);
  rep(i, m) {
    int a, b;
    cin >> a >> b;
    G.add_edge(a, b);
  }
  auto res = G.scc();
  cout << res.size() << '\n';
  for (auto& inner : res) {
    cout << inner.size();
    for (int a : inner) cout << ' ' << a;
    cout << '\n';
  }
}

int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  answer();
  return 0;
}

Measured memory_bytes: 40132
#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<set>
#include<string>
#include<map>
#include<string.h>
#include<complex>
#include<math.h>
#include<queue>
#include <functional>
#include<time.h>
#include <stack>
#include<iomanip>
using namespace std;
#define rep(i,a,n) for(int i=(a);i<(n);i++)
#define ll long long
#define llint long long int
#define reverse(v)  reverse(v.begin(), v.end());
#define Yes(ans) if(ans)cout<<"Yes"<<endl; else cout<<"No"<<endl;
#define YES(ans) if(ans)cout<<"YES"<<endl; else cout<<"NO"<<endl;
#define hei(a) vector<a>
#define whei(a) vector<vector<a>>
#define UF  UnionFind 
#define Pint pair<int,int>
#define keta(a)  fixed << setprecision(a)
constexpr auto INF = 100000000000;
constexpr auto mod = 1000000007;
//辞書順はnext_permutation( begin( v ), end( v ) );やで！
struct edge { int to, cost; };
int k(int s) {
	int x = 0;
	while (s) {
		x++;
		s /= 10;
	}
	return x;
}

int main() {
	int n, m;
	cin >> n >> m;
	vector<pair<pair<int, int>, int>> s(m);
	rep(i, 0, m) {
		cin >> s[i].first.first >> s[i].first.second;
		s[i].second = i;
		
	}
	hei(string) ans(m,"");
	sort(s.begin(), s.end());
	map<int, int> z;
	rep(i, 0, m) {
		z[s[i].first.first]++;
		rep(j, 0, 6 - k(s[i].first.first)) {
			ans[s[i].second] += "0";
		}
		ans[s[i].second] += to_string(s[i].first.first);
		rep(j, 0, 6 - k(z[s[i].first.first]))ans[s[i].second] += "0";
		ans[s[i].second] += to_string(z[s[i].first.first]);
	}
	rep(i, 0, m)cout << ans[i] << endl;
	return 0;
}

Measured memory_bytes: 12800
import java.util.HashSet;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int k = sc.nextInt();

		HashSet<Integer>set = new HashSet<>();
		for (int i=1; i<=n; i++){
			set.add(i);
		}

		for (int i=1; i<=k; i++){
			int d = sc.nextInt();

			for (int j=1; j<=d; j++){
				int a = sc.nextInt();
				set.remove(a);
			}
		}
		System.out.println(set.size());
	}


}

Measured memory_bytes: 46280
import java.util.*;
import java.io.PrintWriter;
import static java.lang.Integer.*;
import static java.lang.Long.*;
import static java.lang.Math.*;
import static java.lang.System.*;

public class Main {
	public static void main(String[] args) {
		int i=0,j=0,k=0;
		Scanner sc = new Scanner(in);
		int h = parseInt(sc.next());
		int w = parseInt(sc.next());
		int n = parseInt(sc.next());
		int[] a = new int[n];
		for(i=0;i<n;i++) {
			a[i] = parseInt(sc.next());
		}
		sc.close();
		int[][] c = new int[h][w];
		int p=0;
		for (i = 0; i < n; i++) {
			for (k = p; k < p+a[i]; k++) {
				c[k/w][(k/w)%2==0?k%w:w-k%w-1] = i+1;
			};
			p+=a[i];
		}
		PrintWriter pw = new PrintWriter(out);
		for (i = 0; i < h; i++) {
			for (j = 0; j < w; j++) {
				pw.print(c[i][j]);
				pw.print(" ");
			}
			pw.println();
		}
		pw.flush();
	}
}


Measured memory_bytes: 25580
X,K,D=map(int, input().split())
X=abs(X)
if X-K*D>0:
  print(X-K*D)
else:
  if K%2==0:
    s=X-2*D*int(X/(2*D))
    t=-(s-2*D)
    print(min(abs(s),t))
    
  else:
    s=X-2*D*int((X-D)/(2*D))-D
    t=-(s-2*D)
    
    print(min(abs(s),t))


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

bool pal(string str)
{
    int i=0,j=str.size()-1;
    
    
    while(i<j)
    {
        if(str[i]!=str[j])
        return false;
        
        i++;
        j--;
    }
    
    return true;
}
int main()
{
   ios::sync_with_stdio(false);
   cin.tie(0);
   cout.tie(0);
   
  string str;
  
  cin>>str;
  
  
  int f1=0,f2=0,f3=0;
  
   f1 = pal(str);
   
   f2 = pal(str.substr(0,(str.size()-1)/2));
   
   
   if(f1 && f2)
   cout<<"Yes"<<endl;
   else
   cout<<"No"<<endl;


   return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
#include <set>
#include <vector>
#include <map>
#include <list>
#include <stack>
#define REP(i, n) for(i=0; i<n; i++)
#define REPR(i, n) for(i=n; i>=0; i--)
#define FOR(i, m, n) for(i=m; i<n; i++)
#define max(a, b) ((a)>(b) ? (a):(b))
#define min(a, b) ((a)<(b) ? (a):(b))
#define INF 10000000000
#define MOD 1000000007LL
using namespace std;
typedef long long ll;
typedef pair<ll, ll> p;
typedef pair<double, double> doup;

int main(void) {
    ll a, b;
    cin >> a >> b;
    if(a&1 && b&1) cout << "Odd" << endl;
    else cout << "Even" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <math.h>
#define _GLIBCXX_DEBUG
#define _LIBCPP_DEBUG 0

using namespace std;
#define ll long long
#define rep(i,n) for (int i = 0; i < n; i++)
#define MOD (1000000007)
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int, int>
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()

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

int gcd(int a, int b) {
    if (b == 0) return a;
    else return gcd(b, a % b);
}

const ll INF = 1LL << 60;

int main(){
  int n; cin >> n;
  vector<string> S(n); rep(i, n) cin >> S[i];

  vvi G(n, vi(26));
  rep(i, n){
    for(char c : S[i]) G[i][c-'a']++;
  }

  vi C(26,100);
  rep(i, n){
    rep(c, 26) chmin(C[c], G[i][c]);
  }

  string ans;
  rep(c, 26){
    rep(i, C[c]) ans += (char)(c+'a');
  }
  std::cout << ans << '\n';
}


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

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

int main(void){
    int N,M;
    cin >> N >> M;
    cout << (N == M ? "Yes" : "No") << endl;
    return 0;
}

Measured memory_bytes: 256
import numpy as np
c=np.array([list(map(int,input().split())) for i in range(3)])
f=True
for i in range(2):
     d=c[i,0]-c[i+1,0]
     for j in range(2):
          if c[i,j+1]-c[i+1,j+1]!=d:
               f=False
for i in range(2):
     d=c[0,i]-c[0,i+1]
     for j in range(2):
          if c[j+1,i]-c[j+1,i+1]!=d:
               f=False
print('Yes' if f else 'No')

Measured memory_bytes: 18200
n,x = gets.chomp.split(" ").map(&:to_i)
a = gets.chomp.split(" ").map(&:to_i)
count = 0
if a[0] > x
  count += a[0]-x
  a[0] = x
end
for i in 1..n-1
  if a[i-1]+a[i] > x
    count += a[i-1]+a[i]-x
    a[i] = x-a[i-1]
  end
end
puts count

Measured memory_bytes: 10780
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
long long calc(long long x) {
  if (x % 2 == 1) {
    return (x + 1) / 2 % 2;
  } else {
    return (x + 2) / 2 % 2 ^ (x + 1);
  }
}
signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
  long long a, b;
  cin >> a >> b;
  cout << (calc(a - 1) ^ calc(b)) << endl;
	return 0;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS

//#define DEBUG
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>

int main() {
#ifdef DEBUG

#endif
	char C[2][4] = { '\0' };

	scanf("%s", C[0]);
	scanf("%s", C[1]);

	int i;
	for (i = 0; i < 3; i++)
	{
		if (C[0][i] != C[1][2 - i]) {
			printf("NO\n");
			return 0;
		}
	}
	printf("YES\n");
}

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

int main() {
	string x; cin >> x;
	int n = x.size();
	vector<char> st;
	REP(i, n) {
		if (x[i] == 'S')
			st.push_back('S');
		else {
			if (st.empty())
				st.push_back('T');
			else if (st.back() == 'S')
				st.pop_back();
			else if (st.back() == 'T')
				st.push_back('T');
		}
	}
	cout << st.size() << '\n';
	return 0;
}


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

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

int N,M,H,W;
int A[1024][1024];

int B[1024][1024];
void check() {
	int x,y;
	FOR(y,H) FOR(x,W) {
		B[y+1][x+1]=B[y][x+1]+B[y+1][x]-B[y][x]+A[y][x];
	}
	int ret=0,sum=0;
	int x1,x2,y1,y2;
	FOR(x2,W) FOR(x1,x2+1) FOR(y2,H) FOR(y1,y2+1) {
		int num=B[y2+1][x2+1]-B[y1][x2+1]-B[y2+1][x1]+B[y1][x1];
		if(num%2==1) ret++;
		sum++;
	}
	cout<<ret<<"/"<<sum<<endl;
}


void dfs(int y1,int y2,int x1,int x2) {
	int my=(y1+y2)/2;
	int mx=(x1+x2)/2;
	A[my][mx]=1;
	if(y1==y2&&x1==x2) return;
	if(y1==y2) {
		dfs(y1,y2,x1,mx-1);
		dfs(y1,y2,mx+1,x2);
	}
	else if(x1==x2) {
		dfs(y1,my-1,x1,x2);
		dfs(my+1,y2,x1,x2);
	}
	else {
		dfs(y1,my-1,x1,mx-1);
		dfs(y1,my-1,mx+1,x2);
		dfs(my+1,y2,x1,mx-1);
		dfs(my+1,y2,mx+1,x2);
	}
	
	
}

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>N>>M;
	H=(1<<N)-1;
	W=(1<<M)-1;
	
	//usleep(H*500);
	//usleep(W*100);
	
	dfs(0,H-1,0,W-1);
	//check();
	
	FOR(y,H) {
		FOR(x,W) cout<<A[y][x];
		cout<<endl;
	}
	
}


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


Measured memory_bytes: 5376
#include<bits/stdc++.h>
using namespace std;
int main(){
        long n,k;
        cin>>n>>k;
        int dc[10]={0};
        for(int i=0; i<k; i++){
                int t;
                cin>>t;
                dc[t]=1;
        }
        for(int i=n; i<=100000; i++){
                int t=i;
                bool ch=true;
                while(t!=0){
                        if(dc[t%10]==1){
                                ch=false;
                                break;
                        }
                        t/=10;
                }
                if(ch){
                        cout<<i;
                        return 0;
                }
        }
}

Measured memory_bytes: 256
macro_rules !input {(source =$s :expr ,$($r :tt ) *) =>{let mut iter =$s .split_whitespace () ;let mut next =||{iter .next () .unwrap () } ;input_inner !{next ,$($r ) *} } ;($($r :tt ) *) =>{let stdin =std ::io ::stdin () ;let mut bytes =std ::io ::Read ::bytes (std ::io ::BufReader ::new (stdin .lock () ) ) ;let mut next =move ||->String {bytes .by_ref () .map (|r |r .unwrap () as char ) .skip_while (|c |c .is_whitespace () ) .take_while (|c |!c .is_whitespace () ) .collect () } ;input_inner !{next ,$($r ) *} } ;}
macro_rules !input_inner {($next :expr ) =>{} ;($next :expr ,) =>{} ;($next :expr ,$var :ident :$t :tt $($r :tt ) *) =>{let $var =read_value !($next ,$t ) ;input_inner !{$next $($r ) *} } ;}
macro_rules !read_value {($next :expr ,($($t :tt ) ,*) ) =>{($(read_value !($next ,$t ) ) ,*) } ;($next :expr ,[$t :tt ;$len :expr ] ) =>{(0 ..$len ) .map (|_ |read_value !($next ,$t ) ) .collect ::<Vec <_ >>() } ;($next :expr ,chars ) =>{read_value !($next ,String ) .chars () .collect ::<Vec <char >>() } ;($next :expr ,usize1 ) =>{read_value !($next ,usize ) -1 } ;($next :expr ,$t :ty ) =>{$next () .parse ::<$t >() .expect ("Parse error" ) } ;}

fn main() {
   input! {
      n: usize,
      h: [usize; n],
      a: [usize; n],
   }
   let mut dp = vec![0; 200005];
   for i in 0..n {
      let c = dp.sum(h[i] - 1);
      dp.add(h[i], c + a[i]);
   }
   let ans = dp.sum(200000);
   println!("{}", ans);
}

use std::ops::{AddAssign, Sub};
trait BIT<T: Copy + Clone + Sub + AddAssign> {
   fn add(&mut self, idx: usize, w: T);
   fn sum(&self, idx: usize) -> T;
}

impl BIT<usize> for [usize] {
   /// let mut bit = vec![0; n+1];
   /// for (i, w) in 0..q {
   ///    bit.add(i, w);
   /// }
   fn add(&mut self, idx: usize, w: usize) {
      let mut j = (idx + 1) as i64;
      while j < self.len() as i64 {
         self[j as usize] = std::cmp::max(self[j as usize], w);
         j += j & -j;
      }
   }
   /// [0, r]
   fn sum(&self, idx: usize) -> usize {
      let mut i = (idx + 1) as i64;
      let mut sum = self[0];
      while i != 0 {
         sum = std::cmp::max(sum, self[i as usize]);
         i -= i & -i;
      }
      sum
   }
}


Measured memory_bytes: 10620
#include<iostream>
#include<string>
using namespace std;
int dp[3005][3005];
pair <int,int> dp2[3005][3005];
int main()
{
	string a,b,str="";
	cin >> a >> b;
	for(int i=0;i<a.size();i++) {
		for(int j=0;j<b.size();j++) {
			if(dp[i][j]==0) dp2[i][j]=make_pair(0,0);
			if(a[i]==b[j]) {
				if(i>0 && j>0) {
					if(dp[i-1][j-1]+1>dp[i][j]) {
						dp[i][j]=dp[i-1][j-1]+1;
						dp2[i][j]=make_pair(i-1,j-1);
						//if(i==a.size()-1 && j==b.size()-1) str+=a[a.size()-1];
					}
				}
				else {
					if(dp[i][j]<1) {
						dp[i][j]=1;
						dp2[i][j]=make_pair(0,0);
					}
				}
			}
			if(i>0 && dp[i-1][j]>dp[i][j]) {
				dp[i][j]=dp[i-1][j];
				dp2[i][j]=make_pair(i-1,j);
			}
			if(j>0 && dp[i][j-1]>dp[i][j]) {
				dp[i][j]=dp[i][j-1];
				dp2[i][j]=make_pair(i,j-1);
			}
			//cout <<i<<" "<<j<<" "<<dp[i][j]<<endl;
		}
	}
	pair <int,int> p=make_pair(a.size()-1,b.size()-1);
	//if(a[p.first]==b[p.second]) str+=a[p.first];
	//cout <<dp2[a.size()-1][b.size()-1].first<<" "<<dp2[a.size()-1][b.size()-1].second<<endl;
	//cout <<str<<endl;
	while(p.first>=0 && p.second>=0) {
         //cout <<p.first<<" "<<p.second<<endl;
         if(!(p.first==0 && p.second==0) && a[p.first]==b[p.second] && dp[p.first][p.second]!=dp[dp2[p.first][p.second].first][dp2[p.first][p.second].second]) str+=a[p.first];
         if(p.first==0 && p.second==0) {
              if(a[p.first]==b[p.second]) str+=a[p.first];
              break;
         }
         p=dp2[p.first][p.second];
    }
	//cout <<dp2[a.size()-1][b.size()-1].first<<" "<<dp2[a.size()-1][b.size()-1].second<<endl;
	for(int i=str.size()-1;i>=0;i--) cout <<str[i];
	//cout <<dp[a.size()-1][b.size()-1]<<endl<<dp2[a.size()-1][b.size()-1];
	return 0;
}


Measured memory_bytes: 105984
#include <iostream>
#include <vector>
#include <cstdlib>

using namespace std;

typedef long long LL;

#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))
#define ALL(a)  (a).begin(),(a).end()
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

#define dump(x)  cerr << #x << " = " << (x) << endl;



int main() {
  int N;
  cin >> N;
  vector<int> X(N), Y(N);
  int odd;
  REP(i, N) {
    cin >> X[i] >> Y[i];
  }

  int max_d = abs(X[0]) + abs(Y[0]);
  odd = abs(X[0]) + abs(Y[0]) & 1;
  FOR(i, 1, N) {
    if (((abs(X[i]) + abs(Y[i])) & 1) ^ odd) {
      cout << -1 << endl;
      return 0;
    }
    if (max_d < (abs(X[i]) + abs(Y[i]))) max_d = abs(X[i]) + abs(Y[i]);
  }

  int sum = 1, m = 1;
  
  for(m=1; m<31; ++m) {
    if (sum > max_d) break;
    sum *= 2;
  }
  sum = sum*2-1;
  cout << m + !odd << endl;
  int temp = 1;
  REP(i, m) {
    cout << temp << ' ';
    temp *= 2;
  }
  if (!odd) cout << 1;
  cout << endl;

  REP(i, N) {
    if (!odd) {
      X[i] -= 1;
    }
    int U = X[i] + Y[i], V = X[i] - Y[i];
    int U1 = (sum-U)/2, V1 = (sum-V)/2;
    REP(j, m) {
      int LD = U1 & 1;
      int LU = V1 & 1;
      
      if (LD & LU) cout << 'L';
      else if (LD & (~LU)) cout << 'D';
      else if ((~LD) & LU) cout << 'U';
      else cout << 'R';

      U1 >>= 1;
      V1 >>= 1;
    }
    if (!odd) cout << 'R';
    cout << endl;
  }

  return 0;
}

Measured memory_bytes: 256
x, y = map(int, input().split())
a = [1, 3, 5, 7, 8, 10, 12]
b = [4, 6, 9, 11]
c = [2]
if x in a and y in a or x in b and y in b or x==y==c:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3060
a,b,c=(int(x) for x in input().split())
count5=0
count7=0

for i in a,b,c:
    if i==5:
        count5+=1
    elif i==7:
        count7+=1

if count5==2 and count7==1:
    print("YES")
else:
    print("NO")

Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
#include <functional>
#include <vector>
#include <string>
#include <map>
#include <sstream>
#include <cmath>
#include <iomanip>
#include <stdexcept>
// #include <bits/stdc++.h>
#define ll long long
#define ld long double
#define req(i,h) for(int i = 0; i < h; i++)
#define req1(i,h) for(int i = 0; i <= h; i++)

using namespace std;


int main(void) {
    double n,a = 0, sum = 0.0;
    cin >> n;
    vector<vector<ld>> data(n, vector<ld>(2));
    req(i,n) {
        cin >>  data.at(i).at(0) >> data.at(i).at(1);
    }

    for (int i = 0; i < n; i++) {
        for(int j = 0; j < n; j++) {
            if(i >= j) {
                continue;
            }
            sum  += sqrt( ((data.at(i).at(0) - data.at(j).at(0)) * (data.at(i).at(0) - data.at(j).at(0)))
            + ((data.at(i).at(1) - data.at(j).at(1)) * (data.at(i).at(1) - data.at(j).at(1))));
        }
    }
   ld ans = (sum *2) / n;
    cout << fixed << setprecision(7) << ans;
}



Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
using namespace std;
int main() {
	string s;
	long long k;
	cin >> s;
	cin >> k;
	bool f=true;
	int c=0;
	int ans=1;
	while(f && c<s.length()){
		if (s[c]-'0'==1 && c==k-1){
			ans=1;
			f=false;
		}
		else if (s[c]-'0'!=1){
			ans=s[c]-'0';
			f=false;
		}
		else c++;
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 256
A = []
for i in range(3):
    A += list(map(int, input().split()))
N = int(input())
for i in range(N):
    b = int(input())
    if b in A:
        A = [0 if num == b else num for num in A]
bingo_check = [[0, 1, 2],
               [0, 3, 6],
               [0, 4, 8],
               [1, 4, 7],
               [2, 4, 6],
               [2, 5, 8],
               [3, 4, 5],
               [6, 7, 8]]
no_check = 1
for check in bingo_check:
    row = [A[i] for i in check]
    if not sum(row):
        print("Yes")
        no_check = 0
        break
if no_check:
    print("No")

Measured memory_bytes: 3064
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(ll i=0;i<(n);i++)
#define pll pair<ll,ll>
#define pq priority_queue
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define lb(c,x) distance(c.begin(),lower_bound(all(c),x))
#define ub(c,x) distance(c.begin(),upper_bound(all(c),x))

using namespace std;

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=1e18;

int main(){
    ll n;
    cin >> n;
    ll bi=(n-1)%2;
    deque<ll> de;
    rep(i,n){
        ll a;
        cin >> a;
        if(i%2==bi){
            de.push_front(a);
        }
        else{
            de.push_back(a);
        }
    }
    rep(i,n){
        ll v=de.front();
        de.pop_front();
        if(i) cout << " ";
        cout << v;
    }
    cout << endl;
    return 0;
} 

Measured memory_bytes: 5280
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdlib>
#include <cstring>
#include <cstdio>
#include <stack>
using namespace std;


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

    if (S == "Sunny") {
        weather = "Cloudy";
    } else if (S == "Cloudy") {
        weather = "Rainy";
    } else {
        weather = "Sunny";
    }
    cout << weather << endl;

    return 0;
}

Measured memory_bytes: 256
import math
import itertools

n = int(input())
xy = [list(map(int,input().split())) for _ in range(n)]
seq = [i for i in range(n)]
p = list(itertools.permutations(seq))
dist = 0
for i in p:
    for j in range(n-1):
        dist += math.sqrt((xy[i[j]][0] - xy[i[j+1]][0])**2 + (xy[i[j]][1] - xy[i[j+1]][1])**2)
print(dist/math.factorial(n))


Measured memory_bytes: 8052
#include <stdio.h>

int		main(void)
{
	char N[4];
	int i = 0;

	scanf("%s", N);
	while (N[i] && i < 3)
	{
		if (N[i] == '7')
		{
			printf("Yes\n");
			return (0);
		}
		i++;
	}
	printf("No\n");
	return (0);
}

Measured memory_bytes: 1644
#include <iostream>
#include <stdlib.h>
#include <vector> //vector
#include <cmath>

#define rep(i, n) for(int i=0; i<(int)(n);i++)
#define all(x) (x).begin(), (x).end()
#define debug(a) if(flagdebug){cout << "debug (" #a "):" << endl << (a) << endl;}

typedef uint64_t ulint;
typedef int64_t lint;

using namespace std;



lint a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z;

bool flagdebug = false;

int main(){
//////////////////////////////////////////////////////
    // flagdebug = true;

    cin >> a >> b;

    lint max = -10000000;

    if(max<a+b)max = a+b;
    if(max<a-b)max = a-b;
    if(max<a*b)max = a*b;


    cout <<  max    << endl;


//////////////////////////////////////////////////////
// Ctrl + Opt + N to make
    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <complex>
#include <cmath>
#include <vector>
#include <algorithm>
using namespace std;

#define EPS 1e-7

typedef complex<double> point;
typedef const point &rpoint;

double cross(rpoint va, rpoint vb){
	return real(va) * imag(vb) - imag(va) * real(vb);
}

double distance_l_p(rpoint a, rpoint b, rpoint c){
	return abs(cross(b - a, c - a)) / abs(b - a);
}

typedef pair<point,point> line;
vector<line> common_tangent(rpoint p1, double r1, point p2, double r2){
	vector<line> ret;

	p2 -= p1;
	double a = arg(p2);
	double b = (r1 - r2) / abs(p2);
	if( b < -1.0 || b > 1.0 ){ return ret; }
	double c = asin(b) - asin(1.0);
	ret.push_back( make_pair( p1 + polar(r1, a - c), p1 + p2 + polar(r2, a - c) ) );
	ret.push_back( make_pair( p1 + polar(r1, a + c), p1 + p2 + polar(r2, a + c) ) );

	b = (r1 + r2) / abs(p2);
	if( b < -1.0 || b > 1.0 ){ return ret; }
	c = asin(b) - asin(1.0);
	ret.push_back( make_pair( p1 + polar(r1, a - c), p1 + p2 - polar(r2, a - c) ) );
	ret.push_back( make_pair( p1 + polar(r1, a + c), p1 + p2 - polar(r2, a + c) ) );

	return ret;
}

int n;
point p[50];
double r[50];
double m[50];
int ans;


void check(rpoint p1, double r1, rpoint p2, double r2){
	vector<line> v = common_tangent(p1, r1, p2, r2);
	for(int i = 0; i < v.size(); ++i){
		int c = 0;

		for(int j = 0; j < n; ++j){
			double d = distance_l_p(v[i].first, v[i].second, p[j]);
			if( d > r[j] - EPS && d < m[j] + EPS ){
				++c;
			}
		}
		
		ans = max(ans, c);
	}
}

int main(){
	double x, y;
	
	while( scanf("%d", &n), n != 0 ){
		ans = 1;
		for(int i = 0; i < n; ++i){
			scanf("%lf%lf%lf%lf", &x, &y, &r[i], &m[i]);
			m[i] += r[i];
			p[i] = point(x, y);
		}
		
		for(int i = 1; i < n; ++i)
		for(int j = 0; j < i; ++j){
			check(p[i], r[i], p[j], r[j]);
			check(p[i], r[i], p[j], m[j]);
			check(p[i], m[i], p[j], r[j]);
			check(p[i], m[i], p[j], m[j]);
		}
		printf("%d\n", ans);
	}
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
using P = pair<ll, ll>;
using V = vector<ll>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep1(i, n) for(ll i=1;i<=(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
#define ALL(obj) (obj).begin(), (obj).end()
#define MOD 1000000007
#define INF 1000000000

int a[301][301] = { {0} };
vector<ll> s[90001];
P m[90001] = { P(0 ,0) };

void solve_abc089() {
	ll h, w, d, q;
	ll ans = 0;

	cin >> h >> w >> d;

	rep(i, h) {
		rep(j, w) {
			cin >> a[i][j];
			m[a[i][j]] = make_pair(i, j);
		}
	}

	// i: dで割った余り
	P prev, next;
	rep(i, d) {
		s[i].push_back(0);
		// j: dの倍数
		for(ll j = 1; j * d <= h * w; j++) {
			prev = make_pair(m[i + (j - 1) * d].first, m[i + (j - 1) * d].second);
			next= make_pair(m[i + j * d].first, m[i + j * d].second);
			s[i].push_back(s[i][j - 1] + abs(next.first - prev.first) + abs(next.second - prev.second));
		}
	}

	cin >> q;
	vector<P> lr(q);
	ll l, r;
	rep(i, q) {
		cin >> l >> r;
		lr[i] = make_pair(l, r);
	}

	rep(i, q) {
		ans = 0;
		l = lr[i].first;
		r = lr[i].second;
		ans += s[l % d][r / d] - s[l % d][l / d];
		cout << ans << "\n";
	}
}

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

	solve_abc089();

	return 0;
}

Measured memory_bytes: 8704
#include <stdio.h>
  
void swap(int *num1, int *num2)
{
   int temp;
   temp = *num1;
   *num1 = *num2;
   *num2 = temp;
  
}
void bsort(int a[])
{
   int i,j;
  
   for( i = 1; i < 3; i++){
      for( j = 0; j < 3 - i; j++){
         if(a[j] > a[j + 1]){
            swap(&a[j], &a[j + 1]);
         }
      }
   }
}
void println(int a[])
{
   
    
   printf("%d %d %d\n", a[0],a[1],a[2]);
  
}
  
int main(void)
{
  
   int a, b, c;
   int sort[3];
  
   scanf("%d %d %d", &a, &b, &c);
   
   sort[0] = a;
   sort[1] = b;
   sort[2] = c;
  
   bsort(sort);
   println(sort);
  
   return 0;
}
   

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

#define mp make_pair
#define mt make_tuple
#define pb push_back
#define CONTAINS(a, x) (a.find(x) != a.end())
#define ALL(x) x.begin(), x.end()
#define SZ(x) (int)x.size()
#define nl cout << endl
#define F first
#define S second

#define what_is(x) cout << #x << " = " << x << endl
#define boost ios::sync_with_stdio(false);cin.tie(NULL)
#define CASET int ___T, case_n = 1; cin >> ___T; while (___T-- > 0) 


#define rep(it, st, en) for(ll it = st; it < en; it++)
#define rep1(it, st, en) for(ll it = st; it <= en; it++)
#define per(it, st, en) for(ll it = en - 1; it >= st; it--)

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

typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<ii> vii;
typedef vector<vi> vvi;

ll INF = 1E9;
ll M = 1E9 + 7;

inline ll max_(ll a, ll b) { return (a>b)?a:b; }
inline ll min_(ll a, ll b) { return (a<b)?a:b; }

inline ll power (ll a,ll p){
    ll res = 1, x = a;
    while ( p ) {
        if ( p & 1 ) res = ( res * x );
        x = ( x * x ); p >>= 1;
    }
    return res;
}

template <typename T> ostream& operator<<(ostream& os, const vector<T> &p){os << "[ "; for (T x: p) os << x << " "; os << "]" << endl; return os;}
template <typename T> ostream& operator<<(ostream& os, const set<T> &p){os << "{ "; for (T x: p) os << x << " "; os << "}" << endl; return os;}
template <typename Tk, typename Tv> ostream& operator<<(ostream& os, const map<Tk, Tv> &p){os << "{ "; for (pair<Tk, Tv> x: p) os << x << " "; os << "}" << endl; return os;}
template <typename Tk, typename Tv> ostream& operator<<(ostream& os, const pair<Tk, Tv> &p){os << "{" << p.first << ',' << p.second << "}";return os;}

int main() {
    boost;
    if(fopen("inp.txt", "r")){
      freopen("inp.txt", "r", stdin);
      freopen("outp.txt", "w", stdout);
    }

    ll x,t;
    cin>>x>>t;

    cout<<max_(0LL,x-t);

    return 0;
}

Measured memory_bytes: 256