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

int main(){
    int i, n, tmp, flg = 0;
    cin >> n;
    for(i = 0; i < n; ++i){
        cin >> tmp;
        if (tmp % 2 == 1){
            continue;
        }
        if (tmp % 3 == 0 || tmp % 5 == 0){
            continue;
        }
        ++flg;
        break;
    }
    if (flg == 0){
        cout << "APPROVED" << endl;
    }else{
        cout << "DENIED" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define FORD(i,a,b) for(int i=a;i>=b;i--)
#define FORL(i,x) for(int i=head[x];i;i=nxt[i])
#define ALL(a)  (a).begin(),(a).end()
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define PB push_back
#define MP make_pair
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }



int main() {
  string s;
  cin >> s;
  int k;
  cin >> k;

  int n = s.length();

  FOR(i,0,n-1){
    if(k==0) continue;
    else if(i==n-1){
      s[n-1] = ('a'+(s[n-1]-'a'+k)%26);
    }
    else if(s[i]=='a') continue;
    else if(k>=('z'-s[i]+1)){
      k -= (int)('z'-s[i]+1);
      s[i] = 'a';
    }
    // cout << k << " " << s << endl;
  }

  cout << s << endl;

}



Measured memory_bytes: 512
#include <iostream>

using namespace std;

int main(void)
{
  int N,flag=1,cnt=0;
  
  cin >> N;

  int A[N];
  for(int i=0;i<N;i++)
    cin >> A[i];

  while(flag){
    for(int i=0;i<N;i++){
      if(A[i]%2)
	flag=0;
      else
	A[i]/=2;
    }
    if(flag==1)
      cnt++;
  }

  cout << cnt << endl;

  return 0;
}

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

void Printf(std::vector<int> & a) {
	for(int i=0;i<(int)a.size();++i) {
		if (i>0){ 
			cout << " ";
		}
		cout  << a.at(i);
	}
	cout << std::endl;
}
void InputSet(std::vector<int> & a) {
	int n;
	cin >> n;
	a.resize(n,0);
	for(int i=0;i<n;++i) {
		cin >> a.at(i);
	}
}

void CountingSort(std::vector<int> & A, std::vector<int> & B, int k)
{
	std::vector<int> C;
	C.resize(k+1,0);
	B.resize(A.size(),0);
	for (unsigned int j = 0; j < A.size(); ++j) {
		C[A[j]] = C[A[j]]+1;
	}
	/* C[i]??????i???????????属????即???????????????????*/
	for (int i = 1; i <= k; ++i) {
		C[i] = C[i] + C[i-1];
	}
	/* C[i]??????i??\????????属???????????属????即???????????????????*/
	for (int j = (int)A.size()-1; j>=0; --j) {
		B[C[A[j]]-1] = A[j];
		C[A[j]] = C[A[j]]-1;
	}
}


int main(){
	std::vector<int> A,B;
	::InputSet(A);
	int maxA = 0;
	for(unsigned int i=0;i<A.size();++i){
		maxA = std::max(maxA,A[i]);
	}
	CountingSort(A,B,maxA);
	Printf(B);
}

Measured memory_bytes: 16804
import java.util.Scanner;

public class Main{
    public static void Calc(int x, String op, int y){
        int S;
        switch(op){
            case "+":
            S = x + y;
            System.out.println(S);
            break;

            case "-":
            S = x - y;
            System.out.println(S);
            break;

            case "*":
            S = x * y;
            System.out.println(S);
            break;

            case "/":
            S = x / y;
            System.out.println(S);
            break;

            default:
            break;
        }
    }
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int S;
        while(true){
            int a = sc.nextInt();
            String op = sc.next();
            int b = sc.nextInt();
            Calc(a, op, b);
            if(op.equals("?")){
                break;
            }
        }
        sc.close();

    }
}


Measured memory_bytes: 26212
#include<bits/stdc++.h>
using namespace std;
int main(){
    int a,b,c,k;
    cin>>a>>b>>c>>k;
    vector<int>num={a,b,c};
    sort(num.begin(),num.end());
    int x=num.at(2);
    int y=num.at(1);
    int z=num.at(0);
    for(int i=0;i<k;i++){
        x*=2;}
    cout<<x+y+z;
    return 0;}

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

using namespace std;

int main() {
    int a, b;
    cin >> a >> b;
    b--;
    char grid[80][50] = {{0}};
    for (int i=0; i<80; i++) {
        for (int j=0; j<49; j++) {
            if (i < 40) {
                if(i%2 || j%2 || b == 0)
                    grid[i][j] = '.';
                else {
                    grid[i][j] = '#';
                    b--;
                }
            } else {
                if(!(i%2) || j%2 || a == 0)
                    grid[i][j] = '#';
                else {
                    grid[i][j] = '.';
                    a--;
                }
            }
        }
    }
    grid[38][48] = grid[39][48] = '#';
    grid[40][0] = '.';
    cout << "80 49" << '\n';
    for (auto g:grid)
        cout << g << '\n';
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc =new Scanner(System.in);
		int N = sc.nextInt();
		int[] T = new int[N + 1];
		for(int i = 0; i < N; i++) {
			T[i] = sc.nextInt();	
		}
		int M = sc.nextInt();
		int[] P = new int [M];
		int[] X = new int [M];
		for(int i = 0; i < M; i++) {
			P[i] = sc.nextInt();
			X[i] = sc.nextInt();
		}
		int sum = 0;
		for(int i = 0; i < M; i++) {
			int a = P[i];
			T[N] = X[i];
			for(int j = 0; j < T.length; j++) {
				sum += T[j];
			}
			System.out.println(sum - T[a - 1]);
			sum = 0;
		}
	}
}

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

using namespace std;

int main(){
    int n;
    cin >> n;
    vector<string> dic;
    string w1;
    cin >> w1;
    bool flag = true;
    dic.push_back(w1);
    for (int i=1;i<n;i++){
        string w;
        cin >> w;
        int cnt = count(dic.begin(),dic.end(),w);
        if (cnt >=1) flag = false;
        if ((dic[i-1][dic[i-1].length()-1]) != (w[0])) flag = false;
        dic.push_back(w);
    }
    
    if (flag) cout << "Yes" << endl;
    else cout << "No" << endl;

}

Measured memory_bytes: 256
#![allow(unused)]

#[allow(unused_imports)]
use std::{cmp, collections, fmt, io, iter, ops, str};
use cmp::Ordering::*;
use collections::{HashMap, HashSet};
use io::{Read, Write};

#[cfg(feature = "debug")]
macro_rules! debug {
    ($fmt: expr) => { eprintln!($fmt) };
    ($fmt: expr, $($arg: tt)*) => { eprintln!($fmt, $($arg)*) };
}

#[cfg(not(feature = "debug"))]
macro_rules! debug {
    ($fmt: expr) => {};
    ($fmt: expr, $($arg: tt)*) => {};
}

fn read_line() -> String {
    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    buf.trim().to_owned()
}

fn read_word() -> String {
    const CAPACITY: usize = 16;

    let mut stdin = io::stdin();
    let mut byte: [u8; 1] = [0];

    loop {
        let mut buf = Vec::with_capacity(CAPACITY);

        loop {
            let res = stdin.read(&mut byte);

            if res.unwrap_or(0) == 0 || byte[0] <= b' ' {
                break;
            } else {
                buf.push(byte[0]);
            }
        }

        if buf.len() > 0 {
            return String::from_utf8(buf).unwrap();
        }
    }
}

fn parse_line<T: str::FromStr>() -> T {
    read_line().parse().ok().unwrap()
}

fn parse_word<T: str::FromStr>() -> T {
    read_word().parse().ok().unwrap()
}

fn parse_vec<T: str::FromStr>() -> Vec<T> {
    read_line()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

fn flush() {
    io::stdout().flush();
}

fn main() {
    let n = parse_line::<usize>();
    let days = parse_word::<i32>();
    let remain = parse_word::<i32>();

    let eat = {
        let mut v = Vec::with_capacity(n);
        for _ in 0..n {
            let a = parse_line::<i32>();
            v.push(a);
        }
        v
    };

    let eat_num = eat.iter().map(|e| (days - 1) / e + 1).sum::<i32>();
    println!("{}", eat_num + remain);
}

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn test() {
        //
    }
}


Measured memory_bytes: 4352
from collections import Counter

n = int(input())
s_list = []

for i in range(n):
    s_list.append(input())

#s_list.sort()
c = Counter(s_list)
l = c.most_common()    
count = l[0][1]
l.sort()
for i in l:
    if count == i[1]:
        print(i[0])

Measured memory_bytes: 46872
using System;
using System.Linq;
namespace C
{
    class Program
    {
        static public int Mod = (int)Math.Pow(10, 9) + 7;
        static void Main(string[] args)
        {
            string[] In = Console.ReadLine().Split(' ');
            int n = int.Parse(In[0]);
            int m = int.Parse(In[1]);
            long[] A = new long[n + 1];
            int[] X = new int[m];
            for (int i = 0; i < m; i++)
            {
                X[i]= int.Parse(Console.ReadLine());
            }
            A[0] = 1;
            int x_inx = 0;
            for (int i = 0; i <= n - 1; i++)
            {
                if (x_inx < m && i == X[x_inx]) { x_inx++; continue; }
                A[i] %= Mod;
                A[i + 1] += A[i];
                if(i!=n-1)A[i + 2] += A[i];
            }
            Console.WriteLine(A[n]%=Mod);
        }
    }
}
//TLE
//namespace C
//{
//    class Program
//    {
//        static public int Mod = (int)Math.Pow(10, 9) + 7;
//        static public bool[] A;
//        static public int n;
//        static public long ans=0;
//        static void Main(string[] args)
//        {
//            string[] In = Console.ReadLine().Split(' ');
//            n = int.Parse(In[0]);
//            int m = int.Parse(In[1]);
//            A = new bool[n+1];
//            A = Enumerable.Repeat(true, n + 1).ToArray();
//            for(int i = 0; i < m; i++)
//            {
//                int a = int.Parse(Console.ReadLine());
//                A[a] = false;
//            }
//            DFS(0);
//            Console.WriteLine(ans);
//        }
//        static public void DFS(int index)
//        {
//            if (index > n) return;
//            if (!A[index]) return;
//            if (index == n) 
//            { 
//                ans++; 
//                ans %= Mod;
//                return; 
//            }
//            DFS(index + 1);
//            DFS(index + 2);
//        }
//    }
//}


Measured memory_bytes: 31160
n, W = map(int, input().split())
dp = [0 for _ in range(W + 1)]
ans = 0
for _ in range(n):
    w, v = map(int, input().split())
    for i in range(W, w - 1, -1):
        dp[i] = max(dp[i], dp[i - w] + v)
        ans = max(ans, dp[i])
print(ans)

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

int main() {
  int N;
  cin >> N;
  vector<int> a(N);
  int A = 0;
  for (int i = 0; i < N; i++){
    cin >> a[i];
  }
  sort (a.begin(), a.end());
  reverse (a.begin(), a.end());
  for (int i = 0; i < N; i++){
    if (i % 2 == 0) A+=a[i];
    else A-=a[i];
  }
  cout << A << endl;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
            using namespace std;
             
            #define int long long
            #define ll long long
            #define pb emplace_back
            #define mp make_pair
            #define f(i,a,n) for(int i=a ; i<n ; i++)
            #define F first
            #define S second
            #define E "\n"
            #define fast ios:: sync_with_stdio(false),cin.tie(0);
            
           int32_t main()
              {
                    int n;
                    cin >> n;
                    if(n==1)cout<<"1.0000000000"<<E;
                    else if(n%2==1) 
                    {
                          float x=(n/2+1)/(float)n;
                          cout<<fixed<<setprecision(6)<<x;
                    }
                    else cout<<"0.5000000000";
              }

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

using namespace std;

int a[200001];
int pos[200001];

typedef long long ll;

int main() {

	int N;

	scanf("%d",&N);

	int i;

	for (i = 0; i < N; i++) {
		scanf(" %d",&a[i]);
		pos[a[i]] = i + 1;
	}

	set<int>data;

	data.insert(0);
	data.insert(N+1);

	ll sum = 0;

	for (i = 1; i <= N; i++) {
		data.insert(pos[i]);
		set<int>::iterator it = data.find(pos[i]);
		ll r = *(++it) - pos[i];
		--it;
		ll l = pos[i] - (*(--it));
		sum += (ll)i*r*l;
	}
	printf("%lld\n",sum);

	return 0;
}

Measured memory_bytes: 11136
import java.util.Scanner

object Main {
  def main(args: Array[String]) {
    if (args.length > 0 && args(0) == "TEST") {
      println(test())
    } else {
      val input = io.Source.stdin.getLines().mkString("\n")
      println(solve(input).trim())
    }
  }

  def solve(input: String): String = {
    val sc: Scanner = new Scanner(input)
    val s, t = sc.next
    val ss = new String(s.toCharArray.sorted)
    val ts = new String(t.toCharArray.sorted.reverse)
    if (ss.compareTo(ts) < 0) "Yes" else "No"
  }

  val tests = List(
    """yx
      |axy""".stripMargin -> """Yes""",
    """ratcode
      |atlas""".stripMargin -> """Yes""",
    """cd
      |abc""".stripMargin -> """No""",
    """w
      |ww""".stripMargin -> """Yes""",
    """zzz
      |zzz""".stripMargin -> """No"""
  )

  def test(): String = tests.map { case (i, o) => (i.trim(), o.trim()) }
    .zipWithIndex.map {
    case ((input, outputExpect), i) =>
      val output = solve(input).trim()
      val tnum = i + 1
      s"test$tnum:" + (
        if (output == outputExpect) "Passed"
        else s"Failed\nexpect:\n$outputExpect\noutput:\n$output")
  }
    .mkString("\n")
}

Measured memory_bytes: 25556
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define INF LLONG_MAX/10
#define rep(i,n) for(int i=0;i<n;i++)
#define krep(i,k,n,m) for(int i=k;i<n;i+=m)
#define erep(i,k,n) for(int i=k;i<n;i++)
#define mod 1000000007
//最大公約数
int gcd(int s,int b){
    if(b==0)return s;
    return gcd(b,s%b);
}
signed main(){
    int n;
    cin>>n;
    int k;
    cin>>k;
    int a[n];
    rep(i,n){
        cin>>a[i];
    }
    sort(a,a+n);
    reverse(a,a+n);
    int ans=0,kai=0;;
    rep(i,n){
        ans++;
        if(ans<=k){
           
        }
        else{
            kai+=a[i];
        }
    }
    cout<<kai<<endl;
}


Measured memory_bytes: 1792
from collections import Counter 
from collections import defaultdict
from collections import deque
from functools import reduce
import math
import itertools
import heapq
import numpy as np
import sys
sys.setrecursionlimit(10**6)

#n=int(input())
#n,m=list(map(int,input().split()))
#a=list(map(int,input().split()))
ceil=lambda x,y: (x+y-1)//y
input_list = lambda : list(map(int,input().split()))



#bfs内で処理すると使い回しが効かないのでsearch_color とか幅探索後の具体的な処理は別個にしたほうがいい
def bfs(s,n,node):
    check=[False for _ in range(n)]
    check[s]=True
    queue=[n for _ in range(n)]
    now=0
    queue[now]=s
    ans=[-1 for _ in range(n)]
    ans[0]=[0]
    last_ind=1
    while last_ind<n:

        
        if now>=n or queue[now]==n:
            return []

        for i in node[queue[now]]:
            edge=i[0]
            
            ind=i[1]
            if check[edge]:
                continue

            queue[last_ind]=edge
            last_ind+=1
            #check[edge]=True
            
            ans[edge]=queue[now]
            check[edge]=True
        now+=1
        #print(queue)
        #print(last_ind)
        #print()
    return ans



n,m=input_list()
node=[[] for _ in range(n)]
for i in range(m):
    u,v=input_list()
    u-=1
    v-=1
    node[u].append([v,i])
    node[v].append([u,i])

#print(np.array(node))

ans=bfs(0,n,node)
if len(ans)==0:
    print("No")
    exit()

print("Yes")
for each in ans[1:]:
    print(each+1)








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

int main() {
	int A, B, C, i;
	cin >> A >> B >> C;
	for (i = 0; i < 64; i++) {
		if (A % 2 == 1 || B % 2 == 1 || C % 2 == 1) break;
		int a = A, b = B, c = C;
		A = (b + c) / 2;
		B = (c + a) / 2;
		C = (a + b) / 2;
	}
	if (i < 31) cout << i << endl;
	else cout << -1 << endl;
}

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

// output
#define SPBR(w, n) std::cout<<(w + 1 == n ? '\n' : ' ');
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
// utility
#define ALL(i) (i).begin(), (i).end()
#define FOR(i, a, n) for(int i=(a);i<(n);++i)
#define RFOR(i, a, n) for(int i=(n)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<int(n);++i)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define IN(a, x, b) (a<=x && x<b)
#define OUT(a, x, b) (x<a || b<=x)
template<class T> inline T chmax(T & a, const T b) { return a = (a < b) ? b : a; }
template<class T> inline T chmin(T& a, const T b) { return a = (a > b) ? b : a; }

// type/const
#define int ll
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const int MOD = 1000000007;
/* const int MOD = 1000000007; */
const int INF = 1e18;
const double PI = acos(-1);

using namespace std;


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

  vector<int> w(N), v(N);
  REP(i, N) cin >> w[i] >> v[i];

  vector<vector<int>> dp(N+1, vector<int>(W+1, 0));

  REP(i, N){
    REP(j, W+1){
      chmax(dp[i+1][j], dp[i][j]);
      if(j-w[i] >= 0) chmax(dp[i+1][j], dp[i][j-w[i]]+v[i]);
    }
  }

  cout << dp[N][W] << endl;

  return 0;
}

Measured memory_bytes: 80256
import sys
input=lambda: sys.stdin.readline().rstrip()
import bisect
D = int(input())
C = [int(i) for i in input().split()]
S = [[int(i) for i in input().split()] for _ in range(D)]

result = 0
Date = [[0] for _ in range(26)]
Contest = [0] * D
for i in range(D):
    t = int(input())
    Contest[i] = t - 1
    result += S[i][t - 1]
    Date[t-1].append(i+1)
    for j in range(26):
        result -= C[j] * (i + 1 - Date[j][-1])

M = int(input())
for _ in range(M):
	d, q = map(int,input().split())
	d -= 1
	q -= 1
	result += S[d][q] - S[d][Contest[d]]
  
	index = bisect.bisect_left(Date[q], d + 1)
	prev = Date[q][index - 1]
	if d + 1 > Date[q][-1]:
		next = D + 1
	else:
		next = Date[q][index]
	
	result += C[q] * (d + 1 - prev) * (next - (d + 1))
	Date[q] = Date[q][:index] + [d+1] + Date[q][index:]

	index = bisect.bisect_left(Date[Contest[d]], d + 1)
	prev = Date[Contest[d]][index - 1]
	if d + 1 == Date[Contest[d]][-1]:
		next = D + 1
	else:
		next = Date[Contest[d]][index + 1]
	
	result -= C[Contest[d]] * (d + 1 - prev) * (next - (d + 1))
	Date[Contest[d]].remove(d + 1)

	Contest[d] = q

	print(result)

Measured memory_bytes: 74588
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pp;
typedef pair<ll,ll> pll;
void read(int& x){ scanf("%d",&x); }
void read(ll& x){ scanf("%lld",&x); }
template<typename T,typename... Args>
void read(T& a,Args&... b){ read(a); read(b...); }
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define x first
#define y second

int n, c, k;
int t[100010];
priority_queue<int> pq;

int main()
{
	read(n, c, k);
	for(int i=1; i<=n; ++i) read(t[i]), pq.push(-t[i]);
	int bus=0;
	while(pq.size()){
        int x=-pq.top()+k;
        ++bus;
        int cnt=0;
        while(pq.size()){
            if(cnt == c) break;
            if(x < -pq.top()) break;
            ++cnt;
            pq.pop();
        }
	}
	printf("%d\n", bus);
    return 0;
}


Measured memory_bytes: 1148
b=input()
max = 0
count = 0

for i in range(len(b)):
    if b[i] == 'A':
        count += 1
    elif b[i] == 'C':
        count += 1
    elif b[i] == 'G':
        count += 1
    elif b[i] == 'T':
        count += 1
    else:
        if max <= count:
            max = count
            count = 0
    if max <= count:
        max = count
print(max)


Measured memory_bytes: 3060
using System;
using System.Collections.Generic;
using System.Collections;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using System.IO;
using System.Reflection;
using static System.Math;
using System.Numerics;
static class Program{
	const int mod=(int)1e9+7;
	static void Main(){
		Sc sc=new Sc();
		var s=sc.Ia;
		var dp=new long[s[1]+1];
		for(int i = 1;i<=s[0];i++) {
			var e=sc.Ia;
			for (int j = 1;e[2]>0;j<<=1) {
				int m=Min(j,e[2]);
				for(int k = s[1];k>=e[1]*m;k--) {dp[k]=Max(dp[k],dp[k-e[1]*m]+e[0]*m);}
				e[2]-=j;
			}
		}
		Console.WriteLine("{0}",dp.Max());
	}
}

public class Sc{
	public int I{get{return int.Parse(Console.ReadLine());}}
	public long L{get{return long.Parse(Console.ReadLine());}}
	public double D{get{return double.Parse(Console.ReadLine());}}
	public string S{get{return Console.ReadLine();}}
	public int[] Ia{get{return Array.ConvertAll(Console.ReadLine().Split(),int.Parse);}}
	public long[] La{get{return Array.ConvertAll(Console.ReadLine().Split(),long.Parse);}}
	public double[] Da{get{return Array.ConvertAll(Console.ReadLine().Split(),double.Parse);}}
	public string[] Sa{get{return Console.ReadLine().Split();}}
	public object[] Oa{get{return Console.ReadLine().Split();}}
	public int[] Ia2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),int.Parse);}}
	public int[] Ia3(int a){return Array.ConvertAll((a.ToString()+" "+Console.ReadLine()).Split(),int.Parse);}
	public int[] Ia3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+Console.ReadLine()+(c?" "+d.ToString():"")).Split(),int.Parse);}
	public long[] La2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),long.Parse);}}
	public long[] La3(int a){return Array.ConvertAll((a.ToString()+" "+Console.ReadLine()).Split(),long.Parse);}
	public long[] La3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+Console.ReadLine()+(c?" "+d.ToString():"")).Split(),long.Parse);}
	public T[] Arr<T>(int n,Func<T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f();}return a;}
	public T[] Arr<T>(int n,Func<int,T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i);}return a;}
	public T[] Arr<T>(int n,Func<string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(Console.ReadLine().Split());}return a;}
	public T[] Arr<T>(int n,Func<int,string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i,Console.ReadLine().Split());}return a;}
}


Measured memory_bytes: 20368
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
int cnt, l;
int main() {
    int n;
    cin >> n;
    string s;
    cin >> s;
    for(int i=0; i<s.size(); i++) {
        if(s[i] == 'I') {
            l++;
        }
        else {
            l--;
        }
        cnt = max(l, cnt);
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
/* typedef */
typedef long long ll;
typedef pair<int, int> pii;
/* constant */
const int INF = 1 << 30;
const ll LINF = 1LL << 50;
const int NIL = -1;
const int MAX = 10000;
const int mod = 998244353;
/* struct for mod Calculation*/
struct mint {
    ll x;
    mint(ll x = 0):x((x % mod + mod) % mod) {}
    mint operator-() const { return mint(-x); }
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod - a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) {
        (x *= a.x) %= mod;
        return *this;
    }
    mint operator+(const mint a) const {
        mint res(*this);
        return res += a;
    }
    mint operator-(const mint a) const {
        mint res(*this);
        return res -= a;
    }
    mint operator*(const mint a) const {
        mint res(*this);
        return res *= a;
    }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t >> 1);
        a *= a;
        if (t & 1) a *= *this;
        return a;
    }
    // for prime mod
    mint inv() const {
        return pow(mod - 2);
    }
    mint& operator/=(const mint a) {
        return (*this) *= a.inv();
    }
    mint operator/(const mint a) const {
        mint res(*this);
        return res /= a;
    }
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}
/* global variables */
/* function */
/* main */
int main(){
    int N, S;
    cin >> N >> S;
    vector<int> A(N);
    for (int i = 0; i < N; i++) cin >> A[i];
    vector<mint> dp(S+1);
    dp[0] = 1;
    for (int i = 0; i < N; i++) {
        vector<mint> p(S+1);
        swap(dp, p);
        for (int j = 0; j < S+1; j++) {
            dp[j] += p[j] * 2;
            if (j + A[i] <= S) dp[j + A[i]] += p[j];
        }
    }

    cout << dp[S] << '\n';
}


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

int main()
{
  int k;
  char s[101];

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

Measured memory_bytes: 1624
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <utility>
#include <functional>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <fstream>
using namespace std;
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v;}
template<class T> inline string toStr(T x) { ostringstream sout; sout << x; return sout.str();}
typedef vector<int> vi;
typedef vector<vi>  vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n) FOR(i,0,(n)-1)
const double EPS = 1e-12;
const double PI = acos(-1.0);
const int INF = INT_MAX/10;

#include <complex>
typedef complex<double> P;

int main() {
	double x, y;
	char c;
	vector<P> points;
	while(cin >> x >> c >> y) {
		points.push_back(P(x, y));
	}
	double S = 0.0;
	REP(i, points.size()-2) {
		double a, b, c;
		a = abs(points[0]-points[i+1]);
		b = abs(points[0]-points[i+2]);
		c = abs(points[i+1]-points[i+2]);

		double z = (a+b+c)/2;
		S += sqrt(z*(z-a)*(z-b)*(z-c));
	}
	printf("%.6f\n", S);
	return 0;
}

Measured memory_bytes: 1260
# https://beta.atcoder.jp/contests/abc065/tasks/abc065_b

import sys


def model():
    e = list(map(int, sys.stdin))
    cur = e[1]
    for i in range(e[0]):
        if cur == 2:
            print(i + 1)
            break
        cur = e[cur]
    else:
        print(-1)


def input_lines():
    """hell?"""
    lines = sys.stdin.readlines()
    for i in range(1, int(lines[0])+1):
        yield i, int(lines[i].strip())


def solve():
    d = {i: button for i, button in input_lines()}
    count = 1
    index = 1

    while True:
        try:
            prev = index
            index = d[index]

            if index == 2:
                print(count)
                exit()
            elif index is None:
                print(-1)
                exit()
            d[prev] = None
            count += 1
        except KeyError:
            print(-1)
            exit()


if __name__ == '__main__':
    solve()
    # model()


Measured memory_bytes: 24228
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <set>
using namespace std;
inline int read()
{
	int res, ok = 1;
	char ch;
	for (ch = getchar(); ch < '0' || ch > '9'; ch = getchar())
	if (ch == '-')
	ok = -1;
	res = ch - '0';
	for (ch = getchar(); ch >= '0' && ch <= '9'; ch = getchar())
	res = res * 10 + ch - '0';
	return res * ok;
}
int n, p[20005], a[20005], b[20005], cnt[20005];
int main()
{
	n = read();
	for (int i = 1; i <= n; i++)
	p[i] = read();
	for (int i = 1; i <= n; i++)
	cnt[p[i]] = n * n - n + i;
	a[1] = 1;
	b[1] = cnt[1] - 1;
	for (int i = 2; i <= n; i++)
	{
		a[i] = a[i - 1] + 1;
		b[i] = b[i - 1] - 1;
		if (a[i] + b[i] < cnt[i])
		a[i] = cnt[i] - b[i];
		if (a[i] + b[i] > cnt[i])
		b[i] = cnt[i] - a[i];
	}
	for (int i = 1; i <= n; i++)
	printf ("%d ", a[i]);
	printf ("\n");
	for (int i = 1; i <= n; i++)
	printf ("%d ", b[i]);
	printf ("\n");
	return 0;
}

Measured memory_bytes: 896
#!/usr/bin/env python
# -*- coding: utf-8 -*-

N, M = map(int, input().split())
ans = set(range(1, M+1))
for i in range(N):
    test_set = set(list(map(int, input().split()))[1:])
    ans = ans.intersection(test_set)
print(len(ans))


Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL)
#define endl "\n"
#define pb push_back
#define mod 1000000007
int dx[]={1,-1,0,0};
int dy[]={0,0,1,-1};
int dx8[]={1,-1,0,0,1,1,-1,-1};
int dy8[]={0,0,1,-1,1,-1,1,-1};

ll binexp(ll a, ll b, ll m) {
	a %= m;
	ll res = 1;
	while (b > 0) {
		if (b & 1)
			res = res * a % m;
		a = a * a % m;
		b >>= 1;
	}
	return res;
}
ll modinvfermat(ll a, ll m)
{
	return binexp(a, m - 2, m);
}
void task(bool flag)
{
	if (flag)
		cout << "YES\n";
	else
		cout << "NO\n";
}
ll lcm(ll a, ll b)
{
	return ((1LL * a * b) / (__gcd(a, b)));
}

ll check (string a,string b){
	ll cc=0;

	for(ll i=0;i<a.size();i++){
		if(a[i]!=b[i])cc++;


	}
	return cc;

}
void solve(){
	
	string s,t;
	cin>>s>>t;
	ll ans=INT_MAX;


	for(ll i=0;i<s.size()-t.size()+1;i++){
		string g;
		g=s.substr(i,t.size());
		ans=min(ans,check(g,t));


	}
cout<<ans<<endl;











return;
}




int main()
{  
#ifndef ONLINE_JUDGE
	// for getting input from input.txt
	freopen("input.txt", "r", stdin);
	// for writing output to output.txt
	freopen("output.txt", "w", stdout);
#endif
    fast;
    ll t;
    t=1;
   //cin>>t;
    while(t--){
    	solve();
    }
    
   
  



#ifndef ONLINE_JUDGE
	cout << "\nTime Elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " sec\n";
#endif
return 0;
}

Measured memory_bytes: 3620
import java.util.Arrays;
import java.util.Scanner;

//Swimming Jam
public class Main{

	class R implements Comparable<R>{
		int speed, lap, now;
		public R(int speed, int lap) {
			this.speed = speed;
			this.lap = lap;
		}
		public int compareTo(R o) {
			return o.speed-speed;
		}
	}

	void run(){
		Scanner sc = new Scanner(System.in);
		int[][] lane = new int[50][150001], begin = new int[50][501];
		for(;;){
			int n = sc.nextInt();
			if(n==0)break;
			R[] r = new R[n];
			for(int i=0;i<n;i++)r[i]=new R(sc.nextInt(), sc.nextInt()*2);
			Arrays.sort(r);
			for(int[]a:lane)Arrays.fill(a, 0);
			for(int[]a:begin)Arrays.fill(a, 0);
			int t = 0, res = 0;
			for(int i=1;i<=r[0].lap;i++){
				begin[0][i] = t;
				for(int j=0;j<r[0].speed;j++){
					lane[0][t++] = i;
				}
				res = Math.max(res, t);
			}
			for(int i=1;i<n;i++){
				t = 0;
				for(int j=1;j<=r[i].lap;j++){
					begin[i][j] = t;
					for(int k=0;k<r[i].speed;k++){
						lane[i][t++] = j;
					}
					int max = t;
					for(int k=0;k<i;k++){
						if(lane[k][t-1]==0)continue;
						if(j%2!=lane[k][t-1]%2)continue;
						int x = lane[k][t-1];
						if(begin[i][j]<=begin[k][x])continue;
						int pos = t;
						while(lane[k][pos]==x)pos++;
						max = Math.max(max, pos);
					}
					while(t<max)lane[i][t++] = j;
					res = Math.max(res, t);
				}
			}
			System.out.println(res);
		}
	}

	public static void main(String[] args) {
		new Main().run();
	}
}

Measured memory_bytes: 43000
#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <functional>
#include <bitset>

using namespace std;
using lint = long long int;
long long int INF = 1001001001001001LL;
int inf = 1000000007;
long long int MOD = 1000000007LL;
double PI = 3.1415926535897932;

template<typename T1,typename T2>inline void chmin(T1 &a,const T2 &b){if(a>b) a=b;}
template<typename T1,typename T2>inline void chmax(T1 &a,const T2 &b){if(a<b) a=b;}

#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()

/* do your best */

int main() {
  
  int n; cin >> n;
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    int a; cin >> a;
    if (i % 2 == 1) {
      if (a % 2 == 1) ans++;
    }
  }

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


Measured memory_bytes: 3588
package main

import "fmt"

type luggage struct {
	value int
	weight int
}

func ma(x int, y int)int{
	if x >= y {
		return x
	}else{
		return y
	}
}

func main(){
	var num,bag_volume int
	var luggages []luggage

	fmt.Scanf("%d %d",&num,&bag_volume)
	for i:=0;i<num;i++{
		l := luggage{}
		fmt.Scanf("%d %d",&l.value,&l.weight)
		luggages = append(luggages,l)
	}

	//make dp chart
	var dp [][]int
	for i:=0;i<num+1;i++{
		dp = append(dp,make([]int,bag_volume+1))
	}

	//fill in dp chart

	for i:=1;i<num+1;i++{
		for j:=1;j<bag_volume+1;j++{
			// i => type of luggage using
			// j => max bag weight
			l_weight := luggages[i-1].weight
			l_value := luggages[i-1].value
			if l_weight <= j{
				//can put in bag
				dp[i][j] = ma(dp[i-1][j],ma(l_value+dp[i-1][j-l_weight],l_value+dp[i][j-l_weight]))
			}else{
				dp[i][j] = dp[i-1][j]
			}
		}
	}
	fmt.Println(dp[num][bag_volume])
}



Measured memory_bytes: 9752
import Data.Char
import Data.List
import qualified Data.ByteString.Char8 as B
main=B.interact$B.pack.f.unfoldr(B.readInt.B.dropWhile isSpace)
f (n:abs) =if s1 <= st && s2 <= st then "Yes" else "No"
    where
        (as,bs) = splitAt n abs
        s1 = sum(map sol1$zip as bs)
        s2 = sum(map sol2$zip as bs)
        st = sum bs - sum as
sol1 (a,b)
    | a<b = (b-a+1)`div`2
    | otherwise = 0
sol2 (a,b)
    | a>b = a-b
    | otherwise = 0

Measured memory_bytes: 2044
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;

void ABC161B()
{
	int N, M;
	cin >> N >> M;
	vi A(N);
	for (auto& x : A)
		cin >> x;
	sort(A.begin(), A.end(), greater<int>());
	int C = accumulate(A.begin(), A.end(), 0);
	int B = A[M - 1];
	if (B * M * 4 < C)
	{
		cout << "No" << endl;
	}
	else
	{
		cout << "Yes" << endl;
	}
}
int main()
{
	ABC161B();
	return 0;
}

Measured memory_bytes: 256
//shan61916
#include <bits/stdc++.h>
  using namespace std;
typedef   long long ll;
typedef   unsigned long long ull ;
typedef   double dll ;

#define   mp make_pair
#define   pb push_back
#define   ff first 
#define   ss second
#define   IOS ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define   endl "\n" 
#define   pll pair<ll, ll>
#define   all(x) x.begin(), x.end()
#define   vll vector<ll> 

const ll inf = (ll)(1e17 + 17);
const ll mod = (ll)(1e9 + 7);
bool ispalin(string s) {
	ll n = s.length();
	for(ll i = 0; i < n/2; i++) {
		if(s[i] != s[n-1-i]) return false;
	}
	return true;
}

int main(){
 IOS
#ifdef SHAN
    freopen("input.txt" , "r" , stdin);  
#endif
  string s;
  cin >> s;
  ll n = s.length();
  string a = s.substr(0, n/2);
  string b = s.substr(n/2 + 1, n/2);
  if(ispalin(a) and ispalin(b) and a == b) cout << "Yes";
  else cout << "No";
  return 0;
} //good night.

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

int main()
{   int i;
    char s[11],t[12];
    cin>>s>>t;

    for(i=0;i<strlen(s);i++)
    {
        if(s[i]!=t[i])
            break;
    }
    if(i==strlen(s))
         cout<<"Yes";
    else
        cout<<"No";

    return 0;
}


Measured memory_bytes: 3628
#include <cassert>
#include <cstdio>
#include <cmath>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>

#ifdef _DEBUG
#define DMP(x) cerr << #x << ": " << x << "\n"
#else
#define DMP(x) ((void)0)
#endif

const int MOD = 1000000007, INF = 1111111111; 
using namespace std;
using lint = long long;

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	int A, B, C, X, tmp, ans = 0;
	cin >> A >> B >> C >> X;

	for (int a = 0; a <= A; a++) {
		for (int b = 0; b <= B; b++) {

			tmp = X - 500 * a - 100 * b;
			if (0 <= tmp && tmp <= C * 50 && tmp % 50 == 0) ans++;

		}
	}

	cout << ans << "\n";

	return 0;
}

Measured memory_bytes: 256
using System;

namespace ALDS1_4A_1 {
    public class Program {
        public static void Main(string[] args) {
            var n = int.Parse(Console.ReadLine());
            var an = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
            Console.ReadLine();
            var tq = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
            Array.Sort(an);

            var cnt = 0;
            foreach(var t in tq) {
                var left = 0;
                var right = n;
                while(left < right) {
                    var mid = (left + right) / 2;
                    if(an[mid] == t) {
                        cnt++;
                        break;
                    }

                    if(t < an[mid]) right = mid;
                    else left = mid + 1;
                }
            }

            Console.WriteLine(cnt);
        }
    }
}

Measured memory_bytes: 9932
fn gcd(a: usize, b: usize) -> usize {
    let r = a % b;
    if r > 0 { gcd(b, r) } else { b }
}

fn main() {
    let k: usize = {
        let mut buf = String::new();
        std::io::stdin().read_line(&mut buf).unwrap();
        buf.trim_end().parse().unwrap()
    };

    let mut ans = 0;
    for a in 1..=k {
        for b in 1..=k {
            for c in 1..=k {
                ans += gcd(gcd(a, b), c);
            }
        }
    }
    println!("{}", ans);
}

Measured memory_bytes: 2176
#define _USE_MATH_DEFINES
#include<iostream>
#include<cstdlib>
#include<algorithm>
#include<cmath>
#include<string>
#include<set>
#include<map>
#include<stdbool.h>
#include<math.h>
#include<sstream>
#include<math.h>
#include<vector>
#include<functional>
#include<queue>
#include<utility>
#include<bitset>
typedef long long ll;
#define N (1000000000+7)
#define INF 1e10
using namespace std;
typedef pair<ll, ll> P;


int main(void) {
	ll n;
	cin >> n;
	vector<ll>a(n), b(n);
	for (ll i = 0;i < n;i++) {
		cin >> a[i];
		b[i] = a[i] - (i + 1);
	}
	sort(b.begin(), b.end());
	ll x = b[n / 2];
	ll sum = 0;
	for (ll i = 0;i < n;i++) {
		sum += (ll)abs(a[i] - x - i - 1);
	}
	cout << sum << endl;
}

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

#define sp ' '
#define endl '\n'
#define st first
#define nd second
#define sz(x) ((long long int)x.size())
#define pb push_back
#define pob pop_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define forn(xx, yy) for(long long int yy = 0; yy < xx; ++yy)
#define prn(xx) cout << xx << '\n'
#define prs(xx) cout << xx << ' '
#define test cout << "TEST " << tn++ << '\n';

typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef vector<vpll> vvpll;

const long long int mod = 1e9 + 7;
const long long int inf = 2e9 + 13;
const long double pi = acos(-1.0);
const long double eps = 1e-9;

ll mx(ll x, ll y){ return (x>y?x:y); }
ll mn(ll x, ll y){ return (x<y?x:y); }
ll tn = 1;

void max_self(ll &x, ll y){ x = mx(x, y); }
void min_self(ll &x, ll y){ x = mn(x, y); }
void add(ll &x, ll y){ x%=mod; x += (y%mod); x%=mod; }
void mul(ll &x, ll y){ x%=mod; x *= (y%mod); x%=mod; }

ll us(ll n, ll x, ll m){
    if(!x) return 1;
    ll a = us(n, x>>1, m);
    return (((a*a)%m)*(x&1?n:1))%m;
}

int main(int argc, char **argv){
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

    ll N;
    cin >> N;
    N %= 1000;
    cout << (1000-N)%1000 << endl;

    return 0;
}

//cikisir



Measured memory_bytes: 3620
#include <stdio.h>
#include <ctype.h>
#include <memory.h>
int main(void){
    int n,i,o,min,t;
    char line[1025],line1[60];
    scanf("%d",&n);
    for(i=0;memset(line,0,sizeof(line)),memset(line1,0,sizeof(line1)),min=t=30,i<n;i++){
        scanf("%s",line);
        line1[min]=line[0];
        for(o=3;line[o];o++)
            if(isalpha(line[o])){
                if(line[o-1] == '>')
                    line1[++t]=line[o];
                else{
                    if(min==t)
                        min--;
                    line1[--t]=line[o];
                }
            }
        printf("%s\n",line1+min);
    }
    return 0;
}

Measured memory_bytes: 588
l, r = map(int, input().split())
n = r-l+1
l = l%2019
r = r%2019
if n >= 2019:
    print(0)
else:
    if l > r:
        print(0)
    else:
        ans = 2018
        for i in range(l,r):
            for j in range(i+1,r+1):
                ans = min(ans,(j*i)%2019)
        print(ans)

Measured memory_bytes: 3060
n, m = map(int, input().split())
des= [0]*(n+1)
a = 1
for i in range(0, m):
	b = (list(map(int, input().split())))
	if b[0] == 1:
		des[b[1]] += 1
		if des[b[1]] == 2:
			print('POSSIBLE')
			a = 0
			break
	if b[1] == n:
		des[b[0]] += 1
		if des[b[0]] == 2:
			print('POSSIBLE')
			a = 0
			break
		
if a:
	print('IMPOSSIBLE')


Measured memory_bytes: 4596
eval'K,*X='+`dd`.split*?,
j=l=1
x,y,*s=X.map &:abs
d=x+y
x,y=y,x if f=x<y
K%2-d%2<0&&p(-1)+exit
d!=K&&(l+=[~-d/K,1].max
l+=1&d-K*l
v=K>(t=K*l-d>>1)?0:t-t=K
a=K-t
2.upto(l){s<<(u=f ?-t:a)<<a-t-u
a+=q=[x+v-a,K].min
t-=K-q})
puts l,s.map{|a|a*=X[j^=1]<=>0.1},X

Measured memory_bytes: 10240
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(ll i = 0;i<((ll)(n));i++)
#define reg(i,a,b) for(ll i = ((ll)(a));i<=((ll)(b));i++)
#define irep(i,n) for(ll i = ((ll)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(ll i = ((ll)(b));i>=((ll)(a));i--)
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;
template<class T = int> void print(vector<T> v){for(auto a:v)cout<<a<<" ";cout<<endl;}

/*
*/

ll n;

void init(){
	cin>>n;
}

int main(void){
	init();
	cout<<(n+1)/2<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <queue>
#include <map>
#include <bitset>
#include <string>
#include <set>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <cstring>
#include <iomanip>
#include <ctime>
//#include <unordered_map>
#include <stack>
#include <cstdlib>
#include <numeric>
#include <cassert>
#include <complex>
using namespace std;
#define maxn 3000007
#define maxm 400007
#define maxq 1000007
#define maxl 1234
#define modn 998244353
#define scan(a) scanf("%d",&a)
#define scanl(a) scanf("%lld",&a)
#define scanl2(a,b) scanf("%lld%lld",&a,&b)
#define scans(a) scanf("%s",a)
#define scans2(a,b) scanf("%s%s",a,b)
#define scand(a) scanf("%lf",&a)
#define scan2(a,b) scanf("%d%d",&a,&b)
#define scand2(a,b) scanf("%lf%lf",&a,&b)
#define scan3(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define scan4(a,b,c,d) scanf("%d%d%d%d",&a,&b,&c,&d)
#define scan5(a,b,c,d,e) scanf("%d%d%d%d%d",&a,&b,&c,&d,&e)
#define print(a) printf("%d\n",a);
#define printl(a) printf("%lld\n",a);
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define rrep(i,a,b) for(int i=a;i>= b;i--)
#define fscan(a) fscanf(stream,"%d", &a);
#define mp      make_pair	
#define pb      push_back
#define eb      emplace_back
#define mm(a,b) memset(a,b,sizeof a)
#define log2(n) (double)(log(n) / log(2.0))
#define _crt_disable_perfcrit_locks
#define bll __int128
typedef long long ll;
typedef unsigned long long ull;
const int inf = 0x3f3f3f3f;
typedef vector <int> vi;
typedef vector <ll> vll;
typedef map <ll, ll> mll;
typedef pair <ll, ll> pll;
typedef map <int, int> mii;
typedef pair <int, int> pii;
typedef map <char, int> mci;
typedef map <char, char> mcc;
typedef pair <char, int> pci;
typedef complex<double> cd;
typedef vector<complex<double> > vcd;

const double eps = 1e-8;
const double PI = 2 * acos(0.0);

int cc, bb; char ch; inline int F() {
	while (ch = getchar(), (ch < 48 || ch> 57) && ch != '-'); ch == '-' ? cc = bb = 0 : (cc = ch - '0', bb = 1);
	while (ch = getchar(), ch > 47 && ch < 58)cc = (cc << 1) + (cc << 3) + (ch ^ 48); return bb ? cc : -cc;
}
void write(int x) {
	int y = 10, len = 1;
	while (y <= x) { y *= 10; len++; }
	while (len--) { y /= 10; putchar(x / y + 48); x %= y; }
}
int main() {
	//ios::sync_with_stdio(0);
	//cin.tie(0);
	//FILE* stream = fopen("L:/20.in", "rb+")
	int k;
	int n;
	int a[200007];
	cin >> k >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	int res = min(min(k + a[0] - a[1], a[n - 1] - a[0]), k - a[n - 1] + a[n - 2]);
	for (int i = 1; i < n - 1; i++) {
		res = min(res, min(k + a[i] - a[i + 1], k - a[i] + a[i - 1]));
	}
	cout << res << endl;
	return 0;
}

Measured memory_bytes: 1152
#if __has_include("debug.h")
    #include "debug.h"
#else  
#include <bits/stdc++.h>
using namespace std;
#define d(...) 2;
#endif

#define int long long int
#define ld long double

#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define endl "\n"      

#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define ff first
#define ss second
#define eps 1e-10
#define PI acos(-1LL)

#define gcd(a,b)            __gcd((a),(b))
#define lcm(a,b)            ((a*b)/gcd(a,b))

void solve();

int32_t main()
{
    #ifdef DEBUG
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
    #endif 

    fast
    
    int t = 1;
	// cin>>t;
	
	while(t--)
	    solve();
	return 0;  
}

void solve()
{
	int i,j;
	int k,x;
	cin>>k>>x;

	if(k*500>=x)
	{
		cout<<"Yes"<<endl;
	}
	else
	{
		cout<<"No"<<endl;
	}

}

Measured memory_bytes: 3600
#!/usr/bin/env python
# -*- coding: utf-8 -*-

n = int(input())

for i in range(n):
    x = list(map(int, input().split()))
    x.sort()
    if x[0]**2 + x[1]**2 == x[2]**2:
        print('YES')
    else:
        print('NO')

Measured memory_bytes: 6724
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#define rep(i,a,n) for(ll i =(a);i<(n);i++)
#define urep(i,a,n) for(ll i = (a);i>=(n);i--)
#define all(x) (x).begin(),(x).end()
#define INF 1e18
const int mod = 1e9 + 7;
typedef long long ll;
using namespace std;
ll dx[4] = { 1,-1,0,0 };
ll dy[4] = { 0,0,1,-1 };
ll N,M,X,Y,A,B,C,Q;
string S,T;
ll ans;
ll x[1000000];
ll y[1000000];
ll h[1000000];
ll v[1000000];
ll a[1000000];
ll acopy[1000000];
ll gcd(ll a, ll b) {
	if (b == 0)return a;
	else return gcd(b, a%b);
}
int main() {
	cin>>N;
	rep(i,0,N){
		cin>>x[i]>>y[i]>>h[i];
	}
	rep(i,0,101){
		rep(j,0,101){
			ll H=0;
			rep(k,0,N){
				if(h[k]!=0){
					H=k[h]+abs(i-x[k])+abs(j-y[k]);
				}
			}
			rep(k,0,N){
				if(max(H-abs(x[k]-i)-abs(y[k]-j),0ll)!=h[k])break;
				if(k==N-1){
					cout<<i<<" "<<j<<" "<<H<<endl;
				}
			}
		}
	}
	return 0;
}


Measured memory_bytes: 6400