akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>

int main() 
{
	int i, k = 0;
	double h,arr[50] = { 0 };

	while (scanf("%lf", &h) != EOF)
	{
		arr[k] = h;
		++k;
	}

	for (i = 0; i < k; i++)
	{
		if (arr[i] <= 48.00)
		{
			printf("light fly\n");
		}
		else if (arr[i] <=51.00 )
		{
			printf("fly\n");
		}
		else if (arr[i] <=54.00 )
		{
			printf("bantam\n");
		}
		else if (arr[i] <=57.00 )
		{
			printf("feather\n");
		}
		else if (arr[i] <=60.00)
		{
			printf("light\n");
		}
		else if (arr[i] <=64.00)
		{
			printf("light welter\n");
		}
		else if (arr[i] <= 69.00)
		{
			printf("welter\n");
		}
		else if (arr[i] <=75.00)
		{
			printf("light middle\n");
		}
		else if (arr[i] <=81.00)
		{
			printf("middle\n");
		}
		else if (arr[i] <= 91.00)
		{
			printf("light heavy\n");
		}
		else 
		{
			printf("heavy\n");
		}
		
	}

	return 0;
}


Measured memory_bytes: 608
#include <iostream>
#include <algorithm>
using namespace std;
int main(void){
    // Your code here!
    int n;
    std::cin >> n;
    int a[200];
    for (int i = 0; i < n; i++) {
        std::cin >> a[i];
        int cnt=0;
        while(a[i]%2!=1){
            a[i]=a[i]/2;
            cnt++;
        }
        a[i]=cnt;
    }
    sort(a,a+n);
    std::cout << a[0] << std::endl;
    
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
  char s[110];
  int i=0;
  scanf("%s",s);
  while(s[i]){
    //printf("%d",i);
    if(i%2){
      if(s[i]=='R'){
        puts("No");
        return 0;
      }
    }else{
      if(s[i]=='L'){
        puts("No");
        return 0;
      }
    }
    i++;
  }
  puts("Yes");
  return 0;
}


Measured memory_bytes: 128
#include <iostream>
using namespace std;
const int INF = 1e9;

int main() {
    int N;
    string S;
    cin >> N >> S;
    int sumE[N+1] = {};
    for (int i = 0; i < N; i++) {
        if (S[i] == 'E') sumE[i + 1] = sumE[i] + 1;
        else sumE[i + 1] = sumE[i];
    }
    int ans = INF;
    for (int i = 1; i <= N; i++) {
        ans = min(ans, i - sumE[i-1] - 1 + sumE[N] - sumE[i]);
    }
    cout << ans << endl;
}

Measured memory_bytes: 1796
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pli = pair<ll, int>;
using pil = pair<int, ll>;
using uint = unsigned int;
template <typename T>
using Graph = vector<vector<T>>;
const int MOD = 1e9 + 7;
const ld PI = acosl(-1);

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

    int a;
    cin >> a;
    cout << a + a * a + a * a * a << endl;

    return 0;
}


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

int main()
{
    int a,b;
    cin >> a >> b;
    int c;
    if(b < 10)
        c = a * 10 + b;
    else if(b < 100)
        c = a * 100 + b;
    else
        c = a * 1000 + b;

    for(int i = 1; i < c; i++)
    {
        if(c == i * i)
        {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 3620
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
using bint = boost::multiprecision::cpp_int;
using ll = long long;
using pint = pair<int, int>;
using pll = pair<ll, ll>;
#define rep(i,n) for (int i = 0; i < (n); i++)
#define repSE(i,s,n) for (int i = (s); i < (n); i++)
#define rrepSE(i,s,e) for (int i = (s); i > (e); i--)
#define ssort(v) sort(v.begin(), v.end())
#define gsort(v) sort(v.rbegin(), v.rend())
template<typename T> istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &vec){ os << "["; for (auto v : vec) os << v << ","; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const deque<T> &vec){ os << "deq["; for (auto v : vec) os << v << ","; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &pa){ os << "(" << pa.first << "," << pa.second << ")"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const unordered_map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }
template<typename T> bool chmax(T &m, const T q) { if (m < q) {m = q; return true;} else return false; }
template<typename T> bool chmin(T &m, const T q) { if (q < m) {m = q; return true;} else return false; }

int main()
{
    int n, m;
    cin >> n >> m;
    vector<bool> acFlag(n, false);
    map<int,int> wa;
    int pen = 0, ac = 0;
    rep(i,m) {
        int p;
        string s;
        cin >> p >> s;
        if (acFlag[p]) continue;
        if (s == "WA") wa[p]++;
        if (s == "AC") {
            ac++;
            pen += wa[p];
            acFlag[p] = true;
        }
    }
    cout << ac << " " << pen << "\n";
    return 0;
}


Measured memory_bytes: 8184
s = input().split() #s_1 s_2を分割して取得し、sに値を入れる


if  0 < int(s[0]) < 10 and 0 < int(s[1]) < 10:
    i = int(s[0]) * int(s[1])   
    print(i)
else:
    print(-1)


Measured memory_bytes: 2940
n=int(input())
a=list(map(int,input().split()))
a.sort(reverse=True)
if n==2:
    exit(print(max(a)))
b=[a[0],a[1]]
ans=a[0]
a=a[1:]
from math import floor
for i in range(n-2):
    num=floor(i/2)
    ans+=a[num]
print(ans)

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

double E[150000],ANS[1500000];
vector<int> g[150000];

double dfs1(int idx,int par)
{
	double cnt = 0;
	for(auto &i:g[idx])
	{
		if(par==i)continue;
		E[idx] += dfs1(i,idx);
		cnt++;
	}
	if(cnt!=0)E[idx] /= cnt;
	return E[idx]+1.0;
}

void dfs2(int idx,double d_par,int par)
{
	double sum = 0;
	int cnt = 0;
	if(idx!=0)cnt++;
	for(auto &i:g[idx])
	{
		if(i==par)continue;
		sum += E[i];
		cnt ++;
	}
	if(idx!=0)sum += d_par ;
	//cout<<idx<<' '<<d_par<<' '<<sum<<' '<<cnt<<endl;
	ANS[idx] = (sum+(double)cnt)/(double)(cnt);
	// ANS[idx] = sum;
	for(auto &i:g[idx])
	{
		if(i==par)continue;
		if(cnt!=1)dfs2(i,(sum-E[i]+cnt-1)/(cnt-1),idx);
		else dfs2(i,(sum-E[i])/cnt,idx);
	}
}

int main()
{
	int n;
	cin >> n;
	for(int i = 0;i<n-1;i++)
	{
		int x,y;
		cin >> x >> y;
		x--;y--;
		g[x].push_back(y);
		g[y].push_back(x);
	}
	dfs1(0,-1);
	dfs2(0,0,-1);
	for(int i = 0;i<n;i++)printf("%.10lf\n",ANS[i]);//cout<<endl;
	//for(int i = 0;i<n;i++)cout<<E[i]<<endl;
	return 0;
}

Measured memory_bytes: 20864
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <map>
#include <numeric>
#include <cmath>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <complex>
#include <string.h>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <iomanip>
#include <sys/time.h>
#include <tuple>
#include <random>
using namespace std;

#define endl '\n'
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define UNIQ(v) (v).erase(unique((v).begin(), (v).end()), (v).end())

typedef long long ll;
typedef long double ld;
typedef pair<int, int> P;
typedef complex<double> comp;
typedef vector< vector<ld> > matrix;
struct pairhash {
public:
    template<typename T, typename U>
    size_t operator()(const pair<T, U> &x) const {
	size_t seed = hash<T>()(x.first);
	return hash<U>()(x.second) + 0x9e3779b9 + (seed<<6) + (seed>>2);
    }
};
const int inf = 1e9 + 9;
const ll mod = 1e9 + 7;
const double eps = 1e-8;
const double pi = acos(-1);

int n;
int a[100100];

int solve() {
    int i = 0, res = 1;
    while (i < n-1) {
        while (i < n-1 && a[i] == a[i+1]) i++;
        if (a[i] < a[i+1]) {
            while (i < n-1 && a[i] <= a[i+1]) i++;
        } else {
            while (i < n-1 && a[i] >= a[i+1]) i++;
        }
        if (i < n-1) res++;
        i++;
    }
    return res;
}

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

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

    input();
    cout << solve() << endl;
}


Measured memory_bytes: 640
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time

sys.setrecursionlimit(10**7)
inf = 10**10
mod = 10**9 + 7

class UnionFind:
    def __init__(self, size):
        self.table = [-1 for _ in range(size)]

    def find(self, x):
        if self.table[x] < 0:
            return x
        else:
            self.table[x] = self.find(self.table[x])
            return self.table[x]

    def union(self, x, y):
        s1 = self.find(x)
        s2 = self.find(y)
        if s1 != s2:
            if self.table[s1] <= self.table[s2]:
                self.table[s1] += self.table[s2]
                self.table[s2] = s1
            else:
                self.table[s2] += self.table[s1]
                self.table[s1] = s2
            return True
        return False

    def subsetall(self):
        a = []
        for i in range(len(self.table)):
            if self.table[i] < 0:
                a.append((i, -self.table[i]))
        return a

def f():
    n,m = list(map(int, input().split()))
    a = list(range(m+1))
    g = [False]*(m+1)
    uf = UnionFind(m+1)
    mi = None
    for _ in range(n):
        c = list(map(int, input().split()))
        if not mi:
            mi = c[1]
        g[c[1]] = True
        if c[0] > 1:
            for i in range(c[0]-1):
                g[c[2+i]] = True
                uf.union(c[1], c[2+i])

    t = uf.find(mi)

    for i in range(m+1):
        if not g[i]:
            continue
        if uf.find(i) != t:
            return 'NO'
    return 'YES'



print(f())


Measured memory_bytes: 13956
#include <bits/stdc++.h>
using namespace std;
#define SELECTER(_1, _2, _3, SELECT, ...) SELECT
#define REP1(i, n) for(int (i)=0; (i)<(n); (i)++)
#define REP2(i, a, b) for(int (i)=(a); (i)<(b); (i)++)
#define REP(...) SELECTER(__VA_ARGS__, REP2, REP1,) (__VA_ARGS__)
#define MOD 1'000'000'007

template <class T> ostream& operator<<(ostream& os, const vector<T>& v){ os << "{"; for(size_t i=0; i<v.size(); i++) os << v[i] << (i+1==v.size() ? "" : ", "); os << "}"; return os; }
template <class T, class U> ostream& operator<<(ostream& os, const pair<T, U>& p){ return os << "{" << p.first << ", " << p.second << "}"; }

int main(){
    long long N;
    cin >> N;
    vector<long long> A(N);
    REP(i, N) cin >> A[i];
    vector<long long> B(N+1);
    REP(i, N) B[A[i]]++;
    long long def = 0;
    REP(i, N+1) def += B[i]*(B[i]-1)/2;
    REP(i, N){
        long long diff = -(B[A[i]]-1);
        cout << def + diff << endl;
    }
    return 0;
}


Measured memory_bytes: 5760
#include <bits/stdc++.h>
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define rep(i,n) for (int i=0;i<(int)(n);i++)
#define codefor int test;scanf("%d",&test);while(test--)
#define yn(ans) if(ans)printf("Yes\n");else printf("No\n")
#define YN(ans) if(ans)printf("YES\n");else printf("NO\n")
#define umap unordered_map
#define uset unordered_set
using namespace std;
using ll = long long;
const int MOD=1000000007;
//入力系
void scan(int& a){scanf("%d",&a);}
void scan(long long& a){scanf("%lld",&a);}
template<class T> void scan(T& a){cin>>a;}
template<class T> void scan(vector<T>& vec){for(auto&& it:vec)scan(it);}
void in(){}
template <class Head, class... Tail> void in(Head& head, Tail&... tail){scan(head);in(tail...);}
//出力系
void print(const int& a){printf("%d",a);}
void print(const long long& a){printf("%lld",a);}
void print(const double& a){printf("%.15lf",a);}
template<class T> void print(const T& a){cout<<a;}
template<class T> void print(const vector<T>& vec){if(vec.empty())return;print(vec[0]);for(auto it=vec.begin();++it!= vec.end();){putchar(' ');print(*it);}}
void out(){putchar('\n');}
template<class T> void out(const T& t){print(t);putchar('\n');}
template <class Head, class... Tail> void out(const Head& head,const Tail&... tail){print(head);putchar(' ');out(tail...);}
//デバッグ系
template<class T> void dprint(const T& a){cerr<<a;}
template<class T> void dprint(const vector<T>& vec){if(vec.empty())return;cerr<<vec[0];for(auto it=vec.begin();++it!= vec.end();){cerr<<" "<<*it;}}
void debug(){cerr<<endl;}
template<class T> void debug(const T& t){dprint(t);cerr<<endl;}
template <class Head, class... Tail> void debug(const Head& head, const Tail&... tail){dprint(head);cerr<<" ";debug(tail...);}

vector<long long int> fibo(100001,-1);
long long int fibonatti(long long int n){
    if(fibo[n]!=-1){
        return fibo[n];
    }else if(n==0){
        fibo[0]=1;
        return 1;
    }else if(n==1){
        fibo[1]=1;
        return 1;
    }else if(n>=2){
        fibo[n]=(fibonatti(n-1)+fibonatti(n-2))%MOD;
        return fibo[n];
    }
}
 
int main(){
    ll n,m;
    in(n,m);
    vector<int> vec(m);
    in(vec);
    fibonatti(100000);
    vec.push_back(n+1);
    ll target=0,ans=1;
    rep(i,m+1){
        if(i==0)target=vec[i]-1;
        else target=vec[i]-vec[i-1]-2;
        if(target==-1){
            ans=0;
            break;
        }
        ans*=fibo[target];
        if(ans>MOD)ans%=(ll)MOD;
    }
    out(ans);
}


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

int main() {
  ll a, b, k; cin >> a >> b >> k;

  if(k > a+b) cout << "0 0" << endl;
  else if(k > a) cout << "0 " << b-k+a << endl;
  else cout << a-k << " " << b << endl;
}


Measured memory_bytes: 3648
#include<stdio.h>
#include<algorithm>
using namespace std;
int main(void)
{
    int n,m,a[10000],b[10000],flg[10001],i,h;
	while(1){
	    scanf("%d %d",&n,&m);
		if(n==0&&m==0) break;
		for(i=2;i<=n;i++) flg[i]=0;
		for(i=0;i<m;i++){
		    scanf("%d %d",&a[i],&b[i]);
		}
		for(i=0;i<m;i++){
		    if(a[i]==1){
			    flg[b[i]]=1;
			}
		}
		h=0;
		for(i=0;i<m;i++){
		    if(flg[a[i]]==1){
			    if(flg[b[i]]==0){
				    flg[b[i]]=2;
				}
			}
			if(flg[b[i]]==1){
			    if(flg[a[i]]==0){
				    flg[a[i]]=2;
				}
			}
		}
		for(i=2;i<=n;i++){
		    if(flg[i]>0){
			    h++;
			}
		}
		printf("%d\n",h);
	}
	return 0;
}

Measured memory_bytes: 2808
#!/usr/bin/env python3
import sys


def solve(X: int):
    for r, k in zip(range(600, 2001, 200), range(8, 0, -1)):
        if X < r:
            return k
    raise

# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    X = int(next(tokens))  # type: int
    print(solve(X))

def test():
    import doctest
    doctest.testmod()

if __name__ == '__main__':
    #test()
    main()


Measured memory_bytes: 9176
import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;

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

}

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

class LazySegmentTree
{
    int n;
    using T1 = long long;
    using T2 = long long;
    std::vector<T1> node;
    std::vector<T2> lazy;

    // 遅延評価
    void eval(int k, int l, int r)
    {
        // 遅延配列が空なら終了
        if (lazy[k] == 0)
            return;
        // 遅延配列を適用
        node[k] = node[k] + lazy[k];
        if (r - l > 1)
        {
            lazy[2 * k + 1] = lazy[2 * k + 1] + lazy[k] / 2;
            lazy[2 * k + 2] = lazy[2 * k + 2] + lazy[k] / 2;
        }
        // 遅延配列初期化
        lazy[k] = 0;
    }

  public:
    LazySegmentTree(int _n)
    {
        int sz = _n;
        n = 1;
        while (n < sz)
            n *= 2;
        // 配列初期化
        node.resize(2 * n - 1, 0);
        lazy.resize(2 * n - 1, 0);
    }
    LazySegmentTree(int _n, T1 _v)
    {
        int sz = _n;
        n = 1;
        while (n < sz)
            n *= 2;
        node.resize(2 * n - 1, 0);
        lazy.resize(2 * n - 1, 0);

        for (int i = 0; i < sz; i++)
            node[i + n - 1] = _v;
        for (int i = n - 2; i >= 0; i--)
            node[i] = node[i * 2 + 1] + node[i * 2 + 2];
    }

    // 半開区間 [a, b) に対して値 val を反映させる
    void update(int a, int b, T2 val, int l = 0, int r = -1, int k = 0)
    {
        if (r < 0)
            r = n;
        // ノード k で遅延評価
        eval(k, l, r);
        if (b <= l || r <= a)
            return;
        // 区間が被覆されている場合
        if (a <= l && r <= b)
        {
            // 遅延配列更新, 評価
            lazy[k] = lazy[k] + (r - l) * val;
            eval(k, l, r);
        }
        else
        {
            // 子ノードの値を評価し, 更新
            int mid = (l + r) / 2;
            update(a, b, val, l, mid, 2 * k + 1);
            update(a, b, val, mid, r, 2 * k + 2);
            node[k] = node[2 * k + 1] + node[2 * k + 2];
        }
    }

    // 半開区間 [a, b) に対してクエリを投げる
    T1 query(int a, int b, int l = 0, int r = -1, int k = 0)
    {
        if (r < 0)
            r = n;
        eval(k, l, r);
        // 範囲外なら単位元返す
        if (b <= l || r <= a)
            return 0;
        if (a <= l && r <= b)
            return node[k];
        int mid = (l + r) / 2;
        T1 vl = query(a, b, l, mid, 2 * k + 1);
        T1 vr = query(a, b, mid, r, 2 * k + 2);
        return vl + vr;
    }
};

using namespace std;

void solve_dsl_2_g()
{
    int n, q;
    cin >> n >> q;
    LazySegmentTree lst(n);
    while (q--)
    {
        int type;
        cin >> type;
        if (type == 0)
        {
            int s, t, x;
            cin >> s >> t >> x;
            s--;
            lst.update(s, t, x);
        }
        else
        {
            int s, t;
            cin >> s >> t;
            s--;
            cout << lst.query(s, t) << endl;;
        }
    }
}

int main()
{
    solve_dsl_2_g();
}



Measured memory_bytes: 7072
#include<bits/stdc++.h>
using namespace std;
#define ll long long
namespace io{
	const int l=1<<20;
	char buf[l],*s,*t;
	inline char gc(){
		if(s==t){
			t=(s=buf)+fread(buf,1,l,stdin);
			return s==t?EOF:*s++;
		}
		return *s++;
	}
	char c;
	template<class IT>inline void gi(IT &x){
		x=0;c=gc();while(c<'0'||c>'9')c=gc();
		while('0'<=c&&c<='9'){x=(x<<1)+(x<<3)+(c^48);c=gc();}
	}
};
using io::gi;
template<class IT>inline void cmin(IT &a,IT b=0){if(a>b)a=b;}
template<class IT>inline void cmax(IT &a,IT b=0){if(a<b)a=b;}
template<class IT>inline IT   _min(IT  a,IT b=0){return a>b?b:a;}
template<class IT>inline IT   _max(IT  a,IT b=0){return a<b?b:a;}

const ll p=1000000007ll,p2=500000004ll;
inline ll expo(ll a,int b){
	ll c=1ll;
	while(b){
		if(b&1)c=c*a%p;
		b>>=1; a=a*a%p;
	}
	return c;
}
const int p0=1000000007;
const int N=200005,K=2000,M=K<<1,T=M|1,L=M<<1|1;
int d[T][T],a[N],b[N];
ll fac[L],ifa[T];
inline void upd(int &a,int b){if((a+=b)>=p0)a-=p0;}
int main(){
	int n,i,j;ll s=0ll;
	scanf("%d",&n);
	fac[0]=1ll;
	for(i=1;i< L;++i)fac[i]=fac[i-1]*i%p;
	ifa[M]=expo(fac[M],1000000005);
	for(i=M;i   ;--i)ifa[i-1]=ifa[i]*i%p;
	for(i=1;i<=n;++i){
		scanf("%d%d",&a[i],&b[i]);
		++d[K-a[i]][K-b[i]];
	}
	for(i=1;i<=M;++i)upd(d[i][0],d[i-1][0]);
	for(i=1;i<=M;++i)upd(d[0][i],d[0][i-1]);
	for(i=1;i<=M;++i)for(j=1;j<=M;++j){
		upd(d[i][j],d[i][j-1]);
		upd(d[i][j],d[i-1][j]);
	}
	for(i=1;i<=n;++i)s+=d[K+a[i]][K+b[i]];
	for(i=1;i<=n;++i)s-=fac[(a[i]+b[i])<<1]*(ifa[a[i]<<1]*ifa[b[i]<<1]%p)%p;
	printf("%lld",(s%p+p)*p2%p);
	return 0;
}

Measured memory_bytes: 64384
using System;

namespace A___Addition_and_Subtraction_Easy
{
    class Program
    {
        static void Main(string[] args)
        {
            var A_op_B = Console.ReadLine().Split();
            int A = int.Parse(A_op_B[0]), B = int.Parse(A_op_B[2]);

            Console.WriteLine(A_op_B[1] == "+" ? A + B : A - B);
        }
    }
}


Measured memory_bytes: 13140
#include <stdio.h>

int main(void)
{
	int X,Y,i,total,d=0;
	scanf("%d",&X);
	scanf("%d",&Y);
	for(i=0;i<=X;i++){
		total=i*2+(X-i)*4;
		if(total==Y){d++;break;}
	}
	if(d!=0)printf("Yes");
	else printf("No");
	return 0;
}

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

using namespace std;
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
constexpr int MOD = 1000000007;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
constexpr int dx[] = {1, 0, -1, 0, 1, 1, -1, -1};
constexpr int dy[] = {0, -1, 0, 1, 1, -1, -1, 1};

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){os << "["; for (const auto &v : vec) {os << v << ","; } os << "]"; return os; }

void solve() {
  int H, W;
  cin >> H >> W;
  vector<string> A(H);
  for (int i = 0; i < H; i++) {
    cin >> A[i];
  }

  vector<int> fH(H), fW(W);
  for(int i = 0; i < H; i++) {
    bool flag = true;
    for(int j = 0; j < W; j++) {
      if (A[i][j] != '.') {
        flag = false;
      }
    }
    if (!flag) fH[i] = 0; else fH[i] = 1;
  }

  for(int j = 0; j < W; j++) {
    bool flag = true;
    for(int i = 0; i < H; i++) {
      if (A[i][j] != '.') {
        flag = false;
      }
    }
    if (!flag) fW[j] = 0; else fW[j] = 1;
  }

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

int main() {
  std::cin.tie(0);
  std::ios::sync_with_stdio(false);
  cout.setf(ios::fixed);
  cout.precision(16);
  solve();
  return 0;
}

Measured memory_bytes: 256
//Using FeatherPad
//#include <bits/stdc++.h>
#include <iostream>
#include <iomanip>
#define problem_solving ios::sync_with_stdio(0);cin.tie(0);
#define oo (int)1e9 + 10
#define all(x) x.begin(), x.end()
using namespace std;

void solve(int case_number) {
	double r;
	cin >> r;
	cout << fixed << setprecision(20);
	cout << r * 6.28318530717958623200 << endl;
}


int main() {
	problem_solving
	int cases = 1;
	//cin >> cases;
	for(int i=0;i<cases;i++)
		solve(i + 1);
	return 0;
}



Measured memory_bytes: 3216
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <utility>
#include <vector>
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i, s, n) for(int i = s, i##_len=(n); i < i##_len; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(v) (v).begin(), (v).end()
typedef long long ll;
const int MOD = 1000000007;
using namespace std;

int main(){
    string s; cin >> s;
    REP(i, 3){
        if(s[i] == '1') s[i] = '9';
        else s[i] = '1';
    }
    cout << s << "\n";
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
 
using namespace std;
 
int main(){
	int a, b, c;
	cin >> a >> b >> c;
 
	if (a == 5 && b == 5 && c == 7) cout << "YES";
	else if (a == 5 && b == 7 && c == 5) cout << "YES";
	else if (a == 7 && b == 5 && c == 5) cout << "YES";
 
	else cout << "NO";
 
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include <math.h>
#include <stdlib.h>


main(void)
{
  long N,sum=0,i;
  
  scanf("%ld",&N);
  
  for(i=0;i<=N;i++)
  {
    if(i%3!=0 && i%5!=0)
    {
      sum=sum+i;
    }
  }
  
  printf("%ld",sum);
  
  return 0;
}


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

int main()
{
    int N,ans = 0;
    cin>>N;
    map<string,int> list;

    for(int i = 0; i < N; i++)
    {
        string S;
        cin>>S;

        auto it = list.find(S);
        if(it == list.end())
        {
            ans++;
            list.emplace(S,1);
        }
    }

    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 19096
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define countof(array) (sizeof(array) / sizeof(array[0]))
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,n,s) for(int i = s; i < (n); ++i)
#define rsrep(i,n,s) for(int i = (n)-1; i >= s; --i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define aall(a) (a), (a)+countof(a)//for array sorting
#define raall(a) (a), (a)+countof(a), greater<>()
#define show(x) cout<<#x<<" = "<<x<<endl;
#define vfind(v, a) find(all(v), a) != v.end()
#define yn(f) { if (f) puts("YES"); else puts("NO"); }
#define yns(f) { if (f) puts("Yes"); else puts("No"); }
#define show_ary(...) { cout<<#__VA_ARGS__<<" = "; for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
#define out_ary(...) { for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
#define argmax(v) distance((v).begin(), max_element(all(v)))
#define argmin(v) distance((v).begin(), min_element(all(v)))
#define vmax(v) *max_element(all(v))
#define vmin(v) *min_element(all(v))
typedef long long int ll;
typedef vector<int> vint;
typedef vector<string> vstr;
typedef vector<bool> vbool;
typedef vector<vint> vvint;
typedef vector<vstr> vvstr;
const ll LINF = 2000000000000000000ll;
const int INF = 1000000100;
const ll MOD = 1e9+7;

int main() {
    ll n, m;
    cin >> n >> m;

    ll ans;
    if (n * m == 1) ans = 1;
    else if (n == 1 || m == 1) ans = max(n, m) - 2;
    else if (n == 2 || n == 2) ans = 0;
    else ans = (n - 2) * (m - 2);

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<string>
#include<vector>
#include<list>
#include<algorithm>
#include<set>
#include<map>
#include<stack>
#include<queue>

using namespace std;

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

#define PRINT(str) printf(#str "\n")
#define yOUT PRINT(Yes)
#define nOUT PRINT(No)
#define YOUT PRINT(YES)
#define NOUT PRINT(NO)
 
#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()

int main(){
	string s;
	cin >> s;
	
	if(s <= "2019/04/30"){
		cout << "Heisei" << endl;
	}
	else cout << "TBD" << endl;
}


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

int main() {
  ll x, k, d;
  cin >> x >> k >> d;

  if(x < 0){
    x = -x;
  }
  
  ll m = x / d;
  
  if(k <= m){
    cout << x - d * k << endl;
    return 0;
  }
  
  if((k - m) % 2 == 0){
    cout << x % d << endl;
  }
  else{
    cout << -((x % d) - d) << endl;
  }
}


Measured memory_bytes: 3624
#![allow(non_snake_case)]
#![allow(unused_imports)]
use proconio::input;
use std::cmp::max;
use std::cmp::min;
use std::collections::HashMap;
use std::collections::VecDeque;

fn main() {
    input! {
        A: i64,
        B: i64,
    }

    let ans = A * B - A - B + 1;
    println!("{}", ans);
}


Measured memory_bytes: 2032
package main

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

func main() {
	var t string
	var s = bufio.NewScanner(os.Stdin)
	s.Split(bufio.ScanWords)

	if s.Scan() {
		t = s.Text()
	}

	N, err := strconv.Atoi(t)
	if err != nil {
		return
	}

	min := -1000
	max := 1000

E:
	for i := max; i >= min; i-- {
		i := i
		for j := min; j <= max; j++ {
			j := j
			// fmt.Println(i, j, i*i*i*i*i-j*j*j*j*j, N)
			if (i*i*i*i*i - j*j*j*j*j) == N {
				fmt.Println(i, j)
				break E
			}
		}
	}
}


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

long long gcd(int c, int d){
  if(d == 0) return c;
  return gcd(d, c%d);
}

int main(void){
  long long a, b, c, d;
  cin >> a >> b >> c >> d;
  long long lcm = c*d/gcd(c, d);
  cout << b - b/c - b/d + b/lcm - (a-1 - (a-1)/c - (a-1)/d + (a-1)/lcm) << endl;
  return 0;
}


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

int main()
{
int H;
int W;
int h;
int w;

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

	cin >> H;
	cin >> W;
	cin >> h;
	cin >> w;

	cout << ( H - h ) * ( W - w ) << endl;

	return 0;
}


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

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

    if (a >= 3200)
        cout << s << endl;
    else
        cout << "red" << endl;

    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <cstdio>

using namespace std;

#define maxn 1010000
#define maxb 1010
int aa[maxn], cnt[maxn], belong[maxn];
int n, m, size, bnum, now, ans[maxn];
typedef struct {
    int l, r, id;
} query;

query q[maxn];

int cmp(query a, query b) {
    return (belong[a.l] ^ belong[b.l])
               ? belong[a.l] < belong[b.l]
               : ((belong[a.l] & 1) ? a.r < b.r : a.r > b.r);
}

#define isdigit(x) ((x) >= '0' && (x) <= '9')

int read() {
    int res = 0;
    char c = getchar();
    while (!isdigit(c))
        c = getchar();
    while (isdigit(c))
        res = (res << 1) + (res << 3) + c - 48, c = getchar();
    return res;
}

void printi(int x) {
    if (x / 10)
        printi(x / 10);
    putchar(x % 10 + '0');
}

int main() {
    scanf("%d", &n);
    m = read();
    ::size = sqrt(n);
    bnum = ceil((double)n / ::size);
    for (int i = 1; i <= bnum; ++i)
        for (int j = (i - 1) * ::size + 1; j <= i * ::size; ++j) {
            belong[j] = i;
        }
    for (int i = 1; i <= n; ++i)
        aa[i] = read();
    for (int i = 1; i <= m; ++i) {
        q[i].l = read(), q[i].r = read();
        q[i].id = i;
    }
    sort(q + 1, q + m + 1, cmp);
    int l = 1, r = 0;
    for (int i = 1; i <= m; ++i) {
        int ql = q[i].l, qr = q[i].r;
        while (l < ql)
            now -= !--cnt[aa[l++]];
        while (l > ql)
            now += !cnt[aa[--l]]++;
        while (r < qr)
            now += !cnt[aa[++r]]++;
        while (r > qr)
            now -= !--cnt[aa[r--]];
        ans[q[i].id] = now;
    }
    for (int i = 1; i <= m; ++i)
        printi(ans[i]), putchar('\n');
    return 0;
}


Measured memory_bytes: 17336
'''
Created on 2020/09/15

@author: harurun
'''
import sys
pin=sys.stdin.readline

N=int(pin())
dp=[[0]*3 for _ in [0]*N]

dp[0][0],dp[0][1],dp[0][2]=map(int,pin().split())
for i in range(1,N):
  a,b,c=map(int,pin().split())
  dp[i][0]=max(dp[i-1][1]+a,dp[i-1][2]+a)
  dp[i][1]=max(dp[i-1][0]+b,dp[i-1][2]+b)
  dp[i][2]=max(dp[i-1][0]+c,dp[i-1][1]+c)

print(max(dp[N-1]))
#解説AC

Measured memory_bytes: 28728
#include<bits/stdc++.h>
using namespace std;
#define INIT  ios_base :: sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define mp make_pair
#define pb push_back
#define ft first
#define sc second
#define ll long long
#define pii pair<int, int>
#define count_bits __builtin_popcount
#define int ll

int n, x, m;
bool v[100010];
int ind[100010];
int p[100010];


int32_t main(){
INIT
//cout<<totient(9)<<flush;
cin>>n>>x>>m;
if(m==1){
    cout<<x; return 0;
}
int res=0;
int a=x;

for(int i=1; i<=m; i++){
    if(v[a]==true){
        res+=a;
        int sum=res-p[ind[a]]; sum*=( (n-ind[a])/(i-ind[a]) ); sum+=p[ind[a] ];
        //cout<<a<<"\n";
         int b=a; a*=a; a%=m;
         for(int j=1; j<=((n-ind[b])%(i-ind[b]));j++ ){sum+=a; a*=a; a%=m;   }
          //cout<<((n-ind[a])%(i-ind[a]))<<"\n";
            cout<<sum; return 0;
    }
    v[a]=true; ind[a]=i;
    res+=a; a*=a; a%=m;
    p[i]=res;
    if(i>=n){ cout<<res; return 0; }
}


return 0;
}





Measured memory_bytes: 4836
import sys
P = list(map(str, input().split()))
MAX = len(P)
S = [0] * MAX

def initialize():
    top = 0
    return top

def isEmpty():
    return top == 0

def isFull():
    return top >= MAX - 1

def push(x, top):
    if isFull():
        print('Error')
        sys.exit()
    top += 1
    S[top] = x
    return top

def pop(top):
    if isEmpty():
        print('Error')
        sys.exit()
    top -= 1
    return top, S[top + 1]

top = initialize()
for i in range(len(P)):
    if P[i].isdecimal():
        top = push(int(P[i]), top)
    elif P[i] == '+':
        top, n1 = pop(top)
        top, n2 = pop(top)
        top = push(n2 + n1, top)
    elif P[i] == '-':
        top, n1 = pop(top)
        top, n2 = pop(top)
        top = push(n2 - n1, top)
    elif P[i] == '*':
        top, n1 = pop(top)
        top, n2 = pop(top)
        top = push(n2 * n1, top)
print(S[top])


Measured memory_bytes: 5620
use std::io::*;

fn main() {
    let mut s: String = String::new();
    std::io::stdin().read_to_string(&mut s).ok();
    let mut itr = s.trim().split_whitespace();

    let a: i64 = itr.next().unwrap().parse().unwrap();
    let b: i64 = itr.next().unwrap().parse().unwrap();
    let c: i64 = itr.next().unwrap().parse().unwrap();
    println!("{}", if a <= c && c <= b { "Yes" } else { "No" });
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll GCD(ll x,ll y){
    if(y == 0) return x;
    else return GCD(y,x%y);
}
const int MOD = 1000000007;


int main() {
    int n; cin >> n;
    int ans = 0;
    for(int i = 0;i < n;++i){
        int a,b; cin >> a >> b;
        ans += (b-a)+1;
    }
    cout << ans;
}




Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<iomanip>
#define rep(i,n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i < (n); i++)
#define repm(i, m, n) for (int i = (m); i < (n); i++)
#define rep_rev(i, n) for (int i = int (n); i >= 0; i--)
typedef long long ll;
using namespace std;

int main() {
	double a,b,x;
	cin >> a >> b >> x;
	double ans;
	if (x < a*a*b / 2.0)ans = atan(2.0*x / (a*b*b));
	else ans = atan(a*a*a / (2.0*(a*a*b - x)));
	cout << fixed << setprecision(10) << 90.0 - 180.0 * ans / 3.14159265358979323846 << endl;
	return 0;
}

Measured memory_bytes: 256
#define I(s)for(s;i<n;i++)scanf("%d%d",h+i,w+i);
#define Z(x)r=x[j],x[j]=x[j+1],x[j+1]=r
h[201],w[201],d[201];main(n,i,j,r){for(;scanf("%d",&n),n;printf("%d\n",r)){
I(i=0)I((scanf("%d",&r),n+=r))
for(i=0;i<n-1;i++)for(j=0;j<n-i-1;j++)if(h[j]>h[j+1])Z(h),Z(w);
for(memset(d,0,sizeof(d)),r=i=0;i<n;r=r>d[i]?r:d[i],i++)for(d[i]=1,j=0;j<i;j++)if(h[j]<h[i]&&w[j]<w[i])d[i]=d[j]>=d[i]?d[j]+1:d[i];
}exit(0);}

Measured memory_bytes: 600
#include <bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;

int main() {
    ios_base::sync_with_stdio(0);
    int x; cin >> x;
    cout << 10-x/200 << endl;
}


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

using namespace std;
using ll = long long;

int main() {

	int X, Y, A, B, C;
	cin>>X>>Y>>A>>B>>C;
	vector<ll> p(A);
	vector<ll> q(B);
	vector<ll> r(C);

	for (auto& x : p) {
		cin>>x;
	}

	for (auto& x : q) {
		cin>>x;
	}

	for (auto& x : r) {
		cin>>x;
	}

	sort(p.begin(), p.end(), greater<ll>());
	sort(q.begin(), q.end(), greater<ll>());
	sort(r.begin(), r.end(), greater<ll>());

	vector<ll> a;
	a.insert(a.end(), p.begin(), p.begin() + X);
	a.insert(a.end(), q.begin(), q.begin() + Y);
	a.insert(a.end(), r.begin(), r.end());
	sort(a.begin(), a.end(), greater<ll>());

	ll sum = 0;
	cout<<accumulate(a.begin(), a.begin() + X + Y, sum, std::plus<ll>())<<endl;
	return 0;
}


Measured memory_bytes: 6592
//#include "stdafx.h"
#include <iostream>
#include <set>
#include <queue>
#include <vector>
#include <algorithm>
#include <math.h>
#include <cmath>
#include <string>
#include <cstring>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
#include <tuple>
#include <numeric>
#include <assert.h>
#include <functional>
#include <unordered_map>
#include <cstdint>

using namespace std;

/*-----------------------------------------------------------------------------
　定義
 -------------------------------------------------------------------------------*/
#define REP(i, n)				for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n)			for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define INF						2e9
#define MOD						(1000 * 1000 * 1000 + 7)
#define Ceil(x, n)				(((((x))+((n)-1))/n))		/* Nの倍数に切り上げ割り算 */
#define CeilN(x, n)				(((((x))+((n)-1))/n)*n)		/* Nの倍数に切り上げ */
#define FloorN(x, n)			((x)-(x)%(n))				/* Nの倍数に切り下げ */
#define IsOdd(x)				(((x)&0x01UL) == 0x01UL)			
#define IsEven(x)				(!IsOdd((x)))						
#define ArrayLength(x)			(sizeof( x ) / sizeof( x[ 0 ]))
#define	MAX_QWORD				((QWORD)0xFFFFFFFFFFFFFFFF)
#define M_PI					3.14159265358979323846
typedef long long				ll;
typedef unsigned long long int	QWORD;
typedef unsigned long long		SQWORD;
typedef pair<ll, ll>			P;

/*-----------------------------------------------------------------------------
　処理
 -------------------------------------------------------------------------------*/
/* 約数の列挙 */
vector<ll> divisorExec(ll n)
{
	vector<ll> res;
    for(ll i = 1; i <= sqrt(n); i++){
		if ((n % i) == 0) {
			res.push_back(i);
			if ((i * i) != n) {
				res.push_back(n / i);
			}
		}
	}
	sort(res.begin(), res.end());
	return res;
}

int main()
{
	ll K;
	string S;
	cin >> S >> K;
	K--;

	bool isFind = false;
	ll ans = 1;
	REP(i, S.size()) {
		if (!isFind) {
			if (S[i] != '1') {
				isFind = true;
				ans = S[i] - '0';
			}
		}
		if (i == K) {
			break;
		}
	}

	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
# include <iostream>
# include <algorithm>
#include <array>
# include <cassert>
#include <cctype>
#include <climits>
#include <numeric>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <tuple>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <bitset>
# include <complex>
# include <chrono>
# include <random>
# include <limits.h>
# include <unordered_map>
# include <unordered_set>
# include <deque>
# include <cstdio>
# include <cstring>
#include <stdio.h>
#include <stdlib.h>
#include <cstdint>
#include <cfenv>
//#include <bits/stdc++.h>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
long long MOD = 1000000000 + 7;
constexpr long long INF = std::numeric_limits<LL>::max();
const double PI = acos(-1);
#define fir first
#define sec second
#define thi third
#define debug(x) cerr<<#x<<": "<<x<<'\n'
typedef pair<LL, LL> Pll;
typedef pair<LL, pair<LL, LL>> Ppll;
typedef pair<LL, pair<LL, bitset<100001>>> Pbll;
typedef pair<LL, pair<LL, vector<LL>>> Pvll;
typedef pair<LL, LL> Vec2;
struct Tll { LL first, second, third; };
typedef pair<LL, Tll> Ptll;
#define rep(i,rept) for(LL i=0;i<rept;i++)
#define Mfor(i,mf) for(LL i=mf-1;i>=0;i--)
LL h, w, n, m, k, t, s, q, last, cnt, sum, ans, dp[10000][2], a[110000],b[110000];
string str, ss,dd;
bool f,ff;
char c;
int di[4][2] = { { 0,1 },{ 1,0 },{ -1,0 } ,{ 0,-1 } };
struct Edge { LL to, cost; };
vector<Edge>vec[10000];
vector<LL>v;
map<string, LL>ma;
set<LL>st;
void YN(bool f) {
	if (f)
		cout << "YES" << endl;
	else
		cout << "NO" << endl;
}
void yn(bool f) {
	if (f)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
}
int main() {
	cin >> h >> w >> s >> n;
	if (n == 0) {
		cout << h - w << endl;
		return 0;
	}
	if (n % 2 == 0)
		a[0] = h - w;
	else
		a[0] = w - h;
	if (a[0] - a[1] > 1000000000000000000)
		cout << "Unfair" << endl;
	else
		cout << a[0] << endl;
	return 0;
}

Measured memory_bytes: 512
// tsukasa_diary's programing contest code template
#include <bits/stdc++.h>
using namespace std;
#define TSUKASA_DIARY_S_TEMPLATE
// define
#define for_(i,a,b) for(int i=(a);i<(b);++i)
#define for_rev(i,a,b) for(int i=(a);i>=(b);--i)
#define allof(a) (a).begin(),(a).end()
#define minit(a,b) memset(a,b,sizeof(a))
#define size_of(a) int((a).size())
#define cauto const auto
// typedef
typedef long long lint;
typedef double Double;
typedef pair< int, int > pii;
template< typename T > using Vec = vector< T >;
template< typename T > using Matrix = Vec< Vec< T > >;
template< typename T > using USet = unordered_set< T >;
template< typename T, class C > using MyUSet = unordered_set< T, C >;
template< typename T, typename F > using UMap = unordered_map< T, F >;
template< typename T, typename F, class C > using MyUMap = unordered_map< T, F, C >;
// hash
class PiiHash { public: size_t operator () (const pii& p) const { return (p.first << 16) | p.second; } };
// popcount
inline int POPCNT(int x) { return __builtin_popcount(x); }
inline int POPCNT(lint x) { return __builtin_popcount(x); }
// inf
const int iINF = 1L << 30;
const lint lINF = 1LL << 60;
// eps
const Double EPS = 1e-9;
const Double PI = acos(-1);
// inrange
template< typename T >
inline bool in_range(T v, T mi, T mx) { return mi <= v && v < mx; }
template< typename T >
inline bool in_range(T x, T y, T W, T H) { return in_range(x,0,W) && in_range(y,0,H); }
// neighbor clockwise
const int DX[4] = {0,1,0,-1}, DY[4] = {-1,0,1,0};
const int DX_[8] = {0,1,1,1,0,-1,-1,-1}, DY_[8] = {-1,-1,0,1,1,1,0,-1};
// variable update
template< typename T > inline void modAdd(T& a, T b, T mod) { a = (a + b) % mod; }
template< typename T > inline void minUpdate(T& a, T b) { a = min(a, b); }
template< typename T > inline void maxUpdate(T& a, T b) { a = max(a, b); }
// converter
template< typename F, typename T >
inline void convert(F& from, T& to) {
	stringstream ss;
	ss << from; ss >> to;
}

int N, a[100010];

int main() {
	cin >> N;
	for_(i,0,N) {
		cin >> a[i];
		--a[i];
	}
	
	int ans = 0;
	for_(i,0,N) if (i == a[a[i]]) ++ans;
	cout << ans / 2 << endl;
}

Measured memory_bytes: 640
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

int i,j,k,h,w,min,ans,mat[700][700],max[700][700];
char c;

int main(){
	while(scanf("%d %d",&h,&w)*h*w){
		for(i=0;i<h;i++){
			k=0;
			scanf("\n");
			for(j=0;j<w;j++){
				scanf("%c",&c);
				if(c=='.')k++; else k=0;
				mat[i][j]=k;
			}
		}

		ans=0;
		for(j=w-1;j>=0 && (j+1)*h>ans ;j--){
			for(k=h-1;k>=0;k--){
				min=mat[k][j];
				if(min*(h-k)<=ans)continue;
				for(i=1;i+k<h;i++){
					if(min>mat[i+k][j])min=mat[i+k][j];
					if(min*(h-k)<=ans)break;
					if(min*(i+1)>ans)ans=min*(i+1);
				}
			}
		}
		printf("%d\n",ans);
	}
	return 0;
}

Measured memory_bytes: 1972
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
const int INF = 1000000000;
#define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++)
#define rep(i,n) REP(i, 0, n)
int N, D;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int _t, _s;
    while(cin >> N >> D && N){
        vector<int> m[100];
        vector<int> sum(N, 0);
        rep(i, N){
            cin >> _t;
            rep(j, _t){
                cin >> _s;
                m[i].push_back(_s);
                sum[i] += _s;
            }
        }
        while(true){
            bool updated = false;
            rep(i, N)
              while(m[i].size()){
                  sum[i] -= m[i].back();
                  if(*max_element(sum.begin(), sum.end()) - sum[i] <= D){
                      m[i].pop_back();
                      updated = true;
                  }else{
                      sum[i] += m[i].back();
                      break;
                  }
              }
            if(!updated) break;
        }
        rep(i, N - 1) sum[i + 1] += sum[i];
        if(sum[N - 1] == 0)
          cout << "Yes" << endl;
        else
          cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 1268
#include<stdio.h>
int main(void)
{
    long int a,b,k,x,y;
    scanf("%ld %ld %ld",&a,&b,&k);
    if(a > k)
    {
        x = a - k;
        
        
        y = b;
        
        
    }
    else
    {
        x = 0;
        if (b > k - a )
        {
            y = b - k + a ;
        }
        else
        {
            y = 0;
        }
        
        
    }
    
    printf("%ld %ld\n",x,y);
    return 0;
}

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

int main(void) {
  int h, w;
  char s[10][10];
  cin >> h >> w;
  for (int i = 0; i < h; i++) cin >> s[i];
  
  int x = 0;
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w - 1; j++) {
      if (s[i][j] == '#' && s[i][j + 1] == '#')
        x++;
    }
  }
  for (int i = 0; i < w; i++) {
    for (int j = 0; j < h - 1; j++) {
      if (s[j][i] == '#' && s[j + 1][i] == '#')
        x++;
    }
  }
  
  if (x == h + w - 2) cout << "Possible\n";
  else cout << "Impossible\n";
  
  return 0;
}
    

Measured memory_bytes: 256
#define _USE_MATH_DEFINES

#include <cmath>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <limits>
#include <cstring>
#include <string>
#include <queue>
#include <map>
#include <set>
#include <bitset>

using namespace std;

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

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

const int Maxn = 100010;

int a[Maxn];
int n, m, r;
double n2;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin >> n;
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }
    sort(a, a + n);
    m = a[n - 1];
    n2 = 1.0 * m / 2;
    double dist = 1e9 + 10;
    for (int i = 0; i < n; ++i) {
        if (abs(a[i] - n2) < dist){
            r = a[i];
            dist = abs(a[i] - n2);
        }
    }
    cout << m << " " << r << endl;
}


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

int main()
{
	int n, m, i, count {0};
	double x = 0, vote {0}, j;
	cin>>n>>m;
	
	int a[n];
	
	for(i=0; i<n; i++)
	{
		cin>>a[i];
		vote = vote + a[i];
	}
	
	j = (double)((vote/m) * (0.25));
	
	for(i=0; i<n; i++)
	{
		if(a[i]>=j)
			count ++;
	}
	
	if(count>=m)
		cout<<"Yes"<<endl;
	else
		cout<<"No"<<endl;
		
} 

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
using namespace std;
using Graph = vector<vector<int>>;

int main() {
    int N; cin >> N;
    Graph G(N);
    int a[100010], b[10010];
    for(int i = 0; i < N-1; ++i) {
        cin >> a[i] >> b[i];
        --a[i], --b[i];
        G[a[i]].push_back(b[i]);
        G[b[i]].push_back(a[i]);
    }
    vector<int> dist(N, -1);
    queue<int> que;
    dist[0] = 0;
    que.push(0);
    int va = 0;
    while(!que.empty()) {
        int v = que.front(); que.pop();
        int color = 1;
        for(auto nv : G[v]) {
            if(dist[nv] != -1) continue;
            if(dist[v] == color) ++color;
            dist[nv] = color;
            que.push(nv);
            va = max(va, color);
            ++color;
        }
    }
    
    cout << va << endl;
    for(int i = 0; i < N-1; ++i) {
        cout << dist[b[i]] << endl;
    }
}


Measured memory_bytes: 6912
#coding: utf-8

from math import log10

def getLS(N):
    small = N//2
    large = N//2 + N%2
    return large, small

def getDigit(num):
    n_sum = 0
    for i in range(int(log10(num))+1):
        n_sum += num % 10
        num //= 10
    return n_sum

def getDigitSum(n1, n2):
    return getDigit(n1) + getDigit(n2)

def main(N):
    n_min = pow(10, 5)
    large, small = getLS(N)
    while small >= 1:
        tmp = getDigitSum(large, small)
        if n_min > tmp:
            n_min = tmp
        large += 1
        small -= 1
    return n_min

if __name__ == "__main__":
    N = int(input())
    print(main(N))


Measured memory_bytes: 3188
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void _main()
{
    int X, A, B;
    cin >> X >> A >> B;
    const int elapsedDays = - A + B;
    if (elapsedDays <= 0)
    {
        cout << "delicious" << endl;
    }
    else if (elapsedDays <= X)
    {
        cout << "safe" << endl;
    }
    else
    {
        cout << "dangerous" << endl;
    }
}


Measured memory_bytes: 256