akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define ll long long int
#define FASTIO std::ios::sync_with_stdio(false);
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define inf 1e18
#define g(x) cout<<x<<" "<<endl;
#define gg(x,y) cout<<x<<" & "<<y<<" "<<endl
#define jam(t) cout<<"Case #"<<t<<": "
#define ggg(x,y,z) cout<<x<<" & "<<y<<" & "<<z<<" "<<endl
#define all(x) x.begin(),x.end()
#define input_from_file  freopen("input.txt", "r", stdin);
#define mod 1000000007ll
#define sz 400005
#define bitcnt(x) __builtin_popcountll(x)
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
using namespace std;
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cout << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}



void solve(){
    string s;
    cin >> s;
    if(s[3] == s[2] && s[4] == s[5]){
        g("Yes");
        return;
    }
    g("No");
}
int main()
{

 
    FASTIO
    cin.tie(NULL);
    fflush(stdout);
    ll t = 1;
   // cin >> t;
    for(ll tcase = 1;tcase <= t;tcase++){
        solve();
        
    }
return 0;
}

Measured memory_bytes: 256
sx, sy, tx, ty = gets.chomp.split.map(&:to_i)
dx = (sx - tx).abs
dy = (sy - ty).abs

puts 'U'*dy + 'R'*dx + 'D'*dy + 'L'*dx + 'L' + 'U'*(dy+1) + 'R'*(dx+1) + 'DR' + 'D'*(dy+1) + 'L'*(dx+1) + 'U'

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

int main(void) {
	int X, Y;
	scanf("%d %d", &X, &Y);
	int award[] = {300000, 200000, 100000, 0};
	if (X == 1 && Y == 1) printf("1000000\n");
	else printf("%d\n", award[min(3, X - 1)] + award[min(3, Y - 1)]);
	return 0;
}


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

int n, a, b;

int main() {
    cin >> n;
    vector<int> c(n);
    for (int i=0;i<c.size();i++) {
      cin >> c.at(i);
    }
    sort(c.begin(), c.end());
    reverse(c.begin(), c.end());
    for (int k=0;k<c.size();k++) {
      if (k%2==0) {
        a += c.at(k);
      } else {
        b += c.at(k);
      }
    }
    cout << a - b << endl;
}

Measured memory_bytes: 256
#include<stdio.h>

#define N 100

int Point[N+1];
int Matrix[N+1][N+1];
int n;

void MatrixChange(void){
 int i,j,k,l;
 for(i = 1;i <= n;i++){
    Matrix[i][i] = 0;
  }
  for(k = 2;k <= n;k++){
    for(i = 1;i <= n-k+1;i++){
      j = i + k -1;
      Matrix[i][j] = 1000000000;
      for(l = i;l <= j-1;l++){
	if(Matrix[i][j] > Matrix[i][l]+Matrix[l+1][j]+Point[i-1]*Point[l]*Point[j]){
	  Matrix[i][j] =  Matrix[i][l]+Matrix[l+1][j]+Point[i-1]*Point[l]*Point[j];
	}
	else{
	  Matrix[i][j] = Matrix[i][j];
	}
      }
    }
  }
}
int main(){

  int i;
  
  scanf("%d",&n);

  for(i = 1;i <= n;i++){
    scanf("%d%d",&Point[i-1],&Point[i]);
  }
  MatrixChange();

  printf("%d\n",Matrix[1][n]);
    
    return 0;
}

Measured memory_bytes: 636
# pragma GCC optimize("O3")
# include <bits/stdc++.h>
# define maxn 100005
# define ll long long
# define clock (clock() * 1000.0 / CLOCKS_PER_SEC)
# define rc(s) return cout << s,0
# define _ ios_base::sync_with_stdio(false);cin.tie(0);cerr.tie(0);cout.tie(0);
# define db(x) cerr << #x << " = " << x << '\n'
# define pb push_back
# define mp make_pair
# define sz(x) (int)((x).size())
# define int ll
using namespace std;
 
vector<pair<int,int>>vec;
int x;
int n;
map<int,int>m;

int32_t main(){_
    //freopen("input","r",stdin);
	cin >> n;
	for(int i = 1;i <= n;i++)
	{
		cin >> x;
		m[x]++;
	}
	for(auto it : m)
	{
		if(it.second >= 2) vec.pb(it);
	}
	sort(vec.rbegin(),vec.rend());
	if(sz(vec) == 0) rc(0);
	if(vec[0].second >= 4) rc(vec[0].first * vec[0].first);
	if(sz(vec) == 1) rc(0);
	rc(vec[0].first * vec[1].first);
}

Measured memory_bytes: 6528
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define ff first
#define ss second
#define inf 1000000000
#define IOS ios_base::sync_with_stdio(0);cin.tie(0)
#define meM(y,a) memset(y,a,sizeof y)
#define sC(a) scanf("%d",&a)
#define alL(a) a.begin(),a.end()
#define prinT(a,sz)  cout<<a[0];for(int i=1;i<sz;i++)cout<<" "<<a[i];cout<<endl
#define ranD srand(chrono::steady_clock::now().time_since_epoch().count());
typedef pair<int,int>pi;
typedef pair<ll,ll>pll;
//int fy[]={1,-1,0,0};
//int gx[]={0,0,1,1,1,-1,-1,-1};
//int gy[]={1,-1,0,1,-1,0,1,-1};
const int N=1003;
char adj[N][N];
int ans[N][N];
int main()
{
    IOS;
    int n,m,k;cin>>n>>m>>k;
    for(int i=0;i<n;i++)
        for(int j=0;j<m;j++)
            cin>>adj[i][j];
    int cnt=0;
    int first=inf;
    for(int i=0;i<n;i++)
    {
        int r=0,l=0;
        while(r<m)
        {
            if(adj[i][r]=='#'){
                first=min(first,i);
                if(cnt<k)
                    cnt++;
                while(l<=r)
                {
                    ans[i][l]=cnt;
                    l++;
                }
            }
            r++;
        }
        if(l!=0)
        {
            while(l<m){
                ans[i][l]=cnt;
                l++;
            }
        }
        if(cnt==k)break;
    }
    for(int i=first-1;i>=0;i--)
        for(int j=0;j<m;j++)ans[i][j]=ans[i+1][j];
    for(int i=first;i<n;i++)
        for(int j=0;j<m;j++)if(ans[i+1][j]==0)ans[i+1][j]=ans[i][j];
    for(int i=0;i<n;i++)
    {
        cout<<ans[i][0];
        for(int j=1;j<m;j++)cout<<" "<<ans[i][j];
        cout<<endl;
    }

}








Measured memory_bytes: 5100
#include <bits/stdc++.h>
#include <math.h>
#define MOD 1000000007
typedef long long int ll;
using namespace std;

int main()
{
    double a, b, x; cin >> a >> b >> x;
    double pi = 3.141592653589;
    double unit = 180.0/pi;
    double ans = atan(a*b*b/2.0/x)*unit;
    double ta = atan(2.0*(a*a*b-x)/a/a/a)*unit;
    int y = x;
    int z = a*a;
    if((double)y/z > b/2) ans = ta;
    
    cout << fixed;
    cout << ans << endl;
    return 0;
}

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

int main() {
    char a; cin >> a;
    if(islower(a)){
        cout << 'a' << endl;
    } else {
        cout << 'A' << endl;
    }

    return 0;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using lint = long long int;
int main()
{
    lint n,m;
    lint sum = 0;
    vector<int> vc;
    cin >> n >> m;
    //for (int i = 0; i<m; i++)
    rep(i,m)
    {
        int x;
        cin >> x;
        sum += x;
    }
    if (sum > n)
        cout << -1;
    else
        cout << (n - sum);
    return 0;
}


Measured memory_bytes: 3624
#include <stdio.h>
#include <math.h>

int main(void)
{
	double d;
	int i;
	double sum;

	while (scanf("%lf", &d) != EOF){
		sum = 0;
		for (i = 1; i * d < 600; i++){
			sum += d * (pow(i * d, 2));
		}
		printf("%.0f\n", sum);
	}

	return (0);
}

Measured memory_bytes: 644
#include <stdio.h>
#include <string.h>


#define	ll_int	long long int
#define	SIZE	32


// 引数：表示する配列、反転するか否か
void Disp(int *box, int inversion)
{
	int i;

	for(i = 0; i < SIZE; i++){
		if(inversion){
			if(box[i])
				printf("0");
			else
				printf("1");
		}else
			printf("%d", box[i]);
	}
	printf("\n");
}


int main()
{
	ll_int x, tmp;
	int bit_box[SIZE], bit_box_cpy[SIZE];
	int i;

	scanf("%lld", &x);

	// ビット列初期化
	for(i = 0; i < SIZE; i++)
		bit_box[i] = 0;


	// ビットへ変換
	i = 0;
	while( (tmp = x / 2) >= 1){
		bit_box[(SIZE - 1) - i] = x % 2;
		x = tmp;
		i++;
	}
	bit_box[(SIZE - 1) - i] = x;


	/* 表示 */
	// ビット列
	Disp(bit_box, 0);
	// 反転
	Disp(bit_box, 1);

	// 左シフト
	memcpy(bit_box_cpy, bit_box, sizeof(int) * SIZE);
	for(i = 1; i < SIZE; i++)
		bit_box_cpy[i - 1] = bit_box_cpy[i];
	bit_box_cpy[SIZE - 1] = 0;

	Disp(bit_box_cpy, 0);

	// 右シフト
	memcpy(bit_box_cpy, bit_box, sizeof(int) * SIZE);
	for(i = 31; i > 0; i--)
		bit_box_cpy[i] = bit_box_cpy[i - 1];
	bit_box_cpy[0] = 0;

	Disp(bit_box_cpy, 0);

	return 0;
}


Measured memory_bytes: 2084
#include<iostream>
#include<utility>
#include<map>
#include<vector>
#include<set>
#include<math.h>
#include<algorithm>
#include<cstring>
using namespace std;
#define ll long long int 
int main()
{
	string a;
	cin>>a;
	ll sum=0;
	for(int i=0;i<a.length();i++)
	{
		sum=sum+(a[i]-'0');
	}
	if(sum%9==0)
		cout<<"Yes"<<endl;
	else
		cout<<"No"<<endl;
	return 0;
}

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

int main(void)
{
  std::string s;
  std::cin >> s;

  bool flag = false;

  if (s[2] == s[3]) {
    if (s[4] == s[5]) {
      flag = true;
    }
  }

  if (flag) {
    std::cout << "Yes" << std::endl;
  }
  else {
    std::cout << "No" << std::endl;
  }
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
int main(){

  int W, H;
  cin>>W>>H;

  int x, y, r;
  cin>>x>>y>>r;

  if(x - r >= 0 && x + r <= W && y - r >= 0 && y + r <= H) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
  return 0;
}



Measured memory_bytes: 3116
#include <bits/stdc++.h>
using namespace std;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
int main(){
  long long N;
  cin>>N;
  long long M;
  cin>>M;
  long long dp[N+1];
  long long ba[N+1];
  for(long long i = 0;i<=N;i++){
    dp[i] = 0;
    ba[i] = 0;
  }
  for(long long i = 0;i<M;i++){
    long long k;
    cin>>k;
    ba[k] = 1;
  }
  dp[0] = 0;
  if(ba[1] == 0){
    dp[1] = 1;
  }
  else{
    dp[1] = 0;
  }
  if(ba[2] != 1){
    dp[2] = dp[1] + 1;
  }
  
  for(long long i = 3;i<=N;i++){
    if(ba[i] == 1){
      dp[i] = 0;
    }
    else{
      dp[i] = dp[i-1]+dp[i-2];
      dp[i] = dp[i]%1000000007;
    }
  }
  cout << dp[N] << endl;
  return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int A,B;
  cin >> A >> B;
  if(A>=13)
    cout << B << endl;
  else if(A>=6 && A<=12)
    cout << B/2 << endl;
  else
    cout << 0 << endl;
}


Measured memory_bytes: 256
S = input()
for i in range(len(S) // 2):
  if S[i] != S[-1 + i * -1]:
    print('No')
    exit()

for i in range(len(S)//2 //2):
  if S[i] != S[len(S)//2 -1 - i]:
    print('No')
    exit()

for i in range(len(S) // 2 + 1, len(S) // 2 + 1 + len(S)// 2 //2):
  if S[i] != S[-1 + i * -1]:
    print('No')
    exit()
print('Yes')

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define REP(i, n) for (long long i = 0; i < (long long)n; i++)
//#define _GLIBCXX_DEBUG
using namespace std;
using ll = long long;
using Pi = pair<int, int>;
using Pl = pair<ll, ll>;
using Vl = vector<ll>;
using vi = vector<int>;
using Graph = vector<vi>;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  // std::cout << std::fixed << std::setprecision(15); //"for float-base
  // problem"
  int N, K;
  cin >> N >> K;
  vi d(K);
  set<int> S;
  for (int i = 1; i <= N; i++) {
    S.insert(i);
  }
  REP(i, K) {
    cin >> d.at(i);
    REP(j, d.at(i)) {
      int tmp;
      cin >> tmp;
      S.erase(tmp);
    }
  }

  cout << S.size() << endl;
}

Measured memory_bytes: 3668
#include <bits/stdc++.h>
using namespace std;
#define mp make_pair
#define pb push_back
#define fi first
#define se second

int n, W, w[107], v[107];
long long dp[107][100007], ans = 0;

int main(){
	ios_base::sync_with_stdio(0); cin.tie(0);
	cin >> n >> W;
	for(int i = 0; i <= n; i++){
		for(int j = 1; j <= W; j++){
			dp[i][j] = -1e16;
		}
	}
	for(int i = 1; i <= n; i++){
		cin >> w[i] >> v[i];
		for(int j = 0; j <= W; j++){
			dp[i][j] = max(dp[i][j], dp[i - 1][j]);
			if(j + w[i] > W) continue;
			dp[i][j + w[i]] = max(dp[i][j + w[i]], dp[i - 1][j] + v[i]);
		}
	}
	for(int j = 0; j <= W; j++) ans = max(ans, dp[n][j]);
	cout << ans;
}


Measured memory_bytes: 80128
#include<iostream>
#include<string>

using namespace std;
int main()
{
    int a,b;
    cin>>a>>b;
    if(a==1||b==1)
    {
        if(a==2||b==2)
        {
            cout<<"3";
        }
        else
        {
            cout<<"2";
        }
        
    }
    else
    {
        if(a==2||b==2)
        {
            cout<<"1";
        }
        else
        {
            cout<<"2";
        }
    }
    

    cout<<endl;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <math.h>
#include <stdlib.h>
#include <stdio.h>

int main()
{
	double a, b;
	int C;
	double rad;
	scanf("%lf %lf %d", &a, &b, &C);
	
	rad = C * M_PI / 180.0;
	
	printf("%f\n%f\n%f\n",
		0.5 * a * b * sin(rad),
		a + b + sqrt(pow(a, 2) + pow(b, 2) -2 * a * b * cos(rad)),
		b * sin(rad));
	
	return 0;
}

Measured memory_bytes: 652
using System;
using System.Collections.Generic;
using System.Linq;

namespace abc168_v{
    class Program{
        static void Main(string[] args){
            // A B H M
            var input = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
            var tickLengthHour = input[0];
            var tickLengthMinite = input[1];
            var hour = input[2];
            var minite = input[3];

            var clockKakudo = (double)360.0;
            var clockMinite = (double)60.0;
            var clockHour = (double)12.0;

            double tickMiniteKakudo =  clockKakudo / clockMinite * minite;
            double t1 = clockKakudo / clockMinite / clockHour * minite;
            double t2 = clockKakudo / clockHour * hour;
            double tickHourKakudo = t1 + t2;

            double SankakuKakudo;

            if(tickMiniteKakudo > tickHourKakudo){
                var k1 = tickMiniteKakudo - tickHourKakudo;
                if(k1 > 180) {
                    SankakuKakudo = calcKakudo(tickHourKakudo) + calcKakudo(tickMiniteKakudo);
                }else{
                    SankakuKakudo = k1;
                }
            }else{
                var k1 = tickHourKakudo - tickMiniteKakudo;
                if(k1 > 180) {
                    SankakuKakudo = calcKakudo(tickHourKakudo) + calcKakudo(tickMiniteKakudo);
                }else{
                    SankakuKakudo = k1;
                }
            }
            // System.Console.WriteLine("時針長さ: {0} / 分針長さ: {1} / 時針-分針間角度: {2}", tickLengthHour, tickLengthMinite, SankakuKakudo);

            System.Console.WriteLine(YogenTeiri(tickLengthHour, tickLengthMinite, (double)SankakuKakudo));
        }
        public static double YogenTeiri(double A, double B, double cosC){
            double rad = Math.PI * cosC / 180.0;
            // Cについて解く
            // 余弦定理からc^2 = a^2 + b^2 - 2ab cosCなので
            var result = Math.Pow(A, 2) + Math.Pow(B, 2) - 2 * A * B * Math.Cos(rad);
            result = Math.Abs(result);
            return Math.Sqrt(result);          
        }

        public static double calcKakudo(double k){
            if(k > 180){
                return (double)360 - k;
            }else{
                return k;
            }
        }
    }
}


Measured memory_bytes: 28652
n=int(input())
arr=list(map(int,input().split()))
cnt=0
for i in range(n):
  minp=i
  for j in range(i,n):
    if arr[minp]>arr[j]:
      minp=j
  arr[minp],arr[i]=arr[i],arr[minp]
  if minp!=i:
    cnt+=1
print(' '.join(map(str,arr)))
print(cnt)


Measured memory_bytes: 5600
#include <stdio.h>

int insertionSort(int A[],int n,int g)
{
	int i, j, v, cnt=0;
	for(i=g; i<n; i++){
		v = A[i];
		j = i - g;
		while(j>=0 && A[j]>v){
			A[j+g] = A[j];
			j = j - g;
			cnt++;
		}
		A[j+g] = v;
	}
	return cnt;
}

int  shellSort(int A[],int n, int G[], int m)
{
	int i,cnt=0,be;

	for(i=m; i>=0; i--){
		be = insertionSort(A, n, G[i]);
		cnt+=be;
	}
	return cnt;
}

int main(void)
{	
	int n, i, a=1, cnt, j, su;
	int A[1000000];
	int G[100];

	scanf("%d", &n);	
	for(i=0; i<n; i++){
		scanf("%d", &A[i]);
	}
	
	for(i=1;;i++){
		su=(a*3-1)/2;
		if(su>n){break;}
		G[i-1]=su;
		a=a*3;
	}
	i=i-1;
	
	cnt=shellSort(A, n, G, i);

	printf("%d\n", i);
	for(j=i-1; j>0; j--){
		printf("%d ", G[j]);
	}
	printf("%d\n", G[0]);
	printf("%d\n", cnt);

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


Measured memory_bytes: 5676
fun main() {
    val x= readLine()!!.toInt()
    fun judge(n:Int):Boolean{
        var ans=true
        for (i in 2 until Math.sqrt(n.toDouble()).toInt()){
            if (n%i==0){ans=false; break}
        }
        return ans
    }
    var now=x
    while (!judge(now)){now++}
    println(now)
}

Measured memory_bytes: 34584
N=int((input()))

if N%1000==0:
    print(0)
    
else:
  N=str(N)
  a = len(N)
  if a>=3:
        x = int(N[a-3]+N[a-2]+N[a-1])
        print(1000-x)
  elif a==2:
        x = int(N[a-2]+N[a-1])
        print(1000-x)
  else :
        x = int(N[a-1])
        print(1000-x)

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

using ll  = long long;
using pii = pair<int,int>;
#define dbg(n) cout<<'\n'<<#n<<" is "<<n<<'\n';
#define pb push_back
#define all(v) v.begin(), v.end()
#define cs(i) cout<<"Case "<<i+1<<": \n"; 
#define FAST ios_base::sync_with_stdio(false); cin.tie(NULL);

const int N   = 1e5+5;
const int INF = 0x7fffffff;

vector<int>adj[N];
int dp[N]; bool vis[N];

void dfs(int i){
    vis[i]=1;
    if(dp[i]==-1)
        dp[i]=0;
    int maxCost=-1;
    for(int j=0;j<adj[i].size();j++){
        int node=adj[i][j];
        if(!vis[node]){
            dfs(node);
        }
        if(vis[node])
            maxCost=max(maxCost,dp[node]);
    }
    dp[i]=maxCost+1;
}


int main(){
    int n,t,hold=0,m;

    cin>>n>>m;

    for(int i=0;i<m;i++){
        int a,b;
        cin>>a>>b;
        adj[a].pb(b);
    }    
    memset(dp,-1,sizeof dp);
    int maxAns=0;
    for(int i=1;i<=n;i++){
        if(!vis[i])
            dfs(i);
        maxAns=max(maxAns,dp[i]);
    }
   /* dbg(maxAns)
    for(int i=1;i<=n;i++)
        cout<<dp[i]<<" ";*/
    cout<<maxAns<<endl;
    return 0;
}

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

using namespace std;

#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define REV(i,n) for(ll (i) = (n) - 1;(i) >= 0;--i)
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {REP(WW,n)cerr << v[WW] << ' ';cerr << endl << endl;}
#define SHOW2d(v,WW,HH) {REP(W_,WW){REP(H_,HH)cerr << v[W_][H_] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL
#define MOD 998244353

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

#define MAX_V 10000
struct edge{int to;long long cap,rev;};

vector<edge> G[MAX_V];
int level[MAX_V];
int iter[MAX_V];

void add_edge(int from,int to,long long cap){
	G[from].push_back((edge){to,cap,(ll)G[to].size()});
	G[to].push_back((edge){from,0,(ll)G[from].size()-1});
}

void bfs(int s){
	memset(level,-1,sizeof(level));
	queue<int> que;
	level[s] = 0;
	que.push(s);
	while(!que.empty())	{
		int v = que.front();que.pop();
		for(int i = 0;i < G[v].size();++i){
			edge &e = G[v][i];
			if(e.cap > 0 && level[e.to] < 0){
				level[e.to] = level[v] + 1;
				que.push(e.to);
			}
		}
	}
}

int dfs(int v ,int t,long long f){
	if(v == t)return f;
	for(int &i = iter[v];i < G[v].size() ;++i){
		edge &e = G[v][i];
		if(e.cap > 0 && level[v] < level[e.to]){
			long long d = dfs(e.to,t,min(f,e.cap));
			if(d > 0){
				e.cap -= d;
				G[e.to][e.rev].cap += d;
				return d;
			}
		}
	}
	return 0;
}

long long Dinic(int s,int t){
	long long flow = 0;
	while(1){
		bfs(s);
		if(level[t] < 0)return flow;
		memset(iter,0,sizeof(iter));
		long long f;while((f = dfs(s,t,INF)) > 0)flow += f;
	}
}

int main(){

	ll n;cin >> n;
	ll start = 111;
	ll goal = 112;
	ll foundation = INF;

	REP(i, n){
		ll now;cin >> now;
		add_edge(start, i, foundation);
		add_edge(i, goal, foundation - now);

		REP(j, n) {
			 if(i < j && (j + 1) % (i + 1) == 0){
				 add_edge(j, i, LLINF);
			 }
		}
	}

	cout << n * foundation - Dinic(start, goal) << endl;

	return 0;
}


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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

void Main() {
    int N, W;
    cin >> N >> W;
    vector<P> items(N);
    rep(i, N) cin >> items[i].first >> items[i].second;
    vector<vector<ll>> dp(N + 1, vector<ll>(100005, INF));

    rep(i, N + 1) {
        dp[i][0] = 0;
    }
    rep(i, N) {
        rep(j,100005) {
            if (j - items[i].second >= 0) {
                dp[i + 1][j] = min(dp[i + 1][j], dp[i][j - items[i].second] + items[i].first);
            }
            dp[i + 1][j] = min(dp[i + 1][j], dp[i][j]);
        }
    }
    ll ans = 0;
    rrep(i, 100004, 0) {
        if (dp[N][i] <= W) {
            ans = i;
            break;
        }
    }
    cout << ans << '\n';
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 80256
#include <stdlib.h>
#include <stdio.h>

void Constraints(int n,int a[])
{
  for(int i=0;i<n;i++)
  {
    if(!(0<=a[i]&&a[i]<=1000&&n<=100))
    {
      printf("条件を満たす入力をしてください。\n");
      exit(0);
    }
  }
}

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

void Chenger(int n,int a[])
{
  int tmp;
  for(int i=0;i<(n/2);i++)
  {
    int back=n-1-i;
    tmp=a[i];
    a[i]=a[back];
    a[back]=tmp;
  }
}

void PrintArray(int n,int a[])
{
  for(int i=0;i<n;i++){
    printf("%d",a[i]);
    if (i != n-1) {
      printf(" ");
    }
  }
  printf("\n" );
}

int main(int argc, const char * argv[]) {
    int n;
    scanf("%d",&n);
    int a[n];
    ScanArray(n,a);
    Chenger(n,a);
    PrintArray(n,a);
    return 0;
}



Measured memory_bytes: 2104
#include <iostream>
using namespace std;
int main(){
    int n,Y; cin >> n >> Y;
    int a,b,i,j,z,flag=0;
    Y = Y/1000;
    for(i=0; i<=n; i++){
        if (flag==1) break;
        for (j=0; j<=n-i; j++){
            z = n - i - j;
            if (z==(Y-10*i-5*j)) {cout<<i<<" "<<j<<" "<<z<<endl; return 0;}
        }
    }
    puts("-1 -1 -1");
}

Measured memory_bytes: 256
n=int(input())
a=list(map(int,input().split()))
s=[0]
for i in range(n):
  s.append(a[i]+s[-1])
tot=s[-1]
ans=10**12
for i in range(1,n):
  x=s[i]
  y=tot-x
  ans=min(ans,abs(x-y))
print(ans)

Measured memory_bytes: 87120
S = input()
s = len(S)
A = [0]*(s+1)

for i in range(s):
  if S[i] == '<':
    A[i+1] = A[i]+1
    
for j in range(s-1,-1,-1):
  if S[j] == '>':
    A[j] = max(A[j],A[j+1]+1)
    
print(sum(A))
  

Measured memory_bytes: 23336
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
using namespace std;
int main(){
    vector<int> v;
    int n;
    while(1){
        cin>>n;
        if(n==0)    break;
        v.push_back(n);
    }
    for(int i=0; i<v.size(); i++){
        cout<<"Case "<<i+1<<":"<<" "<<v[i]<<endl;
    }
    return 0;
}


Measured memory_bytes: 3188
l = [list(map(int,input().split())) for i in range(3)]
N = int(input())
q = [int(input()) for i in range(N)]

for i in range(3):
  for j in range(3):
    for k in range(N):

      if l[i][j] == q[k]:
        l[i][j] = 0
        
      if l[0][0] == 0 and l[0][1] == 0 and l[0][2] == 0:
        print('Yes')
        exit()
      elif l[1][0] == 0 and l[1][1] == 0 and l[1][2] == 0:
        print("Yes")
        exit()
      elif l[2][0] == 0 and l[2][1] == 0 and l[2][2] == 0:
        print("Yes")
        exit()
      elif l[0][0] == 0 and l[1][1] == 0 and l[2][2] == 0:
        print("Yes")
        exit()
      elif l[0][2] == 0 and l[1][1] == 0 and l[2][0] == 0:
        print("Yes")
        exit()
      elif l[0][0] == 0 and l[1][0] == 0 and l[2][0] == 0:
        print("Yes")
        exit()
      elif l[0][1] == 0 and l[1][1] == 0 and l[2][1] == 0:
        print("Yes")
        exit()
      elif l[0][2] == 0 and l[1][2] == 0 and l[2][2] == 0:
        print("Yes")
        exit()

print('No')


Measured memory_bytes: 9220
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define all(x) (x).begin(), (x).end()

using namespace std;

void solve(int tc) {
	ll a, b, n;
	cin>>a>>b>>n;
	ll ans = (a*n)/b;
	ans -= a*(n/b);
	ll y = n/b;
	n = y*b-1;
	ans = max(ans, (a*n)/b - a*(n/b));
	cout<<ans<<endl;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t = 1;
    // cin>>t;
    for(int tc=1; tc<=t; ++tc) {
        solve(tc);
    }    
    return 0;
}

Measured memory_bytes: 3652
import java.util.*;

public class Main {

    public static void main(String[] args) {
        // write your code here
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        Boolean[][] list = new Boolean[n][n];
        for (int i = 0; i < n; i++) {
            int a = sc.nextInt();
            for (int j = 0; j < a; j++) {
                int x = sc.nextInt();
                int y = sc.nextInt();
                list[i][x - 1] = y == 1;
            }
        }

        int ans = 0;

        calc: for (int i = 0; i < Math.pow(2, n) ; i++) {
            Boolean[] values = new Boolean[n];

            int count = 0;
            for (int j = 0; j < n; j++) {
                values[j] = (1 & i >> j) == 1;
                if (values[j]) {
                    count++;
                }
            }

            for (int j = 0; j < n; j++) {
                boolean is1 = values[j];
                Boolean[] target = list[j];
                for (int k = 0; k < n; k++) {
                    if (target[k] == null || !is1) {
                        continue;
                    }
                    if (target[k] != values[k]) {
                        continue calc;
                    }
                }
            }
            ans = Math.max(count, ans);
        }

        System.out.println(ans);
    }
}


Measured memory_bytes: 24788
n = gets.chomp("").to_i
s = gets.chomp("")

mae = Array.new
ato = Array.new
n.times do |i|
  if n/2 > i
    mae << s[i]
  else
    ato << s[i]
  end
end

if mae.join == ato.join
  puts "Yes"
else
  puts "No"
end

Measured memory_bytes: 1788
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<algorithm>
using namespace std;
int n,a,b,c,d,r,w;
double e,h=0.5,m,l;
int main()
{
    scanf("%d%d%d%d%d",&n,&a,&b,&c,&d);
    e+=c+d;
    e/=2;
    h=e-c;
    m=h*(n-1);
    r=abs(a-b);
    if(r>(n-1)*e+m){printf("NO\n");return 0;}
    w=(int)(r/e);
    l=r-e*w;
    if(n%2)
        if(w%2)
		{
            l=e-l;
            if(l<=m){printf("YES\n");return 0;}
            else{printf("NO\n");return 0;}
        }
        else
            if(l<=m){printf("YES\n");return 0;}
            else{printf("NO\n");return 0;}
    else
        if(w%2)
            if(l<=m){printf("YES\n");return 0;}
            else{printf("NO\n");return 0;}
        else
		{
            l=e-l;
            if(l<=m){printf("YES\n");return 0;}
            else{printf("NO\n");return 0;}
        }
    return 0;
}

Measured memory_bytes: 256
import numpy as np

s = input()
n = len(s)
a = np.arange(n) + np.array([1 if c == 'R' else -1 for c in s])
i = 1
while i < n:
    a = a[a]
    i <<= 1
print(*np.bincount(a, minlength=n))


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

long max(long a, long b) {
  if (a > b) return a;
  return b;
}

long min(long a, long b) {
  if (a < b) return a;
  return b;
}

int main() {
  long n;
  cin >> n;
  std::vector<long> prices(n);
  for (int i = 0; i < n; i++) {
    cin >> prices.at(i);
  }
  long max_profit = prices.at(1) - prices.at(0);
  long min_price = prices.at(0);
  for (int i = 1; i < n; i++) {
    long profit = prices.at(i) - min_price;
    max_profit = max(max_profit, profit);
    min_price = min(min_price, prices.at(i));
  }
  cout << max_profit << endl;
}



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

#define ll long long
#define EPSION numeric_limits<double>::epsilon()
#define REP(i,n) for(int i=0; i<n; ++i)
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

using namespace std;

//ifstream f("input.in");
//ofstream g("output.out");

signed main(int argc, char **argv)
{
    IOS;

    int a, b, c, d, e;
    int li;
    cin>>a>>b>>c>>d>>e>>li;

    if(e - a <= li)
        cout<<"Yay!";
    else
        cout<<":(";

    return 0;
}



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

int main() {
    ll a[3];rep(i,3)cin>>a[i];
    sort(a,a+3);
    int k;cin>>k;
    rep(i,k)a[2]*=2;
    cout<<a[0]+a[1]+a[2]<<endl;
	return 0;
}

Measured memory_bytes: 3528
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl;
#define INF 1000000000
#define mod 1000000007
using ll=long long;
const ll LINF=1001002003004005006ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
// ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return true;}return false;}

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    
    ll n,m,x;cin>>n>>m>>x;
    ll a[n][m],cost[n];
    rep(i,n){
        cin>>cost[i];
        rep(j,m) cin>>a[i][j];
    }
    ll ans=LINF;
    for(int bit=0;bit<(1<<n);bit++){
        vector<ll> v(m,0);
        ll sum=0;
        rep(i,n){
            if((bit>>i)&1){
                sum+=cost[i];
                rep(j,m) v[j]+=a[i][j];
            }
        }

        bool f=true;
        rep(i,m){
            if(v[i]<x) f=false;
        }
        if(f) chmin(ans,sum);
    }
    if(ans==LINF) cout<<-1<<endl;
    else cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3660
#include <stdio.h>

typedef struct __xy {
	double x;
	double y;
} XY, *PXY;

double root(double d, int q);
void printXY(XY p);
XY addXY(XY p1, XY p2);
XY subXY(XY p1, XY p2);
XY mulXY(XY p, double v);
void koch(XY p1, XY p2, int n);

double cos60, sin60, div1p3, div2p3;

int main(void) {
	XY p1 = { 0.0, 0.0 };
	XY p2 = { 100.0, 0.0 };
	int n;
	
	cos60 = 0.5;
	sin60 = root(3.0, 25) / 2.0;
	div1p3 = 1.0 / 3.0;
	div2p3 = 2.0 / 3.0;
	
	scanf("%d", &n);
	
	koch(p1, p2, n);
	printXY(p2);
	
	return 0;
}

void printXY(XY p) {
	printf("%10.8lf %10.8lf\n", p.x, p.y);
}

XY addXY(XY p1, XY p2) {
	XY r = p1;
	r.x += p2.x;
	r.y += p2.y;
	return r;
}

XY subXY(XY p1, XY p2) {
	XY r = p1;
	r.x -= p2.x;
	r.y -= p2.y;
	return r;
}

XY mulXY(XY p, double v) {
	XY r = p;
	r.x *= v;
	r.y *= v;
	return r;
}

double root(double d, int q) {
	double p1 = 0;
	double p2 = d;
	double m, p;
	
	do {
		m = ((p2 - p1) / 2.0) + p1;
		p = m * m;
		if (p > d) {
			p2 = m;
		} else if (p < d) {
			p1 = m;
		} else {
			return m;
		}
		--q;
	} while (q > 0);
	
	return m;
}

void koch(XY p1, XY p2, int n) {
	XY df, p13, p23, t;
	if (n > 0) {
		--n;
		df = subXY(p2, p1);
		p13 = addXY(mulXY(df, div1p3), p1);
		p23 = addXY(mulXY(df, div2p3), p1);
		t.x = df.x * cos60 - df.y * sin60;
		t.y = df.x * sin60 + df.y * cos60;
		t = addXY(mulXY(t, div1p3), p13);
		koch(p1, p13, n);
		koch(p13,  t, n);
		koch(t,  p23, n);
		koch(p23, p2, n);
	} else {
		printXY(p1);
	}
}

Measured memory_bytes: 640
use std::io;

fn main() {
    let N=get_int();
    let K=get_int();
    let mut num=1;
    for n in 0..N {
        if num>K {
            num+=K;
        }else {
            num*=2;
        }
    }
    println!("{}",num);
}

fn get_String()->String{
    let mut s =String::new();
    io::stdin().read_line(&mut s).expect("Fail!");        
    s.trim().to_string()
}

fn get_int()->i32{
    let mut input =String::new();
    io::stdin().read_line(&mut input).expect("Fail!");
    input.trim().to_string().parse().unwrap()
}


Measured memory_bytes: 4352
#include <iostream>
#include <numeric>
#include <math.h>
#include <algorithm>
#include <float.h>
#include <limits>
#include <vector> 
#include <string.h>
#include <iomanip>

#define rep(i,a,n) for(ll int (i) = (a);(i) < (n);(i)++)
#define urep(i,a,n) for(ll int (i) = (a);(i) > (n);(i)--)
#define MOD 1000000007
#define Imax 2147483647
#define ll long long
#define asort(a) sort(a.begin(),a.end());

using namespace::std;

int jo(ll int jxo, ll int jyo){//累乗
	ll int jhogeo = 1;
	rep(jinto,0,jyo) jhogeo=jhogeo*jxo;
	return jhogeo;
}
char tobig(char toxbig){//char大文字化
  return (toxbig-0x20);
}
char tolow(char toxlow){//char小文字化
  return (toxlow+0x20);
}
int ctoi(char cctoi){//char->int
  if('0' <= cctoi && cctoi <= '9') return (cctoi-'0');
  return -1;
}
int gcd(int gcad, int gcbd) {//最大公約数
  if(gcad < gcbd) return gcd(gcbd, gcad);
  int gcrd;
  while ((gcrd=gcad%gcbd)) {
    gcad = gcbd;
    gcbd = gcrd;
  }
  return gcbd;
}
int lcm(int lcam, int lcbm){//最小公倍数
 return (lcam*lcbm)/gcd(lcam,lcbm);
}


int main(){
  int N,M;
  cin>>N>>M;
  int min;
  int max;
  cin>>min>>max;
  int hoge;
  rep(i,1,M){
    cin>>hoge;
    if(hoge>min) min=hoge;
    cin>>hoge;
    if(hoge<max) max=hoge;
  }
  cout<<(max-min>=0?max-min+1:0);
    
}
// int *p = new int[N];

//  vector<int> 変数名(要素数);
//  sort(変数名.begin(),変数名.end());//昇順ソート

// vector<vector<int>> 変数名(左の個数, vector<int>(右の個数));

//


Measured memory_bytes: 256
import sys
readline = sys.stdin.buffer.readline
def even(n): return 1 if n%2==0 else 0

s = readline().rstrip().decode('utf-8')

if "RRR" in s:
    print(3)
elif "RR" in s:
    print(2)
elif "R" in s:
    print(1)
else:
    print(0)

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

typedef long long ll;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define each(itr,c) for(__typeof(c.begin()) itr=c.begin(); itr!=c.end(); ++itr)
#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define pb push_back
#define fi first
#define se second

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

    string ans;

    if(a==0 || b==0) ans="Zero";
    else
    {//a!=0 && b!=0
        if(a>0) ans="Positive";
        else
        {
            //間に0がある
            if(b>=0) ans="Zero";
            else
            {
                ll A=abs(a), B=abs(b);
                if((A-B)%2==0) ans="Negative";
                else ans="Positive";
            }
        }
    }

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


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

#include<boost/multi_array.hpp>
#include<boost/optional.hpp>
#include<boost/range/irange.hpp>
#include<boost/range/algorithm.hpp>
#include<boost/range/adaptors.hpp>
namespace adaptor = boost::adaptors;

// 多倍長テンプレ
/* ---------------------- ここから ---------------------- */
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>
namespace mp = boost::multiprecision;
// 任意長整数型
using Bint = mp::cpp_int;
// 仮数部が1024ビットの浮動小数点数型(TLEしたら小さくする)
using Real = mp::number<mp::cpp_dec_float<1024>>;
/* ---------------------- ここまで ---------------------- */

using ll = long long;
using ull = unsigned long long;

/*
	int N;
	std::cin >> N;
	std::vector<int> vec(N);
	for (auto& v : vec)
	{
		std::cin >> v;
	}
*/

void Main()
{
	int x = 0;
	cin >> x;
	cout << 1 - x;
	return;
}

int main()
{
	std::cin.tie(nullptr);
	std::ios_base::sync_with_stdio(false);
	std::cout << std::fixed << std::setprecision(15);
	Main();
}

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

int main() {
    
	int a, b, c;

	cin >> a;
	cin >> b;
	cin >> c;

	if(a+b == c || b+c == a || c+a == b){
		cout << "Yes" << endl;
	} else{
		cout << "No" << endl;
	}
    
    return 0;
}



Measured memory_bytes: 3608
#include <iostream>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <iterator>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <array>
#include <cmath>
#include <random>
#include <functional>
#include <climits>
using namespace std;
using lint=long long;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin>>n;
  vector<int> v(n);
  for(int i=0;i<n;i++){
    cin>>v[i];
    v[i]-=1;
  }
  int cnt=0;
  for(int i=0;i<n;i++){
    cnt+=v[i];
  }
  cout<<cnt<<endl;
  return 0;
}


Measured memory_bytes: 256
n = int(input())
s = []
five_num = []
ten_num = 0
for i in range(n):
    s.append(int(input()))
    if s[i] % 10 == 0:
        ten_num += 1
    else:
        five_num.append(s[i])

sum_s = sum(s)
if sum_s % 10 != 0:
    print(sum_s)
elif n == ten_num:
    print("0")
else:
    print(sum_s - min(five_num))

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MAXN = (int)1e5+10;
const ll MOD = (int)1e9+7;
ll fac[MAXN];
int main()
{


    int n,m;
    cin>>n>>m;
    if(n<m)swap(n,m);
    if(n-m>1)printf("0\n");
    else {
        fac[1]=fac[0]=1;
        for(int i=2;i<=n;i++)fac[i]=fac[i-1]*i%MOD;
        if(n==m)printf("%lld\n",fac[n]*fac[n]%MOD*2%MOD);
        else printf("%lld\n",fac[n]*fac[m]%MOD);
    }
    return 0;
}



Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
using ll=long long;
int main(){
    ll R,C,k;
    cin>>R>>C>>k;
    vector<vector<ll>> field(R+5,vector<ll>(C+5));
    rep(i,k){
        ll r,c,v;
        cin>>r>>c>>v;
        r--;c--;
        field[r][c]=v;
    }
    vector<vector<vector<ll>>> dp(R+5,vector<vector<ll>>(C+5,vector<ll>(5)));
    rep(i,R+1){
        rep(j,C+1){
            rep(k,3){
                dp[i+1][j][0]=max(dp[i+1][j][0],dp[i][j][k]);
                dp[i][j+1][k]=max(dp[i][j+1][k],dp[i][j][k]);
                if(field[i][j]!=0){
                    dp[i+1][j][0]=max(dp[i+1][j][0],dp[i][j][k]+field[i][j]);
                    dp[i][j+1][k+1]=max(dp[i][j+1][k+1],dp[i][j][k]+field[i][j]);
                }
            }
        }
    }
    cout<<dp[R][C][0]<<endl;
    return 0;
}

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

using namespace std;

#define pb push_back
#define mp make_pair
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
typedef long long LL;
typedef pair<int, int> PII;

int n;
bool used[10000];

int main() {
    scanf("%d", &n);
    memset(used, 0, sizeof used);
    for (int i = 1; n > 0; ++i) {
        n -= i;
        used[i] = true;
    }
    n *= -1;
    for (int i = 1; i < 10000; ++i) {
        if (n == i) {
            assert(used[i]);
            used[i] = false;
            n = 0;
            break;
        }
    }
    for (int i = 1; i < 10000; ++i) {
        if (used[i]) {
            printf("%d\n", i);
        }
    }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define re register
#define gc getchar
#define pc putchar
#define st static
#define cs const

inline
ll getint(){
	re ll num=0;
	re char c=gc();
	while(!isdigit(c))c=gc();
	while(isdigit(c))num=(num<<1)+(num<<3)+(c^48),c=gc();
	return num;
}

int n,a[300005];

inline
bool check(int l,int r){
	int maxn=0,minn=n+1;
	for(int re i=l;i<=r;++i){
		maxn=max(maxn,a[i]);
		minn=min(minn,a[i]);
	}
	if(maxn!=r||minn!=l)return false;
	int submaxn=0;
	maxn=0;
	for(int re i=l;i<=r;i+=2){
		if(maxn<a[i])maxn=a[i];
		else if(submaxn<a[i])submaxn=a[i];
		else return false;
	}
	return true;
}

int main(){
	n=getint();
	for(int re i=1;i<=n;++i){
		a[i]=getint();
	}
	for(int re i=1;i<=n;++i){
		if(a[i]==i)continue;
		int p;
		for(p=i;p<=n-2;p+=2){
			if(a[p+1]!=p+1||a[p+2]==p+2)break;
		}
		if(!check(i,p)){
			puts("No");
			return 0;
		}
		i=p;
	}
	puts("Yes");
	return 0;
}

Measured memory_bytes: 1408
import java.util.*;
public class Main {
	public static void main(String arg[]) {
		Scanner sc = new Scanner(System.in);
		String s1 = sc.next();
		String s2 = sc.next();

		s2 = s2.substring(0, s2.length()-1);
		if(s1.equals(s2)) {
			System.out.println("Yes");
		}
		else {
			System.out.println("No");
		}
	}
}

Measured memory_bytes: 35512
import std.algorithm;
import std.array;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

T read(T)() { return readln.chomp.to!T; }
T[] reads(T)() { return readln.split.to!(T[]); }
alias readint = read!int;
alias readints = reads!int;

int calc(int n, int s) {
    int ans = 0;
    for (int i = 0; i < (1 << 10); i++) {

        int sum = 0;
        int take = 0;
        for (int j = 0; j < 10; j++) {
            if (i & (1 << j)) {
                sum += j;
                take++;
            }
        }

        if (sum == s && take == n) {
            ans++;
        }
    }
    return ans;
}

void main() {
    while (true) {
        auto xs = readints;
        int n = xs[0], s = xs[1];

        if (n == 0 && s == 0) break;
        writeln(calc(n, s));
    }
}


Measured memory_bytes: 2404
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define UNIQUE(v) v.erase(unique(all(v)), v.end());
#define ZIP(v) sort(all(v)),UNIQUE(v)
#define repi(i,m,n) for(int i = m;i < n;i++)
#define drep(i,n,m) for(int i = n;i >= m;i--)
#define rep(i,n) repi(i,0,n)
#define rrep(i,n) repi(i,1,n+1)
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(), v.rend()
#define pb(x) push_back(x)
#define fi first
#define se second
typedef pair<int,int> P;
typedef pair<int, P> PP;
typedef vector<int> vi;
const int inf = 1e9+7;
const int INF = 1e18+7;
int mod = 1e9+7;

class FermatCombination{
private:
	vector<int> fac, inv;
	int Pow(int x, int n){
		if(n < 0)n += mod-1;
		int ans = 1;
		while(n > 0){
			if(n & 1)ans = (ans*x)%mod;
			x = (x*x)%mod;
			n >>= 1;
		}
		return ans;
	}
	void Factrial(int n){
		fac[0] = inv[0] = 1;
		for(int i = 1;i <= n;i++){
			fac[i] = (fac[i-1]*i)%mod;
			inv[i] = Pow(fac[i], mod-2);
		}
	}
	
public:
	void init(int n){	//nCk
		fac.resize(n+1);
		inv.resize(n+1);
		Factrial(n);
	}
	int comb(int n, int k){
		if(n < k)return 0;
		if(k == 0)return 1;
		int tmp = (fac[n]*inv[k])%mod;
		return (tmp*inv[n-k])%mod;
	}
};

FermatCombination F;
int nCr(int n, int k){
	return F.comb(n, k);
}

int pow_(int x, int n){
	if(n < 0)n += mod-1;
	int ans = 1;
	while(n > 0){
		if(n & 1)ans = (ans*x)%mod;
		x = (x*x)%mod;
		n >>= 1;
	}
	return ans;
}

int pas[1000000];
signed main(){
	int n, m, k;
	scanf("%lld%lld%lld", &n, &m, &k);
	F.init(n+m+k+1);
	
	int ans = 0;
	pas[0] = 1;
	rrep(i,m+k){
		pas[i] = (pas[i-1]*2)%mod;
		if(i > m)pas[i] = ((pas[i]+mod)-nCr(i-1, m))%mod;
		if(i > k)pas[i] = ((pas[i]+mod)-nCr(i-1, i-(k+1)))%mod;
	}
	
	rrep(i,n+m+k){
		if(i < n)continue;
		ans += (((nCr(i-1, n-1)*pow_(3, n+m+k-i))%mod)*pas[i-n])%mod;
		ans %= mod;
	}
	printf("%lld\n", ans);
	return 0;
}




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

long long N, K, MOD = 1000000007;
static long long F[2010] = {}, RF[2010] = {};

long long Calc(long long A, long long B) {
	if (B == 0) return 1;
	if (B % 2 == 0) {
		long long C = Calc(A, B / 2);
		return (C * C) % MOD;
	}
	return (A * Calc(A, B - 1)) % MOD;
}

long long Comb(long long A, long long B) {
	if (B < 0 || A < B) return 0;
	long long RET = F[A];
	RET *= RF[A - B];
	RET %= MOD;
	return (RET * RF[B]) % MOD;
}

int main() {
	cin >> N >> K;
	F[0] = F[1] = RF[0] = RF[1] = 1;
	for (int i = 2; i <= 2000; i++) {
		F[i] = (F[i - 1] * i) % MOD;
		RF[i] = Calc(F[i], MOD - 2);
	}
	for (int i = 0; i < K; i++) {
		cout << (Comb(K - 1, i) * Comb(N - K + 1, i + 1)) % MOD << endl;
	}
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        new Main();
    }

    public Main() {
        new aoj().doIt();
    }
    class aoj {
        void doIt(){
        	while(true){
        		int n = Integer.parseInt(sc.next());
        		if(n == 0)break;
        		int A = 0,B = 0;
        		for(int i = 0;i < n;i++){
        			int a = Integer.parseInt(sc.next());
        			int b = Integer.parseInt(sc.next());
        			if(a > b)A = A + a + b;
        			else if(a < b)B = B + b + a;
        			else{
        				A = A + a;
        				B = B + b;
        			}
        		}
        		System.out.println(A+" "+B);
        	}
        }
    }
}

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

typedef long long ll;
const int INF = 1e9;
const ll LINF = 1e18;
const int mod = 1e9+7;

#define pi pair<int,int>
#define pl pair<lld,lld>

#define dump(x) cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define SANKOU(n,a,b) cout << ((n) ? (#a) : (#b) ) << endl

#define mem0(x) memset(x,0,sizeof(x))
#define fillnum(x,n) fill(begin(x),end(x),n)
#define asort(x) sort(x.begin(),x.end())
#define dsort(x,t) sort(x.begin(),x.end(),greater<t>())
#define vuniq(x) x.erase(unique(x.begin(), x.end()), x.end())

#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)

int main() {
    ll A,B;
    cin >> A >> B;
    if((A+B)%2 == 0){
        cout << (A+B)/2 << endl;
    } else {
        cout << "IMPOSSIBLE" << endl;
    }

}

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

using namespace std;

int main()
{
    int N,M;

    cin >> N >> M;

    vector<int> A(N); 
    for (int i = 0; i < N; i++) 
    {
    cin >> A.at(i);
    }

    int sum = accumulate(A.begin(),A.end(), 0);
    sort(A.begin(),A.end(), greater<int>());

    for (int i = 0; i < M; i++)
    {
        if(A[i] < sum/(4.*M))
        {
            cout << "No";
            return 0;
        }
    }

    cout << "Yes";
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<set>
#include<map>
#include<algorithm>
#include<queue>
#include<list>
#include<stack>
#include<cstdio>
#include<fstream>
#include<numeric>
#include<functional>
#include<utility>
#include<memory>
#include <cstring>
#include<bits/stdc++.h>
using namespace std; 
  
#define CLEAN(a,b) memset(a,b,sizeof(a))
#define mp make_pair
#define pb push_back
typedef long long ll;
typedef pair<int, int> pii;

int j,k,n,l,a[200005],b[200005];
int main()
{
    int ans=0;
    cin>>n;
    j=1;
    for (int i=1;i<=n;i++)
    {
		cin>>a[i];
        b[a[i]]=j;
        j++;
    }
    int l=1;
    ans=n;
    for (int i=1;i<=n-1;i++)
    {
        if (b[i]<b[i+1])
        {
            l=l+1;
        }
        else
        {
            ans=min(ans,n-l);
            l=1;
        }
    }
    ans=min(ans,n-l);
    cout<<ans<<endl;;
	return 0;
 } 

Measured memory_bytes: 1792
#include<string>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<complex>
#include<cmath>
#include<algorithm>
#include<map>
#include<vector>
#include<sstream>
#include<iostream>
using namespace std;

map<string,bool> m;
int n,k;
string a[20];

bool f[20];
void dfs(string str,int dep){
    if(dep == k){
        m[str] = true;
        return;
    }
    for(int i = 0;i < n;i++){
        if(f[i] == false&&(dep!=0||a[i][0]!='0')){
            f[i] = true;
            dfs(str + a[i],dep+1);
            f[i] = false;
        }
    }
}
int main(void){

    while(cin>>n>>k,k){
        m.clear();
        for(int i = 0;i < 20;i++)a[i] = "",f[i] = false;
        for(int i = 0;i < n;i++){
            cin>>a[i];
        }
        dfs("",0);
        int cnt = 0;
        map<string,bool>::iterator it = m.begin();
        while( it != m.end() )
        {
            //cout << (*it).first << ":" << (*it).second << endl;
            ++it;
            cnt++;
        }
        cout<<cnt<<endl;
    }
    return 0;
}

Measured memory_bytes: 1508
import sys

N = int(sys.stdin.readline())
A =list(map(int, sys.stdin.readline().split()))

false_flag = 0

for i in A:
    if (i%2) == 0:
        if (i%3 == 0 or i%5 == 0):
            continue
        else:
            false_flag = 1
            break
if false_flag == 0:
    print("APPROVED")
else:
    print("DENIED")

Measured memory_bytes: 3060