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

int main(){
  int N; string S;
  cin >> N >> S;
  if(N%2) cout << "No" << endl;
  else{
    bool ans = true;
    rep(i, N/2){
      if(S[i] != S[i+(N/2)]) ans = false;
    }
    if(ans) cout << "Yes" << endl;
    else cout << "No" << endl;
  }
  
  
}     


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i) = 0; (i) < (n); ++(i))
#define rrep(i,n) for(int (i) = (n) - 1; (i) >= 0; --(i)) //Reversi rep
#define nfor(i,a,b) for(int (i) = (a); (i) < (b); ++(i)) //Natural for
#define rfor(i,a,b) for(int (i) = (b); (i) >= (a); --(i)) //Reversi for
#define mod (1000000007)
#define YES cout << "YES" << endl;
#define Yes cout << "Yes" << endl;
#define NO cout << "NO" << endl;
#define No cout << "No" << endl;

int asc(const void *a, const void *b) {
    return *(int *)a - *(int *)b;
}

int desc(const void *a, const void *b) {
    return *(int *)b - *(int *)a;
}

int main()
{
    string s;
    bool ans = false;
    cin >> s;
    rep(i, 3)if(s[i] == s[i + 1])ans = true;
    if (ans) {
        cout << "Bad" << endl;
    }else{
        cout << "Good" << endl;
    }
    return 0;
}

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

int main(void){
  int a,b;
  int n;
  while(cin>>n,n){

    a = b = 0;
  while(n--){
    int c,d;
    cin>>c>>d;
    if(c==d){
      a += c ;
      b += c ;
    }else if(c>d)
      a += c + d;
    else
      b += c + d; 
  }
  cout<< a << " " << b << endl;
  }
}

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

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int a=sc.nextInt();
		String s = sc.next();
		int b=sc.nextInt();
		if(s.equals("+")){
			System.out.println(a+b);
		}else if(s.equals("-")){
			System.out.println(a-b);
		}
	}

}


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

#define INF 1<<30
#define LINF 1ll<<60ll
#define MOD 1000000007
#define pb(a) push_back(a)

#define _overload3(_1,_2,_3,_4,name,...) name
#define _rep(i,n) _repi(i,0,n)
#define _repi(i,a,b) for(int i=a, i##_len=(b); i<i##_len; ++i)
#define _repis(i,a,b,s) for(int i=a, i##_len(b); i<i##_len; i+=s)
#define REP(...) _overload3(__VA_ARGS__,_repis,_repi,_rep,)(__VA_ARGS__)

#define REPR(i, n) for(int i = n;i >= 0;--i)
#define REPARR(i, v) for(int i = 0;i < sz(v);++i)

#define all(vec) (vec.begin()),(vec.end())
#define sz(x) ((int)(x).size())
#define bit(n) (1ll<<(n))

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

#define YES(n) cout<<((n)?"YES":"NO")<<endl
#define Yes(n) cout<<((n)?"Yes":"No")<<endl
#define yes(n) cout<<((n)?"yes":"no")<<endl
#define poss(n) cout<<((n)?"possible":"impossible")<<endl
#define Poss(n) cout<<((n)?"Possible":"Impossible")<<endl
#define POSS(n) cout<<((n)?"POSSIBLE":"IMPOSSIBLE")<<endl



int main(){
    int n;
    cin>>n;
    int w=0;
    int N=n;
    while(N){
        w+=N%10;
        N/=10;
    }
    Yes(!(n%w));
    return 0;
}

Measured memory_bytes: 384
#include<iostream>
#include<set>
#include<map>
#include<algorithm>
using namespace std;
multiset<int> list;
int pow2[30];
int main(){
	int i,n,x,tot=0;
	for(i=1;i<=30;i++)pow2[i-1]=(1<<i);
	cin>>n;
	for(i=1;i<=n;i++)cin>>x,list.insert(x);
	while(!list.empty()){
		multiset<int>::iterator itr=list.end();
		itr--;
		x=*itr;
		list.erase(itr);
		int y=*upper_bound(pow2,pow2+30,x)-x;
		multiset<int>::iterator fin=list.find(y);
		if(fin==list.end())continue;
		list.erase(fin);
		tot++;
	}
	cout<<tot;
	return 0;
}
/*1
3
1 2 3
*/
/*2
5
3 11 14 5 13
*/

Measured memory_bytes: 9600
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
int main(){
    int N, M;
    cin >> N >> M;
    vector<int> v[N];
    vector<P> sub(M);
    for (int i = 0; i < M; i++) {
        int p, y;
        cin >> p >> y;
        p--;
        v[p].push_back(y);
        sub[i] = P(p, y);
    }
    
    map<P,int> ma;
    for (int i = 0; i < N; i++) {
        sort(v[i].begin(), v[i].end());
        for (int j = 0; j < v[i].size(); j++) {
            ma[P(i, v[i][j])] = j + 1;
        }
    }
    
    for (int i = 0; i < M; i++) {
        int p = sub[i].first + 1;
        int num = ma[sub[i]];
        printf("%06d%06d\n", p, num);
    }
}

Measured memory_bytes: 13952
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep1(i, n) for(int i = 1; i < n+1; i++)
#define sort(A) sort(A.begin(),A.end())
#define reverse(A) reverse(A.begin(),A.end());
#define vecmin(A) *min_element(A.begin(),A.end());
#define vecmax(A) *max_element(A.begin(),A.end());
typedef long long ll;

int main(){
  int x,a;
  cin >> x >> a;
  if(x<a) cout << 0 << endl;
  else cout << 10 << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	
	int a,b,c,d,e,k;
	cin>>a>>b>>c>>d>>e>>k;
	if(e-a<=k)
		cout<<"Yay!"<<endl;
	else
		cout<<":("<<endl;
	return 0;
}

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

using namespace std;
struct Point {
    int x;
    int y;
    int h;
};

int main() {
    int n, aval_h;
    cin >> n;
    vector<Point> points(105);
    for (int i = 0; i < n; i++) {
        cin >> points[i].x >> points[i].y >> points[i].h;
        if (points[i].h > 0) {
            aval_h = i;
        }
    }

    for (int px = 0; px < 101; ++px) {
        for (int py = 0; py < 101; ++py) {
            int h = points[aval_h].h + abs(points[aval_h].x - px) + abs(points[aval_h].y - py);
            bool is_ok = true;
            for (int i = 0; i < n; ++i) {
                int dist = max(h - abs(points[i].x - px) - abs(points[i].y - py),0);
                if (dist != points[i].h) {
                    is_ok = false;
                    break;
                }
            }
            if (is_ok) {
                cout << px << " " << py << " " << h << endl;
            }
        }
    }
}

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

int main() 
{ 
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL);  
    long long int n,k,i,j;
    cin>>n>>k;
    long long int w[n],v[n];
    for(i=0;i<n;i++)
    {
        cin>>w[i]>>v[i];
    }
    long long int dp[n+1][k+1];
    for(i=0;i<n+1;i++)
    {
        dp[i][0]=0;
    }
    for(j=0;j<k+1;j++)
    {
        dp[0][j]=0;
    }
    for(i=1;i<n+1;i++)
    {
        for(j=1;j<k+1;j++)
        {
            if(w[i-1]<=j)
            {
                dp[i][j]=max((v[i-1]+dp[i-1][j-w[i-1]]),dp[i-1][j]);
            }
            else
            {
                dp[i][j]=dp[i-1][j];
            }
        }
    }
    cout<<dp[n][k];
}

Measured memory_bytes: 82388
#include <iostream>
#include <vector>

using namespace std;

int main() {

    const int inf = 1145141919;

    while (true) {

        //n?????\???
        int n;
        cin >> n;

        //n == 0????????????
        if(n == 0)
            break;

        //t?????\???
        vector<vector<int>> t(n, vector<int>(n + 1));
        for (int i = 0; i < n; i++){
            for (int j = 0; j < n + 1; j++){
                cin >> t[i][j];
            }
        }

        vector<int> dp(1 << n);
        for (int i = 0; i < (1 << n); i++)
            dp[i] = inf;

        dp[0] = 0;

        for (int i = 0; i < (1 << n); i++) {

            if (dp[i] == inf)
                continue;

            for (int j = 0; j < n; j++) {

                if ((i>>j) & 1)
                    continue;

                int mint = t[j][0];
                for (int k = 0; k < n; k++){
                    if ((i >> k) & 1)
                        mint = min(mint, t[j][k + 1]);
                }

                dp[i | (1<<j)] = min(dp[i | (1<<j)], dp[i] + mint);
            }

        }

        cout << dp[(1<<n) - 1] << endl;
    }

}

Measured memory_bytes: 3368
#include <iostream>
      #include <string>
      #include <vector>
      #include <algorithm>
      #include <utility>
      using namespace std;
      typedef long long ll;
      #define rep(i, n) for (int i=0;i < (int)(n);i++)

      int main(){
         int a,b,c;
         string s;
         cin >> s;
         sort(s.begin(),s.end());
         char ans='a';
         vector<int> cnt(1000,0);

         for (int i=0;i < s.size();i++){
            cnt[int(s[i])]++;
         }
        
         char cans = 'A';
         for (char i = 'a';i <= 'z';i++){
            //cout << cnt[int(i)];
            if (cnt[int(i)] == 0) {
               cans = i;
               break;
            }
         }
         char q = 'c';
         cout << endl;
         if (cans == 'A') {
            cout << "None" << endl;
            //cout << cans << endl;
            //cans = q;
            //cout << cans << endl;
            
         }
         else cout << cans << endl;
         
         return 0;
         
      }



Measured memory_bytes: 512
h,w=map(int, input().split())
ch,cw=map(int, input().split())
ch-=1
cw-=1
dh,dw=map(int, input().split())
dh-=1
dw-=1
grid=[]
for i in range(h):
    s=list(input())
    news=[-1 if x=='#' else 0 for x in s]
    grid.append(news)
dif=[(1,0),(-1,0),(0,1),(0,-1)]
from collections import deque
col=0
for i in range(h):
    for j in range(w):
        if grid[i][j]==0:
            col+=1
            stack=deque([(i,j)])
            grid[i][j]=col
            while stack:
                nowi,nowj=stack.popleft()
                for di,dj in dif:
                    if 0<=nowi+di<h and 0<=nowj+dj<w and grid[nowi+di][nowj+dj]==0:
                        stack.append((nowi+di,nowj+dj))
                        grid[nowi+di][nowj+dj]=col
start=grid[ch][cw]-1
end=grid[dh][dw]-1
if start==end:
    print(0)
    exit()
es=[set([]) for _ in range(col)]
visited=[-1]*col

for i in range(h):
    for j in range(w):
        now=grid[i][j]
        if now!=-1: 
            for x in range(-2, 3):
                for y in range(-2, 3):
                    if 0<=i+x<h and 0<=j+y<w:
                        nex=grid[i+x][j+y]
                        if nex!=-1 and now!=nex:
                            es[now-1].add(nex-1)

stack=deque([start])
visited[start]=0
while stack:
    now=stack.popleft()
    for e in es[now]:
        if visited[e]==-1:
            visited[e]=visited[now]+1
            stack.append(e)
#print(grid)
print(visited[end])


Measured memory_bytes: 132976
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n, taro=0, hana=0;
    string animal1, animal2;
    cin >> n;
    for (int i=0; i<n; i++){
        cin >> animal1 >> animal2;
        if (animal1 > animal2){
            taro += 3;
        } else if (animal1 < animal2){
            hana += 3;
        } else{
            taro += 1;
            hana += 1;
        }
    }cout << taro << " " << hana << endl;
    return 0;
}


Measured memory_bytes: 3160
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
#include <cstring>
#include <deque>
#include <iomanip>
#include <limits>
#include <fstream>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, 0, sizeof(mat))
typedef long long ll;

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin>>n;
  int data[n+1];
  FOR(i,0,n){
    cin>>data[i+1];
  }
  FOR(i,1,n+1){
    cout << "node " << i << ": ";
    cout << "key = " << data[i] << ", ";
    if(i != 1) cout << "parent key = " << data[i/2] << ", ";
    if(i * 2 <= n) cout << "left key = " << data[i*2] << ", ";
    if(i * 2 + 1 <= n) cout << "right key = " << data[i*2+1] << ", ";
    cout << endl;
  }
}


Measured memory_bytes: 3120
#include <iostream>
using namespace std;
typedef long long ll;
const ll MAXN=1e7+7;
ll n,sum;
int main()
{
	cin>>n;
	sum=(1+n)*n/2;
	for(int i=2;i<=n;i++) sum+=(i+n/i*i)*(n/i)/2;
	cout<<sum<<endl;
	return 0;
}

Measured memory_bytes: 3632
package main

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

var sc *bufio.Scanner
var out *bufio.Writer

func main() {
	sc = bufio.NewScanner(os.Stdin)
	//bytes, _ := ioutil.ReadFile("./stdin.txt")
	//sc = bufio.NewScanner(strings.NewReader(string(bytes)))
	out = bufio.NewWriter(os.Stdout)
	buf := make([]byte, 1<<20)
	sc.Buffer(buf, bufio.MaxScanTokenSize)
	sc.Split(bufio.ScanWords)
	defer out.Flush()

	n := []byte(next())
	nInt, _ := strconv.Atoi(string(n))

	nums := f([]byte{}, len(n))
	result := 0
	for i := 0; i < len(nums); i++ {
		if len(nums[i]) < 3 {
			continue
		}
		if si, _ := strconv.Atoi(string(nums[i])); si > nInt {
			continue
		}

		digit := make(map[byte]bool, 10)
		for j := 0; j < len(nums[i]); j++ {
			digit[nums[i][j]] = true
		}
		if len(digit) == 3 {
			_, ok3 := digit['3']
			_, ok5 := digit['5']
			_, ok7 := digit['7']
			if ok3 && ok5 && ok7 {
				result++
			}
		}
	}

	fmt.Fprintln(out, result)
}

func f(n []byte, d int) [][]byte {
	nn := make([][]byte, 3)
	for i, b := range []byte{'3', '5', '7'} {
		nn[i] = append([]byte{b}, n...)
	}
	if len(nn[0]) == d {
		return nn
	}
	return append(nn, append(f(nn[0], d), append(f(nn[1], d), f(nn[2], d)...)...)...)
}

func next() string {
	sc.Scan()
	return sc.Text()
}
func nextInt() int {
	a, _ := strconv.Atoi(next())
	return a
}
func nextInts(n int) []int {
	ret := make([]int, n)
	for i := 0; i < n; i++ {
		ret[i] = nextInt()
	}
	return ret
}
func intMin(a, b int) int {
	if a > b {
		return b
	}
	return a
}
func intMax(a, b int) int {
	if a > b {
		return a
	}
	return b
}


Measured memory_bytes: 8276
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# FileName: 	A
# CreatedDate:  2020-06-21 20:42:18 +0900
# LastModified: 2020-06-21 21:07:27 +0900
#


import os
import sys
#import numpy as np
#import pandas as pd


def main():
    alpha = input()
    if alpha.islower():
        print("a")
    else:
        print("A")


if __name__ == "__main__":
    main()


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

int main(){
  int a[26] = {};
  string ch;
  
  while(cin >> ch){
    for(int i = 0; i < ch.size(); i++){
      if(ch[i] >= 'a' && ch[i] <= 'z') a[ch[i]-'a']++;
      else if(ch[i] >= 'A' && ch[i] <= 'Z') a[ch[i]-'A']++;
    }
  }
  for(int i=0;i<26;i++){
    cout << (char)('a'+i) << " : " << a[i] << endl;
  }
  return 0;
}


Measured memory_bytes: 3204
n, q = map(int, input().split())
A = [[] for i in range(n)]
queries = list()
for i in range(q):
    queries.append(list(map(int, input().split())))
for query in queries:
    if query[0] == 0:
        A[query[1]].append(query[2])
    elif query[0] == 1:
        print(' '.join(map(str, A[query[1]])))
    elif query[0] == 2:
        A[query[1]].clear()



Measured memory_bytes: 135844
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout<< (x) << " "

int main(){
    int n,k;cin>>n>>k;
    double sumprob=0.0;
    rep1(i,n){
        double prob=1.0;
        int cnt = i;
        while(cnt<k){
            prob*=(0.5);
            cnt*=2;
        }
        sumprob += prob;
    }
    printf("%.12f\n",sumprob/n);
}

Measured memory_bytes: 256
/*
 * http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_8_B
 */
#include <iostream>
#include <string>

using namespace std;

int
main()
{
  ios::sync_with_stdio(false);

  while (true) {
    string line;
    getline(cin, line);

    if (line == "0") {
      break;
    }

    int sum = 0;
    for (string::iterator it = line.begin(); it != line.end(); it++) {
      sum += *it - '0';
    }
    cout << sum << endl;
  }

  return 0;
}

Measured memory_bytes: 3216
N,K = map(int,input().split(" "))
list = []
for i in range(N):
    a,b = map(int,input().split(" "))
    list.append([a,b])
list = sorted(list)
#print(list)

for i in range(N):
    a,b = list[i][0],list[i][1]
    K -= b
    if K <= 0:
        print(a)
        break

Measured memory_bytes: 20872
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(void){
    int n;cin>>n;
    vector<ll>V(n);
    for(int i=0;i<n;i++)cin>>V[i];
    sort(V.begin(),V.end());
    vector<ll>Ans;
    for(int i=0;i<n-1;i++){
        if(V[i]==V[i+1]){Ans.push_back(V[i]);i++;}
    }
     sort(Ans.begin(),Ans.end());
     reverse(Ans.begin(),Ans.end());
    if(Ans.size()<2)cout<<0<<endl;
    else cout<<Ans[0]*Ans[1]<<endl;
}


Measured memory_bytes: 1660
import java.util.Scanner;

class Main {
	static final int[] DATE = { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
	static final String[] DAY_OF_THE_WEEK = { "Wednesday", "Thursday",
			"Friday", "Saturday", "Sunday", "Monday", "Tuesday" };

	public static void main(String[] args) {
		Scanner sc = null;
		try {
			sc = new Scanner(System.in);
			while (sc.hasNextInt()) {
				int month = sc.nextInt();
				int day = sc.nextInt();
				if (month == 0 || day == 0) {
					break;
				}

				System.out.println(getDayOfTheWeek(month, day));

			}
		} finally {
			sc.close();
		}
	}

	public static String getDayOfTheWeek(int m, int d) {
		int sum = 0;
		for (int i = 0; i < m - 1; i++) {
			sum += DATE[i];
		}
		sum += d;
		return DAY_OF_THE_WEEK[sum % 7];
	}
}

Measured memory_bytes: 26100
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define f first
#define s second
#define go ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define mem(arr,v) memset(arr,v,sizeof(arr))
/*bool sortbysec(const pair<int,int> &a,
              const pair<int,int> &b)
{
    return (a.second < b.second);
} */
int main()
{
     ll t,cnt=0,a,b;
     cin>>a>>b;
     string str;
     cin>>str;
     for(int i=0;i<str.size();i++)
     {
         if(str[i]=='-')
            cnt++;
     }
     if(cnt==1 && str[a]=='-' && str.size()==a+b+1)
        cout<<"Yes"<<endl;
     else
        cout<<"No"<<endl;
}


Measured memory_bytes: 256
#include <stdio.h>

int cnt;
int m;
int G[1000001];

int make_g(int n){
	unsigned sh = 0;
	for(unsigned i = 1; (1<<i) <= n; i++){
		sh = i;
	}
	for(int i = 0; i <= sh; i++){
		G[i] = 1<<(sh-i);
	}
	return sh + 1;
}
void insertionSort(int *A,int n,int g){
	for(int i = g; i < n; i++){
		int v = A[i];
		int j = i - g;
		while(j >= 0 && A[j] > v){
			A[j+g] = A[j];
			j = j - g;
			cnt++;
		}
		A[j+g] = v;
	}
}

void shellSort(int *A,int n){
	cnt = 0;
	m =  make_g(n);
	//G = ??
	for(int i = 0; i < m; i++){
		insertionSort(A,n,G[i]);
	}
}

int main(){
	int n;
	int A[1000001];
	scanf("%d",&n);
	for(int i = 0; i < n; i++){
		scanf("%d",&A[i]);
	}
	shellSort(A,n);
	
	printf("%d\n",m);
	printf("%d",G[0]);
	for(int i = 1; i < m; i++){
		printf(" %d",G[i]);
	}
	printf("\n%d\n",cnt);
	for(int i = 0; i < n; i++){
		printf("%d\n",A[i]);
	}
	return 0;
}




Measured memory_bytes: 6668
#include <bits/stdc++.h>
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
//#define int long long
typedef long long ll;
const int MOD = 1000000007;
const int INF = 1010000000;
const double EPS = 1e-10;
using namespace std;
const pair<int,int> fd[] = {make_pair(1,0),make_pair(-1,0),make_pair(0,1),make_pair(0,-1)}; 


signed main() {
  string s;cin>>s;string ss = "CODEFESTIVAL2016";
  int ans = 0;
  rep(i,s.length()){
    if(s[i] != ss[i])ans++;
  }
  cout << ans << endl;
}


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

int main(void){
    int x,t;
    std::cin >> x >> t;

    if(x < t){
        std::cout << 0;
        return 0;
    }

    std::cout << x-t;
    return 0;
}




Measured memory_bytes: 892
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdint>
#include <iostream>
#include <vector>

using namespace std;

constexpr int64_t MOD = 1e9+7;

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

  vector<int64_t> nums(N);
  for (int n = 0; n < N; ++n) {
    cin >> nums[n];
  }
  sort(nums.begin(), nums.end());
  
  vector<vector<int64_t>> cnt(2, vector<int64_t>(61));                              
  for (int64_t n : nums) {
    bitset<61> bs(n);
    for (size_t i = 0; i <= 60; ++i) {
      if (bs.test(i)) {
        ++cnt[1][i];
      } else {
        ++cnt[0][i];
      }
    }
  }
  int64_t result = 0;
  for (size_t i = 0; i <= 60; ++i) {
    result += (static_cast<int64_t>(pow(2, i)) % MOD) * (cnt[0][i] * cnt[1][i] % MOD);
    result %= MOD;
  }
  cout << result << endl;
  
  return 0;
}

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

using namespace std ;

#define sz(v) (int)v.size()
#define ll long long
#define all(v)  v.begin() , v.end()
#define rall(v)  v.rbegin() , v.rend()
#define pf push_front
#define pb push_back
#define fast FastInputOutput() ;
#define Clear( container , value ) memset( container , value , sizeof container )
#define PI acos( -1.0 )
#define forn( t , v , be , n ) for( t v = be ; v < n ; v++ )
#define fore( x , j ) for( auto x : j )
#define se second
#define fr first
//#define c_b fflush(stdin);

const ll Long_max = numeric_limits < ll > :: max() ;
const int Int_max = numeric_limits < int > :: max() ;

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

void File_input( string pathIn ) {
    freopen( pathIn.c_str(), "r", stdin ) ;
}

void File_output( string pathOut ) {
    freopen( pathOut.c_str(), "w", stdout ) ;
}

int msg() {
    srand( time( 0 ) ) ;
    vector < string > st = {
        "Wish everyone high ratings!",
        "Good luck!",
        "Have fun!",
        "Please, read all the problems!",
        "Go Go fight!"
    } ;
    cerr << st[ rand() % sz( st ) ] ;
    return 0 ;
}


void FastInputOutput() {
    ios_base :: sync_with_stdio( 0 ) ;
    cin.tie( 0 ) ;
    cout.tie( 0 ) ;
}

string str ;

ll to_num( string str ){
stringstream s ;
s << str ;
ll t ;
s >> t ;
return t ;
}

int main(){

   cin >> str ;
   set < string > ans ;
   forn( int , i , 0 , 1 << sz( str ) ){
     vector < int > seq ;
     forn( int , j , 0 , sz( str ) ){
         seq.pb( ( i & ( 1 << j ) ? 1 : 0 ) ) ;
     }
     string tc = "" ;
     forn( int , c , 0 , sz( seq ) ) {
         string tmp = "" ;
         if( seq[ c ] ){
            while( seq[ c ] && c < sz( seq ) ){
                tmp += str[ c ] ;
                c++ ;
            }
            tc += tmp + "+" ;
            if( c < sz( seq ) )
                c-- ;
         } else if( !seq[ c ] ){
            tmp = "" ;
            while( !seq[ c ] && c < sz( seq ) ){
                tmp += str[ c ] ;
                c++ ;
            }
            tc += tmp + "+" ;
            if( c < sz( seq ) )
                c-- ;
         }
     }

     if( tc.back() == '+' ){
        tc.pop_back() ;
     }

     ans.insert( tc ) ;

   }



   ll sum = 0 ;

   fore( i , ans ){
      string tt = i ;
      forn( int , j , 0 , sz( tt ) ){
         if( isdigit( tt[ j ] ) ){
             string tmp = "" ;
             while( isdigit( tt[ j ] ) && j < sz( tt ) ){
                tmp += tt[ j ] ;
                j++ ;
             }
             sum += to_num( tmp ) ;
         }
      }
   }


   cout << sum ;


   return 0 ;
}


Measured memory_bytes: 384
import sys
input = sys.stdin.readline
import random
import time
import copy
time0=time.time()

D=int(input())
C=[0]+list(map(int,input().split()))
S=[0]+[[0]+list(map(int,input().split())) for i in range(D)]

ANS=0
T=[0]
LAST=[0]*27
for day in range(1,D+1):
    SCORE=[-1<<30]*27
    for j in range(1,27):
        SC=0
        SC+=S[day][j]

        for k in range(1,27):
            if j==k:
                continue
            SC-=C[k]*(day-LAST[k])
        SCORE[j]=SC

    choose=SCORE.index(max(SCORE))
    T.append(choose)
    LAST[choose]=day

ANS=0
LAST=[[0]*27 for i in range(D+1)]
for day in range(1,D+1):
    for j in range(1,27):
        LAST[day][j]=LAST[day-1][j]
    t=T[day]
    ANS+=S[day][t]
    LAST[day][t]=day

    for j in range(1,27):
        ANS-=C[j]*(day-LAST[day][j])

while time.time()-time0<1.77:
    BT=copy.deepcopy(T)
    BLAST=copy.deepcopy(LAST)
    BANS=ANS
    
    d=random.randint(1,D)
    after_t=random.randint(1,26)

    before_t=T[d]

    ANS+=S[d][after_t]-S[d][before_t]

    T[d]=after_t

    for day in range(d,D+1):
        if T[day]!=before_t:
            ANS+=C[before_t]*(day-LAST[day][before_t])
            LAST[day][before_t]=LAST[day-1][before_t]
            ANS-=C[before_t]*(day-LAST[day][before_t])
        else:
            break

    ANS+=C[after_t]*(d-LAST[d][after_t])
    LAST[d][after_t]=d

    for day in range(d+1,D+1):    
        if T[day]!=after_t:
            ANS+=C[after_t]*(day-LAST[day][after_t])
            LAST[day][after_t]=LAST[day-1][after_t]
            ANS-=C[after_t]*(day-LAST[day][after_t])

    if ANS<BANS:
        T=BT
        LAST=BLAST
        ANS=BANS

print(*T[1:])

Measured memory_bytes: 181140
#include <bits/stdc++.h>
#include <chrono>
#include <random>
#include <sstream>
#include <string>
#define ll long long int
#define ull unsigned long long int
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define rep(i,n) for(ll i=0;i<n;i++)
#define loop(i,a,b) for(ll i=a;i<=b;i++)
#define vi vector <int>
#define vs vector <string>
#define vc vector <char>
#define vl vector <ll>
#define all(c) (c).begin(),(c).end()
#define max3(a,b,c) max(max(a,b),c)
#define min3(a,b,c) min(min(a,b),c)
using namespace std;
ll power(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll modInverse(ll a){return power(a,mod-2);}
const int N=100001;
bool vis[N];
vector <int> adj[N];
ll gcd(ll a, ll b) { if (a == 0) return b; return gcd(b % a, a); } 
ll lcm(ll a, ll b){return a*b/gcd(a, b);}
// ll binaryNum[64];
// void decToBinary(ll n, ll k) 
// { 
//     // binaryNum[64]={0};
//     rep(i,64){
//         binaryNum[i]=0;
//     }
//     int i = 0; 
//     while (n > 0) { 
//         binaryNum[i] = n % k; 
//         n = n / k; 
//         i++; 
//     } 
// }

void solve(){
    ll a,b,c,d;
    cin>>a>>b>>c>>d;
    ll a1 = max(a*c,b*d);
    ll a2 = max(a*d,b*c);
    cout << max(a1,a2);
}


int main()
{

    // cout<<1<<endl;
    #ifndef ONLINE_JUDGE
        // for getting input from input.txt
        freopen("input.txt", "r", stdin);
        // for writing output to output.txt
        freopen("output.txt", "w", stdout);
    #endif
    
    
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int T=1;
    // cin>>T;
    int t=0;
    while(t++<T)
    {
        // cout<<"Case #"<<t<<":"<<' ';
        solve();
        //cout<<'\n';
    }
    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
}

Measured memory_bytes: 6148
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<int,int> Pi;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define fi first
#define se second
#define endl "\n"

template<typename T> inline bool chmax(T &a, T b){if(a<b){a=b;return true;}return false;}
template<typename T> inline bool chmin(T &a, T b){if(a>b){a=b;return true;}return false;}
template<typename T> ostream& operator<<(ostream& s,const complex<T>& d) {return s<<"("<<d.real()<<", "<<d.imag()<< ")";}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const pair<T1,T2>& d) {return s<<"("<<d.first<<", "<<d.second<<")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& d){
	int len=d.size();
	rep(i,len){
		s<<d[i];if(i<len-1) s<<" ";
	}
	return s;
}
template<typename T> ostream& operator<<(ostream& s,const vector<vector<T>>& d){
	int len=d.size();
	rep(i,len){
		s<<d[i]<<endl;
	}
	return s;
}
template<typename T> ostream& operator<<(ostream& s,const set<T>& v){
	s<<"{ ";
	for(auto itr=v.begin();itr!=v.end();++itr) {
		if (itr!=v.begin()) {s<< ", ";}
		s<<(*itr);
	}
	s<<" }";
	return s;
}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const map<T1,T2>& m){
	s<<"{"<<endl;
	for(auto itr=m.begin();itr!=m.end();++itr){
		s<<" "<<(*itr).first<<" : "<<(*itr).second<<endl;
	}
	s<<"}"<<endl;
	return s;
}

const ll mod=1e9+7;
const ll inf=1e17;
const int INF=1e9;
const double PI=acos(-1);
const double EPS=1e-10;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n,k;
	cin>>n>>k;
	vector<P> g(n);
	rep(i,n){
		cin>>g[i].se>>g[i].fi;
	} 
	sort(begin(g),end(g),greater<Pi>());
	set<ll> cnt;
	priority_queue<ll,vector<ll>,greater<ll>> que1;
	priority_queue<ll> que2;
	ll ans=0;
	rep(i,k){
		if(cnt.count(g[i].se)){
			que1.push(g[i].fi);
		}
		ans+=g[i].fi;
		cnt.insert(g[i].se);
	}
	ll x=cnt.size();
	ans+=x*x;
	FOR(i,k,n){
		if(cnt.count(g[i].se)) continue;
		if(que2.size()>=que1.size()) break;
		que2.push(g[i].fi);
		cnt.insert(g[i].se);
	}
	ll now=ans;
	while(!que1.empty() && !que2.empty()){
		now=now-que1.top()+que2.top()+2*x+1;
		x++;
		que1.pop();
		que2.pop();
		chmax(ans,now);
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 5244
#define ll long long
#define rep(i,n) for (int i=0;i<(n);i++)
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<cmath>
#define SIZE 100001
#define MOD 1000000007
using namespace std;
int MAP[SIZE];

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

	int n;
	cin >> n;
	int A[SIZE];
	rep(i,n) cin>>A[i];

	rep(i,n) MAP[A[i]]++;

  bool per = true;
	int count = 0;
  //nが奇数
  if(n%2 ==1){
    if(MAP[0]!=1){
      per = false;
    }
    for(int i=1;i<n;i++){
      if(i%2 == 0){
        if(MAP[i] != 2){
          per = false;
          break;
        }
        count++;
      }
      else if(i%2 == 1){
        if(MAP[i] != 0){
          per = false;
          break;
        }
      }
    }

  }
  //nが偶数
  else{
    for(int i=0; i<n;i++){
      if(i%2 == 1){
        if(MAP[i] != 2){
          per = false;
          break;
        }
        count++;
      }
      else if(i%2 == 0){
        if(MAP[i] != 0){
          per = false;
          break;
        }
      }
    }
  }
  ll ans = 1;
  for(int i=0;i<count;i++){
    ans *=2;
    ans %=MOD;
  }

  cout << ((per) ? ans :0) << endl;

	return 0;
}

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

typedef uint64_t u64;
typedef int64_t i64;
typedef uint32_t u32;
typedef int32_t i32;
typedef uint16_t u16;
typedef int16_t i16;
typedef uint8_t u8;
typedef int8_t i8;

using namespace std;

#define rep(idx, N) for (u64 idx = 0; idx < N; idx++)

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

  if (s[2] == s[3] && s[4] == s[5]) {
    cout << "Yes" << endl;
  } else {

    cout << "No" << endl;
  }

  return 0;
}


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

int main() {
    int N;
    cin >>N;
    char in[120];
    pair<pair<string, int>,int> p[110];
    for(int i=0;i<N;i++){
        int t;
        cin >>in>>t;
        string tmp = in;
        p[i] = make_pair(make_pair(in,-t),i);
    }
    sort(p,p+N);
    for(int i=0;i<N;i++) cout<<p[i].second+1<<endl;

    return 0;
}

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

int main() {
  int N;
  cin >> N;
  vector<int>vec(N);
  for(int i = 0; i < N; i++){
    cin >> vec.at(i);
  }
  int ans = 0;
  while(true){
    bool odd = false;
    for(int i = 0; i < N; i++){
      if(vec.at(i)%2 != 0){
        odd =true;
      }
    }
    if(odd){
      break;
    }
    for(int i = 0; i < N; i++){
      vec.at(i) /= 2;
    }
    ans++;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long LL;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)

using namespace std;

int main(void)
{
  int x, y, z, k;
  cin >> x >> y >> z >> k;
  vector<LL> a(x),b(y),c(z),bc;
  for(auto &ai: a) cin >> ai;
  for(auto &bi: b) cin >> bi;
  for(auto &ci: c) cin >> ci;
  bc.reserve(1048576);
  for(auto bi: b) for(auto ci: c) bc.push_back(bi+ci);
  sort(a.begin(),a.end());
  sort(bc.begin(),bc.end());
  LL l=-1ll,r=a.back()+bc.back()+1;
  REP(i,100) {
    LL p=(l+r)/2;
    int nlt=0;
    for(auto ai: a) {
      nlt+=bc.end()-lower_bound(bc.begin(),bc.end(),p-ai);
    }
    if(nlt>k) l=p;
    else r=p;
  }
  vector<LL> answers;
  for(auto ai: a) {
    auto i=lower_bound(bc.begin(),bc.end(),r-ai);
    for(auto bci: vector<LL>(i,bc.end())) answers.push_back(ai+bci);
  }
  sort(answers.begin(),answers.end());
  for(auto i=answers.rbegin();i!=answers.rend();++i) {
    cout << *i << endl;
  }
  REP(i,k-answers.size()) cout << r-1 << endl;
  return 0;
}


Measured memory_bytes: 8448
n = int(input())
a = [int(i) for i in input().split(" ")]

a.sort()
m = n % 2

alice = 0
bob = 0

while n > 0:
    if n % 2 == m:
        alice += a[-1]
    else:
        bob += a[-1]
    a.pop()
    n -= 1

print(alice - bob)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
const int MAXN = 1e6 + 5;
const long long mod = 1e9 + 7;

int n;
int arr[MAXN];
void solve(){
    vector<int> freq(MAXN), ans(MAXN);
    int i = 0, j = 0;
    for(i = 0; i < n; i++)
        freq[arr[i]]++;
    for(i = 1; i < MAXN; i++){
        for(j = i; j < MAXN; j += i)
            ans[j] += freq[i];
    }
    int cnt = 0;
    for(i = 0; i < n; i++){
        cnt += (ans[arr[i]] == 1);
    }
    cout << cnt << "\n";
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> n;
    int i = 0;
    for(i = 0; i < n; i++)
        cin >> arr[i];
    solve();
    return 0;
}


Measured memory_bytes: 11848
n,m,k=map(int,input().split())
a=[int(i) for i in input().split()]
b=[int(i) for i in input().split()]
ca=[0]*(n+1)
ca[1]=a[0]
for i in range(n):
  ca[i+1]=ca[i]+a[i]
cb=[0]*(m+1)
cb[1]=b[0]
for i in range(m):
  cb[i+1]=cb[i]+b[i]
j=m
ans=0
for i in range(n+1):
  t=ca[i]
  while j>=0:
    if t+cb[j]>k:
      j-=1
    else:
      ans=max(ans,i+j)
      break
print(ans)

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

int n;
long long g[222][222];

int main(){
	scanf("%d", &n);
	for(int i = 1; i <= n; i++) for(int j = 1; j <= n; j++) g[i][j] = __gcd(i, j);
	long long sum = 0;
	for(int i = 1; i <= n; i++) for(int j = 1; j <= n; j++) for(int k = 1; k <= n; k++) sum += g[i][g[j][k]];
	printf("%lld\n", sum); 
	return 0;
}

Measured memory_bytes: 4168
#include <iostream>
using namespace std;
#define abs(x) ((x)>=0)?(x):(-(x))
int main(void)
{
	int N, L;
	cin >> N >> L;
	int eaten;
	if (L > 0)eaten = 1;
	else if (L > (1 - N))eaten = abs(1 - L);
	else eaten = N;
	int ans = N * (L - 1) + N * (N + 1) / 2 - (L + eaten - 1);
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<set>
#include<string>
#include<map>
#include<string.h>
#include<complex>
#include<math.h>
#include<queue>
#include<time.h>
using namespace std;
typedef long long int llint;
typedef pair<int, int> pint;
typedef pair<llint, llint> pllint;
typedef vector<int> vint;
typedef vector<llint> vllint;
typedef vector<pint> vpint;
typedef vector<pair<llint, llint>> vpllint;
typedef vector<vector<int>> vvint;
typedef vector<vector<llint>> vvllint;
typedef vector<vector<pint>> vvpint;
typedef vector<bool> vbool;
#define rep(i,n) for(int i=0;i<n;i++)
#define drep(i,n) for(int i=n-1;0<=i;i--)
#define yes(ans) if(ans)cout<<"yes"<<endl;else cout<<"no"<<endl;
#define Yes(ans) if(ans)cout<<"Yes"<<endl;else cout<<"No"<<endl;
#define YES(ans) if(ans)cout<<"YES"<<endl;else cout<<"NO"<<endl;
#define POSSIBLE(ans) if(ans)cout<<"POSSIBLE"<<endl;else cout<<"IMPOSSIBLE"<<endl;
#define Pi 3.1415926535897932384626
#define mod llint(1e9+7)

class UnionFind {
public:
	//親の番号を格納する。親だった場合は-(その集合のサイズ)
	vector<int> Parent;

	//作るときはParentの値を全て-1にする
	//こうすると全てバラバラになる
	UnionFind(int N) {
		Parent = vector<int>(N, -1);
	}

	//Aがどのグループに属しているか調べる
	int root(int A) {
		if (Parent[A] < 0) return A;
		return Parent[A] = root(Parent[A]);
	}

	//自分のいるグループの頂点数を調べる
	int size(int A) {
		return -Parent[root(A)];//親をとってきたい
	}

	//AとBをくっ付ける
	bool connect(int A, int B) {
		//AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
		A = root(A);
		B = root(B);
		if (A == B) {
			//すでにくっついてるからくっ付けない
			return false;
		}

		//大きい方(A)に小さいほう(B)をくっ付けたい
		//大小が逆だったらひっくり返しちゃう。
		if (size(A) < size(B)) swap(A, B);

		//Aのサイズを更新する
		Parent[A] += Parent[B];
		//Bの親をAに変更する
		Parent[B] = A;

		return true;
	}
};

//aとbの最大公約数を求めるよ
long long GCD(long long a, long long b) {
	if (b == 0) return a;
	else return GCD(b, a % b);
}

// 返り値: a と b の最大公約数
// ax + by = gcd(a, b) を満たす (x, y) が格納される
long long extGCD(long long a, long long b, long long& x, long long& y) {
	if (b == 0) {
		x = 1;
		y = 0;
		return a;
	}
	long long d = extGCD(b, a % b, y, x);
	y -= a / b * x;
	return d;
}

bool check(llint a, llint b) {
	return a > b;
}

// mod. m での a の逆元 a^{-1} を計算する
long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}

//aCbを1000000007で割った余りを求める
llint convination(llint a, llint b) {
	llint ans = 1;
	for (llint i = 0; i < b; i++) {
		ans *= a - i;
		ans %= 1000000007;
	}
	for (llint i = 1; i <= b; i++) {
		ans *= modinv(i, 1000000007);
		ans %= 1000000007;
	}
	return ans;
}

//aのb乗をmodで割った余りを求める
llint power(llint a, llint b) {
	if (b == 1)return a;
	if (b == 0)return 1;
	llint tmp = power(a, b / 2);
	tmp *= tmp;
	tmp %= mod;
	if (b % 2 == 1) {
		tmp *= a;
		tmp %= mod;
	}
	return tmp;
}

int main() {
	int a, b;
	cin >> a >> b;
	cout << (b - 1 + a - 2) / (a - 1) << endl;
	return 0;
}

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

#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
using P = pair<ll, ll>;

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 ll MOD = 1000000007;
const int INF = 1<<30;
//const ll INF = (ll)1e18 + 1;

int main(){
  int N; cin >> N;
  vector<int> d(N);
  rep(i, N) cin >> d[i];

  int ans = 0;
  for (int i = 0; i < N; ++i){
    for (int j = i + 1; j < N; ++j){
      ans += d[i] * d[j];
    }
  }
  cout << ans << endl;
}


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

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

template<class T> using v = std::vector<T>;
template<class T> using vv = v<v<T>>;

const int mod = 1000000007;
const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;
//const int mod = 998244353;

struct mint {
    ll x; // typedef long long ll;
    mint(ll x=0):x((x%mod+mod)%mod){}
    mint operator-() const { return mint(-x);}
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod-a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
    mint operator+(const mint a) const { return mint(*this) += a;}
    mint operator-(const mint a) const { return mint(*this) -= a;}
    mint operator*(const mint a) const { return mint(*this) *= a;}
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }

    // for prime mod
    mint inv() const { return pow(mod-2);}
    mint& operator/=(const mint a) { return *this *= a.inv();}
    mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}


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

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

// combination mod prime
// https://www.youtube.com/watch?v=8uowVvQ_-Mo&feature=youtu.be&t=1619
struct combination {
    vector<mint> fact, ifact;
    combination(int n):fact(n+1),ifact(n+1) {
        assert(n < mod);
        fact[0] = 1;
        for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
        ifact[n] = fact[n].inv();
        for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
    }
    mint operator()(int n, int k) {
        if (k < 0 || k > n) return 0;
        return fact[n]*ifact[k]*ifact[n-k];
    }
};

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

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

    int takahashi = ceil((double)c / b);
    int aoki = ceil((double)a / d);

    if (takahashi >= aoki + 1) {
        cout << "No" << endl;
    } else {
        cout << "Yes" << endl;
    }
    return 0;
}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> pii;
typedef long long int lld;
#define sq(x) x*x
#define fr(i,m,n) for(i=m;i<n;i++)
#define vec vector<int>
#define sint set<int>
#define qint queue<int>
#define mip map<int,int>
#define pint priority_queue<int>
#define pb push_back
#define pp pop_back()
#define ft first
#define sd second
#define full(v) v.begin(),v.end()

int main()
{
    int i,j,k,a,b,c,x,y,z,n,m=0,t;
    string s,u,v;
    cin>>n>>k;int ara[n+3];memset(ara,0,sizeof(int)*(n+3));
    while(k--){
        cin>>z;
        while(z--){
            cin>>x;ara[x]=1;
        }
    }
    fr(i,1,n+1) if(ara[i]==0) m++;
    cout<<m<<endl;
}



Measured memory_bytes: 3496
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<bool> vb;
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define in insert
#define FOR(i,a,b) for (int i = a; i < b; i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const int INF = 1e9 + 5;
const int  N = 2e5 + 314;
void foo(){
    vector<string>v={"Sunny", "Cloudy", "Rainy"};
    string s;
    cin>>s;
    for(int i = 0; i < 3; i++){
        if(s==v[i]){
            cout<<v[(i+1)%3];
            break;
        }
    }
}
int main(){
    speed;
    int t=1;
    //cin>>t;
    while(t--)foo();
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

a, b, k = map(int, input().split())

num = set()
for v in range(a, a + k):
    if v > b:
        break
    num.add(v)
    print(v)

for v in range(b + 1 - k, b + 1):
    if v < a:
        continue
    if v in num:
        continue
    print(v)


Measured memory_bytes: 62240
#include<iostream>
#include<vector>
#include<array>
#include<set>

using namespace std;

struct S{
  int y,x;
  array<array<int,4>,4> b;
  bool operator<(S s)const{
    return (y!=s.y)?y<s.y:(x!=s.x)?x<s.x:b<s.b;
  }
};

int main(){
  for(int N;cin>>N,N;){
    set<S> v[366];
    v[0].insert({1,1,{}});
    for(int i=0;i<N;i++){
      int s[4][4];
      for(int j=0;j<4;j++){
	for(int k=0;k<4;k++){
	  cin>>s[j][k];
	}
      }
      for(auto &e:v[i]){
	for(int j=0;j<3;j++){
	  for(int k=0;k<3;k++){
	    if(i==0&&(j!=1||k!=1))continue;
	    if(e.y!=j&&e.x!=k)continue;
	    auto n=e.b;
	    bool fail=false;
	    for(int l=0;l<2;l++){
	      for(int m=0;m<2;m++){
		fail|=s[j+l][k+m];
		n[j+l][k+m]=-1;
	      }
	    }
	    for(auto &f:n){
	      for(auto &g:f){
		fail|=++g>=7;
	      }
	    }
	    if(!fail){
	      v[i+1].insert({j,k,n});
	    }
	  }
	}
      }
    }
    cout<<!v[N].empty()<<endl;
  }
}

Measured memory_bytes: 16264
#include "bits/stdc++.h"
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a),i##_len=(b);i<i##_len;++i)
#define MSVC_UNKO(x) x
#define rep(...) MSVC_UNKO(_overload3(__VA_ARGS__,repi,_rep,_rep)(__VA_ARGS__))
#define all(c) c.begin(),c.end()
#define mp make_pair
#define write(x) cout<<(x)<<"\n"
using namespace std; typedef long long ll; template<class T>using vv = vector<vector<T>>;
template<class T>auto vvec(int n, int m, T v) { return vv<T>(n, vector<T>(m, v)); }
template<class T1, class T2>bool chmax(T1& a, const T2& b) { return a < b ? a = b, 1 : 0; }
template<class T1, class T2>bool chmin(T1& a, const T2& b) { return b < a ? a = b, 1 : 0; }
constexpr int INF = 1 << 29, MOD = int(1e9) + 7; constexpr ll LINF = 1LL << 60;
struct aaa { aaa() { cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(10); }; }aaaa;

int N;
string S;

int main() {
    cin >> S;
    reverse(all(S));
    N = S.size();

    vv<ll> dp = vvec(N + 1, 13, 0LL);
    dp[0][0] = 1;

    ll p = 1;

    for (int i = 0; i < N; ++i) {
        if (S[i] != '?') {
            ll n = S[i] - '0';
            
            rep(j, 0, 13) {
                dp[i + 1][(j + n * p % 13) % 13] = dp[i][j];
            }
        }
        else {
            rep(j, 0, 13) {
                rep(n, 0, 10) {
                    dp[i + 1][(j + n * p % 13) % 13] = (dp[i + 1][(j + n * p % 13) % 13] + dp[i][j]) % MOD;
                }
            }
        }

        p = p * 10 % 13;
    }

    write(dp[N][5]);
}

Measured memory_bytes: 13648
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;

template<typename T>
using ordered_set = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;

const int infI=1e9+5;
const long long infL=1e16;
const int MOD=1e9+7;
const int MAX=1e5+5;

#define mp make_pair
#define in &
#define pb push_back
#define ii pair<int,int>
#define iii pair<ii,int>
#define ll long long
#define pll pair<ll,ll>
#define vvl vector<vector<ll> >
#define vi vector<int>
#define vvi vector<vector<int> >
#define vl vector<ll>
#define eb emplace_back
#define forn(i,a,b) for(ll i=a;i<b;i++)
#define fastio ios_base::sync_with_stdio(0);cin.tie(0)
#define endl '\n'
#define popb pop_back();
#define se second
#define fi first
#define debug(x) cerr<<x<<endl
#define test(t) int t;cin>>t;while(t--)
#define fordebug(x) cerr<<x<<" "

ll power(ll a,ll b){
    if(b==0){
        return 1;
    }
    if(b==1){
        return a;
    }
    ll temp=power(a,b/2);
    temp=(temp*temp)%MOD;
    if(b%2){
        temp=(temp*a)%MOD;
    }
    return temp;
}

//only use if mod is prime
ll mod_inv(ll a,ll mod){
    a%=mod;
    return power(a,mod-2);
}

void extended_gcd(ll a,ll b,ll &x,ll &y){
    if(b==0){
        x=1;
        y=0;
        return;
    }
    ll x1,y1;
    extended_gcd(b,a%b,x1,y1);
    x=y1;
    y=x1-((a/b)*y1);
    return;
}

//TLE can also occur if vectors are not passed by reference

ll dp[55][55][55*50],a[55],ans;

int main(){
    //dp[i][j][k] -> #of ways so that we select j elements from first i numbers and get sum k
    int n,A,s=0;
    cin>>n>>A;
    forn(i,1,n+1){
        cin>>a[i];
        s+=a[i];
    }
    dp[0][0][0]=1;
    forn(i,1,n+1){
        forn(j,0,i+1){
            forn(k,0,s+1){
                dp[i][j][k] = dp[i-1][j][k];//we do not take the i'th element
                if(k>=a[i] and j){
                    dp[i][j][k]+=dp[i-1][j-1][k-a[i]];//we take the i'th element
                }
            }
        }
    }
    forn(i,1,n+1){
        if(A*i>=55*50){
            break;
        }
        ans += dp[n][i][A*i];
    }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 59648