akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define ll long long int 
#define pb push_back
#define mod 1000000007
#define mk make_pair
int main() 
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n,wt;
    cin>>n>>wt;
    ll w[n+1]={0};
    ll v[n+1]={0};
    for(int i=1;i<=n;i++)
    cin>>w[i]>>v[i];
    ll dp[n+1][100002];
    for(int i=0;i<=n;i++)
    dp[i][0]=0;
     for(int i=1;i<=100001;i++)
    dp[0][i]=-1;
   /* for(int i=0;i<=100001;i++)
    {
        if(i>=v[1])
        dp[1][i]=w[1];
    }*/
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=100001;j++)
        {   if(dp[i-1][j]!=-1)
           {
                 dp[i][j]=dp[i-1][j];
                 if(v[i]<=j)
                 {
                     if(dp[i-1][j-v[i]]!=-1)
                     dp[i][j]=min(dp[i][j],dp[i-1][j-v[i]]+w[i]);
                     
                 }
           }
           else
           {
               if(v[i]<=j)
                 {
                     if(dp[i-1][j-v[i]]!=-1)
                     dp[i][j]=dp[i-1][j-v[i]]+w[i];
                     else
                     dp[i][j]=-1;
                     
                 }
                 else
                 dp[i][j]=-1;
           }
          
        }
        //cout<<endl;
    }int f=1;
    for(int i=100001;i>=0;i--)
    {
        for(int j=1;j<=n;j++)
        {
            
            if((dp[j][i]<=wt)&&(dp[j][i]>0) )
            {cout<<i;f=0;break;}//return 0;
        }
        if(f==0)break;
    }
    //cout<<ans;
    
    return 0;
}


Measured memory_bytes: 79232
type tree = Nil | Node of int * tree * tree

let create () = Nil

let insert x t =
  let rec doit = function
    | Nil -> Node (x, Nil, Nil)
    | Node (y, l, r) when x < y -> Node (y, doit l, r)
    | Node (y, l, r) -> Node (y, l, doit r)
  in doit t

let preorder f t =
  let rec doit = function
    | Nil -> ()
    | Node (x, l, r) -> (f x; doit l; doit r)
  in doit t

let inorder f t =
  let rec doit = function
    | Nil -> ()
    | Node (x, l, r) -> (doit l; f x; doit r)
  in doit t

let print t =
  let f e = print_string " "; print_int e in
  inorder f t;
  print_newline ();
  preorder f t;
  print_newline ()

let find x t =
  let rec doit = function
    | Nil -> false
    | Node (y, _, _) when x = y -> true
    | Node (y, l, _) when x < y -> doit l
    | Node (_, _, r) -> doit r
  in doit t

let split str delim =
  let open String in
  let rec doit s acc =
    match
      try Some (rindex s delim) with _ -> None
    with
    | None -> s :: acc
    | Some i ->
        let s1 = sub s 0 i in
        doit s1 (sub s (i + 1) (length s - length s1 - 1) :: acc)
  in doit str []

let () =
  let m = read_int () in
  let rec read i t =
    if i < m then begin
      match split (read_line ()) ' ' with
      | ["insert"; n] -> read (i + 1) (insert (int_of_string n) t)
      | ["find"; n] -> (print_endline (if find (int_of_string n) t then "yes" else "no"); read (i + 1) t)
      | _ -> (print t; read (i + 1) t)
    end in
  read 0 (create ())

Measured memory_bytes: 25060
#include <iostream>
 
int main()
{
    int a, b, c;
    std::cin >> a >> b >> c;
    if ((a < b) && (b < c)) {
        std::cout << "Yes" << std::endl;
    } else {
        std::cout << "No" << std::endl;
    }
    return 0;
}

Measured memory_bytes: 1156
#include <bits/stdc++.h>
const int INF=1e9,MOD=1e9+7;
const long long LINF=1e18;
using namespace std;
#define int long long
//template
bool f[1234][1234];
//main
signed main(){
  int H,W;cin>>H>>W;
  std::vector<string> s(H);
  for(int i=0;i<H;i++)cin>>s[i];
  typedef pair<int,int> P;
  queue<P> que1,que2;
  memset(f,0,sizeof(f));
  int sum=0;
  for(int i=0;i<H;i++)for(int j=0;j<W;j++)if(s[i][j]=='#'){que1.push(P(i,j));sum++;f[i][j]=1;}
  int now=0;
  int x[4]={-1,1,0,0};
  int y[4]={0,0,-1,1};
  while(sum<H*W){
    if(now%2==0){
      while(que1.size()){
        P p=que1.front();que1.pop();
        for(int i=0;i<4;i++){
          int px=p.first+x[i],py=p.second+y[i];
          if(px<0||px>=H||py<0||py>=W)continue;
          if(f[px][py]==0){
            f[px][py]=1;sum++;
            que2.push(P(px,py));
          }
        }
      }
    }
    else{
      while(que2.size()){
        P p=que2.front();que2.pop();
        for(int i=0;i<4;i++){
          int px=p.first+x[i],py=p.second+y[i];
          if(px<0||px>=H||py<0||py>=W)continue;
          if(f[px][py]==0){
            f[px][py]=1;sum++;
            que1.push(P(px,py));
          }
        }
      }
    }
    now++;
  }
  cout<<now<<endl;
}


Measured memory_bytes: 19124
n = int(input())
V = list(map(int,input().split()))
Ce = {}
Co = {}
for i in range(n):
    v = V[i]
    if i%2==0:
        if v not in Ce:
            Ce[v]=0
        Ce[v] += 1
    else:
        if v not in Co:
            Co[v]=0
        Co[v] += 1
Ce = sorted(list(Ce.items()),key=lambda x:x[1],reverse=True)
Co = sorted(list(Co.items()),key=lambda x:x[1],reverse=True)
if Ce[0][0]!=Co[0][0]:
    cnt = 0
    for i in range(1,len(Ce)):
        cnt += Ce[i][1]
    for i in range(1,len(Co)):
        cnt += Co[i][1]
    print(cnt)
else:
    cnt1 = 0
    for i in range(1,len(Ce)):
        cnt1 += Ce[i][1]
    if Ce[0][1]>n//2:
        cnt1 += Ce[0][1]-n//2
    cnt1 += Co[0][1]
    for i in range(2,len(Co)):
        cnt1 += Co[i][1]
    cnt2 = 0
    for i in range(1,len(Co)):
        cnt2 += Co[i][1]
    if Co[0][1]>n//2:
        cnt2 += Co[0][1]-n//2
    cnt2 += Ce[0][1]
    for i in range(2,len(Ce)):
        cnt2 += Ce[i][1]
    print(min(cnt1,cnt2))

Measured memory_bytes: 102196
n,*z=`dd`.split.map &:to_i
t=(e=[*0...n]).dup
a=z.shift n+1
n.downto(1){|i|a[i]-=a[i-1]}
k,*z=z
z.map{|x|t[x-2],t[x-1]=t[x-1],t[x-2]}
60.times{|i|k[i]>0&&e.map!{|q|t[q]};t=t.map{|q|t[q]}}
k,*a=a
n.times{|i|p k;k+=a[e[i]]}

Measured memory_bytes: 56396
/* Dsingh_24 */

#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define	endl		'\n'
#define pii         pair<ll int,ll int>
#define vi          vector<ll int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define hell        1000000007
#define rep(i,a,b)	for(ll int i=a;i<b;i++)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define ios	    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;

#define N  100005

int main()
{
	ios
	ll n,i,j;
	cin>>n;
	ll a[n+3],b[n+1];
	for(i=0;i<=n;i++)
		cin>>a[i];
	for(i=0;i<n;i++)
		cin>>b[i];
	ll ans=0;
	for(i=0;i<n;i++){
		ans+=min(b[i],a[i]);
		b[i]-=min(b[i],a[i]);
		ans+=min(b[i],a[i+1]);
		a[i+1]-=min(b[i],a[i+1]);
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define IDX(vec, element_iter) distance((vec).begin(), element_iter)
#define pb push_back
#define mp make_pair
#define INF9 1000000000 //10^9
#define MOD 1000000007 //10^9+7
#define fi first
#define sc second
using ll=long long;
using pll=pair<ll,ll>;
using vi=vector<int>;
using vll=vector<ll>;
using vstr=vector<string>;

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

    string s,t; cin >> s >> t;
    sort(ALL(s));
    sort(RALL(t));
    cout << ((s<t)?"Yes":"No") << endl;;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>

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

  std::string judge = ":(";
  if (a <= 8 && b <= 8) {
    judge = "Yay!";
  }

  std::cout << judge << std::endl;
  return 0;
}


Measured memory_bytes: 256
n, k = map(int, input().split())
a = list(map(lambda x: int(x)-1, input().split()))

passed = [False for _ in range(n)]
cur = 0
recurr_list = [cur]
passed[cur] = True
last = -1
for i in range(k):
    if passed[a[cur]]:
        last = a[cur]
        break
    else:
        recurr_list.append(a[cur])
        cur = a[cur]
        passed[cur] = True

if -1 == last:
    print(recurr_list[-1] + 1)
else:
    loop_start = recurr_list.index(last)
    loop_len = (len(recurr_list) - loop_start)
    res = (k - loop_start) % loop_len
    print(recurr_list[res + loop_start] + 1)


Measured memory_bytes: 105712
#include<stdio.h>

int main(void){
	int a,b;
	scanf("%d %d",&a,&b);
	if(a%3==0)
		printf("Possible");
	else{
		if(b%3==0)
		printf("Possible");
		else{
			if((a+b)%3==0){
				printf("Possible");	
			}
			else{
				printf("Impossible");
			}
		}
	}
}

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

int A[110];
long long C[110][2]={};

int main(){
  int N,P;
  cin >> N >> P;
  for(int i=0;i<N;i++){
    cin >> A[i];
  }

  C[0][0] = 1;
  C[0][A[0]%2] += 1;
  for(int i=0;i<N;i++){
    for(int j=0;j<2;j++){
      C[i][(A[i]+j)%2] += C[i-1][j];
      C[i][j] += C[i-1][j];
    }
  }

  cout << C[N-1][P];
}

Measured memory_bytes: 256
s = input()
alpha = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
for i in range(len(s)) :
    if s[i] in alpha :
        alpha.remove(s[i])
if alpha :
    print(alpha[0])
else :
    print("None")


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

int main() {
  int n;
  cin >> n;
  int count = 0;
  rep(i,n){
    int t;
    cin >> t;
    if(t!=i+1)count ++;
    if(count>2)break;
  }
  
  count>2 ? cout << "NO" : cout << "YES" ;
  cout << endl;
}


Measured memory_bytes: 256
def gcd(x, y):
    while (y):
        x, y = y, x % y
    return x
a,b,c,d=map(int,input().split())
total=b-a+1
f1=(b//c)-(a//c)
if a%c==0:
    f1+=1
f2=(b//d)-(a//d)
if a%d==0:
    f2+=1
gcd=gcd(c,d)
lcm=(c*d)//gcd
f3=(b//lcm)-(a//lcm)
if a%lcm==0:
    f3+=1
f=f1+f2-f3
print(total-f)


Measured memory_bytes: 3064
// --------------------<optimizations>--------------------
#pragma GCC optimize("O3")
//(UNCOMMENT WHEN HAVING LOTS OF RECURSIONS)\
#pragma comment(linker, "/stack:200000000")
//(UNCOMMENT WHEN TRYING TO BRUTEFORCE WITH A LOT OF LOOPS)\
#pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>

using namespace std;

#define ll long long
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define pii pair<ll,ll>
#define vpii vector<pair<ll,ll> >
#define F first
#define S second
#define ld long double
#define built __builtin_popcountll
#define mst(a,i) memset(a,i,sizeof(a))
#define all(x) x.begin(),x.end()
#define itit(it,a) for(auto it=(a).begin(); it!=(a).end(); it++)
#define rep(i,a,b) for(ll i=a; i<b; i++)
#define repr(i,a,b) for(ll i=a; i>b; i--)
#define reprr(i,a,b) for(ll i=a; i>=b; i--)
#define pi 3.14159265358979323846264338327950288419716939937510582097494459230
ll max3(ll x,ll y,ll z) {return max(max(x,y),z);}
ll min3(ll x,ll y,ll z) {return min(min(x,y),z);}
const ll M=2e5+10,M2=1e6+10,mod=1e9+7,inf=1e17+10;
void add(int& a, int b) {a+=b;if(a>=mod){a-=mod;}}
#define trace1(x)			 	 cerr<<#x<<": "<<x<<endl
#define trace2(x, y)		 	 cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)		 	 cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)	 	 cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)	 cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
int X[] = {0, 1, 0, -1};
int Y[] = {-1, 0, 1, 0};
ll power(ll x,ll n){ll result=1;while(n>0){if(n%2==1)result=(result*x)%mod; x=((x%mod)*(x%mod))%mod;n=n/2;}return result;}



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

	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	ll n,m;
	cin >> n >> m;
	ll vis[n+1]={0};
	rep(i,0,m){
		ll x;
		cin >> x;
		vis[x]=1;
	}

	ll dp[n+2]={0};
	dp[n]=1;
	for(ll i=n-1; i>=0; i--){
		if(vis[i]){
			dp[i]=0;
			continue;
		}
		dp[i]=(dp[i+1]+dp[i+2])%mod;
	}
	cout << dp[0];
	return 0;
}
/* The judge is never wrong! Your code is buggy 
   Look for:
 * * Read the problem carefully.
 * * Don't forget to sort(), mod, ll!!!!
 * * Initial value = +/- infinity instead of zero!!!
 * * an easier and alternate approach
 * * read the problem statement carefully
 * * if concept is correct and still WA, try with a different implementation
 * * special cases (n=1?)
 * * if you have no idea just guess the appropriate well-known algorithm instead of doing nothing :/
 */

Measured memory_bytes: 1792
#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
using namespace std;
#define rep(i,x) for(int i = 0; i < x; i++)
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<vector<vector<int>>> vvvi;
const ll MOD = 1e9+7;
const int n_max = 1e5+10;

int main(){
    ll n; cin >> n;
    priority_queue<int> pq_6, pq_9;
    // pq_6.push(1);
    ll money = 1;
    while(money <= n){
        pq_6.push(money);
        money *= 6;
    }
    money = 1;
    while(money <= n){
        pq_9.push(money);
        money *= 9;
    }

    // ll ans = 0;
    vector<ll> moneys_6, moneys_9;
    while(pq_6.size()){
        ll temp = pq_6.top();pq_6.pop();
        moneys_6.push_back(temp);
    }
    while(pq_9.size()){
        ll temp = pq_9.top();pq_9.pop();
        moneys_9.push_back(temp);
    }

    auto coins = [&](int x, int y){
        ll ans = 0;
        ll n_tmp = x;
        vector<ll> cc = (y == 6 ? moneys_6 : moneys_9);
        for(int i = 0; i < cc.size();i++){
            ll temp = cc[i];
            ll cnt = n_tmp/temp;
            n_tmp -= temp * cnt;
            ans += cnt;
            // cout << temp << ' ' << cnt << ' ' << n << ' ' <<  ans << ' ' << endl;
        }
        // cout << ans << endl;
        return ans;
    };

    ll res = INT_MAX;
    rep(i,n+1){
        ll temp = coins(i,6) + coins(n-i,9);
        res = min(res, temp);
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 256
// #pragma GCC target("avx")  // CPU 処理並列化
// #pragma GCC optimize("O3")  // CPU 処理並列化
// #pragma GCC optimize("unroll-loops")  // 条件処理の呼び出しを減らす
// #define BEGIN_STACK_EXTEND(size) void * stack_extend_memory_ = malloc(size);void * stack_extend_origin_memory_;char * stack_extend_dummy_memory_ = (char*)alloca((1+(int)(((long long)stack_extend_memory_)&127))*16);*stack_extend_dummy_memory_ = 0;asm volatile("mov %%rsp, %%rbx\nmov %%rax, %%rsp":"=b"(stack_extend_origin_memory_):"a"((char*)stack_extend_memory_+(size)-1024));
// #define END_STACK_EXTEND asm volatile("mov %%rax, %%rsp"::"a"(stack_extend_origin_memory_));free(stack_extend_memory_);

#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
#include<numeric>
#include<unordered_set>
#include<unordered_map>
#include<complex>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const long double EPS=1e-9;
const long double INF=1e+10;
const long double PI=acos(-1.0);
const int C_SIZE = 3100000;
const int UF_SIZE = 3100000;
namespace{
	long long fact[C_SIZE];
	long long finv[C_SIZE];
	long long inv[C_SIZE];
	long long Comb(int a,int b){
	 	if(a<b||b<0)return 0;
	 	return fact[a]*finv[b]%mod*finv[a-b]%mod;
	}
	void init_C(int n){
		fact[0]=finv[0]=inv[1]=1;
		for(int i=2;i<n;i++){
			inv[i]=(mod-(mod/i)*inv[mod%i]%mod)%mod;
		}
		for(int i=1;i<n;i++){
			fact[i]=fact[i-1]*i%mod;
			finv[i]=finv[i-1]*inv[i]%mod;
		}
	}
	long long pw(long long a,long long b){
		if(a<0LL)return 0;
		if(b<0LL)return 0;
		long long ret=1;
		while(b){
			if(b%2)ret=ret*a%mod;
			a=a*a%mod;
			b/=2;
		}
		return ret;
	}
	long long pw_mod(long long a,long long b,long long M){
		if(a<0LL)return 0;
		if(b<0LL)return 0;
		long long ret=1;
		while(b){
			if(b%2)ret=ret*a%M;
			a=a*a%M;
			b/=2;
		}
		return ret;
	}
	int pw_mod_int(int a,int b,int M){
		if(a<0)return 0;
		if(b<0)return 0;
		int ret=1;
		while(b){
			if(b%2)ret=(long long)ret*a%M;
			a=(long long)a*a%M;
			b/=2;
		}
		return ret;
	}
	int ABS(int a){return max(a,-a);}
	long long ABS(long long a){return max(a,-a);}
	double ABS(double a){return max(a,-a);}
	int sig(double r) { return (r < -EPS) ? -1 : (r > +EPS) ? +1 : 0; }
	int UF[UF_SIZE];
	void init_UF(int n){
		for(int i=0;i<n;i++)UF[i]=-1;
	}
	int FIND(int a){
		if(UF[a]<0)return a;
		return UF[a]=FIND(UF[a]);
	}
	void UNION(int a,int b){
		a=FIND(a);b=FIND(b);if(a==b)return;
		// if(UF[a]>UF[b])swap(a,b);
		UF[a]+=UF[b];UF[b]=a;
	}
}
// ここから編集しろ
int g[10][10];
int main(){
	int a;scanf("%d",&a);
	long long ret=0;
	for(int i=1;i<=a;i++){
		int fi=i%10;
		int la=i;
		while(la>=10)la/=10;
		g[fi][la]++;
	}
	for(int i=0;i<10;i++)for(int j=0;j<10;j++){
		ret+=(long long)g[i][j]*g[j][i];
	}
	printf("%lld\n",ret);
}

Measured memory_bytes: 128
#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;
    ll se=0;
    cin >> n;
    vector <ll> a(n);
    double aa;
    rep(i,n){
        cin >> aa;
        if((ll)aa==aa){
            ++se;
        }
        aa*=1e9;
        aa+=0.5;
        a[i]=(ll)aa;
    }

    vector <vector <ll>> kk(19,vector <ll>(19,0)),kk2;
    kk2=kk;
    int k2,k5;

    ll a2;
    rep(i,n){
        a2=a[i];
        k2=0;
        k5=0;
        while(a2%2==0){
            ++k2;
            a2/=2;
            if(k2==18){
                break;
            }
        }
        while(a2%5==0){
            ++k5;
            a2/=5;
            if(k5==18){
                break;
            }
        }

        ++kk[18-k2][18-k5];
        
        
    }

    

    rep(i,19){
        rep(j,19){
            rep(i2,19-i){
                rep(j2,19-j){
                    kk2[i+i2][j+j2]+=kk[i][j];
                }
            }
        }
    }

    ll ans=0;
    rep(i,19){
        rep(j,19){
            ans+=kk[18-i][18-j]*kk2[i][j];
        }
    }

    cout << (ans-se)/2 << endl;
    //cout << se << endl;

    

    return 0;
}

Measured memory_bytes: 4780
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < n; i++)
int main()
{
   char c;
   cin >> c;
   if (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u')
   {
      cout << "vowel" << endl;
   }
   else
   {
      cout << "consonant" << endl;
   }
   return 0;
}


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

ll calc_gcd(ll a, ll b) {
  if(a < b) calc_gcd(b, a);
  ll r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}
ll calc_lcm(ll a, ll b){
	ll m = calc_gcd(a,b);
	return m * (a/m) * (b/m);
}

int main(){
	ll a,b;
	cin >> a >> b;
	cout << calc_lcm(a,b) << endl;
	return 0;
}

Measured memory_bytes: 256
n = int(input())
graph = [[0] * n for _ in range(n)]

for i in range(n):
    data = [int(i) for i in input().split()]
    for j in range(data[1]):
        node = data[2 + j] - 1
        graph[i][node] = 1

for line in graph:
    print(" ".join(str(i) for i in line))



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

int main() {
  int A[3];

  rep(i, 3) cin >> A[i];

  sort(A, A+3);

  int ans = 0;

  ans += (A[2]-A[0]) / 2;
  ans += (A[2]-A[1]) / 2;
  A[0] += 2 * ((A[2]-A[0]) / 2);
  A[1] += 2 * ((A[2]-A[1]) / 2);

  sort(A, A+3);

  if (A[0] == A[2]) {
    cout << ans << endl;
  } else if(A[1] == A[2]) {
    ans += 2;
    cout << ans << endl;
  } else {
    ans++;
    cout << ans << endl;
  }

  return 0;

}

Measured memory_bytes: 256
#include<cstdio>
#define MAXN 100006
#include<algorithm>
#include<vector>
using namespace std;
vector<int> road[MAXN];
long long d[MAXN],a[MAXN];
int n,u,v,du[MAXN];
void DFS(int x,int father)
{
	if(du[x]==1)
	{
		d[x]=a[x];
		return;
	}
	long long sum=0,maxone=0;
	for(int i=0;i<(int)road[x].size();i++)
	{
		int nex=road[x][i];
		if(nex==father) continue;
		DFS(nex,x);
		sum+=d[nex];
		maxone=max(maxone,d[nex]);
	}
	if(a[x]>sum||a[x]*2<sum)
	{
		printf("NO");
		exit(0);
	}
	long long p=a[x]*2-sum;
	if(maxone-p>sum-maxone)
	{
		printf("NO");
		exit(0);
	}
	d[x]=p;
}
int main()
{
	//freopen("tree.in","r",stdin);
	//freopen("tree.out","w",stdout);
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
		scanf("%lld",&a[i]);
	for(int i=1;i<n;i++)
	{
		scanf("%d%d",&u,&v);
		road[u].push_back(v);
		road[v].push_back(u);
		du[u]++;
		du[v]++;
	}
	for(int i=1;i<=n;i++)
		if(du[i]!=1)
		{
			DFS(i,0);
			if(d[i]) printf("NO");
			else printf("YES");
			return 0;
		}
	if(a[1]==a[2]) printf("YES");
	else printf("NO");
}

Measured memory_bytes: 14336
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end())
#define VRSORT(v) sort(v.rbegin(), v.rend())//vectorの降順ソート
#define ll long long
#define pb(a) push_back(a)
#define INF 1000000000
#define MOD 1000000007
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

typedef vector<unsigned int>vec;
typedef vector<vec> mat;
//typedef tuple<ll, ll, ll> T;

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


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

int N,D[50];
int cnt[13],vis[24];

int count(){
    int mi=INF;
    REP(i,24) REP(j,24) if(vis[i] && vis[j] && i!=j){
        int d1=abs(i-j);
        int d2=24-d1;
        int d=min(d1,d2);
        mi = min(mi,d);
    }
    return mi;
}

int solve(){
    REP(i,N) cnt[D[i]]++;
    if(cnt[0]) return 0;
    vis[0]=1;
    vector<int> v;
    for(int i=1;i<12;i++){
        if(cnt[i]==1) v.push_back(i);
        else if(cnt[i]==2) vis[i]=vis[24-i]=1;
        else if(2<cnt[i]) return 0;
    }
    if(cnt[12]==1) vis[12]=1;
    else if(2<=cnt[12]) return 0;

    int M=v.size();
    if(M==0) return count();

    int ans=0;
    REP(mask,1<<M){
        REP(i,M){
            if(mask&(1<<i)) vis[v[i]]=1,vis[24-v[i]]=0;
            else vis[v[i]]=0,vis[24-v[i]]=1;
        }
        ans=max(ans,count());
    }
    return ans;
}
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin>>N;
    REP(i,N) cin>>D[i];
    cout<<solve()<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
 
typedef long long int ll;
 
using namespace std;
 
#define MOD (ll)1000000007
 
ll arr[1000000];
 
ll func(int p)
{
	ll ans = 1;
	if(p == 0) return 1;
	for(int i = 1; i <= p; i++)
	{
		ans = ((ans%MOD) * (2%MOD))%MOD;
	}
	return ans;
} 
 
int main(){
 
    ll n;
    cin >> n;
    for(ll i = 0; i < n; i++){
        cin >> arr[i];
    }
    ll sum = 0;
    for(ll i = 0; i < 64; i++){
        ll oc = 0, zc = 0;
        for(ll j = 0; j < n; j++){
            if(arr[j]%2 == 0){
                zc++;
            }
            else{
                oc++;
            }
            arr[j] /= 2;
        }
        ll idsum = ((zc%MOD)*(oc%MOD))%MOD;
        idsum  = ((idsum%MOD) * (func(i)%MOD))%MOD;
        sum = ((sum%MOD) + (idsum%MOD))%MOD;
    }
    cout << sum;
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
typedef long long ll;
#define MOD 1000000007
using namespace std;
#define MAX_V 1000
struct edge {
    int to, cap, rev;
};
vector<edge> G[MAX_V];
bool used[MAX_V];
void add_edge(int from, int to, int cap) {
    // G[to].size()をrevに保持することでG[edge.to][edge.rev]で逆辺の構造体にアクセスできる
    G[from].push_back((edge){to, cap, (int)G[to].size()});
    G[to].push_back((edge){from, 0, (int)G[from].size() - 1});
}
int dfs(int v, int t, int f) {
    if(v == t) {
        return f;
    }
    used[v] = true;
    for(int i = 0; i < (int)G[v].size(); i++) {
        edge &e = G[v][i];
        if(!used[e.to] && e.cap > 0) {
            int d = dfs(e.to, t, min(f, e.cap));
            // d==0ならtにたどり着かない
            if(d > 0) {
                e.cap -= d;
                G[e.to][e.rev].cap += d;
                return d;
            }
        }
    }
    return 0;
}
int max_flow(int s, int t) {
    int flow = 0;
    for(;;) {
        memset(used, 0, sizeof(used));
        int f = dfs(s, t, MOD);
        if(f == 0) {
            return flow;
        }
        flow += f;
    }
}
int main() {
    int n;
    cin >> n;
    vector<vector<int>> red(n, vector<int>(2));
    for(int i = 0; i < n; i++) {
        int a, b;
        cin >> a >> b;
        red[i][0] = a;
        red[i][1] = b;
    }
    vector<vector<int>> blue(n, vector<int>(2));
    for(int i = 0; i < n; i++) {
        int a, b;
        cin >> a >> b;
        blue[i][0] = a;
        blue[i][1] = b;
    }
    for(int i = 0; i < n; i++) {
        add_edge(0, i + 1, 1);
    }
    for(int i = 0; i < n; i++) {
        add_edge(i + n + 1, 2 * n + 1, 1);
    }
    for(int i = 0; i < n; i++) {
        for(int j = 0; j < n; j++) {
            if(red[i][0] < blue[j][0] && red[i][1] < blue[j][1]) {
                add_edge(i + 1, j + n + 1, 1);
            }
        }
    }
    cout << max_flow(0, 2 * n + 1) << endl;
}

Measured memory_bytes: 3752
#include <iostream>
#include <iomanip>
#include <sstream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <complex>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <cassert>
#include <climits>
#include <queue>
#include <set>
#include <map>
#include <valarray>
#include <bitset>
#include <stack>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
typedef long long ll;
typedef pair<int,int> pii;
const int INF = 1<<29;
const double PI = acos(-1);
const double EPS = 1e-8;

const int N = 20;

int v[N];
int next[N];
int main() {
  int n,m;
  int T = 0;
  while(cin>>n>>m,n||m) {
    memset(v,0,sizeof(v));
    v[0] = n;
    int cnt = 0;
    while(v[m]<1) {
      memset(next,0,sizeof(next));
      REP(i, N) {
        if (v[i]%2) {
          next[i]++;            // ツ暗ェツ人ツつカツづ。ツづアツつッツづアツつオツづ按つ「
        }
        next[i+1]+=v[i]/2;
        next[0]+=v[i]/2;
      }
      //REP(i, 20) cout << v[i] << " ";cout << endl;
      memcpy(v,next,sizeof(next));
      cnt++;
    }
    printf("Case %d: %d\n", ++T, cnt);
  }
}

Measured memory_bytes: 0
///   Journey to the End of earth   ///
/// Gunjan Kumar ///
#include<bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp> 
// #include <ext/pb_ds/tree_policy.hpp> 
// #include <functional> // for less 
// using namespace __gnu_pbds; 
using namespace std;
#define ll  long long
#define s(n) scanf("%d",&n)
#define ls(n) scanf("%lld",&n)
#define p(n) printf("%d",n)
// #define ln() printf("\n")
#define pln(n) printf("%d\n",n)
#define lpln(n) printf("%lld\n",n)
#define rep(i,a,n) for(int i=a;i<n;i++)
#define rev(i,a,n) for(int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define gcd __gcd
#define tc           ll t1; cin>>t1; while(t1--)
#define inp         ll n; cin>>n; ll arr[n]; rep(i,0,n) cin>>arr[i];
#define vect vector<ll>
#define sortv(v)       sort(v.begin(),v.end())
#define lower(v,n)    lower_bound(v.begin(),v.end(),n)-v.begin()
#define upper(v,n)    upper_bound(v.begin(),v.end(),n)-v.begin()
#define bitcount(n) __builtin_popcount(n)
#define ln <<endl
#define inf          LONG_MAX
#define ninf         LONG_MIN
#define fast         ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
const   ll mod=1e9+7;
const ll N=1e5+5;



int main()
{

         ios_base::sync_with_stdio(false);
         
         int x;
         cin >> x;
         if(x<=599)
          cout<<8;
       else if(x<=799)
          cout<<7;
       else if(x<=999)
          cout<<6;
       else if(x<=1199)
          cout<<5;
      else  if(x<=1399)
          cout<<4;
      else  if(x<=1599)
          cout<<3;
      else  if(x<=1799)
          cout<<2;
      else  if(x<=1999)
          cout<<1;
         
        
     return 0;
}



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

int main() {
    int n; cin >> n;
    vector<vector<int>> v(n, vector<int>(3));
    for(int i = 0; i < n; ++i) {
        for(int j = 0; j < 3; ++j) {
            cin >> v[i][j];
        }
    }

    vector<vector<int>> dp(n + 1, vector<int>(3));
    for(int i = 0; i < n; ++i) {
        for(int pre = 0; pre < 3; ++pre) {
            for(int nxt = 0; nxt < 3; ++nxt) {
                if(nxt == pre) continue;
                dp[i + 1][nxt] = max(dp[i + 1][nxt], dp[i][pre] + v[i][nxt]);
            }
        }
    }

    cout << *max_element(begin(dp[n]), end(dp[n])) << endl;
}


Measured memory_bytes: 11136
#include<iostream>
#include<string>

int main(){
    std::string str;
    int m,h;
    //std::string shuf;
    
    while(1){
        std::cin>>str>>m;
            if(str=="-"){
                break;
            }

        for(int shu=0; shu<m; shu++){
            std::cin>>h;
            //shuf = str.substr(0,h);
            //str.erase(str.begin(), str.begin()+h);
            str = str.substr(h,str.size()-h)+str.substr(0,h);
        }
        std::cout<< str <<std::endl;
    }
    return 0;
}


Measured memory_bytes: 3220
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define f first
#define s second
#define Fast ios_base::sync_with_stdio(false);cin.tie(NULL);
#define fo(a,b,c) for(int i=a;i<b;i+=c)  
typedef pair<ll , pair<ll, ll> > pi;
int pow(int x,int y){
    int res=1;
    while(y){
        if(y&1) res*=x;
        y>>=1;
        x*=x;
    }
    return res;
}   
struct Compare {
    constexpr bool operator()(pi const & a,
                              pi const & b) const noexcept
    { return a.first < b.first || (a.first == b.first && a.second.first > b.second.first); }
 
};
void prefix_function( string s,ll arr[] )
{
     long long border=0; arr[0]=0;
    for(long long i=1;i<s.size();i++)
    {
      while(border>0 && s[i]!=s[border])
        border=arr[border-1];
     
     if(s[i]==s[border])
         border++;
      else
       border=0;
      
      arr[i]=border;
    }
}
ll mod=998244353;
ll add( ll a , ll b)
{
    return (((a%mod)+(b%mod))%mod);
}
ll mul(ll a,ll b)
{
  return (((a%mod)*(b%mod))%mod);
}
//send mod-2 for a^-1 if mod is a prime number
ll binpow(ll a, ll b) {
    ll res = 1;
    while (b) {
        if (b & 1) res = mul(res, a);
        a = mul(a, a);
        b >>= 1;
    }
    return res;
}
ll dsu_arr[100000];
ll dsu_sz[100000];
void dsu(ll n)
{
    for(ll i=0;i<=n;i++)
    {
        dsu_arr[i]=i;
        dsu_sz[i]=1;
    }
}
ll find(ll x)
{
     ll root=x;
    while (root!=dsu_arr[root])
    {
        root=dsu_arr[root];
    }
    while(x!=dsu_arr[x])
    {
        dsu_arr[x]=root;
        x=dsu_arr[x];
    }
    return root;
}
ll merge(ll x,ll y)
{
    ll root1=find(x);
    ll root2=find(y);
    
    if(root1==root2)
    return 0ll;
 
    if(dsu_sz[x]>dsu_sz[y]){
    dsu_arr[root2]=root1;
    dsu_sz[x]+=dsu_sz[y];
    }
    else
    {
         dsu_sz[y]+=dsu_sz[x];
        dsu_arr[root1]=root2;
    }
    return 1ll;
}


int main()
{
ll n,x,t;
cin>>n>>x>>t;
ll ans=(n+(x-1))/x;
cout<<ans*t<<endl;

}



   
      
    
        



Measured memory_bytes: 3560
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define chmax(a, b) a = (a >= b ? a : b)
#define chmin(a, b) a = (a <= b ? a : b)
#define out(a) cout << a << endl
#define outa(a, n) { rep(_, n) cout << a[_] << " "; cout << endl; }
#define outp(a, n) { cout << endl; rep(_, n) cout << a[_].F << " " << a[_].S << endl; }
#define sz(v) (int)v.size()
#define inf (int)(1e9+7)
#define abs(x) (x >= 0 ? x : -(x))
#define ceil(a, b) a / b + !!(a % b)
#define FIX(a) fixed << setprecision(a)
#define LB(v, n) (int)(lower_bound(all(v), n) - v.begin())
#define UB(v, n) (int)(upper_bound(all(v), n) - v.begin())
ll pow(ll a, int b) { return b ? pow(a * a, b / 2) * (b % 2 ? a : 1) : 1; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }




using P = complex<double>;
double dot(P a, P b) { return real(conj(a) * b); }
double cross(P a, P b) { return imag(conj(a) * b); }
const double eps = 1e-8;

int ccw(P p0, P p1, P p2) {
    P a = p1 - p0;
    P b = p2 - p0;
    
    if (cross(a, b) > 0) return 1; // counter clockwise
    if (cross(a, b) < 0) return -1;
    // 以下外積が0, 平行
    if (dot(a, b) < 0) return 2; // p2, p0, p1
    if (norm(a) < norm(b)) return -2; // p0, p1, p2
    return 0;
}

int main() {
    double p0x, p0y, p1x, p1y;
    cin >> p0x >> p0y >> p1x >> p1y;
    P p0 = P(p0x, p0y), p1 = P(p1x, p1y);
    
    int query;
    cin >> query;
    while (query--) {
        
        double p2x, p2y;
        cin >> p2x >> p2y;
        P p2 = P(p2x, p2y);
        
        switch(ccw(p0, p1, p2)) {
            case 1:
                cout << "COUNTER_CLOCKWISE" << endl;
                break;
            case -1:
                cout << "CLOCKWISE" << endl;
                break;
            case 2:
                cout << "ONLINE_BACK" << endl;
                break;
            case -2:
                cout << "ONLINE_FRONT" << endl;
                break;
            default:
                cout << "ON_SEGMENT" << endl;
                break;
        }
        
    }
}



Measured memory_bytes: 3264
import sys

def solve():
    input = sys.stdin.readline
    N = int(input())
    A = [int(a) for a in input().split()]
    B = [int(b) for b in input().split()]
    C = [int(c) for c in input().split()]
    C.append(10 ** 10)
    A.sort()
    B.sort()
    C.sort()
    B_choise = [0] * N
    C_i = 0
    for i, b in enumerate(B):
        while C[C_i] <= b: C_i += 1
        B_choise[i] = N - C_i
    B_choise_sum = [0] * (N + 1)
    for i in reversed(range(N)):
        B_choise_sum[i] = B_choise_sum[i+1] + B_choise[i]
    
    B.append(10 ** 10)
    B_i = 0
    Ans = 0
    for i, a in enumerate(A):
        while B[B_i] <= a: B_i += 1
        Ans += B_choise_sum[B_i]
    print(Ans)
  
    return 0

if __name__ == "__main__":
    solve()

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

int main() {
  int n;
  cin >> n;
  vector<ll> a(n), b(n);
  rep(i,n){
    cin >> a[i];
    b[i] = a[i];
  }
  sort(b.begin(), b.end());
  ll bigger = b[n / 2];
  ll smaller = b[n / 2 - 1];
  rep(i, n){
    if(a[i] <= smaller){
      cout << bigger << endl;
    }else{
      cout << smaller << endl;
    }
  }
}

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

int main(){
	int n,x;
	cin >> n >> x;
	
	int sum=0;
	int tmp=0;
	int sml = 1000000;
	for(int i=0; i<n; i++){
		cin >> tmp;
		sml=min(tmp, sml);
		sum+=tmp;
	}
	int add=(x-sum)/sml;
	cout << n+add << endl;
}

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

int main() {
    int N;
    cin >> N;
    string string_N = to_string(N);
    int string_length = (int)string_N.length();
    
    //cout << N << endl;
    //cout << string_N << endl;
    //cout << string_length << endl;
    
    int x = 0;
    for (int i = 0; i < string_length; i++){
        //cout << string_N[i] << endl;
        int string_i = string_N[i];
        x += string_i - 48;
        //cout << x << endl;
    }
    
    if (N % x == 0){
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
    
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<math.h>
#include<queue>
#include<string>
#include<vector>
#include<tuple>
#include<stack>
#include<iomanip>
#include<map>
using namespace std;

int main() {

	string a, b, c;

	cin >> a >> b >> c;

	char dif = 'A' - 'a';

	printf("%c%c%c\n", a[0] + dif, b[0] + dif, c[0] + dif);

	return 0;

}


Measured memory_bytes: 256
n,w = map(int, input().split())
wv = []
for _ in range(n):
    data = list(map(int,input().split()))
    wv.append(data)

dp = [[0 for i in range(w+1)] for j in range(n+1)]

for item in range(n):
    now_w=wv[item][0]
    now_v=wv[item][1]

    for weight in range(w+1):
        ans1=dp[item][weight]
        ans2=-1
        if weight - now_w >= 0:
            ans2=dp[item][weight-now_w]+now_v
        dp[item+1][weight] = max(ans1,ans2)

print(dp[n][w])

Measured memory_bytes: 171912
#include <stdio.h>
#include <string>
#include <iostream>
#include <vector>
#include <queue>
#include <list>
#include <algorithm>
#include <map>
#include <iterator>
#include <limits>
#include <numeric>
#include <type_traits>
#include <cmath>
#include <cstdlib>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
using namespace std;

#define ALL(v) (v).begin(), (v).end()
#define endl "\n"
typedef long long int ll;

template<typename T>
ostream& operator << (ostream& os, vector<T>& vec) {
	for (int i = 0; i<vec.size(); i++) {
		os << vec[i] << (i + 1 == vec.size() ? "" : " ");
	}
	return os;
}

int SumDigitValues(int x)
{
	int sum = 0;
	while (x)
	{
		sum += x % 10;
		x = x / 10;
	}

	return sum;
}

int Factorial(int n)
{
	if (n < 0) return 0;
	if (n == 0) return 1;
	return n * Factorial(n - 1);
}

int factorial(int n)
{
	if (n > 1)
	{
		return n * factorial(n - 1);
	}
	else
	{
		return 1;
	}
}


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

vector<int> Divisors(int x)
{
	vector<int> divisors;
	divisors.push_back(1);
	for (int a = 2; a <= x; a++)
	{
		if (x % a == 0) divisors.push_back(a);
	}
	return divisors;
}

vector<int> CommonDivisors(int a, int b)
{
	vector<int> divisorsA = Divisors(a);
	vector<int> divisorsB = Divisors(b);
	vector<int> commonDivisors;
	set_intersection(divisorsA.begin(), divisorsA.end(), divisorsB.begin(), divisorsB.end(), std::back_inserter(commonDivisors));
	return commonDivisors;
}

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

	int r;
	cin >> r;

	cout << 3 * r * r << endl;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
	int a;
	int b;
	int c;

	int difference1;
	int difference2;

	cin >> a;
	cin >> b;
	cin >> c;

	difference1 = b - a;
	difference2 = c - b;

	if (difference1 == difference2) {
		cout << "YES" << endl;
	}
	else{
		cout << "NO" << endl;
	}


}

Measured memory_bytes: 256
import qualified Data.ByteString.Char8 as BS
import Data.Maybe

readInt = fst . fromJust . BS.readInt

readString = map BS.unpack . BS.words

getInt = readInt <$> BS.getLine

getString = readString <$> BS.getLine

calc :: String -> Int -> Int -> Int
calc [c] k k' = k'
calc s k k'
  | c == 'E' && c' == 'E' = calc s' (k - 1) (minimum [k', k - 1])
  | c == 'E' && c' == 'W' = calc s' k k'
  | c == 'W' && c' == 'E' = calc s' k k'
  | c == 'W' && c' == 'W' = calc s' (k + 1) k'
  where
    c = head s
    s' = tail s
    c' = head s'

main = do
  n <- getInt
  [s] <- getString
  let s' = tail s
  let k = length (filter (\x -> x == 'E') s')
  print $ calc s k k


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

int main(){
    long long n, d, p, q;
    int sum = 0;
    cin >> n >> d;
    for (int i ; i < n; i++){
        cin >> p >> q;
        if (p*p + q*q <=d*d){
            sum++;
        }
    }
    cout << sum << endl;
    return 0;
}

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

int main (void)
{

  char text[10];
  char *s1 = "Sunny";
  char *s2 = "Cloudy";
  char *s3 = "Rainy";

  scanf("%s",text);

  if(strcmp(text, s1) == 0){
    printf("%s",s2);
  }
  else if(strcmp(text, s2) == 0){
    printf("%s",s3);
  }
  else if(strcmp(text, s3) == 0){
    printf("%s",s1);
  }

  return 0;
}


Measured memory_bytes: 128
using System;
using System.Linq;

class Circle
{
    static void Main()
    {
            string str;
            {
                for(;;){
                str = Console.ReadLine();
                int a = int.Parse(str.Split(' ')[0]);
                char b = char.Parse(str.Split(' ')[1]);
                int c = int.Parse(str.Split(' ')[2]);
                if (b == '?') { break; }
                else if(b=='+'){
                Console.WriteLine("{0}", a+c);
                }
                else if(b=='-'){
                Console.WriteLine("{0}", a-c);
                }
                else if(b=='*'){
                Console.WriteLine("{0}", a*c);
                }
                else if(b=='/')
                {
                Console.WriteLine("{0}", a/c);
                }
                }
            }
    }
}

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

int main() {
  int A,B,C;
  cin >> A >> B >> C;
  if(A + B + C == 17){
    if(A == 5){
      if(B == 5 || C == 5){
        cout << "YES" << endl;
      }
    }   
    else if(A == 7){
      if(B == 5){
          cout << "YES" << endl;
      }
    }
    else{
      cout << "NO" << endl;
    }
  }
  else{
    cout << "NO" << endl;
  }
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <climits>
#include <set>
#include <algorithm>
#include <unordered_map>
#include <queue>
#include <iomanip>
#include <map>
#include <utility>
#include <numeric>
#include <chrono>
#include <ctime>
#include <bitset>

#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define P pair<int, int>
#define debug(x) cerr << #x << ": " << x << ", "
#define debugln(x) cerr << #x << ": " << x << '\n'

using namespace std;
using ll = long long;
const ll mod = 1e9+7;

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

  int n, k; cin >> n >> k;
  vector<bool> notuse(10);
  rep(i, k) {
    int d; cin >> d;
    notuse.at(d) = true;
  }

  for(int i = n;; i++) {
    bool flag = true;
    int tmp = i;
    while (tmp > 0) {
      int rem = tmp%10;
      if (notuse.at(rem)) {
        flag = false;
        break;
      }
      tmp /= 10;
    }
    if (flag) {
      cout << i << endl;
      return 0;
    }
  }

}

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

const ll INF = 1LL << 50;
struct edge {
    int to;
    ll cost;
};

vector<edge> G[800];
int n;

ll c[800][2];

void dfs(int v, int prev) {
    ll sum = 0;
    for (edge e : G[v]) {
        if (e.to == prev) continue;
        dfs(e.to, v);
        if (G[e.to].size() == 1) {
            sum += e.cost;
        } else {
            sum += c[e.to][0] + 3 * e.cost;
        }
    }

    c[v][0] = sum;
    if (G[v].size() != 1 || prev == -1) {
        c[v][1] = INF;
        for (edge e : G[v]) {
            if (e.to == prev) continue;
            ll cost = sum;
            if (G[e.to].size() != 1) {
                cost -= c[e.to][0] + 2 * e.cost;
                cost += c[e.to][1] + e.cost;
            }
            c[v][1] = min(c[v][1], cost);
        }
    } else {
        c[v][1] = 0;
    }
}

int main() {
    while (cin >> n, n) {
        ll p[800], d[800];
        for (int i = 1; i < n; i++) {
            cin >> p[i];
            p[i]--;
        }
        for (int i = 1; i < n; i++) {
            cin >> d[i];
        }

        for (int i = 0; i < n; i++) {
            G[i].clear();
        }
        for (int i = 1; i < n; i++) {
            G[i].push_back(edge{ int(p[i]), d[i] });
            G[p[i]].push_back(edge{ int(i), d[i] });
        }

        ll ans = INF;
        for (int i = 0; i < n; i++) {
            dfs(i, -1);
            ans = min(ans, c[i][1]);
        }
        cout << ans << endl;
    }

}

Measured memory_bytes: 3336
#include<stdio.h>

#define MAX 1000000

int a[100][2],m[100][100],p[100];

int min(int i,int j){
  if(i<j) return i;
  else return j;
}

void matrixChainOreder(int n){
  
  int i,j,k,l,q;

  for(i=1;i<=n;i++){
    m[i][i] = 0;
  }
  for(l=2;l<=n;l++){
    for(i=1;i<=n-l+1;i++){
      j = i+l-1;
      m[i][j] = MAX;
      for(k=i;k<j;k++){
	q = m[i][k] + m[k+1][j] + p[i-1]*p[k]*p[j];
	m[i][j] = min(m[i][j],q);
      }
    }
  }
  
}

int main(void){
  
  int i,j,n,l,k;

  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d%d",&a[i][0],&a[i][1]);
  }
  
  p[0] = a[0][0];
  p[1] = a[0][1];

  for(i=2;i<=n;i++){
    p[i]=a[i-1][1];
  }
  
  matrixChainOreder(n);
  
  
  
  // 確認用
  /*  for(i=0;i<=n;i++){
    printf("%d ",p[i]);
    }*//*
  for(i=n;i>0;i--){
    for(j=1;j<=i-n+2;j++){
      printf("%d ",m[i][j]);
    }
    printf("\n");
    }*/
  /*
  for(j=1;j<=n;j++){
      for(i=1;i<=n-j+1;i++){
        printf("%d ",m[i][j]);
      }
    printf("\n");
    }*/
  printf("%d\n",m[1][n]);
  return 0;
}

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


int main(){

 int a;
  rep(i,5){
  cin >> a;
    if(a==0)
      cout << i+1 << endl;
  }
 
  
}

Measured memory_bytes: 3620
A, B, C = map(int, input().split())

def ans1(): # 全ての組み合わせを調べる
    return max([
        10*A + B + C, # 10*A + C + B, 
        10*B + A + C, # 10*B + C + A, 
        10*C + A + B, # 10*C + B + A, 
    ])

def ans2():
    return A + B + C + 9*max([A, B, C])

#print(ans1())
print(ans2())

Measured memory_bytes: 3316
#pragma GCC optimize("O3")
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;

using ll = long long;
using P = pair<int, int>;
using T = tuple<int, int, int>;

template <class T> inline T chmax(T &a, const T b) {return a = (a < b) ? b : a;}
template <class T> inline T chmin(T &a, const T b) {return a = (a > b) ? b : a;}

constexpr int MOD = 1e9 + 7;
constexpr int inf = 1e9;
constexpr long long INF = 1e18;
constexpr double pi = acos(-1);
constexpr double EPS = 1e-10;

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

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

    int a, b; cin>>a>>b;
    cout << max({a+b, a-b, a*b}) << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <utility>
#include <cmath>
#include <random>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <algorithm>
using namespace std;

#define rep(i,n) for(int i = 0; i<n; ++i)
#define REP(i,n) for(int i = 1; i<=n; ++i)
#define all(x) begin(x),end(x)
#define show(obj) {for(auto x:obj)cout<<x<<' ';cout<<endl;}
#define line "----------"
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll,ll> LP;
const int inf = 1001001000;
const ll INF = 1LL<<60;
const int MOD = (int)1e9 + 7;

int main(){
	string s, t;
	cin >> s >> t;
	int ans = inf;
	for(int i = 0; i + t.size() <= s.size(); ++i){
		string k = s.substr(i, t.size());
		int cnt = 0;
		rep(j, t.size()){
			if(t[j] != k[j])++cnt;
		}
		ans = min(ans, cnt);
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3624