akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pll = pair<ll,ll>;
using pii = pair<int,int>;
#define ALL(x) (x).begin(),(x).end()

ll N;
inline ll Pow(ll a) {
	ll res = a;
	while(N >= res) {
		res *= a;
		if(N % res != 0) {
			res /= a;
			break;
		}
	}
	if(N % res != 0)
		res /= a;
	return res;
}

int main(){
	cin >> N;
	if(N == 2) {
		cout << 1 << endl;
		return 0;
	}
	ll ans = 2;
	for(ll k=2;k*k<=N;k++) {
		if(N % k == 0) continue;
		if((N-1) % k == 0) {
			ans++;
			ll tmp = (N-1)/k;
			if(tmp == k) continue;
			if(N % tmp != 0) {
				ans++;
			}
		}
	}
	for(ll k=2;k*k<=N;k++) {
		if(N % k == 0) {
			ll kk = Pow(k);
			if( (N/kk) % k == 1) {
				ans++;
			}
			ll nk = N/k;
			if(N % nk == 1) {
				ans++;
			}
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
H, W = map(int, input().split())
G = [list(map(int, input().split())) for _ in range(H)]
ans = []
for h in range(H-1):
    for w in range(W):
        if G[h][w] % 2:
            ans.append([h+1, w+1, h+2, w+1])
            G[h][w] -= 1
            G[h+1][w] += 1
for w in range(W-1):
    if G[H-1][w] % 2:
        ans.append([H, w+1, H, w+2])
        G[H-1][w] -= 1
        G[H-1][w+1] += 1
print(len(ans))
for row in ans:
    print(*row)


Measured memory_bytes: 31344
import sys
input = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 9)

def main():
    N,M = map(int,input().split())
    
    edge = [[] for _ in range(N)]
    for _ in range(M):
        x,y = map(int,input().split())
        edge[x-1].append(y-1)
        
    dist = [-1 for _ in range(N)]
            
    def dfs(s):
        if dist[s] != -1:
            return dist[s]
        else:
            ret = 0
            for fol in edge[s]:
                ret = max(ret,dfs(fol)+1)
            dist[s] = ret
            return ret

    for i in range(N):
        dfs(i)
        
    print(max(dist))
    
if __name__ == "__main__":
    main()


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

pair<int, int> x[4];

int main() {
  int i, j;
  cin >> x[0].first >> x[0].second >> x[1].first >>
      x[1].second;
  i = x[1].first - x[0].first;
  j = x[1].second - x[0].second;
  x[2].first = x[1].first - j;
  x[2].second = x[1].second + i;
  x[3].first = x[2].first - i;
  x[3].second = x[2].second - j;
  cout << x[2].first << " " << x[2].second << " "
       << x[3].first << " " << x[3].second << endl;
  return 0;
}

Measured memory_bytes: 256
n=int(input())
tn,xn,yn=0,0,0
for _ in range(n):
    ti,xi,yi=map(int,input().split())
    td,xd,yd=ti-tn,xi-xn,yi-yn
    if td<xd+yd or (td+xd+yd)%2!=0:
        print('No')
        exit()
    tn,xn,yn=ti,xi,yi
print('Yes')

Measured memory_bytes: 3060
n = int(input())
ac = 0
wa = 0
tle = 0
re = 0


for i in range(n):
    s = str(input())

    if s == "AC":
        ac += 1
    elif s == "WA":
        wa += 1
    elif s == "TLE":
        tle += 1
    else:
        re += 1

print("AC x", ac)
print("WA x", wa)
print("TLE x",tle)
print("RE x",re)

Measured memory_bytes: 9016
#include <iostream>
#include <string>
#include <vector>

using namespace std;

void print_a(char c);
void print_k(char c);
void print_s(char c);
void print_t(char c);
void print_n(char c);
void print_h(char c);
void print_m(char c);
void print_y(char c);
void print_r(char c);
void print_w(char c);


int main(void)
{
  string str;
  int str_size;

  while(cin >> str){

    str_size=str.size();
    

    for(int i=0;i<str_size;i+=2)
      {
	switch(str[i]){
	case '0':print_w(str[i+1]);break;
	case '1':print_a(str[i+1]);break;
	case '2':print_k(str[i+1]);break;
	case '3':print_s(str[i+1]);break;
	case '4':print_t(str[i+1]);break;
	case '5':print_n(str[i+1]);break;
	case '6':print_h(str[i+1]);break;
	case '7':print_m(str[i+1]);break;
	case '8':print_y(str[i+1]);break;
	case '9':print_r(str[i+1]);break;
	}
      }

    cout << endl;
    
  }

  
  
  return 0;
}
  

void print_a(char c){
  if(c=='U')
    cout << "u";
  if(c=='T')
    cout << "a";
  if(c=='D')
    cout << "o";
  if(c=='R')
    cout << "e";
  if(c=='L')
    cout << "i";
}
void print_k(char c){
  if(c=='U')
    cout << "ku";
  if(c=='T')
    cout << "ka";
  if(c=='D')
    cout << "ko";
  if(c=='R')
    cout << "ke";
  if(c=='L')
    cout << "ki";
}

void print_s(char c){
   if(c=='U')
    cout << "su";
  if(c=='T')
    cout << "sa";
  if(c=='D')
    cout << "so";
  if(c=='R')
    cout << "se";
  if(c=='L')
    cout << "si";
}

void print_t(char c){
   if(c=='U')
    cout << "tu";
  if(c=='T')
    cout << "ta";
  if(c=='D')
    cout << "to";
  if(c=='R')
    cout << "te";
  if(c=='L')
    cout << "ti";
}

void print_n(char c){
   if(c=='U')
    cout << "nu";
  if(c=='T')
    cout << "na";
  if(c=='D')
    cout << "no";
  if(c=='R')
    cout << "ne";
  if(c=='L')
    cout << "ni";
}

void print_h(char c){
   if(c=='U')
    cout << "hu";
  if(c=='T')
    cout << "ha";
  if(c=='D')
    cout << "ho";
  if(c=='R')
    cout << "he";
  if(c=='L')
    cout << "hi";
}

void print_m(char c){
   if(c=='U')
    cout << "mu";
  if(c=='T')
    cout << "ma";
  if(c=='D')
    cout << "mo";
  if(c=='R')
    cout << "me";
  if(c=='L')
    cout << "mi";
}
void print_y(char c){
   if(c=='U')
    cout << "yu";
  if(c=='T')
    cout << "ya";
  if(c=='D')
    cout << "yo";
}
void print_r(char c){
   if(c=='U')
    cout << "ru";
  if(c=='T')
    cout << "ra";
  if(c=='D')
    cout << "ro";
  if(c=='R')
    cout << "re";
  if(c=='L')
    cout << "ri";
}

void print_w(char c){
  if(c=='U')
    cout << "nn";
  if(c=='T')
    cout << "wa";
  if(c=='D')
    cout << "wo";
}



Measured memory_bytes: 3244
#include "bits/stdc++.h"
using namespace std;
const int MOD = 998244353;
const int MON = 200005;
long long fac[MON], finv[MON], inv[MON];

void COMinit() {
	fac[0] = 1, fac[1] = 1, finv[0] = 1, finv[1] = 1, inv[1] = 1;
	for (int i = 2; i < MON; ++i) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

//calc
long long COM(long long n, long long k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main() {
	COMinit();
	int a, b;
	cin >> a >> b;
	for (int i = 2; i <= 2 * a; ++i) {
		long long ans = 0, mon;
		if (i > a + 1) { mon = 2 * a + 2 - i; }
		else { mon = i; }
		for (int j = 0; j <= mon / 2; ++j) {
			long long mmon = COM(mon / 2, j)*COM(a + b - 2 * j - 1, b - 2 * j) % MOD;
			if (j & 1) { ans = (ans - mmon + MOD) % MOD; }
			else { ans = (ans + mmon) % MOD; }
		}
		cout << ans % MOD << endl;
	}
}

Measured memory_bytes: 4992
#include <cstdio>
#include <iostream>
#include <string>
#include <sstream>
#include <stack>
#include <algorithm>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <cstdlib>
#include <bitset>
#include <tuple>
#include <assert.h>
#include <deque>
#include <bitset>
#include <iomanip>
#include <limits>
#include <chrono>
#include <random>
#include <array>
#include <unordered_map>
#include <functional>
#include <complex>
#include <numeric>
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

constexpr long long MAX = 5100000;
constexpr long long INF = 1LL << 60;
constexpr int inf = 1 << 28;
//constexpr long long mod = 1000000007LL;
//constexpr long long mod = 998244353LL;

using namespace std;
typedef unsigned long long ull;
typedef long long ll;

ll dp[11][156][22];
int main()
{
	/*
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	*/

	int kkt; scanf("%d", &kkt);
	string s;
	ll cnt0 = 0;
	ll cnt1 = 0;
	while (kkt--) {
		ll p, n;
		char c;
		cin >> p >> c >> n;
		if (c == '(') cnt0 += n;
		else cnt1 += n;
		if (cnt0 == cnt1) puts("Yes");
		else puts("No");
		/*
		string t;
		for (int i = 0; i < p; i++) t += s[i];
		t += string(n, c);
		for (int i = p; i < s.size(); i++) t += s[i];
		s = t;
		*/
	}
	return 0;

}



Measured memory_bytes: 3168
using System;
using System.Text;

class Program
{
	static void Main()
	{
		var numbers = Array.ConvertAll(Console.ReadLine().Split(new[] { ' ' }), number => int.Parse(number));
		var k = numbers[0];
		var x = numbers[1];

		var firstIndex = x - k + 1;
		var lastIndex = x + k - 1;

		var answer = new StringBuilder();
		for (var i = firstIndex; i <= lastIndex; ++i) {
			answer.Append($"{i} ");
		}

		Console.WriteLine(answer.ToString().Trim());

		//デバッグ実行での確認用。そのまま提出しても問題なし
		Console.ReadKey();
	}
}


Measured memory_bytes: 17772
#include <algorithm>
#include <bits/stdc++.h>
#include <cstdlib>
#include <iostream>
#include <iterator>
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <vector>

using namespace std;
typedef long long ll;

int main() {
    int N;
    string S;
    int count = 0;
    cin >> N >> S;
    for(int i = 0; i < N; i++){
        if(S[i] !=S[i+1]){
            count ++;
        }
    }
    cout << count <<endl;
}

Measured memory_bytes: 512
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Globalization;

namespace 練習１
{
    class Program
    {
        static void Main(string[] args)
        {
            var x = Console.ReadLine().Split(' ');
            var y = new int[3];
            for(var i = 0; i < x.Length; i++)
            {
                y[i] = int.Parse(x[i]);
            }
            int tmp;

            tmp = y[0];
            y[0] = y[1];
            y[1] = tmp;

            tmp = y[0];
            y[0] = y[2];
            y[2] = tmp;

            Console.WriteLine("{0} {1} {2}", y[0], y[1], y[2]);

        }
    }
}

Measured memory_bytes: 11220
#include <iostream>
#include <string>
#include <vector>

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

using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::vector;

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

  int red = 0;
  int count = 0;
  rep(i, N)
  {
    if (c[i] == 'R')
    {
      red++;
    }
  }

  rep(i, red)
  {
    if (c[i] == 'W')
    {
      count++;
    }
  }

  cout << count << endl;

  return 0;
}


Measured memory_bytes: 3748
#include <bits/stdc++.h>
#define LL long long
#define pb push_back
#define mp make_pair
#define INF 0x3f3f3f3f
#define Inf 1000000000000000000LL
using namespace std;
typedef pair<int,int>pii;
int deg[100010];
vector<int>G[100010];
int n,m;
int fa[100010];
bool vis[100010];
void dfs(int x,int pr){
	vis[x]=1;
	fa[x]=pr;
	for(auto to:G[x])deg[to]--;
	for(auto to:G[x])if(!vis[to]&&deg[to]==0)dfs(to,x);
}
int root;
int main(){
	cin>>n>>m;
	for(int i=1,x,y;i<=m-1+n;i++){
		cin>>x>>y;
		G[x].pb(y);
		deg[y]++;
	}
	for(int i=1;i<=n;i++)if(!deg[i]){
		root=i;
		break;
	}
	dfs(root,0);
	for(int i=1;i<=n;i++)cout<<fa[i]<<endl;
	return 0;
}

Measured memory_bytes: 10240
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]
dy8, dx8 = [0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def ceil(a, b):
    return (a + b - 1) // b


def ok(n, A, B, H):
    num = 0
    for h in H:
        r = h - n * B
        if r > 0:
            num += ceil(r, (A - B))
    return num <= n


def main():
    N, A, B = map(int, input().split())
    H = sorted([int(input()) for _ in range(N)])

    low, high = 0, 10 ** 10
    ans = 0
    while high - low > 1:
        middle = (low + high) // 2
        if ok(middle, A, B, H):
            ans = middle
            high = middle
        else:
            low = middle

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 9064
//Copyright@3_soon,From Hangzhou No.2 High School Baimahu
//Problem:
//Result:

#include<bits/stdc++.h>
using namespace std;
#define re register
#define LL long long
#define DB double
#define il inline
#define For(x,a,b) for(re int x=a;x<=b;x++)
#define For2(x,a,b) for(re int x=a;x>=b;x--)
#define LFor(x,a,b) for(re LL x=a;x<=b;x++)
#define LFor2(x,a,b) for(re LL x=a;x>=b;x--)
#define Abs(x) ((x>0)? x:-x)
#define mod 998244353
int gi()
{
    int res=0,fh=1;char ch=getchar();
    while((ch>'9'||ch<'0')&&ch!='-') ch=getchar();
    if(ch=='-') fh=-1,ch=getchar();
    while(ch>='0'&&ch<='9')res=res*10+ch-'0',ch=getchar();
    return fh*res;
}
LL gl()
{
    LL res=0,fh=1;char ch=getchar();
    while((ch>'9'||ch<'0')&&ch!='-') ch=getchar();
    if(ch=='-') fh=-1,ch=getchar();
    while(ch>='0'&&ch<='9')res=res*10+ch-'0',ch=getchar();
    return fh*res;
}
LL inv[1000005],fac[1000005];
LL n,m;
LL ans;
LL ksm(LL b,LL k)
{
    int sum=1;
    while(k){
	if(k&1) sum=sum*b%mod;
	b=b*b%mod;
	k>>=1;
    }
    return sum%mod;
}
LL C(LL a,LL b)
{
    return fac[a]*inv[b]%mod*inv[a-b]%mod;
}


int main()
{
    n=gl(),m=gl();
    if(n<m) swap(n,m);
    fac[0]=1;
    For(i,1,n+m)  fac[i]=1ll*i*fac[i-1]%mod;
    inv[n+m]=ksm(fac[n+m],mod-2);
    For2(i,n+m-1,0) inv[i]=1ll*inv[i+1]*(i+1)%mod;
    ans=0;
    For(i,1,m){
	ans=(ans+1ll*C(i*2,i)*C(n+m-2*i,n-i))%mod;
    }
    ans=ans*ksm(2*C(m+n,n),mod-2)%mod;
    printf("%lld\n",(ans+n)%mod);
    return 0;
}



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

int main(){
    int n;
    cin >> n;
    int A[n], B[n], C[n], dp[n][3];
    for(int i = 0; i < n; i++){
        cin >> A[i] >> B[i] >> C[i];
    }
    dp[0][0] = A[0];
    dp[0][1] = B[0];
    dp[0][2] = C[0];
    for(int i = 1; i < n; i++){
        dp[i][0] = A[i] + max(dp[i-1][1], dp[i-1][2]);
        dp[i][1] = B[i] + max(dp[i-1][0], dp[i-1][2]);
        dp[i][2] = C[i] + max(dp[i-1][1], dp[i-1][0]);
    }
    cout << max(dp[n-1][0], max(dp[n-1][1], dp[n-1][2]));
    return 0;
}

Measured memory_bytes: 5924
import java.util.*;
 
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        
        int N = sc.nextInt();
        int[] a = new int[N];
        
        for(int i=0; i<N; i++){
            a[i] = sc.nextInt();
        }
        
        for(int i=N-1;i>=0;i-=2){
        	System.out.print(a[i] + " ");
        }
        for(int j=N%2;j<N;j+=2){
        	System.out.print(a[j] + " ");
        }
   }
}


Measured memory_bytes: 61500
import java.util.*;
import static java.lang.Math.*;
public class Main {
	final Scanner sc=new Scanner(System.in);
	public static void main(String[] args) {
		new Main().init();
	}
	void init(){
		final long STACK_SIZE=8*1024*1024;
		new Thread(null, new AOJ2061(), "RUN", STACK_SIZE).start();
	}
	
	// International party
	class AOJ2061 implements Runnable{
		AOJ2061(){}
		@Override public void run(){
			int c=0;
			while(sc.hasNext()){
				N=sc.nextInt();
				M=sc.nextInt();
				if((N|M)==0)	break;
				if(c>0)System.out.println();
				solve();
				++c;
			}
		}
		
		int N,M;
		String[] LANG;
		long[] ST;
		HashMap<String, Integer> dic;
		
		void solve(){
			LANG=new String[N];
			dic=new HashMap<String,Integer>();
			for(int i=0; i<N; ++i){
				LANG[i]=sc.next();
				dic.put(LANG[i], i);
			}
			
			ST=new long[M];
			for(int i=0; i<M; ++i){
				int K=sc.nextInt();
				for(int j=0; j<K; ++j){
					long tmp=dic.get(sc.next());
					ST[i]|=(1<<tmp);
				}
			}
			
			for(int i=1; i<=5; ++i){
				long ans=DFS(0,-1,0L,i,new boolean[M][M]);
				if(ans>0){
					System.out.println(Long.bitCount(ans));
					for(int j=0; j<N; ++j){
						long tmp=1<<j;
						if( (ans&tmp) >0 )	System.out.println(LANG[j]);
					}
					return;
				}
			}
			
			System.out.println("Impossible");
			
		}
		
		long DFS(int depth,int last,long used,int lim,boolean[][] graph){
			
			if(depth==lim){
				boolean[] ret=isConnected(0, graph, new boolean[M]);
				for(boolean b:ret)if(!b)	return 0L;
				return used;
			}
			
			long ret=0L;
			for(int i=last+1; i<N; ++i){
				long now=(1<<i);
				used|=now;
				
				boolean[][] newGraph=new boolean[M][M];
				for(int j=0; j<M; ++j){
					for(int k=0; k<M; ++k){
						newGraph[j][k] = graph[j][k] | ( (ST[j]&now)>0 && (ST[k]&now)>0 );
					}
				}
				
				long tmp=DFS(depth+1,i,used,lim,newGraph);
				if(tmp > 0 && (ret == 0 || Long.bitCount(ret) < Long.bitCount(tmp) ) )	ret=tmp;
				
				used^=now;
			}
			
			return ret;
		}
		
		boolean[] isConnected(int n,boolean[][] g,boolean[] vtd){
			for(int i=0; i<M; i++){
				if(g[n][i] && !vtd[i]){
					vtd[i]=true;
					vtd = isConnected(i,g,vtd);
				}
			}
			return vtd;
		}
	}
}

Measured memory_bytes: 13000
#include<stdio.h>

int main(void){
  double ans=0,a;
  int n,i;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%lf",&a);
    ans += 1/a;
  }
  ans = 1/ans;
  printf("%f\n",ans);
  return 0;
}

Measured memory_bytes: 128
while True:
    try:
        weight=input()
        if weight<=48.00:
            print "light fly"
        elif weight>91.00:
            print "heavy"
        else:
            if weight<=51.00:
                print "fly"
            elif weight<=54.00:
                print "bantam"
            elif weight<=57.00:
                print "feather"
            elif weight<=60.00:
                print "light"
            elif weight<=64.00:
                print "light welter"
            elif weight<=69.00:
                print "welter"
            elif weight<=75.00:
                print "light middle"
            elif weight<=81.00:
                print "middle"
            else:
                print "light heavy"
    except:
        break

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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

int N;
int P[111111];

signed main(){
    cin>>N;
    rep(i,N)cin>>P[i],P[i]--;
    int cnt=0;
    for(int i=0;i+1<N;i++){
        if(P[i]==i){
            swap(P[i],P[i+1]);
            cnt++;
        }
    }
    if(P[N-1]==N-1)cnt++;
    cout<<cnt<<endl;
    return 0;
}


Measured memory_bytes: 1024
R, G, B, N = map(int, input().split())
count = 0
# print(N//R+1)
for i in range(N+1):
    if i*R > N:
        break
    for j in range(N+1):
        if i*R + j*G > N:
            break
        if (N-i*R-j*G)%B == 0:
            count += 1
    # print(i, (N-i) // G+1)
print(count)

Measured memory_bytes: 40428
n = int(input())

pos_t=0
pos_x=0
pos_y=0

def judge(target_t,target_x,target_y,
          pos_t,pos_x,pos_y):

    #print(target_t,target_x,target_y,
    #        pos_t,pos_x,pos_y)

    t = abs(target_t-pos_t)
    x = abs(target_x-pos_x)
    y = abs(target_y-pos_y)

    #print(t,x,y)

    if x+y == t:
        #print("case1")
        return 0
    elif x == 0 and y== 0 and t%2==0:
        #print("case2")
        return 0
    elif ((x+y)%2 == 1) and (t%2==1) \
        and (x+y < t):
        #print("case3")
        return 0
    elif ((x+y)%2 == 0) and (t%2==0) \
        and (x+y<t):
        #print("case4")
        return 0
    else:
        return -1

no = 0
for i in range(n):
    t, x, y = map(int,input().split())
    ret = judge(t,x,y,pos_t,pos_x,pos_y)
    pos_t=t
    pos_x=x
    pos_y=y
    if ret == -1:
        no = 1

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


Measured memory_bytes: 3064
#include <iostream>
#include <cctype>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <utility>
#include <string>
#include <functional>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iomanip>
#include <bitset>
#define pb push_back
#define mp make_pair
#define YES cout<<"YES"<<endl
#define Yes cout<<"Yes"<<endl
#define NO cout<<"NO"<<endl
#define No cout<<"No"<<endl
#define INF (1<<30)
#define LLINF (1<<60)
#define MOD 1000000007
#define rep(i, n) for(int i=0;i<n;i++)
using ll = long long;
using namespace std;

int main(){
    int n;
    cin >> n;
    cout << 1110 - n << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <bitset>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <complex>
using namespace std;

//#define int long long
#define reps(i,s,n) for(int (i)=(s);(i)<(n);++(i))
#define rep(i,n) reps(i,0,n)
#define rept(i,n) rep(i,(n)+1)
#define repst(i,s,n) reps(i,s,(n)+1)
#define reprt(i,n,t) for(int (i)=(n);(i)>=(t);--(i))
#define repr(i,n) reprt(i,n,0)
#define each(itr,v) for(auto &(itr):(v))
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define tmax(x,y,z) max(x,max(y,z))
#define tmin(x,y,z) min(x,min(y,z))
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define ln '\n'
#define bln(i,n) (((i)==(n)-1)?'\n':' ')
#define dbg(x) cout<<#x" = "<<(x)<<ln<<flush
#define dbga(x,n) {cout<<#x" : ";for(int (i)=0;i<(n);++i){cout<<((x)[i])<<(i==((n)-1)?'\n':' ')<<flush;}}
#define zero(a) memset(a,0,sizeof(a))
#define unq(a) sort(all(a)),a.erase(unique(all(a)),a.end())

typedef complex<double> P;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vst;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vector<int> > mat;

const ll inf = (ll)1e9+10;
const ll linf = (ll)1e18+10;
const ll mod = (ll)(1e9+7);
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};
const double eps = 1e-10;

ll mop(ll a,ll b,ll m=mod) {ll r=1;a%=m;for(;b;b>>=1){if(b&1)r=r*a%m;a=a*a%m;}return r;}
ll gcd(ll a,ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b) {return a*b/gcd(a,b);}
bool ool(int x,int y,int h,int w) {return((x<0)||(h<=x)||(y<0)||(w<=y));}
bool deq(double a,double b) {return abs(a-b)<eps;}

struct oreno_initializer {
	oreno_initializer() {
		cin.tie(0);
		ios::sync_with_stdio(0);
	}
} oreno_initializer;



int n;
string s;

signed main() {
	cin >> n;
	if (n==0) return cout << 0 << ln, 0;
	while (n!=0 && n!=1) s.push_back(n%(-2) ? '1' : '0'), n = (n - abs(n%(-2)))/(-2);
	s.push_back(n ? '1' : '0');
	reverse(all(s));
	cout << s << ln;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <iterator>
#include <assert.h>
#pragma warning(disable:4996) 
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223300000000000000
#define INF 2140000000
const long long MOD = 1000000007;
using namespace std;



int main(int argc, char* argv[])
{
    int n;
    scanf("%d", &n);

    double ans = (double)((n-1)/2+1)/n;
    printf("%.10lf\n", ans);



    return 0;
}


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

int main()
{
    int a[100003] = {0}, n = 0, i = 0, x = 0, y = 1;
    cin >> n;
    for(i = 1; i <= n; i++)
    {
        cin >> a[i];
    }
    i = 0;
    while(a[i] != 2)
    {
        if(y == 1)
        {
            i = 1;
        }
         if(a[i] == 2)
        {
            break;
        }
         i = a[i];

        y++;
         if(y >= n)
         {
             cout << -1;
             x++;
             break;
         }
    }
    if(x == 0)
    {
        cout << y;
    }


return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <stdio.h>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#include <cstdlib>
using namespace std;

int main() {
	int k;
	cin >> k;
	if (k % 2 == 0)k = (k / 2)*(k / 2);
	else k = (k / 2)*(k / 2 + 1);
	cout << k << endl;
	return(0);
}


Measured memory_bytes: 256
import sys
import math
from collections import Counter
import itertools
import fractions
from decimal import Decimal
#from functools import reduce

# 入力を整数に変換して受け取る
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
# 入力全てを整数に変換したものの配列を受け取る
def LI(): return list(map(int, sys.stdin.readline().split()))
# 入力全てを整数に変換して1引いたものの配列を受け取る
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SR(): return sys.stdin.readline().rstrip()

ascii_lowercase = 'abcdefghijklmnopqrstuvwxyz'
ascii_uppercase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
ascii_uppercase2 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ'

# リストを改行区切りで出力する
p2D = lambda x: print(*x, sep="\n")
p2E = lambda x: print(''.join(x))
p2S = lambda x: print(*x, sep=" ")

# ###########################################

A,B,H,M=MI()

kakuM = M*6
kakuH = H*30+0.5*M
 
kakudo = kakuH - kakuM

 
ans = A**2 + B**2 - 2 * A * B * math.cos(math.radians(kakudo))
 
print(math.sqrt(ans))


Measured memory_bytes: 10792
import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop;


void main() {
    auto N = readln.chomp.to!int;
    auto A = N.iota.map!(_ => readln.split.map!(to!int).array).array;
    auto B = N.iota.map!(_ => readln.split.map!(to!int).array).array;

    int source = N*2;
    int sink = N*2+1;
    auto FF = new FordFulkerson(N*2+2, source, sink);
    foreach (i; 0..N) FF.add_edge(source, i, 1);
    foreach (i; 0..N) FF.add_edge(N+i, sink, 1);
    foreach (i; 0..N) foreach (j; 0..N) if (A[i][0] < B[j][0] && A[i][1] < B[j][1]) FF.add_edge(i, N+j, 1);
    FF.run.writeln;
}


class FordFulkerson {
    int N, source, sink;
    int[][] adj;
    int[][] flow;
    bool[] used;

    this(int n, int s, int t) {
        N = n;
        source = s;
        sink = t;
        assert (s >= 0 && s < N && t >= 0 && t < N);
        adj = new int[][](N);
        flow = new int[][](N, N);
        used = new bool[](N);
    }

    void add_edge(int from, int to, int cap) {
        adj[from] ~= to;
        adj[to] ~= from;
        flow[from][to] = cap;
    }

    int dfs(int v, int min_cap) {
        if (v == sink)
            return min_cap;
        if (used[v])
            return 0;
        used[v] = true;
        foreach (to; adj[v]) {
            if (!used[to] && flow[v][to] > 0) {
                auto bottleneck = dfs(to, min(min_cap, flow[v][to]));
                if (bottleneck == 0) continue;
                flow[v][to] -= bottleneck;
                flow[to][v] += bottleneck;
                return bottleneck;
            }
        }
        return 0;
    }

    int run() {
        int ret = 0;
        while (true) {
            foreach (i; 0..N) used[i] = false;
            int f = dfs(source, int.max);
            if (f > 0)
                ret += f;
            else
                return ret;
        }
    }
}


Measured memory_bytes: 508
from collections import Counter

mod = 10**9 + 7

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

c = Counter()
c[-1] = 3
ans = 1
for i in range(N):
    ans *= c[A[i]-1] - c[A[i]]
    c[A[i]] += 1
ans %= mod
print(ans)

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

#define MOD 1000000007
#define rep(i, n) for(ll i=0; i < (n); i++)
#define ALL(v) v.begin(),v.end()
#define FOR(i, j, k) for(ll i=j;i<k;i++)
#define DUMP(i, v)for(ll i=0;i<v.size();i++)cout<<v[i]<<" "

using namespace std;
typedef long long int ll;
typedef vector<ll> llvec;
typedef vector<double> dvec;
typedef pair<ll, ll> P;
typedef long double ld;
struct Edge{ll from, to, cost;};
struct node{ll cost, to;
  bool friend operator>(node a, node b){
    return a.cost>b.cost;
  }
};

ll mod(ll a, ll mod){
  ll res = a%mod;
  if(res<0)res=res + mod;
  return res;
}

ll modpow(ll a, ll n, ll mod){
  ll res=1;
  while(n>0){
    if(n&1) res=res*a%mod;
    a=a*a%mod;
    n>>=1;
  }
  return res;
}

ll modinv(ll a, ll mod){
  return modpow(a, mod-2, mod);
}

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

bool is_prime(ll n){
  ll i = 2;
  if(n==1)return false;
  if(n==2)return true;
  bool res = true;
  while(i*i <n){
    if(n%i==0){
      res = false;
    }
    i = i+1;
  }

  //if(i==1)res = false;
  if(n%i==0)res=false;
  return res;
}


/**************************************
** A main function starts from here  **
***************************************/
int main(){
  ll A,B,C,D;
  cin >> A >> B >> C >>D;
  cout << max(A*B, C*D);

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,x) for(int i=0;i<x;i++)
#define put(ans)    cout << ans << endl;
#define sort(s) sort(s.begin(),s.end())
#define reverse(s) reverse(s.begin(),s.end())

//最大公約数
ll gcd(ll a, ll b) {
    return b ? gcd(b, a%b) : a;
}
//最小公倍数
ll lcm(ll a, ll b) {
    return a / gcd(a, b) * b;
}
bool isPrime(ll x){
    ll i;
    if(x < 2)return 0;
    else if(x == 2) return 1;
    if(x%2 == 0) return 0;
    for(i = 3; i*i <= x; i += 2) if(x%i == 0) return 0;
    return 1;
}

int main(){
    ll x,a(100),y(0);
    cin >> x;
    while(a<x){
        a *= 1.01;
        y++;
    }
    put(y);
    return 0;
}

Measured memory_bytes: 3660
#include<bits/stdc++.h>
#define read(a)(a=qwq())
int qwq()
{
	int x;
	char c,y;
	while(c=getchar(),c!='-'&&(c<'0'||c>'9'));
	if(c!='-')
	y=1,x=c-'0';
	else
	y=-1,x=0;
	while(c=getchar(),c>='0'&&c<='9')
	x=(x<<3)+(x<<1)+c-'0';
	return x*y;
}
using namespace std;
int s[1000000],t[1000000],n,x,j=1;
long long ans;
int main()
{
	read(n);
	for(int i=1;i<=n;++i)
	read(x),s[i]=s[i-1]+x,t[i]=t[i-1]^x;
	for(int i=1;i<=n;ans+=i-j+1,++i)
	while(s[i]-s[j-1]>(t[i]^t[j-1]))
	++j;
	printf("%lld",ans);
	return 0;
}

Measured memory_bytes: 5120
#include<bits/stdc++.h>
#define ll long long
#define speed_up    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define pb push_back
#define MAX 1000000007
using namespace std;
int main()
{
 	speed_up
    ll n,m;cin>>n>>m;
    ll a[m],dp[n+1];for(ll i=0;i<m;i++) cin>>a[i];
    dp[0]=1;sort(a,a+m);
	if(binary_search(a,a+m,1)) dp[1]=0;
	else dp[1]=1;
    for(ll i=2;i<n+1;i++)
    {
    	if(binary_search(a,a+m,i)) dp[i]=0;
    	else
    	dp[i]=(dp[i-1]+dp[i-2])%MAX;
	}
	cout<<dp[n]%MAX;
	
	
	
 return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, a, b) for(int i = a; i < b; i++)
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  FastIO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
typedef long long ll;
using P = pair<int,int>;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return true; } return false; }

int main(){
    int n, d;
    cin >> n >> d;
    d *= 2;
    d++;
    int ans = n / d;
    if (n % d != 0){
        ans++;   
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3576
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE BangPatterns #-}

import Control.Applicative
import Control.Monad
import Control.Arrow
import Data.List
import Data.Maybe
import Data.Char
import qualified Data.ByteString.Char8 as B
import Text.Printf

readInt = ( readLn :: IO Int )
readInts = map ( read :: String -> Int ) . words <$> getLine

getList = map ( fst . fromJust . B.readInt ) . B.words <$> B.getLine

which a b f = if f then a else b
mp [ a, b ] = ( a, b )

main = readInts >>= print . length . group . sort


Measured memory_bytes: 508
#include <iostream>
#include <cstdlib>
#include <time.h>
#include <algorithm>
#include <map>
#include <queue>
#include <stack>
#include <vector>
#include <array>
#include <string>
#include <iomanip>
#include <cstring>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define mp make_pair
#define eb emplace_back
#define F first
#define S second
using namespace std;
using namespace __gnu_pbds;

typedef long long int ll;
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ost;

const ll maxN = 1e7;
const ll INF = 1e17;
const ll MOD = 1e9 + 7;

ll xs[] = {-1, 1, 0, 0, -1, 1, 1, -1};
ll ys[] = {0, 0, -1, 1, -1, 1, -1, 1};

ll segtree[maxN << 2];
ll lazy[maxN << 2];
ll A[maxN];

inline ll left(ll x){
	return x << 1;
}

inline ll right(ll x){
	return (x<<1) + 1;
}

void build(ll node, ll start, ll end){
	if(start == end)
		segtree[node] = A[start];
	else{
		ll mid = (start + end)/2;
		build(left(node), start, mid);
		build(right(node), mid+1, end);
		segtree[node] = segtree[left(node)] + segtree[right(node)];
	}
}

void update(ll node, ll start, ll end, ll l, ll r, ll val){
	if(lazy[node] != 0){
		segtree[node] += (end-start+1)*lazy[node];
		if(start != end){
			lazy[left(node)] += lazy[node];
			lazy[right(node)] += lazy[node];
		}
		lazy[node] = 0;
	}
	if(start > end or l > start or r < end)
		return ;
	else if(start >= l and r >= end){
		segtree[node] += val;
		if(start != end){
			lazy[left(node)] += val;
			lazy[right(node)] += val;
		}
	}
	else{
		ll mid=(start + end)/2;
		update(left(node), start, mid, l, r, val);
		update(right(node), mid+1, end, l, r, val);
		segtree[node] = segtree[left(node)] + segtree[right(node)];
	}
}

ll sums(ll node, ll start, ll end, ll l, ll r){
	if(lazy[node] != 0){
		segtree[node] += (end-start+1)*lazy[node];
		if(start != end){
			lazy[left(node)] += lazy[node];
			lazy[right(node)] += lazy[node];
		}
		lazy[node] = 0;
	}
	if(l > end or r < start or start > end)
		return 0;
	if(l <= start and r >= end)
		return segtree[node];
	ll mid = (start+end)/2;
	return sums(left(node), start, mid, l , r) + sums(right(node), mid + 1, end, l , r);
}

int main(){
	cin.sync_with_stdio(false);
	cin.tie(0);
	map<ll, ll> mpl;
	ll n, m;
	cin >> n >> m;
	ll a, b;
	for(ll i=0; i<n; i++){
		cin >> a >> b;
		mpl[a] += b;
	}
	for(auto &x : mpl){
		if(x.second >= m){
			cout << x.first;
			return 0;
		}
		m -= x.second;
	}
}

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

using namespace std;

int main()
{
  string x;
  cin >> x;
  if (x[2] == x[3] && x[4] == x[5])
  {
    cout << "Yes\n";
  }
  else
  {
    cout << "No\n";
  }
  return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int k,n,ans[510][510];
int main()
{
	scanf("%d",&k);
	if(k==1)return printf("1\n1"),0;
	if(k==2)return printf("2\n1 1\n2 2"),0;
	n=(k+1)/2;
	if(n&1)++n;
	printf("%d\n",n);
	int b=k-n,a=n-b,cnt=1;
//	printf("%d %d\n",a,b);
	for(int i=1;i<=n;cnt+=i<=b?2:1,++i)
		for(int j=1;j<=n;++j)ans[j][(j+i-2)%n+1]=cnt+(i<=b&&j&1);
	for(int i=1;i<=n;++i)
	{
		for(int j=1;j<=n;++j)printf("%d ",ans[i][j]);
		printf("\n");
	}
	return 0;
}


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

int main() {
	int a,b,c,d,e;
	cin >> a;
	c = 0;
	d = 0;
	e = 0;
	for (int i = 0; i < a; i++) {
		cin >> b;
		if (b<=c) {
			d = d+1;
			if (d > e) {
				e = d;
			}
		} else if (b>c) {
			d = 0;
		}
		c = b;
	}
	cout << e;
}


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


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

    long long a;
    long long sum = 0;
    for(int i = 0; i < n; i++){
        cin >> a;
        sum += a - 1;
    }
    cout << sum << endl;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please

const int cm = 1 << 18;
char cn[cm], *ci = cn, ct;
inline int getint() {
	int A = 0;
	while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
	return A;
}

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

	fread_unlocked(cn, 1, cm, stdin);
	int N = getint();
	int A[100000];
	ll sa = 0;
	rep(i, N) A[i] = getint();;
	rep(i, N) {
		int b = getint();
		if (A[i] >= b) sa -= A[i] - b;
		else sa += (b - A[i]) / 2;
	}
	if (sa >= 0) co("Yes");
	else co("No");

	Would you please return 0;
}

Measured memory_bytes: 512
//int a = stoi(c); 文字列をintへ
//小文字から大文字
//transform(a.begin(), a.end(), a.begin(), ::toupper);
//途中の出力をそのまま残さない
//数値計算 個数以外はdouble
//map<キー,値> p は辞書。p[キー] = 値
//map 全探索
//auto begin = p.begin(), end = p.end();
//for (auto it = begin; it != end; it++) {}
//mapのキー：it->first mapのバリュー：it->second
//絶対値 abs()
//入力は空白で切れる
//大文字判定 isupper(文字) 小文字判定 islower(文字)
//do{}while(next_permutation(ALL(配列)))
//while(N)で回すとき、Nはコピーを作っておく
//小文字に対応する文字コード：S[i] - 'a'
//文字コード→小文字：(char)(数字+'a')
//グラフの距離:隣接行列で扱う
//等価なものに変換する思考
//bool型　初期値はTrue
//島渡りの問題：中間ノードに着目
//配列はvector<>を使う：意味わからないエラーがなくなる。
//背反な事象にちゃんとわける
//チェックリストはマップを使う
//数が大きい時の比較はstring型で行う
#include <bits/stdc++.h>
#define rep(i,N) for(int i = 0; i < N;i++)
#define ALL(a) (a).begin(),(a).end()
#define ll long long int
using namespace std;

// K進数でのNの桁数
ll dig(ll N, ll K) {
	ll dig = 0;
	while (N) {
		dig++;
		N /= K;
	}
	return dig;
}
// a,bの最大公約数
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a%b);
}

ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}

//nC2の計算
ll C(ll N) {
	return N * (N - 1) / 2;
}

//円周率
const double PI = 3.14159265358979323846;

int main() {
	ll s; cin >> s;
	map<ll, ll> p;
	ll m = 1;
	while (1) {
		p[s] = 1;
		if (s % 2 == 0)s = s / 2;
		else s = 3 * s + 1;
		m++;
		if (p[s] == 1) {
			cout << m << endl;
			return 0;
		}
	}
}

Measured memory_bytes: 256
//This sourcecode is under GPLv3
//http://yeguanghao.xyz
#include <bits/stdc++.h>
#define rep(name,start,end,step) for(int name=start;name<=end;name+=step)
using namespace std;
#define Pn(x) printf("%d\n",x)
#define Ps(x) printf("%d ",x)
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define PROB
inline void R(int &x) {
	x=0; int f=1; char ch=getchar();
	while(ch<'0'||ch>'9') {if(ch=='-')f=-1; ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	x*=f;
}
void Redirect() {
	freopen(PROB".in","r",stdin);
#ifndef YGHDEBUG
	freopen(PROB".out","w",stdout);
#endif
}
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
int ma=INT_MAX,mb=-1;
int n;
int main() {
	R(n);
	while(n--) {
		int t; R(t);
		mb=max(mb,t);
		ma=min(ma,t);
	}
	Pn(mb-ma);
}



Measured memory_bytes: 256
//
// Created by yamunaku on 2019/11/05.
//

#include <bits/stdc++.h>

using namespace std;

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repl(i, l, r) for(int i = (l); i < (r); i++)
#define per(i, n) for(int i = ((n)-1); i >= 0; i--)
#define perl(i, l, r) for(int i = ((r)-1); i >= (l); i--)
#define all(x) (x).begin(),(x).end()
#define MOD9 998244353
#define MOD1 1000000007
#define IINF 1000000000
#define LINF 1000000000000000000
#define SP <<" "<<
#define CYES cout<<"Yes"<<endl
#define CNO cout<<"No"<<endl
#define CFS cin.tie(0);ios::sync_with_stdio(false)
#define CST(x) cout<<fixed<<setprecision(x)

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vector<int>> mti;
typedef vector<ll> vl;
typedef vector<vector<ll>> mtl;

int main(){
    int n;
    cin >> n;
    CST(10);
    cout << (double)((n+1)/2)/n << endl;
    return 0;
}


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

int main() {
	// your code goes here
	int a, b, c, sum;
	cin >> a >> b >> c;
	
	sum = b*10 + c;
	
	if(sum % 4 == 0) cout << "YES" << endl;
	else cout << "NO" << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    long long int a[n];
    int i;
    for(i=0;i<n;i++)
    cin>>a[i];
    sort(a,a+n);
    cout<<a[n-1]-a[0];
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <variant>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/range/irange.hpp>
#include <boost/range/adaptor/indexed.hpp>
#define FOR(i,k,n)  for(int i = (k);i < (n);++i)
#define REP(i,n)    FOR(i,0,n)
#define ALL(x) begin(x),end(x)

using namespace std;
using namespace boost::adaptors;
using namespace std::string_literals;
using ll = int64_t;
using vecint = vector<int>;
using vecll = vector<ll>;
using boost::irange;
constexpr ll MOD = 1000000007;

ll pmod(ll base, ll index) {
  if (index == 0) return 1;
  if (index%2 == 1) return pmod(base, index-1) * base % MOD;
  ll h = pmod(base, index/2);
  return h * h % MOD;
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  ll n,k;
  cin>>n>>k;
  vecll v(k+1);
  FOR(i,1,k+1) {
    v[i] = pmod(k/i, n);
  }
  for (int i = k; i > 0; --i) {
    for (int j = 2*i; j <= k; j += i) {
      v[i] += MOD - v[j];
      v[i] %= MOD;
    }
  }
  ll ans = 0;
  FOR(i,1,k+1) {
    ans += i * v[i] % MOD;
    ans %= MOD;
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 3992
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.OptionalInt;
import java.util.regex.Pattern;
import java.util.stream.Stream;

public class Main {
  public static void main(String[] args) {

    new Main().run();
  }

  public void run() {
    
    try(BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {

      int n = Integer.parseInt(br.readLine());
      String line = br.readLine();
      final Pattern delim = Pattern.compile("\\s");
      int[] arrayS = delim
        .splitAsStream(line)
        .parallel()
        .mapToInt(Integer::parseInt)
        .toArray();

      OptionalInt max =
        Arrays.stream(arrayS).max();

      dispIntArray( countingSort(arrayS, max.getAsInt()) );
    }
    catch ( IOException e ) {
      System.out.println("IOException!");
    }

  }

  public int[] countingSort(int[] a, int k) {

    int   aLength = a.length;
    int[] result  = new int[aLength];
    int[] counter = new int[k+1];

    for (int var : a) {
      counter[var]++;
    }

    for (int i=1, max=k+1; i < max; i++) {
      counter[i] += counter[i-1];
    }

    for (int i=aLength-1, val=0; i>=0; i--) {
      val = a[i];
      result[counter[val]-1] = val;
      counter[val]--;
    }

    return result;
  }

  public void dispIntArray(int[] target) {
    StringBuilder s = new StringBuilder();

    for (int i : target) { s.append(i).append(" "); }
    s.setLength(s.length()-1);

    System.out.println(s);
  }
}


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

bool flag(int n){
    int a[5], i;
    bool Flag;
    Flag = false;
    i = 0;
    while(n > 0){
        a[i] = n%10;
        n /= 10;
        i++;
    }
    if(a[0] == a[4] && a[1] == a[3]){
        Flag = true;
    }

    return Flag;
}

int main(){
    int A, B, cnt;
    bool Flag;
    cnt = 0;
    cin >> A >> B;
    for(int i = A; i <= B; i++){
        Flag = flag(i);
        if(Flag){
            cnt++;
        }
    }

    cout << cnt << endl;
}

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

int main(void) {
	const char *SEP = " ";
	int N;
	char input_str[512];
	char *num_str;
	char arr[100];
	int i;
	int cnt = 0;

	fgets(input_str, sizeof(input_str), stdin);
	N = atoi(input_str);
	fgets(input_str, sizeof(input_str), stdin);
	num_str = strtok(input_str, SEP);
	for ( i = 0; i < N; i++ ) {
		arr[i] = atoi(num_str);
		num_str = strtok(NULL, SEP);
	}

	/*
	for ( i = 0; i < N; i++ ) {
		printf("arr[%d] = %d", i, arr[i]);
	}
	*/

	for ( i = 0; i < N; i++ ) {
		if ( i % 2 ) continue;
		if ( arr[i] % 2 ) cnt++;
	}

	printf("%d\n", cnt);

	return 0;
}


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

using namespace std;

typedef long long ll;
typedef vector<ll> v1;

const ll mod = 1000000007;

ll n;
ll a[200000];
ll ans;

int main(){
  cin >> n;
  for(ll i = 0;i < n;i++) cin >> a[i];
  ll r = 0;
  ll l = 0;
  l = accumulate(a,a+n,0ll);
  ans = abs(r-l);
  for(ll i = 0;i < n;i++){
    r += a[i];
    l -= a[i];
    ans = min(ans,abs(r-l));
  }
  cout << ans << endl;

}


Measured memory_bytes: 1792
import math
X, Y = map(int, input().split())

MOD = 1000000007


def combination(n, r):
    r = min(r, n - r)

    num = 1
    den = 1

    for i in range(1, r + 1):
        num = num * (n + 1 - i) % MOD
        den = den * i % MOD

    return num * pow(den, MOD - 2, MOD) % MOD


if (X + Y) % 3 != 0:
    print(0)
    exit()

m = (2 * Y - X) / 3
n = (2 * X - Y) / 3
m = int(m)
n = int(n)

if m < 0 or n < 0:
    print(0)
    exit()

print(int(combination(m + n, n)) % MOD)

Measured memory_bytes: 3064
n=int(input())
if 599>=n>=400:
    print(8)
elif 799>=n>=600:
    print(7)
elif 999>=n>=800:
    print(6)
elif 1199>=n>=1000:
    print(5)
elif 1399>=n>=1200:
    print(4)
elif 1599>=n>=1400:
    print(3)
elif 1799>=n>=1600:
    print(2)
elif 1999>=n>=1800:
    print(1)

Measured memory_bytes: 9216
<?php

function extGcd($a, $b, &$x, &$y) {
    if ($b === 0) {
        $x = 1;
        $y = 0;
        return $a;
    }

    $d = extGcd($b, $a % $b, $y, $x);
    $y -= intdiv($a, $b) * $x;
    return $d;
}

const MOD = 1000000007;
const N_MAX = 2005;

$fac = []; $fac[0] = 1; $fac[1] = 1;
$inv = []; $inv[1] = 1;
$finv = []; $finv[0] = 1; $finv[1] = 1;
for ($i = 2; $i < N_MAX; ++$i) {
    $fac[$i] = $fac[$i - 1] * $i % MOD;

    $x; $y; extGcd($i, MOD, $x, $y);
    $inv[$i] = ($x % MOD + MOD) % MOD;

    $finv[$i] = $finv[$i - 1] * $inv[$i] % MOD;
}

function COM($n, $k) {
    global $fac;
    global $finv;

    if ($n < $k) {
        return 0;
    }

    if ($n < 0 || $k < 0) {
        return 0;
    }

    return $fac[$n] * ($finv[$k] * $finv[$n - $k] % MOD) % MOD;
}

fscanf(STDIN, "%d %d", $n, $k);

for ($i = 1; $i <= $k; ++$i) {
    echo COM($n - $k + 1, $i) * COM($k - 1, $i - 1) % MOD, PHP_EOL;
}


Measured memory_bytes: 4856
#include <bits/stdc++.h>
using namespace std;
char a[11];
int main()
{
	int n,m,i;
	scanf("%d",&n);
	scanf("%s",a);
	scanf("%d",&m);
	for(i=0;i<n;i++)
	{
		if(a[i]!=a[m-1])
			printf("*");
		else
			printf("%c",a[i]);
	}
    return 0;
}

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

int flag1[30][30];
int flag2[30][30];
int main(void){
	int i,t,f;
	char s[15];
	t=0;
	while(1){
		if(t==0){
			printf("?aaaa\n");
			flag1[1][1]=1;
		}
		else{
			for(i=1;i<=26;i++){
				if(flag1[s[strlen(s)-1]-'a'+1][i]==0){
					printf("?%c%caa\n",s[strlen(s)-1],i-1+'a');
					flag1[s[strlen(s)-1]-'a'+1][i]=1;
					break;
				}
			}
		}
		t++;

		fflush(stdout);
		strcpy(s,"");
		scanf("%s",s);
		f=0;
		if(s[0]!='a')f=1;
		if(strlen(s)==1){
			if(flag2[0][s[0]-'a'+1]==1)f=1;
			else flag2[0][s[0]-'a'+1]=1;
		}
		else{
			if(flag2[s[0]-'a'+1][s[1]-'a'+1]==1)f=1;
			else flag2[s[0]-'a'+1][s[1]-'a'+1]=1;
		}
		if(f==1){
			printf("!OUT\n");
			break;
		}
	}
	return 0;
}

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

int main(){
  int H,W;
  int i,j;
  while(1){
    cin>>H>>W;
    if(H==0 && W==0) break;

    for(j=0;j<W;j++){
      cout<<"#";
    }
    cout<<endl;

    for(i=0;i<H-2;i++){
      cout<<"#";
      for(j=0;j<W-2;j++){
        cout<<".";
      }
      cout<<"#"<<endl;
    }
    for(j=0;j<W;j++){
      cout<<"#";
    }
    cout<<endl<<endl;
  }

  return 0;
}

Measured memory_bytes: 1152
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
int main() {
	int n;
	cin >> n;
	int d1[100];
	int d2[100];
	for (int i = 0;i < n;i++) {
		cin >> d1[i] >> d2[i];
	}
	bool flag = false;
	for (int i = 0;i < n-2;i++) {
		if ((d1[i] == d2[i]) && (d1[i + 1] == d2[i + 1]) && (d1[i + 2] == d2[i + 2]))
			flag = true;
	}
	if (flag) cout << "Yes";
	else cout << "No";
}

Measured memory_bytes: 3620