akhauriyash/Code-Regression huggingface dataset:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.Map;

public class Main {

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        Map<String, Integer> cache = new HashMap<String, Integer>();

        final Integer MAX = 1000000;
        boolean[] naturalFlg = new boolean[MAX];

        for (int i = 2; i <= 500000; i++) {
            for (int j = 2; j <= Math.ceil(999999 / i); j++) {
                naturalFlg[i * j] = true;
            }
        }

        String line;
        while ((line = br.readLine()) != null && !line.isEmpty()) {
            if (cache.containsKey(line)) {
                System.out.println(cache.get(line));
                continue;
            }

            int cnt = 0;
            for (int i = 2; i <= Integer.parseInt(line); i++) {
                if (!naturalFlg[i]) cnt++;
            }
            cache.put(line, cnt);
            System.out.println(cnt);
        }
    }
}

Measured memory_bytes: 27100
#include <bits/stdc++.h>
#define mp make_pair
#define ft first
#define sd second
#define ue printf("what?\n");
#define pb push_back
#define oo 0x3F3F3F3F	
#define OO 3000000000000000000LL
#define EPS 0
#define maxn 200000
#define pi acos(-1)
#define mod 1000000007
#define mdc __gcd
#define N 100010
#define M 33
using namespace std;
typedef long long ll;
typedef vector<vector<ll> > mat;
typedef pair<int,int> pii;
typedef vector<pii> vii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;

string s, t;

bool testa(int ind)
{
	for(int i=0; i<t.size(); i++)
	{
		if(t[i] != s[(ind % s.size())]) return 0;
		ind++;
	}
	return 1;
}

main()
{
	cin >> s >> t;
	if(s.size() != t.size()) return !printf("No\n");
	for(int i=0; i<s.size(); i++)
		if(testa(i))
			return !printf("Yes\n");
	printf("No\n");
}


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

public class Main {

	public static void main(String[] args) throws NumberFormatException, IOException {
		// TODO Auto-generated method stub
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] as = br.readLine().split(" ");
		int n = Integer.parseInt(as[0]);
		int m = Integer.parseInt(as[1]);
		int[] array = new int[n];
		as = br.readLine().split(" ");
		int  sum = 0;
		for(int i = 0 ; i < n ; i++) {
			array[i]  = Integer.parseInt(as[i]);
			sum += array[i];
		}
		int kosu = 0;
		//System.out.println(sum);
		for(int i = 0 ; i < n ; i++) {
			if(array[i] >= ((double) sum/(4*m)) ) {
				kosu++;
			}
		}
		if(kosu >= m) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
		
	}

}


Measured memory_bytes: 21332
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define MOD 1000000007
#define INF (1<<30)
#define LINF (1LL<<60)
#define endl "\n"
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define reprev(i,n) for(int (i)=(n-1);(i)>=0;(i)--)
#define Flag(x) (1<<(x))
#define Flagcount(x) __builtin_popcount(x)
#define pint pair<int,int>
#define pdouble pair<double,double>
#define plint pair<lint,lint>
typedef unsigned long long int ull;
typedef long long lint;

int main(void){
    string S;
    cin >> S;
    int ans=700;
    rep(i,3) if(S[i]=='o') ans+=100;
    cout << ans << endl;
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(200200)

mod = 10 ** 9 + 7

N, *AB = map(int, open(0).read().split())

E = [[] for _ in range(N + 1)]
for i, (a, b) in enumerate(zip(*[iter(AB)] * 2)):
    E[a - 1].append((b - 1, i))
    E[b - 1].append((a - 1, i))

X = [0] * N

visited = [False] * N
visited[0] = True

def dfs(u, i):
    res = 1
    for v, c in E[u]:
        if not visited[v]:
            visited[v] = True
            res += dfs(v, c)
    X[i] = res
    return res

dfs(0, -1)

I = [1] * (N + 1)
inv = pow(2, mod - 2, mod)
for i in range(N):
    I[i + 1] = I[i] * inv % mod

ans = (I[N] + 1) * (N - 1) - inv * N - I[N] + 1
for xe in range(N - 1):
    ans -= I[X[xe]] + I[N - X[xe]]
    ans %= mod

print(ans)

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

#define ln                '\n'
#define all(dat)           dat.begin(), dat.end()
#define loop(i, to)        for (int i = 0; i < to; ++i)
#define cont(i, to)        for (int i = 1; i <= to; ++i)
#define circ(i, fm, to)    for (int i = fm; i <= to; ++i)
#define foreach(i, dat)    for (__typeof(dat.begin()) i = dat.begin(); i != dat.end(); ++i)

typedef long long          num;

using namespace std;

const int nsz = 1e5, lgsz = 18;
int n, a, b, rt, pr[nsz + 5][lgsz + 5], dep[nsz + 5], ans;
vector<int> g[nsz + 5], lf;

void dfs(int u = rt, int p = rt) {
    if (g[u].size() == 1 && u != rt) {
        lf.push_back(u);
        return;
    }
    loop (i, g[u].size()) {
        int v = g[u][i];
        if (v == p)  continue;
        pr[v][0] = u;
        dep[v] = dep[u] + 1;
        dfs(v, u);
    }
}

void inline init() {
    dfs();
    cont (k, lgsz) {
        cont (u, n) {
            int p = pr[u][k - 1];
            if (!p)  continue;
            pr[u][k] = pr[p][k - 1];
        }
    }
}

int inline lca(int u, int v) {
    if (dep[u] > dep[v]) {
        swap(u, v);
    }
    circ (k, 0, lgsz) {
        if (((dep[v] - dep[u]) >> k) & 1) {
            v = pr[v][k];
        }
    }
    if (u == v)  return u;
    for (int k = lgsz; k >= 0; --k) {
        if (pr[u][k] != pr[v][k]) {
            u = pr[u][k], v = pr[v][k];
        }
    }
    return pr[u][0];
}

int main() {
    ios::sync_with_stdio(0);
    cin >> n >> a >> b;
    rt = b;
    cont (i, n - 1) {
        int u, v;
        cin >> u >> v;
        g[u].push_back(v);
        g[v].push_back(u);
    }
    init();
    loop (i, lf.size()) {
        int v = lf[i], p = lca(v, a);
        if (dep[a] - dep[p] < dep[p]) {
            ans = max(ans, dep[v] - 1);
        }
    }
    cout << ans << ln;
}

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

int main(int argc, char const* argv[])
{
  int a, b, c;
  cin >> a >> b >> c;
  bool f = false;
  if (a == 5 && b == 5 && c == 7)
    f = true;
  else if (a == 5 && b == 7 && c == 5)
    f = true;
  else if (a == 7 && b == 5 && c == 5)
    f = true;
  cout << (f ? "YES" : "NO") << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define REP(i,n) for (int64_t i=0; i<(n); ++i)
#define P pair<int,int>
using ll=int64_t;
using namespace std;
#define ketasuu(n) fixed<<setprecision(n)
#define btoe(p) p.begin(),p.end()
#define etob(p) p.rbegin(),p.rend()




int main(){
    int n,w; cin>>n>>w;
    vector<int> v(n), p(n);
    rep(i,n) cin>>v[i]>>p[i];
    vector<vector<int>> dp(n+5,vector<int>(w+5,0));
    rep(i,w+1) dp[0][i]=0;
    rep(i,n){
        rep(j,w+1){
            if(j>=p[i]) dp[i+1][j]=max(dp[i][j-p[i]]+v[i], dp[i][j]);
            else dp[i+1][j]=dp[i][j];
        }
    }
    cout<<dp[n][w]<<endl;
    return 0;
}


Measured memory_bytes: 7024
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <map>

using namespace std;

int main() {
	string A, B, C;
	cin >> A >> B >> C;
	if (A[A.size() - 1] == B[0] && B[B.size() - 1] == C[0]) cout << "YES" << endl;
	else cout << "NO" << endl;
	return 0;
}

Measured memory_bytes: 3520
#include <bits/stdc++.h>
using namespace std;
int N, K, M;

int main()
{
    cin >> N >> K;
    M = N * (N - 1) / 2 - K;
    if(M < N - 1) M = -1;
    
    cout << M << endl;
    if(M != -1)
	{
        int cnt = N - 1;
        while(M > 0)
		{
            for (int i=N-cnt+1;i<= (min(N, N - cnt + M));++i) 
				cout << N - cnt << " " << i << endl;
            M -= cnt--;
        }
    }
    return 0;
}

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

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

int main(){
  string s;	cin >> s;
  int n=s.size();
  vector<int>	ans(n);
  rep(ri,2){
    int cnt=0;
    rep(i,n){
      if(s[i]=='R')	cnt++;
      else{
        ans[i]+=cnt/2;
        ans[i-1]+=(cnt+1)/2;
        cnt=0;
      }
    }
    reverse(s.begin(),s.end());
    reverse(ans.begin(),ans.end());
    rep(i,n){
      if(s[i]=='R')	s[i]='L';
      else	s[i]='R';
    }
  }
  rep(i,n){
    cout << ans[i] << " ";
  }
  
}

Measured memory_bytes: 3828
#include<stdio.h>
 
int main(void){
       int N;
       int i;
       
       int index[4]={0,0,0,0};
       scanf("%d",&N);

       char s[N][5];

       for(i=0;i<N;i++){
              scanf("%S",&s[i][0]);
       }

       for(i=0;i<N;i++){
              if(s[i][0]=='A')index[0]++;
              else if(s[i][0]=='W')index[1]++;
              else if(s[i][0]=='T')index[2]++;
              else if(s[i][0]=='R')index[3]++;
              
       }

       printf("AC x %d\nWA x %d\nTLE x %d\nRE x %d",index[0],index[1],index[2],index[3]);
       return 0;
}

Measured memory_bytes: 2640
#include <iostream>
#include <string>
#include <algorithm>
#include <stdio.h>
using namespace std;

int main()
{
    int n, z = 0;
    string s;
    cin >> n;
    cin >> s;
    for (int i = 0; i < (n-2); i++)
    {
        if (s[i] == 'A' && s[i + 1] == 'B' && s[i + 2] == 'C')
            z++;
        
    }
    cout << z;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<stack>
#include<cmath>
using namespace std;
typedef long long ll;
ll mod = 1e9+7;
#define rep(i,n) for(int i = 0; i < (n); ++i)
int main() {
    int a, b, c;
    cin >> a >> b >> c;
    if ( b - a == c - b ) cout << "YES" << endl;
    else                  cout << "NO" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;
int main(){
    int n;
    cin >> n;
    vector<double> a(n);
    for(int i=0;i<n;i++){
        cin >> a.at(i);
    }
    sort(a.begin(),a.end());
    for(int i = 0; i < n-1; i++){
        a.at(i+1)=(a.at(i)+a.at(i+1))/2.00000;
    }
    
    cout << a.at(n-1) << endl;
}

Measured memory_bytes: 256
n = int(input())
div = [None] + [int(v) for v in input().split()]
result = [None for _ in range(n+1)]

for d in range(1, n+1):
    for i in range(n//d, n//(d+1), -1):
        part = sum([result[i*j] for j in range(2, d+1)], 0)
        result[i] = (part + div[i]) % 2

print(sum(result[1:]))
for i, r in enumerate(result[1:]):
    if r > 0:
        print(i+1)


Measured memory_bytes: 8756
import java.util.*;

public class Main {
//    private static final String ex = "2\n" +
//        "2\n" +
//        "3";
    private static final String ex = "5\n" +
            "2\n" +
            "5\n" +
            "10\n" +
            "1000000000000000000\n" +
            "1000000000000000000";

    public static void main(String[] args) {
        System.out.println(solve(new Scanner(System.in)));
//        System.out.println(solve(new Scanner(ex)));
    }

    private static long solve(Scanner scanner) {
        int N = Integer.parseInt(scanner.nextLine());
        long[] T = new long[N];
        for (int i = 0; i < N; i ++) {
            T[i] = Long.parseLong(scanner.nextLine());
        }

        long ret = T[0];
        for (int i = 1; i < T.length; i ++) {
            ret = lcm(ret, T[i]);
        }

        return ret;
    }

    private static long lcm(long a, long b) {
        return a / gcd(a, b) * b;
    }

    private static long gcd(long a, long b) {
        while (b > 0) {
            long tmpA = a;
            a = b;
            b = tmpA % b;
        }
        return a;
    }
}


Measured memory_bytes: 21844
#include <iostream>
#include <vector>
#include <climits>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <string>
#include <bitset>
#include <utility>
#include <numeric>

using ll = long long;
using namespace std;

constexpr int MOD = 1e9 + 7;
constexpr ll MOD_LL = ll(1e9) + 7;

int main(void) {
	int n;
	cin >> n;
	
	vector<int> a(n + 1), b(n);
	for(int i = 0; i < n + 1; ++i) {
		cin >> a[i];
	}
	
	for(int i = 0; i < n; ++i) {
		cin >> b[i];
	}
	
	ll ans = 0;
	int x = 0;
	for(int i = 0; i < n; ++i) {
		int x = min(a[i], b[i]);
		a[i] -= x;
		b[i] -= x;
		ans += x;
		
		x = min(a[i + 1], b[i]);
		a[i + 1] -= x;
		b[i] -= x;
		ans += x;
	}
	
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin(),(x).end()
const ll mod=998244353,MAX=1000001,INF=1<<30;

int main(){
    
    ll K,A,B;cin>>K>>A>>B;
    if(A<=B){
        if(K<=A) cout<<1<<endl;
        else cout<<-1<<endl;
    }else{
        if(K<=A) cout<<1<<endl;
        else{
            K-=A;
            ll need=(K+(A-B-1))/(A-B);
            cout<<need*2+1<<endl;
        }
    }
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <cmath>
#include <utility>
#include <iostream>
#include <functional>
#include <bitset>
#include <algorithm>
#include <vector>
#include <forward_list>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#define rep(i, s, g) for ((i) = (s); (i) < (g); ++(i))
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const ll MOD = 1e9 + 7;
const ll INF = (1ll << 60);

int main(void)
{
    string s;
    char a, b;

    cin >> s;

    sort(s.begin(), s.end());

    if (s[0] == s[1] && s[2] == s[3] && s[0] != s[3])
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
}

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

int main() {

    string s;
    cin >> s;
    int a[s.size()];
    memset(a, 0, sizeof a);
    for (int i=0; i<s.size(); i++) {
        if (s[i] == 'A' || s[i] == 'C' || s[i] == 'G' || s[i] == 'T') {
            if (i == 0) {
                a[i] = 1;
            }
            else {
                a[i] = a[i-1]+1;
            }
        }
        else {
            a[i] = 0;
        }
    }
    int mx = 0;
    for (int i=0; i<s.size(); i++) {
        mx = max(mx, a[i]);
    }
    cout << mx;

}

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

#define REP(i,n) for(int i=0; i < (n); ++i)
#define REPR(i,n) for(int i=(n); i >= 0; --i)
#define FOR(i, m, n) for(int i = (m); i < (n); ++i)

typedef long long ll;


int main(){
  int X, A;
  cin >> X >> A;

  if(X < A){
    cout << 0 << endl;
  }
  else{
    cout << 10 << endl;
  }
  return 0;
}


Measured memory_bytes: 764
import statistics
import math

N=int(input())
A_array=list(map(int,input().split()))
B_array=[]
for i in range(len(A_array)):
    i=i+1
    B_array.append(A_array[i-1]-i)
    i=i-1
mid=statistics.median(B_array)

ans=0
for i in  range(len(B_array)):
    ans+=abs(B_array[i]-mid)
print(int(ans))


Measured memory_bytes: 27248
///#pragma GCC optimize("Ofast,unroll-loops,no-stack-protector,fast-math")
///#pragma GCC target("sse,sse2,sse3,ssse3,sse4,abm,mmx,popcnt,avx,avx2,tune=native")

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

/*
    zet:
        find_by_order(k): k-stat [k > 0]
        order_of_key(k) : {el < k}

    gp_hash_table<key, val, custom_hash>

    rope<T>:
        iterators: mutable_begin, ..
        methods  : erase, insert, substr, ..
*/

#define all(x) (x).begin(), (x).end()
#define size(x) (int)((x).size())
#define em_back emplace_back

using namespace std;
using namespace __gnu_cxx;
using namespace __gnu_pbds;

using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

template<typename T>
using zet = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

mt19937 eng(chrono::steady_clock::now().time_since_epoch().count());

const ll INF = 8e18;
const int B = 5e6;

ll n, s, ans = INF;

inline ll f(ll b, ll x) {
    if (x < b) {
        return x;
    }
    return x % b + f(b, x / b);
}

void calc() {
    for (int b = 2; b < B; ++b) {
        ll fb = f(b, n);
        if (fb == s) {
            ans = b;
            return;
        }
    }

    if (n == s) {
        ans = n + 1;
        return;
    }

    if (s > n) {
        return;
    }

    ll ns = n - s;
    for (ll x = 1; x * x <= ns; ++x) {
        if (ns % x == 0) {
            ll b1 = ns / x;
            ll y = s - x;

            if (y >= 0 && y <= b1) {
                ans = min(ans, b1 + 1);
            }
        }
    }
}

void solve() {
    cin >> n >> s;
    calc();
    if (ans == INF) {
        cout << "-1\n";
    } else {
        cout << ans << "\n";
    }
}

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

    int z = 1;
    /// cin >> z;

    while (z--) {
        solve();
    }

    return 0;
}


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

const int N = 10000;
const int Q = 500;

int linear_search(int n, int A[], int q, int T[]) {
  int cnt = 0;
  
  for (int i = 0; i < q; i++) {
    int t = T[i];
    for (int j = 0; j < n; j++) {
      if (t == A[j]) {
        cnt++;
        break;
      }
    }
  }

  return cnt;
}

int main() {
  int i, n, q;
  int A[N], T[Q];  

  cin >> n;
  for (i = 0; i < n; i++) cin >> A[i];
  cin >> q;
  for (i = 0; i < q; i++) cin >> T[i];

  int c = linear_search(n, A, q, T);

  cout << c << endl;

  return 0;
}



Measured memory_bytes: 3144
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MS(a) memset(a,0,sizeof(a))
#define MP make_pair
#define PB push_back
const int INF = 0x3f3f3f3f;
const ll INFLL = 0x3f3f3f3f3f3f3f3fLL;
inline ll read(){
    ll x=0,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();}
    return x*f;
}
//////////////////////////////////////////////////////////////////////////
const int maxn = 1e5+10;

ll t[maxn];

int main(){
	int n,c,k;
	cin >> n >> c >> k;
	for(int i=1; i<=n; i++)
		t[i] = read();
	sort(t+1,t+1+n);
	// for(int i=1; i<=n; i++)
	// 	cout << t[i] << endl;
	ll end = 0, ans=0;
	for(int i=1; i<=n; i++){
		end = t[i]+k;
		// cout << i << " " << end << endl;
		ll L=i+1,R=n,pos=0;
		while(L<=R){
			ll mid = (L+R)/2;
			
			if(t[mid] <= end) pos = mid, L = mid+1;
			else R = mid-1;
			if(pos-i+1 > c) { pos=i+c-1; break;}
		}
		// cout << pos << endl;
		if(pos != 0)
			i = pos;

		ans++;
	}
	cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1024
/**
 *    author:  math2do
 *    created: 12.05.2020 00:05:43 IST
**/

#include <bits/stdc++.h>

using namespace std;

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  string s, t;
  cin >> s;
  cin >> t;
  int a = s.length();
  int b = t.length();
  if (a + 1 == b && s == t.substr(0, a)) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  } 
  return 0;
}


Measured memory_bytes: 3612
import java.util.*;class Main{public static void main(String[]r){Scanner s=new Scanner(System.in);int n=s.nextInt(),i=n,m=s.nextInt(),b;int[]a=new int[n];for(;i>0;)a[--i]=s.nextInt();Arrays.sort(a);b=a[n-1];for(;i+m-1<n;i++)b=Math.min(b,a[i+m-1]-a[i]);System.out.print(b);}}

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

using ll =  long long;
using pint =  pair<int,int>;

#define INF 99999999
#define rep(i,n) for(int (i)=0,temp=(int)(n);(i)<temp;++(i)) 
#define repi(i,start,end) for(int (i)=(start),temp=(int)(end);i<(end);++(i))
#define rfor(v,x) for(const auto& (x) : (v)) //xは値を表す
#define all(x) (x).begin(),(x).end()
#define SORT(v, n) sort((v), (v)+(n))
#define vsort(v) sort((v).begin(), (v).end())
#define vfsort(v,lambda) sort(all((v)),(lambda))
#define vint vector<int>
#define vvint vector<vector<int>> //vvint v(n,vint(n))のように宣言できる
#define vin(v) rep(i,(v).size()) {cin >> (v)[i];}
//最終奥義(使うときはINFも書き換えろ!!)
//#define int long long
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int ctoi(char c) {return c-'0';}
//lambda式 -> [&](int x, int y){return x<y;}
//vector内の重複を削除-> v.erase(unique(all(v)),v.end());

signed main(void){
  int n;cin>>n;
  string s,t;cin>>s>>t;
  rep(i,n){
    cout << s[i] << t[i];
  }
  cout << endl;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iomanip>
#include <math.h>
#include <unistd.h>
#include <stdio.h>
#define all(a) (a).begin(),(a).end()
#define vecin(a) rep(i,a.size())cin >> a[i]
#define vecout(a) rep(i,a.size()){cout << a[i];cout << (i == a.size() - 1 ? "\n":" ");}
#define mp make_pair
using ll = long long;
using ld = long double;
using namespace std;
using dou = double;
const ll inf = 2147483647;
const ll INF = 1LL << 60;
const dou pi = 3.14159265358;
const ll mod = 1000000007LL;
//const ll mod = 998244353LL;
typedef pair<ll,ll> P;
using graph = vector<vector<ll>>;
template<class T> inline bool chmax(T& a, T b){if(a < b){a = b; return true;}return false;}
template<class T> inline bool chmin(T& a, T b){if(a > b){a = b; return true;}return false;}
template<class T> inline bool change(T a,T b){if(a > b){swap(a,b);return true;}return false;}
ll gcd(ll a,ll b){
    if(a < b)swap(a,b);
    if(a % b == 0)return b;
    else return gcd(b,a%b);
}
ll lcm(ll a,ll b){
    return a / gcd(a,b) * b;
}

//素数判定O(sqrt(N))
bool isp(ll n){
    bool res = true;
    if(n == 1)return false;
    else{
        for(ll i = 2;i * i <= n;i++){
            if(n % i == 0){
                res = false;
                break;
            }
        }
        return res;
    }
}
const ll cmax = 1000000;
ll fac[cmax], finv[cmax], inv[cmax];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < cmax; 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;
    }
}

// 二項係数計算
ll nCk(ll n, ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}
//nのm乗をMODで割ったあまりO(logm)
ll modpow(ll n,ll m,ll MOD){
    if(m == 0)return 1;
    if(m < 0)return -1;
    ll res = 1;
    while(m){
        if(m & 1)res = (res * n) % MOD;
        m >>= 1;
        n *= n;
        n %= MOD;
    }
    return res;
}
ll mypow(ll n,ll m){
    if(m == 0)return 1;
    if(m < 0)return -1;
    ll res = 1;
    while(m){
        if(m & 1)res = (res * n);
        m >>= 1;
        n *= n;
    }
    return res;
}
//printf("%.10f\n", N);
/*  vector<ll> vec = {1,2,5,6,8,9,10};
    cout << binary_search(all(vec),5) << endl; -> true*/
/*
    vector<ll> vec = {1,2,5,6,8,9,10};
    auto n = upper_bound(all(vec),4);
    cout << *n << endl; -> 5*/

//    cout << fixed << setprecision(15);

#define rep(i,x) for(int i = 0;i<x;i++)
#define REP(i,x) for(int i = 1;i<=x;i++)

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll N;
    cin >> N;
    ll kazu = N / 100,ika = N % 100;
    cout << (kazu * 5 >= ika) << endl;
}

Measured memory_bytes: 3588
#方針: 連続するk本に点火するパターンを全部調べる
n, k = gets.split.map(&:to_i)
x = gets.split.map(&:to_i)

ans = 1<<30

i=0
while i+k-1 < x.length
  time = x[i+k-1] - x[i]
  time = [time + x[i+k-1].abs, time + x[i].abs].min
  if ans > time
    ans = time
  end
  i += 1
end

p ans

Measured memory_bytes: 11012
s = input()[:: -1]

ans = 0
for i in range(2**(len(s) - 1)):
    num, d = int(s[0]), 10
    for j in range(len(s) - 1):
        if (i >> j) & 1:
            num += int(s[j + 1]) * d
            d *= 10
        else:
            ans += num
            num = int(s[j + 1])
            d = 10
    
    ans += num
    
print(ans)

Measured memory_bytes: 3064
#include <algorithm>
#include <iostream>
#include <vector>
#include <set>
#include <map>
using namespace std;
#define rep(i, a, b) for(int i = a; i < (b); ++i)
int main() {
    int N;
    cin >> N;
    
    vector<int> D(N);
    rep(i, 0, N) {
        cin >> D[i];
    }
    
    sort(D.begin(), D.end());
    int ans = D[N/2] - D[N/2-1];
    cout << ans << endl;
    
    return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
const int N=4010,mod=1e9+7,M=2e5+10;
int n,f[N][N],Fac[N*2];
struct node{int x,y;}e[M];
inline int qm(int x,int k){
	int sum=1;
	while(k){
		if(k&1)sum=1ll*sum*x%mod;
		x=1ll*x*x%mod;k>>=1;
	}
	return sum;
}
inline int inv(int x){return qm(x,mod-2);}
inline int C(int a,int b){return 1ll*Fac[a]*inv(Fac[b])%mod*inv(Fac[a-b])%mod;}
int main(){
  scanf("%d",&n);
  int x,y;
  for(int i=1;i<=n;i++){
	  scanf("%d%d",&x,&y);
	  f[2001-x][2001-y]++;
	  e[i]=(node){x,y};
  }
  for(int i=1;i<=4001;i++)
	  for(int j=1;j<=4001;j++)
		  f[i][j]=(1ll*f[i][j]+f[i-1][j]+f[i][j-1])%mod;
  Fac[0]=1;for(int i=1;i<=8000;i++)Fac[i]=1ll*Fac[i-1]*i%mod;
  int ans=0;
  for(int i=1;i<=n;i++){
	  ans=(ans+f[e[i].x+2001][e[i].y+2001])%mod;
	  ans=(ans-C(e[i].x*2+e[i].y*2,e[i].x*2))%mod;
  }
  if(ans<0)ans+=mod;
  cout<<1ll*ans*inv(2)%mod<<endl;
  return 0;
}


Measured memory_bytes: 64512
import math

inputs = input().split()
n = int(inputs[0])
k = int(inputs[1])

p = [0] * n
for dice in range(n):
    p[dice] = 1/n
    point = (dice+1)
    while point < k:
        p[dice] *= 1/2
        point *= 2.0

print(sum(p))

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

int GCD(int a, int b){
    return b? GCD(b, a % b) : a;
}

int LCM(int a, int b) {
    return a * b / GCD(a, b);
}

int main(void) {
    int n;

    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n;
    cout << LCM(n, 2) << "\n";
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#include<cmath>


#define REP(i,n) for (int i = 0; (i) < (n); ++ (i))
#define FOR(i,n) for (int i = 1; (i) <= (n); ++ (i))
#define dump(x)  cout << #x << " = " << (x) << endl;
#define pb push_back
#define int long long
//#define lint long long

const int INF = 1e18;
const int MOD = 1e9+7;
//const lint LINF = 1e18;
const double eps = 0.000000001;//もとの値の10^(-16)まで

using namespace std;

//typedef pair<int, int> P;
//priority_queue< P, vector<P>, greater<P> > q;//ダイクストラの時、greaterで小さい順
double ans1;

signed main(){
  int n;
  cin >> n;
  REP(i,n){
    int a;
    cin >> a;
    ans1 += 1.0/a;
  }
  cout << fixed << setprecision(10) << 1.0/ans1 << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define int long long
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e18;

vector<int> s[11];

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n, m;
    cin >> n >> m;
    rep(i, 0, m){
        int k;
        cin >> k;
        rep(j, 0, k){
            int in;
            cin >> in;
            in--;
            s[i].push_back(in);
        }
    }
    vector<int> p(m);
    rep(i, 0, m) cin >> p[i];
    int ans = 0;
    for(int i = 0; i < (1LL << n); i++){
        bool f = true;
        rep(j, 0, m){
            int cnt = 0;
            for(auto k : s[j]){
                if(i & (1LL << k)){
                    cnt++;
                }
            }
            if((cnt % 2) != p[j]){
                f = false;
                break;
            }
        }
        if(f) ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
import std.stdio, std.string, std.conv, std.range, std.array, std.algorithm;
import std.uni, std.math, std.container, std.typecons, std.typetuple;
import core.bitop, std.datetime;

immutable int mod = 10^^9 + 7;

void main()
{
    //             0  1  2  3  4  5  6  7  8  9  10 11 12
    int[] group = [0, 1, 3, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1];
    int x, y;
    readVars(x, y);

    writeln(group[x] == group[y] ? "Yes" : "No");
}


void readVars(T...)(auto ref T args)
{
    auto line = readln.split;
    foreach(ref arg ; args){
        arg = line.front.to!(typeof(arg));
        line.popFront;
    }
    if(!line.empty){
        writeln(line);
        throw new Exception("args num < input num");
    }
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;

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

        Scanner sc = new Scanner(System.in);
        List<String> nums = Arrays.asList(sc.nextLine().split(" "));

        boolean one = nums.stream().anyMatch(x -> x.equals("1"));
        boolean nine = nums.stream().anyMatch(x -> x.equals("9"));
        boolean seven = nums.stream().anyMatch(x -> x.equals("7"));
        boolean four = nums.stream().anyMatch(x -> x.equals("4"));

        if (one && nine && seven && four) {
        	System.out.println("YES");
        } else {
         	System.out.println("NO");
        }
	}
}

Measured memory_bytes: 29012
#include<iostream>
#include<cstdio>
typedef long long ll;
using namespace std;
const int MAXN=2e5+10;
ll val[MAXN],pre[MAXN],suf[MAXN],dp[MAXN];
int main(){
	int n;scanf("%d",&n);
	for(int i=1;i<=n;i++) scanf("%lld",&val[i]);
	if(n%2==0){
        pre[1]=val[1];pre[2]=val[2];
        for(int i=3;i<=n;i++) pre[i]=pre[i-2]+val[i];
        suf[n]=val[n];suf[n-1]=val[n-1];
        for(int i=n-2;i>=1;i--) suf[i]=suf[i+2]+val[i];
		ll ans=max(pre[n-1],pre[n]);
		for(int i=1;i<=n-3;i+=2) ans=max(ans,pre[i]+suf[i+3]);
		printf("%lld\n",ans);
		return 0;
	}
	ll mx=dp[1]=-val[1];
	ll sum=val[1];
	for(int i=3;i<=n;i+=2){
        sum+=val[i];
        dp[i]=max(-val[i],dp[i-2]+val[i-1]-val[i]);
        mx=max(mx,dp[i]);
	}
	printf("%lld\n",sum+mx);
	return 0;
}


Measured memory_bytes: 7896
#include <vector>
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <limits.h>
#include <cmath>
#include <queue>
#include <map>
#include <iomanip>
#include <random>
#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
typedef long long ll;

ll gcd(ll a, ll b)
{
  ll r;
  while ((r = a % b))
  {
    a = b;
    b = r;
  }
  return b;
}

int main()
{

  int Tmax = 10000;
  rep(i, Tmax)
  {
    cout << -1 << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#if defined(LOCAL)
const double _max_double_error = 1e-9;
#include "testutils.h"
#define L(x...) (debug(x, #x))
#define I(x, ...) (x)
#define C(x...) CHECK(x)
#else
#define L(x, ...) (x)
#define I(x, ...) (x)
#define C(x, ...) ;
#endif
#include <algorithm>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <math.h>
#include <memory>
#include <numeric>
#include <queue>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using ii = pair<int, int>;
using lu = unsigned long long;
using l = long long;
using vs = vector<string>;
using vii = vector<ii>;
using vl = vector<l>;
using vvl = vector<vl>;
using vvvl = vector<vvl>;
using ll = pair<l, l>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vd = vector<double>;
using vvd = vector<vd>;
using mll = unordered_map<l, l>;
using sl = unordered_set<l>;
const l INF = numeric_limits<l>::max();
const double EPS = 1e-10;
const double PI = M_PI;
const l e0 = 1, e3 = 1000, e5 = 100000, e6 = 10 * e5, e7 = 10 * e6,
        e8 = 10 * e7, e9 = 10 * e8;
const char lf = '\n';
#define all(x) begin(x), end(x)
#define F(a, b, c) for (l a = l(b); a < l(c); a++)
#define B(a, b, c) for (l a = l(c) - 1; a >= l(b); a--)
#define VVL(x, a, b, i) vvl x(a, vl(b, l(i)));
#define VVVL(x, a, b, c, i) vvvl x(a, vvl(b, vl(c, l(i))));

void solve(istream &in, ostream &out);
int main(int argc, char **argv) {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(15);
#if defined(LOCAL)
  tst::test_init(argc, argv);
  // _generate_random_test = generate_random;
  // _solve_brute = solve_brute;
  // _player_b = player_b;
  // _custom_solution_checker = solution_checker;
  tst::maybe_run_tests(cin, cout);
#else
  solve(cin, cout);
#endif
}
const l MOD = e9 + 7; // end of template

void solve(istream &in, ostream &out) {
  l n;
  in >> n;
  mll a, b;
  F(i, 0, n / 2) {
    l x, y;
    in >> x >> y;
    a[x]++;
    b[y]++;
  }
  ll a1, a2, b1, b2;
  auto f = [&](mll &m) -> pair<ll, ll> {
    ll x, y;
    for (auto kv : m) {
      if (kv.second > x.second) {
        swap(x, y);
        x = kv;
        continue;
      }
      if (kv.second > y.second) {
        y = kv;
      }
    }
    return {x, y};
  };
  tie(a1, a2) = f(a);
  tie(b1, b2) = f(b);
  if (a1.first == b1.first) {
    if (a1.second + b2.second > a2.second + b1.second) {
      swap(b1, b2);
    } else {
      swap(a1, a2);
    }
  }
  out << n - a1.second - b1.second << lf;
}


Measured memory_bytes: 4376
# -*- coding: utf-8 -*-
"""
Created on Wed Aug 15 12:43:21 2018
ABC049C
@author: maezawa
"""

s = input()
a = ('dream', 'dreamer', 'erase', 'eraser')

i = len(s)
ans = 'YES'
while True:
    if s[-5:] == a[0] or s[-5:] == a[2]:
        i -= 5
        if i == 0:
            ans = 'YES'
            break
        elif i<5:
            ans = 'NO'
            break
        s = s[:i]
    elif i>=6 and s[-6:] == a[3]:
        i -= 6
        if i == 0:
            ans = 'YES'
            break
        elif i<5:
            ans = 'NO'
            break
        s = s[:i]
    elif i>=7 and s[-7:] == a[1]:
        i -= 7
        if i == 0:
            ans = 'YES'
            break
        elif i<5:
            ans = 'NO'
            break
        s = s[:i]
    else:
        ans = 'NO'
        break
    #print(s)
print(ans)

Measured memory_bytes: 3316
// author: Saman Mahdanian
#include <bits/stdc++.h>

using namespace std;
const int N = 5e5 + 10;
const int MOD = 1e9 + 7;

int _sum (int, int);
int _mul (int, int);
int _pow (int, int);
int gcd (int, int);

int n, a[N], preg[N], sufg[N];

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

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

	preg[0] = a[0];
	for (int i = 1; i < n; i++)
		preg[i] = gcd(preg[i - 1], a[i]);
	sufg[n - 1] = a[n - 1];
	for (int i = n - 2; i >= 0; i--)
		sufg[i] = gcd(sufg[i + 1], a[i]);

	// for (int i = 0; i < n; i++)
	// 	cout << a[i] << ' ' << preg[i] << ' ' << sufg[i] << endl;

	int ans = max(preg[n - 2], sufg[1]);
	for (int i = 1; i < n - 1; i++)
		ans = max(ans, gcd(preg[i - 1], sufg[i + 1]));
	cout << ans << endl;
}

int gcd (int a, int b) {
	return !b? a : gcd (b, a % b);
}

// int choose (int r, int k) {
// 	return _mul (f[k], _mul(inv[r], inv[k - r]));
// }

int _sum (int a, int b) {
	return a + b - (a + b >= MOD? MOD : 0);
}

int _mul (int a, int b) {
	return 1LL * a * b % MOD;
}

int _pow (int a, int b) {
	if (!b) 
		return 1;
	int res = _pow (a, b >> 1);
	res = _mul (res, res);
	if (b & 1)
		res = _mul (res, a);
	return res;
}

// SamMHD :: Jun27-2019 :: Another Day with Shayan...

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

typedef long long ll;


int main() {
	cin.tie(0);
    ios::sync_with_stdio(false);
 
    ll a, b, c;
 
    cin >> a >> b >> c;
 
    c -= (a + b);

    if(c < 0) {
        cout << "No" << endl;
        return 0;
    }
 
    if(4LL * a * b < c * c) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}

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

using namespace std;

int greater(int a, int b){
  return a>b;
}

int main(){
  int a[5];
  scanf("%d%d%d%d%d", a, a+1, a+2, a+3, a+4);

  sort(a, a+5, greater);

  printf("%d %d %d %d %d\n", a[0], a[1], a[2], a[3], a[4]);
}

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

#define ll long long
#define endl "\n"

int main(){
  string s;
  cin >> s;
  int ans=0;
  for(int i=0;i<s.size()-1;i++){
    if(s[i]==s[i+1]){
      if(s[i]=='0')
        s[i+1]='1';
      else
        s[i+1]='0';
      ans++;  
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3712
#include <iostream>
#include <vector>
#include <numeric>
#include <algorithm>
using ll = long long;
template <typename T>
constexpr T INF() { return std::numeric_limits<T>::max() / 2; }
int main()
{
    int N;
    ll W;
    std::cin >> N >> W;
    std::vector<ll> v(N), w(N);
    for (int i = 0; i < N; i++) { std::cin >> v[i] >> w[i]; }
    const int F = N / 2, L = N - F;
    const int fmask = 1 << F, lmask = 1 << L;
    using P = std::pair<ll, ll>;
    std::vector<P> f(fmask, {0LL, 0LL}), l(lmask, {0LL, 0LL});
    for (int i = 0; i < fmask; i++) {
        for (int j = 0; j < F; j++) {
            if (i & (1 << j)) { f[i].first += w[j], f[i].second += v[j]; }
        }
    }
    for (int i = 0; i < lmask; i++) {
        for (int j = 0; j < L; j++) {
            if (i & (1 << j)) { l[i].first += w[j + F], l[i].second += v[j + F]; }
        }
    }
    std::sort(f.begin(), f.end()), std::sort(l.begin(), l.end());
    std::vector<ll> fw(fmask), fv(fmask), lw(lmask), lv(lmask);
    for (int i = 0; i < fmask; i++) { fw[i] = f[i].first, fv[i] = f[i].second; }
    for (int i = 0; i < lmask; i++) { lw[i] = l[i].first, lv[i] = l[i].second; }
    for (int i = 1; i < fmask; i++) { fv[i] = std::max(fv[i], fv[i - 1]); }
    for (int i = 1; i < lmask; i++) { lv[i] = std::max(lv[i], lv[i - 1]); }
    ll ans = 0;
    for (int i = 0; i < fmask; i++) {
        const ll WR = W - fw[i];
        const int ind = std::upper_bound(lw.begin(), lw.end(), WR) - lw.begin();
        if (ind <= 0) { break; }
        ans = std::max(ans, fv[i] + lv[ind - 1]);
    }
    std::cout << ans << std::endl;
    return 0;
}


Measured memory_bytes: 68320
N = gets.chomp.to_i
H = gets.chomp.split.map(&:to_i)

before = nil
H.each_cons(3) do |a, b, c|
  candidates =
    if before
      ab = before.map {|x| [x[1], x[2]]}.uniq
      ab.flat_map do |_a, _b|
        [
          [_a, _b, c],
          [_a, _b, c - 1],
        ]
      end
    else
      [
        [a, b, c],
        [a, b, c - 1],
        [a, b - 1, c],
        [a, b - 1, c - 1],
        [a - 1, b, c ],
        [a - 1, b, c - 1],
        [a - 1, b -1, c],
        [a - 1, b -1, c - 1],
      ]
    end

  before = candidates.select do |x, y, z|
    x <= y && y <= z
  end
  (puts 'No'; exit) if before.size == 0
end
puts 'Yes'


Measured memory_bytes: 13188
#include <bits/stdc++.h> // Tomasz Nowak
using namespace std;     // XIII LO Szczecin
using LL = long long;    // Poland
#define FOR(i, l, r) for(int i = (l); i <= (r); ++i)
#define REP(i, n) FOR(i, 0, (n) - 1)
template<class T> int size(T &&x) {
	return int(x.size());
}
template<class A, class B> ostream& operator<<(ostream &out, const pair<A, B> &p) {
	return out << '(' << p.first << ", " << p.second << ')';
}
template<class T> auto operator<<(ostream &out, T &&x) -> decltype(x.begin(), out) {
	out << '{';
	for(auto it = x.begin(); it != x.end(); ++it)
		out << *it << (it == prev(x.end()) ? "" : ", ");
	return out << '}';
}
void dump() {}
template<class T, class... Args> void dump(T &&x, Args... args) {
	cerr << x << ";  ";
	dump(args...);
}
#ifdef DEBUG
  struct Nl{~Nl(){cerr << '\n';}};
# define debug(x...) cerr << (strcmp(#x, "") ? #x ":  " : ""), dump(x), Nl(), cerr << ""
#else
# define debug(...) 0 && cerr
#endif
mt19937_64 rng(0);
int rd(int l, int r) {
	return uniform_int_distribution<int>(l, r)(rng);
}
// end of templates

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

	int a, b, v, w, t;
	cin >> a >> v >> b >> w >> t;
	// a + tv = b + tw
	// t = (b - a) / (v - w)
	if(v <= w) {
		cout << "NO\n";
		return 0;
	}
	if(a > b)
		swap(a, b);

	if((b - a) <= t * LL(v - w))
		cout << "YES\n";
	else
		cout << "NO\n";
}


Measured memory_bytes: 3632
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;


class Main {

	public static void main(String... args) {
		Scanner scanner = null;
		try {
			scanner = new Scanner(System.in);
			
			Paper paper = new Paper();
			while (scanner.hasNext()) {
				String line = scanner.nextLine();
				String[] lines = line.split(",");
				
				int x = Integer.parseInt(lines[0]);
				int y = Integer.parseInt(lines[1]);
				int size = Integer.parseInt(lines[2]);
				paper.drop(x, y, size);
			}
			paper.printOutput();
			
		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}
	
	static class Paper {
		private List<List<Integer>> X_LIST = new ArrayList<List<Integer>>();
		Paper() {
			for (int i = 0; i < 10; i++) {
				List<Integer> yList = new ArrayList<Integer>();
				for (int j  = 0; j < 10; j++) {
					yList.add(0);
				}
				X_LIST.add(yList);
			}
		}
		
		void drop(int x, int y, int size) {
			dropCell(x, y);
			
			switch (size) {
			case 3:
				dropCell(x + 2, y);
				dropCell(x - 2, y);
				dropCell(x, y + 2);
				dropCell(x, y - 2);
			case 2:
				dropCell(x + 1, y + 1);
				dropCell(x + 1, y - 1);
				dropCell(x - 1, y + 1);
				dropCell(x - 1, y - 1);
			case 1:
				dropCell(x + 1, y);
				dropCell(x - 1, y);
				dropCell(x, y + 1);
				dropCell(x, y - 1);
			default:
				break;
			}
		}
		
		void dropCell(int x, int y) {
			if (x < 0 || y < 0 || 9 < x || 9 < y) {
				return;
			}
			List<Integer> yList = X_LIST.get(x);
			yList.set(y, yList.get(y) + 1);
		}
		
		void printOutput() {
			int whiteNum = 0;
			int maxDensity = 0;
			for (List<Integer> yList : X_LIST) {
				for (Integer i : yList) {
					whiteNum = (0 < i) ? whiteNum : whiteNum + 1;
					maxDensity = (maxDensity < i) ? i : maxDensity;
				}
			}
			System.out.println(whiteNum);
			System.out.println(maxDensity);
		}
	}
}

Measured memory_bytes: 17340
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair< ll, ll > Pi;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep2(i,n) for(int i=1;i<=(n);i++)
#define rep3(i,i0,n) for(int i=i0;i<(n);i++)
#define pb push_back
#define mod 1000000007
const ll INF = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
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;}
#define all(x) x.begin(), x.end()
#define mp make_pair
bool compare(Pi a, Pi b) {
    if(a.first != b.first){
        return a.first < b.first;
        
    }else{
        return a.second < b.second;
    }
}


bool In_map(ll y,ll x,ll h,ll w){
    if(y<0 || x<0 || y>=h || x>=w){
        return 0;
    }else{
        return 1;
    }
}
const vector<ll> dx{1,0,-1,0};
const vector<ll> dy{0,1,0,-1};


int main() {
    ll N;
    cin >>N;
    vector<ll>A(N);
    vector<ll>sum(N+1);
    rep(i,N){
        cin>>A[i];
        sum[i+1]=(sum[i]+A[i])%mod;
    }
    ll ans=0;

    rep(i,N){
        //cout<<A[i]<<" "<<sum[i]<<endl;
        ans = (ans+A[i]*sum[i])%mod;
    }
    cout << ans << endl;


    return 0;
    

}

Measured memory_bytes: 6428
from statistics import mean, median,variance,stdev
import sys
import math

x = input().split()
#y = input().split()
a = []
for i in range(len(x)):
   a.append(int(x[i]))

if a[0]*a[1]<a[2]*a[3]:print(a[2]*a[3])
else:print(a[0]*a[1])

Measured memory_bytes: 5148
#include<iostream>

using namespace std;

int main(){
	int N, M;
	char A[50][50], B[50][50];
	cin >> N >> M;
	for(int i = 0; i < N; i++){
		cin >> A[i];
	}
	for(int i = 0; i < M; i++){
		cin >> B[i];
	}
	bool canflag = false;
	for(int ai = 0; ai < N; ai++){
		for(int aj = 0; aj < N; aj++){
			bool flag = true;
			for(int bi = 0; bi < M; bi++){
				for(int bj = 0; bj < M; bj++){
					if(A[ai + bi][aj + bj] != B[bi][bj]){
						flag = false;
					}
				}
				if(flag == false){
					break;
				}
			}
			if(flag == true){
				canflag = true;
				break;
			}
		}
	}
	if(canflag == true){
		cout << "Yes" << endl;
	}else{
		cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var b string
	fmt.Scan(&b)
	switch b[0] {
	case 'A':
		fmt.Println("T")
	case 'C':
		fmt.Println("G")
	case 'G':
		fmt.Println("C")
	case 'T':
		fmt.Println("A")
	}
}

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

deque< pair<pair<long long, long long>, int> > L, R, L2, R2;

int main(){
  int n; cin >> n;
  vector<bool> used(n, false); vector<bool> used2(n, false);
  for (int i = 0; i < n; i++) {
    long long l, r; cin >> l >> r;
    L.push_back(make_pair(make_pair(l, r), i));
    L2.push_back(make_pair(make_pair(l, r), i));
    R2.push_back(make_pair(make_pair(r, l), i));
    R.push_back(make_pair(make_pair(r, l), i));
  }
  sort(L.begin(), L.end());
  sort(R.begin(), R.end());
  sort(L2.begin(), L2.end());
  sort(R2.begin(), R2.end());
  long long x = 0;
  long long ans = 0;
  long long nn = n;
  ans += x - R.front().first.first;
  x = R.front().first.first;
  used[R.front().second]=true;
  R.pop_front();
  n--;
  while(n != 0) {
    while (used[L.back().second]) {
      L.pop_back();
    }
    int yl = L.back().first.first;
    while (used[R.front().second]) {
        R.pop_front();
    }
    int yr = R.front().first.first;
    if (yl - x <= 0 && x - yr <= 0) break;
    if (yl - x > x - yr) {
      ans += yl - x;
      x = yl;
      used[L.back().second]=true;
      L.pop_back();
    } else {
      ans += x - yr;
      x = yr;
      used[R.front().second]=true;
      R.pop_front();
    }
    n--;
  }
  ans += abs(x);
  long long x2 = 0;
  long long ans2 = 0;
  ans2 += L2.back().first.first - x2;
  x2 = L2.back().first.first;
  used2[L2.back().second]=true;
  L2.pop_back();
  nn--;
  while(nn != 0) {
    while (used2[L2.back().second]) {
      L2.pop_back();
    }
    int yl = L2.back().first.first;
    while (used2[R2.front().second]) {
        R2.pop_front();
    }
    int yr = R2.front().first.first;
    if (yl - x2 <= 0 && x2 - yr <= 0) break;
    if (yl - x2 > x2 - yr) {
      ans2 += yl - x2;
      x2 = yl;
      used2[L2.back().second]=true;
      L2.pop_back();
    } else {
      ans2 += x2 - yr;
      x2 = yr;
      used2[R2.front().second]=true;
      R2.pop_front();
    }
    nn--;
  }
  ans2 += abs(x2);
  //cout << ans << " " << ans2 << endl;
  cout << max(ans, ans2) << endl;
  return 0;
}

Measured memory_bytes: 10112
n = int(input())
ans = {}
for _ in range(n):
  s = input()
  if s in ans.keys():
    ans[s] += 1
  else:
    ans[s] = 1
for i in ['AC', 'WA', 'TLE', 'RE']:
  if not i in ans.keys():
    ans[i] = 0
  print('%s x %s ' %(i, ans[i]))

Measured memory_bytes: 9220
#include<stdio.h>
#define MAX 500000
#define INF (1<<30)

int L[MAX], R[MAX],cnt;

void merge(int* A, int l, int mid, int r){
	int n1,n2,i,j,k;
	n1=mid-l;	n2=r-mid;
	for(i=0;i<n1;i++){
		L[i]=A[l+i];
	}
	for(int i=0;i<n2;i++){
		R[i]=A[mid+i];
	}
	L[n1]=R[n2]=INF;

	i=j=0;
	for(k=l;k<r;k++){
			cnt++;
		if(L[i]<=R[j]){
			A[k]=L[i++];
		}else{
			A[k]=R[j++];
		}
	}
}

void MergeSort(int* A, int l, int r){
	int mid;
	if(r-l>1){
		mid=(l+r)/2;
		MergeSort(A,l,mid);
		MergeSort(A,mid,r);
		merge(A,l,mid,r);
	}
}

int main(){
	int i,n,A[MAX];
	scanf("%d",&n);
	for(i=0;i<n;i++)scanf("%d",&A[i]);

	cnt=0;
	MergeSort(A,0,n);

	for(i=0;i<n;i++){
		if(i)printf(" ");
		printf("%d",A[i]);
	}printf("\n%d\n",cnt);
	return 0;
}



Measured memory_bytes: 6504