akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define int long long

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,int> plli;
typedef pair<int,pii> pipii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<pii> vpii;

#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)
#define rrep(i,n) for (int i=(n);i>0;i--)
#define rrep2(i,a,b) for (int i=(a);i>b;i--)
#define pb push_back
#define fi first
#define se second
#define all(a) (a).begin(),(a).end()

const ll mod = 1e9 + 7;
const ll INF = 1<<30;
const int dx4[4] = {1, 0, -1, 0};
const int dy4[4] = {0, 1, 0, -1};
const int dx8[8] = {1, 1, 1, 0, 0, -1, -1, -1};
const int dy8[8] = {0, 1, -1, 1, -1, 0, 1, -1};
const double pi = 3.141592653589793;

int n, m;

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    while (true) {
        cin >> n;
        if (n == 0) break;
        cin >> m;
        string s;
        cin >> s;
        bool check[m + 1] = {};
        int P[m + 1] = {};
        rep(i, m) {
            if (check[i]) continue;
            int cnt = 0;
            rep2(j, i, m) {
                if ((j - i) % 2 == 0) {
                    if (s[j] == 'I') {
                        cnt++;
                        check[j] = true;
                    }
                    else {
                        check[j] = true;
                        break;
                    }
                }
                else {
                    if (s[j] == 'O') {
                        cnt++;
                        check[j] = true;
                    }
                    else break;
                }
            }
            if (cnt < 3) continue;
            P[(cnt - 3) / 2 + 1]++;
        }
        int ans = 0;
        rep2(i, n, m) ans += (i - n + 1) * P[i];
        cout << ans << endl;
    }
}

Measured memory_bytes: 12576
#include <iostream>
using namespace std;
 
int xx[100], yy[100], hh[100];
 
int main()
{
    int n;
    cin >> n;
    for (int i = 0; i < 100; i++)
    {
        cin >> xx[i] >> yy[i] >> hh[i];
    }
    for (int i = 0; i <= 100; i++)
    {
        for (int j = 0; j <= 100; j++)
        {
            int h = -1;
            for (int k = 0; k < n; k++)
            {
                if (hh[k] != 0) 
                {
                    h = hh[k] + abs(xx[k] - i) + abs(yy[k] - j); break;
                }
            }
            if (h == -1) {h = 1;}
            bool b = true;
            for (int k = 0; k < n; k++)
            {
                if (hh[k] == 0)
                {
                    if (h > abs(xx[k] - i) + abs(yy[k] - j))
                    {
                        b = false;
                        break;
                    }
                }
                else if (h != hh[k] + abs(xx[k] - i) + abs(yy[k] - j))
                {
                    b = false;
                    break;
                }
            }
            if (b) {cout << i << " " << j << " " << h << endl; return 0;}
        }
    }
}

Measured memory_bytes: 256
#include<cstdio> 
#include<cstring> 
const int MAX_E=100005,MAX_V=1005,INF=1e7; 
struct edge{ 
    int to,cap,rev,next; 
}g[MAX_E]; 
int k=0,h[MAX_V],level[MAX_V],iter[MAX_V],head=0,tail=0,q[MAX_V],n,m,S,T;
char map[105][105]; 
void add(int u,int v,int cap){ 
    g[++k].next=h[u]; h[u]=k; 
    g[k].to=v; g[k].cap=cap; g[k].rev=k+1; 
    g[++k].next=h[v]; h[v]=k; 
    g[k].to=u; g[k].cap=0; g[k].rev=k-1; 
} 
void bfs(int s){ 
    head=tail=0; 
    q[tail++]=s; level[s]=1; 
    while(head!=tail){ 
        int u=q[head]; 
        for(int i=h[u];i;i=g[i].next){ 
            if(!level[g[i].to]&&g[i].cap){ 
                level[g[i].to]=level[u]+1; 
                q[tail++]=g[i].to; 
            } 
        } 
        head++; 
    } 
} 
int dfs(int u,int t,int f){ 
    if(u==t) return f; 
    for(int &i=iter[u];i;i=g[i].next){ 
        if(level[g[i].to]==level[u]+1&&g[i].cap){ 
            int d=dfs(g[i].to,t,f<g[i].cap?f:g[i].cap); 
            if(d){ 
                g[i].cap-=d; 
                g[g[i].rev].cap+=d; 
                return d; 
            } 
        } 
    } 
    return 0; 
} 
int max_flow(int s,int t){ 
    int flow=0; 
    for(;;){ 
        for(int i=1;i<=m+n*2;++i) iter[i]=h[i]; 
        memset(level,0,sizeof(level)); 
        bfs(s); 
        if(level[t]==0) return flow; 
        int d=dfs(s,t,INF); 
        while(d>0){ 
            flow+=d; 
            d=dfs(s,t,INF); 
        } 
    } 
} 
int main(){
	scanf("%d%d",&n,&m);
	S=n+m+1,T=n+m+2;
	for(int i=1;i<=n;++i) scanf("%s",map[i]+1);
    for(int i=1;i<=n;++i)
        for(int j=1;j<=m;++j){
            if(map[i][j]!='.') add(i,j+n,1),add(j+n,i,1);
            if(map[i][j]=='S') add(S,i,INF),add(S,j+n,INF);
            else if(map[i][j]=='T') add(i,T,INF),add(j+n,T,INF);
        }
    int ans=max_flow(S,T);
    if(ans>=INF) puts("-1");
    else printf("%d\n",ans);
}

Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#ifdef tabr
#include "library/debug.cpp"
#else
#define debug(...)
#endif

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int get_rand(int a, int b) {  // [a, b]
    return uniform_int_distribution<int>(a, b)(rng);
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int d, n = 26;
    cin >> d;
    vector<int> c(n);
    vector<vector<int>> s(d, vector<int>(n));
    for (int i = 0; i < n; i++) {
        cin >> c[i];
    }
    for (int i = 0; i < d; i++) {
        for (int j = 0; j < n; j++) {
            cin >> s[i][j];
        }
    }

    vector<int> t(d, -1);
    vector<int> last(n, -1);
    int res = 0;
    for (int i = 0; i < d; i++) {
        int z = -2e9;
        for (int k = 0; k < n; k++) {
            int y = 0;
            for (int j = 0; j < n; j++) {
                if (j == k) {
                    y += s[i][j];
                } else {
                    y -= (i - last[j]) * c[j];
                }
            }
            if (y > z) {
                z = y;
                t[i] = k;
            }
        }
        res += z;
        last[t[i]] = i;
        // cout << res << '\n';
        cout << t[i] + 1 << '\n';
    }

    // vector<int> t(d);
    // int m;
    // for (int i = 0; i < d; i++) {
    //     cin >> t[i];
    //     t[i]--;
    // }
    // cin >> m;
    // while (m--) {
    //     int dd, qq;
    //     cin >> dd >> qq;
    //     dd--, qq--;
    //     t[dd] = qq;
    //     int res = 0;
    //     vector<int> last(n, -1);
    //     for (int i = 0; i < d; i++) {
    //         res += s[i][t[i]];
    //         int x = i - last[t[i]] - 1;
    //         res -= x * (x + 1) / 2;
    //         last[t[i]] = i;
    //     }
    //     cout << res << '\n';
    // }
    return 0;
}

Measured memory_bytes: 3684
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
int main(void){
    long int x,y=0,money=100;
    scanf("%ld",&x);
    while(money<x){
        money = money * 1.01;
        money = floor(money);
        y++;
    }
    printf("%ld",y);
    return 0;
}

Measured memory_bytes: 1684
import sys
import itertools
# import numpy as np
import time
import math
import heapq
from collections import defaultdict
from collections import Counter
sys.setrecursionlimit(10 ** 7)
 
INF = 10 ** 18
MOD = 10 ** 9 + 7
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

# map(int, input().split())

s = input()
s = s.replace('BC', 'D')
s_list = s.split("B")
x = []
for e in s_list:
    x += e.split("C")

ans = 0
for e in x:
    cnt_d = 0
    now = 0
    for c in e[::-1]:
        if c == 'D':
            cnt_d += 1
        if c == 'A':
            now += cnt_d
    ans += now
print(ans)
        



Measured memory_bytes: 13316
#include <stdio.h>

int main(){
  int i,j,minj,count=0,len,array[100],num;

  scanf("%d",&len);
  for(i=0;i<len;i++){
    scanf("%d",&array[i]);
  }
  for(i=0;i<len;i++){
    minj=i;
    for(j=i;j<len;j++){
      if(array[j]<array[minj]) minj=j;
    }
    if(i!=minj){
      num=array[i];
      array[i]=array[minj];
      array[minj]=num;
      count++;
    }
  }
  for(i=0;i<len;i++){
    printf("%d",array[i]);
    if(i==len-1)printf("\n");
    else printf(" ");
  }
  printf("%d\n",count);
  return 0;
}

   



Measured memory_bytes: 2104
import java.util.*;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        long n = sc.nextLong();
        if (n%2==1){
            System.out.println(0);
        }else {
            long ans = 0;
            n/=10;
            ans+=n;
            while (n!=0){
                n/=5;
                ans+=n;
            }
            System.out.println(ans);
        }
    }
}


Measured memory_bytes: 35676
package main

import (
	"fmt"
	"io"
	"os"
)

func main() {
	in := os.Stdin
	out := os.Stdout
	solve(in, out)
}

func solve(in io.Reader, out io.Writer) {
	var (
		a, b, c int
	)

	fmt.Fscan(in, &a, &b, &c)
	fmt.Fprintf(out, "%d\n", b+eatPoisonCookie(c, a+b))
}

func eatPoisonCookie(poisonCookie, healCookie int) int {
	if healCookie < poisonCookie {
		return healCookie + 1
	}
	return poisonCookie
}


Measured memory_bytes: 512
#include<iostream>
    #include<stdio.h>
    //#include <bits/stdc++.h>
    #include<vector>
    #include<float.h>
    #include<algorithm>
    #include<string>
    #include<cstring>
    #include<math.h>
    #include<sstream>
    #include<set>
    #include<map>
    #include<queue>

    #define INF 1e7
    #define rep(i,n)for(int i=0;(i)<(int)(n);i++)
    #define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)
    #define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
    #define vec(type,n) vector<type>(n)
    #define vvec(m,n) vector<vector<int>> (int(m),vector<int>(n))

    using namespace std;
    int MAX(int a,int b){
      if(a<b){
        int tmp = a;
        a = b;
        b = tmp;
      }
      int r = a%b;
      while(!r){
        a = b;
        b = r;
        r = a%b;
      }
      return r;
    }

    int main(){
      long long n;
      cin>>n;
      n *= 2;
      long long res;
      if(n%11 > 1)res = n/11 + 1;
      else res = n/11;
      cout<<res<<endl;
    }


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define MOD 1000000007LL
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

ll l,r;

int main(void){
	scanf("%lld%lld",&l,&r);
	if(r-l>=2021){
		printf("%lld\n",0);
	}else{
		ll ans=2019;
		for(ll i=l;i<=r;i++){
			for(ll j=i+1;j<=r;j++){
				ll val=i*j%2019LL;
				ans=min(ans,val);
			}
		}
		printf("%lld\n",ans);
	}
	return 0;
}


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

using namespace std;

char s[100005];

int a[100005], n;

inline bool ok(int p) {
    int l = (p + n - 1) % n;
    int r = (p + 1) % n;
    if(a[p]) {
        if(s[p] == 'o')
            return a[l] != a[r];
        else
            return a[l] == a[r];
    } else {
        if(s[p] == 'o')
            return a[l] == a[r];
        else
            return a[l] != a[r];
    }
}

bool check() {
    for(int i = 2; i < n; ++ i) {
        if(a[i - 1]) {
            if(s[i - 1] == 'o')
                a[i] = a[i - 2] ^ 1;
            else
                a[i] = a[i - 2];
        } else {
            if(s[i - 1] == 'o')
                a[i] = a[i - 2];
            else
                a[i] = a[i - 2] ^ 1;
        }
    }
    return ok(0) && ok(n - 1);
}

void output() {
    for(int i = 0; i < n; ++ i)
        putchar(a[i] ? 'W' : 'S');
    exit(0);
}

int main() {
    scanf("%d%s", &n, s);
    for(a[0] = 0; a[0] < 2; ++ a[0]) {
        for(a[1] = 0; a[1] < 2; ++ a[1]) {
            if(check())
                output();
        }
    }
    puts("-1");
    return 0;
}


Measured memory_bytes: 768
#include<bits/stdc++.h>
#define int long long
using namespace std;
constexpr int mod=1e9+7;
signed main(){
    int n,a,sum=0,ans=0;
    cin>>n;
    while(cin>>a){
        (ans+=a*sum)%=mod;
        (sum+=a)%=mod;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 3616
#include <stdio.h>
#include <iostream>
#include <vector>
#include <cassert>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <math.h>
#include <ctype.h>
#include <limits>
#include <numeric>
#include <type_traits>
using namespace std;
//整形Shift + alt + f 
int n,t,c,res = 99999;
int main(){
    
    cin >> n >> t;

    for(int i=1; i <=n; i++){
        int tmp,cost;
        cin >> cost >> tmp;
        if(tmp <= t){
            if(cost < res)
                res = cost;
        }
    }

    if(res == 99999){
        cout << "TLE";
        return 0;
    }

    cout << res;
    return 0;
}

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

int main() {
  char b;
  cin>>b;
  if(b=='A'||b=='T'){
    if(b=='A') cout<<'T';
    else cout<<'A';
  }
  else if(b=='C'||b=='G'){
    if(b=='C') cout<<'G';
    else cout<<'C';
  }
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] arg) {
		Scanner sc = new Scanner(System.in);
		
		int a = sc.nextInt();
		int b = sc.nextInt();
		int ab = a * b;
		if(ab % 2 == 0) {
			System.out.println("Even");
		}
		else {
			System.out.println("Odd");
		}
		
		
	}

}

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

typedef long long ll;
typedef int64_t i64;
using namespace std;

int main()
{
	int n;
	cin >> n;
	bool cek = true;
	for(int i=0; i<n; i++){
		int a;
		cin >> a;
		if(a % 2 == 0){
				if(a % 3 != 0 && a % 5 != 0 )
			cek = false;

			}

	}

	if(cek)
		cout << "APPROVED\n";
	else
		cout << "DENIED\n";

	return 0;
}


Measured memory_bytes: 256
h,w=map(int,input().split())
e=["*" for i in range(w+2)]
s=[e]
for i in range(h):
  s.append(["*"]+list(input())+["*"])
s.append(e)

for i in range(1,h+1):
  for j in range(1,w+1):
    if s[i][j]==".":
      s[i][j]=str(sum(s[k][j-1:j+2].count("#") for k in range(i-1,i+2)))
  print("".join(s[i][1:w+1]))


Measured memory_bytes: 3188
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i < (int)(n) + 1; i++)
#define all(vecto) vecto.begin(),vecto.end()
typedef long long ll;

int main(){
    vector<int> vec(3);
    rep(i,3){
        cin >> vec.at(i);
    }
    sort(all(vec));
    vec.at(2) = 10 * vec.at(2);
    int sum = 0;
    rep(i,3){
        sum += vec.at(i);
    }
    cout << sum << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
int main(){
    int64_t a,b,x;
    cin >> a >> b >> x;
    int64_t ans = 0;
    if(a == 0) cout << b/x + 1 << endl;
    else cout << b/x - (a-1)/x;
}


Measured memory_bytes: 256
#include <stdio.h>
int main ()
{
	char S[100];
	scanf("%s",S);
	
	if(S[1]=='R')
	{
		printf("ABC");
	}
	else if (S[1]=='B')
	{
		printf("ARC");
	}
	
	
	
	return 0;
}

Measured memory_bytes: 1728
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

import numpy as np

MOD = 10**9+7

N,M = map(int,read().split())

"""
・合計の訪問済の町の個数
・訪問済だけれど強連結成分には入っていない町の個数
に対する場合の数を持ってdp
"""

dp = np.zeros((N+1,N+1),np.int64)
dp[1,0] = 1
for _ in range(M):
    prev = dp
    dp = np.zeros_like(prev)
    # 強連結成分にもどる
    dp[:,0] += (prev[:,:] * (np.arange(N+1)[:,None] - np.arange(N+1)[None,:])).sum(axis=1)
    # 未確定部分内で
    dp[:,:] += prev[:,:] * np.arange(N+1)[None,:]
    # 未確定部分の拡張
    dp[1:,1:]+= prev[:-1,:-1] * np.arange(N,0,-1)[:,None]
    dp %= MOD

answer = dp[N,0]
print(answer)

Measured memory_bytes: 15304
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7

def LI(): return list(map(int,input().split()))
def I(): return int(input())
def LS(): return input().split()
def S(): return input()

def main():
  n,m=LI()

  l=[]
  for _ in ' '*m:
    a,b=LI()
    l.append([a,1])
    l.append([b,-1])

  l=sorted(l,key=lambda x:x[1],reverse=True)
  l=sorted(l,key=lambda x:x[0])

  sm=st=0
  for x in l:
    sm+=x[1]
    if sm==m:
      st=x[0]
    if sm!=m and st!=0:
      return x[0]-st+1

  return 0

print(main())


Measured memory_bytes: 37736
#include <bits/stdc++.h>
#include <cassert>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
struct Edge
{
  int to;
  int weight;
  Edge(int t, int w) : to(t), weight(w) {}
};
using Graph = vector<vector<Edge>>;
// using Graph = vector<vector<int>>;

const long long INF = 1LL << 60;
const int INT_INF = 1000000000;

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

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int a;
  cin >> a;
  cout << a + a * a + a * a * a << endl;
  return 0;
}

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

using namespace std;
#define all(a)a.begin(),a.end()
using ll=long long;
const int INF = 1<<30;
const ll INFll =1LL<<62;
const int mod= int(1e9)+7;
using P = pair<ll,ll>;
using ld=long double;

vector<ll>a;
ll n;ll k;
bool ch(ll x){
    ll now=0;
    if(x==0)return false;
    for (int i = 0; i < n; ++i) {
        now+=(a[i]-1)/x;
    }
    if(now<=k)return true;
    return false;
}

int main(){
    cin >>n>>k;
    a.resize(n);
    for (int i = 0; i < n; ++i) {
        cin >>a[i];
    }
    ll ok=1e9;
    ll ng=0;
    ll cnt=0;
    while(cnt<1000){
        ll m=(ok+ng)/2;
        if(ch(m))ok=m;
        else ng=m;
        cnt++;
    }
    cout <<ok<<endl;
}


Measured memory_bytes: 4732
#C

N,M=map(int,input().split())
H=[int(x) for x in input().split()]
AC=["ii" for i in range(N)]

for i in range(M):
    A,B=map(int,input().split())
    Min=min(H[A-1],H[B-1])
    
    if H[A-1]==H[B-1]:
        AC[A-1]="dame"
        AC[B-1]="dame"
    elif Min==H[A-1]:
        AC[A-1]="dame"
    elif Min==H[B-1]:
        AC[B-1]="dame"
        
cnt=0
for i in range(N):
    if AC[i]=="ii":
        cnt+=1
        
print(cnt)

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

int main() {
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	if(abs(a-c)<=d || (abs(a-b)<=d && abs(b-c)<=d)){
		cout <<"Yes"<<endl;
	}
	else cout << "No"<<endl;
	return 0;
}

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


int main(){

	int N;
	scanf("%d",&N);
	int a[N];
	int Alice = 0;
	int Bob = 0;
	for(int i=0; i<N; i++){
		scanf("%d",&a[i]);
	}
	for(int i=0; i<N; i++){
		for(int j=N-1; j>i; j--){
			if(a[j-1] < a[j]){
				int tmp = a[j];
				a[j] = a[j-1];
				a[j-1] = tmp; 
			}
		}
	}
	for(int i=0; i<N; i++){
		if(i%2 == 0){
			Alice += a[i];
		}
		else{
			Bob += a[i];
		}
	}
	printf("%d\n",Alice - Bob);

	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <climits>
#include <map>
using namespace std;

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 w, h, n;
	cin >> w >> h >> n;
	vector<vector<int>> board(h, vector<int>(w, 1));
	for (int i = 0; i < n; i++) {
		int x, y, a; cin >> x >> y >> a;
		switch (a) {
		case 1:
			for (int j = 0; j < h; j++) {
				for (int k = 0; k < w; k++) {
					if (k < x) {
						board.at(j).at(k) = 0;
					}
				}
			}
			break;
		case 2:
			for (int j = 0; j < h; j++) {
				for (int k = 0; k < w; k++) {
					if (k >= x) {
						board.at(j).at(k) = 0;
					}
				}
			}
			break;
		case 3:
			for (int j = 0; j < h; j++) {
				for (int k = 0; k < w; k++) {
					if (j < y) {
						board.at(j).at(k) = 0;
					}
				}
			}
			break;
		case 4:
			for (int j = 0; j < h; j++) {
				for (int k = 0; k < w; k++) {
					if (j >= y) {
						board.at(j).at(k) = 0;
					}
				}
			}
		}
	}
	int ans = 0;

	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			ans += board.at(i).at(j);
		}
	}
	cout << ans << endl;
	return 0;
}

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

int main() {
  int N, Y; cin >> N >> Y;
  bool lie = true;
  for(int i = 0; i <=N;i++){
     if(!lie) break;
    for(int j = 0; j <=N;j++){
      int total = 10000*i+5000*j+1000*(N-i-j);
      if(total==Y && i+j <= N ){
        cout << i << " " << j << " " << N-j-i << endl;
        lie = false;
        break;
      }
     
    }
   
  }
 if(lie) cout << -1 << " " << -1 << " " << -1 << endl;
}



Measured memory_bytes: 3592
#include <iostream>
#include <fstream>
#include <vector>
#include <cstring>
#include <string>
#include <algorithm>
#include <iomanip>
using namespace std;
typedef long long ll;

ll a[2000];
ll amin[2000];

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

	ll N, x;
	cin >> N >> x;
	for(int i = 0; i < N; i++) {
		cin >> a[i];
		amin[i] = a[i];
	}

	ll ans = 1LL << 60;
	for(int xc = 0; xc < N; xc++) {
		ll s = x * xc;
		for(int i = 0; i < N; i++) {
			ll change = a[(i - xc + N) % N];
			amin[i] = min(amin[i], change);
			s += amin[i];
		}
		ans = min(ans, s);
	}

	cout << ans << endl;
}

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

int main(){
    int n,cnt=0,mx=0;
    cin >> n;
    vector<int> a(n);
    for(int i=0; i<n; i++){
        cin >> a[i];
    }
    sort(a.begin(),a.end());
    for(int i=0; i<a.size()-1; i++){
        if(a[i]/400!=a[i+1]/400&&a[i+1]<3200)cnt++;
        else if(a[i+1]>=3200)mx++;
    }
    cout << cnt+1 << " " << mx+cnt+1 << endl;

    
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations

sys.setrecursionlimit(10000)


def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(N, A):
    # ans = 0
    ans = sys.maxsize

    S = [0] * (N+1)
    for i in range(0, N):
        S[i+1] = A[i] + S[i]
    
    lj = 1
    left_diffs = {}
    for i in range(2, N-1):
        left_diff = (sys.maxsize, 0, 0)
        for j in range(lj, i):
            a = S[j]-S[0]
            b = S[i]-S[j]
            # print(j, A[0:j], A[j:i], a, b, abs(a-b))
            if left_diff[0] > abs(a-b):
                left_diff = (abs(a-b), a, b)
            else:
                break
        lj = j-1 if j-1 > 0 else 1
        left_diffs[i] = left_diff

    right_diffs = {}
    rj = N-1
    for i in range(N-1-1, 2-1, -1):
        right_diff = (sys.maxsize, 0, 0)
        # for j in range(i+1, N):
        for j in range(rj, i, -1):
            c = S[j]-S[i]
            d = S[-1]-S[j]
            # print(j, A[i:j], A[j:], c, d, abs(c-d))
            if right_diff[0] > abs(c-d):
                right_diff = (abs(c-d), c, d)    
            else:
                break
        rj = j+1 if j+1 < N else N-1
        right_diffs[i] = right_diff
    
    for i in range(2, N-1): 
        _, a, b = left_diffs[i]
        _, c, d = right_diffs[i]
        # print(a, b, c, d)
        ans = min(ans, (max(a, b, c, d) - min(a, b, c, d)))
    return ans
     

def main():
    N = read_int()
    A = read_int_n() 

    # N = int(2.0e+5)
    # A = [random.randint(1, int(1e+9)) for _ in range(N)]
    print(slv(N, A))


if __name__ == '__main__':
    main()


Measured memory_bytes: 138800
#include <bits/stdc++.h>
typedef long long int ll;
using namespace std;
int main()
{
    string s;
    cin>>s;
    ll n=s.length();
    ll z[26];
    for(int i=0;i<26;i++)
    z[i]=0;
    for(int i=0;i<n;i++)
    {
        z[s[i]-'a']++;
    }
    ll ans=0;
    for(int i=0;i<26;i++)
    {
        ll q=(z[i]*z[i])-z[i];
        ans=ans+q/2;
    }
    cout<<1+(n*(n-1))/2-ans<<endl;
}

Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <queue>
#include <stack>
#include <tuple>
#include <cmath>
#include <iomanip>
#include <map>
#include <cstring> //memset(dp,0,sizeof(dp))
#include <functional>
#include <cctype>
#include <locale>
#define ll long long
#define rep(i,n) for(int i=0;i<(n);i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define fi first
#define se second
#define pb push_back
#define ALL(a) (a).begin(),(a).end()
using namespace std;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
typedef pair<int,int> P;
typedef pair<long long,long long> Pll;
#define fout(num) cout << fixed << setprecision(20) << (num) << endl
//s[i]=tolower(s[i]); islower(s[i]); cout << tolower(s[i])はバグ
//vector<vector<ll>> dp(n,vector<ll>(n))
//exist x map o setconst ll MOD = 1e9+7;return fac[n]*(finv[k]*finv[n-k] % MOD) % MOD;
//2-dim:vector<vector<Type>> vv(n, vector<Type>(m, d));
//3-dim:vector<vector<vector<Type>>> vvv(n, vector<vector<Type>>(m, vector<Type>(l, d)));


signed main(){
    const int mxm=1e9;
    int n,k,s; cin >> n >> k >> s;
    rep(i,k){
        cout << s << " ";
    }
    rep(i,n-k){
        if(s!=mxm) cout << mxm << " ";
        else cout << mxm-1 << " ";
    }
}




Measured memory_bytes: 3652
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin>>s;
  if(s[0]==s[1]){
    if(s[1]!=s[2]&&s[2]==s[3])cout<<"Yes";
    else cout<<"No";
  }
  else{
    if(s[1]==s[2]){
      if(s[0]==s[3])cout<<"Yes";
      else cout<<"No";
    }
    else{
      if(s[0]==s[2]&&s[1]==s[3])cout<<"Yes";
      else cout<<"No";
    }
  }
  cout<<endl;
}
    

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define idfc ios_base::sync_with_stdio(false),cin.tie(nullptr),cout.tie(nullptr)
#define ll long long
#define pb emplace_back
#define mp make_pair
#define nt _int128
#define ld long double
long double PI =3.14159265358979323846;


const ll modo=1e9+7;
const ll inf=1e7;
const ll ms=(2e5)+5;



int main()
{
    idfc;
    ll x;
    cin>>x;

    ll i,j;
    ll pp;

    for(i=(-200);i<=200;i++)
    {
        for(j=-200;j<=200;j++)
        {
          pp=pow(i,5)-pow(j,5);
          if(pp==x){cout<<i<<" "<<j;return 0;}
        }
    }

    return 0;

}

Measured memory_bytes: 4112
from sys import stdin
input = stdin.readline
class LazySegmentTree():
    def __init__(self, n, init, merge_func=min, ide_ele=10 ** 18):
        self.n = (n - 1).bit_length()
        self.merge_func = merge_func
        self.ide_ele = ide_ele
        self.data = [0 for i in range(1 << (self.n + 1))]
        self.lazy = [0 for i in range(1 << (self.n + 1))]
        for i in range(n):
            self.data[2 ** self.n + i] = init[i]
        for i in range(2 ** self.n - 1, 0, -1):
            self.data[i] = self.merge_func(self.data[2 * i], self.data[2 * i + 1])

    def propagate_above(self, i):
        m = i.bit_length() - 1
        for bit in range(m, 0, -1):
            v = i >> bit
            add = self.lazy[v]
            self.lazy[v] = 0
            self.data[2 * v] += add
            self.data[2 * v + 1] += add
            self.lazy[2 * v] += add
            self.lazy[2 * v + 1] += add

    def remerge_above(self, i):
        while i:
            i >>= 1
            self.data[i] = self.merge_func(self.data[2 * i], self.data[2 * i + 1]) + self.lazy[i]

    def update(self, l, r, x):
        l += 1 << self.n
        r += 1 << self.n
        l0 = l // (l & -l)
        r0 = r // (r & -r) - 1
        while l < r:
            self.data[l] += x * (l & 1)
            self.lazy[l] += x * (l & 1)
            l += (l & 1)
            self.data[r - 1] += x * (r & 1)
            self.lazy[r - 1] += x * (r & 1)
            l >>= 1
            r >>= 1
        self.remerge_above(l0)
        self.remerge_above(r0)

    def query(self, l, r):
        l += 1 << self.n
        r += 1 << self.n
        l0 = l // (l & -l)
        r0 = r // (r & -r) - 1
        self.propagate_above(l0)
        self.propagate_above(r0)
        res = self.ide_ele
        while l < r:
            if l & 1:
                res = self.merge_func(res, self.data[l])
                l += 1
            if r & 1:
                res = self.merge_func(res, self.data[r - 1])
            l >>= 1
            r >>= 1
        return res
def solve():
    n,k = map(int,input().split())
    a = [int(inp) for inp in stdin.read().splitlines()]
    N = 300010
    cnt = [0]* N
    LST = LazySegmentTree(N,cnt,max,-1)
    res = 0
    for i in a:
        v = LST.query(max(0,i - k),min(N,i+k) + 1)
        res = max(res,v + 1)
        cur = LST.query(i,i+1)
        LST.update(i,i+1,v+1-cur)
    print(res)


if __name__ == '__main__':
    solve()

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

const int64_t INF = 2 << 30;

int main() {
  int N,M;
  string ans="No";
  cin>>N>>M;
  if(N==M){
    ans="Yes";
  }
  cout<<ans<<endl;
}  

Measured memory_bytes: 256
/* package whatever; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
        int k = sc.nextInt();
	int total =0;

	if( n%2 == 0) {
		total = n/2;
	} else {
		total = (n+1)/2;
	}

	if(k <= total) {
		System.out.println("YES");
	} else {
		System.out.println("NO");
	}
	}
}


Measured memory_bytes: 22996
#include <bits/stdc++.h>
using namespace std;
typedef long long  ll;
#define FOR(i,a,n) for(ll i=(ll)a;i<(ll)n;i++)
#define RFOR(i,a,n) for(ll i=(ll)n-1;i >= (ll)a;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,0,n)
#define ALL(v) v.begin(), v.end()
#define bra(first,second) '(' << first << ',' << second << ')'
constexpr ll MOD = 1000000007;
//constexpr ll MOD = 998244353;
ll INF = 6001001001001001001;
long double EPS = 1e-6;
long double PI = 3.141592653589793238;
template<typename T>
void remove(std::vector<T>& vector, unsigned int index){
    vector.erase(vector.begin() + index);
}

using Graph = vector<vector<pair<ll,double>>>;

// MOD確認

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


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


#define off ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define maxx 1e6+7

int main() {
	off;
	
	long double a,b;
	cin>>a>>b;
	cout<<fixed<<setprecision(10)<<(a/b)<<'\n';

  	return 0;
}


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






int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    
    int n;
    cin>>n;
    list<int> li;
    for(int i=1; i<=n; i++){
        int x;
        cin>>x;
        if(i%2){
            li.push_back(x);
        }
        else{
            li.push_front(x);
        }
    }
    if(n%2){
        for(auto it=li.rbegin(); it!=li.rend(); it++){
            cout<<*it<<" ";
        }
        return 0;
    }
    
    for(int i:li){
        cout<<i<<" ";
    }
    
    
    
    
    return 0;
}

Measured memory_bytes: 8448
#include <stdio.h>
#include <stdlib.h>
int max(int a,int b){return a>b?a:b;}
int main(void){
    int n,z,w;
    scanf("%d%d%d",&n,&z,&w);
    int a[n];
    for (int i=0; i<n; i++){
        scanf("%d",&a[i]);
    }
    if (n==1){
        printf("%d\n",abs(a[n-1]-w));
    } else {
        printf("%d\n",max(abs(a[n-1]-w),abs(a[n-1]-a[n-2])));
    }
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;
template<class T> void assign(V<T>& v, int n, const T& a = T()) { v.assign(n, a); }
template<class T, class... U> void assign(V<T>& v, int n, const U&... u) { v.resize(n); for (auto&& i : v) assign(i, u...); }

struct M {
  using T = int;
  static T op(const T& a, const T& b) { return a + b; }
  static constexpr T e() { return 0; }
};

template<class M> struct ST {
  using T = typename M::T;
  int n;
  V<T> t;

  ST(int n) : n(n) {
    t.assign(2 * n, M::e());
  }

  void build() {
    for (int i = n - 1; i; i--) t[i] = M::op(t[2 * i], t[2 * i + 1]);
  }

  T get(int l, int r) {
    T resl = M::e(), resr = M::e();
    for (l += n, r += n; l < r; l >>= 1, r >>= 1) { 
      if (l & 1) resl = M::op(resl, t[l++]); 
      if (r & 1) resr = M::op(t[--r], resr);
    }
    return M::op(resl, resr);
  }

  void set(int i, const T& a) {
    for (t[i += n] = a; i >>= 1;) t[i] = M::op(t[2 * i], t[2 * i + 1]);
  }
};

int main() {
  cin.tie(NULL); ios::sync_with_stdio(false);
  int n; cin >> n;
  struct seg { int id, x1, y1, x2, y2; };
  V<seg> a(n);
  V<> x, y;
  for (int i = 0; i < n; i++) {
    int x1, y1, x2, y2; cin >> x1 >> y1 >> x2 >> y2;
    x.push_back(x1), y.push_back(y1);
    x.push_back(x2), y.push_back(y2);
    a[i] = seg{i, x1, y1, x2, y2};
  }
  sort(x.begin(), x.end()), sort(y.begin(), y.end());
  x.erase(unique(x.begin(), x.end()), x.end());
  y.erase(unique(y.begin(), y.end()), y.end());
  for (int i = 0; i < n; i++) {
    a[i].x1 = lower_bound(x.begin(), x.end(), a[i].x1) - x.begin();
    a[i].y1 = lower_bound(y.begin(), y.end(), a[i].y1) - y.begin();
    a[i].x2 = lower_bound(x.begin(), x.end(), a[i].x2) - x.begin();
    a[i].y2 = lower_bound(y.begin(), y.end(), a[i].y2) - y.begin();
  }

  struct event { int type, x1, x2; };
  VV<event> y2e(y.size());
  for (int i = 0; i < n; i++) {
    if (a[i].x1 == a[i].x2) {
      y2e[min(a[i].y1, a[i].y2)].push_back(event{0, a[i].x1, -1});
      y2e[max(a[i].y1, a[i].y2)].push_back(event{2, a[i].x1, -1});
    } else {
      y2e[a[i].y1].push_back(event{1, min(a[i].x1, a[i].x2), max(a[i].x1, a[i].x2)});
    }
  }
  auto comp = [](const event& a, const event& b) { return a.type < b.type; };
  for (auto&& v : y2e) sort(v.begin(), v.end(), comp);
  ST<M> st(x.size());
  int res = 0;
  for (int j = 0; j < y.size(); j++) {
    for (auto&& e : y2e[j]) {
      if (e.type == 0) st.set(e.x1, st.t[e.x1 + x.size()] + 1);
      else if (e.type == 1) res += st.get(e.x1, e.x2 + 1);
      else st.set(e.x1, st.t[e.x1 + x.size()] - 1);
    }
  }
  cout << res << '\n';
}


Measured memory_bytes: 10336
#include<bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define ull unsigned long long
#define vi vector<ll>
#define vvi vector<vi>
#define BITLE(n) (1LL<<((ll)n))
#define BITCNT(n) (__builtin_popcountll(n))
#define SUBS(s,f,t) ((s).substr((f)-1,(t)-(f)+1))
#define ALL(a) (a).begin(),(a).end()
using namespace std;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n;cin>>n;
  ll ans=0;
  ll mae=0;
  cin>>mae;
  for(int i=0;i<n-1;i++){
    ll a;cin>>a;
    ans+=(mae>=a);
    mae=a;
  }
  cout<<ans+1<<endl<<n<<endl;
  return 0;
}



Measured memory_bytes: 3212
#include<stdio.h>
int main()
{
    int i,N,value=0,X,L1,Li,LN,arr[100],count=1;

    scanf("%d %d",&N,&X);

    for(i=0; i<N; i++)
    {
       scanf("%d",&arr[i]);
       value=value+arr[i];
       if(value<=X)
        count++;
    }
    printf("%d",count);



}


Measured memory_bytes: 128
#pragma GCC optimize("O3")
  #include  "bits/stdc++.h"
  using namespace std;
  #define I_AM_SPEED  ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); 
  #define printclock  cerr <<"Time : "<<(double)clock()/(double)CLOCKS_PER_SEC<<" sec\n";
  #define meme(a,v)    memset((a), (v), sizeof (a))
  #define mp(a , b)   make_pair(a , b)
  #define eb(a)       emplace_back(a)
  #define anal         '\n'
  #define mod 1000000007
  //const double PI = acos(-1.0);
  typedef long long ll;


  //_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
    

  //_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
    

  int main(){
  I_AM_SPEED;

  //_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
         
        int x, n;
        cin >> x >> n;
        set<int> in;
        for(int i = 0; i < n; i++){
           int num;
           cin >> num;
           in.insert(num);
        }
        int left = x, right = x;
        while(left || right){
             if(!(in.count(left))){
                 cout << left << anal;
                 return 0;
             }
             if(!in.count(right)){
                 cout << right << anal;
                 return 0;
             }
             left--;
             right++;
        }


        
  //_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-

  return  0 ;      
  }        





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

int main() {
  ll ans=0;
  ll a = 0;
  ll n;
  cin >> n;
  vector<ll> A(n);
  rep(i,n) {
    cin >> A.at(i);
  }
 
  map<ll, ll> cnt;
  for (ll x : A) {
    if (cnt.count(x)) {
      cnt.at(x)++;
    } else {
      cnt[x] = 1;
    }
  }
  
  rep(i, n+1){
    if (cnt.count(i)) {
    	a = cnt.at(i)*(cnt.at(i)-1)/2;
    	ans = ans + a;
    }
  }

  ll ansk;
  rep(k,n){
    ansk = ans - cnt.at(A.at(k))*(cnt.at(A.at(k))-1)/2 
      		+ (cnt.at(A.at(k))-1)*(cnt.at(A.at(k))-2)/2;
    cout << ansk << endl;
  }
}

Measured memory_bytes: 11008
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;

bool valid(int left,int right){
  if(left==right)return false;
  if(left==5||right==5) return false;
  if((left==2||left==8)&&(right==1||right==4||right==7))
    return false;
  if((left==6||left==9||left==3)
     &&(right==2||right==8||right==1||right==4||right==7))
    return false;
  return true;
}

const int INF=100000000;

int main(){

  string str;
  while(cin>>str&&str!="#"){
    int n=str.size();
    int minCnt=INF;
    int dp[2][11][11][2];
    for(int i = 1; i <= 9; i++){
      for(int j = 1; j <= 9; j++){
	if(valid(i,j)){
	  dp[0][i][j][0]=0;
	  dp[0][i][j][1]=0;
	}
	else{
	  dp[0][i][j][0]=INF;
	  dp[0][i][j][1]=INF;
	}
	dp[1][i][j][0]=INF;
	dp[1][i][j][1]=INF;
      }
    }
    // Å©çÅãÜÅ[vðñ·
    for(int i = 0; i < str.size(); i++){
      for(int j = 0; j < 11; j++)
	for(int k = 0; k < 11; k++)
	  dp[(i+1)%2][j][k][0]=dp[(i+1)%2][j][k][1]=INF;
      for(int j = 1; j <= 9; j++){
	for(int k = 1; k <= 9; k++){
	  // ¶«ªj,E«ªkÉ éóÔ©çJÚ·é
	  
	  if(!valid(j,k))
	    continue;
	  // if(dp[(i+1)%2][str[i]-'0'][k][1]<0
	  //    ||dp[(i+1)%2][str[i]-'0'][k][1]<0){
	  //   cout<<i<<" "<<j<<" "<<k<<endl;
	  // }
	  // ¡ñg¤«
	  if(valid(j,str[i]-'0')){
	    dp[(i+1)%2][j][str[i]-'0'][0]
	      =min(dp[(i+1)%2][j][str[i]-'0'][0]
		   ,dp[i%2][j][k][1]);
	    dp[(i+1)%2][j][str[i]-'0'][0]
	      =min(dp[(i+1)%2][j][str[i]-'0'][0]
		   ,dp[i%2][j][k][0]+1);
	  }
	  if(valid(str[i]-'0',k)){
	    dp[(i+1)%2][str[i]-'0'][k][1]
	      =min(dp[(i+1)%2][str[i]-'0'][k][1]
		   ,dp[i%2][j][k][1]+1);
	    dp[(i+1)%2][str[i]-'0'][k][1]
	      =min(dp[(i+1)%2][str[i]-'0'][k][1]
		   ,dp[i%2][j][k][0]);
	  }
	}
      }
    }
    for(int i = 1; i <= 9; i++)
      for(int j = 1; j <= 9; j++)
	for(int l = 0; l < 2; l++)
	  minCnt=min(minCnt,dp[n%2][i][j][l]);
    cout<<minCnt<<endl;
  }
  return 0;
}

Measured memory_bytes: 1144
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<stack>
#include<queue>
#include<deque>
#include<map>
#include<set>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
#define FOR(i,n) for(int (i)=0;(i)<(n);(i)++)
#define FOR1(i,n) for(int (i)=1;(i)<(n);(i)++)
#define eFOR(i,n) for(int (i)=0;(i)<=(n);(i)++)
#define eFOR1(i,n) for(int (i)=1;(i)<=(n);(i)++)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i) sort((i).begin(),(i).end(), greater<int>());
#define YES(i) cout << ((i) ? "Yes" : "No") << endl;
constexpr auto INF = 1000000000;
constexpr auto LLINF = 1LL<<62;
constexpr auto mod = 1000000007;
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; }

int main() {

	int a, p;
	cin >> a >> p;
	cout << (a * 3 + p) / 2 << endl;
	
}


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

int main() {
    int n,cnt=0;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    for(int i=1;i<n-1;i++){
        if((a[i-1]<a[i] and a[i]<a[i+1] )or ( a[i-1]>a[i] and a[i]>a[i+1]))
            cnt++;
    }
    cout<<cnt;
    return 0;
}


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

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int,int> pii;
#define RI(a) scanf("%d",&a)
#define RII(a,b) scanf("%d%d",&a,&b)
#define RIII(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
#define ALL(a) a.begin(),a.end()
#define F first
#define S second
#define REP(i,n) for(int i=0;i<(n);i++)
#define mp make_pair
#define pb push_back
#define forn(i, a, n) for (int i = (int)(a); i < (int)(n); ++i)
#define ford(i, a, n) for (int i = (int)(n - 1); i >= (int)(a); --i)
#define fore(i, a, n) for (int i = (int)(a); i <= (int)(n); ++i)
#define all(a) (a).begin(), (a).end()
#define fs first
#define sn second

const int MOD = 1e9+7;
const int inf = 1e9+9;
const long long INF = 1e18+3;
const ld eps = 1e-9;
int main(){

    map<char,char> mp;
    fore(i,'a','y') mp[i]=i+1;
    mp['z']='a';
    //fore(i,'a','z') cout<<mp[i]<<endl;
    string s;
    int n,x;
    cin>>s>>n;

    forn(i,0,s.size()-1) {
        x='z'-s[i]+1;
        if(x<=n && s[i]!='a') n-=x,s[i]='a';
    }
    n%=26;
    while(n--) s[s.size()-1]=mp[s[s.size()-1]];
    cout<<s<<endl;
return 0;
}


Measured memory_bytes: 512
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class Main
{
    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }
    public static void main(String args[])
    {
        FastReader obj = new FastReader();
        int n = obj.nextInt(),k = obj.nextInt();
        boolean flags[] = new boolean[n+1];
        for(int i=0;i<k;i++)
        {
            int u = obj.nextInt();
            for(int j=0;j<u;j++)
            {
                int p = obj.nextInt();
                flags[p] = true;
            }
        }
        int count =0;
        for(int i=1;i<flags.length;i++) if(!flags[i]) count++;
        System.out.println(count);
    }
}


Measured memory_bytes: 33188
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define rep(i,n) for (int i = (0); i < (n); ++i)
#define rng(x) (x).begin(),(x).end()
#define rrng(x) (x).rbegin(),(x).rend()
#define debug(x) cout << #x << " = " << (x) << endl;
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define uni(x) x.erase(unique(rng(x)),x.end())
#define SP << " " <<
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
const int mod = 1000000007;
const double EPS = 1e-9;
const int INF = 1<<30;
const ll INFLL = 1LL<<60;
//cout << fixed << setprecision(10);

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

int main () {
  int n;
  cin >> n;
  vector<string> s(n);
  
  // {M,A,R,C,H} -> {0,1,2,3,4}
  string t = "MARCH";
  vll c(5);
  rep(i,n) {
    string s;
    cin >> s;
    rep(j,5) {
      if (s[0] == t[j]) c[j]++;
    }
  }

  ll ans = 0;
  for (int i = 0; i < 5; ++i) {
    for (int j = i+1; j < 5; ++j) {
      for (int k = j+1; k < 5; ++k) {
        ans += c[i]*c[j]*c[k];
      }
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1532
/**
 * Combinatorial - Knapsack Problem
 */

#include <iostream>

using namespace std;

int main() {

    int N, W;
    cin >> N >> W;

    int dp[W + 1];
    fill(dp, dp + W + 1, 0);

    for (int i = 0; i < N; i++) {
        int v, w;
        cin >> v >> w;
        for (int j = w; j <= W; j++) {
            dp[j] = max(dp[j], dp[j - w] + v);
        }
    }

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

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

#define rep(i,n) for(long long int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(long long int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(long long int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define pb(q) push_back(q)
#define Abs(a,b) max(a,b)-min(a,b)
#define YES(condition) if(condition){cout << "YES" << endl;}else{cout << "NO" << endl;}
#define Yes(condition) if(condition){cout << "Yes" << endl;}else{cout << "No" << endl;}
#define Cout(x) cout<<(x)<<endl
#define POSSIBLE(condition) if(condition){cout << "POSSIBLE" << endl;}else{cout << "IMPOSSIBLE" << endl;}
#define Possible(condition) if(condition){cout << "Possible" << endl;}else{cout << "Impossible" << endl;}
#define possible(condition) if(condition){cout << "possible" << endl;}else{cout << "impossible" << endl;}
#define Size(n) (n).size()

typedef long long ll;


using namespace std;

const int INF = 1e9,MOD = 1e9 + 7,ohara = 1e6;
const ll LINF = 1e18;


long long int n,cnt=0,ans=0,a[ohara],b,c,d,cmp,cmpp,m,h,w,x,y,sum=0,pos;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
string alph("abcdefghijklmnopqrstuvwxyz"),s;
bool fl=true;
struct edge{int to,cost;};

//-------------------------↓↓↓↓↓↓------------------------

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

      
      cin>>n>>x;
      rep(i,n)cin>>a[i];
      rep(i,n-1){
        if(a[i]+a[i+1]<=x)continue;
        pos=a[i]+a[i+1]-x;
        ans+=pos;
        if(a[i+1]>=pos)a[i+1]-=pos;
        else{
          a[i+1]=0;
          pos-=a[i+1];
          a[i]-=pos;
        }
      }
      Cout(ans);
     

       
return 0;
}


Measured memory_bytes: 1024
import java.util.*;

public class Main {
	public static void main(String[] args) throws Exception{
		Scanner scn = new Scanner(System.in);
		int a = scn.nextInt();
      	int b = scn.nextInt();
      	int c = scn.nextInt();
      	String ans = "No";
      	if(a==b && b==c) ans = "Yes";
		System.out.println(ans);
	}
}

Measured memory_bytes: 35704
#include <stdlib.h>
#include <iostream>
#include <string>
using namespace std;
int main(void)
{
	int T;
	int X;
	cin >> T;
	cin >> X;

	if (T > 0 &&
		T <= 100 &&
		T > 0 &&
		T <= 100)
	{
		float time = float(T)/float(X)
			;
		cout << time << endl;
	}
	cin >> T;
	return 0;
}

Measured memory_bytes: 256