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

#define int long long
#define inf 1000000007LL

#define rep(i, n) for(int i = 0; i < (n); i++)
#define rrep(i, n) for(int i = (n) - 1LL; i >= 0; i--)
#define trep(i, n) for(int i = 0; i <= (n); i++)
#define rep1(i, n) for(int i = 1LL; i <= (n); i++)
#define mfor(i, s, t) for(int i = (s); i < (t); i++)
#define tfor(i, s, t) for(int i = (s); i <= (t); i++)
/*
class Dinic {
public:
  vector<vector<pair<int, int>>> v;
  vector<int> e;

  vector<int> k;
  vector<int> j;

  void init(int n) {
    v = vector<vector<pair<int, int>>>(n);
    e = vector<int>();
    k = vector<int>(n);
    j = vector<int>(n);
  }
  void add_edge(int a, int b, int atob, int btoa = 0) {
    v[a].push_back(make_pair(b, e.size()));
    e.push_back(atob);
    v[b].push_back(make_pair(a, e.size()));
    e.push_back(btoa);
  }
  void dyk(int s) {
    for(auto& i : k) {
      i = inf;
    }
    queue<pair<int, int>> pq;
    pq.push(make_pair(0, s));
    while(!pq.empty()) {
      int w = pq.front().first;
      int b = pq.front().second;
      pq.pop();
      if(k[b] > w) {
        k[b] = w;
        for(auto i : v[b]) {
          if(e[i.second] > 0) {
            pq.push(make_pair(w + 1LL, i.first));
          }
        }
      }
    }
  }
  int dfs(int s, int t, int p, int c) {
    if(p == t) {
      return c;
    }
    int all = 0;
    while(c > all && j[p] < v[p].size()) {
      if(k[v[p][j[p]].first] == k[p] + 1LL) {
        int r = dfs(s, t, v[p][j[p]].first, min(c - all, e[v[p][j[p]].second]));
        e[v[p][j[p]].second] -= r;
        e[v[p][j[p]].second ^ 1LL] += r;
        if(r < c - all) {
          j[p]++;
        }
        all += r;
      }
      else {
        j[p]++;
      }
    }
    return all;
  }
  int solve(int s, int t) {
    int all = 0;
    while(1LL) {
      dyk(s);
      for(auto& i : j) {
        i = 0;
      }
      int r = dfs(s, t, s, inf);
      if(r == 0) {
        return all;
      }
      all += r;
    }
  }
};
*/

class Bit {
public:
  vector<int> d;
  void init(int n) {
    d.resize(n + 10, 0);
  }
  void add(int b, int x) {
    for(int i = b + 1; i <= (int)d.size(); i += (i & -i)) {
      d[i - 1] += x;
    }
  }
  int sum(int b) {
    int all = 0;
    for(int i = b + 1; i > 0; i -= (i & -i)) {
      all += d[i - 1];
    }
    return all;
  }
};

int q[334334];
int w[314514];
pair<int, int> tmp[334334];

signed main() {
  int n, k;
  cin >> n >> k;
  rep(i, n) {
    cin >> q[i];
    q[i] -= k;
  }
  int now = 0;
  rep(i, n + 1) {
    if(i > 0) {
      now += q[i - 1];
    }
    w[i] = now;
  }
  rep(i, n + 1) {
    tmp[i] = make_pair(w[i], i);
  }
  sort(tmp, tmp + n + 1);
  Bit b;
  b.init(n);
  int all = 0;
  int qq = 0;
  rrep(i, n + 1) {
    if(tmp[i].second < n) {
      all += qq - b.sum(tmp[i].second);
    }
    b.add(tmp[i].second, 1);
    qq++;
  }
  cout << all << endl;
}


Measured memory_bytes: 12032
#include <stdio.h>

int main() {
  char S[7];
  int result = 0;
  scanf("%s",S);
  for(int i=2;i<6;i+=2) {
    if(S[i]==S[i+1]) {
      result++;
    }
  }
  if(result==2) {
    printf("Yes");
  }else {
    printf("No");
  }
  return 0;
}

Measured memory_bytes: 1696
# -*- coding: utf-8 -*-
import itertools
import numpy as np

# 標準入力を取得
H, W, K = list(map(int, input().split()))
c = []
for h in range(H):
    c.append(input())

# 求解処理
l = np.zeros(shape=(H, W))
for h, w in itertools.product(range(H), range(W)):
    l[h, w] = (c[h][w] == "#")

ans = 0
for h_bit in range(1 << H):
    l_copy = l.copy()
    for h in range(H):
        if h_bit & (1 << h):
            l_copy[h, :] = [0]
    if np.sum(l_copy) < K:
        continue
    for w_bit in range(1 << W):
        l_copy_copy = l_copy.copy()
        for w in range(W):
            if w_bit & (1 << w):
                l_copy_copy[:, w] = 0
        ans += (np.sum(l_copy_copy) == K)

# 結果出力
print(ans)


Measured memory_bytes: 27280
#include "bits/stdc++.h"
 
using namespace std;
typedef long long int ll;
typedef pair<ll, ll > pi;  
typedef pair<pair<ll, ll >, ll > pii;  
vector<ll > vec;
vector<vector<ll > > vec2;
ll MOD = 1000000007;
ll INF = 1145141919454519;

// L/3の3乗が最大...
int main(){

    long double L;
    cin >> L;
    cout << fixed << setprecision(15) << L/3 * L/3 * L/3 << endl;

}

Measured memory_bytes: 256
using System;
using System.Linq;

class Program
{
    static void Main()
    {
        var N = Console.ReadLine().ToCharArray().Select(c => (int)(c - '0')).ToArray();
        var sum = 0;
        for (int i = 0; i < N.Length; i++)
        {
            sum += N[i];
        }
        Console.WriteLine(sum % 9 == 0 ? "Yes" : "No");
    }
}


Measured memory_bytes: 28356
#include <iostream>
#include <iomanip>
#include<math.h>
#include<list>
#include <algorithm>
#include<set>
#include<vector>
#include<math.h>
#include<map>
#include<string>
#include <numeric>
#include <queue>
#include <sstream>
#include <bitset>
#include<stack>

using namespace std;
using ll = long long;
using vll = vector<long long>;
using sll = set<long long>;


template<typename T>
T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template<typename T>
T lcm(T a, T b) { return a / gcd(a, b) * b; }

template<typename T>
map<T, T> getPrimeFactor(T n) {
	map<T, T> res;
	for (T i = 2; i * i <= n; ++i) {
		while (n % i == 0) {
			res[i] ++;
			n /= i;
		}
	}
	if (n != 1) res[n] = 1;
	return res;
}

template<typename T>
bool IsPrimeNumber(T num)
{
	if (num <= 2) return true;
	else if (num % 2 == 0) return false;

	double sqrtNum = sqrt(num);
	for (int i = 3; i <= sqrtNum; i += 2)
	{
		if (num % i == 0)
		{
			return false;
		}
	}

	return true;
}

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

#define rep(i,s,e) for(ll i=s;i<e;i++)
#define repeq(i,s,e) for(ll i=s;i<=e;i++)


int main() {
	ll N;
	std::cin >> N;

	stack<bool> st;


	while (N != 0) {
		st.push(N % -2);
		N -=st.top();
		N /= -2;
	}
	if (st.empty()) {
		std::cout << 0;
	}
	while (!st.empty()) {
		std::cout << st.top();
		st.pop();
	}
	std::cout<<endl;

	return 0;
}


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

int main() {
	int x, y;
	cin >> x >> y;
	int a[] = { 0,1,3,1,2,1,2,1,1,2,1,2,1 };
	if (a[x] == a[y])cout << "Yes";
	else cout << "No";
}

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

int main() {
    int N;
    cin >> N;
    vector<int> h(N);
    for (int i = 0; i < N; i++) cin >> h[i];
    int ans = 0;
    for (int i = 0; i < N; i++) {
        bool cansee = true;
        for (int j = 0; j < i; j++) {
            if (h[i] < h[j]) {
                cansee = false;
                break;
            }
        }
        if (cansee) {
            ans++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
//小数点以下　cout << fixed << setprecision(10) << num << endl;
//桁数はlog10(mid)でやれ　log(mid)/log(10)はWA
//long*long<0で判定するな
//開区間と閉区間
//アルファベットが何番目かは x=s[i]-'a'
//bfsはmain()内で　rep(i,h)rep(j,w)rep(i,4)でバグ
//切り上げ：(a+(b-1))/b
//32bit以上は 1ull<<j
// map 初期値0 for(auto itr=mp.begin();itr!=mp.end();++itr) itr->fi itr->se で全探索
// for(auto u:mp) u.fi u.se も可能
//n個のgcd,lcmは一つずつみて更新していく
//大きな数を扱うときは素因数分解した形で持っておく
// (l/a[i]) = l*powmod(a[i],MOD-2)%MOD;
//auto itr=lower_bound(ALL(a),key) a[itr-a.begin()]
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <queue>
#include <stack>
#include <tuple>
#include <cmath>
#include <iomanip>
#include <map>
#include <stdio.h>
#include <cstring> //memset(dp,0,sizeof(dp))
#include <functional> //operator[]
#define ll long long
#define rep(i,n) for(int i=0;i<(n);i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define fi first
#define se second
#define pb push_back
#define ALL(a) (a).begin(),(a).end()
using namespace std;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;

signed main(){
    int n; cin >> n;
    string s; cin >> s;
    int l[n],r[n];
    rep(i,n) l[i]=r[i]=0;
    rep(i,n){
        if(s[i]=='W'){
            if(i==0) l[0]=1;
            else l[i]=l[i-1]+1;
        }
        else if(i==0) l[0]=0;
        else l[i]=l[i-1];
        if(s[n-1-i]=='E'){
            if(i==0) r[n-1]=1;
            else r[n-1-i]=r[n-i]+1;
        }
        else if(i==0) r[n-1]=0;
        else r[n-1-i]=r[n-i];
    }
    int ans=1001001;
    chmin(ans,r[1]);
    chmin(ans,l[n-2]);
    rep(i,n){
        if(0<=i-1&&i+1<=n-1){
        chmin(ans,l[i-1]+r[i+1]);
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3076
#include<bits/stdc++.h>
// Begin Header {{{
#define all(x) (x).begin(), (x).end()
#define lli long long int
#define rep(i,n) for(lli i=0; i<n; i++)
#define loop(i, j, n) for(lli i=j; i<n; i++)
#define Max(a, b) ((a) > (b) ? (a) : (b))
#define Min(a, b) ((a) < (b) ? (a) : (b))
constexpr int INF  = 0x3f3f3f3f;
const long long mod=1e9+7;
//Function
lli combi(lli n, lli r)
{
	if(r==0 || r==n) return 1;
	else return combi(n-1,r) + combi(n-1,r-1);
}
lli sigma1(lli n){return n*(n+1)/2;}
lli sigma2(lli s, lli n){return sigma1(n) - sigma1(s -1);}
using namespace std;
// }}} End Header

int main()
{
	ios::sync_with_stdio(false); cin.tie(nullptr);
	lli n, k, ans;
	cin >> n >> k;
	if(n == k) ans = 1;
	else if(k == 2) ans = n-1;
	else if(n%(k-1) < 2) ans = n/(k-1);
	else ans = n/(k-1) + 1;

	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;

namespace cs
{
    public class Program
    {
        public static void Main(string[] args)
        {
        
        	int min = 11;
        	int sum = 0;
        	int input = 0;
        	int t = 0;
        	
        	for(int i = 0; i < 5; i++){
        		
        		input = int.Parse(Console.ReadLine());
        		if((t = input % 10) != 0){
        			min = Math.Min(min, t);
        			sum += (input / 10) * 10;
        			sum += 10;
        		
        		}else{
        			sum += input;
        		}
        	
        	}
        	if(min != 11){
        	 	sum -= 10;
        		sum += min;
        	}
        	Console.WriteLine(sum);
        
        
        
        }
            
    }
}



Measured memory_bytes: 11092
#include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <stdio.h>
#include <algorithm>
#include <string.h>
using namespace std;

int solve(int n,int m){
	//int hu[n+1];
	queue<int> q;
	queue<int> tmp;
	//int pos=m;
	int num=n;
	int i;
	//memset(hu,0,sizeof(hu));
	for(i=1;i<=n;i++){
		q.push(i);
	}
	while(num!=1){
		int tmp1 = m;
		while(num<tmp1) tmp1-=num;
		//hu[pos]=1;
		for(i=1;i<tmp1;i++){
			tmp.push(q.front());
			//cout<<q.front()<<endl;
			q.pop();
		}
		//cout<<"pop = "<<q.front()<<endl;
		q.pop();
		for(i=1;i<tmp1;i++){
			q.push(tmp.front());
			tmp.pop();
		}
		
		num--;
		//pos+=m;
		/*while(pos>n) pos-=n;
		while(hu[pos]==1){
			if(pos==n) pos=1;
			else pos++;
		}*/
		//cout<<"num = "<<n-num<<endl<<endl;
		
		
	}
	cout<<q.front()<<endl;
	return 0;
}
	



int main(){
	int n,m;
	
	
	cin>>n>>m;
	while(!(n==0&&m==0)){
		solve(n,m);
		cin>>n>>m;
	}
	return 0;
}

Measured memory_bytes: 1224
import java.io.PrintWriter;
import java.util.Scanner;

import static java.lang.Integer.parseInt;

public class Main {
    public static void main(String[] args) {
        var sc = new Scanner(System.in);
        var k = parseInt(sc.next());
        var s = sc.next();

        var writer = new PrintWriter(System.out);
        if (s.length() <= k) {
            writer.print(s);
        } else {
            writer.print(s.substring(0, k));
            writer.print("...");
        }
        writer.flush();
    }
}


Measured memory_bytes: 35776
n, y = map(int, input().split())
ans = 0
o10000 = -1
o5000 = -1
o1000 = -1
for i in range(n+1):
    for j in range(n+1-i):
        k = n - i - j
        sum = 10000*i + 5000*j + 1000*k
        if sum == y:
            o10000 = i
            o5000 = j
            o1000 = k
print(o10000, o5000, o1000)


Measured memory_bytes: 3060
#include<bits/stdc++.h>
#include<iostream>
#include<vector>
#include<queue>
using namespace std;
int A=0;

//int cnt=0;
int W,H;
vector<string> s(1100);
int cost[1100][1100];
 
void bfs(int a,int b){
  int dx[]={0,1,0,-1}, dy[]={1,0,-1,0};
  queue<pair<int,int>> que;
  que.push(make_pair(a,b));
  cost[a][b]=0;
  while(!que.empty()){
    pair<int,int> p=que.front();
    que.pop();
    for(int i=0;i<4;i++){
      int ny=p.first+dy[i], nx=p.second+dx[i];
      //マスの外
      if(nx<0 || ny<0 || nx>=W || ny>=H)continue;
      
      if(cost[p.first][p.second]+1>=cost[ny][nx]){continue;}
      if(s[ny][nx]=='#' && cost[ny][nx]!=0 && A<=500000){A++; bfs(ny,nx); continue;}
      if(s[ny][nx]=='#')continue;
      cost[ny][nx]=cost[p.first][p.second]+1;
      que.push(make_pair(ny,nx));
      //cnt++;
    }
  }
}
 
int main(){
  cin >> H >> W;
  int ans=0;
  for(int i=0;i<H;i++){cin >> s[i];}
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){cost[i][j]=2000000;}
  }
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      if(s[i][j]=='#' && cost[i][j]!=0){bfs(i,j);}
    }
  }
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      ans=max(ans,cost[i][j]);
    }
  }
  cout << ans << endl;
  //cout << cnt << endl;
}


Measured memory_bytes: 443136
#include <bits/stdc++.h>
#define x first
#define y second

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MOD = 1e9+7;
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3f;

int n;
ll D[20][20][(1<<16)+3];
ll arr[20];
pll cof[1<<20];

void init(int idx) {
    if(idx>=(1<<(n-3))) return;
    cof[idx*2] = pll(cof[idx].x,cof[idx].x+cof[idx].y);
    cof[idx*2+1] = pll(cof[idx].x+cof[idx].y,cof[idx].y);
    init(idx*2);
    init(idx*2+1);
}

int main() {
    scanf("%d",&n);
    for (int i=0;i<n;i++) scanf("%lld",&arr[i]);
    if (n==2) {
        printf("%lld\n",arr[0]+arr[1]);
        return 0;
    }
    cof[1] = pll(1,1);
    init(1);
    for (int len=1;len<n-1;len++) {
        for (int i=1;i<n-len;i++) {
            int j = i+len-1;
            for (int k=1;k<(1<<(n-2));k++) {
                if (len==1) {
                    D[i][j][k] = (cof[k].x+cof[k].y)*arr[i];
                    continue;
                }
                D[i][j][k] = LINF;
                for (int p=i;p<=j;p++) {
                    D[i][j][k] = min(D[i][j][k],D[i][p-1][k*2]+D[p+1][j][k*2+1]+
                                     (cof[k].x+cof[k].y)*arr[p]);
                }
            }
        }
    }
    printf("%lld\n",D[1][n-2][1]+arr[0]+arr[n-1]);

    return 0;
}


Measured memory_bytes: 109824
#include <bits/stdc++.h>
#define ll long long
#define double long double
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
#define mod (ll)(1e9+7)
#define inf (ll)(3e18+7)
#define pi (double) acos(-1)
#define P pair<int,int>
#define PiP pair<int,pair<int,int>>
#define all(x) x.begin(),x.end()
using namespace std;

int main(){
    int a, b;
    cin >> a >> b;
    cout << __gcd(a,b) << endl;
}



Measured memory_bytes: 3100
X, Y = map(int, input().split(" "))

d = {1: 300000, 2: 200000, 3: 100000}
ans = 0
ans += d.get(X, 0)
ans += d.get(Y, 0)
if X == 1 and Y == 1:
    ans += 400000

print(ans)


Measured memory_bytes: 2940
#include <iostream>
#include <vector>
using namespace std;
vector<int> v[1000100];
int main(){
    int i,j,n; cin >> n;
    for(i=1;i<=n;i++){
        for(j=i;j<=n;j+=i) v[j].push_back(i);
    }
    long long ans = 0;
    for(i=1;i<=n - 1;i++){
        ans += (long long)v[n - i].size();
    }
    cout << ans << endl;
}

Measured memory_bytes: 117896
#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 n;
vl a;
vvl dp;

ll Rec(int l,int r){
	if(dp[l][r]>=0) return dp[l][r];
	if(l==r) return dp[l][r]=0;
	return dp[l][r]=max(a[l]-Rec(l+1,r),a[r-1]-Rec(l,r-1));
}

int main(){
	cin>>n;
	a=vl(n);
	dp=vvl(n+1,vl(n+1,-1));
	for(int i=0;i<n;i++) cin>>a[i];
	cout<<Rec(0,n)<<endl;
}

Measured memory_bytes: 70912
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N; cin >> N;
  string ans = "No";
  for (int i = 0; i <= N; i++) {
    if (N - 7 * i >= 0 && (N - 7 * i) % 4 == 0) {
      ans = "Yes";
      break;
    }
  }
 
  cout << ans;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = a; i < n; i++)
#define repr(i, a, n) for (int i = n - 1; i >= a; i--)
using namespace std;
using ll = long long;
using P = pair<int, int>;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }

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

  string s;
  cin >> s;
  int n = s.size();
  rep(i, 0, n - 1) {
    if (s[i] == s[i + 1]) {
      cout << i + 1 << " " << i + 2 << endl;
      return 0;
    }
    if (i + 2 < n && s[i] == s[i + 2]) {
      cout << i + 1 << " " << i + 3 << endl;
      return 0;
    }
  }
  cout << "-1 -1" << endl;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define dunk(a) cout << (a) << endl
using namespace std;
typedef long long ll;

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

    if(s == 1000000000){
        if(k<=n){
        rep(i,k) cout << s << " ";
        rep(i,n-k) cout << 2 << " ";
        }

        else{
        if(k%2 == 0){
            rep(i,k/2){
                cout << s-1 << " " << 1;
            }
            rep(i,n-(k/2)) cout << 2 << " ";
        }
        else{
            rep(i,k/2){
                cout << s-1 << " " << 1 << " ";
            }
            cout << s << " ";
            rep(i,n-(k/2)-1) cout << 2 << " ";
        }
    }
    cout << endl;
    }

    else{

    if(k<=n){
        rep(i,k) cout << s << " ";
        rep(i,n-k) cout << 1000000000 << " ";
    }

    else{
        if(n >= k*2){
        if(k%2 == 0){
            
            rep(i,k/2){
                cout << s-1 << " " << 1;
            }
            rep(i,n-(k/2)) cout << 1000000000 << " ";
        }
        else{
            rep(i,k/2){
                cout << s-1 << " " << 1 << " ";
            }
            cout << s << " ";
            rep(i,n-(k/2)-1) cout << 1000000000 << " ";
        }
        }
        else{
            if(k%3 == 0){
            
            rep(i,k/3){
                cout << s-5 << " " << 3 << " " << 2 << " ";
            }
            rep(i,n-(k/3)) cout << 1000000000 << " ";
        }
        else if(k%3 == 1){
            rep(i,k/3){
                cout << s-5 << " " << 3 << " " << 2 << " ";
            }
            cout << s << " ";
            rep(i,n-(k/3)-1) cout << 1000000000 << " ";
        }
        else{
            rep(i,k/3){
                cout << s-5 << " " << 3 << " " << 2 << " ";
            }
            cout << s << " " << s << " ";
            rep(i,n-(k/3)-2) cout << 1000000000 << " ";

    }
    cout << endl;
    }
    }
    }}

Measured memory_bytes: 1280
#include <bits/stdc++.h>
#define vi               vector<int>
#define pb(x)            push_back(x)
#define all(x)           x.begin(), x.end()
#define sortall(x)       sort(all(x))
#define sortrev(x)       sort(all(x), greater<int>())
#define debug(x)         cout << '>' << #x << ':' << x << endl;
#define int              long long
#define ld               long double
#define endl "\n";
#define lb lower_bound
#define ub upper_bound
const int mod = 1000000007;
using namespace std;
// const int N = 1e5 + 5; 
// int n;
// int a[N];

int32_t main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
int t;
t = 1;
// cin >>t;
while(t--){
vector <char> v;
int n;cin >> n;
while(n >0){
n--;
v.pb((char)('a' + n%26));	
n /= 26;
}

reverse(v.begin(),v.end());
for(auto x : v)
	cout << x ;




}
return 0;
}

Measured memory_bytes: 3632
#include <iostream>
#include <vector>
#include <map>
using ll = long long;

char janken(char x) {
    switch (x) {
        case 'r':
            return 'p';
        case 's':
            return 'r';
        default:
            return 's';
    }
}

int main() {
    int n, k, r, s, p;
    std::string t;
    std::cin >> n >> k >> r >> s >> p >> t;
    std::vector<bool> v(n, true);
    ll res = 0;
    std::map<char, int> m;
    m['r'] = r;
    m['s'] = s;
    m['p'] = p;
    for (int i = 0; i < t.size(); i++) {
        if (i + k < t.size()) {
            int r = i + k;
            if (janken(t[r]) == janken(t[i]) && v[i]) {
                if (m[janken(t[i])] >= m[janken(t[r])]) {
                    v[r] = false;
                }
                else {
                    v[i] = false;
                }
            }
        }

    }
    for (int i = 0; i < v.size(); i++) {
        if (v[i]) {
            char e = janken(t[i]);
            res += m[e];
        }
    }
    std::cout << res << std::endl;
}


Measured memory_bytes: 512
import itertools
import math

n=int(input())
town=[0]*n
for i in range(n):
    town[i]=tuple(map(int,input().split(' ')))

sum_len=0
now=[0,0]

permu = itertools.permutations([i for i in range(n)])
for case in permu:
    now = town[case[0]]
    for i in case[1:]:
        sum_len += ((now[0]-town[i][0])**2 + (now[1]-town[i][1])**2)**(1/2)
        now = town[i]
print(sum_len/math.factorial(n))

Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
using Int = int_fast64_t;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n, t; cin >> n >> t;
	using P = pair<int, int>;
	vector<P> v(n);
	for(int i=0; i<n; ++i){
		int a, b; cin >> a >> b;
		v[i] = P(a, b);
	}
	sort(v.begin(), v.end());
	vector<vector<int>> dp(n, vector<int>(t));
	if(v[0].first < t)
		dp[0][v[0].first] = v[0].second;
	for(int i=1; i<t; ++i)
		dp[0][i] = max(dp[0][i], dp[0][i-1]);
	for(int i=1; i<n-1; ++i)
		for(int j=1; j<t; ++j){
			dp[i][j] = max(dp[i][j-1], dp[i-1][j]);
			if(j-v[i].first >= 0)
				dp[i][j] = max(dp[i][j], dp[i-1][j-v[i].first]+v[i].second);
		}
//	for(int i=0; i<n; ++i)
//		cout << i << " " << v[i].first << " " << v[i].second << "\n";
	for(int i=n-2; i>=0; --i)
		v[i].second = max(v[i].second, v[i+1].second);
	int ans = 0;
	for(int i=0; i<n-1; ++i){
		ans = max(ans, dp[i][t-1]+v[i+1].second);
//		cout << ans << " " << i << " " << dp[i][t-1] << "\n";
	}
	cout << ans << "\n";
//	for(int i=2; i<4; ++i)
//		for(int j=0; j<t; ++j)
//			cout << i << " " << j << " " << dp[i][j] << "\n";
}

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

const int N = 200010;

int a[N];
int n;

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

Measured memory_bytes: 2944
#include<bits/stdc++.h>
#define mo 1000000007
#define add(a,b) (a+b>=mo)?(a+=b-mo):(a+=b)
using namespace std;
int f[1<<19],g[1<<19],a[22][22];
int lowbit(int s){return s&(-s);}
int main()
{
	int n,m,q;scanf("%d%d%d",&n,&m,&q);
	memset(a,255,sizeof(a));
	while (q--)
	{
		int u,v,w;scanf("%d%d%d",&u,&v,&w);
		a[u][v]=w;
	}
	f[0]=1;
	for (int i=1;i<=m;i++)
	{
		for (int j=0;j<n-1;j++)
		{
			memset(g,0,sizeof(g));
			for (int s=0;s<(1<<(n-1));s++) if (f[s])
			{
				if ((a[i][j+1]!=1)&&((s&(1<<j))==0)) add(g[s],f[s]);
				if (a[i][j+1]!=0)
				{
					if (s&(1<<j)) add(g[s],f[s]);
					else add(g[s-(((s>>j)&(-(s>>j)))<<j)+(1<<j)],f[s]);
				}
			}
			memcpy(f,g,sizeof(f));
		}
	}
	int ans=0;
	for (int s=0;s<(1<<(n-1));s++) add(ans,f[s]);
	printf("%d\n",ans);
}

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

int main() {
  int n;
  cin >> n;
  map<string,int>mapa;
  for(int i=0; i<n; i++){
    string s;
    cin >> s;
    mapa[s]++;

  }
  
  int m;
  cin >> m;
  for(int i=0; i<m; i++){
    string t;
    cin >> t;
    mapa[t]--;
  }
 
  int money = 0;
  for (auto x : mapa)
    {
    	if(x.second > money)money = x.second;
    }

  cout << money << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int N, count, shinyButton;
    count = 0;
    shinyButton = 1;
    cin >> N;
    vector<int> buttons(N+1);
    vector<bool> compButtons(N+1);
    compButtons.at(1) = true;
    for (int i = 1; i < (N + 1); i++) {
        cin >> buttons.at(i);
    }
    while(true) {
        if (shinyButton == 2) {
            break;
        }
        int nextButton = buttons.at(shinyButton);
        if (nextButton == shinyButton || compButtons.at(nextButton)) {
            count = -1;
            break;
        }
        compButtons.at(nextButton) = true;
        shinyButton = nextButton;
        count++;
    }
    cout << count << endl;

}

Measured memory_bytes: 640
#include<iostream>
#include<vector>

using namespace std;

#define MAX 100005
#define NIL -1

struct Node{
    int p, l, r;
};
Node T[MAX];
int n, D[MAX];

void print(int u){
    int i, c;
    cout << "node " << u << ": ";
    cout << "parent = " << T[u].p << ", ";
    cout << "depth = " << D[u] << ", ";

    if(T[u].p == NIL)cout << "root, ";
    else if(T[u].l == NIL)cout << "leaf, ";
    else cout << "internal node, ";

    cout << "[";

    for(i = 0, c = T[u].l; c != NIL; i++, c = T[c].r){
        if(i) cout << ", ";
        cout << c;
    }
    cout << "]" << endl;
}

int rec(int u, int p){
    D[u] = p;
    if(T[u].r != NIL)rec(T[u].r, p); //右の兄弟に同じ深さを設定
    if(T[u].l != NIL)rec(T[u].l, p + 1);
}

int main(){
    int i, j, d, v, c, l, r;
    cin >>n;
    for(i = 0; i < n; i++)T[i].p = T[i].l = T[i].r = NIL;

    for(i = 0; i < n; i++){
        cin >>v >>d;
        for(j = 0; j < d; j++){
            cin >>c;
            if(j == 0)T[v].l = c;
            else T[l].r = c;
            l = c;
            T[c].p = v;
        }
    }
    for(i = 0; i < n; i++){
        if(T[i].p == NIL) r = i;
    }

    rec(r, 0);
    for(i = 0; i < n; i++)print(i);

    return 0;
}


Measured memory_bytes: 7664
s = list(input())
bw, wb = 0, 0
for i in range(len(s)):
    if i % 2 == 0:
        if s[i] != "0":
            bw += 1
        else:
            wb += 1
    else:
        if s[i] != "1":
            bw += 1
        else:
            wb += 1
print(min(wb, bw))

Measured memory_bytes: 3956
#include <iostream>
#include <utility>
#include <vector>

using namespace std;

int main() {
    int h, w;
    cin >> h >> w;

    vector<vector<int>> a(h, vector<int>(w));
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            cin >> a[i][j];
        }
    }

    vector<pair<pair<int, int>, pair<int, int>>> op(0);
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            if (a[i][j] % 2 == 1) {
                a[i][j]--;

                if (j < w - 1) {
                    a[i][j + 1]++;
                    op.push_back(make_pair(make_pair(i, j), make_pair(i, j + 1)));
                } else if (i < h - 1) {
                    a[i + 1][j]++;
                    op.push_back(make_pair(make_pair(i, j), make_pair(i + 1, j)));
                }
            }
        }
    }

    cout << op.size() << endl;
    for (int i = 0; i < static_cast<int>(op.size()); i++) {
        cout << op[i].first.first + 1 << " " << op[i].first.second + 1
            << " " << op[i].second.first + 1 << " " << op[i].second.second + 1 << endl;
    }
}


Measured memory_bytes: 5232
#include <iostream>
#include <math.h>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <algorithm>
#include <iomanip>
#include <string.h>

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()

typedef long long lint;

using namespace std;

int main(){
  int a,b,c;
  cin>>a>>b>>c;
  cout<<((b-a==c-b)?"YES":"NO")<<endl;
  return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<stack>
#include<set>

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int MAX_N=100000;
char map[120][120];
int vis[120][120];
int W,H;
int ans;
char eat;
void dfs(int y,int x){
	vis[y][x]=ans;
	//cout<<vis[y][x]<<" "<<y<<" "<<x<<endl;
	if(y+1<=H&&vis[y+1][x]==0&&map[y+1][x]==eat)
		dfs(y+1,x);
	if(y-1>=1&&vis[y-1][x]==0&&map[y-1][x]==eat)
		dfs(y-1,x);
	if(x+1<=W&&vis[y][x+1]==0&&map[y][x+1]==eat)
		dfs(y,x+1);
	if(x-1>=1&&vis[y][x-1]==0&&map[y][x-1]==eat)
		dfs(y,x-1);
}
int main()
{
	ios::sync_with_stdio(false);
	while(cin>>H>>W&&(W||H)){
		ans=1;
		memset(vis,0,sizeof(vis));
		for(int i=1;i<=H;i++)
			for(int j=1;j<=W;j++){
				cin>>map[i][j];
			}
		for(int i=1;i<=H;i++)
			for(int j=1;j<=W;j++){
				if(vis[i][j]==0){
					eat=map[i][j];	
					dfs(i,j);
					ans++;/*
					for(int w=1;w<=H;w++){
						for(int q=1;q<=W;q++){
							cout<<vis[w][q]<<"	";
						}
						cout<<endl;
					}
					cout<<endl;*/
				}
			}	
		cout<<ans-1<<endl;
	}
	
	return 0;
}


Measured memory_bytes: 3980
#include<stdio.h>

int main()
{
  int a,b,c,d,e;
  scanf("%d %d",&a,&b);
  c = a+b;
  d = a-b;
  e = a*b;
  if(c>=d &&c>=e)
    printf("%d\n",c);
  else if(d>=c && d>=e)
    printf("%d\n",d);
  else if(e>=c && e>=d)
    printf("%d\n",e);
  else if(c==d && c==e)
    printf("%d",c);
  return 0;
}


Measured memory_bytes: 128
//#include "pch.h"
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>

#include <vector>
#include <set>
#include <map>
#include <iostream>
#include <utility>
#include <queue>
#include <algorithm>
#include <functional>
#include <string>
#include <bitset>

#define ll long long
#define fri(n) for(i=0;i<(n);i++)
#define frj(n) for(j=0;j<(n);i++)
#define min(p,q) ((p)<(q)?(p):(q))
#define max(p,q) ((p)>(q)?(p):(q))
#define INF 1000000000000000000//10^18
#define INFINT 2000000001//2*10^9+1
#define MOD 1000000007
#define MODANOTHER 998244353
#define PI acos(-1)

using namespace std;


int main(void)
{
	//変数の宣言
	int n;
	static char s[200010];
	static int white[200010];
	static int black[200010];

	//よく使う変数
	int i,j,k,l;
	int flag=0;
	int ans=0;
	int count=0;
	int temp=0;
	int temp1=0;
	int temp2=0;
	int max=0;
	int min=INFINT;
	int len=0;
	int sum=0;
	int ok=0;
	int ng=0;
	int dummy;



	//データの読み込み

	scanf("%d",&n);
//	scanf_s("%d",&n);


	scanf("%s",&s);
//	scanf_s("%s",&s,200010);


/*	for(i=0;i<n;i++){
//		scanf(%d",&h[i]);
		scanf_s("%d",&h[i]);
	}*/

	//	printf("nは%dです\n", n);
	//	printf("データの読み込み終了\n");
	//実際の処理
	
	
	for(i=0;i<n;i++){
		if(i==0){
			if(s[0]=='.'){
				white[0]=1;
				black[0]=0;
			}else{
				white[0]=0;
				black[0]=1;
			}
		}else{
			if(s[i]=='.'){
				white[i]=white[i-1]+1;
				black[i]=black[i-1];
			}else{
				white[i]=white[i-1];
				black[i]=black[i-1]+1;
			}
		}
	}

	ans=white[n-1];
	for(i=0;i<n;i++){
//		printf("%d\n",white[n-1]+black[i]-white[i]);
		ans=min(ans,white[n-1]+black[i]-white[i]);
	}

	//	printf("計算部分終了\n");

	//出力
	printf("%d",ans);

	//	printf("結果の出力終了\n");

	return 0;
}



Measured memory_bytes: 2048
#include<stdio.h>
#include<string.h>
#include<math.h>
#include<stdbool.h>




int main() {
	int a, b, c,n,cnt=0;
	
	scanf("%d%d%d%d", &a,&b,&c,&n);
	for (int i = 0; a*i <= n; i++) {
		for (int j = 0; j*b <= n; j++) {
			if ((n - a * i - j * b) % c ==0 && n-a*i-b*j>=0) {
				cnt++;
				//printf("%d%d\n", i, j);
			}
		}

	}
	printf("%d", cnt);
	




	return 0;
}

Measured memory_bytes: 128
f = "YYMM"
s = "MMYY"


st = input()

mm = int(st[:2])
yy = int(st[2:])



if (mm > 0 and mm < 13) and (yy > 0 and yy < 13):
    print("AMBIGUOUS")

elif (yy > 0 and yy < 13) and ( mm < 1 or mm > 12):
    print(f)
    
elif (yy < 1 or yy > 12) and ( mm > 0 and mm < 13):
    print(s)
else:
    print("NA")


Measured memory_bytes: 3060
// May this submission get accepted!

#pragma GCC optimize ("O3")
#pragma GCC target ("tune=native")
#pragma GCC target ("avx")

#include <bits/stdc++.h>

// 汎用マクロ
#define ALL_OF(x) (x).begin(), (x).end()
#define REP(i,n) for (long long i=0, i##_len=(n); i<i##_len; i++)
#define RANGE(i,is,ie) for (long long i=(is), i##_end=(ie); i<=i##_end; i++)
#define DSRNG(i,is,ie) for (long long i=(is), i##_end=(ie); i>=i##_end; i--)
#define STEP(i, is, ie, step) for (long long i=(is), i##_end=(ie), i##_step = (step); i<=i##_end; i+=i##_step)
#define UNIQUE(v) do { sort((v).begin(), (v).end()); (v).erase(unique((v).begin(), (v).end()), (v).end()); } while (false)
template<class T> bool chmax(T &a, const T &b) { if (a < b) {a = b; return true;} return false; }
template<class T> bool chmin(T &a, const T &b) { if (a > b) {a = b; return true;} return false; }
#define INF 0x7FFFFFFF
#define LINF 0x7FFFFFFFFFFFFFFFLL
#define Yes(q) ((q) ? "Yes" : "No")
#define YES(q) ((q) ? "YES" : "NO")
#define Possible(q) ((q) ? "Possible" : "Impossible")
#define POSSIBLE(q) ((q) ? "POSSIBLE" : "IMPOSSIBLE")
#define DUMP(q) cerr << "[DEBUG] " #q ": " << (q) << " at " __FILE__ ":" << __LINE__ << endl
#define DUMPALL(q) do { cerr << "[DEBUG] " #q ": ["; REP(DUMPALL_ITR, (q).size()) { cerr << (q)[DUMPALL_ITR] << (DUMPALL_ITR == DUMPALL_ITR_len-1 ? "" : ", "); } cerr << "] at " __FILE__ ":" << __LINE__ << endl; } while (false)
template<class T> T gcd(T a, T b) { if (a < b) std::swap(a, b); while (b) std::swap(a %= b, b); return a; }
template<class T> T lcm(const T a, const T b) { return a / gcd(a, b) * b; }

// gcc拡張マクロ
#define popcount __builtin_popcount
#define popcountll __builtin_popcountll

// エイリアス
#define DANCE_ long
#define ROBOT_ unsigned
#define HUMAN_ signed
using  ll = DANCE_ HUMAN_ DANCE_;
using ull = DANCE_ ROBOT_ DANCE_;
using  ld = long double;
using namespace std;

// 標準入出力
struct inp {
    size_t sz;
    inp(size_t _sz = 1) : sz(_sz) {}
    template <typename T> operator T () const { T a; cin >> a; return a; }
    template <typename T> operator vector<T> () const { vector<T> a(sz); for (size_t i = 0; i < sz; i++) cin >> a[i]; return a; }
    template <typename T, typename U> operator pair<T, U> () const { T f; U s; cin >> f >> s; return pair<T, U>(f, s); }
};
inp inp1; // input one
template <typename T> void say(T &x, char end = '\n') { cout << x << end; }
template <typename T> void say(vector<T> &x, char sep = ' ', char end = '\n') { for (size_t i = 0, sz = x.size(); i < sz; i++) { cout << x[i] << (i == sz-1 ? end : sep); } }

// モジュール


// 処理内容
int main() {
    
    ios::sync_with_stdio(false); // stdioを使うときはコメントアウトすること
    cin.tie(nullptr);            // インタラクティブ問題ではコメントアウトすること
    
    ll a, b, k;
    cin >> a >> b >> k;

    ll x = min(a, k);
    a -= x; k -= x;

    x = min(b, k);
    b -= x; k -= x;

    cout << a << " " << b << endl;
    
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<map>
#include<cstring>
#include<math.h>
#include<bitset>
#include<queue>
#include<set>
#include<iomanip>
#include<math.h>
#include<assert.h>
// #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr long long int INFLL = 1001001001001001LL;
constexpr int INFI = 1000000007;
const int mod = 1000000007;
int main(void){
    int a,b;
    cin>>a>>b;
    cout<<6-a-b<<endl;
}

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

#define Pi 3.141592653589

int main(){
	float x = 0,y = 0;
	int a,r;
	int R = 0;
	
	while(1){
		scanf("%d,%d",&a,&r);
		if(a == 0&&r == 0)break;
		
		x += a*sin(R*Pi/180.0);
		y += a*cos(R*Pi/180.0);
		R = (R + r)%360;
	}
	
	printf("%d\n%d\n",(int)x,(int)y);
	
	return 0;
}

Measured memory_bytes: 604
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define fi first
#define se second
typedef pair<ll,ll> P;
using VP = vector<P>; using VVP = vector<VP>;
using VI = vector<ll>; using VVI = vector<VI>; using VVVI = vector<VVI>;
const int inf=1e9+7;
const ll INF=1LL<<60;
const ll mod=1e9+7;

int main(){
    int i,j;
    int n,m;
    cin>>n>>m;
    VVI E(n);
    for(i=0;i<m;i++){
        int a,b;
        cin>>a>>b;
        a--; b--;
        E[a].pb(b);
    }
    VVI dist(n,VI(n,inf));
    for(i=0;i<n;i++){
        dist[i][i]=0;
    }
    
    for(i=0;i<n;i++){
        queue<int> q;
        q.push(i);
        while(!q.empty()){
            int x=q.front(); q.pop();
            for(int u:E[x]){
                if(dist[i][u]>dist[i][x]+1){
                    dist[i][u]=dist[i][x]+1;
                    q.push(u);
                }
            }
        }
    }

    int c=inf;
    int st=-1,en=-1;
    for(i=0;i<n;i++){
        for(j=0;j<n;j++){
            if(c>dist[i][j]+dist[j][i]&&dist[j][i]==1){
                c=dist[i][j]+dist[j][i];
                st=i;
                en=j;
            }
        }
    }

    if(c==inf) {
        cout<<-1<<endl;
        return 0;
    }

    int pre=st;
    vector<int> ans;
    ans.pb(pre);
    c--;
    while(1){
        int nex;
        for(i=0;i<n;i++){
            if(dist[pre][i]+dist[i][en]==c&&dist[pre][i]==1){
                nex=i;
                break;
            }
        }
        c--;
        pre=nex;
        ans.pb(pre);
        if(pre==en) break;
    }

    cout<<ans.size()<<endl;
    for(int u:ans) cout<<u+1<<endl;
    return 0;


}


Measured memory_bytes: 8192
import sys
from collections import defaultdict, Counter, deque
from itertools import accumulate, permutations, combinations
from operator import itemgetter
from bisect import bisect_left, bisect_right, bisect
from heapq import heappop, heappush
from fractions import gcd
from math import ceil, floor, sqrt, cos, sin, pi
from copy import deepcopy

# If you use recursive call, uncomment this code
#sys.setrecursionlimit(10**6)

def main():
    s,w = map(int, input().split())
    if s<=w:
        print("unsafe")
    else:
        print("safe")

if __name__ == '__main__':
    main()


Measured memory_bytes: 10572
odd = ['R','U','D']
even = ['L', 'U', 'D']
S = input()
for s in S[::2]:
  if s not in odd:
    print('No')
    exit()
    
for s in S[1::2]:
  if s not in even:
    print('No')
    exit()
    
print('Yes')

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

using namespace std;

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

  vector<int> B(N-1);
  for (int i = 0; i < N-1; i++) {
    cin >> B[i];
  }

  int ans = B[N-2];
  for (int i = N - 2; i > 0; i--) {
    int A = min(B[i], B[i - 1]);
    ans += A;
  }
  ans += B[0];
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
/*
これを入れて実行
g++ code.cpp
./a.out
 */
 
#include <iostream>
#include <stdio.h>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <math.h>
#include <tuple>
#include <iomanip>
#include <bitset>
#include <functional>

#define all(x) (x).begin(),(x).end()
 
using namespace std;
typedef long long ll;
typedef long double ld;
 
int dy4[4] = {-1, 0, +1, 0};
int dx4[4] = {0, +1, 0, -1};
int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
int dx8[8] = {0, 1, 1, 1, 0, -1, -1, -1};
 
const long long INF = 1LL << 60;
const ll MOD = 1e9 + 7;
 
bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
    return f.second > s.second;
}
 
ll gcd(ll a, ll b){
	if (b == 0)return a;
	return gcd(b, a % b);
}
 
ll lcm(ll a, ll b){
    return a / gcd(a, b) * b;
}
 
ll nCr(ll n, ll r){
    if(r == 0 || r == n){
        return 1;
    } else if(r == 1){
        return n;
    }
    return (nCr(n - 1, r) + nCr(n - 1, r - 1));
}
 
ll nPr(ll n, ll r){
    r = n - r;
    ll ret = 1;
    for (ll i = n; i >= r + 1; i--) ret *= i;
    return ret;
}
 
//-----------------------ここから-----------
int main(void){
    ll n;
    cin >> n;
    string s = to_string(n);
    if(s.size() == 1){
        cout << n << endl;
        return 0;
    }
    for(int i = 1; i < s.size(); i++){
        if(s[i] != '9'){
            cout << (s[0] - '0') + 9 *(s.size() - 1) - 1 << endl;
            return 0;
        }
    }
    cout << (s[0] - '0') + 9 * (s.size() - 1) << endl;
}   

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <algorithm>
#include <tuple>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <cstdio>
#include <numeric>
#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, m, n) for(LL i = m;i < n;i++)
#define FORR(i, m, n) for(LL i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()
#define INF (LL)1e15
#define MOD 1000000007
using namespace std;
typedef long long LL;
typedef pair<int, int> P;
typedef pair<LL, LL> LP;
typedef pair<int, P> PP;
typedef pair<LL, LP> LPP;
int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};

/*************** using variables ***************/
LL x;
vector<LL> ruiseki;
/**********************************************/

int main(){
    cin >> x;
    ruiseki.resize(1000000);
    
    ruiseki[0] = 0;

    LL i = 0;
    while(1){
        ruiseki[i+1] = ruiseki[i] + i+1;
        if(ruiseki[i+1] >= x){
            break;
        }
        i++;
    }
    cout << min(x, i+1) << endl;
    return 0;
}


Measured memory_bytes: 8064
package main

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

const (
	initialBufSize = 10000
	maxBufSize     = 1000000
	mod            = 1e9 + 7
)

var (
	sc *bufio.Scanner = func() *bufio.Scanner {
		sc := bufio.NewScanner(os.Stdin)
		buf := make([]byte, initialBufSize)
		sc.Buffer(buf, maxBufSize)
		sc.Split(bufio.ScanWords)
		return sc
	}()
)

func main() {
	A := getInt()
	B := getInt()

	result := -1
	for i := 1; i < 1250; i++ {
		if (i * 8 / 100 == A) && (i / 10 == B) {
			result = i
			break
		}
	}

	fmt.Println(result)
}

type Graph struct {
	n     int
	edges [][]int
}

func NewGraph(n int) *Graph {
	g := &Graph{
		n:     n,
		edges: make([][]int, n),
	}
	return g
}

func (g *Graph) AddEdge(u, v int) {
	g.edges[v] = append(g.edges[v], u)
	g.edges[u] = append(g.edges[u], v)
}

func dfs(c int, edges [][]int, visited map[int]struct{}) {
	visited[c] = struct{}{}

	for _, v := range edges[c] {
		_, flag := visited[v]
		if flag {
			continue
		}
		dfs(v, edges, visited)
	}
}

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

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

func abs(a int) int {
	return int(math.Abs(float64(a)))
}

func pow(p, q int) int {
	return int(math.Pow(float64(p), float64(q)))
}

func powMod(n, p int) int {
	if p == 0 {
		return 1
	} else if p%2 == 0 {
		t := powMod(n, p/2)
		return calcMod(t * t)
	} else {
		return n * powMod(n, p-1)
	}
}

func min(nums ...int) int {
	if len(nums) == 0 {
		panic("funciton min() requires at least one argument.")
	}
	res := nums[0]
	for i := 0; i < len(nums); i++ {
		res = int(math.Min(float64(res), float64(nums[i])))
	}
	return res
}

func max(nums ...int) int {
	if len(nums) == 0 {
		panic("funciton max() requires at least one argument.")
	}
	res := nums[0]
	for i := 0; i < len(nums); i++ {
		res = int(math.Max(float64(res), float64(nums[i])))
	}
	return res
}

func strSearch(a []string, b string) bool {
	for i := 0; i < len(a); i++ {
		if a[i] == b {
			return true
		}
	}
	return false
}

func printIntArray(array []int) {
	strArray := fmt.Sprint(array)
	fmt.Println(strArray[1 : len(strArray)-1])
}

func calcMod(x int) int {
	return x % mod
}


Measured memory_bytes: 640
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] result = new int[n];
        if (n % 2 == 1) {
            result[n / 2] = sc.nextInt();
        }
        int numParallelPairs = n / 2;
        for (int i = 1; i <= numParallelPairs; i++) {
            if (n % 2 == 0) {
                result[n / 2 + i - 1] = sc.nextInt();
                result[n / 2 - i] = sc.nextInt();
            }
            else if (n % 2 == 1) {
                result[n / 2 + i] = sc.nextInt();
                result[n / 2 - i] = sc.nextInt();
            }
        }

        for (Integer i : result) {
            System.out.print(i + " ");
        }
    }
}


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

#define rep(i, n) for(int i = 0; i < (n); ++i)
#define repr(i, n) for(int i = (n-1); i >= 0; --i)

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

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

const int MAX = 200005;
const int INF = 1001001001;
const int MOD = 1000000007;

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

    auto f = [&](string s) {
        string t(s);
        reverse(t.begin(), t.end());
        return s == t;
    };

    if (f(S) && f(S.substr(0, S.size() / 2))) puts("Yes");
    else puts("No");
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cassert>
#include <string>
#include <algorithm>
#include <vector>
#include <valarray>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <iomanip>
#include <map>
#include <set>
#include <list>
#include <limits>
#include <numeric>
#include <utility>
#include <deque>
#include <unordered_set>
#include <unordered_map>
#include <regex>
#include <array>
#include <bitset>
#include <complex>
#include <tuple>
#include <random>

using namespace std;
using ll = long long;
const int INF = 1e9;
const ll MOD = 1e9 + 7;

int main()
{
  int d, e;
  while (cin >> d >> e, d || e)
  {
    double ans = 100000;
    for (int x = 0; x <= d; ++x)
    {
      int y = d - x;
      ans = min(ans, abs(sqrt(x * x + y * y) - e));
    }
    cout << fixed << setprecision(10) << ans << endl;
  }

  return 0;
}



Measured memory_bytes: 3276
<?php
$N = (int)trim(fgets(STDIN));
//$S = trim(fgets(STDIN));
//list($H,$W,$K) = array_map('intval',explode(" ",trim(fgets(STDIN))));
$A = array_map('intval',explode(" ",trim(fgets(STDIN))));

rsort($A);
$ans=0;
$t=$N-1;
for($i=0;$i<$N;$i++) {
  $lim = 2;
  if ($i==0) $lim= 1;
  for($j=0;$j<$lim;$j++) {
    if ($t > 0) {
      $ans += $A[$i];
      $t--;
    }
  }
}
printf("%d\n",$ans);


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

using namespace std;

void math_slove()
{
    long long n, negative_cnt = 0;
    cin>>n;
    long long A[n], a_min = LLONG_MAX, sums = 0;
    for(int i = 0; i < n; i++)
    {
        cin>>A[i];
        if(A[i] < 0) negative_cnt++;
        sums += abs(A[i]);
        a_min = min(a_min,abs(A[i]));
    }
    if(negative_cnt%2 == 0) printf("%lld\n", sums);
    else printf("%lld\n", sums - 2ll*a_min);
}

void dp_slove()
{
    long long n; cin>>n;
    long long A[n+1], dp[n+2][2];
    for(int i = 0; i < n; i++) cin>>A[i];
    dp[0][0] = 0; dp[0][1] = INT_MIN;
    for(int i = 0; i < n; i++)
    {
        dp[i+1][0] = max(dp[i][0]+A[i], dp[i][1]-A[i]);
        dp[i+1][1] = max(dp[i][0]-A[i], dp[i][1]+A[i]);
    }
    cout<<dp[n][0]<<endl;
}

int main()
{
    /* math_slove(); */
    dp_slove();
    return 0;
}


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

int main() {
	int n, p;
	std::cin >> n >> p;

	long long n0 = 1;
	long long n1 = 0;
	for (int i = 0; i < n; i++) {
		int tmp;
		std::cin >> tmp;
		long long nn0 = n0;
		long long nn1 = n1;

		if (tmp % 2 == 0) {
			n0 = nn0 * 2;
			n1 = nn1 * 2;
		} else {
			n0 = nn0 + nn1;
			n1 = nn1 + nn0;
		}
	}

	std::cout << (p == 0 ? n0: n1) << std::endl;
}

Measured memory_bytes: 256