akhauriyash/Code-Regression huggingface dataset:
/*http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DPL_1_A&lang=jp*/

#include<stdio.h>

int main(void){
    int n, m, i, j, min;
    min = 50000;
    
    //??\??????
    int coin[21];
    scanf("%d %d", &n, &m);
    for(i = 1; i < m+1; i++){
        scanf("%d", &coin[i]);

    }
    //????????????????????????,0?????????MAX?????£??\???0????????????0
    int table[21][50001]={};
    for(i=0;i<n+1;i++){
        table[0][i] = 50000;
    }
    for(i=1;i<m+1;i++){
        for(j=1;j<n+1;j++){
            //table[i][j]????????????
                if(coin[i] > j){//?????¢???n=j??????????????????????????¨??£?????????
                    table[i][j] = table[i-1][j];
                }else{//2????????§min??????????????£?????????
                    if(table[i-1][j] < table[i][j - coin[i]] + 1){
                        table[i][j] = table[i-1][j];
                    }else{
                        table[i][j] = table[i][j - coin[i]] + 1;
                    }
                }
            //printf("%d ",table[i][j]);
        }
        //printf("\n");
        if(min > table[i][j-1]){
            min = table[i][j-1];
        }
    }
    printf("%d\n",min);
    return 0;
}

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

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
//const ll mod = 1000000007;

int main() {
    //cout.precision(10);
    string S;
    cin >> S;
    if(S <= "2019/04/30") cout << "Heisei" << endl;
    else cout << "TBD" << endl;
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int r;
char d[100010],s[100010],c[100010];
void f(int n){
  int i;
  if(n==0)return;
  f(n-1);
  for(i=0;c[i];i++){
    d[r++]=c[i];
    f(n-1);
  }
  //f(n-1);
  return;
}
int main(){
  int i,j,k;
  long long l,a=1,n;
  scanf("%s %s",s,c);
  for(l=0;c[l];l++);
  for(n=0;s[n];n++);//printf("%lld %lld %lld\n",l,n,l*a);
  for(i=0;n>=l*a;i++){//printf("a\n");
    a*=(l+1);
    r=0;
    f(i+1);
    d[r]=0;//printf("%s %d\n",d,i);
    for(j=k=0;j<n;j++){
      if(s[j]==d[k])k++;
    }//printf("%d\n",d[k]);
    if(d[k])break;
  }
  printf("%d\n",i);
  return 0;
}
    



Measured memory_bytes: 2956
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define rrep(i,n) for(int i=1,i##_len=(n); i<=i##_len; ++i)
#define drep(i,n) for(int i=(n)-1; i>=0; --i)
#define srep(i,s,t) for(int i=(s);i<(t);++i)
#define rng(obj) (obj).begin(), (obj).end()
#define maxs(x,y) (x=max((x),(y)))
#define mins(x,y) (x=min((x),(y)))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x=max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T>>
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) vector<vector<T>>
using ll = long long;
using ull = unsigned long long;
using uint = unsigned int;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vp = vector<pii>;
template <class T> inline istream& operator>>(istream&i,v(T)&v)
{ rep(j,sz(v))i>>v[j];return i;}
template <class T> string join(const v(T)&v)
{ stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template <class T> inline ostream& operator<<(ostream&o,const v(T)&v)
{ if(sz(v))o<<join(v); return o;}
template <class T1,class T2> inline istream& operator>>(istream&i ,pair<T1,T2>&v)
{ return i>>v.fi>>v.se;}
template <class T1,class T2> inline ostream& operator<<(ostream&o ,pair<T1,T2>&v)
{ return o<<v.fi<<","<<v.se;}
template <class T> inline ll suma(const v(T)& a) 
{ ll res(0); for(auto&& x:a) res += x; return res;}
const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;
const double eps = 1e-10;
const int MX = 200005;
//----------------------------------------------------------------

#define fileio ifstream fio; if(argc>=2){fio.open(argv[1]); std::cin.rdbuf(fio.rdbuf());}
#define fastio ios_base::sync_with_stdio(false);
#define MOD 1000000007
//----------------------------------------------------------------
void Main(){
  int n,k;
  cin>>n>>k;
  vl x(n);
  cin>>x;
  ll ans = LINF;
  rep(i,n-k+1){
    ans = min(ans,min(abs(x[i])+x[i+k-1]-x[i],abs(x[i+k-1])+x[i+k-1]-x[i]));
  }
  cout<<ans<<endl;
} int main(int argc,char* argv[]){ 
    fastio; fileio; Main();}


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

using namespace std;

const int maxn = 2e5 + 6;

int a[maxn];

int main() {

	int n, k;
	cin >> n >> k;
	double ans = -1.0, value = 0.0;
	for (int i = 1; i <= n; ++i)
	{
		cin >> a[i];
		value += (double)((a[i] + 1) / 2.0);
		if (i > k) {
			value -= (double)((a[i - k] + 1) / 2.0);
			ans = max(ans, value);
		}
	}

	if (n == k) {
		ans = value;
	}

	cout << fixed << setprecision(12) << ans << "\n";

	//cout << index << " ";
	return 0;
}

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

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int a, b, c, k;
  cin >> a >> b >> c >> k;
  
  if(a >= k){
    cout << k << endl;
  }else if(a + b >= k){
    cout << a << endl;
  }else{
    int l = k - a - b;
    cout << a - l << endl;
  }
}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;

template <class T> using oset = tree <T, null_type, less <T>, rb_tree_tag, tree_order_statistics_node_update>;

void usaco(string name = "")
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    if(name.size())
    {
        freopen((name+".in").c_str(), "r", stdin);
        freopen((name+".out").c_str(), "w", stdout);
    }
}

int main()
{
    usaco();
    int n;
    cin >> n;
    vector <int> a(n), dp(n, 1e9);
    for (int i = 0; i < n; ++i) cin >> a[i];
    dp[0] = 0;
    for (int i = 0; i < n; ++i)
    {
        for (int j : {1, 2})
        {
            if (i+j >= n) break;
            else dp[i+j] = min(dp[i+j], dp[i]+abs(a[i+j]-a[i]));
        }
    }
    cout << dp[n-1] << '\n';
}


Measured memory_bytes: 3952
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>

using namespace std;

int read()
{
	int x = 0, f = 1; char c = getchar();
	while(!isdigit(c)) { if(c == '-') f = 0; c = getchar(); }
	while(isdigit(c)) { x = (x << 3) + (x << 1) + (c ^ 48); c = getchar(); }
	return f ? x : -x;
}

typedef long long LL;
const int maxn = 5010, mod = 1e9 + 7, maxm = maxn << 1;
int to[maxm], nxt[maxm], head[maxn], e;
int sz[maxn], f[maxn][maxn], tmp[maxn], fac[maxn];

void add(int x, int y) 
{
	to[++e] = y; nxt[e] = head[x]; head[x] = e;
	to[++e] = x; nxt[e] = head[y]; head[y] = e;
}

void dfs(int u, int fa)
{
	sz[u] = 1; f[u][1] = 1;
	for(int i = head[u]; i; i = nxt[i])
	{
		int v = to[i];
		if(v == fa) continue;
		dfs(v, u);
		for(int j = 1; j <= sz[v] + sz[u]; ++j) tmp[j] = 0;
		for(int j = 1; j <= sz[u]; ++j)
			for(int k = 1; k <= sz[v]; ++k)
			{
				(tmp[j + k] += (LL)f[u][j] * f[v][k] % mod) %= mod;
				if(!(k & 1)) (tmp[j] += mod - (LL)f[u][j] * f[v][k] % mod * fac[k - 1] % mod) %= mod;
			}
		sz[u] += sz[v];
		for(int j = 1; j <= sz[u]; ++j) f[u][j] = tmp[j];
	}
}

int main()
{

	int n = read();
	for(int i = 1; i < n; ++i) add(read(), read());

	fac[1] = 1;
	for(int i = 3; i <= n; i += 2) fac[i] = (LL)fac[i - 2] * i % mod;

	dfs(1, 0);
	int ans = 0;
	for(int i = 2; i <= n; i += 2) (ans += (LL)f[1][i] * fac[i - 1] % mod) %= mod;
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 97280
#include<bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long
bool compare(pair<int,int> p1,pair<int,int> p2)
{
    if(p1.first==p2.first) return p1.second<p2.second;
    return p1.first<p2.first;
}
int32_t main()
{
    IOS
    // #ifndef ONLINE_JUDGE
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    // #endif
    int n,W,w,v,sum=0;
    cin>>n>>W;
    vector<pair<int,int>> item;
    item.push_back({0,0});
    for(int i=0;i<n;i++) {cin>>w>>v; sum+=v; item.push_back(make_pair(w,v));}
    sort(item.begin(),item.end(),compare);
    // for(int i=1;i<=n;i++) cout<<item[i].first<<" "<<item[i].second<<endl;
    int dp[n+1][sum+1];
    for(int i=0;i<=sum;i++) dp[0][i]=1e18L+5;
    for(int i=0;i<=n;i++) dp[i][0]=0;
    for(int i=1;i<=sum;i++)
    {
        for(int j=1;j<=n;j++)
        {
            if(i-item[j].second>=0) dp[j][i]=min(dp[j-1][i],item[j].first+dp[j-1][i-item[j].second]);
            else dp[j][i]=dp[j-1][i];
        }
    }
    for(int i=sum;i>=0;i--) for(int j=n;j>=0;j--) if(dp[j][i]<=W) {cout<<i; goto xx;}
    xx: cout<<"";
    return 0;
}

Measured memory_bytes: 79232
#include<cstdio>
int main()
{
	int a,b,c,d,x;
	scanf("%d %d %d %d",&a,&b,&c,&d);
	while(1){
		// printf("a%d-d%d  c%d-b%d\n",a,d,c,b);
		c=c-b;
		// printf("c=%d\n");
			if(c<=0){
			x=2;
			break;
		}
		a=a-d;
		// printf("a=%d\n",a);
		if(a<=0){
			x=1;
			break;
		}
	}
	if(x==1) printf("No\n");
	else printf("Yes\n");
	return 0;
}

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

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }
    int ans = 0;
    for (int j = 0; j < n - 1; ++j) {
        if (a[j] == j + 1) {
            swap(a[j], a[j + 1]);
            ans++;
        }
    }
    if (a[n - 1] == n) ans++;
    cout << ans << endl;
}


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

int main(){
  int n;
  cin>>n;
  while(n--){
    int mp[12][12],ans[12][12];
    for(int i=1;i<=10;i++)for(int j=1;j<=10;j++) cin>>mp[i][j];
    int cp[12][12];

    for(int i=0;i<(1<<10);i++){
      
      for(int j=1;j<=10;j++)
	for(int k=1;k<=10;k++)cp[j][k]=mp[j][k],ans[j][k]=0;
      for(int j=0;j<10;j++){
	if(i&(1<<j)){
	  cp[1][j+1]=!cp[1][j+1];
	  cp[1][j]=!cp[1][j];
	  cp[1][j+2]=!cp[1][j+2];
	  cp[2][j+1]=!cp[2][j+1];
	  ans[1][j+1]=1;
	}
      }
      for(int j=2;j<=10;j++){
	for(int k=1;k<=10;k++){
	  if(cp[j-1][k]){
	    cp[j-1][k]=!cp[j-1][k];
	    cp[j][k]=!cp[j][k];
	    cp[j][k-1]=!cp[j][k-1];
	    cp[j][k+1]=!cp[j][k+1];
	    cp[j+1][k]=!cp[j+1][k];
	    ans[j][k]=1;
	  }
	}
      }
      int f=0;
      for(int j=1;j<=10;j++)
	for(int k=1;k<=10;k++)
	  if(cp[j][k])f=1;
      if(!f)break;
    }

    for(int i=1;i<=10;i++){
      for(int j=1;j<=10;j++){
	if(j!=1)cout<<' ';
	cout<<ans[i][j];
      }
      cout<<endl;
    }
  }
  return 0;
}

Measured memory_bytes: 1160
#include<cstdio>
int main()
{
	int a;
	scanf("%d",&a);
	if(a>7){
		while(1){
			a%=7;
			if(a<=7) break;
		}
	}
	if(a==1) printf("fri\n");
	else if(a==2) printf("sat\n");
	else if(a==3) printf("sun\n");
	else if(a==4) printf("mon\n");
	else if(a==5) printf("tue\n");
	else if(a==6) printf("wed\n");
	else printf("thu\n");
	return 0;
}



Measured memory_bytes: 2692
/*
　　　  ∧＿∧　やあ
　　 （´・ω・｀)　　　　　/　　　　　ようこそ、バーボンハウスへ。
　　 ／∇y:::::＼　　　 [￣]　　　　　このテキーラはサービスだから、まず飲んで落ち着いて欲しい。
　　 |:⊃:|:::::|　　　|──|
￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣|　うん、「また」なんだ。済まない。
￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣|￣　  仏の顔もって言うしね、謝って許してもらおうとも思っていない。
￣￣￣￣￣￣￣￣￣￣￣￣￣￣／|
　　　　∇　∇　∇　∇　　　／.／|　　　でも、この提出を見たとき、君は、きっと言葉では言い表せない
　　　　┴　┴　┴　┴　／ ／　  |　　　「ときめき」みたいなものを感じてくれたと思う。
￣￣￣￣￣￣￣￣￣￣|／　　  |　　　殺伐としたコンテストの中で、そういう気持ちを忘れないで欲しい
￣￣￣￣￣￣￣￣￣￣　　　　 |　　　そう思って、この提出を投げたんだ。
　　　(⊆⊇)　(⊆⊇)　(⊆⊇)　　|
　    ||　　 ||　　||　　|　　　 じゃあ、判定を聞こうか。
　　.／|＼　／|＼ ／|＼
*/

#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <array>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;
#define fst first
#define snd second
#define ALL(obj) (obj).begin(),(obj).end()
#define debug(x) cerr << #x << " -> " << x << " (line:" << __LINE__ << ")" << '\n';
#define debugpair(x, y) cerr << "(" << #x << ", " << #y << ") -> (" << x << ", " << y << ") (line:" << __LINE__ << ")" << '\n';
typedef long long lint;
typedef priority_queue<int> p_que;
typedef priority_queue<int, vector<int>, greater<int>()> p_que_rev;
const lint INF = INT_MAX;
const lint LINF = LLONG_MAX;
const lint MOD = 1000000000 + 7;
const double EPS = 1e-9;
const double PI = acos(-1);
const int di[]{0, -1, 0, 1, -1, -1, 1, 1};
const int dj[]{1, 0, -1, 0, 1, -1, -1, 1};

int main()
{
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    int a, b, n;
    bool isReserved = false;
    cin >> a >> b >> n;
    vector<int> s(n);
    vector<int> f(n);
    vector<lint> sum(1001, 0);
    for (int i=0; i<n; ++i){
        cin >> s[i] >> f[i];
    }
    for (int i=0; i<n; ++i){
        sum[s[i]]++;
        sum[f[i]]--;
    }
    for (int i=1; i<=1000; ++i){
        sum[i] = sum[i-1] + sum[i];
    }
    for (int i=a; i<b; ++i){
        if(sum[i] > 0){
            isReserved = true;
            break;
        }
    }
    if(isReserved){
        cout << 1 << endl;
    }
    else {
        cout << 0 << endl;
    }
    return 0;
}


Measured memory_bytes: 3168
using System;
using System.Linq;//リストの使用
using System.Collections.Generic;
using System.Text;//テキストの高速出力に必要
class Program
{
	static void Main()
	{
		string[] input = Console.ReadLine().Split(' ');
		int h = int.Parse(input[0]);
		int w = int.Parse(input[1]);
    int answer = int.MaxValue;

    int[,,] matrix = new int[h,w,2];
      
    for(int i = 0; i < h; i++)
    {
    	int[] numsa = Array.ConvertAll(Console.ReadLine().Split(' '),int.Parse);
    	for(int j = 0; j < w; j++) matrix[i,j,0] = numsa[j];
    }
    for(int i = 0; i < h; i++)
    {
    	int[] numsb = Array.ConvertAll(Console.ReadLine().Split(' '),int.Parse);
    	for(int j = 0; j < w; j++) matrix[i,j,1] = numsb[j];
    }

    bool[,][] dp = new bool[h,w][];
    for(int i = 0; i < h; i++)
    {
      for(int j = 0; j < w; j++)
      {
        dp[i,j] = new bool[80*(h+w+1)+1];
      }
    }

    for(int i = 0; i < h; i++)
    {
      for(int j = 0; j < w; j++)
      {
        int sub = Math.Abs(matrix[i,j,0]-matrix[i,j,1]);//差
      
        if(i == 0 && j == 0) dp[i,j][sub] = true;

        if(i > 0)
        {
          for(int k = 0; k <= 80*(i+j); k++)
          {
            if(dp[i-1,j][k])
            {
              dp[i,j][k+sub] = true;
              dp[i,j][Math.Abs(k-sub)] = true;
            }
          }
        }

        if(j > 0)
        {
          for(int k = 0; k <= 80*(i+j); k++)
          {
            if(dp[i,j-1][k])
            {
              dp[i,j][k+sub] = true;
              dp[i,j][Math.Abs(k-sub)] = true;
            }
          }
        }
      }
    }

    for(int i = 80*(h+w-1); i >= 0; i--)
    {
      if(dp[h-1,w-1][i]) answer = i;
    }

		Console.WriteLine(answer);
	}
}

Measured memory_bytes: 116288
import std.stdio, std.string, std.array, std.conv, std.algorithm;

int[] factors(int n) {
    int[] result;
    while (n % 2 == 0) {
        result ~= 2;
        n /= 2;
    }
    for (int i = 3; i * i <= n; i += 2) {
        while (n % i == 0) {
            result ~= i;
            n /= i;
        }
    }
    if (n != 1) result ~= n;
    return result[];
}

void main() {
    int n = readln.chomp.to!int;
    int[] a = factors(n).sort.uniq.array;
    foreach (x; a) {
        n = (n * (1 - 1.0 / x)).to!int;
    }
    n.writeln;
}


Measured memory_bytes: 2504
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define MOD 1000000007
using namespace std;
int main()
{
    double r;
    cin >> r;
    cout << setprecision(20) << r * r * M_PI << " " << 2 * r * M_PI << "\n";

    return 0;
}


Measured memory_bytes: 3284
#include <stdio.h>

int main(void) {
	int a, b;
	char op;
	scanf("%d %c %d", &a, &op,&b);
	if (op == '+') {
		a = a + b;
		printf("%d\n",a);
	}
	else if (op == '-') {
		a = a - b;
		printf("%d\n", a);
	}
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define all(x) x.begin(), x.end()
using namespace std;
using ll = long long;
using pii = pair<int, int>;
const int MN = 1e5 + 5;

int main() {
    ios_base::sync_with_stdio(0), cin.tie(0);
    int N; ll D; cin >> N >> D; D *= D;
    int ans = 0;
    for (int i = 0; i < N; i++) {
        ll x, y; cin >> x >> y;
        if (x * x + y * y <= D) ans++;
    }
    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 3596
import sys
a,b,c,d = map(int, list(input()))
x = [1,-1]
for i in x:
  for j in x:
    for k in x:
      if a+i*b+j*c+k*d==7:
        ans = str(a)
        ans += "+" if i==1 else "-"
        ans += str(b)
        ans += "+" if j==1 else "-"
        ans += str(c)
        ans += "+" if k==1 else "-"
        ans += str(d)
        ans += "=7"
        print(ans)
        sys.exit()

Measured memory_bytes: 3064
import sys
sys.setrecursionlimit(10000000)
MOD = 10 ** 9 + 7
INF = 10 ** 15

def main():
    L = input().split()
    A = int(L[0])
    B = 100 * int(L[1][0]) + int(L[1][2:4])
    print(A*B//100)
if __name__ == '__main__':
    main()

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

#define rep(i, n) for (int i=0; i<(n); ++i)
using ll = long long;
using P = pair<int, int>;

const int MAX = 100003;
vector<int> G[MAX];
int color[MAX];
int n;

void dfs(int s, int id) {
  stack<int> S;
  S.push(s);
  color[s] = id;

  while (!S.empty()) {
    int u = S.top(); S.pop();
    rep(i,G[u].size()) {
      int v = G[u][i];
      if (color[v] == -1) {
	color[v] = id;
	S.push(v);
      }
    }
  }
}

void assignColor() {
  int id = 1;
  memset(color, -1, sizeof(color));
  rep(u,n) {
    if (color[u] == -1) dfs(u, id++);
  }
}

int main() {
  int m, s, t;
  cin >> n >> m;
  rep(i,m) {
    cin >> s >> t;
    G[s].push_back(t);
    G[t].push_back(s);
  }

  assignColor();

  int q;
  vector<bool> ans;
  cin >> q;
  rep(i,q) {
    cin >> s >> t;
    if (color[s] == color[t]) ans.push_back(true);
    else ans.push_back(false);
  }
  rep(i,q) {
    cout << (ans[i] ? "yes" : "no") << endl;
  }
  return 0;
}



Measured memory_bytes: 8904
import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		double[] x = new double[1001];
		double[] y = new double[1001];
		double l = Math.sqrt(2);
		double ang = Math.PI / 4;
		x[0] = 0;
		for(int i = 1; i <= 1000; i++) {
			x[i] = l * Math.cos(ang);
			y[i] = l * Math.sin(ang);
			double a = l;
			double b = Math.sqrt(a * a + 1);
			double th = Math.acos((a * a + b * b - 1) / (2 * a * b));
			ang += th;
			l = b;
		}
//		for(int i = 0; i < 5; i++) {
//			System.out.printf("%f %f\n", x[i], y[i]);
//		}
		Scanner sc = new Scanner(System.in);
		while(sc.hasNext()) {
			int n = sc.nextInt();
			if(n == -1) break;
			System.out.println(x[n - 1]);
			System.out.println(y[n - 1]);
		}
		sc.close();
	}
}


Measured memory_bytes: 25916
#include<iostream>
#define MAX_N 200050
#define ll long long

using namespace std;

ll dp[110][MAX_N];
ll w[110];
ll v[110];

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

Measured memory_bytes: 81952
#include<iostream>
using namespace std;
int main(){
    int n;
    cin >> n;
    int ans = 9999999;
    for(int i=0;i<n;i++){
        int a;
        cin >> a;
        int cnt=0;
        while(a%2==0){
            cnt++;
            a/=2;
        }
        ans = min(ans,cnt);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
from collections import Counter

N = int(input())
V = list(map(int,input().split()))

even = Counter(V[1::2]).most_common() + [(0, 0)]
odd = Counter(V[::2]).most_common() + [(0, 0)]

if even[0][0] != odd[0][0]:
  print(N-even[0][1]-odd[0][1])
else:
  print(min(N-even[0][1]-odd[1][1], N-even[1][1]-odd[0][1]))

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

ll gcd(ll n, ll m) {
    if(n % m== 0) {
        return m;
    }
    return gcd(m, n%m);
}
int main() {
    ios :: sync_with_stdio(false);
    ll N, X, ans;
    cin >> N >> X;
    ans = 3*(N - gcd(N, X));
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,ini,n) for(int i=ini;i<n;i++)
#define _rep(i,ini,n) for(int i=ini;i>=n;i--)
#define ToEnd(a) a.begin(),a.end()
uint64_t MOD=1000000007;

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

    vector<vector<int64_t>> Dp(2,vector<int64_t>(2019,0));
    int64_t ans=0;
    rep(i,0,S.size()){
        int n=S.at(i)-'0';
        rep(j,0,2019) Dp.at(i&1).at(j)=0;
        rep(j,0,2019) Dp.at(i&1).at((j*10+n)%2019)+=Dp.at(!(i&1)).at(j);
        Dp.at(i&1).at(n)++;
        ans+=Dp.at(i&1).at(0);
    }

    cout<<ans<<endl;
}

Measured memory_bytes: 3708
#include <cstdio>
#include <iostream>
#include <cmath>
#include <ctype.h>
#include <string> 
#include <sstream>
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#include <set>
#include <iomanip>
  
using namespace std;

#define pi 3.141592653589793

bool isfinish(char p[8][8][8], int n, int m, int z[8][8], int x, int y)
{
	int dx[13] = {1, 0, 0, 1, 1, 0, 0, 1, -1, 1, 1, -1, 1};
	int dy[13] = {0, 1, 0, 1, -1, 1, 1, 0, 0, 1, 1, 1, -1};
	int dz[13] = {0, 0, 1, 0, 0, 1, -1, 1, 1, 1, -1, 1, 1};
	for(int i = 0; i < 13; i++){
		int ballnum = 1;
		int nx = x + dx[i], ny = y + dy[i], nz = z[x][y] - 1 + dz[i];
		char c = p[x][y][z[x][y] - 1];
		while(nx > 0 && ny > 0 && nz > 0 && nx <= n && ny <= n && nz <= z[nx][ny] - 1 && c == p[nx][ny][nz]){
			ballnum++;
			nx += dx[i];
			ny += dy[i];
			nz += dz[i];
		}
		nx = x - dx[i];
		ny = y - dy[i];
		nz = z[x][y] - 1 - dz[i];
		while(nx > 0 && ny > 0 && nz > 0 && nx <= n && ny <= n && nz <= z[nx][ny] - 1 && c == p[nx][ny][nz]){
			ballnum++;
			nx -= dx[i];
			ny -= dy[i];
			nz -= dz[i];
		}
		// cout << ballnum << endl;
		if(ballnum >= m) return true;
	}
	return false;
}

int main()
{
	int n, m, p;
	while(1){
		cin >> n >> m >> p;
		if(n == 0 && m == 0 && p == 0) break;
		char puzzle[8][8][8];
		int height[8][8];
		for(int i = 1; i < n + 1; i++){
			for(int j = 1; j < n + 1; j++){
				height[i][j] = 1;
				for(int k = 1; k < n + 1; k++){
					puzzle[i][j][k] = 'n';
				}
			}
		}
		// height[i][j]: (x, y) = (i, j)の現在の高さ、次に玉が置かれる位置
		int x, y;
		int ans = -1;
		for(int i = 0; i < p; i++){
			cin >> x >> y;
			if(ans != -1) continue;
			if(i % 2 == 0) puzzle[x][y][height[x][y]] = 'b';
			else puzzle[x][y][height[x][y]] = 'w';
			height[x][y]++;
			if(p < 2 * (m - 1) + 1) continue;
			if(isfinish(puzzle, n, m, height, x, y)) ans = i + 1;
		}
		if(ans == -1) cout << "Draw" << endl;
		else if(ans % 2 == 1) cout << "Black" << " " << ans << endl;
		else cout << "White" << " " << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 1168
n,l=map(int,input().split())
lst=[]
for i in range(l, n+l):
  lst.append(i)
total = sum(lst)
gap = 10000000
digit=0
for j in range(len(lst)):
  if abs(lst[j])<gap:
    gap=abs(lst[j])
    digit = j
del lst[digit]
print(sum(lst))

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

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define eb emplace_back

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

int n, m;
const int maxn = 1e5 + 5;
int deg[maxn];
int cnt[maxn];
vector<int> G[maxn];

bool dfs(int u, int fa, int st, int ed){
    if(u == st)
        return false;
    else if(u == ed)
        return true;
    for(auto v : G[u]){
        if(v == fa)
            continue;
        return dfs(v, u, st, ed);
    }
    return false;
}

void solve(){
    vector<int> a;
    for(int i = 1;i <= n;i++){
        if(deg[i] == 4){
            a.push_back(i);
        }
    }
    bool ok = true;
    for(auto v : G[a[0]]){
        ok &= dfs(v, a[0], a[0], a[1]);
    }
    if(ok){
        cout << "No" << endl;
    }else{
        cout << "Yes" << endl;
    }
}

int main(){
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    cin >> n >> m;
    for(int i = 1;i <= m;i++){
        int u, v;
        cin >> u >> v;
        deg[u]++, deg[v]++;
        G[u].push_back(v);
        G[v].push_back(u);
    }
    int mx = 0;
    for(int i = 1;i <= n;i++){
        cnt[deg[i]]++;
        mx = max(mx, deg[i]);
        if(deg[i] & 1){
            cout << "No" << endl;
            return 0;
        }
    }
    if(mx > 4){
        cout << "Yes" << endl;
    }else{
        if(mx == 2){
            cout << "No" << endl;
        }else{
            if(cnt[4] > 2){
                cout << "Yes" << endl;
            }else if(cnt[4] < 2){
                cout << "No" << endl;
            }else{
                solve();                
            }
        }
    }
    return 0;
}


Measured memory_bytes: 6144
#include "bits/stdc++.h"

using namespace std;

using ll = long long;
using ld = long double;
using P = pair<int, int>;
constexpr ld EPS = 1e-12;
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr int MOD = 1e9 + 7;

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

    ll b;
    while (cin >> b, b)
    {
        ll st, gt;
        for (ll len = 1; len * len <= 3 * b; len++)
        {
            if ((2 * b) % len != 0)
                continue;
            ll tmp = 2 * b / len;
            tmp += 1 - len;
            if (tmp % 2)
                continue;
            tmp /= 2;
            if (tmp <= 0)
                continue;
            st = tmp;
            gt = len;
        }
        cout << st << " " << gt << endl;
    }
}



Measured memory_bytes: 3208
n = int(input())
ANS = []
A = [2, 10, 3, 9, 4, 8, 6, 12]
if n == 3:
    print(2, 5, 63)
else:
    p = n // 8
    r = n % 8
    ANS += [12 * i + a for a in A for i in range(p)]
    ANS += [12 * p + a for a in A[:r]]
    if r % 2 == 1:
        ANS.pop()
        ANS.append(12 * p + 12)
    print(*ANS)

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

int vis[100005];

int main()
{
	memset(vis,0,sizeof(vis));
	int x,n,k,q;
	scanf("%d%d%d",&n,&k,&q);
	
	for(int i = 0;i < q;++i){
		scanf("%d",&x);
		vis[x]++;
	}
	
	for(int i = 1;i <= n;++i){
		int t = q - vis[i];
		if(k - t > 0) printf("Yes\n");
		else printf("No\n");
	}
	return 0;
}

Measured memory_bytes: 1024
#include<cstdio>
#include<cmath>
#include<string.h>
#include<algorithm>
using namespace std;

bool check(int a, int b, int c){
	if(a==c)	return false;
	if(a==b&&b!=c)	return true;
	if(a!=b&&b==c)	return true;
	else	return false;
}

int main()
{
	int a, b, c;
	while(scanf("%d%d%d", &a, &b, &c)!=EOF){
		if(a>b)	swap(a,b);
		if(a>c)	swap(a,c);
		if(b>c)	swap(b,c);
		if(check(a,b,c))	printf("Yes\n");
		else				printf("No\n");
	}
	
	return 0;	
} 

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

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

using namespace std;

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

    
    int cnt0=0,cnt1=0;
    for (int i=0;i<S.size();i++) {
        int n = S[i]-'0';
        // start with 0
        cnt0 += abs(n - i%2);
        // start with 1
        cnt1 += abs(n - (i+1)%2);
    }

    cout << min(cnt0, cnt1) << endl;

    return 0;
}

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

double calc(double x, double v, double l, double r) {
	if (0 <= x and x < l) return v+(l-x);
	else if (l <= x and x <= r) return v;
	else return v+(x-r);
}

// i read the editorial for this
int main () {
	cout.precision(9);
	cout << fixed;
	int n; cin >> n;
	int t[n+2], v[n+2], pt[n+2]; // pt is just a prefix sum
	int T = 0;
	t[0] = v[0] = pt[0] = 0;
	for (int i = 1; i <= n; i++) {
		cin >> t[i];
		pt[i] = pt[i-1] + t[i];
	}
	for (int i = 1; i <= n; i++)
		cin >> v[i];
	t[n+1] = 0; pt[n+1] = pt[n]; v[n+1] = 0;
	double ans = 0;
	for (double i = 0; i < pt[n+1]; i += 0.5) {
		double vmin0 = calc(i, v[0], pt[0], pt[0]);
		double vmin1 = calc(i+0.5, v[0], pt[0], pt[0]);
		for (int j = 1; j <= n; j++) {
			vmin0 = min(vmin0, calc(i, v[j], pt[j-1], pt[j]));
			vmin1 = min(vmin1, calc(i+0.5, v[j], pt[j-1], pt[j]));
		}
		vmin0 = min(vmin0, calc(i, v[n+1], pt[n+1], pt[n+1]));
		vmin1 = min(vmin1, calc(i+0.5, v[n+1], pt[n+1], pt[n+1]));
		// cout << i << ' ' << vmin0 << ' ' << vmin1 << endl;
		ans += 0.5*(vmin0+vmin1)*0.5; // 0.5*(top+bottom)*h
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
N = int(input())
S = input()

cnt = 0

for i in range(1000):
    if 0 <= i < 10:
        a = "00" + str(i)
    elif 10 <= i < 100:
        a = "0" + str(i)
    elif 100 <= i:
        a = str(i)
    
    idx = 0
    for j in range(N):
        if S[j] == a[idx]:
            idx += 1
            if idx == 3:
                cnt += 1
                break

print(cnt)

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

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

int main(void) {
    int n, d, x, a, ans = 0;

    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n;
    cin >> d >> x;
    REP(i, n) {
        cin >> a;
        REP(j, d) {
            if (j % a == 0) {
                ans++;
            }
        }
    }
    
    cout << ans + x << "\n";
    return 0;
}

Measured memory_bytes: 256
#! /usr/bin/env python3

n, m = map(int, input().split())
p = [int(i) for i in input().split()]
pairs = [[int(i) for i in input().split()] for _ in range(m)]

parents = [i for i in range(n + 1)]

def ufRoot(a):
    global parents
    if parents[a] == a:
        return(a)
    else:
        parents[a] = ufRoot(parents[a])
        return parents[a]

def ufFind(a, b):
    return ufRoot(a) == ufRoot(b)

def ufUnite(a, b):
    global parents
    a = ufRoot(a)
    b = ufRoot(b)
    if (a == b):
        return
    parents[a] = b

for pp in pairs:
    if ufFind(pp[0], pp[1]) == False:
        ufUnite(pp[0], pp[1])

for i in range(len(parents)):
    parents[i] = ufRoot(parents[i])


uniques = list(set(parents))
dict_ids = {}
dict_values = {}

for u in uniques:
    dict_ids[u] = []
    dict_values[u] = []

for i in range(n):
    dict_ids[parents[i + 1]].append(i + 1)
    dict_values[parents[i + 1]].append(p[i])

res = 0
for u in uniques:
    sets = set(dict_ids[u]).intersection(dict_values[u])
    res += len(sets)

print(res)


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

// Inserted snippets: io, root
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
template<typename H> bool chmin(H& v1, const H v2) { if (v1 > v2) { v1 = v2; return true; } return false; }
template<typename H> bool chmax(H& v1, const H v2) { if (v1 < v2) { v1 = v2; return true; } return false; }
template<typename H> void read(H& head) { cin >> head; }
template<typename H, typename ...T> void read(H& head, T& ...tail) { cin >> head; read(tail...); }
template<typename H> void write(H head) { cout << head << '\n'; }
template<typename H, typename ...T> void write(H head, T ...tail) { cout << head << " "; write(tail...); }
template<typename ...T> void die(T ...tok) { write(tok...); exit(0); }
// End snippets

int main() {
	cin.tie(0)->sync_with_stdio(0);
	cin.exceptions(cin.failbit);

	int l, r, d; read(l, r, d);
	int a = 0;
	rep(i, l, r + 1) if (i % d == 0) a++;
	write(a);
}


Measured memory_bytes: 3636
# 頂点を3回ずつに持つ (x歩目の着地）
# 最短路

import sys
input = sys.stdin.readline
N,M = map(int,input().split())
if M == 0:
  print(-1)
  exit()
edge = [[] for _ in range(N+1)]
for _ in range(M):
  u,v = map(int,input().split())
  edge[u].append(v)
S,T = map(int,input().split())

INF = 10 ** 9
dist = [[INF,INF,INF] for _ in range(N+1)]

d = 0
q = [S]
while q:
  d += 1
  r = d % 3
  qq = []
  for u in q:
    for v in edge[u]:
      if dist[v][r] == INF:
        dist[v][r] = d
        qq.append(v)
  q = qq

d = dist[T][0]
answer = -1 if d == INF else d // 3
print(answer)


Measured memory_bytes: 42328
#include <iostream>
#include <stdio.h>
#include <vector>
#include <string>
#include <map>
#include <math.h>
#include <algorithm>
#include <queue>
#include <tuple>

using namespace std;

#define INT_MAX 2147483647
typedef long long ll;

ll gcd(ll m, ll n);
ll lcm(ll m, ll n);

int main(void) {

	string ans = "Yes";
	
	int a, b;
	cin >> a >> b;

	if (a % 2 == 0 || b % 2 == 0) ans = "No";


	cout << ans << endl;	

	return 0;

}

// 2番目から3要素だけ抜き出した部分文字列を取得する
//std::string result = s.substr(2, 3);  
#if 1
//最大公倍数
ll gcd(ll m, ll n)
{
	ll temp;
	while (m % n != 0)
	{
		temp = n;
		n = m % n;
		m = temp;
	}
	return n;
}

//最小公倍数
ll lcm(ll m, ll n)
{
	return m * n / gcd(m, n);
}
#endif

Measured memory_bytes: 256
#include <iostream>
#include <cstdint>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int, int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define irep(it, stl) for (auto it = stl.begin(); it != stl.end(); it++)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define mes(a) cout << (a) << endl
#define dmes(a, b) cout << (a) << " " << (b) << endl

#define CHOOSE(a) CHOOSE2 a
#define CHOOSE2(a0,a1,a2,a3,a4,x,...) x
#define debug_1(x1) cout<<#x1<<": "<<x1<<endl
#define debug_2(x1,x2) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<endl
#define debug_3(x1,x2,x3) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<endl
#define debug_4(x1,x2,x3,x4) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<", "#x4<<": "<<x4<<endl
#define debug_5(x1,x2,x3,x4,x5) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<", "#x4<<": "<<x4<<", "#x5<<": "<<x5<<endl
#ifdef _DEBUG
#define debug(...) CHOOSE((__VA_ARGS__,debug_5,debug_4,debug_3,debug_2,debug_1,~))(__VA_ARGS__)
#else
#define debug(...)
#endif

#define ynmes(a) (a) ? mes("Yes") : mes("No")
#define YNmes(a) (a) ? mes("YES") : mes("NO")
#define re0 return 0
#define mp(p, q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define rSort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int;
int dx[8] = { 1, 0, -1, 0, 1, -1, -1, 1 };
int dy[8] = { 0, 1, 0, -1, 1, 1, -1, -1 };
template <class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template <class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
struct io { io() { ios::sync_with_stdio(false); cin.tie(0); } };
const int INF = INT_MAX;
const ll LLINF = 1LL << 60;
const ll MOD = 1000000007;
const double EPS = 1e-9;

signed main(void)
{    
    ll n;
    cin >> n;
    ll r = 0;
    rep(i, n) {
        ll a, b;
        cin >> a >> b;
        r += (b-a+1);
    
    }
	
    mes(r);
    
    
    
    
    
    
    
}



Measured memory_bytes: 3552
import sys

input_methods=['clipboard','file','key']
using_method=0
input_method=input_methods[using_method]

IN=lambda : map(int, input().split())
mod=1000000007

#+++++

def main():
	n,r = IN()
	ret = r + (100 * (10 - min(10, n)))
	
	print(ret)
	
	
#+++++
isTest=False

def pa(v):
	if isTest:
		print(v)
		
def input_clipboard():
	import clipboard
	input_text=clipboard.get()
	input_l=input_text.splitlines()
	for l in input_l:
		yield l

if __name__ == "__main__":
	if sys.platform =='ios':
		if input_method==input_methods[0]:
			ic=input_clipboard()
			input = lambda : ic.__next__()
		elif input_method==input_methods[1]:
			sys.stdin=open('inputFile.txt')
		else:
			pass
		isTest=True
	else:
		pass
		#input = sys.stdin.readline
			
	ret = main()
	if ret is not None:
		print(ret)

Measured memory_bytes: 38384
dec1 [] = []
dec1 (s:sx) = 
  let d = case s of
            'A' -> [0,0,0,0,0]
            'B' -> [0,0,0,0,1]
            'C' -> [0,0,0,1,0]
            'D' -> [0,0,0,1,1]
            'E' -> [0,0,1,0,0]
            'F' -> [0,0,1,0,1]
            'G' -> [0,0,1,1,0]
            'H' -> [0,0,1,1,1]
            'I' -> [0,1,0,0,0]
            'J' -> [0,1,0,0,1]
            'K' -> [0,1,0,1,0]
            'L' -> [0,1,0,1,1]
            'M' -> [0,1,1,0,0]
            'N' -> [0,1,1,0,1]
            'O' -> [0,1,1,1,0]
            'P' -> [0,1,1,1,1]
            'Q' -> [1,0,0,0,0]
            'R' -> [1,0,0,0,1]
            'S' -> [1,0,0,1,0]
            'T' -> [1,0,0,1,1]
            'U' -> [1,0,1,0,0]
            'V' -> [1,0,1,0,1]
            'W' -> [1,0,1,1,0]
            'X' -> [1,0,1,1,1]
            'Y' -> [1,1,0,0,0]
            'Z' -> [1,1,0,0,1]
            ' ' -> [1,1,0,1,0]
            '.' -> [1,1,0,1,1]
            ',' -> [1,1,1,0,0]
            '-' -> [1,1,1,0,1]
            '\''-> [1,1,1,1,0]
            '?' -> [1,1,1,1,1]
  in
    d++(dec1 sx)

dec2 (0:0:0:1:y)         = 'D':(dec2 y)
dec2 (0:0:1:0:0:y)       = 'L':(dec2 y)
dec2 (0:0:1:0:1:y)       = 'O':(dec2 y)
dec2 (0:0:1:1:0:y)       = 'S':(dec2 y)
dec2 (0:0:1:1:1:y)       = 'T':(dec2 y)
dec2 (0:0:0:0:0:0:y)     = '\'':(dec2 y)
dec2 (0:0:0:0:1:1:y)     = ',':(dec2 y)
dec2 (0:0:0:0:0:1:y)     = '?':(dec2 y)
dec2 (0:0:0:0:1:0:y)     = 'W':(dec2 y)
dec2 (0:1:0:0:0:0:y)     = 'H':(dec2 y)
dec2 (0:1:0:0:0:1:y)     = '.':(dec2 y)
dec2 (0:1:0:0:1:y)       = 'F':(dec2 y)
dec2 (0:1:0:1:y)         = 'C':(dec2 y)
dec2 (0:1:1:0:y)         = 'K':(dec2 y)
dec2 (0:1:1:1:y)         = 'I':(dec2 y)
dec2 (1:0:0:0:y)         = 'R':(dec2 y)
dec2 (1:0:0:1:0:0:0:0:y) = 'Z':(dec2 y)
dec2 (1:0:0:1:0:0:0:1:y) = '-':(dec2 y)
dec2 (1:0:0:1:0:0:1:0:y) = 'X':(dec2 y)
dec2 (1:0:0:1:0:0:1:1:y) = 'Y':(dec2 y)
dec2 (1:0:0:1:0:1:y)     = 'A':(dec2 y)
dec2 (1:0:0:1:1:0:0:0:y) = 'J':(dec2 y)
dec2 (1:0:0:1:1:0:0:1:y) = 'M':(dec2 y)
dec2 (1:0:0:1:1:0:1:0:y) = 'B':(dec2 y)
dec2 (1:0:0:1:1:0:1:1:y) = 'G':(dec2 y)
dec2 (1:0:0:1:1:1:0:0:y) = 'U':(dec2 y)
dec2 (1:0:0:1:1:1:0:1:y) = 'V':(dec2 y)
dec2 (1:0:0:1:1:1:1:0:y) = 'N':(dec2 y)
dec2 (1:0:0:1:1:1:1:1:y) = 'Q':(dec2 y)
dec2 (1:0:1:y)           = ' ':(dec2 y)
dec2 (1:1:0:y)           = 'E':(dec2 y)
dec2 (1:1:1:y)           = 'P':(dec2 y)
dec2 _ = []

ans s =
  let d1 = dec1 s
      d2 = dec2 d1
  in
    d2

main = do
  c <- getContents
  let l = lines c
      o = map ans l
  mapM_ putStrLn o

Measured memory_bytes: 4356
import java.io.*;
import java.util.*;

public class Main { // "Main" should be used for most online judges
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int nestValue = sc.nextInt();
		int result = 0;
		
		for (int i = 0; i <= nestValue; i++) {
			if(maxValue(i) >= nestValue) {
				result = i;
				 i = nestValue;
			}
		}
		
		System.out.println(result);
		sc.close();
	}
	
	public static int maxValue(int n) {
		int max = 0;
		for (int i = 1; i <= n; i++) {
			max += i;
		}
		return max;
	}
}

Measured memory_bytes: 21844
//Author : Vivek Dubey
#include <bits/stdc++.h>
using namespace std;

#define int long long 

int32_t main() {
	#ifndef ONLINE_JUDGE
	    // for getting input from input.txt
		freopen("input.txt", "r", stdin);
	    // for writing output to output.txt
	    //this can be opted out if you want to print the output to the sublime console
		freopen("output.txt", "w", stdout);
	#endif

	// for fast i/o
	ios_base::sync_with_stdio(false); 
	cin.tie(NULL); 
	cout.tie(NULL);

	// test cases
	int t = 1;
	// cin >> t;
	int a, b, c, d;
	while(t--) {
		cin >> a >> b >> c >> d;
		cout << max({a * c, a * d, b * c, b * d});
	}

	return 0;
}

Measured memory_bytes: 3644
#include <iostream>
using namespace std;
int main(void){
    int n;
    cin >> n;
    int ai[n];
    long long count[100001];
    for(int i=0;i<100001;i++){
        count[i]=0;
    }
    long long sum=0;
    for(int i=0;i<n;i++){
        int t;
        cin >> t;
        count[t]++;
    }
    for(int i=0;i<100001;i++){
        sum+=i*count[i];
    }
    int q;
    cin >> q;
    long long sums[q];
    for(int i=0;i<q;i++){
        long long bi, ci;
        cin >> bi >> ci;
        sum-=bi*count[bi];
        count[ci]+=count[bi];
        sum+=ci*count[bi];
        count[bi]=0;
        sums[i]=sum;
    }
    for(int i=0;i<q;i++){
        cout << sums[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 5144
/*
Author: CNYALI_LK
LANG: C++
PROG: D.cpp
*/
#include<bits/stdc++.h>
#define debug(...) fprintf(stderr,__VA_ARGS__)
#define all(x) x.begin(),x.end()
using namespace std;
const double eps=1e-8;
const double PI=acos(-1.0);
typedef long long ll;
template<class T>void chkmin(T &a,T b){a=a<b?a:b;}
template<class T>void chkmax(T &a,T b){a=a>b?a:b;}
template<class T>T sqr(T a){return a*a;}
template<class T>T mmin(T a,T b){return a<b?a:b;}
template<class T>T mmax(T a,T b){return a>b?a:b;}
template<class T>T aabs(T a){return a<0?-a:a;}
int a[102424];
int main(){
#ifdef cnyali_lk
	freopen("in.txt","r",stdin);
	freopen("out.txt","w",stdout);
#endif
	int n,x,tot=0;
	scanf("%d",&n);
	for(int i=1;i<=n;++i){
		scanf("%d",&x);
		if(x==i)a[i]=1;
	}
	for(int i=1;i<=n;++i)if(a[i]){
		++tot;a[i]=a[i+1]=0;
	}
	printf("%d\n",tot);
	return 0;
}



Measured memory_bytes: 640
#include<iostream>

using namespace std;

#define N 1000000

int A[N],n;

int search(int key){
  int l=0,r=n,mid;

  while(l<r){
    mid=(l+r)/2;
    if(key==A[mid]) return 1;
    if(key>A[mid]) l=mid+1;
    else if(key < A[mid]) r=mid;

  }

  return 0;
}

int main(){
  int q,k,sum=0;

cin >> n;

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

cin >> q;

for(int i=0;i<q;i++){
  cin >> k;
  if(search(k)) sum++;
}
cout << sum << endl;

return 0;
}



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

int main()
{
	int N;
	cin >> N;
	int sum = 0;
	vector<int> a(N);
	for (int i = 0; i < N; i++) {
		cin >> a[i];
		sum ^= a[i];
	}
	if (sum == 0) {
		bool ok = false;
		for (int i = 0; i < N; i++) {
			if (a[i] & 1) {
				ok = true;
			}
		}
		puts(ok ? "Alice" : "Bob");
	}
	else if (sum == 1) {
		puts("Bob");
	}
	else {
		puts("Alice");
	}
	return 0;
}



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

int main() {
  long long n;
  bool harshed = false;
  cin >> n;
  int digitSum = 0;
  long long x = n;
  while (x > 0) {
    digitSum += x % 10;
    x /= 10;
  }
  if (n % digitSum == 0) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        while(true){
            int a = sc.nextInt();
            int b = sc.nextInt();
            int c = sc.nextInt();
            
            if(a == -1 && b == -1 && c == -1) break;
            
            int sum = a + b;
            
            char grade;
            
            if(a == -1 || b == -1){
                grade = 'F';
            }else if(sum >= 80){
                grade = 'A';
            }else if(sum >= 65 && sum < 80){
                grade = 'B';
            }else if(sum >= 50 && sum < 65){
                grade = 'C';
            }else if(sum >= 30 && sum < 50){
                if(c >= 50){
                    grade = 'C';
                }else{
                    grade = 'D';
                }
            }else{
                grade = 'F';
            }
            System.out.println(grade);
            
        }
    }
}


Measured memory_bytes: 26376
#define _CRT_SECURE_NO_WARNINGS
#include"bits/stdc++.h"
#ifdef _DEBUG
#define DBG(n) n
#else
#define DBG(n)
#endif
#define INF          1e9
#define INFLL        1e18
#define EPS          1e-9
#define MOD          1000000007
#define REP(i,n)     for(ll i=0,i##_len=(n);i<i##_len;++i)
#define REP1(i,n)    for(ll i=1,i##_len=(n);i<=i##_len;++i)
#define REPR(i,n)    for(ll i=(n)-1;i>=0;--i)
#define REPR1(i,n)   for(ll i=(n);i>0;--i)
#define REPC(i,obj)  for(auto i:obj)
#define ALL(obj)     (obj).begin(),(obj).end()
#define SETP(n)      cout<<fixed<<setprecision(n)
#define VV(T,h,w)    move(vector<vector<T>>(h,vector<T>(w)))
#define VVI(T,h,w,i) move(vector<vector<T>>(h,vector<T>(w,i)))
using namespace std;
using ll = long long;
template<typename T = ll>inline T in() { T ret; cin >> ret; return ret; }

signed main()
{
	ll n = in(), k = in();
	ll kdig = k == 0 ? 1 : static_cast<ll>(floor(log2(k) + 1));

	vector<ll>a(n), ones(kdig, 0);
	REP(i, n) {
		scanf("%lld", &a[i]);
		ll a_cop = a[i];
		REP(j, kdig) {
			ones[j] += a_cop & 1LL;
			a_cop >>= 1;
		}
	}

	ll x = 0;
	REPR(i, kdig) {
		ll foo = ((ones[i] * 2 >= n ? 0LL : 1LL) << i);
		if (x + foo <= k)x += foo;
	}

	ll ans = 0;
	REPC(i, a)ans += i ^ x;
	cout << ans << endl;
}

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

public class Main{
	public static void main(String[] args) {
		BufferedReader input = new BufferedReader(new InputStreamReader(System.in));

        try{
        //??¨?????????????????\???????????????????????????????????????????´?????????????

                  //??\????????????????????????????????¨???????????????????????????
        	int Array_input[][]=new int[4][14];
        	     String az=input.readLine();
        	     int a=Integer.parseInt(az);
                 //egara_num?????????????????¨??????
        	     int egara_num=0;
        	     int c=0;
                 //??\????????????a????????°???.?????????Array_input???????´??????\??????
                 for(int s=0;s<a;s++){
			        String ab = input.readLine();
		            String []strAry = ab.split(" ");
		            String b=strAry[0];
                 //?????????????????????????????\??????????????¨??????????????????
		            if(b.equals("S")){
		        	   egara_num=0;
		            }else if(b.equals("H")){
		        	    egara_num=1;
		            }else if(b.equals("C")){
		        	    egara_num=2;
		            }else if(b.equals("D")){
		        	    egara_num=3;
		            }
		             c=Integer.parseInt(strAry[1]);
		             //?????????????????§?????????????´?
                Array_input[egara_num][c]=(egara_num*100)+c;

                //System.out.println(Array_input[egara_num][c]);
                 }

                 int Array[][]=new int[4][14];
                 for(int i=0; i<4; i++){
                     for(int j=1; j<14; j++){
                      		Array[i][j]=(i*100)+j;
                      		//??????Array???????´??????????Array_input???????´?????????????
                      if(Array[i][j]!=(Array_input[i][j])){
                    	 int num=Array[i][j];
                    	if(num<100){
                    		System.out.println("S"+" "+j);
                    	 }else if(num>100&&num<200){
                    		 System.out.println("H"+" "+j);
                    	 }else if(num>200&&num<300){
                    		 System.out.println("C"+" "+j);
                    	 }else{
                    		 System.out.println("D"+" "+j);
                    	 }

                        }

                      }

                     }


		      }catch(IOException e) {   System.out.println("Exception : " + e);
		    }

	//60

	}
}

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

int main(){
  int A, B, C, D;
  cin >> A >> B >> C >> D;
  while (A > 0 && C > 0){
    C -= B;
    A -= D;
  }
  if(C <= 0){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}


Measured memory_bytes: 3564