akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define ios ios_base::sync_with_stdio(0) ; cin.tie(0) ; cout.tie(0)
#define so sizeof
#define pb push_back
#define vl vector<ll>
#define forn(i,a,b) for(ll i=1;i<=b;++i)
#define forr(i,a,b) for(ll i=0;i<b;++i)
#define vll vector<pair<ll,ll> >
#define r0 return 0
#define be begin()
#define en end()
#define pll pair<ll,ll>
#define plll pair<ll,pair<ll,ll>>
#define plvl pair<pair<ll,ll> ,ll>
#define mp make_pair
#define cf cout.flush()
int main()
{
   ios;
   long long n   , m ;
   cin >> n  >> m ;
   vl v ;
   forn(i , 1 , m){
    ll x;
    cin >> x;
    v.pb(x);
 }
  sort(v.begin() , v.end());
  if(n>=m) {
        cout << 0 <<endl ;
    r0 ;
  }
  vector<pll> vv;
  vl diff ;
  for(ll i=0;i<m-1;++i){
    ll foo = abs(v[i]-v[i+1]);
    diff.pb(foo);
  }
   sort(diff.be , diff.en , greater<>());
   ll foo = accumulate(diff.be , diff.en , 0);
   for(ll i =0;i<n-1;++i)
   {
       foo = foo - diff[i];
   }
    cout << foo <<"\n";
  return 0 ;
}

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

int main(){
    int k;
    string s;
    cin >> k >> s;
    if(k < s.size()){
       rep(i, k){
          cout << s[i];
       }
       cout << "...";
    }else{
       cout << s;
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 3592
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        double N = sc.nextInt();
        if (N==0) {
            System.out.println(0);
        }
        else if (N % 2 == 0) {
            System.out.println(0.5);
        }
        else {
            System.out.println(((N/2)+0.5)/N);
        }
    }
}

Measured memory_bytes: 22740
#include <iostream>
#include <vector>
#include <cstdlib>
using namespace std;
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; }

const long long INF = 1LL << 60;

int N;
long long W, weight[110], value[110];
long long dp[110][100100]={0};

int main(void){
	cin >> N >> W;
	for(int i=0; i<N; i++) cin >> weight[i] >> value[i];

	for(int i=0; i<N; i++){
		for(int sum_w = 0; sum_w <= W; sum_w++){
			if(sum_w-weight[i] >= 0){
				chmax(dp[i+1][sum_w], dp[i][sum_w-weight[i]]+value[i]);
			}
			chmax(dp[i+1][sum_w], dp[i][sum_w]);
		}
	}
	cout << dp[N][W] << endl;
}

Measured memory_bytes: 79360
import sys

rl = sys.stdin.readline


class SegmentTree:
    def __init__(self, init_value: list, segfunc, ide_ele):
        n = len(init_value)
        self.N0 = 1 << (n - 1).bit_length()
        self.ide_ele = ide_ele
        self.data = [ide_ele] * (2 * self.N0)
        self.segfunc = segfunc
        
        for i, x in enumerate(init_value):
            self.data[i + self.N0 - 1] = x
        for i in range(self.N0 - 2, -1, -1):
            self.data[i] = self.segfunc(self.data[2 * i + 1], self.data[2 * i + 2])
    
    def update(self, _k, x):
        k = _k + self.N0 - 1
        self.data[k] = x
        while k:
            k = (k - 1) // 2
            self.data[k] = self.segfunc(self.data[k * 2 + 1], self.data[k * 2 + 2])
    
    def query(self, left, right):
        L = left + self.N0
        R = right + self.N0
        res = self.ide_ele
        
        while L < R:
            if L & 1:
                res = self.segfunc(res, self.data[L - 1])
                L += 1
            if R & 1:
                R -= 1
                res = self.segfunc(res, self.data[R - 1])
            L >>= 1
            R >>= 1
        
        return res


def solve():
    N, x = map(int, rl().split())
    a = list(map(int, rl().split()))
    
    seg_tree = SegmentTree(a, min, 10 ** 15)
    ans = 10 ** 15
    for i in range(N):
        get_cost = 0
        for j in range(N):
            if i <= j:
                get_cost += seg_tree.query(j - i, j + 1)
            else:
                get_cost += min(seg_tree.query(0, j + 1), seg_tree.query(N - i + j, N))
        ans = min(ans, i * x + get_cost)
    print(ans)


if __name__ == '__main__':
    solve()


Measured memory_bytes: 54084
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, k, n) for(int i = (k); i < (int)(n); i++)
using namespace std;
int main(){
    long Q, H, S, D, N;
    long tmp = 0;
    cin >> Q >> H >> S >> D >> N;
     H = min(H, 2 * Q); //0.5 or 0.25 * 2
     S = min(S, H * 2); //1.0 or 0.5 * 2
    if(2 * S > D){
        long sw = N / 2;
        if(N % 2 != 0)
            tmp = N % 2;
        cout << sw * D + tmp * S << endl;
    }else{
        cout << (long)(S * N) << endl;
    }
    return 0;
}

Measured memory_bytes: 256
use std::io::*;
use std::str::FromStr;

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

fn main(){
    let n: u8 = read();
    if n == 0 {
        println!("1");
    } else {
        println!("0");
    }
}


Measured memory_bytes: 2080
s = input()

leng = len(s) + 1

lr = [0] * leng
rl = [0] * leng

for i in range(1, leng):
    if s[i - 1] == '<':
        lr[i] = lr[i - 1] + 1

for i in range(leng - 1, 0, -1):
    if s[i - 1] == '>':
        rl[i - 1] = rl[i] + 1

ans_list = [max(rl[i], lr[i]) for i in range(leng)]

print(sum(ans_list))


Measured memory_bytes: 31908
import math
from math import gcd
INF = float("inf")

import sys
input=sys.stdin.readline
sys.setrecursionlimit(500*500)
import itertools
from collections import Counter,deque

def main():
    s = input().rstrip()
    l = len(s)
    a = 0
    ans = 0

    t = 1
    for i in s:
        if t != int(i):
            a += 1
        t = 1-t
    ans = a
    t = 0
    a = 0
    for i in s:
        if t != int(i):
            a += 1
        t = 1-t
    ans = min(a,ans)
    print(ans)

if __name__=="__main__":
    main()


Measured memory_bytes: 74100
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;

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

template <class T> inline T chmax(T &a, const T b) {return a = (a < b) ? b : a;}
template <class T> inline T chmin(T &a, const T b) {return a = (a > b) ? b : a;}

constexpr int MOD = 1e9 + 7;
constexpr ll INF = 1e18;
constexpr double pi = acos(-1);
constexpr double EPS = 1e-10;

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

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

    int n; cin>>n;
    vector<int> a(n), b(n);
    for(int i=0; i<n; i++){
        cin>>a[i];
        b[i] = a[i];
    }
    sort(a.begin(), a.end(), greater<int>());

    for(int i=0; i<n; i++){
        if(b[i] == a[0]) cout << a[1] << endl;
        else cout << a[0] << endl;
    }
}

Measured memory_bytes: 3200
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,n) for(long long i=0;i<n;++i)
#define REPP(i,m,n) for(long long i=m;i<n;++i)
#define rep(i,n) for(long long i = n-1;i>=0;--i)
#define repp(i,n,m) for(long long i = n-1; i >= m; --i)
#define ALL(N) (N.begin(),N.end())
#define de cout << "line : " << __LINE__ << " debug" << endl;
#define pb push_back
#define pq priority_queue
#define Dcout(N) cout << setprecision(20) << N << endl
constexpr ll INF = 2147483647;
constexpr long long INFF = 9223372036854775807;

std::vector<bool> IsPrime(55555);

void sieve(size_t max){
    IsPrime[0] = false; // 0は素数ではない
    IsPrime[1] = false; // 1は素数ではない

    for(size_t i=0; i<=max; ++i){// 0からmaxまで全て調べる
        if(IsPrime[i]){// iが素数ならば
            for(size_t j=i+1; j<=max; ++j){//i+1からmaxまで全て調べる
                if(j%i==0){// iの倍数は
                    IsPrime[j] = false; // 素数ではない
                }
            }
        }
    }
}

signed main() {
    cin.tie(0);
	ios::sync_with_stdio(false);
    REP(i,55555) IsPrime[i] = 1;
    sieve(55555);
    vector<int> ans;
    int N;cin >> N;
    REP(i,55555){
        if(IsPrime[i] && i % 5 == 1){
            ans.pb(i);
        }
        if(ans.size() == N) break;
    }
    REP(i,ans.size()){
        cout << ans[i] << ' ';
    }
    cout << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#include<math.h>
#include<iostream>
#include<algorithm>
#define ll long long
using namespace std;
int a[200002];
int b[200002];
int main()
{
		int n;
		scanf("%d",&n);
		for(int i=0;i<n;i++)
		{
		scanf("%d",&a[i]);
			b[i]=a[i];
		}
		sort(b,b+n);
		int h=0;
		for(int i=0;i<n;i++)
		{
			if(a[i]==b[i])
			{
				h++;
				if(a[i+1]==b[i+1])
				i++;
			}
		}
		printf("%d\n",h);
		return 0;
 } 

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long x, a, ans = 0;
    cin >> x;
    a = x / 500;
    if (a > 0)
    {
        ans = ans + (a * 500 * 2);
        x = x - (a * 500);
    }
    // a = x / 100;
    // if (a > 0)
    // {
    //     ans = ans + (a * 100 * 2);
    //     x = x - (a * 100);
    // }
    // a = x / 50;
    // if (a > 0)
    // {
    //     ans = ans + (a * 50 * 2);
    //     x = x - (a * 50);
    // }
    // a = x / 10;
    // if (a > 0)
    // {
    //     ans = ans + (a * 10 * 2);
    //     x = x - (a * 10);
    // }
    a = x / 5;
    if (a > 0)
    {
        ans = ans + (a * 5);
        x = x - (a * 5);
    }
    // a = x / 1;
    // if (a > 0)
    // {
    //     ans = ans + (a * 1 * 2);
    //     x = x - (a * 1);
    // }
    cout << ans << endl;
    return 0;


}

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

int main() {
    ll n, x;
    cin >> n >> x;
    ll t;
    cin >> t;
    ll ans = 0;
    ans = abs(t-x);
    rep(i,n-1){
        cin >> t;
        ans = __gcd(ans, abs(t-x));
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3552
#include <bits/stdc++.h>
using namespace std ;
int main(){
    string N;
    cin >> N;
    int A=0;
    for(int i=0;i<N.size();i++){
        A+=(int)N[i]-48;
        A=A%9;
    }
    if(A==0)cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 3656
#include <stdio.h>

int handan(int a,int b,int c){
  int d=a;
  if(a==b) d=c;
  else if(c==a) d=b;
  return d;
}

int main(){
  int a,b,c;
  scanf("%d%d%d",&a,&b,&c);
  printf("%d\n",handan(a,b,c));
  return 0;
}


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

int main() {
   int n,m;
    cin>>n>>m;vector<string > v(n);
    for(int i=0;i<n;i++)
    {
      cin>>v[i];
    }bool r[n]={0};bool c[m]={0};
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<m;j++)
        {
            if(v[i][j]=='#')
            {
                r[i]=1;
                c[j]=1;
            }
        }
    }
    int cnt=0;
    for(int i=0;i<n;i++)
    {
        //cout<<r[i]<<" ";
        if(r[i]==0)
        {v.erase(v.begin()+i-cnt);cnt++;}
    }
     for(int i=0;i<v.size();i++)
    {
      //  cout<<v[i]<<endl;
    }
    for(int i=0;i<v.size();i++)
    {cnt=0;
        for(int j=0;j<m;j++)
        {
            if(c[j]==0)
            {
               // cout<<j<<" "<<v[i]<<" ";
                v[i]=v[i].substr(0,j-cnt).append(v[i].substr(j-cnt+1,v[i].size()-j+cnt-1));cnt++;
                //cout<<v[i];
            }
        }
        cout<<v[i]<<endl;
    }
    
    
    
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define maxn 200050
#define mod 1000000007
using namespace std;
int read()
{
    int x=0,f=1;
    char ch=getchar();
    while(ch-'0'<0||ch-'0'>9){if(ch=='-') f=-1;ch=getchar();}
    while(ch-'0'>=0&&ch-'0'<=9){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}
int quick_pow(int x,int p)
{
    int an=1,po=x;
    while(p)
    {
        if(p&1)  an=1ll*an*po%mod;
        po=1ll*po*po%mod;
        p>>=1;
    }
    return an;
}
int fac[maxn*2],inv[maxn*2];
int C(int x,int y)
{
    if(x<y)  return 0;
    return 1ll*fac[x]*inv[y]%mod*inv[x-y]%mod;
}
int main()
{
    fac[0]=1;
    for(int i=1;i<=400000;i++)  fac[i]=1ll*fac[i-1]*i%mod;
    inv[400000]=quick_pow(fac[400000],mod-2);
    for(int i=399999;i>=0;i--)  inv[i]=1ll*inv[i+1]*(i+1)%mod;
    int n=read(),k=read();
    int ans=0;
    for(int i=0;i<=min(n,k);i++) ans=(ans+1ll*C(n-1,i)*C(n,i)%mod)%mod;
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define LIMIT 1000000007 //10^9+7

namespace /* combination.cpp */{
  namespace /* modinv.cpp */{
    namespace /* extGCD.cpp */{
      //ax + by = gcd(a, b)を満たすx, yを参照渡しから入れる
      long long extGCD(long long a, long long b, long long &x, long long &y) {
          if (b == 0) {
              x = 1;
              y = 0;
              return a;
          }
          long long d = extGCD(b, a%b, y, x);
          y -= a/b * x;
          return d;
      }
    }

    /*
    mod pでの a の逆元 x
    ax = 1 mod p
    ax-1がpで割り切れるので
    ax + py = 1 の解 x をとる
    aとpは互いに素であること
    */
    long long modinv(long long a, long long p){
      long long x, y;
      extGCD(a, p, x, y);
      return (x>0? x: x+p);
    }
  }

  long long l_fac(long long n){
    if(n<0) return -1;
    long long ans = 1;
    for(long long i=1; i<=n; i++){
      ans *= i;
      ans %= LIMIT;
    }
    return ans;
  }

  long long l_nPr(long long n, long long r){
    long long ans = 1;
    for(long long i=0; i<r; i++){
      ans *= (n-i);
      ans %= LIMIT;
    }
    return ans;
  }

  long long l_nCr(long long n, long long r){
    if(r > n/2) r = n-r;
    return l_nPr(n, r) * modinv(l_fac(r), LIMIT) % LIMIT;
  }
}

long long modpow(long long a, long long n, long long p){
  if(n==1) return a % p;
  if(n%2 == 1) return (a * modpow(a, n-1, p)) % p;
  long long t = modpow(a, n/2, p);
  return t * t % p;
}

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

    ll ans = modpow(2, n, LIMIT) - 1;
    ans -= l_nCr(n, a);
    ans -= l_nCr(n, b);
    while(ans<0)ans+=LIMIT;

    cout<<ans<<endl;
}

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

#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define mp make_pair
#define pb push_back
#define each(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define dbg(x) cerr<<__LINE__<<": "<<#x<<" = "<<(x)<<endl

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;
const int inf = (int)1e9;
const double INF = 1e12, EPS = 1e-9;

int main(){
	int n; string s; cin >> n >> s;
	map<char, int> cnt;
	rep(i, n) cnt[s[i++]]++;
	
	vi v;
	int ans = 0;
	for(auto p : cnt) v.pb(p.second);
	sort(all(v));
	rep(i, v.size()){
		if(i) ans++;
		if(v[i] == 1) { ans++; continue; }
		if(i + 1 < v.size() && v[i] == v[i + 1]){
			
			int j = i + 1;
			for(; j < v.size() && v[i] == v[j]; j++);
			ans += min(1 + 2 * (j - i + 1), 4 * (j - i) - 1);
			i = j - 1;
		}
		else ans += 3;
	}
	cout << ans <<endl;
	return 0;
}

Measured memory_bytes: 3220
#include <bits/stdc++.h>
using namespace std;
typedef long double ld;
typedef long long ll;
typedef pair<double, double> pdd;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<int, int> pii;
typedef vector<pii> vii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
const int mod = 998244353;

int main() {
  std::ios::sync_with_stdio(false); std::cin.tie(0);
  int n;
  string s;
  cin >> n >> s;
  ll res = 1;
  vi v(1 << 3);
  vi ord = {6, 5, 3, 4, 2, 1, 0};
  v[0] = n;
  for (char x : s) {
    int t = 0;
    if (x == 'G') t = 1;
    if (x == 'B') t = 2;
    for (int mask : ord) if (!(mask & (1 << t)) && v[mask] > 0) {
//      cerr << t << ' ' << mask << ' ' << v[mask] << endl;
//      for (int y : v) cerr << y << ' '; cerr << endl;
      res = res * v[mask] % mod;
      --v[mask];
      ++v[mask | (1 << t)];
      break;
    }
  }
//  for (int x : v) cerr << x << endl;
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 720
N = int(raw_input())

for i in range(N):
    a = range(3)
    a[0],a[1],a[2] = map(int, raw_input().split())
    a.sort()
    if a[0]**2 + a[1]**2 == a[2]**2:
        print "YES"
    else:
        print "NO"

Measured memory_bytes: 4220
#include<bits/stdc++.h>
using namespace std;
//#include<ext/rope>
//using namespace __gnu_cxx
//#include<ext/pb_ds/priority_queue.hpp>
//using namespace __gnu_pbds;
#define lowbit(x) (x&-x)
#define pb push_back
#define empb emplace_back
#define all(x) (x).begin(),(x).end()
#define clr(a,b) memset(a,b,sizeof(a))
#define caze(T) for(cin>>T;T;T--)
#define inf (1<<29)
#define Endl ('\n')
#define fi first
#define se second
#define db double
#define ldb long double
#define ll long long
#define pii pair<int,int>
#define pil pair<int,ll>
#define pli pair<ll,int>
#define pll pair<ll,ll>
#define ull unsigned long long
#define IOS ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
inline char nc() {
	#define SZ 1000000
	static char buf[SZ], *p1, *p2;
	return p1==p2&&(p2=(p1=buf)+fread(buf,1,SZ,stdin),p1==p2)?EOF:*p1++;
}
template<typename T>
inline int scan(T &x) {
	char c, sign=1; 
	while(!isdigit(c=nc())&&c!=EOF)if(c=='-')sign*=-1;
	if(c==EOF) return EOF;
	for(x = 0; isdigit(c); c = nc())
		x = (x<<1) + (x<<3) + (c&15);
	return x *= sign, 1;
}
template<typename T, typename...Args>
inline int scan(T &x, Args&...args) {
	return scan(x), scan(args...);
}
int v[11];
int main()
{
	int a,b,c;cin>>a>>b>>c;
	v[a]++;v[b]++;v[c]++;
	if(v[5]==2&&v[7]==1)
		cout<<"YES"<<Endl;
	else cout<<"NO"<<Endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <numeric>
#include <string>
#include <cstdio>
#include <cstring>
#include <queue>
#include <stack>
#include <set>
#include <cmath>
#include <bitset>

typedef long long ll;
using namespace std;

#define FALSE printf("false\n");
#define TRUE printf("true\n");
#define all(x) (x).begin(),(x).end()
#define print(x) cout<<(x)<<endl
#define rep(i,n) for(int i = 0;i < ((int)(n));++i)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define SUM(vec) accumulate(all(vec),0LL)
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define test(a) cout<<"line:"<<__LINE__<<"["<<(#a)<<": "<<(a)<<"]"<<endl

const int INF = 1e9+7;
const ll INFL = 9*1e18;

ll inline digit(ll num){int tmp = 0;while(num){tmp++;num/=10;}return tmp;}
template<typename T>inline T digitSum(T num){T sum = 0;while(num){sum+=num%10;num/=10;}return sum;} // 各桁の和
template<typename T>inline T gcd(T a,T b){if(b == 0)return a;return gcd(b,a%b);}
template<typename T>inline T lcm(T a, T b){T g = gcd(a,b);return a/g*b;}
template<typename T>inline T power(T a,T b){T tmp=1;rep(i,b){tmp*=a;}return tmp;}


bool isOk(ll key,ll value){
  return key >= value;
}

ll binary_search(vector<ll> a,ll key){
  ll ok = a.size()-1;
  ll ng = 0;

  while(abs(ok - ng) > 1){
    ll mid = (ok + ng) / 2;
    if(isOk(key,a[mid]))ok = mid;
    else ng = mid;
  }
  return ok;
}

int main() {
  cin.tie(0); ios::sync_with_stdio(0);
  int n,k;cin>>n>>k;
  vector<int> a(n);rep(i,n)cin>>a[i];
  --n;--k;
  int ans = n / k + !!(n % k);
  print(ans);
  return 0;
}

Measured memory_bytes: 640
import numpy
n = int(input())
a = list(map(int, input().split()))


# iを探す
a_array = numpy.asarray(a)
n_i = a_array.argmax()

n_ret= a_array[n_i]

a_array2 = numpy.delete(a_array, n_i)



n_want_r = n_ret / 2

r_i = numpy.abs(a_array2 - n_want_r).argmin()

print("{} {}".format(n_ret, a_array2[r_i] ))



Measured memory_bytes: 31248
import java.util.Scanner;
 
public class Main{
  public static void main(String[] args){
    int i = 1;
    Scanner scan = new Scanner(System.in);
    while(true){
    int x = scan.nextInt();
    if( x == 0 )break;
    System.out.println("Case "+i+": "+x+"");
    i++;
        
   }
  }
}

Measured memory_bytes: 41444
#include <bits/stdc++.h>
#define pb push_back
#define sz(a) int(a.size())
#define re return
#define all(a) a.begin(),a.end()
#define int long long
using namespace std;
signed main()
{
	int a,b;
	cin>>a>>b;
	if (b==100)  b=101;
	cout<<b;
	for (int i=0;i<a;i++){
		cout<<"00";
	}
	re 0;
}

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

using namespace std;
#define PI 3.1415926535897932384626433832795
#define MOD (1000000007)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repc(i, s, n) for (int i = (s); i <= (n); i++)
#define rrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define rrepc(i, s, n) for (int i = (s); i >= (n); i--)
typedef long long ll;
typedef unsigned long long ull;

#define NMAX (55555 + 1)
bool prime[NMAX + 1];

int main()
{
	int N;
	vector<int> ans;

	cin >> N;

	repc(i, 2, NMAX) prime[i] = true;
	repc(i, 2, NMAX) {
		if (!prime[i]) continue;
		for (int n = i * 2; n <= NMAX; n += i) prime[n] = false;
	}

	repc(i, 2, 55555) {
		if (prime[i] && i % 10 == 1) {
			ans.push_back(i);
			if (ans.size() == N) break;
		}
	}

	rep(i, N - 1) cout << ans[i] << ' ';
	cout << ans[N - 1] << endl;

	return 0;
}


Measured memory_bytes: 256
# [a,b] - [a,b) = {b} なので、端の方は自由。
# 中央が単色であるかを確認すればよい。

import numpy as np
arr = np.array([int(x) for x in input()])
arr_c = arr.cumsum()

N = arr.size

answer = 0

for K in range(N,0,-1):
  left = N-K
  right = K-1
  # [left,right]が単色であればよい
  if left >= right:
    answer = K
    break
  one_cnt = arr_c[right] - arr_c[left] + arr[left]
  zero_cnt = (right - left + 1) - one_cnt
  if one_cnt == 0 or zero_cnt == 0:
    answer = K
    break
    
print(answer)

Measured memory_bytes: 20048
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; ++i)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = int64_t;
using P = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;



int main() {
    int h, n;
    cin >> h >> n;
    vi a(n);
    int sum = 0;
    rep(i, n){
        cin >> a[i];
        sum += a[i];
    }

    cout << (sum >= h ? "Yes":"No") << endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

using namespace std;
int main(){
    long long n,k,count=0;
    cin >> n >> k;
    while(n>0){
        n /= k;
        count++;
    }
    cout << count << endl;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
long long arr[100001][3] = {0};
int main()
{
    long long n;
    cin>>n;
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<3;j++)
        {
            int a;
            cin>>a;
            arr[i][j] = a;
        }
    }
    long long dp[100001][3];

    dp[0][0] = arr[0][0];
    dp[0][1] = arr[0][1];
    dp[0][2] = arr[0][2];

    for(int i=1;i<n;i++)
    {
        for(int j=0;j<3;j++)
        {
            if(j==0)
            {
                dp[i][j] = arr[i][j] + max(dp[i-1][1],dp[i-1][2]);
            }

            if(j==1)
            {
                dp[i][j] = arr[i][j] + max(dp[i-1][0],dp[i-1][2]);   
            }

            if(j==2)
            {
                dp[i][j] = arr[i][j] + max(dp[i-1][0],dp[i-1][1]);
            }
        }
    }   
    long long ans = max(dp[n-1][0],max(dp[n-1][1],dp[n-1][2]));
    cout<<ans<<endl;

    return 0;
}

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

#define rep(i, n) for (int i = 0; i < (n); i++)
#define contains(v, t) (find(v.begin(), v.end(), t) != v.end())
#define MOD 1000000007
typedef long long ll;
typedef unsigned long long ull;

int main() {
  int n;
  cin >> n;
  vector<ll> v(n+1);
  v[0] = 0;

  // 累積和
  rep(i, n) {
    ll t;
    cin >> t;
    v[i+1] = v[i] + t;
  }

  map<ll, ll> m;
  rep(i, n + 1) {
    m[v[i]]++;
  }

  ll ans = 0;
  for(auto it: m) {
    ans += it.second * (it.second - 1) / 2;
  }

  cout << ans;
}


Measured memory_bytes: 14336
from collections import deque
n=int(input())
to=[[] for _ in range(n)]
cost=[[] for _ in range(n)]
for _ in range(n-1):
    u,v,w=map(int,input().split())
    u-=1
    v-=1
    to[u].append(v)
    to[v].append(u)
    cost[u].append(w%2)
    cost[v].append(w%2)

color=[-1]*n
color[0]=0

q=deque()
q.append(0)
while q:
    v=q.popleft()

    for t,c in zip(to[v], cost[v]):
        if color[t]!=-1:
            continue
        color[t]=color[v]^c
        q.append(t)

print(*color, sep="\n")

Measured memory_bytes: 36756
/**
 * File    : A.cpp
 * Author  : Kazune Takahashi
 * Created : 11/19/2018, 9:06:46 AM
 * Powered by Visual Studio Code
 */

#include <iostream>
#include <iomanip>   // << fixed << setprecision(xxx)
#include <algorithm> // do { } while ( next_permutation(A, A+xxx) ) ;
#include <vector>
#include <string> // to_string(nnn) // substr(m, n) // stoi(nnn)
#include <complex>
#include <tuple>
#include <queue>
#include <stack>
#include <map> // if (M.find(key) != M.end()) { }
#include <set>
#include <functional>
#include <random> // auto rd = bind(uniform_int_distribution<int>(0, 9), mt19937(19920725));
#include <chrono> // std::chrono::system_clock::time_point start_time, end_time;
// start = std::chrono::system_clock::now();
// double elapsed = std::chrono::duration_cast<std::chrono::milliseconds>(end_time-start_time).count();
#include <cctype>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
using namespace std;

#define DEBUG 0 // change 0 -> 1 if we need debug.

typedef long long ll;

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

// const int C = 1e6+10;
// const ll M = 1000000007;

int main()
{
  int X, t;
  cin >> X >> t;
  cout << max(0, X - t) << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
struct Scanner {
  std::string pp(const char ch) {
    if (ch == EOF) {
      return "EOF";
    } else {
      return std::string(1, ch);
    }
  }
  void readSpace() {
    auto ch = getchar();
    if (ch != ' ') {
      throw std::runtime_error(std::string("want: Space, got: ") + pp(ch));
    }
  }
  void readNewline() {
    auto ch = getchar();
    if (ch != '\n') {
      throw std::runtime_error(std::string("want: Newline, got: ") + pp(ch));
    }
  }
  void readEof() {
    auto ch = getchar();
    if (ch != EOF) {
      throw std::runtime_error(std::string("want: EOF, got: ") + pp(ch));
    }
  }
  std::string readString() {
    std::string ret;
    char ch;
    while (ch = getchar(), ch != ' ' and ch != '\n' and ch != EOF) {
      ret += ch;
    }
    ungetc(ch, stdin);
    return ret;
  }
  template <typename T>
  T readInt(T lb, T ub) {
    char ch = getchar();
    if ((not isdigit(ch)) and (ch != '-')) {
      ungetc(ch, stdin);
      throw std::runtime_error(std::string("want: [0-9\\-]+, got: ") + pp(ch));
    }
    T ret = ch == '-' ? 0 : ch - '0';
    int sgn = ch == '-' ? -1 : +1;
    while (isdigit(ch = getchar())) {
      ret = ret * 10 + (ch - '0');
    }
    ungetc(ch, stdin);
    ret *= sgn;
    if (not(lb <= ret and ret <= ub)) {
      std::ostringstream os;
      os << ret << " is not in [" << lb << ", " << ub << "]";
      throw std::runtime_error(os.str());
    }
    return ret;
  }
};

using namespace std;
int main() {
  Scanner sc;
  auto a = sc.readInt<int>(1, 20);
  sc.readSpace();
  auto b = sc.readInt<int>(1, a);
  sc.readSpace();
  auto c = sc.readInt<int>(1, 20);
  sc.readNewline();
  sc.readEof();
  cout << max(0, c - (a - b)) << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define reg register
typedef long long ll;
using namespace std;
const int MN=2e5+5;
int n,k,a[MN];
int main(){
	scanf("%d%d",&n,&k);
	for(reg int i=1;i<=n;i++)scanf("%d",a+i);
	reg double Ans=0,Res=0;
	for(reg int i=1;i<=k;i++)
		Res+=((double)a[i]*(a[i]+1)/2)/a[i];
	Ans=Res;
	for(reg int i=k+1;i<=n;i++){
		Res+=((double)a[i]*(a[i]+1)/2)/a[i];
		Res-=((double)a[i-k]*(a[i-k]+1)/2)/a[i-k];
		Ans=max(Ans,Res);
	}
	printf("%lf\n",Ans);
	return 0;
}

Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();

        int[] a = new int[n];

        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
        }

        for (int i = n - 1; i > 0; i--) {
            System.out.print(a[i] + " ");
        }

        System.out.println(a[0]);
    }
}


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

using namespace std;
typedef long long int LL;
typedef long long int ll;
typedef pair<long long int, long long int> pii;
typedef pair<double, double> pdd;

#define SORT(c) sort((c).begin(),(c).end())
#define BACKSORT(c) sort((c).begin(),(c).end(),std::greater<LL>())
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SP << " " <<

LL mod = 1000000007;

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  LL N,M;
  cin >> N >> M;
  vector<LL> A(N);
  LL Asum = 0;
  REP(i, N)
  {
    cin >> A[i];
    Asum += A[i];
  }

  LL cnt = 0;

  REP(i,N){
    if(Asum<=A[i]*4*M){
      cnt++;
    }
  }
  
  if(cnt>=M){
    cout << "Yes" << endl;
  }
  else
  {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
#include "iostream"
#include <stdio.h>
#include <algorithm>
#include <stdlib.h>
#include <string>
#include <cctype>
#include <stack>
#include <vector>
#include <list>
#include <queue>
using namespace std;
using ll=long long;
#define mod  1000000007

int main(int argc, char const *argv[]) {
  int a,b;
  std::cin >> a >> b;
  std::cout << 2*b-a << '\n';
  return 0;
}


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

typedef long long ll;
int mod = 1e9 + 7;

int main() {
	string s;
	cin >> s;
	int n = (int)s.size();
	for (int i = n - 1; i >= 0; --i) {
		if ((i + 1) % 2 == 0) {
			bool d = 1;
			string p = "";
			for (int j = 0; j < i / 2; ++j) {
				if (s[j] != s[(i / 2) + j]) {
					d = 0;
					break;
				}
				p += s[j];
			}
			if (d) {
				//cout << p << " ";
				cout << i - 1;
				return 0;
			}
		}
	}
	cout << 0;
}



















Measured memory_bytes: 256
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int A = sc.nextInt();
		int B = sc.nextInt();
		long[] v = new long[N];
		for(int i=0; i<N; i++)
			v[i] = sc.nextLong();
		
		Arrays.sort(v);
//		, new Comparator<Long>(){
//			public int compare(Long l1, Long l2) {
//				return -Long.compare(l1, l2);
//			}
//		});
		long[][] dp = new long[51][51];
	    dp[0][0] = 1;
	    dp[1][0] = 1;
	    dp[1][1] = 1;
		for(int i=2; i<51; i++) {
			dp[i][0] = 1;
			dp[i][i] = 1;
			for(int j=1; j<i; j++) {
				dp[i][j] = dp[i-1][j] + dp[i-1][j-1];
			}
		}
		double maxAve = 0;
		long sum = 0;
		for(int i=1; i<=A; i++)
			sum += v[N-i];
		maxAve = (double)sum/(double)A;
		
		long ans = 0;
		if(A==N) {
			ans = 1;
		} else {
			if(v[N - A] > v[N - A - 1]) {
				ans = 1;
			} else {
				int K = 0;
				for(int i=0; i<N; i++)
					if(v[i]==v[N-A])
						K++;
				int s = 0;
				for(int i=N-A; i<N; i++)
					if(v[i]==v[N-A])
						s++;


				if(v[N-1] > v[N-A])
					ans = dp[K][s];
				else
					for(int i=A; i<=B; i++)
						ans += dp[K][i];
			}
		}		
		System.out.println(maxAve);
		System.out.println(ans);
		
		sc.close();
	}
}

Measured memory_bytes: 23636
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val s = StringBuilder(sc.next())

    var ret = 0
    while (true) {
        var changed = false

        var i = 0
        while (i + 1 < s.length) {
            if ((s[i] == '0' && s[i + 1] == '1') || (s[i] == '1' && s[i + 1] == '0')) {
                s.deleteCharAt(i + 1)
                s.deleteCharAt(i)

                ret += 2
                i = Math.max(i-1,0)
                changed = true
            } else {
                i++
            }
        }

        if (!changed) break
    }

    println(ret)
}

Measured memory_bytes: 32144
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<string>
#include<stack>
#include<cstdio>
#include<cmath>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<int,P> P1;

#define fr first
#define sc second
#define mp make_pair
#define pb push_back
#define rep(i,x) for(int i=0;i<x;i++)
#define rep1(i,x) for(int i=1;i<=x;i++)
#define rrep(i,x) for(int i=x-1;i>=0;i--)
#define rrep1(i,x) for(int i=x;i>0;i--)
#define sor(v) sort(v.begin(),v.end())
#define rev(s) reverse(s.begin(),s.end())
#define lb(vec,a) lower_bound(vec.begin(),vec.end(),a)
#define ub(vec,a) upper_bound(vec.begin(),vec.end(),a)
#define uniq(vec) vec.erase(unique(vec.begin(),vec.end()),vec.end())
#define mp1(a,b,c) P1(a,P(b,c))

const int INF=1000000000;
const int dir_4[4][2]={{1,0},{0,1},{-1,0},{0,-1}};
const int dir_8[8][2]={{1,0},{1,1},{0,1},{-1,1},{-1,0},{-1,-1},{0,-1},{1,-1}};

int main(){
	int n,a,d;
	map<int,int> M;
	scanf("%d%d%d",&n,&a,&d);
	int m;
	scanf("%d",&m);
	rep(i,m){
		int x,y,z;
		scanf("%d%d%d",&x,&y,&z);
		if(x == 0){
			int Y = (M.find(y) == M.end())?(a+(y-1)*d):M[y];
			int Z = (M.find(z) == M.end())?(a+(z-1)*d):M[z];
			M[y] = Z; M[z] = Y;
		}
		else {
			int Z = (M.find(z) == M.end())?(a+(z-1)*d):M[z];
			M[y] = Z;
		}
	}
	int k;
	scanf("%d",&k);
	cout << ((M.find(k) == M.end())?(a+(k-1)*d):M[k]) << endl;
}

Measured memory_bytes: 1208
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();
        int C = sc.nextInt();
        int X = sc.nextInt();

        int res = 0;
        for (int a=0; a<=A; a++) {
            for (int b=0; b<=B; b++) {
                int c = (X - a * 500 - b * 100) / 50;
                if (c >= 0 && c <= C)
                    res++;
            }
        }

        System.out.println(res);
    }
}

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

int main(){
  string s, t, u;
  int a, b;
  cin >> s >> t;
  cin >> a >> b;
  cin >> u;
  
  if (s == u) cout << a-1 << " " << b << endl;
  else cout << a << " " << b-1 << endl;
}

Measured memory_bytes: 256
def main():
    st = list(map(str, input().split()))
    num = list(map(int,input().split()))
    u = str(input())
    if st[0]==u:
        num[0]-=1
    else:
        num[1]-=1
    print(num[0],num[1])

if __name__ == '__main__':
    main()

Measured memory_bytes: 3060
#include <iostream>
using namespace std;
int main()
{
	double a,b;
	cin >> a >> b;
	if(a>b){
		cout << "GREATER" << endl;
	}
	else if(a<b){
		cout << "LESS" << endl;
	}
	else{
		cout << "EQUAL" << endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <bitset>
#include <deque>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <iterator>
#include <string>
#include <chrono>
#include <random>
#include <tuple>
#include <utility>

const int INF = 1000000009;
const long LINF = 1123456789012345678;

std::set<long> st;
std::deque<long> deq;

long n, m;
std::vector<long> path[100005];

void push(bool front, long a){
	st.insert(a);
	if(front){
		deq.push_front(a);
	}else{
		deq.push_back(a);
	}
	return;
}

void check(bool front, long a){
	for(int i = 0; i < path[a].size(); i++){
		long nx = path[a][i];
		if(st.count(nx) == 0){
			push(front, nx);
			check(front, nx);
			return;
		}
	}
	return;
}

int main(){
	scanf("%ld %ld", &n, &m);
	for(int i = 0; i < m; i++){
		long a, b;
		scanf("%ld %ld", &a, &b);
		path[a].push_back(b);
		path[b].push_back(a);
	}
	push(true, 1);
	push(false, path[1][0]);
	check(true, 1);
	check(false, path[1][0]);
	printf("%ld\n", deq.size());
	for(auto it = deq.begin(); it != deq.end(); it++){
		printf("%ld ", *it);
	}
	printf("\n");
	return 0;
}


Measured memory_bytes: 11776
// scanf 等でエラーを出さないように追加
#define _CRT_SECURE_NO_WARNINGS 1

#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <math.h>
#include <limits.h>
#include <iostream>
#include <string>
#include <vector>
#include <memory>
#include <algorithm>
#include <numeric>
#include <set>
#include <functional>


using namespace std;


typedef long long ll;


int main() {

	char s[16];
	scanf("%s", &s);

	for (int i = 0; i < 12; i++) {
		printf("%c", s[i]);
		if (i == 3) {
			printf(" ");
		}
	}
	printf("\n");

	return 0;
}

Measured memory_bytes: 256
// #include <bits/stdc++.h>
#include <algorithm>
#include <cmath>
#include <deque>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;
typedef long long ll;

#define all(x) begin(x), end(x)
#define rep(i,n) for(int i=0; i<n; i++)

struct UnionFind {
    vector<int> par, rank, _size;
    
    UnionFind(int n) : par(n), rank(n, 1), _size(n, 1) {
        for (int i=0; i<n; i++) par[i] = i;
    }
    
    int find(int x) {
        if (par[x]==x) return x;
        else return par[x] = find(par[x]);
    }

    bool same(int x, int y) {
        x = find(x); y = find(y);
        return x == y;
    }

    void unite(int x, int y) {
        x = find(x); y = find(y);
        if(x == y) return;

        _size[x] = _size[y] = _size[x] + _size[y];
        if(rank[x] == rank[y]) rank[y]++;

        if(rank[x] > rank[y]) par[y] = x;
        else par[x] = y;
    }

    int size(int x) {
        return _size[find(x)];
    }
};


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

    int a[m], b[m];
    rep(i, m) {
        cin >> a[i] >> b[i];
        a[i]--;
        b[i]--;
    }

    ll ans[m];
    UnionFind island(n);
    ans[m-1] = n*(n-1)/2;

    for (int i=m-1; i>=0; i--) {
        ll size_a = island.size(a[i]);
        ll size_b = island.size(b[i]);
        if (island.same(a[i], b[i])) ans[i-1] = ans[i];
        else ans[i-1] = ans[i] - size_a*size_b;
        island.unite(a[i], b[i]);
    }

    rep(i, m) cout << ans[i] << endl;

    return 0;
}

Measured memory_bytes: 4096
//09, 02, 2019, 10:01:29 Rafaelcs cpp
#include <bits/stdc++.h>

using namespace std;
typedef pair<int, int> pii;
typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    
    int n, k;

    cin >> n >> k;

    if((n + 1) / 2 >= k){
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=1e5+7;
char s[maxn];
ll n,m;
int a[maxn];
ll ans,sum;
struct Node
{
    ll a,b;
}e[maxn];
bool cmp(Node x,Node y)
{
    return x.a<y.a;
}
int main()
{
   scanf("%lld%lld",&n,&m);
   for(int i=1;i<=n;i++)
     scanf("%lld%lld",&e[i].a,&e[i].b);

   sort(e+1,e+1+n,cmp);
   for(int i=1;i<=n;i++)
   {
       if(sum+e[i].b>=m)
       {
           ans+=e[i].a*(m-sum);
           break;
       }
       else
       {
           sum+=e[i].b;
           ans+=e[i].a*e[i].b;
       }
   }
   printf("%lld\n",ans);
}


Measured memory_bytes: 1792
package main

import "fmt"

func isSqrt(n int) (res bool) {
	res = false
	for i := 0; i*i <= n; i++ {
		if i*i == n {
			res = true
		} else {
			continue
		}
	}
	return
}
func myPow(a, n int) (b int) {
	b = 1
	for n > 0 {
		b *= a
		n--
	}
	return
}
func combine(a, b int) (c int) {
	var t int
	for i := 0; ; i++ {
		if myPow(10, i) > b {
			t = i
			break
		}
	}
	c = a*myPow(10, t) + b
	return
}

func main() {
	var a, b int
	fmt.Scan(&a, &b)
	if isSqrt(combine(a, b)) {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


Measured memory_bytes: 512
#include <iostream>
#include <stdio.h>
#include <string.h>
#define MAX_N 105

using namespace std;

int n,ans=0;
int a[MAX_N];
int b[MAX_N];

int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++) scanf("%d",&a[i]),a[i]+=a[i-1];
	for(int i=1;i<=n;i++) scanf("%d",&b[i]),b[i]+=b[i-1];
	for(int i=1;i<=n;i++) ans=max(ans,a[i]+b[n]-b[i-1]);
	printf("%d\n",ans);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main()
{
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i, n)
  {
    cin >> a[i];
  }
  sort(a.begin(), a.end());
  cout << a[n - 1] - a[0] << endl;
  return 0;
}

Measured memory_bytes: 3580
#include<bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
#define pri(str) cout << str << endl
using ll = long long;
using P = pair<int, int>;

const ll MX = 1e18;
const long double PI = acos(-1);

int main()
{
    ll a,b,v,w,t;
    cin >> a >> v >> b >> w >> t;

    if(a < b)
        if((b-a) <= t*(v-w))
            pri("YES");
        else
            pri("NO");
    else
        if((a-b) <= t*(v-w))
            pri("YES");
        else
            pri("NO");
    return 0;
}


Measured memory_bytes: 3644
# abc064_c.py
def _min(rates):
    return max(len(rates)-rates.count(0),1)

def _max(rates,free):
    return min(len(rates)-rates.count(0)+free,n)

n = int(input())
a = list(map(int,input().split()))
rates = [0]*8
free = 0
for i in a:
    if i<400: #gray
        rates[0] += 1
    elif i<800: #cha
        rates[1] += 1
    elif i<1200: #green
        rates[2] += 1
    elif i<1600: #water
        rates[3] += 1
    elif i<2000: #blue
        rates[4] += 1
    elif i<2400: #yellow
        rates[5] += 1
    elif i<2800: #daidai
        rates[6] += 1
    elif i<3200: #red
        rates[7] += 1
    else:
        free += 1
print(_min(rates),_max(rates,free))


Measured memory_bytes: 3064
#include <queue>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
#ifdef _WIN32
#define __builtin_popcount __popcnt
#endif
// Time Complexity: O(3^P + 2^P * H * M log N)
int N, M, H, K, S, T, P, a, b, c, h, r;
int main() {
	while (cin >> N >> M >> H >> K, N) {
		vector<vector<vector<int> > > G(N);
		for (int i = 0; i < M; i++) {
			cin >> a >> b >> c >> h >> r; a--, b--, r--;
			G[a].push_back({ b, c, h, r });
			G[b].push_back({ a, c, h, r });
		}
		vector<int> cost(1 << K, 999999999); cost[0] = 0;
		cin >> S >> T >> P; S--, T--;
		for (int i = 0; i < P; i++) {
			cin >> a >> b;
			int bit = 0;
			for (int j = 0; j < a; j++) cin >> c, c--, bit += 1 << c;
			cost[bit] = b;
		}
		vector<pair<int, int> > v;
		for (int i = 0; i < 1 << K; i++) v.push_back(make_pair(__builtin_popcount(i), i));
		sort(v.begin(), v.end());
		for (int i = 0; i < v.size(); i++) {
			for (int j = 0; j < i; j++) {
				cost[i | j] = min(cost[i | j], cost[i] + cost[j]);
			}
		}
		int ret = 999999999;
		for (int i = 0; i < 1 << K; i++) {
			vector<vector<int> > dist(N, vector<int>(H + 1, 999999999)); dist[S][0] = 0;
			priority_queue<vector<int> > que; que.push({ 0, S, 0 });
			while (!que.empty()) {
				vector<int> u = que.top(); que.pop();
				for (int j = 0; j < G[u[1]].size(); j++) {
					int f = G[u[1]][j][0], d = u[2] + G[u[1]][j][2], c = dist[u[1]][u[2]];
					if (!(i & (1 << G[u[1]][j][3]))) c += G[u[1]][j][1];
					if (d <= H && dist[f][d] > c) {
						dist[f][d] = c;
						que.push({ -dist[f][d], f, d });
					}
				}
			}
			int res = 999999999;
			for (int j = 0; j <= H; j++) res = min(res, dist[T][j]);
			ret = min(ret, res + cost[i]);
		}
		cout << (ret != 999999999 ? ret : -1) << endl;
	}
	return 0;
}

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

int main() {
  string s;
  cin >> s;
  
  int n;
  bool bo = false;
  
  if (s.at(0) != 'A') {
    bo = true;
  }
  else {
    int count = 0;
    for (int i = 2; i < s.size() - 1; i++) {
      if (s.at(i) == 'C') {
        count++;
      }
    }
    if (count != 1) {
      bo = true;
    }
    else {
      count = 0;
      for (int i = 0; i < s.size(); i++) {
        if ('A' <= s.at(i) && s.at(i) <= 'Z') {
          count++;
        }
      }
      if (count != 2) {
        bo = true;
      }
    }
  }
  if (bo) {
    cout << "WA" << endl;
  }
  else {
    cout << "AC" << endl;
  }
}

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

int main(){
    string o, e;
    cin >> o >> e;
    for(int i = 0; i < o.size(); i++){
        cout << o[i];
        if(i < e.size()) cout << e[i];
    }
    cout << endl;
    return 0; 
}

Measured memory_bytes: 256
package main

import (
	"fmt"
	"strconv"
)

// 2018-07-30T21:19:57+0800
// 2018-07-30T21:25:19+0800
func main() {
	var N int
	fmt.Scanf("%d", &N)
	sN := strconv.Itoa(N)
	n := 0
	for i := 0; i < len(sN); i++ {
		n += int(sN[i] - 48)
	}
	if N%n == 0 {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG //GCC5.4.1で配列の範囲外アクセスをエラーにする

//cmdで g++ test.cpp とするとコンパイルできる
//制限1秒なら10^6は余裕 10^7は多分間に合う 10^8はよほど単純でないと厳しい

#define ALL(x) x.begin(),x.end()
#define get_tp(t,i) get<i>(t)
#define len(x) (ll)(x.size())
#define ub(a,x) (upper_bound(ALL(a),x)-a.begin())
#define lb(a,x) (lower_bound(ALL(a),x)-a.begin())
typedef long long ll; //long long
typedef pair<int,int> pii; //pair<int,int>
typedef pair<long long,long long> pllll; //pair<ll,ll>
typedef vector<int> vi; //vector<int>
typedef vector<vector<int>> vvi; //vector<vector<int>>
typedef vector<ll> vll; //vector<long long>
typedef vector<vector<ll>> vvll; //vector<vector<long long>>
typedef priority_queue<int, vector<int>, greater<int> > gpq; //逆順priority_queue
typedef priority_queue<int> pq;

//const int MOD=998244353;
const int MOD=1000000007; //10^9+7
const long double PI=3.1415926535897932;

int main(){
    int N;
    cin>>N;
    int a=0,w=0,t=0,r=0;
    for(int i=0;i<N;i++){
        string S;
        cin>>S;
        if(S=="AC"){
            a++;
        }else if(S=="WA"){
            w++;
        }else if(S=="TLE"){
            t++;
        }else if(S=="RE"){
            r++;
        }
    }
    cout<<"AC x "<<a<<endl;
    cout<<"WA x "<<w<<endl;
    cout<<"TLE x "<<t<<endl;
    cout<<"RE x "<<r<<endl;
}


Measured memory_bytes: 3632
class UnionFind:
    N = 0
    cost = 0
    par = []
    group = 0
    
    def init(N):
        UnionFind.N = N
        UnionFind.group = N
        UnionFind.par = [i for i in range(N)]

    def find(v):
        c = 0
        u = v
        while v != UnionFind.par[v]:
            v = UnionFind.par[v]
            c += 1

        if c > 10:
            while u != v: u, UnionFind.par[u] = UnionFind.par[u], v

        return v

    def union(v, u, c=0):
        vr = UnionFind.find(v)
        ur = UnionFind.find(u)

        if vr == ur: return True

        UnionFind.par[ur] = vr
        UnionFind.cost += c
        UnionFind.group -= 1
        
        return False
            
    def get_cost():
        return UnionFind.cost

    def get_group():
        return UnionFind.group

    def same(v, u):
        return UnionFind.find(v) == UnionFind.find(u)

N, M = list(map(int, input().split()))
UnionFind.init(N)

for i in range(M):
    x, y, _ = list(map(int, input().split()))
    x -= 1; y -= 1

    UnionFind.union(x, y)

print(UnionFind.get_group())

Measured memory_bytes: 7092
#include <iostream>
#include <stdio.h>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
#include <set>
#include <map>
#include <deque>
#include <math.h>
#include <string>
#include <iomanip>
#include <locale>
#include <list>
#include <bitset>
#include <tuple>
using namespace std;
#define FORN(i,m,n) for(int i=(m); i<int(n); i++)
#define PRINTVEC(v) FORN(i,0,v.size()) cout<<v[i]<<" "; cout<<endl
#define PRINTMAT(m) FORN(j,0,m.size()) {PRINTVEC(m[j]);}
typedef long long ll;

const int ms = 2e5 + 5;
ll freq[ms], v[ms];

int main(){
  ios_base::sync_with_stdio(false); cin.tie(NULL);
  int n; cin>>n;
  FORN(i,0,ms) freq[i] = 0;
  FORN(i,0,n){
    cin>>v[i];
    freq[v[i]]++;
  }
  ll tot = 0;
  for(ll cur : freq) tot += ((cur * (cur - 1)) >> 1);
  FORN(i,0,n){
    ll x = (freq[v[i]] * (freq[v[i]] - 1)) >> 1;
    ll cur = ((freq[v[i]] - 1) * (freq[v[i]] - 2)) >> 1;
    cout<<tot-x+cur<<endl;
  }
}

Measured memory_bytes: 5760