akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <cmath>
#include <algorithm>
#include <utility>
#include <functional>
#include <fstream>
#define debug(x) cout << #x << " = " << x << endl
#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); i > -1; i--)
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const int MOD = 1000000007;
const double EPS = 1e-9;


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

  ll n,c,k;
  cin>>n>>c>>k;
  ll t[n];
  rep(i,n) cin>>t[i];
  sort(t, t + n);
  ll mi;
  ll cnt = 0;
  ll ans = 0;
  rep(i,n) {
    if(cnt == 0) {
      mi = t[i];
      cnt++;
      ans++;
    } else if(t[i] <= mi + k && cnt < c) {
      cnt++;
    } else {
      cnt = 1;
      mi = t[i];
      ans++;
    }
  }
  cout << ans << endl;

  return 0;

}


Measured memory_bytes: 1024
#!/usr/bin/env python3

import math

def devident(N):
    sq = int(math.sqrt(N))
    for m in range(sq, 1, -1):
        if N % m == 0:
            return (m, N // m)
    return (N, 1)


def solve(N):
    m, n = devident(N)
    return m+n-2

if __name__ == '__main__':
    N = int(input())

    ans = solve(N)

    print(ans)


Measured memory_bytes: 3060
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        
        Scanner sc = new Scanner(System.in);
        
        String s = sc.next();
        if(s.charAt(0) != s.charAt(1) || s.charAt(1) != s.charAt(2)){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
}

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

using namespace std;

bool check(const vector<int> &v){
  bool fg = true;
  for(int i=0;i<v.size();i++){
    fg &= v[i]==0;
  }
  return fg;
}

int main(void){

  int n,p;
  while(cin >> n >> p, n|p){
    vector<int>v(n,0);

    int k;
    for(k=0;;k=(k+1)%n){
      if(p>0)v[k]++,p--;
      else p+=v[k],v[k]=0;
      if(check(v))break;
    }
    cout << k << endl;
  }
  
  return 0;
}

Measured memory_bytes: 3084
#include <iostream>
#include <cstdlib>
#include <string>
#include <vector>
#include <stack>
#include <algorithm>

using namespace std;

int main() {
    stack<int> Left_s;
    stack< pair<int,int> > Water;
    string given;
    int sum = 0;

    cin >> given;

    for ( int i = 0; i < given.size() ; ++i ) {

        if ( given[i] == '\\' ) Left_s.push(i);
        else if ( given[i] == '/' && Left_s.size() > 0 ) {
            int j = Left_s.top();
            Left_s.pop();
            sum += i - j;
            int a = i - j;
            while ( Water.size() > 0 && Water.top().first > j ) {
                a += Water.top().second;
                Water.pop();
            }
            Water.push(make_pair(j, a));
        }
    }


    vector<int> ans;
    while ( Water.size() > 0 ) {
        ans.push_back(Water.top().second);
        Water.pop();
    }
    reverse(ans.begin(), ans.end());
    cout << sum << endl;
    cout << ans.size();
    for ( int i : ans) {
        cout << " ";
        cout << i;
    }
    cout << endl;

    return 0;
}


Measured memory_bytes: 3276
#include <iostream>
#include <vector>

struct CoinOperation {
  int from_y;
  int from_x;
  int to_y;
  int to_x;
};

void calcCoinOperation(const std::vector<std::vector<int>> initial_grids,
                       std::vector<CoinOperation> *const results) {
  results->clear();
  auto current_grids = initial_grids;
  for (int i = 0; i < static_cast<int>(current_grids.size()); ++i) {
    auto &row = current_grids[i];
    for (int j = 0; j < static_cast<int>(row.size()) - 1; ++j) {
      if (row[j] % 2 == 1) {
        --row[j];
        ++row[j + 1];
        results->push_back({i, j, i, j + 1});
      }
    }
  }
  const int last_index = static_cast<int>(current_grids.front().size()) - 1;
  for (int i = 0; i < static_cast<int>(current_grids.size()) - 1; ++i) {
    if (current_grids[i][last_index] % 2 == 1) {
      --current_grids[i][last_index];
      ++current_grids[i + 1][last_index];
      results->push_back({i, last_index, i + 1, last_index});
    }
  }
}

void calcOperationAndShowResults(const std::vector<std::vector<int>> &grid) {
  std::vector<CoinOperation> results;
  calcCoinOperation(grid, &results);
  std::cout << results.size() << std::endl;
  for (const auto &op : results) {
    std::cout << op.from_y + 1 << " " << op.from_x + 1 << " " << op.to_y + 1
              << " " << op.to_x + 1 << std::endl;
  }
}

int main() {
  int h, w;
  std::cin >> h >> w;
  std::vector<std::vector<int>> grids(h);
  for (auto &row : grids) {
    row.resize(w);
  }
  for (int i = 0; i < h; ++i) {
    for (int j = 0; j < w; ++j) {
      std::cin >> grids[i][j];
    }
  }
  calcOperationAndShowResults(grids);
  return 0;
}

Measured memory_bytes: 5364
parseInt(x::String) = parse(Int, x)
parseInt(x::SubString{String}) = parse(Int, x)
parseInt(x::Char) = parse(Int, x)
parseInt(x::Float64) = trunc(Int, x)
parseFloat(x::String) = parse(Float64, x)
parseFloat(x::Int) = trunc(Float64, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)

function main()
    n=parseInt(readline())
    d,x=parseMap(split(readline()))
    ans=x
    for i in 1:n
        a=parseInt(readline())
        day=1
        while day<=d
            ans+=1
            day+=a
        end
    end
    println(ans)
end
main()

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

#define int long long
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define rep1(i,n) for(int i=1;i<=(int)(n);++i)
#define rep11(i,n) for(int i=1;i<(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define repm(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define sperase(v,n) (v).erase(remove(all(v), n), (v).end())
#define vdelete(v) (v).erase(unique(all(v)), (v).end())
#define pb(n) push_back(n)
#define mp make_pair
#define MOD 1000000007
#define INF 9223372036854775807

int a,b,c,d,e,k;

signed main() {
    cin >> a >> b >> c >> d >> e >> k;
    if (e-a > k) cout << ":(" << endl;
    else cout << "Yay!" << endl;
}


Measured memory_bytes: 256
/* ***********************************************
author        :dasinlsb
created time  :2018/6/3 20:45:40
file name     :c:\dasin\duipai.cpp
************************************************ */

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define fi first
#define se second
const int N=300005;
const int mod= 998244353;
int n,a,b,fac[N],inv[N];
ll kk;
int c(int x,int y){
  //printf("c %d %d : %d %d %d,%d \n",x,y,fac[x],inv[y],inv[x-y],(ll)fac[x]*inv[x-y]%mod);
  return (ll)fac[x]*inv[y]%mod*inv[x-y]%mod;
}
int main(){
 // freopen("c:/dasin/aa.in","r",stdin);
  //freopen("c:/dasin/mine.out","w",stdout);
  int i,j;
  cin>>n>>a>>b>>kk;
  for(fac[0]=i=1;i<=n;++i)fac[i]=(ll)fac[i-1]*i%mod;
  for(inv[0]=inv[1]=1,i=2;i<=n;++i)inv[i]=mod-(ll)mod/i*inv[mod%i]%mod;
  for(i=1;i<=n;++i)inv[i]=(ll)inv[i]*inv[i-1]%mod;
  int ans=0;
  for(i=0;i<=n;++i){
    if((kk-a*i)%b)continue;
    ll bs=(kk-a*i)/b;
    if(bs<0||bs>n)continue;
    //printf("pro %d %d\n",i,bs);
    ans=(ans+(ll)c(n,i)*c(n,bs))%mod;
  }
  printf("%d\n",ans);
  return 0;

}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
int64_t MOD=1000000007;

int main() {
  int N;
  cin>>N;
  bool error=false;
  int64_t ans=0;
  vector<int64_t> S(N+1);
  vector<int64_t> T(N+1);
  for(int i=0;i<=N;i++)cin>>S.at(i);
  T.at(N)=S.at(N);
  for(int i=N-1;i>0;i--) T.at(i)=T.at(i+1)+S.at(i);
  T.at(0)=1;
  for(int i=1;i<=N;i++){
    T.at(i)=min(T.at(i),2*T.at(i-1)-2*S.at(i-1));
    if(T.at(i)<1) error=true;
  }
  if(error||S.at(N)!=T.at(N)) cout<<-1;
  else{
    for(int i=0;i<=N;i++){
      ans+=T.at(i);
    }
    cout<<ans<<endl;
  }
 
}


Measured memory_bytes: 4824
#include <iostream>
#include <cstdio>
#include <string>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <ctime>
using namespace std;

#define rep(i,a,n) for(int i=a; i<n; i++)
#define repr(i,a,n) for(int i=a; i>=n; i--)
#define pb(a) push_back(a)
#define fr first
#define sc second
#define INF 999999999

#define X real()
#define Y imag()
#define EPS (1e-10)
#define EQ(a,b) (abs((a) - (b)) < EPS)
#define EQV(a,b) ( EQ((a).X, (b).X) && EQ((a).Y, (b).Y) )
#define LE(n, m) ((n) < (m) + EPS)
#define GE(n, m) ((n) + EPS > (m))

typedef vector<int> VI;
typedef vector<VI> MAT;
typedef pair<int, int> pii;
typedef long long int ll;

typedef complex<double> P;
typedef pair<P, P> L;
typedef pair<P, double> C;

int const MOD = 1000000007;

int a, b, ret;
// x????¶???????????????????????????§???y????¶???????????????????????????§???????¨????sum???
void dfs(int x, int y, int sum) {
    if(sum == b && y == a) {
        ret++; return;
    }
    if(x == 10 || sum > b) return;
    dfs(x+1,y,sum);
    dfs(x+1,y+1,sum+x);
}

int main() {
    while(cin >> a >> b) {
        ret = 0;
        if(a == 0 && b == 0) break;
        dfs(0,0,0);
        cout << ret << endl;
    }
    return 0;
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
#define fi first
#define se second
#define bug cout<<"--------------"<<endl
using namespace std;
typedef long long ll;
const double PI=acos(-1.0);
const double eps=1e-6;
const int inf=1e9;
const ll llf=1e18;
const int mod=1e9+7;
const int maxn=2e5+10;
int n;
int a[maxn],b[maxn],a1[maxn],b1[maxn];
int main(){
	ios::sync_with_stdio(false);
	//freopen("in","r",stdin);
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>a[i];
	} 
	for(int i=1;i<=n;i++){
		cin>>b[i];
	}
	ll ans=0;
	for(int i=0;i<29;i++){
		for(int j=1;j<=n;j++){
			a1[j]=(a[j]%(1<<(i+1)));
			b1[j]=(b[j]%(1<<(i+1)));
		}
		sort(b1+1,b1+n+1);
		int t=(1<<i);
		ll ret=0;
		for(int j=1;j<=n;j++){
			ret+=lower_bound(b1+1,b1+n+1,2*t-a1[j])-lower_bound(b1+1,b1+n+1,t-a1[j]);
			ret+=lower_bound(b1+1,b1+n+1,4*t-a1[j])-lower_bound(b1+1,b1+n+1,3*t-a1[j]);
		}
		if(ret&1) ans|=(1<<i);
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 3328
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using ll = long long;
using pii = pair<int,int>;
using vi = vector<int>;
using vs = vector<string>;
using vll = vector<long long>;
using vpii = vector<pair<int,int>>;
using vivi = vector<vector<int>>;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};



int main(void) {
  int a;
  string s;
  cin >> a >> s;
  if(a>=3200) cout << s << endl;
  else cout << "red" << endl;
    
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define pb(x) push_back(x)
#define mp make_pair
#define sz(x) ((int)(x).size())
#define endl "\n"
#define fastio ios_base::sync_with_stdio(false); cin.tie(nullptr);
#define all(x) x.begin(),x.end()
#define y1 omg
#define INF 1000000010
#define FOR(x, n) for(int x=0; x<n; x++)
#define ini(x, n) memset(x, n, sizeof(x));
#define MOD ((int)1e9 + 7)
#define atoi(x) ((x)-'0')
#define int ll
#define double long double
using namespace std;
typedef long long ll;
typedef pair<int, int> ii;
typedef pair<int, ii> iii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<vi> vvi;

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

int n, a, b, cnt;

signed main() {
	cin >> n;
	FOR(i, n) {
		cin >> a >> b;
		if (a == b) cnt++;
		else cnt = 0;
		if (cnt == 3) {
			cout << "Yes";
			return 0;
		}
	}
	cout << "No";
}

Measured memory_bytes: 3616
#include<iostream>
#include<stdio.h>
#include<string.h>
#include<algorithm>
#define maxn 100005
using namespace std;
typedef long long ll;
int n;
int a[maxn],b[maxn],c[maxn];
ll sum1[maxn];
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
		scanf("%d",&a[i]);
	for(int i=1;i<=n;i++)
		scanf("%d",&b[i]);
	for(int i=1;i<=n;i++)
		scanf("%d",&c[i]);

	sort(a+1,a+1+n);
	sort(b+1,b+1+n);
	sort(c+1,c+1+n);

	for(int i=1;i<=n;i++)
	{
		int pos=(lower_bound(a+1,a+1+n,b[i])-a)-1;
		sum1[i]=(pos-1+1);
		//cerr<<sum1[i]<<" ";
		sum1[i]+=sum1[i-1];
	}
//	cerr<<endl;
	ll ans=0;

	for(int i=1;i<=n;i++)
	{
		int pos=(lower_bound(b+1,b+1+n,c[i])-b)-1;
		ans+=sum1[pos];
	}

	printf("%lld\n",ans);
}


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

using int64 = long long;
using uint64 = unsigned long long;

using namespace std;

constexpr int MAX_N = 100000;
constexpr int INF = 1 << 28;

vector<int> graph[MAX_N];

int n;
int dist_t[MAX_N], dist_a[MAX_N];

void BFS(int dist[], int s) {
    fill(dist, dist + n, INF);
    queue<int> queue;
    queue.push(s);
    dist[s] = 0;
    while (!queue.empty()) {
        int u = queue.front();
        queue.pop();

        for (int to : graph[u]) {
            if (dist[to] > dist[u] + 1) {
                dist[to] = dist[u] + 1;
                queue.push(to);
            }
        }
    }
}

bool check(int move_a, int move_t) {
    for (int u = 0; u < n; u++) {
        if (dist_t[u] > move_t || dist_t[u] % 2 != move_t % 2) continue;
        if (dist_a[u] > move_a) {
            return false;
        }
    }
    return true;
}

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

    int u, v;
    cin >> n >> u >> v;
    u--;
    v--;

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

    BFS(dist_t, u);
    BFS(dist_a, v);

    int lb = -1,
        ub = n;
    while (ub - lb > 1) {
        int mid = (lb + ub) / 2;
        if (check(mid, mid + (dist_t[v] % 2))) {
            ub = mid;
        } else {
            lb = mid;
        }
    }
    cout << ub << endl;

    return 0;
}



Measured memory_bytes: 6656
#include<stdio.h>
int main(){
    int a, b, c, k, i=1;
    scanf("%d %d %d", &a, &b, &c);
    scanf("%d", &k);
    while(a>=b && i<=k){
        b *= 2;
        i++;
    }
    while(b>=c && i<=k){
        c *= 2;
        i++;
    }
    if(a<b && b<c) printf("Yes");
    else printf("No");
    return 0;
}


Measured memory_bytes: 1736
import java.util.Scanner;

public class Main {
	  
	public static void main(String args[]) {
		    Scanner scanner = new Scanner(System.in);
		    
		    String s = scanner.next();
		    
		    int count  = 0;
		    
		    for(int i = 0; i < 3; i++)
		    {
		    	if(s.substring(i, i + 1).equals("o")) 
		    	{
		    		count++;
		    	}
		    }
		    System.out.println( 700 + 100 * count);
		    scanner.close(); }
		  }

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

int main(){
    int N;
    string S;
    cin >> N >> S;

    int res = 1;
    char temp = S[0];
    
    for(int i = 1; i < N; ++i){

        if(S[i] != temp){
            res += 1;
            temp = S[i];
        }
    }
    cout << res << endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define R cin>>
#define Z class
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
template<Z A>void pr(A a){cout<<a;ln;}
template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);}
template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);}
template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);}
template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}
const ll MAX=1e9+7,MAXL=1LL<<61,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
typedef pair<ll,ll> P;

void Main() {
  ll n,m;
  cin >> m >> n;
  ll a[n];
  mem(a);
  rep(i,n) {
    a[i]=1;
    m--;
  }
  a[0]+=m;
  pr(a[0]-a[min(n-1,1LL)]);
}

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


Measured memory_bytes: 256
OPERATORS = %w(+ - *)
FORMULAS = ['%d %c %d %c %d %c %d',
            '(%d %c %d) %c %d %c %d',
            '%d %c (%d %c %d) %c %d',
            '%d %c %d %c (%d %c %d)',
            '((%d %c %d) %c %d) %c %d',
            '(%d %c (%d %c %d)) %c %d',
            '(%d %c %d) %c (%d %c %d)',
            '%d %c ((%d %c %d) %c %d)',
            '%d %c (%d %c (%d %c %d))']

loop do
  nums = gets.split.map(&:to_i)
  break if nums.all?(&:zero?)

  catch :next do
    nums.permutation do |num|
      OPERATORS.product(OPERATORS, OPERATORS).each do |op|
        variables = [num[0], op[0], num[1], op[1], num[2], op[2], num[3]]

        FORMULAS.each do |formula|
          expression = formula % variables

          if eval(expression) == 10
            puts expression
            throw :next
          end
        end
      end
    end

    puts 0
  end
end

Measured memory_bytes: 10032
#include<bits/stdc++.h>
#define rep(i,N) for(int i=0;i<(N);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
const int mod = 1e9+7;
typedef long long ll;
typedef pair<ll,int> P;
typedef set<int> S;
int main(){
    int n,k;
    cin>>n>>k;
    ll a = 0;
    ll b = 0;
    for(int i=1;i<=n;i++){
        if(i%k==0) a++;
        if(i%k==k/2) b++;
    }
    if(k%2==0) cout<<a*a*a + b*b*b <<endl;
    else cout<<a*a*a<<endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		while(true){
			int l=sc.nextInt();
			if(l==0)break;
			int ans=0;
			for(int i=0;i<12;i++){
				int m=sc.nextInt();
				int n=sc.nextInt();
				l-=(m-n);
				if(l<=0){
					if(ans>0)continue;
					ans=i+1;
				}
			}
			if(l<=0)System.out.println(ans);
			else System.out.println("NA");
		}
	}
}

Measured memory_bytes: 34600
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MM = 1000000000;
const int MOD = MM + 7;
const int MAX = 510000;
#define rep(i, n) for(ll i=0; i<n; i++)
#define Rep(i, j, n) for(ll i=j; i<n; i++)
#define all(vec) vec.begin(), vec.end()
template<class T> inline bool chmin(T& a, T b) {if(a > b) {a = b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b) {if(a < b) {a = b; return true;} return false;}
const ll INF = 1LL << 60;
const double pi = acos(-1.0);

int main() {
    ll n; cin >> n;
    vector<ll> a(n), b(n);
    rep(i, n) cin >> a[i] >> b[i];
    ll ans = 0;
    ll sum = 0;
    for(ll i=n-1; i>=0; i--) {
        ll cnt;
        if((a[i]+sum) % b[i] == 0) cnt = 0;
        else cnt = b[i] - ((a[i]+sum) % b[i]);
        ans += cnt;
        sum += cnt;
    }
    cout << ans << endl;
}

Measured memory_bytes: 4848
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <time.h>
#include <math.h>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
#include <iterator>
#include <sstream>
#include <string>
#include <bitset>
using namespace std;
#define FOR(I,F,N) for(int I = F; I < (int)(N); I++)
#define rep(i, n) FOR(i, 0, n)
#define FIN(V) cout<<V<<endl
#define pb push_back
#define INF (1 << 28)

template<typename T>
void remove(vector<T>& vector, unsigned int index){
vector.erase(vector.begin() + index);
}

typedef pair<int, int> P;
typedef long long ll;
typedef priority_queue<int> pq;
int StrToInt(string);
string IntToStr(int);
int dx[4] = {1, -1, 0, 0};
int dy[4] = {0, 0, 1, -1};

int main(void){
	int n;
	while(cin >> n, n){
		double ok = 100000.0;
		int ans = 0;
		rep(i,n){
			int num;
			double diff, kg, m;
			cin >> num >> m >> kg;
			m /= 100.0;
			m *= m;
			diff = 22.0-(kg/m);
			if(ok > fabs(diff)){
				ok = fabs(diff);
				ans = num;
			}
		}
		FIN(ans);
	}

	return 0;
}



int StrToInt(string s){
	stringstream ss;
	ss << s;
	int val;
	ss >> val;
	return val;
}
string IntToStr(int i){
	stringstream ss;
	ss << i;
	return ss.str();
}

Measured memory_bytes: 1232
// A.cpp
#include <bits/stdc++.h>

using namespace std;

int x;

int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }

int main()
{
    scanf("%d", &x), printf("%d\n", 360 / gcd(x, 360));
    return 0;
}

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

int main() {
  int N;
  cin >> N;
  vector<string> W(N);
  map<string, int> counter;
  bool yes = true;
  for(int i=0;i<N;i++) {
    cin >> W[i];
    counter[W[i]]++;
    if(i==0) {
    } else {
      if(W[i][0] != W[i-1][W[i-1].size()-1]) {
        yes = false;
        break;
      }
      if(counter[W[i]] == 2) {
        yes = false;
        break;
      }
    }
  }

  if(yes) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <cstring>
using namespace std;



int main(){
    char ch[101];
    scanf("%s",ch);
    
    size_t len=strlen(ch);
    
    for(size_t i=0;i!=len;++i){
        ch[i]='x';
    }
    
    cout<<ch<<endl;
    
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 10;
int n,ans[maxn],vis[maxn];
vector<int>g[maxn],v[2];
void dfs(int u = 1, int fa = 0, int t = 0)
{
	v[t].push_back(u);
	for(int i = 0; i < (int) g[u].size(); ++i) 
	{
		int v = g[u][i];
		if(v==fa) 	continue;
		dfs(v,u,1-t);
	}
}
int main()
{
	int i,u,t;
	scanf("%d",&n);
	for(i=1;i<n;++i) 
	{
		scanf("%d %d",&u,&t);
		g[u].push_back(t);
		g[t].push_back(u);
	}
	dfs();
	if(v[0].size()>v[1].size()) 	swap(v[0],v[1]);
	int sum = n/3;
	if(v[0].size() <= sum) 
	{
		for(i=1;i<=n;++i)
		{
			if(!v[0].size()) break;
			if(i % 3 == 0) 
			{
				t = v[0].back();
				ans[t] = i;
				v[0].pop_back();
				vis[i]++;
			}
		}
	}
	else
	{
		for(i=1;i<=n;++i) 
		{
			if(!v[0].size()) break;
			if(i % 3 == 1) 
			{
				t = v[0].back();
				ans[t] = i;
				v[0].pop_back();
				vis[i]++;
			}
		}
		for(i=1;i<=n;++i) 
		{
			if(!v[0].size()) break;
			if(i%3==0) 
			{
				t = v[0].back();
				ans[t] = i;
				v[0].pop_back();
				vis[i]++;
			}
		}
	}
	for(i=1;i<=n;++i) 
	{
		if(!v[1].size()) 	break;
		if(!vis[i])
		{
			t = v[1].back();
			ans[t] = i;
			v[1].pop_back();
			vis[i]++;
		}
	}
	for(i=1;i<=n;++i) 	printf("%d ",ans[i]);
}



Measured memory_bytes: 22516
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author champon
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define inf 1e18
#define ceill(a, b) (a+b-1)/b
#define ok cout << "ok" << endl;
#define sp << " " <<
ll mod = 1e9+7;
void ans(bool b, ostream& out=cout){ out << (b ? "Yes" : "No") << endl; }
void ans2(bool b, ostream& out=cout){ out << (b ? "YES" : "NO") << endl; }
template<typename T> inline bool chmax(T &a, T b){ if(a<b) a=b; return a<b; }
template<typename T> inline bool chmin(T &a, T b){ if(b<a) a=b; return b<a; }
template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val){fill((T*)array, (T*)(array+N), val);}
int dx[] = {1, 0, -1, 0, 1, -1, 1, -1};
int dy[] = {0, 1, 0, -1, 1, -1, -1, 1};

#ifndef INCLUDE_DEBUG_HPP
#define INCLUDE_DEBUG_HPP

class debug
{
public:
    template<typename T> void vdeb(T vec);
    template<typename T1, typename T2> void adeb(T1 *arr, T2 n);
    template<typename T> void mdeb(T mp);
};

#endif //INCLUDE_DEBUG_HPP

template<typename T> void debug::vdeb(T vec)
{
    cout << "#vector set debug" << endl;
    for(auto vv : vec) cout << vv << " ";
    cout << endl;
}

template<typename T1, typename T2> void debug::adeb(T1 *arr, T2 n)
{
    cout << "#adebug" << endl;
    for(int i=0; i<=n; i++) cout << arr[i] << " ";
    cout << endl;
}

template<typename T> void debug::mdeb(T mp)
{
    cout << "#map pair debug" << endl;
    for(auto const& m : mp) cout << m.first sp m.second << endl;
}
debug dbg;

class BVaried {
public:
	void solve(std::istream& in, std::ostream& out)
	{
	    string s;
	    in >> s;
	    map<char, int> mp;
	    bool res = true;
	    for(int i=0; i<s.length(); i++){
	        if(mp[s[i]]) res = false;
	        mp[s[i]] = 1;
	    }
	    if(res) out << "yes" << endl;
	    else out << "no" << endl;
	}
};


int main() {
	BVaried solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cmath>
#include <vector>
#include <queue>
#include <limits>
#include <algorithm>
#include <string>
using namespace std;

int main()
{
	int32_t X;
	cin >> X;

	int32_t i = 1;
	while (true) {
		if (i * (i + 1) / 2 >= X) {
			cout << i << endl;
			return 0;
		}
		i++;
	}

	return 0;
}

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

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


Measured memory_bytes: 4020
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(ll i = 0; i < (ll)(n); i++)
#define repi(i,a,b) for(ll i = (ll)(a); i < (ll)(b); i++)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const ll INF = 1LL << 60;

//auto mod int

// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){} //初期化指定子
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator++() {
      mint res(*this);
      return res+=1;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};

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

    mint ans=0;
    rep(k,60){
        mint x = 0;
        rep(i,n) if(a[i]>>k&1) x+=1;
        mint bsum = -x*(x-n);
        rep(i,k) bsum *= 2;
       //cout << bsum.x << endl;
        ans += bsum;
    }

    cout << ans.x << endl;

    return 0;
}

Measured memory_bytes: 2560
#!/usr/bin/env python3
import sys


def solve(N: int, M: int, p: "List[int]", S: "List[str]"):
    ok = 0
    penalty = 0

    problem_dict = {}
    for i in range(M):
        if problem_dict.get(p[i]) == None:
            problem_dict[p[i]] = [S[i]]
        else:
            problem_dict[p[i]].append(S[i])


    for key,value in problem_dict.items():
        if "AC" not in value:
            continue

        for result in value:
            if result == "WA":
                penalty += 1
            else:
                ok += 1
                break
    
    print(ok,penalty)
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    p = [int()] * (M)  # type: "List[int]"
    S = [str()] * (M)  # type: "List[str]"
    for i in range(M):
        p[i] = int(next(tokens))
        S[i] = next(tokens)
    solve(N, M, p, S)

if __name__ == '__main__':
    main()


Measured memory_bytes: 30804
import sys
import math
from collections import defaultdict
from bisect import bisect_left, bisect_right

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(input())
def LI(): return list(map(int, input().split()))
def LIR(row,col):
    if row <= 0:
        return [[] for _ in range(col)]
    elif col == 1:
        return [I() for _ in range(row)]
    else:
        read_all = [LI() for _ in range(row)]
        return map(list, zip(*read_all))

#################
 
def floor(a,b):
    return a//b

N,X,M = LI()

# 繰り返しの1回目が終わるまで
used = [-1]*M
end_index = -1
A = [X]
sum_ = 0
for i in range(N):
    if i == 0:
        sum_ += A[0]
    else:
        val = pow(A[i-1],2,M)
        A.append(val)
        if used[val] == -1:
            used[val] = i
            sum_ += val
        else:
            end_index = i
            start_val = val
            start_index = used[val]
            break

if end_index == -1:
    print(sum_)
    exit()
else:
    ans = sum_


# 繰り返し全体が終わるまで
n = floor(N-start_index,end_index-start_index)
sum_ = 0
A2 = [start_val]
for j in range(end_index-start_index):
    if j == 0:
        val2 = start_val
        sum_ += val2
    else:
        val2 = pow(A2[j-1],2,M)
        A2.append(val2)
        sum_ += val2

ans += (n-1)*sum_


# 残りの部分
sum_ = 0
A2 = [start_val]
for j in range(N-n*end_index+(n-1)*start_index):
    if j == 0:
        val2 = start_val
        sum_ += val2
    else:
        val2 = pow(A2[j-1],2,M)
        A2.append(val2)
        sum_ += val2

ans += sum_

print(ans)

Measured memory_bytes: 75648
#include <bits/stdc++.h>  // include all standard C++ libraries

using namespace std;

// Loops
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define _rrep(i,n) rrepi(i,n,0)
#define rrepi(i,a,b) for(int i=int(a)-1;i>=int(b);--i)

#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define rrep(...) _overload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)
#define each(xi, x) for (auto&& xi : x)
// Note: we can use rep(i,N) or rep(i,from,to)


// typedef
template <class T> using vec = vector<T>;
using ll = long long;
using vi   = vec<int>;
using vvi  = vec<vi>;
using vvvi = vec<vvi>;
using pii  = pair<int, int>;


// Constants

// Shorter repr for frequently used terms
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define Fi first
#define Se second


// Algorithms
#define all(x) (x).begin(), (x).end()
#define uniq(v) v.erase( unique(all(v)), v.end() )
#define perm(c) sort(all(c));for(bool c##p=1;c##p;c##p=next_permutation(all(c)))

template<class T> pair<T, size_t> max(vector<T> &x){ auto it = max_element(all(x)); return mp(*it, it-x.begin()); }
template<class T> pair<T, size_t> min(vector<T> &x){ auto it = min_element(all(x)); return mp(*it, it-x.begin()); }

template<class T> inline bool chmax(T &maxval, const T &newval) { if (maxval<newval) { maxval=newval; return 1; } return 0; }
template<class T> inline bool chmin(T &minval, const T &newval) { if (minval>newval) { minval=newval; return 1; } return 0; }

// Utilities
// Grid world utilities
int dx[4]={0,1,0,-1};
int dy[4]={1,0,-1,0};
#define inside(H,W,y,x) 0<=(x) && (x)<(W) && 0<=(y) && (y)<(H)

inline int in() {int x; cin >> x; return x;} // read int from cin
inline  ll IN() {ll x; cin >> x; return x;}  // read ll from cin



// Debug
#ifdef LOCAL
  #include "dump.hpp"
  #define debug(x) cerr << #x << ": " << x << '\n'
#else
  #define dump(...)
  #define debug(x)
#endif

// Paste snippets here!!

// 

int main(){
  cin.tie(0); ios::sync_with_stdio(false);    // Magic for faster cin
  int n; cin>>n; string s; cin>>s;
  int ret = 1;
  rep(i,1,n){
    if(s[i-1]!=s[i]) ret++;
  }
  cout << ret;
  return 0;
}


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

int main(void) {
    int N;
    cin >> N;
    int A[N];

    for (int i = 0; i < N; i++) cin >> A[i];
    
    while (1) {
      sort(A, A+N);
      int index = -1;
      for (index = 0; index < N; index++) {
        if (A[index] > 0) break;
      }
      if (index == (N-1)) break;
      for (int i = index+1; i < N; i++) {
      	A[i] %= A[index];
      }
    }
  	cout << A[N-1] << endl;

    return 0;
}

Measured memory_bytes: 640
import java.util.Scanner;

//Sum of 4 Integers
public class Main{

	public static int n;
	public static int ans;

	public static void dfs(int k, int s){
		if(n<s)return;
		if(k==4){
			if(s==n)ans++;
			return;
		}
		for(int i=0;i<10;i++){
			dfs(k+1, s+i);
		}
	}

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while(sc.hasNext()){
			n = sc.nextInt();
			ans = 0;
			dfs(0, 0);
			System.out.println(ans);
		}
	}
}

Measured memory_bytes: 12000
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
/**
*   author: j o s e m a g o
*   user: m a m i s a k i
**/
using namespace std;

/***PLANTILLA***/

using namespace __gnu_pbds; //*st.find_by_order(1);  st.order_of_key(p);
#pragma GCC optimize ("Ofast")
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(),(v).end()
#define mset(a,v) memset(a,v,sizeof(a))
#define pb push_back
#define sz(x) ((int)(x).size())
#define rsz resize
#define ln "\n"
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
typedef double dbl;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
const ld PI = 2*acos(0.0);
const int MOD = 1000000007;

string tostring(auto a){
    stringstream ss;ss<<a;string s = ss.str();
    return s;
}

/**Mi Debug**/
#define var(x) cout<<#x<<" = ";
#define db(x) cout<<#x<<" = "<<x<<"\n";
void dbvector(vector<auto>&v){
    int c = -1;
    for(auto i: v){
        c++;cout<<"["<<c<<":"<<i<<"] ";
    }cout<<"\n";
}
void dbmapa(map<auto,auto>mp){
   for(auto x : mp) cout<<"{"<<x.first<<":"<<x.second<<"} ";cout<<"\n";
}
void dbstring(string v){
    int c = -1;
    for(auto i: v){
        c++;cout<<"["<<c<<":"<<i<<"] ";
    }cout<<"\n";
}

/***********Code***************/

const int JJJ = 100100;


int dp[JJJ];
bool visited[JJJ];
int n,m;
int nvis = 0;
vector<int>grafo[JJJ];
int path[JJJ];

void BFS(int nod){

    queue<int>cola;
    cola.push(nod);
    visited[nod] = true;
    nvis++;
    while(!cola.empty()){
        int zx = cola.front();
        cola.pop();
        for(int xx: grafo[zx]){
            if(!visited[xx]){
                nvis++;
                visited[xx] = true;
                dp[xx] = dp[zx]+1;
                path[xx] = zx;
                cola.push(xx);
            }
        }


    }




}





int main(){

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

    ios_base::sync_with_stdio(0); cin.tie(0);

    cin >> n >> m;
    while(m--){
        int a,b;
        cin >> a >> b;
        grafo[a].pb(b);
        grafo[b].pb(a);
    }

    BFS(1);

    if(n != nvis){
        cout<<"No";
        return 0;
    }

    cout<<"Yes\n";
    for(int i = 2;i <= n;i++){
        cout<<path[i]<<"\n";
    }







    return 0;
}


Measured memory_bytes: 10936
n=int(input())
a,b=map(int,input().split())
p=list(map(int,input().split()))

l=[0,0,0]
for i in p:
    if i<=a:
        l[0]+=1
    elif a+1<=i<=b:
        l[1]+=1
    else:
        l[2]+=1
print(min(l))

Measured memory_bytes: 38256
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i = a; i < b; ++i)
#define all(c) c.begin(), c.end()
#define gmax(x,y) x=max(x,y)
#define gmin(x,y) x=min(x,y)
#define gadd(x,y) x=add(x,y)
#define gmul(x,y) x=mul(x,y)
using namespace std;

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

const int H=11,W=1001, inf = 1e8;
int g[H][W], rsum[H][W];

inline int query(int x,int y, int a,int b){
	if(x > a || y > b)return 0;
	return rsum[a][b] - rsum[a][y-1] - rsum[x-1][b] + rsum[x-1][y-1];
}

int k;

int main(){
	cin.tie(0);
	cout.tie(0);
	ios_base::sync_with_stdio(0);
	int h,w;
	scanf("%d %d %d",&h,&w,&k);
	rep(i,1,h+1){
		rep(j,1,w+1){
			char c;
			scanf(" %c",&c);
			g[i][j] = c - '0';
			rsum[i][j] += g[i][j] + rsum[i-1][j] + rsum[i][j-1] - rsum[i-1][j-1];
		}
	}
	int ans = inf;
	rep(msk,0,1 << (h-1)){
		int cur = 0;		
		vector<int> vals;
		vals.push_back(1);
		rep(i,0,h-1)if((msk >> i)&1)vals.push_back(i+2);
		vals.push_back(h+1);
		vector<int> sm(vals.size()-1, 0);
		bool valid = 1;
		int cnt = __builtin_popcount(msk);
		rep(i,1,w+1){
			bool kill = 0;
			rep(j,0,vals.size()-1){
				int nxt = query(vals[j],i,vals[j+1]-1,i);
				if(nxt > k){
					valid = 0;
					break;
				}
				sm[j] += nxt;
				if(sm[j] > k)kill = 1;
			}
			if(kill){
				++cnt;
				rep(j,0,sm.size()){
					sm[j] = query(vals[j],i,vals[j+1]-1,i);
				}
			}
		}
		if(valid){
			gmin(ans,cnt);
		}
	}
	cout << ans << '\n';
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define rep(i, s, e) for (int i = s; i < e; ++i)
#define sort_(a) stable_sort(a.begin(), a.end())
#define rsort(a) stable_sort(a.rbegin(), a.rend())
#define sum(a) accumulate(a.begin(), a.end(), 0LL)
#define join(a, d) accumulate(a.begin() + 1, a.end(), a[0], [](string s, string t) {return s + d + t;})
#define all(a) a.begin(), a.end()
#define __lcm(a, b) std::__detail::__lcm(a, b)
typedef long long ll;
const long mod = 1e9 + 7;

int main(void) {
#ifdef DEBUG
  freopen("input.txt", "r", stdin);
#endif

  ios_base::sync_with_stdio(false);
  cin.tie(0);

  int N, K;
  cin >> N >> K;
  vector<long> H(N);
  rep(i, 0, N) {
    cin >> H[i];
  }
  sort_(H);
  long ans = 1000000000;
  rep(i, 0, N - K + 1) {
    ans = min(ans, H[i+K-1] - H[i]);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1408
#include<bits/stdc++.h>
#include<cctype>
using namespace std;
#define rep(i,n) for (int i=0;i<(n);i++)
#define all(v) (v).begin(),(v).end()
typedef long long int ll;
#define pi 3.1415926535897932384
#define E9 1000000000
#define eps 1e-4
#define pii pair<int,int>


int main(){
  string s; cin >> s;
  int n = s.size();
  int l = 0, r = n-1;
  int cnt = 0;
  while (l<r) {
    if (s[l]==s[r]) {
      l++, r--;
    }
    else {
      if (s[l]=='x') {
        l++, cnt++;
      }
      else if (s[r]=='x'){
        r--, cnt++;
      }
      else {
        cnt = -1;
        break;
      }
    }
  }
  cout << cnt << endl;


  // cout << fixed << setprecision(10);
  
  return 0;
}


Measured memory_bytes: 3732
#include <bits/stdc++.h>
using namespace std;
#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define in(x,y,h,w) x >= 0 && x < h && y >= 0 && y < w

#define int long long
//typedef    long long          ll;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      P;

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); }
 
const int INF=1e+18;
const double EPS=1e-9;
const int MOD=1000000007;

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

signed main(){
	char c;
	cin >> c;
	if(c == 'A') cout << 'T' << endl;
	else if(c == 'T') cout << 'A' << endl;
	else if(c == 'G') cout << 'C' << endl;
	else cout << 'G' << endl;
	return 0;
}

Measured memory_bytes: 256
n=int(input())
def yakusuu(n):
  num=0
  if n%2==1:
    for i in range(1,n+1):
      if n%i==0:
        num=num+1
  return num 

ans=0
for i in range(n+1):
  if yakusuu(i)==8:
    ans=ans+1
print(ans)
  
      

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

int main() {
  //string S;
  int X;
  cin >> X;
  
  cout << 2*X*3.14 << endl; 
}

/* answer
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main() {
  int a, b, c;
  cin >> a >> b >> c;
  swap(a,b);
  swap(a,c);
  printf("%d %d %d\n", a, b, c);
  return 0;
}
*/


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

int main(){
  string T;cin>>T;
  string ans = T;
  for(int i=0;i<ans.length()-1;++i) {
    string s = ans.substr(i,2);
    if (s=="P?") {
      ans[i+1]='D';
    }
    else if(s=="?D") {
      ans[i]='P';
    }
    else if (s=="??") {
      ans[i]='P';
      ans[i+1]='D';
    }
    //cerr<<i<<":"<<s<<":"<<ans<<endl;
  }
  for(int i=0;i<ans.length();++i) {
    if (ans[i]=='?') ans[i]='D';
  }
  cout << ans << endl;
}



Measured memory_bytes: 3924
#include<bits/stdc++.h>
	using namespace std;
	typedef long long ll;
	#define PI 3.14159265358979
	#define EPS 1e-8
	#define mod  1000000007
	#define fi first
	#define se second
	#define mp make_pair
	#define pb push_back
 
	const ll INF=1e18;	
	const int N=1e5+50;
 
	
	
	int main()
	{
		ios_base::sync_with_stdio(false);
		cin.tie(NULL);cout.tie(0);
		
		ll n,k;
		cin>>n>>k;
		vector<ll> v(n);
		for(ll i=0;i<n;i++)
		{
			cin>>v[i];
		}
		
		vector<vector<ll> > dp(k+1,vector<ll> (n+1,0));
		for(int i=0;i<=k;i++)
		{
			dp[i][0]=1;
		}
		
		for(int j=1;j<=n;j++)
		{
			for(int i=0;i<=k;i++)
			{
				dp[i][j]=dp[i][j-1];
				if((i-v[j-1])>0)
				{
					dp[i][j]-=dp[i-v[j-1]-1][j-1];
				}
				dp[i][j]%=mod;
				dp[i][j]+=mod;
				dp[i][j]%=mod;
				if(i>0)
					dp[i][j]+=dp[i-1][j];
				
				dp[i][j]%=mod;
				
			}
		}
		ll ans=dp[k][n];
		if(k)
			ans-=dp[k-1][n];
		ans%=mod;
		ans+=mod;
		ans%=mod;
		cout<<ans;
		
	}


Measured memory_bytes: 85276
import sys
from collections import Counter
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7



def main():
    N = int(readline())
    D = list(map(int, readline().split()))
    M = int(readline())
    T = list(map(int, readline().split()))
    count_D = Counter(D)
    count_T = Counter(T)
    ans = 'YES'
    for key, value in count_T.items():
        if count_D[key]<value:
            ans = 'NO'
    print(ans)
if __name__ == '__main__':
    main()

Measured memory_bytes: 57380
#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

//#define int long long
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return true; } return false; }

using Weight = int;
using Flow = int;
struct Edge {
	int s, d; Weight w; Flow c;
	Edge() {};
	Edge(int s, int d, Weight w = 1) : s(s), d(d), w(w), c(w) {};
};
bool operator<(const Edge &e1, const Edge &e2) { return e1.w < e2.w; }
bool operator>(const Edge &e1, const Edge &e2) { return e2 < e1; }
inline ostream &operator<<(ostream &os, const Edge &e) { return (os << '(' << e.s << ", " << e.d << ", " << e.w << ')'); }

using Edges = vector<Edge>;
using Graph = vector<Edges>;
using Array = vector<Weight>;
using Matrix = vector<Array>;

void addArc(Graph &g, int s, int d, Weight w = 1) {
	g[s].emplace_back(s, d, w);
}
void addEdge(Graph &g, int a, int b, Weight w = 1) {
	addArc(g, a, b, w);
	addArc(g, b, a, w);
}



//??????????????????????????? O(V^2 2^V)
//????????°????????????????????????????°?????????¨???1?????????????????????
int chinesePostman(const Graph &g) {
	static const int MAX_V = 17;
	Weight total = 0;
	int n = g.size();
	vector<int> odds;
	static Weight dist[MAX_V][MAX_V];
	for (int i = 0; i < n; i++) {
		fill(dist[i], dist[i] + n, INF);
		for (auto &e : g[i]) {
			total += e.w;
			dist[e.s][e.d] = min(dist[e.s][e.d], e.w);
		}
		if (g[i].size() & 1)
			odds.push_back(i);
	}
	for (int k = 0; k < n; k++)
		for (int i = 0; i < n; i++)
			for (int j = 0; j < n; j++)
				dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
	static Weight dp[1 << MAX_V];
	int k = odds.size();
	fill(dp, dp + (1 << k), INF);
	dp[0] = 0;
	for (int mask = 0; mask < 1 << k; mask++)
		for (int i = 0; i < k; i++)
			if (~mask >> i & 1)
				for (int j = 0; j < i; j++)
					if (~mask >> j & 1)
						dp[mask | 1 << i | 1 << j] = min(
							dp[mask | 1 << i | 1 << j],
							dp[mask] + dist[odds[i]][odds[j]]
						);
	return total / 2 + dp[(1 << k) - 1];
}

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int V, E; cin >> V >> E;
	Graph g(V);
	rep(i, 0, E) {
		int s, t, d; cin >> s >> t >> d;
		addEdge(g, s, t, d);
	}
	cout << chinesePostman(g) << endl;
	return 0;
}

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

const ll mod = 1000000007;

int main() {
  int n;
  cin >> n;

  ll ans = 1;
  int color[3]{};
  for (int i = 0; i < n; i++) {
    int a = 0;
    cin >> a;
    ll same = 0;
    for (int j = 0; j < 3; j++) {
      if (color[j] == a) {
        if (same == 0) color[j]++;
        same++;
      }
    }
    ans *= same;
    ans %= mod;
    if (ans == 0) break;
  }
  cout << ans << endl;

  return 0;
}

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

#define ASC(vec) vec.begin(), vec.end()		// 昇順ソート 例：sort(ASC(vec));
#define DESC(vec) vec.rbegin(), vec.rend()	// 降順ソート 例:sort(DESC(vec));
#define rep(i, n) for(int i = 0; i < (n); i++)
#define Rep(i, n) for(int i = 1; i < n; i++)

const int mod = 1000000007;
const int inf = (1 << 21);
const long long INF = 1LL << 60;

using ii = pair<int, int>;
using ll = long long;
using vi = vector<int>;
using vd = vector<double>;
using vb = vector<bool>;
using vl = vector<ll>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;
using vvb = vector<vector<bool>>;
using vii = vector<pair<int, int>>;

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

ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }
ll LCM(ll a, ll b) { return (a * b) / GCD(a, b); }
int round_int(int a, int b) { return (a + (b - 1)) / b; }

constexpr array<int, 9> dx = { 0, 1, 0, -1, -1, 1, 1, -1, 0 };
constexpr array<int, 9> dy = { 1, 0, -1, 0, 1, 1, -1, -1, 0 };

// ──────────────────────────────────────────────────────────────────

int main() {
	int cnt = 1;
	while (true) {
		int n;
		cin >> n;

		if (!n) break;

		cout << "Case " << cnt << ": " << n << endl;
		cnt++;
	}
}


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

int main(){
  int R,G,B,N,n,cnt;
  cin>>R>>G>>B>>N;
  while(N>=0){
    n=N;
    while(n>=0){
      if(n%G==0){
        cnt++;
      }
      n-=B;
    }
    N-=R;
  }
  cout<<cnt<<endl;
}

Measured memory_bytes: 256
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    n=int(input())
    l=list(map(int,input().split()))
    kisu=0
    ni1=0
    ni2=0
    for i in l:
        if i%2==1:
            kisu+=1
        else:
            if i%4==0:
                ni2+=1
            else:
                ni1+=1
    if ni1==0:
        if kisu<=ni2+1:
            print('Yes')
        else:
            print('No')
    else:
        if kisu<=ni2:
            print('Yes')
        else:
            print('No')
resolve()

Measured memory_bytes: 63344