akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
#define M 10000000
char p[M]={1,1};
int main(){
  int i,j,n;
  for(i=2;i*i<M;i++){
    if(p[i])continue;
    for(j=i*i;j<M;j+=i)p[j]=1;
  }
  while(scanf("%d",&n),n){
    for(;1;n--){
      if(p[n-8]+p[n-6]+p[n-2]+p[n]==0)break;
    }
    printf("%d\n",n);
  }
  return 0;
}

Measured memory_bytes: 10360
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rep2(i,n) for (int i = 1; i < (n); ++i)
using namespace std;
typedef long long ll;
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n;
    cin >> n;
    vector<int> A(n+2);
    vector<int> B(n+2);
    rep(i,n) cin >> A[i];
    copy(A.begin(), A.end(), back_inserter(B));
    sort(B.begin(), B.end(), greater<int>());
    int max_A = B[0];
    int max_A2 = B[1];
    rep(i,n) {
        if(A[i]!=max_A) cout << max_A << endl;
        else cout << max_A2 << endl;
    }
    return 0;
}

Measured memory_bytes: 3952
import collections
S = input()[::-1]
N = len(S)
mod = 2019

ans = 0
x = [0] * N
x[0] = int(S[0]) % mod
ruijo = 10

for i in range(1, N):
    x[i] = (ruijo * int(S[i]) + x[i - 1]) % mod
    if x[i] % mod == 0:
        ans += 1
    ruijo *= 10
    ruijo %= mod
    
d = collections.Counter(x)

for i in d.values():
    ans += i * (i - 1) // 2
    
print(ans)

Measured memory_bytes: 16500
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <map>

using namespace std;

int main()
{
    long long int w, h;
    int x, y;

    cin >> w >> h >> x >> y;

    printf("%.6lf ", w / 2.0 * h);
    if (x == w/2.0 && y == h/2.0) {
        cout << 1 << endl;
    }
    else {
        cout << 0 << endl;
    }

}


Measured memory_bytes: 256
N = int(input())

A1 = list(map(int, input().split()))
A2 = list(map(int, input().split()))

B1 = [0]
B2 = [0]
for i in range(N):
    B1 += [B1[i]+A1[i]]
    B2 += [B2[i]+A2[N-i-1]]
B1 += [0]
B2 += [0]
B2 = B2[::-1]
# print (B1, B2)

ans = 0
for i in range(len(B1)):
    ans = max(ans, B1[i]+B2[i])

print (ans)


Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;
using ll = long long;




int main() {
	string s;
	int a = 0;
	cin >> s;
	if (s[0] == '1') a++;
	if (s[1] == '1')a++;
	if (s[2] == '1')a++;
	cout << a << endl;

	return 0;
}


Measured memory_bytes: 256
import java.util.*;
import java.math.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    Map<Integer, Integer> map = new HashMap<>();
    for(int i = 0; i < n; i++){
      int tmp = sc.nextInt();
      if(!map.containsKey(tmp)){
        map.put(tmp, 0);
      }
      if(!map.containsKey(tmp+1)){
        map.put(tmp+1, 0);
      }
      if(!map.containsKey(tmp-1)){
        map.put(tmp-1, 0);
      }
      map.put(tmp, map.get(tmp) + 1);
      map.put(tmp + 1, map.get(tmp + 1) + 1);
      map.put(tmp - 1, map.get(tmp - 1) + 1);
    }
    int max = 0;
    for(Integer num : map.values()){
      max = Math.max(max, num);
    }
    System.out.println(max);
  }
}

Measured memory_bytes: 64292
#include<bits/stdc++.h>
using namespace std;
using i64 = int_fast64_t;
#define rep(i, N) for(int (i) = 0; (i) < (N); (i)++)
#define all(v) (v).begin(), (v).end()
#define eb emplace_back
#define Cout(s) cout << s << endl
string Yes(bool b) {if(b){return "Yes";} else {return "No";}}
string YES(bool b) {if(b){return "YES";} else {return "NO";}}


int main(){
	string S;
	cin >> S;
	Cout("ABC" + S);
}


Measured memory_bytes: 256
#include <iostream>    // cin, cout
#include <string>    // string, stoi, to_string
#include <algorithm>    // sort, lower_bound, heap, min, next_permutation 
#include <functional>    // greater, less
#include <vector>    // vector
#include <stack>    // stack
#include <queue>    // queue
#include <list>    // list
#include <map>    // map
#include <set>    // set
#include <tuple>    // tuple
#include <bitset>    // bitset
#include <cstdio>  // fopen, printf, scanf, puts
#include <cmath>    // sin, exp, log, pow, sqrt
#include <iomanip>    // setfill, setbase
#include <ctime>    // clock

using namespace std;
using pii = pair<int, int>;
using ti = tuple<int, int, int>;

const double eps=1e-14;
const int mod = 1e9 + 7;
const int inf = ((1<<30));
const long long linf = (1LL<<60);

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    long double a, b;
    cin >> a >> b;
    long double c = floor(a*b);
    long long d = (long long)c;
    cout << d << endl;
    return 0;
}


Measured memory_bytes: 3836
n = int(input())

A = list(map(int,input().split()))
A.sort()

M = 1000005
cnt = [0]*M
for i in A:
    if cnt[i] != 0:
        cnt[i] = 2
        continue
    
    for j in range(i,M,i):
        cnt[j] += 1

ans = 0
for i in A:
    if cnt[i] == 1:
        ans += 1
        
print(ans)

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

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

typedef long long ll;
using namespace std;
int mod = 1000000007;

int main(void){
    int N, P;
    vector<int> prime_ls;
    bool pr[200000];
    rep(i, 200000) pr[i] = true;
    pr[1] = false;
    for(int i = 2; i < 1000; i++){
        for(int j = (i << 1); j < 200000; j+=i){
            pr[j] = false;
        }
    }
    for(int i = 2; i < 200000; i++) if(pr[i]) prime_ls.push_back(i);

    vector<int> ans;
    while(true){
        cin >> N >> P;
        if(N == -1) break;
        int work[P*P];
        rep(i, P*P) work[i] = mod;
        int idx = 0;
        while(prime_ls[idx] <= N) idx++;
        for(int i = idx; i < idx+P; i++){
            for(int j = i; j < idx+P; j++){
                work[(i-idx)*P+(j-idx)] = prime_ls[i] + prime_ls[j];
            }
        }
        sort(work, work + (P*P));
        //rep(i, 100) cout << work[i] << " "; cout << endl;
        ans.push_back(work[P-1]);
    }
    rep(i, ans.size()) cout << ans[i] << endl;
    return 0;
}


Measured memory_bytes: 3436
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> lpair;
const ll MOD = 1e9 + 7;
#define rep(i,m,n) for(ll i = (m); i < (n); i++)
#define rrep(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define print2(x,y) cout << (x) << " " << (y) << endl;
#define printa(x,n) for(ll i = 0; i < n; i++){ cout << (x[i]) << " \n"[i == n-1];}
#define INF (1e18)
ll N,M;
ll A[100010], B[100010];
vector<ll> tree[100010];
ll is_visit[100010] = {};
int main(){   
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> N >> M;
    rep(i,0,M){
        cin >> A[i] >> B[i];
        A[i]--; B[i]--;
        tree[A[i]].push_back(B[i]);
        tree[B[i]].push_back(A[i]);
    }
    is_visit[A[0]] = 1;
    is_visit[B[0]] = 1;
    deque<ll> dq;
    dq.push_front(A[0]);
    dq.push_back(B[0]);
    while(1){
        ll p1 = dq.front();
        ll p2 = dq.back();
        bool ok = true;
        for(auto &e: tree[p1]){
            if(is_visit[e] == 0) ok = false;
        }
        for(auto &e: tree[p2]){
            if(is_visit[e] == 0) ok = false;
        }
        if(ok){
            print(dq.size());
            for(auto &e: dq){
                cout << e+1 << " ";
            }
            cout << endl;
            return 0;
        }else{
            bool change = false;
            for(auto &e: tree[p1]){
                if(is_visit[e] == 0){
                    change = true;
                    dq.push_front(e);
                    is_visit[e] = 1;
                    break;
                }
            }
            if(change) continue;
            for(auto &e: tree[p2]){
                if(is_visit[e] == 0){
                    dq.push_back(e);
                    is_visit[e] = 1;
                    break;
                }
            }
        }

    }
    

}


Measured memory_bytes: 9472
int main(void)
{
  int n,k,a[200000]={0},b,b2,maxb=0;
  scanf("%d %d",&k,&n);
  for(int i=0;i<n;i++)
    scanf("%d",&a[i]);
  b=k-a[n-1]+a[0];
  for(int i=1;i<n;i++)
  {
    b2=a[i]-a[i-1];
    if(b2>maxb)
      maxb=b2;
    if(b>maxb)
      maxb=b;
  }
  printf("%d",k-maxb);
}


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

int strength (int i) {
  if (i == 1)
    return 14;
  else
    return i;
}

int main (void) {
  int a, b;
  cin >> a >> b;
  if (strength(a) > strength(b)) {
    cout << "Alice" << endl;
  } else if (strength(a) < strength(b)) {
    cout << "Bob" << endl;
  } else {
    cout << "Draw" << endl;
  }
  return 0;
}


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

using namespace std;

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

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

int a, b;

void init() {

}

void input() {
	cin >> a >> b;
}

void solve() {
	int res = a + b;
	chmax(res, a-b);
	chmax(res, a*b);
	cout << res << endl;
}

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


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

int main(){
    int n;
    vector <int> a;
    long long INF = 1000000000;

    cin >> n;
    int min_a = INF;
    for (int i = 0; i < n; i ++){
        int _a; cin >> _a;
        min_a = min(min_a, _a);
        a.push_back(_a);
    }

    while(1){
        int cnt = 0;
        int new_min_a = INF;
        for (auto itr = a.begin(); itr != a.end(); ++ itr){
            if (*itr % min_a == 0){
                cnt += 1;
            }
            else{
                new_min_a = min(new_min_a, *itr % min_a);
            }
            //*itr %= min_a;
        }
        if(cnt == a.size()){
            break;
        }
        min_a = new_min_a;
    }
    cout << min_a << endl;
}

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

int main() {
	bool br[30] = { true };
	int ar[28];
	for (int i = 0; i < 30; i++) { br[i] = {true };}
	for (int i = 0; i < 28; i++) {
		cin >> ar[i];
	}
	sort(ar, ar + 28);
	for (int i = 0; i < 28; i++) {
		int a = ar[i];
		br[a - 1] = { false };
	}
	for (int i = 0; i < 30; i++) {
		if (br[i] == true) {
			cout << i + 1 << endl;
		}
	}
	return 0;
}

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

const int N = 1e6 + 100;

int main() {
    // freopen("in.txt", "r", stdin);
    ios::sync_with_stdio(0);
    cin.tie(0);
    long long A;
    cin >> A;
    long double B;
    cin >> B;
    long double ans = A*B;
    long long res = floor(ans);
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 3744
n,m = map(int,input().split())
h = list(map(int,input().split()))

path=[[] for i in range(n)]
count = 0

for i in range(m):
  a,b = map(int,input().split())
  a -= 1
  b -= 1
  path[a].append(b)
  path[b].append(a)

for i in range(n):
  c = 0
  for j in path[i]:
    if h[i] > h[j]:
      c += 1
  if c == len(path[i]):
    count += 1
    
         
print(count)

Measured memory_bytes: 29368
k = int(input())

maxV = (10**6)**2

i = 0
sevens = 0
while i < 10**6+1:
    sevens = sevens * 10 + 7
    sevens = sevens % k
    i+=1
    if sevens % k == 0:
        print(i)
        exit()

print(-1)

Measured memory_bytes: 9092
/*  "Sahand Alitanloo"  */
#include <bits/stdc++.h>
#define F first
#define S second
#define fast() ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define per(i) cout<<fixed<<setprecision(i)
#define pb push_back
#define all(v) begin(v),end(v)
#define endl '\n'
using namespace std;
typedef pair<int,int> pii;
typedef long double ld;
typedef long long ll;
const int MAX_N = 2e5+10;
const ll mod = 1e9+7;
const ll INF = 1e9;
inline ll bpow(ll t,ll n){ll ans=1;while(n>0){if(n&1)ans=(ans*t)%mod;t=(t*t)%mod,n>>=1;}return ans;}
/*
ll fact[MAX_N],ifact[MAX_N];
inline ll c(ll n,ll k){if(k>n||k<0)return 0;return (fact[n]*ifact[k]%mod*ifact[n-k])%mod;}
inline void get_fact(){fact[0]=1;ifact[0]=1;for(ll i=1;i<MAX_N;i++)fact[i]=(fact[i-1]*i)%mod,ifact[i]=bpow(fact[i],mod-2);}
*/

vector<int> vec[MAX_N];
int main(){
    fast();per(0);
    //get_fact();
    int n,m;cin>>n>>m;
    for(int i=1;i<=m;i++){
        int a,b;cin>>a>>b;
        vec[a].pb(b);
        vec[b].pb(a);
    }
    for(int i:vec[1])
        if(i!=n)
            for(int j:vec[i])
                if(i!=j&&j!=1)
                    if(j==n)
                        return cout<<"POSSIBLE",0;
    cout<<"IMPOSSIBLE";
    return 0;
}



Measured memory_bytes: 12016
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<cmath>
#include<queue>
#include<stack>
#include<list>

using namespace std;
using ll = long long;

int keta(int n){
    int result = 1;
    int tmp = n;
    while((tmp/10)>0){
        result++;
        tmp/=10;
    }
    return result;
}

int ketanum(int n,int s){
    n /= pow(10,keta(n)-s);
    return n%10;
}

int main(){
    int n,m;
    cin>>n>>m;
    int s[m],c[m];
    for(int i=0;i<m;i++){
        cin>>s[i]>>c[i];
    }
    int ans=-1;

    for(int i=0;i<pow(10,n);i++){
        if(keta(i)!=n) continue;
        bool ok=true;
        for(int j=0;j<m;j++){
            if(ketanum(i,s[j])!=c[j]) ok=false;
        }
        if(ok){
            ans=i;
            break;
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <string>
#include <math.h>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cassert>
#include <utility>
#include <numeric>
#include <cstring>
using namespace std;
using ll = long long;

int main(){
    int a;
    string s;
    cin >> a;
    cin >> s;
    if (a>=3200){
        cout << s;
    }
    else cout << "red";
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <deque>
#include <algorithm>
#include <numeric>
#include <string>
#include <cstring>
#include <list>
#include <unordered_set>
#include <tuple>
#include <cmath>
#include <limits>
#include <type_traits>
using namespace std;

using INT = long long;
using UINT = unsigned long long;

unsigned gcd(unsigned a, unsigned b) {
	while (1) {
		if (a < b) swap(a, b);
		if (!b) break;
		a %= b;
	}
	return a;
}

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


	s[k - 1] -= ('A' - 'a');

	cout << s << endl;

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
vector<int>V;
int dp[20][2];
int dfs(int start,int ok) {
	if(dp[start][ok]!=-1&&ok)return dp[start][ok];
	if(start==(int)V.size())return dp[start][ok]=0;
	int lim=V[start];
	if(ok)lim=9;
	int ans=0;
	for(int i=0; i<=lim; i++) {
		if(ok==0) {
			if(i<V[start]) ans=max(ans,dfs(start+1,1)+i);
			else if(i==V[start]) ans=max(ans,dfs(start+1,0)+i);
		} else {
			ans=max(ans,dfs(start+1,1)+i);
		}
	}
	return dp[start][ok]=ans;
}
int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	long long lim;
	cin>>lim;
	while(lim) {
		V.push_back(lim%10);
		lim/=10;
	}
	memset(dp,-1,sizeof(dp));
	reverse(V.begin(),V.end());
	cout<<dfs(0,0)<<endl;
	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define all(a) (a).begin(),(a).end()

using namespace std;
long long dp[100][100][5000];

int main(int argc, char const *argv[]) {
  int N,A;
  dp[0][0][0]=1;
  scanf("%d%d",&N,&A);
  std::vector<ll> X(N);
  for (int i = 0; i < N; i++) {
    std::cin >> X[i];
  }

  //以上入力と初期化等//
  //以下随時コメント//

  for (int i = 0; i < N; i++) {
    for (int j = 0; j <= i; j++) {
      for (int k = 0; k < 5000; k++) {
        if(dp[i][j][k]==0){
          continue; //なければ計算する必要ないので
        }
        dp[i+1][j+1][k+X[i]]+=dp[i][j][k]; //0のところから始めているので一枚(iのカード)ずつ増やす試行
        dp[i+1][j][k]+=dp[i][j][k]; //一番追える場所を増やしても同じ値になるよう選ぶことは可能なので
      }
    }
  }


  ll ans=0;
  for (int i = 1; i <= N; i++) {
    ans+=dp[N][i][i*A];
  }
  printf("%lld\n",ans);
  return 0;
}

//dp[j][k][s]=X[0]...X[j]からk個選んで合計をsにするような選び方の総数//


Measured memory_bytes: 151808
#include<bits/stdc++.h>
//#include<iostream>
#include<vector>
#include<algorithm>
#define ll long long
using namespace std;
/*

ll lcm(ll a,ll b)
{
    ll g=__gcd(a,b);
    ll res=(a/g)*b;
    return res;
}
//map<int,pair<int,int>>m;

//ll *arr=new ll[10000000+100];
bool isprime[100000000];
//ll *arr-=new arr[1000000000+5];
void sieve(int n)
{
    isprime[0]=true;
    isprime[1]=true;
    isprime[2]=false;
    for(int i=4;i<=n;i=i+2) isprime[i]=true;
    for(int i=3;i*i<=n;i+=2)
    {
        if(!isprime[i]) //if prime number
        {
            for(int j=i*i;j<=n;j=j+i)
            {
                isprime[j]=true;

            }
        }
    }

}
/*void twinprime()
{
    int c=1;
   // m[0]=make_pair(3,5);
    for(int i=3;i<=18409201;i+=2)
    {
        if((!isprime[i])&&(!isprime[i+2]))
        {
            m[c]=make_pair(i,i+2);
            c++;
        }
    }

}
*/


/*

void NOD(ll n)
{
    //int *arr=new int[n+1];


    for(ll i=1;i<=n;i++)
    {
        for(ll j=i;j<=n;j=j+i)
        {
            arr[j]=arr[j]+1;
        }
    }
    //return arr[n];
}
void SOD(ll n)
{
    int *arr=new int[n+1];


    for(ll i=1;i<=n;i++)
    {
        for(ll j=i;j<=n;j=j+i)
        {
            arr[j]=arr[j]+i;
        }
    }
    //return arr[n];
}
*/


int main()
{

//sieve(18409201);
//   twinprime();
    // NOD(2000000000);
// SOD(1000000000)
    ll a,b,x;

    scanf("%lld %lld %lld",&a,&b,&x);
    ll c=0;
    ll dif=abs((a/x)-(b/x));
    if(a%x==0)
        dif++;
    cout<<dif<<endl;











    return 0;
}


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

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

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

import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

def dijkstra(N: int, nodes: list, src: int) -> list:
    """ ダイクストラ高速化版(頂点数, 隣接リスト(0-indexed), 始点) """
    from heapq import heappush, heappop

    res = [INF] * N
    # スタート位置(今回は開始コストが0じゃないので1*Nを含める)
    que = [1*N+src]
    # 今回の開始位置1のコストは1
    res[src] = 1*N

    while len(que) != 0:
        cur = heappop(que)
        dist = cur // N
        cur %= N
        for nxt, cost in nodes[cur]:
            if dist + cost < res[nxt]:
                res[nxt] = dist + cost
                heappush(que, (dist+cost)*N+nxt)
    return res

K = INT()

nodes = [[] for i in range(K)]
for i in range(K):
    nodes[i].append(((i+1)%K, 1))
    nodes[i].append(((i*10)%K, 0))

res = dijkstra(K, nodes, 1)
print(res[0])


Measured memory_bytes: 37896
from itertools import accumulate

N,K = [int(zz) for zz in input().split()]
P = [int(zz) for zz in input().split()]

Q = [0] + list(accumulate(P))
ans = 0
for i in range(N-K+1):
    ans = max(ans,Q[i+K]-Q[i])

print((ans+K)/2)


Measured memory_bytes: 25152
import re
import math

s=input()
l=[0,]*len(s)

pointer=0
for item in re.findall(r'R+L+', s):
  num_R=item.count('R')
  num_L=item.count('L')
 
  l[pointer+num_R-1]=math.ceil(num_R/2)+math.floor(num_L/2)
  l[pointer+num_R]=math.ceil(num_L/2)+math.floor(num_R/2)
    
  pointer=pointer+len(item)
  
print(*l)

Measured memory_bytes: 7284
#include <stdio.h>

int main()
{
	int K;
	int X;
	
	scanf("%d %d",&K,&X);
	
	if (K*500>=X)
	{
		printf ("Yes");
	}
	else 
	{
		printf("No");
	}
	
	
	
	return 0;
}

Measured memory_bytes: 1672
use std::io::stdin;


fn main() {
    let mut st = String::new();
    stdin().read_line(&mut st).unwrap();
    let s:Vec<char> = st.trim().chars().collect();
    let p:usize = s.iter().filter(|x| x.to_string()=="p").count();
    let n = s.len();
    println!("{}", n/2 - p);
}

Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
 
int main(){
  // A-Cは全て1以上9以下の整数
  int A,B,C;
  cin >> A >> B >> C;
  if(A == B && A != C) cout << "Yes" << endl;
  else if(A == C && A != B) cout << "Yes" << endl;
  else if(B == C && B != A) cout << "Yes" << endl;
  else cout << "No" << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<algorithm>
#include<cmath>
#include<set>
using namespace std;
typedef pair<int,int> P;

int main(){
    string str;
    cin>>str;
    long long sz=str.size();
    long long ans = (sz*(sz-1))/2 + 1;
    int hist[26]={};
    for(int i=0;i<sz;i++){
        long long ch = str[i]-'a';
        ans -= hist[ch];
        hist[ch]++;
    }
    cout<<ans<<endl;
    return 0;
}


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

int main() {
  string s;
  cin >> s;
  int ans = s.at(0) - '0'; int ans1 = 0; 
  //cout << s.size() << endl;
  rep(bit, 1 << (s.size() - 1)){
    //cout << bit << endl;
    rep(i, s.size() - 1){
      //cout << i << endl;
      if(bit & (1<<i)) ans += (s.at(i + 1) -'0');
      else ans -= (s.at(i + 1) -'0');
    }
    if(ans == 7) {
      ans1 = bit;
      cout << s.at(0);
      rep(i, s.size() - 1){
        if(ans1 & (1<<i)) cout << "+" << s.at(i + 1);
        else cout << "-" << s.at(i + 1);
        if(i == s.size() - 2) cout << "=7" << endl;
      }
      break;
    }
    else ans = s.at(0) - '0';  
  }
}

Measured memory_bytes: 3608
#include <algorithm>
#include <vector>
#include <cfloat>
#include <string>
#include <cmath>
#include <set>
#include <cstdlib>
#include <map>
#include <ctime>
#include <iomanip>
#include <functional>
#include <deque>
#include <iostream>
#include <cstring>
#include <queue>
#include <cstdio>
#include <stack>
#include <climits>
#include <sys/time.h>
#include <cctype>

using namespace std;

typedef long long ll;

int a, l;
int next_number(int x) {
  int t[l];
  for (int i = l-1; i >= 0; i--) {
    t[i] = x%10;
    x /= 10;
  }
  sort(t, t+l);
  int max_v = 0;
  for (int i = l-1; i >= 0; i--) {
    max_v = max_v*10+t[i];
  }
  int min_v = 0;
  for (int i = 0; i < l; i++) {
    min_v = min_v*10+t[i];
  }
  return max_v-min_v;
}

int ind[1000001];
int main() {
  while(cin >> a >> l) {
    if (a == 0 && l == 0) break;
    set<int> memo;
    int ans = 0;
    memset(ind, 0, sizeof(ind));
    while (true) {
      memo.insert(a);
      ind[a] = ans;
      ans++;
      a = next_number(a);
      if (memo.find(a) != memo.end()) {
	std::cout << ind[a] << " " << a << " " << ans-ind[a] << std::endl;
	break;
      }
    }
  }
}

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

#define $(x) (int)((x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define endl '\n'
#define x first
#define y second
#define int long long
#define double long double
#define pii pair<int, int>
#define pb push_back
#define vec vector
#define beg begin
#define dbg(x) cerr << #x << " = " << x << endl;

template<class T> ostream& operator<<(ostream &str, vector<T> &a) {
    for (auto &i : a) {
        str << i << " ";
    }
    return str;
}

template<class T> istream& operator>>(istream &str, vector<T> &a) {
    for (auto &i : a) {
        str >> i;
    }
    return str;
}

template<class T> ostream& operator<<(ostream &str, pair<T, T> &a) {
    str << a.first << " " << a.second;
    return str;
}

template<class T> istream& operator>>(istream &str, pair<T, T> &a) {
    str >> a.first >> a.second;
    return str;
}

void solve(); signed main() {
#ifdef LOCAL
    freopen("C:\\Users\\artma\\CLionProjects\\problems\\input.txt", "r", stdin);
#endif
    srand(time(0));
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cout.setf(ios::fixed); cout.precision(6);
    solve();
    return 0;
}

const int MOD = 1e9 + 7, MAXN = 1e6 + 10, INF = 1e18 + 10, BASE = 37;

void solve() {
    int n;
    cin >> n;
    string s;
    cin >> s;
    vec<int> ps(n);
    if (s[0] == 'R') {
        ps[0] = 1;
    }
    for (int i = 1; i < n; ++i) {
        if (s[i] == 'R') {
            ps[i] = ps[i - 1] + 1;
        }
        else {
            ps[i] = ps[i - 1];
        }
    }
    int ans = INF;
    for (int cnt = 0; cnt <= n; ++cnt) {
        if (cnt == 0) {
            ans = min(ans, ps[n - 1]);
        }
        else if (cnt <= ps[n - 1]) {
            ans = min(ans, cnt - ps[cnt - 1] + ps[n - 1] - cnt);
        }
        else {
            ans = min(ans, cnt - ps[cnt - 1]);
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 5200
use proconio::input;

fn main() {
    input! {
        n: usize,
        k: usize,
        a: [usize; n],
    }

    let max_d = 40;
    let mut counter1 = vec![0; max_d + 1];

    for i in 0..n {
        for j in 0..=max_d {
            if (a[i] >> j) & 1 != 0 {
                counter1[j] += 1;
            }
        }
    }
    let mut x = 0;
    for i in 0..=max_d {
        if counter1[i] <= n / 2 {
            x += 2usize.pow(i as u32);
        }
    }

    let mut flag = true;
    for i in (0..=max_d).rev() {
        let bit_x = (x >> i) & 1;
        let bit_k = (k >> i) & 1;
        //println!("i: {} bit_k {}", i, bit_k);
        match (bit_x, bit_k) {
            (1, 1) => (),
            (0, 1) => flag = false,
            (1, 0) => {
                if flag {
                    //i番目の1→0
                    x &= !(1 << i);
                }
            }
            (0, 0) => (),
            _ => panic!(),
        };
    }
    //println!("x: {}", x);

    let mut ans = 0;
    for i in 0..n {
        ans += a[i] ^ x;
    }
    println!("{}", ans);
}


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

int main() {
  int x, sum = 0, count = 100000000, modNum;
  cin >> x;
  modNum = x;
  while (true) {
    int y = modNum / count;
    if (y != 0 && y < 10) {
      modNum = x % count;
      sum += y;
    }
    count /= 10;
    if (count == 0) break;
  }
  string str;
  if (x % sum == 0) {
    str = "Yes";
  }
  else {
    str = "No";
  }
  cout << str << endl;
}

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

// #define int long long
#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) int(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vs = vector<string>;
using vpll = vector<pair<ll, ll>>;

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

const ll INF = 1e15;
const int MOD = 1e9+7;
const ll LINF = 1e18;


signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  ll n; cin>>n;
  vll a(n+1);
  rep(i,n+1) cin>>a[i];
  vll b(n);
  rep(i,n) cin>>b[i];
  ll ans=0;
  rrep(i,n){
    ll tmp=a[i+1];
    a[i+1]=max(a[i+1]-b[i],0LL);
    ans+=tmp-a[i+1];
    b[i]=b[i]<=tmp?0LL:b[i]-tmp;
    if(b[i]<=0) continue;
    tmp=a[i];
    a[i]=max(a[i]-b[i],0LL);
    ans+=tmp-a[i];
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 1792
x1,x2,x3,x4,x5,x6 = map(int,(input().split()))
t = input()
x=x1


L=[x1,x2,x3,x4,x5,x6]
n= len(t)
T=[]
M=[]
for i in range(n):
    T.append(t[:1])
    t=t[1:]



for i in T:
    if i is "S":
        L = [L[4],L[0],L[2],L[3],L[5],L[1]]
    elif i is "E":
        L = [L[3], L[1], L[0], L[5], L[4], L[2]]
    elif i is "N":
        L = [L[1], L[5], L[2], L[3], L[0], L[4]]
    else:
        L = [L[2], L[1], L[5], L[0], L[4], L[3]]



print(L[0])

Measured memory_bytes: 7736
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <array>
#include <algorithm>
#include <utility>
#include <numeric>
#include <deque>
#include <stack>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cmath>
#include <limits>
#include <cassert>
#include <bitset>
#include <list>
#include <iomanip>
#include <cctype>
#include<chrono>
#include<random>

#define for0(i, N)    for (long long i = 0  ; i <  (N); ++i)
#define for1n(i, N)   for (long long i = 1  ; i <= (N); ++i)
#define for1(i, N)    for (long long i = 1  ; i <  (N); ++i)
#define forn(i, N)    for (long long i = 0  ; i <= (N); ++i)
#define forx(i, N, x) for (long long i = (x); i <  (N); ++i)
#define forl(i, N, x, a) for (long long i = (x), a = 0; a < (N);    \
                              i = (i + 1) % (N), ++a)
#define int long long

long double constexpr pi = 3.141592653589793;

template<class T>
constexpr T sigma1(T i, T n){
    return (n - i + 1) * (i + n) / 2;
}

template<class T>
constexpr T sigma2(T i, T n){
    return (i == 1 ? n * (n + 1) * (2 * n + 1) / 6 :
            sigma2(1, n) - sigma2(1, i - 1));
}

template<class T>
constexpr T sigma3(T i, T n){
    if (i == 1) {
        auto temp = sigma1(i, n);
        return temp * temp;
    }
    return sigma2(1, n) - sigma2(1, i - 1);
}

template<size_t i>
std::bitset<i> operator++(std::bitset<i> b, signed){
    static_assert(i <= 64, "Cannot cast 64bit int.");
    return b = (unsigned long long)b + 1;
}

template<size_t i>
std::bitset<i> operator++(std::bitset<i> b){
    static_assert(i <= 64, "Cannot cast 64bit int.");
    auto temp = b;
    b++;
    return temp;
}

template<size_t i>
std::bitset<i> operator--(std::bitset<i> b, signed){
    static_assert(i <= 64, "Cannot cast 64bit int.");
    return b = (unsigned long long)b - 1;
}

template<size_t i>
std::bitset<i> operator--(std::bitset<i> b){
    static_assert(i <= 64, "Cannot cast 64bit int.");
    auto temp = b;
    b--;
    return temp;
}

long long constexpr inf = std::numeric_limits<long long>::max();

using namespace std;

typedef long long ll;
typedef long double ld;
typedef priority_queue<ll> pq;
typedef priority_queue<ll,vector<ll>, greater<ll>> pql;
typedef stack<ll> stk;
typedef queue<ll> qu;
typedef pair<ll, ll> pll;
typedef map<ll, ll> mll;
typedef unordered_map<ll, ll> umll;
typedef set<ll> sll;
typedef unordered_set<ll> usll;
typedef vector<ll> vll;
typedef vector<ld> vld;
typedef vector<vector<ll>> vvll;


signed main(void){
    cin.tie(0); ios::sync_with_stdio(false);cout<<fixed<<setprecision(10);

    ll n;

    cin >> n;
    set<string> ss;

    for0(i, n){
        string s;
        cin >> s;
        ss.insert(s);
    }


    cout << ss.size() << "\n";

    return 0;
}


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

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

const long long INF = 1e17;
long long N, M, L, Q;
long long fuel[305][305];
long long dist[305][305];
long long s[105000], t[105000];
long long A[100000], B[100000], C[100000];


void input() {
    cin >> N >> M >> L;
    for (int i = 1; i <= M; i++) cin >> A[i] >> B[i] >> C[i];
    cin >> Q;
    for (int i = 1; i <= Q; i++) cin >> s[i] >> t[i];
}


void solve() {
    input();
    for (int i = 1; i <= N; i++) {
        for (int j = 1; j <= N; j++) {
            fuel[i][j] = INF;
            dist[i][j] = INF;
        }
        fuel[i][i] = 0;
        dist[i][i] = 0;
    }
    for (int i = 1; i <= M; i++) {
        chmin(fuel[A[i]][B[i]], C[i]);
        chmin(fuel[B[i]][A[i]], C[i]);
    }
    for (int i = 1; i <= N; i++) {
        for (int j = 1; j <= N; j++) {
            for (int k = 1; k <= N; k++) {
                chmin(fuel[j][k], fuel[j][i] + fuel[i][k]);
            }
        }
    }
    for (int i = 1; i <= N; i++) {
        for (int j = 1; j <= N; j++) {
            if (i == j) continue;
            if (fuel[i][j] <= L) chmin(dist[i][j], 1LL);
        }
    }
    for (int i = 1; i <= N; i++) {
        for (int j = 1; j <= N; j++) {
            for (int k = 1; k <= N; k++) {
                chmin(dist[j][k], dist[j][i] + dist[i][k]);
            }
        }
    }
    for (int i = 1; i <= Q; i++) {
        if (dist[t[i]][s[i]] < INF) cout << dist[t[i]][s[i]] - 1 << endl;
        else cout << -1 << endl;
    }
    return;
}


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

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

#define endl '\n'
#define rep(n)      for (int i = 0 ; i < n ; i++)
#define all(a)      a.begin(),a.end()
#define NumofDigits(n)    ((long long)log10(n)+1)
#define Unique(n)         (n).erase(unique(all(n)), (n).end())



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

void readFromText ()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
#endif // ONLINE_JUDGE
}

void time()
{
#ifndef ONLINE_JUDGE
    cout << "\nTime: " << 1.0 * clock() / CLOCKS_PER_SEC << "s\n";
#endif
}

const double Pi = acos(-1.0);

const int MAX = 2e5 ;
int sum [MAX+1];
int freq [MAX+1];

int main()
{
    quick(); // readFromText();
    int n , m ; cin >> n >> m ; 
    if (n<=m)cout <<"unsafe";
    else cout <<"safe";
    return 0;
}


Measured memory_bytes: 3652
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		long K = sc.nextLong();
		sc.close();

		int onecount = 0;
		for(int i = 0 ; i < S.length() ; i++){
			if(S.substring(i,i+1).equals("1"))
				onecount++;
			else{
				break;
			}
		}

		if(onecount >= K){
			System.out.println("1");
		}
		else{
			System.out.println(S.substring(onecount,onecount+1));
		}
	}
}


Measured memory_bytes: 21844
void main() {
    char c = readln.chomp.to!char;
    char[] vowels = ['a', 'e', 'i', 'o', 'u'];
    writeln(vowels.canFind(c) ? "vowel" : "consonant");
}

import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.range;
import std.math;
import std.numeric;
import std.container;
import std.typecons;
import std.ascii;
import std.uni;

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

#define MAX_V 1000
#define INF 100000

// ???????????????????????????
struct edge {
  int to, cap, rev;
};

int V, E;
vector<edge> G[MAX_V];
bool used[MAX_V];

void add_edge(int from, int to, int cap) {
  G[from].push_back((edge){to, cap, G[to].size()});
  G[to].push_back((edge){from, 0, G[from].size() - 1});
}

// ?¢?????????????dfs??§??¢???
int dfs(int v, int t, int f) {
  if(v == t) return f;
  used[v] = true;
  for(int i = 0; i < G[v].size(); i++) {
    edge &e = G[v][i];
    if(!used[e.to] && e.cap > 0) {
      int d = dfs(e.to, t, min(f, e.cap));
      if(d > 0) {
        e.cap -= d;
        G[e.to][e.rev].cap += d;
        return d;
      }
    }
  }
  return 0;
}

// s??????t???????????§???????±???????
int max_flow(int s, int t) {
  int flow = 0;
  while(true) {
    memset(used, 0, sizeof(used));
    int f = dfs(s, t, INF);
    if(f == 0) return flow;
    flow += f;
  }
  return -1;
}

int main() {
  cin >> V >> E;
  for(int i = 0; i < E; i++) {
    int u, v, c;
    cin >> u >> v >> c;
    add_edge(u, v, c);
  }

  cout << max_flow(0, V-1) << endl;
}

Measured memory_bytes: 1288
N = int(input())
A = [int(i) for i in input().split(" ")]

next_int = 1
num_break = 0

for x in A:
    if x == next_int:
        next_int += 1
        continue
    num_break += 1

result = -1 if next_int == 1 else num_break
print(result)


Measured memory_bytes: 74588
#include<bits/stdc++.h>
using namespace std;
#define ll long long
 
int main()
{
    ll n, k;
    cin >> n >> k;
    ll arr[n];
    for(int i = 0; i <n; i++)   {
        cin >> arr[i];
    }
    sort(arr, arr+n);
    ll sum  = 0;
    for(int i = 0; i < k; i++)  {
        sum += arr[i];
    }
    cout << sum;
    return 0;
}

Measured memory_bytes: 3636
n = int(input())
a = list(map(int, input().split()))
ans = 0
count = 0
c = 10 ** 9

for i in range(n):
    if a[i] < 0:
        count += 1
    if abs(a[i]) < c:
        c = abs(a[i])
    ans += abs(a[i])


if count % 2 == 1:
    ans -= 2 * c

print(ans)



Measured memory_bytes: 14412
N = 100001
A,B = [True]*N,[0]*N
A[0],A[1] = False,False
for i in range(2,N):
    if A[i]:
        for j in range(i*2,N,i):
            A[j] = False
c=0
for i in range(3,N):
    if A[i] and A[(i+1)//2]:
        c += 1
    B[i] = c
Q = int(input())
for i in range(Q):
    l,r = map(int,input().split())
    print(B[r]-B[l-1])


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

#define ll long long
#define ull unsigned long long
#define pb push_back
#define pii pair<int, int>
#define sz size()

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>void __f(const char* name, Arg1&& arg1){cout<<name<<" : "<<arg1<<"\n";}
template <typename Arg1, typename... Args>void __f(const char* names, Arg1&& arg1, Args&&... args)
{const char* comma=strchr(names+1,',');cout.write(names,comma-names)<<" : "<<arg1<<" , ";__f(comma+1, args...);} 
#define traceloop(x,a) { cerr<<#a<<": "; for(ll ix=0;ix<x;ix++) cerr<<a[ix]<<" "; cerr<<endl; }

const int maxn = 1e3+7;
const int mod = 1e9+7;
int dp[maxn][maxn], a[maxn][maxn];
int n, m;

int dfs(int u, int v)
{
	//trace(u, v);
	if(u==n-1 and v==m-1)
		return 1;

	if(dp[u][v] != -1)
		return dp[u][v];

	dp[u][v] = 0;

	if(u+1 < n and a[u+1][v])
	{
		//trace(u, v, "go down"); cout << '\n';
		dp[u][v] = ( dp[u][v] + dfs(u+1, v) ) % mod;
	}
	if(v+1 < m and a[u][v+1])
	{
		//trace(u, v, "go right"); cout << '\n';
		dp[u][v] = ( dp[u][v] + dfs(u, v+1) ) % mod;
	}

	return dp[u][v];
}

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

	int i, j, k;

	cin>>n>>m;

	for(i=0;i<n;++i)
	{
		string s;
		cin>>s;
		for(j=0;j<m;++j)
		{
			a[i][j] = (s[j] == '.');
			dp[i][j] = -1;
		}
	}

	cout << dfs(0, 0) << '\n';

	return 0;
}

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

class AllGreen{
  private:
    int D, G;
    std::vector<int> p;
    std::vector<int> c;
    int min_q = 9999999;

    void loop ( int k , int sum_p, int sum_q , int count) {
      if ( min_q < sum_q || count >= 2) return;
      if ( k == D ) {
        if(sum_p >= G) min_q = std::min ( min_q, sum_q );
        return;
      }

      for(int i=0; i<=p[k]; i++){
        if ( i == p[k] ) loop(k+1, sum_p+i*(k+1)*100+c[k], sum_q+i, count);
        else if ( i == 0 ) loop(k+1, sum_p+i*(k+1)*100, sum_q+i, count);
        else {
          loop(k+1, sum_p+i*(k+1)*100, sum_q+i, count+1);
        }
      }
      return ;
    }


  public:
    AllGreen(int D_, int G_) : D(D_), G(G_){
    }

    void push_back( int p_, int c_ ){
      p.push_back(p_);
      c.push_back(c_);
    }

    void Sol(){
      loop(0, 0, 0, 0);
      std::cout << min_q << std::endl;
    }
};

int main (void){
  int D, G; std::cin >> D >> G;
  AllGreen x(D,G);

  for(int i=0; i<D; i++){
    int p, c; std::cin >> p >> c;
    x.push_back(p,c);
  }

  x.Sol();
  return 0;
}

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

#define _USE_MATH_DEFINES
#include<cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>
#include<iomanip>
#include<unordered_set>
#include<bitset>
#include<complex>

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

//typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;
typedef vector< vector<int> > mat;

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 (b < a) { a = b; return true; } return false; }

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD =  (int)1e9 + 7;
const double EPS = 1e-9;

int N, D, A;
int imos[200010];

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

	cin >> N >> D >> A;

	vector<pii> P(N);
	rep(i, 0, N)
	{
		cin >> P[i].first >> P[i].second;
		P[i].second = (P[i].second + A - 1) / A;
	}

	sort(all(P));

	int cnt = 0;
	int ans = 0;
	rep(i, 0, N)
	{
		cnt += imos[i];

		if (cnt >= P[i].second)continue;

		int d = P[i].first + 2*D + 1;
		int ind = lower_bound(all(P), mp(d, 0LL)) - P.begin();
		imos[ind] -= P[i].second - cnt;
		ans += P[i].second - cnt;
		cnt = P[i].second;
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 4992
#include<bits/stdc++.h>
using namespace std;
long long n,z;
string st,s;
int main()
{
	cin>>st>>s;
    for (int i=2;i>=0;i--)
      if (s[i]==st[2-i]) z++;
    if (z==3) cout<<"YES"<<endl;else
      cout<<"NO"<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ft first
#define sc second
#define pt(sth) cout << sth << "\n"
#define chmax(a, b) {if(a<b) a=b;}
#define chmin(a, b) {if(a>b) a=b;}
#define moC(a, s, b) (a)=((a)s(b)+MOD)%MOD
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
static const ll INF=1e18;
static const ll MAX=101010;
static const ll MOD=1e9+7;

ll N;
ll a[444];
ll s[444];
ll mem[444][444];
ll rec(ll l, ll r) {
  if(l+1==r) return 0;
  if(mem[l][r-1]!=-1) return mem[l][r-1];
  
  
  ll res=INF;
  for(ll m=l+1; m<r; m++) {
    chmin(res, rec(l, m)+rec(m, r)-s[l-1]+s[r-1]);
  }
  
  return mem[l][r-1]=res;
}

int main() {
  cin >> N;
  ll i, j;
  
  for(i=1; i<=N; i++) {
    cin >> a[i];
    s[i]=s[i-1]+a[i];
  }
  
  memset(mem, -1, sizeof(ll));
  for(i=1; i<N+1; i++) {
    for(j=1; j<N+1; j++) {
      mem[i][j]=-1;
    }
  }
  
  pt(rec(1, N+1));
  
}








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

ll g1(ll n, int p) {
  if (n == 0) return 0;
  return n/p + g1(n/p,p);
}
ll g2(ll n, int p) {
  if (n%2 == 1) {
    return g1(n,p) - g2(n-1,p);
  }
  ll res = g1(n/2,p);
  if (p == 2) res += n/2;
  return res;
}

int main() {
  ll n;
  cin >> n;
  ll ans = min(g2(n,2), g2(n,5));
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
K = int(input())
A = list(map(int, input().split()))
def ceiling(x, mod):
  if x % mod == 0:
    return x // mod
  else:
    return x // mod + 1

m, M = 2, 2
p = 0
for i in range(K-1, -1, -1):
  m, M = A[i] * ceiling(m, A[i]), A[i] * (M // A[i]) + A[i] - 1
chk1, chk2 = m, M
for i in range(K):
  chk1, chk2 = A[i] * (chk1 // A[i]), A[i] * (chk2 // A[i])
if chk1 == 2 and chk2 == 2:
  print(m, M)
else:
  print(-1)

Measured memory_bytes: 14432
siri = ''
N = int(input())
a = [input() for i in range(N)]
for i, temp in enumerate(a):
    if i == 0:
        if len(set(a)) != N:
            print('No')
            break
        siri = temp[-1]
        continue
    if siri != temp[0]:
        print('No')
        break
    siri = temp[-1]
else:
    print('Yes')

Measured memory_bytes: 3064
def mips():
    return map(int,input().split())
N,K = mips()
C = [c for c in mips()]
dist = []
for i in range(N-K+1):
    dist.append(min(abs(C[i]) + abs(C[i+K-1]-C[i]),abs(C[i+K-1]) + abs(C[i+K-1]-C[i])))
print(min(dist))


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

int main() {
  int N, K, cnt = 0, flag = 0;
  cin >> N >> K;
  for(int i = 1; i <= N; i += 2) {
    cnt++;
    if(cnt == K) {
      cout << "YES" << endl;
      flag++;
      break;
    }
  }
  if(flag == 0) {
    cout << "NO" << endl;
  }

  return 0;
}

Measured memory_bytes: 256
/*
    g++ -std=c++14 -O2 -Wall a.cpp -o a && a
    g++ -std=c++14 -O2 -Wall a.cpp -o a && a < in.txt > out.txt
    */

//  io
#include <fstream> //http://www.cplusplus.com/reference/fstream/fstream/
#include <iostream>
//#include <cstdio>
#include <iomanip> //http://www.cplusplus.com/reference/iomanip/
//  util
#include <algorithm>
#include <cstring>
#include <string>
#include <utility>
//#include <functional> //http://www.cplusplus.com/reference/functional/
//#include <cstdlib>
//#include <cmath>
//#include <complex>
//#include <random>
//#include <bitset>
//  containers https://en.cppreference.com/w/cpp/container
#include <queue>
#include <stack>
#include <vector>
//#include <set>
#include <tuple>
//#include <map>
//#include <unordered_set>
//#include <unordered_map>
//  time
//#include <ctime>
//#include <chrono>
//                  https://en.cppreference.com/w/cpp/header/chrono
//                  http://www.cplusplus.com/reference/chrono/

using namespace std;
typedef vector<int> vi;
typedef vector<float> vf;
typedef pair<int, int> vii;
typedef long long ll;
typedef long double ld;
constexpr int mod = 1e9 + 7;
const ll inf = 0x7fffffffffffffff;
const ll infneg = -0x7fffffffffffffff;

//int modadd(int a, int b) { return ((a += b) < mod) ? a : (a - mod); }
//int modmult(int a, int b) { return (int)((a * b) % mod); }

int arr[100005];

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

    int n, m;
    cin >> n >> m;
    for (int i = 0; i < m; i++)
    {
        int l, r;
        cin >> l >> r;
        arr[l - 1] += 1;
        arr[r] -= 1;
    }

    int cnt = 0;

    for (int i = 1; i <= n; i++)
    {
        arr[i] += arr[i-1];
    }
    for (int i = 0; i < n; i++)
    {
        if(arr[i] == m) cnt++;
    }

    cout << cnt;
}


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

using namespace std;

int main(){
  string s,t;
  cin >> s >> t;
  sort(s.begin(),s.end());
 
  sort(t.begin(),t.end());
  reverse(t.begin(), t.end());
  if ( s < t ){
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 3604