akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define rep(i, n) for(int i = 0;i < (int)n;i++)
#define repb(i, n) for(int i = (int)n;i >= 0;i--)
#define reps(i, m, n) for(int i = (int)m;i < (int)n;i++)
#define repsb(i, m, n) for(int i = (int)m;i >= (int)n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define pb(a) push_back(a)
#define INF 999999999999999999
using namespace std;
int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};
using namespace std;
int main(int argc, char const *argv[]) {
    int k;
    cin>>k;
    k=(k/2)*((k+1)/2);
    cout<<k<<endl;
    return 0;
}


Measured memory_bytes: 256
N = int(input())
R = []

for i in range(N):
    R.append(int(input()))

mins = [R[0]]
m = R[0]
for i in range(1,N):
    m = min(m,R[i])
    mins.append(m)

ans = -1e9
for i in range(1,N):
    ans = max(ans,R[i]-mins[i-1])

print(ans)


Measured memory_bytes: 14976
def yuc(a,b):
    if a>b:
        if a%b==0:
            return b
        else:
            c=a%b
            i=yuc(b,c)
            return i
    else:
        if b%a==0:
            return a
        else:
            c=b%a
            i=yuc(a,c)
            return i
x,y=(int(i) for i in input().split())
f=yuc(x,y)
print(f)



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

#define fi first
#define se second

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int MAXN = 2e5 + 5;

int N, M, C;

int main() {
	ios::sync_with_stdio(0); cin.tie(0);
	cin >> N >> M >> C;
	int ans = C / max(N, M);
	if(C % max(N, M)) ans++;
	cout << ans;
}

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

using namespace std;

int n,m;

int main(){
	scanf("%d%d",&n,&m);
	if (n==1&&m==1) puts("1");
	else{
		if (n==1) printf("%d\n",m-2);
		else{
			if (m==1) printf("%d\n",n-2);
			else printf("%lld\n",((long long)n-2)*(m-2));
		}
	}
	
	return 0;
}
			

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define PI 3.14159265358979323846
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr long long INFL = numeric_limits<long long>::max() / 2;
constexpr int MOD = 1000000007;
using Graph = vector<vector<int>>;



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

    int sum=0;
    rep(i,3){
        int x;
        cin >> x;
        sum+=x;
    }
    if(sum>21) cout << "bust" << endl;
    else cout << "win" << endl;



}


Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<string>
#include<cmath>
#include<cstdlib>
#include<climits>
#include<iostream>
#include<sstream>
#include<utility>
#include<map>
#include<vector>
#include<queue>
#include<algorithm>
#include<set>
#include<stack>
#include<functional>
#include<ios>
#include<iomanip>
//#include <boost/multiprecision/cpp_int.hpp>

//namespace mp = boost::multiprecision;
using namespace std;
typedef long long ll;
typedef pair<int,int>P;
//using Bint = mp::cpp_int;

int main()
{
	int N,bn,res=1;
	bool bup,bdn;
	cin>>N;
	for(int i=0;i<N;i++)
	{
		int t;
		cin>>t;
		if(i==0)
		{
			bup=bdn=false;
		}
		else if(bn==t)
		{

		}
		else if(bn<t)
		{
			if(bdn)
			{
				res++;
				bup=bdn=false;
			}
			else
			{
				bup=true;
			}
		}
		else if(bn>t)
		{
			if(bup)
			{
				res++;
				bup=bdn=false;
			}
			else
			{
				bdn=true;
			}
		}
		bn=t;
	}
	cout<<res<<endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <limits.h>
#include <math.h>

int main(void) {
	long long n;
	long long max;
	long long ans = 0;

	scanf("%lld", &n);
		max = (long long)sqrt(n);
		if (n == max * max)max--;
		for (long long i = 1; i <= max; i++) {
			if (n % i == 0 && i < n / i - 1) {
				ans += n / i - 1;
			}
		}
		printf("%lld", ans);
	return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, o, n) for (auto i = (o); (i) < (n); ++(i))
#define REP(i, n) FOR(i, 0, n)
#define REPR(i, n) for (auto i = (n)-1; (i) >= 0; --i)
#define REPI(itr, v) for (auto itr = v.begin(); itr != v.end(); ++itr)
#define REPIR(itr, v) for (auto itr = v.rbegin(); itr != v.rend(); ++itr)
#define fi first
#define se second
#define ll long long
#define V2(name, h, w) vector<vector<int> > name((h), vector<int>(w));
int main(){
	int N; cin >> N;
	string S; cin >> S;
	int r = 0, b = 0;
	REP(i, (int)S.size()){
		if(S[i] == 'B') ++b;
		else ++r;
	}
	if(r > b) cout << "Yes" << endl; 
	else cout << "No" << endl;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define watch(x) cout << (#x) << " is " << (x) << endl
#define f(t) for(ll i=0;i<t;i++)
#define ll long long int
#define ld long double
#define umpl unordered_map<ll,ll> 
#define vl vector<ll>
#define vld vector<ld>
#define vvl vector<vl>
#define pb push_back
#define mod 998244353
#define inf 1e18
#define pcout(x,p) cout<<fixed<<setprecision(p)<<x
#define all(a) a.begin(),a.end()
#define endl "\n"

inline ll mul(ll a, ll b){ return (a * 1ll * b) % mod; }
inline ll sub(ll a, ll b){ ll c = a - b; if(c < 0) c += mod; return c; }
inline ll add(ll a, ll b){ ll c = a + b; if(c >= mod) c -= mod; return c; }
inline ll max(ll a, ll b){return a>b?a:b;}
inline ll min(ll a, ll b){return a<b?a:b;}
inline ll ceil(ll a,ll b){if(a%b==0)return a/b;else return a/b+1;}
inline ll mo(ll a,ll b){if(b<0){b=abs(b)%mod;b=a-b;return (b<0)?b+mod:b;}else{return (a+b)%mod;}}
inline ll pow(ll a,ll b){if(b==0){return 1;}else{if(b%2==0){ll temp=pow(a,b/2);return temp*temp;}
else{return a*pow(a,b-1);}}}

struct comp { 
    template<class T1,class T2,class T3,class T4>
    bool operator()(const pair<T1,T2> &p1,const pair<T3,T4> &p2){
        return p1.first<p2.first;
    }
}; 

int main(){
	ll n,m,k;cin>>n>>m>>k;
	vl a(n),b(m);
	f(n)cin>>a[i];
	f(m)cin>>b[i];
	ll sum=0;
	map<ll,ll> mp;
	ll ans=0;
	f(n){
		sum+=a[i];
		mp[sum]=i+1;
		if(sum<=k)ans=max(ans,i+1);
	}sum=0;ll t=0;
	f(m){
		sum+=b[i];t++;if(sum>k)break;
		auto it=mp.upper_bound(k-sum);
		if(it==mp.end()){
			ans=max(ans,t+n);
		}else{
			ans=max(ans,t+it->second-1);
		}
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 18836
#include <bits/stdc++.h>
#define mod 1000000007
#define ll long long
using namespace std;
int h,w;
vector<string> v(1001);
ll dp[1001][1001];
int main()
{
    cin >> h >> w;
    for(int i = 0; i < h; ++i)
        cin >> v[i];
    for(int i = 0; i < w; i++)
    {
        if(v[0][i] == '.')
            dp[0][i] = 1;
        else
            break;
    }
    for(int i = 0; i < h; i++)
    {
        if(v[i][0] == '.')
            dp[i][0] = 1;
        else
            break;
    }
    for(int i = 1; i < h; i++)
    {
        for(int j = 1; j < w; j++)
        {
            if(v[i][j] == '.'){
                dp[i][j] = dp[i - 1][j] + dp[i][j - 1] ;
            }
            dp[i][j] = dp[i][j] % mod;
        }
    }
    cout << dp[h - 1][w - 1];
    return 0;
}

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

using namespace std;

#define fRead(x)        freopen(x,"r",stdin)
#define fWrite(x)       freopen (x,"w",stdout)

#define LL              long long
#define ULL             unsigned long long
#define ff              first
#define ss              second
#define pb              push_back
#define PI              acos(-1.0)
#define mk              make_pair
#define pii             pair<int,int>
#define pll             pair<LL,LL>


#define min3(a,b,c)     min(a,min(b,c))
#define max3(a,b,c)     max(a,max(b,c))
#define min4(a,b,c,d)   min(a,min(b,min(c,d)))
#define max4(a,b,c,d)   max(a,max(b,max(c,d)))
#define SQR(a)          ((a)*(a))
#define FOR(i,a,b)      for(int i=a;i<=b;i++)
#define ROF(i,a,b)      for(int i=a;i>=b;i--)
#define REP(i,b)        for(int i=0;i<b;i++)
#define MEM(a,x)        memset(a,x,sizeof(a))
#define ABS(x)          ((x)<0?-(x):(x))

#define SORT(v)         sort(v.begin(),v.end())
#define REV(v)          reverse(v.begin(),v.end())
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define FastRead        ios_base::sync_with_stdio(0);cin.tie(nullptr);
#ifdef VAMP
     #define debug(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template < typename Arg1 >
    void __f(const char* name, Arg1&& arg1){
        cout << name << " = " << arg1 << std::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...);
    }
#else
    #define debug(...)
#endif

const int N = 200005;

int main()
{

    #ifdef VAMP
        clock_t tStart = clock();
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
    LL x;
    cin >> x;
    LL ret = 100;
    for(int i = 1; ;i++){
        LL got = ret/100;
        ret += got;
        if(ret >= x){
            cout << i << "\n";
            return 0;
        }
    }
    #ifdef VAMP
        fprintf(stderr, "\n>> Runtime: %.10fs\n", (double) (clock() - tStart) / CLOCKS_PER_SEC);
    #endif
}


Measured memory_bytes: 3636
n, m = gets.split.map(&:to_i)
a = gets.split.map(&:to_i).sort
b = []
m.times do
  g = gets.split.map(&:to_i)
  b << g
end
i=0
b.sort_by! { |_k, v| -v }.each do |k, v|
  j = 0
  while (j < k) && (i < a.size) && (a[i] < v)
    a[i] = v
    i += 1
    j += 1
  end
  break if i >= a.size
end
p a.inject(:+)

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

int main(){
    string  s;

    cin >>s;
    vector<int> a(s.size());

    int n = s.size();
    for (int i = 0; i < n;i++){
        a[i] = (int)(s[i]-'0');
    }
    int min = 999999;
    int pos = -1;


    for(int i = 1; i < n-1; i++){
        int tmp = a[i-1]*100+a[i]*10+a[i+1];
        int dif = abs(753-tmp);
        if(min > dif){
            min = dif;
        }
    }
    cout << min <<endl;

}


Measured memory_bytes: 256
S = int(input())
import math

K = 10**9+7

def inverse_factorial(m):
    invs = [1,1]
    for i in range(2,m+1):
        t = invs[K % i] * (K // i)
        invs.append((-t) % K)
    return invs[1:]

def prod_mod_K(a_list):
    res = 1
    for a in a_list:
        res *= a
        res = res % K
    return res


def comb_mod_K(N,l):
    if l<N/2:
        den_seq = inverse_factorial(l)
        num_seq = [N,N-l+1]
    else:
        den_seq = inverse_factorial(N-l)
        num_seq = [N,l+1]
    num_seq = list(range(num_seq[1], num_seq[0]+1))
    res = prod_mod_K(num_seq) * prod_mod_K(den_seq)
    return res % K


l_max = int(S/3)
res = 0
for l in range(1,l_max+1):
    res += comb_mod_K(S-2*l-1,l-1)
print(res % K)


Measured memory_bytes: 67852
# -*- coding: utf-8 -*-
"""
Created on Sun Oct 21 11:28:35 2018
ABC078D
@author: maezawa
"""

n, z, w = list(map(int, input().split()))
a = list(map(int, input().split()))

#if n == 1:
#    cand = [abs(w-a[-1])]
#elif n == 2:
#    cand = [abs(a[-2]-a[-1]), abs(w-a[-1])]
#elif:
#    cand = [abs(a[-2]-a[-1]), abs(w-a[-1]), abs(a[-3]-a[-1])]

cand = [abs(w-a[-1])]
for card in a[-2:]:
    cand.append(abs(card-a[-1]))

score = max(cand)
print(score)

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

#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.end(), cont.begin()
#define mp make_pair
#define pb push_back
#define X first
#define Y second
#define MOD 1000000007

#define trace1(x)                    cout <<#x<<": "<<x<< endl;
#define trace2(x, y)                 cout <<#x<<": "<<x<<" | "<<#y<<": "<<y<< endl;
#define trace3(x, y, z)              cout <<#x<<": "<<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl;
#define trace4(a, b, c, d)           cout <<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl;

typedef long long ll;
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(NULL);
    ll i,j,n,m;
    cin>>n;
    string s[n];
    for(i=0;i<n;i++)
    {
        cin>>s[i];
        ll len=s[i].length();
        sort(s[i].begin(),s[i].end());
    }
    sort(s,s+n);
    ll ans=0;
    for(i=0;i<n;)
    {
        ll cnt=0;
        string temp=s[i];
        while(temp==s[i] && i<n)
        i++,cnt++;
        ans+=((cnt*(cnt-1))/2);
    }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 5760
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;

namespace AtCoder
{
    class Program
    {
        static void Main()
        {
            var N = int.Parse(ReadLine());

            for (int i = 0; i * 4 <= N; i++)
            {
                var num = N;
                num = num - i * 4;
                if (num < 0) continue;
                for (int j = 0; num >= j * 7; j++)
                {
                    if (num - j * 7 == 0)
                    {
                        WriteLine("Yes");
                        return;
                    }
                }
            }
            WriteLine("No");
        }
    }
}



Measured memory_bytes: 13140
#include <iostream>
#include <vector>
using namespace std;
int a1[101];
int a2[101];
int b1[101];
int b2[101];

int main() {
  size_t n;
  cin >> n;
  for (size_t i = 0; i < n; ++i) {
      int a;
      cin >> a;
      a1[i] = a;
  }
  for (size_t i = 0; i < n; ++i) {
      int a;
      cin >> a;
      a2[i] = a;
  }
  b1[n-1] = a1[n-1] + a2[n-1];
  b2[n-1] = a2[n-1];
  for (int i = n - 2; i > -1; --i) {
    b2[i] = a2[i] + b2[i+1];
    b1[i] = a1[i] + max(b1[i+1], b2[i]);        
  }
  cout << b1[0] << endl;
  return 0;
}

Measured memory_bytes: 256
X = int(input())
import bisect
exp_list = []
for i in range(1,32):
    for j in range(2,10):
        if pow(i,j) <= 1000:
            exp_list.append(pow(i,j))
        else:
            break
exp_list.sort()
i = bisect.bisect_right(exp_list,X)
print(exp_list[i-1])

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

typedef long long ll;
typedef unsigned long long ull;

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

  bool fumi = true;
  for (ll i = 0; i < s.size(); ++i) {
    if ((i+1) % 2 == 0) {
      if (s[i] != 'L' && s[i] != 'U' && s[i] != 'D') fumi = false; 
    } else {
      if (s[i] != 'R' && s[i] != 'U' && s[i] != 'D') fumi = false; 
    }
  }

  if (fumi) cout << "Yes" << endl;
  else cout << "No" << endl;

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <string>
#include <cmath>
#include <vector>
#include <queue>
#include <climits>
typedef long long ll;
using namespace std;

int main(void){
  int n;
  string s;
  cin>>n>>s;

  int i,j,max,cnt,t;
  max=0;

  for(i=1;i<n;i++){
    cnt=0;
    t=0;
    for(j=n-i;j<n;j++){
      if(s[t]!=s[j]||cnt>=n-i||cnt==i){
        if(max<cnt){
          max=cnt;
        }
        cnt=0;
      }
      else{
        cnt++;
      }
      t++;
    }
    if(max<cnt){
      if(cnt>i){
        cnt=i;
      }
      max=cnt;
    }

    cnt=0;
    t=0;
    for(j=i;j<n;j++){
      if(s[t]!=s[j]||cnt==i){
        if(max<cnt){
          max=cnt;
        }
        cnt=0;
      }
      else{
        cnt++;
      }
      t++;
    }
    if(max<cnt){
      if(cnt>i){
        cnt=i;
      }
      max=cnt;
    }
  }
  cout<<max<<endl;

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
#define rep(i,n) for(int i = 0; i < ((int)(n)); i++)   // 0-indexed昇順

ll gcd(ll a, ll b) {
    if (a == 0) return b;
    else if (b == 0) return a;
    return gcd(b, a % b);
}

int main() {
    int N;
    cin >> N;
    vector<ll> A(N+1, 0);
    ll prev;
    bool same = true;
    for (int i = 1; i <= N; i++) {
        cin >> A.at(i);
        if (i == 1) prev = A[1];
        else if (prev != A[i]) {
            same = false;
        }
        prev = A[i];
    }
    /*
    if (same) {
        cout << A[1] << endl;
        return 0;
    }
    */
    vector<ll> LEFT(N+1,0);
    vector<ll> RIGHT(N+2,0);
    for (int i = 1; i <= N; i++) LEFT[i] = gcd(LEFT[i - 1], A[i]);
    for (int i = N; i >= 1; i--) RIGHT[i] = gcd(A[i], RIGHT[i+1]);
    ll ma = 0;
    for (int i = 1; i <= N; i++) {
       ma = max(ma, gcd(LEFT[i-1], RIGHT[i+1])); 
    }
    cout << ma << endl;
}

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

using ll = long long;

const int MAXN = 20;
int N;
ll A[MAXN];

ll mem[MAXN * MAXN / 2][1 << 19];

ll solve(int i, int j, ll wi, ll wj, uint32_t state) {
	if (j - i <= 1) {
		return 0;
	}
	int ind = (j - 1) * (j - 2) / 2 + i;
	if (mem[ind][state] != -1) {
		//return mem[ind][state];
	}
	ll ans = 1e18;
	ll wk = wi + wj;
	for (int k = i+1; k <= j-1; k++) {
		ll cnd = wk * A[k];
		cnd += solve(i, k, wi, wk, state * 2 + 0);
		cnd += solve(k, j, wk, wj, state * 2 + 1);
		ans = min(ans, cnd);
	}
	return mem[ind][state] = ans;
}

int main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	cin >> N;
	for (int i = 0; i < N; i++) cin >> A[i];
	memset(mem, -1, sizeof(mem));
	ll ans = A[0] + A[N-1] + solve(0, N-1, 1, 1, 1);
	cout << ans << '\n';

	return 0;
}


Measured memory_bytes: 819584
import java.util.Scanner;

/**
 * Main
 */
public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();
        int[] P = new int[N];
        int count = 0;
        int min = N+1;
        for(int i = 0; i < N; i++){
            P[i] = sc.nextInt();
            if(min > P[i]){
                min = P[i];
                count += 1;
            }
        }
        System.out.println(count);
    }
}

Measured memory_bytes: 85544
#include<bits/stdc++.h>
using namespace std;
int main(){
   int n;
   cin>>n;
   int x=n%10;
   if(x==3) puts("bon");
  else if(x==0||x==1||x==6||x==8) puts("pon");
  else puts("hon");
  return 0;
}

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

int main() {
  long long n, a, b, c, l, r, ll, rr, ans;
  cin >> n >> a >> b;
  c = (b - a) / 2;
  l = b - 1;
  r = n - a;
  ll = a + ((b - a) - 1) / 2;
  rr = n - b + 1 + (n - (a + n - b + 1)) / 2;
  ans = 0;
  
  if ((b - a) % 2 == 0) {
    ans = min(c, min(l, r));
  }
  else {
    ans = min(l, min(r, min(ll, rr)));
  }
  
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define INF 100000007
#define rep(i, N) for(ll i = 0; i < N; i++)
#define rep2(i, j, k) for(ll i = j; i < k; i++)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = inx(x, y)
#define print(x) cout << x << "\n"
#define print2(x, y) cout << x << " " << y << "\n"
#define printv(vec) rep(i, vec.size()) cout << vec[i] << " "; print("");
#define ALL(v) v.begin(), v.end()
#define SUM(v) accumulate(ALL(v), 0)
#define MAX(v) *max_element(ALL(v))
#define MIN(v) *min_element(ALL(v))
#define SORT(v) sort(ALL(v))
#define REV(v) reverse(ALL(v))
typedef long long ll;
using namespace std;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using vs = vector<string>;
using vvs = vector<vector<string>>;

ll prime_fact(ll n) {
	
	ll ret = 0;
	while (n % 2 == 0){
		ret++;
		n /= 2;
	}
	return ret;
}


void solve(){

	ll N;
	cin >> N;
	vl A(N);
	rep(i, N) cin >> A[i];
	
	ll ans = 0;
	rep(i, N) ans += prime_fact(A[i]);
	print(ans);
	
}

int main(){
	
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	solve();
    
	return 0;
	
}





Measured memory_bytes: 3736
#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

int main()
{
    stack<int> stk;
    for(;;){
        int n;
        if(!(cin >> n))
            return 0;

        if(n == 0){
            cout << stk.top() << endl;
            stk.pop();
        }else{
            stk.push(n);
        }
    }
}

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

using namespace std;

int main()
{
    int H, W, h, w;
    int a[30][30];
    cin >> H >> W >> h >> w;
    memset(a, 0, sizeof(a));
    for (int i = 1; i <= h; i++){
        for (int j = 1; j <= W; j++){
            a[i][j] = 1;
        }
    }
    for (int i = 1; i <= H; i++){
        for (int j = 1; j <= w; j++){
            a[i][j] = 1;
        }
    }
    int res = 0;
    for (int i = 1; i <= H; i++){
        for (int j = 1; j <= W; j++){
            if (!a[i][j]){
                res++;
            }
            //cout << a[i][j] << " ";
        }
        //cout << endl;
    }
    cout << res;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <iomanip>
#include <map>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i < (int)(n) + 1; i++)
#define all(vecto) vecto.begin(), vecto.end()
#define max3(a, b, c) max(a, max(b, c))
#define min3(a, b, c) min(a, min(b, c))
typedef long long ll;

void ans(bool qus)
{
    if (qus == true)
        std::cout << "Yes" << std::endl;
    else
        std::cout << "No" << std::endl;
}

void Ans(bool qust)
{
    if (qust == true)
        std::cout << "YES" << std::endl;
    else
        std::cout << "NO" << std::endl;
}

using namespace std;

/////////////////////////////////////////

int main(){
    string s;
    cin >> s;
    s.at(3) = '8';
    cout<<s<<endl;
}

Measured memory_bytes: 256
//Nihal Mittal - nihal_47
//Strike First , Strike Hard , No Mercy !!

/**⠀⠀⠀⠀⠀⠀⣀⣤⣤⣄⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⣠⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣦⣀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⣰⣿⣿⣿⣿⠿⠿⣿⣿⣿⣿⣿⣿⣿⣧⢀⠀⠀⠀⠀
⠀⠀⠀⣿⣿⣿⠋⠀⠀⠀⠀⠀⠙⠀⠙⣿⣿⣿⣷⢳⢀⠀⠀⠀
⠀⠀⣠⣿⣿⣿⢸⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿⣿⣿⣿⢀
⠀⠀⣸⣿⣿⣿⠸⠀⠀⠀⠒⠒⠒⠐⠀⠀⢿⣿⣿⣿⣿⣿⠀⠀
⠀⣴⣿⣿⣿⡿⠀⠒⣋⣙⡒⢰⠀⠤⣖⠒⢾⣿⣿⣿⣿⣧⠀⠀
⢺⣿⣿⣿⣿⢀⠀⠀⠉⠉⠉⠸⠀⡇⠉⠉⠀⢿⣿⣿⣿⣄⠀⠀
⠀⠙⣿⣿⣧⢻⠀⠀⠀⠀⠀⠠⠀⠰⠀⠀⠀⣸⠸⣿⣿⠿⠰⠀
⠀⠀⠀⠹⣿⣿⣿⣷⠀⡠⠙⣲⣔⣅⢡⣰⣷⣿⣿⣿⣧⠀⠀⠀
⠀⠀⠀⣼⣿⣿⣿⣿⠀⡿⠭⠭⠭⠭⢿⠀⣿⢻⣿⣿⠃⠀⠀⠀
⠀⠀⠀⠙⠛⣿⢻⠹⣿⠐⠙⠛⠟⠉⢀⣴⡟⢿⣿⡏⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⡟⠀⠀⠻⣦⣤⣶⠾⠋⠀⠀⠁⡦⢄⢀⠀⠀⠀
⠀⠀⠀⠀⡠⠁⡇⠑⢄⠀⠀⠀⠀⠀⠀⠔⠀⠀⠁⠀⠀⠀⠉⠁
⠀⠔⠊⠁⠀⠀⣇⠀⠀⠀⠑⡤⠤⢎⠁⠀⠀⡘⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⢢⠠⠀⡠⢆⠀⠀⡠⠙⢄⠀⡸⠀
**/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define ld long double
#define mk make_pair
#define pb push_back
#define in insert
#define se second
#define fi first
#define mod 998244353
#define watch(x) cout << (#x) << " is " << (x) << "\n"
#define all(v) (v).begin(),(v).end()
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(0);
#define printclock cerr<<"Time : "<<1000*(ld)clock()/(ld)CLOCKS_PER_SEC<<"ms\n";
#define pii pair<ll,ll>
#define vi(x) vector<x>
#define maxn 100005
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 
using namespace std;
using namespace __gnu_pbds;
ll psum[200010];
ll dp[200010];
signed main()
{
    fast;
   
    ll n,k,i,j;
    cin>>n>>k;
    vector<pii> v;
    for(i=0;i<n;i++)
    {
    	ll x,y;
    	cin>>x>>y;
    	v.pb({x,y});
    }
    dp[1] = 1;
    psum[1] = 1;
    for(i=2;i<=n;i++)
    {
    	for(j=0;j<k;j++)
    	{
    		if(v[j].fi > i) continue;
    		ll fa = v[j].fi;
    		ll sa = min(v[j].se,i);
    		dp[i] = (dp[i]  + (psum[i-fa] - psum[i-sa-1] + mod)%mod)%mod;
    	}
    	psum[i] = (psum[i-1] + dp[i])%mod;
    }
    cout<<dp[n];
}

Measured memory_bytes: 9536
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<tuple>
#include<algorithm>
#include<cmath>
#include<limits>
#include<set>
#include<queue>
using namespace std;
#define int long  long int
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }
typedef pair<int, int>P;
const int MOD = 1e9 + 7;
const int INF = 1e8;

signed main() {
	int N;
	cin >> N;
	vector<int>A(N), B(N);
	rep(i, N)cin >> A[i] >> B[i];
	int sum = 0;
	int ans = 0;
	for (int i = N - 1; i >= 0; i--) {
		int num = (B[i] - ((A[i] + sum) % B[i])) % B[i];
		sum += num;
		ans += num;
	}
	cout << ans;
}

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

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

    int sum = 0;
    for(int i=0; i<s.length(); i++){
        sum += s[i] - '0';
    }

    if(stoi(s) % sum == 0) cout << "Yes" << endl;
    if(stoi(s) % sum != 0) cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstdlib> 
#include<cstring>
#include<algorithm>
using namespace std;
int read()
{
	int x=0,f=1; char c=getchar();
	while (c<'0'||c>'9') {if (c=='-') f=-1; c=getchar();}
	while (c>='0'&&c<='9') {x=x*10+c-'0';c=getchar();}
	return x*f;
}
int d[200100],t[200100],m,n;
bool flag=1;
int main()
{
	n=read();
	for (int i=1; i<=n; i++) d[i]=read();
	m=read();
	for (int i=1; i<=m; i++) t[i]=read();
	sort(d+1,d+n+1);
	sort(t+1,t+m+1);
	int now=1;
	if (n<m) flag=0;
	for (int i=1; i<=m; i++) {
		while (d[now]<t[i]) now++;
		if (t[i]==d[now]) now++;
		else {
			flag=0;
			break;
		}
	}
	if (flag) printf("YES"); else printf("NO");
	return 0;
}

Measured memory_bytes: 1792
s = input()
data = len(s)
s = list(s)
j = 0
for i in s:
  if j%2 == 0:
    if i != "h":
      break
  if j%2 == 1:
    if i != "i":
      break
  j += 1

      
if j == data and data%2 == 0:
  print("Yes")
else:
    print("No")

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
const int N=21;
const int M=1<<N;
const int mod=1e9+7;
int a[N][N],b[N];
int dp[M];
void add(int &a, int b)
{ a+=b;if(a>=mod) a-=mod;}
void sub(int &a, int b)
{ a-=b;if(a<0) a+=mod;}
int main()
{
int n;
scanf("%i",&n);
for(int i=0;i<n;i++)
for(int j=0;j<n;j++)
scanf("%i",&a[i][j]),b[i]+=a[i][j]*(1<<j);
dp[0]=1;
for(int i=0;i<n;i++)
{
for(int mask=(1<<n)-1;~mask;mask--)
{
dp[mask]=0;
int can=mask&b[i];
for(int j=can;j;j-=j&-j)
add(dp[mask],dp[mask^(j&-j)]);
}
}
printf("%i",dp[(1<<n)-1]);
return 0;
}

Measured memory_bytes: 8448
n = int(input())
l = list(map(int,input().split()))
x = sum(l)//n
count1 = 0
for i in range(n):
  count1 += (l[i]-x)**2
x += 1
count2 = 0
for i in range(n):
  count2 += (l[i]-x)**2
print(min(count1,count2))

Measured memory_bytes: 38384
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <climits>
#include <string>
#include <bitset>
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<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 drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define fin(ans) cout<<(ans)<<endl
#define STI(s) atoi(s.c_str())
#define mp(p,q) make_pair(p,q)
#define pb(n) push_back(n)
#define Sort(a) sort(a.begin(),a.end())
#define Rort(a) sort(a.rbegin(),a.rend())
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
const int P = 1000000007;
const int INF = INT_MAX;
const long long LLINF = 1LL<<60;
//g++ -std=c++1z main.cpp
//.\a.exe

int main(void){ios::sync_with_stdio(false);cin.tie(0);
////////////////////////////////////////////////////////
string s,a;
cin >> s;
for(int i=0;i<s.size();i=i+2){
	a =a+s[i];
}
cout << a << endl;


////////////////////////////////////////////////////////
return 0;}

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

public class Main {

	public static void main(String[] args) throws IOException {
		// TODO ?????????????????????????????????????????????
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		while(true){
			String tmp = br.readLine();
			String[] tmpArray = tmp.split(" ");
			int m = Integer.parseInt(tmpArray[0]);
			int n = Integer.parseInt(tmpArray[1]);
			
			if(m == 0 && n == 0){
				break;
			}
			
			int[] days = {31,29,31,30,31,30,31,31,30,31,30,31};
			
			int day = n;
			for(int i = 0 ; i < m - 1; i++){
				day += days[i];
			}
			
			String result;
			switch (day%7) {
			case 1 :
				result = "Thursday";
				break;
			case 2 :
				result = "Friday";
				break;
			case 3 :
				result = "Saturday";
				break;
			case 4 :
				result = "Sunday";
				break;
			case 5 :
				result = "Monday";
				break;
			case 6 :
				result = "Tuesday";
				break;
			default :
				result = "Wednesday";
				break;
				
			}
			
			System.out.println(result);
			
		}
	}

}

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

void makeCombiUtil(vector<vector<int> >& ans,
	vector<int>& tmp, int n, int left, int k)
{
	if (k == 0) {
		ans.push_back(tmp);
		return;
	}
	for (int i = left; i <= n; ++i)
	{
		tmp.push_back(i);
		makeCombiUtil(ans, tmp, n, i + 1, k - 1);

		tmp.pop_back();
	}
}


vector<vector<int> > makeCombi(int n, int k)
{
	vector<vector<int> > ans;
	vector<int> tmp;
	makeCombiUtil(ans, tmp, n, 1, k);
	return ans;
}
int main()
{
	int n,m,p;
	int k = 2;
	cin>>n>>m;
	vector<vector<int> > ans = makeCombi(n, k);
	vector<vector<int> > ans1 = makeCombi(m, k);
	p=ans.size()+ans1.size();
	cout<<p<<endl;

	return 0;
}


Measured memory_bytes: 896
// 154 B

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <queue>
#include <iomanip>
#include <climits>

using namespace std;

int main(){
    int n, tmp, min=0, count=0;
    cin >> n;
    vector<int> v;
    for(int i=0; i<n; i++){
        cin >> tmp;
        v.push_back(tmp);
    }
    min = v.at(0);
    count++;
    for(int i=1; i<n; i++){
        if(min > v.at(i)) {min = v.at(i); count++;}
    }
    cout << count << endl;
    return 0;
}


Measured memory_bytes: 1400
#include <cstdio>

using namespace std;
int a,b;
int main()
{
    scanf ("%d %d", &a, &b);
    if (a==1)
        a+=13;
    if (b==1)
        b+=13;
    if (a>b)
        printf ("Alice\n");
    else if (a<b)
        printf ("Bob\n");
    else
        printf ("Draw\n");
    return 0;
}


Measured memory_bytes: 128
#define _USE_MATH_DEFINES
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <iostream>
#include <fstream>
#include <chrono>

using namespace std;

const int DIV = 998244353;

int main(int argc, char *argv[]) {
#ifdef VLAD_LOCAL
    ifstream in("in.txt");
    auto start = std::chrono::steady_clock::now();
#else
    istream &in = cin;
#endif
    string str;
    int K;
    in >> str >> K;
    int n = 0, m = 0;
    vector<int> a(str.size() + 1);
    int cur = 0;
    for (int i = 0; i < str.size(); i++) {
        if (str[i] == '0') {
            a[n++] = cur;
            cur = 0;
        }
        else
            cur++;
    }
    a[n++] = cur;
    a.resize(n);
    m = str.size() - n + 1;
    int dMax = std::min(m, K) * 2;
    vector<vector<vector<int64_t>>> cnt(n);
    int aSum = 0;
    for (int i = 0; i < n; i++) {
        aSum += a[i];
        cnt[i].resize(m + 1);
        for (int j = 0; j <= m; j++)
            cnt[i][j].resize(dMax + 1, 0);
        for (int s = 0; s <= m; s++) {
            for (int d = 0; d <= dMax; d++) {
                int64_t tmp = i == 0 ? ((s == 0 && d == 0) ? 1 : 0) : cnt[i - 1][s][d];
                if (tmp == 0)
                    continue;
                for (int s2 = std::max(s, aSum); s2 <= m; s2++) {
                    int d2 = d + abs(s2 - s - a[i]);
                    if (d2 <= dMax)
                        cnt[i][s2][d2] = (cnt[i][s2][d2] + tmp) % DIV;
                }
            }
        }
    }
    int64_t result = 0;
    for (int d = 0; d <= dMax; d++) {
        result = (result + cnt[n - 1][m][d]) % DIV;
    }
    printf("%lld\n", result);
#ifdef VLAD_LOCAL
    auto end = std::chrono::steady_clock::now();
    double seconds = (double)std::chrono::duration_cast<std::chrono::milliseconds>(end - start).count() / 1000;
    printf("%.3lf seconds\n", seconds);
#endif
	return 0;
}


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

int main(){
  vector<int> x(2);
  cin >> x.at(0) >> x.at(1);
  int ans=0;
  for (int i:x){
    if (i==1) ans+=300000;
    else if (i==2) ans+=200000;
    else if (i==3) ans+=100000;
  }
  if (ans==600000) ans+=400000;
  cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		int count = 0;
		
		while(sc.hasNext()){
			char[] ch = sc.next().toCharArray();
			
		for(int i = 0; i < ch.length; i++){
			
			if(Character.isDigit(ch[i])){
				int x = ch[i++] - '0';
				
				while(i < ch.length && Character.isDigit(ch[i])){
					x *= 10;
					x += ch[i++] - '0';
			}
				count += x;
		}
		}
		}
		System.out.println(count);
		
		sc.close();
	}
}

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

typedef long double ld;
typedef unsigned long ul;
typedef long long ll;
typedef unsigned long long ull;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<long> vl;
typedef vector<double> vd;
typedef map<int,int> mii;
typedef pair<int,int> pii;
typedef pair<long,long> pll;

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,a,n) for(int i=a;i<n;i++)
#define ALL(a) (a).begin(),(a).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))

#define pi 3.14159265358979
#define eps 1e-9
#define inf 1<<30
#define MOD 1000000007 // 1e9+7

vector<long long> nums(51);
vector<long long> pn(51);

ll calc(int n, ll x){
  if( n == 0 ){
    if( x == 0 ) return 0;
    else return 1;
  }
  if( x <= 1 ) return 0;
  if( x <  1 +   nums[n-1] ) return calc(n-1, x-1);
  if( x <= 1 +   nums[n-1] ) return pn[n-1];
  if( x <= 2 +   nums[n-1] ) return pn[n-1] + 1;
  if( x <  2 + 2*nums[n-1] ) return pn[n-1] + 1 + calc(n-1, x-nums[n-1]-2);
  return 2*pn[n-1] + 1;
}

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

  nums[0] = 1;
  pn[0] = 1;
  for( int i=0; i<N; i++ ){
    nums[i+1] = 2*nums[i] + 3;
    pn[i+1] = 2*pn[i] + 1;
  }

  cout << calc(N, X) << endl;

  return 0;
}



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

int main(){
	double a, b, C, PI=3.1415926535;
	cin >> a >> b >> C;
	cout << fixed << setprecision(10) << a*b*sin(C*PI/180)/2.0 << endl;
	cout << fixed << setprecision(10) << a + b + sqrt( pow(a*sin(C*PI/180),2) + pow(b-a*cos(C*PI/180),2) ) << endl;
	cout << fixed << setprecision(10) << b*sin(C*PI/180) << endl;
	return 0;
}

Measured memory_bytes: 3376
N,M,X=map(int,input().split())
li=[list(map(int,input().split())) for _ in range(N)]
ans=float("inf")
for i in range(2**N):
  price=0
  abil=[0]*M
  for j in range(N):
    if (i>>j)&1:
      price+=li[j][0]
      for k in range(1,M+1):
        abil[k-1]+=li[j][k]
  if min(abil)>=X:
    ans=min(ans,price)
if ans==float("inf"):
  print(-1)
else:
  print(ans)


Measured memory_bytes: 9176
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[])
{
	int n,i,min,max,maxincome,income;
	scanf("%d",&n);
	int *p=(int *)malloc(sizeof(int)*n);
	for(i=0;i<n;i++)
	scanf("%d",&p[i]);
	min=p[0];
	max=p[1];
	maxincome=p[1]-p[0];
	for(i=1;i<n;i++)
	{
		if(p[i]<min&&i+1!=n)
		{
			min=p[i];
			max=p[i+1];
			income=max-min;
			if(income>maxincome)
			maxincome=income;
		}
		else if(p[i]>min&&p[i]<max)
		continue;
		else if(p[i]>max)
		{
			max=p[i];
			income=max-min;
			if(income>maxincome)
			maxincome=income;
		}
			
	}
	printf("%d\n",maxincome);
	return 0;
}

Measured memory_bytes: 2588
#define _USE_MATH_DEFINES
#include<iostream>
#include <math.h>
#include <climits>
#include <algorithm>
#include <vector>
#include <queue>
#include <string>
using namespace std;

/* sample input

*/
int n;
int a[100001];

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

	int count = 0;
	int j = 1;

	for (int i = 0; i < n; i++){
		j = a[j-1];
		count++;
		if (j == 2){
			break;
		}
	}

	if (j == 2){
		cout << count;
	}
	else{
		cout << -1;
	}

	return 0;
}

Measured memory_bytes: 640
#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 N;
cin>>N;
vector<int>v(N);
for(int i=0;i<N;i++){
   cin>>v[i];
}
sort(v.begin(),v.end());
vector<double>a(N);
a[0]=v[0];
for(int i=1;i<N;i++){
   a[i]=(a[i-1]+v[i])/2.0;

}

cout<<a[N-1]<<endl;
return 0;
}

Measured memory_bytes: 3732
#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>;

int main(){
  int n;
  cin >> n;
  cout << 180*(n-2) << endl;
  return 0;
}


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

#define rep(i,n) for(i = 0;i < n;++i)
#define all(v) v.begin(), v.end()
using ll = long long;

int main()
{
    ll i,j;
    string s;
    cin >> s;
    ll n = s.size();
    ll ans = 1e9;
    for(i = 'a';i <= 'z';++i){
        char tmpchar = i;
        ll tmpn = n;
        ll tmpans = 0;
        string tmps = s;
        while(true){
            bool flag = true;
            rep(j,tmpn){
                if(tmps.at(j) != tmpchar){
                    flag = false;
                    break;
                }
            }
            if(flag){
                ans = min(ans,tmpans);
                break;
            }
            for(j = 0;j < tmpn-1;++j){
                if(tmps.at(j) == tmpchar || tmps.at(j+1) == tmpchar){
                    tmps.at(j) = tmpchar;
                }
            }
            --tmpn;
            ++tmpans;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
 
/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
    sizeは(int)とキャストしよう
    ごちゃごちゃ場合分けを考える前に全探索は考えましたか？
*/

int main(){
    string s,t; cin >> s >> t;

    string ans = "";
    for(int i=0; i<t.size(); ++i){
        ans += s[i];
        ans += t[i];
    }

    if(s.size() > t.size()) ans += s.back();

    cout << ans << endl;
}

Measured memory_bytes: 256
using System;

namespace teisyutusensei
{
    class Program
    {
        static void Main(string[] args)
        {
//            string result =null;
           bool [] v = new bool[100000001];

           v[0] = true;
           v[1] = true;

            for (int i = 2; i <= 10000; i++)
            {
                if (v[i] == false)
                {

                    for (int j = 2; j <= 100000000; j++)
                    {
                        int h = i * j;

                        if (h > (100000000))
                        {
                            break;
                        }
                        else
                        {
                            v[h] = true;
                        }
                    }
                }
            }
            
            int count = 0;
            ////?????????????????????
            string dmmy = Console.ReadLine();

            int n = int.Parse(dmmy);

            for (int i = 0; i < n; i++)
            {
                string dmmy2 = Console.ReadLine();
                int val = int.Parse(dmmy2);

                if (v[val] == false)
                {
                    count++;
                }
                
            }

            Console.WriteLine(count);
            Console.ReadLine();

        }
    }

}



//            string dmmy = Console.ReadLine();
//            string[] input = dmmy.Split(' ');

//            int n = int.Parse(input[0]);
//          int x = int.Parse(input[1]);

Measured memory_bytes: 103884
s = int(input())

def f(n):
    if n%2==0:
        return int(n/2)
    else:
        return 3*n + 1

def main():
    a = [s]
    for n in range(1, 1000000):
        a.append(f(a[n-1]))
        if len(set(a)) != n+1:
            return n+1

if __name__ == '__main__':
    print(main())


Measured memory_bytes: 3060
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
int main() {
	char s[4];
	int flag = 0;
	for (int i= 0; i < 4; i++)cin >> s[i];
	for (int i = 0; i < 3; i++) {
		if (s[i] == s[i + 1]) {
			flag = 1;
		}
		else {
			continue;
		}
	}
	if (flag == 0) {
		printf("Good");
	}
	else {
		printf("Bad");
	}
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace app152
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] str = Console.ReadLine().Split(' ');
            int n = int.Parse(str[0]);
            int m = int.Parse(str[1]);

            if(n == m)
            {
                Console.Write("Yes");
            }
            else
            {
                Console.Write("No");
            }
        }
    }
}


Measured memory_bytes: 11092
def Prime?(n)
	return false if n == 1

	sqrtN = Math.sqrt(n).to_i
	$primelist.each { |p|
		break if p > sqrtN
		return false if n % p == 0
	}

	a = true
	max = $primelist[-1]
	if max < sqrtN
		(max+2).step(sqrtN, 2){ |i|
			isprime = true
			$primelist.each { |p|
				if i % p == 0
					isprime = false
					break
				end
			}
			if isprime
				$primelist << i
				if n % i == 0
					a = false
					break
				end
			end
		}
	end

	return a
end

$primelist = Array.new(0)
$primelist << 2
$primelist << 3

n = 0
gets.to_i.times { n += 1 if Prime?(gets.to_i) }
puts "#{n}"

Measured memory_bytes: 8840
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cstring>
#include <stack>
#include <utility>
#include <map>
#include <cmath>
#include <stack>
#include <queue>
#include <deque>
#include <cstdlib>
#include <set>
#include <chrono>
#include <climits>
#include <unordered_map>
#include <iomanip> 

#define pii pair<int,int>
#define vi vector<int>
#define ll long long
#define pb push_back
#define mp make_pair
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL)
#define repf(i,st,end,inc) for(int i = st; i < end; i += inc)
#define repb(i,st,end,dec) for(int i = st; i >= end; i -= dec) 

#define MOD 1000000007

#define trace1(a) cout << a << endl;
#define trace2(a,b) cout << a << " | " << b << endl;
#define trace3(a,b,c) cout << a << " | " << b << " | " << c << endl;
#define trace4(a,b,c,d) cout << a << " | " << b << " | " << c << " | "<< d << endl;

using namespace std;
using namespace std::chrono;

bool mycmp(pii a, pii b){
	if (a.first==b.first)
		return a.second > b.second;
	return a.first < b.first;
}

int main(){
	fast;
	#ifdef LOCAL_PROJECT
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
	#endif

	auto start = high_resolution_clock::now(); 

	int n, t;
	cin >> n >> t;
	
	vector<pii> ab(n);
	for(int i = 0; i< n; i++){
		int a, b;
		cin >> a >> b;
		ab[i] = {a, b};
	}

	sort(ab.begin(), ab.end());

	vector<vector<int>> dp(n+1, vector<int>(6005, 0));
	int ans = 0;
	for(int i = 1; i <= n; i++){
		for(int j = 0; j < 6005 ; j++){
			dp[i][j] = max(dp[i-1][j], dp[i][j]); 
			ans = max(ans, dp[i][j]);
		}
		for(int j = ab[i-1].first; j < t + ab[i-1].first ; j++){
			dp[i][j] = max(dp[i][j], dp[i-1][j-ab[i-1].first] + ab[i-1].second);
			ans = max(ans, dp[i][j]);
		}
	}

	// vector<int> a(n), b(n);
	// for(int i = 0; i< n; i++){
	// 	cin >> a[i] >> b[i];
	// }

	// vector<vector<int>> dp(n+1, vector<int>(6005, 0));
	// int ans = 0;
	// for(int i = 1; i <= n; i++){
	// 	for(int j = 0; j < 6005 ; j++){
	// 		dp[i][j] = max(dp[i-1][j], dp[i][j]); 
	// 		ans = max(ans, dp[i][j]);
	// 	}
	// 	for(int j = a[i-1]; j < t + a[i-1] ; j++){
	// 		dp[i][j] = max(dp[i][j], dp[i-1][j-a[i-1]] + b[i-1]);
	// 		ans = max(ans, dp[i][j]);
	// 	}
	// }

	cout << ans << endl;

	// for(int i = 0; i <= n; i++){
	// 	for(int j = 0; j <=130 ; j++)
	// 		cout << dp[i][j] << " ";
	// 	cout << endl;
	// }

	auto stop = high_resolution_clock::now(); 
	auto duration = duration_cast<microseconds>(stop - start);	
	// cout << endl;
	// cout << fixed << setprecision(9) << double(duration.count()) / 1000000 << endl; 

	return 0;
}


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

#if MYDEBUG
#include "lib/cp_debug.hpp"
#else
#define DBG(...) ;
#endif

using LL = long long;
constexpr LL LINF = 334ll << 53;
constexpr int INF = 15 << 26;
constexpr LL MOD = 1E9 + 7;

namespace Problem {
using namespace std;

class Solver {
 public:
  int n;
  vector<LL> a, b;

  Solver(LL n) : n(n), a(n){};

  void solve() {
    for (int i = 0; i < n; ++i) {
      cin >> a[i];
    }
    b = a;
    for (int i = 0; i < n; ++i) {
      b[i] -= i + 1;
    }
    sort(b.begin(), b.end());
    LL m = b[n / 2];
    DBG(m)
    LL ans = 0;
    for (int i = 0; i < n; ++i) {
      ans += abs(a[i] - m - i - 1);
    }
    cout << ans << endl;
  }
};
}  // namespace Problem

int main() {
  std::cin.tie(0);
  std::ios_base::sync_with_stdio(false);
  long long n = 0;
  std::cin >> n;

  Problem::Solver sol(n);
  sol.solve();
  return 0;
}


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

int main(){
  string s;
  cin >> s;
  int n = s.size();
  
  int red = 0;
  for(int i = 0; i < n; ++i){
    if(s.at(i) == '1') red++;
  }
  
  red = min(n, min(red, n - red) * 2);
  cout << red << endl;
}

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

int main()
{
  string s;
  int p=700;
  cin >> s;
  if(s[0]=='o') p+=100;
  if(s[1]=='o') p+=100;
  if(s[2]=='o') p+=100;
  cout << p<< endl;
  
  return 0;
}

Measured memory_bytes: 256
from collections import deque
INF = float("inf")
TO = 0;  CAP = 1;  REV = 2
class Dinic:
    def __init__(self, N):
        self.N = N
        self.V = [[] for _ in range(N)]  # to, cap, rev
        # 辺 e = V[n][m] の逆辺は V[e[TO]][e[REV]]
        self.level = [0] * N

    def add_edge(self, u, v, cap):
        self.V[u].append([v, cap, len(self.V[v])])
        self.V[v].append([u, 0, len(self.V[u])-1])

    def add_edge_undirected(self, u, v, cap):  # 未検証
        self.V[u].append([v, cap, len(self.V[v])])
        self.V[v].append([u, cap, len(self.V[u])-1])

    def bfs(self, s: int) -> bool:
        self.level = [-1] * self.N
        self.level[s] = 0
        q = deque()
        q.append(s)
        while len(q) != 0:
            v = q.popleft()
            for e in self.V[v]:
                if e[CAP] > 0 and self.level[e[TO]] == -1:  # capが1以上で未探索の辺
                    self.level[e[TO]] = self.level[v] + 1
                    q.append(e[TO])
        return True if self.level[self.g] != -1 else False  # 到達可能

    def dfs(self, v: int, f) -> int:
        if v == self.g:
            return f
        for i in range(self.ite[v], len(self.V[v])):
            self.ite[v] = i
            e = self.V[v][i]
            if e[CAP] > 0 and self.level[v] < self.level[e[TO]]:
                d = self.dfs(e[TO], min(f, e[CAP]))
                if d > 0:  # 増加路
                    e[CAP] -= d  # cap を減らす
                    self.V[e[TO]][e[REV]][CAP] += d  # 反対方向の cap を増やす
                    return d
        return 0

    def solve(self, s, g):
        self.g = g
        flow = 0
        while self.bfs(s):  # 到達可能な間
            self.ite = [0] * self.N
            f = self.dfs(s, INF)
            while f > 0:
                flow += f
                f = self.dfs(s, INF)
        return flow

from fractions import gcd
while True:
    m, n = map(int, input().split())
    if m==n==0:
        break
    B = []
    while len(B)!=m:
        B += list(map(int, input().split()))
    R = []
    while len(R)!=n:
        R += list(map(int, input().split()))
    dinic = Dinic(m+n+2)
    s, g = m+n, m+n+1
    for i in range(m):
        dinic.add_edge(s, i, 1)
    for i in range(m, m+n):
        dinic.add_edge(i, g, 1)

    for i, r in enumerate(B):
        for j, b in enumerate(R, m):
            if gcd(r, b) > 1:
                dinic.add_edge(i, j, 1)
    print(dinic.solve(s, g))



Measured memory_bytes: 34728