akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define sz(a) int((a).size()) 
#define pb push_back 
#define all(c) (c).begin(),(c).end() 
#define tr(c,i) for(auto i = (c).begin(); i != (c).end(); i++) 
#define present(c,x) ((c).find(x) != (c).end()) 
#define cpresent(c,x) (find(all(c),x) != (c).end())
#define F(i,n) for(int i=0;i<n;i++)
#define VE(i,v) for(int i = 0;i < (v).size();i++)
using namespace std;
typedef vector<int> vi; 
typedef vector<vi> vvi; 
typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef long long ll;
typedef unsigned int ui;
typedef vector<ll> vl; 
typedef vector<vl> vvl; 
typedef pair<ll,ll> pll;
typedef vector<pll> vpll; 


int main()
{
	std::ios::sync_with_stdio(false);
	cin.tie(NULL);
	int T=1;
	
	
	

	for(int tc = 0; tc < T; tc++)
	{
		int N,W;
		cin>> N>>W;
		vector<pair<int, ll> > items(N);
		for(int i =0; i < N; i++)
		{
			cin>>items[i].first>>items[i].second;
		}
		sort(all(items));
		ll ans = 0;
		vl dp(W+1,0);
		for(int i =0; i < N; i++)
		{
			vl temp(all(dp));
			for(int j =items[i].first; j<=W;j++)
			{
				temp[j] = max(dp[j], items[i].second + dp[j-items[i].first]);
				ans = max(ans, temp[j]);
			}
			dp = temp;
			/*cout<<i<<": ";
			for(auto z:dp)
				cout<<z<<" ";
			cout<<"\n";*/
		}




		
		cout<<ans<<"\n";
	}

 
 
 
	return 0;
}
 
 


Measured memory_bytes: 1804
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> lpair;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define rREP(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define printa(x,n) for(ll i = 0; i < n; i++){ cout << (x[i]) << " ";} cout<<endl;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int a,b;
    string s;
    cin >> a >> b >> s;

    bool flag = true;
    if (s.size() == a+b+1 && s[a] == '-')
    {
	    rep(i, s.size())
	    {
		    if (i == a)
		    {
			    continue;
		    }
		    if (s[i] == '0' || s[i] == '1' || s[i] == '2' || s[i] == '3' || s[i] == '4' || s[i] == '5' || s[i] == '6' || s[i] == '7' || s[i] == '8' || s[i] == '9')
		    {
		    }
		    else
		    {
			    flag = false;
			    break;
		    }
	    }
    }
    else
    {
	    flag = false;
    }
    
    if (flag)
    {
	    cout << "Yes" << endl;
    }
    else
    {
	    cout << "No" << endl;
    }
}


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

using namespace std;

vector <pair <int, int> > pairs;

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

  int N, M;
  cin >> N >> M;

  for (int i = N, m = M; i > (N - (int)(M / 2) - (M % 2 == 0 ? 0 : 1)); i--, m -= 2) {
    pairs.push_back(make_pair(i, i-m));
  }

  for (int i = 1, m = M-1; i <= (int)(M / 2); i++, m -= 2) {
    pairs.push_back(make_pair(i, i+m));
  }

  for (int i = 0; i < pairs.size(); i++)
    cout << pairs[i].first << " " << pairs[i].second << endl;

  return 0;
}


Measured memory_bytes: 3848
#include <iostream>
#include <algorithm>
#include <vector>
typedef long long int ll;
#define rep(i,k,n) for(int i=k;i<n;++i)

const ll IFN=100100100;

int main(){
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(0);
    std::cout.tie(0);
    ll n,m,x;
    std::cin >> n >> m >> x;
    std::vector<ll> c(n);
    ll a[n][m];
    for(ll i=0;i<n;++i){
        std::cin >> c[i];
        for(ll j=0;j<m;++j){
            std::cin >> a[i][j];
        }
    }
    
    ll ans=IFN;
    for(int s=0;s<1<<n;++s){
        ll cost=0;
        std::vector<ll> d(m);
        for(ll i=0;i<n;++i){
            if(s>>i&1){
                cost+=c[i];
                for(ll j=0;j<m;++j){
                    d[j]+=a[i][j];
                }
            }
        }
        bool flag=true;
        for(ll j=0;j<m;++j){
            if(d[j]<x){
                flag=false;
            }
        }
        if(flag){
            ans=std::min(ans,cost);
        }
    }
    
    if(ans==IFN){
        std::cout << -1 << std::endl;
    } else {
        std::cout << ans << std::endl;
    }
    return 0;
}

Measured memory_bytes: 3552
#include <bits/stdc++.h>
using namespace std;
using intint = pair<int, int>;
static constexpr int N_max = 10'000;
static constexpr int M_max = 10'000;

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

    // first : val
    // second: cnt
    auto x = vector<intint>(m);
    for (auto &x_i : x) {
        cin >> x_i.second >> x_i.first;
    }
    sort(x.begin(), x.end(), greater<pair<int, int>>());

    auto updater = vector<int>();
    updater.reserve(n);
    for (auto &x_i : x) {
        auto space = n - (int)updater.size();
        auto cnt = min(space, x_i.second);
        updater.resize(updater.size() + cnt, x_i.first);
        if (updater.size() == n)
            break;
    }
    updater.resize(n, 0);

    auto sum = 0LL;

    auto iu = 0;
    for (int i = 0; i < n; ++i) {
        auto val = a[i];
        auto update = updater[iu];
        if (update > val) {
            sum += update;
            iu++;
        } else {
            sum += val;
        }
    }

    cout << sum;
    return 0;
}


Measured memory_bytes: 1792
// C.

#include <iostream>
#include <sstream>
#include <algorithm>
#include <vector>
#include <numeric>
#include <set>
#include <cassert>
#include <cmath>

using namespace std;

typedef long double LD;

int main(int argc, char* argv[]) {
#ifdef _MSC_VER
	while (true)
#endif
	{
		int a = -1, b, c;
		cin >> a >> b >> c;
		if (a < 0) return 0;
		LD A = a, B = b, C = c;
		LD p = sqrt(A) + sqrt(B) + 1e-15, q = sqrt(C);
		bool ans = p < q;
		cout << (ans ? "Yes" : "No") << endl;
	}
	return 0;
}


Measured memory_bytes: 256
n, x, m = map(int, input().split())
ans = x
if n <= m:
    for i in range(1, n):
        x = (x * x) % m
        ans += x
    print(ans)
    exit()
cnt = [0] * m
loop = []
start = -1
for i in range(4 * m):
    x = (x * x) % m
    if cnt[x] == 1:
        loop.append(x)
        if start == -1:
            start = i
    cnt[x] += 1
for i in range(m):
    if cnt[i] > 0:
        ans +=  i
l = len(loop)
if l > 0 and start != -1:
    ans += sum(loop) * ((n-1-start) // l)
    ans += sum(loop[:(n-1-start)%l])
print(ans)

Measured memory_bytes: 11832
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstdlib>
using namespace std;
 
//repetition
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
 
//infinity
#define INTINF 2000000000
#define LONGINF 20000000000
 
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
 
int main(){
	int n;
	cin >> n;
	int a[n];
	REP(i, n){
		cin >> a[i];
	}
	
	int count = 0;
	REP(i, n-2){
		if(a[i] == a[i+1]){
			if(a[i+1] + 1 == a[i+2]){
				a[i+1] += 2;
			}else{
				a[i+1] += 1;
			} 
			count++;
		}
	}
	if(a[n-2] == a[n-1]){
		count++;
	}
	cout << count << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <string>
#include <algorithm>
#include <string.h>
#include <ctype.h>
#include <math.h>
#include <float.h>
#include <iomanip>
#include <iostream>
using namespace std;
 
int main(){

    int A[3][3]={},N,B,result[3][3]={},f=0;
    
    for(int i=0;i<3;i++){
        for(int k=0;k<3;k++){
            cin>>A[i][k];
            result[i][k]=0;
        }
    }

    cin>>N;

    for(int i=1;i<=N;i++){
        cin>>B;

        for(int i=0;i<3;i++){
            for(int k=0;k<3;k++){
                if(A[i][k]==B)result[i][k]=1;
            }
        }
    }

    for(int i=0;i<3;i++){
        int row=0,col=0;
        for(int k=0;k<3;k++){
            row+=result[i][k];
            col+=result[k][i];
        }
        if(row==3||col==3){
            f=1;
        }
    }

    int temp =result[0][0]+result[1][1]+result[2][2];
    if(temp==3)f=1;
    temp = result[0][2]+result[1][1]+result[2][0];
    if(temp==3)f=1;

    if(f==1){
        cout << "Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }


    return 0;
}

Measured memory_bytes: 256
n, m = gets.to_s.split.map{|t|t.to_i}

edges = Array.new(n){ []}
m.times do
  u, v = gets.to_s.split.map{|t|t.to_i-1}
  edges[u] << v
end

s, t = gets.to_s.split.map{|i|i.to_i-1}

inf = 10 ** 9
dist = Array.new(n){ Array.new(3){ inf } }
dist[s][0] = 0

q = [[s,0]]
while q.any?
  
  u, x = q.shift
  y = (x+1) % 3
  edges[u].each do |v|
    next if dist[v][y] != inf || dist[u][x] == inf
    dist[v][y] = dist[u][x] + 1
    if v == t && y == 0
      puts dist[v][y] / 3
      exit
    end
    q.push([v, y])
  end
end

puts dist[t][0] == inf ? -1 : dist[t][0] / 3

Measured memory_bytes: 18300
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <set>
#include <string>
#include <iomanip>
using namespace std;

int main(){
    int n,x;
    cin >> n >> x;
    vector<int> y(n);
    for ( int i = 0 ; i < n ; i++){
        int a; cin >> a;
        y[i] = abs(x-a);
    }
    int m = 10e9;
    sort(y.begin(),y.end());
  	if ( n == 1 ){ cout << y[0] << endl;return 0;}
  	
    for ( int i = 1 ; i < n ; i++ ){
        int b = y[i] , c = y[i-1];
        while( b > 0 ){
            if ( b % c == 0){break;}
            else{
                int tmp = b % c;
                b = c;
                c = tmp;
            }
        }
        m = min(m,c);
    }
    cout << m << endl;
}

Measured memory_bytes: 640
def comb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル
n=int(input())
mod=10**9+7
for i in range( 2, n + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )
import copy
a=list(map(int,input().split()))
b=copy.deepcopy(a)
b.sort()
tmp=-1
for i in range(n):
  if b[i]==b[i+1]:
    tmp=b[i]
r=[]
for i in range(n+1):
  if a[i]==tmp:
    r.append(i)
y=abs(r[1]-r[0]-1)
for k in range(1,n+2):
  ans=(comb(n-1,k,mod)+comb(n-1,k-2,mod)+comb(n-1,k-1,mod)*2-comb(n-1-y,k-1,mod))%mod
  print(ans)

Measured memory_bytes: 26240
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <unordered_map>

using namespace std;
using ll = long long;

void _cin(){} template <class Head, class... Tail> void _cin(Head&& head, Tail&&... tail){ cin >> head; _cin(forward<Tail>(tail)...); }
void _cout(){ cout << "\n"; } template <class Head, class... Tail> void _cout(Head&& head, Tail&&... tail){ cout << head; _cout(forward<Tail>(tail)...); }
int gcd(int a, int b){ return (b == 0) ? a : gcd(b, a % b); }

#define Sq(x) (x)*(x)
#define For(i, n) for(int i = 0; i < (n); i ++)
#define Rep(n) For(_, n)
#define Range(c) c.begin(), c.end()
#define RevRange(c) c.rbegin(), c.rend()
#define Contains(c, x) (find(Range(c), x) != c.end())
#define Search(rb, re, x) distance(rb, find(rb, re, x))
#define Sort(a) sort(Range(a))
#define DeSort(a) sort(RevRange(a))
#define Reverse(c) reverse(Range(c))
#define Unique(a) a.erase(unique(Range(a)), a.end())
#define Vec2(T, n, m, xs) vector<vector<T>> xs(n, vector<T>(m))
#define Sum(a) accumulate(Range(a), 0)
#define Cusum(T, xs, sxs) vector<T> sxs(xs.size()+1); For(i, (int)xs.size()) sxs[i+1] = sxs[i] + xs[i]
#define Cin(T, ...) T __VA_ARGS__; _cin(__VA_ARGS__)
#define Cins(T, n, xs) vector<T> xs(n); For(i, n) cin >> xs[i]
#define Cins2(T, n, xs, ys) vector<T> xs(n), ys(n); For(i, n) cin >> xs[i] >> ys[i]
#define Cins3(T, n, xs, ys, zs) vector<T> xs(n), ys(n), zs(n); For(i, n) cin >> xs[i] >> ys[i] >> zs[i]
#define Cinss(T, n, m, xs) Vec2(T, n, m, xs); For(i, n) For(j, m) cin >> xs[i][j]
#define Cinm(T, n, map) unordered_map<T, int> map; Rep(n){ Cin(T, x); map[x] ++; }
#define Cout(...) _cout(__VA_ARGS__)
#define Couts(xs) for(const auto &e : xs) cout << e << " "; cout << "\n"
#define Coutyn(cond) Cout((cond) ? "yes" : "no")
#define CoutYn(cond) Cout((cond) ? "Yes" : "No")
#define CoutYN(cond) Cout((cond) ? "YES" : "NO")

// constexpr int MOD = 1e9+7;

#include <set>
constexpr int Inf = 2*1e9;

int main(void){
    Cin(int, n, t);
    vector<int> a(n);
    int m = 2e9;
    For(i, n){
        Cin(int, x);
        m = min(m, x);
        a[i] = x - m;
    }
    Sort(a);
    Cout(distance(lower_bound(Range(a), a.back()), a.end()));
}


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

using namespace std;

int n,k,h[100009],b[100009],c=0,mn=1000000;

int calc(int idx)
{
    if(idx>=n)
        return 100000;
    if(idx==n-1)
        return 0;
        //pick
        int x=100000,y=100000;
        if(b[idx]!=-1)
            {
                c++;
                return b[idx];
            }
            for(int i=1;i<=k;i++)
            {
                if(i==1)
                {
                    mn=b[idx]=abs(h[idx+i]-h[idx])+calc(idx+i);
                }
                x=abs(h[idx+i]-h[idx])+calc(idx+i);
                mn = min(x,mn);
            }
                return b[idx]= mn;


            //y=abs(h[idx+2]-h[idx])+calc(idx+2);





}

int main()
{
    for(int i=0;i<100005;i++)
    {
        b[i]=-1;
    }
    cin>>n>>k;
    for(int i=0;i<n;i++)
    {
        cin>>h[i];
    }
    cout<<calc(0);
    /*for(int i=0;i<n;i++)
        cout<<b[i]<<" ";
    cout<<endl<<c;*/
    return 0;
}


Measured memory_bytes: 7296
#define _GLIBCXX_DEBUG
// header {{{
#include <bits/stdc++.h>
using namespace std;
#define CPP_STR(x) CPP_STR_I(x)
#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_STR_I(args...) #args
#define CPP_CAT_I(x,y) x ## y
#define ASSERT(expr...) assert((expr))
using i8  = int8_t;
using u8  = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;
using f32 = float;
using f64 = double;
using f80 = __float80;
// }}}
constexpr i64 INF = 1'010'000'000'000'000'017LL;
constexpr i64 MOD = 1'000'000'007LL;
constexpr f64 EPS = 1e-12;
constexpr f64 PI = 3.14159265358979323846;
// util {{{
#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))

template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }
template<typename T, size_t N>
i64 SIZE(const T (&)[N]) { return static_cast<i64>(N); }
template<typename T, typename U, typename Comp=less<>>
bool chmax(T& xmax, const U& x, Comp comp={}) {
    if(comp(xmax, x)) {
        xmax = x;
        return true;
    }
    return false;
}

template<typename T, typename U, typename Comp=less<>>
bool chmin(T& xmin, const U& x, Comp comp={}) {
    if(comp(x, xmin)) {
        xmin = x;
        return true;
    }
    return false;
}
// }}}

// init {{{
struct ProconInit {
    static constexpr int IOS_PREC = 15;
    static constexpr bool AUTOFLUSH = false;

    ProconInit() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(IOS_PREC);
        if(AUTOFLUSH)
            cout << unitbuf;
    }
} PROCON_INIT;
// }}}

//--------------------------------------------------------------------

signed main() {
    int n;
    cin>>n;
    double k=0;
    int p=0;
    REP(i,n){
        cin>>p;
        k += 1.0/p;
    }
    cout<<1/k<<endl;


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

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep_(i, n, m) for (int i = n; i < (int)(m); i++)
#define all(v) v.begin(), v.end()
#define int long long
#define stoi stoll
//#define _GLIBCXX_DEBUG

signed main() {
  int N, M; cin >> N >> M;
  vector<int> a(N), b(N);
  rep(i, N) cin >> a[i] >> b[i];
  vector<int> c(M), d(M);
  rep(i, M) cin >> c[i] >> d[i];
  
  rep(i, N) {
    int k = 0;
    int dis = abs(a[i]-c[0])+abs(b[i]-d[0]);
    
    rep(j, M) {
      if(dis > abs(a[i]-c[j])+abs(b[i]-d[j])) {
        dis = abs(a[i]-c[j])+abs(b[i]-d[j]);
        k = j;
      }
    }
    
    cout << k+1 << endl;
  }
  
}


Measured memory_bytes: 256
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <queue>
#include <string>
using namespace std;
#define rep(i,a,n) for(ll i=a;i<n;i++)
#define rrep(i,a,n) for(ll i=n;i>=a;i++)
typedef long long ll;
typedef pair<ll,ll> P;
const ll INF = 1e+17;
const ll MODcdf = 998244353;
string keyence="keyence";
int main(){
    ll n;cin>>n;
    ll h[n];
    ll sho=INF;
    rep(i,0,n){
        cin>>h[i];
        sho=min(sho,h[i]);
    }
    ll ans=0;
    ans+=sho;
    rep(i,0,n)h[i]-=sho;
    bool flag=false;
    while(1){
        ll dis=ans;
        rep(i,0,n){
        if(h[i]!=0){
                if(!flag)ans++;
                flag=true;
                h[i]--;
            }
            else{
                flag=false;
            }
        }
        flag=false;
        if(dis==ans)break;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<assert.h>

template<typename T>
void swap(T &a,T &b){
  T x=a;
  a=b;
  b=x;
}

int dif(int x,int y){return x-y>=0?x-y:y-x;}

const int N = 4;
int st[N*N];

int calc(int i,int j){ 
  if(st[i*N+j]<0) return 0;
  int res=0; 
  res+=dif(i,st[i*N+j]/N);
  res+=dif(j,st[i*N+j]%N);
  return res;
}

int dist=0,ans=45;

int check(int cur){
  if(dist==0&&ans>cur) ans=cur;
  int val=cur+dist;
  return val<ans;  
}

int dy[]={0,0,1,-1};
int dx[]={1,-1,0,0};
int in(int y,int x){return 0<=y&&y<N&&0<=x&&x<N;};

void dfs(int di,int y,int x,int p){
  for(int k=0;k<4;k++){
    if((p>=0)&&((p^1)==k)) continue;
    int ny=y+dy[k],nx=x+dx[k];
    if(!in(ny,nx)) continue;
    dist-=calc(ny,nx);
    swap(st[y*N+x],st[ny*N+nx]);
    dist+=calc(y,x);
    if(check(di+1)) dfs(di+1,ny,nx,k);    
    dist-=calc(y,x);
    swap(st[y*N+x],st[ny*N+nx]);
    dist+=calc(ny,nx);
  }
}

int main(){
  for(int i=0;i<N;i++)
    for(int j=0;j<N;j++)
      std::cin>>st[i*N+j],st[i*N+j]--;
  
  for(int i=0;i<N;i++)
    for(int j=0;j<N;j++)
      dist+=calc(i,j);
  
  int y=-1,x=-1;
  for(int i=0;i<N;i++)
    for(int j=0;j<N;j++)
      if(st[i*N+j]<0) y=i,x=j;

  check(0);
  dfs(0,y,x,-1);
  
  std::cout<<ans<<std::endl;
  return 0;
}



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

typedef long long int LL;
typedef long long int LLint;

//Faster Program
#define endl "\n"

//Faster Coding
#define ED return
#define GET(a) int a;cin >> a
#define DGET(a) double a;cin >> a
#define SGET(a) string a;cin >> a
#define CGET(a) char a;cin >> a
#define PRINT(a) cout << a << "\n"
#define ANS(a,b) int a;cin >> a;cout << b << "\n"
#define FOR(n) for(int i = 0;i < n;i++)
#define SORT(vec) sort(vec.begin(),vec.end())
#define REV(vec) reverse(vec.begin(),vec.end())

//As Function
#define UP(a,b) ((a+(b-1))/b)
#define ipow(x,y) LL(pow(x,y))

//Debug
#define TEST cout << "OK" << endl

const double PI = M_PI;
const long long INF = int(10e9-1);
const long long MOD = int(10e9+7);

//Settings
const bool DO_BENCHMARK = false;
const int DOUBLE_ACCURACY = 15;

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(DOUBLE_ACCURACY);
    void solve();
    if(DO_BENCHMARK){
        clock_t start = clock();
        solve();
        clock_t end = clock();
        const double time = static_cast<double>(end-start)/CLOCKS_PER_SEC*1000.0;
        cout << "\n" << time << "[ms]\n";
    }
    else solve();
}

void solve(){
   ANS(n,180*(n-2));
}



Measured memory_bytes: 256
#include <iostream>
using namespace std;
void a(){
    int A,B; cin >> A >> B;

    int ans = 0;
    if (A > B){
        ans +=A;A--;
    } else {
        ans += B;
        B--;
    }

    if (A > B){
        ans +=A;A--;
    } else {
        ans += B;B--;
    }

 cout << ans;

}

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


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

using namespace std;

int main(){
  int n,k;
  cin>>n>>k;
  vector<int> v(n);
  for(int i=0;i<n;i++)
    cin>>v[i];
  sort(v.begin(),v.end());
  int sum=0;
  for(int i=0;i<k;i++)
    sum+=v[i];
  cout<<sum;
  return 0;
}


Measured memory_bytes: 3608
N = int(input())
A = list(map(int, input().split()))

def solve():
    count = 0
    tmp = A[0]
    for i in range(1, N):
        if A[i] >= tmp:
            tmp = A[i]
        else:
            count += tmp - A[i]
    return count

if __name__ == "__main__":
    print(solve())


Measured memory_bytes: 32200
#include <bits/stdc++.h>
  using namespace std;
  typedef long long int ll;
  #define mod 1000000007
  #define all(v)  v.begin(),v.end()
  #define pb push_back
  #define size(v)  (int) v.size()
  #define fast ios_base:: sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL)
  ll power_mod(ll a,ll x){if(x==0) return 1;ll y=power_mod(a,x/2);ll ans=(y*y)%mod; if(x%2) ans=(ans*a)%mod;return ans;}
  ll inv(ll a){return power_mod(a,mod-2);}
  ll power(ll a, ll x){ if(x==0) return 1; ll y= power(a,x/2); ll ans=(y*y); if(x%2) ans*=a; return ans;}
  int add( int a ,int b){a+=b;if(a>mod) a-=mod; return a;} 
  char s[1001][1001];
  int main()
  {
     
     int n,m;
     cin>>n>>m;
     
     for(int i=1;i<=n;i++) for(int j=1;j<=m;j++) cin>>s[i][j];
     int dp[n+1][m+1];

     memset(dp,0,sizeof(dp));
     for(int i=1;i<=n;i++) {if(s[1][i]=='#') break; else dp[1][i]=1;}
     for(int i=1;i<=m;i++) {if(s[i][1]=='#') break; else dp[i][1]=1;	}

     for(int i=2;i<=n;i++)
     {
     	  for(int j=2;j<=m;j++)
     	  {
     	  	  if(s[i][j]=='#') continue;
     	  	  dp[i][j]=add(dp[i-1][j],dp[i][j-1]);
     	  }
     }	

     cout<<dp[n][m]<<endl;
        
  }




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

using ll=long long;

ll sqpow(ll a, ll b){
	if(b==0)return 1;
	if(b%2==0)return sqpow(a*a, b/2);
	else return a*sqpow(a*a, b/2);
}

void solve(){
	ll n,k;
	cin>>n>>k;
	cout<<k*sqpow(k-1, n-1)<<endl;
}

signed main(){
	//while(1)
	solve();
}

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

#define  rep(i,n)   for(int i=0; i<(int)n; i++)
#define  per(i,n)   for(int i=((int)n)-1; i>=0; i--)
#define  mem(x,y)   memset(x,y,sizeof(x))
#define  read(f)    freopen(f, "r", stdin)
#define  write(f)   freopen(f, "w", stdout)
#define  pii        pair<int,int>
#define  mp         make_pair
#define  ff         first
#define  ll         long long
#define  ss         second
#define  pb         push_back
#define  MAX        100000


int main(){
    string s;
    while(cin>>s)
    {
        int l = s.size();
        if(s[l-1]=='s') cout<<s<<"es"<<endl;
        else cout<<s<<"s"<<endl;
    }
    return 0;
}


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

using namespace std;

int n, m, k;
int ans;
int a[200010];
int b[200010];
long long sa[200010];
long long sb[200010];
int main() 
{
	cin >> n >> m >> k;
	for(int i = 1; i <= n; i++)
	{
		cin >> a[i];
	}
	for(int j = 1; j <= m; j++)
	{
		cin >> b[j];
	}
	for(int i = 1; i <= n; i++)
	{
		sa[i] = sa[i-1] + a[i];
	}
	for(int j = 1;j  <= m; j++)
	{
		sb[j] = sb[j-1] + b[j];
	}
	int j = m;
	for(int i = 0; i <= n; i++)
	{	
		if(sa[i] > k)
		{
			break;
		}
		while(sb[j] > k - sa[i])
		{
			j -= 1;
		}
		ans = max(ans, i + j);
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 8440
#include <bits/stdc++.h>
using namespace std;
template < typename T > std::string to_string( const T& n )
    {
        std::ostringstream stm ;
        stm << n ;
        return stm.str() ;
    }

int main() {
  int a,b;
  cin >> a >> b;
  string ans="";
  for(int i=0; i<max(a,b); i++)ans+=to_string(min(a,b));
  cout << ans << endl;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <algorithm>
#include <climits>
#include <cstring>
#include <cmath>
#include <stack>
#include <iomanip>
#include <tuple>
#include <functional>
#include <cfloat>
#include <map>

//LLONG_MAX
#define int long long
#define CONTAINS(v,n) (find((v).begin(), (v).end(), (n)) != (v).end())
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define ARY_SORT(a, size) sort((a), (a)+(size))
#define MAX(a,b) (((a) > (b)) ? (a) : (b))
#define MIN(a,b) (((a) < (b)) ? (a) : (b))
#define REMOVE(v,a) (v.erase(remove((v).begin(), (v).end(), (a)), (v).end()))
#define REVERSE(v) (reverse((v).begin(), (v).end()))
#define LOWER_BOUND(v,a) (lower_bound((v).begin(), (v).end(), (a)))
#define UPPER_BOUND(v,a) (upper_bound((v).begin(), (v).end(), (a)))
#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define CONTAINS_MAP(m, a) (m).find((a)) != m.end()
using namespace std;

int N, M;
int link_flg[701][701];
vector<int> link[701];

using P = pair<int, int>;
vector<P> group;

bool func_flg[701];

int dp[701][701] = {};


bool func(int n)
{
	if (func_flg[n])
	{
		return true;
	}

	int flg[701] = {};
	vector<int> a;
	vector<int> b;

	queue<int> q;
	q.push(n);
	flg[n] = 1;
	func_flg[n] = true;
	a.push_back(n);

	int color = -1;
	while (q.size() > 0)
	{
		int q_size = q.size();
		for (int i = 0; i < q_size; i++)
		{
			int p = q.front();
			q.pop();

			for (int l : link[p])
			{
				if (flg[l] != 0)
				{
					if (flg[l] != color)
					{
						return false;
					}
				}
				else
				{
					flg[l] = color;
					func_flg[l] = true;
					if(color > 0) 
						a.push_back(l);
					else 
						b.push_back(l);
					q.push(l);
				}
			}
		}

		color *= -1;
	}

	group.push_back(P(a.size(), b.size()));

	return true;
}

signed main()
{
	cin >> N >> M;
	REP(i, M)
	{
		int a, b;
		cin >> a >> b;
		link_flg[a][b] = true;
		link_flg[b][a] = true;
	}

	for (int i = 1; i <= N; i++)
	{
		for (int j = 1; j <= N; j++)
		{
			if (i != j)
			{
				if (!link_flg[i][j])
				{
					link[i].push_back(j);
				}
			}
		}
	}

	for (int i = 1; i <= N; i++)
	{
		if (!func(i))
		{
			cout << -1 << endl;
			return 0;
		}
	}

	dp[0][group[0].first] = 1;
	dp[0][group[0].second] = 1;

	for (int g = 1; g < group.size(); g++)
	{
		for (int i = 0; i <= N; i++)
		{
			if (dp[g - 1][i] > 0)
			{
				dp[g][i + group[g].first] = 1;
				dp[g][i + group[g].second] = 1;
			}
		}
	}

	int min = INT_MAX;
	for (int i = 0; i <= N; i++)
	{
		if (dp[group.size() - 1][i] > 0)
		{
			int a = i - 1;
			int b = N - i - 1;
			int aa = (a * (a + 1)) / 2;
			int bb = (b * (b + 1)) / 2;
			int c = aa + bb;
			min = MIN(min, c);
		}
	}

	cout << min << endl;
}







Measured memory_bytes: 7936
#define fi first
#define se second
#define mp make_pair
#define pb push_back

#define LOCAL 1

#include<bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#define dbg(...) cout<<#__VA_ARGS__ ": ["; for(auto e: __VA_ARGS__){cout<<e<<", ";} cout<<"]\n"
#define dbg1(...) cout<<#__VA_ARGS__ " "<< __VA_ARGS__ 
#else
#define dbg(...) 1;
#define dbg1(...) 1;
#endif

typedef long long ll;
typedef unsigned long long ull;
constexpr int R=2e6+69, INF=2e9+6969;

int n,a[R],m,wys[R];
bitset <R> vis;

int main()
{
	cin>>n;
	for(int i=0;i<n;++i)
	{
		cin>>a[i];
		wys[a[i]]++;
		m=max(m,a[i]);
	}
	sort(a,a+n);
	int prev=1,ans=0;
	for(int i=0;i<n;++i)
	{
		int cur=a[i];
		if(vis[cur]==0)
		{
			if(wys[cur]==1) ans++;
			//  printf("%d\n", cur);
			for(int j=cur;j<=m;j+=cur) vis[j]=1;
		}
	}
	cout<<ans<<"\n";
	return 0;
}


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

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    std::cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');std::cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#define rep(i,a,n)    for(int i=a; i<=n; ++i)
#define rep1(i,a,n)   for(int i=a; i>=n; --i)
#define pb            push_back
#define mp            make_pair
#define int           long long
#define fr            first
#define sc            second
#define vc            vector
#define sz(v)         (int)v.size()
#define all(x)        (x).begin(),(x).end()
#define rall(x)       (x).rbegin(),(x).rend()
#define N             (int)(1e6+5)
#define M             1000000007
#define MM            998244353
#define PI            3.14159265358979
#define INF           1000000000000000

typedef vector<int> vi;
typedef pair<int,int> pii;
typedef map<int,int> mii;

int n,m,ans; string str;

int solve(){
    cin>>n>>str;// n=sz(str);
    rep(i,2,n-1){
        if(str[i-2]=='A'&&str[i-1]=='B'&&str[i]=='C') ans++;
    }
    cout<<ans;
    return 0;
}

signed main() {
    ios::sync_with_stdio(0);
    //std::mt19937_64 rng(std::chrono::steady_clock::now().time_since_epoch().count());
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int t=1;
    //cin>>t;
    while(t--) solve();
    return 0;
}


Measured memory_bytes: 256
/* 2012-07-07T08:25:28 */
#define DEBUG_ON
#define CONDITION true
using namespace std;/*{{{*/

#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <sys/time.h>
#include <vector>

#define INF (1e9)
static const double PI (3.14159265358979323846);
static const double EPS (1e-10);

typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef complex<double> P;

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
inline double now(){ struct timeval tv; gettimeofday(&tv, NULL); return ((double)(tv.tv_sec) + (double)(tv.tv_usec) * 1e-6); }

#define FOR(i, b, e) for (typeof(b) i = (b); assert((i) <= (e)), i != (e); ++i)
#define REP(i, n) FOR(i, 0, n)

#define IFC(c) if(c) continue;
#define IFB(c) if(c) break;
#define IFR(c, r) if(c) return r;

#define OPOVER(_op, _type) inline bool operator _op (const _type &t) const

#define arrsz(a) ( sizeof(a) / sizeof(a[0]) )

#define F first
#define S second
#define MP(a, b) make_pair(a, b)

#define SZ(a) ((ll)a.size())
#define PB(e) push_back(e)
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())

#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define EACH(c,it) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define EXIST(s,e) ((s).find(e)!=(s).end())

#define BIT(n) (1ULL << (n))
#define BITOF(n, m) ((n) >> (m) & 1)

#define RANGE(a, b, c) ((a) <= (b) && (b) <= (c))

#ifdef DEBUG_ON
#define dprt(fmt, ...) if (CONDITION) fprintf(stderr, fmt, __VA_ARGS__)
#define darr(a) if (CONDITION) copy( (a), (a) + arrsz(a), ostream_iterator<int>(cerr, " ") ); cerr << endl
#define darr_range(a, f, t) if (CONDITION) copy( (a) + (f), (a) + (t), ostream_iterator<int>(cerr, " ") ); cerr << endl
#define dvec(v) if (CONDITION) copy( ALL(v), ostream_iterator<int>(cerr, " ") ); cerr << endl
#define darr2(a, n, m) if (CONDITION) FOR(i, 0, (n)){ darr_range( (a)[i], 0, (m) ); }
#define dvec2(v) if (CONDITION) FOR(i, 0, SZ(v)){ dvec( (v)[i] ); }
#define WAIT() if (CONDITION) { string _wait_; cerr << "(hit return to continue)" << endl; getline(cin, _wait_); }
#else
#define cerr if(0) cerr
#define dprt(fmt, ...)
#define darr(a)
#define darr_range(a, f, t)
#define dvec(v)
#define darr2(a, n, m)
#define dvec2(v)
#define WAIT()
#endif
/*}}}*/

int main(int argc, char const* argv[])
{
	int N; cin >> N;
	while (N--) {
		vector<int> abc;
		REP (i, 3) {
			int buf; cin >> buf;
			abc.PB(buf);
		}
		SORT(abc);
		if (pow(abc[0], 2) + pow(abc[1], 2) == pow(abc[2], 2)) {
			cout << "YES" << endl;
		} else {
			cout << "NO" << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 0
#include <stdio.h>

int main(void)
{
	int x, y, z;
	int tmp, count;
	int n, m;
	
	while (1){
		scanf("%d %d", &x, &y);
		
		if (x == 0 && y == 0){
			break;
		}
		
		if (x <= y){
			z = y;
			y = x;
			x = z;
		}
		
		count = 0;
		while (y != 0){
			tmp = x % y;
			x = tmp;
			tmp = x;
			x = y;
			y = tmp;
			count++;
		}
		printf("%d %d\n", x, count);
	}
	
	return (0);
}

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

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++) 
#define ll long long
#define ld long double
#define repl(i, n) for (ll i = 0; i < (ll)(n); i++)  
#define outdeb(fir, sec, thr) cout << fir << ":" << sec << ":" << thr << endl

int main()
{
  ll k;
  cin >> k;
  
  if(k % 2 == 0)
  {
    cout << -1 << endl;
    return 0;
  }

  if(k % 7 == 0)
  {
    k = k / 7;
  }

  ll val = 1;
  for(ll times = 1; times <= 2000000; times++)
  {
    if(val % k == 0)
    {
      
      cout << fixed << times << endl;
      return 0;
    }
    val = (val % k) * 10 + 1;
  }

cout << fixed << -1 << endl;
  return 0;
}

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

ll digitFirst(ll x){
  ll first = 0;
  vector<ll> digit;
  while(x>0){
   	first = x%10;
    digit.push_back(first);
    x/= 10;
  }
  for(int i = 0; i< digit.size()-1;i++){
    if(digit[i] != 9){
      first -= 1;
      break;
    }
  }
  return first;
}

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  string s;
  cin >>s;
  int l = s.length();
  int c = s[0] - '0';
  int ans;
  for(int i = 1; i < l;i++){
   if(s[i] != '9'){
     ans = c + 9 * (l - 1) - 1;
     cout << ans << endl;
     return 0;
   }
  }
  ans = c + 9 * (l - 1);
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
using namespace std;
#define ll long long
inline int read()
{
	int x;char c;
	while((c=getchar())<'0'||c>'9');
	for(x=c-'0';(c=getchar())>='0'&&c<='9';)x=x*10+c-'0';
	return x;
}
#define MN 100000
int L,x[MN+5],w[MN+5],a[MN+5],an,b[MN+5],bn,z[MN+5];
ll calx(int x){return a[x%an]-1LL*x/an*L;}
ll caly(int x){return b[x%bn]+1LL*x/bn*L;}
int main()
{
	int n,t,i;ll l,r,mid,res;
	n=read();L=read();t=read();
	for(i=1;i<=n;++i)x[i]=read(),w[i]=read(),z[i]=((x[i]+(w[i]<2?1:-1)*t)%L+L)%L;
	sort(z+1,z+n+1);
	if(w[1]<2)++an;else ++bn;
	for(i=n;i>1;--i)if(w[i]<2)a[an++]=x[i]-L-x[1];
	for(i=2;i<=n;++i)if(w[i]>1)b[bn++]=x[i]-x[1];
	if(w[1]<2)
	{
		if(!bn){for(i=1;i<=n;++i)printf("%d\n",(x[i]+t)%L);return 0;}
		for(l=1,r=3e9;l<=r;)
		{
			mid=l+r>>1;
			if(caly(mid-1>>1)-calx(mid>>1)>2*t)res=r=mid-1;
			else l=mid+1;
		}
		if(res)l=calx(res>>1),r=caly(res-1>>1);else l=r=0;
		x[1]=((x[1]+(r+l+(res&1?-1:1)*(2*t-r+l)>>1))%L+L)%L;
		if(res&1)for(i=1;i<=n;++i){if(z[i]==x[1])break;}
		else for(i=n;i;--i)if(z[i]==x[1])break;
	}
	else
	{
		if(!an){for(i=1;i<=n;++i)printf("%d\n",((x[i]-t)%L+L)%L);return 0;}
		for(l=1,r=3e9;l<=r;)
		{
			mid=l+r>>1;
			if(caly(mid>>1)-calx(mid-1>>1)>2*t)res=r=mid-1;
			else l=mid+1;
		}
		if(res)l=calx(res-1>>1),r=caly(res>>1);else l=r=0;
		x[1]=((x[1]+(r+l+(res&1?1:-1)*(2*t-r+l)>>1))%L+L)%L;
		if(res&1)for(i=n;i;--i){if(z[i]==x[1])break;}
		else for(i=1;i<=n;++i)if(z[i]==x[1])break;
	}
	for(l=i;l<=n;++l)printf("%d\n",z[l]);
	for(l=1;l<i;++l)printf("%d\n",z[l]);
}

Measured memory_bytes: 2688
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <cassert>
#include <functional>

using namespace std;

vector<int> s;

int main(){
	int n, m; cin >> n >> m;
	vector<int> l, r;
	for(int i = 0; i < m; i++){
		int x, y; cin >> x >> y;
		l.push_back(x); r.push_back(y);
	}

	int low = *max_element(l.begin(), l.end());
	int high = *min_element(r.begin(), r.end());
	int ans = 0;

	if(low <= high){
		ans = high - low + 1;
	}

  	cout << ans << endl;

	return 0;
}

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



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

    int n,t;
    cin>>n>>t;
    int ans=10000;
    for(int i=0;i<n;i++){
        int a,b;
        cin>>a>>b;
        if(b<=t)ans=min(ans,a);
    }
    if(ans==10000)cout<<"TLE"<<endl;
    else cout<<ans<<endl;
    
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>

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

using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::vector;

int main() {
  int N, K;
  cin >> N >> K;

  vector<bool> s(N, false);

  int d;
  int a;
  rep(i, K) {
    cin >> d;
    rep(j, d) {
      cin >> a;
      a--;
      s[a] = true;
    }
  }

  int c = 0;
  rep(i, N) {
    if (!s[i]) c++;
  }

  cout << c << endl;

  return 0;
}


Measured memory_bytes: 3628
import java.util.Scanner;

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

        int H = sc.nextInt();
        int A = sc.nextInt();
        int hitNum = (int)Math.ceil((double) H / A);

        System.out.print(hitNum);
    }
}

Measured memory_bytes: 21972
n,m=gets.split.map &:to_i
h=Array.new(m,0)
hh=Array.new(10**5+1,0)
hhh=Array.new(m,0)

gets.split.map{|i|
  g=i.to_i
  h[g%m]+=1
  hh[g]+=1
}
(10**5).times do |i|
  if hh[i]>=2
    hhh[i%m]+=hh[i]/2
  end
end
c=0
(m/2+1).times do |i|
  if i==0 || 2*i==m
    c+=h[i]/2
  else
    g=[h[i],h[m-i]].min
    c+=g
    c+=[(h[i]-g)/2,hhh[i]].min
    c+=[(h[m-i]-g)/2,hhh[m-i]].min
  end
end
p c

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

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

using namespace std;

typedef long long ll;

int main () {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(20) << fixed;

  int n; cin >> n;
  string s, t; cin >> s >> t;

  rep(i, n) {
    cout << s[i];
    cout <<t[i];
  }
  cout << endl;
  return 0;
}


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

int main()
{
    int a,b,c,d;
    cin >> a >> b >> c >> d;
    int n1 = abs(a-b);
    int n2 = abs(b-c);
    int n3 = abs(a-c);
    if(n3 <= d){
        cout << "Yes" << endl;
    }else if(n1 <= d && n2 <= d){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
N = int(input())
a = N//100
b = (N-(100*a))//10
c = N-(100*a+10*b)
if a == b == c:
    ans = N
elif a==b>c:
    ans = 111*(a)
elif a==b<c:
    ans = 111*(a+1)
elif a > b:
    ans = 111*a
elif a < b:
    ans = 111*(a+1)
print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define FLASH ios_base::sync_with_stdio(0);
#define ll int
#define debt(x,y)cout<<"#x = "<<(x)<<" and "<<"#y = "<<(y)<<endl;
#define deb(x)cout<<"#x = "<<(x)<<endl;
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define endl "\n"
#define arr(a,n) for(ll i=1;i<=n;i++) cout<<a[i]<<" "; cout << "\n";
#define vecc(a,n) for(ll i=0;i<n;i++) cout<<a[i]<<" "; cout << "\n";


using namespace std;


ll n,m;
ll dist[1010][1010];
char massiv[1010][1010];

ll used[1010][1010];


ll xx[]={1,-1,0,0};
ll yy[]={0,0,1,-1};

ll check(ll x,ll y)
{
 if(x>=1 && y>=1 && x<=n && y<=m && massiv[x][y]=='.')return 1;
 else return 0;
}

priority_queue<pair<ll,pair<ll,ll> >,vector<pair<ll,pair<ll,ll> > >,greater<pair<ll,pair<ll,ll> > > >q;
ll startx,starty;
ll konecx,konecy;


int main(){
FLASH;
cin.tie(0);
cout.tie(0);
cin>>n>>m;
cin>>startx>>starty;
cin>>konecx>>konecy;


for(ll i=1;i<=n;i++)
{  
 for(ll j=1;j<=m;j++)
 {
   cin>>massiv[i][j];
   dist[i][j]=INT_MAX;	  
 }	
}



q.push(mp(0,mp(startx,starty)));
dist[startx][starty]=0;
while(!q.empty())
{
  auto from=q.top();
  ll money=q.top().first;
  q.pop();
   if(money>dist[from.second.first][from.second.second])continue;
  ll sig=0;
  for(ll i=0;i<4;i++)
  {
	ll tox=from.second.first+xx[i];
	ll toy=from.second.second+yy[i];
	if(check(tox,toy))
	{ 	
	  if(dist[tox][toy]>dist[from.second.first][from.second.second]){dist[tox][toy]=dist[from.second.first][from.second.second];q.push(mp(dist[tox][toy],mp(tox,toy)));}
	  
    }  
  }
  if(!sig)
  {
	for(ll i=-2;i<=2;i++)
	{
	  for(ll j=-2;j<=2;j++)
	  {
		ll tox=from.second.first+i;
	    ll toy=from.second.second+j;
	    if(check(tox,toy))
	    {
	     if(dist[tox][toy]>dist[from.second.first][from.second.second]+1){dist[tox][toy]=dist[from.second.first][from.second.second]+1;q.push(mp(dist[tox][toy],mp(tox,toy)));}
	    }
	  }	
    }  
  }	
}

if(dist[konecx][konecy]==INT_MAX)cout<<-1<<endl;
else cout<<dist[konecx][konecy]<<endl;


return 0;
} 


Measured memory_bytes: 8700
#include <cstdio>
using namespace std;
int main(){
  int A,B;
  scanf("%d %d",&A,&B);
  if(A==B) printf("Draw\n");
  else if(A==1) printf("Alice\n");
  else if(B==1) printf("Bob\n");
  else if(A>B) printf("Alice\n");
  else if(A<B) printf("Bob\n");
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  char S;
  cin >> S;
  if (S=='a'||S=='i'||S=='u'||S=='e'||S=='o')
   cout << "vowel" << endl;
  else
   cout << "consonant" << endl;
  
}
      
   

Measured memory_bytes: 384
import java.math.BigDecimal
import kotlin.math.ceil
import kotlin.math.floor

//

fun main() {
    abc169c()
}

fun abc169c() {
    val (a, b) = readLine()!!.split(" ")
    val A = BigDecimal(a)
    val B = BigDecimal(b)
    val m = A.multiply(B)
    val text = m.toPlainString()
    println(text.substring(0, text.lastIndex - 2))
}


Measured memory_bytes: 35992
#include <iostream>
#include <cstdio>
#include <iomanip>

#include <vector>
#include <map>
#include <set>
#include <queue>
#include <bitset>
#include <stack>
#include <utility>

#include <numeric>
#include <algorithm>
#include <functional>

#include <cctype>

#include <complex>
#include <string>
#include <sstream>

using namespace std;

#define all(c) c.begin(),c.end()
#define rall(c) c.rbegin(),c.rend()
#define rep(i,n) for(unsigned int i=0;i<(n);i++)
#define tr(it,container) for(typeof(container.begin()) it = container.begin(); \
                                                  it != container.end(); ++it)
#define mp(a,b) make_pair((a),(b))

typedef long long ll;
typedef complex<double> P;
const int dx[] = {1,0,-1,0};
const int dy[] = {0,-1,0,1};
const double EPS = 1e-9;
const int days[] = {31,28,31,30,31,30,31,31,30,31,30,31};
const int daysleap[] = {31,29,31,30,31,30,31,31,30,31,30,31};

const int M = 1e6+10;
bool isPrime[M] = {false};

void seive(){
    bool found[M] = {false};
    for(int i=2;i*i < M;i++){
        if(found[i]) continue;
        for(int j=i*2;j<M;j+=i){
            found[j] = true;
        }
    }
    for(int i=2;i<M;i++){
        isPrime[i] = !found[i];
    }
}

int main(){
    seive();
    while(true){
        int a,d,n;
        cin >> a >> d >> n;
        if(a==0)break;
        int now = a;
        int c = 0;
        while(true){
            if(isPrime[now]) c++;
            if(c==n){
                cout << now << endl;
                break;
            }
            now += d;
        }
    }
    return 0;
}

Measured memory_bytes: 3116
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
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;
}

const long double EPS = 1e-10;
const long long INF = 1e18;
const long double PI = acos(-1.0L);
//const ll mod = 1000000007;

int main() {
    //cout.precision(10);
    cin.tie(0);
    ios::sync_with_stdio(false);
  char a;
  cin >> a;
  cout << ++a;
    return 0;
}


Measured memory_bytes: 256
import sys
sys.setrecursionlimit(500000) 
input = sys.stdin.readline
from collections import deque
H,W = map(int,input().split())
C = list(map(int,input().split()))
C[0] -= 1; C[1] -= 1
D = list(map(int,input().split()))
D[0] -= 1; D[1] -= 1
S = []; INF = float("inf")
for i in range(H):
  temp = str(input());temp =list(temp)
  S.append(temp)
#print(S)
reach = [[INF]*W for _ in range(H)]
reach[C[0]][C[1]] = 0
dxdy = [(1,0),(-1,0),(0,1),(0,-1)]
Q = deque([])
Q.append([C,0])
while Q:
  z, score = Q.popleft()
  x = z[0];y=z[1]
 
  for i in range(4):
    nx = x + dxdy[i][0]
    ny = y + dxdy[i][1]
    #print(nx,ny)
    if 0<=nx<H and 0<=ny<W and S[nx][ny] == "." and reach[nx][ny] > score:
      reach[nx][ny] = min(score,reach[nx][ny])
      u = [nx,ny]
      Q.appendleft([u,score])
  #print(reach)
 
  for i in range(5): #0~4
    for j in range(5):
      mx = x-2 + i
      my = y-2 + j
      if i == 2 and j == 2:
        continue
      if mx < 0 or mx >= H or my < 0 or my >= W or S[mx][my] == "#":
        continue
      if reach[mx][my] <= score+1: #すでにこのスコア以下でいける。
        continue
      reach[mx][my] = min(score+1,reach[mx][my])
      p = [mx,my]
      #print(v,p,"X")
      Q.append([p,score+1])
#dfs(C,0)
#print(reach)
#print(reach[D[0]][D[1]])
if reach[D[0]][D[1]] == INF:
  print(-1)
else:
  print(reach[D[0]][D[1]])

Measured memory_bytes: 169044
#include <iostream>
#include <string>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <algorithm>

using namespace std;

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

	int amari = n / 500;
  	if(n % 500 <= a) {
    	cout << "Yes" << endl;
    	return 0;
    } 
	cout << "No" << endl;
}


Measured memory_bytes: 256
using System;
using System.Security.Cryptography;
using System.Text;

namespace abc152_b
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] ab = Console.ReadLine().Split(" ");
            int a = int.Parse(ab[0]);
            int b = int.Parse(ab[1]);

            string resStr = new string("");
            if(a > b)
            {
                resStr = getResStr(a, char.Parse(ab[1]));
            }else if(b > a) 
            {
                resStr = getResStr(b, char.Parse(ab[0]));
            }
            else
            {
                resStr = getResStr(a, char.Parse(ab[1]));
            }
            Console.WriteLine(resStr);
        }

        static string getResStr(int nod, char c)
        {
            StringBuilder resStr = new StringBuilder();
            for (int i = 0; i < nod; i++)
            {
                resStr.Append(c);
            }
            return resStr.ToString();
        }
    }
}


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


#define _USE_MATH_DEFINES_
#define ll long long
#define ld long double
#define Accepted 0
#define pb push_back
#define mp make_pair
#define sz(x) (int)(x.size())
#define every(x) x.begin(),x.end()
#define F first
#define S second
#define For(i,x,y)  for (ll i = x; i <= y; i ++) 
#define FOr(i,x,y)  for (ll i = x; i >= y; i --)
#define SpeedForce ios_base::sync_with_stdio(0), cin.tie(0)
// ROAD to...                                                                                                                                                                                                                Red

using namespace std;

inline bool isvowel (char c) {
	c = tolower(c);
    if (c == 'a' || c == 'e' || c == 'i' || c == 'y' || c == 'o' || c == 'u') return 1;
    return 0;
}

const double eps = 0.000001;
const ld pi = acos(-1);
const int maxn = 1e7 + 9;
const int mod = 1e9 + 7;
const ll MOD = 1e18 + 9;
const ll INF = 1e18 + 123;
const int inf = 2e9 + 11;
const int mxn = 1e6 + 9;
const int N = 5e5 + 1;                                          
const int M = 22;
const int pri = 997;
const int Magic = 801;

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

int hate[10];
 
bool check(int n) {
	while (n > 0) {
		if (hate[n % 10]) {
			return false;
		}
		n /= 10;
	}
 
	return true;
}
 
int main() {
	
	int n, k; cin >> n >> k;
 
	for (int i = 0; i < n; i++) {
		int buf; cin >> buf;
 
		hate[buf] = 1;
	}
 
	for (int i = n; n < 999199; i++) {
		
		if (check(i)) {
			cout << i << endl;
			return 0;
		}
	}
 
	return 0;
}

Measured memory_bytes: 256