akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<ll>;
const int LIMIT = 1e9 + 7;
#define rep(i, n) for(int i=0; i<(int)n; i++)
#define all(v) (v).begin(), (v).end()

namespace /* debug */{
  #define DEBUG(...) do{cout<<#__VA_ARGS__<<" = ";debug(__VA_ARGS__);}while(0) //変数
  #define ldebug(...) do{cout<<"["<<setw(3)<<__LINE__<<"] ";debug(__VA_ARGS__);}while(0) //行数
  #define lDEBUG(...) do{cout<<"["<<setw(3)<<__LINE__<<"] "<<#__VA_ARGS__<<" = ";debug(__VA_ARGS__);}while(0) //変数, 行数
  template<class T>void show(T&x){cout<<x<<" ";} //出力
  template<class T>void showendl(T&x){cout<<x<<endl;} //出力改行
  template<class P,class Q>void show(pair<P,Q>&x){cout<<"("<<x.first<<", "<<x.second<<") ";} //pair出力
  template<class P,class Q>void showendl(pair<P,Q>&x){cout<<"("<<x.first<<", "<<x.second<<")"<<endl;} //pair出力改行
  template<class H>void debug(H&&h){showendl(h);} //引数1つ
  template<class H,class...Ts>void debug(H&&h,Ts&&...ts){show(h);debug(forward<Ts>(ts)...);} //可変引数
  template<class T>void debug(vector<T>&vt){int i=0;for(auto x:vt)++i!=vt.size()?show(x):showendl(x);} //vector出力
  template<class T>void debug(initializer_list<T>init){int i=0;for(auto x:init)++i!=init.size()?show(x):showendl(x);} //初期化子リスト出力
}

namespace /* ZahyoComp.cpp */ {
  template<class T>
  vector<T> compress(vector<T> &V){
    //Vを圧縮後の値にする 元の値を得るために重複削除ソート列であるSを返す
    vector<T> S = V;
    sort(S.begin(), S.end());
    S.erase( unique(S.begin(), S.end()), S.end() );
    for(int i=0; i<V.size(); i++){
      V[i] = lower_bound(S.begin(), S.end(), V[i]) - S.begin();
    }
    return S;
  }

  template<class T>
  vector<T> compress(vector<T> &V1, vector<T> &V2){
    //2つのVを一緒くたにして各々圧縮する 重複削除ソート列Sを返す
    vector<T> S;
    int N = V1.size();
    copy(V1.begin(), V1.end(), back_inserter(S));
    copy(V2.begin(), V2.end(), back_inserter(S));

    sort(S.begin(), S.end());
    S.erase( unique(S.begin(), S.end()), S.end() );
    for(int i=0; i<N; i++){
      V1[i] = lower_bound(S.begin(), S.end(), V1[i]) - S.begin();
      V2[i] = lower_bound(S.begin(), S.end(), V2[i]) - S.begin();
    }
    return S;
  }
}


int main(){
	int N;cin>>N;
  vi X1(N), X2(N), Y1(N), Y2(N);
  rep(i,N)cin>>X1[i]>>Y1[i]>>X2[i]>>Y2[i];

  vi X = compress(X1, X2);
  vi Y = compress(Y1, Y2);

  //DEBUG(X1);DEBUG(Y1);DEBUG(X2);DEBUG(Y2);

  //DEBUG(X);DEBUG(Y);

  int H = X.size();
  int W = Y.size();

  //圧縮した上で数える
  vector<vi> field(H, vi(W, 0));
  rep(i,N){
    for(int h=X1[i]; h<X2[i]; h++){
      for(int w=Y1[i]; w<Y2[i]; w++){
        field[h][w]++;
      }
    }
  }

  //rep(i,H)debug(field[i]);

  ll ans = 0;
  rep(i,H)rep(j,W)if(field[i][j]){
    ll rec = (X[i+1] - X[i]) * (Y[j+1] - Y[j]);
    //DEBUG(i,j,rec);
    ans += rec;
  }
  cout<<ans<<endl;
}


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

int main(){
  string S, T; cin >> S >> T;
  int A, B; cin >> A >> B;
  string U; cin >> U;
  if(S==U){
    cout << A-1 << " " << B << endl;
  }
  else if(T==U){
    cout << A << " " << B-1 << endl;
  }
  else{
    cout << A << " " <<  B << endl;
  }
}

Measured memory_bytes: 256
use std::io::*;
use std::str::FromStr;

pub fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let s: String = read();
    let sc: Vec<char> = s.chars().collect();
    let si: Vec<u32> = sc.iter().map(|x| x.to_digit(10).unwrap()).collect();
    let n = sc.len();

    for i in 0..(n / 2) {
        if si[i] != si[si.len() - 1 - i] {
            println!("No");
            return;
        }
    }
    println!("Yes");
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
int main(){
    int n;
    string s;
    cin >> n >> s;
    bool dp[11][11][11];
    rep(i,11){
        rep(j,11){
            rep(k,11){
                dp[i][j][k] = false;
            }
        }
    }
    dp[10][10][10] = true;
    //dp[n][10][10][10] = true;
    for(int i = n-1;i>=0;i--){
        int now = (s[i]-'0');
        rep(j,10){
            rep(k,10){
                if(dp[10][j][k]) dp[now][j][k]=true; 
            }
        }
        rep(j,10){
            if(dp[10][10][j]){
                dp[10][now][j]=true;
            }
        }
        dp[10][10][now]=true;
    }
    int ans = 0;
    rep(i,10){
        rep(j,10){
            rep(k,10){
                if(dp[i][j][k]) ans++;
            }
        }
    }
    cout << ans << endl;
}

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

int main(void)
{
    int N;
    cin >> N;

    for(int i = 0; ; i++)
    {
        if(4 * i > N) break;
        for(int j = 0; ; j++)
        {
            if(i * 4 + 7 * j > N) break;
            if(i * 4 + 7 * j == N)
            {
                cout << "Yes" << endl;
                return 0;
            }
        }

        
    }

    cout << "No" << endl;

    return 0;
}

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

typedef long long ll;
#define rep(i, n) for (int i = 0; i < n; i++)
#define all(v) v.begin(), v.end()
const ll MOD=1000000007;
int main(){
  long long N,D,x,y;
  int cnt=0;
    cin>>N>>D;
    for(int i=0;i<N;i++){
      cin>>x>>y;
      if(x*x+y*y<=D*D){
        cnt++;
      }
    }
  cout<<cnt<<endl;
  return 0;
}
    


Measured memory_bytes: 3592
N, M = map(int, input().split())
S = input()
T = input()

def gcd(m, n):
    x = max(m, n)
    y = min(m, n)
    if y == 0:
        return x
    else:
        return gcd(y, x%y)

def lcm(m, n):
	return int(m*n/gcd(m,n))


L = lcm(N, M)
X = {}


for i in range(0,N):
	X[i*L//N] = S[i]
# print(X)
for i in range(0,M):
	if X.get(i*L//M) != None:
		if X[i*L//M] != T[i]:
			print(-1)
			exit()
	else:
		pass
print(L)


Measured memory_bytes: 15396
#include<cstdio>
#include<vector>
#include<algorithm>
#include<utility>
#include<numeric>
#include<iostream>
#include<array>
#include<string>
#include<sstream>
#define _USE_MATH_DEFINES

#include<math.h>
#include<unordered_map>

#define min(a,b) (a)>(b)?(b):(a)
#define max(a,b) (a)>(b)?(a):(b)

using namespace std;

void shell_sort(int a[], int n)
{
	const int G[] = { 1, 8, 23, 77, 281, 1073, 4193, 16577, 65921, 262913, 1050113 };
	int cnt = 0;
	int m = 0;
	while (true)
	{
		m++;
		if (G[m] > n)
		{
			break;
		}
	}

	cout << m << endl;

	for (int i = m - 1; i != -1; i--)
	{
		for (int j = G[i]; j < n; j++)
		{
			int v = a[j];
			int k = j - G[i];
			while (k >= 0 && a[k] > v)
			{
				a[k + G[i]] = a[k];
				k -= G[i];
				cnt++;
			}
			a[k + G[i]] = v;
		}
		cout << G[i];
		if (i > 0)
		{
			cout << " ";
		}
	}
	cout << endl;
	cout << cnt << endl;
	for (int i = 0; i < n; i++)
	{
		cout << a[i] << endl;
	}
}

int main()
{
	int n;
	static int a[1000000];
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		cin >> a[i];
	}
	shell_sort(a, n);
	return 0;
}

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

int N;



/*
*/


struct l_info {
	int l_min;
	int l;
};

int main(){
	cin >> N;
	
	/*
	 ( で括弧レベルが上がる
	 ) で括弧レベルが下がる
	 Sの特徴を2つの数で表す。レベルの下限と、最終的なレベル
	*/
	vector<l_info> v(N);
	
	
	for ( int i = 0; i < N; i++ ){
		string s;
		cin >> s;
		int l_min = 0;
		int l = 0;
		for ( size_t j = 0; j < s.size(); j++ ){
			if ( s[j] == '(' )
				l++;
			else {
				l--;
				l_min = min( l_min, l );
			}
		}
		v[i] = {l_min, l};
	}
	
	auto f = [](const l_info &l, const l_info &r){
		/*
			上り坂が先
				0<l が先で l<=0 が後
			両方上り坂なら、
				l_minが小さい方が後
			両方下り坂なら、
				(l_min-l)が小さい方が先
			
			lが先ならtrueを返す
		*/
		bool l_up = l.l > 0;
		bool r_up = r.l > 0;
		if ( l_up && !r_up )	return true;
		if ( !l_up && r_up )	return false;
		
		if ( l_up && r_up )	return l.l_min > r.l_min;
		return (l.l_min-l.l) < (r.l_min-r.l);
	};
	sort(v.begin(),v.end(),f);
	
	int l = 0;
	int l_min = 0;
	for ( auto it : v ){
		l_min = min(l_min, l+it.l_min);
		l += it.l;
	}
	
//	for ( auto it : v ){
//		cout << "min=" << it.l_min << " l=" << it.l << endl;
//	}
//	cout << "-- min=" << l_min << " l=" << l << endl;
	
	cout << ( l == 0 && l_min >= 0 ? "Yes" : "No" ) << endl;
	
	return 0;
}



Measured memory_bytes: 11016
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
using u64 = unsigned long long;
#define REP(i, n) for (int i = 0; (i64)(i) < (i64)(n); ++i)

#ifdef ENABLE_DEBUG
template <typename T>
void debug(T value) {
  cerr << value;
}
template <typename T, typename... Ts>
void debug(T value, Ts... args) {
  cerr << value << ", ";
  debug(args...);
}
#define DEBUG(...)                              \
  do {                                          \
    cerr << " \033[33m (L" << __LINE__ << ") "; \
    cerr << #__VA_ARGS__ << ":\033[0m ";        \
    debug(__VA_ARGS__);                         \
    cerr << endl;                               \
  } while (0)
#else
#define debug(...)
#define DEBUG(...)
#endif

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int H, W, K;
  cin >> H >> W >> K;
  vector<string> grid(H);
  REP(i, H) { cin >> grid[i]; }
  i64 ans = 0;
  for (int s = 0; s < (1 << (H + W)); ++s) {
    vector<string> g = grid;
    REP(r, H) {
      if (~s & (1 << r)) continue;
      REP(c, W) { g[r][c] = 'x'; }
    }
    REP(c, W) {
      if (~s & (1 << (c + H))) continue;
      REP(r, H) { g[r][c] = 'x'; }
    }
    int cnt = 0;
    REP(r, H) REP(c, W) {
      if (g[r][c] == '#') ++cnt;
    }
    if (cnt == K) ++ans;
  }
  cout << ans << endl;
}

Measured memory_bytes: 3660
#include<stdio.h>
int main(void)
{
  int N,X,T,ans=0;
  //input
  scanf("%d %d %d",&N,&X,&T);
  //control
  if(N%X==0){
  	ans = (N/X)*T;
  }else{
    ans = (N/X+1)*T;
  }
  //output
  printf("%d",ans);
  return 0;
}

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

public class Program
{
    private int N, A, B;

    public void Solve()
    {
        var sc = new Scanner();
        N = sc.NextInt();
        A = sc.NextInt();
        B = sc.NextInt();

        if (A + B - 1 > N)
        {
            Console.WriteLine(-1);
            return;
        }

        if ((long) A * B < N)
        {
            Console.WriteLine(-1);
            return;
        }

        List<int> l = new List<int>();
        l.Add(A);
        int i = A;

        // N-A個をB-1個に分ける
        if (B > 1)
        {
            int d = (N - A) / (B - 1);
            int m = (N - A) % (B - 1);
            for (int j = 0; j < B - 1; j++)
            {
                int tmp = d;
                if (j < m) tmp++;
                l.Add(tmp);
            }
        }

        var ans = new int[N];
        int t = N;
        int index = 0;
        foreach (int i1 in l)
        {
            for (int j = i1 - 1; j >= 0; j--)
            {
                ans[index] = t - j;
                index++;
            }

            t -= i1;
        }

        Console.WriteLine(String.Join(" ", ans));
    }

    public static void Main(string[] args)
    {
        new Program().Solve();
    }
}

class Scanner
{
    public Scanner()
    {
        _pos = 0;
        _line = new string[0];
    }

    const char Separator = ' ';
    private int _pos;
    private string[] _line;

    #region スペース区切りで取得

    public string Next()
    {
        if (_pos >= _line.Length)
        {
            _line = Console.ReadLine().Split(Separator);
            _pos = 0;
        }

        return _line[_pos++];
    }

    public int NextInt()
    {
        return int.Parse(Next());
    }

    public long NextLong()
    {
        return long.Parse(Next());
    }

    public double NextDouble()
    {
        return double.Parse(Next());
    }

    #endregion

    #region 型変換

    private int[] ToIntArray(string[] array)
    {
        var result = new int[array.Length];
        for (int i = 0; i < array.Length; i++)
        {
            result[i] = int.Parse(array[i]);
        }

        return result;
    }

    private long[] ToLongArray(string[] array)
    {
        var result = new long[array.Length];
        for (int i = 0; i < array.Length; i++)
        {
            result[i] = long.Parse(array[i]);
        }

        return result;
    }

    private double[] ToDoubleArray(string[] array)
    {
        var result = new double[array.Length];
        for (int i = 0; i < array.Length; i++)
        {
            result[i] = double.Parse(array[i]);
        }

        return result;
    }

    #endregion

    #region 配列取得

    public string[] Array()
    {
        if (_pos >= _line.Length)
            _line = Console.ReadLine().Split(Separator);

        _pos = _line.Length;
        return _line;
    }

    public int[] IntArray()
    {
        return ToIntArray(Array());
    }

    public long[] LongArray()
    {
        return ToLongArray(Array());
    }

    public double[] DoubleArray()
    {
        return ToDoubleArray(Array());
    }

    #endregion
}

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

using namespace std;

typedef long long int ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int INF = 1000000000;
const ll LINF = (ll) 4000000000000000000;
const ll MOD = (ll) 1000000007;
const double PI = acos(1.0);
const int limit = 100010;

#define REP(i,m,n) for(ll i = m; i < (ll)(n); ++i)
#define rep(i,n) REP(i, 0, n)
#define MP make_pair
#define YES(n) cout << ((n) ? "YES" : "NO") << endl
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << endl
#define NP(v) next_permutation(v.begin(),v.end())
#define smaller_queue  priority_queue <ll, vector<ll>, greater<ll> >
#define smaller_queue_p  priority_queue <pll, vector<pll>, greater<pll> >
//------------------------------------------------------

template <typename T> class dijkstra {
public:

    struct edge {
        T to;
        ll cost;
    };

    typedef pair<ll, T> P;
    map<T, vector<edge> > E;
    map<T, ll> d;

    void calc(T s) {
        priority_queue <P, vector<P>, greater<P> > que; //greaterが未定義の場合は自分で作る
        rep(i, limit) d[i] = LINF;
        que.emplace(0LL, s);
        d[s] = 0;
        while (!que.empty()) {
            P p = que.top();
            que.pop();
            T v = p.second;
            if (d[v] < p.first) continue;

            for (auto& e : E[v]) {
                if (d[e.to] > d[v] + e.cost) {
                    d[e.to] = d[v] + e.cost;
                    que.emplace(d[e.to], e.to);
                }
            }
        }
    }
};

struct query {
    int u, v;
    ll a, b;
};

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

    int n, m, s, t;
    cin >> n >> m >> s >> t;
    vector<query> v;

    dijkstra<int> ds_yen, ds_snuke;

    rep(i, m) {
        query q;
        cin >> q.u >> q.v >> q.a >> q.b;
        ds_yen.E[q.u].push_back({q.v, q.a});
        ds_yen.E[q.v].push_back({q.u, q.a});
        ds_snuke.E[q.u].push_back({q.v, q.b});
        ds_snuke.E[q.v].push_back({q.u, q.b});
    }

    ds_yen.calc(s);
    ds_snuke.calc(t);
    ll Min = LINF;

    vector<ll> ans;

    for (int i = n; i >= 1; --i) {
        Min = min(Min, ds_yen.d[i] + ds_snuke.d[i]);
        ans.push_back((ll) 1e15 - Min);
    }

    reverse(ans.begin(), ans.end());
    for (auto a : ans) cout << a << endl;
    return 0;
}


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

using namespace std;

#define ll long long
#define dd double

struct info
{
	ll w;
	ll v;
	dd ra;
};

ll n;
info a[101];
ll dp[101][100001];

ll rot(ll i,ll w)
{
	if(i==n)
	{
		return 0;
	}
	if(dp[i][w]!=-1)
	{
		return dp[i][w];
	}
	ll ans = 0;
	ans = max(ans,rot(i+1,w));
	if((w-(a[i].w))>=0)
	{
		ans = max(ans,rot(i+1,w-(a[i].w))+(a[i].v));
	}
	dp[i][w] = ans;
	return ans;
}

int main()
{
	for(ll i = 0;i<101;i++)
	{
		for(ll j = 0;j<100001;j++)
		{
			dp[i][j] = -1;
		}
	}
	ll w;
	cin>>n>>w;
	for(ll i = 0;i<n;i++)
	{
		cin>>a[i].w>>a[i].v;
		a[i].ra = a[i].v/a[i].w;
	}
	ll ans = rot(0,w);
	cout<<ans<<endl;
}

Measured memory_bytes: 79104
#include<iostream>
#include<string>
#include<vector>
#include<math.h>
#include<map>
#include<algorithm>
#include<set>
#include <stdexcept>
#define rep(i,N) for(int i=0;i<(N);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
typedef long long ll;
int ceil(int a,int b){// a以上でｂの倍数の最小値を出力//
    return (a+b-1)/b*b;
}
int stoii(string s){ //stoi関数の代用//
    return atoi(s.c_str());
}
int main(void){
    int n;
    cin>>n; 
    vector<int> t(n,0);
    rep(i,n) cin>>t[i];
    int m;
    cin>>m;
    vector<int> p(m,0),x(m,0);
    rep(i,m) cin>>p[i]>>x[i];
    rep(i,m){
        int sum=0;
        rep(j,n){
            if(j==p[i]-1) sum+=x[i];
            else sum+=t[j];
        }
        cout<<sum<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
import java.util.*;
import java.util.List;
import java.util.ArrayList;
import java.math.*;
class Main{
    public static void main(String[]args){
        Scanner scanner = new Scanner(System.in);
        int A = scanner.nextInt();
        int B = scanner.nextInt();

        System.out.println(A*B);

    }

}

Measured memory_bytes: 35588
#include<stdio.h>
#include<string.h>
#define LEN 100005

typedef struct pp{
  char name[100];
  int t;
}P;

P Q[LEN];
int head=0, tail=0, n;

void enqueue(P );
P dequeue(void);


int main(){
  int elaps = 0, c,count=0;
  int i, q,x;
  P u;
  scanf("%d %d", &n, &q);

  for ( i = 0; i < n; i++){
    scanf("%s", Q[i].name);
    scanf("%d", &Q[i].t);
    enqueue(Q[i]);
  }

  while(count!=n){
    
    u=dequeue();
    c=u.t-q;
    if(c==0){
      elaps+=q;
      printf("%s %d\n",u.name,elaps);
      count++;
    }
     else if(c<0){
      x=q-(-c);
      elaps+=x;
      printf("%s %d\n",u.name,elaps);
      count++;
    }
     else{
	elaps+=q;
	u.t=c;
	enqueue(u);
	}
  
  }

  return 0;
}

void enqueue(P x){

  Q[tail]=x;
  if(tail+1==n)tail=0;
  else tail++;
}

P dequeue(void){

  P x;

  x=Q[head];
  if(head+1==n) head=0;
  else head=head+1;

  return x;
  }

Measured memory_bytes: 6736
import java.util.Arrays;
import java.util.Scanner;
public class Main
{
	public static void main(String[] args) 
	{
		Scanner in=new Scanner(System.in);
		int M=100000;
		boolean a[]=new boolean[M+1];
		Arrays.fill(a, true);
		a[0]=a[1]=false;
		for(int i=2;i*i<=M;i++)
		{
			if(!a[i])
				continue;
			for(int j=i*2;j<=M;j+=i)
				a[j]=false;
		}
		for(;;)
		{
			int n=in.nextInt();
			if(n==0)
				return;
			int ans=0;
			for(int i=0;i<=n;i++)
			{
				if(!a[i])
					continue;
				for(int j=i;j<=n;j++)
				{
					if(!a[j])
						continue;
					if(i+j==n)
						ans++;
				}
			}
			System.out.println(ans);
		}
	}
}

Measured memory_bytes: 12000
//参考：http://ehafib.hatenablog.com/entry/2015/12/23/164517
//インクルード
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//イテレータあるけど順序保持しないmap
#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列

using namespace std;
typedef long long ll;

//マクロ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(b);i--)
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))
#define INF 1000000000000
#define MOD 10000007
#define PB push_back
#define MP make_pair
#define F first
#define S second

int main(int argc, char const *argv[]) {
  int n,ans;
  std::cin >> n;

  if (n % 2 == 0) std::cout << n/2 << '\n';
  else std::cout << n/2+1 << '\n';
  return 0;
}


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

struct Point{
    double x;
    double y;
};

void PrintPoint(Point p){
    printf("%.8f %.8f\n", p.x, p.y);
}

void koch(int d, Point p1, Point p2){
    if(d == 0){
        return;
    }
    Point s, t, u;
    double th = M_PI * 60.0 / 180.0;

    s.x = (p1.x * 2 + p2.x) / 3;
    s.y = (p1.y * 2 + p2.y) / 3;
    t.x = (p1.x + 2 * p2.x) / 3;
    t.y = (p1.y + 2 * p2.y) / 3;
    u.x = (t.x - s.x) * cos(th) - (t.y - s.y) * sin(th) + s.x;
    u.y = (t.x - s.x) * sin(th) + (t.y - s.y) * cos(th) + s.y;

    koch(d-1, p1, s);
    PrintPoint(s);
    koch(d-1, s, u);
    PrintPoint(u);
    koch(d-1, u, t);
    PrintPoint(t);
    koch(d-1, t, p2);
}

int main(){
    int d;
    scanf("%d", &d);
    Point p1, p2;
    p1.x = 0.0; p1.y = 0.0;
    p2.x = 100.0; p2.y = 0.0;
    
    PrintPoint(p1);
    koch(d, p1, p2);
    PrintPoint(p2);

    return 0;
}


Measured memory_bytes: 3212
n = int (input())
p = list(map(int,input().split()))
ans = 0
for i in range(1,n-1):
    if min(p[i-1],p[i],p[i+1]) != p[i] and max(p[i-1],p[i],p[i+1]) != p[i]:
        ans+=1
print(ans)
        

Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <algorithm>
#include <cmath>
#include <numeric>

using namespace std;

int main()
{
    int n;
    int ta = 0, h = 0;

    cin >> n;

    for (int i = 0; i < n; i++) {
        string s, t;
        cin >> s >> t;
        if (s > t) {
            ta += 3;
        }
        else if (s < t) {
            h += 3;
        }
        else {
            ta++;
            h++;
        }
    }

    cout << ta << " " << h << endl;
}




Measured memory_bytes: 3212
#include<bits/stdc++.h>
#define REP(x,y,z) for(int x=y;x<=z;x++)
#define MSET(x,y) memset(x,y,sizeof(x))
#define M 10005
#define MOD 1000000007
using namespace std;
using LL = long long;
char in[M];
int dp[M][102][2], d, n;
int cnt_digits(int x) {
    vector<int> dp2[2];
    dp2[0] = vector<int> (102);
    dp2[1] = vector<int> (102);
    dp2[0][0] = 1;
    int fr=0, cur=1;

    REP(i,0,x-1) {
        fill(dp2[cur].begin(), dp2[cur].end(), 0);

        REP(j,0,d-1) REP(k,0,9) {
            dp2[cur][(j+k)%d] += dp2[fr][j];
            dp2[cur][(j+k)%d] %= MOD;
        }
        swap(cur, fr);
    }
    return (dp2[fr][0] + MOD - 1) % MOD;
}
int main()
{
    scanf("%s %d", in+1, &d);
    n = strlen(in+1);

    REP(i,1,in[1]-'0'-1) dp[1][i%d][0] += 1;
    dp[1][(in[1]-'0')%d][1] += 1;

    REP(i,1,n-1) REP(j,0,d-1) REP(k,0,1) if (dp[i][j][k]) {

        int cd = in[i+1] - '0';
        REP(nd,0,9) {
            if (k==1 && nd>cd) continue;

            int i2 = i+1;
            int j2 = (j + nd) % d;
            int k2 = k==1 && nd==cd;
            dp[i2][j2][k2] += dp[i][j][k];
            dp[i2][j2][k2] %= MOD;
        }
    }

    int ans = cnt_digits(n-1);
    ans = (ans + dp[n][0][0]) % MOD;
    ans = (ans + dp[n][0][1]) % MOD;
    printf("%d\n", ans);
    return 0;
}


Measured memory_bytes: 11772
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<math.h>
#include<iomanip>
#include<stdio.h>
#include<cstring>
using namespace std;
 
int main(){

  int n, y, a, b, c;
  cin >> n >> y;

  for(int i=0; i<=n; i++){
    for(int j=0; j<=n-i; j++){
      if(y==10000*i+5000*j+1000*(n-i-j)){
        cout << i <<" "<< j <<" "<< n-i-j << endl;
        return 0;
      }
    }
  }

  cout << -1 <<" "<< -1 <<" "<< -1 << endl;

  return 0;
}

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

int main() {
	
	int R, G, B, N; cin >> R >> G >> B >> N;
	int ans = 0;
	int rNum = ceil(N / R);
	int gNum = ceil(N / G);
	int bNum = ceil(N / B);
	for (int r = 0; r <= rNum; r++) {
		for (int g = 0; g <= gNum; g++) {
			int tmp = N - r * R - g * G;
			if (tmp < 0) continue;
			if (tmp % B != 0) continue;
			ans++;
		}
	}
	cout << ans << endl;
	return 0;
}

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

//repetition
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)

//container util
#define all(x) (x).begin(),(x).end()

//typedef
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VLL;
typedef vector<VLL> VVLL;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;

//const value
//const ll MOD = 1e9 + 7;
//const int dx[] = {0,1,0,-1};//{0,0,1,1,1,-1,-1,-1};
//const int dy[] = {1,0,-1,0};//{1,-1,0,1,-1,0,1,-1};

//conversion
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
inline ll toLL(string s) {ll v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}


int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n,m;
  cin >> n >> m;
  vector<PLL> a(n);
  VLL b(n);

  rep(i,n){
    cin >> a[i].first >> b[i];
    a[i].second = i;
  }

  sort(all(a));
  priority_queue<ll> que;
  ll idx = 0;
  ll ans = 0;
  FOR(i,1,m+1){
    while(idx < n){
      if(a[idx].first <= i){
        que.push(b[a[idx].second]);
        idx++;
      }else{
        break;
      }
    }
    if(que.empty() == false){
      ans += que.top();
      que.pop();
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3832
#include<bits/stdc++.h>
using namespace std;
int main()
{
	string a;
	cin>>a;
	int b=a.length();
	int n=0,s=0,e=0,w=0;
	for(int i=0;i<b;i++)
	{
		if(a[i]=='N') n++;
		else if(a[i]=='S') s++;
		else if(a[i]=='E') e++;
		else if(a[i]=='W') w++;
	}
	if(n>0&&s>0&&e>0&&w>0)
	{
		cout<<"Yes"<<endl;
	}
	else if(n>0&&s>0&&e==0&&w==0)
	{
		cout<<"Yes"<<endl;
	}
	else if(e>0&&w>0&&n==0&&s==0)
	{
		cout<<"Yes"<<endl;
	}
	else cout<<"No"<<endl;
 	return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <map>
#include <numeric>
#include <cmath>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <complex>
#include <string.h>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <iomanip>
#include <sys/time.h>
#include <tuple>
#include <random>
using namespace std;

#define endl '\n'
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define UNIQ(v) (v).erase(unique((v).begin(), (v).end()), (v).end())

typedef long long ll;
typedef long double ld;
typedef pair<int, int> P;
typedef complex<double> comp;
typedef vector< vector<ld> > matrix;
struct pairhash {
public:
    template<typename T, typename U>
    size_t operator()(const pair<T, U> &x) const {
	size_t seed = hash<T>()(x.first);
	return hash<U>()(x.second) + 0x9e3779b9 + (seed<<6) + (seed>>2);
    }
};
const int inf = 1e9 + 9;
const ll mod = 1e9 + 7;
const double eps = 1e-8;
const double pi = acos(-1);

ll n, k;

ll solve() {
    if (n % k == 0) return 0;
    ll a = n % k;
    ll b = k - a;
    return min(a, b);
}

void input() {
    cin >> n >> k;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(15);

    input();
    cout << solve() << endl;
}


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

#define ll long long
#define endl "\n"
#define mp(x,y) make_pair(x,y)
#define pb(x) push_back(x)
#define f first
#define s second
#define vecll vector<ll>
#define pairll pair<ll,ll>
#define vecpairll vector<pair<ll,ll>>
#define mapllll map<ll,ll>
#define mapstrll map<string,ll>
#define mapllvecll map<ll,vecll>
#define setll set<ll>
#define fio ios_base::sync_with_stdio (false); cin.tie (NULL); cout.tie(NULL);

using namespace std;

ll const N=1e5+5;
ll const inf=1e18+5;
ll const MOD=1e9+7;

ll t,n,m,x,y,z,w,k;

int main()
{
    fio

    cin>>n;

    if((n%2))   cout<<0;
    else
    {
        n /= 2;

        ll ans = 0;
        while(n)
        {
            n /= 5;
            ans += n;
        }
        cout<<ans;
    }


    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
 
int main(){
  string S;
  cin>>S;
  vector<int> s(S.length());
  int ans=1000;
  rep(i,S.length()-2){
    int a=S[i]-'0';
    int b=S[i+1]-'0';
    int c=S[i+2]-'0';
    int x=100*a+b*10+c;
    ans=min(ans,abs(753-x));
  }
  cout<<ans<<endl;
}

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

int main(){
  int A, B, C, K;
  cin >> A >> B >> C >> K;
  if(A>=K){
    cout << K << endl;
    return 0;
  }else if(B>=K-A){
    cout << A << endl;
    return 0;
  }
  cout << A+(-1)*(K-A-B) << endl;
  return 0;
}

Measured memory_bytes: 3592
n, k = gets.split.map(&:to_i)
s = gets.chomp.split("").map(&:to_i)
ary = [];
f = nil
s.each_with_index do |i, idx|
  ary << [i.odd?, idx] if ary.empty? || i.odd? != ary.last[0]
end
ary << [nil, n]

c = [ary.size-k*2-1, 0].max
res = (0..c).map do |i|
  len = k * 2
  len += 1 if ary[i][0]
  len = ary.size - i - 1 if i + len > ary.size - 1
  ary[i+len][1] - ary[i][1]
end.max

puts res


Measured memory_bytes: 13564
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
#define MOD 1000000007
 
typedef long long ll;
typedef unsigned int ui;
typedef unsigned long long ull;
template <class T>
void print(T& x){printf("%d\n", x);}
void printvec(vector<int> a){
    rep(i, a.size()-1){
        printf("%d ", a[i]);
    }
    printf("%d\n", a[a.size()-1]);
}
 
int main()
{
    int N, Q;
    cin >> N >> Q;
    vector<ll> a(N);
    rep(i, N){
        a[i] = 0;
    }
    int com, s, t;
    ll ans;
    rep(i, Q){
        cin >> com >> s >> t;
        if(com==0){
            a[s-1] += t;
        }else if(com==1){
            ans = 0;
            FOR(j, s-1, t){
                //if(ans > a[j]) 
                ans += a[j];
            }
            print(ans);
        }
    }
    return 0;
}


Measured memory_bytes: 3544
import Data.Functor ((<$>))
import Control.Monad (replicateM_)

main :: IO ()
main = do
  [h, w] <- map (read :: String -> Int) . words <$> getLine
  if h == 0 && w == 0
    then return ()
    else printRect h w >> putChar '\n' >> main
    where printRect h w = replicateM_ h (putStrLn (replicate w '#'))



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

int main() {
    int j,a,b,c,n;
    long long count=0;
    long long k;
    long long i=0;
    int sum=0;
    string s;
    cin>>s;
    cin>>k;
    while(s[i]=='1'){count++;i++;}
    if(count>=k){cout<<'1';}
    else{cout<<s[i];}

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
ll a[100005];
ll boom[100005];
int main()
{
    //ios::sync_with_stdio(false);
	ll n,q;
	cin>>n;
	for (ll i = 0; i < n; i++)
	{
		cin>>a[i];
		boom[a[i]]++;
	}
	cin>>q;
	ll ans=0;
	for (ll i = 1; i <100005; i++)
	{
		ans+=i*boom[i];
	}
	for (ll i = 0; i < q; i++)
	{
		int a,b;
		cin>>a>>b;
		if(boom[a]!=0)
		{
			boom[b]+=boom[a];
			ans-=boom[a]*(a-b);
			boom[a]=0;
			cout<<ans<<endl;
		}
		else
			cout<<ans<<endl;
			
	}
	return 0;
}



Measured memory_bytes: 5068
//BITが書けるかcheck　ライブラリcheckではないので注意

#include <bits/stdc++.h>
#ifndef ONLINE_JUDGE
#define _GLIBCXX_DEBUG
#endif
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = s; i < (int)(n); i++)
#define Clear(a) a = decltype(a)()
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define vec vector
typedef long long ll;
typedef pair<ll,ll> P;
//const ll big=998244353;
const ll big=1000000007LL;
const ll INF=1e18;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
ll max(ll x,ll y){
if(x>y)return x;
else return y;
}
ll min(ll x,ll y){
if(x<y)return x;
else return y;
}
ll expm(ll x,ll y){
    if(y==0)return 1;//0^0=1
    if(x==1||x==0)return x;
    if(y%2==1)return (expm(x,y-1)*x)%big;
    ll t=expm(x,y/2);
    return (t*t)%big;
}
ll exp(ll x,ll y){
    if(y==0)return 1;//0^0=1
    if(x==1||y==0)return x;
    if(y%2==1)return exp(x,y-1)*x;
    ll t=exp(x,y/2);
    return t*t;
}


struct BIT{
    int n;
    vector<ll> a;
    BIT(const int n_):n(n_) , a(n+1){};
    void add(int i,ll x){
        for(int idx=i;idx<=n;idx += (idx & -idx))a[idx]+=x;
    }
    ll sum(int i){
        ll res=0;
        for(int idx=i;idx>0; idx -= (idx & -idx))res+=a[idx];
        return res;
    }
};

int main(){
    ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    cout << fixed << setprecision(10);
    /*--------------------------------*/

    int n,q;cin >> n >> q;
    BIT tree(n);
    rep(i,n){
        int a;cin >> a;
        tree.add(1+i,a);
    }
    rep(i,q){
        int com,l,r;cin >> com >> l >> r;
        if(com==0)tree.add(l+1,r);
        else cout << tree.sum(r) - tree.sum(l) << '\n';
    }
}

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

typedef long long ll;
typedef pair<int,int> P;

#define p_ary(ary,a,b,i) do { cout << "["; for (int (i) = (a);(i) < (b);++(i)) cout << ary[(i)] << ((b)-1 == (i) ? "" : ", "); cout << "]\n"; } while(0)
#define p_map(map,it) do {cout << "{";for (auto (it) = map.begin();;++(it)) {if ((it) == map.end()) {cout << "}\n";break;}else cout << "" << (it)->first << "=>" << (it)->second << ", ";}}while(0)

int main() {
    int n;
    cin >> n;
    vector<int> a(n),b(n);
    for (int i = 0;i < n;++i) scanf("%d",&a[i]);
    for (int i = 0;i < n;++i) scanf("%d",&b[i]);
    priority_queue<P> que;
    bool ans = true;
    ll cnt = 0;
    for (int i = 0;i < n;++i) {
        if (b[i] < a[i]) ans = false;
        else if (b[i] > a[i]) que.push(P(b[i],i));
    }
    while (ans && !que.empty()) {
        P t = que.top();
        que.pop();
        int i = t.second;
        int s = b[i-1+(i ? 0 : n)]+b[i+1-(i < n-1 ? 0 : n)];
        if (b[i]-s < a[i]) {
            ans = false;
        }
        cnt += (b[i]-a[i])/s;
        b[i] -= (b[i]-a[i])/s*s;
        t.first = b[i];
        if (t.first > a[i]) {
            que.push(t);
        }
    }
    cout << (ans ? cnt : -1) << endl;
    return 0;
}

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

int main(){
  int N;
  cin >> N;
  int A[N];
  for(int i = 0; i < N; i++){
    cin >> A[i];
    A[i] -= i + 1;
  }
  sort(A, A+N);
  ll ans = 0;
  if(N % 2 == 0){
    if(abs(A[(N-1)/2]) > abs(A[(N+1)/2])) {
      for(int i = 0; i < N; i ++){
        ans +=  abs(A[i] - A[(N-1)/2]);
      }
    } else {
      for(int i = 0; i < N; i ++){
        ans +=  abs(A[i] - A[(N+1)/2]);
      }
    }
  } else {
    for(int i = 0; i < N; i ++){
      ans +=  abs(A[i] - A[(N-1)/2]);
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1024
#include "bits/stdc++.h"
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define all(a) a.begin(),a.end()
int main(){
  int n;
  cin>>n;
  vector<int> a(n);
  rep(i,n)cin>>a[i];
  sort(all(a));
  int ans=0;
  rep(i,n)rep(j,n)if(i<j){
    int u=lower_bound(all(a),a[j]+a[i])-a.begin();
    
    ans+=max(u-1-j,0);
    
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>

int N,D;
int X[10][10];
int count;
int result=0;
int untiburiburi = 0;
double unti = 0;
int main (void){
  if(scanf("%d%d",&N,&D)==1);
  for(int i = 0;i < N;i++){
    for(int j = 0;j < D;j++){
      scanf("%d",&X[j][i]);
    }
  }
  for(int i = 0;i < N;i++){
    for(int j = i + 1;j < N;j++){
      for(int n = 0;n < D;n++){
        result = (X[n][i] - X[n][j]) * (X[n][i]-X[n][j]);
        untiburiburi = untiburiburi  + result;
      }
      unti = sqrt(untiburiburi);
      if(unti-(int)(unti) == 0){
        count++;
      }
      untiburiburi = 0;
    }
  }
  printf("%d\n",count);
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll, ll> Pll;
#define debug(var)  do{std::cout << #var << " : ";view(var);}while(0)
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

const int MOD = 1000000007;
const int INF = 1e9;

const int mod = 1000000007;
const int inf = 1e9;
#define PI acos(-1);
int dx[4] = {1,-1,0,0};
int dy[4] = {0,0,1,-1};
int ddx[8] = {1,1,1,-1,-1,-1,0,0};
int ddy[8] = {0,1,-1,0,1,-1,1,-1};


int main(){
    ll q, h, s, d;
    cin >> q >> h >> s >> d;
    q*=4, h*=2;
    ll p = min({q, h, s});
    ll n;
    cin >> n;
    if(p*2 <= d) {
        ll ans = n*p;
        cout << ans << endl;
    }else{
        ll ans = n/2*d+(n%2)*p;
        cout << ans << endl;
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for(int i=0;i<(int)n;i++)
#define PI acos(-1)
#define fast_io ios_base::sync_with_stdio(false) ; cin.tie(0); cout.tie(0);
ll mod=1e9+7;

ll rep_pow(ll a, ll b){//繰り返し2乗法
    if(b==0) return 1;
    else if(b%2==0){
        ll memo = rep_pow(a, b/2);
        return memo*memo%mod;
    }else{
        return rep_pow(a, b-1)*a%mod;
    }
}

ll nCr(ll n, ll r){//mod逆元使ったnCr
    ll ret=1;
    rep(i,r){
        ret *= n-i;//分子
        ret %= mod;
        ret *=rep_pow(r-i, mod-2);//mod逆元によりr!で割ると同値
        ret %= mod;
    }
    return ret;
}
ll gcd(ll a, ll b){ if(b==0) return a; return gcd(b, a%b);}

int counter(int x){
    if(x==0) return 0;
    return counter(x>>1)+(x&1);
}
int main(){
    fast_io

    ll a, b, c, d;
    cin>>a>>b>>c>>d;
    a--;
    
    ll e=c*d/__gcd(c,d);
    ll x=a/c+a/d-a/e;
    ll y=b/c+b/d-b/e;
    cout<<b-a-(y-x)<<endl;
    return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define pb push_back
const int maxn = 10000;
const int INF32 = 1'050'000'000;
const long long INF64 = 4'000'000'000'000'000'000;
const int MOD7 = 1'000'000'007;
const int MOD9 = 1'000'000'009;

ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
int dx[8]={-1,0,1,0,1,1,-1,-1};
int dy[8]={0,-1,0,1,1,-1,1,-1};

int main()
{
    int a, b, c;
    cin >> a >> b >> c;
    if(a == b && a!= c) cout << "Yes" << endl;
    else if(a==c && a!=b) cout << "Yes" << endl;
    else if(b==c && b!=a) cout << "Yes" << endl;
    else cout << "No" << endl; 
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
	"strings"
)

func main() {
	a := reads()
	b := reads()
	yesOrNo(a[:len(a)] == b[:len(a)])
}

// IO---------------------------------------------------

func readi() (n int) {
	fmt.Scan(&n)
	return
}

func readf() (n float64) {
	fmt.Scan(&n)
	return
}

func reads() (n string) {
	fmt.Scan(&n)
	return
}

var rdr = bufio.NewReaderSize(os.Stdin, 1000000)

func readLine() string {
	buf := make([]byte, 0, 1000000)
	for {
		l, p, e := rdr.ReadLine()
		if e != nil {
			panic(e)
		}
		buf = append(buf, l...)
		if !p {
			break
		}
	}
	return string(buf)
}

func readSlice() []string {
	return strings.Split(readLine(), " ")
}

func atoi(a []string) (b []int) {
	b = make([]int, len(a))
	for i := range a {
		b[i], _ = strconv.Atoi(a[i])
	}
	return
}

func atof(a []string) (b []float64) {
	b = make([]float64, len(a))
	for i := range a {
		b[i], _ = strconv.ParseFloat(a[i], 64)
	}
	return
}

func readSlice2(n int) (a []int, b []int) {
	a = make([]int, n)
	b = make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&a[i], &b[i])
	}
	return
}

func readFloatSlice2(n int) (a []float64, b []float64) {
	a = make([]float64, n)
	b = make([]float64, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&a[i], &b[i])
	}
	return
}

func yesOrNo(b bool) {
	if b {
		fmt.Println("Yes")
		return
	}
	fmt.Println("No")
}

func yesorNO(b bool) {
	if b {
		fmt.Println("YES")
		return
	}
	fmt.Println("NO")
}

func yesorno(b bool) {
	if b {
		fmt.Println("yes")
		return
	}
	fmt.Println("no")
}

// calc---------------------------------------------------

func abs(a int) int {
	if a > 0 {
		return a
	}
	return -a
}

func ave(a []int) (ave int) {
	for i := 0; i < len(a); i++ {
		ave += a[i]
	}
	ave /= len(a)
	return
}

func eq(a []string, b []string) bool {
	for i := 0; i < len(a); i++ {
		if a[i] != b[i] {
			return false
		}
	}
	return true
}

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

func max(a ...int) int {
	max := a[0]
	for i := 1; i < len(a); i++ {
		if max < a[i] {
			max = a[i]
		}
	}
	return max
}

func min(a ...int) int {
	min := a[0]
	for i := 1; i < len(a); i++ {
		if min > a[i] {
			min = a[i]
		}
	}
	return min
}

func mid(a []int) int {
	sort.Ints(a)
	return a[len(a)/2]
}

func sum(a []int) (ans int) {
	for i := range a {
		ans += a[i]
	}
	return
}


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

typedef long long ll;
#define SZ(a) (int)a.size()
#define PB push_back
//#define cerr if(false)cerr
#define print(x) cerr<<"\n" << (#x) << " is " << (x) << endl;



int nearer(int ss){
	if( ss - 0 <= 10-ss)
		return 0;
	else return 10;
}

int main(){
	//long long ans = 0;
	string s;
	cin >> s;
	//cout<<s.size() << endl;
	//int c = 0;
	//for(int i=SZ(s)-1; i>=0; i--){
		//int l = s[i]-'0';
		//l += c;
		//print(l);
		//print(nearer(l));
		//if(nearer(l) == 10){
			//c = 1;
			//ans += 10-l;
		//}
		//else{
			//c = 0;
			//ans += l;
		//}
	//}
	//cout << ans + c << endl;
	reverse(s.begin(), s.end());
	int dp[SZ(s)+1][2];
	dp[0][0] = s[0]-'0';
	dp[0][1] = 10 - (s[0]-'0');
	for(int i=1; i<SZ(s); i++){
		dp[i][0] = min(dp[i-1][0] + (s[i]-'0'), dp[i-1][1] + (int)(s[i]-'0') + 1);
		dp[i][1] = min(dp[i-1][0] + (10 -  (s[i]-'0')), dp[i-1][1]+10-(s[i]-'0')-1);
	}
	dp[SZ(s)][0] = min(dp[SZ(s)-1][0], dp[SZ(s)-1][1]+1);
	//for(int i=0; i<=SZ(s); i++){
		//cout << dp[i][0] << " " << dp[i][1] << endl;
	//}
	cout << dp[SZ(s)][0] << endl;
}
		 


Measured memory_bytes: 9220
# -*- coding: utf-8 -*-

n = int(input())
p = list(map(int, input().split()))

ans = 0
for i in range(1, n-1):
    if p[i+1] < p[i] < p[i-1] or p[i-1] < p[i] < p[i+1]:
        ans += 1

print(ans)

Measured memory_bytes: 3060
import Control.Applicative
import qualified Data.IntMap.Strict as Map
import Data.List (sort)

main = do
  [_,capa] <- map (read :: String -> Int) . words <$> getLine
  goods <-map (map (read :: String -> Int) . words) . lines <$> getContents
  let maxValue = foldl1 (+) $ map head goods
  let ans = resolve capa maxValue (Map.fromList (zip [0..maxValue] [0,0..])) (reverse (sort goods))
  print $ if Map.null ans then 0 else fst $ Map.findMax ans

resolve capa maxValue valueMap ([v,w]:xs)
  | xs == []  = Map.filter (>0) koushin'
  | otherwise = resolve capa maxValue koushin' xs
  where
    koushin'
      | capa < w  = valueMap
      | otherwise = koushin valueMap [v,w] (maxValue-v)
    koushin valueMap [v,w] n
      | n == 0 && valueMap Map.! v > w        = Map.insert v w valueMap
      | n == 0 && oldWight == 0              = Map.insert v w valueMap
      | n == 0                                = valueMap
      | oldWight == 0                         = next
      | w + oldWight > capa                  = next
      | (w + oldWight >= newWight) && newWight /= 0 = next
      | otherwise = koushin (Map.insert (n+v) (w + oldWight) valueMap) [v,w] (n-1)
      where
        oldWight = valueMap Map.! n
        newWight =valueMap Map.! (n+v)
        next     = koushin valueMap [v,w] (n-1)

Measured memory_bytes: 6548
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,a) for(int i=0;i<(a);i++)
const ll MOD=1000000007;
// const ll MOD=998244353;

int main(){
  int P,Q,R; cin>>P>>Q>>R;
  cout<<P+Q+R-max({P,Q,R})<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <cmath>
#include <vector>
#include <numeric>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <tuple>

using ll = long long int;
using ul = unsigned long long int;
const ll LL_MAX (1LL<<60);
const ll MOD (1000000007);

#define rep(i,s,e) for(ll i=(s); i<(e); i++) 

using namespace std;

using T = tuple<ll,ll>;
using Graph = vector<vector<T>>;

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

    ll a, b, c, d;
    cin >> a >> b >> c >>d;

    while (true)    
    {
        c -= b; 
        if (c<=0)
        {
            cout << "Yes" << endl;
            return 0;
        }
        a -= d;
        if (a<=0)
        {
            cout << "No" << endl;
            return 0;
        }
    }

    return 0;
}


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

#define pout(n)  printf ("%d\n", n)

#define rep(i,a,n) for (int i = a;i < n;i++)
#define per(i,n,a) for (int i = n-1;i >= a;i--)

typedef long long int ll;
using namespace std;
 
int main (){
  char card[3][101] = {0};
  int acount = 0;
  int bcount = 0;
  int ccount = 0;
  char turn = 'a';

  rep(i,0,3){
    cin >> card[i];
  }
  
  while(1){
    if(turn == 'a'){
      turn = card[0][acount];
      if(!turn){
        printf("A\n");
        break;
      }
      acount++;
    }
    else if(turn == 'b'){
      turn = card[1][bcount];
      if(!turn){
        printf("B\n");
        break;
      }
      bcount++;
    }
    else{
      turn = card[2][ccount];
      if(turn == 0){
        printf("C\n");
      break;
      }
      ccount++;
    }
  }
  return 0;
}

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

int gcd(int a, int b)
{
    return b == 0 ? a : gcd(b, a % b);
}

typedef long long ll;

int main()
{
    ll a, b;
    cin >> a >> b;
    cout << a * b / gcd(a, b);
    return 0;
}

Measured memory_bytes: 256
// C++ program to find the longest repeated
// non-overlapping substring
#include<bits/stdc++.h>
using namespace std;

// Returns the longest repeating non-overlapping
// substring in str
string longestRepeatedSubstring(string str)
{
	int n = str.length();
	int LCSRe[n+1][n+1];

	// Setting all to 0
	memset(LCSRe, 0, sizeof(LCSRe));

	string res; // To store result
	int res_length = 0; // To store length of result

	// building table in bottom-up manner
	int i, index = 0;
	for (i=1; i<=n; i++)
	{
		for (int j=i+1; j<=n; j++)
		{
			// (j-i) > LCSRe[i-1][j-1] to remove
			// overlapping
			if (str[i-1] == str[j-1] &&
				LCSRe[i-1][j-1] < (j - i))
			{
				LCSRe[i][j] = LCSRe[i-1][j-1] + 1;

				// updating maximum length of the
				// substring and updating the finishing
				// index of the suffix
				if (LCSRe[i][j] > res_length)
				{
					res_length = LCSRe[i][j];
					index = max(i, index);
				}
			}
			else
				LCSRe[i][j] = 0;
		}
	}

	// If we have non-empty result, then insert all
	// characters from first character to last
	// character of string
	if (res_length > 0)
		for (i = index - res_length + 1; i <= index; i++)
			res.push_back(str[i-1]);

	return res;
}

// Driver program to test the above function
int main()
{
  int n;
  cin>>n;
	string str;
  cin>>str;
	string ans = longestRepeatedSubstring(str);
  cout<<ans.size()<<'\n';
	return 0;
}


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

using namespace std;

int main()
{
    long long n,m,sum=0;
    cin>>n>>m;
    long long a[m],i;
    for(i=0;i<m;i++)
    {
        cin>>a[i];
        sum=sum+a[i];
    }
    if(sum==n)
    {
        cout<<0<<endl;
    }
    else if(sum>n)
    {
        cout<<-1<<endl;
    }
    else
        cout<<n-sum<<endl;
    return 0;
}


Measured memory_bytes: 3672