akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

using ll = long long;
using ull = unsigned long long;
using ld = long double;

#define MOD 1000000007LL

#define rep(i, n) for(ll (i) = 0LL;(i) < (ll)(n);(i)++)
#define rep2(i, s, e) for(ll (i) = (ll)(s);(i) < (ll)(e);(i)++)
#define repi(i, n) for(ll (i) = 0LL;(i) <= (ll)(n);(i)++)
#define repi2(i, s, e) for(ll (i) = (ll)(s);(i) <= (ll)(e);(i)++)
#define per(i, n) for(ll (i) = (ll)(n) - 1LL;(i) >= 0LL;(i)--)
#define per2(i, s, e) for(ll (i) = (ll)(s) - 1LL;(i) >= (ll)(e);(i)--)
#define peri(i, n) for(ll (i) = (ll)(n);(i) >= 0LL;(i)--)
#define peri2(i, s, e) for(ll (i) = (ll)(s);(i) >= (ll)(e);(i)--)
#define iter(i, it) for(auto &(i): (it))

template<typename T, typename U> ostream& operator<<(ostream &s, const pair<T, U> m) {
    cout << "(" << m.first << ", " << m.second << ")";
    return s;
}
template<typename T, typename U> ostream& operator<<(ostream &s, const map<T, U> m) {
    ll c = 0;
    cout << "{ ";
    iter(i, m) cout << i << (c++ == m.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const vector<T> &v) {
    cout << "{ ";
    rep(i, v.size()) cout << v[i] << (i == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const list<T> &v) {
    ll c = 0;
    cout << "{ ";
    iter(i, v) cout << i << (c++ == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}

int main(void) {
    ll N;
    ll ans;
    cin >> N;
    cin >> ans;
    rep(i, N - 1) {
        ll temp;
        cin >> temp;
        ans = __gcd(ans, temp);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
typedef long long ll;
typedef pair<int, int> P;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i, n) for (ll i = 0; i < n; i++)
#define Rep(i, r, n) for (ll i = r; i < n; i++)
#define debug(x) cout << #x << " =" << (x) << endl;
#define MOD 1000000007
#define EPS (1 >> 30)
#define INF (1 << 30)
//#define INFll (1LL << 60)

signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(10);
    //---------------------------------------------
    
    int a,b;
    cin>>a>>b;
    int ans=max(a+b,a*b);
    ans=max(ans,a-b);
    cout<<ans<<endl;
}

Measured memory_bytes: 256
n, m = map(int, input().split())
sc = [list(map(int, input().split())) for i in range(m)]

for i in range(1000):
  t = str(i)
  if len(t) != n: continue
  judge = True
  for s, c in sc:
    if t[s-1] != str(c):
      judge = False
  if judge:
    print(t)
    exit(0)
print(-1)

Measured memory_bytes: 39152
#include <cstdio>
#include <bits/stdc++.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <cmath>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <map>
using ll = long long;
#define rep(i,n) for (ll i=0;i<n;i++)
using namespace std;

void solve(){

}

// int search(int q,int w,int e){
//     int ans=0;
//     rep(i,(e + q - 1)/q + 1){
//         rep(j,(e + w - 1)/w + 1){
//             if ((i*q+w*j)<=e){
//                 ans=max(ans,i*q+w*j);
//             }
            
//         }
//     }
//     return ans;
// }

int main (){
    ios::sync_with_stdio(0);
    cin.tie(0);
    ll a,b,c,d,e,f;
    cin >> a >> b >> c >> d >> e >> f ;

    ll ansx = 0,ansy = 10000;

    // double ans = 0;

    // rep(i,f+1){
    //     rep(j,f+1){
    //         double W = c*i  + d*j;

    //         if(W<=f){
    //             int tmp = W*100 / e;
    //             if(tmp>f-W){
    //                 continue;
    //             }
    //             bool p = false;
    //             rep(k,f/100+1){
    //                 if((tmp-k*a*100)%(b*100)==0){
    //                     p = true;
    //                 }
    //             }
    //             if(!p) continue;
    //             if((double) W/(tmp+W) > ans){
    //                 ans = (double) W/(tmp+W);
    //                 ansx = W;
    //                 ansy  = tmp;
    //             }
    //         }


    //     }
    // }



    rep(i,31){
        rep(j,31){
            rep(k,1501){
                rep(l,1501){
                    int s = (i*a + j*b)*100 + c*k + d*l;
                    // double q = (c*k + d*l)  / (double)s; 
                    if(s>f) continue;
                    if(c*k + d*l > e*(i*a + j*b)) continue;

                    if(ansx*(i*a + j*b)*100 <= ansy*(c*k + d*l)){
                        ansx = c*k + d*l;
                        ansy = (i*a + j*b)*100;
                    }
                }
            }

        }
    }


    // int s;
    // s=f/(100+e);
    // // cout <<s <<endl;
    // int x;
    // x=search(a,b,s);
    // // cout << x <<endl;

    // int y;
    // y=search(c,d,x/e);

    cout << ansx + ansy << " " << ansx << endl;
    return 0;
}

Measured memory_bytes: 3556
#include<stdio.h>

int main(void){
    int W,H,x,y,r;
	scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);
	if(x-r>=0 && y-r>=0 && x+r<=W && y+r<=H){
		printf("Yes\n");
	}
	else{
		printf("No\n");
	}
	return 0;
}
    

Measured memory_bytes: 584
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define endl '\n'
const ll mod=1e9+7;
ll dp[30][ll(1<<21)];
ll a[30][30],n;
ll solve(ll idx,ll sum){
if(idx>n)return 1;
ll &ans=dp[idx][sum];
if(ans!=-1)return ans;
ans=0;
for(ll i=1;i<=n;i++){
        if(a[idx][i]==1){
    if(sum & (1<<(i-1)))continue;
    else ans+=solve(idx+1,sum|(1<<(i-1)));
}
}
return ans%mod;
}
int32_t main(){
    ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL);
    cin>>n;
    for(ll i=1;i<=n;i++)for(ll j=1;j<=n;j++)cin>>a[i][j];
    memset(dp,-1,sizeof(dp));
    cout<<solve(1ll,0ll)<<endl;

    return 0;
}


Measured memory_bytes: 491776
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iterator>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
using namespace std;

typedef long long ll;

template <typename T>
class FenwickTree {
 private:
  vector<T> bit;
  int M;

 public:
  FenwickTree(int M) : bit(vector<T>(M + 1, 0)), M(M) {}

  int sum(int i) {
    if (!i) return 0;
    return bit[i] + sum(i - (i & -i));
  }

  void add(int i, T x) {
    if (i > M) return;
    bit[i] += x;
    add(i + (i & -i), x);
  }
};

int main() {
  int N, Q;
  cin >> N >> Q;
  FenwickTree<int> fenwick(N);
  for (int i = 0; i < Q; ++i) {
    int c, x, y;
    cin >> c >> x >> y;
    if (c == 0) {
      fenwick.add(x, y);
    } else {
      if (x > y) swap(x, y);
      cout << (fenwick.sum(y) - fenwick.sum(x - 1)) << endl;
    }
  }
}

Measured memory_bytes: 3160
using System;
class Qsort
{
    public static void Main()
    {
        string[] str = Console.ReadLine().Split(' ');
        long w = long.Parse(str[0]);
        long h = long.Parse(str[1]);
        long x = long.Parse(str[2]);
        long y = long.Parse(str[3]);
        Console.Write(w * h / 2.0);
        Console.Write(" ");
        if (w % 2 == 0 && h % 2 == 0 && x == w / 2 && y == h / 2)
            Console.WriteLine(1);
        else
            Console.WriteLine(0);

    }


}

Measured memory_bytes: 11092
#include <bits/stdc++.h>
#define ll long long
#define fi first
#define se second
#define sz(a)  int((a).size())
#define pb  push_back
#define eb  emplace_back
#define FOR(var,from,to) for(int var=(from);var<=(to);++var)
#define rep(var,n)  for(int var=0;var<(n);++var)
#define rep1(var,n)  for(int var=1;var<=(n);++var)
#define repC2(vari,varj,n)  for(int vari=0;vari<(n)-1;++vari)for(int varj=vari+1;varj<(n);++varj)
#define repC3(vari,varj,vark,n)  for(int vari=0;vari<(n)-2;++vari)for(int varj=vari+1;varj<(n)-1;++varj)for(int vark=varj+1;vark<(n);++vark)
#define ALL(c)  (c).begin(),(c).end()
#define RALL(c)  (c).rbegin(),(c).rend()
#define tr(i,c)  for(auto i=(c).begin(); i!=(c).end(); ++i)
#define mset(arr,val)  memset(arr,val,sizeof(arr))
#define mid(x,y) ((x)+((y)-(x))/2)
#define IN(x,a,b) ((a)<=(x)&&(x)<=(b))
using namespace std;
template<typename T> void Out(T x) { cout << x << endl; }
template<typename T1, typename T2> void Ans(bool f, T1 y, T2 n) { if(f) Out(y); else Out(n); }


int main() {
    int N,A,B,C;
    int ans=0;
    cin>>N;
    string S;
    int D[N];
    cin>>S;

    
    if(N>=3200)
    Out(S);
    else
    Out("red");
    
    return 0;
}

Measured memory_bytes: 256
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <stack>
using namespace std;

int main(void)
{
  int N;
  scanf("%d",&N);
  if (N%1000!=0)
  printf("%d",1000-(N%1000));
  else
  printf("0");
  return 0;
}

Measured memory_bytes: 3200
import sys
input = sys.stdin.readline
from operator import itemgetter


def main():
    N = int(input())
    xyh = []
    for _ in range(N):
        xyh.append([int(x) for x in input().split()])

    xyh = sorted(xyh, key=itemgetter(2), reverse=True)

    for cx in range(101):
        for cy in range(101):
            x, y, h = xyh[0]
            H = h + abs(x - cx) + abs(y - cy)
            is_correct = True
            for x, y, h in xyh:
                if h == 0:
                    if H - abs(x - cx) - abs(y - cy) > 0:
                        is_correct = False
                        break
                elif H != h + abs(x - cx) + abs(y - cy):
                    is_correct = False
                    break

            if is_correct:
                print(cx, cy, H)
                return


if __name__ == '__main__':
    main()



Measured memory_bytes: 3064
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int cnt = 0;
		double ans = 0;
		while(true){
			if(Math.pow(2,cnt)>n){
				ans = Math.pow(2, cnt-1);
				break;
			}
			cnt++;
		}
		System.out.println((int)ans);
	}

}


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

typedef  long long ll;

int main()
{
    ll k,i,j,x,n,m,sum=0,borogcd,gcd;
    cin>>k;
    for(i=1;i<=k;i++)
    {
        for(j=1;j<=k;j++)
        {
            for(x=1;x<=k;x++)
            {
                gcd=__gcd(i,j);
                borogcd=__gcd(gcd,x);
                sum+=borogcd;
            }
        }
    }

    cout<<sum<<endl;
}


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

int main(){
    int n,m,min,num,dis;
    cin >> n >> m;
    vector<int> a(n,0), b(n,0), c(m,0), d(m,0);
    for(int i = 0; i < n; i++){
        cin >> a[i] >> b[i];
    }
    for(int j = 0; j < m; j++){
        cin >> c[j] >> d[j];
    }
    for(int i = 0; i < n; i++){
        num = 0;
        min = abs(a[i] - c[0]) + abs(b[i] - d[0]);
        for(int j = 1; j < m; j++){
            dis = abs(a[i] - c[j]) + abs(b[i] - d[j]);
            if(dis < min){
                min = dis;
                num = j;
            }
        }
        cout << num + 1 << endl;
    }
}

Measured memory_bytes: 256
D,N = map(int, input().split())
if D == 0:
    if N != 100:
        print(N)
    else:
        print(101)
elif D == 1:
    if N != 100:
        print(N*100)
    else:
        print(10100)
else:
    if N != 100:
        print(N*10000)
    else:
        print(1010000)


Measured memory_bytes: 3060
#include <iostream>
#include <stdio.h>

using namespace std;
int main (int argc, const char * argv[])
{
    int a,b;
    cin >>a >>b;
    double f1,f2;
    f1=a/b;
    f2=(double)a/b;
    //cout << a/b<<" "<<a%b<<" "<<a/b<<endl;
    printf("%.0f ", f1 );
     printf("%.1d ", a%b );
    printf("%.8f\n", f2 );

    // insert code here...
   // std::cout << "Hello, World!\n";
    return 0;
}

Measured memory_bytes: 1192
N=input()
#Nのi文字目とi＋1文字目が同じであればカウントを増やす。
j_count=0
for i in range(0,3):
    if N[i]==N[i+1]:
        j_count+=1
if j_count>=2 and N[1]==N[2]:
    print("Yes")
else:
    print("No")
    

Measured memory_bytes: 9096
package main

import (
  "fmt"
)

func main() {
  var a, b, c, d int 
  fmt.Scan(&a, &b, &c, &d)
  e := c - (d - b)
  f := d + (c - a)
  g := e - (f - d)
  h := f + (e - c)
  fmt.Println(e, f, g, h)
}

Measured memory_bytes: 512
x = int(input())
a = 0
b = 0
c = 0
f = 0
bun = []
for p in range(x):
    bun = input()
    if bun[0] == "B":
        b +=1
    if bun[len(bun)-1] == "A":
        a += 1
        if bun[0] == "B":
            f += 1
    for k in range(len(bun)-1):
        if bun[k] == "A":
            if bun[k+1] == "B":
                c += 1



if f == a:
    if a == b:
        if a > 0:
            a -= 1
if a < b:
    print(a+c)
else:
    print(b+c)

Measured memory_bytes: 3064
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
#define double long double
typedef vector<int> VI;
typedef pair<int, int> pii;
typedef vector<pii> VP;
typedef vector<string> VS;
typedef priority_queue<int> PQ;
template<class T>bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
#define fore(i,a) for(auto &i:a)
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
#define eps 1e-12 
//priority_queue<int,vector<int>, greater<int> > q2;



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

	int N; cin >> N;
	VI cnt(N + 1, 0);
	int ans = 0;
	eFOR(i, 1, N) {
		int j = i;
		while (j <= N) {
			cnt[j]++;
			j += i;
		}
	}


	eFOR(i, 1, N) {
		ans += i * cnt[i];
	}
	cout << ans << endl;
	return 0;
}



Measured memory_bytes: 81328
#include <bits/stdc++.h>
using namespace std;
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 d, t, s;
    cin >> d >> t >> s;
    if ((d + (s - 1)) / s <= t) {
        cout << "Yes" << endl;
    } 
    else {
        cout << "No" << endl;
    }
    return 0;
}

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


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
using namespace std;
using namespace __gnu_pbds;

#define lsc(x)      scanf("%lld",&x)
#define sc(x)       scanf("%d",&x)
#define lpr(x)      printf("%lld ",x)
#define pr(x)       printf("%d ",x)
#define n_l         printf("\n")
#define VI          vector<int>
#define VII         vector<long long int>
#define MI          map<int, int>
#define PI          pair<int, int>
#define m_p         make_pair
#define pb          push_back
#define fi           first
#define se           second
#define mset(x,y)   memset(x,y,sizeof(x))
#define sz(v)       (int)v.size()
#define all(v)      v.begin(), v.end()
#define fr(i, a, n) for(int i=a;i<=n;i++)
mt19937 rng32(chrono::steady_clock::now().time_since_epoch().count());
const int N=(int)1e6+5;
const int mod = 1000000007;
typedef long long ll;
// order_of_key (val): returns the no. of values strictly less than val
// find_by_order (k): returns the kth largest element iterator.(0-based)
// vector<int>::iterator itr=lower_bound(v.begin(),v.end(),x);
// s.substr(pos[0-indexed], len(default=till end))
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
#define TRACE

#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
	cerr << name << " : " << arg1 << std::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...);
}
#else
#define trace(...)
#endif
int u;
int tmp;
int vis[N], dep[N];
VI g[N], revg[N];
void dfs(int i){
    vis[i]=1;
    dep[i]=1;
    for (auto v: g[i]) {
        if (!vis[v]){
            dfs(v);
        }
        dep[i] = max(dep[i], dep[v]+1);
    }
}
int main(){
    int n;sc(n);int m;sc(m);
    fr(i, 1, m){
        int u, v;
        sc(u);sc(v);
        g[u].pb(v);
        revg[v].pb(u);
    }
    int ans=0;
    fr(i, 1, n){
        if (!vis[i]){
            dfs(i);
            //fr(j,1,n) trace(j, dep[j]);
        }
    }
    fr(i,1,n) ans = max(ans, dep[i]);
    pr(ans-1);n_l;
    return 0;
}



Measured memory_bytes: 59776
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
const int INF=1145141919,MOD=1e9+7;
const long long LINF=8931145141919364364,LMOD=998244353;
inline long long mod(long long n,long long m){return(n%m+m)%m;}
// const int dx[]={1,0,-1,0,1,1,-1,-1},dy[]={0,-1,0,1,1,-1,-1,1};

int main(){
    int n; cin>>n;
    double ans=0;
    while(n--){
        double x; cin>>x;
        string s; cin>>s;
        if(s=="BTC") x*=380000.0;
        ans+=x;
    }
    printf("%.10f\n",ans);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n;
  cin>>n;
  vector<int> l(n);
  for(int i=0;i<n;i++){
  	cin>>l[i];
  }
  sort(l.begin(),l.end());
  int sum=0;
  for(int i=0;i<n-1;i++){
  	sum+=l[i];
  }
  if(sum>l[n-1]) cout<<"Yes";
  else cout<<"No";
}

Measured memory_bytes: 3644
#include<bits/stdc++.h>
typedef long long ll;
#define pii pair<int,int>
#define ff first
#define ss second
using namespace std;
void fast()
{
ios::sync_with_stdio(false);
cin.tie(NULL); cout.tie(NULL);
}
int main()
{
    ll n;
    cin>>n;
    cout<<n+(n*n)+(n*n*n)<<endl;
    return 0;
}


Measured memory_bytes: 3632
#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <cstring>
#include <numeric>
#include <algorithm>
#include <functional>
#include <array>
#include <map>
#include <queue>
#include <limits.h>
#include <set>
#include <stack>
#include <random>
#include <complex>
#include <unordered_map>
#define rep(i,s,n) for(int i = (s); (n) > i; i++)
#define REP(i,n) rep(i,0,n)
#define RANGE(x,a,b) ((a) <= (x) && (x) <= (b))
#define DUPLE(a,b,c,d) (RANGE(a,c,d) || RANGE(b,c,d) || RANGE(c,a,b) || RANGE(d,a,b))
#define INCLU(a,b,c,d) (RANGE(a,c,d) && (b,c,d))
#define PW(x) ((x)*(x))
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define MODU 1000000007
#define bitcheck(a,b)   ((a >> b) & 1)
#define bitset(a,b)      ( a |= (1 << b))
#define bitunset(a,b)    (a &= ~(1 << b))
#define MP(a,b) make_pair((a),(b))
#define Manh(a,b) (abs((a).first-(b).first) + abs((a).second - ((b).second))
#define pritnf printf
#define scnaf scanf
#define itn int
#define PI 3.141592653589
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a%b);
}
template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T &val) {
	std::fill((T*) array, (T*) (array + N), val);
}
pii Dir [] = {
	{ 1,0 },{ 0,1 }
};

signed main() {
	int n;
	while (scanf("%d", &n)) {
		if (!n)
			break;

		set<pii> m;
		vector<pii> st(n);
		REP(i, n) {
			scanf("%d %d", &st[i].first, &st[i].second);
			m.insert(st[i]);
		}
		sort(ALL(st));
		int ans = 0;
		REP(i, n) {
			rep(j, i + 1, n) {
				pii sa = { st[j].first - st[i].first, st[j].second - st[i].second };
				bool f = 0;
				pii nex = { st[j].first + sa.second, st[j].second - sa.first };
				pii nexx = { nex.first - sa.first, nex.second - sa.second };
				if (m.find({ nex.first, nex.second })!=m.end() && m.find({nexx.first, nexx.second}) != m.end()) {
					ans = max(ans, PW(sa.first) + PW(sa.second));
				}
			}
		}
		
		printf("%d\n", ans);
	}

	return 0;
}

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

int main() {
  int A, B, Z;
  double mean;
  cin >> A >> B;
  mean = (double)(A + B) / 2;
  Z = (A + B) / 2;
  mean = mean - Z;
  if(mean >= 0.5){
    cout << Z + 1 << endl;
  }
  else{
    cout << Z << endl;
  }
  return 0;
}


Measured memory_bytes: 3636
import java.util.Scanner;
public class Main{
public static void main(String args[]){
Scanner sc=new Scanner(System.in);
  String s=sc.next();
  String t=sc.next();
  int i; int count=0;
  for(i=0;i<s.length();i++){
  if(s.charAt(i)!=t.charAt(i)){
  	count++;
  	}
  }
  System.out.println(count);
}
}

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

int main(){
    int m, n; cin >> n >> m;
    vector<string> a(n), b(m);
    for (int i=0; i<n; i++){
        cin >> a.at(i);
    }
    for (int i=0; i<m; i++){
        cin >> b.at(i);
    }
    for (int i=0; i<n-m+1; i++){//1行ずつiで回す
        for (int j=0; j<n-m+1; j++){//1文字ずつjで回す
            if (a.at(i).at(j)==b.at(0).at(0)){//画像Bの左上の画素に一致する画素が見つかったら
                bool judge=true;
                for (int k=0; k<m; k++){//そこからm行のstringを比較
                    if (a.at(i+k).substr(j, m)!=b.at(k)){
                        judge=false;
                        break;
                    }
                }
                if (judge){
                        cout << "Yes" << endl;
                        return 0;
                }
            }
        }
    }
    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
// 2016-12-12
#include <iostream>
#include <string>
using namespace std;

int main() {
	int t[5] = {5, 7, 5, 7, 7};
	int n, a[40];
	string s;
	while (cin >> n, n) {
		for (int i = 0; i < n; i++) {
			cin >> s;
			a[i] = s.length();
		}
		bool b = false;
		for (int i = 0; i < n; i++) {
			for (int j = i, k = 0, m = 0; j < n; j++) {
				m += a[j];
				if (m == t[k]) {
					k++;
					m = 0;
					if (k == 5) {
						b = true;
						break;
					}
				} else if (m > t[k]) {
					break;
				}
			}
			if (b) {
				cout << i + 1 << endl;
				break;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 3116
#include <iostream>
#include <string>
#include <math.h>
#include <iomanip>
#include <stdio.h>
#include <algorithm>
#include <ctime>
#include <vector>
#include <set>
#include <queue>
using namespace std;

#define PI 3.14159265358979323846264338327950L

int res;

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

    int N, D, X;
    cin >> N >> D >> X;
    int A[110];
    for (int i = 0; i < N; i++)
    {
        cin >> A[i];
    }
    res = 0;
    for (int i = 0; i < N ; i++)
    {
        int tmp = 0;
        int cnt = 0;
        while (cnt * A[i] + 1 <= D)
        {
            tmp += 1;
            cnt++;
        }
        res += tmp;
    }
    res += X;
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 256
import math,fractions
a=list(map(int,input().split()))
A=a[1]-a[0]+1
B=(a[1]//a[2])-((a[0]-1)//a[2])
C=(a[1]//a[3])-((a[0]-1)//a[3])
d=int(a[2]*a[3]/fractions.gcd(a[2],a[3]))
D=(a[1]//d)-((a[0]-1)//d)
print(A-B-C+D)

Measured memory_bytes: 66156
#include <iostream>
#include <cstring>
#include <vector>
#include <algorithm>
#include <numeric>
#include <mutex>
#include <cmath>
#include <set>
#include <climits>

#define mod 1000000007
#define mp make_pair
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define _GLIBCXX_DEBUG

using namespace std;
using ll = long long;
using lli = long long int;
using pii = pair<int, int>;
 
 int main(){
	int N, K;
	cin >> N >> K;
	int ans = 1;
	rep(i, N){
		if(ans > K){
			for(i; i < N; i++){
				ans += K;
			}
			break;
		}
		ans *= 2;
	}
	cout << ans;
	return 0;
 }

Measured memory_bytes: 256
#pragma GCC optimize("trapv")
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <random>
#include <chrono>

using namespace std;

#define int long long
typedef long long ll;
typedef long double ld;
#define fastInp cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);

const ll SIZE = 1e5 + 100, INF = 1e9 + 10, MOD = 1e9 + 7;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

char grid[502][502], ansBl[502][502], ansR[502][502];
bool usd[502];

signed main()
{
    fastInp;

    ll h, w;
    cin >> h >> w;

    ll mx = -INF;

    for (int i = 0; i < h; i++) {
        ansBl[i][0] = '#';
        ansR[i][w - 1] = '#';
    }

    for (int i = 0; i < h; i++) {
        for (int j = 1; j < w - 1; j++) {
            if (i % 2 == 0) {
                ansBl[i][j] = '#';
            }
            else {
                ansR[i][j] = '#';
            }
        }
    }
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            cin >> grid[i][j];
            if (grid[i][j] == '#') {
                ansBl[i][j] = '#';
                ansR[i][j] = '#';
                mx = max(mx, i);
                usd[j] = 1;
            }
        }
    }

    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            if (ansBl[i][j] == 0) ansBl[i][j] = '.';
            cout << ansBl[i][j];
        }
        cout << "\n";
    }
    cout << "\n";
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            if (ansR[i][j] == 0) ansR[i][j] = '.';
            cout << ansR[i][j];
        }
        cout << "\n";
    }
    return 0;
}

Measured memory_bytes: 4392
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<sstream>
#include<unordered_map>
#include<unordered_set>
#include<vector>
#include<random>
using ll = long long;
enum : int { M = (int)1e9 + 7 };
enum : ll { MLL = (ll)1e18L + 9 };
using namespace std;
#ifdef LOCAL
#include"rprint2.hpp"
#include"debug_deque.hpp"
// #define vector DebugDeque
#else
#define FUNC(name) template <ostream& out = cout, class... T> void name(T&&...){ }
FUNC(prints) FUNC(printe) FUNC(printw) FUNC(printew) FUNC(printb) FUNC(printd) FUNC(printde) FUNC(printdu);
#endif
template <class S, class T>
istream& operator >> (istream& in, pair<S, T>& p){ return in >> p.first >> p.second; }
template <class T>
istream& operator >> (istream& in, vector<T>& v){ for(auto& e : v){ in >> e; } return in; }

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll l, n;
    cin >> l >> n;
    vector<ll> xs(n); cin >> xs;
    vector<ll> ys, accx(n + 1), accy(n + 1);
    for(int i = 0; i < n; i++){
        accx[i + 1] = xs[i] + accx[i];
    }
    ll ans = 0;
    for(int i = 0; i <= n; i++){
        int yNum = i, xNum = n - i,
            mini = min(yNum, xNum);
        ll cand = (accy[yNum] - accy[yNum - mini] +
                   accx[xNum] - accx[xNum - mini]) * 2;
        ll c1 = cand - (xNum ? xs[xNum - 1] : 0) + (xNum != mini ? xs[xNum - mini - 1] : 0) * 2;
        ll c2 = cand - (yNum ? ys[yNum - 1] : 0) + (yNum != mini ? ys[yNum - mini - 1] : 0) * 2;
        printde(c1, c2);
        ans = max(ans, c1);
        ans = max(ans, c2);
        if(i == n){ break; }
        ys.push_back(l - xs.back());
        xs.pop_back();
        accy[yNum + 1] = ys.back() + accy[yNum];
    }
    cout << ans << '\n';
}


Measured memory_bytes: 7156
N = gets.to_i
table = Array.new(10){Array.new(10){0}}

(1..9).each do |f|
  (1..9).each do |e|
    if f == e
      n = f
      if n <= N
        table[f][e] += 1
      end
    end

    flag = true
    loop_count = 0
    while flag
      n = "#{f}#{"9" * loop_count}#{e}".to_i
      if n <= N
        table[f][e] += 10 ** loop_count
      else
        (("0" * loop_count)..("9" * loop_count)).each do |i|
          n = "#{f}#{i}#{e}".to_i
          if n <= N
            table[f][e] += 1
          else
            break
          end
        end
        flag = false
      end
      loop_count += 1
    end
  end
end

result = 0
(1..N).each do |n|
  f = n.to_s[0].to_i
  e = n.to_s[-1].to_i

  result += table[e][f]
end
puts result

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

using namespace std;

int main() {
    long long X, Y, Z, K;
    cin >> X >> Y >> Z >> K;
    long long A[X], B[Y], C[Z];

    for (int i = 0; i < X; i++) cin >> A[i];
    for (int i = 0; i < Y; i++) cin >> B[i];
    for (int i = 0; i < Z; i++) cin >> C[i];

    sort(A, A + X, greater<long long>());
    sort(B, B + Y, greater<long long>());
    sort(C, C + Z, greater<long long>());

    vector<long long> ans;
    for (int x = 0; x < X; x++) {
        for (int y = 0; y < Y; y++) {
            for (int z = 0; z < Z; z++) {
                ans.push_back(A[x]+B[y]+C[z]);
                if (x * y * z > K) break;
            }
        }
    }
    sort(ans.begin(), ans.end(), greater<long long>());

    for (int i = 0; i < K; i++) {
        cout << ans[i] << endl;
    }

    return 0;
}


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

int main(void) {
	int n;
	cin >> n;
	map<string, int> m;
	char last;
	for (int i = 0; i < n; i++) {
		string s;
		cin >> s;
		m[s]++;
		if (i == 0) last = s[s.size() - 1];
		if (i > 0 && (last != s[0] || m[s] == 2)) {
			cout << "No" << endl;
			return 0;
		}
		last = s[s.size() - 1];
	}
	cout << "Yes" << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip> // << fixed << precision(10)
#include <vector>
#include <string>
#include <map>
#include <set>
#include <cmath>
#include <algorithm>
#include <queue>
using namespace std;

#define FOR(i,s,t) for(int i=s;i<t;i++)
#define REP(i,n) FOR(i,0,n)
#define PRINT(s) cout << s << "\n"
#define SORT(A) sort(A.begin(), A.end())
#define EACHPRINT(A, T) for_each(begin(A), end(A), [&](T i){ cout << i << " "; });cout << "\n"
#define NEWMAT(N, M, ini) MAT(N, vector<lint>(M, ini))
#define MOD 1000000007

typedef long long lint;
typedef pair<lint, lint> P;
typedef vector<lint> V;
typedef vector<vector<lint>> MAT;
bool lessPair(const P& l, const P& r){return l.second < r.second;}

lint H;
lint W;
vector<string> A;
MAT mat;

lint fetch(lint i, lint j) {
  if(mat[i][j] != -1) return mat[i][j];

  if(A[i][j] == '#') {
    mat[i][j] = 0;
    return 0;
  }

  PRINT(A[i][j]);

  if(A[i][j] == '.') {
    lint res = 1000*1000;

    if(i != 0) {
      res = min(fetch(i-1, j), res);
    }

    if(j != 0) {
      res = min(fetch(i, j-1), res);
    }

    if(i != H-1) {
      res = min(fetch(i+1, j), res);
    }

    if(j != W-1) {
      res = min(fetch(i, j+1), res);
    }

    A[i][j] = res;
    return res;
  }

  return 0;
}

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

    queue<P> q;
    mat = NEWMAT(H, W, -1);

    REP(i, H) {
      string x; cin >> x; A.push_back(x);

      REP(j, W) {
        if(x[j] == '#') {
          q.push(P(i,j));
          mat[i][j] = 0;
        }
      }
    }

    lint res = 0;

    while(!q.empty()) {
      P p = q.front();
      q.pop();

      lint i = p.first;
      lint j = p.second;
      
      if(i != 0) {
        if(mat[i-1][j] == -1) {
          mat[i-1][j] = mat[i][j] + 1;
          q.push(P(i-1, j));

          res = max(mat[i-1][j], res);
        }
      }

      if(j != 0) {
        if(mat[i][j-1] == -1) {
          mat[i][j-1] = mat[i][j] + 1;
          q.push(P(i, j-1));

          res = max(mat[i][j-1], res);
        }
      }

      if(i != H-1) {
        if(mat[i+1][j] == -1) {
          mat[i+1][j] = mat[i][j] + 1;
          q.push(P(i+1, j));

          res = max(mat[i+1][j], res);
        }
      }

      if(j != W-1) {
        if(mat[i][j+1] == -1) {
          mat[i][j+1] = mat[i][j] + 1;
          q.push(P(i, j+1));

          res = max(mat[i][j+1], res);
        }
      }
    }
    cout << res << "\n";

    return 0;
}


Measured memory_bytes: 25524
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll mod=1000000007;
#define IO ios_base::sync_with_stdio(false);cin.tie(NULL);
int main()
{
	ll n;
	cin>>n;
	ll a[n+1];
	for(ll i=1;i<=n;i++)
	cin>>a[i];
	ll dp[n+1];
	dp[1]=0;
	dp[2]=abs(a[1]-a[2]);
	for(ll i=3;i<=n;i++)
	{
		dp[i]=min((dp[i-1])+abs(a[i]-a[i-1]),(dp[i-2])+abs(a[i]-a[i-2]));
	}
	cout<<dp[n]<<endl;
}

Measured memory_bytes: 1792
#pragma once
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
using P = pair<ll, ll>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
#define ALL(obj) (obj).begin(), (obj).end()

ll gcd(ll a, ll b) {
	while (b) {
		ll c = a;
		a = b;
		b = c % b;
	}
	return a;
}

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

	ll A, B;

	cin >> A >> B;

	ll n = gcd(A, B);
	ll ans = 1;
	for (ll i = 2; i * i <= n; i++) {
		if (n % i == 0) {
			ans++;
			while (n % i == 0) {
				n /= i;
			}
		}
	}

	if (n != 1) ans++;
	
	cout << ans << "\n";

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,h[100000];
int main()
{
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>h[i];
	}
	for(int i=n-1;i>0;i--)
	{
		if(h[i]>=h[i-1])
		continue;
		if(h[i]<h[i-1]-1)
		{
			cout<<"No";
			return 0;
		}
		h[i-1]--;
	}
	cout<<"Yes";
	return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,s,n) for(int i = (s); i < (n); i++)
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()



int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  ll x, y;
  cin >> x >> y;
  long double z = y/x;
  ll ans = log2(z);
  cout << ans+1 << "\n";

}

Measured memory_bytes: 256
#include<iostream>

using namespace std;
typedef long long ll;

int main(void){
  ll n,h,w;
  cin >> n >> h >> w;
  ll count = 0;
  ll a,b;
  for( int i=0; i<n; ++i){
    cin >> a >> b;
    if ( a >= h && b >= w) count++;
  }
  cout << count << endl;
  return 0;
}


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

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        ArrayList<Integer> list = new ArrayList<>(n);
        for (int i = 0; i < n; i++) {
            list.add(Integer.parseInt(sc.next()));
        }
        String answer = "APPROVED";
        for (Integer i : list) {
            if ((i % 2) != 0) {
                continue;
            }
            if (((i % 3) == 0) || ((i % 5) == 0)) {
                answer = "APPROVED";
            } else {
                answer = "DENIED";
                break;
            }
        }
        System.out.println(answer);
        sc.close();
    }

}


Measured memory_bytes: 35636
#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
using namespace std;
#define REP(i, j) for(int i = 0; i < (int)(j); ++i)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define SORT(v) sort((v).begin(), (v).end())
#define REVERSE(v) reverse((v).begin(), (v).end())
typedef complex<double> P;

int main() {
  int N;
  while(cin >>N && N){
    vector<int> score(N, 0);
    string s; cin >>s;
    int n = 0, p = 0;
    REP(i, s.length()){
      if(s[i] == 'M') score[n]++;
      if(s[i] == 'S') { p += 1 + score[n]; score[n] = 0; }
      if(s[i] == 'L') { score[n] += 1 + p; p = 0; }
      n = (n + 1) % N;
    }
    SORT(score);
    REP(i, N) cout <<score[i] <<" "; cout <<p <<endl;
  }
  return 0;
}

Measured memory_bytes: 1224
package main

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

// I/O
type Scanner struct {
	sc *bufio.Scanner
}

func NewScanner() *Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &Scanner{sc}
}

func (s *Scanner) nextStr() string {
	s.sc.Scan()
	return s.sc.Text()
}

func (s *Scanner) nextInt() int {
	i, e := strconv.Atoi(s.nextStr())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *Scanner) nextFloat() float64 {
	f, e := strconv.ParseFloat(s.nextStr(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func (s *Scanner) nextRuneSlice() []byte {
	return []byte(s.nextStr())
}

func (s *Scanner) nextIntSlice(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextInt()
	}
	return res
}

func (s *Scanner) nextFloatSlice(n int) []float64 {
	res := make([]float64, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextFloat()
	}
	return res
}

func run(input io.Reader, output io.Writer) int {
	sc := NewScanner()
	a := sc.nextInt()
	b := sc.nextInt()
	c := sc.nextInt()

	if c-a-b < 0 {
		fmt.Println("No")
		return 0
	}

	if 4*a*b < (c-a-b)*(c-a-b) {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}

	return 0
}

func main() {
	os.Exit(run(os.Stdin, os.Stdout))
}


Measured memory_bytes: 640
#include <stdio.h>

int main(){
  char c;
  scanf("%c", &c);
  if(c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u'){
    printf("vowel\n");
  }else{
    printf("consonant\n");
  }
  return 0;
}


Measured memory_bytes: 128
from fractions import gcd
# from datetime import date, timedelta
from heapq import*
import math
from collections import defaultdict, Counter, deque
import sys
from bisect import *
import itertools
import copy
sys.setrecursionlimit(10 ** 7)
MOD = 10 ** 9 + 7

input = sys.stdin.readline
def main():
    n, c = map(int, input().split())
    stk = [tuple(map(int, input().split())) for i in range(n)]
    stk = sorted(stk, key=lambda x: x[0])

    ans = 1
    l = []
    # heapify(l)
    # heappush(l, (stk[0][1], stk[0][2]))
    l = [(stk[0][1], stk[0][2])]
    for i in range(1, n):
        ll = []
        #heapify(ll)
        for j in range(len(l)):
            # v = heappop(l)
            v = l[j]
            if stk[i][2] == v[1]:
                if stk[i][0] < v[0]:
                    # heappush(ll, v)
                    ll.append(v)
            else:
                if stk[i][0] - 0.5 < v[0]:
                    # heappush(ll, v)
                    ll.append(v)
        # heappush(ll, stk[i][1:])
        ll.append(stk[i][1:])
        l = ll
        ans = max(ans, len(l))
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 21868
from collections import defaultdict
n = int(input())
dic_sorted_s = defaultdict(int)
count = 0
for i in range(n):
    s = input()
    str_sorted_s = ''.join(sorted(s))
    count += dic_sorted_s[str_sorted_s]
    dic_sorted_s[str_sorted_s] += 1
print(count)

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

#define print2(a, b) cerr << "(" << a << "," << b << ")" << endl
#define print3(a, b, c) cerr << "(" << a << "," << b << "," << c << ")" << endl


void solve(long long N, std::vector<long long> A){
    vector<ll> B = A;
    sort(B.begin(), B.end());
    reverse(B.begin(), B.end());
    for (ll i = 0; i < N; i++) {
        cout << (A[i] == B[0] ? B[1] : B[0]) << endl;
    }
}

int main(){
    long long N;
    scanf("%lld",&N);
    std::vector<long long> A(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&A[i]);
    }
    solve(N, std::move(A));
    return 0;
}


Measured memory_bytes: 4736
s = input()
i = 1
c = [s[0]]
while i != len(s):
    l = 1
    back = 0
    while c[-1] == s[i:i + l]:
        l += 1
        if i + l > len(s):
            c[-1] += s[i]
            i += 1
            back = 1
            break
    if back:
        continue
    c.append(s[i:i + l])
    i += l
print(len(c))

Measured memory_bytes: 8008
#include<stdio.h>
#define fo(i,a,b) for(int i=a;i<=b;i++)
int n,a,b;
int main(){
	scanf("%d",&n);
	a=n/100;b=n%100;
	if (1<=a&&a<=12) a=1;else a=0;
	if (1<=b&&b<=12) b=1;else b=0;
	if (a&&b){
		printf("AMBIGUOUS\n");
	}
	if (a&&!b){
		printf("MMYY\n");
	}
	if (!a&&b){
		printf("YYMM\n");
	}
	if (!a&&!b){
		printf("NA\n");
	}
	return 0;
} 

Measured memory_bytes: 128
import java.util.*;

/**
 * A
 */
public class Main {
    public static void main(String[] args) {
        
        Scanner sc = new Scanner(System.in);
        int flag = 0, count = 0;

        int n = sc.nextInt();
        int[] S = new int[n];

        for(int i=0; i<n; i++) {
            S[i] = sc.nextInt();
        }

        int q = sc.nextInt();
        int[] T = new int[q];

        for (int i = 0; i<q; i++) {
            T[i] = sc.nextInt();
        }

        sc.close();

        for(int j=0; j<q; j++) {
            flag = 0;
            for(int i=0; i<n; i++) {
                if(S[i] == T[j]) {
                    flag++;
                    break;
                }
            }
            if(flag >= 1) {
                count++;
            } 
        }

        System.out.println(count);

    }
}


Measured memory_bytes: 40300
s = input()

if len(s) % 2 == 0:
    ans = True
else:
    ans = False

for i in range(len(s)):
    if i % 2 == 0:
        if s[i] != 'h':
            ans = False
    else:
        if s[i] != 'i':
            ans = False

if ans:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 2940
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		long dp[] = new long[N+1];

		for (int i=0; i<=N; i++) {
			if (i==0) dp[0] = 2;
			else if (i==1) dp[1] = 1;
			else dp[i] = dp[i-1] + dp[i-2];
		}
		System.out.println(dp[N]);
	}
}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
int main(){
    long long L, R, ans, tmp;
    ans = 3000;
    cin>>L>>R;
    R = min(R, L+2019);
    for(long long i=L;i<R;i++){
        for(long long j=i+1;j<=R;j++){
            tmp = (i*j)%2019;
            ans = min(ans, tmp);
        }
    }
    cout<<ans<<endl;
}

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

int n, place;

struct node
{
	int id, pid, rbid;
	int lc, rc;
}N[10000];

void Preorder(node root)
{
	cout << " " << root.id;

	if (root.lc != -1)
		Preorder(N[root.lc]);
	if (root.rc != -1)
		Preorder(N[root.rc]);
}

void Inorder(node root)
{
	if (root.lc != -1)
		Inorder(N[root.lc]);

	cout << " " << root.id;

	if (root.rc != -1)
		Inorder(N[root.rc]);
}
	
void Postorder(node root)
{
	if (root.lc != -1)
		Postorder(N[root.lc]);
	if (root.rc != -1)
		Postorder(N[root.rc]);

	cout << " " << root.id;
}

void print()
{
	node root;

	for (int i = 0; i < n; i++)
		if (N[i].pid == -1)
			root = N[i];

	cout << "Preorder\n";
	Preorder(root);  
	cout << endl;

	cout << "Inorder\n";
	Inorder(root);
	cout << endl;

	cout << "Postorder\n";
	Postorder(root);;
	cout << endl;
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	;
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		N[i].pid = -1;
		N[i].rbid = -1;
	}

	for (int i = 0; i < n; i++)
	{
		cin >> place;
		N[place].id = place;

		cin >> N[place].lc >> N[place].rc;
		N[N[place].lc].id = N[place].lc;
		N[N[place].rc].id = N[place].rc;

		if (N[place].lc != -1 && N[place].rc != -1)
		{
			N[N[place].lc].rbid = N[N[place].rc].id;

			N[N[place].lc].pid = N[place].id;
			N[N[place].rc].pid = N[place].id;
		}

		if (N[place].lc != -1 && N[place].rc == -1)
			N[N[place].lc].pid = N[place].id;

		if (N[place].rc != -1 && N[place].lc == -1)
			N[N[place].rc].pid = N[place].id;
	}

	print();

	return 0;
}



Measured memory_bytes: 3168
/** 
 *  Author : Parth Prajapati aka (PARTH_4399, hungry_chef)
 *  Institute : Pandit Deendayal Petroleum University
 **/
#include<bits/stdc++.h>

using namespace std; 

#define start_cooking int main()
#define food_is_ready return 0;
#define main_ingredient_added ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

void cook()
{
    // start with your recipe
    int x, y;
    cin>>x>>y;
    y -= x*2;
    if(y%2 == 0 && y <= x*2 && y >= 0)
        cout<<"Yes";
    else
        cout<<"No";
}

start_cooking
{
    main_ingredient_added
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int t = 1; 
    //cin>>t;
    while(t--)
        cook();
    food_is_ready
}

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

#define lli long long int
#define REP(i,s,l) for(lli i=s;i<l;i++)
#define DEBUG 0
#define INF (1LL<<50)
#define MOD 1000000007

int main()
{
    int num, t, m, p, x, tmp, sum=0;
    cin >> num;
    int arr[num];
    for(int i=0; i<num; i++){
        cin >> t;
        arr[i] = t;
    }
    cin >> m;

    int t_arr[m][2];
    for(int i=0; i<m; i++){
        cin >> p >> x;
        t_arr[i][0] = x;
        t_arr[i][1] = p;
    }

    for(int i=0; i<m; i++){
        tmp = arr[t_arr[i][1]-1];
        arr[t_arr[i][1]-1] = t_arr[i][0];
        for(int j=0; j<num; j++){
            sum += arr[j];
        }
        cout << sum << endl;
        sum = 0;
        arr[t_arr[i][1]-1] = tmp;
    }
    return 0;
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(1000000)

# 入力
N = int(input())
H = [int(i) for i in input().split()]

# メモ用のDPテーブルを生成
dp = [float("inf") for i in range(N)]

# 足場iにたどり着く最初コストを返す
def rec(i):
    # ベースケースをセット
    if i == 0:
        return 0
    
    # メモをチェック
    if dp[i] < float("inf"):
        return dp[i]
    
    # i-1から遷移する場合
    cost = rec(i-1) + abs(H[i] - H[i-1])
    # i-2から遷移する場合
    if i > 1:
        cost = min(cost, rec(i-2) + abs(H[i] - H[i-2]))
    
    # 結果をメモしてから返す
    dp[i] = cost
    return cost

print(rec(N-1))

Measured memory_bytes: 95936