akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define IL inline
#define _ 400005
#define ll long long
using namespace std ;
 
IL int gi(){
    int data = 0 , m = 1; char ch = 0;
    while(ch!='-' && (ch<'0'||ch>'9')) ch = getchar();
    if(ch == '-'){m = 0 ; ch = getchar() ; }
    while(ch >= '0' && ch <= '9'){data = (data<<1) + (data<<3) + (ch^48) ; ch = getchar(); }
    return (m) ? data : -data ; 
}
 
#define inf 2e18
 
int seqL[_] , seqR[_] , n , K , cov[_ << 2] , A[_] , B[_] , X[_] , xox , nL ;
ll Ans  , f[_] , SUM ; 

IL void PushDown(int o) {
	if(!cov[o]) return ;
	cov[o << 1] = cov[o] ; cov[o << 1 | 1] = cov[o] ; cov[o] = 0 ; return ;
}
void Insert(int o , int l , int r , int ql , int qr , int v) {
	if(ql > qr) return ;
	if(ql <= l && r <= qr) {cov[o] = v ; return ; }
	int mid = (l + r) >> 1 ;
	PushDown(o) ;
	if(ql <= mid) Insert(o << 1 , l , mid , ql , qr , v) ;
	if(qr  > mid) Insert(o << 1 | 1 , mid + 1 , r , ql , qr , v) ;
	return ; 	
}
int Query(int o , int l , int r , int ps) {
	if(l == r) return cov[o] ;
	int mid = (l + r) >> 1 ; PushDown(o) ;
	return ps <= mid ? Query(o << 1 , l , mid , ps) : Query(o << 1 | 1 , mid + 1 , r , ps) ;
}
 
IL void Init() {
	n = gi() ; K = gi() ;
	for(int i = 1; i <= n; i ++) A[i] = gi() , B[i] = gi() ;
	for(int i = 1; i <= n; i ++) if(2 * A[i] > K && B[i] == 1) {puts("-1") ; exit(0) ; } 
	for(int i = 1; i <= n; i ++) SUM += A[i] , A[i] = (A[i] + A[i - 1]) % K  ;
	nL = 0 ;
	for(int i = 1; i <= n; i ++)
		if(B[i] == 1) {
			seqL[i] = ((-2 * A[i - 1]) % K + K) % K ;
			seqR[i] = ((-2 * A[i]) % K + K) % K ; 
		}
		else seqL[i] = 0 , seqR[i] = K - 1 ; 
	for(int i = 1; i <= n; i ++) X[++xox] = seqL[i] , X[++xox] = seqR[i] ;
	sort(X + 1 , X + xox + 1) ; xox = unique(X + 1 , X + xox + 1) - X - 1 ;
	for(int i = 1; i <= n; i ++) {
		seqL[i] = lower_bound(X + 1 , X + xox + 1 , seqL[i]) - X ;
		seqR[i] = lower_bound(X + 1 , X + xox + 1 , seqR[i]) - X ; 
	}
	return ;
}
 
IL int Dist(int u , int v) {if(v >= u) return v - u ; else return v + K - u ; }
 
int main() {
	Init() ; 
	f[n + 1] = 0 ;
	seqL[n + 1] = seqL[n] ; 
	Insert(1 , 1 , xox , 1 , xox , n + 1) ;
	for(int i = n,v; i >= 1; i --) {
		f[i] = f[v = Query(1 , 1 , xox , seqL[i])] + 1ll * (v <= n) * Dist(X[seqL[i]] , X[seqL[v]]) ;
		if(seqL[i] > seqR[i])  Insert(1 , 1 , xox , seqR[i] + 1 , seqL[i] - 1 , i) ;
		else {
			Insert(1 , 1 , xox , 1 , seqL[i] - 1 , i) ;
			Insert(1 , 1 , xox , seqR[i] + 1 , xox , i) ; 
		} 
	}
	Ans = inf ;
	for(int i = 1,v; i <= xox; i ++) 
		Ans = min(Ans , f[v = Query(1 , 1 , xox , i)] +  1ll * (v <= n) * Dist(X[i] , X[seqL[v]])) ;
	Ans = Ans + 2ll * SUM ;
	cout << Ans << endl ; return 0 ; 
}


Measured memory_bytes: 13312
# import sys
# sys.setrecursionlimit(10 ** 6)
# import bisect
# from collections import deque
# from decorator import stop_watch
# 
# 
# @stop_watch
def solve(N, Vs):
    Vs.sort()
    ans = Vs[0]
    for i in range(1, N):
        ans = (ans + Vs[i]) / 2
    print(ans)


if __name__ == '__main__':
    # S = input()
    N = int(input())
    # N, M = map(int, input().split())
    Vs = [int(i) for i in input().split()]
    # Bs = [int(i) for i in input().split()]
    solve(N, Vs)


Measured memory_bytes: 9096
#pragma GCC optimize("Ofast","unroll-loops")
#pragma GCC push_options
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include<bits/stdc++.h>
#include <xmmintrin.h>
#include <immintrin.h>
using namespace::std;
__attribute__((constructor))void init(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/priority_queue.hpp>
#include<ext/pb_ds/tag_and_trait.hpp>
// #include <boost/multiprecision/cpp_dec_float.hpp>
// #include <boost/multiprecision/cpp_int.hpp>
// namespace mp = boost::multiprecision;
// typedef mp::number<mp::cpp_dec_float<0>> cdouble;
// typedef mp::cpp_int cint;
template<typename T>using pbds=__gnu_pbds::tree<T,__gnu_pbds::null_type,less<T>,__gnu_pbds::rb_tree_tag,__gnu_pbds::tree_order_statistics_node_update>;
template<typename T>using pbds_map=__gnu_pbds::tree<T,T,less<T>,__gnu_pbds::rb_tree_tag,__gnu_pbds::tree_order_statistics_node_update>;
template<typename T,typename E>using hash_map=__gnu_pbds::gp_hash_table<T,E>;
template<typename T>using pqueue =__gnu_pbds::priority_queue<T, less<T>,__gnu_pbds::rc_binomial_heap_tag>;
typedef long long lint;
#define INF (1LL<<60)
#define IINF (1<<30)
#define EPS (1e-10)
#define MOD 1000000007LL
//#define MOD 998244353LL
typedef vector<lint> vec;
typedef vector<vector<lint>> mat;
typedef vector<vector<vector<lint>>> mat3;
typedef vector<string> svec;
typedef vector<vector<string>> smat;
template<typename T>inline void numout(T t){bool f=0;for(auto i:t){cout<<(f?" ":"")<<i<INF/2?i:"INF";f=1;}cout<<endl;}
template<typename T>inline void numout2(T t){for(auto i:t)numout(i);}
template<typename T>inline void output(T t){bool f=0;for(auto i:t){cout<<(f?" ":"")<<i;f=1;}cout<<endl;}
template<typename T>inline void output2(T t){for(auto i:t)output(i);}
template<typename T>inline void _output(T t){bool f=0;for(lint i=0;i<t.size();i++){cout<<f?"":" "<<t[i];f=1;}cout<<endl;}
template<typename T>inline void _output2(T t){for(lint i=0;i<t.size();i++)output(t[i]);}
#define rep(i,n) for(lint i=0;i<lint(n);++i)
#define repi(i,a,b) for(lint i=lint(a);i<(lint)(b);++i)
#define rrep(i,n) for(lint i=lint(n)-1;i>=0;--i)
#define rrepi(i,a,b) for(lint i=lint(b)-1;i>=lint(a);--i)
#define irep(i) for(lint i=0;;++i)
#define all(n) begin(n),end(n)
#define dist(a,b,c,d) sqrt(pow(a-c,2)+pow(b-d,2))
inline lint gcd(lint A,lint B){return B?gcd(B,A%B):A;}
inline lint lcm(lint A,lint B){return A/gcd(A,B)*B;}
// inline cint cgcd(cint A,cint B){return B?cgcd(B,A%B):A;}
// inline cint clcm(cint A,cint B){return A/cgcd(A,B)*B;}
inline bool chmin(auto& s,const auto& t){bool res=s>t;s=min(s,t);return res;}
inline bool chmax(auto& s,const auto& t){bool res=s<t;s=max(s,t);return res;}
const vector<lint> dx={1,0,-1,0,1,1,-1,-1};
const vector<lint> dy={0,1,0,-1,1,-1,1,-1};
#define SUM(v) accumulate(all(v),0LL)
auto call=[&](auto f,auto... args){return f(f,args...);};

int main(){
    string s;
    cin>>s;
    if(s.size()==2){
        cout<<s<<endl;
    }else{
        reverse(all(s));
        cout<<s<<endl;
    }
}

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

using namespace std;

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vd = vector<double>;
using vs = vector<string>;

ll MAX = 1000000000000;

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

    int N;
    cin >> N;
    vll A(N);
    vll B(N);
    vll C(N);
    for(int i=0;i<N;i++) cin >> A[i] >> B[i] >> C[i];

    vll dprow(3, 0);
    vvll dp(N+1, dprow);
    for(int i=1;i<=N;i++) {
        dp[i][0] = max(dp[i-1][1], dp[i-1][2]) + A[i-1];
        dp[i][1] = max(dp[i-1][0], dp[i-1][2]) + B[i-1];
        dp[i][2] = max(dp[i-1][0], dp[i-1][1]) + C[i-1];
    }

    cout << max(dp[N][0], max(dp[N][1], dp[N][2])) << endl;

    return 0;
}

Measured memory_bytes: 8064
#include <cmath>
#include <stdio.h>

using namespace std;

int main(void)
{
	int x,h;
	double ans;

	scanf("%d", &x);
	scanf("%d", &h);
	while(x != 0 || h != 0){
		if(x == 0){
			printf("0\n");
		scanf("%d", &x);
		scanf("%d", &h);
			continue;
		}
		ans = (1 / cos(atan((double)h * 2 / (double)x)) + 1) * x * x;

		printf("%f\n",ans);
		scanf("%d", &x);
		scanf("%d", &h);

	}
	return 0;
}

Measured memory_bytes: 1116
//#pragma GCC optimize ("Ofast")
//#pragma GCC optimize ("unroll-loops")
//#pragma GCC target("avx,avx2,fma")

#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//#include <ext/rope>
#define pb push_back
#define F first
#define S second
#define ins insert
#define mp make_pair
#define fo(i, n1, n, x) for(int i = n1; i <= n; i += x)
#define foo(i, n, n1, x) for(int i = n; i >= n1; i -= x)
#define bit __builtin_popcount
#define md (l + ((r - l) / 2))
#define all(x) x.begin(),x.end()
#define eb emplace_back
#define ub upper_bound
#define lb lower_bound
#define ios ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define file(s) if (fopen(s".in", "r")) freopen(s".in", "r", stdin), freopen(s".out", "w", stdout)

using namespace std;
//using namespace __gnu_pbds;
//using namespace __gnu_cxx;


using ll = long long;

//#define int ll

using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vi = vector<int>;



const int N = 2e5 + 11, mod = 1e9 + 7, mod2 = 998244353;
const int MAX = 1e5 + 11;
const int INF1 = 2e9 + 11;
const ll INF2 = 2e18 + 11;
const double INF3 = 1e8 + 11;
const int base = 500;
const int P = 31;
const int dx[] = {1, -1, 0, 0, 1, 1, -1, -1};
const int dy[] = {0, 0, 1, -1, 1, -1, 1, -1};
const double EPS = 1e-4;
const double PI = acos(-1.0);


//template<typename T> using ordered_set = tree <T, null_type, less <T>, rb_tree_tag, tree_order_statistics_node_update>;
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; }


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

int x, y, z;
main() {
  file("threesum");
  ios;
  cin >> x >> y >> z;
  swap(x, y);
  swap(x, z);
  cout << x << " " << y << " "<<z;
  return 0;
}
/**

*/


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

using namespace std;

// 蟻本の池を思い出す

int h, w;
vector<string> board;
vector<vector<int>> warningBoard;

void f(int x, int y) {
	warningBoard[x][y] = -1;
	for (int dx = -1; dx <= 1; dx++) {
		for (int dy = -1; dy <= 1; dy++) {
			if (dx == 0 && dy == 0) {
				continue;
			}

			int nx = x + dx, ny = y + dy;
			if (nx < 0 || nx >= h || ny < 0 || ny >= w) {
				continue;
			}

			if (board[nx][ny] == '#') {
				continue;
			}

			warningBoard[nx][ny]++;
		}
	}
}

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

	cin >> h >> w;

	board.resize(h);
	warningBoard.resize(h, vector<int>(w));

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

	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			if (board[i][j] == '#') {
				f(i, j);
			}
		}
	}

	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			cout << (warningBoard[i][j] == -1 ? "#" : to_string(warningBoard[i][j]));
		}
		cout << endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const ll mod = 1000000007;
const ll INF = mod * mod;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)

int main() {
    vector<int> A(9); rep(i, 9) cin >> A[i];
    int N; cin >> N;
    vector<int> b(N + 5); rep(i, N) cin >> b[i];

    map<int,int> open;
    rep(i, N) {
        rep(j, 9) {
            if (A[j] == b[i]) open[j] = 1;
        }
    }

    bool bingo = false;
    rep(i, 3) {
        if (open[3*i]*open[3*i+1]*open[3*i+2]) bingo = true;
        if (open[i]*open[i+3]*open[i+6]) bingo = true;
    }
    if (open[0]*open[4]*open[8] || open[2]*open[4]*open[6]) bingo = true;

    if (bingo) cout << "Yes" << endl;
    else cout << "No" << endl;
}

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

int main() {
    int A, B;
    std::cin >> A >> B;

    int ans = 0;
    if (A > B) {
        ans += A;
        A -= 1;
    } else {
        ans += B;
        B -= 1;
    }

    ans += std::max(A, B);
    std::printf("%d\n", ans);

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(){
  int n,i,j,k,A[100000];
  int x,p=0,r,temp;
  scanf("%d",&n);
  for(i=0;i<n;i++){
  scanf("%d",&A[i]);
  }
  r = n-1;

  x = A[r];
  i = p-1;
  for(j=p;j<=r-1;j++){
    if (A[j]<=x) {
      i=i+1;
      temp = A[i];
      A[i] = A[j];
      A[j] = temp;
    }
  }
    temp = A[i+1];
    A[i+1] = A[r];
    A[r] = temp;

  

  for(k=0;k<n-1;k++){
    if(k == i+1) printf("[%d] ",A[k]);

else    printf("%d ",A[k]);

  }


  printf("%d\n",A[k]);




  return 0;
}

Measured memory_bytes: 992
#include <cstdio>
#include <algorithm>
#include <numeric>

int main()
{
  int n;
  scanf("%d", &n);
  long long a[100000];
  for (int i = 0; i < n; ++i)
  {
    scanf("%lld", a + i);
  }
  std::sort(a, a + n);
  long long ans;
  if (n & 1)
  {
    ans = std::max
    (
      a[n / 2] + a[n / 2 + 1] + 2 * std::accumulate(a + (n / 2 + 2), a + n, 0LL) - 2 * std::accumulate(a, a + n / 2, 0LL),
      - 2 * std::accumulate(a, a + ((n + 1) / 2 - 2), 0LL) - a[(n + 1) / 2 - 2] - a[(n + 1) / 2 - 1] + 2 * std::accumulate(a + (n + 1) / 2, a + n, 0LL)
    );
  }
  else
  {
    ans = a[n / 2] + 2 * std::accumulate(a + (n / 2 + 1), a + n, 0LL) - 2 * std::accumulate(a, a + (n / 2 - 1), 0LL) - a[n / 2 - 1];
  }
  printf("%lld\n", ans);
  return 0;
}

Measured memory_bytes: 896
#include <iostream>
#define rep(i,n) for(int (i)=0;(i)<(n);++(i))
#define all(x) (x).begin(),(x).end()
#define dump(x) cout << #x << " = " << (x) << endl

using namespace std;
using ll = long long;

int main() {
    ll n, m; cin >> n >> m;

    if (n == 1 && m == 1) {
        cout << 1 << endl;
        return 0;
    }

    if (n == 1) {
        cout << max(0ll, m - 2) << endl;
        return 0;
    }

    if (m == 1) {
        cout << max(0ll, n - 2) << endl;
        return 0;
    }

    cout << (n - 2) * (m - 2) << endl;
    return 0;
}

Measured memory_bytes: 256
n=int(input())
S=[int(i) for i in input().split()]
q=int(input())
T=[int(i) for i in input().split()]
s=0
S.append(10**10)
for i in range(q):
    l=0
    r=n+1
    while r-l>1:
        m=(l+r)//2
        if S[m]>T[i]:
            r=m
        else:
            l=m
    if S[l]==T[i]:
        s+=1    
print(s)


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

using namespace std;

typedef long long ll;

#define sz(x) ((int)(x).size())
#define in(x) int x;cin>>x
#define inn(x, y) int x,y;cin>>x>>y
#define innn(x, y, z) int x,y,z;cin>>x>>y>>z
#define bit(n) (1<<(n))

#define out(x) cout<<(x)<<endl;
#define err(x) cerr<<(x)<<endl;
#define errr(x,y) cerr<<(x)<<" "<<(y)<<endl;
#define errrr(x,y,z) cerr<<(x)<<" "<<(y)<<" "<<(z)<<endl;

#define rep(i,n) for (int i=0;i<(n);i++)
#define repp(i,n) for (int i=1;i<=(n);i++)
#define reppp(j, i, n) for (int j=i+1; j<n; j++)

#define lim5 100002
#define lim9 1000000002

#define deg(rad) (((rad)/2/M_PI)*360)
#define mid(min, max) ((min + max) / 2)

int main() {
	inn(a, b);

	if (a > b) swap(a, b);

	string s = "";

	rep(i, b)
		cout << to_string(a);

	return 0;
}


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

 int puzle[3][3];
 int tmp[3][3];
 int d1[4]={0,1,0,-1};
 int d2[4]={1,0,-1,0};
 
 void empty(int *x,int *y){
                           int i,j;
                           for(i=0;i<3;i++){
                                            for(j=0;j<3;j++){
                                                             if(!puzle[i][j]){
                                                                              *x=j;
                                                                              *y=i;
                                                                              return;
                                                                              }
                                                              }
                                             }
                            }

 void swap(int *a,int *b){
                          int tmp=*a;
                          *a=*b;
                          *b=tmp;
                          }

 int cal(){
           int a,i,sum=0;
           for(i=0;i<9;i++){
                            a=puzle[i/3][i%3];
                            if(a){
                                  a--;
                                  sum+=abs(i/3-a/3)+abs(i%3-a%3);
                                  }
                            }
           return sum;
           }

 int dfs(int x,int y,int p,int dep,const int lim){
       int i,h,n1,n2,res;
       h=cal();
       if(h==0){
                return dep;
                }
       if(dep+h>lim){
                     return -1;
                     }
       for(i=0;i<4;++i){
                        n1=x+d1[i];
                        n2=y+d2[i];
 
                        if(~p&&i==(p+2)%4)continue;
                        if(!(0<=n1&&n1<3&&0<=n2&&n2<3))continue;
                        swap(&puzle[y][x],&puzle[n2][n1]);
                        res=dfs(n1,n2,i,dep+1,lim);

                        if(~res)return res;
 
                        swap(&puzle[y][x],&puzle[n2][n1]);
                        }
       return -1; 
       }

  int main(){
    int ans,x,y,l,i,j;
  
    for(i=0;i<3;i++){
      for(j=0;j<3;j++){
        scanf("%d",&puzle[i][j]);
      }
    }
    empty(&x,&y);
    for(l=0;l<100;l++){
      for(i=0;i<3;i++){
        for(j=0;j<3;j++){
    tmp[i][j]=puzle[i][j];
      }
    }
      ans=dfs(x,y,-1,0,l);
      if(ans!=-1){
        printf("%d\n",ans);
        break;
      }
      for(i=0;i<3;i++){
        for(j=0;j<3;j++){
    puzle[i][j]=tmp[i][j];
      }
      }
      ans=-1;
      if(l==99){
        printf("%d\n",ans);
    }
    }
    return 0;            }









Measured memory_bytes: 2116
#include <stdio.h>

int k,n,w[100000];

int check(int mid){
	int j,i=0;
	int s;
	for(j=0;j<k;j++){
		s=0;
		while(s+w[i]<=mid){
			s=s+w[i];
			i++;
			if(i==n){
				return n;
			}
		}
	}
	return i;
}

int BinarySearch(){
	int left = 0;
	int right = 10000*100000;
	int mid;
	int a;
	while(right-left>1){
		mid = (left + right) / 2;
		a=check(mid);
		if(a>=n){
			 right=mid;
		}
		else{
			left = mid;
		}
	}
	return right;
}

int main(void){
	int ans,i;
	
	scanf("%d",&n);
	scanf("%d",&k);
	
	for(i=0;i<n;i++){
		scanf("%d",&w[i]);
	}
	ans=BinarySearch();
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 2172
#include<stdio.h>
long long int ar[10000000];
void sort(int a)
{
    int i,j,k;
    for(i=0; i<a-1; i++)
    {
        for(j=i+1; j<a; j++)
        {
            if(ar[i]>ar[j])
            {
                k=ar[i];
                ar[i]=ar[j];
                ar[j]=k;
            }
        }
    }
    return ;
}
int main()
{
    long long int a,b,c,i,j,k=0;
    scanf("%lld",&a);
    for(i=0; i<a; i++)
    {
        scanf("%lld",&ar[i]);
    }
    sort(a);
    for(i=0; i<a-2; i++)
    {
        for(j=i+1; j<a-1; j++)
        {
            for(c=j+1; c<a; c++)
            {
                if(ar[i]+ar[j]>ar[c] && ar[i]+ar[c]>ar[j] && ar[j]+ar[c]>ar[i])k++;
            }
        }
    }
    printf("%lld\n",k);
    return 0;
}


Measured memory_bytes: 128
n=int(input())
counta=0
countb=0
countc=0
countd=0
for _ in range(n):
    s=input()
    if "AC" in s:
        counta+=1
    elif "WA" in s:
        countb+=1
    elif "TLE" in s:
        countc+=1
    elif "RE" in s:
        countd+=1
print("AC","x",counta)
print("WA","x",countb)
print("TLE","x",countc)
print("RE","x",countd)

Measured memory_bytes: 9220
using System;

namespace B___Increment_Decrement
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            var s = Console.ReadLine();
            var max = 0;
            var count = 0;
            for(var i=0; i<n; i++)
            {
                if(s[i]=='I')
                {
                    count++;
                }
                else
                {
                    count--;
                }
                if(max<count)
                {
                    max = count;
                }
            }
            Console.WriteLine(max);
        }
    }
}

Measured memory_bytes: 13140
#include <iostream>
#include <stdio.h>
#include <cmath>
#include <vector>
#include <map>
#include <algorithm>

using namespace std;

int main() {
    unsigned long long int a;
    cin >> a;


    vector<unsigned long long int>p;
    unsigned long long int t = 0;

    while (true)
    {
        if (a <= 26)break;

        if (a % 26 == 0) {
            p.push_back(a % 26);
            a /= 26;
            a -= 1;
        } else {
            p.push_back(a % 26);
            a /= 26;
        }

        
        t++;
    }
    p.push_back(a);

    vector<char> c;
    for (int i = 0; i < 26; i++) {
        if (i == 0) {
            c.push_back('z');
        } else {
            c.push_back('a' + i - 1);
        }


    }
    c.push_back('z');

    for (int i = 0; i < t + 1; i++) {
        cout << c[p[t - i]];
    }
    cout << endl;



    return 0;
}

Measured memory_bytes: 3616
import math

def is_prime(n):
    if n == 1: return False

    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False

    return True

x = int(input())
boole = True
while boole:
  if is_prime(x):
    print(x)
    boole = False
  else:
    x += 1
    

Measured memory_bytes: 9028
//	Sha3ban_El-Bay
#include<bits/stdc++.h>
using namespace std ;
//======================================================
#define El_Bay ios_base::sync_with_stdio(false);cin.tie(NULL);
#define forn(i,n)  for (int i = 0; i < (int)(n); ++i)
#define for1(i,n)  for (int i = 1; i <=(int)(n); ++i)
#define all(v)     (v).begin(),(v).end()
#define ull        unsigned long long
#define PI         3.14159265359
#define ll         long long
#define sz(v)	   v.size()
#define pb         push_back
#define pp         pop_back
#define S          second
#define bgn        begin
#define F          first
#define N	100000+5
#define MOD	1e9+7
#define inf 1e18
//======================================================
int dx[] = { 0,  0, 1, -1 ,  1,  -1,  1,  -1 };
int dy[] = { 1, -1, 0,  0 , -1,   1,  1,  -1 };
//======================================================
ll gcd(ll a, ll b) { return !b ? a : gcd(b, a % b); }
ll lcm(ll a, ll b) { return (a / gcd(a, b)) * b; }
ll power(ull a, ull b, ull ret = 1LL) {
	while (b--) ret = (ret * a);
	return ret;}
//======================================================
ll n,k;
ll a[N];
ll dp[N];
ll Frog(int i)
{
	if(i>=n) return 0;
	if(dp[i]!=-1) return dp[i];
	ll c1=inf,c2=inf;
	for(int x=1 ; x<=k ; x++)
	{
		if(i+x<=n)c1=Frog(i+x)+abs(a[i]-a[i+x]);
		c2=min(c1,c2);
	}

	return dp[i]=c2;
}

int main()
{
	El_Bay
	cin >> n >> k;
	memset(dp,-1,sizeof dp);
	for(int i=1 ; i<=n ; i++)
		cin >> a[i];
	ll ans=Frog(1);
	cout << ans;
	return 0;
}


Measured memory_bytes: 11408
#include<iostream>
#include<math.h>
#include<vector>
#include<algorithm>
#include<numeric>
#include<map>
#include<queue>
#include<deque>
#include<set>
#include<cstdio>
using namespace std;

int main(){
    int H,W;cin>>H>>W;
    char s[60][60];
    for(int j=0;j<=W+1;j++)
        s[0][j]=s[H+1][j]='.';
    for(int i=1;i<=H;i++){
        s[i][0]='.';
        for(int j=1;j<=W;j++)
            cin>>s[i][j];
        s[i][W+1]='.';
    }
    bool b=true;
    for(int i=1;i<=H;i++){
        for(int j=1;j<=W;j++){
            if(s[i][j]=='#'&&s[i][j+1]=='.'&&s[i][j-1]=='.'&&s[i+1][j]=='.'&&s[i-1][j]=='.')
                b=false;
        }
    }
    if(b)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}

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

#define ll long long



void solve(){
    string s1,s2,s3;
    cin>>s1>>s2>>s3;
    if(s1[s1.size()-1]==s2[0]&&s2[s2.size()-1]==s3[0]){
        cout<<"YES"<<endl;
    }else{
        cout<<"NO"<<endl;
    }
}

signed main(){
    //while(1)
    solve();
}

Measured memory_bytes: 256
fun main(args: Array<String>) {
    val (N, M, K) = readInputLine().split(" ").map { it.toInt() }
    
    for (i in 0..N) {
        for (j in 0..M) {
            if (i * (M - j) + j * (N - i) == K) {
                println("Yes")
                return
            }
        }
    }

    println("No")
}

fun readInputLine(): String {
    return readLine()!!
}


Measured memory_bytes: 37964
#include <bits/stdc++.h>
#include <ext/rope>
#define VALHALLA cin.tie(0);ios_base::sync_with_stdio(false);cout<<fixed<<setprecision(13);cerr<<fixed<<setprecision(5);
#define endl "\n"
#define pb push_back
#define all(v) v.begin(),v.end()
#define debug(x) std::cerr << #x << ": " << (x) << '\n';
#define sz(x) (int)x.size()
#define fast(map_name) map_name.reserve(1024);map_name.max_load_factor(0.25);
using namespace std;
using namespace __gnu_cxx;
typedef long long int ll;
typedef pair<int,int> ii;
typedef complex<double> point;
const double epsilon=1e-9;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const ll mod=1e9+7;
/* VARIABLE DECLARATION START */
int globe[int(1e6)];
/*  FUCNTION TEMPLATE STARTS  HERE */
double dot(point a,point b){ return (conj(a)*b).real() ; }
double cross(point a,point b){ return (conj(a)*b).imag() ; }
double dist(point a, point b){ return abs(a-b); }
struct neal {
static uint64_t splitmix64(uint64_t x)
 {
    x += 0x9e3779b97f4a7c15;
    x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
    x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
    return x ^ (x >> 31);
}
size_t operator()(uint64_t x) const
 {
    static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
    return splitmix64(x + FIXED_RANDOM);
}
};
struct HASH{
  size_t operator()(const pair<int,int>&x)const{
    return (size_t) x.first * 37U + (size_t) x.second;
  }
};
bool isprime(ll n) {
    if (n == 2 || n == 3) return true;
    if (n < 2 || n % 2 == 0 || n % 3 == 0) return false;
    for (ll i = 6; (i - 1) * (i - 1) <= n; i += 6) {
        if (n % (i - 1) == 0 || n % (i + 1) == 0) {
            return false;
        }
    }
    return true;
}
inline ll exp(ll a, ll b, ll mod) {
    ll n = 1;
    ll p = a;
    while (b > 0) {
        if (b % 2 == 1) {
            n *= p;
            n %= mod;
        }
        p *= p;
        p %= mod;
        b /= 2;
    }
    return n;
}

inline bool comp(double a,double b)
{
  return (fabs(a-b)<epsilon);
}
ll gcd(ll u, ll v) {
  ll r;
  while (0 != v) {
    r = u % v; u = v; v = r;
  }
  return u;
}
/*  FUCNTION TEMPLATE ENDS HERE */
int main()
{
   VALHALLA
   string s;cin>>s;
   if(!(sz(s)%2!=0)!=!(s.front()==s.back()))
   {
    cout<<"First"<<endl;
   }
   else
    cout<<"Second"<<endl;


   
}



Measured memory_bytes: 512
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i ++)
#define irep(i,n) for (int i = (int)(n) - 1;i >= 0;--i)
using namespace std;
using ll = long long;
using PL = pair<ll,ll>;
using P = pair<int,int>;
constexpr int INF = 1000000000;
constexpr long long HINF = 1000000000000000;
constexpr long long MOD = 1000000007;// = 998244353;
constexpr double EPS = 1e-4;
constexpr double PI = 3.14159265358979;

#include <atcoder/all>
using namespace atcoder;

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

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

    mf_graph<int> mf(N*M + 2);
    rep(i,N) {
        rep(j,M) {
            if ((i + j)%2 == 0) {
                if (grid[i][j] == '#') continue;
                mf.add_edge(N*M,i*M + j,1);
                rep(k,4) {
                    int y = i + dy[k];
                    int x = j + dx[k];
                    if (y < 0 || y >= N || x < 0 || x >= M) continue;
                    if (grid[y][x] == '#') continue;
                    mf.add_edge(i*M + j,y*M + x,1);
                }
            } else {
                mf.add_edge(i*M + j,N*M + 1,1);
            }
        }
    }

    int flow = mf.flow(N*M,N*M + 1);
    auto E = mf.edges();
    for (auto e: E) {
        if (e.from == N*M || e.to == N*M + 1 || e.flow == 0) continue;
        int i = e.from/M,j = e.from%M;
        int y = e.to/M,x = e.to%M;
        if (i == y && j < x) {
            grid[i][j] = '>';
            grid[y][x] = '<';
        } else if (i == y && j > x) {
            grid[i][j] = '<';
            grid[y][x] = '>';
        } else if (i < y) {
            grid[i][j] = 'v';
            grid[y][x] = '^';
        } else {
            grid[i][j] = '^';
            grid[y][x] = 'v';
        }
    }
    cout << flow << '\n';
    rep(i,N) cout << grid[i] << '\n';
    return 0;
}

Measured memory_bytes: 5460
#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <algorithm>
using namespace std;

int main(){
    int H,A;
    cin >> H >> A;

    int count = 0;
    while(1){
        H = H - A;
        count++;
        if(H <= 0) break;
    }

    cout << count << endl;
}

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

using namespace std;

int main()
{
    int n, m, a[1010], b[1010], cnt[1010], ans=0;
    for (int i=0; i<1010; i++) cnt[i]=0;
    cin>>n>>m;
    for (int i=0; i<n; i++) cin>>a[i];
    for (int i=0; i<m; i++) cin>>b[i];
    for (int i=0; i<m; i++)
    {
        for (int j=0; j<n; j++)
        {
            if (a[j]<=b[i]) { cnt[j]++; j=n; }
        }
    }
    m=0;
    for (int i=0; i<n; i++)
    {
        if (cnt[i]>m) { m=cnt[i]; ans=i+1; }
    }
    cout<<ans<<'\n';
    return 0;
}



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

#define pb push_back
#define ll long long
#define maxn 200005
#define fr(i,j,k) for(int i=j;i<k;i++)
#define f(n) fr(i,0,n)
#define f1(n) fr(i,1,n+1)
#define ms(i) memset(i,0,sizeof(i));
#define ms1(i) memset(i,-1,sizeof(i));
#define F first
#define S second
const ll mod = 1e9+7;

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n;
    //while(cin >> n){
        string s;
        cin >> s;
        n = s.size();
        vector<int>l,r;
        f(n){
            if(s[i]=='L')l.pb(i);
            else r.pb(i);
        }
        int cnt[n+5] = {};
        f(n){
            if(s[i]=='L'){
                int idx = lower_bound(r.begin(),r.end(),i) - r.begin() - 1;
                if((i-r[idx])%2){
                    cnt[r[idx]+1]++;
                }
                else{
                    cnt[r[idx]]++;
                }
            }
            else{
                int num = *lower_bound(l.begin(),l.end(),i);
                if((num-i)%2){
                    cnt[num-1]++;
                }
                else{
                    cnt[num]++;
                }
            }
        }
        f(n){
            cout<<cnt[i]<<' ';
        }
        cout << endl;
    //}
}

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

template<class T> void vin(vector<T>& v, int n) {
    v.resize(n);
    for (int i = 0; i < n; ++i) {
        cin >> v[i];
    }
}

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


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

int main(){
  int n, p;
  cin >> n >> p;
  vector<int> m(2,0);
  int a,i;
  for(i=0;i<n;i++){
    cin >> a;
    m[a%2]++;
  }
  long long ans=exp2(n);
  if(m[1]==0){
    if(p) ans=0;
  }else ans/=2;
  cout << ans << endl;
}

Measured memory_bytes: 384
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cmath>
using namespace std;

typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;
#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define next asdnext
#define prev asdprev
#define dump(x)  cout << #x << " = " << (x) << endl;	//debug
#define SZ(x) ((int)(x).size())
#define REP(i, n) for(ll i = 0; i < (n); i++)
#define REPR(i, n) for (ll i = (n); i >= 0; i--)
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)

int main() {
	ll x;
	ll res = 0;
	scanf("%lld", &x);
	ll money=100;
	ll i = 0;
	while (money < x) {
		money = (ll) (money * 1.01);
		i++;
	}
	printf("%lld\n", i);
	return(0);
}

Measured memory_bytes: 3228
#include<iostream>
using namespace std;
int main(){
  int n,ans,i,m,h;
  cin >> n;ans = m = 0;
  for(i=0;i<n;i++){
    cin >> h;
    if(h >= m){
      ans += 1;
      m = h;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <complex>
#include <stdio.h>
#include <time.h>
#include <numeric>
//#define int long long
#define all(a) a.begin(),a.end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef long double ld;
typedef complex<ld> com;
constexpr int inf = 1000000000;
constexpr ll INF = 1000000000000000000;
constexpr ld EPS = 1e-12;
constexpr ld PI = 3.141592653589793238;
template<class T, class U> inline bool chmax(T &a, const U &b) { if (a < b) { a = b; return true; } return false; }
template<class T, class U> inline bool chmin(T &a, const U &b) { if (a > b) { a = b; return true; } return false; }

constexpr ll mod = 1000000007;
constexpr ll modsize = 0;
vector<ll> fac(modsize);
vector<ll> inv(modsize);
vector<ll> facinv(modsize);

void modcalc() {
	if (modsize == 0) abort();
	fac[0] = 1; fac[1] = 1; inv[1] = 1;
	facinv[0] = 1; facinv[1] = 1;
	for (ll i = 2; i < modsize; i++) {
		fac[i] = fac[i - 1] * i % mod;
		inv[i] = mod - inv[mod % i] * (mod / i) % mod;
		facinv[i] = facinv[i - 1] * inv[i] % mod;
	}
}

ll modinv(ll a) {
	if (a == 0) abort();
	ll b = mod, u = 1, v = 0;
	while (b) {
		ll t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= mod;
	if (u < 0) u += mod;
	return u;
}

ll modpow(ll a, ll b) {
	ll ans = 1;
	a %= mod;
	while (b) {
		if (b & 1) ans = ans * a % mod;
		a = a * a % mod;
		b >>= 1;
	}
	return ans;
}

ll modcomb(ll n, ll k) {
	if (n < 0 || k < 0 || n < k) return 0;
	return fac[n] * facinv[k] % mod * facinv[n - k] % mod;
}

ll modperm(ll n, ll k) {
	if (n < 0 || k < 0 || n < k) return 0;
	return fac[n] * facinv[n - k] % mod;
}

ll modhom(ll n, ll k) {
	if (n < 0 || k < 0 || n == 0 && k > 0) return 0;
	if (n == 0 && k == 0) return 1;
	return fac[n + k - 1] * facinv[k] % mod * facinv[n - 1] % mod;
}

int mobius(int n) {
	int ans = 0;
	int m = n;
	for (int i = 2; i*i <= m; i++) {
		int check = 0;
		while (n%i == 0) {
			n /= i;
			ans++;
			check++;
			if (check >= 2) {
				return 0;
			}
		}
	}
	if (n != 1) ans++;
	if (ans % 2 == 0) return 1;
	else return -1;
}

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

	ll n, k;
	cin >> n >> k;
	swap(n, k);
	ll ans = 0;
	for (ll i = 1; i <= n; i++) {
		ll cnt = n / i;
		cnt = modpow(cnt, k);
		ll num = i;
		vector<int> div;
		for (ll j = 1; j*j <= i; j++) {
			if (i%j == 0) {
				div.pb(j);
				if (j*j != i) div.pb(i / j);
			}
		}
		for (ll j : div) {
			if (i == j) continue;
			num += mobius(i / j) * j;
		}
		ans += cnt * num%mod;
		ans %= mod;
	}
	cout << ans << '\n';
} 

Measured memory_bytes: 3628
#include <iostream>
#include <cmath>

using namespace std;

int main()
{
    long long int a, b, c, d;
    cin >> a >> b >> c >> d;
    long long int lcm;
    long long int count = 0;
    long long int gcd;

    long long int amari;
    long long int bigger = (c > d ? c : d);
    long long int smaller = (c > d ? d : c);
    while (amari != 0)
    {
        amari = bigger % smaller;
        bigger = smaller;
        smaller = amari;
    }
    gcd = bigger;
    lcm = c/gcd*d;
    count = (b - (b / c + b / d - b/lcm)) - (a - 1 - ((a - 1) / c + (a - 1) / d - (a-1)/lcm));

    cout << count;
}

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

int main()
{
	//dp[i][j] -> Probability of j heads in first i coins
	int n;
	cin>>n;
	ld p[n+1];
	for(int i=1;i<=n;i++)cin>>p[i];
	ld dp[n+1][n+1];
	memset(dp, 0,sizeof dp);
	dp[0][0]=1.0;
	for(int i=1;i<=n;i++)
	{
		dp[i][0]=dp[i-1][0]*(1-p[i]);
		for(int j=1;j<=i;j++)
		{
			dp[i][j]=dp[i-1][j-1]*p[i]+dp[i-1][j]*(1-p[i]);
		}
	}
	ld ans=0;
	for(int j=n/2+1;j<=n;j++)ans+=dp[n][j];
	cout<<fixed<<setprecision(10)<<ans;
	
	
	
}

Measured memory_bytes: 140928
#include<bits/stdc++.h>	
#define int long long int
#define pb push_back
#define endl "\n"
#define F first
#define S second 
#define mod 1000000007     
using namespace std;

main()
{	
	ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
	int x, ans = 0;
	cin >> x;
	ans += 1000 * (x / 500);
	x %= 500;
	ans += 5 * (x / 5);
	x %= 5;
	cout << ans << endl;
}

Measured memory_bytes: 256
//A,Elebereth Gilthoniel mantae!
//For Temeria!
#include<iostream>
#include<algorithm>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<cstdio>
#include<map>
#include<stack>
#include<queue>
#include<cstring> 
using namespace std;
long long ss[300008],kl[300008];
long long oss,okl,ox;
long long l[300008],r[300008];
int main()
{
 	//freopen("","r",stdin);
	//freopen("","w",stdout);
	long long n,m;
	cin>>n>>m;
	cin>>r[0];
	for(long long i=0;i<n-1;i++)
	{
		l[i+1]=r[i];scanf("%d",&r[i+1]);
		long long a=l[i+1],b=r[i+1];
		if(a>b) b+=m;
		oss+=b-a;
		ss[a+1]+=a+1;
		kl[a+1]++;
		ss[b+1]-=a+1;
		kl[b+1]--;
	}
	for(long long i=1;i<=2*m;i++)
	{
		ss[i]+=ss[i-1];kl[i]+=kl[i-1];
		//cout<<i<<":"<<ss[i]<<" "<<kl[i]<<endl;
	}
	long long ans=1234651324789;
	for(long long i=1;i<=m;i++)
	{
		long long ft=oss;
		ft+=ss[i];
		ft-=kl[i]*i;
		ft+=ss[i+m];
		ft-=kl[i+m]*(i+m);
		ans=min(ans,ft);//cout<<ft<<ans<<" ";
	}
	cout<<ans<<endl;
	return 0;
}
/*
4 6
1 5 1 4
*/

Measured memory_bytes: 7552
#include<cstdio>
#include<cstring>
#include<cmath>
#include<bitset>
#include<iostream>
#include<algorithm>
#include<string>
#include<utility>
#include<tuple>
#include<vector>
#include<list>
#include<map>
#include<queue>
#include<stack>
#include<numeric>
#include<functional>
#include<iomanip>

#define IOS ios::sync_with_stdio(false),cin.tie(0)
#define REP(i,n) for(int i = 0;i < n;i++)
#define MEM(a,b) memset(a,b,sizeof(a))

using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;

int gcd(int a, int b) {
	if (a < b)swap(a, b);
	int k = a % b;
	if (k == 1)return 1;
	if (k == 0)return b;
	int ans = gcd(b, k);
	return ans;
}
int a[114514];
int dp[55][10010];
int main() {
	IOS;
	int n, a, b;
	cin >> n >> a >> b;
	cout << ((b - a) % 2 == 0 ? "Alice" : "Borys") << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;
import java.io.*;

public class Main
{
	public static void main(String args[])
	{
		Scanner sc = new Scanner(System.in);
		int n, x, ans;
		while(true)
		{
			n = sc.nextInt();
			x = sc.nextInt();
			ans = 0;
			if(n == 0 && x == 0)
			{
				break;
			}
			for (int i = 1; i <= n; i++)
			{
				for (int j = i + 1; j <= n; j++)
				{
					for (int k = j + 1; k <= n; k++)
					{
						if(i != j && j != k && i != k && i + j + k == x)
						{
							++ans;
						}
					}
				}
			}
			System.out.println(ans);
		}
		sc.close();
	}
}


Measured memory_bytes: 26628
using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using System.Text;


class Program
{
    static void Main(string[] args)
    {
        // 入力
        var s = Console.ReadLine();
        //var n = int.Parse(Console.ReadLine());
        //int[] n = Console.ReadLine().Split().Select(int.Parse).ToArray();

        var ans = "NO";
        for (int i = 0; i < s.Length; i++)
        {
            for (int k = 0; k < s.Length - i; k++)
            {
                var tmp = s.Remove(i, k);
                if (tmp == "keyence") ans = "YES";
            }
        }
        
        // 出力
        Console.WriteLine(ans);
    }
}

Measured memory_bytes: 13140
/*~~~~~~~~~~~~~~~~~ K++ code ~~~~~~~~~~~~~~~~~~~
in(a, b, c)
if(a+b+1 >= c) out(b+c)
else out(a+2*b+1)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/

#include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <string>
#include <cstring>
#include <utility>
#include <algorithm>
#include <functional>
#include <deque>
#include <cctype>
#include <ctime>
#include <cstdlib>
#include <iomanip>
using namespace std;

;;;
;
int main(){
  ;;;
    int a, b, c;
    cin >> a >> b >> c;
    ;
    if(a+b+1 >= c) {;;cout << (b+c) << endl;;;}
    else {;;cout << (a+2*b+1) << endl;;;};
    ;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,s,e) for(int i=(s); i<(e);i++)
#define rep(i,n) REP(i,0,n)
#define rep1(i,n) REP(i,1,n)
#define repe(i,n) for(auto &&i:n)
#define all(v) (v).begin(),(v).end()
#define decimal fixed<<setprecision(20)
#define fastcin() cin.tie(0);ios::sync_with_stdio(false)
using namespace std;
using LL = long long;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF = 1e9;
const LL LLINF = 1e16;

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

int main(){
    LL A, B, C, D;
    cin >> A >> B >> C >> D;
    LL l = C*D/gcd(C, D);
    LL ans = B - (B/C + B/D - B/l);
    ans -= (A-1) - ((A-1)/C + (A-1)/D - (A-1)/l);
    cout << ans << endl;
}

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

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

	int temp, numbers[100001] = {0};
	long long sum = 0;
	while(N-- > 0){
        cin >> temp;
        numbers[temp]++;
        sum += temp;
	}

    int Q, B, C;
    cin >> Q;
    while(Q-- > 0){
        cin >> B >> C;
        sum += (C - B) * numbers[B];
        numbers[C] += numbers[B];
        numbers[B] = 0;
        cout << sum << endl;
    }
	return 0;
}


Measured memory_bytes: 3984
#include<bits/stdc++.h>
using namespace std;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin>>n;
    vector<int> arr(n+1,0);
    //for(int i=1;i<=n;i++) cin>>arr[i];
    vector<long long int> dp(n+1,0);
    int turn=((n-1)%2);
    for(int i=n;i>0;i--){
        cin>>arr[i];
        for(int j=i;j<=n;j++){
            if((i+j)%2==0){
                if(turn==0){
                    dp[j]=max(dp[j]+arr[i],dp[j-1]+arr[j]);
                }
                else{
                    dp[j]=min(dp[j]-arr[i],dp[j-1]-arr[j]);
                }
            }
            else{
                if(turn==1){
                    dp[j]=max(dp[j]+arr[i],dp[j-1]+arr[j]);
                }
                else{
                    dp[j]=min(dp[j]-arr[i],dp[j-1]-arr[j]);
                }
            }
        }
    }
    cout<<dp[n]<<"\n";
}

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

int f(int a, int b) {
	if (a == 0) return 0;
	return a * (b / a) + f(b % a, a);
}

signed main() {
	int n, x;
	cin >> n >> x;
	cout << f(n - x, x) * 3 << endl;
	return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;

public class Main {

    public static void main(String[] args) throws IOException {
        new Main().solve();
    }

    private void solve() throws IOException {
        BufferedReader f = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(System.out);

        int num = Integer.parseInt(f.readLine());
        int kyu = 8;
        while (num - 200 >= 400) {
            num -= 200;
            kyu--;
        }

        out.println(kyu);
        out.close();
    }
}

Measured memory_bytes: 32668
from itertools import product
S = input()
L = len(S)
N = int(S)
c = 0
for i in range(3, L + 1):
    for j in product(["3", "5", "7"],  repeat=i):
        s = set(j)
        t = "".join(j)
        if int(t) <= N:
            if "3" in s and "5" in s and "7" in s:
                c = c + 1
print(c)

Measured memory_bytes: 3060
s = str(input())
list_ans = []
list_ans.append("KIHBR")
list_ans.append("AKIHBR")
list_ans.append("KIHABR")
list_ans.append("KIHBAR")
list_ans.append("KIHBRA")
list_ans.append("AKIHABR")
list_ans.append("AKIHBAR")
list_ans.append("AKIHBRA")
list_ans.append("KIHABAR")
list_ans.append("KIHABRA")
list_ans.append("KIHBARA")
list_ans.append("AKIHABAR")
list_ans.append("AKIHABRA")
list_ans.append("AKIHBARA")
list_ans.append("KIHABARA")
list_ans.append("AKIHABARA")
if s in list_ans:
    print("YES")
else:
    print("NO")


Measured memory_bytes: 3188
#include <iostream>
#include <string>
#include <utility>
#include <vector>

int main() {
  std::string n;
  int k;
  std::cin >> n >> k;
  struct node {
    int s, r;
  };
  std::vector<node> dp(k + 1, {0, 0});
  dp[0].s = 1;
  for (const int d_ : n) {
    const int d = d_ - '0';
    std::vector<node> nx(k + 1, {0, 0});
    for (int i = 0; i != k + 1; i += 1) {
      for (int c = 0; c != 10; c += 1) {
        if (d < c)
          continue;
        const int ni = i + (c ? 1 : 0);
        if (ni > k)
          continue;
        (c == d ? nx[ni].s : nx[ni].r) += dp[i].s;
      }
      for (int c = 0; c != 10; c += 1) {
        const int ni = i + (c ? 1 : 0);
        if (ni > k)
          continue;
        nx[ni].r += dp[i].r;
      }
    }
    dp = std::move(nx);
  }
  std::cout << dp[k].s + dp[k].r << std::endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for (int i= (a); i < (b); ++i)
typedef long long ll;
typedef pair<int,int> P;
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
int main() { int N;
  cin >> N;
  vector<int> s(N);
  REP(i, N) cin >> s[i];
  sort(s.begin(), s.end());
  ll mx = 0;
  REP(i, N) mx += s[i];
  int i = 0;
  while(true){
    if (mx % 10 != 0) break;
    mx -= s[i];
    i++;
    if(i==N){
      break;
    }
  }
  for (int j = i-1; 0<=j ;j--){
    if ((mx + s[j]) % 10 != 0) mx += s[j];
  } cout << mx << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define fastio                        \
    ios_base::sync_with_stdio(false); \
    cin.tie(0);                       \
    cout.tie(0)
#define scl(n) scanf("%lld", &n)
#define pcl(n) printf("%lld\n", n)
#define pcl1(n) printf("%lld ", n)
#define nln printf("\n")
#define dev(x) cout << #x << " " << x << " ";
#define PTT pair<ll, ll>

map<ll, ll> mp, mp1;
map<ll, ll>::iterator itr;

int main()
{
    ll t, n, k, x;
    scl(n);
    (n == 0) ? cout << "1" : cout << "0";

    return 0;
}

Measured memory_bytes: 3756
#include<bits/stdc++.h>
#define ll long long
#define pii pair<int,int>
#define sf(a) scanf("%d",&a)
#define pf(a) printf("%d\n",a)
#define mem(a,b) memset(a,b,sizeof(a))
#define all(x) (x.begin(),x.end())
#define rall(x) (x.rbegin(),x.rend())
#define pb push_back
#define F first
#define S second
#define FastRead ios_base::sync_with_stdio(false);cin.tie(NULL);
using namespace std;
int n,a[105][105];
int maxD(int i,int j,int amount)
{
    if(i==1 && j==n-1)
        return amount+a[i][j];
    int p1 = 0 , p2 = 0;
    if(i+1 < 2)
        p1 = maxD(i+1,j,amount+a[i][j]);
    if(j+1 < n)
        p2 = maxD(i,j+1,amount+a[i][j]);
    return max(p1,p2);
}
int main()
{
    cin >> n;
    for(int i=0;i<2;i++)
        for(int j=0;j<n;j++)
            cin >> a[i][j];
    cout << maxD(0,0,0) << endl;
}


Measured memory_bytes: 256
#include <vector>
#include <algorithm>
#include <iostream>
#include <array>
#include <set>
#include <iomanip>
#include <map>
#include <cmath>

using namespace std;

typedef long long ll;

int popcount(int n)
{
    int ans = 0;
    while (n > 0)
    {
        ans += n & 1;
        n >>= 1;
    }
    return ans;
}

ll get_cost(const vector<ll> &vs, const int bitmap)
{
    ll sum = 0;
    ll prev = vs[0];
    for (int i = 1; i < vs.size(); i++)
    {
        ll val = vs[i];
        if (((1 << i) & bitmap) != 0)
        {
            sum += max<ll>(0, prev + 1 - val);
            val = max<ll>(prev + 1, val);
        }
        prev = max(prev, val);
    }
    return sum;
}

int main()
{
    int n, k;
    cin >> n >> k;
    vector<ll> vs(n);
    
    for (auto &v : vs)
    {
        cin >> v;
    }

    ll min_cost = 10000000000000000ll;

    for (int i = 0; i < (1 << n); i++)
    {
        if (popcount(i) == k)
        {
            min_cost = min<ll>(min_cost, get_cost(vs, i));
        }
    }
    cout << min_cost << endl;
}

Measured memory_bytes: 256