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

using namespace std;

#define M 1000000007
#define pb push_back
#define f first
#define s second
#define rep(i, st, ed) for(int i=st; i<ed; i++)
#define repn(i, st, ed) for(int i=st; i<=ed; i++)


typedef long long ll;
typedef unsigned long long int llt;

const int N = 1e5 + 10;

vector<int> g[N];
bool viss[N];
int vis[N];

void dfs(int curr, int par)
{
  for(auto x: g[curr])
    if(x != par)
      dfs(x, curr);
}

void dfs1(int curr, int par)
{
  viss[curr] = 1;
  for(auto x: g[curr])
    if(!viss[x])
      dfs1(x, curr);
}

void dfs2(int curr, int par, int num)
{
  vis[curr] = num;
  for(auto x: g[curr])
    if(vis[x] == 0)
      dfs2(x, curr, num);
}

ll fxor(ll n)
{
  if(n < 0) return 0;
  if(n % 4 == 3) return 0;
  else if(n % 4 == 0) return n;
  else if(n % 4 == 1) return n^(n-1);
  else if(n%4 == 2) return n^(n-1)^(n-2);
}

llt ppow(llt x, llt y)
{
  llt res = 1;
  while(y > 0){
    if(y&1)
      res = (res * x)%M;
    y = y >> 1;
    x = (x * x)%M;
  }
  return res;
}

llt factdp[N];
llt fact(llt x)
{
  if(x == 0) return 1;
  if(x == 1) return 1;
  if(factdp[x] != -1) return factdp[x];
  return factdp[x] = (x*fact(x-1))%M;
}

string ans ="";
void convert10tob(llt N, int b)
{
     if (N == 0)
        return;
     int x = N % b;
     N /= b;
     if (x < 0)
        N += 1;
     convert10tob(N, b);
     ans += to_string(x);
     return;
}

llt convertstrtob(string a, int b)
{
  llt aa = 0;
  llt mul = 1;
  for(int i=a.length()-1; i>=0; i--)
  {
    int curr = a[i] - '0';
    aa += (curr * mul);
    mul *= b;
  }
  return aa;
}

ll arr[N];

int main()
{
  ll n,x;
  cin>>n>>x;
  rep(i,0,n)
  {
    cin>>arr[i];
  }
  arr[n] = 0;
  ll total = 0;
  rep(i, 0, n)
  {
    if(arr[i] + arr[i+1] > x)
    {
      total += (arr[i]+arr[i+1] - x);
      arr[i+1] -= (arr[i]+arr[i+1] - x);
      if(arr[i+1] < 0) arr[i+1] = 0;
    }
  }
  cout<<total<<endl;
  return 0;
}


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

int main()
{
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	int n, d; cin >> n >> d;
	long long int sum = d * 2 + 1;
	sum = ceil((double)n / sum);
	cout << sum << endl;
	return 0;
}

Measured memory_bytes: 3744
n,m,c = map(int, input().split())

B = [int(s) for s in input().split()]

count = 0
for _ in range(n):
    A = [ int(s) for s in input().split() ]
    
    f = 0
    for a,b in zip(A,B):
#        print((a,b))
        f += a*b

#    print(f)
    if f+c>0:
        count += 1

print(count)

Measured memory_bytes: 3064
from sys import stdin
from itertools import repeat
def main():
    n, k = map(int, stdin.readline().split())
    a = map(int, stdin.readline().split(), repeat(10, n))
    for i in xrange(n):
        a[i] -= 1
    ans = 0
    if a[0]:
        a[0] = 0
        ans += 1
    xt = [0] * n
    last = [None] * n
    for i in xrange(1, n):
        xt[i] = last[a[i]]
        last[a[i]] = i
    p = [0]
    push = p.append
    pop = p.pop
    d = [None] * n
    while p:
        x = pop()
        if d[x] is None:
            d[x] = -1
            push(x)
            j = last[x]
            while j is not None:
                push(j)
                j = xt[j]
	elif d[x] == -1:
            d[x] = 1
            j = last[x]
            while j is not None:
		if x and d[j] >= k:
                    ans += 1
                elif d[x] < d[j] + 1:
                    d[x] = d[j] + 1
                j = xt[j]
    print ans
main()


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

int main()
{
  int a, b;
  cin >> a >> b;
  string sa = "", sb = "";
  for (int i = 0; i < b; i++)
  {
    sa = sa + to_string(a);
  }
  for (int i = 0; i < a; i++)
  {
    sb = sb + to_string(b);
  }
  cout << min(sa, sb) << endl;
}

Measured memory_bytes: 256
/*
                                        //     //     //\\\\\\\\\
                                        \\    //      \\        \\
                                        //   //       //         \\
                                        \\  //        \\          \\
                                        // //         //           \\
                                        \\//          \\            \\       
                                        //\\          //            //
                                        \\ \\         \\           //
                                        //  \\        //          //
                                        \\   \\       \\         //
                                        //    \\      //        //
                                        \\     \\     \\/////////
*/

#include <bits/stdc++.h>
//#include <boost/math/common_factor.hpp>
//#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
//using namespace boost::multiprecision;
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define vint vector <int>
#define vll vector <long long int>
#define endl cout<<'\n'
#define fre(i,l,n) for(long long int i=l;i<n;++i)
#define fr(i,l,n) for(long long int i=l;i<=n;i++)
#define rfre(i,n,l) for(long long int i=n-1;i>=l;i--)
#define rfr(i,n,l) for(long long int i=n;i>=l;--i)
#define tab '\t'
#define debug cout<<'*';
#define s(a) cin>>a
#define p(a) cout<<a
typedef long long int ll;
typedef unsigned long long int ull;
typedef pair<int,int> pii;
typedef pair<long long int,long long int> pll;
typedef pair<int,pair<int,int> > tii;
typedef vector<int> vec;
typedef vector<long long> vecll;
typedef vector<pair<int,int> > vec_pii;
typedef vector<pair<long long int,long long int> > vec_pll;
typedef vector<vector<int> > vvi;
typedef vector<vector<ll> > vvll;
typedef vector<vector<pair<int,int> > > vvpii;
typedef vector<vector<pair<ll,ll> > > vvpll;
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define mod 1000000007
#define Pi 3.14159265358979
#define gcd(a,b) __gcd(a,b)
#define sf(n) scanf("%lld",&(n))
#define pf(n) printf("%lld\n",(n))
#define min3(a,b,c) (min((c),min((a),(b))))
#define max3(a,b,c) (max((a),max((b),(c))))
#define w(t) while(t--)
#define flt(a) cout<<fixed<<setprecision(a)
#define cntSetBits(n) __builtin_popcountll(n)
/*****************************
*****************************/



void solve()
{
    ll x,y;
    s(x);s(y);
    if(y%2)
    {
        p("No");endl;
    }
    else
    {
        ll val2 = y - 2*x;
        val2 /= 2;
        ll val1 = x - val2;
        if(val1 >= 0 && val2 >= 0 && val1*2 + val2*4 == y)
        {
            p("Yes");endl;
        }
        else
        {
            p("No");endl;
        }
    }
}



int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    ll t=1;
    // s(t);
    w(t)
    {
        solve();
    }
    return 0;
}









Measured memory_bytes: 3584
#include<bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define int long long
#define vec(a,n) vector<int> (a)((n))
#define Vec(a,n) vector<string> (a)((n))
#define twovec(a,n,m) vector<vector<int>> a(n,vector<int>(m,0))
#define Twovec(a,n,m) vector<vector<double>> a(n,vector<double>(m,0))
#define P pair<int,int>
#define All(a) (a).begin(),(a).end()
#define Sort(a) sort(All(a))
#define Reverse(a) reverse(All(a))
#define PQ(n) priority_queue<P,vector<P>,greater<P>> (n)
#define pq(n) priority_queue<int> (n)
#define Lower(a,t) lower_bound(All(a),t)
using namespace std;
int max_int = 1000000007;
void Debug(auto a);
struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

void yari(vector<int> &a,int n){
    n += 1;
    REP(i,a.size()){
        if(a[i] <= 0){
            n ++;
        }
        a[i]--;
    }
}


signed main(){
    string s;
    cin >> s;
    int a=0,b=0;
    int n = s.size();
    REP(i,n){
        if(s[i] == '1'){
            if(i%2==0){
                a++;
            }
            else{
                b++;
            }
        }
    }
    int ans;
    if(n%2==0){
        n /= 2;
        int x = n - a + b;
        int y = n -b + a;
        ans = min(x,y);
    }
    else{
        n /= 2;
        int x = (n+1) - a + b;
        int y = n-b+a;
        ans = min(x,y);
    }

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



void Debug(auto a){
    cout << "{ ";
    for(auto b: a){
        cout << b << " ";
    }
    cout << "}" << endl;
}


Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <stack>
#include <cmath>
#include <iomanip>
#include <algorithm>
using namespace std;

int main(){
    int x, y;
    cin >> x >> y;
    cout << x + y/2 << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<cmath>
#include<tuple>

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

using namespace std;

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


template<typename T>
void dump(T *arr, int h, int w){
	rep(i,h){
		rep(j,w) cout << arr[i][j] << "\t";
		cout << "\n";
	}
}

template<typename T>
void dump(T *arr, int a){
	rep(i,a) cout << arr[i] << "\t";
	cout << "\n";
}

template<typename T>
void dump(vector<T> arr, int a){
	rep(i,a) cout << arr[i] << "\t";
	cout << "\n";
}

const int INF = 1e9;
const int MOD = 1e9+7;

bool compare(P a, P b){
	if(a.second != b.second) return a.second > b.second;
	else	return a.first > b.first;
}

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

ll pow_kai(ll a, int n){//aのn乗を計算します。
  ll x = 1;
  while(n > 0){//全てのbitが捨てられるまで。
    if(n&1){//1番右のbitが1のとき。
      x = x*a;
    }
    a = a*a;
    n >>= 1;//bit全体を右に1つシフトして一番右を捨てる。
  }
  return x;
}

struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2
	vector<int> num_node; //そのノードの所属するグループのノード数

    UnionFind(int N) : par(N), num_node(N){ //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) {
			par[i] = i;
			num_node[i] = 1;
		}
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
		num_node[ry] += num_node[rx];
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }

	int nodes(int x) {
		return num_node[root(x)];
	}
};

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

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

    UnionFind tree(n);
	int num_friend[n]={}, num_block[n]={}, t1, t2;
	rep(i, m){
		cin >> t1 >> t2;
		num_friend[t1-1]++;
		num_friend[t2-1]++;
		tree.unite(t1-1, t2-1);
	}
	rep(i, k){
		cin >> t1 >> t2;
		if(!tree.same(t1-1, t2-1)) continue;
		num_block[t1-1]++;
		num_block[t2-1]++;
	}

//	dump(num_friend, n);
//	dump(num_block, n);


	rep(i, n){
		cout << tree.nodes(i) - 1 - num_friend[i] - num_block[i] << " ";
	}
	cout << "\n";
		
	return 0;
}


Measured memory_bytes: 2816
#include <iostream>
#include<cstdlib>
#include<queue>
#include<set>
#include<vector>
#include<string>
#include<algorithm>
#include<sstream>
#include<cmath>
#include<stack>
#include<map>
#include<cstdio>
using namespace std;
#define rep(i,a) for(int i=0;i<a;i++)
#define mp make_pair
#define pb push_back
#define P pair<int,int>
#define ll __int64

int n;
string s;
int main(){
cin>>n;
bool ok=1;
int cnt=0;
rep(i,n){
	cin>>s;
	if(s=="A"){
		cnt++;
	}
	else{
		if(cnt==0)ok=0;
		cnt--;
	}
}
if(cnt!=0)ok=0;
if(ok)cout<<"YES"<<endl;
else cout<<"NO"<<endl;
	return 0;
}


Measured memory_bytes: 3148
n,m = map(int,raw_input().split())

stomid = [0]*n
midtog = [0]*n

for i in range(m):
	f,t = map(int,raw_input().split())
	if f == 1:
		stomid[t-1] = 1

	elif t == n:
		midtog[f-1] = 1 

for i in range(n):
	if stomid[i] == midtog[i] == 1 :
		print 'POSSIBLE'
		quit()

print 'IMPOSSIBLE'

Measured memory_bytes: 12136
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repr(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define FORR(i, m, n) for (int i = (m); i >= (n); --i)
#define equals(a, b) (fabs((a) - (b)) < EPS)
using namespace std;
typedef long long ll;
typedef long double ld;
const ll mod = 1000000007;
const ll mod2 = 998244353;
const int inf = 1e9 + 10;
const ll INF = 1e18;
const ld EPS = 1e-10;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const int MAX = 1e6;

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

  rep(i, MAX) {
    int resa = i * 0.08, resb = i * 0.1;
    if (resa == a && resb == b) {
      cout << i << endl;
      return 0;
    }
  }
  cout << -1 << endl;



  
  return 0;
}

Measured memory_bytes: 256
//
// Created by kota_ on 2020/01/06.
//

#include <stdio.h>
#include <stdlib.h>

void try_to_print(int n, int *A, int i, int index, char *prefix){
    if(1 <= index && index <= n){
        printf("%s = %d, ", prefix, A[index - 1]);
    }
}


int main(){
    int *A;
    int i, index,  H;
    scanf("%d", &H);
    A = malloc(sizeof(int) * H);
    for(i = 0; i < H; i++){
        scanf("%d", &A[i]);
    }
    for(i = 1; i <= H; i++){
        printf("node %d: key = %d, ", i, A[i - 1]);
        try_to_print(H, A, i, i / 2, "parent key");
        try_to_print(H, A, i, 2 * i, "left key");
        try_to_print(H, A, i, 2 * i + 1, "right key");
        printf("\n");
    }
    free(A);
    return 0;
}



Measured memory_bytes: 2112
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
typedef long long int ll;
#define pii pair<ll,ll>

vector<pii> v;
bool cmp(pii &a,pii &b){
	if(a.second!=b.second) {
		return a.second<b.second;
	}
	else {
		return a.first<b.first;
	}
}
int main()
{

	ios_base:: sync_with_stdio(false); cin.tie(0);
	int n; cin>>n;
	v.resize(n);
	for(int i=0; i<n; i++) {
		cin>>v[i].first>>v[i].second;
	}
	sort(v.begin(),v.end(),cmp);
/*
        for(int i=0; i<n; i++) {
                cout<<v[i].first<<" "<<v[i].second<<endl;
        }
 */
	ll cur=0;
	int cnt=0;
	for(int i=0; i<n; i++) {
		if(cur+v[i].first<=v[i].second) {
			cnt++;
			cur+=v[i].first;
		}

	}
	if(cnt==n) {
		cout<<"Yes"<<endl;
	}
	else{
		cout<<"No"<<endl;
	}
	return 0;
}


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

int main(){
  int N, T, prof = 0, count = 1, M = 0, m;
  cin >> N >> T;
  vector<int> A(N);
  for (int i = 0; i < N; i++){
    cin >> A[i];
  }
  m = A[0];
  for (int i = 1; i < N; i++){
    m = min(m, A[i]);
    M = A[i] - m;
    //cout << m << " " << M << endl;
    if (prof == M){
      count += 1;
    }
    else if (prof < M){
      prof = M;
      count = 1;
    }
  }
  cout << count << endl;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define lowbit(x) x&(-x)
#define iter set<int>::iterator

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

const int N = 1e5+5;
const ll mod = 1e9+7;
const int INF = 0x3f3f3f3f;
const int dir[4][2]={-1,0,1,0,0,-1,0,1};
const int exdir[4][2]={1,1,1,-1,-1,1,-1,-1};

ll qpow(ll x,ll y){
    ll ans=1,t=x;
    while(y>0){
        if(y&1)ans*=t,ans%=mod;
        t*=t,t%=mod;
        y>>=1;
    }
    return ans%mod;
}

void solve(){
    int n,k,s;cin>>n>>k>>s;
    int i=0;
    while(i<n){
        if(i<k)cout<<s<<' ';
        else if(s!=1)cout<<s-1<<' ';
        else cout<<2<<' ';
        i++;
    }
}

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    //int t;cin>>t;
    //while(t--)solve(),cout<<'\n';
    solve();
    return 0;
}


Measured memory_bytes: 1280
import java.util.Scanner;

//Crossing Black Ice
public class Main{

	int w, h, max;
	int[][] move = {{-1,0},{0,1},{1,0},{0,-1}};
	int[][] a;
	boolean[][] u;
	
	void dfs(int i, int j, int c){
		max = Math.max(max, c);
		for(int k=0;k<4;k++){
			int ni = i+move[k][0], nj = j+move[k][1];
			if(0<=ni&&ni<h&&0<=nj&&nj<w&&!u[ni][nj]&&a[ni][nj]==1){
				u[ni][nj] = true; dfs(ni, nj, c+1); u[ni][nj] = false;
			}
		}
	}
	
	void run(){
		Scanner sc = new Scanner(System.in);
		for(;;){
			w = sc.nextInt(); h = sc.nextInt();
			if((w|h)==0)break;
			a = new int[h][w];
			for(int i=0;i<h;i++)for(int j=0;j<w;j++)a[i][j]=sc.nextInt();
			u = new boolean[h][w];
			max = 0;
			for(int i=0;i<h;i++)for(int j=0;j<w;j++){
				if(a[i][j]==0)continue;
				u[i][j] = true; dfs(i, j, 1); u[i][j] = false;
			}
			System.out.println(max);
		}
	}
	
	public static void main(String[] args) {
		new Main().run();
	}
}

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

#ifdef DEBUG
#define PRINT(x)\
    cout<<"func "<<__func__<<": line "<<__LINE__<<": "<<#x<<" = "<<(x)<<endl;
#define PRINTA(a,first,last)\
    cout<<"func "<<__func__<<": line "<<__LINE__<<": "<<#a<<"["<<(first)<<", "<<(last)<<")"<<endl;\
    for (int _i=(first);_i<(last);++_i){cout<<#a<<"["<<_i<<"] = "<<(a)[_i]<<endl;}
#define PRINTI(a,i)\
    cout<<"func "<<__func__<<": line "<<__LINE__<<": "<<#a<<"["<<#i<<"] = "<<#a<<"["<<(i)<<"] = "<<(a)[i]<<endl;
#define dprintf(...) printf(__VA_ARGS__)
#else
#define PRINT(x)
#define PRINTA(a,first,last)
#define PRINTI(a,i)
#define dprintf(...)
#endif

#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);--i)
#define REP(i,n) for (int i=0;i<(n);++i)
#define RREP(i,n) for (int i=(n)-1;i>=0;--i)
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define MOD 1000000007
//#define MOD 998244353

using namespace std;

using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;

template <class T, class U> void amax(T& x, U y) {if (x < y) x = y;}
template <class T, class U> void amin(T& x, U y) {if (x > y) x = y;}

template <class T, class U>
std::ostream& operator<<(std::ostream &os, const std::pair<T, U> &p) {
	os << "(" << p.first << ", " << p.second << ")";
	return os;
}
 
template <class T>
std::ostream& operator<<(std::ostream &os, const std::vector<T> &v) {
    os << "[";
	for (int i = 0; i < v.size(); ++i) {
        if (i) {
            if (i % 5 == 0) {
                os << ",\n ";
            } else {
                os << ", ";
            }
        }
		os << v[i];
	}
	os << "]";
	return os;
}

template <class T>
using vec2 = vector<vector<T>>;

template <class T>
using vec3 = vector<vector<vector<T>>>;

template <class T>
vec2<T> vec2_init(int n0, int n1, T x = 0) {
    return vec2<T>(n0, vector<T>(n1, x));
}

template <class T>
vec3<T> vec3_init(int n0, int n1, int n2, T x = 0) {
    return vec3<T>(n0, vec2_init(n1, n2, x));
}

/*
 *           U P
 *           - x
 *            ^
 *            |
 * LEFT -y <--+--> +y RIGHT
 *            |
 *            v
 *           + x
 *         D O W N
 */

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

enum {
    DOWN,
    RIGHT,
    UP,
    LEFT,
};

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

    int D, T, S;
    cin >> D >> T >> S;
    cout << (D <= T * S? "Yes" : "No") << endl;
    return 0;
}



Measured memory_bytes: 3648
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		while(sc.hasNext()){
			String str=sc.next();
			char[] cStr=str.toCharArray();
			int[] iStr=new int[cStr.length];
			for(int i=0;i<cStr.length;i++){
				if(cStr[i]=='I'){
					iStr[i]=1;
				}else if(cStr[i]=='V'){
					iStr[i]=5;
				}else if(cStr[i]=='X'){
					iStr[i]=10;
				}else if(cStr[i]=='L'){
					iStr[i]=50;
				}else if(cStr[i]=='C'){
					iStr[i]=100;
				}else if(cStr[i]=='D'){
					iStr[i]=500;
				}else if(cStr[i]=='M'){
					iStr[i]=1000;
				}
			}
			int sum=iStr[iStr.length-1];
			for(int i=iStr.length-2;i>=0;i--){
				if(iStr[i]<iStr[i+1]){
					sum-=iStr[i];
				}else{
					sum+=iStr[i];
				}
			}
			System.out.println(sum);
		}
	}
}

Measured memory_bytes: 17156
import java.util.*;
import java.io.*;
import java.awt.geom.*;
import java.math.*;

public class Main {

	static final Scanner in = new Scanner(System.in);
	static final PrintWriter out = new PrintWriter(System.out,false);

	public static final double EPS = 1E-10;
	public static boolean epsEquals(double a, double b) { return Math.abs(a-b) < EPS; };

	static void solve() {
		out.println(isOrthogonal(
			new Vector(in.nextDouble(),in.nextDouble(),in.nextDouble(),in.nextDouble()),
			new Vector(in.nextDouble(),in.nextDouble(),in.nextDouble(),in.nextDouble())) ? "YES" : "NO");
	}

	static boolean isOrthogonal (Vector a, Vector b) { return epsEquals(Vector.dot(a,b),0.0); }

	public static void main(String[] args) {
		long start = System.currentTimeMillis();

		while(in.hasNext()) solve();
		out.flush();

		long end = System.currentTimeMillis();
		//trace(end-start + "ms");
		in.close();
		out.close();
	}

	static class Point implements Comparable, Cloneable {

		private double x, y;
		public Point(double x, double y) {
			this.x = x; this.y = y;
		}

		public double getX() {
			return this.x;
		}
		public double getY() {
			return this.y;
		}

		public void set(double x, double y) {
			this.x = x; this.y = y;
		}

		public int compareTo(Object another) {
			Point p = (Point)another;
			if (!epsEquals(this.x,p.x)) return this.x < p.x ? -1 : 1;
			if (!epsEquals(this.y,p.y)) return this.y < p.y ? -1 : 1;
			return 0;
		}

		public boolean equals(Point p) {
			return epsEquals(this.x,p.x) && epsEquals(this.y,p.y);
		}

		public Point clone() {
			return new Point(this.x, this.y);
		}

		public String toString() {
			return "("+x+","+y+")";
		}
	}

	static class Vector implements Comparable {

		private double x, y;
		public Vector(double x, double y) {
			this.x = x; this.y = y;
		}
		public Vector(Point target, Point source) {
			this.x = target.getX() - source.getX();
			this.y = target.getY() - source.getY();
		}
		public Vector(double tx, double ty, double sx, double sy) {
			this.x = tx - sx;
			this.y = ty - sy;
		}

		public static double dot(Vector a, Vector b) { return a.getX()*b.getX() + a.getY()*b.getY(); }
		public static double cross(Vector a, Vector b) { return a.getX()*b.getY() - a.getY()*b.getX(); }

		public double getX() {
			return this.x;
		}
		public double getY() {
			return this.y;
		}

		public void set(double x, double y) {
			this.x = x; this.y = y;
		}

		public int compareTo(Object other) {
			Vector p = (Vector)other;
			if (!epsEquals(this.x,p.x)) return this.x < p.x ? -1 : 1;
			if (!epsEquals(this.y,p.y)) return this.y < p.y ? -1 : 1;
			return 0;
		}

		public boolean equals(Vector p) {
			return epsEquals(this.x,p.x) && epsEquals(this.y,p.y);
		}

		public String toString() {
			return "("+x+","+y+")";
		}
	}

	static void trace(Object... o) { System.out.println(Arrays.deepToString(o));}
}

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

using namespace std;

#pragma GCC optimization("O3")
typedef long long ll;
typedef long double ld;
const int mod = 1e9 + 7;
#define INF 1000000000

#define start_routine() int begtime = clock();
#define end_routine()                                                       \
  int endtime = clock();                                                    \
  cerr << "\nTime elapsed: " << (endtime - begtime) * 1000 / CLOCKS_PER_SEC \
       << " ms\n\n";
#define ff first
#define ss second
#define pii pair<int, int>
#define pll pair<ll, ll>
#define mll map<ll, ll>
#define sz(a) a.size()
#define all(a) a.begin(), a.end()

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
#ifndef ONLINE_JUDGE
  start_routine();
  // freopen("in.txt", "r", stdin);
  // freopen("out.txt", "w", stdout);
#endif

  ll n;
  cin >> n;
  if (n % 2 == 0)
    cout << "0.5000000000"
         << "\n ";
  else {
    ll a = n / 2 + 1;
    double ans = (double)a / n;
    cout << std::setprecision(9) << ans << '\n';
  }

#ifndef ONLINE_JUDGE
  end_routine();
#endif
  return 0;
}

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

#define ll long long
#define ld long double
#define x first
#define y second
#define pb push_back
#define mp make_pair
#define ii pair < int, int >
#define vi vector < int > 
#define vii vector < pair < int, int > >
#define vvi vector < vector < int > >
#define all(a) (a).begin(), (a).end()

using namespace std;
using namespace __gnu_pbds;

typedef tree< int, null_type, less< int >, rb_tree_tag, tree_order_statistics_node_update> ost;
// name.find_by_order( x ) or name.order_of_key( x )

int grundy( int n, int k ) {
	if ( n < k ) return 0;
	if ( n % k == 0 ) return n / k;
	
	int d = n / k;
	int raz = ( n % k ) / ( d + 1 );
	n -= raz * ( d + 1 );
	if ( n > d * k ) n -= d + 1;
	return grundy( n, k );
}

int main() {
	int n;
	cin >> n;
	int sum = 0;
	for( int i = 0;i < n;i++ ) {
		int x, k;
		cin >> x >> k;
		x = grundy( x, k );
		sum ^= x;
	}
	cout << ( sum ? "Takahashi" : "Aoki" ) << "\n";
	return 0;
}


Measured memory_bytes: 3624
import java.io.*;
import java.util.*;
import java.util.stream.*;

public class Main {
    public static final Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
    public static final PrintStream out = System.out;

    public static void main(String[] args) {
        int P = in.nextInt();
        int[] A = new int[P];
        int[] B = new int[P];

        for (int i = 0; i < P; i++) {
            A[i] = in.nextInt();
        }

        B[0] = A[0];
        
        for (int i = 1; i < P; i++) {
            B[P - 1] = (B[P - 1] + A[i] - B[0] + P) % P;
        }
        B[P - 1] = (P - B[P - 1]) % P;

        for (int i = P - 2; 0 < i; i--) {
            for (int j = 1; j < P; j++) {
                A[j] = (A[j] * j) % P;
                B[i] = (B[i] + A[j]) % P;
            }
            B[i] = (P - B[i]) % P;
        }
        
        out.println(Arrays.stream(B).mapToObj(Integer::toString).collect(Collectors.joining(" ")));
    }
}


Measured memory_bytes: 31084
#include<cstdio>

int main(){
  int a, b, c, x;
  scanf("%d %d %d", &a, &b, &c);
  if(a > b){
    x = b;
    b = a;
    a = x;
  }
  if(b > c){
    x = c;
    c = b;
    b = x;
  }
  if(a > b){
    x = b;
    b = a;
    a = x;
  }
  printf("%d %d %d\n", a, b, c);
  return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;

const int mod = 1e9 + 7;
const int maxn = 1e5 + 5;

int f[105][105],h,w;

void add(int &x,int &y,int d) {
    f[x][y] = d;
    if(y + 1 <= w && f[x][y + 1] == 0) y++;
    else if(y > 1 && f[x][y - 1] == 0) y--;
    else x++;
}

int main() {
    int n,i,x,u,v;
    scanf("%d%d%d",&h,&w,&n);
    u = v = 1;
    for(i = 1;i <= n; i++) {
        scanf("%d",&x);
        while(x--) add(u,v,i);
    }
    for(i = 1;i <= h; i++) {
        for(int j = 1;j <= w; j++) printf("%d%c",f[i][j]," \n"[j == w]);
    }
    return 0;
}


Measured memory_bytes: 384
import copy
from fractions import gcd
N,X=map(int,input().split())
x=list(map(int,input().split()))
z=copy.deepcopy(x)+[X]
z.sort()

if N>1:
  y=[0]*N
  for i in range(N):
    y[i] = z[i+1]-z[i]
  ans=y[0]
  for j in range(N):
    ans = gcd(y[j],ans)
  print(ans)
else:
  print(abs(X-x[0]))

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

namespace test
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = ReadInt();
            var A = new int[N];
            for (int i = 0; i < N; i++) A[i] = ReadInt();
            var sortedA = A.OrderByDescending(i => i).ToArray();
            var max = sortedA[0];
            var next = sortedA[1];
            for (int i = 0; i < N; i++)
            {
                var ans = A[i] != max ? max : next;
                Console.WriteLine(ans);
            }

            Console.WriteLine();
            Console.ReadLine();
        }

        static string Read() { return Console.ReadLine(); }
        static int ReadInt() { return int.Parse(Read()); }
        static long ReadLong() { return long.Parse(Read()); }
        static int[] ReadArrayInt() { return Read().Split(' ').Select(s => int.Parse(s)).ToArray(); }
        static long[] ReadArrayLong() { return Read().Split(' ').Select(s => long.Parse(s)).ToArray(); }
    }
}

Measured memory_bytes: 24276
A=int(input())
B=int(input())
C=int(input())
X=int(input())
m=0
for i in range(A+1):
  for j in range(B+1):
    for k in range(C+1):
      if 500*i+100*j+50*k == X:
        m+=1
print(m)

Measured memory_bytes: 3060
import java.util.Scanner;

public class Main {

    public static void main(String[] args) throws Exception {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();

        boolean[][] hasCards = new boolean[4][13];
        String card;
        for (int i = 0; i < n; i++) {
            card = in.next();
            int cardMark = 0;
            if (card.equals("S")){
                cardMark = 0;
            }else if(card.equals("H")){
                cardMark = 1;
            }else if(card.equals("C")){
                cardMark = 2;
            }else if(card.equals("D")){
                cardMark = 3;
            }
            int cardNumber = in.nextInt() -1;

            hasCards[cardMark][cardNumber] = true;
        }

        in.close();

        for (int x = 0; x < 4; x++) {
            for (int y = 0; y < 13; y++) {
                if (hasCards[x][y] == false) {
                    switch (x) {
                        case 0:
                            System.out.print("S");
                            break;

                        case 1:
                            System.out.print("H");
                            break;

                        case 2:
                            System.out.print("C");
                            break;

                        case 3:
                            System.out.print("D");
                            break;

                        default:
                            break;
                    }
                    System.out.print(" ");
                    System.out.println(y + 1);
                }
            }
        }
    }
}

Measured memory_bytes: 18072
#include<iostream>
#include<string>
using namespace std;
struct Dice
{
    int s[6];
    void roll(char c)
    {


    int b;
    if(c=='E')
    {
        b=s[0];
        s[0]=s[3];
        s[3]=s[5];
        s[5]=s[2];
        s[2]=b;
    }
    if(c=='W')
    {
        b=s[0];
        s[0]=s[2];
        s[2]=s[5];
        s[5]=s[3];
        s[3]=b;
    }
    if(c=='N')
    {
        b=s[0];
        s[0]=s[1];
        s[1]=s[5];
        s[5]=s[4];
        s[4]=b;
    }
    if(c=='S')
    {
        b=s[0];
        s[0]=s[4];
        s[4]=s[5];
        s[5]=s[1];
        s[1]=b;
    }
    }
    int top()
    {
        return s[0];
    }
};
int main()
{
    Dice d;
    for(int i=0;i<6;i++)
        cin>>d.s[i];
    string s;cin>>s;
    for(int i=0;i<s.size();i++)
       d.roll(s[i]);
    cout <<d.top()<<endl;
    return 0;

}


Measured memory_bytes: 3220
#include<stdio.h>
int main(void)
{
	int tate, yoko, i, j;

	scanf("%d%d", &tate, &yoko);

	while (tate != 0 || yoko != 0)
	{
		for (i = 1; i <= tate; i++)
		{
			for (j = 1; j <= yoko; j++)
			{
				if ((i > 1) && (i < tate) && (j < yoko) && (j > 1))//端じゃないとき
				{
					printf(".");
				}
				else//端のとき
				{
					printf("#");
				}
			}
			printf("\n");
		}
		printf("\n");


		scanf("%d%d", &tate, &yoko);

	}


	return 0;

}



Measured memory_bytes: 2044
#include<iostream>
#include<math.h>
#include<iomanip>
#include<vector>
#include<algorithm>
#include<queue>
#include<string>
#include<stdlib.h>
#include<stack>
using namespace std;
#define PI 3.14159265358979
typedef  long long ll;
#define rep(i,n) for(int i=0;i<n;i++)
#include<set>
int main(void)
{
    int a,b;
    cin>>a>>b;
    cout<<a*b<<endl;
}

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

const int MAX = 205;

vector<vector<int>> lst(MAX,vector<int>(MAX,-1));

//index i,jに、gcd(i,j)をメモしておく.

int gcd(int a,int b){
    if(lst[a][b] != -1)return lst[a][b];
    int r = a % b;
    if(r == 0)return b;
    return lst[a][b] = gcd(b,r);
}

int main(){
    ll ans = 0;
    int K; cin>>K;
    for(int i = 1;i<=K;i++){
        for(int j=1;j<=K;j++){
            for(int k=1;k<=K;k++){
                ans += gcd(i,gcd(j,k));
            }
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3800
#include <iostream>
int main(){
	while(1){
		int a=0,c,n;
		std::cin>>n;
		if(n==0)break;
		for(int i=0;i<n/4;i++){
			std::cin>>c;
			a+=c;
		}
		std::cout<<a<<std::endl;
	}
	return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
bool a[10000001];
int main(){
  long long b[5000]={0},c=0,i,j;
  for(i=2;i<10000001;i++){
    if(!a[i])for(j=i+i;j<10000001;j+=i)a[j]=1;
  }
  for(i=5;i<10000001-9;i++)if(a[i]==0&&a[i+2]==0&&a[i+6]==0&&a[i+8]==0)b[c++]=i+8;
  while(cin>>j,j){
    for(i=0;i<c;i++){
      if(j<b[i])break;
    }
    if(i--);
    cout<<b[i]<<endl;
  }
}

Measured memory_bytes: 12880
#include<stdio.h>
#include<string.h>

int main(void)
{
	int a = 0, z = 0;
	char s[200100];
	scanf("%s", s);

	for (int i = 0; i < strlen(s); i++)
	{
		if (s[i] == 'A')
		{
			a = i;
			break;
		}
	}

	for (int i = 0; i < strlen(s); i++)
	{
		if (s[i] == 'Z')
		{
			z = i;
		}
	}

	printf("%d", z - a + 1);

	return 0;
}

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

int main() {
    string s; cin >> s;
    rep(i, s.size()) {
        if (s[i] == ',') s[i] = ' ';
    }
    cout << s << endl;
    return 0;
}


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

int main() {
    ll n;
    cin >> n;
    vector<ll> h(n,0);
    rep(i,n) cin >> h[i];
    bool ok = true;
    for (int i = n-1; i > 0; i--) {
        if (h[i]+1 == h[i-1]) h[i-1] -= 1;
        else if (h[i]+1 < h[i-1]) ok = false;
    }
    if (ok) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 4032
#include<iostream>
#include<utility>
#include<queue>
#include<unordered_map>
using namespace std;
typedef pair<char,int> card;

card A[100100] ;
int n;
unordered_map<int,queue<char>> mp;

void replace(int i,int j){
    card temp=A[i];
    A[i]=A[j];
    A[j]=temp;
}

int partition(int p,int r){
    card x=A[r];
    int i=p-1;

    for(int j=p;j<r;++j){
        if(A[j].second<=x.second){
            replace(++i,j);
        }
    }

    replace(++i,r);
    
    return i;
}

void quickSort(int p,int r){
    if(p<r){
        int q=partition(p,r);
        quickSort(p,q-1);
        quickSort(q+1,r);
    }
}

void isStable(){
    bool flag=true;
    for(int i=0;i<n;++i){
        if(A[i].first!=mp[A[i].second].front()){
            flag=false;
        }
        mp[A[i].second].pop();
    }

    if(flag){
        cout<<"Stable\n";
    }
    else{
        cout<<"Not stable\n";
    }
}

int main(){
    cin>>n;
    for(int i=0;i<n;++i){
        cin>>A[i].first>>A[i].second;
        mp[A[i].second].push(A[i].first);
    }

    quickSort(0,n-1);

    isStable();

    for(int i=0;i<n;++i){
        cout<<A[i].first<<" "<<A[i].second<<"\n";
    }
}


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

#define ll long long
#define rep(i,n) for(ll i=(ll)(0); i<(ll)(n); ++i)
#define vi vector<int>

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

const long long MOD = 1e9 + 7;

ll m,a,r,c,h;
string s;

signed main()
{
  ll n; cin>>n;
  
  rep(i,n){
    cin>>s;
    if(s[0]=='M')m++;
    if(s[0]=='A')a++;
    if(s[0]=='R')r++;
    if(s[0]=='C')c++;
    if(s[0]=='H')h++;
  }
  
  ll d[]={m,a,r,c,h};
  
  int x[]={0,0,0,0,0,0,1,1,1,2};
  int y[]={1,1,1,2,2,3,2,2,3,3};
  int z[]={2,3,4,3,4,4,3,4,4,4};
  ll ans=0;
  rep(i,10){
    ans+=d[x[i]]*d[y[i]]*d[z[i]];
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<n;++i)

using namespace std;
typedef long long ll;

template<typename T>
T gcd(T a, T b){
   if (a%b == 0){
       return(b);
   }
   else{
       return(gcd(b, a%b));
   }
}

template<typename T>
T lcm(T a,T b){
    return a*b/gcd(a,b);
}

int main(void){
    vector<int>s;
    vector<int>t;
    string s_,t_;

    cin>>s_>>t_;
    rep(i,s_.length()){
        s.push_back(int(s_[i]));
    }
    rep(i,t_.length()){
        t.push_back(int(t_[i]));
    }
    sort(ALL(s));
    sort(ALL(t));
    reverse(ALL(t));
    rep(i,min(s.size(),t.size())){
        if(s[i]<t[i]){
            cout<<"Yes";
            return 0;
        }
        if(s[i]>t[i]){
            cout<<"No";
            return 0;
        }
    }
    if(s.size()<t.size()){
        cout<<"Yes";
    }
    else{
        cout<<"No";
    }
}
/*
*/


Measured memory_bytes: 256
n = int(input())
A = list(map(int,input().split()))

print(' '.join(map(str, A)))
for i in range(1,n):
    v = A[i]
    j = i-1
    while j >= 0 and A[j] > v:
        A[j+1] = A[j]
        j = j-1
    A[j+1] = v
    print(' '.join(map(str, A)))



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

int main() {
    int a, b; cin >> a >> b;
    int c;
    if (b < a) {
        c = a;
        a = b;
        b = c;
    }
    for (int i=0; i<b; i++) {
        cout << a;
    }
    cout << endl;
}

Measured memory_bytes: 256
#define _LIBCPP_DEBUG 0
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=int(a);i<int(b);i++)
typedef vector<int> vi;
typedef long long ll;


int main(){
    ll N,M,K;cin>>N>>M>>K;
    rep(i,0,N+1){
        rep(j,0,M+1){
            ll on=i*M+j*N-2*i*j;
            if(on==K){
                cout<<"Yes"<<endl;
                return 0;
            }
        }
    }
    cout<<"No"<<endl;
}






Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
long long y,x,ans;
int main(){
	ans=0;
	cin>>y>>x;
	ans+=y;y-=x;
	while(true){
		if(x>y){long long t=x;x=y,y=t;}
		ans+=2*x*(y/x);
		if(y%x==0){
			ans-=x;
			break;
		}
		y%=x;
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cmath>
#include<cstring>
#include<iostream>
using namespace std;
int main() {
	string a,b;
	cin>>a>>b;
	a+=b;
	int len=a.size();
	int sum=0;
	for(int i=0;i<len;i++)
		sum=10*sum+a[i]-'0';
	double sq=sqrt(sum);
	if(sq!=int(sq))
		printf("No\n");
	else printf("Yes\n");
}

Measured memory_bytes: 256
# coding: utf-8
# Your code here!

#保存
import heapq
import sys
import itertools
 
sys.setrecursionlimit(10**7)

def bfs(cost,node):
    root[node]=min(root[node],cost)
    for next_c,next_n in way[node]:
        if root[next_n]==10**9:
            heapq.heappush(q,[cost+next_c,next_n])
    return
    
N,M,R=map(int,input().split())
r=list(map(int,input().split()))

way=[[] for i in range(N)]

for _ in range(M):
    A,B,C=map(int,input().split())
    way[A-1].append([C,B-1])
    way[B-1].append([C,A-1])

made=[]

#print(q)
for start in r:
    root=[10**9]*N
    q=[[0,start-1]]
    heapq.heapify(q)#costとnode
    while q:
        temp=heapq.heappop(q)
        #print(temp)
        if root[temp[1]]==10**9:
            bfs(temp[0],temp[1])
    made.append(root)
#print(made)

ans=10**9
for order in itertools.permutations([i for i in range(len(r))]):
    #print(order)
    temp=0
    for i in range(len(order)-1):
        fro=r[order[i]]
        aft=r[order[i+1]]
        #print("YES")
        #print(order[i]-1,order[i+1]-1)
        #print(root[order[i]-1][0])
        temp+=abs(made[order[i]][aft-1]-made[order[i]][fro-1])
    ans=min(ans,temp)
print(ans)




Measured memory_bytes: 10696
#include <iostream>
#include <vector>
#include <cstring>
#include <algorithm>
#include <cstdio>
using namespace std;
bool prime[10001000];
void eratos()
{
	memset(prime,true,sizeof(prime));
	prime[0]=prime[1]=false;
	for(int i=2;i*i<10000000;i++)if(prime[i])
	{
		for(int j=i*2;j<=10000000;j+=i)
		{
			prime[j]=false;
		}
	}
	return;
}
int main()
{
	vector<int> vec;
	eratos();
	for(int i=13;i<=10000000;i++)if(prime[i])
	{
		if(prime[i-2]&&prime[i-6]&&prime[i-8])vec.push_back(i);
	}
	vector<int>::iterator it;
	while(1)
	{
		int k;
		scanf("%d",&k);
		if(k==0)break;
		it = upper_bound(vec.begin(),vec.end(),k);
		it--;
		cout << *it << endl;
	}
	return 0;
}

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

int main()
{
    string b;
    cin >> b;

    if (b[0] == 'A')
    {
        cout << "T" << endl;
    }
    else if (b[0] == 'T')
    {
        cout << "A" << endl;
    }
    else if (b[0] == 'C')
    {
        cout << "G" << endl;
    }
    else if (b[0] == 'G')
    {
        cout << "C" << endl;
    }
}


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

int	main()
{
	int	K;
	string	S;
	cin >> K >> S;
	if (S.size() > static_cast<size_t>(K))
		cout << S.substr(0, K) << "..." << endl;
	else
		cout << S << endl;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define dunk(a) cout << (a) << endl
const int INF = 2e9;
using namespace std;
using Graph = vector<vector<int>>;
typedef pair<int,int> P;
typedef long long ll;

int main(){
    vector<int> a(3);
    cin >> a[0] >> a[1] >> a[2];

    sort(all(a));

    if(a[0] == 5 && a[1] == 5 && a[2] == 7) cout << "YES" << endl;
    else cout << "NO" << endl;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(void)
{
    int N, K, Q, A[100000], i, P[100000];

    cin >> N >> K >> Q;

    for(i=1; i<=Q; i++){
        cin >> A[i];
    }

    // ポイントを初期化
    for(i=1; i<=N; i++){
        P[i] = K - Q; //開始時のポイント-正解が出た数にする
    }

    // 正解した人のポイントを1増やす
    for(i=1; i<=Q; i++){
        P[A[i]]++;
    }

    //ポイントが0以下かどうかを判定する
    for(i=1; i<=N; i++){
        if(P[i] > 0){
            cout << "Yes" << endl;
        }

        else{
            cout << "No" << endl;
        }
    }

    return 0;
}

Measured memory_bytes: 1408
n=int(input())

a,w,t,r=0,0,0,0


for _ in range(0,n):
  x=input()
  if x=="AC":
    a+=1
  elif x=="WA":
    w+=1
  elif x=="TLE":
    t+=1
  else:
    r+=1
print("AC x " + str(a))
print("WA x " + str(w))
print("TLE x " + str(t))
print("RE x " + str(r))


Measured memory_bytes: 9204
import java.util.*;
public class Main{
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String s = sc.nextLine();
    String t = sc.nextLine();
    int n = 0;

    if(s.substring(0,1).equals(t.substring(0,1))){
      n++;
    }
    if(s.substring(1,2).equals(t.substring(1,2))){
      n++;
    }
    if(s.substring(2,3).equals(t.substring(2,3))){
      n++;
    }
    System.out.println(n);
  }
}


Measured memory_bytes: 23124
#include <bits/stdc++.h>
#define ll long long
#define sf scanf
#define pf printf
using namespace std;

int main(){
    int arr[4];
    for(int i=0; i<4; i++) sf("%d",&arr[i]);
    sort(arr, arr+4);

    int ans1=arr[0]+arr[3];
    int ans2=arr[1]+arr[2];
    int ans=abs(ans1-ans2);
    pf("%d\n",ans);

    return 0;
}



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

#define int long long

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

    int s, w;
    cin >> s >> w;
    if(s <= w) cout << "unsafe" << endl;
    else cout << "safe" << endl;
}

Measured memory_bytes: 3636
#include<stdio.h>
main()
{
	int i,j,n,del;
	
	while(scanf("%d",&n)!=EOF){
		
		int flag[n+1],cnt=0;
		
		for(i=0;i<=n;i++){
			flag[i]=1;
		}
		
		flag[0]=0;
		flag[1]=0;
		
		for(i=2;i<=n;i++){
			if(flag[i]==1){
				cnt+=1;
				for(j=1;i*j<=n;j++){
					flag[i*j]=0;
				}
			}
		}
		printf("%d\n",cnt);
	}
	return 0;
}

Measured memory_bytes: 4500
n,m=map(int,input().split())
sc=[list(map(int,input().split())) for i in range(m)]
# 全探索
if n==1:
  for i in range(10):
    memo=0
    for li in sc:
      if str(i)[li[0]-1]!=str(li[1]):
        break
      else:
        memo+=1
    if memo==m:
      print(i)
      exit()
  print("-1")
elif n==2:
  for i in range(10,100):
    memo=0
    for li in sc:
      if str(i)[li[0]-1]!=str(li[1]):
        break
      else:
        memo+=1
    if memo==m:
      print(i)
      exit()
  print("-1")
else:
  for i in range(100,1000):
    memo=0
    for li in sc:
      if str(i)[li[0]-1]!=str(li[1]):
        break
      else:
        memo+=1
    if memo==m:
      print(i)
      exit()
  print("-1")

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define ll long long

using namespace std;

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

	ll n, m, k;
	cin >> n >> m >> k;

	vector<ll> a(n+1, 0), b(m+1, 0);

	for(ll i=1; i<=n; i++){
        cin >> a[i];
        a[i]+=a[i-1];
	}

	for(ll j=1; j<=m; j++){
        cin >> b[j];
        b[j]+=b[j-1];
	}

	ll i=0, j=m, ans=0, sum=0;
	while(i<=n){
        sum=a[i];
        if(sum>k)
            break;
        while(j>=0 && sum+b[j]>k)
            j--;
        ans=max(ans, i+j);
        i++;
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 6364
from collections import defaultdict
from sys import stdin
def main():
    N,M = map(int,stdin.readline().split())
    edge = defaultdict(list)
    color = [-1]*N
    for _ in range(M):
        a,b = map(int,stdin.readline().split())
        a -= 1
        b -= 1
        edge[a].append(b)
        edge[b].append(a)
    stack = [0]
    color[0] = 0
    flag = 1
    while stack:
        u = stack.pop()
        for v in edge[u]:
            if color[v] == -1:
                stack.append(v)
                if color[u] == 0:
                    color[v] = 1
                else:
                    color[v] = 0
            if color[u] == color[v]:flag = 0;break
    if flag:
        B = 0
        W = 0
        for c in color:
            if c == 1:
                B += 1
            else:W += 1
        ans = B*W-M
    else:
        ans = N*(N-1)//2-M
    
    print(ans)


if __name__ == "__main__":
    main()

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

int main() {
  int64_t n,m;
  cin >> n >> m;
  vector<int64_t> h(n);
  vector<int64_t> vec(n,0);
  rep(i,n) cin >> h.at(i);
  rep(i,m){
    int64_t x,y;
    cin >> x >> y;
    if(h.at(x-1)>=h.at(y-1)) vec.at(y-1)++;
    if(h.at(x-1)<=h.at(y-1)) vec.at(x-1)++;
  }
  int64_t ans=0;
  rep(i,n){  
    if(vec.at(i)==0) ans++;
  }
  cout << ans << endl;

}

Measured memory_bytes: 4844
use std::cmp::*;
use std::io::*;

fn main() {
    let mut s: String = String::new();
    std::io::stdin().read_to_string(&mut s).ok();
    let mut itr = s.trim().split_whitespace();
    let s: Vec<char> = itr.next().unwrap().chars().collect();

    let mut l = 0;
    let mut r = s.len() - 1;
    let mut ans = 0;
    while r > l {
        if s[l] == s[r] {
            l += 1;
            r -= 1;
        } else if s[l] == 'x' {
            l += 1;
            ans += 1;
        } else if s[r] == 'x' {
            r -= 1;
            ans += 1;
        } else {
            println!("-1");
            return;
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 2524