akhauriyash/Code-Regression huggingface dataset:
import qualified Data.IntSet as IntSet
import qualified Data.Set as Set
import Debug.Trace
import Data.Array

main :: IO ()
main = do
  s <- readLn :: IO Integer
  print $ solve s

-- solve :: Int -> Int
solve s = find Set.empty [1..]
  where
    a = listArray (1, 1000000) $ map g [1..1000000]
    f n | n `mod` 2 == 0 = n `div` 2
        | otherwise = 3 * n + 1
    g 1 = s
    g i = f $ a!(i-1)

    -- find :: Set.Set Integer -> [Int] -> Int
    find as (i:is)
      | Set.member ai as = i
      | otherwise = find (Set.insert ai as) is
        where ai = a!i


Measured memory_bytes: 69884
use std::fmt::Write;
use std::io::*;

fn main() {
  let input = {
    let mut buf = vec![];
    stdin().read_to_end(&mut buf);
    unsafe { String::from_utf8_unchecked(buf) }
  };
  let mut lines = input.split('\n');

  let (h, w) = {
    let line = lines.next().unwrap();
    let mut iter = line.split(' ').map(|s| s.parse::<usize>().unwrap());

    (iter.next().unwrap(), iter.next().unwrap())
  };

  let mut result = String::with_capacity(h * w * 3);

  for line in lines.take(h) {
    let mut cnt = -1;

    for ch in line.bytes() {
      if ch == b'c' {
        cnt = 0;
        result.push_str("0 ");
      }
      else {
        if cnt == -1 {
          result.push_str("-1 ");
        }
        else {
          cnt += 1;
          write!(result, "{} ", cnt);
        }
      }
    }
    result.pop();
    result.push('\n');
  }
  print!("{}", result);
}



Measured memory_bytes: 5028
#include <bits/stdc++.h>
using namespace std;
int main(){
 string s;
 cin >> s;
 
 int dSize = 2;
 while(dSize < s.size()){
   int size =(s.size() - dSize ) / 2;
   bool ret = true;
   for(int i = 0; i < size; i++){
     if(s.at(i) != s.at(size + i)) {ret = false; break;}
   }
   
   if(ret){
     cout << size * 2 << endl;
     return 0;
   }
   
   dSize += 2;
 }
 
  
  
 return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdio>
#include <cmath>
const int N = 5005;
typedef long long ll; 
using namespace std;

int n, m, a[N];
ll f[N]; 

template < typename T >
inline T read()
{
	T x = 0, w = 1; char c = getchar();
	while(c < '0' || c > '9') { if(c == '-') w = -1; c = getchar(); }
	while(c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
	return x * w; 
}

int main()
{
#ifndef ONLINE_JUDGE
	freopen("cpp.in", "r", stdin); 
#endif
	n = read <int> (), m = read <int> ();
	for(int i = 1; i <= n; i++) a[i] = read <int> () - m;
	f[2500] = 1; 
	for(int i = 1; i <= n; i++)
	{
		if(a[i] > 0)
			for(int j = 5000; j >= a[i]; j--)
				f[j] += f[j - a[i]]; 
		else
			for(int j = 0; j <= 5000 + a[i]; j++)
				f[j] += f[j - a[i]]; 
	}
	printf("%lld\n", f[2500] - 1); 
	return 0; 
}


Measured memory_bytes: 3236
#pragma GCC optimize("Ofast,inline,unroll-loops,fast-math")
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cmath>
using namespace std;

int main(void)
{
    long long x;
    int i;
    long long s;

    cin >> x;
    for(i = 0, s = 100; s < x; i ++)
        s *= 1.01;
    cout << i << endl;

    return 0;
}


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

int main(){
  int A, B;
  int a[10];
  int counter = 0;
  cin >> A >> B;
  for(int i = A; i <= B; i++){
    int s = i;
    for(int j = 0; j < 5; j++) a[j] = s % 10, s /= 10;
    if((a[0] == a[4]) && (a[1] == a[3])) counter++;
  }
  cout << counter << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<functional>
#include<map>
#include<cstdlib>
#include<complex>
#include<numeric>
#include<set>
#include<deque>

using namespace std;
using Int = long long;
Int INF = 1LL << 60;
const Int MOD = 1000000000 + 7;

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	Int N;
	cin >> N;

	vector<Int> s(N);
	Int sum = 0;
	for (Int i = 0; i < N; i++) {
		cin >> s[i];
		sum += s[i];
	}
	sort(s.begin(), s.end());

	Int flag = 0;
	if (sum % 10) {
		cout << sum << "\n";
	}
	else {
		for (Int i = 0; i < N; i++) {
			if (s[i] % 10) {
				sum -= s[i];
				flag = 1;
				break;
			}
		}

		if (flag == 0) {
			cout << 0 << "\n";
		}
		else {
			cout << sum << "\n";
		}
	}

}

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

using namespace std;

int main()
{

    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    
    int A, B, C; long long K; cin >> A >> B >> C >> K, C = ( A - B );
    
    if ( K & 1LL )
        C = -C;
        
    cout << C; 
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String S = sc.nextLine();
        String [] S1 = S.split("/",0);
        int year,month,day;
         year = Integer.parseInt(S1[0]);
         month = Integer.parseInt(S1[1]);
         day = Integer.parseInt(S1[2]);
        if(month>=5) System.out.println("TBD");
        else System.out.println("Heisei");

    }
}

Measured memory_bytes: 22608
i = list(map(int, input().split()))

H = i[0]
W = i[1]


if(W == 1):
    print(1)
elif(H == 1):
    print(1)
#横が偶数の時は、縦の偶奇によらない
elif(W % 2 == 0):
    yoko = W // 2
    print(yoko*H)
#横が奇数の時は、縦の偶奇による
elif(W % 2 != 0):
    yoko = W // 2 + 1
    #縦が偶数の時
    if(H % 2 == 0):
        print(yoko*(H//2)+(yoko-1)*(H//2))
    #縦が奇数の時
    else:
        print(yoko*(H//2+1)+(yoko-1)*(H//2))

Measured memory_bytes: 3064
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<functional>
#include<math.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<(n);i++)
#define pf(n) printf("%d\n",n)
#define pff(a,b) printf("%d  %d\n",a,b);
typedef long long ll;
typedef pair<ll, ll> p;
const int INF = 1001001001;
const double PI = acos(-1);

int main() {
	int h, w;
	cin >> h >> w;
	char a[101][101];
	rep(i, h)rep(j, w) a[i][j] = '*';
	rep(i, h)rep(j, w) cin >> a[i][j];

	rep(i, h) {
		bool ok = true;
		rep(j, w) {
			if (a[i][j] == '#') ok = false;
		}
		if (ok) {
			rep(j, w) {
				a[i][j] = '*';
			}
		}
	}
	
	rep(j, w) {
		bool ok = true;
		rep(i, h) {
			if (a[i][j] == '#') ok = false;
		}
		if (ok)rep(i, h) a[i][j] = '*';
	}

	rep(i, h) {
		bool ok = false;
		rep(j, w) {
			if (a[i][j] != '*') {
				cout << a[i][j];
				ok = true;
			}
		}
		if (ok) cout << endl;
	}

	return 0;
}

Measured memory_bytes: 3604
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!{
        a: i32,
        b: i32,
        c: i32
    }
    let ans = if a == b { c } else if a == c { b } else { a };
    println!("{}", ans);
}

Measured memory_bytes: 4352
function Main(input) {
	//tmp[0]にX, tmp[1]にY
	input = input.split("\n");
	tmp = input[0].split(" ");
  
	var x = parseInt(tmp[0], 10);
	var y = parseInt(tmp[1], 10);
    var b = 0;
  
    for ( let t = 0 ; t < (x+1) ; t++ ) {
		var yy = 4 * x - 2 * t;
		if ( yy == y ) {
             console.log( 'Yes' );
             var b = 1;
        	 break;
        }
    }
    
    if ( b == 0 ) {
       console.log( 'No' );
    }
      
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 29616
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define pf push_front
#define mod 1000000007
#define endl '\n'
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

int main()
{
   string s1,s2;
   cin>>s1>>s2;
   s2+=s1;
   cout<<s2<<endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void recDelIsland(boolean[][] map, int i, int j){
		map[i][j] = false;
		for(int di = -1; di <= 1; di++){
			for(int dj = -1; dj <= 1; dj++){
				if((di != 0 || dj != 0) &&
					di + i >= 0 && di + i < map.length &&
					dj + j >= 0 && dj + j < map[0].length &&
					map[di + i][dj + j]){
					recDelIsland(map, di + i, dj + j);
				}
			}
		}
	}
	public static int getNumOfIslands(boolean[][] map){
		int result = 0;
		for(int i = 0; i < map.length; i++){
			for(int j = 0; j < map[0].length; j++){
				if(map[i][j]){
					result++;
					recDelIsland(map, i, j);
				}
			}
		}
		return result;
	}
	public static void main(String[] args){
		Scanner scn = new Scanner(System.in);
		int w, h;
		w = scn.nextInt();
		h = scn.nextInt();
		while(w != 0 || h != 0){
			boolean[][] map = new boolean[h][w];
			for(int i = 0; i < h; i++)	for(int j = 0; j < w; j++)	map[i][j] = (scn.nextInt() == 1);
			System.out.println(getNumOfIslands(map));
			w = scn.nextInt();
			h = scn.nextInt();
		}
	}
}

Measured memory_bytes: 41444
def slove():
    import sys
    import collections
    input = sys.stdin.readline
    n, q = list(map(int, input().rstrip('\n').split()))
    d = collections.defaultdict(list)
    for i in range(n-1):
        a, b = list(map(int, input().rstrip('\n').split()))
        d[a] += [b]
        d[b] += [a]

    score = collections.defaultdict(int)
    for i in range(q):
        p, x = list(map(int, input().rstrip('\n').split()))
        score[p] += x

    ql = collections.deque()
    ql.append(1)
    fq = collections.defaultdict(list)
    fq[1]
    while True:
        if len(ql) != 0:
            p = ql.popleft()
            for v in d[p]:
                if v not in fq:
                    score[v] += score[p]
                    fq[v]
                    ql.append(v)
        else:
            break
    print(*[score[i] for i in range(1, n + 1)])


if __name__ == '__main__':
    slove()


Measured memory_bytes: 128488
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cstring>
#include <map>
#include <queue>
#include <cmath>
#include <complex> // complex<double> a(1.2 , 2.3);// real(): 1.2, imag()2.3
using namespace std;

#define MOD 1000000007
#define ll long long
#define ld long double
#define FOR(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rmsame(a) sort(all(a)),a.erase(unique(all(a)), a.end())
#define rmvector(a,b) rep(i,a.size())rep(j,b.size())if(a[i]==b[j]){a.erase(a.begin()+i);i--;break;}


ll road[301][301];
ll cpr[301][301];
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);

  ll N;
  cin >> N;
  rep(i,301)rep(j,301){
    road[i][j]=10e10;
    cpr[i][j]=10e10;
  }
  
  rep(i,N) rep(j,N){
    cin >> road[i][j];
    cpr[i][j]=road[i][j];
  }

  rep(k,N)rep(i,N)rep(j,N)
    cpr[i][j]=min(cpr[i][j], cpr[i][k]+cpr[k][j]);

  rep(i,N)rep(j,N){
    if(road[i][j]!=cpr[i][j])
      {
	cout << -1 << endl;
	return 0;
      }
  }


  rep(k,N)rep(i,N)rep(j,N){
    if(cpr[i][j]==road[i][k]+road[k][j] && k!=i && k!=j)
      cpr[i][j]=0;
  }

  ll ans = 0;
  rep(i,N){
    rep(j,N){
    ans+=cpr[i][j];
    }
  }
  cout << ans/2 << endl;
  return 0;
}


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

#define hell                         1000000007
#define lcm(a,b)                     (a*b)/__gcd(a,b)
#define ll                           long long
#define vll                          vector<ll>
#define vi                           vector<int>
#define pll                          vector< pair<ll,ll> >
#define pb                           push_back
#define mp                           make_pair
#define all(v)                       v.begin(),v.end()
#define lbnd                         lower_bound
#define ubnd                         upper_bound
#define bs                           binary_search
#define F                            first
#define S                            second
#define rep(i,a,b)                   for(i=a;i<b;i++)
#define parr(a,n)                    for(ll it=0;it<n;it++) cout<<a[it]<<" ";cout<<endl;
#define pcont(a)                     for(auto it:a) cout<<it<<" ";cout<<endl;
#define ret(x)                       return cout<<x,0;
#define endl                           '\n'

/*constants*/
#define MAXN                         100005
#define PI                           3.14159265358979323846

/*debug*/
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>void __f(const char* name, Arg1&& arg1){ std::cout << name << " : " << arg1 << '\n';}
    template <typename Arg1, typename... Args>void __f(const char* names, Arg1&& arg1, Args&&... args){const char* comma = strchr(names + 1, ','); std::cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);}
#else
#define trace(...)
#endif

using namespace std;


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    
    ll i,j,n,m,k,cnt=0,ans=0,t=1;
    cin>>n;
    ll a[n+1];
    ll b[n];
    rep(i,0,n+1) cin>>a[i] ;
    rep(i,0,n) cin>>b[i];
    rep(i,0,n){
        ans+=min(a[i],b[i]);
        b[i]-=min(a[i],b[i]);
        ans+=min(a[i+1],b[i]);
        k=min(a[i+1],b[i]);
        a[i+1]-=k,b[i]-=k;
    }   
    ret(ans)
    return 0;
}

Measured memory_bytes: 1792
def main():
    n, x = map(int, input().split())
    m = []
    for i in range(0, n):
        m.append(int(input()))

    minSize = min(m)
    sumSize = sum(m)

    print(n + (x - sumSize) // minSize)

if __name__ == '__main__':
    main()


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

int main() {
    /*変数定義，入力*/
    ll N, M;
    cin >> N >> M;
    ll H[N];
    bool goodObs[N];
    rep(i, N){
        goodObs[i] = true;
        cin >> H[i];
    }

    
    ll A, B;
    rep(i, M){
        cin >> A >> B;
        if(H[A-1] >= H[B-1]){
            goodObs[B-1] = false;
        }
        if(H[A-1] <= H[B-1]){
            goodObs[A-1] = false;
        }
    }

    cout << std::count(goodObs, goodObs + sizeof(goodObs), true) << endl;

    /*終了*/
    return 0;
}

Measured memory_bytes: 4512
import java.util.*;

public class Main{
    
    static final int MOD = (int)1e9+7;
    
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        
        int d = Integer.parseInt(sc.next());
        
        int[] c = new int[26];
        for(int i=0; i<26; i++){
            c[i] = Integer.parseInt(sc.next());
        }
        
        int[][] s = new int[d][26];
        for(int i=0; i<d; i++){
            for(int j=0; j<26; j++){
                s[i][j] = Integer.parseInt(sc.next());
            }
        }
        
        int[] t = new int[d];
        for(int i=0; i<d; i++){
            t[i] = Integer.parseInt(sc.next());
        }
        
        int[][] nocontest = new int[d+1][26];
        
        long score = 0;
        long[] scorememo = new long[d+1];
        for(int day=1; day<=d; day++){
            int contest = t[day-1]-1;
            score += s[day-1][contest];
            for(int j=0; j<26; j++){
                if(j==contest){
                    nocontest[day][j] = 0;
                }else{
                    nocontest[day][j] = nocontest[day-1][j]+1;
                }
            }
            for(int j=0; j<26; j++){
                score -= c[j] * nocontest[day][j];
            }
            scorememo[day] = score;
        }
        
        for(int i=0; i<=d; i++){
            //System.out.println(scorememo[i]);
        }
        
        int m = Integer.parseInt(sc.next());
        int[][] q = new int[m][2];
        for(int i=0; i<m; i++){
            for(int j=0; j<2; j++){
                q[i][j] = Integer.parseInt(sc.next());
            }
        }
        
        for(int i=0; i<m; i++){
            int qday = q[i][0];
            int qidx = q[i][1];
            t[qday-1] = qidx;
            score = scorememo[qday-1];
            for(int day = qday; day<=d; day++){
                int contest = t[day-1]-1;
                score += s[day-1][contest];
                for(int j=0; j<26; j++){
                    if(j==contest){
                        nocontest[day][j] = 0;
                    }else{
                        nocontest[day][j] = nocontest[day-1][j]+1;
                    }
                }
                for(int j=0; j<26; j++){
                    score -= c[j] * nocontest[day][j];
                }
                scorememo[day] = score;
            }
            System.out.println(score);
        }
        
    }
    
}


Measured memory_bytes: 62608
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <math.h>
#include <string.h>
#include <map>
#include <numeric>
using namespace std;

int main()
{
  int a,b;
  cin>>a>>b;
  if(a+b>=10) {cout<<"error"<<endl;}
  else {cout<<a+b<<endl;}
}



Measured memory_bytes: 256
class Bit():
    def __init__(self, n):
        self.size = n
        self.tree = [0] * (n + 1)

    def add(self, i, x):
        while i <= self.size:
            self.tree[i] += x
            i += i & -i

    def sum(self, i):
        s = 0
        while i > 0:
            s += self.tree[i]
            i -= i & -i
        return s


def enc(a):
    return ord(a) - ord('a')


N = int(input())
S = input()
bits = [Bit(N) for i in range(26)]

for i, s in enumerate(S):
    bits[enc(s)].add(i + 1, 1)


for _ in range(int(input())):
    t, l, r = input().split(" ")
    if t == '1':
        i = int(l)
        before = -1
        for before in range(26):
            if bits[before].sum(i) - bits[before].sum(i - 1) == 1:
                break
        after = enc(r)
        bits[before].add(i, -1)
        bits[after].add(i, 1)
    else:
        l, r = map(int, [l, r])
        ans = 0
        for c in range(26):
            if bits[c].sum(r) - bits[c].sum(l - 1) > 0:
                ans += 1
        print(ans)

Measured memory_bytes: 144884
#include<bits/stdc++.h>
#define ll long long
#define mo 1000000007
#define N 22
using namespace std;
template <typename T> void read(T &x){
	x=0;char c=getchar();int fh=1;
	while (!isdigit(c)){if (c=='-')fh=-1;c=getchar();}
	while (isdigit(c))x=x*10+c-'0',c=getchar();
	x*=fh;
}
vector<pair<int,int> > s[N];
struct Info{int ki,an;}dp[195][524300];
int d[N],f[N],no[N],m,n,q,g[524300],x,y,ne[524300][N];
void jb(int x,int y,int z){s[x].push_back(make_pair(y,z));}
void dfs(int x,int fa,int dep){
	d[x]=dep;f[x]=fa;
	for (unsigned i=0;i<s[x].size();i++){
		if (s[x][i].first!=fa){
			no[s[x][i].first]=s[x][i].second;
			dfs(s[x][i].first,x,dep+1);
		}
	}
}
int que(int x,int y){
	int an=0;
	while (x!=y){
		if (d[x]<d[y]) swap(x,y);
		an+=(1<<no[x]);
		x=f[x];
	}
	return an;
}
int main(){
	read(n);read(m);q=n-1;
	for (int i=1;i<n;i++){read(x);read(y);jb(x,y,i-1);jb(y,x,i-1);}
	dfs(1,0,1);
	for (int i=n;i<=m;i++){
		read(x);read(y);
		g[que(x,y)]++;
	}
	for (int i=0;i<q;i++)
		for (int j=0;j<(1<<q);j++)
			if ((j&(1<<i))==0)g[j+(1<<i)]+=g[j];
	for (int j=0;j<(1<<q);j++)
		for (int i=0;i<q;i++)if (j&(1<<i))g[j]++;else ne[j][++ne[j][0]]=1<<i;
	dp[0][0].ki=1;
	for (int i=0;i<m;i++){
		for (int j=0;j<(1<<q);j++){
			if (dp[i][j].ki||dp[i][j].an){
				for (int k=1;k<=ne[j][0];k++){
					dp[i+1][j+ne[j][k]].ki=(dp[i][j].ki+dp[i+1][j+ne[j][k]].ki)%mo;
					dp[i+1][j+ne[j][k]].an=(1ll*dp[i][j].ki*(i+1)+dp[i+1][j+ne[j][k]].an+dp[i][j].an)%mo;
				}
				dp[i+1][j].ki=(dp[i+1][j].ki+1ll*dp[i][j].ki*(g[j]-i))%mo;
				dp[i+1][j].an=(dp[i+1][j].an+1ll*dp[i][j].an*(g[j]-i))%mo;
			}
		}
	}
	cout<<dp[m][(1<<q)-1].an<<endl;
	return 0;
}

Measured memory_bytes: 792832
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
using ld=long double;
using P=pair<ll,ll>;
#define MOD 1000000007LL
#define INF 1000000000ll
#define EPS 1e-10
#define FOR(i,n,m) for(ll i=n;i<(ll)m;i++)
#define REP(i,n) FOR(i,0,n)
#define DUMP(a) REP(d,a.size()){cout<<a[d];if(d!=a.size()-1)cout<<" ";else cout<<endl;}
#define ALL(v) v.begin(),v.end()
#define UNIQUE(v) sort(ALL(v));v.erase(unique(ALL(v)),v.end());
#define pb push_back

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll h,w;
	cin>>h>>w;
	vector<vector<ll>> a(h,vector<ll>(w));
	REP(i,h) REP(j,w) cin>>a[i][j];
	ll buf=0;
	vector<pair<P,ll>> b;
	REP(i,h) {
		if(i%2==0) {
			for(ll j=0; j<w; j++) {
				b.pb(make_pair(P(i,j),a[i][j]));
			}
		} else {
			for(ll j=w-1; j>=0; j--) {
				b.pb(make_pair(P(i,j),a[i][j]));
			}
		}
	}
	vector<pair<P,P>> ans;
	REP(i,b.size()) {
		if(b[i].second%2) {
			if(buf==0) buf++;
			else {
				b[i].second--;
				ll pos=i;
				while(b[pos].second%2==0) {
					ans.pb(make_pair(b[pos].first, b[pos-1].first));
					pos--;
				}
				b[pos].second--;
				buf=0;
			}
		}
	}
	cout<<ans.size()<<endl;
	REP(i,ans.size()) {
		cout<<ans[i].first.first+1<<" "<<ans[i].first.second+1<<" "<<ans[i].second.first+1<<" "<<ans[i].second.second+1<<endl;
	}
	return 0;
}


Measured memory_bytes: 18028
#include<algorithm>
#include<string>
#include<stdio.h>
#include<iostream>
#include<vector>
#include<queue>
#include<stack>
#include<set>
#include<utility>
#include<functional>
#include<cassert>
#include<cmath>
#include<math.h>
#include<unordered_map>
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
typedef vector<int> vint;
typedef vector<vint> vvint;
#define PI 3.1415926535
#define MOD 1000000007
#define rep(i, n) for(int i=0;i<(n);i++)
vector<vector<char>> s;


int main(void) {
	ll n, x, ans = 0; cin >> n >> x;
	vint a(n);
	rep(i, n)cin >> a[i];

	for (int i = 1; i < n; i++) {
		if (a[i - 1] + a[i] < x) {
			continue;
		}
		if(a[i-1]<= x) {
			ans += a[i] + a[i - 1] - x;
			a[i] = x - a[i - 1];
		}
		else {
			ans += a[i] + a[i - 1] - x;
			a[i] = 0;
			a[i - 1] = x;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 640
#include<stdio.h>
double line(double x1, double y1, double x2, double y2, double x, double y)
{
	return (x1-x2)*(y-y1)+(y1-y2)*(x1-x);
}
int main()
{
	double x[4], y[4];
	int i;
	while (scanf("%lf,%lf", x, y)>0) {
		for (i = 1; i < 4; i ++)
			scanf(",%lf,%lf", x+i, y+i);
		for (i = 0; i < 4; i ++) {
			if (line(x[i], y[i], x[(i+1)%4], y[(i+1)%4], x[(i+2)%4], y[(i+2)%4]) *
				line(x[i], y[i], x[(i+1)%4], y[(i+1)%4], x[(i+3)%4], y[(i+3)%4]) < 0)
				break;
		}
		puts (i == 4 ? "YES" : "NO");
	}
	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
#define input(d) cin >> d
#define inputs(n,d) for(auto i=0;i<n;i++)cin >> d.at(i)
#define output(d) cout << d << endl
#define outputs(n,d) for(auto i=0;i<n;i++)cout<<d[i]<<endl
#define ll long long
#define l_ long
#define f0(n) for(ll i=0;i<n;i++)
#define f(a,b) for(ll i=a;i<b;i++)

int main(){
  ll n,d[4]={0,0,0,0};
  string s;
  input(n);
  f0(n){
    input(s);
    if(s=="AC"){
      d[0]++;
    }else if(s=="WA"){
      d[1]++;
    }else if(s=="TLE"){
      d[2]++;
    }else if(s=="RE"){
      d[3]++;
    }
  }
  cout << "AC x "<<d[0]<<"\nWA x "<<d[1]<<"\nTLE x "<<d[2]<<"\nRE x "<<d[3]<<endl;
}


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

int main(){
  int N;
  string S;
  cin >> N;
  cin >> S;
  int R[N],G[N],B[N];
  for(int i=0;i<N;i++){
    R[i]=0;
    G[i]=0;
    B[i]=0;
  }
  for(int i=0;i<N;i++){
    if(S[i]=='R'){
      R[i]++;
    }else if(S[i]=='G'){
      G[i]++;
    }else if(S[i]=='B'){
      B[i]++;
    }
    if(i==N-1)break;
    R[i+1]=R[i];
    G[i+1]=G[i];
    B[i+1]=B[i];
  }
  long long int count=0;
  for(int i=0;i<N;i++){
    for(int j=i+1;j<N;j++){
      if(S[i]!=S[j]){
        if(S[i]!='R'&&S[j]!='R'){
          if(2*j-i<N&&2*j-i>0){
            if(R[2*j-i]-R[2*j-i-1]==1){
              count --;
            }
          }
          count += R[N-1]-R[j];
        }else if(S[i]!='G'&&S[j]!='G'){
          if(2*j-i<N&&2*j-i>0){
            if(G[2*j-i]-G[2*j-i-1]==1){
              count --;
            }
          }
          count += G[N-1]-G[j];
        }else if(S[i]!='B'&&S[j]!='B'){
          if(2*j-i<N&&2*j-i>0){
            if(B[2*j-i]-B[2*j-i-1]==1){
              count --;
            }
          }
          count += B[N-1]-B[j];
        }
      }
    }
  }
  cout << count;
}


Measured memory_bytes: 3676
def i():
	return int(input())
def i2():
	return map(int,input().split())
def s():
	return str(input())
def l():
	return list(input())
def intl():
	return list(int(k) for k in input().split())

h,w = i2()
a = ""
for _ in range(w+2):
	 a += "#"
print(a)
b = "#"
for i in range(h):
	c = s()
	b += c + "#"
	print(b)
	b = "#"
print(a)


Measured memory_bytes: 9028
#include <bits/stdc++.h>
#define all(x) begin(x), end(x)
#define dbg(x) cerr << #x << " = " << x << endl
#define _ << ' ' <<
using namespace std;
using ll = long long;
using vi = vector<int>;

int cnt[40];

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s;
    cin >> s;
    for (int i = 0; i < s.size(); ++i)
        cnt[s[i] - 'a']++;
    for (int i = 0; i < 40; ++i)
        if (cnt[i] % 2)
            return cout << "No", 0;
    cout << "Yes";
}


Measured memory_bytes: 256
package main

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

func main() {
	defer stdout.Flush()
	a := readInt()
	b := readInt()
	_ = readInt()
	k := readInt()
	var ans int64
	if k%2 == 1 {
		ans = (b - a)
	} else {
		ans = (a - b)
	}
	if ans > 1000000000000000000 {
		println("Unfair")
	} else {
		println(ans)
	}
}

var (
	readString func() string
	stdout     *bufio.Writer
)

func init() {
	readString = newReadString(os.Stdin)
	stdout = bufio.NewWriter(os.Stdout)
}

func newReadString(ior io.Reader) func() string {
	r := bufio.NewScanner(ior)
	r.Split(bufio.ScanWords)

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}

func readInt() int64 {
	i, err := strconv.ParseInt(readString(), 0, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func printf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(stdout, f, args...)
}

func println(args ...interface{}) (int, error) {
	return fmt.Fprintln(stdout, args...)
}


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

int main() {
	long int n,p,q,r,ans;
  	cin >>n;
  	p=n/3;
  	q=n/5;
  	r=n/15;
  
  ans=n*(n+1)/2-3*p*(p+1)/2-5*q*(q+1)/2+15*r*(r+1)/2;
  cout <<ans<<endl;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<n; i++)
typedef long long ll;
typedef pair<int, int> P;
 
int main(){
	  int x;
	    cin >> x;
			if(x>=30)	cout << "Yes" << endl;
			else 	    cout << "No" << endl;
      return 0;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
template<typename T> inline bool chmax(T& a,T b) { if (a < b) { a = b; return true; } return false; }
template<typename T> inline bool chmin(T& a,T b) { if (a > b) { a = b; return true; } return false; }

int main(){
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    int dx = abs(a-c), dy = abs(b-d);
    string e(dy, 'U'), f(dx, 'R'), g(dy, 'D'), h(dx, 'L');
    cout << e << f << g << h << 'D' << f << 'R' << e << 'U' << 'L' << 'U' << 'L' << h << g << 'D' << 'R' << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cstdint>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cmath>
#include <cstdlib>
#include <sstream>
#include <functional>
#include <bitset>
#include <queue>

#include <boost/range/irange.hpp>
using boost::irange;

#include <boost/utility/string_ref.hpp>
using string_view = boost::string_ref;

#include <boost/function_output_iterator.hpp>

using namespace std;

struct sushi_t {
    int kind = 0;
    int deliciousness = 0;
};

struct greater_deliciousness
{
    bool operator()(const sushi_t& a, const sushi_t& b) const { return a.deliciousness > b.deliciousness; }
};
struct less_deliciousness
{
    bool operator()(const sushi_t& a, const sushi_t& b) const { return a.deliciousness < b.deliciousness; }
};

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

    int n, k;
    cin >> n >> k;

    vector<sushi_t> ss(n);
    for(auto& s : ss)
    {
        cin >> s.kind >> s.deliciousness;
    }

    sort(begin(ss), end(ss), greater_deliciousness());

    priority_queue<int, vector<int>, greater<int>> removable_sushi;
    unordered_set<int> kinds;
    int64_t deliciousness = 0;
    for(auto i : irange(0, k))
    {
        deliciousness += ss[i].deliciousness;
        if(kinds.find(ss[i].kind) != end(kinds))
            removable_sushi.push(ss[i].deliciousness);
        else
            kinds.insert(ss[i].kind);
    }
    uint64_t max_satisfaction = deliciousness + kinds.size() * kinds.size();
    //cout << kinds << ':' << deliciousness << " + " << (kinds.size() * kinds.size()) << '\n';
    for(auto i : irange(k, n))
    {
        if(removable_sushi.empty())
            break;
        if(kinds.find(ss[i].kind) != end(kinds))
            continue;

        kinds.insert(ss[i].kind);
        deliciousness += ss[i].deliciousness;
        deliciousness -= removable_sushi.top();
        removable_sushi.pop();
        max_satisfaction = max(max_satisfaction, deliciousness + kinds.size() * kinds.size());
        //cout << kinds << ':' << deliciousness << " + " << (kinds.size() * kinds.size()) << '\n';
    }

    cout << max_satisfaction << '\n';

    return 0;
}


Measured memory_bytes: 4748
#include <iostream>
#include <cstdio>
#include <array>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <cmath>
#include <string>
#include <algorithm>
#include <numeric>
#include <bitset>
#include <chrono>

using namespace std;
using lli = long long int;
using ulli = unsigned long long int;

namespace atcoder {
	void judge_outer(bool judge_exp, string ok = "Yes", string ng = "No") {
		if (judge_exp) {
			cout << ok << endl;
		} else {
			cout << ng << endl;
		}
	}

	int ncr(int left, int right) {
		right = min(left - right, right);
		int ans = 1;
		for (int i = 1; i <= right; i++) {
			ans = ans * (left - right + i) / i;
		}
		return ans;
	}

	const int LIMIT = 1000000256;
	const int tenfive = 100100;
}

using namespace atcoder;

int main(void) {
	int EC[300300] = {};
	int WC[300300] = {};
	string str;
	int N;
	cin >> N;
	cin >> str;
	for (int i = 0; i < N; i++) {
		if (str[i] == 'W')
			WC[i] = 1;
		else
			EC[i] = 1;
	}
	for (int i = 1; i < N; i++) {
		int j = N - 1 - i;
		WC[i] = WC[i] + WC[i - 1];
		EC[j] = EC[j] + EC[j + 1];
	}
	int ans = min(EC[0],WC[N-1]);
	for (int i = 1; i < N - 1; i++){
		if (ans > WC[i - 1] + EC[i + 1])
			ans = WC[i - 1] + EC[i + 1];
	}
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 3204
#include <iostream>
#include <vector>

int main(){
  int n;
  std::cin >> n;
  std::vector<int> a;
  int temp;
  while(std::cin >> temp)
    a.push_back(temp);
  double sum = 0;
  for(auto i : a)
    sum += 1/(double)i;
  std::cout << 1/sum << std::endl;
  return 0;
}


Measured memory_bytes: 256
import * as fs from 'fs';

namespace AtCoder.abc098 {

    export class Program {
        args: string[];

        constructor(args: string[]) {
            this.args = args;
        }

        /**
         * in
         * 3 1
         * out
         * 4
         */
        main(): void {
            const [a, b]: number[] = this.args[0].split(' ').map(Number);
            console.log(~~Math.max(...[a + b, a - b, a * b]));
        }
    }

}

const args = fs.readFileSync('/dev/stdin', 'utf8').trim().split('\n');
const prg = new AtCoder.abc098.Program(args);
prg.main();




Measured memory_bytes: 7500
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define RFOR(i,a,b) for(int i=(a);i>=(b);--i)
#include <bits/stdc++.h> 
#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 RREP(i,n) for(int i=(n);i>0;--i)
#define CI cin>> 
#define CO cout<<
#define EN <<endl 
#define all(x) (x).begin(),(x).end() 
using namespace std;
template <typename T> istream& operator >> (istream& is, vector<T>& vec) { for (T& x : vec) is >> x; 	return is; }
using ll = long long;

int main() {
	int a, b;
	CI a >> b;
	int ans = 1;
	int tmp=1;
	for (int i = 0; i < a; i++) { ans = (ans * 100); tmp = ans; }

	ans=ans * b;
	if (b == 100) { ans += tmp; }

	CO ans EN;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<int,int> Pi;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define fi first
#define se second
#define endl "\n"

template<typename T> inline bool chmax(T &a, T b){if(a<b){a=b;return true;}return false;}
template<typename T> inline bool chmin(T &a, T b){if(a>b){a=b;return true;}return false;}
template<typename T> ostream& operator<<(ostream& s,const complex<T>& d) {return s<<"("<<d.real()<<", "<<d.imag()<< ")";}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const pair<T1,T2>& d) {return s<<"("<<d.first<<", "<<d.second<<")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& d){
	int len=d.size();
	rep(i,len){
		s<<d[i];if(i<len-1) s<<" ";
	}
	return s;
}
template<typename T> ostream& operator<<(ostream& s,const vector<vector<T>>& d){
	int len=d.size();
	rep(i,len){
		s<<d[i]<<endl;
	}
	return s;
}
template<typename T> ostream& operator<<(ostream& s,const set<T>& v){
	s<<"{ ";
	for(auto itr=v.begin();itr!=v.end();++itr) {
		if (itr!=v.begin()) {s<< ", ";}
		s<<(*itr);
	}
	s<<" }";
	return s;
}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const map<T1,T2>& m){
	s<<"{"<<endl;
	for(auto itr=m.begin();itr!=m.end();++itr){
		s<<" "<<(*itr).first<<" : "<<(*itr).second<<endl;
	}
	s<<"}"<<endl;
	return s;
}

const ll mod=1e9+7;
const ll inf=1e17;
const int INF=1e9;
const double PI=acos(-1);
const double EPS=1e-10;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int a,b;
	cin>>a>>b;
	if(a+b==15) cout<<"+"<<endl;
	else if(a*b==15) cout<<"*"<<endl;
	else cout<<"x"<<endl;
}

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


int main() {
string s;
cin >> s;
int ans = 0;
if(s[0] == 'R'){
        ans++;
    if(s[1] == 'R'){
        ans++;
        if(s[2] == 'R'){
            ans++;
        }
    }
}
else if(s[0] != 'R'){
    if(s[1] == 'R'){
        ans++;
      if(s[2] == 'R'){
          ans++;
      }
    }
    else if(s[1] != 'R'){
        if(s[2] == 'R'){
            ans++;
        }
    }
}
else{
    ans = 0;
}

cout << ans << endl;

}


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

int main()
{
    int x,a,b;
	cin>>x;
	cin>>a;
	cin>>b;
	int mon=x-a;
	int cont=mon/b;
	int ans=mon-cont*b;
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define PB push_back
#define MP make_pair
#define rep(i,n) for (int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
int main(){
  string s;
  while(cin>>s){
    int ans[2],jo=0,io=0;
    ans[0]=ans[1]=0;
    for(int i=2;i<s.size();i++){
      if(s[i-2]=='J'&&s[i-1]=='O'&&s[i]=='I')ans[0]++;
      if(s[i-2]=='I'&&s[i-1]=='O'&&s[i]=='I')ans[1]++;
    }
    cout<<ans[0]<<endl<<ans[1]<<endl;
  }
  return 0;
}

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

int main() {
  int N,M;
  cin >> N >> M;
  int H[N],A[M],B[M];
  rep(i,N) cin >> H[i];
  rep(i,M){
    int a,b;
    cin >> a >> b;
    A[i] = a - 1;B[i] = b - 1;
  }
  int used[N];
  rep(i,N) used[i] = 0;
  rep(i,M){
    if(H[A[i]] <= H[B[i]] ) used[A[i]] = 1;
    if(H[B[i]] <= H[A[i]] ) used[B[i]] = 1;
  }
  int cnt = 0;
  rep(i,N){
    if(used[i]==0){
      cnt++;
    }
  }
  cout << cnt << endl;
  return 0;
}

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

int main(){
	int n;	cin >> n;
	int a[n] ,b[n],c[n];
	for(int i=0; i<n; i++	)cin >> a[i] >> b[i] >> c[i];
	
	int dp[n][3];	memset(dp,0,sizeof(dp));
	for(int i=0; i<n; i++){
		for(int j=0 ;j<3; j++){
			if(!i){
				if(j==0)	dp[i][j]  = a[i];
				else if(j==1)	dp[i][j] = b[i];
				else	dp[i][j] =c[i];
			}
			else{
				for(int k=0;k <3; k++){
					if(j==k)	continue;
					if(j==0)	dp[i][j] = max(dp[i][j] , dp[i-1][k] + a[i]);
					if(j==1)	dp[i][j] = max(dp[i][j] , dp[i-1][k] + b[i]);
					if(j==2)	dp[i][j] = max(dp[i][j] , dp[i-1][k] + c[i]);
				}
			}
		}
	}
	int ans=0;
	ans = max(ans, dp[n-1][0]);
	ans = max(dp[n-1][1],max(ans, dp[n-1][2]));
	cout<<ans;
}

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


int main()
{
    int a, b;cin>>a>>b;
    if(a==1||b==1){
        if(a==1&&b!=1){
            cout<<"Alice";
        }
        if(b==1&&a!=1){
            cout<<"Bob";
        }
        if(a==b){
            cout<<"Draw";
        }
    }
    else{
        if(a>b){
            cout<<"Alice";
        }
        if(a<b){
            cout<<"Bob";
        }
        if(a==b){
            cout<<"Draw";
        }
    }
    return 0;
}


Measured memory_bytes: 256
import bisect


def eratosthenes_generator():
    n = 3
    h = {}
    while True:
        m = n
        if n in h:
            b = h[n]
            m += 2 * b
            while m in h:
                m += 2 * b
            h[m] = b
            del h[n]
        else:
            m += 2 * n
            while m in h:
                m += 2 * n
            h[m] = n
            yield n
        # print(n, h)
        n += 2


ps = {2}
like2017s = [3]
for p in eratosthenes_generator():
    if p % 4 == 1 and (p + 1) // 2 in ps:
        like2017s.append(p)
    ps.add(p)
    if p >= 1e5:
        break
# print(like2017s)

q = int(input())
buf = []
for l, r in (map(int, input().split()) for _ in range(q)):
    li = bisect.bisect_left(like2017s, l)
    ri = bisect.bisect(like2017s, r)
    # if like2017s[li] == l:
    #     li -= 1
    buf.append(ri - li)
    # print(li, ri)
print('\n'.join(map(str, buf)))


Measured memory_bytes: 14824
data = list(map(int, input().split()))
K = int(input())

flag = 0
count = 0

while flag == 0 and count < K:
    if data[1] <= data[0]:
        data[1] *= 2
    elif data[2] <= data[1]:
        data[2] *= 2
    if data[0] < data[1] and data[1] < data[2]:
        flag = 1
    count += 1
    
if flag == 1:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 9200
from collections import defaultdict
from collections import deque
from collections import Counter
import math
import itertools

def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()
x = readInt()

print((x+1)%2)

Measured memory_bytes: 9452
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin>>n;
	
	while(true)
	{ bool isprime=true;
	for(long long i=2;i<n;i++)
	
       if(n%i==0)
       {isprime=false;}
       	
    if(isprime)break;
    	
    n++;
    
}
cout<<n<<endl;
return 0;
} 


Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var a, b, c int
	fmt.Scan(&a, &b, &c)
	if a == b {
		fmt.Println(c)
	} else if b == c {
		fmt.Println(a)
	} else {
		fmt.Println(b)
	}
}


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

#include <bits/stdc++.h>

using namespace std;

#ifdef LOCAL
#include <prettyprint.hpp>
#define debug(...)  cerr << "[" << #__VA_ARGS__ << "]: ", d_err(__VA_ARGS__);
#else
#define debug(...) 83;
#endif

void d_err() {
    cerr << endl;
}

template <typename H, typename... T>
void d_err(H h, T... t) {
    cerr << h << " ";
    d_err(t...);
}

#define ALL(x) (x).begin(), (x).end()
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define bcnt __builtin_popcountll

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<ll,ll> Pll;
typedef pair<int,int> Pin;

ll INF = 1e16;
int inf = 1e9;
ll MOD = 1e9+7;


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

    ll N;
    cin >> N;

    queue<ll> que;
    que.push(3);
    que.push(5);
    que.push(7);

    vi vv = {3, 5, 7};

    ll ans = 0;
    while(!que.empty()) {
        ll x = que.front(); que.pop();

        if (x > N) continue;

        ll c = x;
        bitset<3> f;
        while(c) {
            f[c % 10 / 2 - 1] = true;
            c /= 10;
        }

        if (f.count() == 3) ans++;

        for (auto e: vv) {
            que.push(x * 10 + e);
        }
    }

    cout << ans << endl;

}


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

const int MAXN = 20;

char s[MAXN];
int main(){
	scanf("%s", s);
	
	int m = 10 * (s[5] - '0') + (s[6] - '0');
	if(m > 4)printf("TBD\n");
	else printf("Heisei\n");
	
	return 0;
}


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

int n;
int a[100000];
long long b[100000], c[100000];

int main()
{
	cin >> n;

	for (int i = 0; i < n; i++)
		cin >> a[i];

	for (int i = 0; i < n; i++) {
		if (i < 2)
			b[i] = a[i];
		else
			b[i] = b[i - 2] + a[i];
	}

	for (int i = n - 1; i >= 0; i--) {
		if (i > n - 3)
			c[i] = a[i];
		else
			c[i] = c[i + 2] + a[i];
	}

	for (int i = 0; i < n; i++) {
		long long m = a[i];

		if (i < n - 1)
			m -= c[i + 1];
		if (i < n - 2)
			m += c[i + 2];
		if (i > 1)
			m -= b[i - 2];
		if (i > 0)
			m += b[i - 1];

		cout << m << endl;
	}

	return 0;
}

Measured memory_bytes: 3328
/*
 * 16-11-20_chu2_G.cpp
 *
 *  Created on: 2016/11/20
 *      Author: ryoma
 */

#include<iostream>
#include<algorithm>
#include<vector>

using namespace std;

typedef long long ll;

typedef vector<int> vec;
typedef vector<vec> mat;

const int MOD=998244353;


int mul(ll x,ll y){
	return (x%MOD)*(y%MOD)%MOD;
}

mat mat_mul(mat &A,mat& B){
	mat C(A.size(),vec(B[0].size()));
	for(int i=0;i<A.size();i++){
		for(int k=0;k<B.size();k++)
			for(int j=0;j<B[0].size();j++){
				C[i][j] = (C[i][j]+mul(A[i][k],B[k][j]))%MOD;
			}
	}
	return C;
}

mat pow(mat A,ll n){
	mat B(A.size(),vec(A.size()));
	for(int i=0;i<A.size();i++){
		B[i][i] = 1;
	}
	while(n>0){
		if(n&1)
			B=mat_mul(B,A);
		A=mat_mul(A,A);
		n>>=1;
	}
	return B;
}

int Fib(ll k){
	mat A(2,vec(2));
	A[0][0] = 1;
	A[0][1] = 1;
	A[1][0] = 1;
	A[1][1] = 0;
	A = pow(A,k);
	return A[1][0];
}

const int MAX_N=200010;

int main(){
	int n;
	ll m;
	cin >>n>>m;
	vector<int> inv(MAX_N);
	inv[1] = 1;
	for(int i=2;i<MAX_N;i++)
		inv[i] = mul(inv[MOD%i],MOD-MOD/i);
	int ans = Fib(m+2*(n-1));
	int C = 1;
	for(int i=0;i<=n-2;i++){
			ans =(ans+ mul(C,MOD-Fib(2*(n-1)-2*i))) %MOD;
			C = mul(C,mul(m+i,inv[i+1]));
	}
	cout << ans<< endl;
	return 0;
}




Measured memory_bytes: 1152
#pragma GCC optimize("O3")
#include<bits/stdc++.h> 
using namespace std;
using ll=long long;
using P=pair<ll,ll>;
template<class T> using V=vector<T>; 
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
const ll inf=(1e18);
//const ll mod=998244353;
const ll mod=1000000007;
ll GCD(ll a,ll b) {return b ? GCD(b,a%b):a;}
ll LCM(ll c,ll d){return c/GCD(c,d)*d;}
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
V<int> g[100005];
deque<int> deq;
bool used[100005];
void solve(int cur,bool front){
    bool ok=true;
    for(int v:g[cur]){
        if(used[v])continue;
        if(front)deq.push_front(v+1);
        else deq.push_back(v+1);
        used[v]=true;
        solve(v,front);
        ok=false;
        break;
    }
    if(cur==0){
        for(int v:g[cur]){
        if(used[v])continue;
        used[v]=true;
        deq.push_back(v+1);
        solve(v,false);
        break;
       }
    }
}
int main(){
    int n,m;
    cin>>n>>m;
    for(int i=0;i<m;i++){
        int a,b;
        cin>>a>>b;
        g[--a].push_back(--b);
        g[b].push_back(a);
    }
    deq.push_back(1);
    used[0]=true;
    solve(0,1);
    cout<<deq.size()<<"\n";
    while(deq.size()){
        cout<<deq.front()<<(deq.size()==1?"\n":" ");
        deq.pop_front();
    }
}

Measured memory_bytes: 18036
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int d1[500],d2[500],i,j,k,m,n;
    cin>>n;
    for(i=0;i<n;i++)
        cin>>d1[i]>>d2[i];
    k=0;
    bool run=false;
    m=0;
    for(i=0;i<n;i++)
    {
        if(d1[i]==d2[i] && run==false)
        {
            run=true;
            k++;

        }
        else if((d1[i]==d2[i])&& run==true)
            k++;
        else if(d1[i]!=d2[i])
        {
            if(k>m)
                m=k;
            k=0;

        }
    }
    if(k>m)
        m=k;
    if(m>=3)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
}


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

int main() { 
string S;
cin>>S;
if(S[0]=='7'){
  cout<<"Yes"<<endl;
}
else if(S[1]=='7'){
  cout<<"Yes"<<endl;
}
else if(S[2]=='7'){
  cout<<"Yes"<<endl;
}
else{
  cout<<"No"<<endl;
}
 return 0;

}

Measured memory_bytes: 3604
#include <stdio.h>
#define CUP 3

int cup[CUP];

void init();
void swap(char a, char b);
void answer();

int main(int argc, const char *argv[])
{
	char ch1, ch2;
	init();
	while(scanf("%c,%c\n", &ch1, &ch2)!=EOF){
		swap(ch1, ch2);
	}
	answer();	
	return 0;
}

void init()
{
	cup[0] = 1; // cup A
	cup[1] = 0; // cup B
	cup[2] = 0; // cup C
}

void swap(char a, char b)
{
	int c1 = a-'A', c2 = b-'A';
 	int tmp;
	
	tmp = cup[c1];
	cup[c1] = cup[c2];
	cup[c2] = tmp;	
}

void answer()
{
	if(cup[0]) printf("A\n");
	if(cup[1]) printf("B\n");
	if(cup[2]) printf("C\n");
}

Measured memory_bytes: 0