akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#ifdef DBP
#define deb(...) fprintf(stderr,__VA_ARGS__)
#else
#define deb(...) 0
#endif
#define fst first
#define snd second
#define fore(x,a,b) for(int x=(a), qwerty=(b); x<qwerty; x++)
#define pb push_back
#define mset(a,v) memset((a),(v),sizeof(a))
#define ALL(a) (a).begin(), (a).end()
#define SZ(a) int((a).size())
#define FIN ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
using namespace std;
typedef long long ll;

const int K=1e5+5, N=101;
int n, k, dp[K], A[N];

int main(){FIN;
	dp[0]=0;
	cin >> n >> k;
	fore(x,0,n)cin>>A[x];
	fore(i,1,k+1){
		fore(x,0,n)dp[i]|=i-A[x]>=0&&!dp[i-A[x]];
	}
	cout << (dp[k]?"First":"Second") << "\n";
}

Measured memory_bytes: 640
#include<iostream>
#include<algorithm>
using namespace std;
static const int MAX = 200000;

int main (){
    int  R[MAX], n;
    cin >> n;

    for (int  i = 0 ; i < n ; i++) cin >> R[ i ];

    int maxv = R[1] - R[0];
    int minv = R[0];

    for (int j = 1; j < n; j++){
      maxv = max(maxv, R[j] - minv);
      minv = min(minv, R[j]);
    }
    cout << maxv << endl;

    return 0;
}

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

int main() {
	vector<string> v;
	v.push_back("qwertasdfgzxcvb");
	v.push_back("yuiophjklnm");
	v.push_back("");
	string s;
	while(cin >> s,s!="#"){
		int idx = 2,cnt=0;
		for(int unsigned i = 0;i<s.size();i++){
			if(find(v[0].begin(),v[0].end(),s[i]) != v[0].end()){
				if(idx != 0)cnt++;
				idx=0;
			}
			if(find(v[1].begin(),v[1].end(),s[i]) != v[1].end()){
				if(idx != 1)cnt++;
				idx=1;
			}
		}
		cout << cnt-1 << endl;
	}
	return 0;
}

Measured memory_bytes: 3036
/*
    AUTHOR : TANMAY SINHA
    INORMATION TECHNOLOGY
    BIT MESRA ,RANCHI
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
#define ld long double
#define ull unsigned long long int
#define ll long long int
#define pb(x) push_back(x)
#define eb(x) emplace_back(x)
#define mp make_pair
#define SPEED ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define mod 1000000007
#define rep(j,L,R) for(j=L;j<R;j++)
#define per(i,L,R) for(i=L;i>= R;i--)
#define all(con) (con).begin(),(con).end()
#define fi first
#define se second
#define foreach(iter,con) for(auto iter=(con).begin(); iter!=(con).end(); iter++)
#define DEBUG
#ifdef DEBUG
#define deb2(args...) {dbg,args; cerr<<endl;}
#else
#define deb2(args...)
#endif
struct debb{template<typename T> debb& operator,(const T &v){cerr<<v<<" ";return *this;}}dbg;
#define deb1(args...) do {cerr << #args << " : "; dbg,args; cerr << "\n";} while(0)
#define printa(a,L,R) rep(i,L,R) cout << a[i] <<' ';cout<<"\n";
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> pl;
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
template<typename T>T gcd(T a,T b){if(b==0)return a;else return gcd(b,a%b);}
template<typename T>T lcm(T a,T b){return a/gcd(a,b)*b;}
ll power(ll x,ll y,ll p){ll res=1;x=x%p;while(y>0){if(y&1)res=((res%p)*(x%p))%p;y=y>>1;x=(x*x)%p;}return res;}
ll power1(ll x,ll y){ll res=1;while(y>0){if(y&1)res=(res*x);y=y>>1;x=x*x;}return res;}

int main()
{
   SPEED
   ll n,i,j,m;
   cin>>n;
   ll a[n][3];
   for(i=0;i<n;i++)
    cin>>a[i][0]>>a[i][1]>>a[i][2];

   m = max(a[0][0],max(a[0][1],a[0][2]));
   if(n==1)
   {
       cout<<m;
       return 0;
   }
   for(i=1;i<n;i++)
   {
       for(j=0;j<3;++j)
       a[i][j]+= max(a[i-1][(j+1)%3],a[i-1][(j+2)%3]);
   }
   cout<<max(a[n-1][0],max(a[n-1][2],a[n-1][1]));
}







Measured memory_bytes: 2560
#include <bits/stdc++.h>
#define fi first
#define se second
using namespace std;
typedef vector<int> vi;
typedef pair<int,int> pii;

const int mxsz = 1e5 + 3;
int n;
vector<pii> adj[mxsz];
int dst[mxsz];

void dfs(int u, int prv, int w){
	dst[u] = w & 1;
	for (int i = 0, nx, l; i < adj[u].size(); i++){
		nx = adj[u][i].fi, l = adj[u][i].se;
		if (nx != prv){
			dfs(nx, u, w ^ l);
		}
	}
}
int main(){
	cin >> n;
	for (int i = 1, u, v, w; i < n; i++){
		cin >> u >> v >> w;
		w &= 1;
		adj[u].push_back(make_pair(v, w));
		adj[v].push_back(make_pair(u, w));
	}
	dfs(1, -1, 0);
	for (int i = 1; i <= n; i++) cout << dst[i] << '\n';
	return 0;
}


Measured memory_bytes: 9216
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const ll INF = 100000000;
#define rep1(i, n) for (ll i=0; i<(n); i++) 
#define rep2(i, k, n) for (ll i=k; i<(n); i++)


int main() {
    ll a;
    long double b;
    cin >> a >> b;
    ll ans = a*b;
    cout << ans << endl;
}

Measured memory_bytes: 3732
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <string>
#include <queue>
#include <math.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll mod = 1000000007;
ll bit[200010], num;
ll n, m, a[1010], ans;
bool jud;

ll sum(ll i)
{
	ll s = 0;
	while (i > 0)
	{
		s += bit[i];
		i -= i & -i;
	}
	return s;
}

void add(ll i, ll x)
{
	while (i <= num)
	{
		bit[i] += x;
		i += i & -i;
	}
}

ll po(ll x, ll y)
{
	if (y == 0) return 1;
	if (y % 2)
	{
		return po(x, y - 1) * x % mod;
	}
	else
	{
		ll yyy = po(x, y / 2);
		return yyy * yyy % mod;
	}
}

ll div(ll x)
{
	return po(x, mod - 2);
}

int main(void)
{
	while (true)
	{
		ll n, m, a[1010], ans = 0;
		bool jud = false;
		cin >> n >> m;
		if (n == 0 && m == 0)
		{
			break;
		}
		for (int i = 0; i < n; i++)
		{
			cin >> a[i];
		}
		for (int i = 0; i < n; i++)
		{
			for (int j = i + 1; j < n; j++)
			{
				if (a[i] + a[j] <= m)
				{
					jud = true;
					ans = max(ans, a[i] + a[j]);
				}
			}
		}
		if (jud)
		{
			cout << ans << endl;
		}
		else
		{
			cout << "NONE" << endl;
		}
	}
	int www;
	cin >> www;
}



Measured memory_bytes: 3096
n = gets.to_i

ans = [gets.chomp]
(1..n-1).each do |i|
  w = gets.chomp
  if ans.include?(w) || ans[i-1][-1] != w[0]
    puts 'No'
    exit
  else
    ans.push(w)
  end
end
puts 'Yes'

Measured memory_bytes: 1788
#include <bits/stdc++.h>
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = s; i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << endl;
#define CFYN(n) cout << ( (n) ? "YES":"NO") << endl;
#define OUT(n) cout << (n) << endl;

using namespace std;

int main(void)
{
    IOS
    int n; cin >> n;
    cout << n * n * n << endl;

    return 0;
}


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

int main(){
long ans=0;
int N; cin >> N; int L[N]; map<int, int> M, P, Q;
for(int i=0; i<N; i++){ cin >> L[i]; M[L[i]]++; }
for(int i=0; i<=1000; i++){
int m=0; 
for(int j=0; j<i; j++){ m+=M[j]; }
P[i]=m; Q[i]=m+M[i];
}
P[1001]=Q[1000];
for(int i=0; i<N-1; i++){ for(int j=i+1; j<N; j++){
int F=min(1001, L[i]+L[j]), G=abs(L[i]-L[j]);
ans+=(P[F]-Q[G]);
if(G<L[i]&&L[i]<F){ ans--; }
if(G<L[j]&&L[j]<F){ ans--; }
}}
cout << ans/3 << "\n";
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define ll long long
#define endl '\n'
using namespace std;
int dy[4] = { 1, 0, -1, 0 }, dx[4] = { 0, 1, 0, -1 };
typedef pair<ll, ll> P;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a, b;
    cin >> a >> b;
    if (a >= 13) {
        cout << b << endl;
    } else if (6 <= a && a <= 12) {
        cout << b / 2 << endl;
    } else {
        cout << 0 << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<algorithm>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<iostream>
#include<vector>
#include<queue>
#include<deque>
#include<stack>
#include<set>
#include<map>
#include<string>
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define ll long long 
using namespace std;
int main(){
  int a,b;
  cin >>a>>b;
  if(a%2!=0&&b%2!=0){
    cout<<"Yes"<<endl;
  }else{
cout <<"No"<<endl;
  }
}

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

void print() { std::cout << std::endl; }
template <class Head, class... Tail> void print(Head &&head, Tail &&... tail) {
    std::cout << head;
    if(sizeof...(tail) != 0)
        std::cout << " ";
    print(std::forward<Tail>(tail)...);
}
template <class T> void print(std::vector<T> &vec) {
    for(auto &a : vec) {
        std::cout << a;
        if(&a != &vec.back())
            std::cout << " ";
    }
    std::cout << std::endl;
}
template <class T> void print(std::vector<std::vector<T>> &df) {
    for(auto &vec : df) {
        print(vec);
    }
}

int main() {
    int A, B;
    cin >> A >> B;

    int count = 0;
    if(B == 1) {
        print(count);
    } else {
        while(true) {
            count++;
            if((count * (A - 1) + 1) >= B) {
                break;
            }
        }
        print(count);
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <set>
using namespace std;
#define MOD 1000000007

long long N, X;
long long dp[202][111111];

void add(long long &x, long long y){
    x = (x + y) % MOD;
}

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

    sort(S.begin(), S.end(), greater<long long>());

    dp[0][X] = 1;
    for(int i=1; i<=N; i++){
        for(int j=0; j<=100000; j++){
            add(dp[i][j], ((N-i) * dp[i-1][j]) % MOD);
        }
        for(int j=0; j<=100000; j++){
            add(dp[i][j%S[i-1]], dp[i-1][j]);
        }
    }
    long long ans = 0;
    for(int i=0; i<=100000; i++)
        add(ans, (dp[N][i] * i) % MOD);
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 173696
#include<bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < (int)n; i++)
#define REPvec(itr, mp) for(auto itr = mp.begin();itr != mp.end(); itr ++)
#define all(x) x.begin(), x.end()
#define MOD 1000000007//1e9+7
using namespace std;
typedef long long ll;
typedef vector<int >    vecint;
typedef vector<string > vecstr;
int main()
{
  int n, m;
  cin >> n >> m;
  if(n == m){
    cout << "Yes" << endl;    
  }else{
    cout << "No" << endl;    
}

}


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

int main() {
	int r;
	cin>>r;
	if(r<1200){
		cout<<"ABC"<<endl;
	
		
	}
	else if(r>=2800){
		cout<<"AGC"<<endl;
	}
	else{
		cout<<"ARC"<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long a,b,i,r=0,z,j;
	cin >> a;
	long long arr[a];
	for(i=0;i<a;i++)
	cin >> arr[i];
	sort(arr,arr+a);
	for(i=0;i<a-2;i++)
	 {
	 	for(j=i+1;j<a-1;j++)
	 	{
	 	z=a-1;
	 	while(z>j)
	 	{
	 		if(arr[i]+arr[j]>arr[z])
	 		{
	 		r++;
	 		z--;
	 	}
	 		else
	 		z--;
	
		 }
	}
	 }
	 cout << r;
	
}

Measured memory_bytes: 256
func readIntTuple() -> (Int, Int) {
    let line = readLine()!.split(separator: " ").map({Int($0)!})
    return (line[0], line[1])
}

struct LinkedList<T> {
    
    var first: Node?
    var last: Node?
    
    var isEmpty: Bool {
        return first == nil
    }
    
    mutating func append(_ e: T) -> Void {
        let node = Node(e)
        if first == nil {
            first = node
        }
        if let lastElement = last {
            lastElement.next = node;
            node.prev = lastElement;
        }
        last = node
    }
    
    mutating func delete(_ node: Node) {
        if let prev = node.prev {
            prev.next = node.next
        } else {
            first = node.next
        }
        if let next = node.next {
            next.prev = node.prev
        } else {
            last = node.prev
        }
    }
    
    mutating func removeFirst() -> T? {
        guard let firstNode = first else {
            return nil
        }
        delete(firstNode)
        return firstNode.value
    }
    
    class Node {
        var value: T
        var prev: Node?
        var next: Node?
        
        init(_ value: T) {
            self.value = value
        }
    }
}

let (N, M) = readIntTuple()
var adjacent: [[Int]] = Array(repeating: [], count: N + 1)
(1...M).forEach({ _ in
    let (A, B) = readIntTuple()
    adjacent[A].append(B)
    adjacent[B].append(A)
})

var parent = Array(repeating: -1, count: N + 1)
var list = LinkedList<Int>()
list.append(1)
while !list.isEmpty {
    let room = list.removeFirst()!
    adjacent[room].forEach({
        if parent[$0] < 0 {
            parent[$0] = room
            list.append($0)
        }
    })
}

print("Yes")
(2...N).forEach({print(parent[$0])})


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

typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;

#define pb push_back
#define rep(i, a, n) for(int i = (a); i < (n); i++)
#define mod (ll)1e9+7

__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}

signed main() {
  string s;
  cin >> s;
  s[3] = '8';
  cout << s << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
bool comp(pair<long long int,long long int>a,pair<long long int,long long int>b)
{
    if(a.first==b.first)
    {
        if(a.second<=b.second)
        return true;
        else
        return false;
    }
    if(a.first>b.first)
    return true;
    else return false;
}
long long int gcd(long long int bdda,long long int chota)
{
    if(chota==0)
        return bdda;
    return gcd(chota,bdda%chota);
}
void solve()
{
    long long int n,m,c;
    cin>>n>>m>>c;
    long long int b[m];
    for(long long int i=0;i<m;i++)cin>>b[i];
    long long int a[n][m];
    for(long long int i=0;i<n;i++)
    {
        for(long long int j=0;j<m;j++)cin>>a[i][j];
    }
    long long int value=0,ans=0;
    for(long long int i=0;i<n;i++)
    {
        value=0;
        for(long long int j=0;j<m;j++)value+=a[i][j]*b[j];
        value+=c;
        if(value>0)ans++;
    }
    cout<<ans;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t;    
    t=1;

    //cin>>t;
    while(t--)
    {
        solve();
    }
}


Measured memory_bytes: 3668
#include <stdio.h>


int pic_des(int N, int M, char* n_pic, char* m_pic, int offset_y, int offset_x) {

    for(int i=0;i<N;i++) {
        for(int t=0;t<N;t++) {
            if(n_pic[i*N + t] != m_pic[(i+offset_y)*M + (t+offset_x)]) {
                return 0;
            }
        }
    }

    return 1;
}

int main() {

    int N, M;
    scanf("%d %d", &M, &N);

    char Npic[N*N];
    char Mpic[M*M];

    for(int i=0;i<M;i++) {
        scanf("%s",&Mpic[i*M]);
    }

    for(int i=0;i<N;i++) {
        scanf("%s",&Npic[i*N]);
    }

    int flg = 0;
    for(int i=0;i<=M-N;i++) {
        for(int t=0;t<=M-N;t++) {
            if(pic_des(N,M,Npic,Mpic, i, t)) {
                flg = 1;
            }
        }
    }

    if(flg) {
        printf("Yes\n");
    } else {
        printf("No\n");
    }

    return 0;
}



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

int main() {
	int n;
	cin >> n;
	vector<int> p(n);
	vector<int> q(n);
	for(int i=0; i<n; i++){
		int num;
		cin >> num;
		p.at(i) = num;
		q.at(i) = num;
	}
	sort(q.begin(), q.end());
	int count = 0;
	bool ans = true;
	for(int i=0; i<n; i++){
		if(p.at(i) != q.at(i)){
			count++;
		}
		if(count > 2){
			ans = false;
			break;
		}
	}
	cout << (ans?"YES":"NO") << endl;	
}

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

using namespace std;

typedef long long int lli ;

lli i,j,k,l,m,n,t,a,b,c,d,x,y,sum=0,total=0,r;

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

    //freopen("Input.txt","r",stdin);

    cin>>l>>r;

    for(i=l ; i<r ; i++)
    {
        if(i%2019==0)
        {
            sum=1;
            break;
        }
    }
    if(sum==1)
    {
        cout<<"0\n";
        return 0;
    }
    else
    {
        lli a=l%2019;
        lli b=r%2019;

        l=2019;

        lli m1=max(a,b);
        lli m2=min(a,b);

        for(i=m2 ; i<=m1-1 ; i++)
        {
            for(j=m2+1 ; j<=m1 ; j++)
            {
                l=min(l,(i*j)%2019);
            }
        }
        cout<<l%2019<<"\n";
    }

}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>
#define pb push_back
#define mp make_pair
#define pie 3.141592653589793238
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
using namespace std;
const int INF = 1<<29;
typedef long long ll;
inline int two(int n) { return 1 << n; }
inline int test(int n, int b) { return (n>>b)&1; }
inline void set_bit(int & n, int b) { n |= two(b); }
inline void unset_bit(int & n, int b) { n &= ~two(b); }
/////////////////////////////////////////////////////////////////////
const ll mod = 1e9 + 7;
const int N = 1e6 + 9;
ll a[N];
vector <ll> v[105];
vector <ll> num;
ll modexp(ll a, ll n)
{
    ll r = 1;
    while(n){
        if(n & 1)
            r = (r * a) % mod;
        a = (a * a) % mod;
        n >>= 1;
    }
    return r;
}
bool cmp(const pair<double, ll> &a, const pair<double, int> &b)
{
    if(a.first == b.first){
        return a.second < b.second;
    }
    else return a.first > b.first;
}
int main()
{
    fast;
    string s; ll n;
    cin >> s;
    cin >> n;
    set <string> se;
    for(int i = 0; i < s.size(); i ++)
    {
        string ss;
        ll kk = i + n;
        if(kk > s.size()){kk = s.size();}
        for(int k = i; k < kk; k ++){
            ss += s[k];
            se.insert(ss);
        }
    }
    ll count = 0;
    for(auto it = se.begin(); it != se.end(); it ++)
    {
        count ++;
        if(count == n){
            cout << *it;
        }
    }
    return 0;
}


Measured memory_bytes: 1664
#include<iostream> 
#include<string> 
#include<vector> 
#include<algorithm> 
#include<cmath>
#include<set>
using namespace std; 


int main()
{

	int a;
	cin >> a;
	vector<string> aa(a);
	for (int i = 0; i < a; i++)
	{
		cin >> aa[i];
	}
	int b;
	cin >> b;
	vector<string> bb(b);
	for (int i = 0; i < b; i++)
	{
		cin >> bb[i];
	}
	int ans = 0;
	for (int i = 0; i < a; i++)
	{
		int w = 0;
		for (int j = 0; j < a; j++)
		{
			if (aa[i] == aa[j])
			{
				w++;
			}
		}
		
		for (int j = 0; j < b; j++)
		{
			if (aa[i] == bb[j])
			{
				w--;
			}
		}
		ans = max(ans, w);
	}
	cout << ans << endl;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  string S;
  int ans = 0;
  int length = 0;
  cin >> S;
  for(int i = 0; i < S.size(); i++){
    if(S[i] == 'A' || S[i] == 'C' || S[i] == 'G' || S[i] == 'T'){
      length++;
      if(length > ans)ans = length;
    }else{
      length = 0;
    }
  }
  cout << ans << endl;
}



Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
typedef long long ll;
#define rep(i, a, b) for (int i = a; i <= b; ++ i)
const int maxn = 200010;
using namespace std;
int n, a[maxn], b[maxn], h[2];
bool ok(int ave) {
	rep(i, 1, 2 * n - 1) a[i] = (b[i] >= ave);
	if (a[n] == a[n - 1] || a[n] == a[n + 1]) return a[n];
	int l = n, r = n;
	while (l - 1 && a[l - 1] != a[l]) -- l;
	while (r + 1 <= n * 2 - 1 && a[r + 1] != a[r]) ++ r;
	if ((l + r) % 2) {
		if (n - l < r - n) -- r;
			else ++ l;
	}
	if ((l + r) / 2 < n) return a[r + 1];
	if ((l + r) / 2 > n) return a[l - 1];
	h[0] = h[1] = 0;
	++ h[a[n] ^ ((n - l) & 1)];
	if (l - 1) ++ h[a[l - 1]];
	if (r + 1 <= n * 2 - 1) ++ h[a[r + 1]];
	return (h[1] > h[0]);
}
int main() {
	scanf("%d", &n);
	rep(i, 1, 2 * n - 1) scanf("%d", &b[i]);
	int l = 1, r = 2 * n - 1, ans;
	while (l <= r) {
		int mid = (l + r) / 2;
		if (ok(mid)) ans = mid, l = mid + 1;
			else r = mid - 1;
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 1920
#include <iostream>
#include <map>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
	int a, L;
	while ( cin >> a >> L, a || L ) {
		map<int, int> m;
		m[a] = 0;
		int ans = -1;
		int t = 0;
		while (++t) {
			vector<int> v(L);
			for (int i = 0, k = a; i < L; ++i, k /= 10) {
				v[i] = k % 10;
			}
			sort(v.begin(), v.end());

			int B = 0;
			for (int i = v.size()-1; i >= 0; --i) {
				B = B * 10 + v[i];
			}
			int b = 0;
			for (int i = 0; i < v.size(); ++i) {
				b = b * 10 + v[i];
			}
			a = B - b;

			if (m.find(a) != m.end()) {
				cout << m[a] << " " << a << " " << (t-m[a]) << endl;
				break;
			}
			m[a] = t;
		}
	}
}

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

using namespace std;

int main() {
 	int x, y; cin >> x >> y;
  	if (y % 2 == 0 && 2 * x <= y && 4 * x >= y) {
      	cout << "Yes" << endl; 
      	return 0;
    }
  	cout << "No" << endl; 
  	return 0;
}


Measured memory_bytes: 3632
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#include <bits/stdc++.h>
using namespace std;
#define FAST  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
#define ll long long int 
#define ar array
#define pb push_back
#define fi(a,b) for(ll i=a;i<(b);i++)
#define fj(a,b) for(ll j=a;j<(b);j++)
#define fk(a,b) for(ll k=a;k<(b);k++)
//hash base 177013

const int mod=1e9+7;

int main()
{
	FAST;
	//#ifndef ONLINE_JUDGE
	//	freopen("input.txt","r",stdin);
	//	freopen("output.txt","w",stdout);
	//#endif
	//ll testcase;
	//cin>>testcase;
	//while(testcase--)
	{
		int s;
		cin>>s;
		int len=(s/3)+1;
		vector<vector<int>> dp(len+2,vector<int> (s+2));
		dp[0][0]=1;
		fi(1,len+1)
		{
			for(int j=i*3;j<=s;j++)
			{
				for(int k=3;k<=j-((i-1)*3);k++)
				{
					if(j-k>=0)
						dp[i][j]=(dp[i][j]+dp[i-1][j-k])%mod;
				}
			}
		}
		int ans=0;
		fi(0,len+1)
		{
			ans=(ans+dp[i][s])%mod;
		}
		cout<<ans;
	}
}


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

int main(){
  int a,b,c;
  int count =0;
  cin>> a >> b >>c;
  if(a==b){
      count++;
  }
  if(a==c){
      count++;
  }
  if(b==c){
      count++;
  }
  if(count==1){
      cout << "Yes" << endl;
  }else{
      cout <<"No" << endl;
  }

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,a,b,c,i,j,d[100];
string s;
int main()
{
  for(cin>>n;i<n;i++)cin>>d[i];
  sort(d,d+n);
  for(i=1,a=1;i<n;i++,a++)if(d[i-1]==d[i])a--;
  cout<<a;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
ios_base::sync_with_stdio(false);
  cin.tie(NULL);
#ifndef ONLINE_JUDGE
  freopen("input.txt","r",stdin);
#endif

    ll n;
    cin>>n;
    ll count=0;
    ll mycount=0;
    while(n%2==0)
    {
      mycount++;
      n=n/2;
    }

    if(mycount>0)
      count+=(sqrt(8*mycount+1)-1)/(2);
    for(ll i=3;i<=sqrt(n);i=i+2)
    {
      mycount=0;
      while(n%i==0)
      {
        mycount++;
        n=n/i;
      }

      if(mycount>0)
      count+=(sqrt(8*mycount+1)-1)/(2);

    }

    if(n>2)
    {
      count++;
    }

    cout<<count<<endl;

  return 0;
}

Measured memory_bytes: 3696
import math
import heapq
import sys
from collections import Counter
import datetime
from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN

#N,K=map(int, input().split())  #複数数値入力　「A B」みたいなスペース空いた入力のとき
#x=list(map(int, input().split()))  #リスト入力 「a1 a2 a3 ...」みたいな配列のような入力のとき
#s = [input() for i in range(3)]

S=input()
cnt=0
for i in range(len(S)//2):
    if S[i]!=S[-1-i]:
        cnt+=1
    
print(cnt)

Measured memory_bytes: 5252
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#pragma comment(linker, "/stack:200000000")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef string str;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector <pii> vpii;
typedef vector <pll> vpll;
typedef map <str,int> mapsi;
typedef map <str,int> :: iterator mapsitr;
typedef map <int , int> mint;
typedef map <ll , ll> mll;
typedef set <int> si;
typedef set <ll> sll;
typedef si :: iterator sitr;
typedef si :: reverse_iterator rsitr;
typedef sll :: iterator sltr;
typedef sll :: reverse_iterator rsltr;
#define mset multiset

typedef mset <int> msi;
typedef mset <ll> msll;
typedef msi :: iterator msitr;
typedef msi :: reverse_iterator msritr;
typedef msll :: iterator msltr;
typedef msll :: reverse_iterator mslritr;

#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define mp make_pair
#define pb push_back
#define pob pop_back
#define pf push_front
#define pof pop_front
#define fi first
#define se second
#define fs first.second
#define ss second.second
#define ff first.first
#define sf second.first
#define newl '\n'
#define fbo find_by_order
#define ook order_of_key

char to_upper (char x){
    if( 97 <= int(x) && int(x) <= 122)return char(x-32);
    else if( 65 <= int(x) && int(x) <= 90)return x;
}
char to_lower (char x){
    if( 97 <= int(x) && int(x) <= 122)return x;
    else if( 65 <= int(x) && int(x) <= 90)return char(x+32);
}
int numerize (char x){
    if(48 <= int(x) && int(x) <= 57)return int(x-'0');
    else if( 97 <= int(x) && int(x) <= 122)return int(x-96);
    else if( 65 <= int(x) && int(x) <= 90)return int(x-64);
}
bool isect (int l1, int r1, int l2, int r2){
    pii p1,p2;
    p1 = mp(l1,r1); p2 = mp(l2,r2);
    if(p1>p2)swap(p1,p2);
    if(p2.fi <= p1.se)return true;
    else return false;
}
ll quickpow (ll num1, ll num2, ll MOD){
    if(num2==0)return 1;
    else if(num2==1)return num1;
    else{
        ll temp = quickpow (num1,num2/2,MOD); ll res = ((temp%MOD) * (temp%MOD))%MOD;
        if(num2%2==1) res = ((res%MOD)*(num1%MOD))%MOD; return res;
    }
}
ll invmod (ll num, ll MOD){return quickpow (num,MOD-2,MOD);}
ll gcd (ll num1, ll num2){
    if(num1 < num2) swap(num1,num2); ll num3 = num1 % num2 ;
    while(num3 > 0){ num1 = num2; num2 = num3; num3 = num1 % num2;}
    return num2;
}
ll lcm (ll num1 , ll num2){return (ll) (num1/__gcd(num1,num2))*num2;}
// end of Template
int a,b;
int main(){

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

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    cin>>a>>b;
    if(a==1) a+=100;
    if(b==1) b+=100;
    
    if(a>b)cout<<"Alice\n";
    else if(a<b)cout<<"Bob\n";
    else cout<<"Draw\n";
}


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

// 総数を1000000007（素数）で割った余り
const long long mod = 1e9 + 7;

using ll = long long;
using pii  = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

ull gcd(ull a, ull b) { return b ? gcd(b, a % b) : a; }
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }

const long long MOD = 2019;

int main(){
    ll l, r;
    cin >> l >> r;
    ll ans = MOD;
    r = min(r, l + MOD * 2);
    for (ll i=l; i<=r; ++i) {
        for (ll j=l; j<i; ++j) {
            ans = min(ans, i*j%MOD);
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll =long long;
#define all(v) v.begin(),v.end()
 
int main() {
 string S;
  cin>>S;
  if(S[0]==S[2]) {
cout<<"Yes"<<endl;
  }
  else {
cout<<"No"<<endl;
  }
}

Measured memory_bytes: 3600
#include<bits/stdc++.h>
using namespace std;
string answer(int t)
{
    if(t==2 || t==4 || t==5 || t==9 || t==7)return "hon";
    if(t==0 || t==1 || t==6 || t==8) return "pon";
    return "bon";
}
int main()
{
    int n;
    cin>>n;
    cout<<answer(n%10)<<endl;
}


Measured memory_bytes: 3628
#include <algorithm>
#include <climits>
#include <cmath>
#include <iostream>
#include <map>
#include <string>
#include <utility>
#include <vector>

using namespace std;
using ll = long long int;

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

ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }

int main() {
  ll n, k;
  cin >> n >> k;

  vector<ll> vec(n+1, 0);

  for (size_t i = 0; i < n; i++) {
    ll ai;
    cin >> ai;
    vec[ai]++;
  }

  ll type = 0;
  for (auto &&e : vec) {
    if (e > 0) {
      type++;
    }
  }

  sort(vec.begin(), vec.end());

  ll ans = 0;
  for (auto &&e : vec) {
    if (type <= k) {
      break;
    }
    if (e > 0) {
      ans += e;
      type--;
    }
  }
  cout << ans << endl;
}

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

int main(){
    int n, m;
    cin >> n >> m;
    vector <int> arr(n);
    int sum = 0;
    for(int i = 0; i < n; i++){
        cin >> arr[i];
        sum += arr[i];
    }
    sort(arr.begin(), arr.end(), greater <int> ());
    if(arr[m-1] < (1/(double)(4*m)) * sum){
        cout << "No";
    }
    else{
        cout << "Yes";
    }
    cout << "\n";
}

Measured memory_bytes: 256
typedef long long ll;
#include <bits/stdc++.h>
using namespace std;
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

int main() {
    ll n,k;
    double result = 0;
    std::cin >> n>>k;
    
    ll count = 0;
    ll o = n;
    while(o != 0){
        if(o-ceil(k*pow(2,-count))+1>=0){
            result += pow(2,-count)*(o-ceil(k*pow(2,-count))+1)/n;
            o = ceil(k*pow(2,-count))-1;
        }
        count++;
    }
    
    std::cout << setprecision(15)<<result << std::endl;
}

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

public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		
		int n = Integer.parseInt(in.next());
		String[] nArray = new String[n];
		
		for(int i = 0; i < n; i++) {
			String nString = in.next();
			nArray[i] = nString;
		}
		
		int q = Integer.parseInt(in.next());
		String[] qArray = new String[q];
		
		for(int j = 0; j < q; j++) {
			String qString = in.next();
			qArray[j] = qString;
		}
		
		int qCount = 0;
		for(String qStr : qArray) {
			for(String nStr : nArray) {
				if (nStr.matches(qStr)) {
					qCount++;
					break;
				}
			}
		}
		System.out.println(qCount);
		in.close();
	}
}



Measured memory_bytes: 168560
package main

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

func main() {
	fsc := NewFastScanner()
	A := []int{}
	for i := 0; i < 3; i++ {
		A = append(A, fsc.NextInt())
	}
	sort.Ints(A)
	result := 0
	result += A[2] - A[1]
	A[0] += A[2] - A[1]

	diff := A[2] - A[0]
	result += diff / 2
	if diff%2 != 0 {
		result += 2
	}
	fmt.Println(result)
}

//template
type FastScanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func NewFastScanner() *FastScanner {
	rdr := bufio.NewReaderSize(os.Stdin, 1024)
	return &FastScanner{r: rdr}
}
func (s *FastScanner) Next() string {
	s.pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	result := string(s.buf[start:s.p])
	s.p++
	return result
}
func (s *FastScanner) NextLine() string {
	s.pre()
	start := s.p
	s.p = len(s.buf)
	return string(s.buf[start:])
}
func (s *FastScanner) NextInt() int {
	v, _ := strconv.Atoi(s.Next())
	return v
}
func (s *FastScanner) NextInt64() int64 {
	v, _ := strconv.ParseInt(s.Next(), 10, 64)
	return v
}

func (s *FastScanner) NextIntArray() []int {
	s.pre()
	start := s.p
	result := []int{}
	for ; s.p < len(s.buf)+1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 0)
			result = append(result, int(v))
			start = s.p + 1
		}
	}

	return result
}

func (s *FastScanner) NextInt64Array() []int64 {
	s.pre()
	start := s.p
	result := []int64{}
	for ; s.p < len(s.buf)+1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 64)
			result = append(result, v)
			start = s.p + 1
		}
	}
	return result
}

func (s *FastScanner) pre() {
	if s.p >= len(s.buf) {
		s.readLine()
		s.p = 0
	}
}
func (s *FastScanner) readLine() {
	s.buf = make([]byte, 0)
	for {
		l, p, e := s.r.ReadLine()
		if e != nil {
			panic(e)
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}

//Max,Min
func IntMax(a, b int) int {
	if a < b {
		return b
	}
	return a
}

func Int64Max(a, b int64) int64 {
	if a < b {
		return b
	}
	return a
}
func Float64Max(a, b float64) float64 {
	if a < b {
		return b
	}
	return a
}

func IntMin(a, b int) int {
	if a > b {
		return b
	}
	return a
}

func Int64Min(a, b int64) int64 {
	if a > b {
		return b
	}
	return a
}
func Float64Min(a, b float64) float64 {
	if a > b {
		return b
	}
	return a
}

//Gcd
func IntGcd(a, b int) int {
	if a < b {
		b, a = a, b
	}
	if b == 0 {
		return a
	}
	return IntGcd(b, a%b)
}
func Int64Gcd(a, b int64) int64 {
	if a < b {
		b, a = a, b
	}
	if b == 0 {
		return a
	}
	return Int64Gcd(b, a%b)
}

func IntAbs(a int) int {
	if a < 0 {
		a *= -1
	}
	return a
}

func Int64Abs(a int64) int64 {
	if a < 0 {
		a *= -1
	}
	return a
}


Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <utility>
#include <map>
#include <algorithm>
#include <queue>
#include <cmath>

using namespace std;

int main() {
  int n;
  cin >> n;
  string ans;
  while (n != 0) {
    int r = n%-2;
    if (r<0) r+=2;

    n = (n-r) / -2;
    ans += '0' + r;
  }
  if (ans == "") ans='0';
  reverse(ans.begin(), ans.end());
  cout << ans << endl;
}

Measured memory_bytes: 256
N = int(input())
Blist = list(map(int,input().split()))
ans = 0

for i in range(N):
    if i==0:
        ans += Blist[i]
    elif i == N-1:
        ans += Blist[i-1]
    else:
        ans += min(Blist[i-1],Blist[i])

print(ans)

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

typedef long long ll;
typedef pair<ll, ll> P;

#define pb push_back
#define rep(i, n) for(int i = 0; i < (n); i++)
#define dep(i, a, n) for(int i = a; i >= (n); i--)
#define FOR(i, a, n) for(int i = a; i < (n); i++)
#define mod (ll)(1e9+7)
#define int ll
#define INF 100000000

__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}

signed main() {
	ll h, w;
  bool ch;
  char a[101][101];
  bool b[101][101];
  rep(i, 101) rep(j, 101) b[i][j] = false;
  cin >> h >> w;
  rep(i, h) rep(j, w) cin >> a[i][j];
  rep(i, h) {
    ch = false;
    rep(j, w) {
      if(a[i][j] == '#') ch = true;
    }
    if(ch) continue;
    rep(j, w) b[i][j] = true;
  }
  rep(j, w) {
    ch = false;
    rep(i, h) {
      if(a[i][j] == '#') ch = true;
    }
    if(ch) continue;
    rep(i, h) b[i][j] = true;
  }
  bool cc = false;
  rep(i, h) {
    ch = false;
    rep(j, w) {
      if(!b[i][j]) {
        ch = true;
        break;
      }
    }
    if(cc && ch) cout << endl;
    rep(j, w) {
      if(!b[i][j]) {
        cout << a[i][j];
        cc = true;
      }
    }
  }
  cout << endl;
	return 0;
}

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

using namespace std;
typedef long long int ll;

int main() {
  int A,B,C;
  cin>>A>>B>>C;
  if(A==B)cout<<C<<endl;
  if(B==C)cout<<A<<endl;
  if(A==C)cout<<B<<endl;
  return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;


namespace AtCoder
{
    class Program
    {
        public static void Main()
        {
            new Program().Solve();
        }

        void Solve()
        {
            int n = int.Parse(Console.ReadLine());
            var tmp = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();
            int count = 0;
            bool end = false;
            while (true)
            {
                for (int i = 0; i < tmp.Length; i++)
                {
                    if (tmp[i] % 2 != 0)
                    {
                        end = true;
                    }
                        
                }
                if (end)
                    break;
                count++;
                for (int i = 0; i < tmp.Length; i++)
                {
                    tmp[i] /= 2;
                }
            }
            Console.WriteLine(count);
        }
    }
}


Measured memory_bytes: 13380
#include <iostream>
using namespace std;
int main(){
  string s;
  cin >> s;
  if(s[0] ==s[1] && s[2]==s[3] && s[0] != s[2]){
    cout << "Yes";
  } else if(s[0]==s[2] && s[1]==s[3] && s[0] != s[1]){
    cout << "Yes";
  }else if(s[0]==s[3] && s[1]==s[2] && s[0] !=s[1]){
    cout << "Yes";
  }else{
    cout << "No";
  }
  return 0;
}
  


Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<algorithm>
 using namespace std;
 typedef long long ll;
 const double eps=1e-7;
 int main()
 {
    long double a,b,c; cin>>a>>b>>c;
    long double x=a+b+sqrt(a*b)*2;
    if(x<c) cout<<"Yes";
    else cout<<"No";
    return 0;
  } 

Measured memory_bytes: 256
#pragma GCC optimize("O3,unroll-loops")
#include <bits/stdc++.h>
using namespace std;
int main() {
	ios_base :: sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	long long a;
	string p;
	cin >> a >> p;
	int b = 0;
	for(int k = 0; p[k]; ++k) if(p[k] != '.') b = 10 * b + p[k] - '0';
	cout << a * b / 100 << '\n';
	return 0;
}

Measured memory_bytes: 3660
#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,t,a;
    cin >> n >> t >> a;
    vector<ll> h(n);
    ll diff=INF;
    ll ans=-1;
    rep(i,n){
        cin >> h[i];
        if(abs(1000*a-(1000*t-6*h[i]))<diff){
            ans=i+1;
            diff=abs(1000*a-(1000*t-6*h[i]));
        }
    }
    cout << ans << endl;
    return 0;
} 

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(int argc, char* argv[])
{
    char b; cin >> b;
    if (b == 'A') {
        b = 'T';
    } else if (b == 'T') {
        b = 'A';
    } else if (b == 'C') {
        b = 'G';
    } else if (b == 'G') {
        b = 'C';
    }

    cout << b << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int mod(int x, int m) {
	if (x < 0) return - (-x%m);
	return x%m;
}

int main(void){
	int x;
	int y;
	int sn;
	char buf[50], *p;
	
	while (scanf("%d",&x),x){
		p = buf;
		sn=1;
		
		while (x!=0){
			y = mod(x,10);
			if (y*sn<0) y += sn*10;
			x -= y;
			y *= sn;
			x /= 10;
			*++p = '0'+y;
			sn *= -1;
		}
		while (p!=buf) printf("%c",*p--);
		puts("");
	}
	
	return 0;
}
	

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

int main() {
    int N, M;
    cin >> N >> M;
    int a, b, ans[N] = {0};
    for(int i = 0; i < M; i++) {
        cin >> a >> b;
        ans[a-1]++;
        ans[b-1]++;
    }
    for(int i = 0; i < N; i++) {
        cout << ans[i] << endl;
    }
    return 0;
}

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

using Graph=vector<vector<int>>;
using ll=long long;
const ll MOD=1e9+7;
ll powm(ll x,ll k){
    ll res=1;
    while(k){
        if(k&1) res=res*x%MOD;
        k>>=1;
        x=x*x%MOD;
    }
    return res;
}
ll modInv(ll x){return powm(x,MOD-2);}
class Solver{
    int n;
    Graph g;
    map<int,vector<int>> st;
    vector<int> pos;
    vector<vector<int>> deps;
    vector<int> flag;
    vector<int> badFlag;
    void build(int v,int from){
        pos[v]=from;
        if(g[v].size()==1){
            build(g[v][0],from);
            return;
        }
        for(auto to:g[v]){
            st[from].push_back(to);
            build(to,to);
        }
    }
    void setDeps(int v,int dep){
        deps[dep].push_back(v);
        for(auto to:g[v]){
            setDeps(to,dep+1);
        }
    }
    pair<ll,ll> dfs(int v){
        if(flag[v]){
            return make_pair(1LL,1LL);
        }
        if(badFlag[v] || st[v].empty()){
            badFlag[v]=true;
            return make_pair(1LL,0LL);
        }
        vector<pair<ll,ll>> vec;
        for(auto to:st[v]){
            vec.push_back(dfs(to));            
        }
        ll pat0=1;
        ll allp=1;
        for(auto&e:vec) pat0=pat0*e.first%MOD,allp=allp*(e.first+e.second)%MOD;
        ll pat1=0;
        for(auto&e:vec) pat1=(pat1+pat0*modInv(e.first)%MOD*e.second)%MOD;
        if(pat1==0){
            badFlag[v]=true;
        }
        return make_pair(((allp-pat1)%MOD+MOD)%MOD,pat1);
    }
    public:
    Solver(int n):n(n),g(n+1),pos(n+1),deps(n+1),flag(n+1),badFlag(n+1){
        for(int i=0;i<n;i++){
            int p; cin>>p;
            g[p].push_back(i+1);
        }
    }
    ll solve(){
        build(0,0);
        setDeps(0,0);
        vector<ll> pow2(n+2);
        pow2[0]=1;
        for(int i=1;i<=n+1;i++) pow2[i]=(pow2[i-1]*2)%MOD;
        ll res=0;
        for(int i=0;i<=n;i++){
            for(auto v:deps[i]) flag[pos[v]]=true;
            ll pat=dfs(0).second;
            res=(res+pow2[n+1-deps[i].size()]*pat%MOD)%MOD;
            for(auto v:deps[i]) flag[pos[v]]=false;
        }
        return res;
    }
};
int main(){
    int n;
    cin>>n;
    Solver solver(n);
    cout<<solver.solve()<<endl;
    return 0;
}

Measured memory_bytes: 72960
#include <vector>
#include <iostream>
#include <utility>
#include <algorithm>
#include <string>
#include <deque>
#include <queue>
#include <tuple>
#include <queue>
#include <functional>
#include <cmath>
#include <iomanip>
#include <map>
#include <set>
#include <numeric>
#include <unordered_map>
#include <unordered_set>
#include <complex>
#include <iterator>
#include <array>
#include <memory>
#include <stack>
#define vi vector<int>
#define vvi vector<vector<int> >
#define ll long long int
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
#define ld long double
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define all(in) in.begin(), in.end()
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
#define MAX 9999999
using namespace std;
typedef pair<int, int> pii;
typedef pair<double,double>pdd;
typedef pair<ll,ll>pll;
int main(){
    vector<vector<char>>hoge(100,vector<char>(100));
    int h,w; cin>>h>>w;
    rep(i,h)rep(j,w)cin>>hoge[i][j];
    vvi dp(h,vi(w,0));
    rep(i,h)rep(j,w)dp[i][j]=hoge[i][j]-'0';
    rep(i,h)rep(j,w){
        if(i+j==0)continue;
        if(i==0&&j!=0)dp[i][j]+=dp[i][j-1];
        else if(i!=0&&j==0)dp[i][j]+=dp[i-1][j];
        else dp[i][j]+=min(dp[i-1][j],dp[i][j-1]);
    }
    cout<<dp[--h][--w]<<endl;
}

Measured memory_bytes: 3172
//为郝尚诚写亦！！
//勿hack余，否则君必悔之！！若如此，请寄言，吾望得！！下为正文：
#include <iostream>
#include <iomanip>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <climits>
using namespace std;
#define rep(i,n) for (int i=0;i<(n);i++)
#define all(a) (a).begin(),(a).end()
#define reunique(v) v.erase(unique(all(v)),v.end())
#define RET(p,x) return p<<x<<endl,0;
#define Debug(x) cerr<<#x<<" = "<<x<<endl
typedef long long ll;
typedef unsigned long long ull;
ull rdtsc(){ull ret=0;asm volatile("rdtsc" : "=A" (ret) : :);return ret;}
const int inf=1e9;
const ll infl=1e18;
ll n,a[100005],sm=2,la=2,s,l;
ll mx[100005],mn[100005];
signed main()
{
	rdtsc();
	ios_base::sync_with_stdio(0);cin.tie();cout.tie();
	cout<<setprecision(10);
	cin>>n;
	rep(i,n) cin>>a[i];
	mx[n]=2;
	mn[n]=2;
	for (ll i=n-1;i>=0;i--)
	{
		mx[i]=(mx[i+1]/a[i]+1)*a[i]-1;
		mn[i]=((mn[i+1]-1)/a[i]+1)*a[i];
		if (mx[i]<mn[i])
		{
			cout<<-1;
			return 0;
		}
	}
	cout<<mn[0]<<" "<<mx[0];
	return 0;
}

Measured memory_bytes: 2560
#include<bits/stdc++.h>
#include<unordered_map>
using namespace std;
#define ll long long
#define all(x) (x).begin(),(x).end()
#define rep(i, n) for(ll i = 0; i < n; i++)
const ll INF = 100100100100;


ll combination(ll n, ll r){
    if(n < r) return 0;
    if(r == 0||r == n) return 1;
    else if(r == 1) return n;
    return (combination(n - 1, r - 1) + combination(n - 1, r));
}

bool checkKaibun(string str){
    string checkStr = str;
    reverse(checkStr.begin(), checkStr.end());
    if(str == checkStr) return true;
    else return false;
}

int keta(ll num){
    int digits = 0;
    while(num > 0){
        num /= 10;
        digits++;
    }
    return digits;
}


int main(){
    int N;
    cin >> N;
    int even = 0, odd = 0;
    rep(i, N){
        int num;
        cin >> num;
        if(num % 2 == 0) even++;
        else odd++;
    }
    if(odd % 2 == 1)cout << "NO" << endl;
    else cout << "YES" << endl;
}

Measured memory_bytes: 256
#include<math.h>
#include<time.h>
#include<string.h>
#include<stdlib.h>
#include<stdio.h>
int main()
{
	int a,b,i,j,n=0,k[9999][5],h;
	scanf("%d %d",&a,&b);
	while(a!=0 || b!=0)
	{
		n++;
		k[n][1]=a;
		k[n][2]=b;
		scanf("%d %d",&a,&b);
	}
	for(i=1;i<=n;i++)
	{
		for(j=1;j<=k[i][1];j++)
		{
			for(h=1;h<=k[i][2];h++)
				if(j%2!=h%2)
					printf(".");
				else
					printf("#");
			printf("\n");
		}
		printf("\n");
	}
	return 0;
}


Measured memory_bytes: 2060
#include <stdio.h>

int main()
{
  int n,m;
  long long int t[100], p[100], x[100];
  
  scanf("%d", &n);
  for(int i=0;i<n;i++) scanf("%lld", &t[i]);
  
  scanf("%d", &m);
  
  for(int i=0;i<m;i++)
    scanf("%lld %lld", &p[i], &x[i]);
  
  int sum;
  long long int tmp[100];
  for(int i=0;i<m;i++){
    sum = 0;
    for(int k=0;k<n;k++) tmp[k] = t[k];
    tmp[p[i]-1] = x[i];
    for(int j=0;j<n;j++)
      sum += tmp[j];
    printf("%d\n", sum);
  }
   
  return 0;
}
  

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <functional>
#include <list>
#include <bitset>
#include <numeric>
#include <utility>
#define INF 1e9
#define MOD 1000000007
#define ll long long
using namespace std;
typedef unsigned long long ull;
typedef pair<int, int> pr;
int main(){
    ios_base::sync_with_stdio(0); cin.tie(0);
    ll n,h,w,a,b;
    cin>>n>>h>>w;
    ll ans=0;
    for(int i=0;i<n;i++){
        cin>>a>>b;
        if(h<=a&&w<=b){
            ans++;
        }

    }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<math.h>
#include<iomanip>
using namespace std;
typedef long long ll;

int main() {
    cout << fixed << setprecision(10);
    int n; cin >> n;
    vector<int> v(n);
    for (int i = 0; i < n; i++) cin >> v[i];

    sort(v.begin(), v.end());
    double ave = (v[0] + v[1]) / 2.0;
    for (int i = 2; i < n; i++) {
        ave = (ave + v[i]) / 2.0;
    }
    cout << ave << endl;
}


Measured memory_bytes: 256