akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <string>

using namespace std;
typedef long long llong;

#define MAX 10
const llong mod = 1000000000 + 7;

int main()
{
  int N, M;
  int S[MAX], C[MAX];
  scanf("%d%d", &N, &M);

  for (int i = 0; i < M; i++)
  {
    scanf("%d%d", &S[i], &C[i]);
  }

  int i;
  for (i = 0; i < 1000; i++)
  {
    string str = to_string(i);
    int flag = 1;
    if (str.size() != N)
      continue;
    for (int j = 0; j < M; j++)
    {
      if (str[S[j] - 1] - '0' != C[j])
        flag = 0;
    }
    if (flag)
      break;
  }
  if (i == 1000)
    i = -1;

  printf("%d", i);

  return 0;
}

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

int main(){
    int R, G, B, N;
    cin >> R >> G >> B >> N;
    int nr = N/R, ng = N/G, nb = N/B;

    int cnt = 0;
    rep(i, N/R+1){
        rep(j, N/G+1){
            int tmp = N-i*R-j*G;
            if(tmp%B==0 && tmp>=0){
                cnt++;
                // cout << i << j << endl;
            }
        }
    }
    cout << cnt << endl;
    return 0;
}

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

namespace AtCoder.Abc
{
    public class QuestionA
    {
        public static void Main(string[] args)
        {
            var inputArray = Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray();
            var H = inputArray[0];
            var W = inputArray[1];

            List<string> inputList = new List<string>();
            for(int indexH = 0; indexH < H; ++indexH) {
                var str = Console.ReadLine();
                inputList.Add(str);
            }

            for (int h = 0; h < H; ++h) {
                string lineStr = "";
                for (int w = 0; w < W; ++w) {
                    if(inputList[h].Substring(w, 1) == "#") {
                        lineStr += "#";
                    } else {
                        int count = 0;
                        //1行前
                        if (h != 0 && w != 0 && inputList[h - 1].Substring(w - 1, 1) == "#" ) {
                            ++count;
                        }
                        if (h != 0 && inputList[h - 1].Substring(w, 1) == "#") {
                            ++count;
                        }
                        if (h != 0 && w != W - 1 && inputList[h - 1].Substring(w + 1, 1) == "#") {
                            ++count;
                        }

                        //対象行
                        if (w != 0 && inputList[h].Substring(w - 1, 1) == "#") {
                            ++count;
                        }
                        if (w != W - 1 && inputList[h].Substring(w + 1, 1) == "#") {
                            ++count;
                        }

                        //次の行
                        if (h != H - 1 && w != 0 && inputList[h + 1].Substring(w - 1, 1) == "#") {
                            ++count;
                        }
                        if (h != H - 1 && inputList[h + 1].Substring(w, 1) == "#") {
                            ++count;
                        }
                        if (h != H - 1 && w != W - 1 && inputList[h + 1].Substring(w + 1, 1) == "#") {
                            ++count;
                        }

                        lineStr += count.ToString();
                    }
                }

                Console.WriteLine(lineStr);
            }

        }
    }
}

Measured memory_bytes: 13396
read a b c
n=0
while((a%2+b%2+c%2==0))
do
    if((a==b&&b==c))
    then
        echo -1
        exit
    fi
    n=$((n+1))
    na=$(((b+c)/2))
    nb=$(((a+c)/2))
    nc=$(((a+b)/2))
    a=$na
    b=$nb
    c=$nc
done
echo $n


Measured memory_bytes: 1272
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
typedef long long LL;
int N;
LL A[301][301];
LL B[301][301];

int main(){
    cin>>N;
    REP(i,N){
        REP(j,N){
            cin>>A[i][j];
            B[i][j]=A[i][j];
        }
    }
    
    REP(k,N){
        REP(i,N){
            REP(j,N){
                B[i][j]=min(B[i][j],B[i][k]+B[k][j]);
            }
        }
    }
    bool c=false;
    REP(i,N){
        REP(j,N){
            if(A[i][j]!=B[i][j])c=true;
        }
    }
    if(c){
       cout<<-1<<endl;
       return 0;
    }
    LL ans=0;
    REP(i,N){
        REP(j,i){
            bool check=false;
            REP(k,N){
                if(k==i)continue;
                if(k==j)continue;
                if(A[i][j]==(A[i][k]+A[k][j]))check=true;
            }
            if(check==false)ans+=A[i][j];
        }
    }
    cout<<ans<<endl;
    return(0);
}

Measured memory_bytes: 1664
#include <iostream>
#include <algorithm>
#include <vector>
#include <limits.h>
#include <cmath>

using namespace std;

using VS = vector<string>;    using LL = long long;
using VI = vector<int>;       using VVI = vector<VI>;
using PII = pair<int, int>;   using PLL = pair<LL, LL>;
using VL = vector<LL>;        using VVL = vector<VL>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))
#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)
#define FORR(i, s, e) for (int(i) = (s); (i) > (e); (i)--)
#define debug(x) cerr << #x << ": " << x << endl
const int INF = 1e9;                          const LL LINF = 1e16;
const LL MOD = 1000000007;                    const double PI = acos(-1.0);
int DX[8] = { 0, 0, 1, -1, 1, 1, -1, -1 };    int DY[8] = { 1, -1, 0, 0, 1, -1, 1, -1 };

/* -----  2017/12/04  Problem: codefestival2017_team_relay C / Link: __CONTEST_URL__  ----- */
/* ------問題------



-----問題ここまで----- */
/* -----解説等-----

同時ににぶたん？

----解説ここまで---- */

LL N,K;

LL ans = 0LL;

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

	cin >> N >> K;
	VL w(N,0),d(N,0);
	FOR(i,0,N){
		cin>> w[i]>> d[i];
	}
	LL L = 0;LL R = LLONG_MAX;//  座標
	FOR(kim,0,70){
		LL ret = 0;
		
		LL mid = (L+R)/2LL;
		FOR(i,0,N){
			LL p = (mid-w[i])/d[i];
			if(p>0)ret += p;
			if(mid>=w[i])ret++;
			if(ret>K)break;
		}
		if(ret>=K){R = mid;}
		else L = mid;
	}
	
	ans=R;
	cout << ans << "\n";

	return 0;
}


Measured memory_bytes: 1792
/*|In The Name Of Allah|*/

#include <bits/stdc++.h>

using namespace std;

int main(){
    int a,b,c=1,ans=0;
	cin>>a>>b;
	while(1){
		if(c>=b){
			break;
		}
		c+=a-1;
		ans++;
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main() {
	int n,m;
	cin>>n>>m;
	int sum=0;
	int x=((n)*(n-1))/2;
    int y=((m)*(m-1))/2;
	cout<<x+y; 
    return 0;
}

Measured memory_bytes: 256
while True:
    try:
        inlist = list(map(int,input().split(",")))
        v2 = inlist.pop()
        v1 = inlist.pop()
        time = sum(inlist)/(v1+v2)
        length = time*v1
        for i in range(11):
            if length<=sum(inlist[:i]): print(i); break
    except EOFError: break

Measured memory_bytes: 7400
#include <iostream>
#include <iomanip>
#include <sstream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <complex>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <cassert>
#include <climits>
#include <queue>
#include <set>
#include <map>
#include <valarray>
#include <bitset>
#include <stack>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
typedef long long ll;
typedef pair<int,int> pii;
const int INF = 1<<29;
const double PI = acos(-1);
const double EPS = 1e-8;

string in[100];

int main() {
  int m;
  cin >> m;
  map<string, pii> mp;
  REP(i,m) {
    string name;
    cin >> name;
    int a, b;
    cin >> a >> b;
    mp[name] = pii(a,b);
  }
  int n;
  cin >> n;
  REP(i,n)cin >> in[i];
  stack<set<int> > stk;
  int mod = 256;
  REP(i,n) {
    string s = in[i];
    if (mp.count(s)) {
      pii p = mp[s];
      set<int> se;
      for (int j=p.first; j<=p.second; ++j) {
        se.insert(j);
      }
      stk.push(se);
    } else if (s.size() == 1 && !isdigit(s[0])) {
      assert(stk.size());
      set<int> b = stk.top();
      stk.pop();
      assert(stk.size());
      set<int> a = stk.top();
      stk.pop();
      set<int> se;
      FOR(it, a) {
        FOR(jt, b) {
          if (s=="+") se.insert((*it + *jt)%mod);
          else if (s=="-") se.insert((*it - *jt + mod)%mod);
          else if (s=="*") se.insert((*it * *jt) %mod);
          else {
            if (*jt == 0) {
              puts("error");
              return 0;
            }
            se.insert(*it / *jt % mod);
          }
        }
      }
      stk.push(se);
    } else {
      set<int> se;
      se.insert((atoi(s.c_str()) % mod + mod) % mod);
      stk.push(se);
    }
    //FOR(it, stk.top()) cout << *it << " ";cout << endl;
  }
  puts("correct");
}

Measured memory_bytes: 1300
#include<iostream>
#include <stdio.h>
#include <vector> 
#include <algorithm>
#include <functional>

using namespace std;

int main(){
   int a, b, c;
   cin >> a >> b >> c;
    
   	std::vector<int> data;
	data.push_back(a);
	data.push_back(b);
	data.push_back(c);

	std::sort(data.begin(),data.end());//???????????????
        cout << data[0] << " "<< data[1] << " "<<data[2] <<endl;
  
}

Measured memory_bytes: 3148
k,n = map(int,input().split())

A = list(map(int,input().split()))
L = [0] * n
for i in range(n):
  if i != n - 1:
    L[i] = A[i+1] - A[i]
  else:
    L[i] = k - A[i] + A[0]
print(k - max(L))

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


int main(){

    int n; cin >> n;
    set<int> S;
    for(int i = 0; i < n; i++){
        int a; cin >> a;
        if(S.find(a) != S.end()) S.erase(a);
        else S.insert(a);
    }
    cout << S.size() << endl;
    return 0;
}

Measured memory_bytes: 4864
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <functional>
#include <list>
#include <bitset>
#include <numeric>
#include <utility>
#define INF 1e9
#define MOD 1000000007
#define MAX 210000
#define ll long long
using namespace std;
typedef unsigned long long ull;
typedef pair<int, int> p;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n,m;
    cin>>n>>m;
    int ans=1;
    int x=m/n;
    for(int i=x;0<i;i--){
        if(m%i==0){
            cout<<i;
            return 0;
        }
    }

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,o,n) for(long long i = o;i<n;i++)
#define oneforall ios::sync_with_stdio(false);cin.tie(0);
#define all(v) (v).begin(),(v).end()
#define ini(...) int __VA_ARGS__; in(__VA_ARGS__)
#define inl(...) long long __VA_ARGS__; in(__VA_ARGS__)
#define ins(...) string __VA_ARGS__; in(__VA_ARGS__)
#define int long long 
const long long inf=1e18;
void in(){} template <typename T,class... U> void in(T &t,U &...u){ cin >> t; in(u...);}
void out(){cout << "\n";} template <typename T,class... U> void out(const T &t,const U &...u){ cout << t; if(sizeof...(u)) cout << " "; out(u...);}
typedef vector<int> vi;
typedef vector<long long> vl;
typedef long long ll;
typedef vector<pair<long, long > > vpll;
typedef vector<pair<int, int > > vpii;
#define FORR(x,arr) for(auto& x:arr)
#define ZERO(a) memset(a,0,sizeof(a))





//3111111111111111111111111111111

	vi adj[310000];
	bool used[310000];
	vi rick(310000);
	void dfs(int x){
		used[x] = 1;
		FORR(x1,adj[x]){
			if(used[x1])continue;
			rick[x1]+=rick[x];
			dfs(x1);
		}
	}



	void solve(){

		ini(n);
		ini(n1);
		cerr<<1;
		FOR(i,0,n-1){
			ini(x);
			ini(x1);
			adj[x].push_back(x1);
			adj[x1].push_back(x);
		}
		FOR(i,0,n1){
			ini(x);
			ini(x1);
			rick[x]+=x1;
		}
		dfs(1);
		FOR(i,1,n+1){
			cout<<rick[i]<<" ";
		}
		out();










	}	























int32_t main() {
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall 
	oneforall

	solve();
	


	return 0;
}


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

#define ull unsigned long long
#define ll long long
#define imei(...)   "[ "<< #__VA_ARGS__ <<" = "<< __VA_ARGS__ <<" ] "

using namespace std;

void solve(int t) {
    int n;
    cin >> n;
}

vector<int> c;

int main(int argc, char *argv[])
{
    int n;
    ll ans = 0;
    cin >> n;

    c.resize(n+1, 0);

    for (int i = 1; i <= n; i++) {
        for (int j = i; j <= n; j+=i) {
            c[j]++;
        }
    }

    for (ll i = 1; i <= n; i++) {
        ans += i * c[i];
    }

    cout << ans<<endl;

    return 0;
}


Measured memory_bytes: 42244
package main

import "fmt"

func main() {
	var s string
	fmt.Scan(&s)

	a := s[:2]
	b := s[2:]

	aMM := a <= "12" && a != "00"
	bMM := b <= "12" && b != "00"

	if aMM && bMM {
		fmt.Println("AMBIGUOUS")
		return
	}

	if aMM && !bMM {
		fmt.Println("MMYY")
		return
	}

	if !aMM && bMM {
		fmt.Println("YYMM")
		return
	}

	fmt.Println("NA")
}


Measured memory_bytes: 512
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
 
int xmove[4001];
int ymove[4001];
int xmove_len=0, ymove_len=0;
 
char S[8001];
int goalx,goaly;
 
char dp[4001][8001];
 
int abs(int a){ return (a < 0)? -a : a;}

int compare_disascending(const void * a, const void * b){
    return *(int*)b - *(int*)a;
}
char possible(int goal, int * move, int move_len){
    if(move_len == 0){
        if(goal == 0) return 1;
        else          return 0;
    }
    qsort(move,move_len,sizeof(int),compare_disascending);
    for(int i = 0; i < move_len; i++){
        if(goal > 0) goal -= move[i];
        else         goal += move[i];
    }
    if(goal == 0) return 1;
    else          return 0;
    /*
    int sum = 0;
    for(int i = 0; i < move_len ; i++) sum += move[i];
      
    if(sum < goal || (sum-goal) % 2 == 1) return 0;
 
    memset(dp, 0, sizeof(dp));
    dp[0][0] = 1;
    dp[0][move[0]]=1;
    for(int i = 1; i < move_len; i++){
        for(int j = 0; j <= (sum-goal)/2 ; j++){
            dp[i][j] |= dp[i-1][j];
            if(j-move[i] >= 0) dp[i][j] |= dp[i-1][j-move[i]];    
        }
    }
    return dp[move_len-1][(sum-goal)/2];
    */
}
 
int main(void){
    scanf("%s",S);
    scanf("%d %d",&goalx,&goaly);
 
    int xmove_ind = 0, ymove_ind = 0;
    char dir_x = 1;
    int count = 0;
    for(int i = 0; i <= strlen(S); i++){
        if(i == strlen(S) || S[i] == 'T' ){
            if(dir_x) xmove[xmove_ind++] = count;
            else      ymove[ymove_ind++] = count;
            
            dir_x = !dir_x;
            count = 0;
        }else{
            count++;
        }
    }
    xmove_len = xmove_ind;
    ymove_len = ymove_ind;
 
    if(possible(abs(goaly),ymove,ymove_len)){
        if(xmove_len==1){
            if(goalx == xmove[0]) puts("Yes");
            else                  puts("No");
        }else{
            if(possible(abs(goalx-xmove[0]), &(xmove[1]), xmove_len-1)) puts("Yes");
            else                                                        puts("No");
        }
    }else{
        puts("No");
    }
    
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <cstring>
#include <climits>
#include <string.h>
#include <stdio.h>
#define LL long long
#define pii pair<int,int>
#define piii pair<int, pii >
#define REP(i,n) for (int (i)=0;(i)<(n);(i)++)
#define vi vector<int>
#define vpi vector< pii >
#define INF 2147483647
#define big 20160116
#define pb push_back
#define mp make_pair
using namespace std;
const int Maxk=1005;
string mul(string a,string b){
	int res[Maxk];
	memset(res,0,sizeof(res));
	reverse(a.begin(),a.end());
	reverse(b.begin(),b.end());
	for (int i=0;i<a.length();i++){
		for (int j=0;j<b.length();j++){
			res[i+j]+=(a[i]-'0')*(b[j]-'0');
		}
	}
	for (int i=0;i<Maxk;i++){
		if (res[i]>=10) {
			res[i+1]+=(res[i]/10);
			res[i]%=10;
		}
	}
	string ret;
	bool flag=false;
	for (int i=Maxk-1;i>=0;i--){
		if (flag || res[i]){
			flag=true;
			ret=ret+(char)(res[i]+'0');
		}
	}
	if (ret=="") ret="0";
	return ret;
}
string add(string a,string b){
	if (a.length()<b.length()) swap(a,b);
	while (a.length()!=b.length()){
		b='0'+b;
	}
	for (int i=a.length()-1;i>=0;i--){
		a[i]+=(b[i]-'0');
		if (a[i]>'9' && i){
			a[i]-=10;
			a[i-1]++;
		}
	}
	if (a[0]>'9'){
		a[0]-=10;
		a='1'+a;
	}
	return a;
}
const int Maxn=100005;
int a[Maxn];
int n,m;
vector<pair<int,int> > e,ee;
LL x[Maxn];
int main(){
	scanf("%d %d",&n,&m);
	for (int i=0;i<n;i++){
		scanf("%d",&a[i]);
	}
	LL tot=0;
	for (int i=1;i<n;i++){
		if (a[i-1]<a[i]){
			e.push_back(mp(a[i-1],i));
			e.push_back(mp(a[i],~i));
			tot+=(LL)a[i]-a[i-1];
		}
		else{
			e.push_back(mp(a[i-1],i));
			e.push_back(mp(a[i]+m,~i));
			//ee.push_back(mp(a[i-1],i));
		//	ee.push_back(mp(a[i]+m,~i));
			tot+=(LL)(a[i]+m-a[i-1]);
		}
	}
//	cout<<tot<<endl;
	sort(e.begin(),e.end());
//	sort(ee.begin(),ee.end());
	int cnt=0;
	int cur=0;
	LL sum=0;
	LL delay=0;
	for (int i=1;i<=m+m;i++){
	delay=0;
		
		x[(i-1)%m+1]+=sum;
		x[(i-1)%m+1]-=cur;
		while (1){
			if (cnt!=(int)e.size() && e[cnt].first==i){
				if (e[cnt].second>0) cur++;
				else {
					cur--;
					
					if (a[~e[cnt].second]>a[~e[cnt].second-1]){
						sum-=(LL)(a[~e[cnt].second]-a[~e[cnt].second-1]);
					}
					else{
						sum-=(LL)(a[~e[cnt].second]-a[~e[cnt].second-1]);
						sum-=(LL)m;
					} 
					//cerr<<'f'<<endl;
					//sum-=(LL)(a[~e[cnt].second]-a[~e[cnt].second-1]),cerr<<'f';
				}
				cnt++;
			}
			else{
				break;
			}
		}
		sum+=(LL)cur;
	//	sum+=(LL)delay;
	}
	LL ans=0;
	for (int i=1;i<=m;i++){
	//	cout<<x[i]<<endl;
		ans=max(ans,x[i]);
	}
	cout<<tot-ans<<endl;
	return 0;
} 

Measured memory_bytes: 3056
import sys
import random
import time
my_input = sys.stdin.readline

start = time.time()
D = int(input())
C = list(map(int, my_input().split()))
S = [list(map(int, my_input().split())) for _ in range(D)]


def main():
    cnt = 0
    best_ans, best_score = generate_first_ans()
    while time.time() - start < 1.85:
        cnt += 1
        ans = best_ans[:]

        x = random.random()
        if x > 0.70:
            si, sj = random.randint(0, 364), random.randint(0, 364)
            if si == sj:
                continue
            ans[si], ans[sj] = ans[sj], ans[si]
        else:
            si = random.randint(0, 364)
            sx = random.randint(0, 25)
            if ans[si] == sx:
                continue
            ans[si] = sx

        score = calc_score(ans)
        if score > best_score:
            best_score = score
            best_ans = ans

    #print(best_score, cnt)
    for a in best_ans:
        print(a + 1)


def generate_first_ans():
    best_ans = []
    best_score = 0
    last_day = [-1] * 26
    for d in range(365):
        d_ans = -1
        d_score = -float('inf')
        d_last_day = [-1] * 26
        for t in range(26):
            d_tmp_score = 0
            d_tmp_score += S[d][t]
            d_tmp_last_day = last_day[:]
            d_tmp_last_day[t] = d
            for c, ld in zip(C, d_tmp_last_day):
                d_tmp_score -= c * (d - ld)

            if d_tmp_score > d_score:
                d_ans = t
                d_score = d_tmp_score
                d_last_day = d_tmp_last_day[:]

        best_ans.append(d_ans)
        best_score += d_score
        last_day = d_last_day[:]

    return best_ans, best_score


def calc_score(T):
    score = 0
    last_day = [-1] * 26
    for d, t in enumerate(T):
        score += S[d][t]
        last_day[t] = d
        for c, ld in zip(C, last_day):
            score -= c * (d - ld)
    return score


if __name__ == "__main__":
    main()


Measured memory_bytes: 83144
#include <cstdio>
#define ll long long

int n;
ll m, now, res;

int main(){
	int i;
	ll a;
	scanf("%d %lld", &n, &m);
	for(i = 0; i < n; i++){
		scanf("%lld", &a);
		if(now > a) res += a + m - now;
		else res += m;
		now = a + m;
	}
	printf("%lld", res);
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  int a[100];
  for(int i=0;i<n;i++){
    cin>>a[i];
  }
  int ans=0;
  int cnt=1;
  for(int i=1;i<n;i++){
    if(a[i-1]==a[i])cnt++;
    else{
      ans+=cnt/2;
      cnt=1;
    }
  }
  ans+=cnt/2;
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = a; i < (b); i++)
#define rrep(i, a, b) for (int i = a; i >= (b); i--)
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
using P = pair<int, int>;

const int INF = 1000000;
const int MOD = 1e9 + 7;
int t[105][105], c[105][105];
char s[105][105];
int main() {
   int h, w;
   cin >> h >> w;
   rep(i, 0, h) { rep(j, 0, w) cin >> s[i][j]; }
   rep(i, 0, h) { rep(j, 0, w) t[i][j] = INF; }
   queue<P> que;
   que.push(P(0, 0));
   if (s[0][0] == '#')
      t[0][0] = 1;
   else
      t[0][0] = 0;
   while (que.size()) {
      P X = que.front();
      que.pop();
      int x = X.first, y = X.second;
      if (x >= w || y >= h) continue;
      if (c[y][x] == 1) continue;
      c[y][x] = 1;

      if (x + 1 < w && y < h) {
         if (s[y][x + 1] == '#') {
            if (s[y][x + 1] == s[y][x])
               t[y][x + 1] = min(t[y][x + 1], t[y][x]);
            else
               t[y][x + 1] = min(t[y][x + 1], t[y][x] + 1);
         } else {
            t[y][x + 1] = min(t[y][x + 1], t[y][x]);
         }
         que.push(P(x + 1, y));
      }
      if (y + 1 < h && x < w) {
         if (s[y + 1][x] == '#') {
            if (s[y + 1][x] == s[y][x])
               t[y + 1][x] = min(t[y + 1][x], t[y][x]);
            else
               t[y + 1][x] = min(t[y + 1][x], t[y][x] + 1);
         } else {
            t[y + 1][x] = min(t[y + 1][x], t[y][x]);
         }
         que.push(P(x, y + 1));
      }
   }
   cout << t[h - 1][w - 1] << endl;
   return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
#define ll long long
#define fi first
#define se second
#define pb push_back
#define in insert
#define mp make_pair
using namespace std;
const int N = 200;
char a[N][N];
int n,m,k;
string s;
set<int>setik;

vector<char>v;

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	
	cin >> n >> m;
	for(int i = 0; i < n; i++) for(int j = 0; j < m; j++) cin >> a[i][j];

	for(int i = 0; i < n; i++)
	{
		for(int j = 0; j < m; j++)
		{
			int c = 0;
			int c1 = 0;
			if(a[i][j] == '.')
			{
				for(int k = j; k < m; k++)
				{
					if(a[i][k] == '.')c++;
				}
			}
			//cout << c << ' ' ;
			if(c == m)
			{
				for(int k = j; k < m; k++)
				{
					a[i][k] = '-';
					//if(a[i][k] == '.')c++;
				}	
			}
		}
	}

	for(int i = 0; i < n; i++)
	{
		for(int j = 0; j < m; j++)
		{
			int c1 = 0;
			if(a[i][j] == '.' || a[i][j] == '-')
			{
				for(int k = i; k < n; k++)
				{
					if(a[k][j] == '.' || a[k][j] == '-')c1++;
				}
			}

				if(c1 == n)
					{
						for(int k = i; k < n; k++)
					{
						a[k][j] = '-';
					//if(a[i][k] == '.')c++;
					}	
			}
		}
	}
	for(int i = 0; i < n; i++)
	{
		for(int j = 0; j < m; j++)
		{
			if(a[i][j] != '-')cout << a[i][j];
		}
		cout << endl;
	}
	
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i, n) for(int i = 0; i < n; i++)
#define all(a) a.begin(), a.end()
#define P pair<int, int>
#define F first
#define S second
#define mod 1000000007
#define INF 9000000000000000000
signed main() {
    int a,b;cin>>a>>b;
    cout<<max((int)0,a-2*b)<<endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main(void)
{	
	unsigned long i, n, n2, a=1;
	
	scanf("%lu", &n );
	
	n2 = n;
	for(i=1; i<=n2; i++){
//		n =  (i * n);
		a = a * i;
	//	printf("%d\n", a);
	}
	printf("%lu\n", a);
	
	
	

	return 0;
}

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

int main(){
  int n;
  cin >> n;
  int h[n];
  rep(i,n) cin >> h[i];
  int m = h[0];
  bool f = true;
  for(int i = 1; i < n; i++) {
    m = max(m,h[i]);
    if(m-h[i] > 1) f = false;
  }
  cout << (f ? "Yes" : "No") << endl;
  return 0;
}


Measured memory_bytes: 3984
import sys
input = sys.stdin.readline
def main():
    N, K = map(int, input().split())
    A = list(map(int, input().split()))
    loop_count = min(K, 42)
    for _ in range(loop_count):
        light_range_list = [[0, 0] for _ in range(N)]
        for i, a in enumerate(A):
            start, end = max(0, i-a), min(N, i+a+1)
            light_range_list[i][0] = start
            light_range_list[i][1] = end
        ans = [0] * N
        for light_range in light_range_list:
            start, end = light_range[0], light_range[1]
            ans[start] += 1
            if end < N:ans[end] -= 1
        for i in range(N-1):
            ans[i+1] = ans[i] + ans[i+1]
        A = ans
    print(" ".join(list(map(str, ans))))
if __name__ == "__main__":
    main()

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

int main(){
  int n,k,a,t;
  long double ans=0;
  cin >> n >> k;
  rep(i,n){
    t = 0;
    a = i+1;
    while(a<k){
      a *= 2;
      t++;
    }
    ans += powl(0.5,t);
  }
  ans = ans / n;
  cout << fixed << setprecision(12) << ans << endl;
}

Measured memory_bytes: 640
#include<iostream>
#include<string>
#include<vector>
#include<utility>
#include<algorithm>
#include<map>
#include<cstdlib>
#include<cmath>
#include<numeric>
#include<iomanip>
using namespace std;
using ll =long long;

int main() {
	int H, A;
	cin >> H >> A;
	H%A>0?cout << H / A + 1 : cout << H / A ;
	

}

	

Measured memory_bytes: 256
n,T=map(int,raw_input().split())
t=map(int,raw_input().split())
ans=0
now=0
for i in xrange(n):
    if t[i]<=now:
        ans+=t[i]+T-now
        now=t[i]+T
    else:
        ans+=T
        now=t[i]+T
print ans

Measured memory_bytes: 20060
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")

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

const int MX=200005;
int a[MX],b[MX];

int main()
{
    int n,k;
    scanf("%d %d",&n,&k);
    for(int i=1;i<=n;i++) scanf("%d",&a[i]);
    bool flag=true;
    while(flag && k--){
        for(int i=1;i<=n;i++){
            b[max(1,i-a[i])]++;
            b[min(n+1,i+a[i]+1)]--;
        }
        flag=false;
        for(int i=1;i<=n;i++){
            b[i]+=b[i-1];
            if(a[i]!=b[i]) a[i]=b[i],flag=true;
        }
        for(int i=1;i<=n;i++) b[i]=0;
    }
    for(int i=1;i<=n;i++){
        if(i>1) printf(" ");
        printf("%d",a[i]);
    }
    printf("\n");
    return 0;
}

Measured memory_bytes: 5300
#include <iostream>
#include <stdio.h>
#include <cstring>
#include <cstdio>
#include <math.h>
#include <algorithm>
#include <vector>
#include <string>
#include <stdlib.h>
#include <queue>
#include <stack>
#include <utility>
#include <fstream>
#include <random>
#include <map>
#include <unordered_map>
#include <cstdlib>
#include <functional>
#include <random>
#include <time.h>
#include <chrono>
#include <sstream>
#include <iomanip>
#include <numeric>
#include <iostream>
#include <limits>
#include <numeric>
#include <type_traits>
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define ll long long
#define INF 1000000001
#define MOD 1000000007
#define SORT(s) sort(s.begin(), s.end());
#define REVERSE(s) reverse(s.begin(), s.end());
#define SUM(s) accumulate(s.begin(), s.end(), 0LL);
#define P pair<int,int>
#define mp make_pair
#define valid(x,y,h,w) (0<=x&&x<h&&0<=y&&y<w)
//#define int ll
int dx[4] = { 0,1,0,-1 };
int dy[4] = { 1,0,-1,0 };
int ndx[8] = { 0,1,0,-1, 1,1,-1,-1 };
int ndy[8] = { 1,0,-1,0, 1,-1,-1,1 };
using namespace std;
int POW(int x, int y) { return int(pow(double(x), double(y))); }
double log(double a, double b) { return log(b) / log(a); }


int main() {
	
	int s, w;
	cin >> s >> w;


	if (w >= s) {
		cout << "unsafe" << endl;
	}
	else {
		cout << "safe" << endl;
	}


}




Measured memory_bytes: 3620
$memo = {}
$n = gets.to_i
$a = (1..$n).map{gets.to_i}

def inc(x);(x+1)%$n;end
def dec(x);(x+$n-1)%$n;end

def dfs(l,r)
  $memo[[l,r]] ||= if l==r
    $a[l]
  elsif inc(l)==r
    [$a[l],$a[r]].max
  else
    [[$a[l],inc(l),r],[$a[r],l,dec(r)]].map{|x,nextl,nextr|
      if $a[nextl] > $a[nextr]
        nextl = inc(nextl)
      else
        nextr = dec(nextr)
      end
      x + dfs(nextl,nextr)
    }.max
  end
end

p $n.times.map{|i|dfs(inc(i),i)}.max

Measured memory_bytes: 242504
import java.util.*;
class P{
    String name;int m,point;
    int[] d;
    public P(String name,int m,int[] d){
	this.name=name;this.m=m;this.d=d;
	point=0;
    }
}
class Main{
    boolean debug=true;
    Scanner sc=new Scanner(System.in);

    void run(){
	while(true){
	    int n=sc.nextInt();if(n==0)break;
	    int[] a=new int[31];
	    P[] list=new P[n];
	    for(int i=0;i<n;i++){
		String name=sc.next();
		int m=sc.nextInt();
		int[] d=new int[m];
		for(int j=0;j<m;j++){d[j]=sc.nextInt();a[d[j]]++;}
		list[i]=new P(name,m,d);
	    }

	    for(int i=0;i<n;i++){
		for(int j=0;j<list[i].m;j++){
		    list[i].point+=n+1-a[list[i].d[j]];
		}
	    }
	    Arrays.sort(list,new Comparator<P>(){
		    public int compare(P o1,P o2){
			if(o1.point!=o2.point)return o1.point-o2.point;
			return o1.name.compareTo(o2.name);
		    }
		});
	    System.out.printf("%d %s\n",list[0].point,list[0].name);
	}

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

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

using namespace std;

typedef long long ll;

template<typename T>
class CumulativeSum {
    const int n;
    std::vector<T> sum_data;
public:
    CumulativeSum(vector<T> data) : n(data.size()) {
        sum_data.resize(n + 1);
        for (int i = 0; i < n; i++) {
            sum_data[i + 1] = sum_data[i] + data[i];
        }
    }

    // 区間 [l, r) 番目の範囲の和を求める．(l = r のときは 0 を返す．)
    T sum(int l, int r) const {
        assert(0 <= l && l <= r && r <= n);
        return sum_data[r] - sum_data[l];
    }
};
typedef CumulativeSum<ll> CumSum;


int main() {
    long long N;
    cin >> N;
    vector<ll> A(N);
    for(int i = 0 ; i < N ; i++){
        cin >> A[i];
    }
    CumSum s(A);

    map<ll, ll> cnt;
    ll ans = 0;
    cnt[0]++;
    for(int i = 0 ; i < N ; i++){
        ll ss = s.sum(0, i+1);
        ans += cnt[ss];
        cnt[ss]++;
    }
    cout << ans << endl;
}


Measured memory_bytes: 15844
#include <bits/stdc++.h>
using namespace std;
int main(void){
    long long int n,q,x;
    string s,l,r;
    std::map<string, long long int> map;
    cin>>n;
    for (int i=0;i<n;i++) {
        cin>>q;
        if (q==0) {
            cin>>s>>x;
            if (map.find(s)!=map.end()) {
                map.erase(s);
            }
            map.emplace(make_pair(s,x));
        } else if (q==1) {
            cin>>s;
            if (map.find(s)!=map.end()) {
                cout<<map.at(s)<<endl;
            } else {
                cout<<0<<endl;
            }
        } else if (q==2) {
            cin>>s;
            map.erase(s);
        } else if (q==3) {
            cin>>l>>r;
            auto itr3=map.lower_bound(l);
            auto itr4=map.upper_bound(r);
            for (auto it=itr3;it!=itr4;it++) {
                cout<<it->first<<" "<<it->second<<endl;
            }
        }
    }
}



Measured memory_bytes: 27744
#include <stdio.h>

int main(void)
{
	int time, hour, minute, second;
	
	scanf("%d", &time);
	
	hour = time / (60 * 60);
	minute = (time % 3600) / 60;
	second = time % 60;
	
	printf("%d:%d:%d\n", hour, minute, second);
	
	return 0;
}

Measured memory_bytes: 592
#include <bits/stdc++.h>
#pragma GCC optimize(3, "Ofast")
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
inline int read() {
    int s = 0, w = 1;
    char ch = getchar();
    while (ch < '0' || ch>'9') { if (ch == '-')w = -1; ch = getchar(); }
    while (ch >= '0' && ch <= '9') s = s * 10 + ch - '0', ch = getchar();
    return s * w;
}
#define f(i, l, r) for (int i = l; i <= r; ++i)
#define rf(i, r, l) for (int i = r; i >= l; --i)
#define all(x) (x).begin(), (x).end()
#define l l
#define r r
#define lch (o << 1)
#define rch (o << 1 | 1)
#define mid ((l + r) >> 1)
#define mem(x, y) memset(x, y, sizeof(x))
#define mod1(x) ((x >= mod) && (x -= mod))
#define mod2(x) ((x < 0) && (x += mod))

const int inf = 1e9 + 7;
const ll INF = INT64_MAX;
double eps = 1e-6;
const int mod = 1e9 + 7;
const int N = 1e6 + 10;
const double pi = acos(-1.0);
ll power(ll a, ll b) { ll res = 1; while (b) { if (b & 1)res = res * a % mod; a = a * a % mod; b >>= 1; }return res; }
int gcd(int a, int b) { return !b ? a : gcd(b, a % b); }
void add(ll& a, ll b) { a += b; mod1(a); mod2(a); }
/*int len, C[N], clen;
int id(int v) {return lower_bound(C + 1, C + len, v) - C;}
void initC() { sort(C + 1, C +1+ clen); len = unique(C + 1, C + 1 + clen) - C - 1; }*/



int main() {
    ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#ifdef local
    freopen("in.txt", "r", stdin);
    int start = clock();
#endif
    string s; cin >> s;
    int len = 0; int mx = 0;
    f(i, 0, 2)if (s[i] == 'R') {
        len++;
        mx = max(mx, len);
    }
    else {
        len = 0;
    }
    mx = max(mx, len);
    cout << mx;

#ifdef local
    int end = clock();
    cout << '\n' << end - start << "ms";
#endif* /
}

Measured memory_bytes: 3648
n , m = map(int,input().split())
q = []
for i in range(m):
    p , y = map(int,input().split())
    q.append([p,y,i])
ans = [0 for i in range(m)]
q.sort()

now = q[0][0]
cou = 1
for a , b , c in q:
    if now != a:
        now = a
        cou = 1
        ans[c] = str(a).rjust(6,'0') + str(cou).rjust(6,'0')
        cou += 1
    elif now == a:
        ans[c] = str(a).rjust(6,'0') + str(cou).rjust(6,'0')
        cou += 1
        
for i in ans:
    print(i)

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

int main(void){
    string s,t;
    cin >> s >> t;
    //文字列ｓを昇順ソート
    for(int i = 0;i < s.size();i++){
        for(int j = 0;j < s.size() - 1;j++){
            if(s[j] > s[j+1])swap(s[j],s[j+1]);
        }
    }
    //文字列ｔを降順ソート
    for(int i = 0;i < t.size();i++){
        for(int j = 0;j < t.size() - 1;j++){
            if(t[j] < t[j+1])swap(t[j],t[j+1]);
        }
    }
    
    //for(int i = 0;i < s.size();i++)cout << s[i] << " ";
    //cout << endl;
    //for(int i = 0;i < t.size();i++)cout << t[i] << " ";
    
    int size = t.size() > s.size() ? s.size() : t.size();
    int count = 0;
    for(int i = 0;i < size;i++){
        if(s[i] > t[i]){
            cout << "No" << endl;
            count = 0;
            break;
        } else if(s[i] == t[i]){
            count++;
        } else if(s[i] < t[i]){
            cout << "Yes" << endl;
            count = 0;
            break;
        }
    }
    if(count > 0){
        if(s.size() >= t.size()) cout << "No" << endl;
        else cout << "Yes" << endl;
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n;cin>>n;
  long long a=2,b=1;
  if(n==0)cout<<a;
  if(n==1)cout<<b;
  else{
    long long c;
  	for(int i=2;i<=n;i++){
    	c = b;
      b  = a+b;
      a  = c;
    }
    cout<<b;
  }
}

Measured memory_bytes: 3644
#define y1 askjdkasldjlkasd
#include <bits/stdc++.h>
#undef y1

using namespace std;

#define pb push_back
#define mp make_pair
#define fi(a, b) for(int i=a; i<=b; i++)
#define fj(a, b) for(int j=a; j<=b; j++)
#define fo(a, b) for(int o=a; o<=b; o++)
#define fdi(a, b) for(int i=a; i>=b; i--)
#define fdj(a, b) for(int j=a; j>=b; j--)
#define fdo(a, b) for(int o=a; o>=b; o--)
#define sz(x) (int)x.size()

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

#ifdef LOCAL
#define err(...) fprintf(stderr, __VA_ARGS__)
#else
#define err(...) while (0)
#endif

double START_TIME;

void exit() {
#ifdef LOCAL	
	cerr << "TIME: " << setprecision(5) << fixed << (clock() - START_TIME) / CLOCKS_PER_SEC << endl;
#endif	
	exit(0);
}

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

template<typename T>
ostream& operator<<(ostream& os, vector<T> v) {
	fi(0, sz(v) - 1) {
		os << v[i] << " ";
	}
	return os;
}

template<typename T>
ostream& operator<<(ostream& os, set<T> t) {
	for (auto z : t) {
		os << z << " ";
	}
	return os;
}

template<typename T1, typename T2>
ostream& operator<<(ostream& os, map<T1, T2> t) {
	cerr << endl;
	for (auto z : t) {
		os << "\t" << z.first << " -> " << z.second << endl;
	}
	return os;
}

#ifdef LOCAL
#define dbg(x) {cerr << __LINE__ << "\t" << #x << ": " << x << endl;}
#define dbg0(x, n) {cerr << __LINE__ << "\t" << #x << ": "; for (int ABC = 0; ABC < n; ABC++) cerr << x[ABC] << ' '; cerr << endl;}
#else
#define dbg(x) while(0){}
#define dbg0(x, n) while(0){}
#endif

#ifdef LOCAL
#define ass(x) if (!(x)) { cerr << __LINE__ << "\tassertion failed: " << #x << endl, abort(); }
#else
#define ass(x) assert(x)
#endif

///////////////////////////////////////////////////

const int MAX = 1e5 + 41;

int n, m, q;
vpii edges[2];

void no() {
	printf("No\n");
	exit();
}

void yes() {
	printf("Yes\n");
	exit();
}

struct Dsu {
	vi par;
	vi size;
	Dsu() {};
	Dsu(int n) {
		fi(0, n - 1) par.pb(i), size.pb(1);
	}
	int find(int x) {
		if (par[x] == x) return x;
		return par[x] = find(par[x]);
	}
	bool uni(int a, int b) {
		a = find(a);
		b = find(b);
		if (a == b) return false;
		size[a] += size[b];
		par[b] = a;
		return true;
	}
};

void solve () {
	if (m == n - 1) {
		if (sz(edges[1]) > 0) no();
		yes();
	}

	int comp = n;
	Dsu dsu1(n), dsu2(n);
	for (auto z : edges[0]) {
		comp -= dsu1.uni(z.first, z.second);
	}
	for (auto z : edges[1]) {
		int x = dsu1.find(z.first);
		int y = dsu1.find(z.second);
		if (x == y) no();
	}
	ll l = n;
	ll r = (ll) comp * (comp - 1) / 2 + (n - comp);
	if (l <= m && m <= r) {
		yes();
	} else {
		no();
	}	
}

int main() {
#ifdef LOCAL
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	START_TIME = (double)clock();
#endif
	
	scanf("%d %d %d", &n, &m, &q);
	fi(0, q - 1) {
		int x, y, z;
		scanf("%d %d %d", &x, &y, &z);
		edges[z].pb(mp(x, y));
	}
	solve();

	exit();
	return 0;
}





Measured memory_bytes: 3572
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pl;
#define all(a) (a).begin(),(a).end()
#define overload4(_1, _2, _3, _4, name, ...) name
#define rep1(n) for(ll i = 0;i < (n);i++)
#define rep2(i,n) for(ll i = 0;i < (n);i++)
#define rep3(i,a,b) for(ll i = (a);i < (b);i++)
#define rep4(i,a,b,c) for(ll i = (a);i < (b);i += (c))
#define rep(...) overload4(__VA_ARGS__, rep4, rep3, rep2, rep1)(__VA_ARGS__)
#define rrep1(n) for(ll i = (n)-1;i >= 0;i--)
#define rrep2(i,n) for(ll i = (n)-1;i >= 0;i--)
#define rrep3(i,a,b) for(ll i = (a)-1;i >= (b);i--)
#define rrep4(i,a,b,c) for(ll i = (a)-1;i >= (b);i -= (c))
#define rrep(...) overload4(__VA_ARGS__, rrep4, rrep3, rrep2, rrep1)(__VA_ARGS__)
#define SHOW(x) cout << #x << ": " << x << endl;
template<class T> ll sumArr(const T& a){ return accumulate(all(a), 0LL);}
template<class T> auto minArr(const T& a){ return *min_element(all(a));}
template<class T> auto maxArr(const T& a){ return *max_element(all(a));}
template<class T> void DEBUG_PRINT(T tmp){cout<<tmp<<endl;}
template<class T1,class... T2> void DEBUG_PRINT(T1 tmp,T2... tmp2){cout<<tmp<<" ";DEBUG_PRINT(tmp2...);}
ll gcd(ll a, ll b){ while(b){ ll c = b; b = a % b; a = c; } return a; }
const ll INF=1e18,MOD = 1e9+7;
const int iINF = 1e9;


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

    int x,y;
    cin>>x>>y;

    if(x * 2 <= y && x * 4 >= y && y % 2 == 0){
        cout<<"Yes"<<endl;
    }
    else{
        cout<<"No"<<endl;
    }
   
    return 0;
}


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

using namespace std;

#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)
#define unless(p) if(!(p))
#define until(p) while(!(p))

using ll = long long;
using P = std::tuple<int,int>;

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

int N;
int A[100100][3];
int dp[100100][3];

int rec(int d, int p){
    if(d == N){
        return 0;
    }

    if(dp[d][p] != -1){
        return dp[d][p];
    }

    int res = 0;
    for(int n=0;n<3;++n){
        if(d > 0 && n == p){
            continue;
        }

        res = std::max(res, A[d][n] + rec(d + 1, n));
    }

    return dp[d][p] = res;
}

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

    std::cin >> N;

    for(int i=0;i<N;++i){
        std::cin >> A[i][0] >> A[i][1] >> A[i][2];
    }

    memset(dp, -1, sizeof(dp));

    int res = rec(0, 0);
    std::cout << res << std::endl;
}


Measured memory_bytes: 10368
#include <cstdio>
using namespace std;

const int N = 510;
int n, m; char s[N][N];

template <class T> inline void in(T &x) {
	x = 0; int f = 1; char ch = getchar();
	for (; ch<'0' || ch>'9';) {if (ch=='-') f=-1; ch = getchar();}
	for (; ch>='0' && ch<='9';) x = x*10 + ch-'0', ch = getchar();
	x *= f;
}

inline void red(char *s) {
	int ls = 0; char ch = getchar();
	for (; ch!='.' && ch!='#'; ch = getchar());
	for (; ch=='.' || ch=='#'; ch = getchar()) s[++ls] = ch;
}

int main() {
	in(n), in(m);
	for (int i = 1; i <= n; ++i) red(s[i]);
	for (int i = 1; i <= n; ++i) {
		for (int j = 1; j <= m; ++j)
			if ((s[i][j] == '#' || (i & 1) || (j==1)) && j != m) putchar('#');
			else putchar('.'); putchar('\n');
	}
	putchar('\n');
	for (int i = 1; i <= n; ++i) {
		for (int j = 1; j <= m; ++j)
			if ((s[i][j] == '#' || (!(i&1)) || (j==m)) && j != 1) putchar('#');
			else putchar('.'); putchar('\n');
	}
	return 0;
}

Measured memory_bytes: 1024
#include<stdio.h>

int main(void){
#define NUM 26
	char str[1200];
	int ans[NUM]={0};
	char* p = str;
	char c = '0';
	int i = 0;

	while(scanf("%s", str) != EOF){
		p = str;
		while(*p != '\0'){
			c = *p;
			i = (int)(c - 'A');
			if(i>=0 && i<NUM) ans[i]++;
			else{
				i -= 0x20;
				if(i>=0 && i<NUM) ans[i]++;
			}
			p++;
		}
	}

	for(i=0;i<NUM;i++){
		printf("%c : %d\n", 'a'+i, ans[i]);
	}

	return 0;
}

Measured memory_bytes: 540
main = do
  n <- readLn :: IO Int
  s <- getLine :: IO String
  putStrLn $ show $ abc $ zip s $ tail $ zip s $ tail s

abc t = foldl step 0 t
    where step a (x,(y,z)) = a + if z == 'C' && y == 'B' && x == 'A' then 1 else 0


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

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

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

    vector<int> A(n);
    for(int i = 0; i < n; i++){
        A[i] = V[i] - C[i];
    }

    sort(A.rbegin(), A.rend());

    int ans = 0;
    for(int i = 0; i < n; i++){
        if(A[i] > 0) ans += A[i];
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include<iostream>
#include<string>
#include<cmath>
#include<queue>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<random>
#include<functional>
#include<algorithm>
#include<cstdio>
#include<bitset>
#include<unordered_map>
using namespace std;
//---------------------------------------------------
//ライブラリゾーン！！！！
typedef long long ll;
typedef long double ld;
#define str string
#define rep(i,j) for(ll i=0;i<(long long)(j);i++)
#define all(a) (a).begin(),(a).end()
const ll Mod = 1000000007;
const ll gosenchou = 5000000000000000;
short gh[2][4] = { { 0,0,-1,1 },{ -1,1,0,0 } };
struct P {
	ll pos, cost;
};
bool operator<(P a, P b) { return a.cost < b.cost; }
bool operator>(P a, P b) { return a.cost > b.cost; }
struct B {//隣接リスト表現
	ll to, cost;
};
struct E {//辺の情報を入れる変数
	ll from, to, cost;
};
bool operator<(E a, E b) {
	return a.cost < b.cost;
}
struct H {
	ll x, y;
};
bool operator<(H a, H b) {
	if (a.x != b.x) return a.x < b.x;
	return a.y < b.y;
}
bool operator>(H a, H b) {
	if (a.x != b.x) return a.x > b.x;
	return a.y > b.y;
}
bool operator==(H a, H b) {
	return a.x == b.x&&a.y == b.y;
}
bool operator!=(H a, H b) {
	return a.x != b.x || a.y != b.y;
}
ll gcm(ll i, ll j) {//最大公約数
	if (i > j) swap(i, j);
	if (i == 0) return j;
	return gcm(j%i, i);
}
ld rad(H a, H b) {
	return sqrt(pow(a.x - b.x, 2.0) + pow(a.y - b.y, 2.0));
}//rad＝座標上の2点間の距離
ll ari(ll a, ll b, ll c) {
	return (a + b)*c / 2;
}//等差数列の和
ll fact(ll x, ll k, ll p) {//最大値、個数、あまり
	ll sum = 1;
	for (int i = 0; i < k; i++) {
		sum *= (x--);
		sum %= p;
	}
	return sum;
}//階乗(正）
ll mod_pow(ll x, ll n, ll p) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res*x%p;
		x = x*x%p;
		n >>= 1;
	}
	return res;
}//x^n%p
int ctoi(char a) {
	return (int)a - '0';
}
#define int long long
const long long Inf = 4523372036854775807;
const int inf = 15000000000;
//----------------------------------------------------
//++++++++++++++++++++++++++++++++++++++++++++++++++++
int n, l;
int a[100000];
signed main() {
	cin >> n >> l;
	for (int i = 0; i < n; i++) 
		cin >> a[i];
	int res = 0, t;
	for (int i = 1; i < n; i++) {
		if (res < a[i] + a[i - 1]) {
			res = a[i] + a[i - 1];
			t = i;
		}
	}
	if (res >= l) {
		cout << "Possible\n";
		for (int i = 1; i < t; i++)
			cout << i << endl;
		for (int i = n - 1; i > t; i--)
			cout << i << endl;
		cout << t << endl;
	}
	else {
		cout << "Impossible\n";
	}
	getchar(); getchar();
}


Measured memory_bytes: 1536
#include <stdio.h>
#include <vector>
#include <algorithm>

using namespace std;

int n;
vector<int> sortedk;

int main()
{
	scanf("%d",&n);
	for (int i = 0; i < n + n; ++i)
	{
		int kusi;
		scanf("%d",&kusi);
		sortedk.push_back(kusi);
	}
	sort(sortedk.begin(), sortedk.end());
	int ans = 0;
	for (int i = 0; i < n; ++i)
	{
		ans += sortedk[i*2];
	}
	printf("%d\n", ans);
	return 0;
}

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

using ll = long long;
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define REP(i, n) FOR(i, 0, n)
#define REP1(i, n) FOR(i, 1, (n) + 1)
#define ALL(c) (c).begin(), (c).end()
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;}
const int MOD = 1000000007;

int main() {
    int n, m;
    cin >> n >> m;
    vector<vector<int>> w(m + 1, vector<int>());
    int a, b;
    REP(i, n) {
        cin >> a >> b;
        if (a > m) continue;
        w[a].push_back(b);
    }
    ll t = 0;
    priority_queue<int> q;
    REP1(i, m) {
        for (int x : w[i]) {
            q.push(x);
        }
        if (!q.empty()) {
            t += q.top(); q.pop();
        }
    }
    cout << t << endl; 
}


Measured memory_bytes: 5632
import math
N,D = map(int,input().split())

X_lis = []
for i in range(N):
	x = list(map(int, input().split()))
	X_lis.append(x)

c=0
for i in range(N):
	for j in range(i+1, N):
		d2 = sum(map(lambda x: (X_lis[j][x] - X_lis[i][x])**2, range(D)))
		for k in range(int(math.sqrt(d2))+1):
			if k**2 == d2:
				c += 1
print(c)


Measured memory_bytes: 3064