akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
using namespace std;

int main(){
  int n, nn, wa = 0;
  cin >> n;
  nn = n;
  
  while( nn > 0 ){
    wa += nn%10;
    nn /= 10;
  }

//  cout << wa << endl;

  if( n%wa == 0 ){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.end()
#define allR(v) v.rbegin(), v.rend()
#define PRINT(v) for (auto x : (v)) cout <<x <<" " ; cout <<endl;
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
typedef pair<int,int> Pi;
const ll MOD = 1000000007;
const ll INF = 10000000000000000;
const int inf = 1001001001;
vector<int> x4 = {0, 1, 0, -1}, x8 = {0, 1, 1, 1, 0, -1, -1, -1};
vector<int> y4 = {1, 0, -1, 0}, y8 = {1, 1, 0, -1, -1, -1, 0, 1};
template<class T> inline bool chmin(T& a, T b){if (a>b){a = b; return true;}return false;}
template<class T> inline bool chmax(T& a, T b){if (a<b){a = b; return true;}return false;}
template<class T> inline T powerM(T a,T b){if (b==0) return 1;
T tmp = powerM(a,b/2); if (b%2==0) return tmp*tmp%MOD; else return tmp*tmp%MOD*a%MOD; }
template<class T> inline T power(T a,T b,T m=numeric_limits<T>::max()){ if (b==0) return 1;
  T tmp = power(a,b/2,m); if (b%2==0) return tmp*tmp%m; else return tmp*tmp%m*a%m; }
template<class T> inline T gcd(T a, T b){if (b==0) return a; return gcd(b, a%b);}
template<class T> inline T lcm(T a, T b){return a / gcd(a,b) * b;}
// ax+by=gcd(a,b)を解く
template<class T> inline T extgcd(T a,T b,T &x,T &y){if (b==0){x=1; y=0; return a;} T d=extgcd(b,a%b,y,x); y -= a/b*x; return d;}
void hey(){ cout <<"hey" <<endl; }

template<class T> struct edge { int to; T cost;};


ll bfs(int H,int W,vector<string> &field,vector<vector<bool>> &seen,int si,int sj){
  // (si,sj)からbfs
  queue<Pi> que;
  int black = field[si][sj] == '#';
  seen[si][sj] = true;
  que.push(Pi(si,sj));
  ll sumblack = field[si][sj] == '#';
  ll sumwhite = field[si][sj] == '.';
  while (!que.empty()){
    auto e = que.front(); que.pop();
    int i,j; tie(i,j) = e;
    for (int k=0; k<x4.size(); k++){
      int ni = i+y4[k];
      int nj = j+x4[k];
      if (ni < 0 || ni >= H || nj < 0 || nj >= W) continue;
      if (seen[ni][nj]) continue;
      if (field[i][j] == field[ni][nj]) continue;
      seen[ni][nj] = true;
      if (field[ni][nj] == '#') sumblack++;
      else sumwhite++;
      que.push(Pi(ni,nj));
    }
  }
  return sumblack*sumwhite;
}

int main() {
  int H,W; cin >>H >>W;
  vector<string> field(H); rep(i, H) cin >>field[i];
  vector<vector<bool>> seen(H, vector<bool>(W, false));
  ll res = 0;
  for (int i=0; i<H; i++){
    for (int j=0; j<W; j++){
      if (seen[i][j]) continue;
      res += bfs(H,W,field,seen,i,j);
    }
  }
  cout <<res <<endl;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
#define LL long long
const int N = 2e5 + 10;
int n, c[N], cnt[N], siz[N];
	inline LL cal(int n) {
		// C(n,2) + n
		return 1LL*n*(n+1)/2;
	}
LL ans[N];
vector<int>G[N];
	void dfs(int v, int fa) {
		int tmp = cnt[c[v]];
		siz[v] = 1;
		for(int u:G[v]) {
			if(u==fa) continue;
			cnt[c[v]] = 0;
			dfs(u, v);
			siz[v] += siz[u];
			ans[c[v]]+=cal(siz[u]-cnt[c[v]]);
		}
		cnt[c[v]] = tmp + siz[v];
	}
	
	inline void add(int a, int b) {
		G[a].push_back(b);
		G[b].push_back(a);
	}
	
int main() {
	//scanf("%d", &n);
	std::ios::sync_with_stdio(false);
	cin>>n;
	for (int i = 1; i <= n; i++)
		//scanf("%d", &c[i]);
		cin>>c[i];
	for (int i = 1; i < n; i++) {
		int u, v;
		//scanf("%d%d", &u, &v);
		cin>>u>>v;
		G[u].push_back(v);
		G[v].push_back(u);
		//add(u, v); add(v, u);
	}
	dfs(1, 0);
	for (int i = 1; i <= n; i++) {
		cout<< cal(n) - ans[i] - cal(n - cnt[i])<<endl;
	}
	return 0;
}


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

import sys
import os

for s in sys.stdin:
    xa1, ya1, xa2, ya2, xb1, yb1, xb2, yb2 = map(float, s.split())

    if xb2 < xa1 or xa2 < xb1 or ya2 < yb1 or yb2 < ya1:
        print('NO')
    else:
        print('YES')

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

int main() {
    int N; cin >> N;
    vector<int> A(N), B(N), C(N-1);
    rep(i, N){
        cin >> A[i];
        A[i]--;
    }
    rep(i, N){
        cin >> B[i];
    }
    rep(i, N-1){
        cin >> C[i];
    }

    int ans = 0;
    int befo = -2;

    rep(i, N){
        ans += B[A[i]];
        if(A[i] == befo+1){
            ans += C[befo];
        }
        befo = A[i];
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3604
import java.util.*;

class Main{
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] h = new int[n];
		int ans = 1;
		int max = 0;
		for(int i = 0; i < n; i++){
			h[i] = sc.nextInt();
			if(i != 0){
				if(h[i] >= h[0] && h[i] >= h[1] && h[i] >= h[i-1] && h[i] >= max){
					ans++;
				}
			}
			max = Math.max(max,h[i]);
		}
		System.out.print(ans);
	}
}


Measured memory_bytes: 23124
n, k = map(int, input().split())
l = []
for i in range(k):
    d = int(input())
    a = list(map(int, input().split()))
    for j in range(d):
        l.append(a[j])
ans = 0
for i in range(n):
    if (i + 1) not in l:
        ans += 1
print(ans)


Measured memory_bytes: 9180
program abc67
 implicit none
 integer(8)::length
 character(len=1002)::S
 read(*,*)S
 length=len_trim(S)
 if(S(length:length)=="s")then
  S(length+1:length+2)="es"
 else
  S(length+1:length+1)="s"
 end if
 print'(a)',trim(S)
 end program abc67

Measured memory_bytes: 2924
/*  -*- coding: utf-8 -*-
 *
 * c.cc: C: 
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>

using namespace std;

/* constant */

const int MAX_N = 100000;

typedef long long ll;
const ll MOD = 1000000007;

const int INF = 1 << 30;

/* typedef */

/* global variables */

int ts[MAX_N], as[MAX_N];
int fhs[MAX_N], mhs[MAX_N];

/* subroutines */

/* main */

int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> ts[i];
  for (int i = 0; i < n; i++) cin >> as[i];

  for (int i = 0, prv = 0; i < n; i++) {
    if (ts[i] > prv) fhs[i] = ts[i];
    prv = mhs[i] = ts[i];
  }

  for (int i = n - 1, prv = 0; i >= 0; i--) {
    if (as[i] > prv) {
      if ((fhs[i] > 0 && fhs[i] != as[i]) || mhs[i] < as[i]) {
	puts("0");
	return 0;
      }
      fhs[i] = mhs[i] = as[i];
    }
    else if (mhs[i] > as[i]) mhs[i] = as[i];
    prv = as[i];
  }
  //for (int i = 0; i < n; i++) printf("%d %d\n", fhs[i], mhs[i]);

  ll cnt = 1;
  for (int i = 0; i < n; i++)
    if (fhs[i] == 0) cnt = (cnt * mhs[i]) % MOD;
  printf("%lld\n", cnt);
  return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <numeric>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <cassert>
#include <cstdarg>
#include <sys/time.h>
#include <fstream>
//#include "cout.h"

using namespace std;

#define SZ(x) ((int)x.size())
#define MSET(x,a) memset(x, a, (int)sizeof(x))
#define PB push_back
#define VI vector < int >
#define PII pair < int, int >
#define LL long long
#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(), (v).end()
#define FIT(it,v) for (__typeof((v).begin()) it = (v).begin(); it != (v).end(); it++)
#define OUT(A) cout << #A << " = "<< (A) << endl
#define OUT2(A, B) cout << "(" << #A << ", " << #B << ") = (" << (A) << ", "<< (B) << ")" << endl
template<class T> void chmin(T &t, T f) { if (t > f) t = f; } 
template<class T> void chmax(T &t, T f) { if (t < f) t = f; } 

#define present(c, e) ((c).find((e)) != (c).end())
#define cpresent(c, e) (find(all(c), (e)) != (c).end())

int n;
LL a[100010];
char op[100010];
LL dp[100010][3];

void init() {
}

void input() {
	cin >> n;
	REP(i, n) {
		cin >> a[i];
		if (i < n-1) cin >> op[i+1];
	}
}

void solve() {
	REP(i, 100010) REP(j, 3) dp[i][j] = -1e15;
	dp[0][0] = a[0];
	FOR(i, 1, n){
		if(op[i] == '+'){
			dp[i][0] = max({
				dp[i-1][0]+a[i], 
				dp[i-1][1]+a[i], 
				dp[i-1][2]+a[i]
				});
			dp[i][1] = max({
				dp[i-1][1]-a[i], 
				dp[i-1][2]-a[i]
				});
			dp[i][2] = max({
				dp[i-1][2]+a[i]
				});
		}
		else{
			dp[i][1] = max({
				dp[i-1][0]-a[i], 
				dp[i-1][1]-a[i], 
				dp[i-1][2]-a[i]
				});
			dp[i][2] = max({
				dp[i-1][1]+a[i], 
				dp[i-1][2]+a[i]
				});
		}
	}
	cout << max({dp[n-1][0], dp[n-1][1], dp[n-1][2]}) << endl;
}

int main() {
	init();
    input();
    solve();
	return 0;
}








Measured memory_bytes: 3584
#include <bits/stdc++.h>
using namespace std;
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;}
const long long INFLL = 1LL<<60;
const int INF = 1<<28;
const long long MOD =1000000000+7;
void solve(int a){cout<<( a?"YES":"NO")<<endl;}
int main(){
	int n;
	cin >>n;
	int b1;
	int b2;
	vector<int>a(n,0);
	for(int i=0;i<n;i++){
		cin>>a[i];
	}

	sort(a.begin(),a.end(),greater<int>());
	b1 = a[0];
	b2 = a[1];
	for(int i=2;i<n;i++){
		if(min(b2,abs(b2-b1)) < min(a[i],abs(a[i]-b1))){
			b2=a[i];
		}
	}
	printf("%d %d\n",b1,b2);
}


Measured memory_bytes: 640
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {

    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    int c = sc.nextInt();

    if ((b - a) == (c - b)) {
      System.out.println("YES");
    } else {
      System.out.println("NO");
    }

  }
}

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

int main()
{
    int n;
    cin >> n;

    vector<int> a(n);
    rep (i, n)
        cin >> a[i];
    sort(a.begin(), a.end());

    vector<int> divisor(1000001, 0);
    for (int x : a)
    {
        if (divisor[x] != 0)
        {
            divisor[x] = 2;
            continue;
        }
        for (int j = x; j < 1000001; j += x)
            divisor[j]++;
    }

    int ans = 0;
    for (int x : a)
        if (divisor[x] == 1)
            ans++;

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

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

int main()
{
	int i;
	string str;
	int code[4];
	int judge = 0;

	cin >> str;
	for(i = 0; i < 4; i++){
		code[i] = (int)(str[i] - '0');
	}
	for(i = 1; i < 4; i++){
		if(code[i] == code[i - 1]){
			judge = 1;
		}
	}
	if(judge){
		cout << "Bad";
	}
	else{
		cout << "Good";
	}
	return 0;

}


Measured memory_bytes: 256
using System.Collections.Generic;
using System.Linq;
using System;
class Program
{
    static void Main()
    {
        int num = int.Parse(Console.ReadLine());
        int currentMinIndex = 0;
        int currentMinValue = 0;
        for (int i = 0; i < num; i++){
            string line = Console.ReadLine();
            string[] a = line.Split(' ');
            int[] b = new int[2];
            b[0] = int.Parse(a[0]);
            b[1] = int.Parse(a[1]);

            if(b[0] > currentMinIndex){
                currentMinIndex = b[0];
                currentMinValue = b[1];
            }
        }

        Console.WriteLine((currentMinValue + currentMinIndex).ToString());
    }
}

Measured memory_bytes: 15280
//
//AtCoder Beginner Contest 162
//D
//

#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <ctime>
#include <queue>
#include <map>
#include <set>
#include <tuple>
#include <functional>
#include <cassert>
#include <bitset>
#include <numeric>

using namespace std;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define SIZE(x) (int)(x).size()
#define SIZEL(x) (ll)(x).size()
#define MSG(a) cout << #a << " " << a << endl;

using ll = long long;
using ld = long double;
using Graph = vector<vector<int>>;

const double PI = 3.14159265358979323846;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

ll gcd(ll x, ll y) { return (x % y)? gcd(y, x % y): y; }    //最大公約数
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }            //最小公倍数

int main()
{
    int n;
    cin >> n;

    string s;
    cin >> s;

    ll r=0;
    ll g=0;
    ll b=0;
    REP(i,n){
        if (s[i]=='R') r++;
        if (s[i]=='G') g++;
        if (s[i]=='B') b++;
    }
    ll notContainsCnt=0;
    REP(i,n-2){
        FOR(j, i+1, n-2){
            int k = j*2-i;
            if (k>=n) break;
            if ((s[i] != s[j]) && (s[j] != s[k]) && (s[i] != s[k])) notContainsCnt++;
        }
    }
    cout << r*g*b-notContainsCnt << endl;
    return 0;
}


Measured memory_bytes: 3612
#include <bits/stdc++.h>
typedef long long int ll;
using namespace std;
#define P 1000000007
#define rep(i,n) for(i=0;i<n;++i)
#define re(i,a,n) for(i=a;i<n;++i)
#define repr(i,a,n) for(i=a;i>=n;--i)
#define pb push_back
#define mp make_pair
#define fi first
#define se second


ll binpow(ll x, ll y, ll p)
{
    ll res = 1;
    x = x % p;
   while (y > 0)
    {
        if (y & 1)
            res = (res*x) % p;
        y = y>>1;
        x = (x*x) % p;
    }
    return res;
}
ll modInverse(ll n, ll p)
{
    return binpow(n, p-2, p);
}


char adj[1001][1001];
int used[1001][1001];
ll com[1001][1001];
pair<ll,ll> dest;
ll n,m;
ll dx[]={0,0,-1,1};
ll dy[]={1,-1,0,0};
vector<vector<pair<ll,ll>>> comp(1e6);
vector<pair<ll,ll>> v;


void dfs(pair<ll,ll> c,ll col)
{
      used[c.fi][c.se]=1;
      //cout << c.fi << " " << c.se << endl;
      comp[col].pb(c);
      com[c.fi][c.se]=col;
      ll i,j;
      ll x,y;
      rep(i,4)
      {
            x=c.fi+dx[i];
            y=c.se+dy[i];
            if(x<0||x>=n||y<0||y>=m) continue ;
            if(used[x][y]==1||adj[x][y]=='#') continue ;
            dfs({x,y},col);
      }
}

int main() 
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll i,f=0,j,ans=0,k,x,r,l,t,y;
    
    ll u,v,x1,y1;
    cin >> n >> m  ;
    cin >> u >> v >> x1 >> y1 ;
    u--;
    v--;
    x1--;
    y1--;
    rep(i,n)
    {
          rep(j,m) 
          {
                used[i][j]=0;
                cin >> adj[i][j];
          }
    }
    
    pair<ll,ll> temp={u,v};
    dfs(temp,1);
    x=2;
    rep(i,n)
    {
          rep(j,m)
          {
                if(!used[i][j]&&adj[i][j]!='#')
                {
                      dfs({i,j},x);
                      
                      x++;
                }
          }
    }
    f=0;
    vector<ll> d(x,1e18);
    d[1]=0;
    set<pair<ll,ll>> s;
    s.insert({0,1});
    //cout << com[x1][y1] << endl ;
    while(!s.empty())
    {
          auto h=*s.begin();
          //cout << h.fi <<  " " << h.se << endl ;
          s.erase(s.begin());
          if(com[x1][y1]==h.se)
          {
                f=1;
                break;
          }
          for(auto it:comp[h.se])
          {
                for(i=-2;i<=2;++i)
                {
                      for(j=-2;j<=2;++j)
                      {
                            if(i==0&&j==0) continue ;
                            x=i+it.fi;
                            y=j+it.se;
                            if(x<0||x>=n||y<0||y>=m) continue ;
                            if(com[x][y]==h.se||adj[x][y]=='#') continue ;
                            if(d[com[x][y]]>h.fi+1)
                            {
                                  s.erase({d[com[x][y]],com[x][y]});
                                  d[com[x][y]]=h.fi+1;
                                  s.insert({d[com[x][y]],com[x][y]});
                            }
                            
                      }
                }
          }
          
    }
    if(d[com[x1][y1]]==1e18) cout << -1 << endl ;
    else cout << d[com[x1][y1]] ;
    
    return 0;
}

Measured memory_bytes: 51612
#include <iostream>
#include <algorithm>
#include <cstdio>
using namespace std;


long long dis[100050];
long long nutri[100050];
long long clockw[100050];
long long clock_ret[100050];
long long cclock[100050];
long long cclock_ret[100050];
int main()
{
    long long sum=0;
    long long n,c;
    cin>>n>>c;
    long long ans=0;
    for(int i=1;i<=n;i++){

        scanf("%lld",&dis[i]);
        scanf("%lld",&nutri[i]);
        clockw[i] = nutri[i-1]+nutri[i]-dis[i];
        sum+=nutri[i];
        nutri[i] += nutri[i-1];
        clock_ret[i] = max(clock_ret[i-1],clockw[i]-dis[i]);
    }
    for(int i=n;i>0;i--){
        cclock[i] = sum - nutri[i-1]-(c-dis[i]);
        cclock_ret[i] = max(cclock_ret[i+1],cclock[i]-(c-dis[i]));
    }
    for(int i=1;i<=n;i++){
        ans = max(ans,clockw[i]);
        ans = max(ans,cclock[i]);
        ans = max(ans,clock_ret[i-1]+cclock[i]);
        ans = max(ans,cclock_ret[i+1]+clockw[i]);
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 4992
//abc136

#include "iostream"
#include <string>
//#include <deque>
#include <algorithm>
#include <map>
using namespace std;

//map<string, int> Map;

//long long CalValue(int val)
//{
//	long long ret = 1;
//
//	ret = val ;
//	ret *= (val - 1) / 2;
//
//	return ret;
//}

long long CalValue(int val)
{
	long long ret = 1;
	if (val < 2)
		return 0;
	for (int i = val; i > val - 2; i--)
	{
		ret *= i;
	}

	return ret / 2;
}

int main(void)
{
	int N;
	int i;
	string s;
	int count = 0;
	long long maxCount = 0;
	map <string,int> Map;
	cin >> N;

	for (i = 0; i < N; i++)
	{
		cin >> s;
		sort(s.begin(),s.end());
		Map[s]++;
	}

	map<string,int  >::iterator iter;

	for (iter = Map.begin(); iter != Map.end(); iter++)
	{
		maxCount += CalValue((*iter).second);
	}
	//for (i = 0; i < N; i++)
	//{
	//	cout << psArray[i]<<endl;
	//}

	cout << maxCount;
	return 0;
}

Measured memory_bytes: 11136
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<cstdio>
#include<cmath>
#include<deque>
#include<numeric>
#include<queue>
#include<stack>
#include<cstring>
#include<limits>
#include<functional>
#include<unordered_set>
#include<iomanip>
#include<cassert>
#include<regex>
#include<bitset>
#include<complex>
#include<chrono>
#include<random>
#define rep(i,a) for(int i=(int)0;i<(int)a;++i)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(),x.end()
using ll=long long;
constexpr ll mod = 1e9 + 7;
constexpr ll INF = 1LL << 60;

ll gcd(ll n, ll m) {
	ll tmp;
	while (m!=0) {
		tmp = n % m;
		n = m;
		m = tmp;
	}
	return n;
}

ll lcm(ll n, ll m) {
	return abs(n * m) / gcd(n, m);//gl=xy
}
 
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
 
using namespace std;

//ここから

void solve(){
  ll a,b;
  char op;
  cin>>a>>op>>b;
  if(op=='+')cout<<a+b;
  else cout<<a-b;
}

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


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

void CoinsSumFlg(int x, int y){
    if(500*x>=y){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
}

int main(){
    int K,X; cin >> K >> X;
    CoinsSumFlg(K,X);
}

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

int main(){
	int a[3];
	cin >> a[0] >> a[1] >> a[2];
	sort(a, a+3);

	if(a[0] == 5 && a[1] == 5 && a[2] == 7) cout << "YES" << endl;
	else cout << "NO" << endl;

	return 0;
}

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

#define F first
#define S second
#define pb push_back
#define sz(x) (int)x.size()
#define all(x) (x).begin(), (x).end()
#define Red ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)

using namespace std;

typedef long long ll;

void solve(){
	ll n,x,cnt=0;
	cin>>n>>x;
	for(int i=0;i<n;++i){
		ll a,b;
		cin>>a>>b;
		double xx=sqrt(a*a*1ll+b*b*1ll);
		if(xx<=x)cnt++;
	}
	cout<<cnt;
}

int main(){
	Red;
	int T=1;
	//cin>>T;
	while(T--)solve();
}

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

int main(){
  string S;
  cin >> S;
  bool flag=true;
  if(flag)flag = S[2]==S[3];
  if(flag)flag = S[4]==S[5];
  if(flag)cout << "Yes" << endl;
  else{
    cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <string>
#include <vector>
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<stack>
#include<queue>
#include<cmath>
#include<algorithm>
#include<functional>
#include<list>
#include<deque>
#include<bitset>
#include<set>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include<cstring>
#include<sstream>
#include<complex>
#include<iomanip>
#include<numeric>
#include<cassert>
#include<random>
#define X first
#define Y second
#define pb push_back
#define rep(X,Y) for (int (X) = 0;(X) < (int)(Y);++(X))
#define reps(X,S,Y) for (int (X) = (int)(S);(X) < (int)(Y);++(X))
#define rrep(X,Y) for (int (X) = (int)(Y)-1;(X) >=0;--(X))
#define rreps(X,S,Y) for (int (X) = (int)(Y)-1;(X) >= (int)(S);--(X))
#define repe(X,Y) for ((X) = 0;(X) < (Y);++(X))
#define peat(X,Y) for (;(X) < (Y);++(X))
#define all(X) (X).begin(),(X).end()
#define rall(X) (X).rbegin(),(X).rend()
#define eb emplace_back
#define UNIQUE(X) (X).erase(unique(all(X)),(X).end())
#define Endl endl
#define NL <<"\n"
#define cauto const auto

using namespace std;
using ll=long long;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
template<class T> using vv=vector<vector<T>>;
template<class T> inline bool MX(T &l,const T &r){return l<r?l=r,1:0;}
template<class T> inline bool MN(T &l,const T &r){return l>r?l=r,1:0;}
//#undef NUIP
#ifdef NUIP
#include "benri.h"
#else
#define out(args...)
#endif
#ifdef __cpp_init_captures
template<typename T>vector<T> table(int n, T v){ return vector<T>(n, v);}
template <class... Args> auto table(int n, Args... args){auto val = table(args...); return vector<decltype(val)>(n, move(val));}
#endif
template<class A,class B> pair<A,B> operator+(const pair<A,B> &p,const pair<A,B> &q){ return {p.X+q.X,p.Y+q.Y};}
template<class A,class B,class C,class D> pair<A,B>& operator+=(const pair<A,B> &p,const pair<C,D> &q){ p.X+=p.X; q.Y+=q.Y; return p;}
template<class A,class B> pair<A,B> operator-(const pair<A,B> &p,const pair<A,B> &q){ return {p.X-q.X,p.Y-q.Y};}
template<class A,class B,class C,class D> pair<A,B>& operator-=(const pair<A,B> &p,const pair<C,D> &q){ p.X-=p.X; q.Y-=q.Y; return p;}
template<class A,class B> istream& operator>>(istream &is, pair<A,B> &p){ is>>p.X>>p.Y; return is;}
template<class T> T read(){ T re; cin>>re; return re;}
template<class T> T read(const T &dec){ T re; cin>>re; return re-dec;}
template<class T> vector<T> readV(const int sz){ vector<T> re(sz); for(auto &x:re) x=read<T>(); return re;}
template<class T> vector<T> readV(const int sz, const T &dec){ vector<T> re(sz); for(auto &x:re) x=read<T>(dec); return re;}
vv<int> readG(const int &n,const int &m){ vv<int> g(n); rep(_,m){ cauto a=read<int>(1),b=read<int>(1); g[a].pb(b); g[b].pb(a);} return move(g);}
vv<int> readG(const int &n){ return readG(n,n-1);}

const ll MOD=1e9+7; //998244353

int main(){
  ios_base::sync_with_stdio(false); cin.tie(0);
  cout<<fixed<<setprecision(0);
	cauto n=read<int>();
	cauto g=readG(n);
	ll re=0;
	reps(i,1,n+1) re+=i*(n+1ll-i);
  rep(a,n)for(auto b:g[a])if(a<b) re-=(a+1ll)*(n-b);
	cout<<re NL;
  return 0;
}


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

int main()
{
	
	int x1 , x2 , y1 , y2;
	cin>>x1>>y1>>x2>>y2;
	int a = (y2-y1);
	int b = (x2-x1);
	cout<<x2-a<<" "<<y2+b<<" "<<x1-a<<" "<<y1+b<<endl;
	return 0;
}


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

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		
		int n = scan.nextInt();
		int p[] = new int[n];
		for(int i=0;i<n;i++) {
			p[i] = scan.nextInt();
		}
		
		int min = p[0];
		int ans = 1;
		for(int i=1;i<n;i++) {
			if(min > p[i]) {
				min = p[i];
			}
			if(min >= p[i]) {
				ans += 1;
			}
		}
		
		System.out.println(ans);
		
	}

}


Measured memory_bytes: 83144
#include <algorithm>
#include <iostream>
#include <cstdlib>
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <string>
#include <typeinfo>
#include <vector>
//#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<vector<bool>> vvb;
typedef vector<vector<int>> vvi;

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

int main()
{
  vi a(3);
  rep(i,3){
    cin >> a.at(i);
  }
  sort(a.begin(), a.end());
  cout << a.at(0) + a.at(1) +10* a.at(2) << endl;
  return 0;
}

Measured memory_bytes: 256
// clang-format off
#include <bits/stdc++.h>

#define mp make_pair
#define fst first
#define snd second
#define forn(i,n) for (int i = 0; i < int(n); i++)
#define forn1(i,n) for (int i = 1; i <= int(n); i++)
#define popcnt __builtin_popcount
#define ffs __builtin_ffs
#define ctz __builtin_ctz
#define clz __builtin_clz
#define all(a) (a).begin(), (a).end()
 
using namespace std;

using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pli = pair<ll,int>;
using pil = pair<int,ll>;
using pll = pair<ll,ll>;
template <typename T> using vec = vector<T>;
using vi = vec<int>;
using vl = vec<ll>;
template <typename T> using que = queue<T>;
template <typename T> using deq = deque<T>;

template <typename T> T id(T b) {return b;};
template <typename T> void chmax(T &x, T y) {if (x < y) x = y;}
template <typename T> void chmin(T &x, T y) {if (x > y) x = y;}
template <typename S, typename K> bool contains(S &s, K k) { return s.find(k) != s.end(); }
void fastio() { ios_base::sync_with_stdio(false); cin.tie(nullptr); }
constexpr ll TEN(int n) { if (n == 0) return 1LL; else return 10LL*TEN(n-1); }
// clang-format on

int n, k;
vi l;

int main() {
    fastio();

    cin >> n >> k;
    l = vi(n);

    forn(i, n) cin >> l[i];

    sort(all(l), greater<int>());

    cout << accumulate(l.begin(), l.begin() + k, 0) << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll  long long
#define FASTINOUT ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
const ll mod = 1e9+7;
const int N=2e5+9;
int main()
{
    FASTINOUT;
    char a,z;
    cin>>a>>z;
    if (a==z)
        cout<<"H";
    else
        cout<<"D";
    return 0;
}


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

typedef pair<int, int> pii;
typedef long long ll;
typedef vector<int> vi;

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define ALL(c) (c).begin(),(c).end()

int N;
string s[310];
char c[310][310];

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

	int cnt = 0;
	rep(A, N) {
		rep(i, N) {
			rep(j, N) {
				c[i][(j+A)%N] = s[i][j];
			}
		}
		bool f = 1;
		rep(i, N) {
			rep(j, N) {
				f &= (c[i][j] == c[j][i]);
			}
		}
		cnt += f;
	}
	cout << cnt * N << endl;
	
	return 0;
}

Measured memory_bytes: 512
from heapq import *
import sys
from collections import *
from itertools import *
from decimal import *
import copy
from bisect import *
import math
sys.setrecursionlimit(4100000)
def gcd(a,b):
    if(a%b==0):return(b)
    return (gcd(b,a%b))
input=lambda :sys.stdin.readline().rstrip()

N,M,K=map(int,input().split())
A=list(map(int,input().split()))
B=list(map(int,input().split()))

suma=0
sumB=sum(B)
b=M-1

while K<sumB and b>=0:
    sumB-=B[b]
    b-=1
c=b+1
#print(c)
for a in range(N):
    sumB+=A[a]
    while K<sumB and b>=0:
        sumB-=B[b]
        b-=1
    #print(sumB,a,b,c)
    if K>=sumB:
        c=max(c,b+1+a+1)
print(c)


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

int main(){
    int a, b; cin >> a >> b;

    cout << max({a+a-1, a + b, b+b-1}) << endl;
}

Measured memory_bytes: 256
import math
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

total = sum(B) - sum(A)
each = 0
for i in range(N):
    if B[i] == A[i]:
        continue
    elif B[i] - A[i] > 0:
        each += math.ceil((B[i] - A[i]) / 2)
if each <= total:
    print('Yes') 
else:
    print('No')

Measured memory_bytes: 4600
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n, k, x;
	scanf("%d", &n);
	scanf("%d", &k);
	int ans = 0;
	for(int i = 0; i < n; i++){
		scanf("%d", &x);
		ans += 2 * min(k - x, x);
	}
	printf("%d\n", ans);
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
const long long mod = 1e9+7;
const int dx[4] = {0,1,0,-1};
const int dy[4] = {1,0,-1,0};
const int ddx[4] = {1,1,-1, -1};
const int ddy[4] = {1,-1,-1,1};
//////////////////////////////////

int main(){
  long long a, b; cin >> a >> b;
  cout << (a/__gcd(a, b))*b << endl;

  return 0;
}

// EOF


Measured memory_bytes: 256
#include <cassert>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <algorithm>
#include <utility>
#include <unordered_set>
#include <unordered_map>
#include <stack>
#include <queue>
#include <deque>
#include <functional>
#include <numeric>
#include <complex>
#include <iomanip>

using namespace std;

#define bitcount(n) __builtin_popcount(n)

#define debug(n) cout << n << endl;

#define PREC(n) setprecision(n)
#define DOTPREC(n) fixed << setprecision(n)

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

#define fst first
#define scd second
#define PB push_back
#define MP make_pair
#define rep(i,x) for(int i=0;i<(x);++i)
#define rep1(i,x) for(int i=1;i<=(x);++i)
#define rrep(i,x) for(int i=(x)-1;i>=0;--i)
#define rrep1(i,x) for(int i=(x);i>=1;--i)
#define FOR(i,a,x) for(int i=(a);i<(x);++i)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()

#define omajinai ios::sync_with_stdio(false); cin.tie(0)

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

const int inf = 1e9;
const ll linf = 3e18;
const double eps = 1e-9;

const ll MOD = 1000000007;

int K, T;
pii a[100];
int main(void)
{
    cin >> K >> T;

    rep(i, T) {
        int tmp;
        cin >> tmp;
        a[i] = MP(tmp, i);
    }

    ll ans = 0;
    ll prev = -1;
    rep(i, K) {
        sort(a, a + T, std::greater<pii>());

        bool eat = false;
        rep(i, T) {
            if (a[i].scd != prev && a[i].fst >= 1) {
                prev = a[i].scd;
                a[i].fst--;
                eat = true;
                break;
            }
        }

        if (!eat) {
            a[0].fst--;
            ans++;
        }
    }
    debug(ans);
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        final Scanner sc = new Scanner(System.in);

        int H = Integer.parseInt(sc.next());
        int W = Integer.parseInt(sc.next());
        int h = Integer.parseInt(sc.next());
        int w = Integer.parseInt(sc.next());

        System.out.print((H * W) - (H * w + W * h - (h * w)));
    }
}

Measured memory_bytes: 21972
//
// Created on 2020/05/21.
//


#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
#include <ios>
#include <iomanip>
#include <numeric>

#define all(x) (x).begin(),(x).end()
typedef long long ll;
using namespace std;
const long long LINF =1e18;
const int INF = 1e9;


int main() {
    int n;
    cin>>n;
    vector<int>value(n);
    vector<int>cost(n);

    for (int i = 0; i < n; ++i) {
        cin>>value[i];
    }
    for (int j = 0; j < n; ++j) {
        cin>>cost[j];
    }

    vector<vector<int>>dp(n + 1, vector<int>(1010,0));

    dp[0][0] = 0;

    for (int k = 1; k <= n; ++k) {
        int n_value = value[k - 1];
        int n_cost = cost[k - 1];

        for (int j = 0; j < n_cost; ++j) {
            dp[k][j] = dp[k - 1][j];
        }
        for (int i = 0 + n_cost; i < 1010; ++i) {
            dp[k][i] = max(dp[k-1][i - n_cost] + n_value, dp[k - 1][i]);
        }
    }

    int ans = 0;

    for (int l = 0; l < 1010; ++l) {
        ans = max(ans, dp[n][l] - l);
    }

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


Measured memory_bytes: 384
local mfl, mce = math.floor, math.ceil
local n = io.read("*n")
local a, b = {}, {}
for i = 1, n do
  a[i], b[i] = io.read("*n", "*n")
end

local function solvelow(x)
  local c = 0
  for i = 1, n do
    if a[i] <= x then
      c = c + 1
    end
  end
  return n + 1 <= c * 2
end

local function solvehigh(x)
  local c = 0
  for i = 1, n do
    if x <= b[i] then
      c = c + 1
    end
  end
  return n + 1 <= c * 2
end

local function solvelow_even(x)
  local c = 0
  local lowmax, highmin = -1, 2000000007
  for i = 1, n do
    if a[i] <= x then
      c = c + 1
      if lowmax < a[i] then
        lowmax = a[i]
      end
    else
      if a[i] < highmin then
        highmin = a[i]
      end
    end
  end
  if n < c * 2 then return true
  elseif n == c * 2 then
    local diff = x - lowmax
    return highmin - x <= diff
  else
    return false
  end
end

local function solvehigh_even(x)
  local c = 0
  local lowmax, highmin = -1, 2000000007
  for i = 1, n do
    if x <= b[i] then
      c = c + 1
      if b[i] < highmin then
        highmin = b[i]
      end
    else
      if lowmax < b[i] then
        lowmax = b[i]
      end
    end
  end
  if n < c * 2 then return true
  elseif n == c * 2 then
    local diff = highmin - x
    return x - lowmax <= diff
  else
    return false
  end
end

if n % 2 == 1 then
  local min, max = 0, 1000000000
  while 1 < max - min do
    local mid = mfl((min + max) / 2)
    if solvelow(mid) then
      max = mid
    else
      min = mid
    end
  end
  local lowlim = max
  min, max = 1, 1000000001
  while 1 < max - min do
    local mid = mfl((min + max) / 2)
    if solvehigh(mid) then
      min = mid
    else
      max = mid
    end
  end
  local highlim = min
  print(highlim - lowlim + 1)
else
  for i = 1, n do
    a[i], b[i] = a[i] * 2, b[i] * 2
  end
  local min, max = 0, 2000000100
  while 1 < max - min do
    local mid = mfl((min + max) / 2)
    if solvelow_even(mid) then
      max = mid
    else
      min = mid
    end
  end
  local lowlim = max
  min, max = 1, 2000000101
  while 1 < max - min do
    local mid = mfl((min + max) / 2)
    if solvehigh_even(mid) then
      min = mid
    else
      max = mid
    end
  end
  local highlim = min
  print(highlim - lowlim + 1)
end


Measured memory_bytes: 6944
#include "bits/stdc++.h"
 
using namespace std;
 
typedef long long ll;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;

typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<vi> vvi;
    
 #define sz(x) (int)(x).size()
 #define mp make_pair
 #define pb push_back
 #define all(x) x.begin(), x.end()
 
 #define PI 3.14159265358979323846264338327950L
const int MOD = 1000000007;

vvi level;
vector<vector<char>> grid;
vi dx{1,-1,0,0};
vi dy{0,0,1,-1};
int h,w,ch,cw,dh,dw;

bool isvalid(int x, int y)
{
    if(x<1 or x>h or y<1 or y>w) return false;
    if(grid[x][y]=='#') return false;

    return true;
}

void bfs(int sx,int sy)
{
    deque<pair<pair<int,int>,int>> q;
    q.push_back(mp(mp(sx,sy),0));
   

    while(!q.empty())
    {
        int x = q.front().first.first;
        int y = q.front().first.second;
        int m = q.front().second;
        
        q.pop_front();

        if(m>=level[x][y]) continue;
        level[x][y]=m;

        for(int i=0;i<4;++i)
        if(isvalid(x+dx[i],y+dy[i]))
        {
            int nx = x + dx[i];
            int ny = y + dy[i];

            q.push_front(mp(mp(nx,ny),m));
 
        }

        for(int a=-2;a<=2;++a)
        {
            for(int b=-2;b<=2;++b)
            {
                if(isvalid(x+a,y+b))
                {
                    int nx = x + a;
                    int ny = y + b;

                    q.push_back(mp(mp(nx,ny),m+1));

                }
            }
        }
    }
}

int main() 
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    
    cin>>h>>w>>ch>>cw>>dh>>dw;

    grid.resize(h+1,vector<char>(w+1));
    level.resize(h+1,vector<int>(w+1,INT_MAX));

    for(int i=1;i<=h;++i)
    {
        for(int j=1;j<=w;++j)
        {
            cin>>grid[i][j];
        }
    }

    bfs(ch,cw);

    int ans = level[dh][dw];
    if(ans == INT_MAX) cout<<-1;   
    else cout<<ans;

}


Measured memory_bytes: 10008
#include <bits/stdc++.h>
#define endl "\n"
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef pair<ll, ll> PP;
#define rep(i, n) for(ll i = 0; i < ll(n); i++)
#define rrep(i, n) for(ll i = n - 1; i > -1; i--)
#define all(v) v.begin(), v.end()
#define pb push_back
#define fi first
#define se second
#define debug(V) rep(i, V.size()) cout << V[i] << " ";
const ll INF = (1LL << 61) - 1;
const ll MOD = 1000000007 /*998244353*/;
const ll MAX_N = 500010;
ll a, b, c, d, e, f, h, x, y, z, p, q, n, t, r, k, w, l, ans, i, j, u, v;
string S, T;
vl A, B;
void input() {
    cin >> n;
    rep(i, n) {
        cin >> x;
        if(i == 0)
            a = x;
        else if(i == 1)
            b = x;
        else
            t = t ^ x;
    }
}
void solve() {
    b += a;
    // cout << b << " " << t << endl;

    if(b % 2 != t % 2) {
        cout << -1 << endl;
        return;
    }

    // cout << "ok1" << endl;

    rep(i, 40) {
        if(((1LL << i) & t)) {
            A.pb(i);
            b -= (1LL << i);
            // cout << i << " " << b << endl;
        }
    }

    // cout << b << " " << p << endl;

    rep(i, 40) {
        if(((1LL << i) & t) == 0) {
            if((1LL << i + 1) & b) {
                b -= (1LL << i + 1);
                p += 1LL << i;
                B.pb(i);
            }
        }
    }

    // cout << b << " " << p << endl;

    if(b) {
        cout << -1 << endl;
        return;
    }
    // cout << "ok2" << endl;

    if(a < p) {
        cout << -1 << endl;
        return;
    }

    reverse(all(A));

    for(ll i : A) {
        if(p + (1LL << i) <= a) {
            p += 1LL << i;
        }
    }

    if(p == 0) {
        cout << -1 << endl;
        return;
    }

    cout << a - p << endl;
}
int main() {
    // cout<<fixed<<setprecision(15);
    cin.tie(0);
    ios::sync_with_stdio(false);
    input();
    solve();
}

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


namespace AtC
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = ReadInt();
            ulong[] namesCount = {0, 0, 0, 0, 0};
            List<char> head = new List<char>
            {
                'M', 'A', 'R', 'C', 'H'
            };

            for (int i = 0; i < N; i++)
            {
                var str = ReadString();
                var index = head.IndexOf(str[0]);
                if (index >= 0) namesCount[index]++;
            }

            ulong count = 0;
            for (int i = 0; i < 5; i++)
            for (int j = i + 1; j < 5; j++)
            for (int k = j + 1; k < 5; k++)
                count += namesCount[i] * namesCount[j] * namesCount[k];

            Out(count);
        }

        //最小公倍数
        static int LCM(int num1, int num2)
        {
            var gcd = GCD(num1, num2);
            return num1 * (num2 / gcd);
        }

        static long LCM(long num1, long num2)
        {
            var gcd = GCD(num1, num2);
            return num1 * (num2 / gcd);
        }

        //最大公約数
        static int GCD(int num1, int num2)
        {
            int a = Math.Max(num1, num2);
            int b = Math.Min(num1, num2);
            int mod;
            while ((mod = a % b) != 0)
            {
                a = b;
                b = mod;
            }

            return b;
        }

        static long GCD(long num1, long num2)
        {
            long a = Math.Max(num1, num2);
            long b = Math.Min(num1, num2);
            long mod;
            while ((mod = a % b) != 0)
            {
                a = b;
                b = mod;
            }

            return b;
        }

        static int[] ReadIntArray()
        {
            return Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
        }

        static int ReadInt()
        {
            return int.Parse(Console.ReadLine());
        }

        static long[] ReadLongArray()
        {
            return Console.ReadLine().Split(' ').Select(long.Parse).ToArray();
        }

        static long ReadLong()
        {
            return long.Parse(Console.ReadLine());
        }

        static string ReadString()
        {
            return Console.ReadLine();
        }

        static void Out(object o)
        {
            Console.WriteLine(o);
        }
    }

    static class EnumerableExtension
    {
        public delegate void Function<in T>(T val);

        public static void ForEach<T>(this IEnumerable<T> enumerable, Function<T> function)
        {
            foreach (var x in enumerable)
            {
                function(x);
            }
        }
    }

    class PriorityQueue<T>
    {
    }
}

Measured memory_bytes: 13268
//phoenix



#include <bits/stdc++.h>
using namespace std;


#define ll long long int
#define spdio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); 
#define pb push_back
#define pp pop_back
#define mp make_pair
//getline(cin,string);
const ll inf = (ll) 1e18 + 19;





void cazz() {
    ll t,n,i,j;
    cin>>n;
    cout<<(n/2)+(n%2>0)<<"\n";
}




int main() {
    spdio;
	cazz();
	return 0;
}

Measured memory_bytes: 256
R, G, B, n = map(int, input().split())

res = 0
for r in range(n + 1):
	for g in range(n + 1):
		b = n - r * R - g * G
		if b == 0 or (b > 0 and b % B == 0):
			res += 1
print(res)

Measured memory_bytes: 40812
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<cmath>
using namespace std;
#define REP(i,st,ed) for(int i=st,i##end=ed;i<=i##end;++i)
#define DREP(i,st,ed) for(int i=st,i##end=ed;i>=i##end;--i)
int n,m,k;
int main(){
	bool ans=0;
	scanf("%d%d%d",&n,&m,&k);
	REP(i,0,n)
		REP(j,0,m)
			if(i*m+j*n-2*i*j==k)ans=1;
	puts(ans?"Yes":"No");
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int)(n); ++i)
using ll = long long;
using P = pair<int,int>;
static const ll INF = 1000000000000000000;
static const ll MOD = 1000000007;

int main(){
	int a, b, c;
	cin >> a >> b >> c;
	int ans = max(0, c - (a - b));
	cout << ans << endl;
	return 0;
}



Measured memory_bytes: 256
from collections import Counter
n = int(input())
v = list(map(int,input().split()))
v1 = v[0::2]
v2 = v[1::2]
count1 = Counter(v1)
count2 = Counter(v2)
count1[0] = 0
count2[0] = 0
items1 = []
items2 = []
key1 = max(count1.keys(), key = count1.get)
items1.append([key1, count1[key1]])
del count1[key1]
key1 = max(count1.keys(), key = count1.get)
items1.append([key1, count1[key1]])

key2 = max(count2.keys(), key = count2.get)
items2.append([key2, count2[key2]])
del count2[key2]
key2 = max(count2.keys(), key = count2.get)
items2.append([key2, count2[key2]])

if items1[0][0] != items2[0][0]:
    m = items1[0][1] + items2[0][1]
else:
    m = max(items1[0][1] + items2[1][1], items1[1][1] + items2[0][1])
print(n - m)

Measured memory_bytes: 19040
#include <iostream>

using namespace std;

int main()
{
    long long N,M,sum=0;
    while(cin>>N>>M)
    {
        long long q;
        if(M>=N && M<=2*N)
            sum=M/2;
        else if(N>M)
           sum=M/2;
        else if(M>2*N)
        {
        sum=N;
		q=M-N*2;
        sum+=q/4;
        } 
        cout<<sum<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
# include<bits/stdc++.h>
 
using namespace std;
 
# define int long long
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<double, int> pdi;
typedef pair<ll, ll> pll;
 
# define S second
# define F first
# define kill(x) return(cout << x << endl, 0LL)
# define debug(x) cerr<< #x << " : " << x << endl
# define ddebug(x, y) cerr<< #x << " : " << x  << ", " << #y << " : " << y << endl
# define bin(x) cerr<< #x << " : " << bitset<4>(x) << endl
# define sz(s) (int)s.size()
# define sq(x) (x) * (x)
# define PB(x) push_back(x)
# define smax(x, y) (x) = max((x), (y))
# define smin(x, y) (x) = min((x), (y))
# define all(x) x.begin(), x.end()
# define SP fixed << setprecision(10)
# define MP make_pair
 
const int MAXN = 100 * 1000 + 10;
vector <int> adj[MAXN];
bool b[MAXN];

void dfs(int u, int p)
{
	for (int v : adj[u])
		if (v != p)
			dfs(v, u);

	if (!b[u])
	{
		if (b[p])
		{
			cout << "First\n";
			exit (0);
		}
		b[p] = b[u] = true;
	}
}

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

	int n;
	cin >> n;
	for (int i = 0; i < n - 1; i ++)
	{
		int u, v;
		cin >> u >> v;
		adj[u].PB(v);
		adj[v].PB(u);
	}
	b[0] = true;
	dfs(1, 0);
	cout << "Second\n";

	return 0;
}


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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

#define double long double

const int INF=1001001001;
const int INFLL=1001001001001001001ll;
const int mod=1000000007;
inline void add(int &a,int b){
    a+=b;
    if(a>=mod)a-=mod;
}
const double PI=acos(-1);
const double EPS=1e-7;

signed main(){
    int N;cin>>N;
    vint R(N);rep(i,N)cin>>R[i];

    sort(all(R));
    reverse(all(R));
    double ans=0;

    for(int k=3;k<=N;k++){
        vint r(R.begin(),R.begin()+k);
        sort(all(r));
        do{
            vector<double>L(k);
            rep(i,k)L[i]=r[i]*r[(i+1)%k]/2.0;
            double mi=*min_element(all(L));
            double lb=-mi;
            double ub=mi;
            rep(i,100){
                double mid=(ub+lb)/2;
                double sum=0;
                rep(j,k)sum+=acos(mid/L[j]);
                if(sum>=2*PI)lb=mid;
                else ub=mid;
            }

            double sum=0;
            rep(j,k)sum+=acos(lb/L[j]);
            if(abs(sum-2*PI)>EPS)continue;
            double val=0;
            rep(j,k)val+=sin(acos(lb/L[j]))*L[j];
            chmax(ans,val);
        }while(next_permutation(all(r)));
    }
    printf("%.20Lf\n",ans);
    return 0;
}

Measured memory_bytes: 3536
from sys import stdin
N = int(stdin.readline().rstrip())
data = []
for i in range(N):
    A,B = [int(x) for x in stdin.readline().rstrip().split()]
    data.append((A+B,A,B))
data.sort()
a = 0
b = 0
for ind,(i,j,k) in enumerate(data[::-1]):
    if ind % 2 == 0:
        a += j
    else:
        b += k
        
print(a-b)

Measured memory_bytes: 21372