akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>


typedef long long ll;
using namespace std;
const int maxn=1007;

string s[4]={"AC","WA","TLE","RE"}; 
int num[4];
 
int main() 
{
	int n;
	cin>>n;
	for( int i=0;i<n;i++ )
	{
		string s1;
		cin>>s1;
		for( int j=0;j<4;j++ ) if( s1==s[j] ) num[j]++;
	}
	for( int i=0;i<4;i++ )
	{
		cout<<s[i]<<" x "<<num[i]<<endl;
	}
}

Measured memory_bytes: 3632
#include <stdio.h>

int main(){
	int n, x, y, z;
	scanf("%d", &n);
	
	if(n / 100 == 7){
		puts("Yes");
	} else if(n / 10 % 10 == 7){
		puts("Yes");
	} else if(n % 10 == 7){
		puts("Yes");
	} else{
		puts("No");
	}
	
	return 0;
}

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

int main()
{
  	int q,a,b;
  	string s,sq,replc;
  
 	cin >> s >> q;
   	
  	for(int i = 0;i < q;i++){
      cin >> sq >> a >> b;
      
      if(sq == "print"){
        for(int i = a;i <= b;i++)
          cout << s.at(i);
        cout << endl;
      }else if(sq == "reverse"){
        int j = 0;
        for(int i = a;j < (b-a+1)/2;i++)
          swap(s.at(i),s.at(b - j++)); 
      }else{
        cin >> replc;
        s.replace(a,replc.length(),replc);
      }
    }
  
}


Measured memory_bytes: 3184
import itertools

if __name__ == '__main__':
    N = int(input())

    answer = 0

    for i_repeat in range(1, len(str(N))+1):
        for i in itertools.product([7, 5, 3], repeat=i_repeat):
            i_list = list(i)
            str_i_list = str(i_list)
            cnt_7 = str_i_list.count('7')
            cnt_5 = str_i_list.count('5')
            cnt_3 = str_i_list.count('3')
            if cnt_7 >= 1 and cnt_5 >= 1 and cnt_3 >= 1:
                num = 0
                for j, e in enumerate(i_list):
                    num += int(e) * pow(10, len(i_list)-j-1)
                if num <= N:
                    answer += 1
    print(answer)

Measured memory_bytes: 3064
input_lines = readlines.map(&:chomp)
# N人のすぬけ君(1〜N), K種類のお菓子(1〜K)
N, K = input_lines.shift.split(' ').map(&:to_i)

all_n = (1..N).to_a

a_ks = (0...K).each_with_object({}) do |i, hash|
  d = input_lines[i*2].to_i
  aa = input_lines[i*2 + 1].split(' ')[0, d].map(&:to_i)
  aa.each do |a|
    hash[a] ||= []
    hash[a] << i+1
  end
end

result = all_n.count do |n|
   a_ks[n].nil?
end

puts result

Measured memory_bytes: 14368
#include<iostream>
#include<algorithm>
using namespace std;
pair<int,int>dp[33][33][33][33];
int a[32][32];
int sum[33][33];
int lim;
pair<int,int>f(int lx,int rx,int ly,int ry)
{
	if(dp[lx][rx][ly][ry].first>=0)return dp[lx][rx][ly][ry];
	int gs=sum[rx][ry]-sum[rx][ly]-sum[lx][ry]+sum[lx][ly];
	if(gs<lim)
	{
		return dp[lx][rx][ly][ry]={-114514,0};
	}
	pair<int,int>ret={1,gs-lim};
	pair<int,int>p,q,r;
	for(int i=lx+1;i<rx;i++)
	{
		p=f(lx,i,ly,ry);
		q=f(i,rx,ly,ry);
		r={p.first+q.first,min(p.second,q.second)};
		if(ret<r)ret=r;
	}
	for(int i=ly+1;i<ry;i++)
	{
		p=f(lx,rx,ly,i);
		q=f(lx,rx,i,ry);
		r={p.first+q.first,min(p.second,q.second)};
		if(ret<r)ret=r;
	}
	return dp[lx][rx][ly][ry]=ret;
}
main()
{
	int H,W,S;
	while(cin>>H>>W>>S,H)
	{
		for(int i=0;i<=H;i++)for(int j=0;j<=H;j++)for(int k=0;k<=W;k++)for(int l=0;l<=W;l++)
			dp[i][j][k][l].first=-1;
		for(int i=0;i<H;i++)for(int j=0;j<W;j++)
			cin>>a[i][j];
		for(int i=1;i<=H;i++)for(int j=1;j<=W;j++)
		{
			sum[i][j]=sum[i][j-1]+sum[i-1][j]-sum[i-1][j-1]+a[i-1][j-1];
		}
		lim=sum[H][W]-S;
		pair<int,int>p=f(0,H,0,W);
		cout<<p.first<<" "<<p.second<<endl;
	}
}



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

int main()
{
  int n;
  cin>> n;
  vector<int> h(n);
  int i;
  for(i = 0; i < n; i++)cin>>h.at(i);
  int maxn = h.at(0);
  bool s = true;
  for(i = 1; i < n; i++)
  {
    if(maxn-h.at(i)>=2)s = false;
    maxn = max(maxn,h.at(i));
  }
  if(s)cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 640
import sys
import math
from collections import defaultdict

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N):
    read_all = [tuple(map(int, input().split())) for _ in range(N)]
    return map(list,zip(*read_all))

#################

S = str(input())

if S=='Sunny':
    print('Cloudy')
elif S=='Cloudy':
    print('Rainy')
else:
    print('Sunny')

Measured memory_bytes: 38384
#include <bits/stdc++.h>
 
using namespace std;
 
const long long MOD=1e9+7;
const double PI=3.14159265359;





int main() {
    
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin>>n;
    vector<int> vi(n);
    for(int& i:vi){
        cin>>i;
    }
    sort(vi.begin(),vi.end());
    reverse(vi.begin(),vi.end());
    long long l=0,r=0;
    for(int i=i; i<n-1; i++){
        if(vi[i+1]==vi[i] && l==0){
            l=vi[i];
            i++;
        }
        else if(vi[i+1]==vi[i] && r==0){
            r=vi[i];
            cout<<r*l;
            return 0;
        }
    }
    
    cout<<r*l;
    return 0;
    
}

Measured memory_bytes: 640
#include <stdio.h>
#include<stdlib.h>
#include<math.h>

int main(){
  
  int num,N,Count=0,i,j;
  
  scanf("%d",&num);
  
  for(i=0; i<num; i++){
    scanf("%d",&N);
    
    if(N==1) Count+=1;
    
    else{
      for(j=2; j<=sqrt(N); j++){
      if(N%j==0 && N!=2){
	Count+=1;
      break;
      }
    }
  }
  }
  printf("%d\n",num-Count);
  
  return 0;
    }
    

Measured memory_bytes: 596
N = int(input())
L = [int(_) for _ in input().split()]

ans = 0
for i in range(N):
    for j in range(i+1, N):
        if L[i] == L[j]:
            continue
        for k in range(j+1, N):
            if L[i] == L[k] or L[j] == L[k]:
                continue
            X = (L[i], L[j], L[k])
            if max(X) < sum(X) - max(X):
                ans += 1
print(ans)


Measured memory_bytes: 9120
# -*- coding: utf-8 -*-
from sys import stdin
import numpy as np
from collections import Counter


s_in = lambda: stdin.readline()[:-1]  # s = s_in()
d_in = lambda: int(stdin.readline())  # N = d_in()
ds_in = lambda: list(map(int, stdin.readline().split()))  # List = ds_in()


N = d_in()
A_LIST = ds_in()


A_LIST = np.cumsum(A_LIST)
A_counter = Counter(A_LIST)


ans = 0
for i, c in A_counter.items():
    if i == 0:
        ans += c * (c+1) // 2
    else:
        ans += c * (c-1) // 2

print(ans)


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

namespace debug
{
    public static partial class Program
    {
        public static void Main()
        {
            var nd = Console.ReadLine().ArrayLongs();
            n = nd[0];
            d = nd[1];

            var xis = new long[n][];
            for (int i = 0; i < n; i++)
            {
                xis[i] = Console.ReadLine().ArrayLongs();
            }

            var cnt = 0;
            for (int i = 0; i < n; i++)
            {
                for (int j = i + 1; j < n; j++)
                {
                    var sum = 0.0;
                    for (int x = 0; x < d; x++)
                    {
                        sum += Math.Pow(Math.Abs(xis[i][x] - xis[j][x]), 2);
                    }

                    sum = Math.Sqrt(sum);
                    
                    if (sum - sum.ToLong() == 0.0)
                    {
                        cnt++;
                    }
                }
            }

            Console.WriteLine(cnt);
        }
    }

    public static partial class Program
    {
        //テンプレここから
        public static long a, c, d, e, f, g, h, j, k, l, m, n, o, p, q, r, s, t, u, v, w;
        public static long GCD(long aaa, long bbb) => bbb == 0 ? aaa : GCD(bbb, aaa % bbb);
        public static long LCM(long aaa, long bbb) => aaa * bbb / GCD(aaa, bbb);
        public static long ToLong(this double ddd) => (long) ddd;
        public static long ToLong(this string str) => long.Parse(str);
        public static long[] ToLong(this IEnumerable<string> strs) => strs.Select(x => x.ToLong()).ToArray();
        public static long[] ArrayLongs(this string str, char opr = ' ') => str.Split(opr).ToLong();
        public static long Diff(long aaa, long bbb) => Math.Abs(Math.Max(aaa, bbb) - Math.Min(aaa, bbb));
        public static long Sign(this long iii) => Math.Sign(iii);
        public static bool IsEven(this long iii) => iii % 2 == 0;
        public static readonly int[] Dx = {0, -1, 0, 1};
        public static readonly int[] Dy = {-1, 0, 1, 0};
        public const int MOD = 1000000007;
        public const string ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
        public const string alphabet = "abcdefghijklmnopqrstuvwxyz";
        public static long ToLong(this char ccc) => ccc.ToString().ToLong();
        public static string Join(this IEnumerable<string> array, string sep = "") => string.Join(sep, array);
        public static string Join(this IEnumerable<char> array, string sep = "") => string.Join(sep, array);

        public static string JoinToStr(this IEnumerable<long> array, string sep = "")
            => array.Select(xxx => xxx.ToString()).Join(sep);

        //テンプレここまで
    }
}

Measured memory_bytes: 13396
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const long long MOD = 1e9+7, MAx = 1e18, larg = 1e5, INF = -1e9;
long long A,B,C,D,E,F,G,H,I,J,K,L,N,M,O,P,Q,R,S,T,U,V,W,x,y,z;
long long max_value = INF, max_index = -1;
long long min_value = MAx, min_index = -1;

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

int main() {
    cin >> N;
    string s, t;
    cin >> s >> t;
    rep(i, N) cout << s[i] << t[i];
}


Measured memory_bytes: 256
def bitadd(a,w,bit): #aにwを加える(1-origin)
 
    x = a
    while x <= (len(bit)-1):
        bit[x] += w
        x += x & (-1 * x)
 
def bitsum(a,bit): #ind 0～aまでの和を求める
 
    ret = 0
    x = a
    while x > 0:
        ret += bit[x]
        x -= x & (-1 * x)
    return ret




N = int(input())

a = list(map(int,input().split()))
b = a.copy()
b.sort()
dic = {}

for i in range(N):
    dic[b[i]] = i+1

for i in range(N):
    a[i] = dic[a[i]]

BIT = [0] * (N+1)
ans = 0
a.reverse()

for i in range(N):

    ans += bitsum(a[i],BIT)
    bitadd(a[i],1,BIT)
    #print (BIT,ans)

print (ans)


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

int main() {
  int a, b;
  cin >> a >> b;
  
  int g_b = 0;
  if (b < 10) g_b = 10;
  else if ((b >= 10)&&(b < 100)) g_b= 100;
  else g_b = 1000;
  
  int num = 0;
  num = a*g_b + b;
  
  bool check = false;
  for (int i = 0; i*i <= num; i++){
    if (i*i == num) check = true;
  }

  if (check) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 256
n = int(input())
s = list(input())
ss = list(input())
ans = []
i = 0
while i < n:
	if i == 0:
		if i+1 == n:
			ans.append(3)
			i = 10000
		elif s[i] == s[i+1]:
			ans.append(3)
			ans.append(2)
			i += 2
		else:
			ans.append(3)
			i += 1
	else:
		if s[i] == ss[i]:
			if s[i-1] == ss[i-1]:
				ans.append(2)
				i += 1
			else:
				ans.append(1)
				i += 1
		else:
			if s[i-1] == ss[i-1]:
				ans.append(2)
				i += 2
			else:
				ans.append(3)
				i += 2

t = 1
for k in range(len(ans)):
	t = (t*ans[k])%1000000007
print(t)

Measured memory_bytes: 3064
N,Q = map(int,input().split())
s_list = list(input())
lr_list = []
for _ in range(Q):
    lr_list.append(list(map(int,input().split())))

ac_head = []

for i in range(N-1):
    if s_list[i] == "A" and s_list[i+1] == "C":
        ac_head.append(1)
    else:
        ac_head.append(0)
        
ac_head.append(0)

ac_tail = [0] + ac_head[:-1]

ac_head_sum = []
tmp = 0
for h in ac_head:
    tmp += h
    ac_head_sum.append(tmp)

ac_tail_sum = []
tmp = 0
for t in ac_tail[::-1]:
    tmp += t
    ac_tail_sum.append(tmp)
    
ac_tail_sum = ac_tail_sum[::-1]

goukei = ac_head_sum[-1]

for l,r in lr_list:
    if l-1 > 0:
        mae = ac_head_sum[l-2]
    else:
        mae = 0
    if r-1 < N-1:
        ato = ac_tail_sum[r]
    else:
        ato = 0
    print(goukei - mae - ato)


Measured memory_bytes: 78968
/* 
    @author : srinathbalaji_99
*/


#include<bits/stdc++.h>

#define PB push_back
#define MP make_pair
#define endl '\n'
#define MAX LLONG_MAX
#define MIN LLONG_MIN
#define rep(i, a, b, inc) for(long long i = a; i < b; i += inc)
#define REP(i, n) rep(i, 0, n, 1)
#define MEM(a, b) memset(a, (b), sizeof(a))
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
#define PLL pair<long long, long long>
#define VL vector<long long>
#define VS vector<string>
#define VLL vector<PLL>
#define VVL vector<VL>
#define MPLL map<long long, long long>
#define UMPLL unordered_map<long long, long long>
#define SETL set<long long>
#define MSETL multiset<long long>
#define GCD(a, b) __gcd(a, b)
#define LCM(a, b) (a * b)/GCD(a, b)
#define ff first
#define ss second
#define pall(a) REP(i, sizeof(a)/sizeof(a[0]))cout << a[i] << " ";cout << endl;
#define pvall(v) REP(i, v.size())cout << v[i] << " ";cout << endl;
#define gall(a, n) REP(i, n)cin >> a[i];
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()

typedef unsigned long long ULL;
typedef long long LL;
typedef long double LD;


using namespace std;

LD dp[3001][3001];
LD prob[3001];
void fast()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
}

int main()
{
    fast();

    cout << fixed;
    cout << setprecision(10);

    LL t,n,i,j,k,x,y,c;
    cin >> n;
    REP(i, n){
        cin >> prob[i + 1];
    }

    dp[0][0] = (LD)1;

    //dp[i][j] -> probabilty that after 'j'-th toss I have 'i' heads


    REP(i, n + 1){
        REP(j, n + 1){
            if(i == 0 && j == 0){
                continue;
            }
            if(i == 0){
                //cout << dp[i][j - 1] << " " << prob[j] << endl;
                dp[i][j] = (dp[i][j - 1] * ((LD)1 - prob[j]));
                continue;
            }
            if(j == 0){
                dp[i][j] = (LD)0;
                continue;
            }
            dp[i][j] = (dp[i - 1][j - 1] * prob[j]) + (dp[i][j - 1] * ((LD)1 - prob[j]));
        }
    }
    LD ans = 0;

    // REP(i, n + 1){
    //     REP(j, n + 1){
    //         cout << dp[i][j] << " "; 
    //     }
    //     cout << endl;
    // }

    rep(i, n / 2, n + 1, 1){
        if(i > (n / 2)){
            ans += dp[i][n];
        }
    }
    cout << ans;
}

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

#define TRACE(x) x
#define WATCH(x) TRACE(cout << #x" = " << x << endl)
#define WATCHR(a, b) TRACE(for (auto it=a; it!=b;) cout << *(it++) << " "; cout << endl)
#define WATCHC(V) TRACE({cout << #V" = "; WATCHR(V.begin(), V.end());})

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

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vs = vector<string>;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);

    ll K, A, B;
    cin >> K >> A >> B;

    if (1 + K <= A || B - A <= 2) {
        cout << 1 + K << endl;
    } else {
        K -= (A - 1);
        cout << A + (K/2 * (B - A)) + (K&1) << endl;
    }

    return 0;
}



Measured memory_bytes: 256
import bisect

n = int(input())

a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))

a.sort()
c.sort()

ans = 0
for i in range(len(b)):
    a_idx = bisect.bisect_left(a, b[i])
    c_idx = bisect.bisect_right(c, b[i])
    ans += a_idx * (n - c_idx)
print(ans)


Measured memory_bytes: 23360
from collections import defaultdict

def check(D, STEP,  x, y):
    global moves_x, moves_y, oks

    if D == 'N':
        y += STEP
        for _y, i in moves_x.get(x, []):
            if y-STEP <= _y and _y <= y:
                oks[i] = 1
            else:
                continue
        return x, y
    elif D == 'S':
        y -= STEP
        for _y, i in moves_x.get(x, []):
            if y+STEP >= _y and _y >= y:
                oks[i] = 1
            else:
                continue
        return x, y
    elif D == 'E':
        x += STEP
        for _x, i in moves_y.get(y, []):
            if x-STEP <= _x and _x <= x:
                oks[i] = 1
            else:
                continue
        return x, y
    elif D == 'W':
        x -= STEP
        for _x, i in moves_y.get(y, []):
            if x+STEP >= _x and _x >= x:
                oks[i] = 1
            else:
                continue
        return x, y

ans = []
while 1:
    N = int(input())
    if N == 0: break
    moves_x = defaultdict(list)
    moves_y = defaultdict(list)
    oks = [0]*N

    for i in range(N):
        _x, _y = map(int, input().split())
        moves_x[_x] += [[_y, i]]
        moves_y[_y] += [[_x, i]]
    moves_x = dict(moves_x)
    moves_y = dict(moves_y)

    M = int(input())
    x, y = 10, 10
    for i in range(M):
        D, STEP = input().split()
        STEP = int(STEP)
        x, y = check(D, STEP, x, y)
    if 0 in oks:
        ans += ['No']
    else:
        ans += ['Yes']

print('\n'.join(ans))


Measured memory_bytes: 6004
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<vector>
#include<deque>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<algorithm>
#include<functional>
#include<utility>
#include<bitset>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<cstdio>

using namespace std;

#define REP(i,n) for(int i=0;i<int(n);i++)
#define foreach(c,itr) for(__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)
typedef long long ll;
typedef pair<int,int> P;

int L[55][55];
int w,h;
bool inside(int i,int j){
	return (1<=i && i<=h && 1<=j && j<=w);
}

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

void dfs(int i,int j){
	L[i][j]=0;
    REP(k,8){
    int x=i+dx[k],y=j+dy[k];
	if(inside(x,y)){
		if(L[x][y]==1) dfs(x,y);
	}
    }
}

int main(){
	  int i,j;

	  while(1){
		  cin >> w >> h;
		  if(w==0 && h==0) break;
		  for(i=1;i<=h;i++) for(j=1;j<=w;j++) cin >> L[i][j];

		  int ans=0;
		  for(i=1;i<=h;i++) for(j=1;j<=w;j++){
			  if(L[i][j]==1){
				  ans++;
				  dfs(i,j);
			  }
		  }

		  cout << ans << endl;

	  }

	  return 0;
}



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

using namespace std;

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

int main(void)
{
	while(1) {
		int n, p;
		cin >> n >> p;
		if (!n) break;
		int init_p = p;
		int winner = 0;
		vec<int> rock(n, 0);
		while(1) {
			if (p > 0) {
				p--;
				rock[winner]++;
			} else {
				p += rock[winner];
				rock[winner] = 0;
			}
			if (!p && rock[winner] == init_p) break;
			winner++;
			if (winner == n) winner = 0;
		}
		cout << winner << endl;
	}
	return 0;
}

Measured memory_bytes: 3076
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.NoSuchElementException;

public class Main {
	int N;
	long[] a;

	public void solve() {
		N = nextInt();
		a = new long[N];
		for (int i = 0; i < N; i++) {
			a[i] = nextInt();
		}

		long ans = Long.MAX_VALUE;

		// even
		{
			long sum = 0;
			long cnt = 0;
			for (int i = 0; i < N; i++) {
				sum += a[i];
				if (i % 2 == 0) {
					if (sum <= 0) {
						cnt += 1 - sum;
						sum = 1;
					}
				} else {
					if (sum >= 0) {
						cnt += 1 + sum;
						sum = -1;
					}
				}
			}

			ans = Math.min(ans, cnt);
		}

		//odd
		{
			long sum = 0;
			long cnt = 0;
			for (int i = 0; i < N; i++) {
				sum += a[i];
				if (i % 2 == 1) {
					if (sum <= 0) {
						cnt += 1 - sum;
						sum = 1;
					}
				} else {
					if (sum >= 0) {
						cnt += 1 + sum;
						sum = -1;
					}
				}
			}
			ans = Math.min(ans, cnt);
		}

		out.println(ans);
	}

	public static void main(String[] args) {
		out.flush();
		new Main().solve();
		out.close();
	}

	/* Input */
	private static final InputStream in = System.in;
	private static final PrintWriter out = new PrintWriter(System.out);
	private final byte[] buffer = new byte[2048];
	private int p = 0;
	private int buflen = 0;

	private boolean hasNextByte() {
		if (p < buflen)
			return true;
		p = 0;
		try {
			buflen = in.read(buffer);
		} catch (IOException e) {
			e.printStackTrace();
		}
		if (buflen <= 0)
			return false;
		return true;
	}

	public boolean hasNext() {
		while (hasNextByte() && !isPrint(buffer[p])) {
			p++;
		}
		return hasNextByte();
	}

	private boolean isPrint(int ch) {
		if (ch >= '!' && ch <= '~')
			return true;
		return false;
	}

	private int nextByte() {
		if (!hasNextByte())
			return -1;
		return buffer[p++];
	}

	public String next() {
		if (!hasNext())
			throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = -1;
		while (isPrint((b = nextByte()))) {
			sb.appendCodePoint(b);
		}
		return sb.toString();
	}

	public int nextInt() {
		return Integer.parseInt(next());
	}

	public long nextLong() {
		return Long.parseLong(next());
	}

	public double nextDouble() {
		return Double.parseDouble(next());
	}
}

Measured memory_bytes: 38372
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define FOR(i,l,r) for(ll i=(l);i<(r);++i)
#define REP(i,n) FOR(i,0,n)
#define REPS(i,n) FOR(i,1,n+1)
#define RFOR(i,l,r) for(ll i=(l);i>=(r);--i)
#define RREP(i,n) RFOR(i,n-1,0)
#define RREPS(i,n) RFOR(i,n,1)
#define pb push_back
#define eb emplace_back
#define SZ(x) ((ll)(x).size())
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
template<class T = ll> using V = vector<T>;
template<class T = ll> using VV = V<V<T>>;
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; }
inline void Yes(bool b = true) {cout << (b ? "Yes" : "No") << '\n';}
inline void YES(bool b = true) {cout << (b ? "YES" : "NO") << '\n';}
inline void err(bool b = true) {if(b) {cout << -1 << '\n'; exit(0);}}
template<class T> inline void fin(bool b = true, T e = 0) {if(b) {cout << e << '\n'; exit(0);}}
template<class T> T Roundup_div(T x, T y) {return (x+(y-1))/y;}
const ll INF = 1e18;
template <typename T>
T pow(T a, long long n, T e = 1) {
    T ret = e;
    while (n) {
        if (n & 1) ret *= a;
        a *= a;
        n >>= 1;
    }
    return ret;
}

ll memo[200001];

int dfs(int n){
    if(n == 0) return 0;
    if(memo[n]) return memo[n];
    return memo[n] = dfs(n % __builtin_popcount(n)) + 1;
}

void make_table(){
    REPS(i,200000) dfs(i);
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll n; string s; cin >> n >> s;
    make_table();
    ll onec = 0;
    REP(i, n) if(s[i] == '1') onec++;
    ll pres = 0, mres = 0;
    REP(i, n){
        pres *= 2;
        if(s[i] == '1') pres++;
        pres %= (onec + 1);
    }
    if(onec - 1)REP(i, n){
        mres *= 2;
        if(s[i] == '1') mres++;
        mres %= (onec - 1);
    }
    V<> pt(n, 0), mt(n, 0);
    ll pk = 1, mk = 1;
    RREP(i, n){
        pt[i] = pk;
        pk *= 2;
        pk %= (onec + 1);
    }
    if(onec - 1)RREP(i, n){
        mt[i] = mk;
        mk *= 2;
        mk %= (onec - 1);
    }
    REP(i, n){
        if(s[i] == '0'){
            ll x = pres + pt[i];
            x %= (onec + 1);
            cout << memo[x] + 1 << endl;
        }
        else{
            if(onec - 1 == 0){
                cout << 0 << endl;
                continue;
            }
            ll y = mres - mt[i];
            if(y < 0) y += (onec - 1);
            y %= (onec - 1);
            cout << memo[y] + 1 << endl;
        }
    }
}

Measured memory_bytes: 8100
#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <vector>
#include <cstdio>
#include <bits/stdc++.h>
#include <set>
#include <map>
#include <stdio.h>
#include <stack>
#include <queue>
#include <deque>
#include <numeric>
#include<bits/stdc++.h>
#include <utility>

#define ALL(obj) (obj).begin(), (obj).end()
#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define RFOR(i,a,b) for(int i = (a); (b) <= i; i--)
#define REP(i,n) for(int i = 0; i < (n); i++)
#define RREP(i,n) for(int i = n; n <= i; i--)
#define ABS(a) ((a < 0) ? ((-1)*(a)) : (a))
#define elif else if
#define MOD 1000000007
#define INF (1<<29)

using namespace std;
using ll = long long;
map <int ,int> mpa,mpb;
typedef pair<ll, ll> P;
priority_queue<P, vector<P>, greater<P>> pque;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  ll N;
  cin >> N;
  ll x[110],y[110],h[110];
  for(int i=1;i<=N;i++){
    cin >> x[i] >> y[i] >> h[i];
  }
  ll H=0;
  for(int ax=0;ax<=100;ax++){
    for(int ay=0;ay<=100;ay++){
      for(int i=1;i<=N;i++){
        if(h[i]!=0){
          H=h[i]+abs(x[i]-ax)+abs(y[i]-ay);
          break;
        }
      }
      for(int j=1;j<=N;j++){
        if(h[j]==max(0LL,H-abs(x[j]-ax)-abs(y[j]-ay))){
          if(j==N){
            cout << ax << " " << ay << " " << H << endl;
            return 0;
          }
        }else{
          break;
        }
      }
    }
  }
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
N = int(input())
nodes = []
for i in range(N - 1):
    tmp = input()
    nodes.append([int(a) for a in tmp.split()])
tmp = input()
M, top = [int(a) for a in tmp.split()]
querys = []
for i in range(M):
    tmp = input()
    querys.append([int(a) for a in tmp.split()])

#
#print(nodes, querys)
nodes_dic = [[] for i in range(N + 1)]
for n in nodes:
    frm, to, dist = n
    nodes_dic[frm].append([to, dist])
    nodes_dic[to].append([frm, dist])
#
# print(nodes_dic)
dist_dic = [-1 for i in range(N + 1)]
dist_dic[top] = 0
stack = [top]
while len(stack) > 0:
    n = stack.pop()
    for a in nodes_dic[n]:
        to, dist = a
        if dist_dic[to] >= 0:
            continue
        dist_dic[to] = dist_dic[n] + dist
        stack.append(to)
#
# print(dist_dic)
for q in querys:
    print(dist_dic[q[0]] + dist_dic[q[1]])


Measured memory_bytes: 79568
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define sz(x) (int)x.size()
#define de(x) cout << #x << " = " << x << endl
#define rep(i, a, b) for(int i=(a); i<(b); i++)
//-----
ll lcm(ll a, ll b){
	return a/__gcd(a, b)*b;
}
int n;
int main() {
	scanf("%d", &n);
	ll ans=1;
	rep(i, 0, n){
		ll t=0;
		cin>>t;
		ans=lcm(ans, t);
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
typedef long long ll;
int main() {
	ll x; cin >> x;
	ll a = (x / 11) * 2;
	ll b = x % 11;
	if (b != 0) {
		if (b > 6 && b < 11) a += 2;
		if (b <= 6) a++;
	}
	cout << a << endl;
	return 0;
}

Measured memory_bytes: 256
S = input()
f = int(S[:2])
s = int(S[2:])
if 1 <= f <= 12 and 1 <= s <= 12:
    print('AMBIGUOUS')
elif 1 <= f <= 12:
    print('MMYY')
elif 1 <= s <= 12:
    print('YYMM')
else:
    print('NA')

Measured memory_bytes: 61652
using System;
using System.Collections.Generic;

class Program
{
    static string InputPattern = "InputX";

    static List<string> GetInputList()
    {
        var WillReturn = new List<string>();

        if (InputPattern == "Input1") {
            WillReturn.Add("QWERTYASDFZXCV");
            //5
        }
        else if (InputPattern == "Input2") {
            WillReturn.Add("ZABCZ");
            //4
        }
        else if (InputPattern == "Input3") {
            WillReturn.Add("HASFJGHOGAKZZFEGA");
            //12
        }
        else {
            string wkStr;
            while ((wkStr = Console.ReadLine()) != null) WillReturn.Add(wkStr);
        }
        return WillReturn;
    }

    static void Main()
    {
        List<string> InputList = GetInputList();
        string s = InputList[0];

        char[] wkArr = s.ToCharArray();

        int StaInd = Array.FindIndex(wkArr, X => X == 'A');
        int EndInd = Array.FindLastIndex(wkArr, X => X == 'Z');
        Console.WriteLine(EndInd - StaInd + 1);
    }
}


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

#define ll long long
#define INF 100000000000
int n,m,k;

ll dp[100003],h[100003];

ll solve(int i){
    if(i<=0) return 0;
    if(dp[i]!=-1) return dp[i];
    ll mn=INF;
    for(int p=1;p<=k && i-p>=0 ;p++){
        if(dp[i-p]!=-1) mn=min(dp[i-p]+abs(h[i]-h[i-p]),mn);
        else mn=min(solve(i-p)+abs(h[i]-h[i-p]),mn);
    }
    return dp[i]=mn;
}


int main(){
    int t=1,tn=1;
//    scanf("%d",&t);
    while(t--){
        scanf("%d%d",&n,&k);
        for(int i=0;i<n;i++){
            scanf("%lld",&h[i]);
            dp[i]=-1;
        }
        solve(n-1);
//        for(int i=0;i<n;i++)
//            printf("%lld ",dp[i]);

        printf("%lld",dp[n-1]);

    }
    return 0;
}


Measured memory_bytes: 8064
#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<string> a(3);
  for (int i=0; i<3; i++) {
    cin >> a[i];
    if (a[i].at(0)=='a') {
      cout << 'A';
    }
    if (a[i].at(0)=='b') {
      cout << 'B';
    }
    if (a[i].at(0)=='c') {
      cout << 'C';
    }
    if (a[i].at(0)=='d') {
      cout << 'D';
    }
    if (a[i].at(0)=='e') {
      cout << 'E';
    }
    if (a[i].at(0)=='f') {
      cout << 'F';
    }
    if (a[i].at(0)=='g') {
      cout << 'G';
    }
    if (a[i].at(0)=='h') {
      cout << 'H';
    }
    if (a[i].at(0)=='i') {
      cout << 'I';
    }
    if (a[i].at(0)=='j') {
      cout << 'J';
    }
    if (a[i].at(0)=='k') {
      cout << 'K';
    }
    if (a[i].at(0)=='l') {
      cout << 'L';
    }
    if (a[i].at(0)=='m') {
      cout << 'M';
    }
    if (a[i].at(0)=='n') {
      cout << 'N';
    }
    if (a[i].at(0)=='o') {
      cout << 'O';
    }
    if (a[i].at(0)=='p') {
      cout << 'P';
    }
    if (a[i].at(0)=='q') {
      cout << 'Q';
    }
    if (a[i].at(0)=='r') {
      cout << 'R';
    }
    if (a[i].at(0)=='s') {
      cout << 'S';
    }
    if (a[i].at(0)=='t') {
      cout << 'T';
    }
    if (a[i].at(0)=='u') {
      cout << 'U';
    }
    if (a[i].at(0)=='v') {
      cout << 'V';
    }
    if (a[i].at(0)=='w') {
      cout << 'W';
    }
    if (a[i].at(0)=='x') {
      cout << 'X';
    }
    if (a[i].at(0)=='y') {
      cout << 'Y';
    }
    if (a[i].at(0)=='z') {
      cout << 'Z';
    }
  }
  cout << endl;
}


Measured memory_bytes: 256
n,x = list(map(int, input().split()))

ans = [1]
pat = [1]
a = 1
p = 1
for i in range(n):
    ans.append(a*2 + 3)
    pat.append(p*2 + 1)
    a = a*2 + 3
    p = p*2 + 1

def f(N, X):
    if N == 0:
        return 0 if X <= 0 else 1
    elif X <= 1 + ans[N-1]:
        return f(N-1, X-1)
    elif X == 2 + ans[N-1]:
        return pat[N-1] + 1
    elif X <= 2 + 2*ans[N-1]:
        return pat[N-1] + 1 + f(N-1, X-2-ans[N-1])
    else:
        return 2*pat[N-1] + 1

print(f(n, x))

Measured memory_bytes: 38384
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <bitset>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <numeric>
#include <iostream>
#include <iomanip>
#include <string>
#include <chrono>
#include <random>
#include <cmath>
#include <cassert>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <functional>
#include <sstream>

using namespace std;


int main(int argc, char** argv) {
    ios::sync_with_stdio(false);
    cin.tie(0);

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

    int res = 0;
    for (int i = 1; i + 1 < n; ++i) {
        if ((P[i] > P[i - 1] && P[i] < P[i + 1])
            || (P[i] > P[i + 1] && P[i] < P[i - 1])) {
                ++res;
            }
    }

    cout << res << "\n";
    
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <math.h>
#include <string.h>
#include <map>
#include <numeric>
#include <random>
#include <queue>
#include <deque>
#include <tuple>
#include <iomanip>

using namespace std;

const int MOD = 1000000007;
typedef long long ll;

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N;
  cin>>N;
  cout<<180*(N-2)<<endl;
}


Measured memory_bytes: 256
object Main extends App {
	val pw = new java.io.PrintWriter(System.out)

	@scala.annotation.tailrec
	def loop(start: Int, end: Int)(f: Int => Unit): Unit =
		if (start < end) {
			f(start)
			loop(start + 1, end)(f)
		}

	val n, m, x = Scanner.nextInt

	case class Book(c: Int, a: Array[Int])
	val bs = Seq.fill(n)(Book(Scanner.nextInt, Array.fill(m)(Scanner.nextInt)))

	val ans = (1 to n).flatMap(bs combinations _).collect{case b if (b.map(_.a).transpose.map(_.sum).forall(_ >= x)) => b.map(_.c).sum}

	pw.println(if (ans.isEmpty) -1 else ans.min)
	pw.flush()
}

object Scanner {
	private val buf = new Array[Byte](1024); private var ptr = 0; private var len = 0

	@inline private def isPrintableChar(c: Int): Boolean = 33 <= c && c <= 126
	@inline private def hasNextByte(): Boolean = if (ptr >= len) { ptr = 0; len = System.in.read(buf); len > 0 } else true
	@inline private def hasNext(): Boolean = {
		while (hasNextByte() && !isPrintableChar(buf(ptr))) ptr += 1
		hasNextByte()
	}
	@inline private def readByte(): Byte = if (hasNextByte()) { val res = buf(ptr); ptr += 1; res } else -1

	def next(): String = {
		if(!hasNext()) ???
		val sb = new StringBuilder; var b = readByte()
		while (isPrintableChar(b)) { sb.append(b.toChar); b = readByte() }
		sb.toString
	}

	def nextInt(): Int = {
		val n = nextLong()
		if (n < Int.MinValue || Int.MaxValue < n) ???
		n.toInt
	}

	def nextLong(): Long = {
		if(!hasNext()) ???
		var minus = false; var b = readByte()
		if (b == '-') { minus = true; b = readByte() }

		@scala.annotation.tailrec
		def go (b: Byte, n: Long = 0): Long = if ('0' <= b && b <= '9') go(readByte(), n * 10 + b - '0') else if (minus) -n else n

		go(b)
	}

	def nextDouble(): Double = next().toDouble
}


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

using namespace std;
using ll=long long;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, a, n) for(int i = (a); i < (n); i++)

int main(){
  cin.tie(nullptr);ios_base::sync_with_stdio(false);
  int n;cin>>n;
	//$B$3$NK\$G$O!"<!$N$h$&$J=g$G%l%9%H%i%s$r(B
  //$B>R2p$7$h$&$H$7$F$$$^$9!#(B
  pair<pair<string,int>,int> pair[n];
  int p;
  string s;
  rep(i,n){
    cin>>s>>p;
    pair[i]=make_pair(make_pair(s,-p),i);
  }
	//$B;TL>$,<-=q=g$GAa$$$b$N$+$i>R2p$7$F$$$/!#(B
  sort(pair,pair+n);
	//$B$3$NK\$G>R2p$5$l$k=g$K(B
  //$B%l%9%H%i%s$NHV9f$r=PNO$7$F$/$@$5$$!#(B
	//$BF1$8;T$KJ#?t%l%9%H%i%s$,$"$k>l9g$O!"(B
  //$BE@?t$,9b$$$b$N$+$i>R2p$7$F$$$/!#(B
  rep(i,n)cout<<++pair[i].second<<endl;
}


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


class Program
{


    static void Main(string[] args)
    {

        char[] cs = new char[] { ' ', ',' };
        //int val = int.Parse(Console.ReadLine());
        //int[] vals = parseAry(Console.ReadLine().Split(cs));
        //string str = Console.ReadLine();
        //string[] strs = Console.ReadLine().Split(cs);

        //string res="";
        //int res = 0; ;
        //int t = int.Parse(Console.ReadLine());
        //string str = Console.ReadLine();
        ///int[] vals = parseAry(Console.ReadLine().Split(cs));
        //int n = int.Parse(Console.ReadLine());

        int res = 0;

		int[] v = parseAry(Console.ReadLine().Split(cs));
		int k = v[1];
		int[] vals = parseAry(Console.ReadLine().Split(cs));

        //int[] vals = parseAry(Console.ReadLine().Split(cs));
		int[] d=new int[vals.Length];
		d[0] = 0;

		for ( int i = 1; i < vals.Length; i++ ) {
			List<int> ddd = new List<int>();
			for ( int j = i - k; j < i; j++ ) {
				if ( j <0 ) { j = 0; }
				ddd.Add(d[j] + Math.Abs(vals[j] - vals[i]));
			}
			d[i] = ddd.Min();

        }

        Console.WriteLine(d[d.Length-1]);

        return;
    }

    //　String[]  ----->  int[]
    static int[] parseAry(string[] str)
    {
        int[] nums = new int[str.Length];
        for (int i = 0; i < str.Length; i++) { nums[i] = int.Parse(str[i]); }
        return nums;
    }
    //　String[]  ----->  long[]
    static long[] parseAryL(string[] str)
    {
        long[] nums = new long[str.Length];
        for (int i = 0; i < str.Length; i++) { nums[i] = long.Parse(str[i]); }
        return nums;
    }

    //文字列を1文字ずつString[]に入れる
    static string[] strAry(String str)
    {
        string[] re = new string[str.Length];
        for (int i = 0; i < str.Length; i++) { re[i] = str[i].ToString(); }
        return re;
    }

}

Measured memory_bytes: 26716
#include <cstdio>
#include <cstdlib>
#include <cstring>
using namespace std;

struct Node
{
  int key;
  Node *parent, *left, *right;
};

Node *root, *nil;

void insert(int i)
{
  Node *n = (Node *)malloc(sizeof(Node));
  n->key = i;
  n->left = nil;
  n->right = nil;

  Node *node = root;
  Node *parent = nil;
  while (node != nil)
  {
    parent = node;
    if (n->key < node->key)
      node = node->left;
    else
      node = node->right;
  }
  n->parent = parent;

  if (parent == nil)
    root = n;
  else if (n->key < parent->key)
    parent->left = n;
  else
    parent->right = n;
}

bool contains(Node *n, int i)
{
  if (n == nil)
    return false;
  if (n->key == i)
    return true;

  if (i < n->key)
    return contains(n->left, i);
  else
    return contains(n->right, i);
}

void preorderPrint(Node *n)
{
  if (n == nil)
    return;
  printf(" %d", n->key);
  preorderPrint(n->left);
  preorderPrint(n->right);
}

void inorderPrint(Node *n)
{
  if (n == nil)
    return;
  inorderPrint(n->left);
  printf(" %d", n->key);
  inorderPrint(n->right);
}

int main()
{
  int m, num;
  char order[7];
  scanf("%d", &m);

  for (int i = 0; i < m; i++)
  {
    scanf("%s", order);
    if (order[0] == 'i')
    {
      scanf("%d", &num);
      insert(num);
    }
    else if (order[0] == 'f')
    {
      scanf("%d", &num);
      if (contains(root, num))
        printf("yes\n");
      else
        printf("no\n");
    }
    else
    {
      inorderPrint(root);
      printf("\n");
      preorderPrint(root);
      printf("\n");
    }
  }

  return 0;
}

Measured memory_bytes: 21308
#include <algorithm>
#include <cmath>
#include <deque>
#include <iostream>
#include <numeric>
#include <sstream>
#include <string>
#include <string.h>
#include <vector>

#define REP(i,x) for(int i{ 0 }; i < (int)(x); i++)
#define REPC(i,x) for(int i{ 0 }; i <= (int)(x); i++)
#define RREP(i,x) for(int i{ (int)(x) - 1 }; i >= 0 ;i--)
#define RREPC(i,x) for(int i{ (int)(x)}; i >= 0; i--)
#define REP1O(i,x) for(int i{ 1 }; i < (int)(x); i++)
#define REP1C(i,x) for(int i{ 1 }; i <= (int)(x); i++)

#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(),(x).end()

using namespace std;

typedef int64_t ll;
typedef pair<int, int> pii;

const int dx[4] = { 1, 0, -1,  0 };
const int dy[4] = { 0, 1,  0, -1 };
const int INTMAX = 2147483647;
const ll LLMAX = 9223372036854775807;

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; }
void SWAP(ll& a, ll& b) { a ^= b; b ^= a; a ^= b; }
void SWAP(int& a, int& b) { a ^= b; b ^= a; a ^= b; }


class A {
	int a, b;
public:
	A()
	{
		cin >> a >> b;
	}
	void solve()
	{
		cout << (int)ceil(((double)a + b) / 2);
	}
};


int main()
{
	A solution;
	solution.solve();

	return 0;
}

Measured memory_bytes: 256
def Int():
    return int(input())
def Ints():
    return map(int,input().split())
def IntList():
    return list(Ints())
def IntMat(N):
    return [IntList() for i in range(N)]

S = input()
if '7' in S:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 61676
#pragma warning(disable:4996)
#include <bits/stdc++.h>

using namespace std;

//macro
#define FOR(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) (a).begin(),(a).end()
#define EPS (1e-8)
#define equals(a,b)(fabs((a)-(b))<EPS)

using ll = long long;
using ull = unsigned long long;
using vb = vector<bool>;
using vi = vector<int>;
using vll = vector<ll>;
using vs = vector<string>;
using vvb = vector<vb>;
using vvi = vector<vi>;
using vvll = vector<vll>;
//func
template<typename A, typename T>void assign2d(A&arr, ll H, ll W, T t) { arr.resize(H); REP(i, H) arr[i].assign(W, t); }
template<class T> ostream &operator<<(ostream &os, const vector<T> &v) { int n = v.size(); REP(i, n)os << v[i] << (i == n - 1 ? "" : " "); return os; }
template <class T = int> inline T IN() { T x; cin >> x; return x; }
template<class T> inline void OUT(const T &x) { cout << x << "\n"; }
void YESNO(bool c) { OUT(c ? "YES" : "NO"); };
void YesNo(bool c) { OUT(c ? "Yes" : "No"); };
struct pre_ { pre_() { cin.tie(nullptr); ios::sync_with_stdio(false); /*cout << fixed << setprecision(6);*/ } } pre__;

int main() {
	string S;
	cin >> S;
	REP(i, S.size()) {
		if (i % 2 == 0)cout << S[i];
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 592
import java.util.Scanner;

public class Main {
	static public void main(String[] args) {

		Scanner scan = new Scanner(System.in);
		String s = scan.next();
		scan.close();

		String[] array = s.split("");
		int oCount = 0;
		for (int i = 0; i < array.length; i++) {
			if (array[i].equals("o")) {
				oCount++;
			}
		}
		System.out.println(700 + 100 * oCount);
	}
}


Measured memory_bytes: 21972
#include<stdio.h>
#include<string.h>
#include<queue>
#include<algorithm>
#define MAX_N 1002
using namespace std;
struct node{int x,y;};
char _map[MAX_N][MAX_N];
int dp[MAX_N][MAX_N];
int ox[]={0,0,1,-1};
int oy[]={1,-1,0,0};
int S_x,S_y;
int h,w,cnt;

node make_node(int x,int y){
	node t;
	t.x=x,t.y=y;
	return t;
}
void solve(){
	queue<node> que;
	int step=0;
	
	for(int i=1;i<=cnt;i++){
		que.push(make_node(S_x,S_y));
		_map[S_x][S_y]='.';
		memset(dp,-1,sizeof(dp));
		dp[S_x][S_y]=step;
		while(!que.empty()){
			node t=que.front();que.pop();
			if(_map[t.x][t.y]=='0'+i){
				step=dp[t.x][t.y];
				S_x=t.x,S_y=t.y;
				break;
			}
			for(int j=0;j<4;j++){
				int x=t.x+ox[j];
				int y=t.y+oy[j];
				if(0<=x&&x<h&&0<=y&&y<w&&_map[x][y]!='X'&&dp[x][y]==-1){
					que.push(make_node(x,y));
					dp[x][y]=dp[t.x][t.y]+1;
				}
			}
		}
		while(!que.empty()) que.pop();
	}
	
	printf("%d\n",step);
}

int main()
{
	while(scanf("%d%d%d",&h,&w,&cnt)!=EOF){
		for(int i=0;i<h;i++)
			scanf("%s",_map[i]);
		for(int j=0;j<h;j++)
			for(int k=0;k<w;k++)
				if(_map[j][k]=='S')
					S_x=j,S_y=k,j=h,k=w;
		solve();
	}
	return 0;
}

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

using namespace std;

typedef long long int ll;
typedef vector<ll> vll;

ll ad(ll a, ll b){
    return abs(a - b);
}

int main(){
    int n,k;
    cin>>n>>k;
    vll height(n + 1);
    vll dp(n + 1, INT_MAX);
    for(int i = 1; i <= n; ++i)
        cin>>height[i];
    dp[1] = 0;
    height[0] = INT_MAX;
    for(int i = 2; i <= n; ++i){
        for(int j = i - 1; j >= max(0, i - k); --j){
            dp[i] = min(dp[j] + ad(height[i], height[j]), dp[i]);
        }
    }
    cout<<dp[n]<<endl;
    return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <stdio.h>
#include <algorithm>

using namespace std;
const int MAX = 1001;
long long dp[MAX][MAX];
const int modd = 1000000007;
int main()
{
	char a[1];
	int N, M;
	cin >> N >> M;
	for (int i = 1; i <= N;i++)
	for (int j = 1; j <= M; j++)
	{
		cin >> a[0];
		if (a[0] == '.')	
			dp[i][j]=-1;
		else
			dp[i][j] = 0;
	}
	dp[1][1] = 1;
	for (int i = 1; i <= N; i++)
	for (int j = 1; j <= M; j++)
	{
		if ((i != 1 || j != 1) && dp[i][j] != 0)
		{
			dp[i][j] = dp[i - 1][j] + dp[i][j - 1];
			dp[i][j] %= modd;
		}
	}

	cout << dp[N][M];
	return 0;
}

Measured memory_bytes: 8064
#include <stdio.h>

#define MAX 100000

int partition(int *,int,int);

int main()
{
  int i, n, kijun;
  int A[MAX];

  scanf("%d",&n);

  for(i = 0; i < n; i++) {
    scanf("%d",&A[i]);
  }
  
  kijun = partition(A, 0, n - 1);

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

int partition(int *A, int p, int r)
{
  int i, j, x, tmp;
  
  x = A[r];
  i = p - 1;
  for(j = p; j < r; j++) {
    if(A[j] <= x) {
      i++;
      tmp = A[i];
      A[i] = A[j];
      A[j] = tmp;
    }
  }
  tmp = A[i+1];
  A[i+1] = A[r];
  A[r] = tmp;

  return i+1;
}



Measured memory_bytes: 2108
#include <iostream>
#include <string>
using namespace std;
int main(void){
    long long A,B;
    cin >> A >> B;
    
    long long ans;
    long long X = A,Y = B;
    while(X != Y){
        if(X < Y){
            X += A;
        }
        else{
            Y += B;
        }
    }
    cout << X << endl;
}


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

int main(){
    int N;
    int A;
    map<int, int> counter;
    cin >> N;
    long long s=0;
    for(int i=0; i<N; i++){
        cin >> A;
        counter[A]++;
        s+=A;
    }

    int Q;
    cin >> Q;
    int B, C;
    for(int i=0; i<Q; i++){
        cin >> B >> C;
        s += (counter[B]*(C-B));
        counter[C] += counter[B];
        counter[B] = 0;
        cout << s << endl;
    }
}

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

int main(void){
  int n;
  char s[100];
  scanf("%d %s",&n,s);
  
 int len = strlen(s);
  
  if(len <= n){
    printf("%s\n",s);
  }
  else{
    for(int i = 0;i < n;i ++){
      printf("%c",s[i]);
    }
    printf("...\n");
  }

  return 0;
}

      

Measured memory_bytes: 1664
#include<iostream>
#include<iomanip>
#include<cassert>
#include<math.h>
#include<complex>
#include<algorithm>
#include<utility>
#include<queue>
#include<string.h>
#include<string>
#include<set>
#include<map>
#include<unordered_map>
#include<functional>
#include<vector>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
const ll INF=2e18;
const ll MOD=998244353;

ll N,K;
ll dp[200010];
ll dpSum[200010];
ll L[11],R[11];
int main(){
    cin>>N>>K;
    for(ll i=0;i<K;i++){
        cin>>L[i]>>R[i];
    }
    dp[1]=1;
    dpSum[1]=1;
    for(ll i=2;i<=N;i++){
        for(ll j=0;j<K;j++){
            dp[i]=((dp[i]+dpSum[max(0ll,i-L[j])])%MOD+MOD-dpSum[max(0ll,i-R[j]-1)])%MOD;
        }
        dpSum[i]=(dpSum[i-1]+dp[i])%MOD;
    }
    cout<<dp[N]<<endl;

    return 0;
}

Measured memory_bytes: 6752
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
 
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}
 
int f(int x) {
  int res = 0;
  while (x%2 == 0) {
    x /= 2;
    res++;
  }
  return res;
}
 
int main() {
  int n, m;
  cin >> n >> m;
  vector<int> a(n);
  rep(i,n) cin >> a[i];
 
  // a -> a'
  rep(i,n) {
    if (a[i]%2 == 1) {
      cout << 0 << endl;
      return 0;
    }
    a[i] /= 2;
  }
 
  // a' -> a''
  int t = f(a[0]);
  rep(i,n) {
    if (f(a[i]) != t) {
      cout << 0 << endl;
      return 0;
    }
    a[i] >>= t; // a[i] /= 2^t
  }
  m >>= t;
 
  ll l = 1;
  rep(i,n) {
    l = lcm(l, a[i]);
    if (l > m) {
      cout << 0 << endl;
      return 0;
    }
  }
 
  m /= l;
  int ans = (m+1)/2;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 640