akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		try (Scanner sc = new Scanner(System.in)) {
			int n = sc.nextInt();
			int[] s = new int[n];
			int sum = 0;
			for (int i = 0; i < n; i++) {
				s[i] = sc.nextInt();
				sum += s[i];
			}

			int left = 0;
			int right = sum;
			int min = sum;
			for (int i = 0; i < n; i++) {
				left += s[i];
				right -= s[i];
				if (Math.abs(left - right) < min) {
					min = Math.abs(left - right);
				}
			}
			System.out.println(min);
		}
	}
}


Measured memory_bytes: 21716
#include <stdio.h>

int main(void){
  int K;
  int i, j, k;
  int count = 0;

  scanf("%d", &K);

  for(i = 1; i <= K; i++){
    for(j = i+1; j <= K; j++){
      if(i%2 == 0 && j%2 == 1){
        count++;
      }else if(i%2 == 1 && j%2 == 0){
        count++;
      }
    }
  }

  printf("%d\n", count);
  
  return 0;
}


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

using namespace std;
typedef long long int ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) for (int i = 0; i < (n); i++)
#define fst first
#define snd second
#define ALL(obj) (obj).begin(), (obj).end()
#define debug(x) cout << #x << ": " << x << endl
#define out(x) cout << x << endl
//#define int long long int
const int MOD = 1000000007;
const ll LINF = (ll)1e20;
const int INF = 1e9;
const double EPS = 0.000000001;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, l;
  cin >> n >> l;
  int ans = n * l + n * (n - 1) / 2;
  if(l > 0) ans = ans - l;
  else if(l < 0){
    if(l + n - 1< 0) ans = ans - (l + n - 1);
  }
  out(ans);
  return 0;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
s = str(input())

if s == "SUN":
    print(7)
if s == "MON":
    print(6)
if s == "TUE":
    print(5)
if s == "WED":
    print(4)
if s == "THU":
    print(3)
if s == "FRI":
    print(2)
if s == "SAT":
    print(1)


Measured memory_bytes: 2940
#include<bits/stdc++.h>
#define ll long long
#define pii pair<int,int> 
#define mp make_pair
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fi first
#define se second
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
int n,m,c;
int a[31][31];
int b[31];
int main(){
    cin>>n>>m>>c;
    for(int i=0;i<m;i++)
        cin>>b[i];
    for(int i=0;i<n;i++)
        for(int j=0;j<m;j++)
            cin>>a[i][j];
    int cnt=0;
    for(int i=0;i<n;i++){
        int now=c;
        for(int j=0;j<m;j++)
            now+=a[i][j]*b[j];
        cnt+=(now>0);
    }
    cout<<cnt<<endl;
    return 0;
}

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

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));

            return;
        }

        public void Solve(ConsoleInput cin)
        {

            var S = cin.ReadLine.ToCharArray();

            var dfs = new Dfs(S);
            dfs.Proc(1);
            Console.WriteLine(dfs.Ans());

        }
    }
    public class Dfs
    {
        private readonly char[] _S;
        private int ans;
        public Dfs(char[] S)
        {
            this._S = S;
            this.ans = 0;
        }
        public int Ans()
        {
            return this.ans;
        }
        public void Proc(int i)
        {
            if (i == this._S.Length) {
                return;
            }
            if (this._S[i] == '0') {
                if (this._S[i - 1] == '0')
                {
                    this._S[i] = '1';
                    this.ans++;
                }
            }
            if (this._S[i] == '1') {
                if (this._S[i - 1] == '1')
                {
                    this._S[i] = '0';
                    this.ans++;
                }
            }
            Proc(i + 1);
        }
    }

    public static class Extensions
    {
        public static string Reverse(this string sourse)
        {
            char[] chrAry = sourse.ToCharArray();
            Array.Reverse(chrAry);
            return new string(chrAry);
        }
    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); } }
        public int ReadInt { get { return int.Parse(Read); } }
        public long ReadLong { get { return long.Parse(Read); } }
        public double ReadDouble { get { return double.Parse(Read); } }
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret; }
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }
    }
}


Measured memory_bytes: 16376
main = do
  (_:_:sC:_) <- words <$> getLine
  let c = (read sC) :: Integer
  bs <- map (read :: String-> Integer) <$> words <$> getLine
  aMat <- map (map read :: [String]-> [Integer]) <$> map words <$> lines <$> getContents
  let matMuled = map (\ aLine -> zipWith (*) aLine bs) aMat
  let aSum = map sum matMuled
  putStrLn $ show  $ length $ filter (\a -> a + c > 0) aSum


Measured memory_bytes: 1020
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <vector>

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<double, double> pdd;
typedef vector<vector<ll>> matrix;

vector<int> edges[100005];

int v[100005];
int d[100005];
int c[100005];

int ret[100005];

int dp[100005];

void color(int curr, int dist, int cc) {
  if(dp[curr] >= dist) return;
  dp[curr] = dist;
  if(ret[curr] == 0) ret[curr] = cc;
  color(curr, dist-1, cc);
  for(int out: edges[curr]) color(out, dist-1, cc);
}

void solve() {
  int n, m;
  cin >> n >> m;
  while(m--) {
    int a, b;
    cin >> a >> b;
    edges[a].push_back(b);
    edges[b].push_back(a);
  }
  for(int i = 1; i <= n; i++) dp[i] = -1;
  int q;
  cin >> q;
  for(int i = 0; i < q; i++) cin >> v[i] >> d[i] >> c[i];
  for(int i = q-1; i >= 0; i--) {
    color(v[i], d[i], c[i]);
  }
  for(int i = 1; i <= n; i++) cout << ret[i] << "\n";
}

void casesolve() {
  int t;
  cin >> t; cin.ignore();
  for(int i = 1; i <= t; i++) {
    cout << "Case #" << i << ": ";
    solve();
  }
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL); cout.tie(NULL);
  solve();
  // casesolve();
}


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

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

    string S;
    cin >> S;
    string ans = "Yes";
    for (int i = 0; i < S.length(); i++)
    {
        if (S[i] == 'U' || S[i] == 'D')
        {
        }
        else if (((i + 1) % 2 == 1 && S[i] != 'R') || ((i + 1) % 2 == 0 && S[i] != 'L'))
        {
            ans = "No";
            break;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
import fractions

def main():
    A,B,C,D = map(int, input().split())  
    lc = lcm(C, D)
    Bsum = B - (B//C) - (B//D) + (B//lc)
    A1 = A-1
    Asum = A1 - (A1//C) - (A1//D) + (A1//lc)
    print(Bsum-Asum)
    
def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)



if __name__ == '__main__':
    main()


Measured memory_bytes: 5432
n,m,x=map(int,input().split())
lis=[list(map(int,input().split())) for _ in range(n)]
ans=10**18
for i in range(2**n):
    l=[]
    rikai=[0]*m
    ok=True
    for j in range(n):
        if (i>>j)&1:
            l.append(j)
    cost=0
    for k in l:
        cost+=lis[k][0]
        for s in range(1,m+1):
            rikai[s-1]+=lis[k][s]
    for j in range(m):
        if rikai[j]<x:
            ok=False
    #print(l)
    if ok:
        ans=min(ans,cost)
if ans==10**18:
    ans=-1
print(ans)

Measured memory_bytes: 9236
#include<bits/stdc++.h>
using namespace std;
int n,m;
char ch[188][188];
int sum[188][188];
int dp[2][188][188][188];
bool eq(int x1,int y1,int x2,int y2)
{
    int siz=(x2-x1+1)*(y2-y1+1);
    int c1=sum[x2][y2]-sum[x2][y1-1]-sum[x1-1][y2]+sum[x1-1][y1-1];
    return c1==siz||c1==0;
}
void init()
{
    for(int i=1;i<=n;++i)
        for(int j=1;j<=m;++j)
            sum[i][j]+=sum[i][j-1];
    for(int i=1;i<=n;++i)
        for(int j=1;j<=m;++j)
            sum[i][j]+=sum[i-1][j];
    for(int i=1;i<=n;++i)
        for(int j=i;j<=n;++j)
            for(int l=1,r;l<=m;l=r)
            {
                r=l;
                while(eq(i,l,j,r)&&r<=m)r++;
                for(int p=l;p<r;++p)dp[0][i][j][p]=r-1;
                if(l==r)dp[0][i][j][l]=l-1,r++;
            }
}
int find(int c,int u,int d,int L)
{
    int l=u,r=d-1,mid;
    int res=0;
    int v1,v2;
    while(l<=r)
    {
        mid=(l+r)/2;
        v1=dp[c][u][mid][L];
        v2=dp[c][mid+1][d][L];
        res=max(res,min(v1,v2));
        if(v1<v2)r=mid-1;
        else l=mid+1;
    }
    return res;
}
void DP(int c)
{
    int nv,lv;
    for(int i=1;i<=n;++i)
        for(int j=i;j<=n;++j)
            for(int l=1;l<=m;++l)
            {
                lv=dp[c^1][i][j][l];
                if(lv!=m)
                {
                    nv=dp[c^1][i][j][lv+1];
                    nv=max(nv,find(c^1,i,j,l));
                }
                else nv=m;
                dp[c][i][j][l]=nv;
            }
}
int main()
{
    scanf("%d%d",&n,&m);
    for(int i=1;i<=n;++i)
    {
        scanf("%s",ch[i]+1);
        for(int j=1;j<=m;++j)
            if(ch[i][j]=='#')sum[i][j]=1;
    }
    init();
    int ans=0;
    for(int i=1;dp[(i&1)^1][1][n][1]<m;++i) DP(i&1),ans=i;
    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 51456
#include <stdio.h>
int main(){
    double r, p = 3.14159265358979323846264338327950288419716939937510, area, para;
    scanf("%lf", &r);
    area = p * r * r;
    para = (r + r) * p;
    printf("%.6lf %.6lf\n", area, para);
    return 0;
}


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

using namespace std;

int a[5];

int main(){

	ios::sync_with_stdio(0);
	cin.tie(0);

	for(int i=0;i<3;++i) 
		cin >> a[i];
	sort(a,a+3);
	for(int i=0;i<3;++i){
		cout << a[i];
		if(i<2) cout << ' ';
		else cout << '\n';	
	}

	return 0;
} // br1



Measured memory_bytes: 3120
#include <iostream>
#include <stdio.h>
#include <algorithm>
using namespace std;

int main(void)
{
	int n, in, i;
	int ma = -1000000;
	int mi = 1000000;
	long long int sum = 0;

	cin >> n;

	for (i=0; i<n; i++) {
		cin >> in;
		ma = max(ma , in);
		mi = min(mi , in);
		sum += (long long int)in;
	}

	printf("%d %d %lld\n", mi, ma, sum);


	return 0;
}



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

int main(){
    int n, q, a, b, c;
    cin >> n >> q;

    vector<priority_queue<int>> pq(n);

    for(int i = 0; i < q; i++){
        cin >> a;

        if(a == 0){
            cin >> b >> c;
            pq[b].push(c);
        }else if(a == 1){
            cin >> b;
            if(!pq[b].empty())  cout << pq[b].top() << endl;
        }else if(a == 2){
            cin >> b;
            if(!pq[b].empty())  pq[b].pop();
        }
    }

    return 0;
}


Measured memory_bytes: 4140
#include <iostream>
#include <cstring>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <time.h>
#include <string>
#include <map>
#include <stack>
#include <vector>
#include <set>
#include <queue>
using namespace std;
typedef long long ll;
const int inf=0x3f3f3f3f;
const int N=1e5+100;
const int M=1e6+5;
int n,m,k;
ll a[N],b[N];
int main() {
    scanf("%d",&n);
    for(int i=1;i<=n;i++){
        scanf("%lld%lld",&a[i],&b[i]);
    }
    ll ans=0;
    for(int i=n;i>=1;i--){
        a[i]+=ans;
        ll k=a[i]/b[i];
        if(a[i]%b[i]!=0)k++;
        ll s=b[i]*k-a[i];
        ans+=s;
    }
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 1792
#include <stdio.h>
int main(){
	int a,b,c,d,e;
	int f;
	scanf("%d",&a);
	scanf("%d",&b);
	scanf("%d",&c);
	scanf("%d",&d);
	scanf("%d",&e);
	if(a<=40){
		a=40;
	}
	if(b<=40){
		b=40;
	}
	if(c<=40){
		c=40;
	}
	if(d<=40){
		d=40;
	}
	if(e<=40){
		e=40;
	}
	f=(a+b+c+d+e)/5;
	printf("%d\n",f);
	return 0;
}


Measured memory_bytes: 2088
while True:
    n = int(input())
    if n == 0:
        break
    gem_points = [list(map(int, input().split())) for i in range(n)]
    m = int(input())
    operations = [input().split() for i in range(m)]
    robot_pos = [10, 10]
    for operation in operations:
        move_dir = operation[0]
        move_amount = int(operation[1])

        for move in range(move_amount):
            if move_dir == 'N':
                robot_pos[1] += 1
            elif move_dir == 'E':
                robot_pos[0] += 1
            elif move_dir == 'S':
                robot_pos[1] -= 1
            elif move_dir == 'W':
                robot_pos[0] -= 1

            if robot_pos in gem_points:
                gem_points.pop(gem_points.index(robot_pos))

    if gem_points:
        print('No')
    else:
        print('Yes')



Measured memory_bytes: 5616
'''
Created on 2020/09/15

@author: harurun
'''
import sys
pin=sys.stdin.readline


N,W=map(int,pin().split())
dp=[[0]*(W+1) for _ in [0]*(N+1)]

for i in range(1,N+1):
  w,v=pin().split()
  w=int(w)
  v=int(v)
  for j in range(W+1):
    if j-w>=0:
      dp[i][j]=max(dp[i-1][j],dp[i-1][j-w]+v)
    else:
      dp[i][j]=dp[i-1][j]
print(dp[N][W])
#解説AC

Measured memory_bytes: 148792
import sys
input = sys.stdin.readline

#n = int(input())
#l = list(map(int, input().split()))

'''
a=[]
b=[]
for i in range():
    A, B = map(int, input().split())
    a.append(A)   
    b.append(B)'''
n=int(input())
a=list(map(int, input().split()))
ans=0
anss=[0]*(n+1)
for i in range(1,n+1):
    anss[-i-1]=anss[-i]+a[-i]
    if anss[-i-1]>10**9+7:
        anss[-i-1]%=10**9+7
#print(anss)
for i in range(n-1):
    ans+=a[i]*anss[i+1]
    if ans>10**9+7:
        ans%=10**9+7
print(ans)

Measured memory_bytes: 31128
#include <iostream>
using namespace std;
int a, b, c, x, y, s, mn;
int main() {
	cin>>a>>b>>c>>x>>y;
	mn = s = a*x + b*y;
	for(int i=1; i<=max(x, y); i++) {
		if(i<=min(x, y)) s -= a + b;
		else if(x>y) s -= a;
		else s -= b;
		s += c*2;
		mn = min(mn, s);
	}
	cout<<mn;
	return 0;
}

Measured memory_bytes: 256
import heapq

H,W = map(int,input().split())
C = [[int(x) for x in input().split()] for _ in range(10)]
num = [0] * 10
for _ in range(H):
    for x in input().split():
        if int(x) != -1:
            num[int(x)] += 1

que = []
flag = [True]*10
flag[1] = False
cost = [10**10]*10
cost[1] = 0

for i in range(10):
    if flag[i]:
        heapq.heappush(que,[C[i][1],i])

while que:
    a,b = heapq.heappop(que)
    if flag[b]:
        flag[b] = False
        cost[b] = a
        for i in range(10):
            if flag[i]:
                heapq.heappush(que,[C[i][b]+a,i])

ans = 0
for i in range(10):
    ans += num[i]*cost[i]
print(ans)


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

int main() {
  int a, b;
  cin >> a >> b;
  if (a > b) {
    int t = a;
    a = b; b = t;
  }
  if (a == 1) {
    if (b == 2) {
      cout << 3;
    } else  cout << 2;
    return 0;
  } cout << 1;
  return 0;
}


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

int n;
long long a[100005],b[100005],c[100005];
int main(){
  std::cin>>n;
  for(int i=0;i<n;++i)
    std::cin>>a[i];
  for(int i=0;i<n;++i)
    std::cin>>b[i];
  for(int i=0;i<n;++i)
    std::cin>>c[i];
  std::sort(a,a+n);
  std::sort(b,b+n);
  std::sort(c,c+n);

  long long ans=0;
  for(int i=0;i<n;++i)
    ans+=(std::lower_bound(a,a+n,b[i])-a)*(c+n-std::upper_bound(c,c+n,b[i]));
  
  std::cout<<ans<<std::endl;
  return 0;
}

Measured memory_bytes: 2560
#include <algorithm>
#include <cassert>
#include <climits>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int a[3] = {};
  int b[3] = {};
  for (int i = 0; i < 3; ++i) {
    cin >> a[i] >> b[i];
  }
  bool can = false;

  int order[6][3] = {{0, 1, 2}, {0, 2, 1}, {1, 0, 2},
                     {1, 2, 0}, {2, 0, 1}, {2, 1, 0}};

  for (int o = 0; o < 6; ++o) {
    for (int i = 0; i < 2; ++i) {
      for (int j = 0; j < 2; ++j) {
        for (int k = 0; k < 2; ++k) {
          int x[6];
          if (i == 0) {
            x[0] = a[order[o][0]];
            x[1] = b[order[o][0]];
          } else {
            x[0] = b[order[o][0]];
            x[1] = a[order[o][0]];
          }

          if (j == 0) {
            x[2] = a[order[o][1]];
            x[3] = b[order[o][1]];
          } else {
            x[2] = b[order[o][1]];
            x[3] = a[order[o][1]];
          }

          if (k == 0) {
            x[4] = a[order[o][2]];
            x[5] = b[order[o][2]];
          } else {
            x[4] = b[order[o][2]];
            x[5] = a[order[o][2]];
          }

          int y[5];
          for (int z = 0; z < 6; ++z) {
            y[x[z]] = 1;
          }
          bool ok = true;
          for (int v = 1; v < 5; ++v) {
            if (y[v] == 0) {
              ok = false;
            }
          }

          if (x[1] == x[2] && x[3] == x[4] && ok) {
            can = true;
            goto BREAK;
          }
        }
      }
    }
  }

BREAK:
  if (can) {
    cout << "YES"
         << "\n";
  } else {
    cout << "NO"
         << "\n";
  }
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define REP(i, n) for(int i = 1; i < n; i++)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(), v.rend()
using P = pair<int,int>;
using vi = vector<int>;
using vii = vector<vi>;
using ll = long long;
const int dx4[4] = {1,0,-1,0};
const int dy4[4] = {0,1,0,-1};
const int dx8[8] = {-1,0,1,1,1,0,-1,-1};
const int dy8[8] = {1,1,1,0,-1,-1,-1,0};
const int mod = 1e9+7;

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

  int n, m;
  cin >> n >> m;
  vector<P> p(m);
  rep(i,m){
    int s, c;
    cin >> s >> c;
    p[i] = make_pair(s, c);
  }
  rep(i,1000){
    int x = i/10;
    vector<int> l(1, i%10);
    while(x != 0){
      l.push_back(x%10);
      x /= 10;
    }
    bool ok = true;
    if(l.size() != n) ok = false;
    reverse(all(l));
    rep(j,m){
      if(l[p[j].first-1] != p[j].second) ok = false;
    }
    if(ok){
      cout << i << endl;
      return 0;
    }
  }
  cout << -1 << endl;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void)
{
  int a, b, c;

  scanf("%d %d %d", &a, &b, &c);

  if(a < b && b < c)
  {
    printf("Yes\n");
  }

  else
  {
    printf("No\n");
  }

  return 0;
}


Measured memory_bytes: 2104
#include<iostream>
using namespace std;
#define MAX 100005
#define NIL -1

struct Node { int p,l,r; };

Node T[MAX];
int n,D[MAX];

void print(int u){

  int i,c;

  cout << "node " << u << ": ";
  cout << "parent = " << T[u].p << ", ";
  cout << "depth = " << D[u] << ", ";

  if(T[u].p == NIL ) cout << "root, ";
  else if( T[u].l == NIL) cout << "leaf, ";
  else cout << "internal node, ";

  cout << "[";
  
  for( i = 0, c = T[u].l; c != NIL; i++, c = T[c].r){
    if (i) cout << ", ";
    cout << c;
  }
  cout << "]" << endl;
}

int rec(int u,int p){
  D[u] = p;
  if ( T[u].r != NIL) rec(T[u].r,p);
  if ( T[u].l != NIL) rec(T[u].l, p+1);
}

int main(){
  int i,j,d,v,c,l,r;
  cin >> n;
  for (i = 0; i < n; i++)T[i].p = T[i].l = T[i].r = NIL;

  for(i = 0; i < n; i++){
    cin >> v >> d;
    for( j = 0; j < d; j++){
      cin >> c;
      if( j == 0) T[v].l = c;
      else T[l].r = c;
      l = c;
      T[c].p = v;
    }
  }
  for (i = 0; i < n; i++){
    if(T[i].p == NIL) r = i;
  }

  rec(r,0);
  
  for(i = 0; i < n; i++)print(i);

  return 0;

}

Measured memory_bytes: 5844
#include <bits/stdc++.h>
using namespace std;
int main() {
	int N, W; cin >> N >> W;
	long long int w[105], v[105];
	for(int i=0;i<N;i++){
		cin >> w[i] >> v[i];
	}
	long long int dp[102][100002];
	for(int i=0;i<N;i++){
		for(int j=1;j<=W;j++){
			if(j<w[i]){
				dp[i+1][j] = dp[i][j];
			}else{
				dp[i+1][j] = max(dp[i][j], dp[i][j-w[i]]+v[i]);
			}
		}
	}
	cout << dp[N][W] << endl;
	return 0;
}

Measured memory_bytes: 79104
N, M, Q = map(int, input().split())
abcd = [tuple(map(int, input().split())) for _ in range(Q)]
ans = 0
def calc(p):
    ret = 0
    for a, b, c, d in abcd:
        a, b = a-1, b-1
        if p[b] - p[a] == c:
            ret += d
    return ret

def dfs(a, d):
    global ans
    if d == N:
        ans = max(ans, calc(a))
        return
    for i in range(a[-1], M+1):
        dfs(a+[i], d+1)

for i in range(1, M+1):
    dfs([i], 1)

print(ans)


Measured memory_bytes: 75668
/*
　　　  ∧＿∧　やあ
　　 （´・ω・｀)　　　　　/　　　　　ようこそ、バーボンハウスへ。
　　 ／∇y:::::＼　　　 [￣]　　　　　このテキーラはサービスだから、まず飲んで落ち着いて欲しい。
　　 |:⊃:|:::::|　　　|──|
￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣|　うん、「また」なんだ。済まない。
￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣|￣　  仏の顔もって言うしね、謝って許してもらおうとも思っていない。
￣￣￣￣￣￣￣￣￣￣￣￣￣￣／|
　　　　∇　∇　∇　∇　　　／.／|　　　でも、この提出を見たとき、君は、きっと言葉では言い表せない
　　　　┴　┴　┴　┴　／ ／　  |　　　「ときめき」みたいなものを感じてくれたと思う。
￣￣￣￣￣￣￣￣￣￣|／　　  |　　　殺伐としたコンテストの中で、そういう気持ちを忘れないで欲しい
￣￣￣￣￣￣￣￣￣￣　　　　 |　　　そう思って、この提出を投げたんだ。
　　　(⊆⊇)　(⊆⊇)　(⊆⊇)　　|
　    ||　　 ||　　||　　|　　　 じゃあ、判定を聞こうか。
　　.／|＼　／|＼ ／|＼
*/

#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <array>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;
#define fst first
#define snd second
#define mp make_pair
#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 = (b-1);i>=a;i--)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n) 
#define SIZE(x) ((int)(x).size())
#define debug(x) cerr << #x << " -> " << x << " (line:" << __LINE__ << ")" << '\n';
#define debugpair(x, y) cerr << "(" << #x << ", " << #y << ") -> (" << x << ", " << y << ") (line:" << __LINE__ << ")" << '\n';
typedef long long lint;
typedef pair<int, int> pint;
typedef pair<lint, lint> plint;
typedef vector<lint> vec;
typedef vector<vector<lint>> matrix;
typedef priority_queue<lint> p_que;
typedef priority_queue<lint, vector<lint>, greater<lint>> p_que_rev;
const lint INF = INT_MAX;
const lint LINF = LLONG_MAX;
const lint MOD = 1000000000 + 7;
const double EPS = 1e-9;
const double PI = acos(-1);
const int di[]{0, -1, 0, 1, -1, -1, 1, 1};
const int dj[]{1, 0, -1, 0, 1, -1, -1, 1};

lint gcd(lint a, lint b) {
    lint r;
    while (b != 0) {
        r = a % b;
        a = b; 
        b = r;
    }
    return a;
}

lint lcm(lint a, lint b) {
    return (a / gcd(a, b)) * b;
}

lint power(lint x, lint n, lint mod = MOD) {
    lint ret = 1;
    while(n > 0) {
        if(n & 1){
            (ret *= x) %= mod;
        }
        (x *= x) %= mod;
        n >>= 1;
    }
    return ret;
}

vector<lint> make_power(int n, lint base){
    lint num = 1;
    vector<lint> ret;
    for (int i=0; i<=n; ++i){
        ret.push_back(num);
        num *= base;
    }
    return ret;
}

int main()
{
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    string s;
    cin >> s;
    int l = s.length() - 2;
    cout << s[0] << l << s[s.length() - 1] << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include<string.h>
int main()
{
char str[1005];
gets(str);
char str1[] ="es";
char str2[] ="s";

int len = strlen(str);

if(str[len-1] == 's')
{
    strcat(str,str1);
    puts(str);
}
else
{
    strcat(str,str2);
    puts(str);

}

    return 0;
}


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

using ll = long long;

const int INF = 1001001001;
const ll INF_LL = 1001001001001001001LL;

int main(void){
  vector<vector<int>> a(3,vector<int>(3));
  rep(i,3){
    rep(j,3) cin >> a[i][j];
  }
  int n; cin >> n;
  vector<int> b(n);
  rep(i,n) cin >> b[i];

  vector<vector<bool>> flag(3,vector<bool>(3,false));
  rep(k,n){
    rep(i,3){
      rep(j,3) if(b[k]==a[i][j]) flag[i][j] = true;
    }
  }
  bool ans = false;
  rep(i,3){
    if(flag[i][0] && flag[i][1] && flag[i][2]) ans = true;
    if(flag[0][i] && flag[1][i] && flag[2][i]) ans = true;    
  }
  if(flag[0][0] && flag[1][1] && flag[2][2]) ans = true;
  if(flag[0][2] && flag[1][1] && flag[2][0]) ans = true;

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


Measured memory_bytes: 256
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
use std::io::{Write, BufWriter};
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};
    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, [graph1; $len:expr]) => {{
        let mut g = vec![vec![]; $len];
        let ab = read_value!($next, [(usize1, usize1)]);
        for (a, b) in ab {
            g[a].push(b);
            g[b].push(a);
        }
        g
    }};
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };
    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };
    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };
    ($next:expr, usize1) => (read_value!($next, usize) - 1);
    ($next:expr, [ $t:tt ]) => {{
        let len = read_value!($next, usize);
        read_value!($next, [$t; len])
    }};
    ($next:expr, $t:ty) => ($next().parse::<$t>().expect("Parse error"));
}

#[allow(unused)]
macro_rules! debug {
    ($($format:tt)*) => (write!(std::io::stderr(), $($format)*).unwrap());
}
#[allow(unused)]
macro_rules! debugln {
    ($($format:tt)*) => (writeln!(std::io::stderr(), $($format)*).unwrap());
}

fn solve() {
    let out = std::io::stdout();
    let mut out = BufWriter::new(out.lock());
    macro_rules! puts {
        ($($format:tt)*) => (let _ = write!(out,$($format)*););
    }
    input! {
        n: usize,
        a: [i64; n],
    }
    let mut kabu = 1000 / a[0];
    let mut rem = 1000 % a[0];
    let mut cash = 1000;
    for i in 1..n {
        if a[i - 1] <= a[i] {
            cash = max(cash, kabu * a[i] + rem);
        } else {
            kabu = cash / a[i];
            rem = cash % a[i];
        }
    }
    puts!("{}\n", cash);
}

fn main() {
    // In order to avoid potential stack overflow, spawn a new thread.
    let stack_size = 104_857_600; // 100 MB
    let thd = std::thread::Builder::new().stack_size(stack_size);
    thd.spawn(|| solve()).unwrap().join().unwrap();
}


Measured memory_bytes: 2280
# -*- coding: utf-8 -*-
"""
Created on Fri Jul 26 04:05:59 2019

@author: matsui
"""
N,L=map(int,input().split())

abc=[chr(i) for i in range(97,123)]
s=list()
for i in range(N):
    s.append(input())
    
s.sort()
ans=''
for i in range(N):
    ans+=s[i]
        
        
print(ans)
    

Measured memory_bytes: 3060
N,M,Q = list(map(int,input().split()))
LR = [list(map(int,input().split())) for _ in range(M)]
pq = [list(map(int,input().split())) for _ in range(Q)]

data = [[0]*N for _ in range(N)]
for l,r in LR:
    l -=1
    r -=1
    data[l][r] += 1

for l in range(N-2,-1,-1):
    for r in range(l+1,N,1):
        data[l][r] += data[l+1][r]
for l in range(N-2,-1,-1):
    for r in range(l+1,N,1):
        data[l][r] += data[l][r-1]

for p,q in pq:
    p -= 1
    q -= 1
    print(data[p][q])

Measured memory_bytes: 74928
#include <iostream>

using namespace std;
int n,x,sum,i;
int main()
{
    cin>>n;
    for(i=1;i<=n;i++)
    {
        cin>>x;
        x&=1;
        sum^=x;
    }
    if(sum) cout<<"NO";
    else cout<<"YES";
    return 0;
}


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

typedef long long ll;
typedef unsigned long long ull;
typedef double dd;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;

const int mx=1e6+11;
const double PI = acos(-1);
#define MOD 1000000007

#define nl '\n'
#define pb push_back
#define F first
#define S second
#define I insert
#define mp make_pair

#define sz(x) x.size()
#define tt int t; cin>>t; while(t--)
#define be(a) (a).begin(),(a).end()
#define rbe(a) (a).rbegin(),(a).rend()
#define mem(a,b) memset(a,b,sizeof(a))
#define yes cout<<"YES"<<nl
#define no cout<<"NO"<<nl

#define su ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define file freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define frac cout.unsetf(ios::floatfield); cout.precision(10); cout.setf(ios::fixed,ios::floatfield);

template < typename F, typename S >
ostream& operator << ( ostream& os, const pair< F, S > & p )
{
    return os << "(" << p.first << ", " << p.second << ")";
}

template < typename T >
ostream &operator << ( ostream & os, const vector< T > &v )
{
    os << "{";
    for(auto it = v.begin(); it != v.end(); ++it)
    {
        if( it != v.begin() )
            os << ", ";
        os << *it;
    }
    return os << "}";
}

template < typename T >
ostream &operator << ( ostream & os, const set< T > &v )
{
    os << "[";
    for(auto it = v.begin(); it != v.end(); ++it)
    {
        if( it != v.begin() )
            os << ", ";
        os << *it;
    }
    return os << "]";
}

template < typename T >
ostream &operator << ( ostream & os, const multiset< T > &v )
{
    os << "[";
    for(auto it = v.begin(); it != v.end(); ++it)
    {
        if( it != v.begin() )
            os << ", ";
        os << *it;
    }
    return os << "]";
}

template < typename F, typename S >
ostream &operator << ( ostream & os, const map< F, S > &v )
{
    os << "[";
    for(auto it = v.begin(); it != v.end(); ++it)
    {
        if( it != v.begin() )
            os << ", ";
        os << it -> first << " = " << it -> second ;
    }
    return os << "]";
}

#define dbg(args...) do {cerr << #args << " : "; faltu(args); } while(0)

void faltu ()
{
    cerr << endl;
}

template <typename T>
void faltu( T a[], int n )
{
    for(int i = 0; i < n; ++i)
        cerr << a[i] << ' ';
    cerr << endl;
}

template <typename T, typename ... hello>
void faltu( T arg, const hello &... rest)
{
    cerr << arg << ' ';
    faltu(rest...);
}


int gcd(int a,int b)
{
    return b ? gcd(b,a%b) : a;
}
int lcm(int a,int b)
{
    return (a*( b/ gcd(a,b)));
}

void f()
{
    int n,k,cnt=0,a;
    cin>>n>>k;
    
    for(int i=0; i<n; i++)
    {
        cin>>a;
    }
    
    if(n==k)
    {
        cout<<1<<nl;
        return;
    }


    int i=1;
    while(i<=n)
    {
        if(i+k-1>n )
            break;
        cnt++;
        i+=k-1;
    }

    if(i<n)
        cnt++;

    cout<<cnt<<nl;
}

int main()
{
    su;
    f();
    return 0;
}



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

using namespace std;

struct UnionFind {
    /* data
     *   子なら親の ID
     *   根なら -1 * size */
    vector<int> d;

    /* constructer
     *   最初は全員根として扱う -> 全員 size 1 */
    UnionFind (int n = 0): d(n, -1) {}

    /* 木構造の根の頂点番号を返す
     *   最後の return 部分を `return find(d[x])` とするとメモ化なし
     *   `d[x] =` を加えることで、二回目以降は根までたどる必要がなくなる */
    int find (int x) {
        if ( d[x] < 0 )
            return x;
        return d[x] = find(d[x]);
    }

    /* 木構造同士をくっつける (== 根同士をくっつける)
     *   小さい方を大きい方の根の子要素とする
     *   根が同じなら何もせずに false を返す */
    bool unite (int x, int y) {
        /* 両方の根を見つける */
        x = find(x);
        y = find(y);
        if ( x == y )
            return false;
        /* size が x > y にする (d は -1 * size) */
        if ( d[x] > d[y] )
            swap(x, y);
        /* x の子要素に y が増える */
        d[x] += d[y];
        /* y の根は x となる */
        d[y] = x;
        return true;
    }

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

    int size (int x) {
        return -1 * d[find(x)];
    }
};

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

    UnionFind uf(N);
    vector<int> friends(N, 0);
    vector<vector<int>> blocks(N);
    int a, b;

    /* 友達 */
    for ( int i=0; i<M; i++ ) {
        cin >> a >> b;
        a--; b--;
        friends.at(a)++;
        friends.at(b)++;
        uf.unite(a, b);
    }
    /* ブロック */
    for ( int i=0; i<K; i++ ) {
        cin >> a >> b;
        a--; b--;
        blocks.at(a).push_back(b);
        blocks.at(b).push_back(a);
    }

    int ans;
    for ( int i=0; i<N; i++ ) {
        /* 自分を除いた数 */
        ans = uf.size(i) - 1;
        /* 直接の友人を除く */
        ans -= friends.at(i);
        /* ブロック関係を除く */
        for ( auto itr : blocks.at(i) ) {
            if ( uf.is_same(i, itr) )
                ans--;
        }
        cout << ans;
        if ( i != N - 1 )
            cout << " ";
    }
    cout << endl;

    return 0;
}


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

#define REP(i,n) for(ll i=0;i<ll(n);++i)
#define RREP(i,n) for(ll i=ll(n)-1;i>=0;--i)
#define FOR(i,m,n) for(ll i=m;i<ll(n);++i)
#define RFOR(i,m,n) for(ll i=ll(n)-1;i>=ll(m);--i)
#define ALL(v) (v).begin(),(v).end()
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());
#define INF 1000000001ll
#define MOD 1000000007ll
#define EPS 1e-9

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


using namespace std;

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vvl = vector<vl>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

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


int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n, m;
	cin >> n >> m;
	vvi v(n);
	REP(i, m) {
		int k; cin >> k;
		REP(j, k) {
			int a; cin >> a;
			a--;
			v[a].push_back(i);
		}
	}
	vi p(m);
	REP(j, m)cin >> p[j];
	int ans = 0;
	REP(i, 1 << n) {
		vi cnt(m, 0);
		REP(j, n) {
			if (i & (1 << j)) {
				REP(k, v[j].size()) {
					cnt[v[j][k]]++;
				}
			}
		}
		bool ok = true;
		REP(j, m)if (cnt[j] % 2 !=p[j])ok = false;
		if (ok)ans++;
	}
	cout << ans << endl;
}

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

using namespace std;

#define lli long long int
#define REP(i,n) for(int i=0;i<n;i++)
#define VIN(i,n,v) REP(i,n){ \
	lli TMP; \
	cin>>TMP; \
	v.push_back(TMP);\
}

#define DEBUG 0

lli chmin(lli a,lli b){
	if(a>=b)return b;
	else return a;
}

lli *memo;

lli f(lli n){
	if(n==0)return 0;
	else if(memo[n]!=0) return memo[n];


	//1の倍数で削った場合
	lli fMin = 1000000000;
	fMin = chmin(f(n-1)+1,fMin);

	//6の倍数で削った場合
	lli x=6;
	while(x <= n){
		fMin = chmin(f(n-x)+1,fMin);
		x*=6;
	}

	//9の倍数で削った場合
	x=9;
	while(x <= n){
		fMin = chmin(f(n-x)+1,fMin);
		x*=9;
	}
	memo[n] = fMin;
	if(DEBUG)cout<<"n="<<n<<" memo[n]="<<memo[n]<<endl;
	return memo[n];
}


int main(){

	memo = new lli[100010];
	REP(i,100010)memo[i]=0;

	lli n;
	cin>>n;
	cout<<f(n)<<endl;

	return 0;
}

Measured memory_bytes: 4096
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<map>
#include<cmath>
using namespace std;
#define REP(i, limit) for(int i=0; i< limit; ++i)
#define FOR(i, j, limit) for(int i=j; i< limit; ++i)
#define DUMP(a) REP(d,a.size()){cout<<a[d];if(d!=a.size()-1)cout<<" ";else cout<<endl;}
#define LL long long
int INF = 2147483647;
LL LINF = 9223372036854775807;
LL MOD = 1000000007;
typedef pair<int, int>P;
typedef pair<LL, LL>PL;
typedef vector<int> vi;
typedef vector<LL> vl;


int main(){
  string S;
  cin>>S;
  int n = S.size();
  if(n==1)
  {
    cout<<0<<endl;
    return 0;
  }

  int changed=0;
  REP(i, n-1){
    if(S[i] != S[i+1]) ++changed;
  }
  cout<<changed<<endl;

  return 0;
}


Measured memory_bytes: 512
/******Old_school_@20******/
#include<bits/stdc++.h>
using namespace std;
#define lld               long long int
#define ld                long double
#define pb                push_back
#define ppb               pop_back 
#define mp                make_pair
#define F                 first
#define S                 second
#define nl                '\n'
#define all(c)            (c).begin(),(c).end()
#define rall(c)           (c).rbegin(),(c).rend()
#define sz(c)             (c).size()
#define tr(x,a)           for(auto &a : x)
#define psnt(x,a)         (x).find(a)!=(x).end()
#define vpsnt(x,a)        find(all(x),a)!=(x).end()
#define lexichar(x,y)     lexicographical_compare(x,x+strlen(x),y,y+strlen(y)) //modify the ranges
#define lexistr(x,y)      lexicographical_compare(x.begin(),x.end(),y.begin(),y.end()) 
#define MOD               1000000007
#define pi                3.1415926536
#define tod               1
#define itr(i,a,b)        for(lld i=a;i<=b;i++)
#define itrn(i,a,b)       for(lld i=a;i>=b;i--)
#define iot(n)            for(lld i=0;i<n;i++)
#define pls(n,arr)        lld arr[n]; iot(n)  cin>>arr[i];
#define bye               fflush(stdout)

typedef pair<lld,lld>     pii;
typedef pair<string,lld>  psi;
template <typename T>
bool mycomp(T x,T y){ 
   return (x==y);  //give your condition here
}
bool paircomp(const pair<lld,lld> &x,const pair<lld,lld> &y){ 
return x.second<y.second;
}

int main(){
       ios_base::sync_with_stdio(false);
             cin.tie(0);
            cout.tie(0);
       lld n; cin>>n;
       pls(n,a);sort(a,a+n);
       lld ans=0;
       for(lld i=0;i<n;i++){
           for(lld j=i+1;j<n;j++){
               for(lld k=j+1;k<n;k++){if(a[i]==a[j]||a[i]==a[k]||a[j]==a[k])  continue;
                   if(a[i]+a[j]>a[k])  ans++;
               }
           }
       }
       cout<<ans<<endl;
}


Measured memory_bytes: 3660
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
using ll = long long;
int main() {
  int n;
  cin >> n;
  vector<ll> a(n);
  for(int i = 0; i < n; i++) {
    cin >> a[i];
  }
  sort(a.begin(), a.end());
  ll sum = a[0];
  ll b = 0;
  for(int i = 1; i < n; i++) {
    if(sum * 2 < a[i]) {
      b = i;
    }
    sum += a[i];
  }
  cout << n - b << endl;
  return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector> 
#include <cstring>
#include <queue>
#include <ctime>
#include <set>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,int> pli;
const ll INF = 10e16;
const int maxN = 100010;
const int maxD = 400;
const int maxH = 100; 
const int MOD = 1000000007;

char a[maxN];
char b[maxN];
ll ps[maxN];
ll ss[maxN];
ll sum[maxN];
int main()
{
	scanf("%s",a+1);
	int n = strlen(a+1);
	int j = 1;
	for(int i=1;i<=n;i+=2)
	{
		b[j] = a[i];
		j++;
	}
	puts(b+1);
	return 0;
}  

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define pb emplace_back
#define mp make_pair
typedef long long ll;
typedef pair<int,int> pint;

#define eps (1e-10)
struct Point{
    double x,y;
    Point(){}
    Point(double x,double y):x(x),y(y){}
    Point operator+(Point p) {return Point(x+p.x,y+p.y);}
    Point operator-(Point p) {return Point(x-p.x,y-p.y);}
    Point operator*(double k){return Point(x*k,y*k);}
    double norm(){return x*x+y*y;}
    double abs(){return sqrt(norm());}
    bool operator == (const Point &p) const{
    return fabs(x-p.x)<eps && fabs(y-p.y)<eps;
  }
  double dot(Point p){return x*p.x+y*p.y;}
  double det(Point p){return x*p.y-y*p.x;}
};
bool cmp_x(const Point& p,const Point& q){
  if(p.x!=q.x) return p.x<q.x;
  return p.y<q.y;
}
bool cmp_y(const Point& p,const Point& q){
  if(p.y!=q.y) return p.y<q.y;
  return p.x<q.x;
}
vector<Point> convex_hull(Point* ps,int n){
    sort(ps,ps+n,cmp_y);
    int k=0;
    vector<Point> qs(n*2);
    rep(i,n){
        while(k>1&&(qs[k-1]-qs[k-2]).det(ps[i]-qs[k-1])<0) --k;//<=:exclusion online
        qs[k++]=ps[i];
    }
    for(int i=n-2,t=k;i>=0;--i){
        while(k>t&&(qs[k-1]-qs[k-2]).det(ps[i]-qs[k-1])<0) --k;// <=
        qs[k++]=ps[i];
    }
    qs.resize(k-1);
    return qs;
}
double distance(Point p,Point q){
    return (p-q).abs();
}

Point p[100001];
int main(){
    int n,xi,yi;
    cin>>n;
    rep(i,n){
        cin>>xi>>yi;
        p[i]=Point(xi,yi);
    }
    vector<Point> ans=convex_hull(p,n);
    cout<<ans.size()<<endl;
    rep(i,ans.size()){
        cout<<ans[i].x<<" "<<ans[i].y<<endl;
    }
    return 0;
}


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

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

}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define INCANT cin.tie(0), ios::sync_with_stdio(false), cout << fixed << setprecision(20);
#define int long long
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define _overload(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(...) _overload(__VA_ARGS__, repi, _rep)(__VA_ARGS__)
#define _rev(i, n) revi(i, n, 0)
#define revi(i, a, b) for(int i = (int)(a - 1); i >= (int)(b); i--)
#define rev(...) _overload(__VA_ARGS__, revi, _rev)(__VA_ARGS__)
#define each(i, n) for(auto&& i: n)
void in(){}
template<typename F, typename... R>
bool in(F& f, R&... r){
    if(cin >> f){in(r...);return true;}
    else return false;
}
#define out(x) cout << (x)
#define space() cout << " "
#define indent() cout << '\n'
void print(){}
template<typename F, typename... R>
void print(F f, R... r){out(f), indent(), print(r...);}
#define debughead(x) cerr << "Line " << __LINE__ << ": " << #x << ": "
#define debugout(x) cerr << (x) << " "
#define debugindent() cerr << '\n'
#define debug(x) debughead(x), debugout(x), debugindent()
const int INF = 1e18, MOD = 1e9 + 7;
template<typename T>
bool chmax(T& a, T b){return (a = max(a, b)) == b;}
template<typename T>
bool chmin(T& a, T b){return (a = min(a, b)) == b;}

main(){
    INCANT;
    int n, tmp, res = 0;
    string s;
    in(n);
    if(n == 1){
        print(0);
        return 0;
    }
    if(n / (n - 1) == n % (n - 1)){
        res += n - 1;
    }
    rep(i, 2, (int)sqrt(n) + 1){
        if(n % i == 0){
            int a = i - 1, b = n / i - 1;
            if(n / a == n % a){
                res += a;
            }
            if(n / b == n % b){
                res += b;
            }
        }
    }
    print(res);
}

Measured memory_bytes: 256
#!usr/bim/python
#! -*- coding: utf-8 -*-

import numpy as np

n = raw_input()
n = int(n)

tree = []
for i in range(n):
    tree.append([])

for i in range(n-1):
    abc = raw_input()
    abc = abc.split()
    abc = map(int, abc)
    tree[abc[0]-1].append([abc[1]-1,abc[2]])
    tree[abc[1]-1].append([abc[0]-1,abc[2]])


qk = raw_input()
qk = qk.split()
q,k = map(int,qk)

question = []
for i in range(q):
    xy = raw_input()
    xy = xy.split()
    xy = map(int,xy)
    question.append(xy)

distance = []
for i in range(n):
    distance.append(-1)

distance[k-1] = 0

next_point = [k-1]

while 1:
    search_point = next_point
    next_point = []
    if len(search_point) == 0:
        break
    else:
        for i in search_point:
            for j in tree[i]:
                if distance[j[0]] == -1:
                    distance[j[0]] = distance[i] + j[1]
                    next_point.append(j[0])

for line in question:
    print distance[line[0]-1] + distance[line[1]-1]


Measured memory_bytes: 72352
#include <cmath>
#include <iostream>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <bitset>
#include <algorithm>
#include <functional>
#include <utility>
#include <iomanip>

#define int long long int
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )

using namespace std;

typedef pair<int, int> P;

const int INF = 1e15;
const int MOD = 1e9+7;

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

    int h, w;
    cin >> h >> w;
    vector<vector<bool>> a(h, vector<bool>(w, true));
    rep(i, h){
        rep(j, w){
            char c;
            cin >> c;

            if(c == '#'){
                a[i][j] = false;
            }
        }
    }

    vector<vector<int>> dp(h, vector<int>(w));
    dp[0][0] = 1;
    rep(i, h){
        rep(j, w){
            if(not a[i][j]){
                continue;
            }
            if(i + 1 < h && a[i+1][j]){
                dp[i+1][j] += dp[i][j];
                dp[i+1][j] %= MOD;
            }
            if(j + 1 < w && a[i][j+1]){
                dp[i][j+1] += dp[i][j];
                dp[i][j+1] %= MOD;
            }
        }
    }
    cout << dp[h-1][w-1] << endl;

    return 0;
}


Measured memory_bytes: 8320
#include<iostream>

using namespace std;

int main()
{
  int n;
  cin>>n;
  
  n=n%10;
  
  if(n==2 || n==4 || n==5 || n==7 || n==9)
    cout<<"hon";
  
  else if(n==1 || n==6 || n==8 || n==0)
    cout<<"pon";
  
  else
    cout<<"bon";
  
  return 0;
}

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

vector<ll> Zalgo(string S){
    ll N = S.size();
    vector<ll> ret(N);
    ret[0] = N;
    ll i = 1, j = 0;
    while(i < N){
        while(i + j < N && S[j] == S[i+j]) j++;
        ret[i] = j;
        if(j == 0){
            i++;
            continue;
        }
        ll k = 1;
        while(i + k < N && k + ret[k] < j){
            ret[i+k] = ret[k];
            k++;
        }
        i += k;
        j -= k;
    }
    return ret;
}

int main(){
    ll N; string S;
    cin >> N >> S;
    ll ans = 0;
    rep(i, 0, N){
        auto tmp = Zalgo(S.substr(i));
        rep(j, 1, tmp.size()){
            ans = max(ans, min(j, tmp[j]));
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256