akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <vector>
using namespace std;
typedef long long LL;
const int maxn=1e5+10;

int n,m,u,v;
vector<int> path[maxn];
int c[maxn];
bool f;

void dfs(int p)
{
	for(int i=0;i<path[p].size();i++)
	{
		int tmp=path[p][i];
		if (c[tmp]==-1)
		{
			c[tmp]=1-c[p];
			dfs(tmp);
			if (!f) return;
		}
		else if (c[tmp]==c[p]) 
		{
			f=false;
			return;
		}
	}
	return;
}

int main()
{
	scanf("%d%d",&n,&m);
	for(int i=1;i<=m;i++)
	{
		scanf("%d%d",&u,&v);
		path[u].push_back(v);
		path[v].push_back(u);
	}
	
	f=true;
	for(int i=1;i<=n;i++) c[i]=-1;
	c[1]=0;
	dfs(1);
	
	if (!f)
	{
		printf("%lld\n",(LL)n*(n-1)/2-m);
		return 0;
	}
	
	int cnt=0;
	for(int i=1;i<=n;i++) if (c[i]==0) cnt++;
	printf("%lld\n",(LL)cnt*(n-cnt)-m);
	return 0;
}

Measured memory_bytes: 6528
#include <bits/stdc++.h>
using namespace std;
int main(){
    long long w,h,n;
    cin >> w >> h >> n;
    long long x[n],y[n],a[n],w1=0,w2=w,h1=0,h2=h;
    for(int i=0;i<n;i++){
      cin >> x[i] >> y[i] >> a[i];
      if(a[i]==1){
        w1=max(w1,x[i]);
      }else if(a[i]==2){
        w2=min(w2,x[i]);
      }else if(a[i]==3){
        h1=max(h1,y[i]);
      }else if(a[i]==4){
        h2=min(h2,y[i]);
      }
    }
    if(w2-w1<=0||h2-h1<=0){
      cout << 0 << endl;
      return 0;
    }
    cout << (w2-w1)*(h2-h1) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main(){
    int  H, W;
    cin >> H >> W;
    char A[H+2][W+2];

    for (int i = 0; i < H+2; i++){
        for (int j = 0; j < W+2; j++){
            A[i][j] = '#';
        }
    }

    for (int i = 1; i < H+1; i++){
        for (int j = 1; j < W+1; j++){
            cin >> A[i][j];
        }
    }

    for (int i = 0; i < H+2; i++){
        for (int j = 0; j < W+2; j++){
            cout << A[i][j];
        }
        cout << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#ifdef HIRO
#define d(f_, ...) printf((f_), ##__VA_ARGS__)
#else
#define d(f_, ...)
#endif

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<long long, long long> pllll;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector< pair<int, int> > vii;
typedef vector< pair<long long, long long> > vllll;
typedef map<int, int> mii;
typedef map<long long, long long> mllll;
typedef queue<int> qi;
typedef queue< pair<int, int> > qp;
#define mp make_pair
#define pi 3.14159265358979323846
#define MAX max_element
#define MIN min_element
#define all(v) v.begin(), v.end()
#define gt(T) greater<T>()
#define sum(v) accumulate(v.begin(), v.end(), 0ll)
#define uni(v) do{ \
  sort(v.begin(), v.end()); \
  decltype(v)::iterator result = unique(v.begin(), v.end()); \
  v.erase(result, v.end()); \
}while(0)
#define fi(init, n) for(int i = init; i < n; ++i)
#define fj(init, n) for(int j = init; j < n; ++j)
#define fk(init, n) for(int k = init; k < n; ++k)
#define zero(x) memset(x, 0, sizeof(x))
#define negative(x) memset(x, ~0, sizeof(x))
#define bitsum(x) __builtin_popcount(x)
const ll MOD = 1e9 + 7;
const int INF = 1e9;
const int di[] = { 0, 1, 0, -1 };
const int dj[] = { 1, 0, -1, 0 };

template<typename T>
T gcd(T a, T b) {
	return b ? gcd(b, a % b) : a;
}
template<typename T>
T lcm(T a, T b) {
	return a / gcd(a, b) * b;
}
template<typename T>
int finder(vector<T> vec, T number) {
	auto itr = find(vec.begin(), vec.end(), number);
	size_t index = distance(vec.begin(), itr);
	if (index != vec.size()) return 1;
	else return 0;
}
ll frac(ll n){
	if (n == 0) return 1;
	return (n * frac(n - 1)) % MOD;
}
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 argc, char** argv) {
#ifdef HIRO
  string quiz(argv[1]);
  string id(argv[2]);
  string filename("input/" + quiz + "/" + id + ".txt");
  ifstream fin(filename);
  if (fin.peek() == ifstream::traits_type::eof()) {
    cout << "No input.";
    return 0;
  }
  ifstream cin(filename);
  std::cin.rdbuf(cin.rdbuf());
#endif
  ll ans = 0;
  ll n;
  cin >> n;
  ll arr[n];
  ll r_even_sum = 0, r_odd_sum = 0, l_even_sum = 0, l_odd_sum = 0;
  int plus_minus = 1;
  fi(0, n) {
    cin >> arr[i];
    if(i % 2)
      r_odd_sum += arr[i];
    else
      r_even_sum += arr[i];
  }
  
  fi(0, n) {
    if(i > 0) {
      if((i - 1) % 2) {
        r_odd_sum -= arr[(i - 1)];
        l_odd_sum += arr[(i - 1)];
      }
      else {
        r_even_sum -= arr[(i - 1)];
        l_even_sum += arr[(i - 1)];
      }
    }
    // printf("%lld %lld %lld %lld\n", r_even_sum, r_odd_sum, l_odd_sum, l_even_sum);
    cout << (r_even_sum - r_odd_sum + l_odd_sum - l_even_sum) * plus_minus << endl;
    plus_minus *= -1;
  }
  // cout << ans << endl;
  return 0;
}



Measured memory_bytes: 2048
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        final Scanner scanner = new Scanner(System.in);

        final int n = scanner.nextInt();
        final int d = scanner.nextInt();
        scanner.nextLine();

        final int[][] vectors = new int[n][d];
        for (int i = 0; i < n; i++) {
            vectors[i] = Arrays.stream(scanner.nextLine().split(" ")).mapToInt(Integer::parseInt).toArray();
        }

        int count = 0;
        for (int i = 0; i < n; i++) {
            for (int j = i + 1; j < n; j++) {
                int dist = 0;
                for (int k = 0; k < d; k++) {
                    dist += (vectors[i][k] - vectors[j][k]) * (vectors[i][k] - vectors[j][k]);
                }

                final double realDist = Math.sqrt(dist);
                if (realDist == Math.floor(realDist)) {
                    count++;
                }
            }
        }

        System.out.println(count);
    }
}

Measured memory_bytes: 29012
#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
using namespace std;
int a[27];
int main()
{
    string w;
    cin>>w;
    int n=w.size();
    for(int i=0; i<n; i++)
    {
        a[ (int)w[i] ]++;
    }
    bool flag = true;
    for(int i=97; i<123; i++)
    {
        if(a[i]%2){puts("No");flag = false; break;}
    }
    if(flag)puts("Yes");
    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<vector>
#include<string>

using namespace std;

const int N=50001;
vector<string> key;
vector<int> nindent;
vector<string> mapping_item;
int lx;

bool dfs(int ni,int vx){
  while(lx<mapping_item.size()){
    const char *p=mapping_item[lx].c_str();
    if(nindent[lx]==ni){
      char b[N];
      sscanf(p,"%[^:]",b);
      if(key[vx]==b){
	if(vx+1==key.size()){
	  char s[N];
	  if(sscanf(p,"%*[^:]:%*c%[^\n]",s)==1){
	    printf("string \"%s\"\n",s);
	  }else{
	    puts("object");
	  }
	  return true;
	}else if(++lx<nindent.size()&&nindent[lx]>ni){
	  if(dfs(nindent[lx],vx+1))return true;
	}
      }else{
	lx++;
      }
    }else{
      lx++;
    }
  }
  return false;
}

int main(){
  for(char b[N];scanf(".%[^.\n]",b)==1;){
    key.push_back(b);
  }
  getchar();
  int ni;
  for(;;){
    int ni=0;
    int d=getchar();
    if(d==EOF)break;
    for(;d==' ';d=getchar()){
      ni++;
    }
    ungetc(d,stdin);
    char b[N];
    scanf("%[^\n]%*c",b);
    nindent.push_back(ni);
    mapping_item.push_back(b);
  }
  if(!dfs(0,0)){
    puts("no such property");
  }
}

 

Measured memory_bytes: 1192
#include <iostream>
using namespace std;
int n, x;

int main() {
    cin >> n >> x;
    int L[n];
    for (int i=0; i<n; i++){
        cin >> L[i];
    }
    int cnts=1, total=0;
    for (int i=0; i<n; i++) {
        total += L[i];
        if (total > x) break;
        cnts += 1;
    }
    cout << cnts;
    return 0;
}

Measured memory_bytes: 3596
#include<bits/stdc++.h>
#define M 1000000007
#define pb push_back
#define ll long long int
using namespace std;


struct mat
{
	ll a[50][50];
	int n;

	mat()
	{
		memset(a,0,sizeof(a));
	}

	mat operator*(mat &o)
	{
		mat res;
		res.n = n;
		for(int i=0;i<n;i++)
		{
			for(int j=0;j<n;j++)
			{
				res.a[i][j] = 0;
				for(int k = 0;k<n;k++)
				{
					res.a[i][j] += (a[i][k]*o.a[k][j])%M;
					res.a[i][j] %= M;
				}
			}
		}
		return res;
	}
};


mat binexp(mat m, ll k)
{
	mat res;
	for(int i = 0;i<m.n;i++)
		res.a[i][i] = 1;
	res.n = m.n;
	while(k!=0)
	{
		if(k&1)
		{
			res = res*m;
		}
		m = m*m;
		k = (k>>1);
	}
	return res;
}

int main()
{
	int n;
	ll k;
	cin>>n>>k;
	mat m;
	int i,j;
	for(i=0;i<n;i++)
	{
		for(j=0;j<n;j++)
			cin>>m.a[i][j];
	}
	m.n = n;

	mat res = binexp(m,k);

	ll ans = 0;
	for(i=0;i<n;i++)
	{
		for(j=0;j<n;j++)
		{
			ans += res.a[i][j];
			ans %= M;
		}
	}
	cout<<ans;
	return 0;

}


Measured memory_bytes: 3672
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <queue>
int check[100001]={0};
using namespace std;
int main(){
    int n;
    cin>>n;
    int a[n];
    int fircount=0;
    for(int i=0;i<n;i++){
        cin>>a[i];
        if(check[a[i]]==0){
            fircount++;
        }
        check[a[i]]++;
    }
    int k;
    k= n-fircount;
    if((k%2)==0){
        cout<<fircount<<endl;
    }else{
        cout<<fircount-1<<endl;   
    }
    return 0;
}


Measured memory_bytes: 1024
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner scanner = new Scanner(System.in);
    while(true){
    String a = scanner.next();
    if(a.equals("0")) break;
    int sum = 0;
    for(int i = 0; i < a.length(); i++){
      char num = a.charAt(i);
      sum += Integer.parseInt("" + num);
    }
    System.out.println(sum);
    }
  }
}

Measured memory_bytes: 26704
import sys
input = sys.stdin.readline

def main():
    A, B = map(int, input().split())

    ok = False
    for i in range(1, 11000):
        if int(i * 0.08) == A and int(i * 0.1) == B:
            print(i)
            ok = True
            break
    
    if not ok:
        print(-1)

if __name__ == "__main__":
    main()

Measured memory_bytes: 3060
#include <algorithm>
#include <iostream>
#include <stdio.h>
#include <map>
#include <string>
#include <math.h>
#include <vector>
#include <cstdlib>
#include <queue>

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)

using namespace std;

int main()
{
    int N, A, B;
    cin >> N >> A >> B;

    cout << min(N * A, B) << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

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

    double dp[N + 1][N + 1];
    fill(&dp[0][0], &dp[N][N + 1], 0);
    dp[0][0] = 1;
    dp[0][1] = 0;

    double p;
    for (int i = 1; i <= N; i++) {
        cin >> p;
        dp[i][0] = dp[i - 1][0] * (1 - p);
        for (int j = 1; j <= i; j++) {
            dp[i][j] = dp[i - 1][j] * (1 - p) + dp[i - 1][j - 1] * p;
        }
    }

    double ans = 0;

    for (int i = N; i > N - i; i--) {
        ans += dp[N][i];
    }
    
    cout.precision(10);
    cout << ans << endl;
}

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

using namespace std;

long N;

int main(){
	cin >> N;

	int ans;
	for(long long i = 1; i * i <= N; i++){
		if(N % i != 0) continue;

		string str2 = to_string(N / i);
		ans = str2.size();
		//cout << "i = " << i << endl;
		//cout << str2 << endl;
	}
	cout << ans << endl;

	return 0;

}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] str_xy = br.readLine().split(" ");
        long x = Long.parseLong(str_xy[0]);
        long y = Long.parseLong(str_xy[1]);
        int count = 1;
        while (x * 2 <= y) {
            count++;
            x *= 2;
        }
        
        System.out.println(count);
    }
}


Measured memory_bytes: 22612
import sys
sys.setrecursionlimit(10**7) #再帰関数の上限,10**5以上の場合python
import math
from copy import copy, deepcopy
from copy import deepcopy as dcp
from operator import itemgetter
from bisect import bisect_left, bisect, bisect_right#2分探索
#bisect_left(l,x), bisect(l,x)#aはソート済みである必要あり。aの中からx未満の要素数を返す。rightだと以下
from collections import deque
#deque(l), pop(), append(x), popleft(), appendleft(x)
##listでqueの代用をするとO(N)の計算量がかかってしまうので注意
from collections import Counter#文字列を個数カウント辞書に、
#S=Counter(l),S.most_common(x),S.keys(),S.values(),S.items()
from itertools import accumulate,combinations,permutations#累積和
#list(accumulate(l))
from heapq import heapify,heappop,heappush
#heapify(q),heappush(q,a),heappop(q) #q=heapify(q)としないこと、返り値はNone
#import fractions#古いatcoderコンテストの場合GCDなどはここからimportする
from functools import lru_cache#pypyでもうごく
#@lru_cache(maxsize = None)#maxsizeは保存するデータ数の最大値、2**nが最も高効率
from decimal import Decimal

def input(): 
    x=sys.stdin.readline()
    return x[:-1] if x[-1]=="\n" else x
def printl(li): _=print(*li, sep="\n") if li else None
def argsort(s, return_sorted=False): 
    inds=sorted(range(len(s)), key=lambda k: s[k])
    if return_sorted: return inds, [s[i] for i in inds]
    return inds
def alp2num(c,cap=False): return ord(c)-97 if not cap else ord(c)-65
def num2alp(i,cap=False): return chr(i+97) if not cap else chr(i+65)
def matmat(A,B):
    K,N,M=len(B),len(A),len(B[0])
    return [[sum([(A[i][k]*B[k][j]) for k in range(K)]) for j in range(M)] for i in range(N)]
def matvec(M,v):
    N,size=len(v),len(M)
    return [sum([M[i][j]*v[j] for j in range(N)]) for i in range(size)]
def T(M):
    n,m=len(M),len(M[0])
    return [[M[j][i] for j in range(n)] for i in range(m)]
def main():
    mod = 1000000007
    #w.sort(key=itemgetter(1),reversed=True)  #二個目の要素で降順並び替え

    #N = int(input())
    N, K = map(int, input().split())
    #A = tuple(map(int, input().split())) #1行ベクトル
    #L = tuple(int(input()) for i in range(N)) #改行ベクトル
    #S = tuple(tuple(map(int, input().split())) for i in range(N)) #改行行列
    print(math.ceil(N/K))





if __name__ == "__main__":
    main()

Measured memory_bytes: 10056
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>

using namespace std;

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

	int n = s.size();
	int rest_p = 0;
	int win = 0;
	int lose = 0;
	for (int i = 0; i < n; i++) {
		char his = s[i];

		if (his == 'g') {
			if (rest_p > 0) {
				win++;
				rest_p--;
			} else {
				rest_p++;
			}
		} else {
			if (rest_p > 0) {
				rest_p--;
			} else {
				lose++;
				rest_p++;
			}
		}
	}

	cout << win - lose << endl;
	return 0;
}


Measured memory_bytes: 640
#include<iostream>
#include<cstdio>
#include<math.h>
#include<algorithm>

int main(){
    int A,B,C;
    scanf("%d%d%d",&A,&B,&C);
    if(A+B<C)std::cout<<"No";
    else std::cout<<"Yes";
    
    return 0;
}

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

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
using namespace std;
using namespace __gnu_pbds;
 
 
#define all(x) x.begin(), x.end()
#define allr(x) x.rbegin(), x.rend()
#define speedhack() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define form(i, n) for (size_t i = 0; i < size_t(n); ++i)
#define forn(i, n) for (size_t i = 1; i <= size_t(n); ++i)
template<class T> using ordered_set=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
long long mod(long long a, long long b) { return (a%b+b)%b; }
long long gcd(long long x, long long y) { return __gcd(x, y); }
long long lcm(long long x, long long y) { return x * 1ll * y / gcd(x, y); }
 
 
const long long MAXN = 1e9 + 9;
const long long SIZE = 3e5 + 5;
const long long MOD = 1e9 + 7;



int main() { speedhack()

	string s; cin >> s;

	int cnt = 0;
	if (s[0] == 'R') ++cnt;
	if (s[1] == 'R') ++cnt;
	if (s[2] == 'R') {
		if (s[1] == 'R') ++cnt;
		else cnt = 1;
	}	cout << cnt << endl;

	return 0;
}

Measured memory_bytes: 3620
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<set>
#include <stack>
#include <queue>
#include <map>
#include<math.h>
#include<string.h>

using namespace std;
using ll = long long;
using pll = pair<ll,ll>;
using vl = vector<ll>;
using vll = vector<vl>;
using vpll = vector<pll>;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i=((int)(n)-1); i>=0; i--)
#define pb push_back

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;
}

ll MOD = 1e9 + 7;

int main(){
    int n;
    int m;
    vector<int> t(n);
    cin >> n >> m;
    rep(i,n) cin >> t[i];
    ll ans = m;
    rep(i,n-1){
        int a = t[i+1]-t[i];
        ans += min(a,m);
    }
    cout << ans << endl;
}

Measured memory_bytes: 16640
#include <iostream>
#include <cstdio>
#include <cstdlib>
using namespace std;

int main(){
    char num[9],a[5];
    int n,tmp;
    cin >> n;
    for(int j=0;j<n;j++){
        cin >> tmp;
        cout << "Case " << j+1 << ":" << endl;
        for(int i=0;i<10;i++){
            tmp *= tmp;
            sprintf(num,"%08d",tmp);
            for(int i=0;i<4;i++) a[i] = num[i+2];
            tmp = atoi(a);
            cout << tmp << endl;
        }
    }
}

Measured memory_bytes: 1216
#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
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 //y1 j0 j1
#define INF2 4000000000000000037
#define INF 1000000007
#define PI (acos(-1))
#define MOD 1000000007
#define EPS 1e(-9);
using namespace std;
typedef long long ll;



void Main(){

    int H,W,K; cin>>H>>W>>K;

    ll dp1[10][2]={}; //縦棒本数 とりかた tugi入れて良い dame

    dp1[0][0]=1;
    dp1[1][0]=1;
    reps(i,2,10){
        dp1[i][0]=dp1[i-1][0]+dp1[i-1][1];
        dp1[i][1]=dp1[i-1][0];
    }

    ll dpx[10]={};
    rep(i,10){
        dpx[i]=dp1[i][0]+dp1[i][1];
    }

    // 何番目にいるか,いるか、とり方
    ll dp[H+1][W]={};

    dp[0][0]=1;

    rep(i,H){
        rep(j,W){
            // 真っ直ぐ行く
            dp[i+1][j]+=dp[i][j]*dpx[j]*dpx[W-j-1];
            dp[i+1][j]%=MOD;
            // 左に行く
            if(j!=0){
                dp[i+1][j-1]+=dp[i][j]*dpx[j-1]*dpx[W-j-1];
                dp[i+1][j-1]%=MOD;
            }
            // 右に行く
            if(j!=W-1){
                dp[i+1][j+1]+=dp[i][j]*dpx[j]*dpx[W-j-2];
                dp[i+1][j+1]%=MOD;
            }
        }
    }

    cout<< dp[H][K-1] <<"\n";

}

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


Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <climits>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <cassert>
#include <functional>

using namespace std;

#define LOG(...) printf(__VA_ARGS__)
//#define LOG(...)
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define RSORT(c) sort((c).rbegin(),(c).rend())
#define CLR(a) memset((a), 0 ,sizeof(a))

typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

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

struct UnionFind {
	vector<int> v;
	UnionFind(int n) : v(n) { for (int i = 0; i < n; i++) v[i] = i; }
	int  find(int x) { return v[x] == x ? x : v[x] = find(v[x]); }
	void unite(int x, int y) { v[find(x)] = find(y); }
};

int main() {
	string s, t;
	string s1, s2, t1;
	cin >> s >> t;
	REP(i, s.length())
		if (i % 2 == 0)
			s1 += s[i];
		else
			s2 += s[i];
	bool clear1 = true;
	bool clear2 = true;
	int idx = 0;
	REP(i, s1.size()) {
		if (t.find(s1[i],idx) != string::npos) {
			idx = t.find(s1[i], idx)+1;
		}
		else {
			clear1 = false;
			break;
		}
	}
	idx = 0;
	REP(i, s2.size()) {
		if (t.find(s2[i], idx) != string::npos) {
			idx = t.find(s2[i], idx) + 1;
		}
		else {
			clear2 = false;
			break;
		}
	}

	if (clear1 || clear2)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
}

Measured memory_bytes: 3124
S = input()

s01 = int(S[0:2])
s23 = int(S[2:4])

a = False
if 0 <= s01 <= 99:
    if 1 <= s23 <= 12:
        a = True

b = False
if 0 <= s23 <= 99:
    if 1 <= s01 <= 12:
        b = True

if a and b:
    print('AMBIGUOUS')
elif a and not b:
    print('YYMM')
elif not a and b:
    print('MMYY')
else:
    print('NA')


Measured memory_bytes: 3064
#include "bits/stdc++.h"

using namespace std;

typedef long long ll;
typedef pair<int,int> P;
constexpr double EPS = 1e-12;
constexpr int INF = numeric_limits<int>::max()/2;
constexpr int MOD = 1e9+7;

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

    string s;cin>>s;
    if(s[0]=='9' || s[1]=='9') cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}


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

#define int ll
#define FOR(i,n,k) for(int i=n;i<k;i++)
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

const int N = 1e6 + 5;
int dp[N];

int32_t main()
{
    IOS;
    int n,m,sum = 0;
    cin>>n;
    int a[n+1];
    FOR(i,1,n+1) cin>>a[i];
    FOR(i,1,n+1) sum += a[i];
    cin>>m;
    while(m--)
    {
        int p,x,tp;
        cin>>p>>x;
        tp = sum;
        tp -= a[p];
        tp += x;
        cout<<tp<<"\n";
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,k = 0;
  cin >> n;
  cin >> k;
  int m =1;
  for (int i = 0;i<n;i++){
    if(m*2<m+k){
      m*=2;
    }else{
      m+=k;
    }
  }
  cout << m << endl;
}

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

int main(){
    int n;
    cin>>n;
    if(n % 4 == 0){
        cout<<"Yes"<<endl;
        return 0;
    }
    else if(n % 7 == 0){
        cout<<"Yes"<<endl;
        return 0;
    }
    else if(n % 11 == 0){
        cout<<"Yes"<<endl;
        return 0;
    }
    else{
        int temp = n;
        while(temp >= 4){
            temp -= 4;
            if(temp % 7 == 0){
                cout<<"Yes"<<endl;
                return 0;
            }
        }
        while(n >= 7){
            n -= 7;
            if(n % 4 == 0){
                cout<<"Yes"<<endl;
                return 0;
            }
        }
    }

    cout<<"No"<<endl;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
const long long mod=1e9+7;
#define ll long long
using namespace std;
int lim=0;

/*ll power(ll n)
{
    if(n==0) return 0%mod;
    if(n==1) return 1%mod;
    return ((power(n-1)%mod) + (power(n-2)%mod ))%mod;
}
int main()
{
    ll n;cin>>n;
    cout<<power(n%mod)%mod;
}*/
ll pw(ll x,ll n)
{
    ll res=1;
    while(n)
    {
        if(n&1) res=res*x*1ll%mod;
        x=x*x*1ll%mod;
        n/=2;
    }return res;
}
int main()
{
    int n,i,j,s=0,flg=-1;
    scanf("%d",&n);
    int a[n];
    for(i=0;i<n;i++)
        scanf("%d",&a[i]);
    for(i=0;i<n;i++)
    {
        for(j=0;j<n;j++)
        {
            if(j>flg&&i!=j)
            {
                s+=a[i]*a[j];
            }
        }flg++;
    }printf("%d",s);
}
// C++ program to find sum of two large numbers.
/*#include<bits/stdc++.h>
using namespace std;

// Function for finding sum of larger numbers
string findSum(string str1, string str2)
{
    // Before proceeding further, make sure length
    // of str2 is larger.
    if (str1.length() > str2.length())
        swap(str1, str2);

    // Take an empty string for storing result
    string str = "";

    // Calculate length of both string
    int n1 = str1.length(), n2 = str2.length();

    // Reverse both of strings
    reverse(str1.begin(), str1.end());
    reverse(str2.begin(), str2.end());

    int carry = 0;
    for (int i=0; i<n1; i++)
    {
        // Do school mathematics, compute sum of
        // current digits and carry
        int sum = ((str1[i]-'0')+(str2[i]-'0')+carry);
        str.push_back(sum%10 + '0');

        // Calculate carry for next step
        carry = sum/10;
    }

    // Add remaining digits of larger number
    for (int i=n1; i<n2; i++)
    {
        int sum = ((str2[i]-'0')+carry);
        str.push_back(sum%10 + '0');
        carry = sum/10;
    }

    // Add remaining carry
    if (carry)
        str.push_back(carry+'0');

    // reverse resultant string
    reverse(str.begin(), str.end());

    return str;
}

// Driver code
int main()
{
    string str1 ,str2 ;
    cin>>str1>>str2;
    cout << findSum(str1, str2);
    return 0;
}
*/
// CPP program to find (a^b) % MOD where a and
// b may be very large and represented as strings.




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

using namespace std;
int main (){
    string w;
    int count[26]={};
    cin >> w;
    int l=w.size();
    for (int i = 0; i < l; i++){
        count[w[i]-'a']++;
    }
    bool jud=true;
    for (int i = 0; i < 26; i++){
        if(count[i]%2!=0) jud=false;
    }
    if(jud) cout << "Yes\n";
    else    cout << "No\n";
}


Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <queue>
#include <map>
#include <utility>

using namespace std;

#define ll long long

void solve()
{
    ll N;
    cin >> N;
    vector<ll> a(N);
    for (ll i = 0; i < N; i++)
    {
        cin >> a.at(i);
    }

    // i = 1から順に調べる
    vector<ll> box(N, 0);
    vector<ll> b;
    for (ll i = N; i >= 1; i--)
    {
        // 倍数全部調べてボールの数を確認
        ll jballcount = 0;
        for (ll j = 1; j * i <= N; j++)
        {
            jballcount += box.at(j * i - 1);
        }
        // ボール数が条件を満たしてない場合　満たすようにボール入れる
        if (jballcount % 2 != a.at(i - 1))
        {
            box.at(i - 1) = 1;
            b.push_back(i);
        }
    }

    ll M = b.size();
    cout << M << endl;
    if (M != 0)
    {
        cout << b.at(0);
        for (ll xx = 1; xx < M; xx++)
        {
            cout << " " << b.at(xx);
        }
        cout << endl;
    }
    return;
}

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


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

using namespace std;

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

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	string S; cin >> S;

	bool res = false;
	for (int i = 1; i < (int)S.length(); ++i){
		if (S[i-1] == 'A' && S[i] == 'C') res |= true;
	} // end for
	
	cout << (res ? "Yes" : "No") << endl;

	return 0;
}

Measured memory_bytes: 256
a, b = map(int, input().split())

count = 0
for i in range(a, b+1):
    if i//10000 == i%10 and (i%10000)//1000 == (i%100)//10:
        count += 1

print(count)

"""
    print(i//10000)
    print(i%10)
    print((i%10000)//1000)
    print(i%100//10)
"""

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

int main() {
	long long n,m,i,j,k,ans,cur,res,mod=998244353,maxx=0;
	cin >> n;
	vector<int> d(n);
	
	
	for(i=0; i<n; i++){
		cin >> res;
		if(i==0 && res!=0){
			cout << 0; return 0;
		}else if(i!=0 && res==0){
			cout << 0; return 0;
		}
		d[res]++;
		maxx=max(maxx,res);
	}

	i=0;
	if(d[0]!=1){
		cout << 0; return 0;
	}
	for(i=1; i<maxx; i++){
		if(d[i]==0){
			cout << 0; return 0;
		}
	}

	i=1; ans=1;
	while(i<=maxx){
		cur=d[i-1];
		for(j=1; j<d[i]; j++){
			cur=(cur*d[i-1])%mod;
		}
		ans=(ans*cur)%mod;
		i++;
	}
	cout << ans;
}


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

int main(void){
    string s,s1;
    int max = 0;
    cin >> s;
    s1 = s;
    for(int i = 0;i < s.size()-2;i++){
        s1 = s1.substr(0,s1.size()-1);
        if(s1.size() % 2 == 1)continue;
        string t1 = s1.substr(0,s1.size()/2);
        string t2 = s1.substr(s1.size()/2);
        if(t1 == t2){
            max = s1.size();
            break;
        }
    }
    cout << max << endl;
}

Measured memory_bytes: 256
void main() {
  import std.stdio, std.string, std.conv, std.algorithm;

  auto s = readln.chomp.to!(char[]);
  auto n = s.length;
  auto a = new long[](n + 1), c = new long[](n + 1), q = new long[](n + 1);
  foreach (i; 0 .. n) {
    a[i + 1] += a[i];
    c[i + 1] += c[i];
    q[i + 1] += q[i];
    if (s[i] == 'A')
      a[i + 1]++;
    if (s[i] == 'C')
      c[i + 1]++;
    if (s[i] == '?')
      q[i + 1]++;
  }
  long mod = 10 ^^ 9 + 7;
  long powmod(long b, long ex) {
    if (ex == 0)
      return 1L;
    if (ex & 1)
      return b * powmod(b, ex - 1) % mod;
    else
      return powmod(b * b % mod, ex / 2);
  }

  // (A, C), (?, C), (C, ?), (?, ?)
  long tot = 0;
  foreach (i; 0 .. n) {
    if (s[i] == 'B' || s[i] == '?') {
      if (i > 0 && i + 1 < n) {
        (tot += a[i] * (c[n] - c[i + 1]) % mod * powmod(3, q[i] + (q[n] - q[i + 1]))) %= mod;
        if (q[i] > 0) {
          (tot += q[i] * (c[n] - c[i + 1]) % mod * powmod(3, q[i] + (q[n] - q[i + 1]) - 1)) %= mod;
        }
        if (q[n] - q[i + 1] > 0) {
          (tot += a[i] * (q[n] - q[i + 1]) % mod * powmod(3, q[i] + (q[n] - q[i + 1]) - 1)) %= mod;
        }
        if (q[i] > 0 && (q[n] - q[i + 1]) > 0) {
          (tot += q[i] * (q[n] - q[i + 1]) % mod * powmod(3, q[i] + (q[n] - q[i + 1]) - 2)) %= mod;
        }
      }
    }
  }
  writeln(tot);
}

void rd(T...)(ref T x) {
  import std.stdio : readln;
  import std.string : split;
  import std.conv : to;

  auto l = readln.split;
  assert(l.length == x.length);
  foreach (i, ref e; x)
    e = l[i].to!(typeof(e));
}


Measured memory_bytes: 3608
#include <algorithm>
#include <bitset>
#include <cmath>
#include <functional>
#include <iostream>
#include <iterator>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <utility>
#include <unordered_map>
#include <unordered_set>
using namespace std;

#define ABS(a) (((a) >= 0) ? (a) : -(a))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) > (b) ? (b) : (a))
#define FOR(i, a, b) for (int i = (a); i <= (b); ++i)
#define RFOR(i, a, b) for (int i = (a); i >= (b); --i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define NINTH_POWER_OF_TEN 1000000000
#define LL_INF (numeric_limits<long long>::max()/2)
#define int long long

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

const int Alim = 100000;
const int sLim = 10000000000;

int A, B, Q;
int s[Alim+1], t[Alim+1], x[Alim];
int ans;

int st[Alim*2][2];

void Ans(int x) {
  if (x <= st[0][0]) {
    ans = ABS(st[0][0] - x) + st[0][1];
    return;
  }
  int i = 0, j = A+B;
  while (i+1 != j) {
    int k = (i+j) / 2;
    if (st[k][0] <= x) {
      i = k;
    } else {
      j = k;
    }
  }
  if (i == A+B-1) {
    ans = ABS(st[i][0]-x) + st[i][1];
    return;
  } else {
    ans = MIN(ABS(st[i][0]-x)+st[i][1], ABS(st[i+1][0]-x)+st[i+1][1]);
    return;
  }
}

signed main() {
  cin >> A >> B >> Q;
  REP(i, A) { cin >> s[i]; }
  REP(i, B) { cin >> t[i]; }
  REP(i, Q) { cin >> x[i]; }
  s[A] = sLim*3;
  t[B] = sLim*3;

  int i = 0, j = 0;
  while (i < A || j < B) {
    if (s[i] < t[j]) {
      st[i+j][0] = s[i];
      if (j-1 >= 0) {
        st[i+j][1] = MIN(ABS(t[j]-s[i]), ABS(t[j-1]-s[i]));
      } else {
        st[i+j][1] = ABS(t[j]-s[i]);
      }
      ++i;
    } else {
      st[i+j][0] = t[j];
      if (i-1 >= 0) {
        st[i+j][1] = MIN(ABS(s[i]-t[j]), ABS(s[i-1]-t[j]));
      } else {
        st[i+j][1] = ABS(s[i]-t[j]);
      }
      ++j;
    }
  }

  REP(i, Q) {
    Ans(x[i]);
    cout << ans << endl;
  }

  return 0;
}


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

#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define ll long long
using namespace std;



int main() {
  int a, b, k;
  cin >> k >> a >> b;
  int c = a / k;
  int d = b / k;
  
  if (k == 1) {
    cout << "OK" << endl;
    return 0;
  }
  if (a % k == 0) {
    cout << "OK" << endl;
    return 0;
  }
  if (c == d) {
    cout << "NG" << endl;
  }
  else {
    cout << "OK" << endl;
  }
}



Measured memory_bytes: 3596
#include <iostream>
#include <iomanip>
#include<math.h>
#include<list>
#include <algorithm>
#include<set>
#include<vector>
#include<math.h>
#include<map>
#include<string>
#include <numeric>
#include <queue>
#include <sstream>
#include <bitset>
#include<stack>
#include<functional>

using namespace std;
using ll = long long;
using vll = vector<long long>;
using sll = set<long long>;
const long long ll_max = 9223372036854775807;
const long long ll_min = -9223372036854775807;
const int int_max = 2147483647;

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

template<typename T>
map<T, T> getPrimeFactor(T n) {
	map<T, T> ret;
	for (T i = 2; i * i <= n; ++i) {
		while (n % i == 0) {
			ret[i] ++;
			n /= i;
		}
	}
	if (n != 1) ret[n] = 1;
	return ret;
}

template<typename T>
bool IsPrimeNumber(T num)
{
	if (num <= 2) return true;
	else if (num % 2 == 0) return false;

	double sqrtNum = sqrt(num);
	for (int i = 3; i <= sqrtNum; i += 2)
	{
		if (num % i == 0)
		{
			return false;
		}
	}

	return true;
}

long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}



// 繰り返し二乗法
ll pow2(ll n, ll p, ll mod) {
	if (p == 0 || n == 1) {
		return 1;
	}
	else {
		ll ret = pow2(n * n % mod, p / 2, mod);
		if (p % 2 == 1) {
			ret *= n;
		}
		return ret % mod;
	}
}


#define rep(i,s,e) for(ll i=s;i<e;i++)
#define repeq(i,s,e) for(ll i=s;i<=e;i++)


int main() {
	ll P,Q,R;
	cin >> P >> Q >> R;
	cout << min(P + Q, min(Q + R, R + P)) << endl;
	return 0;
}


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

int main() {
  int N, M;
  cin >> N >> M;
  vector<int> a(M);
  vector<int> b(M);
  vector<ll> c(M);
  for (int i = 0; i < M; i++) cin >> a[i] >> b[i] >> c[i], a[i]--, b[i]--;

  ll oo = 0x1000000000000000LL;
  vector<ll> d(N, -oo);
  d[0] = 0LL;
  ll d1, d2;
  for (int i = 0; i < 2 * N; i++) {
    for (int j = 0; j < M; j++) d[b[j]] = max(d[b[j]], d[a[j]] + c[j]);
    if (i == N - 1) d1 = d[N - 1];
    if (i == 2 * N - 1) d2 = d[N - 1];
  }
  if (d1 == d2)
    cout << d1 << endl;
  else
    cout << "inf" << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) \
  for (int i = static_cast<int>(a); i < static_cast<int>(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, ) (__VA_ARGS__)  // NOLINT
using namespace std;
typedef long long int ll;


int main() {
  string s;
  cin >> s;
  cout << s.substr(0, 3) << endl;
  return 0;
}


Measured memory_bytes: 3596
// I SELL YOU...! 
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<chrono>
#include<iomanip>
#include<map>
#include<set>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
void init_io(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(10);
}
signed main(){
  init_io();
  ll n,m,ta,v=0,acc=0,x=0,tmp=0,add=0;
  cin >> n >> m;
  vector<ll> a(n),b(2*m+10,0);
  vector<ll> mp_en[2*m+10];
  map<ll,ll> mp_st;
  for(int i=0;i<n;i++){
    cin >> a[i];
  }
  for(int i=1;i<n;i++){
    ta = a[i];
    if(a[i-1]>ta) ta += m;
    add += ta-a[i-1];
    if(ta-a[i-1]!=1){
      mp_st[a[i-1]+2]++;
      mp_en[ta+1].push_back(ta-a[i-1]-1);
    }
  }
  for(int i=1;i<=2*m;i++){
    acc += mp_st[i];
    for(auto j:mp_en[i]){
      acc--;
      x -= j;
    }
    x += acc;
    b[i] = x;
  }
  for(int i=1;i<=m;i++){
    b[i] += b[i+m];
    tmp = max(tmp,b[i]);
  }
  cout << add - tmp<<endl;
}


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

int mojsh(string s,string t){
  sort(s.begin(),s.end());
  sort(t.begin(),t.end());
  s+='#';
  t+='#';
  int cnt=0;
  int i,j;
  for(i=0;i<s.size()-1;i++){
    if(s[i+1]!=s[i]){
		for(j=0;j<t.size()-1;j++){
			if(t[j+1]!=t[j] && s[i]==t[j]){
				cnt++;
			}
		}
	}
  }
  return cnt;
}

int main(){
  int n,i;
  string s;
  cin>>n;
  cin>>s;
  int ma=0;
  for(i=1;i<n-1;i++){
    ma=max(ma,mojsh(s.substr(0,i),s.substr(i)));
  }
  cout<<ma;
}

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

using namespace std;
const int maxn = 1e6;

int a[maxn],b[maxn];

int cmp(int a,int b)
{
    return a>b;
}
int main()
{
    int n,m,i,j,maxa=0,cnt=0,sum=0;
    cin>>n>>m;
    for(i=0;i<n;i++){
        cin>>a[i]>>b[i];
        if(maxa<a[i]) {
            maxa=a[i];
        }

    }
    sort(b,b+n,cmp);
    for(i=0;b[i]>maxa && i<n && sum < m;i++)
    {
        cnt++;
        sum+=b[i];
    }
    if(sum>=m) cout<<cnt<<endl;
    else {
        while(sum<m){
            cnt++;
            sum+=maxa;
        }
        cout<<cnt<<endl;
    }



}


Measured memory_bytes: 4736
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define fr(i,n) for(i=0;i<n;i++)
#define F first
#define S second
#define fast std::ios_base::sync_with_stdio(false)
#define mod 1000000007
#define pi 3.14159265
int main() {
	fast;
	lli r;
	cin>>r;
	cout<<fixed<<setprecision(6)<<2*pi*r;
	
	return 0;
}

Measured memory_bytes: 3804
#include <cstdio>
using namespace std;


int main()
{
    int n;

    scanf("%d", &n);

    long int A[n], B[n];

    for (int i = 0; i < n; i++) {
        scanf("%ld %ld", &A[i], &B[i]);
    }

    long int counter = 0;
    int temp;

    for (int i = n - 1; i > -1; i--) {
        if ((A[i] + counter) % B[i] == 0) {
            continue;
        } else {
            temp = (A[i] + counter) / B[i];
            temp = (temp + 1) * B[i];
            temp = temp - (A[i] + counter);
            counter += temp;
        }
    }

    printf("%ld\n", counter);
}


Measured memory_bytes: 1664
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <stack>
#include <climits>
#include <map>
#include <set>

using namespace std;

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

const ll mod = 1000000007;
const int inf = 1e9;
const long long INF = 1LL << 60;

int main()
{
    int k,n;
    cin >> k >> n;
    int a[n];
    for(int i = 0; i < n; i++) cin >> a[i];
    int dif = 0;
    for(int i = 0; i < n-1; i++){
        dif = max(dif,a[i+1]-a[i]);
    }
    dif = max(dif,k-a[n-1]+a[0]);
    cout << k - dif;
}

Measured memory_bytes: 1024
card = raw_input().split()
alice = int(card[0])
bob = int(card[1])

if alice == bob:
  print("Draw")
else:
  if alice == 1:
    print("Alice")
  elif bob == 1:
    print("Bob")
  else:
    if bob > alice:
      print("Bob")
    else:
      print("Alice")

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

#define REP(i, count) for(int i = 0; i < (count); i++)
#define REPR(i, first, last) for(int i = (first); i < (last); i++)

int solve(int n){

}


int main(){
	int n; cin >> n;
	int h[100001]; REP(i, n)cin >> h[i];
	ll cost[100001] = {0, abs(h[0]-h[1])};
	REPR(i, 2, n){
		cost[i] = min(cost[i-1] + abs(h[i] - h[i-1]), cost[i-2] + abs(h[i] - h[i-2]));	
	}
	cout << cost[n-1] << endl;
	return 0;
}

Measured memory_bytes: 1408
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
using namespace std;

struct point{
  int t;
  int x;
  int y;
};

bool compare(struct point &p1, struct point &p2){
  int t_diff = abs(p1.t - p2.t);
  int l_diff = abs(p1.x - p2.x) + abs(p1.y - p2.y);
  if(t_diff < l_diff){
    return false;
  }else{
    if(abs(t_diff - l_diff) % 2 == 1){
      return false;
    }
  }
  return true;
}

int main(){
  int N;
  cin>>N;
  vector<struct point> vc;
  for(int i = 0; i<N;i++){
    int t, x, y;
    cin>>t>>x>>y;
    struct point p{t,x,y};
    vc.push_back(p);
  }
  
  struct point start{0,0,0};
  for(auto p : vc){
    if(!compare(start, p)){
      cout<<"No"<<endl;
      return 0;
    }
    start = p;
  }
  cout<<"Yes"<<endl;
  return 0;
}

Measured memory_bytes: 1912
n, k = map(int, input().split())
h = list(map(int, input().split()))

# n個の枠を作成
dp = [float("inf")] * n
# 初期値を0に
dp[0] = 0

#dp[i] =i番目まで来る最安の方法
for i in range(n):
    for j in range(1, min(i, k)+1):  # 上限が負にならないようにmin(i,k)で調整。+1でちゃんとrangeの癖を修正。
        dp[i] = min(dp[i], dp[i - j] + abs(h[i] - h[i - j]))

print(dp[-1])

Measured memory_bytes: 55008
using System;

public class Hello
{
    public static void Main()
    {
        var x = int.Parse(Console.ReadLine().Trim());
        var a1 = x / 500;
        x -= a1 * 500;
        var a2 = x / 5;
        var ans = a1 * 1000 + a2 * 5;
        Console.WriteLine(ans);
    }
}


Measured memory_bytes: 11220
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using static System.Math;
using MethodImplAttribute = System.Runtime.CompilerServices.MethodImplAttribute;
using MethodImplOptions = System.Runtime.CompilerServices.MethodImplOptions;
public static class P
{
    public static void Main()
    {
        var nm = Console.ReadLine().Split().Select(int.Parse).ToArray();

        var n = nm[0];
        var m = nm[1];
        var a = Console.ReadLine().Split().Select(long.Parse).ToArray();
        var gcd = a.Aggregate(GCD);
        var lcm = a.Aggregate(LCM);
        if (lcm / gcd % 2 == 0)
        {
            Console.WriteLine(0);
            return;
        }
        lcm /= 2;
        Console.WriteLine((m / lcm + 1) / 2);
    }

    static long GCD(long a, long b)
    {
        while (true)
        {
            if (b == 0) return a;
            a %= b;
            if (a == 0) return b;
            b %= a;
        }
    }

    static long LCM(long a, long b) 
    {
        var res = a / GCD(a, b) * b;
        if (int.MaxValue < res) return 0;
        return res;
    }
}

Measured memory_bytes: 27484
from bisect import bisect_left as bl, bisect_right as br, insort
import sys
import heapq
# from math import *
from collections import defaultdict as dd, deque
def data(): return input()
def mdata(): return map(float, data().split())
out = sys.stdout.write
# sys.setrecursionlimit(100000)
INF = int(1e9)
mod = int(1e9) + 7

n = int(data())
P = list(mdata())
dp = [0.0] * (n // 2 + 2)
dp[1] = float(1)
for i in range(n):
    p=P[i]
    for j in range(len(dp) - 1, 0, -1):
        dp[j] = dp[j - 1] * (1 - p) + dp[j] * (p)
print(sum(dp))

Measured memory_bytes: 3700
import sys
from heapq import heapify, heappushpop

read = sys.stdin.read
readline = sys.stdin.readline

X, Y, A, B, C = map(int, readline().split())
p = list(map(int, readline().split()))
q = list(map(int, readline().split()))
r = [0] + list(map(int, readline().split()))
p.sort()
q.sort()
r.sort()
heap_p = p[-X:]
heap_q = q[-Y:]
'''
heapify(heap_q)
heapify(heap_p)
while r[-1] > heap_p[0] or r[-1] > heap_q[0]:
    if heap_q[0] < heap_p[0]:
        heappushpop(heap_q, r.pop())
    else:
        heappushpop(heap_p, r.pop())

print(sum(heap_p) + sum(heap_q))
'''
a = heap_p + heap_q + r
a.sort()
print(sum(a[-(X + Y):]))


Measured memory_bytes: 23328
#include "iostream"
#include <vector>
#include <algorithm>
#include <math.h>
using namespace std;

int main(){
    int A, B;
    cin >> A;
    cin >> B;
    vector<int> answers{1, 2, 3};

    for (int i = 0; i < 3; i++) {
        if (answers.at(i) == A || answers.at(i) == B) {
            answers.at(i) = -1;
        }
    }

    int answer = 0;
    for (int i = 0; i < 3; i++){
        if (answers.at(i) != -1) {
            answer = answers.at(i);
        }
    }

    cout << answer <<  endl;
    
    return 0;
}

Measured memory_bytes: 256
while True:
    H, W = [int(i) for i in input().split()]
    if H == W == 0:
        break

    for h in range(H):
        for w in range(W):
            if h == 0 or h == H - 1 or w == 0 or w == W - 1:
                print('#', end='')
            else:
                print('.', end='')

        print()

    print()

Measured memory_bytes: 9028
N=int(input())
W=list(map(int,input().split()))

half=sum(W)//2
left=0
count=0
for i in range(N):
  if left>=half:
    break 
  else:
    left+= W[i]
    count+=1
if count>=2:
  left1=W[:count-1]
  right1=W[count-1:]
  ans1=sum(right1)-sum(left1)
  left2=W[:count]
  right2=W[count:]
  ans2=sum(left2)-sum(right2)
  print(min(ans1,ans2))
else:
  left=W[:1]
  right=w[1:]
  print(sum(left)-sum(right))

Measured memory_bytes: 3064
def main():
    N, M, Q = map(int, input().split())
    ABCD = [list(map(int, input().split())) for i in range(Q)]
    score = 0

    def dfs(l, **kwargs):
        N = kwargs['N']
        M = kwargs['M']
        ABCD = kwargs['ABCD']

        # 末端まで探索したか判定
        if judge_end(l, N=N):
            nonlocal score
            tmp_score = calc_score(l, ABCD=ABCD)
            score = max(tmp_score, score)
            return
        else:
            # 現時点から選べる選択肢の列挙と探索
            nexts = listup_next(l[-1], M=M)
            for x in nexts:
                dfs(l+[x], N=N, M=M, ABCD=ABCD)

    def judge_end(l, **kwargs):
        N = kwargs['N']
        return len(l) == N

    def calc_score(l, **kwargs):
        ABCD = kwargs['ABCD']
        s = 0
        for a, b, c, d in ABCD:
            if l[b-1] - l[a-1] == c:
                s += d
        return s

    def listup_next(now, **kwargs):
        m = now
        M = kwargs['M']
        return range(m, M+1)

    for i in range(1, M+1):
        dfs([i], N=N, M=M, ABCD=ABCD)
    print(score)


if __name__ == "__main__":
    main()


Measured memory_bytes: 9132
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7

from decimal import *

a, b, c = MAP()

if c - a - b > 0 and (c - a - b) ** 2 > 4 * a * b:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 5196
#define _USE_MATH_DEFINES
#define INF 0x3f3f3f3f
#include <cstdio>
#include <iostream>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>
#include <cctype>
#include <utility>
 
using namespace std;
 
typedef long long ll;
typedef pair <int,int> P;
typedef pair <int,P > PP;
 
const static int tx[] = {0,1,0,-1};
const static int ty[] = {-1,0,1,0};

const static double EPS = 1e-8;

int main(){
  int prev;
  int next;
  int sum;
  while(~scanf("%d %d %d",&prev,&next,&sum)){
    if(prev == 0 && next == 0 && sum == 0) break;

    int res = 0;
    for(int orig_x = 1; orig_x <= sum; orig_x++){
      for(int orig_y = sum - orig_x; orig_y >= 1; orig_y--){
        int x = orig_x * (100 + prev) / 100;
        int y = orig_y * (100 + prev) / 100;
        if(x + y != sum) continue;

        int next_x = orig_x * (100 + next) / 100;
        int next_y = orig_y * (100 + next) / 100;
        res = max(next_x + next_y,res);
      }
    }
    printf("%d\n",res);
  }
}

Measured memory_bytes: 1188