akhauriyash/Code-Regression huggingface dataset:
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LS()
    return l
sys.setrecursionlimit(1000000)
mod = 1000000007

#A
def A():
    s = input()
    c = I()
    a = eval(s)
    b = int(s[0])
    n = len(s)
    if n == 1:
        if int(s[0]) == c:
            print("U")
        else:
            print("I")
        quit()
    key = 0 if s[1] == "+" else 1
    for i in range(2,n):
        if not i%2:
            if key:
                b *= int(s[i])
            else:
                b += int(s[i])
        else:
            key = 0 if s[i] == "+" else 1
    if a == b:
        if a == c:
            print("U")
        else:
            print("I")
    elif a == c:
        print("M")
    elif b == c:
        print("L")
    else:
        print("I")
    return

#B
def B():
    return

#C
def C():
    return

#D
def D():
    return

#E
def E():
    return

#F
def F():
    return

#G
def G():
    return

#H
def H():
    return

#I
def I_():
    return

#J
def J():
    return

#Solve
if __name__ == "__main__":
    A()



Measured memory_bytes: 8248
#include <bits/stdc++.h>
#define all(v) (v).begin(), (v).end()
#define pb push_back
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
using namespace std;
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
template<class T>using numr=std::numeric_limits<T>;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const int INF = 1e9;
const ll LLINF = 1e16;
const int MOD = 1000000007;
const int MOD2 = 998244353;

vector<pair<long long, long long> > prime_factorize(long long N) {
    vector<pair<long long, long long> > res;
    for (long long a = 2; a * a <= N; ++a) {
        if (N % a != 0) continue;
        long long ex = 0; // 指数

        // 割れる限り割り続ける
        while (N % a == 0) {
            ++ex;
            N /= a;
        }

        // その結果を push
        res.push_back({a, ex});
    }

    // 最後に残った数について
    if (N != 1) res.push_back({N, 1});
    return res;
}

int main() {
    ios::sync_with_stdio(false);cin.tie(0);
    long long N;
    cin >> N;
    const auto &res = prime_factorize(N);
    set<ll> s;
    for (auto p : res) {
        for (int i = 0; i < p.second; ++i) s.insert(p.first);
    }
    int count = 0;
    for(auto x :s){
        for(int j = 1;j<100;j++){
            ll hoge = pow(x,j);
            if(N % hoge ==0){
                N = N/hoge;
                count++;
            }
        }

    }
    cout << count << endl;
}

Measured memory_bytes: 4216
#include<bits/stdc++.h>
using namespace std;
#define int long long

void solve(){
  int n;
  cin>>n;
  int arr[n];
  for(auto &a:arr) cin>>a;
  int mx=arr[0], ans=0;
  for(auto a:arr){
    mx=max(a,mx);
    ans+=(mx-a);
  }
  cout<<ans;
}

int32_t main()
{
    int t=1;
    //cin>>t;
    while (t--)
    {
        solve();
    }
    return 0;
}


Measured memory_bytes: 5160
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String str = sc.next();
        if (str.length() < 8) {
            System.out.println("YES");
        } else {
            char[] c = new char[str.length()];
            int count = 0;
            for (int i = 0; i < str.length(); i++) {
                if (str.charAt(i) == 'o') {
                    count++;
                }
            }
            if (count + (15 - str.length()) < 8) {
                System.out.println("NO");
            } else {
                System.out.println("YES");
            }
        }

    }
}


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

int main(){
  int N;
  int t = 1;
  int K;
  cin >> N >> K;
  //ｎ回捜査する、二倍する...２ＮかＫを足す...Ｎ＋Ｋ
  int a, b;
  for(int i = 0; i < N; i++){
    a = t * 2;
    b = t + K;
    if(a > b){
      t = b;
    }
    else{
      t = a;
    }
  }
  cout << t << endl;
}

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

int sto(string s){
  int res=0;
  reverse(s.begin(),s.end());
  int k=1;
  for(int i=0;i<s.size();i++){
    res+=(s[i]-'0')*k;
    k*=10;
  }
  return res;
}

bool bigs(string s,string t){
  reverse(s.begin(),s.end());reverse(s.begin(),s.end());
  if(s<t)return true;return false;
}

string po(int a){
  string res;
  res=a+'0';
  return res;
}

signed main(){
  int N,M;cin>>N>>M;
  int w[9]={2,5,5,4,5,6,3,7,6};
  typedef pair<int,int> P;
  std::vector<P> v(M);
  for(int i=0;i<M;i++){
    int a;cin>>a;
    v[i]=P(w[a-1],a);
  }
  std::vector<string> dp(1e4+5,"!");
  dp[N]="";
  for(int i=N;i>=0;i--){
    if(dp[i]=="!")continue;
    for(int j=0;j<M;j++){
      string u=dp[i];
      if(i-v[j].first<0)continue;
      if(dp[i-v[j].first].size()<(u+po(v[j].second)).size()||
      (dp[i-v[j].first].size()==(u+po(v[j].second)).size())&&dp[i-v[j].first]<(u+po(v[j].second)))dp[i-v[j].first]=u+po(v[j].second);
    }
    //cout<<i<<" "<<dp[i]<<endl;
  }
  cout<<dp[0]<<endl;
}


Measured memory_bytes: 33024
# bit全探索

n = int(input())
eigyou = [list(map(int, input().split())) for _ in range(n)]
profits = [list(map(int, input().split())) for _ in range(n)]
# 全休業を除く = 0を除外して、1〜1023まで回す
# 10 = 0000001010 ならば、木曜午前と金曜午前に営業することを示す

ans = -(10 ** 7) * 100 - 10
for i in range(1, 2**10):
    eigyou_here = [-1] * 10
    temp = 0
    for digit in range(10):
        eigyou_here[10 - 1 - digit] = int(i & (2 ** digit) > 0)
    for j_shop in range(n):
        import numpy as np
        coincide_time = np.dot(eigyou[j_shop], eigyou_here)
        # for time in range(10):
        #     coincide_time += eigyou[j_shop][time] * eigyou_here[time]
        temp += profits[j_shop][coincide_time]

    ans = max(ans, temp)

print(ans)


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

int main(){
	int N;
	cin >> N;
	vector< pair<int,int> > v;
	for(int i = 0 ; i < N ; i++){
		int a;
		cin >> a;
		v.push_back({a,i});
	}
	sort(v.begin(),v.end());
	set<int> used;
	used.insert(-1);
	used.insert(N);
	long long ans = 0;
	for(int i = 0 ; i < N ; i++){
		int a = *(--used.lower_bound(v[i].second));
		int b = *(used.lower_bound(v[i].second));
		int r = (b - 1) - v[i].second + 1;
		int l = v[i].second - (a+1) + 1;
		
		ans += 1ll * r * l * v[i].first;
		used.insert(v[i].second);
		//cout << a << " " << b << endl;
	}
	cout << ans << endl;
	
	
}

Measured memory_bytes: 11248
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <deque>
#include <cctype>
#include <cstdio>
#include <math.h>
#include <set>
using namespace std;
using ll = long long;
int main(){
    ll n;
    cin >> n;
    vector<pair<ll,ll>> a(n);
    vector<ll> b(n);
    ll max_i=0,max_z=0;
    for(ll i=0;i<n;i++){
        ll x,y,z;
        cin >> x >> y >> z;
        if(max_z<z){
            max_z = z;
            max_i = i;
        }
        a[i]=make_pair(x,y);
        b[i]=z;
    }
    bool flag;
    bool ok;
    ll temp;
    for(ll i=0;i<=100;i++){
        for(ll j=0;j<=100;j++){
            flag = true;
            ok = false;
            temp = abs(i-a[max_i].first)+abs(j-a[max_i].second)+b[max_i];
            for(ll k=0;k<n;k++){
                if(b[k]>0){
                    if(temp!=abs(i-a[k].first)+abs(j-a[k].second)+b[k]){
                        flag = false;
                    }
                }else{
                    if(temp>abs(i-a[k].first)+abs(j-a[k].second)){
                        flag = false;
                    }
                }
            }
            if(flag == true){
                cout << i << " " << j << " " << temp << endl;
                return 0;
            }
        }
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector< ll > vi;
typedef vector< vi > vvi;
#define pb push_back

int main(void)
{
    ll n;
    cin >> n;
    vi a;
    for(int i = 0;i<n;i++)
    {
        ll temp;
        cin >> temp;
        a.pb(temp);
    }
    ll cnt = 0;
    ll sum = 0;
    for(int i = 0;i<n;i++) {
        sum += a[i];
        if (i % 2) {
            if (sum <= 0) {
                cnt += abs(sum) + 1;
                sum = 1;
            }
        } else {
            if (sum >= 0) {
                cnt += abs(sum) + 1;
                sum = -1;
            }
        }
    }
    ll ans = cnt;
    cnt = 0,sum = 0;
    for(int i = 0;i<n;i++){
        sum += a[i];
        if (i % 2 == 0) {
            if (sum <= 0) {
                cnt += abs(sum) + 1;
                sum = 1;
            }
        } else {
            if (sum >= 0) {
                cnt += abs(sum) + 1;
                sum = -1;
            }
        }
    }
    cout << min(ans,cnt) << endl;
    return 0;
}

Measured memory_bytes: 1528
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		
		Scanner scan = new Scanner(System.in);
		
		int aliceStartTime = scan.nextInt();		
		int aliceStopTime = scan.nextInt();
		int bobStartTime = scan.nextInt();
		int bobStopTime = scan.nextInt();
		
		if(aliceStartTime <= bobStartTime && aliceStopTime <= bobStartTime
				|| bobStartTime <= aliceStartTime && bobStopTime <= aliceStartTime){
			System.out.println("0");
		}else if(bobStartTime <= aliceStartTime && aliceStopTime <= bobStopTime){
			System.out.println(aliceStopTime - aliceStartTime);
		}else if(aliceStartTime <= bobStartTime && bobStopTime <= aliceStopTime){
			System.out.println(bobStopTime - bobStartTime);
		}else if(aliceStartTime <= bobStartTime){
			System.out.println(aliceStopTime - bobStartTime);
		}else if(bobStartTime <= aliceStartTime){
			System.out.println(bobStopTime - aliceStartTime);
		}else{
			System.out.println("エラー");
		}
	}
}

Measured memory_bytes: 23636
using System;
using System.Linq;
class P
{
    static void Main()
    {
        var i = Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToArray();
        var d = i[1] - i[2];
        long c;
        if (i[0] <= i[1]) c = 1;
        else if (d <= 0) c = -1;
        else c = (((i[0] - i[1]) / d) + ((i[0] - i[1]) % d != 0 ? 1 : 0)) * 2 + 1;
        Console.WriteLine(c);
    }
}

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

class Program
{

    static void Main(string[] args)
    {
        var inputs = Console.ReadLine().Split(' ');
        var A = int.Parse(inputs[0]);
        var B = int.Parse(inputs[1]);
        var C = int.Parse(inputs[2]);

        var result = Math.Min(B / A, C);

        Console.WriteLine(result);

    }
}



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

signed main(void)
{
	int n, x, cnt;
	cin >> n >> x;
	vector<long long> a(n);

	cnt = 0;
	rep(i, n) cin >> a[i];
	sort(a.begin(), a.end());
	rep(i, n)
	{
		x -= a[i];
		if (x >= 0)
			cnt++;
		else
			break;
	}
	if (x > 0) cnt--;
	cout << cnt << endl;
	return 0;
}


Measured memory_bytes: 256
#ifdef _MSC_VER
#include <__msvc_all_public_headers.hpp>
#undef min
#undef max
#else
#define NDEBUG
#include <bits/stdc++.h>
#endif

using namespace std;
using large = long long;

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

    auto first = (s[0] - '0') * 10 + (s[1] - '0');
    auto second = (s[2] - '0') * 10 + (s[3] - '0');

    auto fm = (1 <= first && first <= 12);
    auto sm = (1 <= second && second <= 12);

    auto str = (fm && sm) ? "AMBIGUOUS" : fm ? "MMYY" : sm ? "YYMM" : "NA";

    cout << str << endl;
    return 0;
}


Measured memory_bytes: 3592
#include<bits/stdc++.h>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<stack>
#include<queue>
#define endl  "\n"
#define ll long long
#define int long long
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cin.exceptions(cin.failbit);cout.tie(NULL);
using namespace std;
bool isPrime(int n)
{
    if (n <= 1)
        return false;
    if (n <= 3)
        return true;
    if (n % 2 == 0 || n % 3 == 0)
        return false;
    for (int i = 5; i * i <= n; i += 6)
    {
        if ((n % i == 0) || (n % (i + 2) == 0))
            return false;
    }
    return true;
}

int32_t main()
{
	int t=1;
	while(t--)
	{
		int x,k,d;
		cin >> x >> k >> d;
		x=abs(x);
		
		int y;
		
		if(k>=x || d>=x)
		{
			y=-1;
		}
		else
		{
			int p=x/d;
			if(k>p)
			y=-1;
			else
			y=x-k*d;
		}
		
		
		if(y>=0)
		{
			cout << y;
		}
		else
		{
			
			if(x%d==0)
			{
				int temp=x/d;
				int final = k-temp;
				
				if(final%2==1)
				{
					cout << d;
				}
				else
				cout << "0";
			}
			else if(x>d)
			{
				int m=x%d;
				int temp=(x-m)/d;
				int final=k-temp;
				
				if(final%2==1)
				cout << abs(d-m);
				else
				cout << abs(m);
			}
			else
			{
				if(k%2==1)
				cout << abs(d-x);
				else
				cout << x;
			}
		}
	}
}




Measured memory_bytes: 3588
#include<bits/stdc++.h>
#define Accepted 0
using namespace std;
const int maxn=200000;
const long long inf=1e18;
long long n,ans,cur,dp[222222];
priority_queue<pair<long long,int> > pq;
int t,a,b,c,d;
map<pair<long long,int>,long long> mp;
long long get(long long n,int num)
{
	if (n<=maxn) return dp[n];
	if (mp.find(make_pair(n,num))!=mp.end()) return mp[make_pair(n,num)];
	long long res=1e18;
	if (n%2==0) res=min(res,get(n/2,0)+a);
	if (n%3==0) res=min(res,get(n/3,0)+b);
	if (n%5==0) res=min(res,get(n/5,0)+c);
	if (!num) 
	{
		for (int i=-8;i<=3;i++)
		{
			res=min(res,get(n+i,1)+1ll*abs(i)*d);
		}
	}
	if (n<inf/d) res=min(res,1ll*n*d);
	return mp[make_pair(n,num)]=res;
}
int main()
{
	scanf("%d",&t);
	while(t--)
	{
		scanf("%lld%d%d%d%d",&n,&a,&b,&c,&d);
		ans=1e18;dp[0]=0;pq.push(make_pair(0,0));
		for (int i=1;i<=maxn;i++) dp[i]=1e18;
		mp.clear();
		while(!pq.empty())
		{
			int x=pq.top().second;long long y=-pq.top().first;
			pq.pop();
			if (dp[x]!=y) continue;
			if (x>=1 && dp[x-1]>dp[x]+d)
			{
				dp[x-1]=dp[x]+d;
				pq.push(make_pair(-dp[x-1],x-1));
			}
			if (x<maxn && dp[x+1]>dp[x]+d)
			{
				dp[x+1]=dp[x]+d;
				pq.push(make_pair(-dp[x+1],x+1));
			}
			if (2*x<=maxn && dp[2*x]>dp[x]+a)
			{
				dp[2*x]=dp[x]+a;
				pq.push(make_pair(-dp[2*x],2*x));
			}
			if (3*x<=maxn && dp[3*x]>dp[x]+b)
			{
				dp[3*x]=dp[x]+b;
				pq.push(make_pair(-dp[3*x],3*x));
			}
			if (5*x<=maxn && dp[5*x]>dp[x]+c)
			{
				dp[5*x]=dp[x]+c;
				pq.push(make_pair(-dp[5*x],5*x));
			}
		}
		printf("%lld\n",get(n,0));
	}
	return Accepted;
}

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

// definition {{{ 1

// scaning {{{ 2
#define Scd(x) scanf("%d", &x)
#define Scd2(x,y) scanf("%d%d", &x, &y)
#define Scd3(x,y,z) scanf("%d%d%d", &x, &y, &z)

#define Scll(x) scanf("%llu", &x)
#define Scll2(x,y) scanf("%llu%llu", &x, &y)
#define Scll3(x,y,z) scanf("%llu%llu%llu", &x, &y, &z)

#define Scc(c) scanf("%c", &c);
#define Scs(s) scanf("%s", s);
#define Scstr(s) scanf("%s", &s);
// }}} 2

// constants {{{ 2
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
// }}} 2

// systems {{{ 2
#define Rep(x,y) for(int x = 0; x < y; x++)
#define Repe(x,y,z) for(int x = z; x < y; x++)
// }}} 2

// output {{{ 2
#define YesNo(a) (a)?printf("Yes\n"):printf("No\n");
// }}} 2

// }}} 1

void dpupd( int &ate, int cost ){
    ate = min( ate , cost );
}

int main() {

    int N;
    int h[100002];
    int dp[100002];
    Scd(N);
    Rep(i,N){
        Scd(h[i]);
    }
    fill(dp+1,dp+N,INF);
    Rep(ni,N){
        dpupd( dp[ni+1] , abs( h[ni] - h[ni+1] ) + dp[ni] );
        dpupd( dp[ni+2] , abs( h[ni] - h[ni+2] ) + dp[ni] );
    }

    printf ("%d\n", dp[N-1] );

    return 0;
}



Measured memory_bytes: 1024
from heapq import heappop, heappush

X, Y, Z, K = map(int, input().split())
*A, = map(int, input().split())
*B, = map(int, input().split())
*C, = map(int, input().split())
A.sort(reverse=True)

D = [i+j for j in C for i in B]
D.sort(reverse=True)

q = []
for i in A[:K]:
    for j in D[:K]:
        heappush(q, -(i+j))

for _ in range(K):
    print(-heappop(q))

Measured memory_bytes: 177016
/*
memo for solution
*/
#include <cstdlib> 
#include <numeric>
#include <cstring>
#include <cstdio> 
#include <cfloat> 
#include <map> 
#include <cassert>
#include <cmath> 
#include <climits> 
#include <utility> 
#include <set> 
#include <iostream> 
#include <memory> 
#include <string> 
#include <vector> 
#include <algorithm> 
#include <functional> 
#include <sstream> 
#include <complex> 
#include <stack> 
#include <queue> 
#include <iomanip>
#include<sys/time.h>
using namespace std; 
double e_time(void){static struct timeval now;gettimeofday(&now, NULL);return (double)(now.tv_sec  + now.tv_usec/1000000.0);}
#define REP(i,b,n) for(int i=b;i<n;i++) 
#define rep(i,n)      REP(i,0,n) 
#define pb push_back  
#define mp make_pair 
#define ALL(C)   (C).begin(),(C).end() 
#define fe(c,itr) for(__typeof((c).begin()) itr=(c).begin();itr != (c).end();itr++)
#define BITSHIFT(X)     ( (1<<(X)) )
#define CONTAIN(S,X) ( ((S)&BITSHIFT(X)) != 0)
typedef complex<double>P; 
typedef long long ll; 
typedef unsigned long long ull; 
typedef pair<int,int> pii; 
typedef vector<int> vint;
template<class T> void vp(T &a,int p){rep(i,p)cout << a[i]<<" ";cout << endl;}  
template<class T> T ceilUp(const T& a,const T& b){return (a+b-1)/b;}
const ll mod =   1000000009;
inline ll modadd(ll a,ll b){a %= mod;b %= mod;return (a+b)%mod;}
inline ll modsub(ll a,ll b){a %= mod;b %= mod;a-=b;a%=mod;if (a<0)a+=mod;return a;}
inline ll modmul(ll a,ll b){a %= mod;b %= mod;return (a*b)%mod;}
inline ll modeq(ll a,ll b,ll m){a = (a%m+m)%m; b = (b%m+m)%m;return a == b;}
//ll modpow(ll n,ll p){if (p == 0)return 1;if (p == 1)return n;ll ret=mypow(n,p/2);ret=ret*ret%mod;if (p&1)ret=ret*n%mod;return ret;}
//ll getinv(ll a){return mypow(a,mod-2);}

int main(){
  int n;
  cin >> n;
  int ans = 0;
  int color = -1;
  int cnt = 1;
  cin >> color;
  
  for(int i = 1;i < n;i++){
    int tmp;
    cin >> tmp;
    if (tmp == color)cnt++;
    else {
      ans += cnt/2;
      color = tmp;
      cnt = 1;
    }
  }
  ans += cnt/2;
  cout << ans << endl;
  return 0;
}


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

using namespace std;
typedef long long ll;
typedef vector<int> vi;

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

	int n, l;
	string a[111];
	cin >> n >> l;
	for(int i=0; i<n; i++) {
		cin >> a[i];
	}
	sort(a, a+n);
	for(int i=0; i<n; i++) {
		cout << a[i];
	}
	return 0;
}


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

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

int main(){
  char a;
  cin >> a;

  if(isupper(a)) cout << "A";
  else cout << "a";
}


Measured memory_bytes: 3632
d=int(input())
for i in range(d):
    gx,gy=map(int,input().split())
    L1=[[0 for y in range(16)]for x in range(16)]#たて
    L2=[[0 for y in range(16)]for x in range(16)]#よこ
    L3=[[0 for y in range(16)]for x in range(16)]#結果

    m=int(input())
    for i in range(m):
        x1,y1,x2,y2=map(int,input().split())
        if x1==x2:
            L1[max(y1,y2)][x1]=1
        else:
            L2[y1][max(x1,x2)]=1

    for y in range(gy+1):
        for x in range (gx+1):
            if x==y==0:
                L3[y][x]=1
            elif L1[y][x]==L2[y][x]==1:
                L3[y][x]=0
            elif (L1[y][x]==1 or L2[y][x]==1) and (y==0 or x==0):
                L3[y][x]=0
            elif y==0 or L1[y][x]==1:
                L3[y][x]=L3[y][x-1]
            elif x==0 or L2[y][x]==1:
                L3[y][x]=L3[y-1][x]
            else:
                L3[y][x]=L3[y][x-1]+L3[y-1][x]

    n=L3[gy][gx]
    if n==0:
        print("Miserable Hokusai!")
    else:
        print(n)


Measured memory_bytes: 5624
//author : raghav_0901
#include <bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
//#define int long long int
#define f(i,s,e) for(i=s;i<e;++i)
#define fr(i,s,e) for(i=s;i>=e;i--)
#define all(x) (x).begin(),(x).end()
#define all_r(x) (x).rbegin(),(x).rend()
#define _in(v) for(auto &x:v) cin>>x;
#define ffr(i,s,e,f) for(i=s;i>=e && f;i--)
#define ff(i,s,e,f) for(i=s;i<e && f;++i)
#define mem(arr,val) memset(arr, val, sizeof(arr));
#define _out(v) for(auto x:v) cout<<x<<' '; cout<<'\n';
#define ARENA ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
 
const int lim = 1000000;
const int mod = 1e9;

typedef vector<double> vec;
typedef pair<int,int> pr;

//-----------------------------------------functions---------------------------------------------------------------------------------
int gcd(int a,int b) { return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a*b/gcd(a,b);}
inline int n_sum(int n){return (n*(n+1))/2;}
int power(int a,int b){int res=1;assert(b>=0);for(;b;b>>=1){if(b&1)res=res*a;a=a*a;}return res;}
int powmod(int a,int b){int res=1;a%=mod;assert(b>=0);for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
int gcdExtended(int a,int b,int &x,int &y){if(a==0){x=0;y=1;return b;}int x1,y1,gcd=gcdExtended(b%a,a,x1,y1);x=y1-((b/a)*x1);y=x1;return gcd;}
int modInv(int a,int m){int x,y;gcdExtended(a,m,x,y);return (x%m + m)%m;}
int divM(int a,int b){return (modInv(b,mod)*(a%mod))%mod;}
//------------------------------------------------------------------------------------------------------------------------------------


void _main(void)
{
    int n;cin>>n;cout<<(2*3.141*n)<<endl;
    return;
} 

signed main(void)
{
    ARENA
    int t=1,i;//cin>>t;
    f(i,1,t+1)
    {
        //cout<<"Case #"<<i<<": ";
        _main();
    }
    return 0;
}


Measured memory_bytes: 3808
import sys
import math
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

n = int(read())

def is_prime(n):
    if n == 1: return False

    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False

    return True


for i in range(n, n*n, 1):
    if is_prime(i):
        print(i)
        break


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

int main() {
	string O,E;
  	cin >> O >> E;
  
  	int size = E.size();
  	if(O.size() < E.size()) size = O.size();
	
  	for(int i = 0; i < size; i++) {
    	cout << O.at(i);
      	cout << E.at(i);
    }
  if(O.size() != E.size()) {
  	if(size == O.size()) {
    	cout << E.at(E.size() - 1);
    }else {
    	cout << O.at(O.size() - 1);
    }
  }

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define SORT(x) sort((x).begin(),(x).end())
#define ALL(x) (x).begin(),(x).end()
#define rep(i, n) for(int i = 0; i < n; i++)
#define reps(i, m, n) for(int i = m; i < n; i++)
#define repr(i, m, n) for(int i = m; i >= n; i--)
#define db(x) cout<<#x<<"="<<x<<endl
#define deb(x) each(x.begin(),x.end(),(int& y){cout << y <<" ";})
template<class T>bool maxi(T &a,const T &b){if(a<b){ a=b; return 1;} return 0;}
template<class T>bool mini(T &a,const T &b){if(b<a){ a=b; return 1;} return 0;}
#define y0 y3487465 //j0
#define y1 y1347829 //j1
#define INF2 4000000000000000037
#define INF 1000000007
#define PI (acos(-1))
#define MOD 1000000007
using namespace std;
typedef long long ll;

ll modpow(ll a, ll n, ll mod=MOD){ // a^n % MOD の計算
  ll res = 1;
  while (n > 0){
    if(n & 1) res = res * a % mod;
    a = a * a  % mod;
    n >>= 1;
  }
  return res;
}

void Main(){

  int N,M; cin>>N>>M;

  ll cost[M];
  ll kagi[M];

  rep(i,M){
    int a,b; cin>>a>>b;
    int buff=0;
    rep(i,b){
      int c; cin>>c;
      buff+=(1<<(c-1));
    }
    cost[i]=a;
    kagi[i]=buff;
  }

  int MAXN=modpow(2,N);

  ll dp[MAXN]={};

  rep(i,MAXN){
    dp[i]=INF2;
  }
  dp[0]=0;

  rep(i,MAXN){
    rep(j,M){
      mini(dp[(kagi[j] bitor i)], dp[i]+cost[j]);
    }
  }

  if(dp[MAXN-1]==INF2) dp[MAXN-1]=-1;
  cout<< dp[MAXN-1] <<"\n";

}

//-----------------------------------
int main(){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  Main();
}
//-----------------------------------


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

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

#define forn(i, a, n) for (int i = a; i < n; ++i)
#define ford(i, a, n) for (int i = n - 1; i >= a; --i)
#define fore(i, a, n) for (int i = a; i <= n; ++i)
#define all(a) (a).begin(), (a).end()
#define fs first
#define sn second
#define trace(a)\
    for (auto i : a) cerr << i << ' ';\
    cerr << '\n'
#define eb emplace_back

#ifndef M_PI
const ld M_PI = acos(-1.0);
#endif

const ld eps = 1e-9;
const int INF = 2000000000;
const ll LINF = 1ll * INF * INF;
const ll MOD = 1000000007;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int k, t;
    cin >> k >> t;
    int mx = 0;
    forn(i, 0, t) {
        int x;
        cin >> x;
        mx = max(x, mx);
    }
    int rest = k - mx;
    int ans = mx - rest - 1;
    ans = max(ans, 0);
    cout << ans << '\n';
}


Measured memory_bytes: 384
#include<iostream>
#include<algorithm>
#include<string>
#include<cstring>
using namespace std;
int main()
{
    string s;
    while(cin>>s)
    {
        int flag=1;
        int a[3];
        memset(a,0,sizeof(a));
        for(int i=0;i<3;i++)
        {
            if(s[i]=='a')
            {
                a[0]=1;
            }
            if(s[i]=='b')
                a[1]=1;
            if(s[i]=='c')
                a[2]=1;

        }
        for(int i=0;i<3;i++)
            if(a[i]!=1)
                flag=0;
        if(flag==1)
            cout<<"Yes"<<endl;
        else
            cout<<"No"<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
int main(void){
    int n,max,min,*p,i=0,j=0;
    scanf("%d",&n);
    p=malloc(sizeof(int)*n);
    while(scanf("%d",p+i)==1){
        if(i==n-1)break;
        i++;
    }
    max=*(p+1)-*p;
    min=*(p);
    for(j=1;j<=n-1;j++){
        if((*(p+j)-min)>max){
            max=*(p+j)-min;
        }
        if(min>*(p+j)){
            min=*(p+j);
        }
    }
    free(p);
    printf("%d\n",max);
    return 0;
}


Measured memory_bytes: 2276
public class Main {
        private static java.util.Scanner scanner = new java.util.Scanner(System.in);
     
        public static void main(String[] args) {
            int d = scanner.nextInt(), g = scanner.nextInt();
            int[] p = new int[d], c = new int[d];
            for (int i = 0; i < d; i++) {
                p[i] = scanner.nextInt();
                c[i] = scanner.nextInt();
            }
     
            int ans = 10000;
            for (int i = 0; i < 1 << d; i++) {
                int sum = 0, count = 0, zero = 0;
                for (int j = 0; j < d; j++) {
                    if ((1 << j & i) != 0) {
                        sum += (j + 1) * 100 * p[j] + c[j];
                        count += p[j];
                    } else {
                        zero = j;
                    }
                }
                if (sum < g) {
                    int t = (int)Math.ceil((g - sum) / ((zero + 1) * 100F));
                    if (p[zero] < t)
                        continue;
                    count += Math.ceil((g - sum) / ((zero + 1) * 100F));
                }
                ans = Math.min(ans, count);
            }
            System.out.println(ans);
        }
    }

Measured memory_bytes: 23764
//
//  second.cpp
//  CoderTest
//
//  Created by yuya on 2019/05/23.
//  Copyright © 2019 yuya. All rights reserved.
//

#include<bits/stdc++.h>
#define ll long long
using namespace std;



int main()
{
    int i;
    
    string S;
    cin >> S;
    char c = S[0], c1 = c+1;
    string S1 = {c,c,c}, S2 = {c1,c1,c1};
    if(S <= S1) cout << S1 << endl;
    else cout << S2 << endl;
    
    return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize ("O3")

#include <bits/stdc++.h>
#define DEBUG true
#ifdef ONLINE_JUDGE
#undef DEBUG
#define DEBUG false
#endif 

using namespace std;

#define TRACE(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); cerr << endl;}

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << "[" << *it << " = " << a << "]";
	err(++it, args...);
}

#define MAXN ((int)2e5+5)
#define MOD ((int)1e9 + 7)
#define INF ((int)1e9 + 9)
#define ll long long
#define _ << " " <<
#define CLEAR(a, b) memset(a, b, sizeof(a))
#define LOG(x) if(DEBUG) cerr << x << endl;
#define pb push_back
#define all(x) x.begin(), x.end()
#define endl "\n"
#define pii pair<int,int>
#define mid ((l+r)/2)

int n;
int d[MAXN];
int x = 0;

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

	cin >> n;
	for (int i = 0; i < n; ++i)
	{
		cin >> d[i];
		x^=d[i];
	}

	for (int i = 0; i < n; ++i)
		cout << (x^d[i]) << " ";
}

/* stuff you should look for
	* int overflow, array bounds
	* special cases (n=1?)
	* do smth instead of nothing and stay organized
	* WRITE STUFF DOWN
*/

Measured memory_bytes: 4408
#include<bits/stdc++.h>
#define ll long long
#define pii pair<int,int>
#define mp make_pair
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fi first
#define se second
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define maxn 200005
using namespace std;
int n;
int vis[maxn];
vector<int> g[maxn];
int tree[maxn];
vector<int> ha;
int ans[maxn];
int a[maxn];
void dfs(int v){
    vis[v]=1;
    int o,oo,ooo;
    if(v==1) ha.pb(a[1]),ans[1]=1;
    else{
        ooo=ha.size();
        o=lower_bound(ha.begin(),ha.end(),a[v])-ha.begin();
        if(o<(int)ha.size()) oo=ha[o],ha[o]=a[v];
        else ha.pb(a[v]);
        ans[v]=ha.size();
    }
    for(int i=0;i<(int)g[v].size();i++)
        if(!vis[g[v][i]])
            dfs(g[v][i]);
    if(v!=1){
        if(o<ooo) ha[o]=oo;
        else ha.pop_back();
    }
}
int main(){
    scanf("%d",&n);
    for(int i=1;i<=n;i++) scanf("%d",&a[i]);
    for(int i=1;i<n;i++){
        int x,y;
        scanf("%d %d",&x,&y);
        g[x].pb(y);
        g[y].pb(x);
    }
    dfs(1);
    for(int i=1;i<=n;i++) printf("%d\n",ans[i]);
    return 0;
}

Measured memory_bytes: 31308
import sys
input = lambda: sys.stdin.readline().rstrip()

def factorize(n):
    fct = []  # prime factor
    b, e = 2, 0  # base, exponent
    while b * b <= n:
        while n % b == 0:
            n = n // b
            e = e + 1
        if e > 0:
            fct.append((b, e))
        b, e = b + 1, 0
    if n > 1:
        fct.append((n, 1))
    return fct

def main():
    n = int(input())
    primes = factorize(n)
    ans = 0
    for prime in primes:
        i = 1
        cnt = 0
        while True:
            if cnt + i > prime[1]:
                break
            else:
                cnt += i
                i += 1
        ans += (i - 1)
    print(ans)
    
if __name__ == '__main__':
    main()

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

int main(int argc, char *argv[]) { ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);

  for(int i=0;i<5;i++){
    int t;cin>>t;
    if(t==0){
      cout<<i+1<<endl;
      return 0;
    }
  }

  
  return 0;
}


Measured memory_bytes: 3600
#include <iostream>
#include <cmath>
#include <algorithm>

using namespace std;

#define ll long long

int N, M, K[35],A[35][35] = {}, cnt[31]={}, ans = 0;

void solve(){
    for(int i = 1; i <= 30; i++) if(cnt[i]==N) ans++;
    cout << ans << endl;
}

int main(){
    cin >> N >> M;

    for(int i = 1; i <= N; i++){
        cin >> K[i];
        for(int k = 0; k < K[i]; k++) {
            cin >> A[i][k];
            cnt[A[i][k]]++;
        }
    }

    solve();
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define rep1(i,n) for(int i=1; i<=(n); ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define sz(v) (int)v.size()
#define pb push_back

using namespace std;
int a,b,c;
int main(){
    cin >> a >> b >> c;
    vector<int> r;
    rep1(i,b+1) r.pb((a*i)%b);
    auto itr = find(ALL(r),c);
    if(itr == r.end()) cout << "NO" << endl;
    else cout << "YES" << endl;
    
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, n) for(int i = 0; i < (n); i++)
#define MEM(a, x) memset(a, x, sizeof(a))
#define ALL(a) a.begin(), a.end()
#define UNIQUE(a) a.erase(unique(ALL(a)), a.end())
typedef long long ll;

ll N;

int main(int argc, char const *argv[]) {
	ios_base::sync_with_stdio(false);
	cin >> N;
	for (ll h = 1; h <= 3500; h++) {
		for (ll n = 1; n <= 3500; n++) {
			ll up = N*h*n, down = 4*h*n-N*n-N*h;
			if (down <= 0) continue;
			if (up % down == 0 && up / down <= 3500) {
				cout << h << " " << n << " " << up/down << endl;
				return 0;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
void jiaohuan(int a,int b)
{
    int temp;
    if(a<b)
    {
        temp=a;
        a=b;
        b=temp;
    }
}
int main()
{
    int a,b,c;
    scanf("%d %d",&a,&b);
    jiaohuan(a,b);
    while(a%b!=0)
    {
        c=b;
        b=a%b;
        a=c;
        jiaohuan(a,b);
    }
    printf("%d\n",b);
}



Measured memory_bytes: 2052
from collections import Counter

N = int(input())
S = list(input())

c = Counter(S)
ans = c["R"] * c["G"] * c["B"]

if ans == 0:
    print(0)
    exit()

for n_skip in range(1, N):
    for i in range(N):
        try:
            if S[i] != S[i+n_skip] and S[i+n_skip] != S[i + 2*n_skip] and S[i + 2*n_skip] != S[i]:
                ans -= 1
        except IndexError:
            break

print(ans)

Measured memory_bytes: 68712
#include<bits/stdc++.h>
using namespace std;
using ll = unsigned long long int;
int main() 
{
     ll n;
     cin>>n;
     ll cnt[n+1] = {0};
     for(int i=1;i<=n;i++)
     {
     	for(int j=i;j<=n;j+=i)
     	{
     		cnt[j]++;
     	}
     }
     ll ans = 0;
     for(int i=1;i<=n;i++)
     {
     	 ans+=(i*cnt[i]);
     }
     cout<<ans<<"\n";
}

Measured memory_bytes: 81752
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int num = sc.nextInt();
    sc.nextLine();
    long multi = 1;
    long max = (long)Math.pow(10.0, 18.0);
    long[] nums = new long[num];
    
    for(int i = 0; i < num; i++){
      nums[i] = sc.nextLong();
      if(nums[i] == 0){
      	System.out.println(0);
        return;
      }
    }
    for(int j = 0; j < num; j++){
      if(multi <= max / nums[j]){
        multi *= nums[j];
      }else{
      	System.out.println("-1");
        return;
      }
    }
    
     System.out.println(multi);
    
  }

}

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

import fractions
#import math
from functools import reduce

def gcd(*numbers):
    return reduce(fractions.gcd, numbers)
    #return reduce(math.gcd, numbers)

def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)
    #return reduce(math.gcd, numbers)

g = gcd_list(A)
if k%g == 0 and max(A) >= k:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')


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

int main() {
    cout << fixed << setprecision(10);
    int N; cin >> N;
    vector<P> xy(N);
    ll kaijo = 1;
    rep(i, N) {
        int x, y;
        cin >> x >> y;
        xy[i] = make_pair(x, y);
        kaijo *= (i+1);
    }

    // ありうる道の合計
    double load_sum = 0;
    rep(i, N-1) {
        int x1, y1;
        x1 = xy[i].first;
        y1 = xy[i].second;
        for (int j=i+1; j<N; ++j) {
            load_sum += sqrt( double( pow((x1-xy[j].first), 2) + pow((y1-xy[j].second), 2)));
            // cout << load_sum << endl;
        }
    }
    double ans;
    ans = load_sum * 2 / N ;
    cout << ans << endl;
    return 0;
}

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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N, M;
  cin >> N >> M;
  vector<string> A(N);
  REP(i, N) cin >> A[i];
  vector<string> B(M);
  REP(i, M) cin >> B[i];
  bool ans = false;
  for(int i = 0; i < N - M + 1; i++) {
    for(int j = 0; j < N - M + 1; j++) {
      bool flag = true;
      for(int bx = 0; bx < M; bx++) {
        for(int by = 0; by < M; by++) {
          int ax = i + bx;
          int ay = j + by;
          if(A[ax][ay] != B[bx][by]) { flag = false; }
        }
      }
      if(flag) { ans = true; }
    }
  }
  if(ans) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long int
#define pb push_back
#define mpp make_pair

using namespace std;

const int N=3e5+5;
const ll infi=1e18+5;


int main()
{
	ll n,k,s,i;
	cin>>n>>k>>s;


	for(i=1;i<=k;i++)
		cout<<s<<" ";
	ll val=1e9;
	if(s+1<=val)
		for(i=k+1;i<=n;i++)
			cout<<val<<" ";
	else if(s+1>1e9)
		for(i=k+1;i<=n;i++)
			cout<<1<<" ";

		
}

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

int main(void)
{
        int n,i,c;
        char s[100];

        scanf("%s",s);

        n=strlen(s);

        c=0;
        for(i=0;i<n;i++){
                if(i%2==0){
                        if(s[i]=='R' || s[i]=='U' || s[i]=='D') c++;
                }
                else {
                        if(s[i]=='L' || s[i]=='U' || s[i]=='D') c++;
                }
        }

        if(c==n) printf("Yes");
        else     printf("No");

        return 0;
}


Measured memory_bytes: 128
#include <algorithm>  
#include <iostream>  
#include <sstream>  
#include <string>  
#include <cstring>
#include <vector>  
#include <queue>  
#include <set>  
#include <map>  
#include <cstdio>  
#include <cstdlib>  
#include <cctype>  
#include <cmath>  
#include <list>  
#include <cassert>
#include <ctime>
#include <climits>
using namespace std;  

#define PB push_back  
#define MP make_pair  
#define SZ(v) ((int)(v).size())  
#define FOR(i,a,b) for(int i=(a);i<(b);++i)  
#define REP(i,n) FOR(i,0,n)  
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)  
#define REPE(i,n) FORE(i,0,n)  
#define FORSZ(i,a,v) FOR(i,a,SZ(v))  
#define REPSZ(i,v) REP(i,SZ(v))  
typedef long long ll;
typedef unsigned long long ull;
ll gcd(ll a,ll b) { return b==0?a:gcd(b,a%b); }

const int MAXN=500000;

int n,sd,nq;
int x[MAXN];

int d[MAXN+1];
ll need[MAXN+1];


void run() {
	scanf("%d%d",&n,&sd);
	REP(i,n) scanf("%d",&x[i]);

	d[0]=sd; REP(i,n) d[i+1]=min(d[i],abs(d[i]-x[i]));
	need[n]=1; for(int i=n-1;i>=0;--i) if(x[i]>=2*need[i+1]) need[i]=need[i+1]; else need[i]=need[i+1]+x[i];

	scanf("%d",&nq);
	REP(qi,nq) {
		int idx; scanf("%d",&idx); --idx;
		int curd=d[idx]; ll curneed=need[idx+1];
		//printf("%d: d=%d need=%lld\n",idx,curd,curneed);
		printf("%s\n",curd>=curneed?"YES":"NO");
	}
}

int main() {
	run();
	return 0;
}


Measured memory_bytes: 9728
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bitset>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<list>
#include<iomanip>
#include<cmath>
#include<cstring>
#include<functional>
using namespace std;

#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define INF 2e9
#define MOD 1000000007
//#define MOD 998244353
#define LINF (long long)4e18
#define jck 3.141592

using ll = long long;
using Pi = pair<int,int>;
using Pl = pair<ll,ll>;

int main(){
    int N; cin >> N;
    vector<pair<string,int>> v(N);
    int sum = 0;
    rep(i,N){
        cin >> v[i].first >> v[i].second;
        sum += v[i].second;
    }
    string X; cin >> X;
    int now = 0;
    rep(i,N){
        now += v[i].second;
        if(v[i].first == X){
            cout << sum-now << endl;
            return 0;
        }  
    }

}
    



Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main()
{
	int a, b;
	cin >> a >> b;
					if (a==1 && b ==1){
						a=2;
						b=2;
					}
					if (a==1){
						a+=12;
						b--;
					}	if (b==1){
						b+=12;
						a--;
					}
	if(1<=a && a<=13 && 1<=b && b<=13){
		if(b<a){
			cout << "Alice" << endl;
		}else if (a<b){
			cout << "Bob" << endl;
		}else if(a==b)
				cout << "Draw" << 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;
const int inf = 1001001000;
const ll INF = 1LL<<60;
const ll MOD = 1e9 + 7;

int main(){
	int x,N; cin>>x>>N;
	vector<bool> R(1000,true);
	int t;
	rep(i,N){
		cin>>t;
		R[t+500] = false;
	}
	int md = inf;
	int dif;
	int ans;
	rep(i,1000){
		if(R[i] == true){
			t = i-500;
			dif = abs(t-x);
			if(dif < md){
				md = dif;
				ans = t;
			}
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
int main(){
    int a;
    cin>>a;

    if(a/100>=1&&a/100<=12&&a%100>=1&&a%100<=12){
        cout<<"AMBIGUOUS"<<endl;
    }
    else if(a/100>=1&&a/100<=12){
        cout <<"MMYY"<<endl;
    }
    else if(a%100>=1&&a%100<=12){
        cout <<"YYMM"<<endl;
    }
    else{
        cout<<"NA"<<endl;
    }

}


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

int main()
{
    fast_cin;
    #ifndef ONLINE_JUDGE
    // for getting input from input.txt
    freopen("input.txt", "r", stdin);
    // for writing output to output.txt
    freopen("output.txt", "w", stdout);
    #endif

    string s,t;

    cin>>s>>t;
    int m=s.length();
    int n=t.length();
    ll ans=LLONG_MAX;
    for(ll i=0;i<m-n+1;i++){
        ll curr=0;
        for(ll j=0;j<n;j++){
            if(s[i+j]!=t[j]) curr++;
        }
        if(curr<ans)
            ans=curr;
    }
    cout<<ans<<"\n";



}


Measured memory_bytes: 3600
# from math import factorial,sqrt,ceil,gcd
# from itertools import permutations as permus
# from collections import deque,Counter
# import re
# from functools import lru_cache # 簡単メモ化 @lru_cache(maxsize=1000)
# from decimal import Decimal, getcontext
# # getcontext().prec = 1000
# # eps = Decimal(10) ** (-100)

import numpy as np
# import networkx as nx
# from scipy.sparse.csgraph import shortest_path, dijkstra, floyd_warshall, bellman_ford, johnson
# from scipy.sparse import csr_matrix
# from scipy.special import comb

# slist = "abcdefghijklmnopqrstuvwxyz"
N,M = map(int,input().split())
ans = np.zeros(N+1,dtype="int64")
for i in range(M):
    a, b = map(int,input().split())
    ans[a] += 1
    ans[b] += 1

print(*ans[1:],sep="\n")
# print(*ans)   # unpackして出力。間にスペースが入る
# for row in board:
#     print(*row,sep="")    #unpackして間にスペース入れずに出力する
# print("{:.10f}".format(ans))
# print("{:0=10d}".format(ans))


Measured memory_bytes: 12488
from itertools import accumulate
N, W = map(int, input().split())
Item = [[] for i in range(4)]
for i in range(N):
    wi, vi = map(int, input().split())
    if i == 0:
        Item[0].append(vi)
        w_base = wi
    else:
        Item[wi - w_base].append(vi)

w0, w1, w2, w3 = Item
w0 = [0] + list(accumulate(sorted(w0, reverse=True)))
w1 = [0] + list(accumulate(sorted(w1, reverse=True)))
w2 = [0] + list(accumulate(sorted(w2, reverse=True)))
w3 = [0] + list(accumulate(sorted(w3, reverse=True)))

ans = 0
for i in range(len(w0)):
    for j in range(len(w1)):
        for k in range(len(w2)):
            tmp_weight = w_base * i + (w_base + 1) * j + (w_base + 2) * k
            if tmp_weight > W:
                continue
            tmp_ans = w0[i] + w1[j] + w2[k] + w3[min((W - tmp_weight) // (w_base + 3), len(w3) - 1)]
            ans = max(ans, tmp_ans)

print(ans)


Measured memory_bytes: 3064
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<ctype.h>
#include<math.h>
#define INPUT_BUF_SIZE 1024
#define MAX_PRIME_NUM 500000

int main(void){
	int input;                    //??\???
	int prime[MAX_PRIME_NUM]={};  //prime[i]??????i????´???°??????0,????????°1
	int i,j;                      //???????????¨?????°
	int ans;                      //??????
	
	//0,1????´???°??§?????????????????????
	prime[0]=1;
	prime[1]=1;
	//2?????????????´???°??????????????????
	for(i=2;i<=MAX_PRIME_NUM;i++){
		//i????´???°?????????
		if(prime[i]==0){
			j=2;
			//i????????°?????¨????´???°??§?????????????????????(i???j???????´???°??????????????????)
			while(i*j<=MAX_PRIME_NUM){
				prime[i*j]=1;
				j++;
			}
		}
	}
	while(scanf("%d",&input)!=EOF){
	    if(input==0){
	        break;
	    }
		ans=0;
		//?´???°????????°?????°????????????
		for(i=input+1;i<=input*2;i++){
			if(prime[i]==0){
				ans+=1;
			}
		}
		printf("%d\n",ans);
	}
	return 0;
}

Measured memory_bytes: 2560
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <stdlib.h>
#include <stdio.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 abs_A(int num) {
    if (num > 0)
        return num;
    else
        return -num;
}

int abs_B(long long num, long long numb) {
    if (num - numb >= 0)
        return num - numb;
    else
        return -1 * (num - numb);
}

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

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



const long long MOD = 1000000007;

int main() {
    int N;
    cin >> N;
    vector<int> retu(N);
    for (int i = 0; i < N; i++) {
        cin >> retu.at(i);
    }
    vector<int> cop(N);
    for (int i = 0; i < N; i++) {
        cop.at(i) = retu.at(i);
    }
    sort(cop.begin(), cop.end());
    reverse(cop.begin(), cop.end());
    int maxx, secc;
    maxx = cop.at(0);
    secc = 0;
    int count = 1;
    for (int i = 1; i < N; i++) {
        if (cop.at(i) < maxx) {
            secc = cop.at(i);
            break;
        }
        count++;
    }
    for (int i = 0; i < N; i++) {
        if (retu.at(i) == maxx && count == 1) {
            cout << secc << endl;
        }
        else {
            cout << maxx << endl;
        }
    }
}



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

int main() {
  string A,B;
  cin >> A >> B;
  int C=0;
  for(int i=0; i<A.size(); i++) {
    if(A.at(i) != B.at(i)) {
      C++;
    }
  }
  cout << C << endl;
}

Measured memory_bytes: 3908