akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<cstring>
using namespace std;

string a,b="CF";
int al,bl;

int main(){
    getline(cin,a);
    al=a.length();
    for(int i=0;i<al;i++)
        if(a[i]==b[bl]){
            bl++;
            if(bl==2)
                break;
        }
    if(bl==2) cout<<"Yes";
    else cout<<"No";
    cout<<endl;
    return 0;
}

Measured memory_bytes: 384
#include<string.h>
#include<iostream>
using namespace std;
int gcd(int a,int b)
{
    if(!b)return a;
    else return gcd(b,a%b);
}
/*int n,q,ara[200001],st[800004],a,b,mx=2000000000;
void build(int si,int ss,int se)
{
    if(ss==se){
        st[si]=ara[ss];
        return;
    }
    int mid=(ss+se)/2;
    build(2*si,ss,mid),build(2*si+1,mid+1,se);
    st[si]=min(st[2*si],st[2*si+1]);
}
int query(int si,int ss,int se,int qs,int qe)
{
    if(qe<ss || se<qs)return mx;
    if(ss>=qs && qe>=se)return st[si];
    int mid=(ss+se)/2;
    return min(query(2*si,ss,mid,qs,qe),query(2*si+1,mid+1,se,qs,qe));
}
int main()
{
    //freopen ("input.txt","r",stdin);
    //freopen ("output1.txt","w",stdout);
    cin>>n>>q;
    for(int i=1;i<=n;i++)cin>>ara[i];
    build(1,1,n);
    while(q--){
        cin>>a>>b;
        cout<<query(1,1,n,a,b)<<"\n";
    }
}*/
int main()
{
    char s[200000];
    cin>>s;
    int len=strlen(s),ans=0;
    for(int i=0;i<len;i++){
        ans+=s[i]-'0';
    }
    if(ans%9==0)cout<<"Yes";
    else cout<<"No";
}


Measured memory_bytes: 3828
#include<iostream>
#include<vector>
#include<math.h>
using namespace std;
int main(){

  int X;
  cin>>X;
  vector<int>data(X,0);
  long long int num=0;
  for(int i=1;i<=X;i++){    
    for(int j=2;j<=6;j++){
    
      num=pow(i,j);
      //cout<<num<<endl;
      if(num<=X){
      
        data[num-1]=1;
      }
    }
  }
  for(int i=X;i>0;i--){
  
    if(data[i-1]==1){
    
      cout<<i;
      return 0;
    }
  }
}

Measured memory_bytes: 4156
import java.util.*;

class Main{
    int INF=1<<28;
    boolean debug=true;
    void run(){
	Scanner sc=new Scanner(System.in);
	while(true){
	    int n=sc.nextInt();if(n==0)break;
	    int[] p=new int[n+1];int[] t=new int[n+1];
	    p[0]=t[0]=0;
	    for(int i=1;i<=n;i++){
		p[i]=sc.nextInt();t[i]=sc.nextInt();
	    }
	    int[][] dp=new int[n+1][4];
	    for(int i=0;i<dp.length;i++){
		for(int j=0;j<dp[0].length;j++){
		    dp[i][j]=INF;
		}}
	    dp[0][0]=0;int b=0;
	    for(int i=0;i<n;i++){ //テ、ツサツ角[i]テ」ツ?ォテ」ツ??」ツつ?
		for(int j=0;j<3;j++){//テ、ツサツ核テ・ツ?凝」ツつづ」ツ?」テ」ツ?ヲテ」ツつ?
		    if(dp[i][j]<INF)b=i;
		    if(dp[i][j]<INF){
		    if(j==2){
			//テ・ツクツーテ」ツつ?
			if(t[i+1]>=t[i]+(j+2)*p[i]+p[i+1]){
			    dp[i+1][0]=Math.min(dp[i+1][0],dp[i][j]+p[i]+p[i+1]);
			}
		    }else{
			int dist=Math.abs(p[i]-p[i+1]);
			//テァツ崢エティツ。ツ?
			if(t[i+1]>=t[i]+(j+2)*dist){
			    dp[i+1][j+1]=Math.min(dp[i+1][j+1],dp[i][j]+dist);
			}
			//テ・ツクツーテ」ツつ?
			if(t[i+1]>=t[i]+(j+2)*p[i]+p[i+1]){
			    dp[i+1][0]=Math.min(dp[i+1][0],dp[i][j]+p[i]+p[i+1]);
			}
		    }
		    }
		}
	    }

	    int ans=INF;
	    for(int i=0;i<3;i++)ans=Math.min(ans,dp[n][i]);
	    if(ans==INF)System.out.printf("NG %d\n",b+1);
	    else System.out.printf("OK %d\n",ans+p[n]);
	}
    }
    public static void main(String[] args){
	new Main().run();
    }
}

Measured memory_bytes: 24528
#include<stdio.h>
#include<stdlib.h>

int serch(int a[],int n, int x) {
	int i;
	for (i = 0; i < n; i++) {
		if (x == a[i])
			return i;
	}
	return -1;
}

int main(void) {
	int x, n;
	int* a;
	scanf("%d %d", &x, &n);

	a = (int*)calloc(n, sizeof(int));
	for (int i = 0; i < n; i++) {
		scanf("%d", &a[i]);
	}

	int dif = 0;
	while (1) {
		if (-1==serch(a, n, x + dif))
			break;
		dif *= -1;
		if (-1 == serch(a, n, x + dif))
			break;
		dif *= -1;
		dif--;
	}

	printf("%d", x + dif);

	return 0;
}

Measured memory_bytes: 1700
#include <bits/stdc++.h>
#define rep(i, n) for(ll i = 0; i < n; i++)
#define repr(i, n) for(ll i = n; i >= 0; i--)
#define reprr(i, m, n) for (ll i = m; i < n; i++)
#define inf 2e9
#define all(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;

ll N, Q;
vvll G;
vll points;
vll final_points;

void dfs(ll node, ll point, ll pre) {
    point += points[node];
    final_points[node] += point;
    for (ll next_node : G[node]) {
        if (next_node == pre) continue;
        dfs(next_node, point, node);
    }
}

int main()
{
    cin >> N >> Q;
    G.resize(N);
    rep(i, N - 1) {
        ll a, b; cin >> a >> b; a--, b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }

    points.resize(N);
    final_points.resize(N);

    rep(i, Q) {
        ll p, x; cin >> p >> x; p--;
        points[p] += x;
    }

    dfs(0, 0, -1);

    for (auto elem : final_points) cout << elem << " "; cout << endl;
    return 0;
}

Measured memory_bytes: 25856
#include <stdio.h>

#define len 5

int main(void) {
  int x1, x2, x3, x4, x5;
  int x[len];
  int index;
  scanf("%d%d%d%d%d", &x1, &x2, &x3, &x4, &x5);
  x[0] = x1;
  x[1] = x2;
  x[2] = x3;
  x[3] = x4;
  x[4] = x5;
  for(int i = 0; i < len; i++) {
    if(x[i] == 0) {
      index = i+1;
    }
  }
  printf("%d", index);
  return 0;
}


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

int main()
{
    long long n;
    cin>>n;
    for(int i=1;;i++)
    {
        long long t=(i*(i+1))/2;
        if(t>=n)
        {
            cout<<i<<endl;
            return 0;
        }
    }

}




Measured memory_bytes: 384
#include<bits/stdc++.h>
#define int long long 
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb push_back
#define all(a) a.begin(),a.end()
#define ld long double
#define ub upper_bound
#define lb lower_bound
#define pii pair<int,int>
using namespace std;
signed main(){
    fast;
    int a,b,m;
    cin>>a>>b>>m;
    int ans = 1e18;
    int aa[a+1];
    int bb[b+1];
    for(int i=1;i<=a;i++){
        cin>>aa[i];
        ans = min(ans,aa[i]);
    }
    int gg = 1e18;
    for(int i=1;i<=b;i++){
        cin>>bb[i];
        gg = min(gg,bb[i]);
    }
    ans+=gg;
    for(int i=1;i<=m;i++){
        int s,t,c;
        cin>>s>>t>>c;
        ans = min(ans,aa[s]+bb[t]-c);
    }
    if(ans<0)
        ans = 0;
    cout<<ans;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
# include <string>
# include <math.h>
using namespace std;
typedef long long int ll;
//typedef .push_back pb;

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

	int k; cin >> k;
	string s; cin >> s;
	if(s.size()<=k) cout << s ;
	else{
		cout << s.substr(0,k) <<"...";

	}	
	
}


Measured memory_bytes: 3608
#include <iostream>
#include <string>
#include <vector>
#include <cstdlib>
#include <algorithm>
#include <set>
#include <stdio.h>
#include <cmath>
#include <ctime>
#include <functional>
#include <stack>
#include <queue>
#include <map>
#include <tuple>
using namespace std;

int main(){
	string t; cin >> t;
	if (t == "RRR") cout << 3;
	else if (t == "SRR" || t == "RRS") cout << 2;
	else if (t == "RSS" || t == "SRS" || t == "SSR" || t == "RSR") cout << 1;
	else cout << 0 << endl;
}


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

int main(){
    int N,count,minim=1000000,i;
    cin >> N;

    for(i=0;i<=N;i++){
        count = 0;
        int tmp = i;
        while(tmp>0){
            count += tmp % 6;
            tmp /= 6;
        }
        tmp = N - i;
        while(tmp>0){
            count += tmp % 9;
            tmp /= 9;
        }
        minim = min(minim,count);
    }

    cout << minim << endl;

    return 0;
}

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

using namespace std;

#define ll long long
#define pb push_back

int main()
{
  int cases;

      int a, b, c;
      cin >> a >> b >> c;
      if( a == b)
      {
          if( c != a)cout << "Yes" << endl;
          else cout << "No" << endl;
      }
      else if( a == c )
      {
          if( b != a)cout << "Yes" << endl;
          else cout << "No" << endl;
      }
      else if( b == c)
      {
           if( b != a)cout << "Yes" << endl;
          else cout << "No" << endl;
      }
      else cout << "No" << endl;

    //cout << "Hello World" << endl;

    return 0;
}



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

int main() {
  
  	int A,B,C,D;
  	cin >> A >> B >> C >> D;
  
  	if((A+B)>(C+D)){
    	cout << "Left" << endl;
    }
  	else if((A+B)==(C+D)){
    	cout << "Balanced" << endl;
    }
  	else{
    	cout << "Right" << endl;
    }
}

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

typedef int integer;

#define FIN ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long
#define ld long double
#define pb push_back
#define bs binary_search
#define up upper_bound
#define lw lower_bound
#define fs first 
#define sd second 
#define mp make_pair    

#define fore(i,a,b) for(ll i = a; i < b; i++)
#define rfore(i, a, b) for(ll i = a - 1; i >= b; i--)
#define forev(a,b) fore(i,0,b)cout<<a[i]<<" "; 
#define mm(a,b) memset(a , b , sizeof a) 
#define ALL(a) a.begin(),a.end() 
#define SZ(n) ((ll) (n).size())

#define infi  2e9
#define int long long
#define endl '\n'
const ld pi = 3.14159265358979323846;
const ll mod = 1e9+7;
const ll INF = 1e10;
const ll MAXN =1e5;

typedef pair<ll,ll> pll;

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

int a[MAXN];
int d,n;
int dp[MAXN][101][2];

int solve(int pos, int curmod, int bit){
	if(pos==n){
		if((curmod)%d==0)return 1;
		else return 0;
	}
	int &r = dp[pos][curmod][bit];
	if(r!=-1)return r;
	r=0;
	if(bit){
		fore(i,0,10){
			r+=(solve(pos+1,(curmod+i)%d,1)%mod);
		}
	}else{
		fore(i,0,a[pos]+1){
			r+=(solve(pos+1,(curmod+i)%d,(i!=a[pos]))%mod);
		}
	}
	return r;
}

integer main(){
    string s; cin>>s; n=SZ(s);
   	cin>>d;
   	mm(dp,-1);
    fore(i,0,SZ(s))a[i]=s[i]-'0';
    cout<<(solve(0,0,0)-1+mod)%mod;
    return 0;
}




Measured memory_bytes: 158848
#include <iostream>
using namespace std;
int main()
{
    char a;
    cin>>a;
    if(a=='A')
        cout<<"T";
    else if(a=='T')
        cout<<"A";
    else if(a=='G')
        cout<<"C";
    else if(a=='C')
        cout<<"G";
    return 0;
}


Measured memory_bytes: 256
from collections import deque
N, M  = map(int, input().split())
AB =[[] for i in range(N)]

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


print("Yes")

D = deque([1])
ans = [0]* N
ans[0] = -1

for i in range(N-1):
  C = D.popleft()
  for j in AB[C-1]:
    if ans[j-1] == 0:
      ans[j-1] = C
      D.append(j)

for i in range(1,N):
  print(ans[i])

Measured memory_bytes: 94444
s = int(input())
ans = [s,]

for i in range(1,100000):
    if ans.count(ans[-1]) >= 2:
        print(len(ans))
        break
    else:
        if ans[i-1]%2 == 0:
            g = ans[i-1]/2
            ans.append(g)
        elif  ans[i-1]%2 != 0:
            g = 3*ans[i-1]+1
            ans.append(g)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
long long a[2010];
long long m=1e9+7;
int main(){
	long long n,k;
	cin >> n >> k;
	long long aa=(((k+1)*k)/2)%m;
	long long bb=((k*(k-1))/2)%m;
	for(long long i=0;i<n;i++){
		scanf("%d",&a[i]);
	}
	long long qian=0,hou=0;
	for(long long i=0;i<n;i++){
		for(long long j=i+1;j<n;j++){
			if(a[i]<a[j]){
				qian++;
				qian=qian%m;
			}
			else if(a[i]>a[j])
				hou++;
				hou=hou%m;
		}
	}
	long long ans=((hou*(aa%m))%m+(qian*(bb%m))%m)%m;
	cout << ans;
    return 0;
}//123123123123213

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10 ** 7)

N, M = map(int, input().split())
AB = [list(map(int, input().split())) for _ in range(M)]

graph = [[] for _ in range(N)]

for a, b in AB:
    graph[a-1].append(b-1)
    graph[b-1].append(a-1)

colors = [None] * N
# 二部グラフかどうかのチェック
colors[0] = 0
que = [0]
while que:
    x = que.pop()
    for y in graph[x]:
        if colors[y] == None:
            colors[y] = 1 - colors[x]
            que.append(y)

is_bg = all(colors[a-1] != colors[b-1] for a, b in AB)

if is_bg:
    # 二部完全グラフ
    x = sum(colors)
    y = N - x
    answer = x*y - M
else:
    # 完全グラフ
    answer = N*(N-1)//2 - M

print(answer)



Measured memory_bytes: 42228
#include <cstdio>

char s[6];

bool judge() {
    if (s[2] != s[3] || s[4] != s[5]) {
        return false;
    }
    return true;
}

int main() {
    scanf("%s", s);
    printf("%s", judge() ? "Yes" : "No");
    return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

#define ll long long
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define test int t; cin>>t; while(t--)
#define pb push_back
#define mp(a,b) make_pair(a,b)
#define f0(i,n) for( ll i = 0; i < ( n ); i ++)
#define f1(i,n) for(i = 1; i <= ( n ); i ++)
#define f(i,m,n) for(auto i = ( m ); i <= ( n ); i ++)
#define nl cout<<"\n"
#define  mod 1000000007
#define fi first
#define se second
#define all(a) a.begin(),a.end()
#define rall(v) v.rbegin(), v.rend()
#define SZ(x) ((ll)x.size())
#define mem(a, b) memset(a, b, sizeof(a));
#define make_graph(k) int x,y; f0(i,k){cin>>x>>y; adj[x].pb(y); adj[y].pb(x);}
#define dekh cout<<"dekh"

#define o_set tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update>
#define o_setpll tree<pair<ll,ll>, null_type, less<pair<ll,ll>>, rb_tree_tag, tree_order_statistics_node_update>
typedef vector<ll> vl;




/*ll Pow(ll a, ll b, ll m){
    if(b==0)return 1;
    if(b%2==0){
        ll x = a*a;
        x%=m;
        return Pow(x,b/2,m);
    }
    return (a*Pow(a,b-1,m))%m;
}
*/
vector<ll>adj[200005];
 ll vis[200005]={0};

//ll p;ll arr[200005];

void dfs(ll x)
{
    cout<<x;nl;
    vis[x]=1;

    for(auto child : adj[x])
    {   if(!vis[child])
         {
             dfs(child);
         }
    }

}




ll n,W;
ll v[105], w[105];
ll dp[100005][105];
ll solve(ll sum, ll ind)
{
       if(ind==n)
            return sum==0?0:INT_MAX;


       if(dp[sum][ind]!=-1)return dp[sum][ind];
    //if(sum>=W)return 0;
  	ll ans;
  if(sum-v[ind]<0) { ans = solve(sum, ind+1);}
  else
  {
     ans = min(solve(sum, ind+1) , solve( sum-v[ind], ind+1)+w[ind]);
  }
    return dp[sum][ind] =ans;
}

int main()
{
    fast
    mem(dp,-1);
   cin>>n>>W;ll i;
   ll sum=0;
   f0(i,n)
   {
       cin>>w[i]>>v[i]; sum+=v[i];
   }
   for(i=sum;i>=0;i--)
   {
       if(solve(i,0)<=W)
        {cout<<i;break;}
   }

}





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

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

    int ans = n;
    for(int i=1; i<n; i++){
        int a = i;
        int b = n-i;

        int dsum = 0;
        while(a > 0){
            dsum += a % 10;
            a /= 10;
        }  
        while(b > 0){
            dsum += b % 10;
            b /= 10;
        }
        ans = min(ans, dsum);      
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3608
#import string,itertools,fractions,heapq,re,array,bisect
#from math import *
#from collections import Counter
def rl(s): return xrange(len(s))


INF = 2147483647


import sys
stdin = sys.stdin


K, T = map(int, stdin.readline().strip().split())
aa = map(int, stdin.readline().strip().split())

aa.sort()
m = aa[-1]

can_fit = (K + 1) // 2
m -= can_fit
rr = 0
if m > 0:
    if K % 2 == 0:
        rr += 1
        m -= 1
    rr += m*2

print rr



Measured memory_bytes: 2568
#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>;
//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
//xにはvectorなどのコンテナ
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define sz(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値を求める
#define MIN(x) *min_element(ALL(x)) //最小値を求める
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素
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;
}
int main() {
    int n;cin>>n;
    int b=0,c=0,d=0,e=0,f=0,g=0,h=0,i=0;
    int ex=0;
    rep(q,n){
        int a;cin>>a;
        if(1<=a&&a<=399){
            b=1;
        }
        else if(a<=799){
            c=1;
        }
        else if(a<=1199){
            d=1;
        }
        else if(a<=1599){
            e=1;
        }
        else if(a<=1999){
            f=1;
        }
        else if(a<=2399){
            g=1;
        }
        else if(a<=2799){
            h=1;
        }
        else if(a<=3199){
            i=1;
        }else{
            ex++;
        }
    }
    int ans=b+c+d+e+f+g+h+i;
    if(ans==0){
        cout<<1<<endl;
    }
    else{cout<<ans<<" ";}
    
        cout<<ans+ex<<endl;
   
    return 0;
}

Measured memory_bytes: 256
//
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<ll, P>IP;
typedef vector<ll> V;
typedef vector<V> V2;
typedef vector<vector<P> > G;
void g_dir(G &graph, ll a, ll b, ll w = 1){graph[a].push_back(P(b, w));}
void g_undir(G &graph, ll a, ll b, ll w = 1){g_dir(graph, a, b, w);g_dir(graph, b, a, w);}
#define rep(i, n) for(ll (i) = 0; (i) < (n); (i)++)
#define rep1(i, n) for(ll (i) = 1; (i) <= (n); (i)++)
#define rrep(i, n) for(ll (i) = (n) - 1; (i) >= 0; (i)--)
#define rrep1(i, n) for(ll (i) = (n); (i) >= 1; (i)--)
template<class T> void chmax(T &a, const T &b){if(a < b){a = b;}}
template<class T> void chmin(T &a, const T &b){if(a > b){a = b;}}
const ll INF = 1145141919;
const ll MOD = 1000000007;
const ll NUM = 101010;

int main(){

    ll N, M;
    cin >> N >> M;
    ll S[5], C[5];
    rep(i, M)cin >> S[i] >> C[i];
    for(int i = 0; i < 1000; i++){
        V v;
        for(int j = i; j; j /= 10)v.push_back(j % 10);
        if(v.size() == 0)v.push_back(0);
        if(v.size() != N)continue;
        reverse(v.begin(), v.end());
        int f = 1;
        rep(j, M)if(v[S[j] - 1] != C[j])f = 0;
        if(f){
            cout << i << endl;
            return 0;
        }
    }
    cout << -1 << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
 
using namespace std;
void coffee(char arr1[]);
 
int main()
{
   char arr1[6] = {};
   for(int i = 0; i < 6 ; i++){
       
       cin >> arr1[i];
   }
   
   coffee(arr1);
   return 0;
}
 
void coffee(char arr1[]){
    
    if(arr1[2] == arr1[3] && arr1[4] == arr1[5])
    {
      cout << "Yes";
    }
    else
    {
        cout << "No";
    }    
}

Measured memory_bytes: 256
#include<cstdio>

using namespace std;

int main(){
	int data[] = {0,6000,4000,3000,2000};

	for(int i=0;i<4;i++){
		int t,n;
		scanf("%d %d",&t,&n);

		printf("%d\n",data[t]*n);
	}
	return 0;
}

Measured memory_bytes: 1028
#include <iostream>
#include <utility>

using namespace std;

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

int lcm(int a,int b){
	int t=a;
	while(t%b!=0)t+=a;
	return t;
}

typedef pair<int,int> R;

void yakubun(R&a){
	int d = gcd(a.first,a.second);
	a.first/=d;
	a.second/=d;
}

bool cmp(R a,R b){
	double va = (double)a.first / (double)a.second;
	double vb = (double)b.first / (double)b.second;
	return va <= vb;
}

R sub(R a,R b){
	int m = lcm(a.second,b.second);
	int t = a.first*(m/a.second) - b.first*(m/b.second);
	R r = make_pair(t,m);
	yakubun(r);
	return r;
}

double val(R a){
	return (double)a.first/(double)a.second;
}

int calc = 0;
int A;
int f(R mx,R cur,int a,int n){
	int ret=0;
	if(cur.first==0)return 1;
	if(n==0)return ret;
	for(int k=1;k <= A/a && cmp(cur,make_pair(n,k)) ;k++){
		calc++;
		R r = make_pair(1,k);
		if(cmp(r,mx)&&cmp(r,cur)){
			ret+=f(r,sub(cur,r),a*k,n-1);
		}
	}
	return ret;
}

int main(){
	while(true){
		int p,q,n;
		cin >> p >> q >> A >> n;
		if(p==0&&q==0&&A==0&&n==0)return 0;
		calc=0;
		cout << f(make_pair(p,q),make_pair(p,q),1,n) << endl;
		//cerr << "calc=" << calc << endl;
	}
}

Measured memory_bytes: 864
#include<bits/stdc++.h>
#define ll long long
#define mps make_pair
#define F first
#define S second
using namespace std;
const int N=100005;
int a[N],b[N],mp[N];
map<int,int> used[N];
deque<int> D[N];
vector<pair<int,int> > v[N];
int main()
{
    int n;
    cin>>n;
    for(int i=1;i<n;i++)
    {
        cin>>a[i]>>b[i];
        v[a[i]].push_back(mps(b[i],i));
        v[b[i]].push_back(mps(a[i],i));
    }
    for(int i=1;i<=n;i++)
        for(int j=1;j<=v[i].size();j++)
            D[i].push_back(j);
    int ans=0;
    for(int i=1;i<=n;i++)
    {
        ans=max(ans,(int)v[i].size());
        for(int j=0;j<v[i].size();j++)
            if(mp[v[i][j].S]!=0)
                used[i][mp[v[i][j].S]]=true;
        for(int j=0;j<v[i].size();j++)
        {
            if(mp[v[i][j].S]!=0)
                continue;
            while(D[i].size() && used[i][D[i].front()])
                D[i].pop_front();
            mp[v[i][j].S]=D[i].front();
            D[i].pop_front();
        }
    }
    cout<<ans<<endl;
    for(int i=1;i<n;i++)
        cout<<mp[i]<<endl;
    return 0;
}


Measured memory_bytes: 88960
#include<iostream>
using namespace std;
int main()
{
  int n,m,c;
  cin>>n>>m>>c;
  int check[n]={0},a[n][m],b[m];
  for(int i=0;i<m;i++)
    cin>>b[i];
  for(int i=0;i<n;i++)
    for(int j=0;j<m;j++)
      cin>>a[i][j];
  for(int i=0;i<n;i++)
  {
    int sum=0;
    for(int j=0;j<m;j++)
      sum+=a[i][j]*b[j];
    if(sum+c>0)
      check[i]=1;
  }
  int tot=0;
  for(int i=0;i<n;i++)
    if(check[i])
      tot++;
  cout<<tot;
  return 0;
}

Measured memory_bytes: 256
#include <fstream>
#include <iostream>
#define nmax 200001

using namespace std;
/*ifstream fin("p.in");
ofstream fout("p.out");
*/
int n,q;
char s[nmax];

struct query
{
    char pos;
    char dir;
};
query vec_q[nmax];

int verif(int val)
{
    char square=s[val-1];
    //fout<<square<<" ";
    for(int i=1; i<=q; i++)
        {
            //fout<<vec_q[i].pos<<" "<<square<<"\n";
            if(vec_q[i].pos==square)
                {
                    //fout<<square<<" ";
                    if(vec_q[i].dir=='L') val--;
                    else val++;
                    if(val>n) return -1;
                    else if(val<1) return -2;
                    square=s[val-1];
                }
        }
    //fout<<"\n check \n";
    return 1;
}

int best_left_out_right()
{
    int st=1;
    int dr=n;
    int sol;
    int pp=0;
    while(st<=dr)
        {
            //fout<<"st="<<st<<" dr="<<dr<<" ";
            int mij=(st+dr)/2;
            //fout<<mij<<" ";
            if(verif(mij)==1 || verif(mij)==-2)
                st=mij+1;
            else if(verif(mij)==-1) {pp=1; sol=mij; dr=mij-1;}
            //fout<<"\n";
        }
    if(!pp) return n+1;
    return sol;
}

int best_right_out_left()
{
    int st=1;
    int dr=n;
    int sol;
    int pp=0;
    while(st<=dr)
        {
            //fout<<"st="<<st<<" dr="<<dr<<" ";
            int mij=(st+dr)/2;
            //fout<<mij<<" ";
            if(verif(mij)==1 || verif(mij)==-1)
                {
                    dr=mij-1;
                }
            else if(verif(mij)==-2) {pp=1;st=mij+1; sol=mij;}
            //fout<<"\n";
        }
    if(!pp) return 0;
    return sol;
}

int main()
{
    cin>>n>>q;
    cin>>s;
    for(int i=1; i<=q; i++)
        {
            cin>>vec_q[i].pos>>vec_q[i].dir;
        }

    int val_1=best_left_out_right();
    //fout<<"\n next\n";
    int val_2=best_right_out_left();
    //fout<<"\n"<<val_1<<" "<<val_2<<" ";
    cout<<n-val_2-(n-val_1+1);
    return 0;
}


Measured memory_bytes: 768
#include <iostream>
#include <utility>
#include <map>
#include <vector>
#include <algorithm>
#include <queue>
#include <math.h>
#include <stack>
#include <set>
#include <deque>

using namespace std;
typedef long long ll;
ll mod = 1e9+7;
#define rep(i,n) for(int i = 0; i < (n); ++i)

int main(){
    int a, b, c, k;
    cin >> a >> b >> c >> k;
    int ans = 0;
    ans += min(a, k);
    k -= ans;
    if ( k > 0 ) k -= b;
    if ( k > 0 ) ans -= min(c, k);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3680
#include <stdio.h>

int main(void)
{
  int a,b;
  scanf("%d %d",&a,&b);
  
  int max=(a+b);
  
  if((a-b)>max){
      max=(a-b);
  }
  
  if((a*b)>max){
      max=(a*b);
  }
  
  printf("%d",max);
  return 0;
}

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

using namespace std;
inline int read(){int x=0,f=1;char ch=getchar();while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}return x*f;}
const int maxn = 1e5 + 50;
const int mod = 1e9 + 7;

int op[maxn] , a[maxn] , n ,nxt[maxn];
long long prefix[maxn],dp[maxn],neg[maxn];
char s[maxn];

int main(int argc , char * argv[]){
	n=read();
	int pre = 1;
	long long ans = 0;
	op[0] = 1;
	for(int i = 1 ; i <= n ; ++ i){
		a[i] = read();
		if( i != n ){
			scanf("%s",s);
			if(s[0]=='-')
				op[i]=-1;
			else
				op[i]=1;
		}
		if(op[i-1]==-1)
			ans-=a[i];
		else
			ans+=a[i];
	}
	for(int i = 1 ; i <= n ; ++ i){
		prefix[i] = prefix[i - 1] + a[i] * op[i - 1];
		neg[i] = neg[i - 1] - a[i];
	}
	memset(nxt,-1,sizeof(nxt));
	for(int i = n ; i >= 1 ; -- i){
		nxt[i] = nxt[i + 1];
		if(op[i]==-1)
			nxt[i]=i+1;
	}
	dp[n]=a[n]*op[n-1];
	for(int i = n - 1 ; i >= 1 ; -- i){
		dp[i]=dp[i+1]+a[i]*op[i-1];
		if(op[i-1]==-1&&nxt[i]!=-1){
			dp[i]=max(dp[i],-(neg[n]-neg[nxt[i]-1])-(prefix[nxt[i]-1]-prefix[i]+a[i]));
		}
	}
	cout<<dp[1]<<endl;
	return 0;
}

Measured memory_bytes: 3712
S = input()
N = len(S)
MOD = 10**9 + 7

dp = [[0]*13 for _ in range(N+1)]
dp[0][0] = 1

for i in range(N):
    for j in range(13):
        if S[i] == '?':
            for k in range(10):
                dp[i+1][ (10*j+k)%13 ] += dp[i][j]
        else:
            k = int(S[i])
            dp[i+1][ (10*j+k)%13 ] += dp[i][j]
    for j in range(13):
        dp[i+1][j] %= MOD
print(dp[N][5])


Measured memory_bytes: 61788
w, h, n = map(int, input().split())

area = [[0 for i in range(w)] for j in range(h)]

for i in range(n):
    x, y, a = map(int, input().split())

    if a == 1:
        for j in range(0, h):
            for k in range(0, x):
                area[j][k] = 1
    elif a == 2:
        for j in range(0, h):
            for k in range(x, w):
                area[j][k] = 1
    elif a == 3:
        for j in range(0, y):
            for k in range(0, w):
                area[j][k] = 1
    else:
        for j in range(y, h):
            for k in range(0, w):
                area[j][k] = 1

ans = 0
for i in range(h):
    for j in range(w):
        if area[i][j] == 0: ans += 1

print(ans)

Measured memory_bytes: 3064
import sys
from collections import defaultdict, deque
import bisect
from heapq import *
from math import factorial
sys.setrecursionlimit(200000)
input = sys.stdin.readline

N, = map(int, input().split())
# N = int(input())
# L = [int(v) for v in input().split()]
# L = [[int(v) for v in input().split()] for _ in range(N)]
# L = [int(input()) for _ in range(N)]
# L = [list(input().strip())  for _ in range(N)]
# S = input().strip()

L = [[int(v) for v in input().split()] for _ in range(N - 1)]
Q, K = map(int, input().split())
QL = [[int(v) for v in input().split()] for _ in range(Q)]

m = {}
l = [set() for _ in range(N)]
for a, b, c in L:
    a -= 1
    b -= 1
    if m.get(a) == None:
        m[a] = {}
    if m.get(b) == None:
        m[b] = {}

    m[a][b] = c
    m[b][a] = c

    l[a].add(b)
    l[b].add(a)

ans = [None] * N
ans[K - 1] = 0
def dfs(now, a):
    for v in l[now]:
        p = a + m[now][v]
        if ans[v] == None:
            ans[v] = p
            dfs(v, ans[v])
        elif ans[v] > p:
            ans[v] = p
            dfs(v, ans[v])

dfs(K - 1, 0)
for x, y in QL:
    print(ans[x - 1] + ans[y - 1])

Measured memory_bytes: 204256
n = int(input())
nums = list(map(int, input().split()))
pairlist = []
for i in range(len(nums)):
    pairlist.append([i, nums[i]])

sortedPairList = sorted(pairlist, key=lambda item: item[1])

result = []
for i in sortedPairList:
    result.append(str(i[0]+1))
print(" ".join(result))

Measured memory_bytes: 74476
#include <iostream>
#include <cstdio>
using namespace std;
int a[10010];

int main(){
    int n, q, op;
    scanf("%d", &n);
    for(int i = 0; i < n; i++){
        scanf("%d", &a[i]);
    }
    scanf("%d", &q);
    int ans = 0;
    for(int i = 0; i < q; i++){
        scanf("%d", &op);
        for(int j = 0; j < n; j++){
            if(op == a[j]){
                ans++;
                break;
            }
        }
    }
    printf("%d\n", ans);
}



Measured memory_bytes: 3224
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b,c;
  cin>>a>>b>>c;
  if (a==b&&b==c){
    cout<<1<<endl;
  }
  else if(a==b || a==c || b==c){
    cout<<2<<endl;
  }
  else{
    cout<<3<<endl;
  }
}


Measured memory_bytes: 256
parseInt(x) = parse(Int32, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)

function main()
	n = readline() |> parseInt
	l = 0
	r = n
	println(0)
	ans = readline() |> chomp
	while r-l>1
		m = (l+r)>>1
		println(m)
		s = readline() |> chomp
		if s == "Vacant"
			break
		elseif s != ans
			if (m-l)%2==0
				r = m
			else
				l = m
				ans = s
			end
		else
			if (m-l)%2==1
				r = m
			else
				l = m
				ans = s
			end
		end
	end
end

main()

Measured memory_bytes: 119184
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
	ll n;
	scanf("%lld",&n);
	ll sum = 0;
	for(ll i = 1; i<= n; i++){
		if(i%15==0 || i%3==0 || i%5==0) continue;
		else sum += i;
	}
	printf("%lld",sum);
}


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

int main(){

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

    string s;
    cin >> s;
    int ans = 0;
    for(int i=0; i<s.length(); i++){
        if(s[i] == '+'){
            ans++;
        }else{
            ans--;
        }
    }

    cout << ans << '\n';
    return 0;
}

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

int main(){
	
	int a, b, c = 1;
	cin >> a >> b;
	while (c <= b){
		c *= 10;
	}
	for (int i = 0; i < 333; i ++){
		if (i * i == a * c + b){
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;
	return 0;
	
}

Measured memory_bytes: 256
import itertools
N = input()
A = map(int, input().split())
cnt = 0

for pair in itertools.combinations(A, 3):
    if (pair[0]!=pair[1]) and (pair[1]!=pair[2]) and (pair[0]!=pair[2]):
        if (pair[0]+pair[1] > pair[2]) and (pair[1]+pair[2] > pair[0]) and (pair[0]+pair[2] > pair[1]):
            cnt += 1

print(cnt)

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

#ifdef DEBUG
    #include "debug.h"
    #define dump(...)                                                              \
        DUMPOUT << "  " << string(#__VA_ARGS__) << ": "                            \
                << "[" << to_string(__LINE__) << ":" << __FUNCTION__ << "]"        \
                << endl                                                            \
                << "    ",                                                         \
            dump_func(__VA_ARGS__)
#else
    #define dump(...)
#endif


// http://beet-aizu.hatenablog.com/entry/2018/04/08/145516
template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

template<typename T,typename V>
typename enable_if<is_class<T>::value==0>::type
fill_v(T &t,const V &v){t=v;}

template<typename T,typename V>
typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t,const V &v){
  for(auto &e:t) fill_v(e,v);
}

//////////////////

#define int long long
 
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)

#define YES puts("YES")
#define Yes puts("Yes")
#define NO  puts("NO")
#define No  puts("No")
#define ALL(v) (v).begin(), (v).end()
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
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 (a>b) { a=b; return 1; } return 0; }

/*
#define mod 1000000007 /*/
#define mod 998244353 //*/

typedef pair<int, int> P;
#define INF (1LL<<60)


void solve(){
    int X, K, D;
    cin >> X >> K >> D;
    int sign = 1;
    if(X<0){
        sign = -1;
        X=-X;
    }
    int r = X / D;
    if(r>=K) X-=K*D;
    else{
        X -= r*D;
        K -= r;
        if(K%2==1) X-=D;
    }
    cout << abs(X*sign) << endl;
    
}


signed main(){
    cout << fixed << setprecision(18);
    cerr << fixed << setprecision(18);
    solve();
}


Measured memory_bytes: 3632
#include <array>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <deque>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cctype>
#include <cstring>
#include <ctime>
#include <iterator>
#include <bitset>
#include <numeric>
#include <list>
#include <iomanip>
using namespace std;


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

typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;

#define VV(T) vector<vector< T > >

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
	v.assign(a, vector<T>(b, t));
}

template <class F, class T>
void convert(const F &f, T &t){
	stringstream ss;
	ss << f;
	ss >> t;
}


#define REP(i,n) for(int i=0;i<int(n);++i)
#define ALL(v) (v).begin(),(v).end()
#define RALL(v) (v).rbegin(),(v).rend()
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define PB push


#define MOD 1000000007LL
#define EPS 1e-10

int main()
{
    string S;
    cin >> S;
    stack<char> s;
    int ans = 0;
    for (char c : S)
    {
        if (s.size() > 0)
        {
            if (s.top() == c)
            {
                s.push(c);
            }
            else
            {
                s.pop();
                ans += 2;
            }
        }
        else
        {
            s.push(c);
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
typedef long long int ll;
typedef long double ld;
using namespace std;
const long long int INF = 1e18;
const long long int mod = 1e9+7;

typedef pair<ll, ll> pairs;
typedef vector<pairs> p;

struct Edge{
    ll to, weight;
    Edge(ll t, ll w) : to(t), weight(w){}
};
using graph = vector<vector<ll>>;
using Graph = vector<vector<Edge>>;


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

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

ll keta(ll N){
    int tmp{};
    while( N > 0 ){
        tmp += ( N % 10 );
        N /= 10;
    }
    N = tmp;
    return N;
}

// 回文
bool kai(string S){
    bool flag = true;
    for(ll i=0;i<S.size()/2;++i){
        if(S[i] != S[S.size()-i-1]){
            flag = false;
            break;
        }
    }
    return flag;
}
// ---------------------------------------------

int main(){
    ll w, h, x, y;
    cin>>w>>h>>x>>y;
    ld ans = (ld)w * (ld)h / 2;

    ll t = 0;
    ld x0 = (ld)w / 2;
    ld y0 = (ld)h / 2;
    if((ld)x == x0 and (ld)y == y0){
        t = 1;
    }

    cout<<setprecision(10)<<ans<<' '<<t<<endl;

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
main(){
	while(0);
	int n;
	while(cin>>n,n){
		int k,m=n,a=0;
		for(int i=0;i<n;++i){
			cin>>k;
			if(k==0){
				m--;
			}else if(k>=2){
				a++;
			}
		}
		if(a==0)cout<<"NA"<<endl;
		else cout<<m+1<<endl;
	}
}

Measured memory_bytes: 1160
// A

#include <bits/stdc++.h>
using ll = long long;
using namespace std;
ll mod=1e9+7;

int main(){
  int A[2];
  cin>>A[0]>>A[1];
  for (int i(1);i<=3;i++){
    if (A[0] != i && A[1] != i){
      cout << i  << endl;
      return 0;
    } 
  }
  return 0;
}


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

typedef long long int lint;

int main()
{
    lint N;
    cin >> N;
    vector<lint> a(N);
    for (int i = 0; i < N; i++) {
        cin >> a[i];
    }

    lint al = 0;
    for (auto v : a) al = al ^ v;
    cout << (al ? "No" : "Yes") << endl;
    return 0;
}

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

const int MOD = (int)1e9 + 7;

int bin(int a, int n) {
    int res = 1;
    while (n) {
        if (n & 1) res = 1LL * res * a % MOD;
        a = 1LL * a * a % MOD;
        n >>= 1;
    }
    return res;
}

int inv(int x) {
    return bin(x, MOD - 2);
}

int main() {
#ifdef HOME
    freopen("in", "r", stdin);
#endif

    int n;
    bool first = 1;
    while (scanf("%d", &n) == 1) {
        if (first) first = 0;
        else printf("\n");

        vector<int> a(n + 1);
        for (int i = 0; i <= n; i++) scanf("%d", &a[i]);

        vector<vector<int> > pos(n + 1);
        for (int i = 0; i <= n; i++) pos[a[i]].push_back(i);

        vector<int> fct(n + 2), ofct(n + 2);
        fct[0] = 1;
        for (int i = 1; i <= n + 1; i++) fct[i] = 1LL * fct[i - 1] * i % MOD;
        ofct[n + 1] = inv(fct[n + 1]);
        for (int i = n; i >= 0; i--) ofct[i] = 1LL * ofct[i + 1] * (i + 1) % MOD;

        auto getC = [&](int n, int k) {
            if (n < 0 || n < k || k < 0) return 0LL;
            return 1LL * fct[n] * ofct[k] % MOD * ofct[n - k] % MOD;
        };

        int x, dif;
        for (int i = 1; i <= n; i++) {
            if (pos[i].size() > 1) {
                x = i;
                dif = pos[i][1] - pos[i][0];
            }
        }
        vector<int> ans(n + 2);
        for (int i = 1; i <= n + 1; i++) {
            ans[i] = (getC(n + 1, i) - getC(n + 1 - dif - 1, i - 1) + MOD) % MOD;
        }
        for (int i = 1; i <= n + 1; i++) printf("%d\n", ans[i]);
    }

#ifdef HOME
    cerr << clock() / (double)CLOCKS_PER_SEC << endl;
#endif
    return 0;
}

Measured memory_bytes: 8192
while True:
    a, op, b = input().split()   # 3変数ともに文字列として読み込む
    a =int(a)                   # a を整数に変換
    b = int(b)                   # b を整数に変換


    if op=="?": # opが"?"の時は終了
        break
    else:    #opが"?"以外の時
      if op=="+":
        print(a+b)
      elif op=="-":
        print(a-b)
      elif op=="*":
        print(a*b)
      elif op=="/":
        print(int(a/b))

     




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

#define REP(i, n) for(int (i)=0;(i)<(n);++(i))
#define REPV(iter, v) for(auto (iter)=(v).begin(); (iter)!=(v).end();++(iter))
#define ALL(v) (v).begin(),(v).end()

#define MOD 1000000007

using namespace std;

typedef long long ll;

int main()
{
    ll N, K;
    cin >> N >> K;
    vector<ll> l(N);
    REP(i, N) cin >> l[i];
    sort(ALL(l));
    reverse(ALL(l));
    ll ans = 0;
    REP(i, K) ans += l[i];

    cout << ans << endl;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define LOCAL
using namespace std;
template <typename A, typename B>
ostream& operator <<(ostream& out, const pair<A, B>& a) {
out << "(" << a.first << "," << a.second << ")";
return out;
}
template <typename T, size_t N>
ostream& operator <<(ostream& out, const array<T, N>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T>
ostream& operator <<(ostream& out, const vector<T>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T, class Cmp>
ostream& operator <<(ostream& out, const set<T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "}";
return out;
}
template <typename U, typename T, class Cmp>
ostream& operator <<(ostream& out, const map<U, T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& p : a) { out << (first ? "" : ", "); out << p.first << ":" << p.second; first = 0;} out << "}";
return out;
}
#ifdef LOCAL
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#else
#define trace(...) 42
#endif
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
const char* comma = strchr(names + 1, ',');
cerr.write(names, comma - names) << ": " << arg1 << " |";
__f(comma + 1, args...);
}
#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;
#define int long long
using P = pair<int,int>;
//#########################################
signed main(){
    string s;cin >> s;
    if(s == "Sunny")cout << "Cloudy" << endl;
    else if(s == "Cloudy")cout << "Rainy" << endl;
    else cout << "Sunny" << endl;
    return 0;
}

Measured memory_bytes: 3516
X,N = map(int,input().split())
P = list(map(int,input().split()))

P_n = [i for i in range(110) if i not in P]
abs_value = [abs(X-P_n[j]) for j in range(len(P_n))]

import sys

min_abs = min(abs_value)
for k in range(len(abs_value)):
    if abs_value[k] == min_abs:
        print(P_n[k])
        sys.exit()

Measured memory_bytes: 9112
#include<stdio.h>
int main(){
    int x,y,d,e;
    scanf("%d%d",&x,&y);
    if(x<y){
        printf("1\n");
    }
    else{
        d=x/y;
        e=x%y;
    if(e==0){
        printf("%d\n",d);
     }
    else{
        printf("%d\n",d+1);
     }
    }

return 0;
}


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

/**
 *  @brief Iterative segment tree: single update, range query
*/
struct segTree {
    int N;
    using S = int64_t;
    vector<S> val;
    segTree(int _n) : N(_n) {
        // initialize array
        val.resize(2 * N, 0);
    }
    S combine(S l, S r) {
        return max(l, r);
    }
    void update(int i, S d) {
        // this is assignment update
        for (val[i += N] = d; i >>= 1;) {
            val[i] = combine(val[i << 1], val[i << 1 | 1]);
        }
    }
    S query(int l, int r) {
        // query sum of range [l, r)
        S rl = 0, rr = 0;
        for (l += N, r += N; l < r; l /= 2, r /= 2) {
            if (l & 1)
                rl = combine(rl, val[l++]);
            if (r & 1)
                rr = combine(rr, val[--r]);
        }
        return combine(rl, rr);
    }
};

int main() {
    ios::sync_with_stdio(false), cin.tie(nullptr);
    int n;
    cin >> n;
    vector<int> h(n), a(n);
    for (int &it : h) cin >> it, --it;
    for (int &it : a) cin >> it;
    // find each increasing subsequences and check their sum
    segTree st(n);
    for (int i = 0; i < n; i++) {
        int64_t x = st.query(0, h[i] + 1);
        st.update(h[i], x + a[i]);
    }
    cout << st.query(0, n) << '\n';
    return 0;
}

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

int main() {
    string S;
    cin >> S;
    bool a = false;
    bool b = false;
    rep(i, 3){
        if(S[i] == 'A') a = true;
        if(S[i] == 'B') b = true;
    }
    if(a && b) cout << "Yes";
    else cout << "No";
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
   public static void main(String[] args) {
       Scanner sc = new Scanner(System.in);
       int n = sc.nextInt();
       int[] a = new int[n];
       int i;
       for(i=0; i<a.length ;i++){
           a[i] = sc.nextInt();
       }
       for(i = n-1 ;i >= 0;i--){
           if( i == 0){
               System.out.println(a[i]);
           }
           else{
            System.out.print(a[i] + " ");
           }
       }
       //System.out.println("");
   } 
}


Measured memory_bytes: 26200
#include<stdio.h>
 
int main(void){
	char n[3];
	int i;
	
	for(i=0;i<3;i++){
		scanf("%c",&n[i]);
	}
	
	for(i=0;i<3;i++){
		if(n[i]=='1'){
			n[i]='9';
		}
		else if(n[i]=='9'){
			n[i]='1';
		}
	}
	
	for(i=0;i<3;i++){
		printf("%c",n[i]);
	}
	
	return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
#define int long long
#define v(T) vector<T>
#define vb vector<bool>
#define pi pair<int,int>
#define ppi pair<pair,int,int>, int>
#define vpi vector<pair<int,int>>
#define w(t) int t; cin>>t; while(t--)
#define FIO  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
using namespace std;
void init() {
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
}
int fact[10];
int32_t main() {
	FIO;
	init();
	// w(t) {
	int n; cin >> n;
	// if(n%1000==0) cout<<'0'<<endl;
	cout << (1000 * (ceil(n * 1.0 / 1000)) - n) << endl;
	// }
}

Measured memory_bytes: 3804
N = int(input())
A = list(map(int,input().split()))

count = 0
exist_odd = 0
while 1:
    for i in range(N):
        if A[i] % 2 == 0:
        	A[i] /= 2
        else:
        	exist_odd = 1
    if exist_odd == 1:
        break
    count +=1

print(count)


Measured memory_bytes: 38512
//Radhe Radhe
#include<bits/stdc++.h>
#define ll long long
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define mod 1000000007
using namespace std;

int main()
{
    fast_io
    ll n,d;
    cin>>n>>d;
    if(n%(2*d+1)==0)
    cout<<n/(2*d+1)<<endl;
    else
    cout<<n/(2*d+1)+1<<endl;
   return 0;
}





Measured memory_bytes: 3592
package main

import (
  "fmt"
)

func main(){
  var D int
  var T int
  var S int

  //fmt.Println(">>")

  fmt.Scan(&D)
  fmt.Scan(&T)
  fmt.Scan(&S)

  if D<=T*S {
    fmt.Println("Yes")
  }else{
    fmt.Println("No")
  }
}


Measured memory_bytes: 1768