akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define endl '\n'
#define int long long
#define lint long long
#define pii pair<int, int>
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define FORR(i, a, b) for(int i = (a); i > (b); --i)
#define REP(i, n) FOR(i, 0, n)
#define SZ(v) ((int)v.size())
#define ZERO(a) memset(a, 0, sizeof(a))
#define MINUS(a) memset(a, 0xff, sizeof(a))
#define FILLINF(a) memset(a, 0x3f, sizeof(a))
#define POW(n) (1LL << (n))
#define POPCNT(n) (__builtin_popcount(n))
#define IN(i, a, b) ((a) <= (i) && (i) <= (b))
using namespace std;
template <typename T> inline bool CHMIN(T& a, T b) { if(a > b) { a = b; return 1; } return 0; }
template <typename T> inline bool CHMAX(T& a, T b) { if(a < b) { a = b; return 1; } return 0; }
template <typename T> inline void SORT(T& a) { sort(begin(a), end(a)); }
template <typename T> inline void REV(T& a) { reverse(begin(a), end(a)); }
template <typename T> inline void UNI(T& a) { sort(a.begin(), a.end()); a.erase(unique(a.begin(), a.end()), a.end()); }
template <typename S, typename T> inline T LB(S& v, T a) { return *lower_bound(begin(v), end(v), a); }
template <typename S, typename T> inline int LBP(S& v, T a) { return lower_bound(begin(v), end(v), a) - begin(v); }
template <typename S, typename T> inline T UB(S& v, T a) { return *upper_bound(begin(v), end(v), a); }
template <typename S, typename T> inline int UBP(S& v, T a) { return upper_bound(begin(v), end(v), a) - begin(v); }
template <typename S, typename T> ostream& operator << (ostream& os, const pair<S, T>& p) { os << p.first << " " << p.second; return os; }
template <typename S, typename T> istream& operator >> (istream& is, pair<S, T>& p) { is >> p.first >> p.second; return is; }
template <typename T> ostream& operator << (ostream& os, const vector<T>& v) { for (int i = 0; i < v.size(); ++i) { if (i) os << " "; os << v[i]; } return os; }
template <typename T> istream& operator >> (istream& is, vector<T>& v) { for(T& in : v) is >> in; return is; }
template <typename T = int> 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); }
const double PI = 3.14159265358979323846;
const double EPS = 1e-10;
const lint INF = 0x3f3f3f3f3f3f3f3f;
const lint MOD = 1000000007;

void _main() {
    int a, b, c;
    cin >> a >> b >> c;
    if (c - a - b <= 0) {
        cout << "No" << endl;
        return;
    }
    int d = (c - a - b) * (c - a - b);
    cout << (4 * a * b < d ? "Yes" : "No") << endl;
}

signed main(signed argc, char **argv) {
    if (argc > 1) {
        if (strchr(argv[1], 'i')) freopen("input.txt", "r", stdin);
        if (strchr(argv[1], 'o')) freopen("output.txt", "w", stdout);
    }
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(10);
    _main();
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=1e6+5;
vector<ll> V;
const ll mod=998244353;
ll fapow(ll a,ll b){
    ll ans=1;
    for(;b;b>>=1,a=a*a%mod) if(b&1) ans=ans*a%mod;
    return ans;
}
ll fac[maxn];
ll C(ll n,ll m){
    return fac[n]*fapow(fac[n-m]*fac[m]%mod,mod-2)%mod;
}
int main() {
    fac[0]=1;
    for(int i=1;i<maxn;i++) fac[i]=(fac[i-1]*i)%mod;
    ll n,m,k;cin>>n>>m>>k;
    ll ans=0;
    for(int i=0;i<=k;i++){
        ans=(ans+((C(n-1,i)*m%mod)*fapow(m-1,n-i-1))%mod)%mod;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 11456
#include<iostream>
#include<algorithm>
#include<cmath>
typedef long long ll;
using namespace std;
int main() {
	int n;
	cin >> n;
	int ans = 0;
	int count = 0;
	for (int k = 1; k <= n; k = k + 2) {
		for (int i = 1; i <= n; i++) {
			if (k % i == 0) {
				count++;
			}
		}
		if (count == 8) {
			ans++;
		}
		count = 0;
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.Map;
import java.util.PriorityQueue;
import java.util.Scanner;

public class Main {

	/**
	 * @param args
	 * @throws IOException 
	 */
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		Scanner cin = new Scanner(System.in);
		Map<Integer ,Integer> map = new HashMap<Integer,  Integer>();
		while(true){
			String str = br.readLine();
			if(str.equals("")){
				break;
			}
			String s[] = str.split(",");
			int com = Integer.parseInt(s[0]);
			if(map.containsKey(com)){
				
				int tmp = map.get(com);
				map.remove(com);
				map.put(com, tmp+1);
			}
			else{
				map.put(com, 1);

			}
		}


		PriorityQueue<Integer> q = new PriorityQueue<Integer>();
		while(true){
			String str = br.readLine();
			if(str == null){
				break;
			}
			String s[] = str.split(",");
			int com = Integer.parseInt(s[0]);
			if(map.containsKey(com)){
				if(!q.contains(com)){
					q.offer(com);	
				}
				
				int tmp = map.get(com);
				map.remove(com);
				map.put(com, tmp+1);
			}
		}
		
		while(!q.isEmpty()){
			System.out.println(q.peek() + " " + map.get(q.poll()));
		}
		
	}

}

Measured memory_bytes: 12000
def main():
    import sys
    input = sys.stdin.readline
    
    n = int(input())
    arr = list(map(int, input().split()))
    
    ans = 0
    for i in range(1, n - 1):
        b = sorted(arr[i - 1: i + 2])[1]
        if b == arr[i]:
            ans += 1
    
    print(ans)
    
    return 0

main()

Measured memory_bytes: 3316
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll maxn=2e5+50;
const int mod=1e9+7;
int x[maxn];
map<int,int>mp;
int main()
{
    int n;
    ll sum=0;
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        scanf("%d",&x[i]);
        int m=++mp[x[i]];
        sum+=m-1;
    }
    for(int i=0;i<n;i++){
        int m=mp[x[i]]-1;
        sum-=m;
        printf("%lld\n",sum);
        sum+=m;
    }
    return 0;
}


Measured memory_bytes: 8320
#include <cstdio>
#include <cstring>
#include <algorithm>
#define fo(i,a,b) for(int i=a;i<=b;i++)
#define fd(i,a,b) for(int i=a;i>=b;i--)
using namespace std;

typedef long long ll;

const int N=3e5+5,Mo=998244353;

int n,r,g,b,rg,rb,gb;
char s[N];

int main() {
	scanf("%d",&n);
	scanf("%s",s+1);
	int ans=1;
	fo(i,1,3*n) {
		if (s[i]=='R') {
			if (gb) {ans=(ll)ans*gb%Mo;gb--;continue;}
			if (g) {ans=(ll)ans*g%Mo;rg++;g--;continue;}
			if (b) {ans=(ll)ans*b%Mo;rb++;b--;continue;}
			r++;
		}
		if (s[i]=='G') {
			if (rb) {ans=(ll)ans*rb%Mo;rb--;continue;}
			if (r) {ans=(ll)ans*r%Mo;rg++;r--;continue;}
			if (b) {ans=(ll)ans*b%Mo;gb++;b--;continue;}
			g++;
		}
		if (s[i]=='B') {
			if (rg) {ans=(ll)ans*rg%Mo;rg--;continue;}
			if (r) {ans=(ll)ans*r%Mo;rb++;r--;continue;}
			if (g) {ans=(ll)ans*g%Mo;gb++;g--;continue;}
			b++;
		}
	}
	fo(i,1,n) ans=(ll)ans*i%Mo;
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 512
import sys
input = sys.stdin.readline

#l = list(map(int, input().split()))
#import numpy as np
#arr = np.array([int(i) for i in input().split()])
'''
a,b=[],[]
for i in range():
    A, B = map(int, input().split())
    a.append(A)   
    b.append(B)'''

n=int(input())
if n==1:
    print(0)
else:
    print(1)

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


int main(){
  ll n;
  cin >> n;
  vector<ll> a(n);
  rep(i,n) cin >> a.at(i);
  if( count(a.begin(),a.end(),0) > 0 ){
    cout << 0 << endl;
    return 0;
  }
  ll now = 1;
  rep(i,n){
    if( a.at(i) > j/now ){
      cout << -1 << endl;
      return 0;
    }
    now *= a.at(i);
  }
  cout << now << endl;
  return 0;
}


Measured memory_bytes: 4060
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <algorithm>
#include <iomanip>
#include <math.h>
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;
using vl = vector<ll>;
using vll = vector<vl>;
#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define REPR(i,n) for(int i=n-1; i>=(int)(0); i--)
#define FOR(i,a,b) for(int i=(int)(a); i<(int)(b); i++)
#define FORR(i,a,b) for(int i=(int)(b)-1; i>=(int)(a); i--)
#define CHMIN(a,b) (a)=min((a),(b))
#define CHMAX(a,b) (a)=max((a),(b))
#define ALL(v) (v).begin(),(v).end()
//**関数リスト**//
int ctoi(char c) {
	switch (c) {
	case '0': return 0;
	case '1': return 1;
	case '2': return 2;
	case '3': return 3;
	case '4': return 4;
	case '5': return 5;
	case '6': return 6;
	case '7': return 7;
	case '8': return 8;
	case '9': return 9;
	default: return 0;
	}
}
bool pairCompare(const pll firstElof, pll secondElof)
{
	return firstElof.second < secondElof.second;
}
ll nod(ll F) {
	ll keta = 1;
	while (F / 10 > 0) {
		keta++;
		F /= 10;
	}
	return keta;
}
ll gcd(ll x, ll y) {
	ll r;
	if (x < y) {
		swap(x, y);
	}
	while (y > 0) {
		r = x % y;
		x = y;
		y = r;
	}
	return x;
}
ll lcm(ll x, ll y) {
	return x * y / gcd(x, y);
}
ll isPrime(ll x) {
	ll i;
	if (x < 2) {
		return 0;
	}
	else if (x == 2) {
		return 1;
	}
	else if (x % 2 == 0) {
		return 0;
	}
	else {
		for (i = 3; i * i <= x; i += 2) {
			if (x % 1 == 0) {
				return 0;
			}
		}
		return 1;
	}
}
void eratos(vl isPrime) {
	//(注)isPrimeのサイズはN+1にする！実際にはmain内に配置して使用
	ll i, j;
	REP(i, isPrime.size()) {
		isPrime[i] = 1;
	}
	isPrime[0] = 0; isPrime[1] = 0;
	for (i = 2; i * i <= isPrime.size() - 1; i++) {
		if (isPrime[i] == 1) {
			j = i * 2;
			while (j <= isPrime.size() - 1) {
				isPrime[j] = 0;
				j = j + i;
			}
		}
	}
}
ll modinv(ll a, ll m) {
	ll b = m, u = 1, v = 0;
	while (b) {
		ll t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
void bitSearch(ll n) {
	//実際にはコピーして中身を改変して使う
	ll i;
	REP(i, pow(2, n)) {
		ll p = i;
		REP(i, n) {
			cout << p % 2;
			p /= 2;
		}
		cout << endl;
	}
}
void dfs(ll now) {
	//中身は毎回書き換えて使用
	stack <ll> S;
	//flagは初期値0
	S.push(now);
	//flag[now]=1;
	while (!S.empty()) {
		ll u = S.top();
		//ll v = ;
		//if(flag[v]==0){flag[v]=1;S.push[v];}else{S.pop();}
	}
}
void bfs(ll now) {
	//中身は毎回書き換えて使用
	queue<ll> Q;
	Q.push(now);
	ll u;
	while (!Q.empty()) {
		u = Q.front();
		Q.pop();
		//ll v=;
		//Q.push(v);
	}
}
//**定義場所**//
ll i, j, k, l, m, n;
ll N, M, K, H, W;
ll MOD = 1000000007;
ll ans = 0;
//***********//
int main() {
	ll A, B, C, D;
	cin >> A >> B >> C >> D;
	cout << (B - A + 1) - (B / C - (A - 1) / C) - (B / D - (A - 1) / D) + (B / lcm(C, D) - (A - 1) / lcm(C, D));
}

Measured memory_bytes: 256
import java.util.Scanner;
import java.lang.Math;
import java.util.Arrays;

public class Main {
  static long mod = 1000000007;
  static long[] fact;

  public static void main(String[] args) {
    Scanner scan = new Scanner(System.in);
    int N = scan.nextInt();
    int K = scan.nextInt();
    long[] A = new long[N];
    for(int i=0; i<N; i++) {
      A[i] = scan.nextLong();
    }
    scan.close();

    fact = new long[N+1];
    fact[0] = 1;
    for(int i=1; i<=N; i++) {
      fact[i] = (long)i * fact[i-1] % mod;
    }

    Arrays.sort(A);

    long[] nCkArray = new long[N+1];
    long maxSum = 0;
    for(int i=K-1; i<N; i++) {
      if(nCkArray[i] == 0) {
        nCkArray[i] = nCk(i, K-1);
      }

      maxSum += A[i] * nCkArray[i];
      maxSum %= mod;
    }

    long minSum = 0;
    for(int i=0; i<N-K+1; i++) {
      if(nCkArray[N-i-1] == 0) {
        nCkArray[N-i-1] = nCk(N-i-1, K-1);
      }

      minSum += A[i] * nCkArray[N-i-1];
      minSum %= mod;
    }

    long ans = maxSum - minSum;
    ans %= mod;
    while(ans < 0) {
      ans += mod;
    }
    System.out.println(ans);
  }

  public static long power(long x, long n) {
    long result = 1;
    while(n > 0) {
      if(n%2 == 1) {
        result *= x;
        result %= mod;
      }
      x = x*x;
      x %= mod;

      n >>= 1;
    }

    return result;
  }

  public static long nCk(long n, long k) {
    return fact[(int)n] * power(fact[(int)k] * fact[(int)(n-k)] % mod, mod-2) % mod;
  }
}

Measured memory_bytes: 62452
/*
If you want to aim high, aim high
Don't let that studying and grades consume you
Just live life young
******************************
If I'm the sun, you're the moon
Because when I go up, you go down
*******************************
*/
import java.util.*;
import java.io.*;

   public class Main
   {
      public static void main(String args[]) throws Exception
      {
         BufferedReader infile = new BufferedReader(new InputStreamReader(System.in));  
         StringTokenizer st = new StringTokenizer(infile.readLine());
         int N = Integer.parseInt(st.nextToken());
         int K = Integer.parseInt(st.nextToken());
         int[] arr = readArr(N, infile, st);
         boolean[] dp = new boolean[K+1];
         for(int i=0; i <= K; i++)
            for(int v: arr)
               if(i >= v && !dp[i-v])
                  dp[i] = true;
         if(dp[K])
            System.out.println("First");
         else
            System.out.println("Second");
      }
      public static int[] readArr(int N, BufferedReader infile, StringTokenizer st) throws Exception
      {
         int[] arr = new int[N];
         st = new StringTokenizer(infile.readLine());
         for(int i=0; i < N; i++)
            arr[i] = Integer.parseInt(st.nextToken());
         return arr;
      }
   }

Measured memory_bytes: 23636
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define all(x) x.begin(),x.end()
#define dbg(x) cout<<#x<<":"<<x<<endl
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<ll,P> PP;

int main(){
  double t,x;
  cin>>t>>x;
  printf("%.10lf\n",t/x);
  return 0;
}


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

// a^n mod を計算する
long long modpow(long long a, long long n, long long mod)
{
    long long res = 1;
    while (n > 0)
    {
        if (n & 1)
            res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

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

    if (K % 2 == 0 || K % 5 == 0)
    {
        cout << -1 << endl;
        return 0;
    }

    int c = 1;
    int result = 7 % K;

    while (result != 0)
    {
        result = (result * 10 + 7) % K;
        c++;
    }

    cout << c << endl;

    return 0;
}

Measured memory_bytes: 3624
using System;

class main
{
    static void Main(string[] args)
    {
        string s;
        while ((s = Console.ReadLine()) != null)
        {
            int sa = 0;
            int d = int.Parse(s);
            for (int i = 0; i < 600; i += d)
                sa += i*i*d;
            Console.WriteLine(sa);
        }
    }
}

Measured memory_bytes: 5584
#include<iostream>
#include<vector>
#include<math.h>
using namespace std;

int main(){
    string str1,str2;
    cin >> str1;
    cin >> str2;
    int counter = 0;
    for(int i = 0; i < str1.length(); i++) {
        if(str1[i] == str2[i])
            counter++;
    }
    if(counter == str1.length() && str1.length() + 1 == str2.length()) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 2980
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N, K, ans = 0;
  cin >> N >> K;
  
  for (int i = 0; i < N; i++) {
    int h;
    cin >> h;
    
    if (h >= K)
      ans++;
  }
  
  cout << ans << endl;
    
}

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

const int MAX_N = 100000;

int main() {
  long long N, A, B, X[MAX_N];
  long long ans = 0;
  long long dist[MAX_N] = {0};
  cin >> N >> A >> B >> X[0];
  for (int i=1; i<N; i++) {
    cin >> X[i];
    dist[i] = (X[i] - X[i-1]);
    ans += min(dist[i] * A, B);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <numeric>
#include <vector>
#include <cmath>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <iomanip>
using namespace std;
using ll=long long;
using pll=pair<ll,ll>;
const ll MOD=1000000007;
const ll LINF=0x1fffffffffffffff;
const int INF=0x3fffffff;
const vector<pll> dir={{0,1},{1,0},{-1,0},{0,-1},{1,1},{-1,1},{1,-1},{-1,-1}};
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define rrep(i,a,b) for(ll i=b-1;i>=a;i--)
#define range(i) (i).begin(),(i).end()
#define rrange(i) (i).rbegin(),(i).rend()
inline ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
inline ll lcm (ll a,ll b) {return a*b/gcd(a,b);}
inline constexpr int intpow(ll a,ll b){
    if(b==0) return 1;
    ll ans=intpow(a,b/2);
    return ans*ans%MOD*(b&1?a:1)%MOD;
}
inline constexpr int modf(ll n){
    ll ans=1;
    rep(i,0,n) {ans=ans*(n-i)%MOD;}
    return ans;
}

vector<ll> func,inv;
void init(ll n){
    func.resize(n+1);inv.resize(n+1);
    func[0]=1;
    rep(i,0,n) {func[i+1]=func[i]*(i+1)%MOD;}
    inv[n]=intpow(func[n],MOD-2);
    rrep(i,1,n+1) {inv[i-1]=inv[i]*i%MOD;}
}
ll comb(ll a,ll b) {return func[a]*inv[b]%MOD*inv[a-b]%MOD;}

inline long double median(vector<ll> v){
    ll size=v.size();
    sort(v.begin(),v.end());
    if (size % 2 == 1) return v[(size - 1) / 2];
    else return v[(size / 2) - 1] ;
}
template<class T> inline bool chmax(T& a,T b) {if(a<b){a=b;return 1;} return 0;}
template<class T> inline bool chmin(T& a,T b) {if(a>b){a=b;return 1;} return 0;}
template<class T,class L>ostream& operator << (ostream& os, pair<T,L>& p){os << p.first << " " << p.second;return os;}

int main(){
    ll n;
    cin>>n;
    vector<ll> a(n),b(n),c(n);
    rep(i,0,n) cin>>a[i];sort(range(a));
    rep(i,0,n) cin>>b[i];sort(range(b));
    rep(i,0,n) cin>>c[i];sort(range(c));
    ll ans=0;
    rep(i,0,n){
        ans+=(lower_bound(range(a),b[i])-a.begin())*(c.end()-upper_bound(range(c),b[i]));
    }
    cout<<ans;
}

Measured memory_bytes: 2688
#include<iostream>
#include<vector>
#include<string>
#include<cmath>
#include<map>

using namespace std;

int n,m,q;

int suretsu[100];
int a[100],b[100],c[100],d[100];


int ans = 0;

void saiki(int before,int x){
    if(x==n){
        int sum = 0;
        for(int i=0;i<q;i++){
            if(suretsu[b[i]-1]-suretsu[a[i]-1]==c[i]){sum+=d[i];}
        }
        if(sum>ans)ans=sum;

        return;
    }

    for(int i=before;i<=m;i++){
        suretsu[x]=i;
        saiki(i,x+1);
    }

}

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

    for(int i=0;i<q;i++){
        cin >> a[i] >> b[i] >> c[i] >> d[i];
    }

    saiki(1,0);

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3636
#include<iostream>
#include<cstdio>
using namespace std;
int i,j,n,m,x[200003]= {0},a,b,num=0,num1=0;
int main()
{
    cin>>n>>m;
    for(i=0; i<m; i++)
    {
        scanf("%d %d",&a,&b);
        if(a==1)
            x[b]++;
        if(b==n)
            x[a]++;
    }
    int flag=0;
    for(i=0; i<n; i++)
    {
        if(x[i]==2)
        {
            flag=1;
            break;
        }
    }
    if(flag==1)
        cout<<"POSSIBLE"<<endl;
    else
        cout<<"IMPOSSIBLE"<<endl;
}


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

//typedef
//------------------------------------------
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef vector<string> VS;
typedef pair<LL, LL> PLL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int MOD = 1000000007;

// grid
//--------------------------------------------
VL dx = {0, 1, 0, -1};
VL dy = {1, 0, -1, 0};
VL dx2 = {-1, 0, 1, -1, 1, -1, 0, 1};
VL dy2 = {-1, -1, -1, 0, 0, 1, 1, 1};

//debug
//--------------------------------------------
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

//IO accelerate
//--------------------------------------------
struct InitIO {
    InitIO() {
        cin.tie(nullptr);
        ios_base::sync_with_stdio(false);
        cout << fixed << setprecision(30);
    }
} init_io;

//template
//--------------------------------------------
template<typename T>
istream& operator >>(istream& is, vector<T>& vec) {
  for(T& x: vec) is >> x;
  return is;
}
template<typename T>
ostream& operator <<(ostream& os, const vector<T>& vec) {
  for(int i=0; i<vec.size(); i++){
    os << vec[i] << ( i+1 == vec.size() ? "" : "\t" );
  }
  return os;
}
template<typename T>
ostream& operator <<(ostream& s, const vector<vector<T>>& vv) {
	for (int i = 0; i < vv.size(); ++i) {
		s << vv[i] << endl;
	}
	return s;
}

//main code

int main(int argc, char const* argv[])
{
	int n,a,b;
	cin >>n>>a>>b;
	cout << min(n*a,b) << endl;
	return 0;
}


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

const bool debug = false;

int main(){
    int n,m,x;
    cin >> n >> m >> x;
    vector<int> prices(n);
    vector<vector<int>> books(n);
    rep(i,n){
        cin >> prices.at(i);
        rep(j,m){
            int b;
            cin >> b;
            books.at(i).push_back(b);
        }
    }

    if(debug){
        cout << "price:";
        rep(i,m){
            cout << prices.at(i) << " ";
        }
        cout << endl;
    }



    ll res = 1e9;
    for(int bit=0;bit<(1<<n);bit++){
        // std::cout << bit << endl;
        vector<int> learns(m);
        ll p = 0;
        for(int i=0;i<n;i++){
            if(bit&(1<<i)){
                // 買う場合
                rep(j,m){
                    learns.at(j) += books.at(i).at(j);
                }
                p += prices.at(i);
            }
        }
        bool ok_fl = true;
        rep(j,m){
            if(learns.at(j) < x){
                ok_fl = false;
                break;
            }
            // cout << learns.at(j) << " ";
        }
        // cout << "p:" << p << endl;
        if(ok_fl){
            res = min(res,p);
        }
    }
    if(res == 1e9){
        res = -1;
    }

    std::cout << res << endl;
    return 0;
}

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

public class Main {
	public static void main(String[] args) {
		Scanner reader = new Scanner(System.in);
		int[] A = new int[3];
		A[0] = reader.nextInt();
		A[1] = reader.nextInt();
		A[2] = reader.nextInt();
		Arrays.sort(A);
		int ans = A[2] - A[1];
		A[0] += ans;
		ans += (A[2] - A[0]) / 2;
		if ((A[2] - A[0]) % 2 == 1) {
			ans+=2;
		}
		System.out.print(ans);
		reader.close();
	}
}



Measured memory_bytes: 22612
s = input()
first = int(s[:2])
second = int(s[2:])

if((first > 12 or first == 0) and second <= 12 and second != 0):
	print("YYMM")
elif(first <= 12 and (second > 12 or second == 0) and first != 0):
	print("MMYY")
elif(first <= 12 and second <= 12 and second != 0 and second != 0):
	print("AMBIGUOUS")
else:
	print("NA")

Measured memory_bytes: 3064
def calc_gcd(a, b)
  if b > a
    a, b = b, a
  end
  loop do
    r = a % b
    break if r == 0
    a, b = b, r
  end
  
  b
end

while line = gets
  a, b = line.split.map(&:to_i)
  puts calc_gcd(a, b)
end

Measured memory_bytes: 8612
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int mod=998244353;
const int maxn=2010;
inline int add(int v){
	return v<mod?v:v-mod;
}
struct modInt{
	int v;
	modInt(int _v=0):v(_v){}
	inline modInt operator+(const modInt& rhs) const{
		return modInt(add(v+rhs.v));
	}
	inline modInt operator-(const modInt& rhs) const{
		return modInt(add(v+mod-rhs.v));
	}
	inline modInt operator*(const modInt& rhs) const{
		return modInt((ll)v*rhs.v%mod);
	}
} C[maxn+maxn][maxn+maxn];
inline modInt getH(int n,int m){
	if(n+m-1<0 || m-1<0) return 0;
	return C[n+m-1][m-1];
}
inline modInt qpow(modInt base,int pw){
	modInt res=1;
	while(pw){
		if(pw&1) res=res*base;
		base=base*base;
		pw>>=1;
	}
	return res;
}
int main(){
	int k,n;
	scanf("%d%d",&k,&n);
	C[0][0]=1;
	for(int i=1;i<=n+k;i++){
		C[i][0]=1;
		for(int j=1;j<=i;j++)
			C[i][j]=C[i-1][j-1]+C[i-1][j];
	}
	for(int i=2;i<=k+k;i++){
		int conflict=0;
		for(int j=1;j<i-j;j++)
			if(i-j<=k) conflict++;
		modInt ans=0;
		if(i&1){
			for(int apr=0;apr<=conflict;apr++)
				ans=ans+C[conflict][apr]*qpow(2,apr)*getH(n-apr,k-conflict-conflict+apr);
		}else{
			for(int apr=0;apr<=conflict;apr++)
				ans=ans+C[conflict][apr]*qpow(2,apr)*getH(n-apr,k-1-conflict-conflict+apr);
			for(int apr=0;apr<=conflict;apr++)
				ans=ans+C[conflict][apr]*qpow(2,apr)*getH(n-apr-1,k-1-conflict-conflict+apr);
		}
		printf("%d\n",ans.v);
	}
	return 0;
}

Measured memory_bytes: 63488
//#include <bits/stdc++.h>
#include <iostream>
#define ios ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef long long ll;
using namespace std;


int main()
{
    ll a, b, c, d; cin >> a >> b >> c >> d;
    ll ans = a*c;
    ans = max(ans, a*d);
    ans = max(ans, b*c);
    ans = max(ans, b*d);
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3628
from collections import Counter
n = int(input())
l = list(map(int, input().split()))
E = [i for i in l[::2]]
O = [i for i in l[1::2]]
e=Counter(E).most_common() #偶数番目の位置にある数の出現回数を最頻度順に並べる
o=Counter(O).most_common() #奇数番目の位置にある数の出現回数を最頻度順に並べる

if e[0][0] != o[0][0]: #偶数列の最頻値と奇数列の最頻値が異なる場合、それぞれを最頻値で置き換えるだけ
    print(n-e[0][1]-o[0][1])
else:
    if len(e)==1 or len(o)==1: #偶奇数列で最頻地が同じかつ片方が一種類の時、もう一方を全部置き換えるしかない
        print(n//2)
    else: #そうでない場合最頻値とsecond最頻値で置き換える
        a=n-e[1][1]-o[0][1]
        b=n-e[0][1]-o[1][1]
        print(min(a,b))

Measured memory_bytes: 21084
#include <bits/stdc++.h>
#define lli long long int
#define pb push_back
#define mod 1000000007
#pragma GCC optimize ("-O2")
#define mod2 998244353
#define MAXN 1000000000
#define v32 vector<int>
#define v64 vector<lli>
#define v1024 vector <vector <int>>
#define v4096 vector <vector <lli>>
#define vt vector
#define f(x, y, z) for (lli x = y; x < z; x++)
#define fd(x, y, z) for (lli x = y; x > z; x--)
#define lb lower_bound
#define ld long double
#define m64 map<lli,lli>
#define m32 map<int,int>
#define m64it map<lli,lli>::iterator
#define m32it map<int,int>::iterator
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define ist insert
#define endl "\n"
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ordered_set tree<pair<lli,int>, null_type,less<pair<lli,int>>, rb_tree_tag,tree_order_statistics_node_update> 
#define p_q priority_queue 
#define min_p_q priority_queue <int,vt <int>,greater <int>>
using namespace std;
using namespace __gnu_pbds; 
template <typename T> 
void DEBUG_ARR(vt<T> a){
	f(i,0,a.size())cout<<a[i]<<" ";
	cout<<"\n";
}

int main() { 
    fastio;
    int n;
    cin>>n;
    string s,t;
    cin>>s>>t;
    string ans;
    f(i,0,2*n)if(i&1)ans.pb(t[i/2]);
              else ans.pb(s[i/2]);
              cout<<ans<<"\n";
    return 0; 	
}

Measured memory_bytes: 256
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int H = sc.nextInt();
		int W = sc.nextInt();
		int K = sc.nextInt();
		char[][] c = new char[H][W];
		for(int i = 0; i < H; i++)
			c[i] = sc.next().toCharArray();
		int ans = 0;
		for(int i = 0; i < 1<<(H+W); i++) {
			boolean[] x = new boolean[H+W];
		    for(int j = 0; j < (H+W); j++)
		        if ((1 & i >> j) == 1)
		            x[j] = true;
		    int black = 0;
		    for(int j = 0; j < H; j++)
		    	for(int k = 0; k < W; k++)
		    		if(x[j] && x[H+k] && c[j][k] == '#')
		    			black++;
		    if(black == K)
		    	ans++;
		}
		System.out.println(ans);
	}

}


Measured memory_bytes: 36712
let s = read_line ()
let n = String.length s
let cs = Array.init n @@ fun i -> if Char.uppercase s.[i] = s.[i] then 1 else 0
let _ = print_endline @@ if s.[0] = 'A' && String.contains (String.sub s 2 (n - 3)) 'C' && Array.fold_left (+) 0 cs = 2 then "AC" else "WA"

Measured memory_bytes: 384
import java.util.Scanner;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String s=sc.next();
		if(s.equals("Sunny")){
			System.out.println("Cloudy");
		}else if(s.equals("Cloudy")){
			System.out.println("Rainy");
		}else{
			System.out.println("Sunny");
		}
	}
}


Measured memory_bytes: 21716
h, w, K = map(int, input().split())
s = [input() for _ in range(h)]

ans = float('inf')
for i in range(1 << (h - 1)):
    cut_h = []
    for j in range(h - 1):
        if (i >> j) & 1:
            cut_h.append(j)

    blocks = []
    before = 0
    for cut in cut_h:
        blocks.append([before, cut])
        before = cut + 1
    blocks.append([before, h - 1])

    counts = [[0] * w for _ in range(len(blocks))]
    for b in range(len(blocks)):
        for j in range(blocks[b][0], blocks[b][1] + 1):
            for k in range(w):
                if s[j][k] == '1':
                    counts[b][k] += 1

    # print(cut_h)
    # print(blocks)
    # print(counts)

    maxcounts = 0
    for j in range(len(counts)):
        for k in range(len(counts[0])):
            maxcounts = max(maxcounts, counts[j][k])
    if maxcounts > K:
        continue

    tmpans = len(cut_h)
    cumsums = [0] * len(blocks)
    for k in range(w):
        for b in range(len(blocks)):
            cumsums[b] += counts[b][k]

        if max(cumsums) > K:
            # print(cumsums)
            tmpans += 1
            cumsums = [counts[b][k] for b in range(len(blocks))]


    ans = min(ans, tmpans)
    # print(tmpans)
print(ans)


Measured memory_bytes: 50652
//#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <queue>

using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<n;++i)
#define mod (ll)(1e9+7)
#define FIX(a) ((a)%mod+mod)%mod
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define fi first
#define se second
#define pb push_back
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,m;
    cin >> n >> m;
    int t = 1;
    t <<= m;
    cout << (100*(n-m)+1900*m)*t << endl;;

    return 0;
}

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


Measured memory_bytes: 640
import math
import re


x=input()

n=len(x)

k=int((n-1)/2)

y=int((n+3)/2)

x1=x[::-1]

x2=x[:k]


x3=x2[::-1]

x4=x[y-1:]
x5=x4[::-1]


if (x1==x)and(x3==x2)and(x4==x5):
    print('Yes')
else :
    print('No')


Measured memory_bytes: 3188
program ABC042C
    implicit none
    integer(8)::N,K,i,j,h,ans,hmod
    integer(8)::flg=0
    integer(8),allocatable,dimension(:)::D
    read(5,*)N,K
    allocate(D(K))
    read(5,*)(D(i),i=1,K)
    do i=N,10*N
        flg=0
        h=i
        do
            hmod=mod(h,10)
            do j=1,K
                if(D(j)==hmod)then
                    flg=1
                    exit
                end if
            end do
            h=h/10
            if(h==0)exit
        end do
        if(flg==0)then
            ans=i
            exit
        end if
    end do
    print'(i0)',ans
end program ABC042C

Measured memory_bytes: 896
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int t,count=1, result=0;
  cin>>t;
  while(t--)
  {
    int a;
    cin>>a;
    if(count&1 and a&1)
      result++;
    count++;
  }
  cout<<result<<"\n";
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
 
int main() 
{
    
    int N;
    cin >> N;
    vector<int> A(N+2, 0);
    for (int i = 1; i <= N; i++) {
        cin >> A[i];
    }
    
    vector<int> D(N+1, 0);
    int sum = 0;
    for (int i = 0; i < N+1; i++) {
        D[i] = abs(A[i+1] - A[i]);
        sum += D[i];
    }
    
    for (int i = 1; i <= N; i++) {
        int ans = sum;
        ans -= (D[i-1] + D[i]);
        ans += abs(A[i+1] - A[i-1]);
        cout << ans << endl;
    }
    
}

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

a=[1,6,36,216,1296,7776,46656,9,81,729,6561,59049]

inf=float('inf')
dp=[inf for _ in range(100000+1)]
dp[0]=0
dp[1]=1

for x in range(1,100001):
  for b in a:
    if b<=x:
      dp[x]=min(dp[x],dp[x-b]+1)
      
print(dp[n])


Measured memory_bytes: 9936
from sys import exit
from queue import Queue

q = Queue()

N, K = map(int, input().split())

S = input()

ans_list = []

delta = 0

Flag = False

buffer = 0

for i in range(len(S)):
    if S[i] == '0' and not Flag:
        Flag = True
        buffer = i
        if K == 0:
            ans_list.append(i - delta)
    if S[i] == '1' and Flag:
        if K > 0:
            K -= 1
            q.put((buffer, i - 1))
        else:
            delta = q.get()[1] + 1
            q.put((buffer, i - 1))
        Flag = False
if K > 0:
    print(len(S))
    exit()

if S[len(S) - 1] == '0':
    delta = q.get()[1] + 1
    ans_list.append(len(S) - delta)

if S[len(S) - 1] == '1':
    ans_list.append(len(S) - delta)

print(max(ans_list))


Measured memory_bytes: 10436
#pragma GCC optimize("Ofast", "unroll-loops")

#include <bits/stdc++.h>

using namespace std;

int main() {
	string s; cin >> s;
	if (s.length() == 1) {
		cout << 1 << endl;
		return 0;
	}
	vector<vector<int>> dp(s.length(), vector<int>(2, 0));
	dp[0][0] = 1;
	dp[1][1] = 1;
	if (s[0] != s[1])
		dp[1][0] = 2;
	for (int i = 2; i < s.length(); ++i) {
		// dp[i][0]
		if (s[i] != s[i - 1])
			dp[i][0] = max(dp[i - 1][0] + 1, dp[i - 1][1] + 1);
		else dp[i][0] = dp[i - 1][1] + 1;
		// dp[i][1]
		if (i > 2 && s.substr(i - 3, 2) != s.substr(i - 1, 2))
			dp[i][1] = max(dp[i - 2][1] + 1, dp[i - 2][0] + 1);
		else dp[i][1] = dp[i - 2][0] + 1;
	}
	/*
	for (int i = 0; i < s.length(); ++i)
		cout << dp[i][0] << " ";
	cout << endl;
	for (int i = 0; i < s.length(); ++i)
		cout << dp[i][1] << " ";
	cout << endl;
	*/
	cout << max(dp[s.length() - 1][0], dp[s.length() - 1][1]) << endl;
	return 0;
}

Measured memory_bytes: 11396
#include<stdio.h>
int main(){
    int x,y,d;
    scanf("%d%d",&x,&y);
    
    if(x>=y){
        while(y !=0){
            d=x%y;
            x=y;
            y=d;
        }
        printf("%d\n",x);
    }
    
    else{
        while(x != 0){
            d=y%x;
            y=x;
            x=d;
        }
        printf("%d\n",y);
    }
    return 0;
}


Measured memory_bytes: 2140
n,m = map(int, input().split())
x = list(map(int, input().split()))

if n>=m:
    print(0)
else:
    x.sort()

    diff = [[] for i in range(m-1)]
    for i in range(m-1):
        diff[i] = x[i+1]-x[i]
    diff.sort()

    for i in range(n-1):
        diff.pop(-1)

    print(sum(diff))


Measured memory_bytes: 14040
require 'prime'

N = gets.to_i
A = gets.split.map(&:to_i)

def gcd(a, b)
  if a > b
    return a if b == 0

    gcd(b, a % b)
  else
    return b if a == 0

    gcd(a, b % a)
  end
end

# A0, A1,...Ai
L = Array.new(N+1) {0}
# Ai,...An
R = Array.new(N+1) {0}

L[0] = 0
for i in (1..N)
  L[i] = gcd(L[i-1], A[i-1])
end

# p L

R[N] = 0
(N-1).downto(0) do |i|
  R[i] = gcd(R[i+1], A[i])
end

# p R

ans = 0
for i in (1..N-1)
  gcd = gcd(L[i-1], R[i])
  # p "gcd(L[#{i-1}],R[#{i}])"
  if ans < gcd
    ans = gcd
  end
end

p [ans, L[N-1]].max


Measured memory_bytes: 10668
// ConsoleApplication3.cpp : コンソール アプリケーションのエントリ ポイントを定義します。
//

//#include "stdafx.h"
#include <iostream>
using namespace std;
int main()
{
	int a,b;
	cin >> a >> b;
	//cout << a << b << endl;
	cout << a*b << " " <<  2*(a+b) << endl;
    return 0;
}




Measured memory_bytes: 3116
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(ll i = 0; i < (n); ++i)
#define repA(i, a, n) for(int  i = a; i <= (n); ++i)
#define all(x) x.begin(), x.end()
#define sz(x) (int) (x).size()
#define fill(a) memset(a, 0, sizeof(a))
#define fst first
#define snd second
#define mp make_pair
#define pb push_back
#define endl '\n'
#define init(n) int n;cin>>n;int a[n];rep(i,n)cin>>a[i];
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<long long int> vll;
typedef vector<pii> vii;
const ll INF=1e18 + 5;
ll p=1000000007;
int main() {
    // #ifndef ONLINE_JUDGE
    // freopen("input.txt", "r", stdin);   
    // freopen("output.txt", "w", stdout);
    // #endif
    cin.sync_with_stdio(0); cin.tie(0);
    cin.exceptions(cin.failbit);
    ll n,k;cin>>n>>k;
    ll dp[n][k+1];
    ll a[n];
    rep(i,n)cin>>a[i];
    memset(dp,0,sizeof(dp));
    ll sum[k+1]={0};
    for(int i=0;i<n;i++){
        ll temp[k+1]={0};
        for(int j=0;j<=k;j++){
            if(i==0){
                if(j<=a[i]){
                    dp[i][j]=1; 
                    sum[j]++;   
                }
                if(j!=0)
                sum[j]+=sum[j-1];
            continue;
            }
            if(j>a[i]){
                dp[i][j]=(sum[j]-sum[j-a[i]-1]+p)%p;    
            }
            else{
                dp[i][j]=(sum[j])%p;    
            }
            if(j==0){
                temp[j]=dp[i][j];
            }
            else{
                temp[j]=(temp[j-1]+dp[i][j])%p;
            }
        }
        if(i!=0)
        rep(r,k+1)sum[r]=temp[r];
    }
    cout<<dp[n-1][k];
    return 0;
}

Measured memory_bytes: 80000
#include<cstdio>
#include<algorithm>
#include<iostream>
#include<vector>
#include<cstring>
#include<cmath>
#include<cstring>
#include<string>
#include<map>
#include<set>
#define ll long long
#define rep(i,l,r) for(int i=l;i<=r;i++)
#define per(i,r,l)for(int i=r;i>=l;i--)
#define pb push_back
#define pp pop_back
#define pii pair<int,int>
#define pll pair<ll,ll>
#define mod 1e9+7
#define vii vector<int>
#define vll vector<ll>
#define vpp vector<pii>
#define inf  INT_MAX
#define lnf LLONG_MAX
using namespace std;
const int MX = 2e5 + 7;
ll modulo(ll num, ll MOD = mod) { return ((num%MOD) + MOD) % MOD; }
ll power(ll b, ll e, ll MOD = mod) { ll ans = 1; while (e) { if (e % 2) ans = (ans*b) % MOD; b = (b*b) % MOD; e /= 2; } return ans; }
ll inv(ll num, ll MOD = mod) { return power(modulo(num), MOD - 2, MOD); }
ll gcd(ll a, ll b) { return ((b == 0) ? a : gcd(b, a%b)); }
int root[MX];
vll g[MX];
int ans[MX];
void dfs(int a,int t,int p)
{
//	cout << "aa" << endl;
	int m = g[a].size();
	root[a] += t;
	rep(i, 0, m-1)
	{
		if(g[a][i]!=p)
		dfs(g[a][i],root[a],a);
	}
	return;
}
int main()
{
	ios::sync_with_stdio(0); cin.tie(0);
	int n, m;
	cin >> n >> m;
	rep(i, 1, n-1)
	{
		int a, b;
		cin >> a >> b;
		g[a].pb(b);
		g[b].pb(a);
	}
	int q;
	rep(i, 1, m)
	{
		int x,y;
		cin >> y>>x;
		root[y] += x;
	}
	dfs(1, 0, -1);
	rep(i, 1, n) {
		if (i < n)cout << root[i] << " ";
		else cout << root[i] << "\n";
	}
}

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

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

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

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

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

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

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

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

// solution 
#[allow(unused_mut)]
#[allow(non_snake_case)]
fn main() {
    input! {
        N: usize,
        a: [usize; N],
    }
    let mut n4 = 0;
    let mut n2 = 0;

    for &ai in a.iter() {
        if ai&1 == 0 {
            if (ai >> 1)&1 == 0 {
                n4 += 1;
            } else {
                n2 += 1;
            }
        }
    }

    if n4 >= N/2 {
        println!("Yes");
    } else if n2 >= N - 2*n4 {
        println!("Yes");
    } else {
        println!("No");
    }
}



Measured memory_bytes: 4352
#include<iostream>
#include<stdio.h>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<queue>
#include<stack>
#include<vector>
#include<map>
using namespace std;
typedef long long ll;
const int mod = 1e9 + 7;
const int INF = 0x3f3f3f3f;
const int maxx = 1e5;
char a[maxx]; 
int main()
{
	int n;
	cin >> n;
	for(int i = 0; i < n; i ++)
	{
		cin >> a[i];
	}
	int cnt = 1;
	for(int i = 1; i < n; i ++)
	{
		if(a[i] == a[i - 1]) continue;
		else cnt ++;
	}
	cout << cnt << '\n';

	return 0;
}



Measured memory_bytes: 384
#include <iostream>
using namespace std;
int main()
{
    string a,b;
    cin >> a >> b;
    for(int i=0;i<b.size();i++)
        cout << a[i] << b[i];
    if(b.size()!=a.size())
        cout << a[a.size()-1];
    cout << endl;
    return 0;
}

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

using namespace std;

template<typename T>
T gcd(T a,T b){
    if(b==0)return a;
    return gcd(b,a%b);
}

template<typename T>
T lcm(T a,T b){
    T d=gcd(a,b);
    return (a/d)*b;
}

int main(){
    long long a,b,c,d;
    cin>>a>>b>>c>>d;
    long long bc=b/c,bd=b/d;
    long long ac=(a-1)/c,ad=(a-1)/d;
    long long dc=bc-ac,dd=bd-ad;
    long long lc=lcm(c,d);
    long long dlc=b/lc-(a-1)/lc;
    cout<<(b-a+1)-(dc+dd-dlc)<<endl;
    return 0;
}

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

int main() {
    while(1){
        int m, f, r;
        scanf("%d %d %d", &m, &f, &r);

        if (m == -1 && f == -1 && r == -1) break;

        if (m == -1 || f == -1) {
            cout << "F" << endl;
        } else if (m + f >= 80) {
            cout << "A" << endl;
        } else if (m + f >= 65) {
            cout << "B" << endl;
        } else if (m + f >= 50) {
            cout << "C" << endl;
        } else if (m + f >= 30) {
            if (r >= 50) {
                cout << "C" << endl;
            } else {
                cout << "D" << endl;
            }
        } else {
            cout << "F" << endl;
        }
    }

    return 0;
}


Measured memory_bytes: 3252
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <vector>
#include <queue>
#include <algorithm>

using namespace std;

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

ll mod = 1e9 + 7;

int main(){
	ll h;
	int n;
	ll a[100000];
	
	cin >> h >> n;
	for(int i=0;i<n;i++){
		cin >> a[i];
	}
	ll sum = 0;
	for(int i=0;i<n;i++){
		sum += a[i];
	}
	if(sum>=h){
		cout << "Yes" << endl;
	}else{
		cout << "No" << endl;
	}

	return 0;
}


Measured memory_bytes: 1024
import java.util.*;
public class Main{

	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int X = sc.nextInt();
		int min = 1000;
		for(int i = 0; i < N ; i++){
			int a = sc.nextInt();
			X -= a;
			if(min > a){
				min = a;
			}
			
		}
		
		N += X/min;
		System.out.println(N);
	}
}


Measured memory_bytes: 23764
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<(n);++i)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define all(x) (x).begin(), (x).end()
#define PI 3.14159265358979323846264338327950L
#define NUM 1000000000000000000
using namespace std;
typedef long long ll;
typedef long double ld;
int main() {
    ll a,b,c,k;
    cin>>a>>b>>c>>k;
    if(abs(a-b)>NUM){
        cout<<"Unfair";
        return 0;
    }
    if(k%2==0) cout<<a-b;
    else cout<<b-a;
}

Measured memory_bytes: 3632
pub mod kit {
    use std::io::BufRead;
    use std::str::{self, FromStr};

    pub struct Scanner<R: BufRead> {
        reader: R,
        buff: Vec<u8>,
    }

    impl<R: BufRead> Scanner<R> {
        pub fn new(reader: R) -> Self {
            Self {
                reader,
                buff: Vec::new(),
            }
        }

        #[allow(unused)]
        #[inline]
        pub fn read_line<T: FromStr>(&mut self) -> T {
            match self.read_until(b'\n') {
                Some(t) => t,
                None => panic!("Failed to read_line"),
            }
        }

        #[allow(unused)]
        #[inline]
        pub fn read<T: FromStr>(&mut self) -> T {
            match self.read_until(b' ') {
                Some(t) => t,
                None => panic!("Failed to read"),
            }
        }

        #[inline]
        fn read_until<T: FromStr>(&mut self, delim: u8) -> Option<T> {
            loop {
                self.buff.clear();
                match self.reader.read_until(delim, &mut self.buff).unwrap() {
                    0 => return None,
                    1 if self.buff[0] == delim => (),
                    n => {
                        if self.buff[n - 1] == delim {
                            self.buff.truncate(n - 1);
                        }
                        break;
                    }
                }
            }
            str::from_utf8(&self.buff).unwrap().parse().ok()
        }
    }
}


// let cin = std::io::stdin();
// let mut sc = scanner!(cin);
#[allow(unused)]
macro_rules! scanner {
    ($stdin:expr) => {
        kit::Scanner::new($stdin.lock())
    };
}

fn main() {
    let cin = std::io::stdin();
    let mut sc = scanner!(cin);

    let chars = &['#', '.'];

    loop {
        let h: i32 = sc.read();
        let w: i32 = sc.read_line();
        if h == 0 {
            break;
        }

        for i in 0..h {
            let n = if i % 2 == 0 { 0 } else { 1 };
            for j in 0..w {
                print!("{}", chars[((j + n) % 2) as usize]);
            }
            println!();
        }
        println!();
    }

}


Measured memory_bytes: 5032
#include<iostream>
using namespace std;
int N;
int A[2<<17];
long mod=998244353;
long X[1<<20],Y[1<<20],inv[1<<20];
void func(int id,int a)
{
	(X[id]+=Y[id]*a)%=mod;
	(Y[id]+=a)%=mod;
}
main()
{
	cin>>N;
	for(int i=0;i<N;i++)
	{
		cin>>A[i];
		for(int j=1;j*j<=A[i];j++)
		{
			if(A[i]%j==0)
			{
				func(j,A[i]);
				if(A[i]/j>j)func(A[i]/j,A[i]);
			}
		}
	}
	inv[1]=1;
	for(int i=2;i<=1000000;i++)inv[i]=mod-mod/i*inv[mod%i]%mod;
	long ans=0;
	for(int i=1000000;i>0;i--)
	{
		for(int j=i+i;j<=1000000;j+=i)
		{
			X[i]-=X[j];
		}
		X[i]=(X[i]%mod+mod)%mod;
		(ans+=X[i]*inv[i])%=mod;
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 25600
#include <bits/stdc++.h>
#define rep(i,m,n) for(int i=m;i<n;i++)
#define co(n) cout<<n<<endl
#define all(n) (n).begin(),(n).end()
using namespace std;
typedef long long ll;

int main(){
  ll a,b,c=0,d=0,e,f,g,h,m,n,ans=0;
  double x,y;
  cin>>a>>b;
  x=log(a); y=log(b);
  x/=y;
  a=x;
  a++;
  co(a);
  
  return 0;
}


Measured memory_bytes: 384