akhauriyash/Code-Regression huggingface dataset:
import std.stdio, std.string, std.conv;
import std.range, std.algorithm, std.array;


void main() {
    int n;
    scan(n);
    auto a = readln.split.to!(int[]);

    foreach (i ; 0 .. n) {
        foreach (j ; i + 1 .. n) {
            if ((a[i] - a[j]) % (n - 1) == 0) {
                writeln(a[i], " ", a[j]);
                return;
            }
        }
    }
}


void scan(T...)(ref T args) {
    import std.stdio : readln;
    import std.algorithm : splitter;
    import std.conv : to;
    import std.range.primitives;

    auto line = readln().splitter();
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}



void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}



Measured memory_bytes: 2504
#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 P pair<int,int>
#define PiP pair<int,pair<int,int>>
#define all(x) x.begin(),x.end()
using namespace std;

int main() {
  int n;
  double ans;
  cin >> n;
  vector<double> v(n);
  rep(i, n) cin >> v.at(i);
  sort(all(v));
  ans = v.at(0);
  for(int i = 1; i < n; i++)  ans = (ans + v.at(i)) / 2; 
  cout << setprecision(10) << ans;
}

Measured memory_bytes: 256
#python3
def main():
    s = input()
    ans = 0
    cnt = 0
    for i in range(len(s)):
        if (s[i] == "A") | (s[i] == "T") | (s[i] == "C") | (s[i] == "G"):
            cnt += 1
        else:
            cnt = 0
        ans = max(ans, cnt)
    print(ans)
main()


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<long long> vl;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
#define INF __INT32_MAX__
#define LINF __LONG_LONG_MAX__

int main() {
    int N, X, T; cin >> N >> X >> T;

    int min = (N / X) * T;
    if (N % X != 0) min += T;

    cout << min << endl;
}


Measured memory_bytes: 3620
#define _CRT_SECURE_NO_WARNINGS
#include"bits/stdc++.h"
#ifdef _DEBUG
#define DBG(n) n
#else
#define DBG(n)
#endif
#define INF          1e9
#define INFLL        1e18
#define EPS          1e-9
#define MOD          1000000007
#define REP(i,n)     for(ll i=0,i##_len=(n);i<i##_len;++i)
#define REP1(i,n)    for(ll i=1,i##_len=(n);i<=i##_len;++i)
#define REPR(i,n)    for(ll i=(n)-1;i>=0;--i)
#define REPR1(i,n)   for(ll i=(n);i>0;--i)
#define REPC(i,obj)  for(auto i:obj)
#define ALL(obj)     (obj).begin(),(obj).end()
#define SETP(n)      cout<<fixed<<setprecision(n)
#define VV(T,h,w)    move(vector<vector<T>>(h,move(vector<T>(w))))
#define VVI(T,h,w,i) move(vector<vector<T>>(h,move(vector<T>(w,i))))
using namespace std;
using ll = long long;
template<typename T = ll>inline T in() { T ret; cin >> ret; return ret; }

int main()
{
	ll n = in();
	double ave = 0;
	vector<ll>a(n); REP(i, n) { a[i] = in(); ave += a[i]; }
	ave /= n;
	double diff = INFLL;
	ll ind;
	REP(i, n) {
		if (abs(ave - a[i]) < diff) {
			ind = i;
			diff = abs(ave - a[i]);
		}
	}
	cout << ind << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define sz(x) (int)(x).size()
using namespace std;
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
//uniform_int_distribution<int>(1000,10000)(rng)

ll binpow(ll a, ll b)
{
    if (b == 0)
        return 1;
    ll res = binpow(a, b / 2);
    res*=res;
    if (b % 2)
        return res * a;
    return res;
}

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

string to_upper(string a)
{
    for (int i=0;i<(int)a.size();++i) if (a[i]>='a' && a[i]<='z') a[i]-='a'-'A';
    return a;
}
 
string to_lower(string a)
{
    for (int i=0;i<(int)a.size();++i) if (a[i]>='A' && a[i]<='Z') a[i]+='a'-'A';
    return a;
}

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    int n,k;
    cin>>n>>k;
    int a[n];
    for (int i=0;i<n;++i)
        cin>>a[i];
    for (int i=0;i+k<n;++i)
    {
        if (a[i]<a[i+k])
            cout<<"Yes\n";
        else
            cout<<"No\n";
    }
    return 0;
}

Measured memory_bytes: 4420
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

using namespace std;
typedef long long int ll;

#define PI (acos(-1))
#define REP(i,n) for(int (i)=0;(i)<(n);(i)++)

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define dumparr(x) cerr << #x ; for(auto elem: x){cerr << " " << elem;} cerr << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))

int main(void){
    int n; cin >> n;
    vector <int> as;
    vector <bool> painted;
    int a;
    REP(i, n){
        cin >> a;
        as.push_back(a);
        painted.push_back(false);
    };
    map <int, int> curs = {{as[0], 1}};
    for(int i=1; i<n; i++){
        int min_val = (*curs.begin()).first;
        int max_val = (*curs.rbegin()).first;

        if (as[i] > min_val){
            auto it = curs.lower_bound(as[i]);
            it--;
            int d = it->first;
            if (curs[d] == 1){
                curs.erase(d);
            } else {
                curs[d]--;
            }
            curs[as[i]]++;
        } else {
            curs[as[i]]++;
        }
    }
    int ans = 0;
    for (auto c: curs){
        ans += c.second;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 5240
#include <cstdio>
#include <cstring>
#include <utility>
#include <cmath>
#include <algorithm>
#include <iostream>
using namespace std;

int main()
{
  long long n;
  long long ans = 0;
  cin >> n;
  ans += n/11;
  ans *=2;

  if(n%11==0){
    cout << ans <<endl;
  }else if(n%11 < 7){
    cout << ans + 1 <<endl;
  }else{
    cout << ans + 2 <<endl;
  }
}


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

signed main(){
    long long a , ans;
    string b;

    cin >> a;
    cin >> b;

    ans = a * (b[3] - '0')  + a * (b[2] - '0') * 10 + a * (b[0] - '0') * 100;
    cout << ans / 100 << endl;

    return(0);
}

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

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

	string ans = "NO";
	for(int i=1;i<b;i++){
		if((i*a)%b==c){
			ans="YES";
			break;
		}
	}
	cout<<ans<<endl;

	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void){
  int a[3], i, x;
  int max=0, min=100, maxIndex, minIndex;
  for(i=0; i<3; i++){
    scanf("%d",&a[i]);
  }
  for(i=0; i<3; i++){
    if(max <= a[i]){
      max = a[i]; 
      maxIndex = i;
    }
    if(min >= a[i]){
      min = a[i];
      minIndex = i;
    }
    
  }
  x = a[maxIndex]-a[minIndex];
  printf("%d",x);
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
using namespace std;
typedef long long ll;
typedef pair<int, int> P; 
const int inf = 1<<21;
const ll INF = 1LL << 60;
const ll mod = 1e9+7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    ll sum = 0;
    rep(i, n+1){
        if(i%3!=0 and i%5!=0){
            sum += i;
        }
    }
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 3596
#include<bits/stdc++.h>
#define fo(i,w,n) for(int i=(int) w;i<(int) n;i++)
#define qi queue<int>
#define vi vector<int>
#define ll long long
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define pii pair<int,int>
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define fi first
#define se second
#define prq priority_queue
#define foreach(it,c) for(__typeof((c).begin()) it=c.begin();it!=c.end();it++)
using namespace std;
inline ll read(){
	ll x=0;
	int f=1;
	char c=getchar();
	for(;!isdigit(c);c=getchar()) if(c=='-')f=-f;
	for(;isdigit(c);c=getchar())x=x*10+(c-'0');
	return x*f;
}
int n,a[111],b[111],c[111];
int main(){
	//freopen("a.in","r",stdin);
	//freopen("a.out","w",stdout);
	cin>>n;
	fo(i,0,n){
		cin>>a[i];
		b[i]=c[i]=a[i];
	}
	sort(b,b+n);
	bool bb=1;
	fo(i,0,n) if(c[i]!=b[i])bb=0;
	if(bb){
		cout<<"YES\n";
		return 0;
	}
	fo(i,0,n) fo(j,i+1,n){
		fo(k,0,n)c[k]=a[k];
		swap(c[i],c[j]);
		bool d=1;
		fo(k,0,n) if(b[k]!=c[k])d=0;
		if(d){
			cout<<"YES\n";
			return 0;
		}
	}
	cout<<"NO\n";
	return 0;
}


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

cnt=0
S=0
mi=10000000000
C0=False

for i in range(N):
    mi=min(mi,abs(A[i]))
    if A[i]>0:
        S+=A[i]
    elif A[i]==0:
        C0==True
    elif A[i]<0:
        cnt+=1
        S+=(-A[i])

if cnt%2==0 or C0==True:
    print(S)
else:
    print(S-mi*2)


Measured memory_bytes: 14284
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
const long long INF = numeric_limits<long long>::max();
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main() {
  string S; cin >> S;
  long long cnt[26];
  REP(i, 26) cnt[i] = 0;
  REP(i, S.size()) cnt[(int)(S[i] - 'a')]++;

  long long ans = 1 + S.size() * (S.size() - 1) / 2;
  REP(i, 26) ans -= cnt[i] * (cnt[i] - 1) / 2;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 720
import Control.Applicative
import Control.Monad
import qualified Data.List as L
import qualified Data.Char

main ::IO()
main = do
  pqr <- map read . words <$> getLine :: IO [Int]
  putStrLn $ show $ solve pqr

solve :: [Int] -> Int
solve pqr =
  let [i,j,k] = L.sort pqr in
  i+j


Measured memory_bytes: 508
N = int(input())

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

if N == 1:
  print('Yes')
else:
  for i,h in enumerate(H):
    if i == 0:
      H[i] = H[i] - 1
    else:
      if H[i-1] < H[i]:
        H[i] = H[i] - 1
      elif H[i-1] == H [i]:
        None
      else:
        print('No')
        break
  else:
    print('Yes')
      
    
    
  

Measured memory_bytes: 14252
#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(){
	double n;
	cin >> n;
	vector<double> a(n);
	rep(i,n) cin >> a[i];
	double ans = 0;
	rep(i,n){
		ans += 1/a[i];
	}
	cout << fixed << setprecision(15) << 1/ans << endl;
}

Measured memory_bytes: 3768
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define ALL(v) (v).begin(), (v).end()

using namespace std;
using ll = long long;

int main()
{
  int N; cin >> N;
  cout << (N-2)*180 << endl;
}

Measured memory_bytes: 256
import numpy as np
array = np.zeros((3, 3), dtype="int8")
for i in range(3):
    inputs = [int(x) for x in input().split()]
    for j in range(3):
        array[i, j] = inputs[j]
    
b_1 = array[0, 0]
b_2 = array[0, 1]
b_3 = array[0, 2]
a_2 = array[1, 0] - b_1
a_3 = array[2, 0] - b_1
if (array[1, 1] == (a_2+b_2)) & (array[2, 2] == (a_3+b_3) ) & (array[1, 2] == (a_2+b_3)) & (array[2, 1] == (a_3+b_2)):
    flag = 1
else:
    flag = 0

if flag:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 12444
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
    int q;
    scanf("%d",&q);
    while (q--){
        int a,b,c,d;
        scanf("%d%d%d%d",&a,&b,&c,&d);
        int k = (max(a,b)-1)/(min(a,b)+1)+1;
        //printf("k is %d\n",k);
        for (int i = c; i <= d; i++){
            int b1 = i/(k+1);
            int a1 = i-b1;
            int b2 = b-b1;
            int a2 = a-a1;
            //printf("\nA1 = %d, A2 = %d, B1 = %d, B2 = %d\n",a1,a2,b1,b2);
            if ((ll)b2 < (ll)(a2+1)*k){
                ///first part
                //printf("first part");
                printf("%c",i%(k+1)==0?'B':'A');
            }
            else{
                printf("%c",(a+b-i+1)%(k+1)==0?'A':'B');
            }
        }
        printf("\n");
    }
}


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

#define rep(X,N) for(ll X = 0; X < (N); X++)
#define PI (acos(-1.0))
#define pback push_back
#define mpair make_pair
#define MODN 1000000007
#define ALL(V) (V).begin(),(V).end()
#define INT_MAX_HALF (INT_MAX / 2)
#define EPS (1e-10)

using namespace std;
typedef long long ll;

int main(){

    int n;
    cin >> n;

    vector<ll> a(n);
    bool a0neg = false;

    rep(i, n){
        cin >> a[i];

        if(i == 0 && a[i] < 0) a0neg = true;

        if(a0neg) a[i] = -1 * a[i];
    }


    ll ans = LLONG_MAX;

    ll ok = LLONG_MAX - 2;
    ll ng = -1;

    while(ok - ng > 1){
        
        ll costmax = (ok + ng) / 2;
        ll tmpcost = 0;
        ll tmpsum = a[0];

        if(a[0] == 0){
            tmpcost++;
            tmpsum++;
        }

        for(int i = 1; i < n; i++){

            if(i % 2 == 1){
                //a[i]の絶対値をtmpsumの絶対値より大きくしたい
                
                //cerr << tmpsum << " ";
                assert(tmpsum > 0);
                if(a[i] >= -1 * tmpsum){
                    ll tmp = -1 * tmpsum - 1;

                    tmpcost += abs(tmp - a[i]);
                    tmpsum += tmp; 
                }else{
                    tmpsum += a[i];
                }

            }else{

                //cerr << tmpsum << " ";
                assert(tmpsum < 0);
                if(a[i] <= -1 * tmpsum){
                    ll tmp = -1 * tmpsum + 1;

                    tmpcost += abs(tmp - a[i]);
                    tmpsum += tmp; 
                }else{
                    tmpsum += a[i];
                }

            }

        }

        if(tmpcost <= costmax){
            ok = costmax;
        }else{
            ng = costmax;
        }
    }

    ans = min(ans, ok);

    ok = LLONG_MAX - 2;
    ng = -1;
    ll addcost = a[0] - (-1);
    a[0] = -1;

    while(ok - ng > 1){
        
        ll costmax = (ok + ng) / 2;
        ll tmpcost = addcost;
        ll tmpsum = a[0];

        for(int i = 1; i < n; i++){

            if(i % 2 == 0){
                //a[i]の絶対値をtmpsumの絶対値より大きくしたい
                
                assert(tmpsum > 0);
                if(a[i] >= -1 * tmpsum){
                    ll tmp = -1 * tmpsum - 1;

                    tmpcost += abs(tmp - a[i]);
                    tmpsum += tmp; 
                }else{
                    tmpsum += a[i];
                }

            }else{

                assert(tmpsum < 0);
                if(a[i] <= -1 * tmpsum){
                    ll tmp = -1 * tmpsum + 1;

                    tmpcost += abs(tmp - a[i]);
                    tmpsum += tmp; 
                }else{
                    tmpsum += a[i];
                }

            }

        }

        if(tmpcost <= costmax){
            ok = costmax;
        }else{
            ng = costmax;
        }
    }

    ans = min(ans, ok);

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 1024
/////////////////////////////////////////
////////// ^\/^ *_* :) :-D '~' \\\\\\\\\\
/////////////////////////////////////////
#include <bits/stdc++.h>
//#include <algorithm>
//#include <cstdio>
//#include <functional>
#include <iostream>
//#include <cfloat>
//#include <climits>
//#include <cstdlib>
//#include <cstring>
//#include <cmath>
//#include <map>
//#include <queue>
//#include <set>
//#include <sstream>
//#include <stack>
//#include <string>
//#include <time.h>
//#include <vector>
//#include <random>
//#include <unordered_set>
//#include <complex>
//#include <string.h>
 
#define rt0 return 0
#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
#define LL long long
#define pii pair<int,int>
#define pb push_back
#define fi first
#define se second
#define mpr make_pair
 
using namespace std;
 
const LL MOD=1e9+7;
 
int n,m;
vector <pii> v[100010];
bool vis[100010];
int tot[100010];
 
void dfs(int pla,int all)
{
	if(vis[pla])
	{
		if(tot[pla]!=all)
		{
			puts("No");
			exit(0);
		}
		return;
	}
	vis[pla]=true;
	tot[pla]=all;
	rep(i,v[pla].size())
	{
		dfs(v[pla][i].fi,all+v[pla][i].se);
	}
}
 
int main()
{
	ios::sync_with_stdio(false);
	cin>>n>>m;
	rep(i,m)
	{
		int x,y,z;
		cin>>x>>y>>z;
		v[x].pb(mpr(y,z));
		v[y].pb(mpr(x,-z));
	}
	repn(i,n)
	{
		if(!vis[i])
		{
			memset(tot,0,sizeof(tot));
			dfs(i,0);
		}
	}
	puts("Yes");
	rt0;
}

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

class Assignment {
  static void Main() {
    var N = int.Parse(Console.ReadLine().Trim());
    var d = Console.ReadLine().Split(' ').Select(x => int.Parse(x.Trim())).ToArray();
    var l = d.Length;
    var sum = 0;
    
    for(var i = 0; i < l - 1; i++) {
      for(var j = i + 1; j < l; j++) {
        sum += d[i] * d[j];
      }
    }
    
    Console.WriteLine(sum);
    
  }
}

Measured memory_bytes: 13268
s = list(input())
t = [0]* (len(s)+1)

for i in range(len(s)):
    if s[i] == "<":
        t[i+1] = max(t[i]+1,t[i+1])
for i in range(len(s)-1,-1,-1):
    if s[i] ==">":
        t[i] = max(t[i+1]+1,t[i])
print(sum(t))


Measured memory_bytes: 27184
package main

import (
    "fmt"
    "sort"
)

func main() {
    var n int 
    fmt.Scan(&n)
    as := make([]int, n)
    for i := 0; i < n; i++ {
        fmt.Scan(&as[i])
    }   
    sort.Sort(sort.Reverse(sort.IntSlice(as)))
    var a, b int 
    for i := range as {
        if i%2 == 0 { 
            a += as[i]
        } else {
            b += as[i]
        }   
    }   
    fmt.Println(a - b)
}


Measured memory_bytes: 512
n = int(input())
a = [int(input()) for _ in range(n)]

import copy
b = copy.deepcopy(a)
b.sort(reverse=True)

m1 = b[0]
m2 = b[1]

for i in range(n):
    if a[i] == m1:
        print(m2)
    else:
        print(m1)


Measured memory_bytes: 14608
def sep():
    return map(int,input().strip().split(" "))
def lis():
    return list(sep())
import sys
sys.setrecursionlimit(10**6)

n,x,y=sep()



d = [0] * n

for i in range(0, n - 1):
    for j in range(i, n):
        d1 = j - i
        d2 = abs((x - 1) - i) + 1 + abs((y - 1) - j)
        # print(i,j,d1,d2)
        d_min = min(d1, d2)
        d[d_min] += 1
for k in range(1, n):
    print(d[k])






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

#define fr first
#define sc second
#define mk make_pair
#define pb push_back
#define ll long long
#define ld long double
#define OK puts("OK");
#define sz(s) (int)s.size()
#define all(s) s.begin(), s.end()

using namespace std;

const int N = 2e5 + 10;
const int inf = 1e9 + 7;

ll n, cnt;
deque <int> dq;

void go(ll a)
{
    if(a == 1)
        return;
    if(a & 1)
    {
        go(a - 1);
        dq.push_front(++ cnt);
        return;
    }
    go(a / 2);
    dq.pb(++ cnt);
}

main()
{
    cin >> n;
    go(n + 1);
    cout << 2 * cnt << endl;
    while(!dq.empty())
        cout << dq.front() << " ", dq.pop_front();
    for(int i = 1 ; i <= cnt ; i ++)
        cout << i << " ";
}


Measured memory_bytes: 256
#include <stdio.h>

#define N 20
#define Q 200
#define true 1
#define false 0

int n,A[N];

int solve(int, int);

int main(){

  int q,M[Q];
  int i;

  scanf("%d",&n);
  for(i=0;i<n;i++)
    scanf("%d",&A[i]);

  scanf("%d",&q);
  for(i=0;i<q;i++)
    scanf("%d",&M[i]);

  for(i=0;i<q;i++){
    
    if(solve(0, M[i])==1)printf("yes\n");
    else                 printf("no\n");

  }

  return 0;

}

int solve(int i,int m)
{

  if(m==0) return true;

  if(i>=n) return false;

  if(solve(i+1,m) == true || solve(i+1,m-A[i]) == true) return true;
  else                                                return false;

}

Measured memory_bytes: 580
#include <bits/stdc++.h>
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define REP(i, n) FOR(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define bit(x) (1L << (x))
using ll = long long;
using namespace std;

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

class Solver{
private:
  multiset<int, greater<int>> l;
  multiset<int> r;

  ll sum_b, m;

  void smooth_set(){
    const int ls = l.size(), rs = r.size(), ds = abs(ls - rs);

    if(ls < rs){
      copy(r.begin(), next(r.begin(), ds/2), inserter(l, l.end()));
      r.erase(r.begin(), next(r.begin(), ds/2));
    }

    if(rs < ls){
      copy(l.begin(), next(l.begin(), ds/2), inserter(r, r.end()));
      l.erase(l.begin(), next(l.begin(), ds/2));
    }
  }

  void insert(int a){
    if(a < *l.begin()){
      l.insert(a); l.insert(a);
    } else if(a <= *r.begin()){
      l.insert(a); r.insert(a);
    } else {
      r.insert(a); r.insert(a);
    }
  }

public:
  Solver(){
    sum_b = m = 0;
  }

  void query1(int a, int b){
    sum_b += b;

    if(l.size() && (a < *l.begin() || *r.begin() < a)){
        m += min(abs(a - *l.begin()), abs(a - *r.begin()));
    } 

    insert(a);

    smooth_set();
  }

  void query2(){
    cout << *l.begin() << " " << m + sum_b << endl;
  }
};

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

  Solver sv;
  while(q--){
    int c; cin >> c;
    if(c == 1){
      int a, b; cin >> a >> b;
      sv.query1(a, b);
    } else {
      sv.query2();
    }
  }

  return 0;
}


Measured memory_bytes: 18944
N = int(input())
A = [int(input()) for n in range(N)]
B, C = [], []
m = 10 ** 9
M = 0
for n in range(N):
    if A[n] < m:
        m = A[n]
    if A[N - n - 1] > M:
        M = A[N - n - 1]
    B.append(m)
    C.append(M)
C.reverse()
D = [C[n+1] - B[n] for n in range(N-1)]
print(max(D))



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

int main(){
    int n,max = 0,ansi = -1;
    cin >> n;
    vector<int> p(n);
    for(int i=0;i<n;i++){
        cin >> p[i];
        if(p[i] > max){
            max = p[i];
            ansi = i;
        }
    }
    int ans=0;
    for(int i=0;i<n;i++){
        if(i==ansi){
            ans += p[i]/2;
        }
        else{
            ans += p[i];
        }
    }
    cout << ans << endl;

}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		char[] str = sc.next().toCharArray();
		int q = sc.nextInt();
		String order;
		int a, b;
		char[] p;
		char tmp;
		for (int i = 0; i < q; i++) {
			order = sc.next();
			a = sc.nextInt();
			b = sc.nextInt();
			switch (order) {
			case "print":
				for (int j = a; j <= b; j++) {
					System.out.print(str[j]);
				}
				System.out.printf("%n");
				break;
			case "reverse":
				for (int j = a, k = b; j <= (b - a) / 2 + a; j++, k--) {
					tmp = str[j];
					str[j] = str[k];
					str[k] = tmp;
				}
				break;
			case "replace":
				p = sc.next().toCharArray();
				for (int j = a, k = 0; j <= b; j++, k++) {
					str[j] = p[k];
				}
				break;
			}
		}
		sc.close();
	}
}


Measured memory_bytes: 33584
let arr=readLine()!.characters.split{$0==" "}.map{Int(String($0))!}

let plus  = arr[0] + arr[1]
let minus = arr[0] - arr[1]
let mul   = arr[0] * arr[1]

var o = plus

if ( o < minus ) {
  o = minus
}

if ( o < mul ) {
  o = mul
}

print( o )


Measured memory_bytes: 4080
#include <bits/stdc++.h>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/integer/common_factor.hpp>
#include <boost/integer/common_factor_rt.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>

using std::string;
using std::vector;
using std::set;
using std::unordered_set;
using std::map;
using std::unordered_map;
using std::pair;
using std::cin;
using std::cout;

typedef uintmax_t    ull;
typedef intmax_t     ll;
typedef uint64_t     ul;
typedef uint32_t     ui;
typedef uint8_t      uc;

typedef boost::multiprecision::number<boost::multiprecision::cpp_dec_float<1000>> cpp_dec_float_1000;

constexpr char CRLF = '\n';
constexpr char SPACE = ' ';
constexpr char VECTOR_COUT_SEPARATOR = SPACE;
constexpr ll INF = 1000'000'007;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> std::ostream& operator<< (std::ostream& os, const std::vector<T>& vc) { for(auto it = vc.begin(); it != vc.end(); ++it) { if (std::next(it) == vc.end()) os << *it; else os << *it << VECTOR_COUT_SEPARATOR; } return os; }
template<class T1, class T2> inline std::ostream & operator<< (std::ostream & os, const std::pair<T1, T2> & p) { return os << p.first << ' ' << p.second; }

void solve(void)
{
  ui N; cin >> N;
  vector<ull> B(N - 1);
  for(auto& b : B) cin >> b;

  ull res{};
  res += B[0];
  for(ui i = 1; i < B.size(); ++i)
  {
    res += std::min(B[i - 1], B[i]);
  }

  res += B[B.size() - 1];
  cout << res << CRLF;
  return;
}

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

  solve();

  return 0;
}


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

#define lli long long int
#define REP(i,s,l) for(lli i=s;i<l;i++)
#define DEBUG 0
#define INF (1LL<<50)
#define MOD 1000000007

int main(){
    int n, m, x, y;
    cin >> n >> m >> x >> y;
    
    int N[n], M[m];
    for(int i=0; i<n; i++) cin >> N[i];
    for(int i=0; i<m; i++) cin >> M[i];

    int cnt = 0;
    vector<int> ans(y-x-1);
    int k = 0;
    string war = "War";
    for(int i=x+1; i<y; i++){
        for(int j=0; j<n; j++){
            if(N[j]<i){
                cnt++;
                if(cnt==n){
                    ans[k] = i;
                    k++;
                }
            }
        }cnt = 0;
    }

    ans.erase(ans.begin()+k, ans.end());


    if(ans.size()>0){
        for(int j=0; j<ans.size(); j++){
            for(int i=0; i<m; i++){
                if(M[i]>=ans[j]){
                    cnt++;
                    if(cnt==m){
                        war = "No War";
                    }
                }
            }cnt = 0;
        }
    }
    cout << war << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
  int N;
  bool flag = false;
  cin >> N;
  for (int i=1; i<=9; i++){
	if (N % i == 0 && N / i <= 9 && i <= 9){
      flag = true;
      break;
    }
  }
  cout << (flag ? "Yes" : "No") << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
  ll n, k, a;
  ll bi[50] = {};
  ll pw[50] = {};
  ll crr = 0;
  cin >> n >> k;
  pw[0] = 1;
  for(int i=1;i<50;i++) pw[i] = pw[i-1]*2;

  for(int i=0;i<n;i++){
    int idx = 0;
    cin >> a;
    while(a!=0){
      bi[idx++] += a%2;
      a/=2;
    }
  }
  for(int i=(int)log2(k);i>=0;i--){
    if(bi[i] < n-bi[i] && crr+pw[i] <= k){
      bi[i] = n-bi[i];
      crr += pw[i];
    }
  }
  ll ans = 0;
  for(int i=0;i<50;i++){
    ans += bi[i]*pw[i];
  }
  cout << ans << endl;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
int main(){int i,n,m,a,b;
cin>>n>>m;
vector<int>adj[n+1];
for(i=1;i<=m;i++){
    cin>>a>>b;
   adj[a].push_back(b);
   adj[b].push_back(a);
}
int ans[n+1]={0};
ans[1]=1;
queue<int>q;
q.push(1);
while(!q.empty()){
    int j=q.front();
    q.pop();
    for(auto it:adj[j]){
        if(ans[it])continue;
        ans[it]=j;
        q.push(it);
    }
}
bool ok=true;
for(i=1;i<=n;i++){if(!ans[i])ok=false;}
if(!ok){cout<<"No";}
else{
    cout<<"Yes\n";
    for(i=2;i<=n;i++){cout<<ans[i]<<"\n";}
}
    return 0;
}

Measured memory_bytes: 10364
using System;
using System.Collections.Generic;
using System.Collections;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using System.IO;
static class Program{
	const int mod=(int)1e9+7;
		static void Main(){
		Sc sc=new Sc();
		int[] s=sc.Ia;
		int[] dp=new int[s[1]+1];
		Stack<Tuple<int,int>> stk=new Stack<Tuple<int,int>>();
		int ans=0,p=0;
		for(int i = 1;i<=s[0];i++) {
			int[] q=sc.Ia2;
			p=0;
			for(int j = 1;j<=s[1];j++) {
				dp[j]=q[j]==1?0:dp[j]+1;
				p=j;
				while(stk.Count>0&&stk.Peek().Item1>dp[j]){
					ans=Math.Max(ans,stk.Peek().Item1*(j-stk.Peek().Item2));
					p=stk.Peek().Item2;
					stk.Pop();
				}
				if(stk.Count==0||stk.Peek().Item1<dp[j]){stk.Push(Tuple.Create(dp[j],p));}
			}
			while(stk.Count>0){
				ans=Math.Max(ans,stk.Peek().Item1*(s[1]+1-stk.Peek().Item2));
				stk.Pop();
			}
		}
		Console.WriteLine("{0}",ans);
	}
}

public class Sc{
	private string[] a;
	private int n=-1,m=0;
	public int I{get{if(n==-1||n==a.Length-1){n=-1;a=Console.ReadLine().Split();}n++;return int.Parse(a[n]);}}
	public long L{get{if(n==-1||n==a.Length-1){n=-1;a=Console.ReadLine().Split();}n++;return long.Parse(a[n]);}}
	public double D{get{if(n==-1||n==a.Length-1){n=-1;a=Console.ReadLine().Split();}n++;return double.Parse(a[n]);}}
	public string S{get{if(n==-1||n==a.Length-1){n=-1;a=Console.ReadLine().Split();}n++;return a[n];}}
	public int[] Ia{get{if(n!=-1&&n!=a.Length-1){m=n;n=-1;return Array.ConvertAll(a.Skip(m+1).ToArray(),int.Parse);}return Array.ConvertAll(Console.ReadLine().Split(),int.Parse);}}
	public int[] Ia2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),int.Parse);}}
	public long[] La{get{return Array.ConvertAll(Console.ReadLine().Split(),long.Parse);}}
	public long[] La2{get{return Array.ConvertAll(("0 "+Console.ReadLine()).Split(),long.Parse);}}
	public double[] Da{get{return Array.ConvertAll(Console.ReadLine().Split(),double.Parse);}}
	public string[] Sa{get{return Console.ReadLine().Split();}}
}


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

int main() {
  int h, w ; cin >> h >> w;
  vector<string> G(h);
  for (auto &s : G) cin >> s;
  vector<int> height, width;
  for (int i=0; i<h; ++i) {
    for (int j=0; j<w; ++j) {
      if (G[i][j] == '#') {
        height.push_back(i);
        break;
      }
    }
  }
  for (int j=0; j<w; ++j) {
    for (int i=0; i<h; ++i) {
      if (G[i][j] == '#') {
        width.push_back(j);
        break;
      }
    }
  }
  for (auto &i : height) {
    for (auto &j : width) {
      cout << G[i][j];
    }
    cout << "\n";
  }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << x << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){return o<<"("<<p.fs<<","<<p.sc<<")";}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){o<<"sz = "<<vc.size()<<endl<<"[";for(const T& v:vc) o<<v<<",";o<<"]";return o;}
typedef long long ll;
int N;
ll a[100000];
bool can(int x){
	ll now=0;
	rep(i,x+1) now+=a[i];
	for(int i=x+1;i<N;i++){
		if(now*2<a[i]) return 0;
		now+=a[i];
	}
	return 1;
}
int main(){
	cin>>N;
	rep(i,N) cin>>a[i];
	sort(a,a+N);
	int ub=N,lb=-1;
	while(ub-lb>1){
		int m=(ub+lb)/2;
		if(can(m)) ub=m;
		else lb=m;
	}
	cout<<N-ub<<endl;
}


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

int INF=0x3f3f3f3f;
//memset(a,0x3f,sizeof(a));

int main(){
	ios_base::sync_with_stdio(false);
	int x,a,b;
	cin>>x>>a>>b;
	if(b<=a) {cout<<"delicious"<<endl;return 0;}
	else {
		if((x+a)>=b) {cout<<"safe"<<endl;return 0;}
		else {cout<<"dangerous"<<endl;return 0;}
	}
	

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 11451419
int main(){
   ll n,cnt;
   cin>>n;
   vector<ll>dp(n+1,INF);
   dp[0]=0;
   for(int i=1;i<=n;i++){
        cnt=1;
        dp[i]=min(dp[i-cnt]+1,dp[i]);
       
        cnt=6;
        while(cnt<=i){
           dp[i]=min(dp[i-cnt]+1,dp[i]);
           cnt*=6;
        }
        cnt=9;
        while(cnt<=i){
           dp[i]=min(dp[i-cnt]+1,dp[i]);
           cnt*=9;
        }
   }
   cout<<dp[n]<<endl;
}

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

using namespace std;
#define LL long long
const int qq = 5005;
LL num[qq];
LL dp[qq];
int n;
LL k;

int main(){
	scanf("%d%lld", &n, &k);
	LL sum = 0;
	for(int i = 0; i < n; ++i)
		scanf("%lld", num + i), sum += num[i];
	if(sum < k){
		printf("%d\n", n);
		return 0;
	}
	sort(num, num + n, greater<int>());
	int res = 0;
	for(int i = 0; i < n; ++i){
		if(num[i] >= k){
			res++;
			continue;
		}
		int c = 0;
		for(int j = 0; j < n; ++j)
			if(j != i)	dp[c++] = num[j];
		bool flag = true;
		LL x = 0;
		LL maxn = 0;
		for(int j = 0; j < c; ++j){
			x += dp[j];
			if(x >= k){
				x -= dp[j];
			}
			maxn = max(maxn, x);
		}
		if(x + num[i] >= k)	res++;
	}
	printf("%d\n", n - res);
	return 0;
}


Measured memory_bytes: 384
//#include <boost/multiprecision/cpp_dec_float.hpp>
//#include <boost/multiprecision/cpp_int.hpp>
#include <stdio.h>
#include <iostream>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <math.h>
#include <algorithm>
using namespace std;
//namespace mp = boost::multiprecision;
//using llll = mp::cpp_int;
// 仮数部が1024ビットの浮動小数点数型(TLEしたら小さくする)
//using Real = mp::number<mp::cpp_dec_float<1024>>;
using ll = long long;
const double EPS = 1e-10;
const ll MOD = 7+(1e+9);

int main(){
  ll n;
  ll ans=0;
  cin>>n;
  ans=(n-2)*180;
  cout<<ans<<endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
using namespace std;

int main() {
        int n;
        cin >> n;
        int arr[n];

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

        for(int j = n; j > 0; j--) {
                cout << arr[j - 1];
                if(j > 1)  cout << " ";
        }

        cout << endl;
}



Measured memory_bytes: 3112
#include <iostream>
#include <string>

using namespace std;
typedef long long ll;

int main(void) {
	int i, a = 1, ans = 1;
	string s, buf, x;
	cin >> s;
	buf = s.substr(0, 1);
	for (i = 2; i <= s.size(); i++) {
		if (buf != s.substr(a, i - a)) {
			buf = s.substr(a, i - a);
			ans++;
			a = i;
		}
	}
	cout << ans << "\n";
	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define boost_io ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define int long long
#define num(a) a-'0'
#define charr(a) (a - 'A' + 1)
#define rep(i,a,b) for(int i=a;i<b;i++)
#define maxs(a,b) if(b>a)a=b
#define mins(a,b) if(b<a)a=b
#define debug(x) cerr<<"["<<#x<<":"<<x<<"] "
#define debug2(a,b) debug(a);debug(b)
#define debug3(a,b,c) debug2(a,b);debug(c)
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*b)/(__gcd(a,b))
#define print(arr) for(auto it = arr.begin();it < arr.end();it ++){cout << *it << " ";}cout << ln;
#define all(a) (a).begin(), (a).end()
#define vi vector<long long>
#define v vector
#define p pair
#define pb push_back
#define mk make_pair
#define f first
#define s second
#define ln "\n"
typedef long double ld;
typedef double d;
using namespace std;
int modF=1e9+7;
int INF=1e11;

void solve(){
    ld dh,t,s;
    cin>>dh>>t>>s;
    if(dh/s<=t){
    cout<<"Yes\n";
    }
    else{
        cout<<"No\n";
    }
}

signed main(){
	boost_io;
	solve();
	return 0;
}


Measured memory_bytes: 3740
function Main(input) {
  input = input.split("\n");
  var H = parseInt(input[0].split(" ")[0]);
  var W = parseInt(input[0].split(" ")[1]);
  var h = parseInt(input[1].split(" ")[0]);
  var w = parseInt(input[1].split(" ")[1]);

  var AtCoder = function(){};

  AtCoder.prototype = {
    procedure: function(){
      return H*W - (h*W+w*H-h*w);
    }
  }
  var atcoder = new AtCoder();
  console.log(atcoder.procedure());
}

var input=Main(require("fs").readFileSync("/dev/stdin", "utf8"));
// var input=`5 5
// 2 3`
// Main(input);


Measured memory_bytes: 7372
#include <bits/stdc++.h>
#include <set>
#define rep(i,n) for (int i =0; i < (n); ++i)
using namespace std;
// 153b

int main() {
  int h,n;
  cin >> h >> n;
  vector<int> a(n);
  rep(i,n) cin >> a[i];
  rep(i,n) h -= a[i];
  if (h <= 0) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <stdio.h>

using namespace std;

int main(){
   int H, W;
   
   while(true){
       cin >> H >> W;
       if(H==0 && W==0) break;
       
       for(int i=0;i<H;i++){
           for(int j=0;j<W;j++){
               if (i==0 || i==H-1 || j==0 || j==W-1){
                 cout << "#";
               } else {
                 cout << ".";
               }
           }
           cout << endl;
       }
       cout << endl;
   }
   
   return 0;
}


Measured memory_bytes: 3004
#include <iostream>
#include <random>
#include <chrono>
#include <algorithm>
#include <cstring>

#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
using namespace std;
typedef long long ll;
const ll MOD = (ll)1e9 + 7;
const int N = 1e5+5, inf = 1e9+5;
ll add(ll x, ll y) { x += y; if (x >= MOD) return x - MOD; return x; }
ll sub(ll x, ll y) { x -= y; if (x < 0) return x + MOD; return x; }
ll mult(ll x, ll y) { return (x * y) % MOD; }
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

vector<int> adj[N];
int dp[N];

int f(int id) {
    if (dp[id] != -1) return dp[id];
    int best = 0;
    for (int u : adj[id])
        best = max(best, f(u)+1);
    return dp[id] = best;
}

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    int n, m; cin >> n >> m;
    memset(dp, -1, sizeof(dp));
    rep (i, 0, m) {
        int u, v; cin >> u >> v;
        adj[u].push_back(v);
    }
    int ans = 0;
    for (int i = 1; i <= n; ++i) f(i);
    for (int i = 1; i <= n; ++i) ans = max(ans, f(i));
    cout << ans << endl;
    
    return 0;
}

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

int main() {
	
	ios_base::sync_with_stdio(false); 
    cin.tie(NULL); 
     
      long long n,i,j,k,sum=0,count=0,ans=0,x,y,l,r;
      cin>>n;
      long long a[n],b[1000000]={0};
      for(i=0;i<n;i++)
      {
          cin>>a[i];
          b[a[i]]++;
          ans+=a[i];
      }
      int q;
      cin>>q;
      while(q--)
      {
          cin>>l>>r;
          ans=ans-l*b[l]+r*b[l];
          b[r]+=b[l];
          b[l]=0;
          cout<<ans<<"\n";
      }
	return 0;
}

Measured memory_bytes: 12208
#include<stdio.h>

int dp[50];

int fib ( int n ) {
	if ( n == 0 || n == 1 ) return dp[n] = 1;
	if ( dp[n] != -1 ) return dp[n];
	return dp[n] = fib ( n - 1 ) + fib ( n - 2 );
}

int main () {
	int n, i;
	for ( i = 0; i < 50; i++ ) dp[i] = -1;
	
	scanf ( "%d", &n );
	printf ( "%d\n", fib ( n ) );
	
	return 0;
}


Measured memory_bytes: 2112
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#define rep(i,n) for(int i=0;i<(n);i++)
typedef long long ll;

using namespace std;
int main() {
	int p, q, r;
	cin >> p >> q >> r;
	int m;
	m = max(p, q);
	m = max(m, r);
	cout << p + q + r - m << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define rep(i,l,r) for(int (i)=(l);(i)<(r);i++)
#define erep(i,l,r) for(int (i)=(l);(i)<=(r);i++)
using namespace std;
int main(){
    int h,w,n;
    cin>>h;
    cin>>w;
    cin>>n;
    int a=n/h,b=n/w;
    if(n%h!=0)a++;
    if(n%w!=0)b++;
    cout<< min(a,b)<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int H,W;
  cin >> H >> W;
  string l = "";
  for (int i=0; i < W+2; i++){
    l += "#";
  }
  cout << l << endl;
  for (int i=0; i<H; i++){
    string s;
    cin >> s;
    cout << "#" << s << "#" << endl;
  }
  cout << l << endl;
  
}
    

Measured memory_bytes: 256
#include    <iostream>

using namespace std;

int main() {
    while(1) {
        int a, b, n;
        
        cin >> a >> b >> n;
        if(cin.eof()) break;

        int sum = 0;
        
        // a%bを計算して、a/bの整数部分を取り除くようにする。
        // このとき、a%b=0の時は、a/bの小数部分が存在しないため、
        // 0を出力して終了する。
        a = a % b;
        if(a == 0) { cout << '0' << endl; }
        else {
            for(int i = 0; i < n; i++) {
                // aを10倍してbで割ったときの商をsumに加える。
                // その時の余りを新たにaとする。
                sum += (a * 10) / b;
                a = (a * 10) % b;
                
                // ここで、aが0の時は割り切れたと判断できるため、
                // ループを抜ける
                if(a == 0) break;
            }
            cout << sum << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 3020
team = [0 for i in range(101)]
point= [[0 for i in range(2)] for i in range(31)]
while 1:
    temp= map(int, raw_input().split(','))
    if temp[0] ==0==temp[1]:
        break
    team[temp[0]]=temp[1]
    if point[temp[1]][1]==0:
        point[temp[1]][1]=1
        for i in range(temp[1]+1):
            point[i][0]+=1
while 1:
    try:
        n = input()
        print point[team[n]][0]
    except EOFError:
	break

Measured memory_bytes: 4256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		String s = sc.next();

		for (int i = 0; i < s.length(); i += 2) {
			System.out.print(s.charAt(i));
		}
		System.out.println();

		sc.close();
	}
}


Measured memory_bytes: 29828
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int M; cin >> M;
    cout << 48 - M << endl;

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>


int main(int argc, char const *argv[])
{
    int a, b;
    scanf("%d", &a);
    scanf("%d", &b);

    if ((a+b)%2 == 1){
        printf("IMPOSSIBLE\n");
    }
    else{
        printf("%d\n", (a+b)/2);
    }


    return 0;
}


Measured memory_bytes: 128
#include <stdio.h>

int main()
{
  int N,i,minj,j,sabu,c = 0;
  scanf("%d",&N);
  int A[N];
  for(i = 0;i < N;i++)
    {
      scanf("%d",&A[i]);
    }
  for(i = 0;i <= N-1;i++)
    {
      minj = i;
      for(j = i;j <= N-1;j++)
	{
	  if(A[j] < A[minj])
	    minj = j;

	}
      if(A[i] == A[minj])
	{
	  continue;
	}
      sabu = A[i];
      A[i] = A[minj];
      A[minj] = sabu;
      c++;
    }
  for(i = 0;i < N;i++)
    {
      printf("%d",A[i]);
      if(i != N-1)
	{
	  printf(" ");
	}
    }
  printf("\n%d\n",c);
    
}



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

using namespace std;

typedef long long ll;

int main(){
  int N;
  ll dp[35] = {1,1,2,4};
  for(int i = 4 ; i < 35 ; i++){
    dp[i] = dp[i-1] + dp[i-2] + dp[i-3];
  }
  while(cin >> N,N){
    cout << dp[N]/365/10+1 << endl;
  }
  return 0;
}

Measured memory_bytes: 1156
#include <iostream>

using namespace std;

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

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

#define FASTIO  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define ll long long int
#define ld long double
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define W while
#define For(i,s,x) for(int i=s;i<x;i++)
#define FOR(i,x) for(int i=0;i<x;i++)
#define Rof(i,s,x) for(int i=s;i>=x;i--)
#define pb push_back
#define F first
#define S second
#define nextl cout<<"\n"
#define pr(a) cout<<a
#define pr2(a,b) cout<<a<<" "<<b<<"\n"
#define get(a) cin>>a
#define deb(x) cout<<#x<<"="<<x<<"\n";


int main() {
	FASTIO;
    ll n;
    get(n);
    pr(n*n);
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ALL(obj) (obj).begin(), (obj).end()
#define REP(i, n) for(int i = 0;i < (n);++i)
#define RREP(i, n) for(int i = (n)-1; i >= 0; --i)

#define ln '\n'
#define pb push_back
#define eb emplace_back
#define prique priority_queue
#define umap unordered_map
#define BIG 2000000000
#define VERYBIG 1000000000000000ll
#define PI 3.1415926
#define coutdb cout<<fixed<<setprecision(15)

const int dx[]={1,0,-1,0,1,1,-1,-1}, dy[]={0,-1,0,1,1,-1,1,-1};
const long long MOD = 1e9+7;

// typedef int_fast64_t ll;
#define int int_fast64_t
using Graph = vector<vector<int> >;
typedef pair<int, int> P;

template<typename T> inline T GCD(T a,T b){T c;while(b!=0){c=a%b;a=b;b=c;}return a;}
template<typename T> inline T LCM(T a,T b){T c=GCD(a,b);a/=c;return a*b;}
template<typename T> inline T nCr(T a,T b){T i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
template<typename T> inline T nHr(T a,T b){return nCr(a+b-1,b);}

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

  int N; cin >> N;
  vector<int> P(N), idx(N+1);
  REP(i, N){
    cin >> P[i];
    idx[P[i]] = i;
  }

  multiset<int> S;
  S.insert(-1); S.insert(-1);
  S.insert(N); S.insert(N);
  int ans = 0, index = idx[N];
  for(int i = N; i > 0; i--){
    auto itr = S.lower_bound(index);
    int tmin = *itr++;
    int tsec = *itr--;
    itr--;
    int smax = *itr--;
    int ssec = *itr;
    ans += i*(smax-ssec)*(tmin-index);
    ans += i*(index-smax)*(tsec-tmin);
    S.insert(index);
    if(i==1) break;
    index = idx[i-1];
  }
  cout << ans << ln;
}


Measured memory_bytes: 6528
N = int(input())
W = list(map(int, input().split()))

mindif = 0
for i in range(1, N):
  sum1 = 0
  sum2 = 0
  for j in range(0, i):
    sum1 += W[j]
  for j in range(i, N):
    sum2 += W[j]
  if mindif == 0:
    mindif = abs(sum1 - sum2)
  else:
    mindif = min([mindif, abs(sum1 - sum2)])

print(mindif)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
const ll INF=1LL<<60;
const double EPS = 1e-10;
const ll mod=1000000007;
//const ll mod=998244353;
ll n,a,b,h[100100];
bool check(ll x){
    ll count=0;
    for(int i=0;i<n;i++){
        count+=max(ll(0),(h[i]-x*b+(a-b-1))/(a-b));
    }
    if(count<=x) return true;
    return false;
}
ll seach(){
    ll left=0,right=mod;
    while(right-left>1){
        ll mid=(left+right)/2;
        if(check(mid)) right=mid;
        else left=mid;
    }
    return right;
}
int main(void){
    cin>>n>>a>>b;
    for(int i=0;i<n;i++) cin>>h[i];
    cout<<seach()<<endl;
}

Measured memory_bytes: 4348
import sys
H, W, N = map(int, input().split())
sr, sc = map(int, input().split())

sr -= 1
sc -= 1

S = list(input()) #取り除きたい
T = list(input()) #コマを残したい

lst = [0,0,0,0] #L, R, U, D, 高橋くん(文字列S)くんが強制的に動かせる距離

#print ('sc+1', sc+1)
#print ('W-sc', W-sc)
#print ('sr+1', sr+1)
#print ('H-sr', H-sr)

for i in range(N):
    if S[i] == 'L':
        lst[0] += 1
    if S[i] == 'R':
        lst[1] += 1
    if S[i] == 'U':
        lst[2] += 1
    if S[i] == 'D':
        lst[3] += 1
    #print ('S', lst)
    if lst[0] >= sc+1 or lst[1] >= W-sc or lst[2] >= sr+1 or lst[3] >= H-sr:
        print ('NO')
        sys.exit()
    if T[i] == 'L':
        #lst[0] -= 1
        #if lst[0] < -(W-sc):
        #    lst[0] = -(W-sc)
        lst[1] -= 1
        if lst[1] <= -(sc+1)+1:
            lst[1] = -(sc+1)+1
    if T[i] == 'R':
        #lst[1] -= 1
        #if lst[1] < -sc:
        #    lst[1] = -sc
        lst[0] -= 1
        if lst[0] <= -(W-sc)+1:
            lst[0] = -(W-sc)+1
    if T[i] == 'U':
        #lst[2] -= 1
        #if lst[2] < -(H-sr):
        #    lst[2] = -(H-sr)
        lst[3] -= 1
        if lst[3] <= -(sr+1)+1:
            lst[3] = -(sr+1)+1
    if T[i] == 'D':
        #lst[3] -= 1
        #if lst[3] < -sr:
        #    lst[3] = -sr
        lst[2] -= 1
        if lst[2] <= -(H-sr)+1:
            lst[2] = -(H-sr)+1
    #print ('T', lst)

print ('YES')

Measured memory_bytes: 6832
#include <cstdio>

#define maxn 20
char str[maxn];
int main()
{
	scanf("%s", str + 1);
	if (str[1] == 'Y' && str[2] == 'A' && str[3] == 'K' && str[4] == 'I') puts("Yes");
	else puts("No");
	return 0;
}

Measured memory_bytes: 128
import java.util.Scanner;
public class Main{
	public static void main(String[] args) {
		int n,a;
		Scanner scan=new Scanner(System.in);
		n=scan.nextInt();
		boolean exist=false;
		for(int i=0;i<2;i++) {
			int tmp=n%10;
			if(tmp==9)exist=true;
			n/=10;
		}
		if(exist)System.out.println("Yes");
		else System.out.println("No");
}
}


Measured memory_bytes: 21844