akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define fi first
#define se second
#define mp make_pair
#define itrfor(itr,A) for(auto itr = A.begin(); itr !=A.end();itr++)
template <class T> using reversed_priority_queue = priority_queue<T, vector<T>, greater<T> >;
typedef long long llong;
char moji[26]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
char moji2[26]={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
char moji3[10]={'0','1','2','3','4','5','6','7','8','9'};
#define Sort(a) sort(a.begin(),a.end());
#define Reverse(a) reverse(a.begin(),a.end());
#define print(a) cout << a << endl;
#define MOD llong(1e9+7)
#define MAX int(2 * 1e5 +5)
#define debug(x)  cout << #x << " = " << (x) << endl;
#define pi acos(-1.0)
#define int llong
#define INF llong(1e18 + 3)
template<class T> bool chmax(T &a,  T b) {if(a<b){a=b; return 1;} return 0;}
template<class T> bool chmin(T &a,  T b) {if(a>b){a=b; return 1;} return 0;}
bool Add(int &a,int b){a = (a + b) % MOD;}
void myprint(int* A,int A_num){
   REP(i,A_num) cout << A[i] << " ";
   cout << endl;
}

signed main(){
    int n,k;
    cin >> n >> k;
    int A[n];
    REP(i,n) cin >> A[i];
    int F[n];
    REP(i,n) cin >> F[i];
    sort(A, A+n);
    sort(F,F+n);
    reverse(F,F+n);

    int l = -1;
    int r= 0;
    REP(i,n) chmax(r,A[i] * F[i]);
    while(l + 1 < r){
        int mid = (l + r) / 2;
        int cnt = 0;
        REP(i,n){
            int tmp = mid / F[i];
            cnt += max( llong(0), A[i] - tmp);
        }
        if(cnt > k){
            l = mid;
        }
        else r = mid;
    }
    cout << r << endl;

}

Measured memory_bytes: 3456
N = int(input())
a = [int(i) for i in input().split()]

from collections import Counter

c = Counter(a)

if c[0] == N:
    print('Yes')
    exit()
if N % 3 != 0:
    print('No')
    exit()
if c[0] == N//3 and len(c) == 2:
    print('Yes')
    exit()
if len(c) != 3:
    print('No')
    exit()
A = list(c.values())
if not (A[0] == N//3 and A[1] == N//3 and A[2] == N//3):
    print('No')
    exit()
B = list(c.keys())
if B[0]^B[1] != B[2]:
    print('No')
    exit()
print('Yes')

Measured memory_bytes: 14212
n = int(input())
lis = [int(input()) for i in range(n)]
lis_2 = sorted(lis,reverse = True)
fmax = lis_2[0]
smax = lis_2[1]
for i in range(n):
    if lis[i] == fmax:
        print(smax)
    else:
        print(fmax)

Measured memory_bytes: 19076
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = (ll)1e9 + 7;  
int n,k;
auto x = vector<ll>();

int main(){
    cin >> n >> k;
    for (int i = 0; i < n; i++)
    {
        ll temp;
        cin >> temp;
        x.push_back(temp);
    }
    
    auto _min = MOD;
    for (int l = 0; l < n; l++)
    {
        for (int r = n-1; r >= l; r--)
        {
            if(r-l+1>k) continue;
            if(r-l+1<k) break;
			//cout << l << " " << r << endl;
            if(x[l]<0 && x[r]<0){
                _min = min(_min,abs(x[l]));      
            }else if(x[l]<0 && x[r]>=0){
                if(abs(x[l])<abs(x[r])){
                    _min = min(_min,abs(x[l])*2+abs(x[r]));
                }else{
                    _min = min(_min,abs(x[l])+abs(x[r])*2);
                }
            }else if(x[l]>=0 && x[r]>=0){
                _min = min(_min,abs(x[r])); 
            }
        }
        
    }

    cout << _min;
    
}
  
  

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

int main(){
	int x,y;
	
	
	while(1){
		cin >> x >>y;
		if(x == 0 && y == 0){
			break;
		}
		
		if(x < y){
			cout << x << " " << y << endl;
		}else{
			cout << y << " " << x << endl;
		}
	}
    return 0;
}

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

typedef complex<double> P;
namespace std{
  bool operator < (const P &a,const P &b){
    return ( a.real()==b.real() ? a.imag() < b.imag() : a.real() < b.real() );
  }
};



P getCrossPointCC(P p1,double r1,P p2,double r2){
  double a=r2,b=r1,c=abs(p1-p2);
  double cos_A = (b*b+c*c-a*a) / (2.0*b*c);
  double sin_A = sqrt(1.0-cos_A*cos_A);
  P v=(p2-p1);
  v *= r1;
  v /= c;
  return p1+v*P(cos_A,sin_A);
}

int n;
P p1,p2;
double px,py,r1,r2;

int main(){
  
  cin>>px>>py>>r1;
  p1=P(px,py);
  cin>>px>>py>>r2;
  p2=P(px,py);
  
  P A=getCrossPointCC(p1,r1,p2,r2);
  P B=getCrossPointCC(p2,r2,p1,r1);
  P a=min(A,B),b=max(A,B);
  printf("%.9f %.9f %.9f %.9f\n",a.real(),a.imag(),b.real(),b.imag());
  return 0;
}

Measured memory_bytes: 1260
import sys
from math import ceil

def input():
    return sys.stdin.readline().strip()

def iinput():
    return int(input())

def finput():
    return float(input())

def tinput():
    return input().split()

def rinput():
    return map(int, tinput())

def rlinput():
    return list(rinput())

def nok(a, b):
    m = a * b
    while a != 0 and b != 0:
        if a > b:
            a %= b
        else:
            b %= a
    return m // (a + b)    


def main():
    n, x = rinput()
    l = rlinput()
    d = 0
    res = 1
    for i in range(n):
        d += l[i]
        if d > x:
            break
        else:
            res += 1
    print(res)
    
    
    
main()

Measured memory_bytes: 3064
#dt = {} for i in x: dt[i] = dt.get(i,0)+1
import sys;input = sys.stdin.readline
inp,ip = lambda :int(input()),lambda :[int(w) for w in input().split()]

s = input().strip()
if 'RRR' in s:
    print(3)
elif 'RR' in s:
    print(2)
elif 'R' in s:
    print(1)
else:
    print(0)

Measured memory_bytes: 61704
#include<iostream>
#include<vector>
//#include<math.h>
#include <unordered_map>
using namespace std;

int main()
{
    int x,k;
    cin>>k>>x;
    for(int i=x-k+1;i<=x+k-1;i++)
    {
        cout<<i<<" ";
    }
}

Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
#include <set>
#include <utility>
using namespace std;

double max(double a, double b) {
  return a > b ? a : b;
}

int main(void) {
  int i, j, k, xs, ys, xt, yt, n;
  scanf("%d%d%d%d", &xs, &ys, &xt, &yt);
  scanf("%d", &n);
  double cost[n + 2][n + 2], dis[n + 2];
  int x[n], y[n], r[n];
  for(i = 0; i < n; ++i) scanf("%d%d%d", &x[i], &y[i], &r[i]);
  for(i = 0; i < n + 2; ++i) dis[i] = (double)1e10;
  dis[n] = 0.0;
  for(i = 0; i < n; ++i) {
    cost[i][n] = cost[n][i] = max(sqrt((double)(x[i] - xs) * (double)(x[i] - xs) + (double)(y[i] - ys) * (double)(y[i] - ys)) - (double)r[i], 0.0);
    cost[i][n + 1] = cost[n + 1][i] = max(sqrt((double)(x[i] - xt) * (double)(x[i] - xt) + (double)(y[i] - yt) * (double)(y[i] - yt)) - (double)r[i], 0.0);
  }
  i = 0;
  cost[n][n] = cost[n + 1][n + 1] = 0.0;
  cost[n][n + 1] = cost[n + 1][n] = sqrt((double)(xs - xt) * (double)(xs - xt) + (double)(ys - yt) * (double)(ys - yt));
  for(i = 0; i < n; ++i) for(j = 0; j < n; ++j) {
    if(i == j) cost[i][j] = 0.0;
    else cost[i][j] = max(sqrt((double)(x[i] - x[j]) * (double)(x[i] - x[j]) + (double)(y[i] - y[j]) * (double)(y[i] - y[j])) - (double)r[i] - (double)r[j], 0.0);
  }
  set< pair<double, int> > s;
  int now = n;
  for(i = 0; i < n; ++i) s.insert({dis[i], i});
  s.insert({dis[n + 1], n + 1});
  while(s.size()) {
    for(i = 0; i < n + 2; ++i) if(dis[now] + cost[now][i] < dis[i]) {
      s.erase(s.find({dis[i], i}));
      dis[i] = dis[now] + cost[now][i];
      s.insert({dis[i], i});
    }
    now = (*s.begin()).second;
    s.erase(s.begin());
  }
  printf("%.12f", dis[n + 1]);
  return 0;
}

Measured memory_bytes: 8192
#include <bits/stdc++.h>
#define rep(i, a, n) for(int (i) = (int)(a);(i) < (int)(n);++(i))
#define repe(i, a, n) for(int (i) = (int)(a);(i) <= (int)(n);++(i))
#define repif(i, a, x) for(int (i) = (int)(a);(x);++(i))
#define repr(i, a, n) for(int (i) = ((int)(a)-1);(i) >= (int)(n);--(i))
#define reper(i, a, n) for(int (i) = (int)(a);(i) >= (int)(n);--(i))
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define SIZE(x) ((int)(x).size())
#define ALL(x) (x).begin(), (x).end()
#define RNG(x, a, n) &((x)[a]), &((x)[n])
#define ADD(a, b) ((((a+MOD)%MOD)+((b+MOD)%MOD))%MOD)
#define MUL(a, b) ((((a)%MOD)*((b)%MOD))%MOD)
#define CEIL(x) ((int)ceil(((double)x)))
#define POW(x, y) ((int)pow(x, y))
#define UNIQUE(x) (x).erase(unique(ALL((x))), (x).end())
#define YES cout << "YES" << endl
#define NO cout << "NO" << endl
#define Yes cout << "Yes" << endl
#define No cout << "No" << endl
#define yes cout << "yes" << endl;
#define no cout << "no" << endl;
#define fcout cout << fixed << setprecision(10)
#define pb push_back
#define pf push_front
#define mp make_pair
#define mt make_tuple
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define EPS (1e-20)
#define INF INT_MAX
#define INFLL LLONG_MAX
#define MOD 1000000007
using llint = long long;
using VI = std::vector<int>;
using PII = std::pair<int, int>;
using SI = std::set<int>;
using MII = std::map<int, int>;
using TIII = std::tuple<int, int, int>;
using MCI = std::map<char, int>;
using VPII = std::vector<PII>;
using namespace std;


signed main(){
	int N, i;
	cin >> N >> i;

	cout << N-i+1 << endl;

	return 0;
}

Measured memory_bytes: 764
# 個数の標準入力
my $input1 = <STDIN>;
chomp $input1;

# 色番号の標準入力
my $input2 = <STDIN>;
chomp $input2;
my @strcolor = split(/ /, $input2);

my $color1 = 0;
my $color2 = 0;
my $color3 = 0;
my $color4 = 0;
my $color5 = 0;
my $color6 = 0;
my $color7 = 0;
my $color8 = 0;
my $allcolor = 0;

my $cnt = 0;

my $mincnt = 0;
my $maxcnt = 0;

while ($cnt < $input1) {

    if ($strcolor[$cnt] >= 1 && $strcolor[$cnt] <= 399) {
        $color1 = 1;
    }

    if ($strcolor[$cnt] >= 400 && $strcolor[$cnt] <= 799) {
        $color2 = 1;
    }

    if ($strcolor[$cnt] >= 800 && $strcolor[$cnt] <= 1199) {
        $color3 = 1;
    }

    if ($strcolor[$cnt] >= 1200 && $strcolor[$cnt] <= 1599) {
        $color4 = 1;
    }

    if ($strcolor[$cnt] >= 1600 && $strcolor[$cnt] <= 1999) {
        $color5 = 1;
    }

    if ($strcolor[$cnt] >= 2000 && $strcolor[$cnt] <= 2399) {
        $color6 = 1;
    }

    if ($strcolor[$cnt] >= 2400 && $strcolor[$cnt] <= 2799) {
        $color7 = 1;
    }

    if ($strcolor[$cnt] >= 2800 && $strcolor[$cnt] <= 3199) {
        $color8 = 1;
    }

    if ($strcolor[$cnt] >= 3200 && $strcolor[$cnt] <= 4800) {
        $allcolor = $allcolor + 1;
    }

    $cnt = $cnt + 1;
}

$mincnt = $color1 + $color2 + $color3 + $color4 + $color5 + $color6 + $color7 + $color8;

if ($mincnt == 0) {
    $maxcnt = $allcolor;
    $mincnt = 1;
}else{
    $maxcnt = $mincnt + $allcolor;
}

print $mincnt." ".$maxcnt;
print "\n";


Measured memory_bytes: 512
/*
Author: miitbh1
*/
#include <bits/stdc++.h>

#define rep(i, n) for(int i=0; i<n; i++)
#define repA(i, a, n) for(int i=a; i<n; i++)
#define repD(i, a, n) for(int i=a; i>=n; i--)
#define trav(it, ctr) for(auto it=ctr.begin(); it!=ctr.end(); it++)
#define p(x) cout<<x<<"\n"
#define FIO ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pp(x, y) cout<<x<<" "<<y<<"\n"
#define btc __builtin_popcount
#define all(x) x.begin(), x.end()
#define pb push_back
#define mp make_pair
#define X first
#define Y second
 
using namespace std;
 
typedef priority_queue<int> pq;
typedef pair<int, int> ii;
typedef map<int, int> mii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef long double ld;
using ll=long long int;
const int N=100001, M=1e9+7;

int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    string s;
    cin>>s;
    int n=s.length();
    s[0]=s.back();
    if(s[0]=='2' or s[0]=='4' or s[0]=='5' or s[0]=='7' or s[0]=='9')
        p("hon");
    else if(s[0]=='0' or s[0]=='1' or s[0]=='6' or s[0]=='8')
        p("pon");
    else
        p("bon");
    return 0;
}

Measured memory_bytes: 3644
#include <algorithm>
#include <cassert>
#include <iostream>
#include <map>
#include <vector>

static const int IINF = 1 << 30;
static const long long LINF = 1LL << 60;
static const long long MOD = 1.0e+9 + 7;

template <typename T> std::vector<T> vectors(std::size_t n, T val) {
  return std::vector<T>(n, val);
}

template <typename T, typename... Args>
auto vectors(std::size_t n, Args... args) {
  return std::vector<decltype(vectors<T>(args...))>(n, vectors<T>(args...));
}

template <class T> inline bool chmin(T &a, const T &b) {
  return (a > b) ? a = b, true : false;
}

template <class T> inline bool chmax(T &a, const T &b) {
  return (a < b) ? a = b, true : false;
}

template <class T> inline void chadd(T &a, const T &b) {
  a += b, a %= MOD;
  // TODO minus case
}

template <class T>
std::ostream &operator<<(std::ostream &s, const std::vector<T> &v) {
  if (v.empty())
    return s;
  s << *v.begin();
  for (auto iter = v.begin() + 1; iter != v.end(); ++iter)
    if (std::is_fundamental<T>::value)
      s << " " << *iter;
    else
      s << std::endl << *iter;
  return s;
}

int main() {
  // Input
  int N, A, B, C, D;
  std::cin >> N >> A >> B >> C >> D;
  --A;
  --B;
  --C;
  --D;
  std::string S;
  std::cin >> S;

  bool res = true;

  // B が到達不可能
  for (int b = B; b < D; ++b)
    if (S[b] == '#' and S[b + 1] == '#')
      res = false;

  // A が到達不可能
  for (int a = A; a < C; ++a)
    if (S[a] == '#' and S[a + 1] == '#')
      res = false;

  if (D < C) {
    // C に至るまでに三連続の空がある
    bool exist = false;
    for (int a = A; a < C - 1; ++a)
      if (S[a] == '.' and S[a + 1] == '.' and S[a + 2] == '.' and a + 2 != B and
          a != D)
        exist = true;
    if (not exist)
      res = false;
  }

  // Output
  if (res == 1)
    std::cout << "Yes" << std::endl;
  else
    std::cout << "No" << std::endl;

  return 0;
}


Measured memory_bytes: 640
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
int main(){
	int a,b;cin>>a>>b;
	if(a<=0&&0<=b)cout<<"Zero"<<endl;
	if(a<0&&b<0)cout<<((b-a)%2==1?"Positive":"Negative")<<endl;
	if(a>0&&b>0)cout<<"Positive"<<endl;
	return 0;
}


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

long long GCD(long long x, long long y) {
    if ( y == 0) return x;
    else return GCD(y, x % y);
}

long long solve(int N, long long M, vector<long long> &a) {
    // 2 で割れるだけ割る (割れる回数が異なったらダメ)
    bool same = true;
    while (a[0] % 2 == 0) {
        for (int i = 0; i < N; ++i) {
            if (a[i] % 2 != 0) return 0;
            a[i] /= 2;
        }
        M /= 2;
    }
    for (int i = 0; i < N; ++i) if (a[i] % 2 == 0) return 0;

    // lcm
    long long lcm = 1;
    for (int i = 0; i < N; ++i) {
        long long g = GCD(lcm, a[i]);
        lcm = lcm / g * a[i];
        if (lcm > M) return 0;
    }
    return (M / lcm + 1) / 2;
}

int main() {
    int N; long long M;
    cin >> N >> M;
    vector<long long> a(N);

    // あらかじめ a は一回 2 で割っておく
    for (int i = 0; i < N; ++i) cin >> a[i], a[i] /= 2;
    cout << solve(N, M, a) << endl;
}

Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
using namespace std;

#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 1000000007;
const ll MAX = 1000000;

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

ll min(ll a, ll b) {
	if (a > b) { return b; }
	return a;
}

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

bool comp(pair<ll, ll> x, pair<ll, ll> y) {
	return x.second < y.second;;
}



int main() {

	ll N, M;
	cin >> N >> M;

	pair<ll, ll> war[MAX];

	repn(i, M) cin >> war[i].first >> war[i].second;

	sort(war + 1, war + M + 1, comp);

	ll cut = 0;
	ll ans = 0;

	repn(i, M) {
		if (war[i].first >= cut) {
			cut = war[i].second;
			ans++;
		}
	
	}

	cout << ans;

	
	system("PAUSE");
}

Measured memory_bytes: 16120
#include<iostream>

using namespace std;

int main(){
	int k,s,ans = 0;

	cin >> k >> s;

	for(int x = 0; x <= k;x++){
		for(int y = 0; y <= k;y++){
			if(0 <= s - x - y && s - x - y <= k)ans++;
		}
	}

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

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 5;
int red[maxn], green[maxn], white[maxn];
priority_queue<int, vector<int>, greater<int> >r,g,w;
bool cmp(int a,int b){return a > b;}
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);

	int x,y,a,b,c;
	cin >> x >> y >> a >> b >> c;
	for(int i = 1 ; i <= a ; i++){
		cin >> red[i];
	}
	for(int i = 1 ; i <= b ; i++){
		cin >> green[i];
	}
	for(int i = 1 ; i <= c ; i++){
		cin >> white[i];
	}
	sort(red + 1, red + 1 + a, cmp);
	sort(green + 1, green + 1 + b, cmp);
	sort(white + 1, white + 1 + c, cmp);

	for(int i = 1 ; i <= x ; i++)r.push(red[i]);
	for(int i = 1 ; i <= y ; i++)g.push(green[i]);
	int cnt;
	for(int i = c ; i >= 1 ; i--){
		cnt = white[i];
		if(r.top() > g.top()){
			g.push(cnt);
			g.pop();
		}
		else{
			r.push(cnt);
			r.pop();
		}
	}
	long long ans = 0;
	while(!r.empty()){
		ans += r.top();
		r.pop();
	}
	while(!g.empty()){
		ans += g.top();
		g.pop();
	}
	cout << ans << endl;
}

Measured memory_bytes: 2552
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int a;
  cin>>a;
  int n[a+1];
  for(int i=0;i<a;i++)
  cin>>n[i];
  int dp[a+1];
  dp[0]=0;
  dp[1]=abs(n[1]-n[0]);
  for(int i=2;i<a;i++)
  {
    dp[i]=min(dp[i-1]+abs(n[i]-n[i-1]),dp[i-2]+abs(n[i]-n[i-2]));
  }
  cout<<dp[a-1];
  return 0;
}

Measured memory_bytes: 1024
import Control.Monad
import Text.Printf
import Control.Applicative

main :: IO()
main = do
    [a, b] <- words <$> getLine
    printf "%s" $ slv a b

slv :: String -> String -> String
slv a b | last checkList == val = "Yes"
        | otherwise = "No" 
  where val = read (a ++ b) :: Integer
        checkList = takeWhile (<= val) [x*x | x <- [1..]]

Measured memory_bytes: 508
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
typedef pair<int,int> ii;
typedef tree<ii,null_type,less<ii>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	int a,b; cin>>a>>b;
	if (b%a==0) cout<<(a+b)<<endl;
	else cout<<(b-a)<<endl;
	return 0;
}


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

int main() {
    int n;
    cin >> n;
    vector<ll> h(n);
    set<int> ans;
    rep(i, n) cin >> h[i];
    int cnt = 0;
    rep(i, n-1) {
        if (h[i] >= h[i+1]) cnt++;
        else {
            if (cnt != 0) ans.insert(cnt);
            cnt = 0;
        }
    }
    if (cnt != 0) ans.insert(cnt);
    if (ans.empty()) cout << 0 << endl;
    else cout << *rbegin(ans) << endl;
}

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

int main(){
	int A[100][100],b[100],m,n,a;
	cin>>n>>m;
	for(int i = 0 ; i < n ; i++){
		for( int j = 0 ; j < m ; j++){
			cin>>A[i][j];
		}
	}
	for(int i = 0 ; i < m ; i++){
		cin>>b[i];
	}
	for(int i = 0 ; i < n ; i++){
		a = 0;
		for(int j = 0 ; j < m ; j++){
			a += A[i][j]*b[j];
		}
			cout<<a<<endl;
	}
	return 0;
}


Measured memory_bytes: 3128
using System;
using System.Linq;

namespace abc116_b{
  class program{
    public static bool search(int[] array,int s){
      int i=0;
      for(i=0;i<array.Length-1;i++)if(array[i]==s)return true;
      return false;
    }
    public static void Main(string[] args){
      int input=int.Parse(Console.ReadLine());
      var s=new int[1];
      s[0]=input;
      int i=0;
      while(true){
        if(s[i]%2==0){
          Array.Resize(ref s,s.Length+1);
          s[i+1]=s[i]/2;
        }else{
          Array.Resize(ref s,s.Length+1);
          s[i+1]=3*s[i]+1;
        }
        i++;
        if(search(s,s[i]))break;
      }
      Console.WriteLine(i+1);
    }
  }
}

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

using namespace std;
typedef long long unsigned int ll;

#define PI (acos(-1))
#define REP(i,n) for(int (i)=0;(i)<(n);(i)++)

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;


int main(void){
    ll n; cin >> n;
    ll k; cin >> k;
    cout << (n-3+k) / (k-1) << endl;
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = a; i < b; i++)
#define Rep(i, a, b) for(int i = a; i <= b; i++)
#define _GLIBCXX_DEBUG
#define V vector<int>
#define ll long long
using namespace std;

struct Card { char suit, value;};

void bubble(struct Card A[], int N){
    rep(i, 0, N){
        for(int j = N-1; j >= i + 1; j--) {
            if(A[j].value < A[j-1].value){
                Card t = A[j]; A[j] = A[j-1]; A[j-1] = t;
            }
        }
    }
}

void selection(struct Card A[], int N){
    rep(i, 0, N){
        int minj = i;
        rep(j, i, N){
            if(A[j].value < A[minj].value ) minj = j;
        }
        Card t = A[i]; A[i] = A[minj]; A[minj] = t;
    }
}

void print(struct Card A[], int N){
    rep(i, 0, N){
        if(i > 0) cout << " ";
        cout << A[i].suit << A[i].value;
    }
    cout << endl;
}

//バブルソートと選択ソートの結果を比較
bool isStable(struct Card C1[], struct Card C2[], int N){
    rep(i, 0, N){
        if(C1[i].suit != C2[i].suit) return false;
    }
    return true;
}

int main() {
    int N; cin >> N;
    Card C1[100],C2[100];
    char ch;

    rep(i, 0, N) cin >> C1[i].suit >> C1[i].value;

    rep(i, 0, N) C2[i] = C1[i];

    bubble(C1, N);
    selection(C2, N);

    print(C1, N);
    cout << "Stable" << endl;
    print(C2, N);
    if( isStable(C1, C2, N)){
        cout << "Stable" << endl;
    }else{
        cout << "Not stable" << endl;
    }

    return 0;
    
}



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

int main() {
  int H1,M1,H2,M2,K;
  cin >> H1 >> M1 >> H2 >> M2 >>K;
  cout << (H2*60 + M2)-(H1*60 + M1) - K << endl;
}


Measured memory_bytes: 3636
# include <bits/stdc++.h>
# define ll long long
using namespace std;
const int N = 2e5 + 10;
ll n, ans;
bool ok(ll n, ll i){
	if(i == 1)return 0;
	while(n % i == 0)n /= i;
	return n % i == 1;
}
void check(ll d){
	if(2 <= d && d <= n)ans++;
}
main(){
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	cin >> n;
	for(ll i = 1; i * i < n; i++){
		if((n - 1) % i == 0){
			check(i);
			if(i != (n - 1) / i){
				check((n - 1) / i);
			}
		}
	}
	for(ll i = 1; i * i <= n; i++){
		if(n % i == 0){
			if(ok(n, i)){
				check(i);
			}
			if(i != n / i && ok(n, n / i)){
				check(n / i);
			}
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

double F(double L, double R, double r){
    auto f = [&](double x){
        return (x*sqrt(r*r-x*x) + r*r*asin(x/r))/2.0;
    };
    return f(R) - f(L);
}

int main(){
    double w,h;
    int s;
    while(cin >>w >>h >>s,s){
        if(h>w) swap(h,w);

        auto check = [&](double r){
            double lx = w/2, rx = sqrt(r*r-h*h/4);
            rx = min(rx,w);

            double S = F(lx, rx, r);
            S -= (rx-lx)*h/2;

            if(r > h){
                rx = sqrt(r*r-h*h);
                rx = min(rx,w);
                if(lx<rx){
                    S -= F(lx, rx, r);
                    S += (rx-lx)*h;
                }
            }

            return S*4 >= s;
        };

        double ng = sqrt(w*w+h*h)/2, ok = sqrt(w*w+h*h);
        rep(i,40){
            double mid = (ng+ok)/2;
            if(check(mid)) ok = mid;
            else ng = mid;
        }

        printf("%.10f\n", ok*ok*4);
    }
    return 0;
}



Measured memory_bytes: 3492
#include <iostream>
using namespace std;
int main(void){
    int N,K,i,i2,x,y,color,flag;//????????????????????? 2?????? 3??????
    cin>>N>>K;
    for(i=0;i<K;i++){
        cin>>x>>y;
        //N?????¶??°????\???°?????£?????´???????????????????????§N?????????????????????????????????????????°???????????????
        if(N%2==0){
            if(x<=N/2)flag=1;
            else flag=0;
        }
        else{
            if(x<=(N/2+1))flag=1;
            else flag=0;
        }
        //?????????????????°????????¨??????x????????????????±??????????
        if(flag==1){
            color=x%3;
            if(color==0)color=3;
        }
        else{
            x=((N-x)+1);
            color=x%3;
            if(color==0)color=3;
        }
        //y?????????????????\??£?????????????????§??????
        if(x-1<y&&y<N-(x-2))cout<<color<<endl;//??\??£????????????xc?????????????????????
        else {
            //??\??£??????????????£?????´???y???????????°???????????????
            if(N%2==0){
                if(y<=N/2)flag=1;
                else flag=0;
            }
            else{
                if(y<=(N/2+1))flag=1;
                else flag=0;
            }
            //?????????????????°????????¨??????y????????????????±??????????
            if(flag==1){
                color=y%3;
                if(color==0)color=3;
            }
            else{
                y=((N-y)+1);
                color=y%3;
                if(color==0)color=3;
            }
            cout<<color<<endl;
        }
    }
}

Measured memory_bytes: 3084
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin>>n;
	bool isok = false;
	for(int i=0;i<=n;i+=4)
	{
		for(int j=0;j<=n;j+=7)
		{
			if(i+j == n)
				isok = true;
		}
	}
	if(isok)
		cout<<"Yes"<<endl;
	else
		cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
    string s; cin >> s;
    int Q; cin >> Q;
    int r = 0; //1:反転
    string left = "";
    string right = "";
    for (int i = 0; i < Q; i++)
    {
        int t; cin >> t;
        if(t == 1) r = (r + 1) % 2;
        else {
            int f; char c;
            cin >> f >> c;
            if((r == 0 && f == 1) || (r == 1 && f == 2)) {
                left.push_back(c);
            }
            else {
                right.push_back(c);
            }
        }
    }
    if(r == 0) {
        reverse(left.begin(), left.end());
        cout << left << s << right << endl;
    }
    else {
        reverse(s.begin(), s.end());
        reverse(right.begin(), right.end());
        cout << right << s << left << endl;
    }
    return 0;
}

Measured memory_bytes: 1088
#include <stdio.h>
#include <ctype.h>

int main(void){

  char a[10],b[10],c[10],d[10];

  scanf("%s %s %s",a,b,c);

  a[0]=toupper(a[0]);
  b[0]=toupper(b[0]);
  c[0]=toupper(c[0]);

  d[0]=a[0];
  d[1]=b[0];
  d[2]=c[0];

  printf("%s\n",d);

  return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define N 100020
#define ll long long
using namespace std;
inline int read(){
  int x=0,f=1;char ch=getchar();
  while(ch>'9'||ch<'0')ch=='-'&&(f=0)||(ch=getchar());
  while(ch<='9'&&ch>='0')x=(x<<3)+(x<<1)+ch-'0',ch=getchar();
  return f?x:-x;
}
int main(int argc, char const *argv[]) {
  int n = read();
  double ans = 0, x = read(), d = read();

  int m = 2 * n;
  while (m) {
    ans += x+(m-1)*d/2.0;
    x = (2.0*x+5.0*d)/m+x;
    d = (m+4.0)*d/m;
    m -= 2;
  }

  printf("%.15lf\n", ans);

  return 0;
}
/*

转化题面：

  有 2*n+1 个点，每次随机选择两个当前相邻的点删去，答案加上他们的距离，问答案的期望。
  每两个点之间的距离是个等差数列。

我们有结论：

  操作一次后的期望序列相邻点之间的距离仍然是等差数列。

考虑如何计算。

假设距离为 { x, x+d, x+2d, x+3d, ..., x+(m-1)d }

我们要删除的边的期望为：

  ans = (mx+(m-1)md/2)/m
      = x+(m-1)d/2

设删除之后首项变为 x'。

- 如果选的是最左边的两条边，x' = x+2d
- 如果选的是左边的三四条边，x' = 3x+3d
- 其余情况，x' = x

  x' = (x+2d)/m + (3x+3d)/m + x*(m-2)/m
     = (2x+5d)/m+x

然后根据期望守恒算出 d'

  d' = (m+4)d/m                           (????????)

如此迭代计算即可。

*/

Measured memory_bytes: 256
#include"bits/stdc++.h"
using namespace std;
typedef long long ll;
#define int ll
int n,ans;

void dfs(int x)
{
	if(x>n)return;
	string s=to_string(x);
	int sev=0,fiv=0,thr=0;
	for(auto i:s)
	{
		if(i=='7')sev++;
		if(i=='5')fiv++;
		if(i=='3')thr++;
	}
	if(sev and fiv and thr)ans++;

	dfs(x*10+5);
	dfs(x*10+3);
	dfs(x*10+7);




}


int32_t main()
{
	#ifndef ONLINE_JUDGE
		freopen("in","r",stdin);
		freopen("out","w",stdout);
	#endif

	cin>>n;
	dfs(5);dfs(7);dfs(3);
	cout<<ans;

}

Measured memory_bytes: 3656
#include <stdio.h>
#define P(s) printf(s "\n");

int main(void) {
	int m, f, r, sum;
	while (1) {
		scanf("%d %d %d", &m, &f, &r);
		if (m + f + r == -3) {
			break;
		}
		sum = m + f;
		if ((m == -1)|(f == -1)|(sum < 30)) {
			P("F")
		} else if (sum >= 80) {
			P("A")
		} else if (sum >= 65) {
			P("B")
		} else if ((sum >= 50)|(r >= 50)) {
			P("C")
		} else {
			P("D")
		}
	}
	return 0;
}

Measured memory_bytes: 584
#include<bits/stdc++.h>
#define ll long long int
#define ull unsigned long long 
#define ff first
#define ss second
#define fast ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define pb push_back 
#define mp make_pair
#define inf 2000000009
#define mod 1000000007
using namespace std;

int main()
{
    fast;
    ll n;
    cin>>n;
    if(n==0)
      cout<<0<<endl;
    
    else if(n&1)
    {
      cout<<0<<endl;
    }
    else
    {
     ll ans=0;
     n/=2;
     ll x=5;
     while(x<1000000000000000000)
     {
      ans+=((n/x));
      x*=5;
    }
    cout<<ans<<endl;
   }
 }

Measured memory_bytes: 256
//set many funcs
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#define inf 1145141919
#define llinf 1145141919810364364
#define mod 1000000007

int max(int a,int b){if(a>b){return a;}return b;}
int min(int a,int b){if(a<b){return a;}return b;}
int zt(int a,int b){return max(a,b)-min(a,b);}
int round(int a,int b){if((a%b)*2 >= b){return (a/b)+1;}return a/b;}
int ceil(int a,int b){if(a%b==0){return a/b;}return (a/b)+1;}
int gcd(int a,int b){int c;while(b!=0){c=a%b;a=b;b=c;}return a;}
int lcm(int a,int b){int c=gcd(a,b);a/=c;return a*b;}
int nCr(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
int fact(int a){int i,r=1;for(i=1;i<=a;i++){r*=i;}return r;}
int pow(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}
long long llmax(long long a,long long b){if(a>b){return a;}return b;}
long long llmin(long long a,long long b){if(a<b){return a;}return b;}
long long llround(long long a,long long b){if((a%b)*2 >= b){return (a/b)+1;}return a/b;}
long long llceil(long long a,long long b){if(a%b==0){return a/b;}return (a/b)+1;}
long long llgcd(long long a,long long b){long long c;while(b!=0){c=a%b;a=b;b=c;}return a;}
long long lllcm(long long a,long long b){long long c=llgcd(a,b);a/=c;return a*b;}
long long llnCr(long long a,long long b){long long i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
long long llfact(long long a){long long i,r=1;for(i=1;i<=a;i++){r*=i;}return r;}
long long llpow(long long a,long long b){long long i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}
double dbmax(double a,double b){if(a>b){return a;}return b;}
double dbmin(double a,double b){if(a<b){return a;}return b;}
int sortfncsj(const void *a,const void *b){if(*(int *)a>*(int *)b){return 1;}if(*(int *)a==*(int *)b){return 0;}return -1;}
int sortfnckj(const void *a,const void *b){if(*(int *)a<*(int *)b){return 1;}if(*(int *)a==*(int *)b){return 0;}return -1;}
int llsortfncsj(const void *a,const void *b){if(*(long long *)a>*(long long *)b){return 1;}if(*(long long *)a==*(long long *)b){return 0;}return -1;}
int llsortfnckj(const void *a,const void *b){if(*(long long *)a<*(long long *)b){return 1;}if(*(long long *)a==*(long long *)b){return 0;}return -1;}
int dbsortfncsj(const void *a,const void *b){if(*(double *)a>*(double *)b){return 1;}if(*(double *)a==*(double *)b){return 0;}return -1;}
int dbsortfnckj(const void *a,const void *b){if(*(double *)a<*(double *)b){return 1;}if(*(double *)a==*(double *)b){return 0;}return -1;}

int main(void){
    long long n,i,a[131072],x=-1,y=-1;
    scanf("%lld",&n);
    for(i = 0;i < n;i++){scanf("%lld",&a[i]);}
    qsort(a,n,sizeof(long long),llsortfnckj);
    i=1;
    while(i<n){
        if(a[i-1]==a[i]){
            if(x==-1){x=a[i];i++;}else{y=a[i];break;}
        }
        i++;
    }
    if(y!=-1){printf("%lld\n",x*y);}else{printf("0\n");}
    return 0;
}

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

public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        String[] nums = reader.readLine().split(" ");
        Boolean[] b = new Boolean[3];
        for(int i = 1; i <= 3; i++){
            b[i-1] = (Integer.parseInt(nums[0]) * Integer.parseInt(nums[1]) * i) % 2 == 1;
        }
        if(b[0] || b[1] || b[2]){
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}


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

using namespace std;

const int N = 1e5 + 7;
int main(){
	ios_base::sync_with_stdio (false);
    cout << fixed;
    cout.precision(10);
	int a;
  	cin >> a;
  	cout << 1110 - a;
    return 0;
}


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

using namespace std;

const int INF = 1e9;
int n;
vector<int> edge[1100000];
int state[1100000]; // 0...not yet, 1...visiting, 2...visited
int memo[1100000];
bool done[1100000];

bool is_looping(int u)
{
  if (state[u] == 2) return false;
  if (state[u] == 1) return true;
  state[u] = 1;
  
  for (int v: edge[u]) {
    if (is_looping(v)) return true;
  }
  state[u] = 2;
  return false;
}

int dfs(int u)
{
  if (done[u]) return memo[u];
  done[u] = true;
  int dist = 0;
  for (int v: edge[u]) {
    dist = max(dist, dfs(v) + 1);
  }
  return memo[u] = dist;
}

int main()
{
  cin >> n;
  
  for (int i = 0; i < n; i++) {
    int last = 0;
    for (int j = 0; j < n-1; j++) {
      int a;
      cin >> a;
      a--;
      int next = min(i, a) * 1000 + max(i, a);
      edge[last].push_back(next);
      last = next;
    }
  }
  
  if (is_looping(0)) {
    cout << -1 << endl;
    return 0;
  }
  
  cout << dfs(0) << endl;
  return 0;
}


Measured memory_bytes: 51328
#include<iostream>
#include<cstdio>
#include<cstring>
#define N 500010
using namespace std;
int len;
char str[N],suf[N];
void make_nxt(int nxt[],char s[])
{
	nxt[0]=-1;
	int f=0;
	for(int i=1;i<len;i++)
	{
		while(f && s[i]!=s[f]) f=nxt[f];
		if(s[i]==s[f]) nxt[i+1]=++f;
		else nxt[i+1]=0;
	}
}
bool no_rep(int nxt[],int p){return nxt[p]==0 || p%(p-nxt[p]);}
int pre[N],nxt[N];
int main()
{
	scanf("%s",str);
	len=strlen(str);
	for(int i=0;i<len;i++) suf[i]=str[len-i-1];
	suf[len]='\0';
	make_nxt(pre,str);
	make_nxt(nxt,suf);
	if(no_rep(pre,len)){puts("1\n1");return 0;}
	bool same=true;
	for(int i=1;i<len;i++) if(str[i]!=str[i-1]) same=false;
	if(same){printf("%d\n1\n",len);return 0;}
	puts("2");
	int ans=0;
	for(int i=0;i<len;i++)
	if(no_rep(pre,i+1) && no_rep(nxt,len-i-1))ans++;
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 5248
i = input().split(" ")
n = int(i[0])
x = int(i[1])
l = input().split(" ")
height = 0
count = n+1

for i in range(n):
    if (height + int(l[i]) <= x):
        height += int(l[i])
    else:
        count = i + 1
        break

print(count)


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

using namespace std;

typedef long double ld;
typedef long long ll;

#define sz(x) (int)(x).size()
#define pb push_back
#define mp make_pair
#define f first
#define s second

template<typename T, typename U> bool ckmin(T &a, U b){ return b < a ? a = b, true : false; }
template<typename T, typename U> bool ckmax(T &a, U b){ return b > a ? a = b, true : false; }

ll n, a, b, X = 0, sum;
vector<ll> on;
ll f(ll m){
    ll cur = sum;
    for(ll i = 0; i < sz(on); ++i){
        if((m >> i) & 1) cur |= (1LL << on[i]);
    }
    return (cur >= b ? cur - b : -1);
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> n >> a >> b;
    for(int i = 0; i < n - 2; ++i){
        ll u; cin >> u; X ^= u;
    }
    sum = a + b - X;
    if(sum%2){ cout << -1; return 0; }
    sum >>= 1;
    if((sum ^ X) != sum + X){ cout << -1; return 0; }
    for(ll i = 0; i < 60; ++i){
        if((X >> i) & 1) on.pb(i);
    }
    // for(auto i : on) cout << i << " ";
    // cout << "\n";
    ll l = 0, r = (1LL << sz(on)) - 1, res = -1;
    if(sum == 0) l++, r--;
    while(l <= r){
        ll m = l + (r - l)/2, cur = f(m);
        if(cur != -1){
            res = cur;
            r = m - 1;
        }
        else l = m + 1;
    }
    cout << res;
    return 0;
}

Measured memory_bytes: 3668
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define inf (int)(1e18)

signed main(){
  int N, i, ans = inf;
  scanf("%lld", &N);
  for(i = 1; i * i <= N; i++){
    if(N % i == 0){
      ans = min(ans, i + N / i - 2);
    }
  }
  printf("%lld\n", ans);
  return 0;
}

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

using namespace std;
typedef long long ll;

int main() {
    string s;
    cin >> s;
    deque<char> dq;
    for (auto c : s) dq.emplace_back(c);
    bool rev = 0;
    int q;
    cin >> q;
    while (q--) {
        int t, f;
        char c;
        cin >> t;
        if (t == 1) {
            rev = !rev;
        } else {
            cin >> f >> c;
            if ((f == 1 && !rev) || (f == 2 && rev)) dq.emplace_front(c);
            else dq.emplace_back(c);
        }
    }
    if (rev) reverse(dq.begin(), dq.end());
    for (auto c : dq) cout << c;
    cout << "\n";
}


Measured memory_bytes: 4020
#include <stdio.h>
long long gcd(long long p,long long q){
    if(p%q==0) return q;
    else return gcd(q,p%q);
}
int main(void){
    long long a,b;
    scanf("%lld%lld",&a,&b);
    printf("%lld",a*b/gcd(a,b));
    return 0;
}

Measured memory_bytes: 128
using DataStructures
const double = Float64
const int = Int64

parseint(x) = parse(int, x)
readint() = map(parseint, split(readline()))

 
function main()
  N,M = readint()

  s = Vector{Vector{int}}(undef,N)
  for i in 1:N 
    s[i] = Vector{int}(undef,0)
  end
  for i in 1:M
    S = readint()[2:end]
    for SS in S
      append!(s[SS],[i])
    end 
  end
  p = readint()

  c = 0
  B = Vector{int}(undef,M)
  for i in 0:2^N-1
    B .= 0
    for j in 1:N
      #println(j, " ",s[j])
      if i >> (j-1) & 1 == 1 
        
        for k in s[j]
          B[k] += 1
        end
      end
    end
    flag = true
    for j in 1:M
      if B[j]%2 != p[j]
        flag = false
        break
      end
    end
    flag && (c+=1)
  end

  println(c)

 

end



main()

Measured memory_bytes: 194364
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        
        Scanner sc = new Scanner(System.in);
        
        int K = sc.nextInt();
        int X = sc.nextInt();
        
        int start = X - K + 1;
        int end = X + K - 1;
        
        StringBuilder sb = new StringBuilder();
        for(int i = start; i <= end; i++){
            sb.append(i);
            if ( i != end ) sb.append(" ");
        }
        
        System.out.println(sb);
        
    }
}


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

int main()
{
  int H,W;

  while(1){
    cin>>H>>W;
    if(H==0 && W==0){break;}

    for(int i=0;i<H;i++){
      for(int j=0;j<W;j++){
        if((i+j)%2==0){cout<<"#";}
        else{cout<<".";}
      }
      cout<<endl;
    }
    cout<<endl;
  }
  return 0;
}

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

int dsc(const void *, const void *);

int asc(const void *, const void *);

int
main(int argc, char *argv[])
{
  int n, m, Max = -100000, Min = 100000, x[100000], d[100000];
  scanf("%d %d", &n, &m);
  for(int i = 0; i < m; i++) scanf("%d", &x[i]);

  if(n >= m) printf("0\n");
  else{
    qsort(x, m, sizeof(int), asc);
    
    for(int i = 0; i < m - 1; i++){
      d[i] = x[i + 1] - x[i];
    }
    
    qsort(d, m - 1, sizeof(int), dsc);
 
    int ans = x[m - 1] - x[0];
    for(int i = 0; i < n - 1; i++){
      ans -= d[i];
    }
    
    printf("%d\n", ans);
  }
  return 0;
}

int asc(const void *a, const void *b){
  return *(int *)a - *(int *)b;
}

int dsc(const void *a, const void *b){
  return *(int *)b - *(int *)a;
}
    


Measured memory_bytes: 1268
#!/usr/bin/env python3
import bisect

n = int(input())
a = list(map(int, input().split()))
# b = a -1 とすると、bi+bj = -2*i or -2+j となるi,jを見つける
# sortして2分探索すると解ける
b = [a[i] - (1 + i) for i in range(0, n)]
b, idx = zip(*sorted(zip(b, range(1, n + 1))))
# print(b)
ans = 0
for i in range(n):
    # b[i]を固定して二分探索
    r = bisect.bisect_right(b, -b[i] - 2 * idx[i])
    l = bisect.bisect_left(b, -b[i] - 2 * idx[i])
    ans += r - l
    # if r - l != 0:
    # print(i, r, l, -b[i] - 2 * idx[i])
print(ans)


Measured memory_bytes: 61140
import java.util.*;
import java.io.*;
public class Main {
    static InputStreamReader r;
    public static void main(String[] args) throws Exception {
        r = new InputStreamReader(System.in);
        int N = nextInt();
        int W = nextInt();
        long dp[][] = new long[N+1][W+1];
        for (int i = 1; i <= N; i++) {
            int wi = nextInt();
            int vi = nextInt();
            for (int j = 1; j <= W; j++) {
                if (j >= wi) {
                    dp[i][j] = Math.max(dp[i-1][j], dp[i-1][j-wi]+vi);
                }
                dp[i][j] = Math.max(dp[i-1][j], dp[i][j]);
            }
        }
        System.out.println(dp[N][W]);
    }

    public static String nextString() throws Exception {
        String res = "";
        while (true) {
            int c = r.read();
            if (c == 32 || c == 10 || c == -1) {
                break;
            }
            res += (char)c;
        }
        return res;
    }

    public static int nextInt() throws Exception {
        return Integer.parseInt(nextString());
    }

    public static long nextLong() throws Exception {
        return Long.parseLong(nextString());
    }
}


Measured memory_bytes: 126544
n, k, s = map(int, input().split())
if s != 10**9:
  for i in range(n):
    if i < k:
      print(s)
    else:
      print(10**9)
else:
  for i in range(n):
    if i < k:
      print(10**9)
    else:
      print(1)

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

int main()
{
	int a[3];
	vector<int>vect;
	cin >> a[0]>>a[1]>>a[2];
	for (int i = 0; i < 3; i++) {
		if(a[i]<1 || a[i]>10000)return 0;
	}
	for (int i = 0; i < 3; i++ )vect.push_back(a[i]);
	sort(vect.begin(), vect.end());
	for (int i = 0; i < 2; i++)cout << vect[i] << " "; 
	cout << vect[2];
		cout << endl;
	return 0;

}

Measured memory_bytes: 3136
#include<stdio.h>
int main(){
  int n;
  scanf("%d",&n);
  int v[n],c[n],r[n];
  int ans=0;
  for(int i=0;i<n;i++){
    scanf("%d",&v[i]);
  }
  int sa;
  for(int i=0;i<n;i++){
    scanf("%d",&c[i]);
    sa=v[i]-c[i];
    if(sa>0){
      ans+=sa;
    }
  }
  printf("%d\n",ans);
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pi 3.141592653589793238
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define pb push_back
#define bg begin()
#define end end()
#define sz size()
#define vi vector<int>
#define vl vector<long long int>
int main(){
	fast;
	string a,b;
	cin>>a>>b;
	int diff=0,len;
	len=a.length();
	for(int i=0;i<len;i++)
		if(a[i]!=b[i])
			diff++;
	cout<<diff;
	return 0;
}



Measured memory_bytes: 3884
###
### atcorder test program
###

import sys
import math

### math class
# class math:
#     ### pi
#     pi = 3.14159265358979323846264338

#     ### GCD
#     def gcd(self, a, b):
#         if b == 0:
#             return a
#         return self.gcd(b, a%b)

#     ### LCM
#     def lcm(self, a, b):
#         return (a*b)//self.gcd(a,b)

# math = math()

### output class
class output:
    ### list
    def list(self, l):
        l = list(l)
        print(" ", end="")
        for i, num in enumerate(l):
            print(num, end="")
            if i != len(l)-1:
                print(" ", end="")
        print()

output = output()

### input sample
#i = input()
#A, B, C = [x for x in input().split()]
#N, K = [int(x) for x in input().split()]
#inlist = [int(w) for w in input().split()]
#R = float(input())
#A = [int(x) for x in input().split()]
#for line in sys.stdin.readlines():
#    x, y = [int(temp) for temp in line.split()]

### output sample
#print("{0} {1} {2:.5f}".format(A//B, A%B, A/B))
#print("{0:.6f} {1:.6f}".format(R*R*math.pi,R*2*math.pi))
#print(" {}".format(i), end="")

N, K = [int(x) for x in input().split()]

probability = 0

for i in range(1,N+1):
    score = i
    count = 0
    while score < K:
        count += 1
        score *= 2
    probability += (0.5**count)/N
    #print(i,count,probability)

print("{:.12f}".format(probability))


Measured memory_bytes: 3064
n = int(input())

flag = True
chr = 'A'
table = []
for i in range(n):
    line = input()
    if not(chr == line[0] or chr == 'A'):
        print('No')
        flag = False
        break

    if line in table:
        print('No')
        flag = False
        break
    table.append(line)
    chr = line[-1]

if flag:
    print('Yes')


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define int long long int
using namespace std;

signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n,k;
    cin>>k>>n;
    int t,t2;
    int s=0;
    int maxi=INT_MIN;
    int f;
    cin>>s;
    f=s;
    int sum=0;
    for(int i=0;i<n-1;i++)
    {
        cin>>t;
        t2=t;
        t = t-s;
        sum +=t;
        maxi = max(maxi,t);
        s=t2;
    }
    
    maxi = max(maxi,k-sum);
    cout<<k-maxi;
    return 0;
}

Measured memory_bytes: 3596
package main

import "fmt"

func main() {
	var s string
	fmt.Scan(&s)
	t := "hi"
	for i := 0; i < 5; i++ {
		if s == t {
			fmt.Println("Yes")
			return
		}
		t += "hi"
	}
	fmt.Println("No")
}


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

int main(void){
  int A, B, C, numMax;
  int cnt;
  cin >> A >> B >> C;
  numMax = max(A, max(B, C));
  if(3*numMax % 2 == (A + B + C) % 2){
    cnt = (3*numMax - (A + B + C)) / 2;
  }
  else{
    cnt = (3*(numMax + 1) - (A + B + C)) / 2;
  }
  cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 256
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
printV = lambda x: print(*x, sep="\n")
printH = lambda x: print(" ".join(map(str,x)))
def IS(): return sys.stdin.readline()[:-1]
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LI1(): return list(map(int1, sys.stdin.readline().split()))
def LII(rows_number): return [II() for _ in range(rows_number)]
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LLI1(rows_number): return [LI1() for _ in range(rows_number)]

def main():
	n,a,b = MI()
	S = IS()
	cnt = 0
	frank = 1
	for i,s in enumerate(S):
		if s == 'a':
			if cnt < a+b:
				cnt += 1
				print("Yes")
			else:
				print("No")
		elif s == 'b':
			if cnt < a+b and frank <= b:
				cnt += 1
				frank += 1
				print("Yes")
			else:
				print("No")
		else :
			print("No")

if __name__ == '__main__':
	main()

Measured memory_bytes: 4016