akhauriyash/Code-Regression huggingface dataset:
# エラトステネスの篩, 累積和
def make_prime_table(n):
    sieve = list(range(n + 1))
    sieve[0] = -1
    sieve[1] = -1
    for i in range(2, int(n ** 0.5) + 1):
        if sieve[i] != i:
            continue
        for j in range(i * i, n + 1, i):
            if sieve[j] == j:
                sieve[j] = i
    return sieve


max_lr = 10 ** 5

prime_table = make_prime_table(max_lr)

cs = [0] * (max_lr + 1)
for i in range(3, max_lr + 1, 2):
    j = (i + 1) // 2
    if prime_table[i] == i and prime_table[j] == j:
        cs[i] = 1
for i in range(1, max_lr + 1):
    cs[i] += cs[i - 1]

Q = int(input())
result = []
for _ in range(Q):
    l, r = map(int, input().split())
    result.append(cs[r] - cs[l - 1])
#print('\n'.join(str(i) for i in result))
print(*result, sep='\n')


Measured memory_bytes: 18960
n, m, l = map(int, raw_input().split())

A, B = [], []
for ni in range(n):
    A.append(map(int, raw_input().split()))

for mi in range(m):
    B.append(map(int, raw_input().split()))

_B = list(map(list, zip(*B)))

for a in A:
    ret = []
    for b in _B:
        calc_result = 0
        for i, j in zip(a, b):
            calc_result += i*j
        ret += [calc_result]
    print "%s" % ' '.join(map(str, ret))

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

typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
#define ALL(v) (v).begin(),(v).end()
#define CLR(t,v) memset(t,(v),sizeof(t))
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< ")";}
template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cout<<(*i)<<" ";cout<<endl;}
template<class T>void chmin(T&a,const T&b){if(a>b)a=b;}
template<class T>void chmax(T&a,const T&b){if(a<b)a=b;}


int nextInt() { int x; scanf("%d", &x); return x;}

int main2() {
  int X = nextInt();
  int A = nextInt();
  if (X < A) {
    cout << 0 << endl;
  } else {
    cout << 10 << endl;
  }
  return 0;
}

int main() {

#ifdef LOCAL
  for (;!cin.eof();cin>>ws)
#endif
    main2();
  return 0;
}


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

string station = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";

int n;
int main() {
    while(cin>>n) {
        if(n==0) return 0;
        vector<int> vec(n);
        rep(i,n) {
            int a; cin>>a;
            vec[i]=a;
        }
        string ss;
        cin>>ss;
        rep(i,ss.size()) {
            int a = i % vec.size();
            int t = station.find(ss[i])-vec[a];
            if(t<0) t += station.size();
            t %= station.size();
            cout<<station[t];
        }
        cout<<endl;

    }

    return 0;
}

Measured memory_bytes: 1212
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
    int N;
    cin >> N;
    long long int C, K;
    cin >> C >> K;
    
    vector<long long int> T(N);
    for(int n=0; n<N; n++) {
        cin >> T[n];
    }

    sort(T.begin(), T.end());
    
    int ans=0;
    int cur=0;
    while(cur<N) {
        int ind=upper_bound(T.begin(), T.end(), T[cur]+K)-T.begin();
        ind -= cur;
        // cout << cur << ", " << ind << endl;
        
        if(ind<=C) {
            ans++;
            cur += ind;
        } else {
            ans++;
            cur += (int)C;
        }
    }
    
    cout << ans << endl;


    return 0;
    
}

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

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt(), a[] = new int[n], factors[] = new int[1000001];
		for (int i = 0; i < n; i++)
			a[i] = sc.nextInt();
		Arrays.sort(a);
		int m = a[n - 1];
		boolean sieve[] = new boolean[m + 1];
		for (int i = 0; i < m + 1; i++)
			sieve[i] = true;
		for (int i = 0; i < n; i++)
			if (sieve[a[i]])
				for (int j = a[i] * 2; j < m + 1; j = j + a[i])
					sieve[j] = false;
		int ans = 0;
		for (int i = 0; i < n; i++) {
			if (i > 0 && a[i] == a[i - 1])
				continue;
			if (i < n - 1 && a[i] == a[i + 1])
				continue;
			if (sieve[a[i]])
				++ans;
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 65820
import java.io.*;

import java.util.Scanner;



public class Main{
	static String int2Alpha(int num){
		if(num==97+0) return "a";
		if(num==97+1) return "b";
		if(num==97+2) return "c";
		if(num==97+3) return "d";
		if(num==97+4) return "e";
		if(num==97+5) return "f";
		if(num==97+6) return "g";
		if(num==97+7) return "h";
		if(num==97+8) return "i";
		if(num==97+9) return "j";
		if(num==97+10) return "k";
		if(num==97+11) return "l";
		if(num==97+12) return "m";
		if(num==97+13) return "n";
		if(num==97+14) return "o";
		if(num==97+15) return "p";
		if(num==97+16) return "q";
		if(num==97+17) return "r";
		if(num==97+18) return "s";
		if(num==97+19) return "t";
		if(num==97+20) return "u";
		if(num==97+21) return "v";
		if(num==97+22) return "w";
		if(num==97+23) return "x";
		if(num==97+24) return "y";
		if(num==97+25) return "z";
		return "hoe";
	}

	public static void main(String[] args){
                Scanner scanner=new Scanner(System.in);
                String str=scanner.next();
		int k=scanner.nextInt();
int len=str.length();
		int[] dic=new int[len];

		for(int i=0;i<str.length();i++){
			dic[i]=str.charAt(i);
		}
		for(int i=0;i<str.length();i++){
			if(dic[i]!=97 && dic[i]+k>=123) {
				k=k-(123-dic[i]);
				dic[i]=97;
			}
		}
len--;
                dic[len]+=k;
while(dic[len]>122)dic[len]-=26;
		for(int i=0;i<str.length();i++){
			System.out.print(int2Alpha(dic[i]));
		}
	}
}

Measured memory_bytes: 20788
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<stack>
#include<cmath>
#include<sstream>
#include<string>
#include<numeric>
#include<complex>
using namespace std;
typedef long long ll;
ll mod = 1e9+7;
//ll mod = 998244353;
#define rep(i,n) for(int i = 0; i < (n); ++i)

int main(){
    int n;
    cin >> n;
    vector<ll> a(n+1);
    a[n] = 0;
    ll cnt = 0;
    ll ans = 0;
    rep(i, n+1) {
        cin >> a[i];
        if ( a[i] == 0 ) {
            ans += cnt / 2;
            cnt = 0;
        }
        else {
            cnt += a[i];
        }
//        cout << cnt << " " << ans << endl;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1024
#include <cstdio>
#include <algorithm>
#include <map>

using namespace std;

int main() {
  int N;
  long long A[200010], sum[200010];
  map<long long, long long> counts;
  int i;
  scanf("%d", &N);
  sum[0] = 0;
  for (i = 0; i < N; i++) {
    scanf("%lld", &A[i]);
  }
  for (i = 1; i < N+1; i++) {
    sum[i] = sum[i-1] + A[i-1];
  }
  for (i = 0; i < N+1; i++) {
    if (counts.find(sum[i]) != counts.end()) {
      counts[sum[i]] += 1;
    } else {
      counts[sum[i]] = 1;
    }
  }
  long long ans = 0;
  for (auto x : counts) {
    long long n = x.second;
    ans += n*(n-1)/2;
  }   
  printf("%lld", ans);
  return 0;
}


Measured memory_bytes: 15872
import math
a, b, h, m = map(int, input().split())

# 時間を分に変換
h_m = h * 60
# 時針の角度を計算
h_dgree = (h_m + m)*0.5

# 分針の角度を計算
m_dgree = m * 6

# 時針と分針の角度を計算
ab_dgree = h_dgree - m_dgree

# 余弦定理
result = a**2 + b**2 - 2*a*b*math.cos(math.radians(ab_dgree))
print(math.sqrt(result))

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

using namespace std;

int main() {
	int l, r;
	cin >> l >> r;
	long long ans = (1LL*l*r)%2019;
	for (int i = l; i < min(r, l+5000); i++) {
		for (int j = i+1; j <= min(r, l+5000); j++) ans = min(ans, (1LL*i*j)%2019);
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE BinaryLiterals #-}
{-# LANGUAGE MultiWayIf #-}
{-# LANGUAGE NumDecimals #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TupleSections #-}

import Control.Applicative
import Control.Arrow
import Control.Monad
import Control.Monad.ST

import Data.Char
import Data.List
import Data.Maybe

import qualified Data.ByteString.Char8 as B

import Data.Array.ST.Safe
import Data.STRef

import Debug.Trace
import Text.Printf

readInt = readLn :: IO Int
readInts = map ( fst . fromJust . B.readInt ) . B.words <$> B.getLine
readNInts = readInt >>= flip replicateM readInt

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

main = do
	[ a, b ] <- readInts
	if ( a + b ) `mod` 2 == 0
		then print $ ( a + b ) `div` 2
		else putStrLn "IMPOSSIBLE"

Measured memory_bytes: 380
#include<iostream> 
#include<bits/stdc++.h> 
using namespace std;
int main(){ 
	ios::sync_with_stdio(false); 
	cin.tie(0); 
	int N,W,V;
	cin>>N>>W;
	V=0;
	vector<int> w(N),v(N); 
	for(int i=0;i<N;i++){ 
		cin>>w[i]>>v[i]; 
		V+=v[i]; 
	} 
	vector<vector<int>> dp(N+1,vector<int>(V+1,W+1));
	for(int i=0;i<=N;i++){ 
		dp[i][0]=0; 
	} 

	for(int i=1;i<=N;i++){ 
		for(int j=0;j<=V;j++){ 
			if(j-v[i-1]>=0){
				dp[i][j]=min(dp[i-1][j-v[i-1]]+w[i-1],dp[i-1][j]); 
			}else{
				dp[i][j]=dp[i-1][j];
			}
		} 
	} 
	vector<int> minw(V+1);
	for(int i=1;i<=V;i++){ 
		minw[i]=dp[0][i]; 
		for(int k=1;k<=N;k++){ 
			minw[i]=min(minw[i],dp[k][i]); 
		} 
	} 
	int maxj=0;
	for(int j=0;j<=V;j++){ 
		if(minw[j]<=W){
			maxj=j;
		} 
	} 
	cout<<maxj; 



	
	
	return 0;
} 



Measured memory_bytes: 40192
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define repone(i,n) for(int i=1;i<(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define Rep(j,n) for(int j=0;j<(int)(n);++j)
#define Repo(j,o,n) for(int j=o;j<(int)(n);++j)
#define Repone(j,n) for(int j=1;j<(int)(n);++j)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define int long long
#define pb(a) push_back(a)
#define eraser(v,i) (v).erase(v.begin()+(i))
#define pbpair(a,b) push_back(make_pair(a,b))
#define MOD 1000000007
#define MODB 998244353
#define INF 9223372036854775807

signed main()
{
  int x=0,y=1,z=0,w=0,n=0,m=0;
  std::cin >> x;
  std::vector<int> v(x);
  rep(i,x)std::cin >> v[i];
  sort(all(v));
  std::cout << v[x-1]-v[0] << '\n';
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize ("-ffloat-store")  
#pragma GCC optimize ("-fno-defer-pop")
typedef long long int ll; 
typedef long double ld; 

string s,t;

int main()
{
	std::ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	
	cin>>s>>t;
	
	vector <ll> vec[26];
	
	for(ll i=0;i<s.size();++i)
	{
		vec[s[i]-'a'].push_back(i);
	}
	
	ll ans = 0;
	
	ll st = -1;
	ll k=0;
	for(ll j=0;j<t.size();j++)
	{
		ll v = upper_bound(vec[t[j]-'a'].begin(),vec[t[j]-'a'].end(),st)-vec[t[j]-'a'].begin();
		
		if(v==vec[t[j]-'a'].size())
		{
			if(vec[t[j]-'a'].size()==0)
			{
				cout<<-1<<endl;return 0;
			}
			v = 0;
		}
		
		v = vec[t[j]-'a'][v];
		
		if(v>st)
		{
			ans += (v-st);
		}
		else{
			k++;
			ans += (s.size()-st-1)+v+1;
		}
		st = v;
	}
	
	if(log10(k)>100)
	{
		cout<<-1<<endl;return 0;
	}
	
	cout<<ans<<endl;
}



Measured memory_bytes: 1736
import java.util.*;

class Main {
	private static boolean isRightTriangle(int[] a) {
		Arrays.sort(a);
		return a[2]*a[2] == a[1]*a[1] + a[0]*a[0];
	}

	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();

		for (int i = 0; i < n; i++) {
			int arr[] = new int[3];
			for (int j = 0; j < 3; j++) {
				arr[j] = sc.nextInt();
			}
			System.out.println(isRightTriangle(arr) ? "YES" : "NO");
		}
	}
}

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

using namespace std;

#define int long long
#define endl '\n'
#define maxn 210
const int MOD = 1000000007;

int g[maxn][maxn];
constexpr int INF = INT_MAX;

void solve() {
    int n, m, r;
    cin >> n >> m >> r;

    vector<int> p(r);
    for (int i = 0; i < r; i++) {
        cin >> p[i];
    }
    sort(p.begin(), p.end());
    for (int i = 0; i < maxn; i++)for (int j = 0; j < maxn; j++)if (i != j)g[i][j] = INF;
    for (int i = 0; i < m; i++) {
        int a, b, c;
        cin >> a >> b >> c;

        g[a][b] = g[b][a] = c;
    }
    for (int k = 1; k <= n; k++) {
        for (int i = 1; i <= n; i++)
            for (int j = 1; j <= n; j++) {
                g[i][j] = min(g[i][j], g[i][k] + g[k][j]);
            }
    }
    int pasn = LLONG_MAX;
    do {
        int ans = 0;
        for (int i = 1; i < r; i++)
            ans += g[p[i - 1]][p[i]];
        pasn = min(pasn, ans);
    } while (next_permutation(p.begin(), p.end()));
    cout << pasn << endl;
}

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int t = 1;
//    cin >> t;

    while (t--)
        solve();
    return 0;
}

Measured memory_bytes: 640
#include <cstdio>
#include <cctype>
#include <cstring>
#include <algorithm>
#define repu(i,x,y) for (int i=x; i<=y; ++i)
#define repd(i,x,y) for (int i=x; i>=y; --i)
using namespace std;

typedef long long LL;
int n,m,d[100100],f[60][100100],ans[100100];
LL k;

int getint()
{
    char ch;
    while (!isdigit(ch=getchar()) && ch!='-');
    bool flag=ch=='-';
    if (flag)
        ch=getchar();
    int x=ch-'0';
    for (; isdigit(ch=getchar()); x=x*10+ch-'0');
    return flag?-x:x;
}

void merge(int *f,int *g,int *h)
{
    repu(i,1,n)
        h[i]=f[g[i]];
}

int main()
{
    n=getint()-1;
    repu(i,0,n)
        d[i]=getint();
    repd(i,n,1)
        d[i]-=d[i-1];
    repu(i,1,n)
        f[0][i]=ans[i]=i;
    for (scanf("%d%lld",&m,&k); m--;)
    {
        int x=getint();
        swap(f[0][x],f[0][x-1]);
    }
    repu(i,0,59)
    {
        if (k&1)
            merge(f[i],ans,ans);
        if (!(k>>=1))
            break;
        merge(f[i],f[i],f[i+1]);
    }
    LL sum=d[0];
    printf("%lld\n",sum);
    repu(i,1,n)
        printf("%lld\n",sum+=d[ans[i]]);
    return 0;
}

Measured memory_bytes: 25472
#include <iostream>
#include <map>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <sstream>
#include <cmath>
#include <math.h>
#include <string>
using namespace std;
typedef long long ll;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    int l[n] , r[n] , c = 0;
    for( int i = 0 ; i < n ; i++ ) {
        cin >> l[i] >> r[i];
        c += r[i] - l[i] + 1;
    }
    cout << c;
}





Measured memory_bytes: 256
import itertools
import math

n = int(input())
p = list(map(int, input().split()))
q = list(map(int, input().split()))

n_list = [i for i in range(1, n + 1)]
perms = itertools.permutations(n_list, n)
i = 1
for perm in perms:
    if list(perm) == p:
        a = i
    if list(perm) == q:
        b = i
    i += 1
print(abs(a - b))



Measured memory_bytes: 3064
k = int(input())
count = 1
n = 0
if k % 2 == 0 or k % 5 == 0:
    print(-1)
else:
  while 1:
      n = (n * 10 + 7) % k  
      if n == 0:
        break 
      count += 1
  print(count)

Measured memory_bytes: 9088
#include <iostream>
#include <complex>
#include <cmath>
using namespace std;

typedef complex<double> P;
const double PI = acos(-1);

int main() {  
  P p;
  P dir(0, 1.0);

  for(;;) {
    int x, y;
    scanf("%d,%d", &x, &y);
    if( x == 0 && y == 0 ) break;
    p += dir * (double)x;
    dir *= polar(1.0, -y / 180.0 * PI);    
  }
  
  printf("%d\n%d\n", (int)p.real(), (int)p.imag());
  
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b)  for(int i=(a),i##formax=(b);i< i##formax;i++)
#define FORR(i,a,b) for(int i=(a),i##formin=(b);i>=i##formin;i--)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define pcnt __builtin_popcount
#define sz(x) (int)(x).size()
#define maxs(x,y) x=max((x),(y))
#define mins(x,y) x=min((x),(y))
#define show(x) cout<<#x<<" = "<<(x)<<endl;
#define all(a) ((a).begin()),((a).end())
#define each(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define bit(n) (1LL<<(n))
typedef long long ll;
typedef __int128_t lll;
template<class T>using V=vector<T>;
template<class T>using VV=V<V<T>>;
template<class T,class Y>using P=pair<T,Y>;
template<class T,class Y>ostream& operator<<(ostream&o,P<T,Y>&p){return o<<"("<<p.fi<<","<<p.se<<")";}
template<class T>ostream& operator<<(ostream&o,V<T>&v){for(T&t:v)o<<t<<",";return o;}
template<class T>void uniq(V<T>&v){sort(all(v));v.erase(unique(all(v)), v.end());}
template<class A,size_t N,class T>void Fill(A(&a)[N],const T&v){fill((T*)a,(T*)(a+N),v);}

const int MOD = 1e9+7; //998244353;

lll gcd(lll a,lll b,lll&x,lll&y){if(!b){x=1;y=0;return a;}lll d=gcd(b,a%b,y,x);y-=a/b*x;return d;}
ll modInv(ll a,ll m=MOD){lll x,y;gcd(a,m,x,y);return(x%m+m)%m;}
ll modPow(lll a,lll n,ll m=MOD){lll p=1;for(;n;n>>=1,a=a*a%m)if(n&1)p=p*a%m;return p;}
//V<ll>Fac,Rac;void setF(int n,int m=MOD){Fac=Rac=V<ll>(++n);Fac[0]=1;FOR(i,1,n)Fac[i]=Fac[i-1]*i%m;Rac[n-1]=modInv(Fac[n-1],m);FORR(i,n-1,1)Rac[i-1]=Rac[i]*i%m;}
//ll comb(int a,int b,int m=MOD){return a<b||b<0?0:Fac[a]*Rac[b]%m*Rac[a-b]%m;}

const int IINF = 1e9+6;
const ll LINF = 1e18;
const int N = 2e5;
int n, ans[N];
V<int> e[N], v[2], w[3];
void dfs(int a, int p, bool z){
  v[z].pb(a);
  for(int b:e[a]) if(p!=b) dfs(b, a, z^true);
}
int B(V<int>&v){
  int r=v.back();
  v.pop_back();
  return r;
}
main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> n;
  FOR(i, 1, n){
    int a, b;
    cin >> a >> b;
    a--; b--;
    e[a].pb(b);
    e[b].pb(a);
  }
  FOR(i, 1, n+1) w[i%3].pb(i);
  dfs(0, -1, false);
  int s0=sz(v[0]), s1=sz(v[1]);
  if(s0 > s1) swap(v[0], v[1]), swap(s0, s1);
  if(s0<=sz(w[0])){
    FOR(_, 0, s0) ans[B(v[0])] = B(w[0]);
    FOR(_, 0, s1) FOR(i, 0, 3) if(!w[i].empty()){
      ans[B(v[1])] = B(w[i]);
      break;
    }
  }else{
    while(!w[2].empty()) ans[B(v[0])] = B(w[2]);
    while(!w[1].empty()) ans[B(v[1])] = B(w[1]);
    while(!v[0].empty()) ans[B(v[0])] = B(w[0]);
    while(!v[1].empty()) ans[B(v[1])] = B(w[0]);
  }
  FOR(i, 0, n) cout << ans[i] << " ";
  cout << endl;
}

Measured memory_bytes: 24308
#include <iostream>

using namespace std;

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

	int length = s.size();
	for (char c = 'a'; c <= 'z'; c++) {
		int i;
		for (i = 0; i < length; i++) {
			if (s[i] == c) break;
		}
		if (i == length) {
			cout << c << endl;
			return 0;
		}
	}

	cout << "None" << endl;

	return 0;
}

Measured memory_bytes: 512
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <vector>
using namespace std;
static_assert(sizeof(long) >= 8, "sizeof(long) >= 8");
constexpr int mod = 998244353;
long fac[100001], inv[100001];
int dp[10001];
int solve(int x, int y) {
    dp[0] = 1;
    for (int i = 1; i <= x; i++)
        for (int j = 1; j <= y; j++)
            dp[j] = (dp[j] + (long) i * dp[j - 1]) % mod;
    long ans = 0;
    for (int i = 0; i <= y; i++)
        ans = (ans + dp[i] * inv[x + i]) % mod;
    return ans * fac[x] % mod * fac[x] % mod * fac[y] % mod * fac[x + y] % mod;
}
char a[10001], b[10001];
int main() {
    fac[0] = 1;
    for (int i = 1; i <= 100000; i++)
        fac[i] = fac[i - 1] * i % mod;
    inv[100000] = 812950533;
    for (int i = 100000; i >= 1; i--)
        inv[i - 1] = inv[i] * i % mod;

    scanf("%s%s", a, b);
    int x = 0, y = 0;
    for (int i = 0; a[i]; i++)
        if (a[i] == '1')
            (b[i] == '0' ? x : y)++;
    printf("%d\n", solve(x, y));
}


Measured memory_bytes: 1792
/******************** Beginning of Template **************************/
/************ ALL HEADER FILE ***********/
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <fstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <utility>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <cassert>

using namespace std;

/************* ALL DEFINE ***************/
#define MEM(a, b) memset(a, b, sizeof a);
#define FORS(i, j, k, step) for (int i=j; i<k; i+=step)
#define FOR(i, j, k) for (int i=j; i<k; i++)
#define RFORS(i, j, k, step) for (int i=j; i>=k; i-=step)
#define RFOR(i, j, k, step) for(int i=j; i>=k; i--)
#define REP(i, k) for(int i = (0); i < (k); i++ )
#define RREP(i, k) for(int i = j; i >= (k); i-- )

#define ALL(cont) cont.begin(), cont.end()
#define RALL(cont) cont.begin(), cont.end()
#define FOREACH(it, l) for(auto it=l.begin(); it != l.end(); it++)
#define mp make_pair
#define pb push_back
#define debug puts("Fango")
#define INF (int)MAX_INT
#define EPS (int)1e-9
#define PI acos(-1)
#define MOD 1000000007

/****************** TYPEDEF *****************/
typedef pair<int, int> pii;
typedef pair<int, pii> piii;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<pii> vii;
typedef vector<piii> viii;
typedef long long int32;
typedef unsigned long long uint32;
typedef long long int int64;
typedef unsigned long long int uint64;

template <class T>
    T sqr(T val) {
        return val * val;
    }


/*********************** End of Template **************************/

int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    string s;
    bool ans = 0;
    getline(cin, s);
    REP(i, s.size()) {
        if (s[i] == 'C') {
            FOR(j, i, s.size()) {
                if (s[j] == 'F') {
                    ans = 1;
                    break;
                }
            }
        }
    }
    cout << (ans ? "Yes" : "No") << endl;
    return 0;

}





Measured memory_bytes: 256
#[allow(unused_imports)]
use std::cmp::*;
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let n: usize = read();
    let k: usize = read();
    let mut h: Vec<isize> = (0..n).map(|_| read()).collect();

    h.sort();
    let mut ans = h[n - 1] - h[0];
    for i in 0..n - k + 1 {
        ans = min(ans, h[i + k - 1] - h[i]);
    }

    println!("{}", ans);
}

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

const long long M = 998244353;

signed main() {
	ios_base::sync_with_stdio(0); cin.tie(0);

	int n; cin >> n;
	vector<int> d(n+1);
	for (int i = 1; i <= n; i++) {
		cin >> d[i];
		if (i == 1 && d[i] != 0) {
			cout << 0; exit(0);
		}
		if (i != 1 && d[i] == 0) {
			cout << 0; exit(0);
		}
	}

    vector<int> cnt(n+1);
    for (int i = 1; i <= n; i++) {
		cnt[d[i]]++;
    }
    long long ans = 1;
    int mx = *max_element(d.begin(), d.end());
    for (int i = 1; i <= mx; i++) {
		for (int j = 1; j <= cnt[i]; j++) {
			ans *= cnt[i-1];
			ans %= M;
		}
    }
    cout << ans;

	return 0;
}


Measured memory_bytes: 1024
#include <stdio.h>
int main(void){
    // Your code here!
    int n;
    int w[100],t,s1,s2,a;
    s1=s2=0;
    scanf("%d",&n);
    for(int i=0; i<n;i++){
        scanf("%d",&w[i]);
    }
    a=100;
    for(t=1;t<n;t++){
        for(int i=0;i<=t;i++){
            s1+=w[i];
        }
        for(int i=t+1;i<n;i++){
            s2+=w[i];
        }
        if(a>abs(s1-s2))
            a=abs(s1-s2);
        s1=0;
        s2=0;
    }
    printf("%d",a);
}

Measured memory_bytes: 128
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;

class Node{
    int number;
    Node left;
    Node right;
    Node parent;

    Node(int number){
        this.number = number;
        left = null;
        right = null;
        parent = null;
    }

    void preorder(){
        System.out.print(" " + this.number);
        if(this.left != null)   this.left.preorder();
        if(this.right != null)  this.right.preorder();
    }

    void inorder(){
        if(this.left != null)   this.left.inorder();
        System.out.print(" " + this.number);
        if(this.right != null)  this.right.inorder();
    }

    void postorder(){
        if(this.left != null)   this.left.postorder();
        if(this.right != null)  this.right.postorder();
        System.out.print(" " + this.number);
    }
}

class Main{
    public static void main(String[] args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        
        int n = Integer.parseInt(br.readLine());

        Node[] tree = new Node[n];
        for(int i = 0; i < n; i++){
            tree[i] = new Node(i);
        }

        for(int i = 0; i < n; i++){
            String[] input = br.readLine().split(" ");
            int num = Integer.parseInt(input[0]);
            int left = Integer.parseInt(input[1]);
            int right = Integer.parseInt(input[2]);
            
            if(left+right != -2){
                if(left == -1){
                    tree[num].right = tree[right];
                    tree[right].parent = tree[num];
                }else if(right == -1){
                    tree[num].left = tree[left];
                    tree[left].parent = tree[num];
                }else{
                    tree[num].right = tree[right];
                    tree[num].left = tree[left];
                    tree[right].parent = tree[num];
                    tree[left].parent = tree[num];
                }
            }
        }

        Node root = tree[0];
        while(root.parent != null){
            root = root.parent;
        }

        System.out.println("Preorder");
        root.preorder();
        System.out.println("\nInorder");
        root.inorder();
        System.out.println("\nPostorder");
        root.postorder(); 
        System.out.println();     
    }
}


Measured memory_bytes: 24484
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
#define x first
#define y second
#define mp make_pair
#define pb push_back
#define enum(i,x,y) for(int i=(x);i<=(y);++i)
#define try(i,x,y) for(int i=(x);i>=(y);--i)
void readint(int &x)
{
	x=0;int f=1;char c;
	for(c=getchar();!isdigit(c);c=getchar())if(c=='-')f=-1;
	for(;isdigit(c);c=getchar())x=x*10+c-'0';
	x*=f;
}
inline void chkmin(int &x,int y){x>y?x=y:0;}
inline void chkmax(int &x,int y){x<y?x=y:0;}
const int MAXN=30005;

int n;

int main()
{
	#ifndef ONLINE_JUDGE
	//freopen("code.in","r",stdin);
	//freopen("code.out","w",stdout);
	#endif
	readint(n);
	if(n==3)return 0*printf("2 5 63\n");
	printf("2 3 4 9 ");n-=4;
	enum(i,2,5000)
	{
		if(n<=1)break;
		printf("%d %d ",i*6-4,i*6-2);
		n-=2;
	}
	enum(i,2,2500)
	{
		if(n<=1)break;
		printf("%d %d ",i*12-9,i*12-3);
		n-=2;
	}
	enum(i,1,5000)
	{
		if(!n)break;
		printf("%d ",i*6);
		--n;
	}
	return 0;
}

Measured memory_bytes: 384
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS
#include <cstdio>
//#include <cstdlib>
//#include <cstring>
#include <cmath>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <list>
#include <queue>
#include <set>
using namespace std;

#define MAXNUM 250000

int main(void){

	bool nonPrimeMap[MAXNUM] = { false };
	int count = 0;
	int result = 0;

	for (int i = 4;  i < MAXNUM; i = i + 2){
		nonPrimeMap[i] = true;
	}

	for (int i = 3; i < MAXNUM; i = i + 2){
		for (int j = 2; i * j < MAXNUM; j++){
			nonPrimeMap[i * j] = true;
		}
	}

	nonPrimeMap[1] = true;

	int n;
	while (scanf("%d", &n) != EOF)
	{
		if (n == 0) break;

		int count = 0;

		for (int i = n + 1; i <= n * 2; i++){
			if (!nonPrimeMap[i]) count++;
		}

		cout << count << endl;

	}


	return 0;
}

Measured memory_bytes: 1456
import * as fs from "fs";

let input = (fs.readFileSync("/dev/stdin", "utf8") as string).split("\n");
const s = input[0];

const a = new Array(26).fill(0);
for (let c of s) {
	a[c.charCodeAt(0) - "a".charCodeAt(0)] += 1;
}

let flg = false;
for (let i = 0; i < 26; i++) {
	if (a[i] === 0) {
		console.log(String.fromCharCode("a".charCodeAt(0) + i));
		flg = true;
		break;
	}
}
if (!flg) {
	console.log("None");
}


Measured memory_bytes: 7500
# 19:13
s = gets.to_s.chomp
k = gets.to_s.to_i

b = s.bytes
n = s.size

# p "az".bytes #=> [97, 122]
t = idx = nil
ans = 'a' * n
b.each_with_index do |c, i|
  
  if c == 97
    next
  else
    d = 123 - c
    if d <= k
      k -= d
    else
      ans[i] = s[i]
    end
  end
end

ans[-1] = (97 + (ans[-1].ord + k - 97) % 26).chr

puts ans

Measured memory_bytes: 3068
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <map>
#include <set>
#include <list>
#include <unordered_set>
#include <unordered_map>
#include <stdlib.h>

using namespace std;
 
typedef long long i64;
typedef pair<i64, i64> P;

template<class T>
const T INF = numeric_limits<T>::max();
template<class T>
const T SINF = numeric_limits<T>::max() / 10;
static const i64 MOD = 1000000007;

//int dx[4] = {0,1,0,-1}, dy[4] = {-1,0,1,0};
//int dx[5] = {-1,0,0,0,1}, dy[5] = {0,-1,0,1,0};
//int dx[8] = {-1,0,1,1,1,0,-1,-1}, dy[8] = {1,1,1,0,-1,-1,-1,0};
//int dx[9] = {-1,0,1,1,1,0,-1,-1,0}, dy[9] = {1,1,1,0,-1,-1,-1,0,0};

struct edge {
	i64 from, to, cost;
	edge(i64 to, i64 cost) : from(-1), to(to), cost(cost) {}
	edge(i64 src, i64 to, i64 cost) : from(src), to(to), cost(cost) {}
};

template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
	return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

template<typename T,typename V>
typename enable_if<is_class<T>::value==0>::type
fill_v(T &t,const V &v){t=v;}

template<typename T,typename V>
typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t,const V &v){
	for(auto &e:t) fill_v(e,v);
}

//-----end of template-----//

int main(){
    ios_base::sync_with_stdio(false);
	cin.tie(0);
	i64 n;
	cin >> n;
	vector<i64> a(n);
	for(i64 i = 0; i < n; ++i) cin >> a[i];
	sort(a.begin(), a.end(), greater<i64>());
	vector<bool> used(n, false);
	unordered_map<i64, i64> mp;
	for(i64 i = 0; i < n; ++i){
		mp[a[i]] = -1;
	}
	for(i64 i = 0; i < n; ++i){
		if(mp[a[i]] == -1) mp[a[i]] = i;
	}
	i64 ans = 0;
	for(i64 i = 0; i < n - 1; ++i){
		if(used[i]) continue;
		i64 target = (1<<(32 - __builtin_clz(a[i]))) - a[i];
		i64 ng = i;
		i64 ok = n;
		while(abs(ok - ng) > 1){
			i64 mid = (ok + ng) / 2;
			if(a[mid] <= target) ok = mid;
			else ng = mid;
		}
		if(ok == i) continue;
		if(mp[a[ok]] < n && !used[mp[a[ok]]] && a[ok] == a[mp[a[ok]]] && a[ok] + a[i] == (1<<(32 - __builtin_clz(a[i])))){
			if(a[i] == a[ok]){
				used[mp[a[i]] + 1]= used[mp[a[i]]] = true;
				mp[a[i]] += 2;
			}else{
				used[mp[a[ok]]] = used[i] = true;
				mp[a[i]]++;
				mp[a[ok]]++;
			}
			ans++;
		}
	}
	cout << ans << endl;
}

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

using namespace std;

int main() {
	int n,c500,c5;
	cin  >> n;

	c500 = n /500;
	c5 = (n - (c500 * 500))/5;
	cout << c500 *1000+c5*5 << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int64_t INF=9999999999999999;

int main() {
 int N;
 cin>>N;
 vector<int>W(N);int sum=0;
 for(int i=0;i<N;i++){
   cin>>W[i];sum+=W[i];
 }
 int left=0;int right=0;int ans=999999;
 for(int i=0;i<N;i++){
   left+=W[i];right=sum-left;
   ans=min(abs(left-right),ans);
 }
 cout<<ans<<endl;
   return 0;
}

Measured memory_bytes: 256
fun next() = readLine()!!
fun nextInt(offset: Int = 0) = Integer.parseInt(next()) + offset
fun listOfString() = next().split(" ")
fun listOfInt() = listOfString().map(String::toInt)
fun listOfInt(offset: Int = 0) = listOfString().map { Integer.parseInt(it) + offset }

fun main(arg: Array<String>) {
    val (N, M) = listOfInt()
    val graph = Array(N) { BooleanArray(N) }
    repeat(M) {
        val (A, B) = listOfInt(-1)
        graph[A][B] = true
        graph[B][A] = true
    }
    val visited = BooleanArray(N)
    fun dfs(v: Int): Int {
        if (visited.all { it }) return 1
        var result = 0
        for (u in graph[v].indices) {
            if (!graph[v][u]) continue
            if (visited[u]) continue
            visited[u] = true
            result += dfs(u)
            visited[u] = false
        }
        return result
    }
    visited[0] = true
    val ans = dfs(0)
    println(ans)
}


Measured memory_bytes: 37824
import java.util.Scanner;

public class Main {
    public static void main(String args[]) {
        try (Scanner in = new Scanner(System.in)) {
            int N = in.nextInt();
            int D = in.nextInt();
            System.out.println(ceil(N, (2 * D + 1)));
        }
    }

    private static int ceil(int a, int b) {
        return a % b == 0 ? a / b : (a / b + 1);
    }
}


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

int main(){
  int A,B;
  cin >> A >> B;
  int count=0;
  
  for(int N=A; N<=B; N++){
    static bool flag;
    for(int i=1; i<=100; i*=10){
      static int n1,n2;
      flag = true;
      n1 = (N/(10000/i))%10;
      n2 = (N/i)%10;
      if(n1!=n2){
        flag = false;
        break;
      }
    }
    if(flag) count++;
  }
  
  cout << count << endl;
}

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



int dfs(vector<set<int>> graph, vector<int> seen, int x){
  
  int n=int(seen.size())-1;
  seen.at(x)=1;
  
  int count=0;
  
  for (int i=1;i<=n;i++){
    count+=seen.at(i);
  }
  
    
  
  
  if (count==n){
    return 1;
  }
  
  bool flag=false;
  for (int nextx:graph.at(x)){
    if (seen.at(nextx)==0){
      flag=true;
      break;
    }
  }
  
  
  if (flag==false and count!=n){
    return 0;
  }
  
  int tmp=0;
  for (int nextx:graph.at(x)){
    if (seen.at(nextx)==0){
    tmp+=dfs(graph,seen,nextx);
    }
  }
  
  

  
  return tmp;
}



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

  vector<set<int>> graph(n+1);
  
  for (int i=0;i<m;i++){
    int a,b;
    cin>>a>>b;
    graph.at(a).insert(b);
    graph.at(b).insert(a);
  }
  
  vector<int> seen(n+1,0);
  seen.at(0)=1;

  
  
  int answer=dfs(graph,seen,1);
  
  cout<<answer<<endl;
  
    
  
  
  
  
  
  
  
    
  
  
  
}

Measured memory_bytes: 256
// ※※※ 解答不能 ※※※
// scott_wu氏
// https://atcoder.jp/contests/agc040/submissions/8281419
#include <bits/stdc++.h>
using namespace std;
using LL = long long;
const LL MOD = 998244353;
const int MAXN = 1.1e7;

LL fac[MAXN];
LL finv[MAXN];

LL cpow(LL b, int e){
    if(e == 0) return 1;
    LL v = cpow(b, e / 2);
    v = (v * v) % MOD;
    if(e % 2) v = (v * b) % MOD;
    return v;
}

int main(){
    int N;
    scanf("%d", &N);
    fac[0] = 1;
    for(int i = 1; i <= N; i++) fac[i] = (fac[i - 1] * i) % MOD;
    finv[N] = cpow(fac[N], MOD - 2);
    for(int i = N - 1; i >= 0; i--) finv[i] = (finv[i + 1] * (i + 1)) % MOD;
    LL p2 = 1;
    LL ans = 0;
    for(int i = 0; i < N / 2; i++){
        // N choose i * 2 ^ i
        LL nadd = (fac[N] * ((finv[i] * finv[N - i]) % MOD)) % MOD;
        ans = (ans + (nadd * p2)) % MOD;
        p2 = (2 * p2) % MOD;
    }
    ans = (2 * ans) % MOD;
    LL p3 = 1;
    for(int i = 0; i < N; i++) p3 = (3 * p3) % MOD;
    ans = (p3 - ans + MOD) % MOD;
    printf("%lld\n", ans);
    return 0;
}

Measured memory_bytes: 162048
import java.util.*;

class Main {


    public static void main (String [] args) {

        Scanner sc = new Scanner(System.in);

        String line = sc.nextLine();

        line = line.replaceAll("apple", "APPLE");
        line = line.replaceAll("peach", "apple");
        line = line.replaceAll("APPLE", "peach");

        System.out.println(line);

    }
}

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

ll N, A[100005], dp[100005];

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	
	cin >> N;
	for (ll i = 0; i < N; i++) {
		cin >> A[i];
	}
	dp[0] = 0;
	dp[1] = abs(A[1] - A[0]);
	for (ll i = 2; i < N; i++) {
		dp[i] = min(dp[i-1] + abs(A[i]-A[i-1]), dp[i-2] + abs(A[i]-A[i-2]));
	}
	cout << dp[N-1] << "\n";

	return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int> P;
typedef long long ll;
#define rep(i,a,n) for(int i=a;i<n;i++)
#define rrep(i,n,a) for(int i=n;i>=a;i--)
#define FOR(i,n) for(int i=0;i<n;i++)
#define all(s) s.begin(),s.end()
#define lla(s) s.rbegin(),s.rend()
#define pcnt(b) __builtin_popcount(b)
#define vi vector<int>
#define vvi vector<vector<int>>
#define vp vector<pair<int,int>>
const int MOD = 1e9 + 7;
//const int MOD = 998244353;
const ll INF = 1e18;

int g[10][10]={},n,m,a,b,ans=0;


signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cin>>n>>m;
    memset(g,0,sizeof(g));
    rep(i,0,m){
        cin>>a>>b;
        a--;b--;
        g[a][b]=1;
        g[b][a]=1;
    }
    vi p(n-1);
    rep(i,1,n){
        p[i-1]=i;
    }
    bool f = 1;
    if(!g[0][p[0]]){f=0;}
    rep(i,0,n-2){if(!g[p[i]][p[i+1]]){f=0;}}
    if(f){ans++;}
    while(next_permutation(all(p))){
        if(!g[0][p[0]]){continue;}
        else{
            f = 1;
            rep(i,0,n-2){
                if(!g[p[i]][p[i+1]]){f=0;}
            }
            if(f){ans++;}
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<int64_t,int64_t> pll;
typedef vector<int64_t> vl;
int dx[]={1,-1,0,0,1,-1,1,-1};
int dy[]={0,0,1,-1,1,-1,-1,1};
const long double PI = acos(-1);
#define INF (2147483647)
#define mod (1000000007)
#define limit (7368791)
#define rep(i,a,b) for (int64_t i = (a); i < (b); i++)
#define REP(i,n) rep(i,0,n)
#define sz(s) (s).size()
#define ALL(a) begin(a),end(a)
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define fi first
#define se second

int r(){int x;cin>>x;return x;}

void solve() 
{   
    int n=r(),nn=n+1;
    double dp[nn][nn][nn];
    dp[0][0][0]=0;
    vector<int>a(3,0);
    REP(i,n)a[r()-1]++;
    REP(k,nn)REP(j,nn)REP(i,nn)if(i+j+k<=n){
        if(!(i||j||k))continue;
        dp[i][j][k]=n;
        if(i)dp[i][j][k]+=i*dp[i-1][j][k];
        if(j)dp[i][j][k]+=j*dp[i+1][j-1][k];
        if(k)dp[i][j][k]+=k*dp[i][j+1][k-1];
        dp[i][j][k]/=i+j+k;
    }
    cout<<setprecision(12)<<dp[a[0]][a[1]][a[2]]<<endl;
}

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


Measured memory_bytes: 212992
#include <iostream>

using namespace std;

int main(int argc, char const *argv[]) {
  int a, b, c, ans;
  cin >> a >> b >> c;
  if (a == b) ans = c;
  else if (b == c) ans = a;
  else ans = b;
  cout << ans << endl;
  return 0;
}


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

namespace abc102b
{
    class abc102b
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            var sequenceA = Console.ReadLine().Split().ToList().ConvertAll(int.Parse);
            Console.WriteLine(sequenceA.Max()-sequenceA.Min());
        }
    }
}


Measured memory_bytes: 13268
import math
x1, y1, x2, y2 = list(map(lambda x : int(x),input().split()))

c1 = x1 + y1 * 1j
c2 = x2 + y2 * 1j

c3 = (c1 - c2) * -1j + c2
c4 = (c2 -c3) * -1j + c3
print(int(c3.real),int(c3.imag),int(c4.real),int(c4.imag))


Measured memory_bytes: 3060
#include<iostream>
#include<string>
using namespace std;
int main(){
  int h,w,i;
  cin >> h >> w;
  string c;
  for (i=0;i<h;i++) {
    cin >> c;
    cout << c << endl;
    cout << c << endl;
  }
  return 0;
}
  
  


Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
	int A, B;
	scanf("%d%d", &A, &B);
	if (A > 0 && A < 10 && B>0 && B < 10) {
		printf("%d", A * B);
	}
	else {
		printf("-1");
	}

	return 0;
}

Measured memory_bytes: 128
using namespace std;

using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
#include <iostream>
#include <string>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <cmath>
#include <climits>
#include <bitset>
#include <array>
#include <deque>
#include <queue>
#define all(x) (x).begin(),(x).end()

void solve(){

}
int main(){
    int x1,x2,y1,y2;
    cin >> x1 >> y1 >> x2 >> y2;
    int dx = x2 - x1;
    int dy = y2 - y1;
    cout << x2 - dy << ' ' << y2 + dx << ' ' << x1 - dy << ' ' << y1 + dx << endl;

    return 0;
}


Measured memory_bytes: 256
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<sstream>
#include<unordered_map>
#include<unordered_set>
#include<vector>
using uint = unsigned int;
using ll = long long;
enum : int { M = (int)1e9 + 7 };
enum : ll { MLL = (ll)1e18L + 9 };
using namespace std;
#ifdef LOCAL
#include"rprint2.hpp"
#include"debug_deque.hpp"
#define vector DebugDeque
#else
#define FUNC(name) template <ostream& out = cout, class... T> void name(T&&...){ }
FUNC(prints) FUNC(printe) FUNC(printw) FUNC(printew) FUNC(printb) FUNC(printd) FUNC(printde);
#endif

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    vector<vector<int>> fs(n, vector<int>(10));
    for(int i = 0; i < n; i++){
        for(int j = 0; j < 10; j++){
            cin >> fs[i][j];
        }
    }
    vector<vector<int>> ps(n, vector<int>(11));
    for(int i = 0; i < n; i++){
        for(int j = 0; j < 11; j++){
            cin >> ps[i][j];
        }
    }
    prints(fs, ps);
    int ans = -M;
    for(int bits = 1; bits < 1024; bits++){
        vector<int> cs(n);
        for(int i = 0; i < 10; i++){
            if((bits >> i & 1) == 0){ continue; }
            for(int j = 0; j < n; j++){
                cs[j] += fs[j][i];
            }
        }
        int cand = 0;
        // printd(cs[0]);
        for(int i = 0; i < n; i++){
            cand += ps[i][cs[i]];
        }
        ans = max(ans, cand);
    }
    cout << ans << '\n';
}


Measured memory_bytes: 384
#include <stdio.h>

int main(){
    int N;
    int tmp;

    scanf("%d",&N);
    tmp=N%10;
    if (tmp==2 || tmp==4 || tmp==5 || tmp==7 || tmp==9){
        printf("hon\n");
    }

    if (tmp==0 || tmp==1 || tmp==6 || tmp==8){
        printf("pon\n");
    }

    if (tmp==3){
        printf("bon\n");
    }

    return 0;

}


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

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

    if(s.size()==2){
        cout << s;
    }
    if(s.size()==3){
        for(int i = s.size() - 1;i>=0;i--){
            cout << s[i];
        }
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ll long long
using namespace std;

const ll P = 1000000007;
int gcd(int a, int b) { return b != 0 ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }

int main()
{
  int N;
  cin >> N;
  vector<int> vec(N);
  int count = 0;
  for(int i=0;i<N; i++)
  {
    cin >> vec[i];
  }
  int start = vec[0];
  for(int i=0;i<N; i++)
  {
    if(vec[i]<=start)
    {
      start = vec[i];
      count ++;
    }
  }
  cout << count << endl;
  return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define pb push_back
#define ll long long
#define endl "\n"
#define mp make_pair
#define all(c) (c).begin(),(c).end()
#define hell 1000000007
#define ff first
#define ss second
#define pii pair<ll,ll>
#define upd upper_bound
#define lbd lower_bound
#define vi vector<ll>
#define vii vector<pii>
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pi acos(-1.0)

using namespace std;
using namespace __gnu_pbds;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define N 200005

ll i=0,j=0;

ll powr(ll a,ll b)
{
    ll i=0;
    ll ans=1;
    for(i=1;i<=b;i++)
    {
        ans*=a;
    }
    return ans;
}

int main()
{
    IOS;
    ll n,w;
    cin>>n>>w;
    ll dp[w+1];
    memset(dp,0,sizeof(dp));
    for(i=1;i<=n;i++)
    {
        ll wt,val;
        cin>>wt>>val;
        for(j=w-wt;j>=0;j--)
        {
            dp[j+wt]=max(dp[j+wt],dp[j]+val);
        }
    }
    ll ans=0;
    for(i=0;i<=w;i++)
    {
        ans=max(ans,dp[i]);
    }
    cout<<ans<<endl;
}



Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <math.h>
#include <sstream>
#include <numeric>

using namespace std;

bool IsIsolatedBlack(vector<vector<char> > &vv, int x, int y)
{
  if (vv[x][y] == '.') return false;
  
  int H = vv.size();
  int W = vv[0].size();
  
  vector<pair<int, int> > pairs;
  pairs.push_back(make_pair(-1,0));
  pairs.push_back(make_pair(+1,0));
  pairs.push_back(make_pair(0,-1));
  pairs.push_back(make_pair(0,+1));
  
  bool isolated = true;
  for (auto p : pairs) {
    int dx = p.first;
    int dy = p.second;
    if (0 <= x + dx and x + dx < H and
	0 <= y + dy and y + dy < W and
	vv[x + dx][y + dy] == '#') {
      isolated = false;
      break;
    }
  }
  
  return isolated;
}

int main()
{
  int H, W;
  cin >> H >> W;
  vector<vector<char> > vv(H, vector<char> (W));
  for (int i = 0; i < H; ++i) {
    string S;
    cin >> S;
    for (int j = 0; j < W; ++j) {
      vv[i][j] = S[j];
    }
  }
  bool ok = true;
  for (int i = 0; i < H; ++i) {
    for (int j = 0; j < W; ++j) {
      if (IsIsolatedBlack(vv, i, j)) {
	ok = false;
	break;
      }	
    }
  }
  if (ok) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 256
import java.io.{BufferedReader, InputStreamReader}

object Main extends App {

  val in = new BufferedReader(new InputStreamReader(System.in))
  val Array(a, b, c, d, e, f) = in.readLine.split(" ").map(_.toInt)
  // 入れる水の量 100a 100b
  // 入れる砂糖の量 c d
  // 100gあたりとける量 e
  // ビーカーに入る量 f
  // 濃度 0% の砂糖水 : water > 0 , sugar >= 0
  val water = {
    for {
      i <- 0 to f/(a*100)
      j <- 0 to f/(b*100)
      w = 100 * a * i + 100 * b * j
      if(0 < w && w <= f)
    } yield w
  }.distinct.toArray
  val sugar = {
    for {
      i <- 0 to (f-100)/c
      j <- 0 to (f-100)/d
      w = c * i + d * j
      if(0 <= w && w <= f)
    } yield w
  }.distinct.toArray

  // println(water.length + " " + sugar.length)

  val ans = {
    var max = (-1d, 0, 0)
    for {
      w <- water
      s <- sugar
      weight = w + s
      concent = s.toDouble / (w.toDouble/100d)
      if w + s <= f && concent <= e
    } {
      if(concent > max._1) {
        // println(weight + " " + concent)
        max = (concent, weight, s)
      }
    }
    max
  }
  
  println(ans._2 + " " + ans._3)
}

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

#define pb(s) push_back(s)
#define ALL(v) v.begin(), v.end()
#define ALLA(arr, sz) arr, arr + sz
#define SORT(v) sort(ALL(v))
#define REVERSE(v) reverse(ALL(v))
#define SORTA(arr, sz) sort(ALLA(arr, sz))
#define REVERSEA(arr, sz) reverse(ALLA(arr, sz))

typedef long long ll;


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

    int n,k;
    cin>>n>>k;
    int a[n];
    int dp[n]={0};
    for(int i=0;i<n;++i)
        cin>>a[i];
    dp[1]=abs(a[1]-a[0]);
    for(int i=2;i<n;++i){
        int small=1e9;
        for(int j=1;i-j>=0&&j<=k;++j){
            small=min(small,abs(a[i]-a[i-j])+dp[i-j]);
        }
        dp[i]=small;
    }
    cout<<dp[n-1];
    return 0;
}



Measured memory_bytes: 1024
#include<stdio.h>
int main(){
  int a,n,m,i=0,j,k,max,N[20002];
  
  while(1){
    scanf("%d%d",&n,&m);
    if(n==0 && m==0){ break; }
    
    for(i=0;i<n;i++){ 	scanf("%d",&N[i]); }
    if(m==0)N[i]=0;
    for(j=i;j<n+m;j++){	scanf("%d",&N[j]); } 
    
    /* for(j=0;j<n+m;j++){ */
    /*   printf("--r-%d\n",N[j]); */
    /* } */
    
    for(i=0;i<m+n-1;i++){ 
      for(j=i+1;j<m+n;j++){
	if(N[i]>N[j]){
	  a=N[i];
	  N[i]=N[j]; 
	  N[j]=a; 
	} 
      }
    }
    
    max=N[0];
    for(i=0;i<m+n;i++){
      if(max<N[i+1]-N[i])max=N[i+1]-N[i];
    }  
    printf("%d\n",max);
    for(i=0;i<n+m;i++){N[i]=0;}
  }   
  return 0; 
}

Measured memory_bytes: 492