akhauriyash/Code-Regression huggingface dataset:
#ifdef DEBUG_IS_VALID
#define DEB 1 
#define _LIBCPP_DEBUG 0
#else
#define DEB 0
#define NDEBUG
#endif

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

#define ALL(g) (g).begin(),(g).end()
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i, x, n) for(int i = x; i >= n; i--)
#define rrep(i, n) RREP(i,n,0)
#define pb push_back
#pragma GCC optimize ("-O3")

using namespace std;

#define DUMPOUT cout
#define dump(...) if(DEB) DUMPOUT<<"  "<<#__VA_ARGS__<<" :["<<__LINE__<<":"<<__FUNCTION__<<"]"<<endl<<"    "; if(DEB) dump_func(__VA_ARGS__)
template<typename T1,typename T2>ostream& operator << (ostream& os, pair<T1,T2> p){cout << "(" << p.first << ", " << p.second << ")"; return os;}
template<typename T>ostream& operator << (ostream& os, vector<T>& vec) { os << "{"; for (int i = 0; i<vec.size(); i++) os << vec[i] << (i + 1 == vec.size() ? "" : ", "); os << "}"; return os; }
template<typename T>ostream& operator << (ostream& os, set<T>& st){cout << "{"; for(auto itr = st.begin(); itr != st.end(); itr++) cout << *itr << (next(itr)!=st.end() ? ", " : ""); cout << "}"; return os;}
template<typename T1,typename T2>ostream& operator << (ostream& os, map<T1,T2> mp){cout << "{"; for(auto itr = mp.begin(); itr != mp.end(); itr++) cout << "(" << (itr->first) << ", " << (itr->second) << ")" << (next(itr)!=mp.end() ? "," : ""); cout << "}"; return os; }

void dump_func(){DUMPOUT << endl;}
template <class Head, class... Tail>void dump_func(Head&& head, Tail&&... tail){ DUMPOUT << head; if (sizeof...(Tail) == 0) { DUMPOUT << " "; } else { DUMPOUT << ", "; } dump_func(std::move(tail)...);}
template<class T> inline bool chmax(T& a,T const& b){if(a>=b) return false; a=b; return true;}
template<class T> inline bool chmin(T& a,T const& b){if(a<=b) return false; a=b; return true;}

using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using vp = vector<Pl>;
using vvp = vector<vp>;

const int INF = 1<<29;
const long long LINF=1LL<<59;


void solve(long long H, long long W, std::vector<std::string> S){
  vvl w1(H,vl(W)),w2(H,vl(W)),h1(H,vl(W)),h2(H,vl(W));
  rep(i,H){
    ll cnt = -1;
    rep(j,W){
      if(S[i][j]=='#') cnt = -1;
      else cnt++;
      w1[i][j] = cnt;
    }
  }
  rep(j,W){
    ll cnt = -1;
    rep(i,H){
      if(S[i][j]=='#') cnt = -1;
      else cnt++;
      h1[i][j] = cnt;
    }
  }
  rep(i,H){
    ll cnt = -1;
    rrep(j,W-1){
      if(S[i][j]=='#') cnt = -1;
      else cnt++;
      w2[i][j] = cnt;
    }
  }
  rep(j,W){
    ll cnt = -1;
    rrep(i,H-1){
      if(S[i][j]=='#') cnt = -1;
      else cnt++;
      h2[i][j] = cnt;
    }
  }
  ll ans = 0;
  rep(i,H) rep(j,W ){
    if(S[i][j]=='#') continue;
    chmax(ans,w1[i][j]+w2[i][j]+h1[i][j]+h2[i][j]+1);
  }
  dump(w1);
  dump(w2);
  dump(h1);
  dump(h2);
  cout << ans << endl;
}

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


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

#define debug(...) fprintf(stderr, __VA_ARGS__)

#ifndef AT_HOME
#define getchar() IO::myGetchar()
#define putchar(x) IO::myPutchar(x)
#endif

namespace IO {
	static const int IN_BUF = 1 << 23, OUT_BUF = 1 << 23;

	inline char myGetchar() {
		static char buf[IN_BUF], *ps = buf, *pt = buf;
		if (ps == pt) {
			ps = buf, pt = buf + fread(buf, 1, IN_BUF, stdin);
		}
		return ps == pt ? EOF : *ps++;
	}

	template<typename T>
	inline bool read(T &x) {
		bool op = 0;
		char ch = getchar();
		x = 0;
		for (; !isdigit(ch) && ch != EOF; ch = getchar()) {
			op ^= (ch == '-');
		}
		if (ch == EOF) {
			return false;
		}
		for (; isdigit(ch); ch = getchar()) {
			x = x * 10 + (ch ^ '0');
		}
		if (op) {
			x = -x;
		}
		return true;
	}

	inline int readStr(char *s) {
		int n = 0;
		char ch = getchar();
		for (; isspace(ch) && ch != EOF; ch = getchar())
			;
		for (; !isspace(ch) && ch != EOF; ch = getchar()) {
			s[n++] = ch;
		}
		s[n] = '\0';
		return n;
	}

	inline void myPutchar(char x) {
		static char pbuf[OUT_BUF], *pp = pbuf;
		struct _flusher {
			~_flusher() {
				fwrite(pbuf, 1, pp - pbuf, stdout);
			}
		};
		static _flusher outputFlusher;
		if (pp == pbuf + OUT_BUF) {
			fwrite(pbuf, 1, OUT_BUF, stdout);
			pp = pbuf;
		}
		*pp++ = x;
	}

	template<typename T>
	inline void print_(T x) {
		if (x == 0) {
			putchar('0');
			return;
		}
		static int num[40];
		if (x < 0) {
			putchar('-');
			x = -x;
		}
		for (*num = 0; x; x /= 10) {
			num[++*num] = x % 10;
		}
		while (*num){
			putchar(num[*num] ^ '0');
			--*num;
		}
	}

	template<typename T>
	inline void print(T x, char ch = '\n') {
		print_(x);
		putchar(ch);
	}

	inline void printStr_(const char *s, int n = -1) {
		if (n == -1) {
			n = strlen(s);
		}
		for (int i = 0; i < n; ++i) {
			putchar(s[i]);
		}
	}

	inline void printStr(const char *s, int n = -1, char ch = '\n') {
		printStr_(s, n);
		putchar(ch);
	}
}
using namespace IO;

const int N = 18, INF = 0x3f3f3f3f;

int n, a[N], b[N], s[N];

int getv(int x, int k) {
	return (x & 1) == k ? a[x] : b[x];
}

int main() {
	read(n);
	for (int i = 0; i < n; ++i) {
		read(a[i]);
	}
	for (int i = 0; i < n; ++i) {
		read(b[i]);
	}
	int ans = INF;
	for (int S = 0; S < (1 << n); ++S) {
		std::vector<int> p[2];
		for (int i = 0; i < n; ++i) {
			p[S >> i & 1].push_back(i);
		}
		if ((int)p[1].size() != n / 2) {
			continue;
		}
		std::stable_sort(p[0].begin(), p[0].end(), [&](int x, int y) {
			return getv(x, 0) < getv(y, 0);
		});
		std::stable_sort(p[1].begin(), p[1].end(), [&](int x, int y) {
			return getv(x, 1) < getv(y, 1);
		});
		bool flag = 1;
		for (int i = 0; i < n; ++i) {
			s[i] = p[i & 1][i >> 1];
			if (i && getv(s[i], i & 1) < getv(s[i - 1], (i - 1) & 1)) {
				flag = 0;
				break;
			}
		}
		if (!flag) {
			continue;
		}
		int sum = 0;
		for (int i = 0; i < n; ++i) {
			for (int j = i + 1; j < n; ++j) {
				sum += s[i] > s[j];
			}
		}
		ans = std::min(ans, sum);
	}
	if (ans == INF) {
		print(-1);
	} else {
		print(ans);
	}
}


Measured memory_bytes: 3624
# -*- coding: utf-8 -*-

# 標準入力
N = int(input())

# 単語を入れる配列
words = []

flag = 0

for i in range(0, N):
    # 単語の標準入力
    tmp = input()
    words.append(tmp)
    if(i != 0):
        if(tmp2[-1] != tmp[0]):
            flag = 1
    tmp2 = tmp
    for j in range(0, i):
        if(words[j] == words[i]):
            flag = 1

if(flag == 1):
    print("No")
else:
    print("Yes")


Measured memory_bytes: 3060
#include<stdio.h>
#define BUFSIZE 10000
int main(void){
	int reminder[BUFSIZE]={0};
	long a,b;
	int i;
	int m=0;
    scanf("%d %d",&a,&b);
    for(i=1;i<=a;i++){
		if(a%i==0){
			reminder[m]=i;
							
			m++;
		}
	}
	int n=0;
	int N_reminder[BUFSIZE]={0};
		for(int m=0;m<BUFSIZE;m++){
		    if(reminder[m]==0){
				break;
			}    
				if(b%reminder[m]==0){
					N_reminder[n]=reminder[m];
					n++;
				}
		}
long gcd;		
for(int j=0;j<BUFSIZE;j++){
	if(N_reminder[j]==0){
		gcd=N_reminder[j-1];
		break;
	}
}

printf("%ld",a/gcd*b/gcd*gcd);			
		
			

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,m,n) for(int i=m; i<n; i++)
#define co(n) cout << n << endl
using namespace std;
int main(){
  int a[3];
  rep(i,0,3) cin >> a[i];
  sort(a, a+3);
  co(10*a[2]+a[1]+a[0]);
  
  return 0;
}


Measured memory_bytes: 256
import math
n,m = map(int,input().split())

list1 = list(map(int,input().split()))
list1.sort()
list1.reverse()
i = 0
s = math.floor(list1[0]/2)
 
if n == 1:
    print(math.floor(list1[0]/(2**m)))
    exit()
 
while True:
    while True:
        if i+1 > n:
            break
        if list1[i] < s or m == 0:
            break
        list1[i] = math.floor(list1[i]/2)
        m -= 1
        i += 1
    if m == 0:
        break
    list1.sort()
    list1.reverse()
    s = math.floor(list1[0]/2)
    i = 0
print(sum(list1))

Measured memory_bytes: 15020
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>
 
using namespace std;
 
#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define MOD 1000000007
#define rep(i,n) for(i=0;i<n;i++)
#define loop(i,a,n) for(i=a;i<n;i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
 
typedef vector<int> vi;
typedef pair<int,int> pii;
 
int main(void) {
  int i,j,k;
  int n,m;
  while(1){
    cin>>n>>m;
    if(n==0&&m==0)break;
    int tmp=8000000;
    vector<bool> prime(tmp);
    int t=0;
    for(i=n;i<tmp;i++)
      if(prime[i]==0){
    t++;
    if(t==m+1)break;
    for(j=1;i*j<tmp;j++)
      prime[i*j]=true;
      }
    cout<<i<<endl;
  }
}

Measured memory_bytes: 3944
n = int(input())
m = int(input())
K = [[10**9 for one in range(32)] for two in range(32)]
for three in range(m):
    a,b,c,d = map(int,input().split(","))
    K[a][b] = c
    K[b][a] = d

for k in range(1,n+1):
    for j in range(1,n+1):
        for i in range(1,n+1):
            if K[i][j] > K[i][k] + K[k][j]:
                K[i][j] = K[i][k] + K[k][j]

s,g,V,P = map(int,input().split(","))
print(V-P-K[s][g]-K[g][s])


Measured memory_bytes: 5604
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stdio.h>
#include <map>
#include <set>
#include <utility>
#include <queue>
#include <bitset>
#include <math.h>
#include <numeric>
#include <stack>

using namespace std;
 
#define rep(i,m,n) for(int i=m;i<(int)(n);i++)
#define endl '\n'
typedef long long ll;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n; cin >> n;
    map<string,ll> mp;
    rep(i,0,n){
        string s; cin >> s;
        sort(s.begin(),s.end());
        mp[s]++;
    }
    ll res=0;
    for(auto v:mp){
        if(v.second>1){
            res+=v.second*(v.second-1)/2;
        }
    }
    cout<<res<<endl;
}


Measured memory_bytes: 11264
#include<iostream>
#include<math.h>
#include<algorithm>
#include<utility>
#include<queue>
#include<string.h>
#include<string>
#include<set>
#include<map>
#include<unordered_map>
#include<stack>
#include<vector>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll INF=2e18;
string S;
ll N,M;
P ba[100010];
priority_queue<ll> pq[100010];
priority_queue<ll> smallPQ;
int main(){
    cin>>N>>M;
    for(ll i=0;i<N;i++){
        ll a,b;
        cin>>a>>b;
        pq[a].push(b);
    }
    ll ans=0;
    for(ll i=1;i<=M;i++){
        ll now=0;
        if(!pq[i].empty()){
            if(smallPQ.empty() || pq[i].top()>smallPQ.top()){
                now=pq[i].top();pq[i].pop();
            }else{
                now=smallPQ.top();smallPQ.pop();
            }
            while(!pq[i].empty()){
                smallPQ.push(pq[i].top());
                pq[i].pop();
            }
        }else{
            if(smallPQ.empty())continue;
            now+=smallPQ.top();smallPQ.pop();
        }
        ans+=now;
    }
    cout<<ans;

    return 0;
}

Measured memory_bytes: 7424
N, X = map(int, input().split())

m_list = []
total = 0

for i in range(N):
    m_list.append(int(input()))

for i in range(N):
    total += m_list[i]

rest = X - total

min = 1000

for i in range(N):
    if min > m_list[i]:
        min = m_list[i]

min_num = rest // min

print(N + min_num)


Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <cstring>
#include <fstream>
#include <random>
#include <cmath>
#include <iomanip>
#include <climits>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <map>
#include <deque>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <list>
#include <unordered_map>
#include <bitset>
#include <sstream>

typedef  long long ll;
#define mop 1000000007
using namespace std;


int main() {
    
    ll a,b,m;
    cin >> a >> b >> m;
    vector <ll> alis, blis, mlis;
    for (ll i=0;i<a;i++){
        ll tmp;
        cin >> tmp;
        alis.push_back(tmp);
    }
    for (ll i=0;i<b;i++){
        ll tmp;
        cin >> tmp;
        blis.push_back(tmp);
    }
    for(ll i=0;i<m;i++){
        ll x,y,c;
        cin >> x >> y >> c;
        ll tmp;
        tmp = alis[x-1] + blis[y-1] - c;
        mlis.push_back(tmp);
    }
    sort(alis.begin(), alis.end());
    sort(blis.begin(), blis.end());
    mlis.push_back(alis[0] + blis[0]);
    sort(mlis.begin(), mlis.end());
    cout << mlis[0] << endl;
}

Measured memory_bytes: 3316
//参考：http://ehafib.hatenablog.com/entry/2015/12/23/164517
//インクルード
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//イテレータあるけど順序保持しないmap
#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列

using namespace std;
typedef long long ll;

//マクロ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(b);i--)
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))
#define INF 1000000000000
#define MOD 10000007
#define PB push_back
#define MP make_pair
#define F first
#define S second

signed main(){
  int N, X, Y;
  cin >> N >> X >> Y;

  ll dmin[N + 1][N + 1];
  for(int i = 1; i < N; i++){
    for(int j = 1; j < N + 1; j++){
      dmin[i][j] = INF;
    }
  }

  queue<int> que;

  for(int i = 1; i < N; i++){
    dmin[i][i] = 0;
    que.push(i);
    while(que.size()){
      int now = que.front(); que.pop();
      if(now + 1 <= N && dmin[i][now + 1] == INF) {
        que.push(now + 1);
        dmin[i][now + 1] = dmin[i][now] + 1;
      }
      if(now - 1 > 0 && dmin[i][now - 1] == INF) {
        que.push(now - 1);
        dmin[i][now - 1] = dmin[i][now] + 1;
      }
      if(now == X && dmin[i][Y] == INF) {
        que.push(Y);
        dmin[i][Y] = dmin[i][now] + 1;
      }
      if(now == Y && dmin[i][X] == INF) {
        que.push(X);
        dmin[i][X] = dmin[i][now] + 1;
      }
    }
  }

  int ans[N] = {};

  for(int i = 1; i < N; i++){
    for(int j = i; j < N + 1; j++){
      ans[dmin[i][j]]++;
    }
  }

  for(int k = 1; k < N; k++){
    cout << ans[k] << endl;
  }

  return 0;
}


Measured memory_bytes: 31488
#!/usr/bin/env python3
#%% for atcoder uniittest use
import sys
input= lambda: sys.stdin.readline().rstrip()
def pin(type=int):return map(type,input().split())
def tupin(t=int):return tuple(pin(t))
def lispin(t=int):return list(pin(t))
#%%code
def resolve():
    T=(input())
    S=list()
    for t in T:
        if t=="?":
            S.append("D")
        else:S.append(t)

    print("".join(S))
#%%submit!
resolve()

Measured memory_bytes: 90772
package main

import (
        "bufio"
        "fmt"
        "os"
        "sort"
        "strconv"
        "strings"
)

////////////////////////////////////////
///        templates                 ///
////////////////////////////////////////

var sc = bufio.NewScanner(os.Stdin)

func nextLine() string {
        sc.Scan()
        return sc.Text()
}

var rdr = bufio.NewReaderSize(os.Stdin, 1000000)

func readBigLine() string {
        buf := make([]byte, 0, 1000000)
        for {
                l, p, e := rdr.ReadLine()
                if e != nil {
                        panic(e)
                }
                buf = append(buf, l...)
                if !p {
                        break
                }
        }
        return string(buf)
}

func strSprit(str string) []string {
        cols := strings.Split(str, " ")
        return cols
}

func parseInt(str string) int {
        n, _ := strconv.Atoi(str)
        return n
}

func intSprit(str string) []int {
        strs := strSprit(str)
        cols := make([]int, len(strs))
        for i, v := range strs {
                cols[i] = parseInt(v)
        }
        return cols
}

func bitCount(n uint) int {

        x := uint64(n)

        const m = 1<<64 - 1
        const m0 = 0x5555555555555555
        const m1 = 0x3333333333333333
        const m2 = 0x0f0f0f0f0f0f0f0f

        x = x>>1&(m0&m) + x&(m0&m)
        x = x>>2&(m1&m) + x&(m1&m)
        x = (x>>4 + x) & (m2 & m)
        x += x >> 8
        x += x >> 16
        x += x >> 32

        return int(x) & (1<<7 - 1)
}

func bitExist(n, i int) bool {
        return ((n >> uint(i)) & 1) == 1
}

////////////////////////////////////////
///        end templates             ///
////////////////////////////////////////

func main() {
        line := readBigLine()

        spl := strSprit(line)
        N := parseInt(spl[0])
        M := parseInt(spl[1])

        l := readBigLine()
        x := intSprit(l)

        sort.Ints(x)

        diff := make([]int, M)

        sum := 0
        for i := 0; i < M-1; i++ {
                diff[i] = x[i+1] - x[i]
                sum += diff[i]
        }
        sort.Ints(diff)

        n := N - 1
        for n > 0 {
                n--
                if len(diff) <= 0 {
                        break
                }
                sum -= diff[len(diff)-1]
                diff = diff[:len(diff)-1]
        }

        fmt.Println(sum)

}

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

int p[200010];

int main() {
	int n; cin >> n;
	for (int i = 0; i < n; i ++) {
		int t; cin >> t;
		p[t] = i;
	}
	int ans = 1, cur = 1;
	for (int i = 2; i <= n; i ++) {
		if (p[i] > p[i-1]) cur ++;
		else cur = 1;
		ans = max(ans, cur); 
	} 
	cout << n - ans << endl;
	return 0;
} 

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

int main(void){
	int a,b,c;
	
	while(cin>>a>>b>>c){
		bool flg[11];
		fill(flg,flg+11,false);
		flg[a] = flg[b] = flg[c] = true;
		
		int sum = a + b;
		int count = 0;
		
		for(int i=1;i<11;i++){
			if(!flg[i] && sum + i <= 20){
				count++;
			}
		}

		if(count >= 4){
			cout<<"YES\n";
		}
		else{
			cout<<"NO\n";
		}
	}

	return 0;
}

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

int main(){
    int p,n;
    char c;
    int m=0,sum=0,ave=0;
    while(cin>>p>>c>>n){
        m++;
        ave+=n;
        sum+=p*n;
    }
    ave=1.*ave/m+.5;
    cout<<sum<<endl
        <<ave<<endl;
}

Measured memory_bytes: 1156
def solve(a , L , ans,a_n):
    lis = str(a)
    lis = list(lis)
    for i in range(L - len(lis)):
        lis.append('0')

    lis.sort()
    a_ = 0
    dig = 1
    for i in lis:
        a_ += int(i) * dig
        #print(type(i))
        dig *= 10

    dig = 1
    for i in reversed(lis):
        a_ -= int(i) * dig
        dig *= 10

    #print(a_ ,a)    
    for i in range(len(a_n)):
        if a_ == a_n[i]:
            print(i ,a_ ,ans - i)
            return
    a_n.append(a_)
    solve(a_ ,L ,ans+1,a_n)


while True:
    lis = input().split(' ')
    if lis[1] == '0':
        break
    a_n = [int(lis[0])]
    solve(int(lis[0]),int(lis[1]),1,a_n)



Measured memory_bytes: 5604
def solve(string):
    n, *fp = string.split()
    n = int(n)
    f = fp[:10 * n]
    p = list(map(int, fp[10 * n:]))
    int_f = [int("".join(f[10 * i:10 * (i + 1)]), 2) for i in range(n)]
    return str(
        max(
            sum([p[11 * i + bin(o & _f).count("1")]
                 for i, _f in enumerate(int_f)])
            for o in range(1, 2**10)))


if __name__ == '__main__':
    n = int(input())
    print(solve('{}\n'.format(n) + '\n'.join([input() for _ in range(2 * n)])))


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

int main() {
  string a, b;
  cin >> a >> b;
  if (a.size() > b.size()) {
    cout << "GREATER" << endl;
  }else if (a.size() < b.size()) {
    cout << "LESS" << endl;
  }else{
    rep (i, a.size()) {
      if (a[i] - b[i] > 0) {
        cout << "GREATER" << endl;
        break;
      }else if (a[i] - b[i]) {
        cout << "LESS" << endl;
        break;
      }
      if (i == a.size() - 1) cout << "EQUAL" << endl;
    }
  }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < (ll)(n); i++)
#define FOR(i, a, b) for(ll i = a; i < (ll)(b); i++)

#define ALL(x) (x).begin(), (x).end()
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))

using namespace std;
using ll = long long;
using vel = vector<ll>;
using ves = vector<string>;
using veb = vector<bool>;

using qul = queue<ll>;

int main() {
    ll X,Y;
    cin >> X >> Y;
    if(X*2 <= Y && X*4 >= Y && Y%2 ==0){
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 3596
#include <iostream>
using namespace std;
int main() {
    int n; cin >> n;
    int ans = 0;
    for (int i = 1; i <= n; i += 2) {
        int cnt = 0;
        for (int j = 1; j <= n; j++) if (i % j == 0) cnt++;
        if (cnt == 8) ans++;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>
#define int long long
#define mod 1000000007
#define for0(i, n) for(int i = 0; i < (n); i++)
#define for1(i, n) for(int i = 1; i <= (n);i++)
#define mp make_pair
using namespace std;
signed main() {
	int a, b; cin >> a >> b; cout << 6 - a - b << endl;
}

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

int fn(int n) {
  if (n % 2 == 0) return n / 2;
  return 3 * n + 1;
}

int main() {
  bool flag = false;
  int s, i, j, count = 0;
  cin >> s;
  vector<int> line = {s};
  while (count != 2) {
    s = fn(s);
    if (s == 1) count++;
    line.push_back(s);
  }
  count = 0;
  for (i = 0; i < line.size(); i++) {
    for (j = i + 1; j < line.size(); j++) {
      if (line[i] == line[j]) {
        flag = true;
        break;
      }
    }
    if (flag) break;
    count++;
  }
  cout << j + 1 << endl;
  return 0;
}

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

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

    while(true){
        int n, m;
        cin >> n >> m;
        if(n == 0 and m == 0) break;

        int E[m][m], F[m][m];
        for(int i = 0; i < m; i++){
            for(int j = 0; j < m; j++){
                E[i][j] = (i == j ? 0 : 1e9);
                F[i][j] = (i == j ? 0 : 1e9);
            }
        }

        for(int i = 0; i < n; i++){
            int a, b, c1, c2;
            cin >> a >> b >> c1 >> c2;
            a--; b--;
            E[a][b] = c1;
            E[b][a] = c1;
            F[a][b] = c2;
            F[b][a] = c2;
        }

        for(int i = 0; i < m; i++){
            for(int j = 0; j < m; j++){
                for(int k = 0; k < m; k++){
                    E[j][k] = min(E[j][k], E[j][i] + E[i][k]);
                    F[j][k] = min(F[j][k], F[j][i] + F[i][k]);
                }
            }
        }

        int k;
        cin >> k;
        for(int i = 0; i < k; i++){
            int p, q, r;
            cin >> p >> q >> r;
            p--; q--;
            if(r == 0){
                cout << E[p][q] << endl;
            }else{
                cout << F[p][q] << endl;
            }
        }
    }

    return 0;
}


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

#define _GLIBCXX_DEBUG
#define all(v) (v).begin(),(v).end()

using namespace std;

using ll=long long;
using pii=pair<int, int>;
using vi=vector<int>;
using vii=vector<vector<int>>;

const ll LINF=1LL<<60;
const int INF=1<<29;
const ll MOD=1e9+7;

int main(){
    int A, B; cin >> A >> B;
    if(A <= 9 && B <= 9) cout << A*B << endl;
    else cout <<-1 << endl;
    return 0;
}

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

int main()
{
    uint16_t a = 0, b = 0;

    std::cin >> a >> b;
    std::string s = ((a * b) % 2 == 0) ? "Even" : "Odd";
    std::cout << s << std::endl;

    return 0;
}

Measured memory_bytes: 256
/**                                                     **\
 *    created by:   Divianshu Bansal                     *
 *    e-mail id:    god_coder@icloud.com                 *
*                                                        */

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <functional>


using namespace std;
using namespace __gnu_pbds;


typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>new_data_set;
#define MOD 1000000007
#define int long long
#define BIG 998244353
#define pf push_front
#define print(x) for(auto el: x) cout<<el<<" ";cout<<endl
#define bits(x) __builtin_popcount(x)
#define ff first
#define se second
#define pb push_back
#define pii pair<int,int>
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define PSET(x,y) fixed<<setprecision(y)<<x
#define mp make_pair
#define pi 3.141592653589


int power(int x, int y) {
    int r = 1, z = x;
    while (y) {
        if (y & 1)r *= z;
        z *= z; y = y >> 1;
    }
    return r;
}
int powerm(int x, int y, int p) {
    int r = 1;
    while (y) {
        if (y & 1)r = (r * x) % p;
        y = y >> 1;
        x = (x * x) % p;
    }
    return r % p;
}
int modinv(int x, int m) {
    return powerm(x, m - 2, m);
}
int logarithm(int a, int b) {
    int x = 0;
    while (a > 1) {
        x++;
        a /= b;
    }
    return x;
}
int max3(int a, int b, int c) {
    return max(a, max(b, c));
}
int min3(int a, int b, int c) {
    return min(a, min(b, c));
}
bool poss(int a, int b, int c) {
    int sum = a + b + c;
    if (sum % 2 == 1) {
        return false;
    }
    sum /= 2;
    int i = sum - a;
    int j = sum - b;
    int k = sum - c;
    if (min3(i, j, k) <= 0) {
        return false;
    }
    return true;
}
int32_t main() {
    fast;
    int n;
    cin >> n;
    for (int i = 1; i <= n; ++i) {
        int ans = 0;
        int val = 0;
        for (int j = 2; j <= 150; ++j) {
            if ((j * j) > 2 * i) {
                break;
            }
            for (int k = j; k <= 150; ++k) {
                if (j * j + k * k > 2 * i) {
                    break;
                }
                int sum = j * j + k * k;
                val = (2 * i) - sum;
                int f = sqrt(val);
                if (f * f != val) {
                    continue;
                }
                if (f < k) {
                    continue;
                }
                if (!poss(j, k, f)) {
                    continue;
                }
                set<int> s;
                s.insert(j);
                s.insert(k);
                s.insert(f);
                if (s.size() == 1) {
                    ans++;
                }
                else if (s.size() == 2) {
                    ans += 3;
                }
                else {
                    ans += 6;
                }
            }
        }
        cout << ans << '\n';
    }
    return 0;
}

Measured memory_bytes: 3544
from fractions import gcd

def lcm(a,b):
    return a*(b//gcd(a,b))

mod=10**9+7

n=int(input())
A=list(map(int,input().split()))

L=A[0]
for i in range(1,n):
    L=lcm(L,A[i])
ans=0
for i in range(n):
    ans+=(L*pow(A[i],mod-2,mod))%mod
print(ans%mod)

Measured memory_bytes: 6112
N, K = gets.split.map(&:to_i)

MOD = 10 ** 9 + 7
def comb_mod(a, b)
  return 0 if a < b
  return comb_mod(a, a - b) if b > a - b
  mul = div = 1
  b.times do |i|
    mul *= a - i
    div *= i + 1
    mul %= MOD
    div %= MOD
  end
  mul * pow_mod(div, MOD - 2) % MOD
end

def pow_mod(a, pow)
  if pow == 0
    1
  elsif pow.odd?
    a * pow_mod(a, pow - 1) % MOD
  else
    half = pow_mod(a, pow / 2)
    half * half % MOD
  end
end

1.upto(K) do |i|
  puts (comb_mod(N - K + 1, i) * comb_mod(K - 1, i - 1)) % MOD
end


Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define all(t) t.begin(), t.end()
#define inrange(i, a, b) (((i)>= min((a), (b))) && ((i) <= max((a), (b))))
typedef vector<ll> vi;
#define fi first
#define se second
const ll inf = 9e18;
const ll mod = 1e9 + 7;

void print(ll a[], ll n){for(ll i=0;i<n;i++){cout<<a[i]<<" ";}cout<<"\n";}
ll power(ll x, ll y, ll M = inf){
    ll ans = 1;
    x %= M;
    while(y){
        if(y&1)
            ans = (x * ans) % M;

        x = (x * x) % M;
        y >>= 1;
    }
    return ans;
}
ll modInverse(ll n) {return power(n, mod-2, mod);}
inline ll mul(ll a, ll b){ return (a * b) % mod; }
inline ll sub(ll a, ll b){ ll c = a - b; if(c < 0) c += mod; return c; }
inline ll add(ll a, ll b){ ll c = a + b; if(c > mod) c -= mod; return c; }
inline ll divi(ll a, ll b){ return mul(a, modInverse(b)); }

ll dp[3005][3005];
ll a[3005];

ll f(int i, int j, ll sum){
	
	if(i==j-1){
		dp[i][j] = max(a[i], a[j]);
		return dp[i][j];
	}
	if(dp[i][j] == -1)
		dp[i][j] = max(sum-f(i+1, j, sum-a[i]), sum-f(i, j-1, sum-a[j]));
	return dp[i][j];
}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);

	ll n;
	cin>>n;
	ll sum = 0;
	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
			dp[i][j] = -1;
		}
	}
	for(int i=0;i<n;i++){
		cin>>a[i];
		sum+=a[i];
	}
	cout<<2*f(0, n-1, sum) - sum;
	return 0;
}




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

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

  vector<int> weight(N), value(N);
  rep(i, N) {
    cin >> weight[i] >> value[i];
  }

  vector<vector<int64_t>> dp(N + 1, vector<int64_t>(W + 1));
  rep(i, N) rep(w, W + 1) {
    if (w >= weight[i]) {
      dp[i + 1][w] = max(dp[i][w - weight[i]] + value[i], dp[i][w]);
    } else {
      dp[i + 1][w] = dp[i][w];
    }
  }

  cout << dp[N][W] << endl;
}


Measured memory_bytes: 80256
#include<cstdio>
using namespace std;
int main()
{
   int n,m,ans,sum;
   while(scanf("%d%d",&n,&m)!=EOF)
   {
       ans=0,sum=n+m;
       while(sum)
       {
           ans++;
           sum/=10;
       }
       //if(!ans)ans++;
       printf("%d\n",ans);
   }
}

Measured memory_bytes: 1028
#include<bits/stdc++.h>
using namespace std;
//union-findのクラス
class unionfind {
    vector<int> par, rank, size_;//速度ではなくメモリ効率を考えるならrankのかわりにsizeを使う
public:
    unionfind(int n) :par(n), rank(n), size_(n, 1) {
        iota(par.begin(),par.end(), 0);
    }
    int find(int x) {
        if (par[x] == x)return x;
        return par[x] = find(par[x]);
    }
    void unite(int x, int y) {
        x = find(x), y = find(y);
        if (x == y)return;
        if (rank[x] < rank[y])swap(x, y);
        par[y] = x;
        size_[x] += size_[y];
        if (rank[x] == rank[y])rank[x]++;
    }
    bool same(int x, int y) {
        return find(x) == find(y);
    }
    int size(int x) {
        return size_[find(x)];
    }
};


template<class T>
auto Kruskal(const vector<vector<pair<T,T>>>&edge){
  T res = 0;
  using tp = tuple<T,T,T>;
  vector<tp>g;
  for(T i = 0; i < edge.size(); ++i){
    for(auto p : edge[i]){
      T j,cost;
      tie(j,cost) = p;
      g.emplace_back(cost,i,j);
    }
  }
  sort(g.begin(),g.end());
  auto uf =  unionfind(edge.size() + 1);
  for(auto tup : g){
    T cost,s,t;
    tie(cost,s,t) = tup;
    if(uf.same(s,t))continue;
    uf.unite(s,t);
    res += cost;
  }
  return res;
}
int main(){
    int v,e; cin >> v >> e;
    vector<vector<pair<int,int>>>edge(v);
    for(int i = 0; i < e ; ++ i){
        int s,t,w; cin >> s >> t >> w;
        edge[s].emplace_back(t,w);
    }
    cout << Kruskal(edge) << endl;
}




Measured memory_bytes: 6096
blocks = {'A': [[0, 0, 1, 1],
                [0, 1, 0, 1]],
          'B': [[0, 0, 0, 0],
                [0, 1, 2, 3]],
          'C': [[0, 1, 2, 3],
                [0, 0, 0, 0]],
          'D': [[0, 0, -1, -1],
                [0, 1, 1, 2]],
          'E': [[0, 1, 1, 2],
                [0, 0, 1, 1]],
          'F': [[0, 0, 1, 1],
                [0, 1, 1, 2]],
          'G': [[-1, 0, 0, 1],
                [1, 0, 1, 0]], }

while 1:
    field = []
    for i in xrange(8):
        field.append(raw_input())
    for i in xrange(8):
        for j in xrange(8):
            if field[i][j] == '1':
                for block in blocks:
                    dx, dy = blocks[block]
                    for k in xrange(4):
                        ny = i + dy[k]
                        nx = j + dx[k]
                        if nx < 0 or ny < 0 or nx >= 8 or ny >= 8:
                            break
                        if field[ny][nx] != '1':
                            break
                    else:
                        print block
                        break
    try:
        raw_input()
    except EOFError:
        break

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

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define range(a) a.begin(), a.end()
#define endl "\n"
#define Yes() cout << "Yes" << endl
#define No() cout << "No" << endl
using Graph = vector<vector<int>>;
const unsigned long long mod = 1e9 + 7;
const long long INF = 1LL<<60;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
void chmin(long long &a, long long b) { if (a > b) a = b; }
void chmax(long long &a, long long b) { if (a < b) a = b; }

// 平方数かどうかの判定
bool is_squere(int N) {
    int r = (int)floor(sqrt((double)N));  // 切り捨てした平方根
    return (r * r) == N;
}

int main(void){
	ios::sync_with_stdio(0);
	cin.tie(0);
	int N;	cin>>N;
	FOR(k,1,N+1){
	int a,b,c,lim,count=0;
	int lim1=sqrt(2*k)+1;   //cout<<lim1<<endl;
	FOR(i,1,lim1){
		a = i;
		int lim2=sqrt(2*k-i*i)+1;   //cout<<lim2<<endl;
		FOR(j,i,lim2){
			b = j;  //cout<<a<<"/"<<b<<endl;
			if (is_squere(2*k-a*a-b*b)) {
				c = sqrt(2*k-a*a-b*b);
                if(c>=b){
                //cout<<a<<"/"<<b<<"/"<<c<<endl;;
                int S = (a+b+c)/2;
                int x=S-b;  int y=S-c;  int z=S-a;
                if(x<1||y<1||z<1)   continue;
				if(x==y&&y==z)	count++;
				else if(x==y||y==z||z==x)	count=count+3;
				else count=count+6;
                //cout<<x<<"/"<<y<<"/"<<z<<endl;
                }
			}
		}
	}
	cout<<count<<endl;
}

    return 0;
}



Measured memory_bytes: 3592
#include<stdio.h>
#include<stdlib.h>
#include<limits.h>

long long int x[1000],y[1000],z[1000];
int a,b,c;

int compare(const void *s,const void *t){
	return x[*(int *)t]*a+y[*(int *)t]*b+z[*(int *)t]*c>x[*(int *)s]*a+y[*(int *)s]*b+z[*(int *)s]*c?1:-1;
}

int main(void){
	int n,m,i;
	long long int tmp[3];
	int pos[1000];
	long long int max=0,t;
	
	scanf("%d %d",&n,&m);

	for(i=0;i<n;i++){
		scanf("%lld %lld %lld",&x[i],&y[i],&z[i]);
		pos[i]=i;
	}

	for(a=-1;a<=1;a+=2){
		for(b=-1;b<=1;b+=2){
			for(c=-1;c<=1;c+=1){
				qsort(pos,n,sizeof(int),compare);
				tmp[0]=0;
				tmp[1]=0;
				tmp[2]=0;
				for(i=0;i<m;i++){
					tmp[0]+=x[pos[i]];
					tmp[1]+=y[pos[i]];
					tmp[2]+=z[pos[i]];
				}
				t=tmp[0]*a+tmp[1]*b+tmp[2]*c;
				if(t>max)max=t;
			}
		}
	}
	printf("%lld\n",max);
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
using namespace std;
#define rep(i,s,n)for(int i = s;i<n;i++)
#define repe(i,s,n)for(int i = s;i<=n;i++)
typedef long long ll;
static const ll MOD = 1e9 + 7;
static const ll INF = (ll)1 << 62;

static const int MAX = 100001;
static const int WHITE = 0;
static const int GRAY = 1;
static const int BLACK = 2;
vector<pair<int, int>> adj[MAX];

ll pre[MAX];
ll p[MAX];
ll d[MAX];
ll color[MAX];
priority_queue<pair<int, int>>PQ;
ll n;
void dijkstra(int s) {
	rep(i, 0, n) {
		d[i] = INF;
		pre[i] = INF;
		color[i] = WHITE;
	}

	d[s] = 0;
	p[s] = -1;
	PQ.push(make_pair(s, s)); // ?reverse?
	color[s] = GRAY;

	while (!PQ.empty()) {
		pair<ll, ll> f = PQ.top(); PQ.pop();
		ll u = f.second;

		color[u] = BLACK;

		if (d[u] < f.first * (-1)) continue;

		rep(j, 0, adj[u].size()) {
			ll v = adj[u][j].first;
			if (color[v] == BLACK) continue;
			if (d[v] > d[u] + adj[u][j].second) {
				d[v] = d[u] + adj[u][j].second;
				PQ.push(make_pair(d[v] * (-1), v));
				p[v] = u;
				color[v] = GRAY;
			}
		}
	}
	//rep(i, 0, n) cout << i << " " << (d[i] == INF ? -1 : d[i]) << endl;
	//rep(i, 0, n) cout << i << " " << (p[i] == INF ? -1 : p[i]) << endl;
}

vector<ll> get_path(int t) {
	vector<ll> path;
	for (; t != -1; t = p[t])path.push_back(t);
	reverse(path.begin(), path.end());
	return path;
}

int main()
{
	cin >> n;
	rep(i, 0, n) {
		adj[i].push_back(make_pair((i + 1) % n, 1));
		adj[i].push_back(make_pair((i * 10) % n, 0));
	}

	dijkstra(1);

	cout << d[0] + 1 << endl;
	return 0;
}

Measured memory_bytes: 9468
#include<iostream>
using namespace std;
int main()
{
    int a,b,c,x,y;
    while(cin>>a>>b>>c>>x>>y)
    {
        if(a+b<2*c)
        {
            cout<<a*x+b*y<<endl;
        }
        else
        {
            int ans=2*c*min(x,y);
            if(x<y)
            {
                if(b>2*c) ans=ans+2*c*(y-x);
                else ans=ans+b*(y-x);
            }
            else
            {
                if(a>2*c) ans=ans+2*c*(x-y);
                else ans=ans+a*(x-y);
            }
            cout<<ans<<endl;
        }
    }
    return 0;
}


Measured memory_bytes: 256
#pragma warning(disable:4996)

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include <float.h>

#pragma region 定義
typedef long long  ll;
typedef unsigned long long  ull;


#define _itoa(A,N) sprintf(A, "%d", N);

int i_dsort(const void* a, const void* b);
int i_asort(const void* a, const void* b);

int  _gcd(int a, int b);
int  _swp(int* a, int* b);
int _cknum(char* a, int n);
int _atoi(char* s, int len);

int s_asort(const void* a, const void* b);
int s_dsort(const void* a, const void* b);

//昇順
int s_asort(const void* a, const void* b) {
	return(strcmp((char*)a, (char*)b));
}
int s_dsort(const void* a, const void* b) {
	return(strcmp((char*)b, (char*)a));
}

int i_dsort(const void* a, const void* b) {
	return(*(int*)b - *(int*)a);
}
int i_asort(const void* a, const void* b) {
	return(*(int*)a - *(int*)b);
}


int i_gcd(int a, int b);
int i_gcd(int a, int b) {
	if (!b)return a;
	return i_gcd(b, a % b);
}
int i_lcm(int a, int b);
int i_lcm(int a, int b) {
	return (a * b) / i_gcd(a, b);
}
int ll_gcd(ll a, ll b);
int ll_gcd(ll a, ll b) {
	if (!b)return a;
	return ll_gcd(b, a % b);
}
int ll_lcm(ll a, ll b);
int ll_lcm(ll a, ll b) {
	return (a * b) / ll_gcd(a, b);
}

// puts("Yes\n") puts("No\n")
// scanf("%d.%d") 浮動小数点入力を整数２つで得る


//#define pai  3.1415926535 
//#define  _USE_MATH_DEFINES でM_PIが使える

#define deg_rad(X)  (X*(M_PI/180))


int _swp(int* a, int* b)
{
	int tmp;
	tmp = *b; *b = *a; *a = tmp;
	return 0;
}
#define _abs(x) ((x)>0?(x):-(x))
#define _min(x,y) ((x)<(y)?(x):(y))
#define _max(x,y) ((x)<(y)?(y):(x))

int _cknum(char* a, int n) {
	int i;
	char t = '0';

	for (i = 0; i < n; i++) {
		if (a[i] < '0' || a[i]>'9') return 1;
	}
	return 0;
}


int _atoi(char* s, int len) {
	char tmp[20];
	memcpy(tmp, s, len);
	tmp[len] = 0x00;
	return (atoi(tmp));
}

//素因数分解　pf素数が入る　pc 素数の数
ll _pfact(ll a);
static ll pf[100000000];
static ll pc;

ll _pfact(ll a) {
	long i, r;
	if (a % 2 == 0) {
		pf[pc] = 2; pc++;
		return(_pfact(a / 2));
	}
	r = sqrt(a);
	for (i = 3; i <= r; i += 2) {
		if (a % i == 0) {
			pf[pc] = i; pc++;
			return(_pfact(a / i));
		}
	}
	if (a != 1) {
		pf[pc] = a; pc++;
	}
	return 0;

}

//同じものの最初の文字をNULLにして降順
int _sort(const void* a, const void* b);
int _sort(const void* a, const void* b) {
	char rc;

	rc = strcmp((char*)b, (char*)a);
	if (rc == 0) {
		*(char*)a = 0x00;
		return(1);
	}
	return(rc);
}


#pragma endregion


int main(void) {
	int a, b;
	scanf("%d %d", &a, &b);
	printf("%d\n", 6-a-b);
   return 0;
	}







Measured memory_bytes: 2108
#include <bits/stdc++.h>
#define INF 100000000000
#define ll long long
#define pll pair<ll, ll>
using namespace std;

int main()
{
  double pi = 3.141592653589793;
  double R;
  cin >> R;
  cout << setprecision(10) << 2 * R * pi << endl;
}


Measured memory_bytes: 3780
#include <bits/stdc++.h>
using namespace std;
#define N 200020
int i,j,k,m,n,x,y,a[N];
long long ans;
int main() {
    for (scanf("%d", &n), i = 0; i < n; ++i)scanf("%d", &a[i]), a[i] -= i + 1;
    sort(a, a + n);
    for (i = 0; i < n; ++i)ans += abs(a[i] - a[n >> 1]);
    cout << ans;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,k;
    string s;
    cin>>n>>k>>s;
    if(s[k-1]=='A'){
        s[k-1]='a';
    }
    
    else if(s[k-1]=='B'){
        s[k-1]='b';
    }
    
    else if(s[k-1]=='C'){
        s[k-1]='c';
    }
    cout<<s<<endl;
 	return 0;
}

Measured memory_bytes: 256
import java.util.*;

class Main{

    void solve(){
        Scanner sc = new Scanner(System.in);

        int INF = Integer.MAX_VALUE;

        while(true){
            int T = sc.nextInt();
            if(T==0) break;
            int[] t = new int[T];
            for(int i=0; i<T; i++) t[i] = sc.nextInt();

            int n = sc.nextInt();
            int[] time = new int[105];
            Arrays.fill(time, INF);

            int max = 0;
            for(int i=0; i<n; i++){
                int d = sc.nextInt()-1, m = sc.nextInt();
                max = Math.max(max, d);
                time[d] = Math.min(time[d], m);
            }

            int[][] dp = new int[max+2][T];
            for(int i=0; i<=max; i++) Arrays.fill(dp[i], INF);
            dp[0][0] = 0;

            for(int i=0; i<max; i++){
                for(int j=0; j<T; j++){
                    if(dp[i][j]==INF) continue;
                    if(time[i+1]>=t[(j+1)%t.length]){
                        dp[i+1][(j+1)%t.length] = dp[i][j];
                    }
                    dp[i+1][0] = Math.min(dp[i+1][0], dp[i][j] + 1);
                    //dp[i+1][0] = Math.min(dp[i+1][0], dp[i][j] + 1);
                }
                //if(dp[i-1][t.length-1]!=INF) dp[i][0] = Math.min(dp[i][0], dp[i-1][t.length-1]);
            }

            //for(int i=0; i<=max; i++) System.out.println(Arrays.toString(dp[i]));

            int min = Integer.MAX_VALUE;
            for(int i=0; i<T; i++){
                min = Math.min(min, dp[max][i]);
            }
            System.out.println(min);
        }
    }

    public static void main(String[] args){
        new Main().solve();
    }
}

Measured memory_bytes: 25404
#include<bits/stdc++.h>
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9 + 7;
using namespace std;

//ループマクロ
#define FOR(i , a , b)  for(int i = (a) ; i < (b) ; i++)
#define REP(i , n)      for(int i = 0 ; i < n ; i++)
#define REPR(i , n)     for(int i = n ; 0 <= i ; i--)
#define ROP(i, n)       for(int i = 1 ; i <= n ; i++)

//入出力
#define SCOUT(x) cout << (x) << " "
#define VECCIN(x) for(auto& ele : (x) ) cin >> ele
#define VECOUT(x) for(auto& ele : (x) ) cout << ele << " "; cout << endl;

//その他
#define ALL(obj) (obj).begin() , (obj).end() 
#define SORT(obj) sort(ALL(obj))
#define GSORT(obj) sort(ALL(obj) , greater<int>())
#define P pair<int , int>
#define V vector<int>
#define VLL vector<long long>
#define M map<int, int>
#define S set<int>
#define PQ priority_queue<int>
#define PQG priority_queue<int , V , greater<int>>

int main(void) {

	ios::sync_with_stdio(false);	cin.tie(0);
    int N, K;  cin >> N >> K;
    vector<bool> hoge(N);  fill(ALL(hoge), false);
    REP(i, K){
      int d;  cin >> d;
      REP(j, d){  int A;  cin >> A;  hoge[A-1] = true;  }
    }

    int ans = 0;
    REP(i, N)
      if(hoge[i] == false)  ans++;
    cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3660
using System;
using System.Collections.Generic;
using System.Collections;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using System.IO;
using System.Reflection;
using static System.Math;
using System.Numerics;
static class Program{
	const int mod=(int)1e9+7;
	const double eps=1e-11;
	static void Main(){
		Sc sc=new Sc();
		var n=sc.I;
		int m=241;
		for(int i = -120;i<=120;i++) {
			for(int j = -120;j<=120;j++) {
				if(Pow(i,5)-Pow(j,5)==n){
					Console.WriteLine("{0} {1}",i,j);
					return;
				}
			}
		}
	}
}
public class Sc{
	public int I{get{return int.Parse(Console.ReadLine());}}
	public long L{get{return long.Parse(Console.ReadLine());}}
	public double D{get{return double.Parse(Console.ReadLine());}}
	public string S{get{return Console.ReadLine();}}
	public int[] Ia{get{return Array.ConvertAll(Console.ReadLine().Split(),int.Parse);}}
	public long[] La{get{return Array.ConvertAll(Console.ReadLine().Split(),long.Parse);}}
	public double[] Da{get{return Array.ConvertAll(Console.ReadLine().Split(),double.Parse);}}
	public string[] Sa{get{return Console.ReadLine().Split();}}
	public object[] Oa{get{return Console.ReadLine().Split();}}
	public int[] Ia2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),int.Parse);}}
	public int[] Ia3(int a){return Array.ConvertAll((a.ToString()+" "+Console.ReadLine()).Split(),int.Parse);}
	public int[] Ia3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+Console.ReadLine()+(c?" "+d.ToString():"")).Split(),int.Parse);}
	public long[] La2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),long.Parse);}}
	public long[] La3(int a){return Array.ConvertAll((a.ToString()+" "+Console.ReadLine()).Split(),long.Parse);}
	public long[] La3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+Console.ReadLine()+(c?" "+d.ToString():"")).Split(),long.Parse);}
	public double[] Da2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),double.Parse);}}
	public double[] Da3(int a){return Array.ConvertAll((a.ToString()+" "+Console.ReadLine()).Split(),double.Parse);}
	public double[] Da3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+Console.ReadLine()+(c?" "+d.ToString():"")).Split(),double.Parse);}
	public T[] Arr<T>(int n,Func<T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f();}return a;}
	public T[] Arr<T>(int n,Func<int,T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i);}return a;}
	public T[] Arr<T>(int n,Func<string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(Console.ReadLine().Split());}return a;}
	public T[] Arr<T>(int n,Func<int,string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i,Console.ReadLine().Split());}return a;}
}

Measured memory_bytes: 27788
"use strict";
var input=require("fs").readFileSync("/dev/stdin","utf8");
var cin=input.split(/ |\n/),cid=0;
function next(){return +cin[cid++];}
function nextstr(){return cin[cid++];}
function nextbig(){return BigInt(cin[cid++]);}
function nexts(n,a){return a?cin.slice(cid,cid+=n):cin.slice(cid,cid+=n).map(a=>+a);}
function nextm(h,w,a){var r=[],i=0;if(a)for(;i<h;i++)r.push(cin.slice(cid,cid+=w));else for(;i<h;i++)r.push(cin.slice(cid,cid+=w).map(a=>+a));return r;}
function xArray(v){var a=arguments,l=a.length,r="Array(a["+--l+"]).fill().map(x=>{return "+v+";})";while(--l)r="Array(a["+l+"]).fill().map(x=>"+r+")";return eval(r);}

var myOut = main();
if(myOut !== undefined)console.log(myOut);

function main(){
  var x = nextstr();
  var ans = 0, t = 0;
  for(var i = 0; i < x.length; i++){
    if(x[i] === "S")t++;
    else{
      if(t === 0)ans++;
      else t--;
    }
  }
  return ans*2;
}

Measured memory_bytes: 32532
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
using LL = long long;
constexpr int N_MAX = 100000;
int a[N_MAX + 1], deg[N_MAX + 1], dp[N_MAX + 1];
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N, K, ans = 0;
    cin >> N >> K;
    for (int i = 1; i <= N; i++) {
        cin >> a[i];
    }
    if (a[1] != 1) a[1] = 1, ans = 1;
    for (int i = 2; i <= N; i++) {
        deg[a[i]]++;
    }
    queue<int> queueDp;
    for (int i = 1; i <= N; i++) {
        if (deg[i] == 0) queueDp.emplace(i);
    }
    while (!queueDp.empty()) {
        int u = queueDp.front();
        queueDp.pop();
        if (--deg[a[u]] == 0) queueDp.push(a[u]);
        if (dp[u] + 1 >= K && a[u] != 1) {
            ans++, a[u] = 1;
        } else {
            dp[a[u]] = max(dp[a[u]], dp[u] + 1);
        }
    }
    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 1792