akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(long long i=0; i<(n); i++)
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }


int main(){
    ll n,m,q; cin>>n>>m>>q;
    vector<ll> a(q), b(q), c(q), d(q);
    rep(i,q) cin>>a[i]>>b[i]>>c[i]>>d[i];
    queue<vector<ll>> que;
    rep(i,n) que.push({i+1});
    while(true){
        vector<ll> v = que.front();
        if(v.size()==n) break;
        que.pop();
        for(ll j=v[v.size()-1]; j<=m; j++){
            vector<ll> w = v;
            w.push_back(j);
            que.push(w);
        }
    }
    ll res=0;
    while(!que.empty()){
        vector<ll> v=que.front();
        que.pop();
        ll tmp=0;
        rep(i,q){
            if(v[b[i]-1]-v[a[i]-1]==c[i]) tmp+=d[i];
        }
        chmax(res, tmp);
    }
    cout<<res<<endl;
    return 0;
}

Measured memory_bytes: 14660
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf = 1e9 + 7;
const ll longinf = 1LL << 60;
const ll mod = 1e9 + 7;


int n, a, b;
pair<int, int> p[200004];
ll rs1[200004], rs2[200004];
bool ans = true;



int main() {

	cin >> n;
	rep(i, n) {
		cin >> a >> b;
		p[i] = make_pair(b, a);
	}
	sort(p, p + n);
	rep(i, n) {
		if (i == 0) {
			rs1[i] = p[i].second;
		}
		else {
			rs1[i] = rs1[i - 1] + p[i].second;
		}
	}
	rep(i, n) {
		if (rs1[i] > p[i].first) ans = false;
	}

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

	return 0;
}


Measured memory_bytes: 3328
#include <bits/stdc++.h>
#define rep(i, start, end) for (long long i = start; i < end; ++i)
#define repreverse(i, start, end) for (long long i = start; i >= end; --i)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define len(x) ((long long)(x).size())
#define lcm(a, b) ((a) / __gcd((a), (b)) * (b))
using namespace std;
using ll = long long;
using ld = long double;
using vll = vector<ll>;
using vllvll = vector<vll>;
using vc = vector<char>;
using pll = pair<ll, ll>;
template<class T>void print1d(T x,ll n=-1){if(n==-1)n=x.size();rep(i,0,n){cout<<x[i]<<' ';}cout<<'\n';}
template<class T>void print2d(T x,ll r=-1,ll c=-1){if(r==-1)r=x.size();if(c==-1)c=x[0].size();rep(i,0,r)print1d(x[i],c);}
template<class T, class U>bool haskey(T mp, U key) { return mp.find(key) != mp.end(); }
template<class T, class U>bool isin(T el, U container) { return find(all(container), el) != container.end(); }
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
template<class T>bool even(T n) { return ! (n & 1); }
template<class T>bool odd(T n) { return n & 1; }
template<class T>ld deg2rad(T deg) { return M_PI * deg / 180.0; }
template<class T>ld rad2deg(T rad) { return 180.0 * rad / M_PI; }
ll intpow(ll a,ll n){ll p=1;while(n){if(n&1)p*=a;a*=a;n>>=1;}return p;} 
const long double pi = M_PI;
const long long big = 1LL << 50;
const long long inf = 1LL << 60;
const long long mod = 1e9 + 7;



int main()
{
        long long a, b, c;
        cin >> a >> b >> c;
        long long l = 4 * a * b;
        long long r = c - a - b;
        long long rr = r * r;

        if (r < 0) {
                cout << "No" << endl;
                return 0;
        }
        if (l < rr) {
                cout << "Yes" << endl;
        } else {
                cout << "No" << endl;
        }
}


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

typedef long long ll;

int main(){
    
    for(ll n; cin >> n, n;){
        vector<string>vec(n);
        for(ll i = 0; i < n; i++){
            cin >> vec[i];
        }
        for(ll i = n - 1; i > 0; i--){
            ll idx = 0;
            for(;vec[i][idx + 1] == '.' || vec[i][idx + 1] == '|';idx++)if(vec[i][idx] == '.')vec[i][idx] = ' ';
            vec[i][idx] = '+';
            for(ll j = i - 1; j > 0; j--){
                if(vec[j][idx] != '.')break;
                vec[j][idx] = '|';
            }
        }
        for(ll i = 0; i < n; i++){
            cout << vec[i] << endl;
        }
    }
    
    return 0;    
}


Measured memory_bytes: 3732
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES

#include <bits/stdc++.h>
using namespace std;
using i32 = int32_t;  using i64 = int64_t;  using str = string;
using u32 = uint32_t; using u64 = uint64_t; using usize = size_t;
using f64 = double_t; template <typename T> using vec = vector<T>;
#define times(n, i) for (i64 i = 0; i < (n); ++i)
#define range(n, m, i) for (i64 i = (n); i < (m); ++i)
#define upto(n, m, i) for (i64 i = (n); i <= (m); ++i)
#define downto(n, m, i) for (i64 i = (n); i >= (m); --i)
#define foreach(xs, x) for (auto &x : (xs))
#define all(xs) (xs).begin(), (xs).end()
#define sortall(xs) sort(all(xs))
#define reverseall(xs) reverse(all(xs))
#define uniqueall(xs) (xs).erase(unique(all(xs)), (xs).end())
#define maximum(xs) (*max_element(all(xs)))
#define minimum(xs) (*min_element(all(xs)))
#define even(x) (((x) & 1) == 0)
#define odd(x) (((x) & 1) == 1)
#define append emplace_back
const i64 MOD = 1000000007;

i32 n, l;
multiset<str> s;

i32 main()
{
    cin >> n >> l;
    times(n, i) {
        str a;  cin >> a;
        s.insert(a);
    }

    str ans = "";
    auto it = s.begin();
    while (it != s.end()) {
        ans += *it;
        it++;
    }
    cout << ans << endl;
    return 0;
}

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

A = [0]*N

for i in range(N):
    A[i] = int(input())
    
    
a = sorted(A)

Max = a[len(a)-1]
PreMax = a[len(a)-2]

for i in range(N):
    
    if A[i] < Max:
        print(Max)
    else:
        print(PreMax)

Measured memory_bytes: 14092
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
#include<bits/stdc++.h>
#define inf 0x3f3f3f3f
const int maxn = 1000050;
using namespace std;
typedef long long ll;
int p[maxn];
int main()
{
	int n,k;
	cin>>n>>k;
	for(int i=0;i<n;i++)
	cin>>p[i];
	sort(p,p+n);
	int sum=0;
	for(int i=0;i<k;i++)
	sum+=p[i];
	cout<<sum;
	return 0;
}

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

//union_find begin
#define MAX 5000000
struct node{  int parent,size; };
node tree[MAX];
void init(){
  for(int i=0;i<MAX;i++){
    tree[i].parent=i;
    tree[i].size=1;    
  }
}

int find(int x){ 
  if(tree[x].parent==x)return x;
  tree[x].parent = find( tree[x].parent );
  return tree[x].parent;
}

/*
int find(int x){
  stack<int> st;
  while(tree[x].parent!=x){    
    st.push(x);
    x=tree[x].parent;
  }
  while(!st.empty()){
    tree[st.top()].parent=x;
    st.pop();
  }
  return x;
}
*/
int count(int x){
  x=find(x);
  return tree[x].size;
}

bool same(int x,int y){
  return ( find(x) == find(y) );
}

void unite(int x,int y){
  x=find(x);
  y=find(y);
  if(x==y)return;  
  if(count(x)>count(y))swap(x,y);
  tree[x].parent=y;
  tree[y].size+=tree[x].size;
}
// union find end

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

int W,H,N,target;
char t[1005][1005];

int change(int i,int j){
  return i*W+j;
}

int solve(){
  cin>>N;
  for(int ans=1;ans<=N;ans++){
    int i,j;
    cin>>j>>i;
    if(t[i][j]=='.')continue;
    t[i][j]='.';
    for(int k=0;k<4;k++){
      int ni=i+dy[k];
      int nj=j+dx[k];
      if(ni<0 || nj<0 || H<=ni || W<=nj)continue;
      if(t[ni][nj]=='#')continue;
      unite( change(i,j) , change(ni,nj) );
    }
    if(same(target,0))return ans;
  }
  return -1;
}

int main(){
  init();
  cin>>W>>H;
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      cin>>t[i][j];
      if(t[i][j]=='t')target=change(i,j);
    }
  }  
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      if(t[i][j]=='#')continue;
      for(int k=0;k<4;k++){
        int ni=i+dy[k];
        int nj=j+dx[k];
        if(ni<0 || nj<0 || H<=ni || W<=nj)continue;
        if(t[ni][nj]=='#')continue;
        unite( change(i,j) , change(ni,nj) );
      }
    }
  }
  if( same( target , 0 ) ){
    cout<<"0"<<endl;
  }else{
    cout<<solve()<<endl;
  }  
  return 0;
}

Measured memory_bytes: 41208
#include <cstdio>

#define ll long long

int main(){
    int n;
    ll d;
    scanf("%d %lld",&n,&d);

    d=d*d;

    int cnt=0;
    for(int i=0;i<n;i++){
        ll x,y;
        scanf("%lld %lld",&x,&y);
        if(x*x+y*y<=d) cnt++;
    }
    printf("%d\n",cnt);
}


Measured memory_bytes: 1680
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <string>
#include <cmath>
#include <stack>
#include <queue>
#include <list>
#include <set>
#include <numeric>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define all(x) (x).begin(), (x).end()
#define itr(i, x) for(auto i = (x).begin(); i != (x).end(); i++)
#define ritr(i, x) for(auto i = (x).rbegin(); i != (x).rend(); i++)
#define INF 1010101010
#define MOD 1000000007
#define LL long long
using Coord = pair<int, int>;

int main() {
    int n, k;
    vector<bool> dk(10);
    cin >> n >> k;
    for (int i = 0; i < k; i++) {
        int tmp;
        cin >> tmp;
        dk[tmp] = true;
    }
    while (true) {
        int tmp = n;
        bool ok = true;
        while (tmp > 0) {
            char d = tmp % 10;
            if (dk[d]) ok = false;
            tmp /= 10;
        }
        if (ok) break;
        n++;
    }
    
    cout << n << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define res register int
#define ll long long
//#define cccgift
//#define getchar()(p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++)
//char buf[1<<21],*p1=buf,*p2=buf;
template<typename T>
inline void read(T &x)
{
    static char ch;bool f=1;
    for(x=0,ch=getchar();!isdigit(ch);ch=getchar()) if(ch=='-') f=0;
    for(;isdigit(ch);x=(x<<1)+(x<<3)+(ch^48),ch=getchar());x=f?x:-x;
}
template<typename T>
void print(T x)
{
    if (x<0) x=-x,putchar('-');
    if (x>9) print(x/10);
    putchar(x%10+48);
}
template<typename T>
inline void print(T x,char ap) {print(x);if (ap) putchar(ap);}
template<typename T>
inline void chkmax(T &x,const T &y) {x=x<y?y:x;}
template<typename T>
inline void chkmin(T &x,const T &y) {x=x<y?x:y;}
int n,t[51],tot;
char s[51][101],s1[101];
inline bool check(int x) {
	int len=strlen(s[x]),len1=strlen(s1);
	if(len!=len1) return false;
	for(res i=1;i<=len;++i) if(s[x][i]!=s1[i]) return false;
	return true;
}
int main()
{
	ios::sync_with_stdio(false);
	cin>>n;
	for(res i=1;i<=n;++i) cin>>s[i]>>t[i];
	cin>>s1;
	for(res i=n;i;--i) if(!check(i)) tot+=t[i];else break;
	cout<<tot<<'\n';
	cout<<flush;	
	return 0;
}
/* stuff you should look for
    * int overflow, array bounds
    * special cases (n=1?), set tle
    * do something instead of nothing and stay organized
*/ 

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <map>
#define ll long long
using namespace std;
int main(){
    int n;
    cin>>n;
    vector<int> h(n);
    for(int i=0;i<n;i++){
        cin>>h[i];
    }
    vector<int> dp(n,0);
    dp[0]=0;
    dp[1]=abs(h[0]-h[1]);
    for(int i=2;i<n;i++){
        dp[i]=min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i]-h[i-2]));
    }
    cout<<dp[n-1]<<endl;
    return 0;
}

Measured memory_bytes: 1024
Option Strict On

Module Module1
    Sub Main()
        'let'
        Dim tmp() As Long =
            Array.ConvertAll(Of String, Long)(
                Split(Console.ReadLine()), AddressOf Long.Parse)
        Dim N As Long = tmp(0)
        Dim Y As Long = tmp(1)

        'var'
        Dim ans() As Long = New Long() {-1, -1, -1}
        Dim flg As Boolean

        For i As Long = 0 To N
            For j As Long = 0 To N - i
                Dim k As Long = N - i - j
                If 10 * i + 5 * j + k = Y \ 1000 Then
                    ans(0) = i
                    ans(1) = j
                    ans(2) = k
                    flg = True
                    Exit For
                End If
            Next
            If flg Then Exit For
        Next

        Console.WriteLine(
            Join(Array.ConvertAll(Of Long, String)(ans, AddressOf ToString)))

    End Sub


    Function ToString(ByVal i As Long) As String
        Return i.ToString()
    End Function

End Module


Measured memory_bytes: 13536
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<ctime>
#include<cctype>
#include<climits>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<memory>
#include<functional>

using namespace std;

#define ALL(g) (g).begin(),(g).end()
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define F(i,j,k) fill(i[0],i[0]+j*j,k)
#define P(p) cout<<(p)<<endl;
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define INF 1<<25
#define pb push_back

typedef vector<int> vi;
typedef vector<long long> vl;
typedef vector<double> vd;
typedef pair<int,int> pii;
typedef pair<long,long> pll;
typedef long long ll;

int main()
{
    int x, y, s;
    while (cin >> x >> y >> s, x|y|s) {
        int maxc = 0;
        REP(cost, 1, s-1){
            for(int cost2 = s-1; cost2 >= cost; cost2--) {
                if(cost*(100+x)/100+cost2*(100+x)/100 == s){
                    maxc = max(maxc, cost*(100+y)/100+cost2*(100+y)/100);
                }
            }
        }
        cout << maxc << endl;
    }
    return 0;
}

Measured memory_bytes: 1160
//  Created by conan1024hao in 2019.
//  Copyright © 2019 conan1024hao. All rights reserved.
//  専用ライブラリです、自由にコピーして構いません。
//  感谢看我的代码！Wechat:conan1024hao QQ:810396815
#pragma GCC optimize ("O3")
#include <iostream>
#include <iomanip>
#include <istream>
#include <ostream>
#include <sstream>
#include <iterator>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <utility>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <ctime>
#include <cctype>
#include <cstdlib>
#define INF 10e16
#define MOD 1000000007
#define rep(i, a, n) for (ll i = a; i < (ll)(n); i++)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define mmax(x,y)(x>y?x:y)
#define mmin(x,y)(x<y?x:y)
#define chmax(x,y) x=mmax(x,y)
#define chmin(x,y) x=mmin(x,y)
#define all(x) (x).begin(),(x).end()
#define siz(x) (ll)(x).size()
#define PI acos(-1.0)
using namespace std;
//using Int=int_fast64_t;
typedef long long int ll;
typedef pair<ll,ll>Pll;
typedef pair<int,int>Pin;
long long GCD(long long a, long long b) { return b ? GCD(b, a%b) : a; }
long long LCM(long long a, long long b)  {return a/GCD(a,b)*b;}
int dx[8]={-1,0,1,0,1,1,-1,-1};
int dy[8]={0,-1,0,1,1,-1,1,-1};
char dir[4]={'u','l','d','r'};
ll cmp1(pair<ll,string>a,pair<ll,string> b){
        if(a.fi!=b.fi)
        return a.fi<b.fi;
        else
        return a.se<b.se;
}
//---------------------------------------------------------------------------
unsigned long long countz(unsigned long long n){
    unsigned long long ans=0;
    while(n){
        ans+=n/5/2;
        n/=5;
    }
    return ans;
}
//---------------------------------------------------------------------------
int main(){//問題をちゃんと見ろ!!!!!!!!!!!!!!!!!      llか??????????        memset()!!!!!!!!!!!!
    cin.tie(0);
    ios::sync_with_stdio(false);
    //-------------------------------
    unsigned long long n;cin>>n;
    if(n%2!=0)
        cout<<0<<endl;
    else{
        unsigned long long ans=0;
        unsigned long long now=1;
        while(now<=n)now*=10;
        now/=10;
        unsigned long long pre=0;
        while(n&&now>=10){
            unsigned long long cnt=0;
            unsigned long long inow=now;
            while(now>=10){
                now/=10;
                cnt++;
            }
            now=inow;
            unsigned long long mmm=n/now;
            
            
            //cout<<mmm<<" "<<cnt<<endl;
            mmm-=pre;
            unsigned long long mmm1=mmm+pre;
            ans+=mmm*(cnt);
            
            pre=mmm1;
            now/=10;
            //cout<<ans<<endl;
        }
        //cout<<ans<<endl;
        cout<<countz(n)<<endl;
    }
    //-------------------------------
    return 0;
}
//---------------------------------------------------------------------------



Measured memory_bytes: 256
#include<iostream>
using namespace std;
#define MOD 100000
int x[101][101][2][2];
main(){
int h,w,i,sum;
while(true){
for(i=1;i<=100;i++){x[i][1][0][0]=1;}
for(i=1;i<=100;i++){x[1][i][1][0]=1;}
cin>>h>>w;
if(h==0 && w==0){break;}
for(i=2;i<=h;i++){
for(int j=2;j<=w;j++){x[i][j][0][0]=(x[i-1][j][0][0]+x[i-1][j][0][1])%MOD;x[i][j][0][1]=x[i-1][j][1][0]%MOD;x[i][j][1][0]=(x[i][j-1][1][0]+x[i][j-1][1][1])%MOD;x[i][j][1][1]=x[i][j-1][0][0]%MOD;}}
sum=(x[h][w][0][0]+x[h][w][0][1]+x[h][w][1][0]+x[h][w][1][1])%MOD;cout<<sum<<endl;}
}

Measured memory_bytes: 1320
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
void p(vector<int> A){rep(i,A.size()){cout << A[i] << " ";}cout << "\n";}

int f(int x){
    int cnt = 0;
    while (x > 0){
        x /= 10;
        cnt++;
    }
    return cnt;
}

int main(){
    int n;
    cin >> n;
    int ans = 0;
    rep(i,n+1){
        int a = f(i);
        if(a%2 != 0)ans++;
    }
    cout << ans;
}

Measured memory_bytes: 3612
/*
 * FileName:     sorting_pairs_fix_2
 * CreatedDate:  2020-07-14 01:18:06 +0900
 * LastModified: 2020-07-14 01:31:27 +0900
 */

#include <stdio.h>
#define mmx 1e9
void sort(int left, int middle, int right, int x_y[][2]){
    int Left[middle-left+1][2], Right[right-middle+1][2];
    for(int i=0; i<middle-left; i++){
        Left[i][0] = x_y[i+left][0];
        Left[i][1] = x_y[i+left][1];
    }
    Left[middle-left][0] = mmx;
    Left[middle-left][1] = mmx;
    for(int i=0; i<right-middle; i++){
        Right[i][0] = x_y[i+middle][0];
        Right[i][1] = x_y[i+middle][1];
    }
    Right[right-middle][0] = mmx;
    Left[right-middle][1] = mmx;
    int l=0, r=0;
    for(int i=0; i<right-left; i++){
        if(Left[l][0]<Right[r][0]){
            x_y[i+left][0] = Left[l][0];
            x_y[i+left][1] = Left[l][1];
            l++;
        }
        else if(Left[l][0]>Right[r][0]){
            x_y[i+left][0] = Right[r][0];
            x_y[i+left][1] = Right[r][1];
            r++;
        }
        else{
            if(Left[l][1]<Right[r][1]){
                x_y[i+left][0] = Left[l][0];
                x_y[i+left][1] = Left[l][1];
                l++;
            }
            else{
                x_y[i+left][0] = Right[r][0];
                x_y[i+left][1] = Right[r][1];
                r++;
            }
        }
    }
    
}
void merge_sort(int left, int right, int x_y[][2]){
    if(left+1<right){
        int middle = (left+right)/2;
        merge_sort(left, middle, x_y);
        merge_sort(middle, right, x_y);
        sort(left, middle, right, x_y);
    }
}
int main(void){
    int n;scanf("%d", &n);
    int x_y[n][2];
    for(int i=0; i<n; i++){
        scanf("%d%d", &x_y[i][0], &x_y[i][1]);
    }
    merge_sort(0, n, x_y);
    for(int i=0; i<n; i++){
        printf("%d %d\n", x_y[i][0], x_y[i][1]);
    }
    return 0;
}



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

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

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;cin >> n;
	vector<int> a(n);
	rep(i,n) cin >> a.at(i);
	int g=gcd(a.at(0),a.at(1));
	for(int i=2;i<n;++i){
		g=gcd(a.at(i),g);
	}
	cout << g << endl;
}

Measured memory_bytes: 640
#include"stdio.h"
#include"iostream"
#include"string.h"
using namespace std;
int main(void) {
	int a;
	cin >> a;
	string b, c, d;

	cin >> b;
	cin >> c;

	for (int i = 0; i < 2 * a; i++) {
		if (i % 2 == 0) d = d + b.at(i / 2);
		else d = d +  c.at(i / 2);
	}
	cout << d;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <queue>
#include <map>
#include <numeric>
#include <unordered_map>
#include <iomanip>
#include <functional>
#include <bitset>
#include <complex>
#include <stack>
#include <cstdint>



#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rrep(i, n) for(ll i = (ll)(n-1); i >= 0; i--)
#define repi(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rrepi(i,a,b) for(ll i=(ll)(b-1);i>=(ll)(a);i--)

#define all(x) (x).begin(),(x).end()

template<class T>inline bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>inline bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

typedef long long ll;

using namespace std;

ll gcd(ll a,ll b)
{
  if(a>b)swap(a,b);
  if(a==0){return b;}
  else return gcd(b%a,a);
}
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n,m;cin>>n>>m;
  vector<ll>a(n);
  rep(i,n)cin>>a[i];
  ll lc=a[0];
  ll inf=1e10;
  rep(i,n-1){
    if(lc>=inf)break;
    lc=a[i+1]/gcd(a[i+1],lc)*lc;
  }
  if(lc>=inf){
    cout<<0<<endl;
    return 0;
  }
  ll f=1;
  ll beki=a[0]&-a[0];
  rep(i,n)if((a[i]&-a[i])!=beki)f=0;
  if(f==0||beki==1){
    cout<<0<<endl;
    return 0;
  }
  cout<<max(0ll,(m+lc/2))/lc<<endl;

  return 0;

}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include <algorithm>
#include <math.h>
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
#define INF 999999999
// 配列中の重複削除
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

using llong = long long;
using namespace std;

int main(){
    llong s,w;
    cin >> s >> w;
    if(w>=s) cout << "unsafe" << endl;
    else cout << "safe" << endl;
    return 0;
}

Measured memory_bytes: 3632
<?php
// Your code here!
    $input_line = trim(fgets(STDIN));
    
    $num = explode(" ",$input_line);
    
    $num[0] = intval($num[0]);
    $num[1] = intval($num[1]);
    
    if($num[0] > $num[1]){
        echo "a > b";
    }elseif($num[0] < $num[1]){
        echo "a < b";
    }else{
        echo "a == b";
    }
    echo "\n";

?>


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

import sys
# import math
# import re                                    # re.compile(pattern) => ptn obj; p.search(s), p.match(s), p.finditer(s) => match obj; p.sub(after, s)
# from collections import deque                # deque class. deque(L): dq.append(x), dq.appendleft(x), dq.pop(), dq.popleft(), dq.rotate()
# from collections import defaultdict          # subclass of dict. defaultdict(facroty)
# from collections import Counter              # subclass of dict. Counter(iter): c.elements(), c.most_common(n), c.subtract(iter)
# from heapq import heapify, heappush, heappop # built-in list. heapify(L) changes list in-place to min-heap in O(n), heappush(heapL, x) and heappop(heapL) in O(lgn).
# from heapq import nlargest, nsmallest        # nlargest(n, iter[, key]) returns k-largest-list in O(n+klgn).
# from itertools import count, cycle, repeat   # count(start[,step]), cycle(iter), repeat(elm[,n])
# from itertools import groupby                # [(k, list(g)) for k, g in groupby('000112')] returns [('0',['0','0','0']), ('1',['1','1']), ('2',['2'])]
# from itertools import starmap                # starmap(pow, [[2,5], [3,2]]) returns [32, 9]
# from itertools import product                # product(iter, repeat=n)
# from itertools import accumulate             # accumulate(iter[, f])
# from functools import reduce                 # reduce(f, iter[, init])
# from functools import lru_cache              # @lrucache ...arguments of functions should be able to be keys of dict
# from bisect import bisect_left, bisect_right # bisect_left(a, x, lo=0, hi=len(a)) returns i such that all(val<x for val in a[lo:i]) and all(val>-=x for val in a[i:hi]).
# from copy import deepcopy                    # to copy multi-dimentional matrix without reference
# from fractions import gcd                    # for Python 3.4


def main():
    mod = 1000000007                  # 10^9+7
    inf = float('inf')
    sys.setrecursionlimit(10**6)    # 1000 -> 1000000
    def input(): return sys.stdin.readline().rstrip()
    def ii():  return int(input())
    def mi():  return map(int, input().split())
    def mi_0(): return map(lambda x: int(x)-1, input().split())
    def lmi(): return list(map(int, input().split()))
    def lmi_0(): return list(map(lambda x: int(x)-1, input().split()))
    def li():  return list(input())
    
    
    n = ii()
    L = list(set([input() for _ in range(n)]))
    print(len(L))

if __name__ == "__main__":
    main()

Measured memory_bytes: 35612
import java.util.*;


public class Main {
	Scanner in = new Scanner(System.in);
	public static void main(String[] args) {
		new Main();
	}
	public Main() {
		new AOJ0029();
	}
	
	class AOJ0029{
		public AOJ0029() {
			String input[] = in.nextLine().split(" ");
			HashMap<String,Integer> map = new HashMap<String, Integer>();
			int max = Integer.MIN_VALUE;
			int result_index = 0;
			for(int i=0;i<input.length;i++){
				if(max<input[i].length()){
					max = input[i].length();
					result_index = i;
				}
				if(!map.containsKey(input[i]))map.put(input[i], 0);
				map.put(input[i], map.remove(input[i])+1);
			}
			max = Integer.MIN_VALUE;
			String result2 = "";
			for(String key:map.keySet()){
				if(max<map.get(key)){
					result2 = key;
					max = map.get(key);
				}
			}
			System.out.println(result2+" "+input[result_index]);
		}
	}

}

Measured memory_bytes: 17148
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<climits>
#include<iostream>
#include<sstream>
#include<utility>
#include<map>
#include<vector>
#include<queue>
#include<algorithm>
#include<set>
#include<stack>
using namespace std;
typedef long long ll;
typedef pair<int,int>P;

int main()
{
	int W,H,N,x,y,a,sw=0,sh=0,r;
	scanf("%d%d%d",&W,&H,&N);
	for(int i=0;i<N;i++)
	{
		scanf("%d%d%d",&x,&y,&a);
		if(a==1)
			sw=max(sw,x);
		if(a==2)
			W=min(W,x);
		if(a==3)
			sh=max(sh,y);
		if(a==4)
			H=min(H,y);
	}
	if(H-sh<0 || W-sw<0)r=0;
	else r=max(0,(H-sh)*(W-sw));
	printf("%d\n",r);
	return 0;
}


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

vector<ll>a(100002),b(100002),c(100002);
int main() {
	ll n;
	cin>>n;
	for(int i=0;i<100002;i++){
		a[i]=b[i]=c[i]=inf;
	}
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	for(int i=0;i<n;i++){
		cin>>b[i];
	}
	for(int i=0;i<n;i++){
		cin>>c[i];
	}
	sort(a.begin(),a.end());
	sort(b.begin(),b.end());
	sort(c.begin(),c.end());
	ll i,j,k,ans=0;
	i=j=k=0;
	for(int j=0;j<n;j++){
		while(b[j]>a[i]){
			i++;
		}
		while(b[j]>=c[k]){
			k++;
		}
		ans+=i*(n-k);
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <class T, class U> using Pa = pair<T, U>;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N,X;
    cin >> N >> X;
    vec<ll> P(N+1,1),L(N+1,1);
    for(int i=1;i<=N;i++){
        P[i] = 2*P[i-1]+1;
        L[i] = 2*L[i-1]+3;
    }

    auto dfs = [&](auto&& self,ll x,int level)->ll{
        if(!level) return 1;
        if(x==1) return 0;
        ll res = x>=(L[level-1]+2);
        if(1<x && x<=L[level-1]+1) res += self(self,x-1,level-1);
        else if(x==L[level-1]+2) res += P[level-1];
        else if(x<=L[level]-1) res += P[level-1]+self(self,x-L[level-1]-2,level-1);
        else res += 2*P[level-1];
        return res;
    };

    cout << dfs(dfs,X,N) << "\n";
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args)
	{
		Scanner scan = new Scanner(System.in);
		int count = scan.nextInt();
		int array[] = new int[count];
		for(int i = 0;i< count;i++)
		{
			array[i] = scan.nextInt();
		}
		for(int i = count - 1;i > 0;i--)
		{
			System.out.print(array[i] + " ");
		}
		System.out.println(array[0]);
	}
}

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

int main(){
  ll n, k;
  cin >> n >> k;
  ll a[n];
  map<ll,vector<ll>> m;
  vector<ll> s(n+1,0);
  rep(i,n) {
    cin >> a[i];
    s[i+1] = (s[i] + a[i] - 1) % k;
    s[i+1] = (s[i+1] + k) % k;
    m[s[i+1]].push_back(i+1);
  }
  ll ans = 0;
  rep(i,n) {
    ll c = upper_bound(m[s[i]].begin(),m[s[i]].end(),i) - m[s[i]].begin();
    ll d = lower_bound(m[s[i]].begin(),m[s[i]].end(),i+k) - m[s[i]].begin();
    ans += d - c;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 27264
#include <iostream>
#include <queue>
#include <set>
#include <utility>
#include <algorithm>
#include <cstdlib>
#include <vector>
#include <cstring>
using namespace std;
#define INF 200000000

int ary1[510][510],ary2[510][510];
bool used[510][510];
int main(){
	int R,W1,W2,H1,H2,X1,X2,Y1,Y2,imax,imay,imad,res;
	priority_queue<pair<int,pair<int,int> > ,vector<pair<int,pair<int,int> > >,greater<pair<int,pair<int,int> > > > que;
	set<int> se1,se2;
	vector<int> v1,v2;
	pair<int,pair<int,int> > pa;
	while(1){
		v1.clear();
		v2.clear();
		cin>>R;
		if(R==0) break;
		cin>>W1>>H1>>Y1>>X1;
		X1--;Y1--;
		for(int i=0;i<H1;i++){
			for(int j=0;j<W1;j++){
				cin>>ary1[i][j];
			}
		}
		cin>>W2>>H2>>Y2>>X2;
		X2--;Y2--;
		for(int i=0;i<H2;i++){
			for(int j=0;j<W2;j++){
				cin>>ary2[i][j];
			}
		}
		
		memset(used,0,sizeof(used));
		que.push(make_pair(1,make_pair(X1,Y1)));
		used[X1][Y1]=true;
		while(!que.empty()){
			pa=que.top();que.pop();
			imax=pa.second.first;
			imay=pa.second.second;
			imad=pa.first;
			ary1[imax][imay]=imad;
			if(imax>0&&(!used[imax-1][imay])){
				used[imax-1][imay]=true;
				que.push(make_pair(max(ary1[imax-1][imay],imad),make_pair(imax-1,imay)));
			}
			if(imax<H1-1&&(!used[imax+1][imay])){
				used[imax+1][imay]=true;
				que.push(make_pair(max(ary1[imax+1][imay],imad),make_pair(imax+1,imay)));
			}
			if(imay>0&&(!used[imax][imay-1])){
				used[imax][imay-1]=true;
				que.push(make_pair(max(ary1[imax][imay-1],imad),make_pair(imax,imay-1)));
			}
			if(imay<W1-1&&(!used[imax][imay+1])){
				used[imax][imay+1]=true;
				que.push(make_pair(max(ary1[imax][imay+1],imad),make_pair(imax,imay+1)));
			}
		}
		memset(used,0,sizeof(used));
		que.push(make_pair(1,make_pair(X2,Y2)));
		used[X2][Y2]=true;
		while(!que.empty()){
			pa=que.top();que.pop();
			imax=pa.second.first;
			imay=pa.second.second;
			imad=pa.first;
			ary2[imax][imay]=imad;
			if(imax>0&&(!used[imax-1][imay])){
				used[imax-1][imay]=true;
				que.push(make_pair(max(ary2[imax-1][imay],imad),make_pair(imax-1,imay)));
			}
			if(imax<H2-1&&(!used[imax+1][imay])){
				used[imax+1][imay]=true;
				que.push(make_pair(max(ary2[imax+1][imay],imad),make_pair(imax+1,imay)));
			}
			if(imay>0&&(!used[imax][imay-1])){
				used[imax][imay-1]=true;
				que.push(make_pair(max(ary2[imax][imay-1],imad),make_pair(imax,imay-1)));
			}
			if(imay<W2-1&&(!used[imax][imay+1])){
				used[imax][imay+1]=true;
				que.push(make_pair(max(ary2[imax][imay+1],imad),make_pair(imax,imay+1)));
			}
		}
		v1.push_back(0);
		for(int i=0;i<H1;i++){
			for(int j=0;j<W1;j++){
				v1.push_back(ary1[i][j]);
			}
		}
		sort(v1.begin(),v1.end());
		v2.push_back(0);
		for(int i=0;i<H2;i++){
			for(int j=0;j<W2;j++){
				v2.push_back(ary2[i][j]);
			}
		}
		sort(v2.begin(),v2.end());
		res=INF;
		for(int i=0;i<=R;i++){
			if(W1*H1>=i&&W2*H2>=R-i)res=min(res,v1.at(i)+v2.at(R-i));
		}
		cout<<res<<endl;

		/*for(int i=0;i<H1;i++){
			for(int j=0;j<W1;j++){
				cout<<ary1[i][j]<<" ";
			}
			cout<<endl;
		}
		for(int i=0;i<H2;i++){
			for(int j=0;j<W2;j++){
				cout<<ary2[i][j]<<" ";
			}
			cout<<endl;
		}*/
		
	}
	return 0;
}

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

ll N=pow(10,9)+7;

ll mod_pow(ll x, ll y){
    ll ans;
    if(y==0) return 1;
    else if(y%2==0){
        ans = (mod_pow(x,y/2) * mod_pow(x,y/2)) % N;
        return ans;
    }
    else{
        ans = (mod_pow(x,y/2) * mod_pow(x,y/2)) % N;
        ans = (ans*x)%N;
        return ans;
    }
}

ll combi(ll n, ll m){
    ll up=1;
    ll down=1;
    ll ans;
    for(int i=0; i<m; i++){
        up = (up*(n-i))%N;
        down = (down*(i+1))%N;
    }
    ans = (up*mod_pow(down, N-2)) % N;
    return ans;
}


int main(){
    ll x,y;
    cin >> x >> y;
    if(2*x-y<0 || (2*x-y)%3!=0){
        cout << 0 << endl;
        return 0;
    }
    if(2*y-x<0 || (2*y-x)%3!=0){
        cout << 0 << endl;
        return 0;
    }
    ll p=(2*x-y)/3;
    ll q=(2*y-x)/3;
    cout << combi(p+q, p) << endl;
}


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

using namespace std;

int main() {
	vector<int> v;
	int n,a;
	cin>>n;
	for(int i=0;i<n;i++) {
		cin>>a;
		v.push_back(a);
	}
	sort(v.begin(), v.end(), greater<int>());
	a = 0;
	for(int i=0;i<n;i++) {
		if(i%2==0) a += v[i];
		else a -= v[i];
	}
	cout<<a<<endl;
	return 0;
}

Measured memory_bytes: 256
n=int(input()) 
ans=0 
temp=0 
for i in range(n):
    a,b=input().split() 
    if a==b:
        temp+=1 
    else:
        ans=max(ans,temp)
        temp=0 
ans=max(temp,ans)
if ans>=3:
    print("Yes")
else:
    print("No") 

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

#define ll long long int
#define INFTY (1<<21)

using namespace std;

int main(void){
    cin.sync_with_stdio(false);
    int s;
    cin>>s;
    vector<int> aa;
    aa.emplace_back(s);
    while(true){
        int ba = aa[aa.size()-1];
        int a = ba%2==0?ba/2:3*ba+1;
        auto result = find(aa.begin(), aa.end(), a);
        if(result == aa.end())
            aa.emplace_back(a);
        else{
            cout<<aa.size()+1<<endl;
            break;
        }
    }
    return 0;
}

Measured memory_bytes: 256
s = list(input())

a=0
z=0
for i in range(len(s)):
    if s[i]=='A':
        a=i
        break
        
s=s[::-1]
for i in range(len(s)):
    if s[i]=='Z':
        z=i
        break
    
print(len(s)-(a+z))

Measured memory_bytes: 11848
import core.bitop, std.algorithm, std.ascii, std.bigint, std.conv, std.math,
    std.functional, std.numeric, std.range, std.stdio, std.string, std.random,
    std.typecons, std.container, std.format;

// dfmt off
T lread(T = long)(){return readln.chomp.to!T();}
T[] lreads(T = long)(long n){return generate(()=>readln.chomp.to!T()).take(n).array();}
T[] aryread(T = long)(){return readln.split.to!(T[])();}
void scan(TList...)(ref TList Args){auto line = readln.split();
foreach (i, T; TList){T val = line[i].to!(T);Args[i] = val;}}
alias sread = () => readln.chomp();enum MOD = 10 ^^ 9 + 7;
alias PQueue(T, alias less = "a<b") = BinaryHeap!(Array!T, less);
// dfmt on

void main()
{
    long N = lread();
    auto S = sread();
    outer: foreach (state; 0 .. 2 ^^ 2)
    {
        auto ans = new char[](N);
        ans[0] = "SW"[state & 1];
        ans[1] = "SW"[(state >> 1) & 1];
        foreach (i; 1 .. N - 1)
        {
            if (ans[i - 1 .. i + 1] == "SS")
            {
                ans[i + 1] = (S[i] == 'o') ? 'S' : 'W';
            }
            if (ans[i - 1 .. i + 1] == "SW")
            {
                ans[i + 1] = (S[i] != 'o') ? 'S' : 'W';
            }
            if (ans[i - 1 .. i + 1] == "WS")
            {
                ans[i + 1] = (S[i] == 'o') ? 'W' : 'S';
            }
            if (ans[i - 1 .. i + 1] == "WW")
            {
                ans[i + 1] = (S[i] != 'o') ? 'W' : 'S';
            }
        }
        foreach (i; 0 .. N)
        {
            long l = (N + i - 1) % N;
            long r = (i + 1) % N;
            if (ans[i] == 'S' && S[i] == 'o' && ans[l] != ans[r])
                continue outer;
            if (ans[i] == 'S' && S[i] == 'x' && ans[l] == ans[r])
                continue outer;
            if (ans[i] == 'W' && S[i] == 'o' && ans[l] == ans[r])
                continue outer;
            if (ans[i] == 'W' && S[i] == 'x' && ans[l] != ans[r])
                continue outer;
        }
        writeln(ans);
        return;
    }
    writeln(-1);
}


Measured memory_bytes: 2812
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

//INSERT ABOVE HERE
signed main(){
  Int x;
  cin>>x;
  if(x==3||x==5||x==7) cout<<"YES"<<endl;
  else cout<<"NO"<<endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<queue>
#include<vector>
#include<string>
#include<map>
#define all(c) c.begin(),c.end()
#define uni(c) c.erase(unique(all(c)),c.end())
#define pb push_back
using namespace std;
typedef pair<int,int> P;
typedef pair<double,int> Pdi;
int w,h;
vector<string> s;
int dx[]={0,0,1,-1},dy[]={1,-1,0,0};
bool infalpha(int y,int x){
	if(y>=0&&y<h&&x>=0&&x<w&&s[y][x]!='.')
		return true;
	return false;
}
Pdi ret(int y,int x,vector<vector<bool> > &c){
	double zyu=0;
	int cnt=0;
	vector<P> next;
	queue<P> que;
	que.push(P(y,x));
	char col=s[y][x];
	while(!que.empty()){
		P t=que.front();
		que.pop();
		if(c[t.first][t.second]){
			continue;
		}
		c[t.first][t.second]=true;
		cnt++;
		zyu+=(double)t.second+(double)0.5;
		for(int i=0;i<4;i++){
			int nx=t.second+dx[i];
			int ny=t.first+dy[i];
			if(!infalpha(ny,nx))
				continue;
			if(c[ny][nx]){
				continue;
			}
			if(i==1){
				if(s[ny][nx]==col){
					que.push(P(ny,nx));
				}else{
					next.pb(P(ny,nx));
				}
			}else{
				if(s[ny][nx]==col){
					que.push(P(ny,nx));
				}
			}
		}
		
	}
	sort(all(next));
	uni(next);
	for(int i=0;i<next.size();i++){
		P a=ret(next[i].first,next[i].second,c);
		zyu+=(double)a.first;
		cnt+=a.second;
	}
	return P(zyu,cnt);
}
P rl(int y,int x,vector<vector<bool> > &f){
	queue<P> que;
	que.push(P(y,x));
	char col=s[y][x];
	int l=100,r=0;
	while(!que.empty()){
		P t=que.front();
		que.pop();
		if(f[t.first][t.second]){
			continue;
		}
		f[t.first][t.second]=true;
		if(t.first==h-1){
			r=max(r,t.second);
			l=min(l,t.second);
		}
		for(int i=0;i<4;i++){
			int nx=t.second+dx[i];
			int ny=t.first+dy[i];
			if(!infalpha(ny,nx))
				continue;
			if((i==0&&s[ny][nx]!=col)){
				r=max(r,nx);
				l=min(l,nx);
			}
			if(f[ny][nx]||s[ny][nx]!=col){
				continue;
			}
			que.push(P(ny,nx));
		}
		
	}
	return P(r+1,l);
}
int main(){
	while(cin>>w>>h,w||h){
		s.resize(h);
		for(int i=0;i<h;i++){
			cin>>s[i];
		}
		bool flag=true;
		vector<vector<bool> > f(h,vector<bool>(w,false));
		for(int i=0;i<h;i++){//y
			for(int j=0;j<w;j++){//x
				if(s[i][j]!='.'&&!f[i][j]){
					vector<vector<bool> > c(h,vector<bool>(w,false));
					Pdi sum=ret(i,j,c);
					P side=rl(i,j,f);
					double zyushin=(double)sum.first/(double)sum.second;
					if(!((double)side.second*(double)sum.second<(double)sum.first&&(double)side.first*(double)sum.second>(double)sum.first)){
						flag=false;
					}
				}
			}
		}
		if(flag)
		cout<<"STABLE"<<endl;
		else
		cout<<"UNSTABLE"<<endl;
	}
	return 0;
}

Measured memory_bytes: 952
n,m,x,y = gets.chomp.split.map(&:to_i)
xx = gets.chomp.split.map(&:to_i).max
yy = gets.chomp.split.map(&:to_i).min
for inc in x+1...y
 if xx < inc && yy >= inc
   puts "No War" ; exit
 end
end
puts "War"

Measured memory_bytes: 1788
using System;
using System.Collections.Generic;
class Program
{
	static void Main(string[] args)
	{
		string str = Console.ReadLine();
		int M = int.Parse(str.Substring(5,2));
		string ans = "Heisei";
		if(M>=5){
			ans = "TBD";
		}
		Console.WriteLine(ans);
	}
}

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

#define rep(i, k, n) for(int i = (k); i < (n); i++)
#define irep(i, k, n) for(int i = (k); i > (n); i--)
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
using namespace std;
using ll = long long;

int main(void){
  string w[] = {"Sunny", "Cloudy", "Rainy"};
  string s;
  cin >> s;
  rep(i, 0, 3){
    if(w[i] == s){
      cout << w[(i+1)%3] << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include <cmath>
#include <map>
#include <set>
#include <algorithm>
#include <string>
#define rep(i,n) for (int i= 0;i<(n);++i)
using namespace std;
typedef long long ll;
int main()
{
    int H,W,K;
            char map[6][7] = {};
            int ans = 0;
            
            scanf("%d%d%d",&H,&W,&K);
            
            for(int i = 0; i < H; i++){
                scanf("%6s",map[i]);
                //printf("%s\n",map[i]);
            }
            
            for(int Hb = 0; Hb < (int)pow(2,H); Hb++ ){
                for(int Wb = 0; Wb < (int)pow(2,W); Wb++){
                    int brack = 0;
                    for(int i = 0; i < H; i++){
                        for(int j = 0; j < W; j++){
                            if((Hb>>i & 1) == 0 && (Wb>>j & 1) == 0 && map[i][j] == '#'){
                                brack++;
                            }
                        }
                    }
                    if(brack == K){
                        ans++;
                    }
                }
            }
            
            printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 4120
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include<math.h>
#define ll long long
 
int main(){
  int n;
  ll int ans=0;
  scanf("%d",&n);
  for(int i=1;i<=n;i++){
    if(i%3!=0 && i%5!=0){
      ans += i;
    }
  }
  printf("%lld",ans);
  return 0;
}

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

int main()
{
    int A,B,C;
    int K;
    cin >> A >> B >> C >> K;
    int t = max({A,B,C});
    for (int i = 0;i < K;i++) {
        t*= 2;
    }
    cout<<t+A+B+C-max({A,B,C})<<endl;
    return 0;
}

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

int main() {
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    string s;
    cin >> s;
    if (s == "Sunny") cout << "Cloudy\n";
    if (s == "Cloudy") cout << "Rainy\n";
    if (s == "Rainy") cout << "Sunny\n";
}

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

using namespace std;

int main() {


	
	double W, H, x, y;
	cin >> W >> H >> x >> y;

	double area = W * H / 2;

	printf("%f ", area);
	if (x * 2 == W && y * 2 == H) cout << 1;
	else cout << 0;


	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<ll>;
using vvi= vector<vi>;
using vs = vector<string>;
using pl = pair<ll,ll>;
#define  rep(i,n) for(ll i = 0; i < (n); ++i)
#define  red(i,n) for(ll i = (n)-1; i >= 0; --i)
#define  all(a)   begin(a),end(a)
#define  pb(a)    push_back(a)
#define  mp(a,b)  make_pair(a,b)
#define  yn(a)    cout << ( (a)?"War\n":"No War\n" )
inline ll gcd(ll a,ll b) { return b?gcd(b,a%b):a; }
ll INF = 1e9+9, LINF = 1e18;


int main(int argc,char* argv[])
{
    int a,b,k,cnt=0;
    cin>>a>>b>>k;
    for(int i=min(a,b);;i--){
        if(a%i==0&&b%i==0)cnt++;
        if(cnt==k){
            cout<<i<<endl;
            break;
        }
    }
    
    return 0;
}


Measured memory_bytes: 256
using System;
using static System.Console;

class Program
{
	static void Main(string[] args)
	{
		string[] s1 = ReadLine().Split(' ');
		long N = long.Parse(s1[0]), K = long.Parse(s1[1]), re = 0;
		string[] s2 = ReadLine().Split(' ');
		long[] H = new long[N];
		for (int i = 0; i < N; i++) H[i] = long.Parse(s2[i]);
		Array.Sort(H);
		Array.Reverse(H);
		for (long i = K; i < N; i++) re += H[i];
		Write($"{re}");
		ReadKey();
	}
}

Measured memory_bytes: 35840
S = input()

cond1 = False #Sが回文
cond2 = False #前半分が回文
cond3 = False #後半分が回文

N = len(S)
end_full = int(((N+1)/2)-1)

if S[0:end_full]==S[::-1][0:end_full]:
  cond1 = True

half_N = len(S[0:end_full])
#print("half_N",half_N)

if half_N%2==0:
  half_end = int(half_N/2)
else:
  half_end = int(((half_N+1)/2)-1)
#print("half_end",half_end)

prevS = S[0:end_full]
#print("prevS1",prevS[0:half_end])
#print("prevS2",prevS[::-1][0:half_end])
if prevS[0:half_end]==prevS[::-1][0:half_end]:
  cond2 = True
  
suffS = S[::-1][0:end_full]
if suffS[0:half_end]==suffS[::-1][0:half_end]:
  cond3 = True
  
if cond1 and cond2 and cond3:
  print("Yes")
else:
  print("No")


Measured memory_bytes: 3064
#include "bits/stdc++.h"
using namespace std;
#define INF 1e9
#define rep(i, n) for (int i = 0; i < n; i++)
#define rep2(i, l, r) for (int i = (l); i < (r); i++)
#define ALL(x) (x).begin(), (x).end()     //昇順
#define RALL(x) (x).rbegin(), (x).rend()  // 降順
#define FOR(i, c) \
  \ for (__typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
const long long mod = 1e9 + 7;
typedef long long ll;  // ll とdoubleは違う
typedef priority_queue<int> PQ;
typedef vector<long long> VL;
typedef vector<bool> VB;
typedef vector<int> VI;  // VI a(n);
typedef vector<double> VD;
typedef vector<string> VS;
typedef vector<char> VC;
typedef vector<VS> VSS;
typedef vector<VC> VCC;
typedef vector<VI> VII;  // VII a(n,vector<int>(m)) n * m
typedef vector<VL> VLL;
typedef pair<int, int> PII;
typedef map<int, int> MP;  // MP a;
typedef vector<pair<ll, ll>> PS;

template <class T, class U>  // chmax(max, a);
bool chmax(T &a, U b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T, class U>  // chmin(min,a)
bool chmin(T &a, U b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename T>  // operator << (cout,a);
ostream &operator<<(ostream &os, vector<T> &v) {
  os << "{";
  rep(i, (int)v.size()) { os << v[i] << (i < v.size() - 1 ? ", " : ""); }
  os << "}";
  return os;
}

// g++ -std=c++11 prac.cpp

// Union Find
struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3]=2 : 3の親が2

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};
const int MAX_N = 1000;
VI G[MAX_N];
VI color(MAX_N); //頂点iの色 (1 or -1)


int main() {
  double z=0,k,n,m,h,w,ans=0,sum=0,cnt=0,Max=-1e9,Min=1e9+1;
  string u;
  bool ok = false;
  cin >> h >>n;
  
  
  cout << ceil(h/n) << endl;
  return 0;
}



Measured memory_bytes: 256
from heapq import heapify, heappop, heappush

def dijkstra(start,node,edge):
    d = [2*10**5] * node
    m = [0]*node
    d[start] = 0
    q = [(0,0)]
    heapify(q)
    
    while(len(q) != 0):
      ci, i = heappop(q)
      di = d[i]
      for j in edge[i]:
        if(d[j] > di+1):
          d[j] = di + 1
          heappush(q, (di+1,j))
          m[j] = i+1
    return m

def main():
    N,M = map(int, input().split())
    
    E = [[] for _ in [0]*N]
    for i in range(M):
      a,b = (int(x) for x in input().split())
      E[a-1].append(b-1)
      E[b-1].append(a-1)

    m = dijkstra(0, N, E)
    print("Yes")
    print("\n".join(map(str, m[1:])))

if __name__ == '__main__':
    main()


Measured memory_bytes: 107996
def selectionSort(A,N):
    count = 0
    for i in range(0,N-1):
        minj = i
        for j in range(i+1,N):
            if A[j] < A[minj]:
                minj = j
        tmp = A[minj]
        A[minj] = A[i]
        A[i] = tmp
        if i != minj:
            count += 1

    return A,count

N = int(input())
A = list(map(int,input().split(' ')))

A,count = selectionSort(A,N)

for i in range(len(A)):  # output
    if i == len(A) - 1:
        print(A[i])
    else:
        print(A[i], end=' ')

print(count)

Measured memory_bytes: 7820