akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define whlie while
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define rep(i,N) for(int i = 0; i < (N); i++)
#define repr(i,N) for(int i = (N) - 1; i >= 0; i--)
#define rep1(i,N) for(int i = 1; i <= (N) ; i++)
#define repr1(i,N) for(int i = (N) ; i > 0 ; i--)
#define each(x,v) for(auto& x : v)
#define all(v) (v).begin(),(v).end()
#define sz(v) ((int)(v).size())
#define vrep(v,it) for(auto it = v.begin(); it != v.end(); it++)
#define vrepr(v,it) for(auto it = v.rbegin(); it != v.rend(); it++)
#define ini(...) int __VA_ARGS__; in(__VA_ARGS__)
#define inl(...) ll __VA_ARGS__; in(__VA_ARGS__)
#define ins(...) string __VA_ARGS__; in(__VA_ARGS__)
using namespace std; void solve();
using ll = long long; using vl = vector<ll>;
using vi = vector<int>; using vvi = vector< vector<int> >;
constexpr int inf = 1001001001;
constexpr ll infLL = (1LL << 61) - 1;
struct IoSetupNya {IoSetupNya() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); cerr << fixed << setprecision(7);} } iosetupnya;
template<typename T, typename U> inline bool amin(T &x, U y) { return (y < x) ? (x = y, true) : false; }
template<typename T, typename U> inline bool amax(T &x, U y) { return (x < y) ? (x = y, true) : false; }
template<typename T, typename U> ostream& operator <<(ostream& os, const pair<T, U> &p) { os << p.first << " " << p.second; return os; }
template<typename T, typename U> istream& operator >>(istream& is, pair<T, U> &p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator <<(ostream& os, const vector<T> &v) { int s = (int)v.size(); rep(i,s) os << (i ? " " : "") << v[i]; return os; }
template<typename T> istream& operator >>(istream& is, vector<T> &v) { for(auto &x : v) is >> x; return is; }
void in(){} template <typename T,class... U> void in(T &t,U &...u){ cin >> t; in(u...);}
void out(){cout << "\n";} template <typename T,class... U> void out(const T &t,const U &...u){ cout << t; if(sizeof...(u)) cout << " "; out(u...);}
template<typename T>void die(T x){out(x); exit(0);}
#ifdef NyaanDebug
  #include "NyaanDebug.h"
  #define trc(...) do { cerr << #__VA_ARGS__ << " = "; dbg_out(__VA_ARGS__);} while(0)
  #define trca(v,N) do { cerr << #v << " = "; array_out(v , N);cout << endl;} while(0)
#else
  #define trc(...)
  #define trca(...)
  int main(){solve();}
#endif
using P = pair<int,int>; using vp = vector<P>;
constexpr int MOD = /**/ 1000000007; //*/ 998244353;
////////////////

void solve(){
  ini(N);
  rep1(i , 9){
    if(N % i) continue;
    int m = N / i;
    if(m < 10) die("Yes");
  }
  die("No");
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,ans,maxz;
string s;
int main()
{
  cin>>n>>s;
  for(int i=0;i<n;i++)
  {
    ans=(s[i]=='I')?ans+1:ans-1;
    maxz=max(maxz,ans);
  }
  cout<<maxz;
  return 0;
}

Measured memory_bytes: 256
#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 DBG_N(hoge) cerr<<" "<<(hoge)<<endl;
#define DBG cerr<<"!"<<endl;
#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 a,n,b,c,d,e;
  string s,ss,sss;
  cin>>n;
  vi A(n);
  ll ans=0;
  for(auto &a:A)cin>>a;
  for(int i=0;i<n-2;i++){
    if((A[i]<A[i+1]&&A[i+1]<A[i+2])||(A[i]>A[i+1]&&A[i+1]>A[i+2]))ans++;
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner in = new Scanner(System.in);
		int H, W, K;
		
		H = in.nextInt();
		W = in.nextInt();
		K = in.nextInt();
		
		String[] colors = new String[H];
		int total = 0;
		for(int i = 0; i < H; ++i) { 
			colors[i] = in.next();
			for(int j = 0; j < W; ++j)
				if(colors[i].charAt( j ) == '#') ++total;
		}

		int ans = 0;
		for(int i = 0; i < Math.pow(2, H); ++i) {
			for(int j = 0; j < Math.pow(2,  W); ++j) {
//				System.out.printf("%d %d\n", i, j);
				
				
				boolean[][] mat = new boolean[H][W];
				int cnt = 0;
				for(int row = 0; row < H; ++row) {
					if( (i & (1 << row)) > 0 ) {
						for(int ii = 0; ii < W; ++ii)
							if(colors[row].charAt(ii) == '#') {
								++cnt;
								mat[row][ii] = true;
							}
					}
				}
				
				
				for(int col = 0; col < W; ++col) {
					if( (j & (1 << col)) > 0) {
						for(int ii = 0; ii < H; ++ii) {
							if(mat[ii][col] == false && colors[ii].charAt(col) == '#')
								++cnt;
						}
					}
				}
				
				if(total - cnt == K)
					++ans;
			}
		}
		
		System.out.println(ans);

	}

}


Measured memory_bytes: 29180
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define SIZE 1000000
//リストのノード（スタック内の各データ）の定義
typedef struct node{
    char elem;
    struct node *next;
} node;

//スタックにデータを追加
void push(node **first, char elem){
    //追加する分の領域を確保
    node *new = calloc(1, sizeof(node));
    if(new == NULL) exit(1);
    new->elem = elem;
    new->next = *first;
    *first = new;
}

//スタックからデータを取り出す
char pop(node **first){
    char elem;
    node *tmp = *first;
    if(tmp == NULL) exit(1);
    elem = tmp->elem;
    *first = tmp->next;
    //取り出したノードのメモリを解放
    free(tmp);
    return elem;
}
void free_stack(node **first)
{
    node *tmp = *first, *next;
    while (tmp != NULL)
    {
        next = tmp->next;
        free(tmp);
        tmp = next;
    }
}

int main(void){
    char cube[SIZE];
    char under_cube;
    int i,count = 0,answer = 0;
    scanf("%s",cube);
    //最初のノードの指す先
    node *first = NULL;
    /* 文字の数だけループ */
    for ( i = 0; i < strlen(cube); i++)
    {
        if (count == 0)
        {
            /* stackがからの場合、挿入 */
            push(&first,cube[i]);
            count += 1;
        }
        else
        {
            if (first->elem == cube[i])
            {
                /* 1か0が連続している場合、stackに追加 */
                push(&first,cube[i]);
                count += 1;
            }
            else
            {
                /* 連続していない場合は、追加せず */
                answer += 2;
                pop(&first);
                count -= 1;
            }
            
        }
        
    }
    free_stack(&first);
    printf("%d\n",answer);
    return 0;
}


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

struct P
{
    int x,y;

    bool operator<(const P &a)const{
        if(x!=a.x) return x>a.x;
        return y<a.y;
    }
};


vector<P> v[1];
vector<int> v1;
//bitset<4001000> b;
int i,n,m,k,a,d,b,c;
int e;
int o[211111];
int l[211111];
int j[1];

int dx[10]={0,1,0,-1,1,1,-1,-1},dy[10]={1,0,-1,0,1,-1,1,-1},dz[10]={0,0,0,0,1,-1};
int px[10]={-1,1,1,-1,1,1,-1,-1},py[10]={1,1,-1,-1,1,-1,1,-1};
long long mod=1000000007,mod2=1000000009,mod3=2017;
long long x,z,y;
double pi=3.14159265;
P u[1];
stack<int> s;
//set<int> se[33],s1;

//priority_queue<P> q[2];
queue<int> q;
//string r,r1;

char r[211111];
//2147483647
//'1'==49;
//'A'==65;
//'a'==97;
//unordered_
map<int,int> p;
//v.resize(unique(v.begin(),v.end())-v.begin());

bool as(P a,P b)
{
    //if(a.x!=b.x)
    return a.x<b.x;

}


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


int main()
{
    scanf("%d %d %d %d %d",&e,&a,&b,&c,&d);
    scanf("%s",r+1);
    if(c>d)
    {
        for(int t=b;t<=d;t++)
        if(r[t-1]==r[t]&&r[t]==r[t+1]&&r[t]=='.')
        {
            goto qwe;
        }
        puts("No");
        return 0;
        qwe:;
    }
    //else
    {
        o[a]=l[b]=1;
        for(int t=a+1;t<=c;t++)
            if(r[t]=='.'&&(o[t-1]||(t>2&&o[t-2])))
            o[t]=1;
        for(int t=b+1;t<=d;t++)
            if(r[t]=='.'&&(l[t-1]||(t>2&&l[t-2])))
            l[t]=1;
        if(l[d]&&o[c]) puts("Yes");
        else puts("No");
    }
}




Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
int main(void){
    long long int q,h,s,d,n;
    cin>>q>>h>>s>>d>>n;
    long long int ans1=0;
    ans1+=(n/2)*d;
    if (n%2!=0) {
        ans1+=min(q*4,min(h*2,s));
    }
    long long int ans2=s*n;
    long long int ans3=h*2*n;
    long long int ans4=q*4*n;
    cout<<min(ans1,min(ans2,min(ans3,ans4)))<<endl;
}

Measured memory_bytes: 3592
#include<stdio.h>
int main(void)
{
	int i,j,n[10],w;
	for(i=0;i<10;i++){
		scanf("%d",&n[i]);
	}
	for(i=0;i<10;i++){
		for(j=0;j<=10;j++){
			if(n[j]<=n[i]){
				w=n[i];
				n[i]=n[j];
				n[j]=w;
			}
		}
	}
	for(i=0;i<3;i++){
		printf("%d\n",n[i]);
	}
	return 0;
}

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

const int MAX = 100;

int main()
{
	int n, temp, j;
	int A[100];

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

	if(n == 1)
	{
		cout << A[0] << endl;
		return 0;
	}

	for(int k = 0; k < n-1; k++)
		{
			cout << A[k] << ' ';
		}
	cout << A[n-1] << endl;

	for(int i = 1; i < n; i++)
	{
		j = i-1;
		temp = A[i];
		while(j >= 0 && A[j] > temp)
		{
			A[j+1] = A[j];
			j--;
		}
		A[j+1] = temp;

		for(int k = 0; k < n-1; k++)
		{
			cout << A[k] << ' ';
		}
		cout << A[n-1] << endl;
	}

	return 0;
}


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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ull mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

template<class S, class T> ostream& operator << (ostream& os, const pair<S, T> v){
  os << "(" << v.first << ", " << v.second << ")"; return os;
}
template<class T> ostream& operator << (ostream& os, const vector<T> v){
  for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << " ";} os << v[i];} return os;
}
template<class T> ostream& operator << (ostream& os, const vector<vector<T>> v){
  for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os;
}

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

    ll A, B, C;
    cin >> A >> B >> C;
    cout << (A+B+C>=22 ? "bust" : "win") << endl;
    return 0;
}

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

using namespace std;
int main(){
    long N,K;
    cin >> N >> K;

    long *logs = new long[N];
    long all_len=0;
    for (long i = 0; i < N; ++i) {
        long buf;
        cin >> buf;
        logs[i] = buf;
        all_len += buf;
    }

    long *div_is = new long[N];
    long div_i_cnt = K;

    double unit = (double) all_len / (K+N);
    for(int i = 0; i < N; ++i)  {
        long div_i = ((long) (logs[i] / unit)) - 1;
        if (div_i < 0) div_i = 0;
        div_is[i] = div_i;
        div_i_cnt -= div_i;
    }

    vector<double> divd_len;
    for(int i = 0; i < N; ++i)  {
        long bo = div_is[i] + 1;
        double len = (double) logs[i] / bo;
        divd_len.push_back(len);
    }

    sort(divd_len.begin(), divd_len.end());

    long ans = ceil(divd_len[N-div_i_cnt-1]);
    cout << ans << endl;

    return 0;
}



Measured memory_bytes: 8328
N,K = map(int, input().split())
A = list(map(int, input().split()))

mv = 0
i = 1
B = [1]
visit = [0]*N
visit[0] = 1
while True:
    i = A[i-1]
    mv += 1
    B.append(i)
    if mv == K:
        break
    elif visit[i-1] == 1:#ループ処理
        st = B.index(i)
        sa = mv - st
        break
    visit[i-1] = 1
        
if mv == K:
    print(i)
else:
    print(B[st + (K-st)%sa])

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

#define MOD 1000000007

long long myPow(long long x, long long n, long long m){
  long long result = 1;
  for(int i = 0; i < n; i++){
    result *= x;
    result = result % m;
  }
  return result;
}

int main()
{
	int n;
    cin >> n;
    long long u = myPow(10, n, MOD), ne09 = myPow(8,n,MOD), e0 = u - myPow(9, n, MOD), e9 = u - myPow(9, n, MOD);

    if(e0 < 0)e0 += MOD;
    if(e9 < 0)e9 += MOD;

    //cout << u << " " << ne09 << " " << e0 << " " << e9 << endl;
    long long ans = ((ne09 + e0) % MOD + e9) % MOD - u;
    if(ans < 0)ans += MOD;
    cout << ans << endl;
}

Measured memory_bytes: 3624
import java.util.*;
public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		String a = scan.next();
		String b = scan.next();
		String c = scan.next();
		char x = a.charAt(0);
		char y = b.charAt(0);
		char z = c.charAt(0);
		String p = String.valueOf(x);
		String t = String.valueOf(y);
		String w = String.valueOf(z);
		String l = p.toUpperCase();
		String m = t.toUpperCase();
		String n = w.toUpperCase();

				System.out.println(l+m+n);
	}
}

Measured memory_bytes: 21844
#include <iostream>

using namespace std;

int main() {

	double n;

	while(cin >> n) {
		if(n<=48.00) 
			cout << "light fly" << endl;
		else if(n<=51.00)
			cout << "fly" << endl;
		else if(n<=54.00)
			cout << "bantam" << endl;
		else if(n<=57.00)
			cout << "feather" << endl;
		else if(n<=60.00)
			cout << "light" << endl;
		else if(n<=64.00)
			cout << "light welter" << endl;
		else if(n<=69.00)
			cout << "welter" << endl;
		else if(n<=75.00)
			cout << "light middle" << endl;
		else if(n<=81.00)
			cout << "middle" << endl;
		else if(n<=91.00)
			cout << "light heavy" << endl;
		else
			cout << "heavy" << endl;
	}

	return 0;

}

Measured memory_bytes: 0
io = STDIN
x=io.gets.to_i
cand=[]
120.times.each do |i|
  cand << [i,i**5]
end
hash={}
cand.product(cand).each do |x,y|
  a,aa=x
  b,bb=y
  if a>=b
    hash[aa+bb]=[a,-b]
    hash[aa-bb]=[a,b]
  else
    hash[aa+bb]=[b,-a]
    hash[bb-aa]=[b,a]
  end
end
puts hash[x].join(" ")


Measured memory_bytes: 16488
#include <cassert>
#include <algorithm>
#include <array>
#include <bitset>
#include <cctype>
#include <cstdint>
#include <cmath>
#include <complex>
#include <chrono>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>
#include <random>
#include <memory>
#include <utility>
#include <limits>
 
#define rep(i, a, b) for (long long i = (a); (i) < (b); (i)++)
#define all(i) i.begin(), i.end()
#define debug(...) std::cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

void debug_out(){std::cerr<<std::endl;}

template<typename Head,typename... Tail>
void debug_out(Head h,Tail... t){
  std::cerr<<" "<<h;
  debug_out(t...);
}
 
template <typename T1, typename T2>
std::ostream& operator<<(std::ostream& os, std::pair<T1, T2> pa) {
  return os << pa.first << " " << pa.second;
}
 
template <typename T>
std::ostream& operator<<(std::ostream& os, std::vector<T> vec) {
  for (int i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
  return os;
}
 
template<typename T1,typename T2>
inline bool chmax(T1& a,T2 b){return a<b && (a=b,true);}
 
template<typename T1,typename T2>
inline bool chmin(T1& a,T2 b){return a>b && (a=b,true);}
 
long long pow_mod(long long a, long long b, long long mod=-1) {
  if(b==0)return 1;
  if ((a == 0)||(mod!=-1&&(a+mod)%mod==0))return 0;
  long long x = 1;
  while (b > 0) {
    if (b & 1)x = (mod!=-1)?(x * a) % mod:x*a;
    a = (mod!=-1)?(a * a) % mod:a*a;
    b >>= 1;
  }
  return x;
}

// const long long MOD = 998244353;
const long long MOD = 1e9 + 7;

using ll = long long;
using P=std::pair<long long,long long>;

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

  std::string s;
  std::cin>>s;

  if(s[0]==s[1]||s[1]==s[2]||s[2]==s[3])std::cout<<"Bad\n";
  else std::cout<<"Good\n";

  return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll N=1e5+5,mod=1e9+7;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll w,h;cin>>w>>h;
    vector< pair<ll,ll> > a;
    for(ll i=0;i<w;i++){
        ll x;cin>>x;
        a.push_back({x,0});
    }
    for(ll i=0;i<h;i++){
        ll x;cin>>x;
        a.push_back({x,1});
    }
    sort(a.begin(),a.end());
    ll ans=0;
    w+=1;
    h+=1;
    for(auto &ele:a){
        if(ele.second==1)ans+=w*ele.first,h--;
        else ans+=h*ele.first,w--;
    }
    cout<<ans;
}

Measured memory_bytes: 6512
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin>>n;
	map<string,int> m;
	string s;
	for(int i=1;i<=n;i++)
	{
		cin>>s;
		m[s]++;
	}
	cout<<"AC x "<<m["AC"]<<endl;
	cout<<"WA x "<<m["WA"]<<endl;
	cout<<"TLE x "<<m["TLE"]<<endl;
	cout<<"RE x "<<m["RE"]<<endl;
	return 0;
}

Measured memory_bytes: 3632
#include <stdio.h>
int main(void){
    int W, H, x, y, r;
    scanf("%d %d %d %d %d", &W, &H, &x, &y, &r);
    
    if ( x-r < 0 || x+r > W || y-r < 0 || y+r > H )
    printf("No\n");
    
    else 
    printf("Yes\n");

    return 0;
}



Measured memory_bytes: 2104
N=int(input())
X=input()

def solve(x): #10進数
    ret=0
    while x>0:
        pop=bin(x).count("1")
        x%=pop
        ret+=1
    return ret

mod=X.count("1") #>0
original_plus=0
original_minus=0
for i in range(N):
    if X[N-1-i]=="1":
        if mod>1:
            original_minus+=pow(2,i,mod-1)
        original_plus+=pow(2,i,mod+1)
for i in range(N):
    if X[i]=="0":
        tmp=original_plus+pow(2,N-1-i,mod+1)
        tmp%=mod+1
        print(solve(tmp)+1)
    else:
        if mod==1:
            print(0)
            continue
        tmp=original_minus-pow(2,N-1-i,mod-1)
        tmp%=mod-1
        print(solve(tmp)+1)


Measured memory_bytes: 9380
def main():
    N,K=map(int,input().split())
    h=list(map(int,input().split()))
    ans=[0]*N
    ans[1]=abs(h[1]-h[0])
    for i in range(2,N):
        ans[i]= min(abs(h[i]-h[j])+ans[j] for j in range(max(0,i-K),i))
    print(ans[-1])
main()

Measured memory_bytes: 13980
n, m = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(m)]

from collections import defaultdict
graph = defaultdict(list)
for i in range(m):
    a = ab[i][0] - 1
    b = ab[i][1] - 1
    graph[a].append(b)
    graph[b].append(a)

dist = [float('inf')] * n
dist[0] = 0

stack = []
for target in graph[0]:
    dist[target] = 1
    stack.append(target)

for s in stack:
    for target in graph[s]:
        dist[target] = min(dist[target], 2)

if dist[n - 1] <= 2:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')


Measured memory_bytes: 89520
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <sstream>
#include <math.h>
#include <queue>
#include <map>
#include <set>
#include <ios>     // std::left, std::right
#include <iomanip> // std::setw(int), std::setfill(char)
using namespace std;


int main(){
int N,K;
cin>>N>>K;
long long V[N];
long long v;
for(int i=0;i<N;++i){
  cin>>v;
  V[i]=v;
}
long long left[N+1]={};
long long right[N+1]={};
long long tmp_left=0;
long long tmp_right=0;
for(int i=0;i<N;++i){
  tmp_left+=V[i];
  tmp_right+=V[N-1-i];
  left[i+1]=tmp_left;
  right[i+1]=tmp_right;
}
long long ans=0;
long long tmp=0;
long long limit;
limit=min(N,K);
long long keep=0;
long long limit_min;
limit_min=0;
int a;
//Aの全探索
for(int i=0;i<=limit;++i){
  //Bの全探索
  for(int j=0;j<=limit-i;++j){
    keep=0;
    keep+=left[i];
    keep+=right[j];
    vector<long long> vv;
    for(int k=0;k<i;++k){
      vv.push_back(V[k]);
    }
    for(int l=0;l<j;++l){
      vv.push_back(V[N-1-l]);
    }
    sort(vv.begin(),vv.end());
    a=vv.size();
    limit_min=min(K-(i+j),a);
    for(int m=0;m<limit_min;++m){
      if(vv[m]>=0){break;}
      keep=keep-vv[m];
    }
    ans=max(ans,keep);
  }
}
cout<<ans<<"\n";
return 0;
}

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

int main()
{
    int n;
    cout << fixed << setprecision(8);

    while (cin >> n, n) {
        vector<double> S(n);
        double sum = 0, Sum = 0;
        for (auto &s: S) {
            cin >> s;
            sum += s;
        }
        double m = sum / n;
        for (auto s: S)
            Sum += pow(s - m, 2);

        cout << sqrt(Sum / n) << endl;
    }

    return 0;
}


Measured memory_bytes: 3260
#include <bits/stdc++.h>
using namespace std;
int main(void){
    string s;
    cin >> s;
    int n = s.size(),ans=0;
    for(int i=0;i<n;i++){
        for(int j=i;j<n;j++){
            int flag = 1;
            for(int k=i;k<=j;k++){
                if(!(s[k]=='A'||s[k]=='T'||s[k]=='G'||s[k]=='C')) flag = 0;
            }
            if(flag) ans = max(ans,j-i+1);
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3604
def big(a, b, c):
    if a>=b and a>=c:
        g = a
    elif b>=a and b>=c:
        g = b
    else:
        g = c

    return g


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

a, b, c = n[0], n[1], n[2]
g1, g2 = 0, 0

g1 = big(a, b, c)
if g1 == a:
    a = 0
elif g1 == b:
    b = 0
else:
    c = 0

g2 = big(a, b, c)
if g2 == a:
    a = 0
elif g2 == b:
    b = 0
else:
    c = 0

num = g1*10 + g2 + a + b + c

print(num)


Measured memory_bytes: 3064
#include<stdio.h>
int main(void)
{
  int a,b;
  scanf("%d",&a);
  scanf("%d",&b);
  if(a == b){
    printf("Draw");
  }
  else if(a==1 && a < b){
    printf("Alice");
  }
  else if(b==1 && a > b){
    printf("Bob");
  }
  else if(a > b){
    printf("Alice");
  }
  else if(a < b){
    printf("Bob");
  }
  return 0;
}

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

int main() {
    int K, N;
    cin >> K >> N;
    vector<int> A(N);
    for(int i = 0; i < N; i++) {
        cin >> A.at(i);
    }

    int max_d = 0;
    int d;
    for(int i = 0; i < N; i++) {
        if(i == N - 1) {
            d = K - A.at(i) + A.at(0);
        } else {
            d = A.at(i + 1) - A.at(i);
        }
        max_d = max(max_d, d);
    }

    cout << (K - max_d) << endl;
    return 0;
}

Measured memory_bytes: 1024
import java.util.ArrayList;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO ?????????????????????????????????????????????
		Scanner sc = new Scanner(System.in);
		String W = sc.nextLine();
		W = W.toLowerCase();

		ArrayList<String> T = new ArrayList<String>();
		String kari = "";
		int ts = 0;

		while (true) {
			kari = sc.nextLine();
			if (kari.equals("END_OF_TEXT")) {
				break;
			}
			T.add(kari.toLowerCase());
			ts++;
		}

		int answer = 0;

		for (int i = 0; i < ts; i++) {
			
			String[] str = T.get(i).split(" ");
			for (int j = 0; j < str.length; j++) {
				if (str[j].equals(W)) {
					answer++;
				}
			}

		}
		
		System.out.println(answer);
	}

}

Measured memory_bytes: 26056
#include<bits/stdc++.h>
using namespace std;
 
int main(){
  int n,k;
  cin>>n>>k;
  long long a[n];
  for(int i=0;i<n;i++) cin>>a[i];
  
  long long ans=0,time=1000000000;
  for(int i=0;i<n-k+1;i++){
    if(a[k-1+i]<=0) ans=abs(a[i]);
    else if(a[i]>=0) ans=a[k-1+i];
    else ans=max(abs(a[i]),a[k-1+i])+2*min(abs(a[i]),a[k-1+i]);
    time=min(ans,time);
  }
  cout<<time<<endl;
}

Measured memory_bytes: 1152
import sys,heapq

input=sys.stdin.readline

for _ in range(int(input())):
    N=int(input())
    camelL=[]
    camelR=[]
    ans=0
    for i in range(N):
        k,l,r=map(int,input().split())
        if l<r:
            camelR.append((N-k,r-l))
            ans+=l
        elif l>r:
            camelL.append((k,l-r))
            ans+=r
        else:
            ans+=l
    camelL.sort()
    que=[]
    for i in range(len(camelL),0,-1):
        while camelL and camelL[-1][0]>=i:
            id,val=camelL.pop()
            heapq.heappush(que,(-val,id))
        if que:
            val,id=heapq.heappop(que)
            ans-=val
    camelR.sort()
    que=[]
    for i in range(len(camelR),0,-1):
        while camelR and camelR[-1][0]>=i:
            id,val=camelR.pop()
            heapq.heappush(que,(-val,id))
        if que:
            val,id=heapq.heappop(que)
            ans-=val
    print(ans)

Measured memory_bytes: 96996
#pragma GCC optimize("Ofast")
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define PI 3.141592
#define MOD7 1000000007
#define LL_INF 9000000000000000000
#define LL_MINF -9000000000000000000
#define INT_INF 2000000000
#define INT_MINF -2000000000
#define all(a) (a).begin(), (a).end()
#define fi first
#define se second
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

int main(){
    int N;
    cin >> N;
    vector<int> P(N);
    for(int i = 0; i < N; i++) cin >> P[i];
    int min_p = INT_INF;
    int count = 0;
    for(int p : P){
        if(p <= min_p){
            count++;
            min_p = p;
        }
    }
    cout << count << endl;
}


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

#define INF 1e9
#define llINF 1e18
#define MOD 1e9+7
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
using namespace std;
int main(){
  int a,b,c;
  string s1,s2;
  cin>>a>>b;
  int ans=-INF;
  ans=max(ans,a+b);
  ans=max(ans,a-b);
  ans=max(ans,a*b);
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <stdlib.h>
#include <string>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define inf 1001001001
#define mod 1000000007
#define pi 3.141592653589793
ll gcd(ll a,ll b){
    if(b>a) swap(a,b);
    ll r=a%b;
    while(r!=0){
        a=b;
        b=r;
        r=a%b;
    }
    return b;
}

int main(){
    string s;
    cin >> s;
    int l=s.length();
    int ans0=0,ans1=0;
    rep(i,l){
        if(i%2==0){
            if(s[i]=='1') ans0++;
            else ans1++;
        }
        else{
            if(s[i]=='1') ans1++;
            else ans0++;
        }
    }
    cout << min(ans0,ans1) << endl;

    return 0;
}

Measured memory_bytes: 512
use std::io;
use std::f64::consts::PI;

fn get_line() -> String {
  let mut line = String::new();
  io::stdin()
    .read_line(&mut line)
    .ok();
  line
}

fn line_to_vec_i64(line: &str) -> Vec<f64> {
  line
    .trim()
    .split_whitespace()
    .map(|s| { s.parse::<f64>().unwrap_or(0f64) })
    .collect()
}

fn main() {
  let line = get_line();
  let v = line_to_vec_i64(&line);
  let r = v[0];
  println!("{} {}", PI * r * r, 2.0 * PI * r);
}



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

int main(){
    int n, tmp;
    long long ans=0;
    scanf("%d",&n);
    vector<int>a(n+1);
    vector<int>b(n);
    for(int i=0; i<n+1; i++){
        cin >> a[i];
    }
    for(int i=0; i<n; i++){
        cin >> b[i];
    }
    for(int i=0; i<n; i++){
        if(b[i]<=a[i]){
            ans += b[i];
        }else{
            ans += a[i];
            b[i] -= a[i];
            ans += min(b[i], a[i+1]);
            a[i+1] -= min(b[i],a[i+1]);
        }
    }
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 3992
package main

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

func solve() {
	s := []int{1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51}
	k := getInt()

	ans := s[k-1]
	fmt.Fprintln(wr, ans)
}

// -----------------------------------------

const (
	inf = 1 << 60
	// mod = 1000000007
)

var (
	sc = bufio.NewScanner(os.Stdin)
	wr = bufio.NewWriter(os.Stdout)
)

func main() {
	maxBufSize := int(1e8)
	sc.Buffer(make([]byte, 4096), maxBufSize)
	sc.Split(bufio.ScanWords)
	solve()
	wr.Flush()
}

func getInt() (ret int) {
	sc.Scan()
	ret, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return
}

func getIntSlice(n int) (ret []int) {
	ret = make([]int, n)
	for i := range ret {
		ret[i] = getInt()
	}
	return
}

func getString() (ret string) {
	sc.Scan()
	ret = sc.Text()
	return
}

func getRunes() (ret []rune) {
	ret = []rune(getString())
	return
}


Measured memory_bytes: 640
/*
for (int i = 0; i < N; ++i){}

// 各桁の和を計算する関数
int findSumOfDigits(int n) {
  int sum = 0;
  while (n > 0) { // n が 0 になるまで
    sum += n % 10;
    n /= 10;
  }
  return sum;
}

sort(a, a + N, greater<int>());  // a[0:N] を大きい順にソート

int num[110] = {0};  // バケット
for (int i = 0; i < N; ++i) {
    num[d[i]]++;  // d[i] が 1 個増える
}

map<string, int> mp; // 連想配列 map<キー型, 値型> オブジェクト名
for (int i = 0; i < N; ++i) {
    auto itr = mp.find(s[i]);        // s[i] が設定されているか？
    if(itr != mp.end() ) {
         mp[s[i]] += 1;
    }
    else {
         mp[s[i]] += 1 ;
    }
}
stack<int> s;	//intをデータとするスタックを用意
s.push(1);		//{} -> {1}
printf("%d\n", s.top());	// 3
s.pop();

queue<int> que;	//intをデータとするキューを用意
que.push(1);		//{} -> {1}
printf("%d\n", que.front());	// 1
que.pop();
*/
#include <iostream>
#include <set>
#include <map>
#include <string>
#include <math.h>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <bitset>

using namespace std;

// #define for(i,a,b) for (int i=(a);i<(b);++i)
typedef long long ll;
typedef pair<int,int> point;
#define rep(i,n) for(i,0,n)

// int 
// // 各桁の和を計算する関数
// int findSumOfDigits(int n) {
//   int amari = 0;
//   int keta = 0;
//   while (n > 0) { // n が 0 になるまで
//     amari += n % 2;
//     if (keta%2==0)
//     n /= 10;
//   }
//   return sum;
// }
 
 

int main() {
	// 入力
	ll N;
	cin >> N;
	ll A[N], B[N];
	for (ll i = 0; i < N; ++i) cin >> A[i] >> B[i];
 
	// 解法
	ll saikai = 0;
	ll ans = 0;
	for (int i = 0; i < N; ++i) {
		if (A[i]>saikai){
			saikai = A[i];
			ans = A[i] + B[i];
		}
	}
	
	//出力
	printf("%lld\n", ans); // lld としないとオーバーフローする
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define  rep(i,a,b)for(int i=a;i<b;++i)
#define  rrep(i,a,b)for(int i=a;i>=b;--i)
#define  yesno(flag)if(flag)cout<<"Yes"<<endl; else cout<<"No"<<endl;
using namespace std;
typedef long long ll;
const int INF=1000000000LL;
const ll r197=1000000007;
typedef pair<int,int>P;
typedef pair<int,P>Pa;


int main() {
	ll n,t;
	cin>>n>>t;
	int a=10000;
	for(int i=0;i<n;++i){
		int b,c;
		cin>>b>>c;
		if(c<=t){
			a=min(a,b);
		}
	}
	if(a==10000)cout<<"TLE"<<endl;
	else cout<<a<<endl;
	return 0;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <utility>
#include <numeric>

using namespace std;

using ll = long long;
using ull = unsigned long long;

const ll inf = (ll)1e9;
const ll mod = (ll)1e9 + 7;

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

	int n;
	cin >> n;

	vector<ll> h(n);
	for (int i = 0; i < n; i++)
	{
		cin >> h.at(i);
	}

	int res = 0;
	int cnt = 0;
	for (int i = n - 1; i > 0; i--)
	{
		if (h.at(i) <= h.at(i - 1))
		{
			cnt++;
		}
		else
		{
			cnt = 0;
		}

		res = max(res, cnt);
	}

	cout << res << endl;
}

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

int main()
{
	int i, n;
	int money=100000;
	
	cin >> n;
	
	for(i=1; i<=n; i++){
		money *= 1.05;
		money = (money+999) / 1000 * 1000;
	}
	cout << money << endl;
		
	return 0;
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N,M;
  cin >> N >> M;
  vector<int>vec(N);
  for(int i=0; i<M; i++){
    int A,B;
    cin >> A >> B;
    vec[A-1]++;
    vec[B-1]++;
  }
  for(int i=0; i<N; i++){
    cout << vec[i] << endl;
  }
}

Measured memory_bytes: 3580
n = int(input())
a = list(map(int,input().split()))
b =[]
countmax = 0
countmin = 0

for i in range(n):
    b.append(a[i]//400)
for i in range(13):
    if b.count(i) >=1:
        if i<= 7:
            countmax +=1
            countmin +=1
        else:
            countmax += b.count(i)
print(max(1,countmin),countmax)

Measured memory_bytes: 3064
#include<iostream>
#define size(array) (sizeof(array) / sizeof(array[0]))
using namespace std;
int main(void){
  int a,b,c=0,d=0;
  cin >> a >> b;
  int dai[] = {1,3,5,7,8,10,12};
  int shou[] = {4,6,9,11};
  for(int i =0;i < size(dai);i++){
    if(dai[i] == a){
      c = 1;
    }else if(dai[i] == b){
      d = 1;
    }
  }
  for(int i =0;i < size(shou);i++){
    if(shou[i] == a){
      c = 2;
    }else if(shou[i] == b){
      d = 2;
    }
  }
  if(c == d){
      cout << "Yes" << endl;
  }else{
      cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
const ll LINF=0x1fffffffffffffff;
const int INF=0x3fffffff;
const int MOD=1000000007;
#define VAR(type,...) type __VA_ARGS__;in(__VA_ARGS__)
#define VEC(type,name,size) vector<type> name(size);each(x, name)in(x)
#define rep(i,a,b) for(int i=(a);i<(b);++i)
#define rrep(i,a,b) for(int i=(a-1);i>=(b);--i)
#define each(x,v) for(auto &x:(v))
#define all(x) (x).begin(),(x).end()
#define print(x) cout<<(x)<<endl
void in(){} template<class T,class... U> void in(T &t,U &...u){cin>>t;in(u...);}
void solve();
int main(){cin.tie(0);ios::sync_with_stdio(0);solve();}

void solve() {
  VAR(int, N);
  vl C(N - 1), S(N - 1), F(N - 1);
  rep(i, 0, N - 1) {
    in(C[i], S[i], F[i]);
  }

  rep(i, 0, N) {
    ll d = 0;
    rep(j, i, N - 1) {
      if (S[j] > d) {
        d = S[j];
      } else if (d % F[j]) {
        d += F[j] - d % F[j];
      }
      d += C[j];
    }
    print(d);
  }
}


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

using namespace std;

int cnt = 3;
vector<tuple<char, int, int, int>> ops;

int new_elem() { return cnt++; }
int add(int i, int j) {
   int k = new_elem();
   ops.emplace_back('+', i, j, k);
   return k;
}
int comp(int i, int j) {
   int k = new_elem();
   ops.emplace_back('<', i, j, k);
   return k;
}
int main() {
   ios_base::sync_with_stdio(false); cin.tie(nullptr);
   int a = 0;
   int b = 1;
   int zero = new_elem();
   int one = comp(zero, add(a, b));
   int a1 = add(a, one);
   int b1 = add(b, one);
   int cur_a = zero, cur_b = zero;
   vector<int> bits_a(30);
   vector<int> bits_b(30);
   for (int z = 29; z >= 0; --z) {
      int p2 = one;
      for (int i = 0; i < z; ++i) p2 = add(p2, p2);
      int cb = comp(add(cur_a, p2), a1);
      bits_a[z] = cb;
      for (int i = 0; i < z; ++i) cb = add(cb, cb);
      cur_a = add(cur_a, cb);
   }
   for (int z = 29; z >= 0; --z) {
      int p2 = one;
      for (int i = 0; i < z; ++i) p2 = add(p2, p2);
      int cb = comp(add(cur_b, p2), b1);
      bits_b[z] = cb;
      for (int i = 0; i < z; ++i) cb = add(cb, cb);
      cur_b = add(cur_b, cb);
   }
   for (int za = 0; za < 30; ++za) {
      for (int zb = 0; zb < 30; ++zb) {
         int val = comp(one, add(bits_a[za], bits_b[zb]));
         for (int z = 0; z < za + zb; ++z) val = add(val, val);
         ops.emplace_back('+', 2, val, 2);
      }
   }
   cerr << cnt << '\n';
   cout << int(ops.size()) << '\n';
   for (auto op : ops) {
      cout << get<0>(op) << ' ' << get<1>(op) << ' ' << get<2>(op) << ' ' << get<3>(op) << '\n';
   }
}


Measured memory_bytes: 3760
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <functional>
#include <tuple>
#include <climits>
#include <algorithm>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <set>
#include <numeric>
#include <map>
#include <cmath>
#include <cstdlib>
#include <iomanip>
#include <array>

using namespace std;

int main()
{
    string s;
    cin >> s;
    constexpr int alphabet_num = 'z'-'a'+1;
    array<int, alphabet_num> alphabet = {0};

    if(s.size() == 2) {
        if(s[0]!=s[1])
            cout << -1 << " " << -1 << endl;
        else
            cout << 1 << " " << 2 << endl;
        return 0;
    }
    if(s.size() == 3) {
        if(s[0]==s[1]) {
            cout << 1 << " " << 2 << endl;
        } else if(s[1] == s[2]) {
            cout << 2 << " " << 3 << endl;
        } else {
            cout << -1 << " " << -1 << endl;
        }
        return 0;
    }

    int start = 0, end = 2;
    char a[3] = {s[0], s[1], s[2]};
    int count = 0;
    bool s_=true, e_=true;
    while(true) {
        if(a[0] == a[1] || a[1] == a[2] || a[0]==a[2]) break;
        start++; end++;
        if(end >= s.size()) {
            start = -2;
            end = -2;
            break;
        }
        a[count%3] = s[end];
        count++;
    }
    cout << start+1 << " " << end+1 << endl;
}


Measured memory_bytes: 512
//#include <ext/pb_ds/assoc_container.hpp> // Common file
//#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
//#include <ext/pb_ds/detail/standard_policies.hpp>
#include<set>
#include<map>
#include <unordered_map>
#include <unordered_set>
#include<list>
#include<iomanip>
#include<cmath>
#include<string>
#include<vector>
#include<queue>
#include<stack>
#include<complex>
#include<sstream>
#include<iostream>
#include<fstream>
#include<algorithm>
#include<numeric>
#include<utility>
#include<functional>
#include<stdio.h>
#include<assert.h>
#include<memory.h>
#include<bitset>
#include<math.h>
#include <strings.h>



#define f first
#define s second
#define mp make_pair
#define pb push_back
#define lp(i,a,n) for(int i=a;i<=n;++i)
#define lpd(i,a,n) for(int i=a;i>=n;--i)
#define mem(a,b) memset(a,b,sizeof a)
#define all(v) v.begin(),v.end()
#define println(a) cout <<(a) <<endl
#define sz(x) ((int)(x).size())
#define readi(x) scanf("%d",&x)
#define read2i(x,y) scanf("%d%d",&x,&y)
#define read3i(x,y,z) scanf("%d%d%d",&x,&y,&z)
#define mod 1000000007
#define eps 1e-8
#define infi 1000000000
#define infll 2000000000000000000ll
#define mod1 100050001
#define mod2 100030001
#define base1 37
#define base2 31


using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef set<int> si;
typedef map<int,int> mii;


const int N = 102;

int a,b;
char grid[N][N];

int main() {
   
    scanf("%d%d",&a,&b);
   
    --a;
    int h = 1;
    
    
    lp(i, 1, N-2) grid[h][i] = '.';
    
    lp(i, 2, N-2) {

        lp(j, 1, N-2) grid[i][j] = '.';
        
        for(int j = 2 ; j < N-2 && b > 1 ; j += 2)
            --b, grid[i][j] = '#';

        ++i;
        lp(j, 1, N-2) grid[i][j] = '.';
        
        if(b <= 1) {
            h = i;
            break;
        }
    }
    
    --b, ++h;
    
    lp(i, 1, N-2) grid[h][i] = '#';
    
    if(a) {
        lp(i, h+1, N-2) {
            
            lp(j, 1, N-2)   grid[i][j] = '#';
            
            for(int j = 2; j < N-2 && a > 0 ; j += 2)
                --a,grid[i][j] = '.';
            
            
            
            if(!a) {
                h = i;
                break;
            }
            
            ++i;
            lp(j, 1, N-2) grid[i][j] = '#';
            
        }
    }
    
    assert(h <= N-2);
    printf("%d %d\n",h,N-2);
    lp(i, 1, h) {
        lp(j, 1, N-2) printf("%c",grid[i][j]);
        printf("\n");
    }
    
    return 0;
}






/*
 2 3 2
 0 0
 100 0
 0 100
 50 -1 48 3
 49 49 51 52
 4 4 4
 -100 0
 0 100
 0 -100
 100 0
 3 3 -2 -2
 -101 50 101 50
 -101 -101 101 -101
 -49 -50 49 -50
 5 6 4
 40 40
 60 10
 70 30
 60 80
 30 81
 20 40
 0 10 40 50
 10 61 30 61
 -100 90 200 90
 50 20 50 50

 */
//freopen("output.txt","w",stdout);
//freopen("input.txt","r",stdin);
//ios::sync_with_stdio(0);cin.tie(0);

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using lint     = long long;
const lint inf = 1LL << 60;
const lint mod = 1000000007;

struct mint {
    lint v;
    lint _mod;
    mint() : v(0) {}
    mint(signed v, lint _mod = mod) : v(v), _mod(_mod) {}
    mint(lint t, lint _mod = mod) : _mod(_mod) {
        v = t % _mod;
        if (v < 0)
            v += _mod;
    }

    mint pow(lint k) {
        mint res(1), tmp(v);
        while (k) {
            if (k & 1)
                res *= tmp;
            tmp *= tmp;
            k >>= 1;
        }
        return res;
    }
    static mint add_identity() { return mint(0); }
    static mint mul_identity() { return mint(1); }
    mint inv() { return pow(_mod - 2); }

    mint &operator+=(mint a) {
        v += a.v;
        if (v >= _mod)
            v -= _mod;
        return *this;
    }
    mint &operator-=(mint a) {
        v += _mod - a.v;
        if (v >= _mod)
            v -= _mod;
        return *this;
    }
    mint &operator*=(mint a) {
        v = v * a.v % _mod;
        return *this;
    }
    mint &operator/=(mint a) { return (*this) *= a.inv(); }

    mint operator+(mint a) const { return mint(v) += a; };
    mint operator-(mint a) const { return mint(v) -= a; };
    mint operator*(mint a) const { return mint(v) *= a; };
    mint operator/(mint a) const { return mint(v) /= a; };

    mint operator-() const { return v ? mint(_mod - v) : mint(v); }

    bool operator==(const mint a) const { return v == a.v; }
    bool operator!=(const mint a) const { return v != a.v; }
    bool operator<(const mint a) const { return v < a.v; }
};
ostream &operator<<(ostream &os, mint m) { return os << m.v; }

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<lint> t(n), a(n);
    for (int i = 0; i < n; ++i) {
        cin >> t[i];
    }
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }
    if (n == 1) {
        if (t[0] != a[0]) {
            cout << 0 << "\n";
        } else {
            cout << 1 << "\n";
        }
        return 0;
    }
    vector<bool> fix(n, false);
    fix[0] = fix[n - 1] = true;
    for (int i = 1; i < n; ++i) {
        if (t[i] > t[i - 1]) {
            fix[i] = true;
            if (t[i] > a[i]) {
                cout << 0 << "\n";
                return 0;
            }
        }
    }
    for (int i = n - 2; i >= 0; --i) {
        if (a[i] > a[i + 1]) {
            if (fix[i] && a[i] != t[i]) {
                cout << 0 << "\n";
                return 0;
            }
            fix[i] = true;
            if (a[i] > t[i]) {
                cout << 0 << "\n";
                return 0;
            }
        }
    }
    mint ret = 1;
    for (int i = 0; i < n; ++i) {
        if (!fix[i]) {
            ret *= min(a[i], t[i]);
        }
    }
    cout << ret << "\n";
    return 0;
}

Measured memory_bytes: 1792
N = int(input())
H = list(map(int, input().split()))
H.reverse()
def main():
  for i in range(N-1):
    if (H[i+1] - H[i] >= 2):
      print("No")
      return
    if (H[i+1] - H[i] == 1):
      H[i+1] -= 1
  print("Yes")

main()

Measured memory_bytes: 85328
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-9;
const ll mod=1e9+7;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

int a[4];

int main(){
	for(int i=0;i<6;i++){
		int t;
		cin>>t;
		a[t-1]++;
	}
	sort(a,a+4);
	if(a[0]==1&&a[1]==1&&a[2]==2&&a[3]==2) cout<<"YES"<<endl;
	else cout<<"NO"<<endl;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES

#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cmath>
#include <bitset>
using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;



const int BIG_NUM = 1e9;
const ll INF = 1000000000000000000;
const ll MOD = 1e9 + 7;

ll gcd(ll a, ll b) {
	if (a > b) {
		swap(a, b);
	}

	if (a == 0) {
		return b;
	}

	return gcd(b % a, a);
}

ll pow(int k) {
	ll p = 2;
	ll a = 1;

	for (int i = 0; i < 32; i++) {
		if (((k >> i) & 1) == 1) {
			a = (a * p) % MOD;
		}
		p = (p * p) % MOD;
	}
	return a;
}

int main() {
	string s;
	cin >> s;
	
	int r = 0;
	int l = s.length() - 1;

	int cnt = 0;
	while (r < l) {
		if (s[r] == s[l]) {
			r++;
			l--;
			continue;
		}

		if (s[r] == 'x') {
			cnt++;
			r++;
			continue;
		}

		if (s[l] == 'x') {
			cnt++;
			l--;
			continue;
		}

		cout << -1 << endl;
		return 0;
	}

	cout << cnt << endl;
	
	
}


Measured memory_bytes: 3708
#include <bits/stdc++.h>
using namespace std;
/*2進数配列+1*/
vector<int> two(vector<int> v, int N){
    v[N-1]+=1;
    int ind = N-1;
    int j=N-1;
    for(j=N-1;j>=1;j--){
        //cout << j << endl;
        if(v[j]>1){
            v[j-1]+=1;
            v[j]=0;
        }
    }
    /*for(j=0;j<N;j++){
        cout << "v" << v[j];
    }
    cout << endl;*/
    return v;
}

int main() {
    int N;
    cin >> N;
    vector<int> w(N);
    int T=0,sum;
    for(int i=0;i<N;i++){
        cin >> w[i];
        T += w[i];
    }
    sum = T;
    T /= 2;
    int S11=0,S21=0,S12=0,S22=0,ans=0,ans1=0,ans2=0;
    for(int i=0;i<N;i++){
        S11+=w[i];
        if(T<=S11){
            break;
        }
    }
    S21 = sum - S11;
    reverse(w.begin(),w.end());
    for(int i=0;i<N;i++){
        S22+=w[i];
        if(T<=S22){
            break;
        }
    }
    S12 = sum - S22;
    ans1 = abs(S11-S21);
    ans2 = abs(S22-S12);
    if(ans1>ans2){
        ans = ans2;
    }else{
        ans = ans1;
    }
    cout << ans << endl;
}

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

int main(){
	string s1,s2;
	cin >> s1 >> s2;
	bool flag = true;
	for(int i = 0;i < 3;i++) if(s1[i] != s2[2 - i]) flag = false;
	if(flag) cout << "YES" << endl;
	else cout << "NO" << endl;
	return 0;
}

Measured memory_bytes: 256
import sys
f = sys.stdin

for line in f:
    c = sorted(list(map(int, line.strip().split(','))))
    if c[0] == c[3] or c[1] == c[4]:
        print('four card')
    elif (c[0] == c[2] and c[3] == c[4]) or (c[0] == c[1] and c[2] == c[4]):
        print('full house')
    elif c[0] == c[2] or c[1] == c[3] or c[2] == c[4]:
        print('three card')
    else:
        cnt = 0
        for i in range(4):
            if c[i] == c[i + 1]:
                cnt += 1
        if cnt == 2:
            print('two pair')
        elif cnt == 1:
            print('one pair')
        elif c == [1,10,11,12,13] or c[0] == c[1] - 1 == c[2] - 2 == c[3] - 3 == c[4] - 4:
            print('straight')
        else:
            print('null')

Measured memory_bytes: 6752
#include <cmath>
#include <iostream>
#include <functional>
#include <string>
#include <sstream>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <iomanip>
#include <math.h>
#include <list>
#include <numeric>
using namespace std;

long long combi(long long n, long long k) {
  if (n == k || k == 0)
    return 1;
  else {
    return combi(n - 1, k - 1) + combi(n - 1, k);
  }
}

long long gcd(int a, int b){
  if (a%b == 0){
    return(b);
  }
  else{
    return(gcd(b, a%b));
  }
}

int main(){    
  string S,T;
  cin >> S >> T;

  if(S == T.erase(T.size()-1)){
     cout << "Yes"  << endl;
     return 0;
  }
  
 
  cout <<  "No"  << endl;
  
}
 


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

int main() {
  int x,y;
  cin>>x>>y;
  if(y%2==1)cout<<"No"<<endl;
  else{
    if(2*x<=y&&y<=x*4)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
  }
}

Measured memory_bytes: 3620
#include <cstdio>
#include <algorithm>

using namespace std;

int n, m;
struct as{ 
	int x, y;
} stu[10005], cp[10005];

int main() {
	scanf("%d %d", &n, &m);
	for ( int i = 1; i <= n; i ++ ) scanf("%d %d", &stu[i].x, &stu[i].y);
	for ( int i = 1; i <= m; i ++ ) scanf("%d %d", &cp[i].x, &cp[i].y);
	
	for ( int i = 1; i <= n; i ++ ) {
		int mn = 1 << 29, ans = 0;
		// printf("%d\n", mn);
		for ( int j = 1; j <= m; j ++ ) {
			int dis = abs(stu[i].x-cp[j].x)+abs(stu[i].y-cp[j].y);
			if(dis < mn) {
				mn = dis;
				ans = j;
			} else if(dis == mn) {
				ans = min(ans, j);
			}
		}
		printf("%d\n", ans);
	} 
	
	return 0;
}

Measured memory_bytes: 128
n,k=map(int,input().split())
a=[(int(i)+1)/2 for i in input().split()]
ex=0
for i in range(k):
  ex+=a[i]
ans=ex
for i in range(k,n):
  ex+=a[i]-a[i-k]
  if ans<ex:
    ans=ex
print(ans)

Measured memory_bytes: 23588