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

#define int long long
#define double long double

using namespace std;

#define REP(i, a, b) for (int(i) = (a); i < (b); (i)++)
#define rep(i, n) REP(i, 0, n)
#define PER(i, a, b) for (int(i) = (a - 1); i >= (b); (i)--)
#define per(i, n) PER(i, n, 0)
#define each(i, n) for (auto &i : n)
#define clr(a) memset((a), 0, sizeof(a))
#define mclr(a) memset((a), -1, sizeof(a))
#define all(a) (a).begin(), (a).end()
#define dum(val) cerr << #val " = " << val;
#define dump(val) cerr << #val " = " << val << endl;
#define FILL(a, v) fill(a, a + sizeof(a) / sizeof(*a), v)

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

const int dx[8] = {+1, +0, -1, +0, +1, +1, -1, -1};
const int dy[8] = {+0, -1, +0, +1, -1, +1, -1, +1};
const int mod = 1e9 + 7;
const int INF = 1e9;

//nCmを n*(n-1)*(n-2)... / (1 * 2 * 3 ... )　の式で求める
//除算を行うために逆元を求める

int extgcd(int a, int b, int &x, int &y) {
	int d = a;
	if (b != 0) {
		d = extgcd(b, a % b, y, x);
		y -= (a / b) * x;
	} else {
		x = 1;
		y = 0;
	}
	return d;
}

int mod_inverse(int a, int m) {
	int x, y;
	extgcd(a, m, x, y);
	return (m + x % m) % m;
}

const int M = 200001;
int fact[M];

int mod_fact(int n, int p, int &e) {
	e = 0;
	if (n == 0) return 1;
	int res = mod_fact(n / p, p, e);
	e += n / p;

	if (n / p % 2 != 0) return res * (p - fact[n % p]) % p;
	return res * fact[n % p] % p;
}

int mod_comb(int n, int k, int p) {
	if (n < 0 || k < 0 || n < k) return 0;
	int e1, e2, e3;
	int a1 = mod_fact(n, p, e1), a2 = mod_fact(k, p, e2), a3 = mod_fact(n - k, p, e3);
	if (e1 > e2 + e3) return 0;
	return a1 * mod_inverse(a2 * a3 % p, p) % p;
}

signed main() {
	fact[0] = 0;
	fact[1] = 1;
	for (int i = 2; i < M; i++) {
		fact[i] = (fact[i - 1] * i) % mod;
	}

	int n;
	cin >> n;

	int m = n + 1;
	vector<int> a(m);
	map<int, int> mp;

	for (int i = 0; i < m; i++) {
		cin >> a[i];
		mp[a[i]]++;
	}

	int fi = -1, se = -1;
	for (int i = 1; i <= n; i++) {
		if (mp[i] == 2) {
			rep(j, m) {
				if (a[j] == i) {
					if (fi == -1)
						fi = j;
					else
						se = j;
				}
			}
			break;
		}
	}

	int pr = fi;
	int ne = m - se - 1;

	cout << n << endl;
	for (int i = 2; i <= m; i++) {
		cout << (mod_comb(m, i, mod) + mod - mod_comb(pr + ne, i - 1, mod)) % mod << endl;
	}

	return 0;
}


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

int main(){
  	int N,D;
  	cin >> N >> D;
  	
  	if (N%(2*D+1) == 0){
    	cout << N/(2*D+1) << endl;
    }
  	else{
  		cout << (N/(2*D+1))+1 << endl;
    }
  
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
#define P pair<int,int>
#define INF LLONG_MAX
using namespace std;


int g[100000];
vector<int>h[100000]{};
int n[100000];
int t[100000]{};
signed main() {
	int a, b, c, d, e, f;
	scanf("%lld%lld%lld%lld%lld%lld", &a, &b, &c, &d, &e, &f);
	for (int i = 0; i<c; i++) {
		int j;
		scanf("%lld", &j);
		j--;
		g[i] = j;
	}
	for (int k = 0; k<b; k++) {
		int l, m;
		scanf("%lld%lld", &l, &m);
		l--; m--;
		h[l].push_back(m);
		h[m].push_back(l);
	}
	fill(n, n + a, INF/3);
	for (int o = 0; o<c; o++) {
		n[g[o]] = 0;
		queue<int>p;
		p.push(g[o]);
		while (p.size()) {
			int q = p.front();
			p.pop();
			for (int r = 0; r < h[q].size(); r++) {
				if (n[h[q][r]] <= n[q] + 1)continue;
				n[h[q][r]] = n[q] + 1;
				p.push(h[q][r]);
			}
		}
	}
	for (int s = 0; s < a; s++) {
		if (n[s] <= d)n[s] = f;
		else n[s] = e;
	}
	for(int ki=0;ki<c;ki++)n[g[ki]]=INF/3;
	n[a-1]=0;
	fill(t, t + a, INF/3);
	priority_queue<P, vector<P>, greater<P>>u;
	t[0] = 0;
	u.push(P(0, 0));
		while (u.size()) {
		P v = u.top();
		u.pop();
		int qq=v.second;
		if(t[qq]<v.first)continue;
		for (int w = 0; w<h[qq].size(); w++) {
		 int pp=h[qq][w];
		 if(t[pp]>t[qq]+n[pp]){t[pp]=t[qq]+n[pp];
		 u.push(P(t[pp],pp));}
		}
	}
printf("%lld\n",t[a-1]);
}

Measured memory_bytes: 13672
import java.util.Scanner;
import java.lang.String;

public class Main {
  
  public static void main (String[] arg) {
    Scanner sc = new Scanner(System.in);
    String tcdSequence = sc.next();
    sc.close();
	int tdcLength = tcdSequence.length();
    char[] acdSequence = new char[tdcLength];
    for (int i = 0; i < acdSequence.length; i++) {
      if (i % 2 == 0) {
        acdSequence[i] = 'g';
      } else {
        acdSequence[i] = 'p';
      }
    }
    
    int acdScore = 0;
    for (int k = 0; k < tcdSequence.length(); k++) {
      if ((tcdSequence.charAt(k) == 'g') && (acdSequence[k] == 'p')) {
        acdScore++;
      } else if ((tcdSequence.charAt(k) == 'p') && (acdSequence[k] == 'g')) {
        acdScore--;
      }
    }
    
    System.out.println(acdScore);
  }
}


Measured memory_bytes: 25968
#include<iostream>
#include<algorithm>
#define rep(i, n) for(int i=1; i<n; i++)
using namespace std;

long long gcd(int a, int b){
    if(b < a) swap(a,b);
    long long r = b%a;
    while(r != 0){
        if(b < a) swap(a,b);
        b = a;
        a = r;
        r = b%a;
    }
    //cout << "a = " << a << endl;
    return a;
}

int main(){
    int K; cin >> K;
    long long sum = 0;
    rep(i, K+1){
        rep(j, K+1){
            long long a = gcd(i,j);
            rep(k, K+1){
                sum += gcd(a, k);
            }
        }
    }
    cout << sum << endl;
}

Measured memory_bytes: 3620
#include <algorithm>
#include <cassert>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <vector>
#include <sstream>
#include <set>
using namespace std;
using ll = long long;

class range {private: struct I{int x;int operator*(){return x;}bool operator!=(I& lhs){return x<lhs.x;}void operator++(){++x;}};I i,n;
public:range(int n):i({0}),n({n}){}range(int i,int n):i({i}),n({n}){}I& begin(){return i;}I& end(){return n;}};

int N, L;
int xs[100020];
int link[18][100020];

int main() {
  while (scanf("%d", &N) != EOF) {
    for (int i : range(N)) scanf("%d", &xs[i]);
    scanf("%d", &L);

    for (int i : range(N)) {
      int* p2 = upper_bound(xs, xs + N, xs[i] + L);
      p2--;

      link[0][i] = (p2 - xs);
    }

    for (int lv : range(1, 18)) {
      for (int i : range(N)) {
        link[lv][i] = link[lv - 1][link[lv - 1][i]];
      }
    }

    int Q;
    scanf("%d", &Q);

    for (int q : range(Q)) {
      int a, b;
      scanf("%d%d", &a, &b);
      a--;
      b--;
      if (b < a) swap(a, b);
      assert(a < b);

      int ret = 0;
      while (a < b) {
        for (int lv : range(1, 18)) {
          if (link[lv][a] >= b) {
            a = link[lv - 1][a];
            ret += 1 << (lv - 1);
            break;
          }
        }
      }

      printf("%d\n", ret);
    }
  }
}


Measured memory_bytes: 8192
#include <stdio.h>

int main(void){
    int a,b,temp;
    for(;scanf("%d %d",&a,&b) != EOF;){
        if(a<b){
            temp=a;
            a=b;
            b=temp;
        }
        for(;b!=0;){
            temp=a%b;
            a=b;
            b=temp;
        }
        printf("%d\n",a);
    }
    return 0;
}

Measured memory_bytes: 596
N = int(input())
A = list(map(int, input().split()))
A.sort()
A = A[::-1]
if N % 2 == 0:
  M = N // 2
  ans = sum(A[:M]) * 2 - A[0]
else:
  M = (N - 1) // 2
  ans = sum(A[:M]) * 2 - A[0] + A[M]
  
print(ans)

Measured memory_bytes: 31624
#include<iostream>
#include<algorithm>
#include<queue>

int const MAXG = 20;
int const INF = MAXG*MAXG+1;

int H, W, grid[MAXG][MAXG];
int dist[MAXG][MAXG];
int dh[] = {0, 1, 0, -1};
int dw[] = {1, 0, -1, 0};

void bfs(int h1, int w1) {
  std::fill_n(dist[0], MAXG*MAXG, INF);
  std::queue<int> q;
  q.push(h1*MAXG+w1);
  dist[h1][w1] = 0;
  while(!q.empty()) {
    int x = q.front(), h = x/MAXG, w = x%MAXG; q.pop();
    for(int i = 0; i < 4; ++i) {
      int hh = h+dh[i], ww = w+dw[i];
      if(hh < 0 || hh >= H) continue;
      if(ww < 0 || ww >= W) continue;
      if(grid[hh][ww] > 0) continue;
      if(dist[hh][ww] <= dist[h][w]+1) continue;
      dist[hh][ww] = dist[h][w]+1;
      q.push(hh*MAXG+ww);
    }
  }
}

int main() {
  std::cin >> H >> W;
  for(int h = 0; h < H; ++h) for(int w = 0; w < W; ++w) {
    char S; std::cin >> S;
    grid[h][w] = (S == '.'? 0: 1);
  }
  int mD = 0;
  for(int h = 0; h < H; ++h) for(int w = 0; w < W; ++w) {
    if(grid[h][w]>0) continue;
    bfs(h, w);
    for(int h1 = 0; h1 < H; ++h1) for(int w1 = 0; w1 < W; ++w1) {
      if(dist[h1][w1] < INF) mD = std::max(mD, dist[h1][w1]);
    }
  }
  std::cout << mD << std::endl;
  return 0;
}



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

void main_()
{
    ll N;
    cin >> N;

    queue<pair<ll, bitset<3>>> que;
    que.push({ 3, 0x1 });
    que.push({ 5, 0x2 });
    que.push({ 7, 0x4 });

    ll ans = 0;
    while (true) {
        auto n = que.front();
        que.pop();
        if (n.first > N) {
            cout << ans << endl;
            return;
        }
        if (n.second.all()) {
            ans++;
        }
        que.push({ n.first * 10 + 3, n.second | bitset<3>(0x1) });
        que.push({ n.first * 10 + 5, n.second | bitset<3>(0x2) });
        que.push({ n.first * 10 + 7, n.second | bitset<3>(0x4) });
    }
}
int main()
{
    cin.tie(nullptr);
    cout.tie(nullptr);
    ios_base::sync_with_stdio(false);
    main_();
    return 0;
}


Measured memory_bytes: 1280
N, M = map(int, input().split())

ans = 0
if N == 1 and M == 1:
    ans = 1
elif N == 1 or M == 1:
    ans = max(N, M) - 2
else:
    ans = N * M - ((N-1)*2 + (M-1)*2)

print(ans)


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

typedef long long                   ll;
typedef long double                 ld;
typedef pair<ll,ll>                 pll;
typedef pair<ld,ld>                 pld;


#define all(x)          (x).begin(),(x).end()
#define Sort(x)         sort(all(x))
#define sep             ' '
#define endl            '\n'
#define tab             '\t'
#define X               first
#define Y               second
#define fast_io         ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define file_io         freopen("in.txt" , "r" , stdin) ; freopen("out.txt" , "w" , stdout);
#define set_random      mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
const ll MOD = 1e9 + 7,
         MAXN= 1e5+10,
         INF=1e18;
ll n,m,dp[MAXN],ans,mark[MAXN];
vector<ll>adj[MAXN];
ll dfs(ll u){
    mark[u]=1;
    for(auto v:adj[u]){
        if(!mark[v]){
            dfs(v);
        }
        dp[u]=max(dp[u],dp[v]+1);
    }
}
int main()
{
    fast_io;
    cin>>n>>m;
    for(ll i=0;i<m;i++){
        ll u, v;
        cin>>u>>v;
        adj[u].push_back(v);
    }
    for(ll i=1;i<=n;i++){
        if(!mark[i]){
            dfs(i);
        }
    }
    for(ll i=1;i<=n;i++){
        ans=max(ans,dp[i]);
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 9344
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <limits>
#include <queue>
#include <iomanip>
#include <set>

template<typename T> bool chmax(T &a,T b){
    if(a<b){
        a=b;
        return true;
    }
    return false;
}

template<typename T> bool chmin(T &a,T b){
    if(a>b){
        a=b;
        return true;
    }
    return false;
}

using namespace std;
using ll = long long int;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<vvll> vvvll;
const int MOD=1000000007;
//const int MOD=998244353;
const int INTMAX=1001001000;
const ll LLMAX=1010010010010010000;


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    ll H,W;
    cin>>H>>W;
    vector<vector<bool>> s(H,vector<bool>(W));
    for(ll i=0;i<H;i++){
        for(ll j=0;j<W;j++){
            char c;
            cin>>c;
            if(c=='.')s[i][j]=true;
            else s[i][j]=false;
        }
    }
    
    vvll dp(H,vll(W,LLMAX));
    if(s[0][0]) dp[0][0]=0;
    else dp[0][0]=1;
    
    for(ll i=0;i<H;i++){
        for(ll j=0;j<W;j++){
            if(i==0&&j==0)continue;
            if(i==0){
                if(s[0][j-1]&&!s[0][j])dp[0][j]=dp[0][j-1]+1;
                else dp[0][j]=dp[0][j-1];
            }else if(j==0){
                if(s[i-1][0]&&!s[i][0])dp[i][0]=dp[i-1][0]+1;
                else dp[i][0]=dp[i-1][0];
            }else{
                if(s[i-1][j]&&!s[i][j])chmin(dp[i][j],dp[i-1][j]+1);
                else chmin(dp[i][j],dp[i-1][j]);
                if(s[i][j-1]&&!s[i][j])chmin(dp[i][j],dp[i][j-1]+1);
                else chmin(dp[i][j],dp[i][j-1]);
            }
        }
    }
    cout<<dp[H-1][W-1]<<endl;
    
    return 0;
}


Measured memory_bytes: 384
#include<stdio.h>
int main(void){
	int n,i;
	long long ans=0;
	int a[200000];
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d",&a[i]);
	}
	for(i=0;i<n-1;i++){
		if(a[i+1]<a[i]){
			ans+=a[i]-a[i+1];
			a[i+1]=a[i];
		}
	}
	printf("%lld",ans);
	return 0;
}

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

int main() {
 int a,b,m;
  cin>>a>>b>>m;
  vector<int>aprice(a);
  vector<int>bprice(b);
  vector<vector<int>> data(m, vector<int>(3));
  for(int i=0;i<a;i++){
    cin>>aprice[i];
  }
  for(int i=0;i<b;i++){
    cin>>bprice[i];
  }
   for (int j = 0; j < m ; j++) {
      for (int k = 0; k < 3; k++) {
        cin >> data.at(j).at(k);
      }
    }
   int pp=aprice.at(data.at(0).at(0)-1)+bprice.at(data.at(0).at(1)-1)-data.at(0).at(2);
  for(int i=0;i<m;i++){
   
    int x=aprice.at(data.at(i).at(0)-1)+bprice.at(data.at(i).at(1)-1)-data.at(i).at(2);
    if(x <=pp){
      pp =x;
    }
  }
  sort(aprice.begin(),aprice.end());
  sort(bprice.begin(),bprice.end());
  int t=aprice[0]+bprice[0];
  if(t<=pp){
    pp=t;
  }
  cout<<pp<<endl;
  
}


Measured memory_bytes: 6656
#include <iostream>
using std::cin;
using std::cout;
using std::endl;
using std::string;

int main(){
  int field[30][30] = {};
  int n;
  int x,y;
  int rx,ry;
  int m;
  int h;
  int flag;
  std::string d;
  while(cin >> n){
    if(n == 0 ){
      break;
    }
    rx = 10;
    ry = 10;

    flag = 0;

    for(int i = 0;i < 25;i++){
      for(int j = 0;j < 25;j++){
        field[i][j] = 0;
      }
    }

    for(int i = 0;i < n;i++){
      cin >> x >> y;
      field[x][y] = 1;
    }

    cin >> m;

    for(int i = 0;i < m;i++){
      cin >> d >> h;
      if(d[0] == 'N'){
        for(int j = ry;j < ry+h+1;j++){
          field[rx][j] = 0;
        }
        ry += h;
      }else if(d[0] == 'E'){
        for(int j = rx;j < rx+h+1;j++){
          field[j][ry] = 0;
        }
        rx += h;
      }else if(d[0] == 'W'){
        for(int j = rx;j > rx-h-1;j--){
          field[j][ry] = 0;
        }
        rx -= h;
      }else if(d[0] == 'S'){
        for(int j = ry;j > ry-h-1;j--){
          field[rx][j] = 0;
        }
        ry -= h;
      } 
    }

    for(int i = 0;i < 25;i++){
      for(int j = 0;j < 25;j++){
        if(field[i][j] == 1){
          flag = 1;
        }
      }
    }

    if(flag == 1){
      cout << "No" << endl;
    }else{
      cout << "Yes" << endl;
    }
  }
}

Measured memory_bytes: 3108
#include<bits/stdc++.h>
#define assn(n,a,b) assert(n<=b && n>=a)
using namespace std;
#define pb push_back
#define mp make_pair
#define clr(x) x.clear()
#define sz(x) ((int)(x).size())
#define F first
#define S second
#define REP(i,a,b) for(i=a;i<b;i++)
#define rep(i,b) for(i=0;i<b;i++)
#define rep1(i,b) for(i=1;i<=b;i++)
#define pdn(n) printf("%d\n",n)
#define sl(n) scanf("%lld",&n)
#define sd(n) scanf("%d",&n)
#define pn printf("\n")
typedef pair<int,int> PII;
typedef vector<PII> VPII;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef long long LL;
#define MOD 1000000007
LL mpow(LL a, LL n)
{LL ret=1;LL b=a;while(n) {if(n&1)
    ret=(ret*b)%MOD;b=(b*b)%MOD;n>>=1;}
return (LL)ret;}
#define MAXK 100000
#define MAXN 1000000000
int ar[MAXK];
int get(int n, int k){
    int i=0;
    while(i<k and ar[i]<=n)i++;
    return n-i;
}
typedef unsigned long long int ULL;
#define SSTR( x ) static_cast< std::ostringstream & >( \
        ( std::ostringstream() << std::dec << x ) ).str()
 
bool isSafe(int r, int c, vector<vector<int> > arr) {
	int n = arr.size();
	int m = arr[0].size();
	return (r>=0 && r<n && c>=0 && c<m);
}
 
/////////////////////////////////////////////////////////////
bool func(pair<LL,LL> a, pair<LL,LL> b) {
	if(a.first < b.first) return true;
	else {
		if(a.second>b.second) return true;
		else return false;
	}
}
 
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    LL t,i,n,a,b,ans,mn;
    cin>>n;
    bool flag= false;
	while(n) {
		if(n%10 == 7)  {
			flag= true;
			break;
		}
		n/=10;
	}     
	cout<<(flag ? "Yes" : "No");
    return 0;
}

Measured memory_bytes: 3612
#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations,permutations,accumulate # (string,3) 3回
#from collections import deque
from collections import deque,defaultdict,Counter
import decimal
import re
#import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#

import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7
#mod = 9982443453
def readInts():
  return list(map(int,input().split()))
def I():
  return int(input())
n,l = readInts()
S = []
for i in range(n):
    S.append(input())
S = sorted(S)
ans = ""
for i in range(n):
    ans += S[i]
print(ans)


Measured memory_bytes: 10316
N = int(input())
A = list(map(int,input().split()))
A = sorted(A)
ans = 0
from collections import defaultdict
D = defaultdict(int)
for i in A:
    D[i] += 1
for i in range(10**5+1):
    tmp = D[i-1]+D[i]+D[i+1]
    if tmp > ans:
        ans = tmp
print(ans)

Measured memory_bytes: 62572
#include <stdio.h>

int main(void){
  int i;
  char st,al[53] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
  
  do{
    scanf("%c", &st);

    for(i=0;i<52;i++)
      if(al[i] == st){
        st = al[ (i+26)%52 ];
        break;
      }

    printf("%c", st);

  }while(st != '\n');

  return 0;
}



Measured memory_bytes: 2112
#include <iostream>
#include<algorithm>
#include<string>
#include <cmath>
#include <vector>
#pragma region Macros
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<=n;i++)
#define int long long
#define all(x) (x).begin(),(x).end()
#define swap(a,b) (a += b,b = a - b,a -= b)
int gcd(int a, int b) // assuming a,b >= 1
{
    if (a < b)
        swap(a, b);
    if (b == 0)
        return a;
    if (a % b == 0)
        return b;
    return gcd(b, a % b);
}
int lcm(int a, int b) // assuming a,b >= 1
{
    return  a * b / gcd(a, b);
}
using namespace std;
#pragma endregion
signed main() {
    int A,B,C;
    cin >> A >> B>> C;
    if (A == B && B == C)
        cout << "No";
    else {
        if (A != B && B != C && C != A)
            cout << "No";
        else
            cout << "Yes";
    }

}

Measured memory_bytes: 888
#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 = 0;
    ans += b[0];
    for(int i = 1;i < n-1; i++){
        ans += min(b[i],b[i-1]);
    }
    ans += b[n-2];
    cout << ans << endl;
}

Measured memory_bytes: 256
parseInt(x)=parse(Int,x)
parseMap(x::Array{SubString{String},1})=map(parseInt,x)

function main()
	n = map(parseInt, split(chomp(readline()),""))
	s = sum(n)
	for i in 1:length(n)-1
		s = max(s,sum(n[1:i])-1+(length(n)-i)*9)
	end
	println(s)
end
main()

Measured memory_bytes: 111716
#include <iostream>

using namespace std;

int main() {
    int n, a, b;
    cin >> n >> a >> b;

    bool winAlice = (b - (a + 1)) % 2 == 0 ? false : true;
    cout << (winAlice ? "Alice" : "Borys") << endl;

    return 0;
}

Measured memory_bytes: 504
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n,x;
  cin>>n>>x;
  vector<int> ms(n);
  int min_m=1000;
  for(int i=0;i<n;i++){
    cin>>ms.at(i);
    min_m=min(min_m,ms.at(i));
    x-=ms.at(i);
  }
  cout<<n+x/min_m<<endl;
}

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

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

  int cnt = 0;
  string a = "", b = "";
  for (int i = 0; i < s.size(); ++i) {
    if (s[i] == 'x') {
      ++cnt;
    } else {
      a.push_back(s[i]);
      b.push_back(s[i]);
    }
  }

  reverse(b.begin(), b.end());

  bool can = a == b;

  if (can) {
    int ans = 0, p = 0, q = s.size() - 1;
    while (p <= q) {
      if (s[p] == s[q]) {
        ++p, --q;
        continue;
      }
      if (s[p] == 'x')
        ++p;
      if (s[q] == 'x')
        --q;
      ++ans;
    }
    cout << ans << endl;
  } else {
    cout << -1 << endl;
  }
}

Measured memory_bytes: 768
NN = input()
list1 =[]
for i in NN:
  if i == '0':
    list1.append('0')
  elif i == '1' :
    list1.append('1')
  else:
    if len(list1) == 0:
      pass
    else:
      list1.pop(-1)
for i in list1:
  print(i,end ='')

Measured memory_bytes: 8964
from collections import deque


def calc(i):
    while True:
        a = 0
        while i < M and S[i] == 'A':
            i += 1
            a += 1
        if a == 0:
            break
        else:
            dq.appendleft(a)
        bc = 0
        while i < M - 1 and S[i] == 'B' and S[i + 1] == 'C':
            bc += 1
            i += 2
        if bc == 0:
            dq.popleft()
            break
        else:
            dq.appendleft(bc)

    asum = 0
    while dq:
        global ans
        asum += dq.pop()
        ans += asum * dq.pop()
    return i


S = input()
M = len(S)
i = 0
dq = deque()
ans = 0
while i < M:
    if S[i] == 'A':
        i = calc(i)
    i += 1
print(ans)

Measured memory_bytes: 3884
#include<bits/stdc++.h>
using namespace std;
int main() {
	int a, b;
	cin >> a >> b;
	if(a <= 0 && 0 <= b) {
		cout << "Zero" << endl;
	}else if(b < 0 && (b - a) % 2 == 1 || b > 0) {
		cout << "Positive" << endl;
	}else {
		cout << "Negative" << endl;
	}
}


Measured memory_bytes: 256
N, M = map(int, input().split())
K = [0] * M
for i in range(M):
  K[i] = list(map(int, input().split()))
  K[i].pop(0)
#print(K)

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

ans = 0
for i in range(2 ** N):#最大1000
  now = [0] * (N + 1)
  x = 1
  for j in range(N):#最大10
    if ((i >> j) & 1):
      now[j + 1] = 1
  for k in range(M):# 10 * 10
    now2 = 0
    for a in K[k]:
      if now[a] == 1:
        now2 += 1
    if now2 % 2 != p[k]:
      x = 0
  ans += x
  
print(ans)

Measured memory_bytes: 42352
#include<stdio.h>
void trace(int A[],int N){
int i;
for(i=0;i<N;i++){
if(i>0)printf(" ");
 
printf("%d",A[i]);
}printf("\n");
 
}
void insertionSort(int A[],int N){
int j,i,v;
for(i=1;i<N;i++){
v=A[i];
j=i-1;
while(j>=0&&A[j]>v){
A[j+1]=A[j];
j--;
}
A[j+1]=v;
trace(A,N);
}
}
int main(){
int N,i,j;
int A[100];
scanf("%d",&N);
for(i=0;i<N;i++)scanf("%d",&A[i]);
trace(A,N);
insertionSort(A,N);
return 0;
}

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

namespace ALDS1_10_D
{
    public class Program

    {
        public static void Main(string[] args)
        {
            int n = ReadInt();
            double[] p = ReadDoubleAr();
            double[] q = ReadDoubleAr();
            double[,] dp = new double[n + 2, n + 1];
            double[,] wt = new double[n + 2, n + 1];

            for (int i = 1 ; i <= n + 1 ; i++)
            {
                for (int j = i - 1 ; j <= n ; j++)
                {
                    if (j == i - 1)
                    {
                        wt[i, j] = q[j];
                        dp[i, j] = q[j];
                    }
                    else
                    {
                        dp[i, j] = long.MaxValue;
                        wt[i, j] = wt[i, j - 1] + p[j - 1] + q[j];
                    }
                }
            }

            for (int k = 0 ; k <= n ; k++)
            {
                for (int i = 1 ; i + k <= n ; i++)
                {
                    int j = i + k;
                    for (int m = i ; m <= j ; m++)
                    {
                        double tmp = dp[i, m - 1] + dp[m + 1, j] + wt[i, j];
                        dp[i, j] = Math.Min(dp[i, j], tmp);
                    }
                }
            }

            Console.WriteLine(dp[1, n].ToString());

        }

        static string ReadSt() { return Console.ReadLine(); }
        static int ReadInt() { return int.Parse(Console.ReadLine()); }
        static long ReadLong() { return long.Parse(Console.ReadLine()); }
        static double ReadDouble() { return double.Parse(Console.ReadLine()); }
        static string[] ReadStAr(char sep = ' ') { return Console.ReadLine().Split(sep); }
        static int[] ReadIntAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e => int.Parse(e)); }
        static long[] ReadLongAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e => long.Parse(e)); }
        static double[] ReadDoubleAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e => double.Parse(e)); }

    }

}



Measured memory_bytes: 19380
#include<bits/stdc++.h>
  
#define lol long long
#define gcd(x,y) __gcd(x,y)
#define mt make_tuple
#define mp make_pair
#define fi first
#define se second
#define fixed(x) fixed<<setprecision(x)
using namespace std;
using pii=pair<int,int>;
template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }
template <class A> inline A abs(A &a) { return (a < 0 ? -a : a); }
bool inLine(int x,int y,int mx,int my){return (x>=0&&y>=0&&x<mx&&y<my);}
const lol inf=(1LL<<62);
const lol MOD=(1e9)+7;
const lol mod=998244353;
const int dx[]={1,0,-1,0,1,1,-1,-1};
const int dy[]={0,1,0,-1,1,-1,1,-1};
lol n,m,k,r;
signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >>n>>k;
  vector<int> a(n);
  for(auto&&o:a) cin >>o;
  for(int i=k;i<n;i++){
    if(a[i]>a[i-k])cout <<"Yes\n";
    else cout <<"No\n";
  }

  return(0);
}

Measured memory_bytes: 3984
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)

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

    int a, b, c, x, y;
    cin >> a >> b >> c >> x >> y;

    int l, m, n, mini = min(x, y);
    l = a * x + b * y;
    m = (2 * c * mini) + ((x - mini) * a) + ((y - mini) * b);
    n = (2 * c * max(x, y));

    cout << min(min(l, m), n) << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ft first
#define sc second
#define lb lower_bound
#define ub upper_bound
#define pb(t) push_back(t)
#define pt(num) cout << num << "\n"
#define chmax(a, b) (a<b ? a=b : 0)
#define chmin(a, b) (a>b ? a=b : 0)
#define max(a, b) ((a)>(b) ? (a):(b))
#define min(a, b) ((a)<(b) ? (a):(b))
#define moC(a, s, b) (a)=((a)s(b)+MOD)%MOD
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef map<ll, ll> Map;
static const ll INF=1e18;
static const ll MAX=1e5+7;
static const ll MOD=1e9+7;


ll N, M;
ll clr[MAX];
vector<ll> g[MAX];

void dfs(ll u, ll c) {
    clr[u]=c;
    
    ll i, v;
    ll f=1;
    for(i=0; i<g[u].size(); i++) {
        v=g[u][i];
        if(clr[v]==-1)
            dfs(v, 1-c);
    }
    
}

int main(void) {
    cin >> N >> M;
    ll i, j;
    
    for(i=0; i<M; i++) {
        ll a, b;
        cin >> a >> b;
        a--; b--;
        g[a].pb(b);
        g[b].pb(a);
    }
    
    for(i=0; i<N; i++) clr[i]=-1;
    dfs(0, 0);
    
    ll f=1;
    for(i=0; i<N; i++) {
        for(j=0; j<g[i].size(); j++) {
            ll v=g[i][j];
            if(clr[i]==clr[v]) {
                f=0;
                break;
            }
        }
    }
    
    if(!f) pt(N*(N-1)/2-M);
    else {
        ll a=0, b=0;
        for(i=0; i<N; i++) {
            if(clr[i]==0) a++;
            if(clr[i]==1) b++;
        }
        pt(a*b-M);
    }
    
}






Measured memory_bytes: 7936
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using u64 = unsigned long long;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

int main() {
    int n;
    cin >> n;
    string ans;
    do {
        if(n%3 == 0) ans += '0', n /= 3;
        else if(n%3 == 1) ans += '+', n /= 3;
        else ans += '-', n = 1+n/3;
    }while(n);
    reverse(ans.begin(),ans.end());
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 3196
#define _USE_MATH_DEFINES
#include <array>
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>
#include <random>
#include <ctime>

using namespace std;

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 29;
const int MOD = 1e9 + 7;
mt19937 mrand(random_device{}());
int rnd(int x) { return mrand() % x; }

int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  vector<int> pre(n + 1);
  for (int i = 1; i <= n; ++i) {
    int x;
    scanf("%d", &x);
    pre[i] = (pre[i - 1] + x) % m;
  }
  map<int, int> cnt;
  int64 ret = 0;
  for (int i = 0; i <= n; ++i) {
    if (i >= m) {
      int j = i - m;
      int y = (pre[j] + m - j % m) % m;
      --cnt[y];
    }
    int x = (pre[i] + m - i % m) % m;
    // trace(i, x, cnt[x]);
    ret += cnt[x];
    cnt[x]++;
  }
  printf("%lld\n", ret);
  return 0;
}


Measured memory_bytes: 10368
def main():
    N, M = map(int, input().split())
    g = []
    d = [float('INF')] * (N + 1)
    d[1] = 0
    for _ in range(M):
        a, b, c = map(int, input().split())
        g.append((a, b, -c))
    for i in range(2 * N):
        for x, y, z in g:
            if d[x] != float('INF') and d[y] > d[x] + z:
                d[y] = d[x] + z
                if y == N and i > N:
                    print("inf")
                    exit()

    print(-d[-1])


main()


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

int main(){
  string s;
  cin >> s;
  for(int i=0;i<s.size()-1;i++){
    for(int j=i+1;j<s.size();j++){
      if(s[i]==s[j]){
        cout << "no" << endl;
        return 0;
      }
    }
  }
  cout << "yes" << endl;
}


Measured memory_bytes: 256
class UnionFind:
    def __init__(self,n):
        #木の親要素　par[x]=xならxは根。par[x]=1ならxの親は1
        #最初は全員自分の親は自分
        self.par = [i for i in range(n+1)]
        #要素数
        self.elm = [0]+[1]*(n)
        #木の高さを格納(1:木は低いほうがいい　2:親要素の書き換えは少ないほうがいい)
        #低->高
        self.rank = [0]*(n+1)
        
    #探索
    def find(self,x):
        #根ならその番号を返す
        if self.par[x] == x:
            return x
        
        #根でないなら親の要素で再検索
        else:
            #走査していく過程で親を書き換える(これで同じグループでは全員同じ親)
            self.par[x] = self.find(self.par[x])
            return self.par[x]
        
    #併合
    def union(self,x,y):
        #根を探す
        x = self.find(x)
        y = self.find(y)
        #木の高さを比較し、低いほうから高い方に辺を張る
        if self.rank[x] < self.rank[y]:
            self.par[x] = y
            self.elm[y] += self.elm[x]
        else:
            self.par[y] = x
            self.elm[x] += self.elm[y]
        #木の高さが同じならば片方を1増やす
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1

    #同じ集合に属するか判定
    def same_check(self,x,y):
        return self.find(x) == self.find(y)
    
    #xが属する木のサイズを返す
    def count(self,x):
        return self.elm[self.find(x)]
    
    
def conne(n):
    return n*(n-1)//2

n,m=map(int,input().split())
AB=[tuple(map(int,input().split())) for i in range(m)]
AB=AB[::-1]

uc=conne(n)
unconv=[uc]
conv=0

# n個の島、橋は0
uf=UnionFind(n)

ufsc=uf.same_check
ufu=uf.union
ufc=uf.count

unconv_app=unconv.append


for ab in AB:
    a=ab[0]
    b=ab[1]
    if conv<uc:
        #aとbが属する木が異なる
        if ufsc(a,b)==False:
            #aが属する木と、bが属する木を併合
            conv-=conne(ufc(a))
            conv-=conne(ufc(b))
            ufu(a,b)
            conv+=conne(ufc(a))
       
    unconv_app(uc-conv)
    
unconv.pop()
unconv=unconv[::-1]

for i in range(m):
    print(unconv[i])

Measured memory_bytes: 25228
#include <bits/stdc++.h>
#define int long long
using namespace std;
int gcd(int a, int b){
    if (b==0) return a;
    return gcd(b, a%b);
}
signed main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n, m;
    string s, t;
    cin >> n >> m >> s >> t;
    int k = gcd(n, m);
    int ll = n*m/k;
    map<int, char> kek;
    for (int i=0; i < n; i++){
        int ind = ll/n * i;
        kek[ind] = s[i];
    }
    for (int i=0; i < m; i++){
        int ind = ll/m * i;
        if (kek.count(ind) && kek[ind] != t[i]){
            cout << -1;
            return 0;
        }
        kek[ind] = t[i];
    }
    cout << ll;
}


Measured memory_bytes: 10880
#include<bits/stdc++.h>                                                                                               
using namespace std;
 
#define rep(i,n) for(int i=0;i<(n);++i)
#define reps(i,n) for(int i=1;i<=(n);++i)
#define all(x) (x).begin(),(x).end()
#define int long long
#define mk_p(a,b)   make_pair((a),(b))
using pii = pair<int,int>;
constexpr int INF  = 0x3f3f3f3f;
constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL;

int gcd(int a,int b){return b ? gcd(b,a%b) : a;} 
int lcm(int a,int b){return a/gcd(a,b)*b;}

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    string k = "CODEFESTIVAL2016";
    cin >> s;
    int n = s.size();
    int cnt = 0;
    rep(i,n){
        if(s[i] != k[i]) ++cnt;
    }   
    cout << cnt << '\n';
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std; 
#define INF_LL (int64)1e18
#define INF (int32)1e9
#define REP(i, n) for(int64 i = 0;i < (n);i++)
#define FOR(i, a, b) for(int64 i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
#define fs first
#define sc second

using int32 = int_fast32_t;
using uint32 = uint_fast32_t;
using int64 = int_fast64_t;
using uint64 = uint_fast64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;

const double eps = 1e-10;

template<typename A, typename B>inline void chmin(A &a, B b){if(a > b) a = b;}
template<typename A, typename B>inline void chmax(A &a, B b){if(a < b) a = b;}

template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

template<typename T,typename V>
typename enable_if<is_class<T>::value==0>::type
fill_v(T &t,const V &v){t=v;}

template<typename T,typename V>
typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t,const V &v){
  for(auto &e:t) fill_v(e,v);
}

int main(void) {
	int64 N;
	cin >> N;
	vector<int64> A(N), sum(N+1, 0);
	REP(i, N) cin >> A[i];
	REP(i, N) sum[i+1] += sum[i] + A[i];
	int64 res = INF_LL;
	REP(i, N) {
		auto bin = [&](int64 l, int64 r) {
			int64 ll = l, rr = r;
			int64 s = sum[r]-sum[l];
			int64 m;
			while (r-l > 1) {
				m = (l + r) >> 1;
				if (2*(sum[m]-sum[ll]) < s) {
					l = m;
				} else {
					r = m;
				}
			}
			return l;
		};
		int64 a = bin(0, i), b = bin(i, N);
		REP(pa, 2) REP(pb, 2) {
			vector<int64> v = {sum[a+pa], sum[i]-sum[a+pa], sum[b+pb]-sum[i], sum[N]-sum[b+pb]};
			sort(all(v));
			res = min(res, v[3]-v[0]);
		}
	}
	cout << res << endl;
}



Measured memory_bytes: 3328
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Text;
using System.Text.RegularExpressions;
using System.Linq;
using System.IO;

class Program
{
    static private Magatro M = new Magatro();
    static private void Main(string[]args)
    {
        M.Scan();
        M.Solve();
    }
}

public class Scanner
{
    private string[] S;
    private int Index;
    private char Separator;
    private StreamReader Sr;

    public Scanner(char separator = ' ')
    {
        Index = 0;
        Separator = separator;
        S = new string[0];
        Sr = new StreamReader(Console.OpenStandardInput());
    }

    private string[] Line()
    {
        return Sr.ReadLine().Split(Separator);
    }

    public string Next()
    {
        string result;
        if (Index >= S.Length)
        {
            S = Line();
            Index = 0;
        }
        result = S[Index];
        Index++;
        return result;
    }
    public int NextInt()
    {
        return int.Parse(Next());
    }
    public double NextDouble()
    {
        return double.Parse(Next());
    }
    public long NextLong()
    {
        return long.Parse(Next());
    }
    public bool ScanToEnd(ref string s)
    {
        if (Sr.EndOfStream)
        {
            return false;
        }
        else
        {
            s = Sr.ReadLine();
            return true;
        }
    }

}

public class Magatro
{
    Scanner sc = new Scanner();
    private const int loop = 999999;
    private int[] PrimeCnt = new int[loop+1];

    public void Scan()
    {

    }

    public void Solve()
    {
        string input="";
        Cnt();
        while(sc.ScanToEnd(ref input))
        {
            int n = int.Parse(input);
            Console.WriteLine(PrimeCnt[n]);
        }
    }

    private void Cnt()
    {
        bool[] num = new bool[loop+1];
        num[0] = num[1] = true;
        int sq = (int)Math.Sqrt(loop);
        for(int i = 4; i <= loop; i += 2)
        {
            num[i] = true;
        }
        for(int i = 3; i <= sq; i += 2)
        {
            if (!num[i])
            {
                for(int j = i * 2; j <= loop; j += i)
                {
                    num[j] = true;
                }
            }
        }
        int cnt = 0;
        for(int i = 0; i <= loop; i++)
        {
            if (!num[i]) cnt++;
            PrimeCnt[i] = cnt;
        }
    }
}

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

int main(){
    int n;
    cin >> n;
    int ans=0;
    int k=0;
    int a,b;
    rep(i,n){
        cin >> a >> b;
        if(a==b){
            ++k;
            if(k==3){
                ans=1;
            }
        }
        else{
            k=0;
        }
    }

    if(ans==1){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
    

    return 0;
}

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

x = y = t = 0
for i in range(n):
    dx, dy, dt = l[i][1], l[i][2], l[i][0]
    dist = abs((dx - x) + (dy - y))

    if abs(dt - t) < dist or (dt - t - dist) % 2:
        print("No")
        exit()

    x, y, t = dx, dy, dt
print("Yes")

Measured memory_bytes: 27156
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);++i)
#define ALL(v)   (v).begin(),(v).end()
#define INF      (int)1e9
#define MOD      (int)1e9+7
using namespace std;
typedef long long     llong;
typedef pair<int,int> pii;
typedef vector<int>   vi;
typedef vector<vi >   vvi;
typedef vector<vvi >  vvvi;

int main(){
	int n,k;
	cin>>n>>k;
	
	int cnt[200000]={};
	REP(i,n){
		int a;
		cin>>a;
		cnt[--a]++;
	}
	sort(cnt,cnt+200000);
	
	llong ans=0;
	REP(i,200000-k) ans+=cnt[i];
	
	cout<<ans<<endl;
	return 0;
}//解答参考.

Measured memory_bytes: 1024
import java.util.*;
 
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
        
        long w = sc.nextInt();
        long h = sc.nextInt();
        int x = sc.nextInt();
        int y = sc.nextInt();

        long value = w * h;
        if (x == w / 2 && w % 2 == 0 && y == h / 2 && h % 2 == 0) {
            if (value % 2 == 0) {
                System.out.println(value / 2 + ".0 " + 1);
            } else {
                System.out.println(value / 2 + ".5 " + 1);
            }
        } else {
            if (value % 2 == 0) { 
                System.out.println(value / 2 + ".0 " + 0);
            } else {
                System.out.println(value / 2 + ".5 " + 0);
            }
        }
	}
}


Measured memory_bytes: 21716
#include<bits/stdc++.h>
#define LL long long
using namespace std;

const int N = 400000+9;

struct Edge{int u,v,w;}e[N];
struct Operation{int p,c;}op[N];
priority_queue<Operation> que;
int n,m,tot,vis[N],fa[N]; LL vout;

inline bool operator < (const Edge &A, const Edge &B) {return A.w < B.w;}
inline bool operator < (const Operation &A, const Operation &B) {return A.c > B.c;}

inline int read() {
	char c=getchar(); int f=1,ret=0;
	while (c<'0'||c>'9') {if(c=='-')f=-1;c=getchar();}
	while (c<='9'&&c>='0') {ret=ret*10+c-'0';c=getchar();}
	return ret * f;
}

inline int find(int w) {
	int f = fa[w], tmp;
	while (f != fa[f]) f = fa[f];
	while (w != f) tmp = fa[w], fa[w] = f, w = tmp;
	return f;
}

int main() {
	//freopen("11input.in","r",stdin);
	n = read(); m = read();
	for (int i=1,a,b,c;i<=m;i++) {
		a = read(); b = read(); c = read();
		e[++tot] = (Edge){a, b, c};
		que.push((Operation){a, c+1});
		que.push((Operation){b, c+2});
	}
	while (!que.empty()) {
		Operation w = que.top(); que.pop();
		if (!vis[w.p]) {
			vis[w.p] = 1;
			e[++tot] = (Edge){w.p, (w.p+1)%n, w.c};
			que.push((Operation){(w.p+1)%n, w.c+2});
		}
	}
	sort(e+1, e+1+tot);
	for (int i=0;i<=n;i++) fa[i] = i;
	for (int i=1;i<=tot;i++) {
		if (find(e[i].u) != find(e[i].v)) {
			fa[fa[e[i].u]] = fa[e[i].v];
			vout += e[i].w;
		}
	}
	printf("%lld\n",vout);
	return 0;
}


Measured memory_bytes: 9708
#include<bits/stdc++.h>
using namespace std;
int n,m,a,b;map<int,int>M[220000];
int main(){
    cin>>n>>m;
    for(int i=0;i<m;i++){
        cin>>a>>b;M[a][b]=1;M[b][a]=1;
    }
    for(int i=2;i<=n-1;i++){
        if(M[1][i]==1 && M[i][n]==1){cout<<"POSSIBLE"<<endl;return 0;}
    }
    cout<<"IMPOSSIBLE"<<endl;
    return 0;
}

Measured memory_bytes: 38656
#include<stdio.h>

int main(){
  int i, j;
  int h, w;

  while(1){
    scanf("%d %d", &h, &w);

    if(h == 0 && w == 0) break;
  
    for(i = 0; i < h; i++){
      for(j = 0; j < w; j++){
	printf("#");
      }
      printf("\n");
    }
    printf("\n");
  }
  
  return 0;
}


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

int main(void) {

  int a, b;

  scanf("%d %d", &a, &b);
  if((a<1)||(100<a)||(b<1)||(100<b)){
    printf("error\n");
    return -1;
  }

  printf("%d\n", a*b);
  return 0;
}


Measured memory_bytes: 1732
#include <bits/stdc++.h>
using namespace std;
 
 
typedef long long ll;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef long double ld;
 
typedef set<int>::iterator sit;
typedef map<int,int>::iterator mit;
typedef vector<int>::iterator vit;
 
const int INF = 1e9 + 7;
const int MOD = 1e9 + 7;
const int MAXN = 1e6 + 3;
 
#define _  %  MOD
#define __ %= MOD
 
#define      each(it,s)        for(auto it = s.begin(); it != s.end(); ++it)
#define      sortA(v)          sort(v.begin(), v.end())
#define      sortD(v)          sort(v.begin(), v.end(), greater<auto>())
#define      fill(a)           memset(a, 0, sizeof (a))
 
#define      swap(a,b)        {a=a+b;b=a-b;a=a-b;}
#define      rep(i, n)         for(ll i = 0; i < (n); ++i)
#define      repA(i, a, n)     for(ll i = a; i <= (n); ++i)
#define      repD(i, a, n)     for(ll i = a; i >= (n); --i)
#define watch(x) cout << (#x) << " is " << (x) <<endl
 
#define fi first
#define se second
#define mp make_pair
#define pb push_back
 
#define fbo find_by_order
#define ook order_of_key
 
ll gcd(ll a,ll b){if(b==0) return a; else return gcd(b,a%b);}
ll power(ll x,ll y){ll res=1; while(y>0){if(y&1) res=res*x;y=y>>1;x=x*x;}return res;} // modular exponent
 
int main()
{
    ios_base::sync_with_stdio(false); // don't use printf and scanf
    cin.tie(NULL); // cout<<fixed<<setprecision
    
	string s;
	cin>>s;
	int n=s.length();
	if(s[n-1]=='s')
	{
		s+="es";
	}
	else s+='s';
	cout<<s<<'\n';
	return 0;
}
// JUST ASK YOURSELF DID YOU GIVE YOUR BEST ? ISSE ZYADA
// KUCH KAR BHI NAHI SAKTE !! ENJOY AND GIVE YOUR BEST!!



Measured memory_bytes: 3644
#include<cstdio>
#include<iostream>
#include<string>
#include<cstring>
#include<list>
#include<algorithm>
    
#define NMAX 2000000+10
using namespace std;
     
    
     
int main(void){
    std::ios_base::sync_with_stdio(false);
    int n;
    string inp;
    int x;
    list<int> data;
    list<int>::iterator iter,fun;
    
    cin>>n;
     
    while(n--){
        cin>>inp;
     
        if(inp[6]=='F') data.pop_front();
        else if(inp[6]=='L') data.pop_back();
        else{
            cin>>x;
            if(inp[0]=='i') data.push_front(x);
            else{
                fun=find(data.begin(),data.end(),x);
                if(fun!=data.end()) data.erase(fun);
            }
        }
    }
     
    iter=data.begin();
    cout<<*iter;
    *iter++;
    while(iter!=data.end()){
        cout<<" ";
        cout<<*iter;
        iter++;
    }
    cout<<endl;
    
    return 0;
}

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

using namespace std;

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

template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }

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

const ll INF = 1ll<<29;
const ll MOD = 1000000007;
const double EPS = 1e-9;

int N;
int d[20];
vector<pii> g[20];

void dfs(int u, int prev) {
	REP(i, g[u].size()) if (g[u][i].fi != prev) {
		d[g[u][i].fi] = d[u] + g[u][i].se;
		dfs(g[u][i].fi, u);
	}
}

int main() {
	while (cin >> N, N) {
		REP(i, N) g[i].clear();
		
		int sum = 0;
		
		REP(i, N - 1) {
			int a, b, t;
			scanf("%d %d %d", &a, &b, &t);
			a--; b--;
			g[a].push_back(pii(b, t));
			g[b].push_back(pii(a, t));
			sum += t * 2;
		}
		
		d[0] = 0;
		dfs(0, -1);
		
		int ma = -1;
		FOR(i, 1, N) if (g[i].size() == 1) {
			sum -= g[i][0].se * 2;
			chmax(ma, d[g[i][0].fi]);
		}
		
		cout << sum - ma << endl;
		
	}
	return 0;
}

Measured memory_bytes: 3152
module.exports=function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=0)}([function(e,t,r){r(1)(r(2).readFileSync("/dev/stdin","UTF-8"))},function(e,t){e.exports=function(e){var t=e.split(" ");Number(t[0])%Number(t[1])==0?console.log(0):console.log(1)}},function(e,t){e.exports=require("fs")}]);

Measured memory_bytes: 9420
import java.util.*

fun main(args:Array<String>){
    val n = readLine()!!.toInt()
    val a = readLine()!!.split(" ").map{it.toInt()}
    var ans = 0
    var r = 0
    for(l in 0 until n){
        if(r == l) r++
        while(r < n){
            if(a[r] <= a[r - 1]) r++
            else break
        }
        ans = Math.max(ans, r - l - 1)
    }
    println(ans)
}

Measured memory_bytes: 59896
#include <iostream>


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

    while (true) {
        C = C - B;
        if (C <= 0) {
            std::cout << "Yes" << std::endl;
            break;
        }
        A = A - D;
        if (A <= 0) {
            std::cout << "No" << std::endl;
            break;
        }
    }
}


Measured memory_bytes: 3584