akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
using namespace std;
int main(void){
    int N, K, R, S, P;
    string T;
    cin >> N >> K >> R >> S >> P >> T;
    
    int a[100000];
    for (int i = 0; i < N; i++)
        a[i] = 1;
    
    for (int i = 0; i < N-K; i++)
        if (a[i] != 0 && T[i] == T[i+K])
            a[i+K] = 0;
    
    long long ans = 0;
    for (int i = 0; i < N; i++) {
        if (a[i] == 1) {
            if (T[i] == 'r')
                ans += P;
            else if (T[i] == 's')
                ans += R;
            else
                ans += S;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
#define rep0(i, n) for (long long i = 0; i < (long long)(n); i++)
#define rep1(i,n) for(long long i=1;i<=(long long)(n);i++)
#define all(v) v.begin(),v.end()
#define Sort(v) sort(all(v))
#define Reverse(v) reverse(all(v))
#define Rsort(v) sort(all(v),greater)
#define pub(v) push_back(v)
#define pob(v) pop_back(v)
typedef long long ll;
typedef vector<ll> vel;
typedef vector<vector<ll>> vel2d;
typedef string str;
typedef pair<ll,ll> pal;
typedef vector<str> ves;
typedef vector<char> vech;


int main() {
    vel a(5); rep0(i,5){cin>>a[i];}
    vel data(5);
    rep0(i,5){if(a[i]%10==0){data[i]=(a[i]/10)*10-a[i];} else{data[i]=(a[i]/10+1)*10-a[i];}}
    sort(all(data));
    ll ans=0;
    rep0(i,4){ans+=a[i]+data[i];}//cout<<ans<<endl;
    ans+=a[4];
    cout<<ans<<endl;
}


Measured memory_bytes: 256
/*
   Author : tarang
*/
#include<bits/stdc++.h>
#define ll long long
#define fastio ios_base::sync_with(false); cin.tie(0);cout.tie(0);
const int MOD = 1000000007;
#define PI = acos(-1)
using namespace std ;
int main(){
	set<int> s ;
   int a , b , c;
   cin >> a >> b >> c ;
   s.insert(a);
   s.insert(b);
   s.insert(c);
   cout << s.size() << endl;
}




Measured memory_bytes: 3608
#include<bits/stdc++.h>
#define forr(i, a, b) for(int i = (a); i < (b); i++)
#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = 1; i <= (n); i++)
#define ALL(a) (a.begin()),(a.end())
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll, ll> LP;
const ll LINF = 1LL<<60;
const int INF = 1001001001;
const int MOD = 1000000007;

/* --------------------------------------------------- */

int n, m;
map<string, int> memo;

int main() {
    cin >> n;
    rep(i, n) {
        string x;
        cin >> x;
        memo[x]++;
    }
    cin >> m;
    rep(i, m) {
        string x;
        cin >> x;
        memo[x]--;
    }
    int ans = 0;
    for(map<string, int>::iterator it = memo.begin(); it != memo.end(); it++) {
        if(it->second > ans) ans = it->second;
    }
    cout << ans << endl;

    return 0;
}

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

using namespace std;

int main(){
    vector<int> ans(3);

    cin >> ans[0] >> ans[1] >> ans[2];

    sort(begin(ans), end(ans));

    cout << ans[0] << " " << ans[1] << " " << ans[2] << "\n";
    return 0;
}



Measured memory_bytes: 3160
#include <iostream>
#include <string>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <list>
#include <iomanip>
#include <vector>
#include <functional>
#include <algorithm>
#include <cstdio>
#include <random>
#include <ctime>
#include <cstdlib>
#include <unordered_map>
#include <string.h>
#include <iostream>

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(begin, i, end) for (int i = begin; i < (int)(end); i++)
#define all(v) v.begin(), v.end()
const int MOD = 998244353;

ll mpow(ll x, ll n); // x^n (mod MOD)
ll comb(ll n, ll r); // nCr (mod MOD)

vector<ll> fac(200005, 1);     // n!
vector<ll> fac_inv(200005, 1); // (k!)^(-1) (mod MOD)

int main()
{
    ll N, M, K;
    cin >> N >> M >> K;
    rep(0, i, 200004)
    {
        fac.at(i + 1) = (fac.at(i) * (i + 1)) % MOD;
        fac_inv.at(i + 1) = (fac_inv.at(i) * mpow(i + 1, MOD - 2)) % MOD;
    }
    ll ans = 0;
    ll tmp = mpow(M - 1, N - K - 1);
    for (ll i = K; i >= 0; i--)
    {
        ans += ((M * tmp) % MOD * comb(N - 1, i)) % MOD;
        ans %= MOD;
        tmp *= (M - 1);
        tmp %= MOD;
    }

    cout << ans << endl;
}

ll mpow(ll x, ll n)
{
    ll ans = 1;
    while (n != 0)
    {
        if (n & 1)
            ans = ans * x % MOD;
        x = x * x % MOD;
        n = n >> 1;
    }
    return ans;
}

ll comb(ll n, ll r)
{
    if (n == 0 && r == 0)
    {
        return 1;
    }
    if (n < r || n < 0)
    {
        return 0;
    }
    ll tmp = (fac_inv.at(n - r) * fac_inv.at(r)) % MOD;
    return (tmp * fac.at(n)) % MOD;
}

Measured memory_bytes: 6184
#include "bits/stdc++.h"
using namespace std;
#define pb          push_back
#define mp          make_pair
#define ll          long long
#define pii         pair<int, int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int, int>
#define mii         map<pii, int>
#define all(a)      (a).begin(),(a).end()
#define x           first
#define y           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define hell        1000000007
#define debug(x) cout << '>' << #x << ':' << x << endl;
#define rep(i,a,b)  for(int i=a;i<b;i++)
#define rev(i,a,b)  for(int i=a;i>=b;i--)
#define lb          lower_bound
#define ub          upper_bound

#define bg(i)       i.begin()
#define fset(it,s)   for(auto it = s.begin(); it != s.end(); it++)
 
#define track(x)                 cerr<<#x<<": "<<x<<endl
#define track2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define track3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define track4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
 
#define ed(i)       i.end()
#define mem(a)	    memset(a, 0, sizeof(a))

#define MOD         1000000007
int mult(int a,int b, int p=MOD){return ((a%p)*(b%p))%p;}
int add(int a, int b, int p=MOD){return (a + b + p)%p;}
int fpow(int n, int k, int p = MOD) {int r = 1; for (; k; k >>= 1LL) {if (k & 1LL) r = mult(r,n,p); n = mult(n,n,p);} return r;}
int inv(int a, int p = MOD) {return fpow(a, p - 2, p);}
void self_max(int &a, int b) {a = max(a, b); }
void self_min(int &a, int b) {a = min(a, b); }
void self_add(int &a, int b, int p = MOD) { a += b; if(a >= p) a -= p;}
void self_sub(int &a, int b, int p = MOD) { a -= b; if(a < 0) a += p;}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
const int INF = 1e9 + 5;
#define N	    	400001

ll type[N];
void solve(){
    ll n, k;
    cin>>n>>k;
    vector<pair<ll, ll>> v;
    ll sum, typeCnt = 0;
    sum = 0;
    rep(i, 0, n) {
        int t, val;
        cin>>t>>val;
        v.pb(mp(val, t));
    }
    sort(all(v)); reverse(all(v));
    rep(i, 0, k) {
        sum += v[i].x;
        if(!type[v[i].y]) {
            typeCnt++;
        }
        type[v[i].y]++;
    }
    ll ans = sum + typeCnt * typeCnt;
    vector<ll> rem;
    rev(i, k-1, 0) {
        if(type[v[i].y] != 1) {
            rem.pb(v[i].x);
            type[v[i].y]--;
        }
    }


    int ind = 0;
    rep(i, k, n) {
        if(!type[v[i].y] && ind < sz(rem)) {
            type[v[i].y]++;
            sum -= rem[ind++];
            sum += v[i].x;
            typeCnt++;
            ans = max(ans, sum + typeCnt * typeCnt);
        }
    }
    cout<<ans<<endl;
}
int main() {
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(20);
	cin.tie(0);
	cout.tie(0);
	int t = 1;
//	cin>>t;
	while(t--){
		solve();
	}
}


Measured memory_bytes: 6384
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#include <math.h>
#include <limits.h>

int main(void){
    int n,l=0;
    bool e=false;
    char s[250],t[250],u[2]=")";
    scanf("%d%s",&n,s);
    for (int j=0; j<strlen(s); j++){
        for (int i=0; i<strlen(s); i++){
            if (s[i]=='('){
                l++;
            } else {
                l--;
            }
            if (l<0){
                e=true;
            }
        }
        if (e==true){
            strcpy(t,s);
            s[0]='(';
            strcpy(s+1,t);
            
        }
        e=false;
        l=0;
    }
    for (int j=strlen(s)-1; j>=0; j--){
        for (int i=strlen(s)-1; i>=0; i--){
            if (s[i]==')'){
                l++;
            } else {
                l--;
            }
            if (l<0){
                e=true;
            }
        }
        if (e==true){
            strcpy(t,s);
            snprintf(s,210,"%s%s",t,u);
        }
        e=false;
        l=0;
    }    
    
    
    
    printf("%s\n",s);
	return 0 ;
}

Measured memory_bytes: 128
n, m, q = map(int, input().split())

sequence = [1 for i in range(n)]

quartet = []
for i in range(q):
    quartet.append(list(map(int, input().split())))

score = 0
maximum = 0
while sum(sequence) <= n*m:
    for quar in quartet:
        if sequence[quar[1]-1] - sequence[quar[0]-1] == quar[2]:
            score += quar[3]
    
    if maximum < score:
        maximum = score
    
    score = 0
    
    if m in sequence:
        t = sequence.index(m)
        sequence[t-1] += 1
        for i in range(t, n):
            sequence[i] = sequence[t-1]
    else:
        sequence[-1] += 1

print(maximum)


Measured memory_bytes: 9156
n = int(input())
P = list(map(float, input().split()))

memo = [[0] * (2 * n + 1) for _ in range(n+1)]
memo[0][n] = 1
for i in range(1, n+1):
    p = P[i-1]
    for j in range(2 * n + 1):
        if j == 0:
            memo[i][j] = (1-p) * memo[i-1][j+1]
        elif j == 2 * n:
            memo[i][j] = p * memo[i-1][j-1]
        else:
            memo[i][j] = p * memo[i-1][j-1] + (1-p) * memo[i-1][j+1]
ans = 0
for i in range(n+1, 2*n + 1):
    ans += memo[-1][i]
print(ans)

Measured memory_bytes: 317292
#include<iostream>
using namespace std;
const int N=2e5+10;
int n,k;
int a[N];
int main(){
	cin>>n>>k;
	for(int i=0;i<n;i++) cin>>a[i];
	long long ans=0,sum=0;
	for(int i=0;i<k;i++) sum+=a[i];
	ans=sum;
	for(int i=k;i<n;i++){
		sum+=a[i]-a[i-k];
		ans=max(sum,ans);
	}
	printf("%.6lf",(double)(ans+k)/2);
	return 0;
}


Measured memory_bytes: 1024
const t={input:require('fs').readFileSync('/dev/stdin','utf8').split(/[\s]/),n:(arg:number=0):any=>{if(arg){const a=[];for(let i=0;i<arg;i++){a.push(t.n())}return a}else{const a=t.input[0];t.input.shift();return Number(a)}},s:(arg:number=0):any=>{if(arg){const a=[];for(let i=0;i<arg;i++){a.push(t.s())}return a}else{const a=t.input[0];t.input.shift();return String(a)}},c:(arg:number=0):any=>{if(arg){const a=[];for(let i=0;i<arg;i++){a.push(t.c())}return a}else{let a=t.input[0].split('');const b=a[0];a.shift();if(a.length>0){t.input[0]=a.join('')}else{t.input.shift()}return String(b)}},o:(...arg)=>{console.log(...arg)},abs:(a)=>{return Math.abs(a)},min:(...a)=>{return Math.min(...a)},max:(...a)=>{return Math.max(...a)},floor:(a)=>{return Math.floor(a)},asc:(ar:number[])=>{return ar.sort((a,b)=>{return a-b})},desc:(ar:number[])=>{return ar.sort((a,b)=>{return b-a})},sw:(a,arr:any[],op:'=='|'>='|'>'|'<='|'<'='==')=>{for(let i=0;i<arr.length;i+=2){if(eval(a+op+arr[i]))return arr[i+1];}return arr[arr.length-1]}};
const main=()=>{
  let s=t.s()
  let yymm=false
  let mmyy=false
  yymm=Number(s[2]+s[3])<=12&&Number(s[2]+s[3])>0?true:false
  mmyy=Number(s[0]+s[1])<=12&&Number(s[0]+s[1])>0?true:false
  yymm&&mmyy?t.o('AMBIGUOUS'):yymm?t.o('YYMM'):mmyy?t.o('MMYY'):t.o('NA')
}
main()

Measured memory_bytes: 7372
#include<iostream>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
int main(){
	int a[4], b[4];
	while( cin >> a[0] ){
		rep(i,3) cin >> a[i+1];
		rep(i,4) cin >> b[i];
		int hit=0,blow=0;
		rep(i,4) if( a[i] == b[i] ) hit++;
		rep(i,4) rep(j,4) if(i!=j&&a[i]==b[j]) blow++;
		cout << hit << " " << blow << endl;
	}
	return 0;
}

Measured memory_bytes: 0
#include<iostream>
#include<algorithm>
using namespace std;
#define int long long int
int solve(int mat[][3],int n,int m,int val1,int val2,int val3)
{
	int mat2[n][3];
	int i,j;
	for(i=0;i<n;i++)
	{
		for(j=0;j<3;j++)
		{
			mat2[i][j]=mat[i][j];
		}
	}
	for(i=0;i<n;i++)
	{
		for(j=0;j<3;j++)
		{
			if(j==0)
			{
				mat2[i][j]*=val1;
			}
			if(j==1)
			{
				mat2[i][j]*=val2;
			}
			if(j==2)
			{
				mat2[i][j]*=val3;
			}
		}
	}
	int arr[n];
	for(j=0;j<n;j++)
	{
		arr[j]=mat2[j][0]+mat2[j][1]+mat2[j][2];
		//arr[j]=abs(arr[j]);
	}
	sort(arr,arr+n);
	int answer=0;
	for(j=n-1;j>=n-m;j--)
	   answer+=arr[j];
	return answer;
}
int32_t main()
{
	int n;
	cin>>n;
	int m;
	cin>>m;
	int i,j;
	int mat[n][3];
	for(i=0;i<n;i++)
	{
		for(j=0;j<3;j++)
		{
			cin>>mat[i][j];
		}
	}
	int k;
	int answer=-100000000000000000;
	for(i=-1;i<=1;i+=2)
	{
		for(j=-1;j<=1;j+=2)
		{
			for(k=-1;k<=1;k+=2)
			{
				int val=solve(mat,n,m,i,j,k);
				answer=max(answer,val);
			}
		}
	}
	cout<<answer<<endl;
}


Measured memory_bytes: 3696
n,m = map(int, input().split())
tree = [[] for _ in range(n+1)]
for _ in range(m):
    a,b = map(int, input().split())
    tree[a].append(b)
    tree[b].append(a)

def search(now, hist,cnt):
    for i in tree[now]:
        if i in hist:
            pass
        else:
            cnt = search(i, hist+[i],cnt)
    if len(hist)==n: #found
        return cnt + 1
    else: #not found
        return cnt
print(search(1,[1],0))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for (int i = a; i < (int) (b); i++)
#define REP(i, n)    for (int i = 0; i < (int) (n); i++)
#define REP1(i, n)   for (int i = 1; i <= (int) (n); i++)
#define all(x)       (x).begin(), (x).end()
#define SZ(x)        ((int) (x).size())
using ll = long long;

int main() {
  int n;
  cin >> n;
  vector <ll> a(n);
  REP(i, n) {
	cin >> a[i];
  }
  sort(all(a), greater <ll>());
  ll ans = 0;
  REP(i, n - 1) {
	ans += a[(i + 1) / 2];
  }
  cout << ans << endl;
  return 0;
}


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

int main(){
    int N;
    cin >> N;
    vector<long long int> H(N);
    for (int i=0; i < N; i++){
        cin >> H.at(i);
    }
    int max_count = 0;
    int count = 0;
    for (int i = 0; i < N-1; i++){


        if (H.at(i) >= H.at(i+1)){
            count++;
            if (count >= max_count){
                max_count = count;
            }
        }else{
            count = 0;
            if (count >= max_count){
                max_count = count;
            }
        }

    }
    cout << max_count << endl;
}

Measured memory_bytes: 1024
from collections import defaultdict

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

dic = defaultdict(int)
for _ in range(n):
  k,*a=list(map(int,input().split()))
  for a_ in a:
    dic[a_]+=1

cnt=0
for v in dic.values():
  if v == n:
    cnt+=1
print(cnt)

Measured memory_bytes: 3316
nn = list(map(int, list(input())))
L = len(nn)
K = int(input())

dp = [[[0] * (4) for _ in range(2)] for __ in range(L + 1)]


dp[0][0][0] = 1


for i, n in enumerate(nn):
    for x in range(0, 10):
        if x == 0:
            dp[i + 1][1][0] += dp[i][1][0]
            dp[i + 1][1][1] += dp[i][1][1]
            dp[i + 1][1][2] += dp[i][1][2]
            dp[i + 1][1][3] += dp[i][1][3]
        else:
            dp[i + 1][1][1] += dp[i][1][0]
            dp[i + 1][1][2] += dp[i][1][1]
            dp[i + 1][1][3] += dp[i][1][2]

    for x in range(0, n + 1):
        if x == 0:
            dp[i + 1][0 if x == n else 1][0] += dp[i][0][0]
            dp[i + 1][0 if x == n else 1][1] += dp[i][0][1]
            dp[i + 1][0 if x == n else 1][2] += dp[i][0][2]
            dp[i + 1][0 if x == n else 1][3] += dp[i][0][3]
        else:
            dp[i + 1][0 if x == n else 1][1] += dp[i][0][0]
            dp[i + 1][0 if x == n else 1][2] += dp[i][0][1]
            dp[i + 1][0 if x == n else 1][3] += dp[i][0][2]


print(dp[-1][0][K] + dp[-1][1][K])


Measured memory_bytes: 3192
#include <iostream>
#include <stack>
 
using namespace std;
 
int main(){
  int d;
  while(cin >> d){
    int s = 0,n=1;
    while((d*n)<=600-d){
      s += (d*n)*(d*n)*d;
      n++;
    }
    cout << s << endl;
  }
  return 0;
}

Measured memory_bytes: 1160
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    from collections import defaultdict
    from itertools import combinations, permutations, accumulate, groupby, product
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    import math
    #from math import gcd

    #inf = 10**17
    #mod = 10**9 + 7

    d = defaultdict(int)
    res = 0
    n = int(input())
    a = list(map(int, input().split()))
    for i in range(n-1, -1, -1):
        res += d[i+a[i]]
        d[i-a[i]] += 1
    print(res)

if __name__ == '__main__':
    main()

Measured memory_bytes: 126000
#include <iostream>
#include <cmath>
#include <vector>
using namespace std;

void calcStep(long long int *ans,
                long long int *sum,
                long long int *preb)
{
    if(0 <= *sum && 0 < *preb)
    {
        *ans += abs(*sum) + 1;
        *sum = -1;
    }
    else if(*sum <= 0 && *preb < 0)
    {
        *ans += abs(*sum) + 1;
        *sum = 1;
    }
}

int main()
{
    int n;
    int t;
    vector<int> v;
    long long int sum = 0;
    long long int preb = 0;
    long long int ans = -1;
    long long int tAns = 0;

    cin >> n;
    for(int i = 0; i < n; ++i)
    {
        cin >> t;
        v.push_back(t);
    }
    for (int pt = 0; pt < 2; ++pt)
    {
        preb = pt == 0 ? -1 : 1;  
        for (int i = 0; i < n; ++i)
        {
            sum += v.at(i);
            calcStep(&tAns, &sum, &preb);
            preb = sum;
            //cout << tAns << " " << sum << " " << preb << endl;
        }
        if(ans < 0 || (ans >= 0 && ans > tAns))
        {
            ans = tAns;
        }
        tAns = 0;
        sum = 0;
    }
    cout << ans << endl;
}

Measured memory_bytes: 892
a = input()
a = a.split()
b = int(a[1])
c = int(a[2])
d = int(a[3])
a = int(a[0])
e = a / d
f = c / b
if int(e) < e:
    e = int(e + 1)
if int(f) < f:
    f = int(f + 1)
if e >= f:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 9200
#include <bits/stdc++.h>
#define MAXN 100010
#define pii pair<int,int>
#define ff first
#define ss second
#define ll long long
#define in_range(x, y, n) (x >= 0 and x<n and y >=0 and y<n)
using namespace std;
const int mod = 1e9 + 7;

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

    int diva = a/d, divb = c/b;
    if (a%d != 0) diva++;
    if (c%b != 0) divb++;

    if (diva >= divb){
        cout << "Yes" << endl;
    }
    else {
        cout << "No" <<endl;
    }
    return 0;
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define print(s) cout << s << endl
#define acc(v) accumulate(v.begin(), v.end(), 0)
#define cinv(n,v) rep(i,n) cin >> v[i]
using namespace std;
const int INF = 1e9;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vint;
typedef vector<string> vstr;
typedef vector<char> vchar;
const ll LINF = 1e18;
const ll MOD = 1e9 + 7;
// const lint MOD = 998244353;
int x_pos[4] = {1,0,-1,0}, y_pos[4] = {0,1,0,-1};
int ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}

char upper(char c){
	return c-0x20;
}

char lower(char c){
	return c+0x20;
}

void unique_vector(vector<int>& v){
	sort(all(v));
	v.erase(unique(all(v)), v.end());
}

// n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

ll dp[110][10];

int main() {
    int h,w,k;cin>>h>>w>>k;
    Fill(dp,0);
    dp[0][0]=1;
    for(int i = 0;i<h;i++){
        for(int j = 0; j < w; j++){
            for(int p = 0; p < 1 << (w-1); p++){
                bool can = true;
				for (int l = 0; l < w-2; l++) {
					if (((p >> l) & 1) && ((p >> (l + 1)) & 1)) {
						can = false;
					}
				}
                if(can){
                    if (j >= 1 && ((p >> (j - 1)) & 1)) {
						dp[i+1][j-1] += dp[i][j];
						dp[i+1][j-1] %= MOD;
					}
					else if (j <= w-2 && ((p >> j) & 1)) {
						dp[i+1][j+1] += dp[i][j];
						dp[i+1][j+1] %= MOD;
					}
					else {
						dp[i+1][j] += dp[i][j];
						dp[i+1][j] %= MOD;
					}
                }
            }
        }
    }
    cout << dp[h][k-1] << endl;
}



Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<utility>
#include<set>
#include<stack>
#include<queue>
#include<deque>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<bitset>
#include<sstream>
#include<list>
#include<climits>

using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define nrep(i,i0,n) for(int i=(i0);i<(int)(n);++i)
typedef vector<int> vi; typedef pair<int,int> pii; typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vii;
typedef long long ll;


int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n,t;cin>>n>>t;
	int ret=0;int cur=0;
	rep(i,n){
		int a;cin>>a;
		if(a<cur)ret+=(t-(cur-a));
		else ret+=t;
		cur=a+t;
	}
	cout<<ret<<endl;
	return 0;
}



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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef complex<double> Point;

#define PI acos(-1.0)
#define EPS 1e-10
const ll INF = 1e16;
const ll MOD = 1e9 + 7;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,N) for(int i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )
#define fi first
#define se second
#define N_SIZE (1LL << 20)
#define NIL -1

ll mod_add(ll a, ll b) { return (a + b) % MOD; }
ll mod_sub(ll a, ll b) { return (a - b + MOD) % MOD; }
ll mod_mul(ll a, ll b) { return a*b % MOD; }

string s;
ll dp[200001][2];

int main(){
    cin >> s;
    dp[0][1] = 1;
    rep(i,s.size()){
        if(s[i] == '1'){
            ll num = dp[i][1] * 2;
            num %= MOD;
            dp[i+1][1] += num;
            dp[i+1][1] %= MOD;
            dp[i+1][0] = dp[i][1] % MOD;
        }
        else if(s[i] == '0'){
            dp[i+1][1] = dp[i][1] % MOD;
        }
        ll num = dp[i][0] * 3;
        num %= MOD;
        dp[i+1][0] += num;
        dp[i+1][0] %= MOD;
    }
    // rep(i,s.size()+1){
    //     cout << dp[i][0] << " " << dp[i][1] << endl;
    // }
    cout << (dp[s.size()][0] + dp[s.size()][1])%MOD << endl;
}

Measured memory_bytes: 2048
#include<iostream>
#include<string>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
using namespace std;

bool asnake(string s){
	int n=s.size();
	if(n%2 || n<6)return false;
	string com=">\'";
	rep(i,(n-4)/2)com+='=';
	com+='#';
	rep(i,(n-4)/2)com+='=';
	com+='~';
	if(s==com)return true;
	else return false;
}

bool bsnake(string s){
	int n=s.size();
	if(n%2 || n<6)return false;
	string com=">^";
	rep(i,(n-4)/2)com+="Q=";
	com+="~~";
	if(s==com)return true;
	else return false;
}

int main(){
	int n;
	cin>>n;
	rep(p,n){
		string s;
		cin>>s;
		if(asnake(s))cout<<"A"<<endl;
		else if(bsnake(s))cout<<"B"<<endl;
		else cout<<"NA"<<endl;
	}
	return 0;
}

Measured memory_bytes: 1216
// https://atcoder.jp/contests/dp/tasks/dp_l

#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define endl "\n"
#define fastio ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define mod 1000000007
#define gcd __gcd
#define inf INT_MAX
#define INF LLONG_MAX
#define minf INT_MIN
#define MINF LLONG_MIN
#define pb push_back
#define all(v) v.begin(),v.end()
#define print(v) for(auto x:v) cout<<x<<" "; cout<<"\n";
#define printn(v) for(auto x:v) cout<<x<<"\n";
#define F first
#define S second
#define mp make_pair

//dp(i,j) : no. of ways to distribute j candies to first i child
//dp(n,k) : dp(n-1,k) + dp(n-1,k-1) + dp(n-1,k-2) + ..... + dp(n-1,k-min(An,k))
//Base Case : dp(1,j) is 1 if j<=A1, and 0 if j> A1
ll dp[101][100001];
vector<int>v;

ll candies(vector<int>&v, int n, int k) {
	for (int j = 0; j <= k; j++) dp[1][j] = (j > v[1] ? 0 : 1);
	for (int i = 2; i <= n; i++) {
		for (int j = 0; j <= k; j++) {
			if (j == 0) dp[i][j] = dp[i - 1][j];
			else dp[i][j] = (dp[i][j - 1] + dp[i - 1][j] - ((j - v[i] - 1 >= 0) ? dp[i - 1][j - 1 - v[i]] : 0) + mod) % mod;
		}
	}
	return dp[n][k];
}

int32_t main() {
	fastio;
	int n, k;
	cin >> n >> k;
	v.resize(n + 1);
	for (int i = 1; i <= n; i++) cin >> v[i];
	cout << candies(v, n, k) << endl;
}

Measured memory_bytes: 81784
#include<bits/stdc++.h>
using namespace std;
#define MN 200005
char ch[MN];
int f[MN][2];
int main(){
	scanf("%s",ch+1);
	int ln=strlen(ch+1);
	f[1][0]=1;
	for(int i=2;i<=ln;++i){
		f[i][0]=f[i-1][1]+1;
		f[i][1]=f[i-2][0]+1;
		if(ch[i]!=ch[i-1])f[i][0]=max(f[i][0],f[i-1][0]+1);
		if(i>2&&ch[i-1]!=ch[i-3]&&ch[i]!=ch[i-2])f[i][1]=max(f[i][1],f[i-2][1]+1);
	//	cout<<"HI "<<i<<" "<<f[i][0]<<" "<<f[i][1]<<endl;
	}
	printf("%d",max(f[ln][0],f[ln][1]));
	return 0;
} 


Measured memory_bytes: 2048
#line 2 "codes/header.hpp"

//%snippet.set('header')%
//%snippet.fold()%
#ifndef HEADER_H
#define HEADER_H

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

// varibable settings
const long long INF = 1e18;
template <class T> constexpr T inf = numeric_limits<T>::max() / 2.1;

#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (ll i = (ll)(a); i < (ll)(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define _rrep(i, n) rrepi(i, 0, n)
#define rrepi(i, a, b) for (ll i = (ll)((b)-1); i >= (ll)(a); --i)
#define r_rep(...) _overload3(__VA_ARGS__, rrepi, _rrep, )(__VA_ARGS__)
#define each(i, a) for (auto &&i : a)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
#define mt(...) make_tuple(__VA_ARGS__)
#define ub upper_bound
#define lb lower_bound
#define lpos(A, x) (lower_bound(all(A), x) - A.begin())
#define upos(A, x) (upper_bound(all(A), x) - A.begin())
template <class T> inline void chmax(T &a, const T &b) { if ((a) < (b)) (a) = (b); }
template <class T> inline void chmin(T &a, const T &b) { if ((a) > (b)) (a) = (b); }
template <typename X, typename T> auto make_table(X x, T a) { return vector<T>(x, a); }
template <typename X, typename Y, typename Z, typename... Zs> auto make_table(X x, Y y, Z z, Zs... zs) { auto cont = make_table(y, z, zs...); return vector<decltype(cont)>(x, cont); }

#define cdiv(a, b) (((a) + (b)-1) / (b))
#define is_in(x, a, b) ((a) <= (x) && (x) < (b))
#define uni(x) sort(all(x)); x.erase(unique(all(x)), x.end())
#define slice(l, r) substr(l, r - l)

typedef long long ll;
typedef long double ld;
using vl = vector<ll>;
using vvl = vector<vl>;
using pll = pair<ll, ll>;

template <typename T>
using PQ = priority_queue<T, vector<T>, greater<T>>;
void check_input() { assert(cin.eof() == 0); int tmp; cin >> tmp; assert(cin.eof() == 1); }

#if defined(PCM) || defined(LOCAL)
#else
#define dump(...) ;
#define dump_1d(...) ;
#define dump_2d(...) ;
#define cerrendl ;
#endif

#endif /* HEADER_H */
//%snippet.end()%
#line 2 "codes/solve.cpp"
template<class T=ll> using vec = vector<T>;
struct Fast { Fast() { std::cin.tie(0); ios::sync_with_stdio(false); } } fast;


int solve() {
    ll n;cin>>n;

    int k = 1;
    ll mul = 26;
    ll sum = 26;
    while(sum < n){
        mul *= 26;
        sum += mul;
        k++;
    }
    dump(k);

    sum -= mul;
    mul /= 26;

    n -= sum;

    string ans(k, '?');

    rep(i, k){
        char c = 'a';
        while (mul < n) {
            n -= mul;
            c++;
        }
        ans[i] = c;
        mul /= 26;
    }
    cout << ans << endl;

    return 0; 
}


int main(){/*{{{*/
    solve();
    check_input();
    return 0;
}/*}}}*/


Measured memory_bytes: 3600
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <queue>
#include <cmath>
#include <set>
#include <memory.h>

using namespace std;

typedef long long ll;

const int MAX_V = 2*100+2;
const int INF = 2;

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

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, (int)G[to].size()});
  G[to].push_back((edge){from, 0, (int)G[from].size() - 1});
}

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;
}

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

int main(){
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  int N; cin >> N;
  int x[2*N+1], y[2*N+1];
  for(int i=1;i<=2*N;i++){
    cin >> x[i] >> y[i];
  }
  for(int i=1;i<=N;i++){
    for(int j=N+1;j<=2*N;j++){
      if(x[i] < x[j] && y[i] < y[j]){
        add_edge(i, j, 1);
      }
    }
  }
  // s=0, t=2*N+1
  for(int i=1;i<=N;i++){
    add_edge(0, i, 1);
  }
  for(int j=N+1;j<=2*N;j++){
    add_edge(j, 2*N+1, 1);
  }
  
  cout << max_flow(0, 2*N+1) << endl;
}

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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

ll N;

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>N;
	for(ll A=1;A<=3500;A++) {
		for(ll B=A;B<=3500;B++) {
			ll P=4*A*B-(N*A+N*B);
			ll Q=N*A*B;
			if(P<=0) continue;
			if(Q%P) continue;
			cout<<A<<" "<<B<<" "<<Q/P<<endl;
			return;
		}
	}
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


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

int main(){
    char ch;
    
    while(1){
        scanf("%c", &ch);
        if ( isalpha(ch) ){
            if ( islower(ch) ) printf("%c", toupper(ch) );
        else printf("%c", tolower(ch) );
    }else printf("%c", ch);

    if ( ch == '\n') break;
}

return 0;
}

Measured memory_bytes: 2552
import java.util.*;
import java.util.PriorityQueue;

class Main{
  public static void main(String[] args){
    Scanner scan=new Scanner(System.in);
    int num=scan.nextInt();
    boolean flag=true;
    PriorityQueue in=new PriorityQueue();
    for(int x=0; x<num; x++){
      int input=scan.nextInt();
      in.offer(input);
    }
    int before=(int)in.poll();
    int after;
    for(int x=1; x<num; x++){
      after=(int)in.poll();
      if(before==after){
        flag=false;
        break;
      }else{
        before=after;
      }
    }
    if(flag){
      System.out.println("YES");
    }else{
      System.out.println("NO");
    }
  }
}

Measured memory_bytes: 96268
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<tuple>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define Per(i,sta,n) for(int i=n-1;i>=sta;i--)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;


struct F2_mat{
    vector<ll> mat;
    F2_mat(vector<ll> mat):mat(mat){}

    void Gauss(){
        int n=mat.size(),pos=0;
        for(int i=63;i>=0;i--){
            ll k=(1ll << i);
            for(int j=pos;j<n;j++){
                //cout << bitset<5>(mat[j]) << endl;
                if (mat[j]&k) {
                    //cout << j << " " << pos << endl;
                    swap(mat[j],mat[pos]);
                    for(int l=0;l<n;l++){
                        //cout << l << endl;
                        //cout << bitset<60>(mat[l]) << endl;
                        if (l==pos) continue;
                        if (mat[l]&k) mat[l]^=mat[pos];
                    }
                    pos++;
                    break;
                }
            }
        }
    }
};

int n;
ll S;
vector<ll> a;

void solve(){
    cin >> n;
    rep(i,n){
        ll a_;
        cin >> a_;
        S^=a_;
        a.push_back(a_);
    }
    //cout << bitset<60>(S) << endl;
    ll ans=0;
    per(k,64){
        ll m=(1ll << k);
        if (S&m){
            rep(i,n){
                if (a[i]&m)a[i]^=m;
            }
        }
    }
    F2_mat MAT(a);
    MAT.Gauss();
    ll M=0;
    rep(i,n){
        //cout << bitset<60>(MAT.mat[i]) << endl;
        M^=MAT.mat[i];
    }
    cout << 2*M+S << endl;
}

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

Measured memory_bytes: 2804
#include<iostream>
#include<queue>
#include<string>
#include<cmath>
#include<cstdio>
#include<cctype>
#include<cstring>
#include<iomanip>
#include<cstdlib>
#include<ctime>
#include<set>
#include<map>
#include<utility>
#include<vector>
#include<stack>
#include<sstream>
#include<algorithm>
/****************************/
#define ll long long
#define vi vector<int>
#define pii pair<int,int>
#define vpii vector<pair<int,int> >
#define qi queue<int>
#define mii map<int,int>
#define msi map<string,int>
#define vs vector<string>
#define vc vector<char>
/****************************/
#define rep(i,n) for(ll i=0;i<(n);i++)
#define rep2(i,n) for(ll i=(n)-1;i>=0;i--)
#define rep3(i,a,n) for(ll i=(a);i<(n);i++)
#define mp make_pair
#define pb push_back
#define st first
#define nd second
#define pi 3.1415926535897932384626433832795
#define zero(n) memset(n,0,sizeof(n));
#define SZ(n) n.size()
#define ss st.st
#define sn st.nd 
/****************************/
using namespace std;
ll ans=0;
void add(string s)
{
	ll now=0;
	rep(i,SZ(s))
	{
		if(s[i]>='0'&&s[i]<='9')
		{
			now*=10;
			now+=s[i]-'0';
			if(i==s.size()-1)
			{
				ans+=now;
			}
		}
		else
		{
			ans+=now;
			now=0;
		}
	}
}
void dfs(int now,string s)
{
	if(now==SZ(s))
	{
		//cout<<s<<endl;
		add(s);
		return;
	}
	dfs(now+1,s);
	string t=s.substr(0,now);
	if(t[t.size()-1]=='+') return;
	t+='+';
	t+=s.substr(now,s.size()-now);
	//cout<<t<<"@@@@"<<endl;
	dfs(now+1,t);
}
int main()
{
	ios::sync_with_stdio(0);
	string s;
	cin>>s;
	dfs(1,s);
	cout<<ans;
	return 0;
}


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

#define rep(i, n) for(int i=0; i < n; i++)
#define REP(i, n, m) for(int i=n; i < m; i++)
#define reps(i, n) for(int i=1; i <= n; i++)
#define ALL(v) v.begin(), v.end()
#define rALL(v) v.rbegin(), v.rend()
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)

using namespace std;
using ll=long long;

const ll INF = 1LL << 60;

ll mod=1000000007;

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;}

int main() {
  int x,n;cin>>x>>n;
  if(n==0){cout<<x;return 0;}
  int ans=1000;
  vector<int> p(n);
  int ans1;
  rep(i,n)cin>>p[i];
  sort(ALL(p));
  for(int i=-200;i<300;i++){
    if(binary_search(ALL(p),i))continue;
    int ab=abs(x-i);
    if(ab<ans){ans=ab;ans1=i;}
    else {cout<<ans1;return 0;}
  }
}

Measured memory_bytes: 3628
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
using ll = long long;
int main() {
  int n;
  cin >> n;
  vector<int> a(n), b(n);
  for(int i = 0; i < n; i++) {
    cin >> a[i];
    b[i] = -a[i];
  }
  sort(a.begin(), a.end());
  sort(b.begin(), b.end());
  if(a[n - 1] % 2 == 0) {
    int t = a[n - 1] / 2;
    int num = 1001001001;
    int idx = 0;
    for(int i = 0; i < n; i++) {
      if(num > abs(a[i] - t)) {
        num = abs(a[i] - t);
        idx = i;
      }
    }
    cout << a[n - 1] << " " << a[idx] << endl;
  } else {
    int t1 = a[n - 1] / 2, t2 = (a[n - 1] + 1) / 2;
    int num = 1001001001;
    int idx = 0;
    for(int i = 0; i < n; i++) {
      if(num > abs(a[i] - t1)) {
        num = abs(a[i] - t1);
        idx = i;
      }
      if(num > abs(a[i] - t2)) {
        num = abs(a[i] - t2);
        idx = i;
      }
    }
    cout << a[n - 1] << " " << a[idx] << endl;
  }
  return 0;
}

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

int main(){
	int H, W;
	while(1){
		cin >> H >> W;
		if (H == 0 && W == 0)
			break;
		else {
			for (int i = 0; i < H; ++i) {
				int cnt = 0;
				for (int j = 0; j < W; ++j) {
					if ((i+cnt)%2==0)
						cout << '#';
					else
						cout << '.';
					++cnt;
				}
				cout << endl;
			}
		}
		cout << endl;
	}
	return 0;
}



Measured memory_bytes: 3080
#include<stdio.h>

int main(void)

{ 

 int a,b,c,x,y,z;

 

 scanf("%d%d%d",&a,&b,&c);





 if(a > b){
 

 x = a;


 a = b;


 b = x;


}


 if(b > c){


 y = b;


 b = c;


 c = y;


}


 if(a > b){


 z = a;


 a = b;


 b = z;


}





 printf("%d %d %d\n",a,b,c);





 return 0;


}

Measured memory_bytes: 596
#include<iostream>
#include<algorithm>
#include<vector>
#include<numeric>
#include<string>
#include<cmath>
#include<set>
#include<queue>
#include<deque>
#include<bitset>
#include<iomanip>
#include<cctype>
#include<map>
#include<cstring>

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep2(i,a,b) for (int (i)=a;(i)<(b);(i)++)
#define all(x) (x).begin(),(x).end()

using namespace std;
using ll = long long int;

const int inf = 1001001000;
const long long int Inf = 1001001001001001000;


void print(vector<vector<int>> a){
	for (int i = 0; i < a.size(); i++)
	{
		for (int j=0;j<a[i].size();j++){
			cout << a[i][j] << " ";
		}
		cout << endl;
	}
}

void print(vector<vector<long long int>> a){
	for (int i=0;i<a.size();i++){
		for (int j=0;j<a[i].size();j++){
			cout << a[i][j] << " ";
		}
		cout << endl;
	}
}

void print(vector<int> a){
    int n = a.size();
    for (int j=0;j<n;j++) {
        if (j != n-1) cout << a[j] << " ";
        else cout << a[j] << endl;
    }
}

void print(set<int> a){
	for (auto x:a)
		cout << x << " ";
	cout << endl;
}


int main() {
	long long int n;
	cin >> n;
	long long int ans = 0;
	rep2(i, 1, n + 1)
	{
		if(i%3==0||i%5==0)
			continue;
		ans += i;
	}
	cout << ans << endl;
	return 0;
}

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

int main(){
  int n, tmp;
  vector<int> p;
  cin >> n;
  for(int i = 0; i < n; i++){
    cin >> tmp;
    p.push_back(tmp);
  }
  int max = *max_element(p.begin(), p.end());
  int sum = accumulate(p.begin(), p.end(), 0);
  cout << sum - max/2 << endl;
  return 0;
}


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

const long Day_num = 365;
const long type_num = 26;

class Scoring {
public:
    Scoring(const long arg_days, const std::vector<long>& arg_costs, const std::vector<std::vector<long>>& arg_incentives);
    std::vector<long> score(const std::vector<long>& arg_types);
private:
    long days;
    std::vector<long> costs;
    std::vector<std::vector<long>> incentives;
};

std::vector<long> Scoring::score(const std::vector<long>& arg_types) {
    std::vector<long> result(days);
    long satisfy = 0;
    std::vector<long> last_days(type_num, 0);


    for (long day = 1; day <= days; ++day) {
        const auto exe_type = arg_types[day-1];
        satisfy += incentives[day-1][exe_type-1];
        last_days[exe_type-1] = day;
        for (long type = 1; type <= type_num; ++type) {
            satisfy -= costs[type-1] * (day - last_days[type-1]);
        }
        result[day-1] = satisfy;
    }
    return result;
}

Scoring::Scoring(const long arg_days, const std::vector<long>& arg_costs, const std::vector<std::vector<long>>& arg_incentives) {
    days = arg_days;
    costs = arg_costs;
    incentives = arg_incentives;
}

int main() {
    clock_t start_clock = clock();
    std::mt19937 engine(20123123);
    std::uniform_int_distribution<> type_random(1, type_num);
    std::uniform_int_distribution<> day_random(1, Day_num);
    long D;
    std::cin >> D;
    std::vector<long> costs(type_num);
    for (long type = 1; type <= type_num; ++type) {
        std::cin >> costs[type-1];
    }
    std::vector<std::vector<long>> incentives(D, std::vector<long>(type_num));
    for (long day = 1; day <= D; ++day) {
        for (long type = 1; type <= type_num; ++type) {
            std::cin >> incentives[day-1][type-1];
        }
    }

    Scoring scoring(D, costs, incentives);

    std::vector<long> types(D);
    for (long day = 1; day <= D; ++day) {
        types[day-1] = type_random(engine);
    }

    while (static_cast<double>(clock() - start_clock)/CLOCKS_PER_SEC*1000.0 < 2000.0-20.0) {
        const auto old_types = types;
        types[day_random(engine)-1] = type_random(engine);
        if (scoring.score(old_types).back() > scoring.score(types).back()) {
            types = old_types;
        }
    }

    for (long day = 1; day <= D; ++day) {
        std::cout << types[day-1] << std::endl;
    }
    return 0;
}

Measured memory_bytes: 3852
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, N) for(int i = 0; i < N; i++)
#define rep2(i, N, a, b) for(int i = a; i < N; i += b)

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

	vector<string> S(N);
	rep(i, N) cin >> S.at(i);
	sort(S.begin(), S.end());
	rep(i, N) cout << S.at(i);
	cout << endl;
}

Measured memory_bytes: 256
for v in range(10000):
  x = 0
  n = input()
  n = int(n)
  if n == 0:
    break
  else:
    a = input().split()
    b = [int(s) for s in a]
    for i in range(n):
      x += b[i]
      i += 1
    y = x/n
    z = 0
    for j in range(n):
      if y >= b[j]:
        z+=1
        j += 1
      else:
        j+=1
  print(z)




Measured memory_bytes: 6616
import math

a, b, h, m = list(map(int, input().split()))

h += m / 60

rh = 2 * math.pi * h
rm = 1 / 6 * math.pi * h

print(math.sqrt((a * math.cos(rh) - b * math.cos(rm))
                ** 2 + (a * math.sin(rh) - b * math.sin(rm))**2))


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

int main() {
  char c;
  cin >> c;
  
  if (c == 'a' || c == 'i' || c == 'u' || c == 'e' || c == 'o') {
    cout << "vowel" << endl;
  }
  else { cout << "consonant" << endl; }
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
typedef long long ll;
string S;
vector<vector<int>> v(26);
int A[26] = {0},id[26] = {0};

ll merge_count(vector<ll> &a){
	int n = a.size();
	if(n<=1) return 0;
	ll cnt = 0;
	vector<ll> b(a.begin(),a.begin() + n/2);
	vector<ll> c(a.begin() + n/2, a.end());
	cnt += merge_count(b);
	cnt += merge_count(c);
	int ai = 0,bi = 0,ci = 0;
	while(ai<n){
		if(bi<b.size() && (ci == c.size() || b[bi] <= c[ci])){
			a[ai++] = b[bi++];
		}else{
			cnt += n/2 - bi;
			a[ai++] = c[ci++];
		}
	}
	return cnt;
}


int main(){
	cin >> S;
	string T = "";
	int N = S.size();
	for(int i=0;i<N;i++){
		int t = S[i]-'a';
		T = T + S[N-i-1];
		A[t]++;
		v[t].push_back(-1);
	}
	int count = 0;
	for(int i=0;i<26;i++){
		if(A[i]%2==1) count++;
	}
	if(count>=2){
		cout << -1 << endl;
		return 0;
	}
	vector<ll> L,R;
	int l = 0;
	for(int i=0;i<N;i++){
		int c = S[i]-'a';
		if(A[c]%2==1 && 2*id[c]+1==v[c].size()){
			L.push_back(N/2);
			id[c]++;
		}
		else{
			if(id[c]*2<v[c].size()){
				L.push_back(l);
				v[c][id[c]] = l;
				l++;
				id[c]++;
			}else{
				int t = v[c].size()-id[c]-1;
				L.push_back(N-v[c][t]-1);
				id[c]++;
			}
		}
	}
	l = 0;
	for(int i=0;i<26;i++) id[i] = 0;
	for(int i=0;i<N;i++){
		int c = T[i]-'a';
		if(A[c]%2==1&& 2*id[c]+1==v[c].size()){
			R.push_back(N/2);
			id[c]++;
		}
		else{
			if(id[c]*2<v[c].size()){
				R.push_back(l);
				v[c][id[c]] = l;
				l++;
				id[c]++;
			}else{
				int t = v[c].size()-id[c]-1;
				R.push_back(N-v[c][t]-1);
				id[c]++;
			}
		}
	}
	cout << min(merge_count(L),merge_count(R)) << endl;
}

Measured memory_bytes: 8024
#include <bits/stdc++.h>
#define all(a) a.begin(), a.end()
#define forn(i,n) for(int i = 0; i < (int) n; i++)
#define ios ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)

using namespace std;

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

  forn(i, s.size()) {
    if (s[i] == '?') cout << 'D';
    else cout << s[i];
  }
  cout << "\n";
}


Measured memory_bytes: 3720
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const int MOD = 1e9+7;

int main(){
  
  ll n; cin>>n;
  string ans;
  while(1){
    ans += (char)('a'-1+n%26);
    n/=26;
    if(n==0) break;
  }
  for(int i=0; i+1<ans.size(); i++){
    if(ans.at(i)<'a') {
      ans.at(i+1)--; 
      ans.at(i) += 26;
    }
  }
  if(ans.back()=='`'){
    ans.pop_back();
  }
  reverse(ans.begin(),ans.end());
  cout << ans << endl;
  
}


Measured memory_bytes: 3632
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashSet;

class Main {
	public static void main(String args[]) throws IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		Solver solver = new Solver();
		solver.init();
		solver.readHead(in.readLine());
		// for (; solver.hasNext();) {
		// solver.readBody(in.readLine());
		// }
		// solver.solve();
	}
}

class Solver {
	int N;
	int cnt;

	public void init() {
		N = 0;
		cnt = 0;
	}

	public void readHead(String str) {
		String[] strArr = str.split("\\s+");
		// N = Integer.parseInt(strArr[0]);
		// System.out.println(N);
		long A = Long.parseLong(strArr[0]);
		long B = Long.parseLong(strArr[1]);
		long a = A;
		long alimit = (long) Math.ceil(Math.sqrt(B));
		HashSet<Long> ap = new HashSet<Long>();
		for (long d = 2; a > 1;) {
			if (a % d == 0) {
				a = a / d;
				ap.add(d);
			} else
				d++;
			if (d >= alimit) {
				ap.add(a);
				break;
			}
		}
		long b = B;
		long blimit = (long) Math.ceil(Math.sqrt(B));
		HashSet<Long> bp = new HashSet<Long>();
		for (long d = 2; b > 1;) {
			if (b % d == 0) {
				b = b / d;
				bp.add(d);
			} else
				d++;
			if (d >= blimit) {
				bp.add(b);
				break;
			}
		}

		// System.out.println(ap);
		// System.out.println(bp);
		int ans = 1;
		for (long n : ap) {
			if (bp.contains(n))
				ans++;
		}
		System.out.println(ans);
	}

	public boolean hasNext() {
		return cnt < N;
	}

	public void readBody(String str) {
		// System.out.println(str);
		cnt++;
	}

	public void solve() {

	}
}


Measured memory_bytes: 22228
#include<bits/stdc++.h>
using namespace std;
const long long MOD=1e9+7;

int main(){
  int n,m; cin>>n>>m;
  vector<bool>k(n+1,true);
  vector<long long int>dp(n+2);dp[0]=1;
  int a[m+1];
  for(int i=0;i<m;i++){
    cin>>a[i];
    k[a[i]]=false;
  }
  for(int i=0;i<n;i++){
    if(k[i]){
      dp[i+1]+=dp[i];
      dp[i+1]%=MOD;
      dp[i+2]+=dp[i];
      dp[i+2]%=MOD;

    }
  }
  cout<<dp[n]<<endl;
}


Measured memory_bytes: 1408