akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int (i)=0;i<(n);i++)
#define REP(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define INF LLONG_MAX - 100
#define MOD 1000000007
#define fcout cout << fixed << setprecision(15)
#define int long long
#define yorn(f) puts((f)?"Yes":"No")
#define YORN(f) puts((f)?"YES":"NO")
#define lower_bound lowb
#define upper_bound upb
typedef long long ll;
typedef pair<int, int> P;
typedef priority_queue<int> pque;
int gcd(int a,int b){return b?gcd(b,a%b):a;};
int lcm(int a,int b){return a*b/gcd(a,b);};
int mod(int a,int b){return (a+b-1)/b;};
int month[12] = {31,28,31,30,31,30,31,31,30,31,30,31};
template<typename A, size_t N, typename T>
void Fill(A(&array)[N],const T &val){std::fill((T*)array,(T*)(array+N),val);}
template<class T>inline bool chmax(T& a,T b){if(a<b){a=b;return true;}return false;};
template<class T>inline bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;};



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

    int a, b;
    cin >> a >> b;
    cout << 6 - a - b << endl;
    return 0;
}

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

int main(void){
  int n,k;
  cin>>n>>k;
  W.resize(n);
  int tmp;
  for(int i=0;i<n;i++){
    cin>>tmp;
    W[i]=tmp;
  }
  long long cur_weight;
  int trucks;
  long long begin=1;
  long long end=(long long)pow(10,9);
  bool flag=true;
  while (begin<end){
    long long mid=(begin+end)/2;
    cur_weight=0;
    trucks=1;
    flag=true;
    for(int i=0;i<n;i++){
      if (cur_weight+W[i]<=mid){
	cur_weight+=W[i];
      }else {
	if (W[i]>mid){
	  flag=false;
	  break;
	}else{
	  cur_weight=W[i];
	  trucks++;
	  if (trucks >k){
	    flag=false;
	    break;
	  }
	}
      }
    }
    if (flag){
	end=mid;
    }else{
	begin=mid+1;
    }
  }
  cout<<end<<endl;
  return 0;
}
  
    

  



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

int n,k;
long long nimotu[100000];

int check(int p){
    int i = 0;
    for(int j = 0;j < k;j++){
        long long tumu = 0;
        while(tumu+nimotu[i] <= p){
            tumu +=nimotu[i];
            i++;
            if(i == n)return n;
        }
    }
    return i;
}

int main(){
    cin >> n >> k;
    for(int i = 0;i < n;i++){
        cin >> nimotu[i];
    }
    long long left = 0,right = 100000 * 10000,mid;
    while(left < right){
        mid = (left + right) / 2;
        int kazu = check(mid);
        if(kazu >= n)right = mid;
        else left = mid + 1;
    }
    
    cout << right << endl;
}


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

int N;
int A[210];

int main(){
  cin >> N;
  for (int i=0; i<N; ++i) cin >> A[i];

  int res = 0;

  while (true){
    bool exist_odd = false;
    for (int i=0; i<N; ++i){
      if (A[i] % 2 != 0) exist_odd = true;
    }

    if (exist_odd) break;

    for (int i=0; i<N; ++i){
      A[i] /= 2;
    }
    ++res;
  }

  cout << res << endl;
}


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

int main(void){
    int N;
    cin >> N;
    vector<int> L(N);
    for(int i{0}; i<N; ++i){
        cin >> L[i];
    }
    std::sort(L.begin(),L.end());
    int a, b, c;

    int count{0};

    for(int i{0}; i<N-2; i++){
        a = L[i];
        for(int j{i+1}; j<N-1; j++){
            b = L[j];
            for(int k{j+1}; k<N; k++){
                c = L[k];

                if(c>=a+b){
                    break;
                }

                if(a<b+c and b<c+a){
                    ++count;
                }
            }
        }
    }
    cout << count << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <cstdlib>
#include <cstdio>
#include <string>
#include <cstring>
#include <cassert>
#include <utility>
#include <iomanip>

using namespace std;

#define sz(x) (int) x.size()
#define unique(x) x.erase(unique(x.begin(), x.end()), x.end())
#define all(a) a.begin(), a.end()
#define sqr(x) ((x) * (x)) 
#define y1 aksjdaskdjksjfksdjf
#define left kdnvldvoiwejifejg
#define right lkdsjflksdjfdjfk
#define prev asdasfsadjkjsdfjs

const int MAXN = 55;
const int mod = (int) 1e9 + 7;

class Matrix {
public:
  int a[MAXN][MAXN];
  int n, m;

  Matrix() {}

  Matrix(int n, int m, int a[MAXN][MAXN]) {
    init(n, m, a);
  }

  void init(int n, int m, int a[MAXN][MAXN]) {
    this->n = n; this->m = m;
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        this->a[i][j] = a[i][j];
      }
    }
  }

  static Matrix identity(int n) {
    int res[MAXN][MAXN];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < n; j++) {
        if (i == j) {
          res[i][j] = 1;
        } else {
          res[i][j] = 0;
        }
      }
    }
    return Matrix(n, n, res);
  }

  static Matrix mul(Matrix a, Matrix b) {
    assert(a.m == b.n);
    int res[MAXN][MAXN];
    for (int i = 0; i < a.n; i++) {
      for (int j = 0; j < b.m; j++) {
        res[i][j] = 0;
        for (int k = 0; k < a.m; k++) {
          res[i][j] = (res[i][j] + 1ll * a.a[i][k] * b.a[k][j] % mod) % mod;
        }
      }
    }
    return Matrix(a.n, b.m, res);
  }
};

Matrix binPow(Matrix m, long long p) {
  Matrix result = Matrix::identity(m.n);
  while (p) {
    if (p & 1) {
      result = Matrix::mul(result, m);
      p--;
    } else {
      m = Matrix::mul(m, m);
      p /= 2;
    }
  }
  return result;
}

int n;
long long len;
int a[MAXN][MAXN];
int col[MAXN][MAXN];
Matrix mat;

int main() { 

  scanf("%d %lld", &n, &len);
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      scanf("%d", &a[j][i]);
    }
  }

  mat = Matrix(n, n, a);
  mat = binPow(mat, len);

  for (int i = 0; i < n; i++) {
    col[i][0] = 1;
  }
  Matrix colMat = Matrix(n, 1, col);
  colMat = Matrix::mul(mat, colMat);

  int res = 0;
  for (int i = 0; i < n; i++) {
    res = (res + colMat.a[i][0]) % mod;
  }

  cout << res << endl;

  return 0;
}


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

int main()
{
    int N, X, T, result=0;
    cin >> N >> X >> T;
    if (N % X == 0) result = N / X * T;
    else result =  (N / X + 1) * T;

    cout << result << endl;
    return 0;
}


Measured memory_bytes: 3616
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <cstring>

using namespace std;

const int N=200005;
const int P=998244353;

int n;
int a[N];
int b[N];
bool oscar=false;
long long ans=0;

void init(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%d%d",&a[i],&b[i]);
		if(a[i]!=b[i]) oscar=true;
		ans+=a[i];
	}
	if(oscar==false){
		printf("0\n");
		return ;
	}
	int res=0x3f3f3f3f;
	for(int i=1;i<=n;i++){
		if(b[i]<a[i]) res=min(res,b[i]);
	}
	printf("%lld\n",ans-res);
}

int main(){
	init();
	return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <iomanip>
#include <vector>
#include <cmath>
#include <algorithm>
#include <string>
#define shosu(x) fixed<<setprecision(x)
using namespace std;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,P> pip;
const int inf=(1<<31)-1;

double x,y,h,S;

int main(){
	cout<<shosu(7);
	while(1){
		cin>>x>>h;
		if(!x&&!h) break;
		S=x*x;
		x/=2;
		y=sqrt(x*x+h*h);
		cout<<4*(x*x+x*y)<<endl;
	}
}

Measured memory_bytes: 1276
#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()
{
    char s;
    cin >> s;
    cout << (isupper(s) ? "A" : "a") << endl;
}


Measured memory_bytes: 3644
<?php  
  fscanf(STDIN,"%d",$n);
  $max1 = 0;
  $max2 = 0;
  $count = 0;
  for($i=1;$i<=$n;$i++){
    fscanf(STDIN,"%d",$a[$i]);
    if($a[$i]==$max1){
      $count++;
    }elseif($a[$i]>$max1){
      $max2 = $max1;
      $max1 = $a[$i];
      $count = 1;
    }elseif($a[$i]>$max2){
      $max2 = $a[$i];
    }
  }
  for($i=1;$i<=$n;$i++){
    if($a[$i]==$max1){
      if($count==1){
        echo($max2."\n");
      }else{
        echo($max1."\n");
      }
    }else{
      echo($max1."\n");
    }
  }

Measured memory_bytes: 33908
#include <stdio.h>
#include <string.h>
int main()
{
   char s[101], t[101];
   int slen, i ,j, flag = 0;
   scanf("%s %s", s, t);
   slen = strlen(s);

   char stmp;
   for(i=0;i<slen;i++){
      stmp = s[slen-1];
      for(j=slen-1;j>0;j--) s[j] = s[j-1];
      s[0] = stmp;
      if(strcmp(s,t)==0){
         flag = 1;
         break;
      }
   }
   if(flag)printf("Yes\n");
   else printf("No\n");
   return 0;
}

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

int tmpMaxnumber;

long int maxDiff(long int rate[200000], long int n, long int smallPoint, long int smallNumber) {
	int max;
	if (tmpMaxnumber < smallPoint+1) {
		tmpMaxnumber = smallPoint+1;
	} else {
		max = rate[tmpMaxnumber] - smallNumber;
		return max;
	}
	if (smallPoint+1 < n) {
		max = rate[smallPoint+1] - smallNumber;
	}
	for (int i=smallPoint+2; i<n; i++) {
		if ((rate[i] - smallNumber) > max) {
			max = rate[i] - smallNumber;
			tmpMaxnumber = i;
		}
	}
	return max;
}

int main(int argc, char const* argv[])
{
	long int n, max, rate[200000];
	cin >> n;
	for (int i=0; i<n; i++) {
		cin >> rate[i];
	}
	max = maxDiff(rate, n, 0, rate[0]);
	for (int i=1; i<n; i++) {
		if (max < maxDiff(rate, n, i, rate[i])) {
			max = maxDiff(rate, n, i, rate[i]);
		}
	}
	cout << max << endl;
	return 0;
}


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

int main()
{
    int n, maxInd = 0, max = 0, res = 0;
    cin >> n;
    vector<int> v(n);

    for(int i = 0; i < n; ++i)
    {
        cin >> v[i];
        if(v[i] > max)
        {
            max = v[i];
            maxInd = i;
        }
    }

    for(int i = 0; i < n; ++i)
    {
        res += i != maxInd ? v[i] : v[i] / 2;
    }

    cout << res << "\n";
    return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
struct Fast { Fast() { cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20);} } fast;
 
 
int main() {
    int n;
    cin >> n;
    vector<long> as(n);
    cin >> as[0];
    if (n == 1){
        cout << "Yes" << endl;
        return 0;
    }
    cin >> as[1];
    for (int i = 2; i < n; i++){
        cin >> as[i];
        if (as[i - 1] - as[i] > 1){
            cout << "No" << endl;
            return 0;
        }
        if (as[i - 1] - as[i] > 0){
            for (int j = i - 2; j >= 0; j--){
                if (as[j] - as[i - 1] > 0){
                    cout << "No" << endl;
                    return 0;
                }
            }
        }
    }
    cout << "Yes" << endl;
}

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

using namespace std;

typedef long long ll;

struct cum_sum_lm {
	vector<ll> sum;
	int N;
	cum_sum_lm() = default;
	cum_sum_lm(int _N) {
		N = _N;
		sum.resize(N + 1);
	}

	void setup(vector<ll>& _ar) {
		for (int i = 0; i < N; i++) {
			sum[i + 1] = sum[i] + _ar[i];
		}
	}
	ll getval(int l, int r) {
		//[l, r)
		ll ret = sum[r] - sum[l];
		return ret;
	}
};

int main() {
	int N;
	cin >> N;
	vector<ll> A(N);
	for (int i = 0; i < N; i++)cin >> A[i];
	
	cum_sum_lm cs(N);
	cs.setup(A);

	ll ans = 1e18;
	//そもそも全体の長さが偶数
	if (cs.getval(0, N) % 2 == 0) {
		ll half = cs.getval(0, N) / 2;
		for (int i = 0; i < N - 1; i++) {
			ll tmp = 0;
			if (i + 1 <= half) {
				tmp += abs(cs.getval(0, i + 1) - half);
				tmp += abs(cs.getval(i + 1, N) - half);
				ans = min(ans, tmp);
			}
		}
	}
	else {
		//全体の長さが奇数ならば、2k+1として、分割はk, k + 1 or k + 1, kがありうる
		ll lhalf = cs.getval(0, N) / 2;
		ll uhalf = cs.getval(0, N) / 2 + 1;
		ll tmp = 0;
		for (int i = 0; i < N - 1; i++) {
			//k, k + 1
			ll tmp = 0;
			if (i + 1 <= lhalf) {
				tmp += abs(lhalf - cs.getval(0, i + 1));
				tmp += abs(uhalf - cs.getval(i + 1, N));
				ans = min(tmp, ans);
			}
			tmp = 0;
			if (i + 1 <= uhalf) {
				tmp += abs(uhalf - cs.getval(0, i + 1));
				tmp += abs(lhalf - cs.getval(i + 1, N));
				ans = min(tmp, ans);
			}
		}
		ans++;
	}

	cout << ans << endl;
	return 0;
}

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

map<long long int, long long int> prime_factor(long long int n) {
    map<long long int, long long int> ret;
    for (long long int i = 2; i * i <= n; i++) {
        while (n % i == 0) {
            ret[i]++;
            n /= i;
        }
    }
    if (n != 1) ret[n] = 1;
    return ret;
}

ll digit(ll n) { return log10(n) + 1; }

int main() {
    ll N;
    cin >> N;

    vector<ll> prime(1, 1);
    map<ll, ll> primes = prime_factor(N);
    for (auto var : primes) {
        for (int i = 0; i < var.second; i++) {
            prime.push_back(var.first);
        }
    }

    ll minimum = digit(N);
    for (int i = 0; i < (1 << prime.size()); i++) {
        bitset<10000> bit1(i);
        ll left = 1;
        ll right = 1;
        for (int j = 0; j < prime.size(); j++) {
            if (bit1[j]) {
                left *= prime[j];
            }
        }
        right = N / left;
        ll tmp;
        tmp = max(digit(right), digit(left));
        if (tmp < minimum) {
            minimum = tmp;
        }
    }

    cout << minimum << endl;

    return 0;
}


Measured memory_bytes: 3888
unittest
{
	assert( [ "5", "2 2 3 5 5" ].parse.expand.solve == 2 );
	assert( [ "9", "1 2 3 4 5 6 7 8 9" ].parse.expand.solve == 0 );
	assert( [ "6", "6 5 4 3 2 1" ].parse.expand.solve == 18 );
	assert( [ "7", "1 1 1 1 2 3 4" ].parse.expand.solve == 6 );
}



import std.algorithm;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto n = input.front.strip.to!( long );
	input.popFront;
	auto as = input.front.split.to!( long[] );
	
	return tuple( as );
}

auto solve( in long[] as )
{
	// bの後ろの 1 .. N を処理
	auto ais = new long[ as.length ];
	foreach( long i, ref ai; ais )
	{
		ai = as[ i ] - ( i + 1 );		// bが右端に行くように式を変形 a[i]-(b+(i+1)) => a[i]-(i+1)-b
	}
	
	// ソートして中央値を取得
	ais.sort();
	auto b = ais[ $ / 2 ];
	
	// 悲しさを計算
	auto s = 0L;
	foreach( ai; ais )
	{
		s += abs( ai - b );
	}
	
	return s;
}


Measured memory_bytes: 11632
A,B,C,D,E,F=map(int,input().split())
water=[]
for i in range(F//(100*B)+1):
  for j in range((F-100*B*i)//(100*A)+1):
    water.append(100*A*j+100*B*i)
water=sorted(list(set(water)))
suger=[]
for i in range(F//(C)+1):
  for j in range((F-C*i)//D+1):
    suger.append(C*j+D*i)
suger=sorted(list(set(suger)))
Water=0
Suger=0
ans=0
if (A*100+min(C,D)>F):
  print(A*100,0)
else:
  for i in range(len(water)):
    if i==0:
      continue
    for j in range(len(suger)):
      if water[i]+suger[j]>F:
        break
      c=float(suger[j]*100/water[i])
      if c<=E:
        if c>ans:
          ans=c
          Water=water[i]+suger[j]
          Suger=suger[j]
  if Water==0:
    print(A*100,0)
  else:
    print(Water,Suger)

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

#define fast_io ios_base::sync_with_stdio(false); cin.tie(nullptr)
#define rep(i, x, y) for(decltype(y) i = (x) - ((x) > (y)); i != (y) - ((x) > (y)); i += 1 - 2 * ((x) > (y)))
#define trav(i,a) for(auto& (i) : (a))
#define all(a) (a).begin(),(a).end()
#define sz(a) int((a).size())
#define clr(a,x) memset((a),(x),sizeof(a)) // array (0,-1)
#define dbg(x) cerr << "STDERR => " << __LINE__ << ": " << #x << " = " << (x) << "  :(\n";
#define pb push_back
#define mp make_pair
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
inline void cpuTime() { cerr << "cpu time : " << double(clock())/CLOCKS_PER_SEC << "\n"; return; }
using ll = long long;
using ull = unsigned long long;
using F = float;
using D = double;
using vi = vector<int>;
using pii = pair<int,int>;



void solve(){

    int r = 0, g = 0, b = 0, k = 0;
    cin >> r >> g >> b;
    cin >> k;

    int cnt = 0;
    while(r >= g) { g *= 2; ++cnt; }
    while(g >= b) { b *= 2; ++cnt; }

    if(cnt <= k) cout << "Yes\n";
    else cout << "No\n";

    return;
}

/*
 read the question carefully ( what're the exact constraints? )
 look out for SPECIAL CASES (n=1?) and OVERFLOW (ll vs int?) ARRAY OUT OF BOUNDS
 Check datatypes
*/
int main(){

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

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

    cpuTime();
return 0;
}


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

int main() {
  long long a, v, b, w, t;
  cin>>a>>v>>b>>w>>t;
  if (a <= b) {
    if (a + v * t >= b + w * t) {
      cout<<"YES"<<endl;
    } else {
      cout<<"NO"<<endl;
    }
  } else {
    if (a - v * t <= b - w * t) {
      cout<<"YES"<<endl;
    } else {
      cout<<"NO"<<endl;
    }
  }
}

Measured memory_bytes: 3628
n=int(input())
dict={}
res=[]
for i in range(n):
    ss=input().split()
    if ss[0]=='insert':
        dict[ss[1]]=i
    elif ss[0]=='find':
        if dict.__contains__(ss[1]):
            res.append('yes')
        else:
            res.append('no')
    
for i in res:
    print(i)
    


Measured memory_bytes: 45808
import java.util.*;
import java.util.stream.*;
import java.util.function.*;

public class Main {
    public static void main(String[] args) throws Exception {
        System.out.println(new Main().solve());
    }
    
    int solve() {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        // String[] a = s.split("");
        char[] a = s.toCharArray();
        // あまり
        int count = 0;
        // 現在の比較対象
        char first = a[0];
        for(char c : a) {
            if(c == first) {
                count++;
            } else {
                if(count == 0) {
                    first = c;
                    count++;
                } else {
                    count--;
                }
            }
        }
        
        return a.length - count;
    }
}


Measured memory_bytes: 26508
#include<bits/stdc++.h>
using namespace std;
string s;
int main(){
	cin>>s;
	int sum=0;
	int l=s.size();
	for (int i=0;i<l;i++){
		sum++;
	}
	cout<<s[0]<<sum-2<<s[l-1];
	return 0;
}

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

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

    int cnt = 0;
    int n;
    cin >> n;
    for (int i = 1; i <= n; i++) {
        int k = i;
        int t = 0;
        while (k) {
            t++;
            k /= 10;
        }
        if (t & 1) cnt++;
    }
    cout << cnt << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(){
	int s,l,i,j=0,k=0,m=0,flag=0,ans[3000]={0},first=1;
	
	while(scanf("%d %d",&s,&l)!=EOF){
		if(s==0 && l==0)break;
		if(first!=1)printf("\n");
		for(i=s;i<=l;i++){
			if(i%4==0){
				if(i%100!=0 || i%400==0){
				printf("%d\n",i);
				flag=1;
				}
			}
		}
	
		if(flag==0)printf("NA\n");
		flag=0;
		first=0;
	}
return 0;
}

Measured memory_bytes: 616
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;


class Program {

	static long mod = 1000000007;
	static int[] ans;
	static void Main(string[] args) {

		char[] cs = new char[] { ' ' };
		//char[] cs = new char[] { ' ', ',' };

		//int n = int.Parse(Console.ReadLine());
		//int val = int.Parse(Console.ReadLine());
		//int[] vals = parseAry(Console.ReadLine().Split(cs));
		//string str = Console.ReadLine();
		//string[] strs = Console.ReadLine().Split(cs);

		long res = 0;


		int[] vals = parseAry(Console.ReadLine().Split(cs));

		int n = vals[0];
		int ao = vals[1];
		int aka = n - ao;

		long[] powd = new long[2001];
		powd[0]=1;
		for ( long i = 1; i <=2000; i++ ) {
			powd[i] = (powd[i - 1] * i )%mod;
		}

		for ( int i = 1; i <= ao; i++ ) {

			long akaside=0;
			long nowaka=aka;

			//i=3
			nowaka -= i-1;
			if ( nowaka < 0 ) { Console.WriteLine("0"); continue; }
			long tt=powd[nowaka]*(powd[i])%mod;
			//long tttt = t * mod_pow(tt, mod - 2)%mod;
			akaside = (powd[nowaka+(i)]  * (mod_pow(tt, mod - 2)%mod))%mod;



			long aoside = 0;
			//i=3
			long nowao = ao;
			nowao -= i;
			tt = powd[nowao] * ( powd[i-1] ) % mod;
			aoside = (powd[nowao + ( i-1 )] * (mod_pow(tt, mod - 2)%mod))%mod;

			long restemp = akaside * aoside % mod;
			Console.WriteLine(restemp);
		}


			//Console.WriteLine(res);
				return;

	}


	static public long mod_pow(long x, long n) {
		long mod = 1000000007;
		long res = 1;
		while ( n > 0 ) {
			if ( ( n & 1 ) == 1 ) { res = res * x % mod; }
			x = x * x % mod;
			n >>= 1;
		}
		return res;
	}

	//	文字列strをindex番目からdで上書き
	static string strOverWrite(string str, int i, string s) {
		return str.Remove(i, s.Length).Insert(i, s);
	}

	//　String[]  ----->  int[]
	static int[] parseAry(string[] str) {
		int[] nums = new int[str.Length];
		for ( int i = 0; i < str.Length; i++ ) { nums[i] = int.Parse(str[i]); }
		return nums;
	}
	//　String[]  ----->  long[]
	static long[] parseAryL(string[] str) {
		long[] nums = new long[str.Length];
		for ( int i = 0; i < str.Length; i++ ) { nums[i] = long.Parse(str[i]); }
		return nums;
	}

	//文字列を1文字ずつString[]に入れる
	static string[] strAry(String str) {
		string[] re = new string[str.Length];
		for ( int i = 0; i < str.Length; i++ ) { re[i] = str[i].ToString(); }
		return re;
	}


}

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

int main()
{
    int w,h;
    while(cin>>w>>h,w)
    {
        string s[2*h-1];getline(cin,s[0]);
        REP(i,2*h-1)getline(cin,s[i]);
        REP(i,2*h-1)s[i]+=" ";
        vector<vector<int> >step(h,vector<int>(w,-1));
        queue<pair<int,int> >q;
        step[0][0]=1;
        q.push(mp(0,0));
        while(!q.empty())
        {
            int x=q.front().fi;int y=q.front().se;q.pop();
            REP(i,4)
            {
                int xx=x+dx[i];int yy=y+dy[i];
                if(xx<0||xx>=w||yy<0||yy>=h)continue;
                if(s[2*y+dy[i]][2*x+dx[i]]=='1')continue;
                if(step[yy][xx]!=-1)continue;
                step[yy][xx]=step[y][x]+1;
                q.push(mp(xx,yy));
            }
        }
        if(step[h-1][w-1]==-1)step[h-1][w-1]=0;
        cout<<step[h-1][w-1]<<endl;
        //cout << (step[h-1][w-1] == -1 ? 0 : step[h-1][w-1]) << endl;
    }
}


Measured memory_bytes: 3212
#include<cstdio>
#include<functional>
#include<algorithm>
using namespace std;
int main(void)
{
	int n,i,a[100],cnt,x,iro[9],mx,mn;
	scanf("%d",&n);
	for(i=0;i<9;i++)	iro[i]=0;
	for(i=0;i<n;i++)	{
		scanf("%d",&a[i]);
		x=a[i]/400;
		if(x>8)	x=8;
		iro[x]++;
	}
	cnt=0;
	for(i=0;i<8;i++)	{
		if(iro[i]!=0)	cnt++;
	}
	mn=cnt;
	if(mn==0)	mn=1;
	mx=cnt+iro[8];
	printf("%d %d\n",mn,mx);
	return 0;
}
	

Measured memory_bytes: 128
#include<stdio.h>
#define M 100

int main(){
  int i, j, k, N, A[M],v;
  scanf("%d",&N);
  for(i=0;i<N;i++)
    scanf("%d",&A[i]);
  
	printf("%d",A[0]);
	for(k=1;k<N;k++)
	  printf(" %d",A[k]);
	printf("\n");
  for(i=1;i<N;i++){
    
    v=A[i];
    j=i-1;
    while(j>=0&&A[j]>v){
      A[j+1]=A[j];
      j--;
      A[j+1]=v;
    }
    	printf("%d",A[0]);
	for(k=1;k<N;k++)
	  printf(" %d",A[k]);
	printf("\n");
	}
  

  return 0;
}



Measured memory_bytes: 2044
use strict;
use List::Util;
sub getmax {
  my($a) = shift;
  my($b) = shift;

  my($pl) = $a + $b;
  my($mi) = $a - $b;
  my($mu) = $a * $b;

  return List::Util::max($pl, $mi, $mu);
}

if ($0 eq __FILE__) {
  my($a, $b) = split(" ", <STDIN>);
  print getmax($a, $b);
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#include <math.h>
#define ALL(a)    a.begin(), a.end() 
#define rep(i, K, N)  for(int i = K; i < N; i++)
#define ll long long int
using namespace std;

int main() {
ll N, A;cin >> N;
vector<ll> B;

rep(i, 0, N){

cin >> A;

if(i%2 == 0)B.push_back(A);

else B.insert(B.begin(), A);
}

if(N%2 != 0)reverse(ALL(B));

rep(i, 0, B.size())cout << B[i] << " ";
}


Measured memory_bytes: 5376
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        String token;
        int rank;
        boolean[] S = new boolean[13];
        boolean[] H = new boolean[13];
        boolean[] C = new boolean[13];
        boolean[] D = new boolean[13];

        for (int i = 0; i < 13; i++) {
            S[i] = H[i] = C[i] = D[i] = false;
        }

        for (int i = 0; i < n; i++) {
            token = scan.next();
            switch (token) {
                case "S":
                    rank = scan.nextInt();
                    S[rank -1] = true;
                    break;
                case "H":
                    rank = scan.nextInt();
                    H[rank -1] = true;
                    break;
                case "C":
                    rank = scan.nextInt();
                    C[rank -1] = true;
                    break;
                case "D":
                    rank = scan.nextInt();
                    D[rank -1] = true;
                    break;
            }
        }

        for (int i = 0; i < 13; i++) {
            if (!S[i]) System.out.println("S " + (i + 1));
        }
        for (int i = 0; i < 13; i++) {
            if (!H[i]) System.out.println("H " + (i + 1));
        }
        for (int i = 0; i < 13; i++) {
            if (!C[i]) System.out.println("C " + (i + 1));
        }
        for (int i = 0; i < 13; i++) {
            if (!D[i]) System.out.println("D " + (i + 1));
        }
    }
}

Measured memory_bytes: 26360
// Separate what you do from who you are, that's what the guilt trap is all about!
#include <bits/stdc++.h>

using namespace std;

#define pb push_back
#define mp make_pair
#define ff first
#define ss second

typedef long long int ll;
typedef vector< pair<int, int> > vii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<long long int> vll;
typedef pair<int, int> pii;

const ll INF = 1e18;
const int inf = 1e9;
const int MOD = 1e9 + 7;
const int nax = 1000000 + 10;

int n, arr[nax];
int main()
{
    ios::sync_with_stdio(0);
    ll a, b;
    cin >> a >> b;
    cout << a + 2 * (b - a);
    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 repr(i,n) for(int i=(n) ; i>=0 ; i--)
#define ALL(x) (x).begin(),(x).end()

typedef long long ll;
typedef unsigned long long ull;
 
const ll INF = 1LL<<60;
const int MINF = 1e9;
const int MOD = 1e9+7;

using vi = vector<int>;
using vii = vector<vi>;

template<typename T> bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<typename T> bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

template<typename T>
T GCD(T a,T b){ return b ? GCD(b,a%b) : a ;}
template<typename T>
T LCM(T a,T b){ return a*b / GCD(a,b) ;}

string rev(string s){
    reverse(ALL(s));
    return s;
}


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

    string s;cin >> s;
    int n = s.size();
    if(s != rev(s)){
        cout << "No" << endl;
        return 0;
    }
    string s1 = s.substr(0, n-1/2);
    if(s1 != rev(s1)){
        cout << "No" << endl;
        return 0;
    }

    string s2 = s.substr((n+3)/2-1);
    if(s2 != rev(s2)){
        cout << "No" << endl;
        return 0;
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,N) for(int i=0;i<(N);i++)
#define rrep(i, n) for (int i = (int)n-1; i >= 0; --i)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
const int mod = 1e9+7;
typedef long long ll;
typedef pair<ll,int> P;
typedef set<int> S;

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; }

__attribute__ ((constructor))
void fastio() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(10);
}


//N!が5で割れる回数

ll solve(ll n){
    ll res = 0;
    while(n){
        res += n / 5;
        n /= 5;
    }
    return res;
}

int main(){
    ll n;
    cin >> n;
    if(n%2 != 0){
        cout << 0 << endl;
        return 0;
    }else{
        cout << solve(n/2) << endl;
        return 0;
    }
    return 0;
}

Measured memory_bytes: 3596
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    n=int(input())
    l=[input() for i in range(n)]
    from collections import Counter
    c=Counter(l)
    csort=c.most_common()
    maxl=[]
    for i in range(len(csort)):
        if csort[i][1]==csort[0][1]:
            maxl.append(csort[i][0])
    maxl.sort()
    for i in maxl:
        print(i)
resolve()

Measured memory_bytes: 47664
#include <cstdio>
#include <map>

using namespace std;

#define REP(i,n)   for(int i=0; i<(int)(n); i++)
#define FOR(i,b,e) for(int i=(b); i<=(int)(e); i++)
#define ITR(c,it)  for(it = c.begin(); it != c.end(); it++)

const int N_MAX = 100000;
const int H_MAX = 1000000000;
const int W_MAX = 1000000000;

typedef long long ll;

int H, W, N;
int a[N_MAX];
int b[N_MAX];

map<pair<int, int>, int> sqs;
int cnts[10];

void solve() {
  REP(k, N) {
    FOR(i, -2, 0) FOR(j, -2, 0) {
      int i2 = a[k] - 1 + i;
      int j2 = b[k] - 1 + j;
      if (i2 < 0 || i2 + 2 >= H || j2 < 0 || j2 + 2 >= W) continue;
      sqs[make_pair(i2, j2)]++;
    }
  }
  map<pair<int, int>, int>::iterator it;
  ITR(sqs, it) cnts[it->second]++;
  ll total = (ll) (H - 2) * (W - 2);
  FOR(k, 1, 9) total -= cnts[k];

  printf("%lld\n", total);
  FOR(k, 1, 9) printf("%d\n", cnts[k]);
}

void input() {
  scanf("%d%d%d", &H, &W, &N);
  REP(i, N) scanf("%d%d", a + i, b + i);
}

int main() {
  input();
  solve();
  return 0;
}


Measured memory_bytes: 57216
import math

A, B, H, M = map(int, input().split())

theta1 = 2 * math.pi / 12 * H + 2 * math.pi / 60 / 12 * M  
theta2 = 2 * math.pi / 60 * M

x = math.sqrt(A*A + B*B - 2.0 * A * B* math.cos(theta1 - theta2))

print(x)

Measured memory_bytes: 9320
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
typedef long long int ll;
#define BIG_NUM 2000000000
#define MOD 1000000007
using namespace std;

int main(){

	int N,M,table[101],ans,d,v;

	while(true){
		scanf("%d %d",&N,&M);
		if(N == 0 && M == 0)break;

		for(int i = 1; i <= M; i++)table[i] = 0;

		ans = 0;

		for(int i = 0; i < N; i++){
			scanf("%d %d",&d,&v);
			table[d] = max(table[d],v);
		}

		for(int i = 1; i <= M; i++)ans += table[i];

		printf("%d\n",ans);
	}

   return 0;
}


Measured memory_bytes: 2688
A = input()
def num2alpha(num):
    if num<=26:
        return chr(64+num)
    elif num%26==0:
        return num2alpha(num//26-1)+chr(90)
    else:
        return num2alpha(num//26)+chr(64+num%26)

ans =num2alpha(int(A))
print(ans.lower())

Measured memory_bytes: 9112
a = input()
b = input()
flag = 0
if len(a) > len(b):
    print('GREATER')
    flag = 1
elif len(a) < len(b):
    print('LESS')
    flag = -1
else:
    for i in range(len(a)):
        if a[i] > b[i]:
            print('GREATER')
            flag = 1
            break
        elif a[i] < b[i]:
            print('LESS')
            flag = -1
            break
if flag == 0:
    print('EQUAL')

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define REP(i,a,b) for(int(i)=(a);(i)<(b);++(i))
#define RREP(i,a,b) for(int(i)=(a)-1;(i)>=(b);--(i))
#define ALL(x) (x).begin(),(x).end()
#define chmin(x,v) x = min(x, v)
#define chmax(x,v) x = max(x, v)
using namespace std;
typedef long long ll;

string S;
int a[4];

int char2num(char c)  // c: 0-9
{
  return c - '0';
}

void solve()
{
  REP(i,0,4) a[i] = char2num(S[i]);

  REP(bit,0,1<<3) {
    int x = a[0];
    REP(i,0,3) {
      // 0 --> + / 1 --> -
      if (bit & (1<<i)) x += a[i+1];
      else x -= a[i+1];
    }

    if (x == 7) {
      cout << a[0];
      REP(i,0,3) {
        cout << ((bit & (1<<i)) ? '+' : '-');
        cout << a[i+1];
      }
      cout << "=7" << endl;
      return;
    }
  }
}

int main()
{
  cin >> S;
  solve();

  return 0;
}


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

typedef long long ll;
typedef pair<int, int> pii;
#define FOR(i, n) for(int i=0; i<n; i++)
#define FOR1(i, n) for(int i=1; i<=n; i++)
#define FORI(i, n) for(int i=n-1; i>=0; i--)
template<class T, class U> void umin(T& x, const U& y){ x = min(x, (T)y);}
template<class T, class U> void umax(T& x, const U& y){ x = max(x, (T)y);}
template<class T, class U> void init(vector<T> &v, U x, size_t n) { v=vector<T>(n, (T)x); }
template<class T, class U, typename... W> void init(vector<T> &v, U x, size_t n, W... m) { v=vector<T>(n);  for(auto& a : v) init(a, x, m...); }

int h, w;
int ch, cw;
int dh, dw;
vector<string> a;
vector<vector<int>> dist;

int main(int argc, char** argv) {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cout << setprecision(15);
    if (argc == 2 && atoi(argv[1]) == 123456789) freopen("d:\\code\\cpp\\contests\\stdin", "r", stdin);

    cin >> h >> w >> ch >> cw >> dh >> dw;
    ch--; cw--; dh--; dw--;
    a.resize(h);
    FOR(i, h) cin >> a[i];
    init(dist, 1e9, h, w);
//    init(vis, 0, h, w);
    dist[ch][cw] = 0;
    set<vector<int>> S;
    S.insert({0, ch, cw});
    while(S.size()){
        auto it = S.begin();
        int d = (*it)[0];
        int i = (*it)[1];
        int j = (*it)[2];
//        cout << d << " " << i << " " << j << endl;
        S.erase(it);
        if (dist[i][j] < d) continue;
        dist[i][j] = d;

        for(int di = -2; di <= 2; di++){
            for(int dj = -2; dj <= 2; dj++){
                int i2 = i+di;
                int j2 = j+dj;
                if (i2 >=0 && i2 < h && j2 >= 0 && j2 < w && a[i2][j2] == '.'){
                    int step = abs(di) + abs(dj);
                    if (step == 1) {
                        if (dist[i][j] < dist[i2][j2])
                            S.insert({dist[i][j], i2, j2});
                    }
                    else if (step > 1) {
                        if (dist[i][j] + 1 < dist[i2][j2])
                            S.insert({dist[i][j] + 1, i2, j2});
                    }
                }
            }
        }
    }
    if (dist[dh][dw] == 1e9) dist[dh][dw] = -1;
    cout << dist[dh][dw] << endl;

    if (argc == 2 && atoi(argv[1]) == 123456789) cout << clock()*1.0/CLOCKS_PER_SEC << " sec\n";
    return 0;
}



Measured memory_bytes: 9960
let a, b, n = stdin.ReadLine().Split() |> fun [| a; b; n|] -> int a, int64 b, int64 n

// x/Bの小数部をβとすると[Aβ]が答え これは1<=n<B-1のとき最大値x=nそれ以外は最大値x=B-1
let beta x = x - floor x

if n < b-1L then float n 
else (float b - 1.0)
|> fun x -> x / float b |> beta |> (*) (float a) |> floor |> string |> stdout.WriteLine

Measured memory_bytes: 28028
#include<iostream>
using namespace std;
typedef long long ll;

int main() {
    int N;
    ll T, A, t = 1, a = 1;
    cin >> N;
    for (int i = 0; i < N; i++) {
        cin >> T >> A;
        if (T >= t && A >= a) {
            t = T, a = A;
        }
        else if (T >= t && A < a) {
            a = A * ((a + A - 1) / A);
            t = (a / A) * T;
        }
        else if (T < t && A >= a) {
            t = T * ((t + T - 1) / T);
            a = (t / T) * A;
        }
        else {
            if ((t + T - 1) / T < (a + A - 1) / A) {
                t = T * ((a + A - 1) / A);
                a = A * ((a + A - 1) / A);
            }
            else {
                t = T * ((t + T - 1) / T);
                a = A * ((t + T - 1) / T);
            }
        }
    }
    cout << t + a << endl;
    return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
int N;
vector<int>to[200005];
vector<int> ans;
void dfs(int v, int p = -1) {
	for (int e : to[v]) {
		if (p == e) {
			continue;
		}
		ans[e] += ans[v];
		dfs(e, v);
	}
}

int main() {
	int N, Q;
	cin >> N >> Q;
	for (int n = 0; n < N - 1; ++n) {
		int a, b;
		cin >> a >> b;
		a--;
		b--;
		to[a].push_back(b);
		to[b].push_back(a);
	}	
	ans.resize(N);
	for (int n = 0; n < Q; ++n) {
		int p, q;
		cin >> p >> q;
		p--;
		ans[p] += q;
	}	
	dfs(0);
	for (int n = 0; n < N ; ++n) {
		cout << ans[n] << endl;
	}
	return 0;
}


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

using ll = long long;
using ull = unsigned long long;
using ld = long double;
#define REP(NAME, NUM) for (int NAME = 0; NAME < (NUM); ++NAME)
#define BREP(NAME, NUM) for (int NAME = (NUM)-1; NAME >= 0; --NAME)
#define ALL(NAME) (NAME).begin(), (NAME).end()

#define cMOD 998244353;

int main()
{
	ll n = 0;
	cin >> n;
	vector<ll> a( n, 0 );
	REP(i,n)cin>>a[i];
	ll sum = 0;
	REP(i,n) sum += a[i];
	
	vector<ll> dp( sum + 1, 0 );
	vector<ll> dp2( sum + 1, 0 );

	dp[0] = 1;
	dp2[0] = 1;
	REP( i, n ) BREP( j, sum + 1 )
	{
		dp[j] *= 2;
		if( a[i] <= j ) dp[j] += dp[j - a[i]];
		dp[j] %= cMOD;
		
		if( a[i] <= j ) dp2[j] += dp2[j - a[i]];
		dp2[j] %= cMOD;
		//cout << i << " " << j << " " << dp2[j] << endl;
	}
	
	ll ans = 0;
	for( int i= ( sum + 1 ) / 2; i <= sum; ++i )
		ans = ( ans + dp[i] ) % cMOD;

	ll all = 1;
	REP( i, n ) all = ( all * 3 ) % cMOD;

	ans = all - ans * 3;
	if( sum % 2 == 0 ) ans = ans + dp2[sum/2] * 3;
	while( ans < 0 ) ans += cMOD;
	ans %= cMOD;

	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1664
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_map>
#include<climits>
#include<cstdlib>
#include<cmath>
#include<string>
#include<iomanip>

using namespace std;

#define INF 1 << 29
#define LL long long int

LL const MOD = 1000000007;

LL mygcd(LL a,LL b){
    if(b == 0){
        return a;
    }
    return mygcd(b,a%b);
}

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

    LL n,m;
    cin >> n >> m;

    string s,t;
    cin >> s >> t;

    LL x = (n*m)/mygcd(n,m);

    map<LL,char> mp;

    for(LL i = 0; i < n; i++){
        mp[i*(x/n)+1] = s[i];
    }

    bool ans = true;

    for(LL i = 0; i < m; i++){
        auto itr = mp.find(i*(x/m)+1);
        if(itr == mp.end()){

        }else{
            if(t[i] != mp[i*(x/m)+1]){
                ans = false;
            }
        }
    }

    if(ans){
        cout << x << endl;
    }else{
        cout << -1 << endl;
    }
    
    return 0;
}

Measured memory_bytes: 6144
import Control.Monad
import Control.Monad.ST
import Data.List
import qualified Data.Vector.Unboxed as V
import qualified Data.Vector.Unboxed.Mutable as MV

main = do
  getLine
  ns <- sort . map read . words <$> getLine
  print $ solve ns

solve ns = length $ filter (cs V.!) ns'
  where
    gs = group ns
    ns' = map head $ filter (null . tail) gs
    cs = runST $ do
      v <- MV.replicate (10^6 + 1) True
      forM_ (map head gs) $ \i ->
        forM_ (takeWhile (<=10^6) (iterate (+i) (i*2))) $ \j -> MV.write v j False
      V.freeze v

Measured memory_bytes: 74624
#include <iostream>
using namespace std;
int main()
{
    int Total;
    int h,m,s;
    cin>>Total;
    h = Total/3600;
    m = (Total%3600)/60;
    s = (Total%3600)%60;
    cout<<h<<":"<<m<<":"<<s<<endl;
    return 0;
}


Measured memory_bytes: 3056
#include<bits/stdc++.h>
using namespace std;
#define rep(i,x,y) for(int i=x;i<y;i++)
#define range(a) (a).begin(),(a).end()
#define print(A,x,n) rep(i,0,n){cout<<(i ? " ":"")<<A[i]x;}cout<<endl;
#define pprint(A,y,m,n) rep(j,0,m){print(A[j],y,n);}
const long mod=1e9+7;
const int siz=2e5;
const int inf=1e9;
int main(){
	int N; cin>>N;
	int ac = 0, wa = 0, tle = 0, re = 0;
	string s;
	rep(i,0,N){
		cin>>s;
		if(s == "AC") ac++;
		else if(s == "WA") wa++;
		else if(s == "TLE") tle++;
		else re++;
	}
	cout<<"AC x "<<ac<<endl;
	cout<<"WA x "<<wa<<endl;
	cout<<"TLE x "<<tle<<endl;
	cout<<"RE x "<<re<<endl;
}

Measured memory_bytes: 3624
#include <iostream>
#include <stdio.h>
#include <cstdlib>
 
using namespace std;

long gcd(long x, long y){
    long temp;
    if(x < y){
        temp = x;
        x = y;
        y = temp;
    }
    temp = x % y;
    if(temp == 0)return y;
    return gcd(y, temp);
}

int main(void) {
    long n, k;
    cin >> n >> k;
    long x, y;
    cin >> y;
    long ans = abs(k - y);
    for(long i = 1; i < n; i++){
        cin >> x;
        ans = gcd(abs(x - y), ans);
        y = x;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include<cstring>
#include<string>
using namespace std;
int main() {
    int t;
    char a[106];
    cin>>t>>a;
    if (strlen(a)>t) a[t]='.',a[t+1]='.',a[t+2]='.',a[t+3]='\0';
    cout<<a<<endl;
 }

Measured memory_bytes: 3124
#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e5 +7;

#include <math.h>
#define PI 3.14159265358979323846264338327950L



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

    if (a > b) {
        for (int i = 0; i < a; i++) cout << b;
    }
    else {
        for (int i = 0; i < b; i++) cout << a;
    }
    return 0;
}

Measured memory_bytes: 3604
#include <iostream>
using namespace std;
#define rep(i, s, n) for (int i = (s); i < (n); i++)
#define rrep(i, s, n) for (int i = (s); i > (n); i--)

int nmin, dif ,ans,X;
int main()
{
    cin >> X;
    nmin = X / 100;
    dif = X - nmin * 100;
    if (dif > nmin * 5)
    {
        cout << 0 << endl;
        return 0;
    }else
    {
        cout << 1 << endl;
        return 0;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <bitset>
#include <vector>
#include <algorithm>

using namespace std;
const int MAX_N = 10000000;

int main(){
    bitset<MAX_N> sieve;
    vector<int> primes;
    sieve[0] = sieve[1] = true;
    for(int i = 2; i < MAX_N; ++i){
        if(sieve[i]){ continue; }
        primes.push_back(i);
        for(int j = i + i; j < MAX_N; j += i){ sieve[j] = true; }
    }
    while(true){
        int n;
        cin >> n;
        if(n == 0){ break; }
        vector<int>::iterator it = upper_bound(primes.begin(), primes.end(), n);
        int t = distance(primes.begin(), it) - 1;
        while(
            primes[t] - 2 != primes[t - 1] ||
            primes[t] - 6 != primes[t - 2] ||
            primes[t] - 8 != primes[t - 3]
        ){
            --t;
        }
        cout << primes[t] << endl;
    }
    return 0;
}

Measured memory_bytes: 4856
#include <iostream>
#include <iomanip>
#include <random>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <numeric>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <sstream>
#include <bitset>
#include <cassert>
#include <fstream>
#include <queue>

#define len(X) ((int)(X).size())

#ifdef __LOCAL
	#define DBG(X) cout << #X << "=" << (X) << '\n';
	#define SAY(X) cout << (X) << '\n';
#else
	#define DBG(X)
	#define SAY(X)
#endif
 
using namespace std;

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

const int INT_INF = (int)(2e9);
const ll  LL_INF  = (ll)(2e18);

const int NIL = -1;
static mt19937 _g(time(nullptr));

inline ll randint(ll a, ll b) { ll w = (_g() << 31LL) ^ _g(); return a + w % (b - a + 1); }
inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T> inline T sign(T x) { return T(x > 0) - T(x < 0); }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for(auto el: v) cout << el << " "; return os; }
template<typename T> inline T fetch() { T ret; cin >> ret; return ret; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for(auto& elem: ret) cin >> elem; return ret; }

const int MOD = (int)1e9 + 7;

int add(int x, int y) {
	return (x + y >= MOD ? x + y - MOD : x + y);
}

int mult(int x, int y) {
	return (x * 1LL * y) % MOD;
}

int binpow(int x, int y) {
	if(x == 1 || y == 0) {
		return 1;
	}

	if(x == 0) {
		return 0;
	}

	int rez = binpow(x, y / 2);
	rez = mult(rez, rez);

	if(y & 1) {
		rez = mult(rez, x);
	}

	return rez;
}

int divide(int x, int y) {
	return mult(x, binpow(y, MOD - 2));
}

const int MAXN = (int)1e5 + 77;
int fact[MAXN], inv_fact[MAXN], pw[MAXN][4];

void precalc() {
	for(int base = 2; base <= 3; ++base) {
		pw[0][base] = 1;

		for(int i = 1; i < MAXN; ++i) {
			pw[i][base] = mult(pw[i - 1][base], base);
		}
	}

	fact[0] = 1;

	for(int i = 1; i < MAXN; ++i) {
		fact[i] = mult(fact[i - 1], i);
	}

	inv_fact[MAXN - 1] = divide(1, fact[MAXN - 1]);

	for(int i = MAXN - 2; i >= 0; --i) {
		inv_fact[i] = mult(i + 1, inv_fact[i + 1]);
	}
}

int choose(int n, int k) {
	if(k > n) {
		return 0;
	}

	int rez = fact[n];
	rez = mult(rez, inv_fact[k]);
	rez = mult(rez, inv_fact[n - k]);

	return rez;
}

void solve() {
	auto number = fetch<string>();
	int answ = 0;
	int n = len(number);
	int cnt = 0;

	for(int i = 0; i < n; ++i) {
		if(number[i] == '1') {
			int suff = n - i - 1;
			answ = add(answ, mult(pw[cnt][2], pw[suff][3]));
		}

		cnt += number[i] - '0';
	}

	answ = add(answ, pw[cnt][2]);
	cout << answ << '\n';
}

int main() {
	fast_io();

	precalc();
	solve();

	return 0;
}


Measured memory_bytes: 2816
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define inf (ll)1e9
#define mod (ll)(1e9+7)
#define d(x) cerr<<#x<<"="<<x<<endl;
#define p(x) cout<<(x)<<endl
#define ps(x) cout<<(x);
#define pk(x) cout<<(x)<<" ";
#define pfix(d,x) cout << fixed << setprecision(d) << x << endl;
#define pb push_back
#define all(v) (v).begin(), (v).end()
#define minel(v) *min_element(all(v))
#define minind(v) distance((v).begin(), min_element(all(v)))
#define maxel(v) *max_element(all(v))
#define maxind(v) distance((v).begin(), max_element(all(v)))
#define p2d(v,n,m) rep(i,n){rep(j,m){pk(v[i][j]);}p("");}
#define fi first
#define se second
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}
ll a[100001],b[100001],c[100001],d,n,m,x,y,z,h,w,k,sum,mi=inf,ma=-inf,ans,s,t,l,r,res,tmp,itr,p,q;
bool flag;
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
int dx8[8]={1,1,0,-1,-1,-1,0,1},dy8[8]={0,1,1,1,0,-1,-1,-1};
char cha;
string st;
typedef map<ll, ll> imap;
typedef pair<ll, ll> P;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<pair<ll,ll> > VP;
P pa;

ll gcd(ll a, ll b)
{
    if (a < b) {
        a ^= b;
        b ^= a;
        a ^= b;
    }
    return b ? gcd(b, a % b) : a;
}

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



int main(){
    cin>>n>>m;
    ll L=1;
    rep(i,n){
        cin>>a[i];
        L=lcm(L,a[i]/2);
        if(L>m){p(0); return 0;}
    }
    rep(i,m+1){
        if(L*(2*i+1)<=m)sum++;
        else break;
    }
    rep(i,n){
        if((2*L/a[i])%2==0){p(0); return 0;}
    }
    p(m/L-m/(2*L));
    return 0;
}


Measured memory_bytes: 1024
// code.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

#include <bits/stdc++.h>
#define ll long long

using namespace std;

int main()
{
ll n,k;
cin>>n>>k;
if(n<k){
	ll v;
	v = min(n,abs(k-n));
	cout<<v;
}
else{

ll val = n%k;
ll ans = min(val,abs(k-val));
cout<<ans;
}
}


Measured memory_bytes: 256
s = int(input())
a = []
while s > 0:
    a.append(s%10)
    s = s//10
a.reverse()
m = 1000
for i in range(len(a)-2):
    bi =(a[i]*100 + a[i+1]*10 + a[i+2])
    if abs(bi - 753) < m:
        m = abs(bi - 753)
print(m)

Measured memory_bytes: 3060