akhauriyash/Code-Regression huggingface dataset:
/************************************/
/* NoobM							*/
/* File Name : chaa.cpp				*/
/* Date : 13.07.2020 02:37:00 +06	*/
/************************************/

#include <bits/stdc++.h>

#define rr(i, b)    for (int i = 0; i < int(b); i++)
#define vi(n, a) vector <int> a(n); rr(i, n) cin >> a[i]
#define pvec(a) rr(i, a.size()) cout << a[i] << " "; cout << endl
#define bug(x) cout << #x << " " << x << endl
#define ll long long
#define vii vector <int>

using namespace std;

void solve() {
	int n;
	cin >> n;
	
	vi(n, a);
	
	sort(a.begin(), a.end());
	
	cout << abs(a[n/2 - 1] - a[n/2]) << endl;
}
 
int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
	
	int t = 1;
	//cin >> t;
	
	while (t--) {
		solve();
	}
    return 0;
}


Measured memory_bytes: 3704
row1 = list(map(int, input().split()))
row2 = list(map(int, input().split()))
row3 = list(map(int, input().split()))

if (row1[1] - row1[0] != row2[1] - row2[0] or row1[1] - row1[0] != row3[1] - row3[0] or
    row1[2] - row1[1] != row2[2] - row2[1] or row1[2] - row1[1] != row3[2] - row3[1]):
    print('No')
elif (row1[0] - row2[0] != row1[1] - row2[1] or row1[0] - row2[0] != row1[2] - row2[2] or
      row1[0] - row3[0] != row1[1] - row3[1] or row1[0] - row3[0] != row1[2] - row3[2]):
    print('No')
else:
    print('Yes')

Measured memory_bytes: 3064
#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 pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int,int> pint;

int main(){
    string s;
    cin>>s;
    bool f=false;
    if(s[0]==s[1]&&s[1]==s[2]) f=true;
    else if(s[3]==s[1]&&s[1]==s[2]) f=true;
    if(f)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    string S;
    cin >> S;
    int N = S.length();
    int c0 =0;
    int c1 =0;
    for (int i=0;i<N;i++){
        if (S[i]=='0'){
            c0++;
        } else {
            c1++;
        }
    }
    cout << N-abs(c1-c0);
}

Measured memory_bytes: 512
fn run() {
    proconio::input! {
        mut s: proconio::marker::Chars,
        k: usize,
    }
    for c in "01".chars() {
        while s.last().map_or(false, |p| *p == c) {
            s.pop();
        }
        s.reverse();
    }
    if s.is_empty() {
        println!("1");
        return;
    }
    let mut a = vec![];
    for c in s {
        if c == '0' {
            a.push(0);
        } else {
            *a.last_mut().unwrap() += 1;
        }
    }
    let k = std::cmp::min(k, a.iter().sum());
    // [取り出した回数][挿入した回数]
    const MOD: u64 = 998_244_353;
    let mut dp = vec![vec![1u64]];
    for a in a.into_iter().rev() {
        let len = std::cmp::min(k + 1, dp.len() + a);
        let mut next = vec![vec![0; len]; len];
        // 挿入
        for (i, (next, dp)) in next.iter_mut().zip(dp.iter()).enumerate() {
            for (j, &v) in dp.iter().enumerate().filter(|p| *p.1 != 0) {
                next[j] += v;
                if let Some(p) = next.get_mut(i + 1) {
                    *p -= v;
                }
            }
            let mut s = 0;
            for p in next.iter_mut() {
                *p += s;
                s = *p;
            }
        }
        // 取り出す
        for (i, dp) in dp.iter().enumerate() {
            for (j, &v) in dp.iter().enumerate().filter(|p| *p.1 != 0) {
                for next in next.iter_mut().skip(i + 1).take(a) {
                    next[j] += v;
                }
            }
        }
        dp = next;
        dp.iter_mut().for_each(|dp| dp.iter_mut().for_each(|v| *v %= MOD));
    }
    let ans = dp.into_iter().map(|dp| dp.into_iter().sum::<u64>()).sum::<u64>() % MOD;
    println!("{}", ans);
}

fn main() {
    run();
}


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

namespace _2745
{
    class Program
    {
        static void Main(string[] args)
        {
            while (true)
            {
                double[] x = Console.ReadLine().Split().Select(double.Parse).ToArray();
                if (x.Max() == 0) break;
                Console.WriteLine(Math.Max(0,Math.Ceiling((x[1] * x[2] - x[0]) / x[3])));
            }
        }
    }
}


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

using namespace std;

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


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

    string S;
    cin >> S;

    vector<string> ss;
    for (int i = 0; i < 16; i++) {
        string s;
        if (i & 8)
            s += 'A';
        s+= "KIH";
        if (i & 4)
            s += 'A';
        s+= "B";
        if (i & 2)
            s += 'A';
        s+= "R";
        if (i & 1)
            s += 'A';

        if (s == S) {
            cout << "YES" << endl;
            return 0;
        }
    }

    cout << "NO" << endl;

    return 0;
}


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

int main(){
  int a,b; cin >> a >> b;
  if(a>0){
    cout << "Positive" << endl;
  }else if(b>=0){
    cout << "Zero" << endl;
  }else{
    cout << ((b-a)%2==0?"Negative":"Positive") << endl;
  }
}

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

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, K;
    cin >> N >> K;
    vector<int> heights(N);
    for (int i = 0; i < N; i++)
        cin >> heights[i];


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

    int ans = 1e9 + 10;
    for (int i = 0; i < N - K + 1; i++)
    {
        ans = min(ans, heights[i + K - 1] - heights[i]);
    }

    cout << ans;

    return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h> //C++の標準ライブラリを一行で一括でインクルードする
#include <math.h> //数学関数と数学定数を利用する
#define rep(i,n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
template<class T> void chmax(T &a,T b) { if (a<b) a=b;}
template<class T> void chmin(T &a,T b) { if (a>b) a=b;}

int main(){
  string s;
  cin >> s;
  while(true){
    s = s.erase(s.size()-1);
    if(s.size()%2 == 0){
      string l = s.substr(0,s.size()/2);
      string r = s.substr(s.size()/2);
      if(l == r) break;
    }
  }
  cout << s.size();
  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(final String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int K = sc.nextInt();
		char[] S = sc.next().toCharArray();
		sc.close();
		S[K - 1] = Character.toLowerCase(S[K - 1]);
		for(int i = 0; i < N; i++) {
			System.out.print(S[i]);
		}
	}
}

Measured memory_bytes: 19796
#include <iostream>
#include <cstring>
#include <map>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <set>
#include <vector>
#include <queue>
#include <list>
#include <numeric>
#include <stdio.h>
#include <string>
#include <cstdlib>
#include <math.h>
#include <stack>
#include <climits>
#include <bitset>
#include <utility>


using namespace std;
typedef long long ll;

//最小公倍数
ll gcd(ll x, ll y) {
  ll tmp = 0;
  if (x < y){
    tmp=x;
    x=y;
    y=tmp;
  }
  while (y > 0) {
    ll r = x % y;
    x = y;
    y = r;
  }
  return x;
}

//最大公倍数
ll lcm(ll x,ll y){
  return x/gcd(x,y)*y;
}

//階乗
ll kaijo(ll k){
    ll sum = 1;
    for (ll i = 1; i <= k; ++i)
    {
        sum *= i;
        sum%=1000000000+7;
    }
    return sum;
}

//for(int i = ; i < ; i++){}

ll lmax(ll s,ll t){
  if(s>t){
    return s;
  }
  else{
    return t;
  }
}

ll lmin(ll s,ll t){
  if(s<t){
    return s;
  }
  else{
    return t;
  }
}
// ここから開始

int main(){
  int n,k;
  cin>>n>>k;
  ll cnt1 = 0;
  ll ans = 0;
  for(int i = k; i <= n; i+=k){
    cnt1++;
  }
  ans+=cnt1*cnt1*cnt1;
  if(k%2==0){
    ll cnt2 = 0;
    for(int i = k/2; i <= n; i+=k){
      cnt2++;
    }
    ans+=cnt2*cnt2*cnt2;
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "ctime"

using namespace std;

//constexpr long long int MOD = 1000000007;
//constexpr int MOD = 1000000007;
//constexpr int MOD = 998244353;
constexpr long long int MOD = 998244353;
constexpr long double EPS = 1e-8;

long long int N, M, K, L, R, H, W;
//int N, M, K, L, R, H, W;

long long int power(long long int x, long long int n, long long int M) {
	long long int ret = 1;
	long long int by = x;
	while (n) {
		if (n & 1) {
			ret *= by;
			ret %= M;
		}
		by *= by;
		by %= M;
		n >>= 1;
	}
	return ret;
}

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

	cin >> N >> M;
	if (N > M)swap(N, M);
	vector<long long int>by(2000001, 1);
	vector<long long int>rev(2000001, 1);
	for (int i = 2; i <= 2000000; i++) {
		by[i] = by[i - 1] * i%MOD;
	}
	rev[2000000] = power(by[2000000], MOD - 2, MOD);
	for (int i = 2000000; i > 0; i--) {
		rev[i - 1] = rev[i] * i%MOD;
	}
	vector<long long int>c(N + 1);
	vector<long long int>p(N + 1, 1);
	for (int i = 1; i <= N; i++) {
		p[i] = by[i * 2] * rev[i] % MOD*rev[i] % MOD;
	}
	c[1] = 3;
	for (int i = 1; i < N; i++) {
		c[i + 1] = (c[i] * 2 % MOD + by[i * 2] * rev[i + 1] % MOD*rev[i] % MOD) * 2 % MOD + p[i + 1] * rev[2] % MOD;
	}
	if (N == M) {
		cout << c[N] * power(p[N], MOD - 2, MOD) % MOD << endl;
	}
	else {
		long long int ans = 0;
		long long int minus = 0;
		for (int i = N; i >= 0; i--) {
			long long int pp = by[2 * i] * by[M] % MOD*by[N] % MOD*rev[i] % MOD*rev[i] % MOD*rev[N + M] % MOD;
			long long int num = (M - N) % MOD*power(M - i, MOD - 2, MOD) % MOD*by[N + M - i * 2 - 1] % MOD*rev[N - i] % MOD*rev[M - i - 1] % MOD;
		//	cout << pp << " " << num << endl;
			ans += (c[i] * power(p[i], MOD - 2, MOD) % MOD + M - i)*pp%MOD*num%MOD;
			ans %= MOD;
		//	cout << ans << endl;
		//	for (int j = 1; j <= 10; j++)cout << j << " " << ans * j%MOD << endl;
		}
		
		cout << ans << endl;
		//for (int i = 1; i <= 30; i++) {
		//	cout << i << " " << ans * i%MOD << endl;
		//}
		
	}
}

Measured memory_bytes: 41216
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;
int main() {
    ll n;
    cin >> n;
    int six[n + 1];
    for (ll i = 0; i <= n; i++) {
        six[i] = 0;
    }
    for (ll i = 1; i <= n; i++) {
        ll j = i;
        while (j > 0) {
            six[i] += j % 6;
            j = j / 6;
        }
    }
    int nine[n + 1];
    for (ll i = 0; i <= n; i++) {
        nine[i] = 0;
    }
    for (ll i = 1; i <= n; i++) {
        ll j = i;
        while (j > 0) {
            nine[i] += j % 9;
            j = j / 9;
        }
    }
    ll ret = 100000;
    for (ll i = 0; i <= n; i++) {
        if (ret > six[i] + nine[n - i]) {
            ret = six[i] + nine[n - i]; 
        }
    }
    cout << ret;
    return 0;
}

Measured memory_bytes: 1024
//                      Aman Raj  - AmanRaj1608
#include<bits/stdc++.h>
using namespace std;
#define ll                        long long
#define vi                        vector<ll int>
#define pb                        emplace_back
#define rep(i,a,b)                for(int i = a; i<b; ++i)
#define rrep(i,a,b)               for(int i = a; i>=b; --i)
#define p(a)                      cout << a << "\n";
#define p2(a,b)                   cout << a << " " << b << "\n";
#define fast_io                   ios_base::sync_with_stdio(false);cin.tie(NULL);
//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::://

int32_t main() {
	fast_io;
    ll tt = 1;
	// cin >> tt;
    while(tt--) {
		ll n,c;
		cin >> n >> c;
		vi w(n+1,0),v(n+1,0);
		rep(i,1,n+1)	cin >> w[i] >> v[i];

		// Knapsack P
		ll dp[n+1][c+1];
		for(ll i=0; i<=n; i++) {
			for(ll j=0; j<=c; j++) {
				if(j==0 || i==0)
					dp[i][j] = 0;
				else if(w[i]<=j)
					dp[i][j] = max(dp[i-1][j],v[i]+dp[i-1][j-w[i]]);
				else
					dp[i][j] = dp[i-1][j];
			}
		}
		// rep(i,0,n+1)	{rep(j,0,c+1)	cout << dp[i][j] << " "; cout << "\n";}
		p(dp[n][c])
    }
    return 0;
}
//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::://


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

int main() {
  int N, ans=0;
  cin >> N;
  vector<int> A(N);
  
  rep (i, N) cin >> A.at(i);
  
  rep (j, 30) {
    rep (i, N){
      if (A.at(i)%2 != 0) {
        cout << ans << endl;
        return 0;
      }
      
      A.at(i) /= 2;
    }
    
    ans++;
  }
}


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

using ll = long long;

int main() {
    ll N, A, B;
    cin >> N >> A >> B;
    if(B < A || N == 1 && A != B) {
        cout << 0 << endl;
    } else {
        cout << (N-1)*B+A - ((N-1)*A+B) + 1 << endl;
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long ll; 
#define pb push_back
#define mp make_pair
#define mod 998244353
#define vi vector <ll>
using namespace std ; 
ll power(ll x,ll y,ll m)
{            //power(x,y)=x^y  %m;
	ll res=1%m;
	while(y)
	{
	    if(y&1)
	    res=(res*x)%m;
	    x=(x*x)%m;
	    y=(y>>1)%m;
	}
	return res;
}
ll mod_inverse(ll x,ll m)
{
	return power(x,m-2,m);
}
int main ()
{
    ios_base :: sync_with_stdio ( false );
    cin.tie( NULL );
    cout.tie( NULL );
ll t = 1 ;
//cin>>t;
while ( t--)  
{
  ll n;
  cin>>n;
  ll a[n];
  for(ll i=0;i<n;i++)
  {
      cin>>a[i];
  }
  ll x=0;
  for(ll i=2;i<n;i++)
  {
      x^=a[i];
  }
  if((a[0]^a[1])==x)
  {
      cout<<0<<"\n";
      continue;
  }
  ll tt;
  if(((a[0]+a[1])%2==1 && x%2==0) ||((a[0]+a[1])%2==0 && x%2==1))
  {
      cout<<-1<<"\n";
      continue;
  }
  tt=(a[0]+a[1]-x)/2;
  if(tt<0)
  {
      cout<<-1<<"\n";
      continue;
  }
  if( (tt & x)!=0 )
  {
       cout<<-1<<"\n";
      continue;
  }
  if(tt>a[0])
  {
      cout<<-1<<"\n";
      continue;
  }
  bitset<62>bb(x);
  ll cnt=0;
  for(ll i=61;i>=0;i--)
  {
     if(bb[i]==1)
     {
     ll tmp;
      tmp=tt+(1ll<<i);
      if(tmp<=a[0])
      {
          tt+=(1ll<<i);
      }
      
     }
      
      
          
          
      
     
  }
  
      if(((tt^(a[0]+a[1]-tt))!=x) || (tt==0))
      {
          cout<<-1<<"\n";
          continue;
      }
      else
      {
          cout<<a[0]-tt<<"\n";
          continue;
      }
         
      
  
  
  
  
  
 
}

 return 0;
}


Measured memory_bytes: 3628
N, K, Q = list(map(int, input().split()))
A = [int(input()) for i in range(Q)]

points = [-Q + K for i in range(N)]

for a in A:
    points[a-1] += 1

ans = ['Yes' if points[i] > 0 else 'No' for i in range(N)]
print(*ans, sep='\n')


Measured memory_bytes: 65112
#include<iostream>
#include<algorithm>
#include<cstring>
#include<iomanip>
#include<cmath>
#include<cstdio>
#include<queue>
#define ll long long
typedef unsigned long long ULL;
const int N=110;
using namespace std;

int main(){
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    int e=0,f=0;
    e=(a<=b)?a:b;
    f=(c<=d)?c:d;
    cout<<e+f<<endl;
    return 0;
}


Measured memory_bytes: 256
#1に収束すると予想されている関数で、さらに直前の数にしか依存していないので、循環は(4 2 1)を繰り返す。よってsが4,2,1以外なら被る数字は4
#4,2,1の場合は答えは4
def collatz(n)
  if n % 2 == 0
    return n/2
  else
    return 3 * n + 1
  end
end
s = gets.to_i
if s == 1 || s == 2 || s == 4
  puts 4
else
  n = collatz(s)
  arr = [n] #1個目の数を入れる
  four_flag = 0 #循環してない
  while true
    if n == 4 && four_flag == 0
      four_flag = 1 #はじめて4になったらフラグを立てる
    elsif n == 4
      break
    end
    n = collatz(n)
    arr.push(n)
  end
  puts arr.size + 1
end

Measured memory_bytes: 14284
from math import factorial
n,a,b=map(int,input().split())
mod=10**9+7

nCa=1
nCb=1

tmp=n
for i in range(a):
    nCa*=tmp
    tmp-=1
    nCa%=mod
nCa=nCa*pow(factorial(a),mod-2,mod)%mod
tmp=n
for i in range(b):
    nCb*=tmp
    tmp-=1
    nCb%=mod
nCb=nCb*pow(factorial(b),mod-2,mod)%mod

print(((pow(2,n,mod))-nCa-nCb-1)%mod)

Measured memory_bytes: 100120
#include<stdio.h>
#include<stdlib.h>
#define INF 1000000
#define WHITE 0
#define BLACK 1
void dijkstra(void);
int w(int,int);
int n,**G,mincost,*d,*color;
int main(){
  int u,k,v,c,i,j;
  scanf("%d",&n);
  G = (int**)malloc(sizeof(int*) * n);     // dynamic alloction
  color = (int*)malloc(sizeof(int) * n);   // *
  d = (int*)malloc(sizeof(int) * n);       // *
  for(i=0; i<n; i++){                      // *
    G[i] = (int*)malloc(sizeof(int) * n);  // *
    color[i] = WHITE;                      // * initialization
    d[i] = INF;                            // * *
    for(j=0; j<n; j++){                    // * *
      G[i][j] = INF;                       // * *
    }                                      // * *
  }                                        // * *
  d[0] = 0;                                // * end
  for(i=0; i<n; i++){       // input data
    scanf("%d%d",&u,&k);    // *
    for(j=0; j<k; j++){     // *
      scanf("%d%d",&v,&c);  // *
      G[u][v] = c;          // *
    }                       // *
  }                         // end
  dijkstra();
  for(i=0; i<n; i++){
    printf("%d %d\n",i,d[i]);
  }
  return 0;
}

void dijkstra(){
  int i,u,v;
  while(1){
    mincost = INF;
    u = -1;
    for(i=0; i<n; i++){
      if(color[i] != BLACK && d[i] < mincost){
        u = i;
        mincost = d[i];
      }
    }
    if(u == -1){
      break;
    }
    color[u] = BLACK;
    for(v=0; v<n; v++){
      if(color[v] != BLACK && w(u,v) != INF && d[u] + w(u,v) < d[v]){
        d[v] = d[u] + w(u,v);
      }
    }
  }
}
int w(int i,int j){
  return G[i][j];
}

Measured memory_bytes: 636
#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <cstring>
#include <numeric>
#include <algorithm>
#include <functional>
#include <array>
#include <map>
#include <queue>
#include <limits.h>
#include <set>
#include <stack>
#include <random>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#define rep(i,s,n) for(int i = (s); (n) > i; i++)
#define REP(i,n) rep(i,0,n)
#define RANGE(x,a,b) ((a) <= (x) && (x) <= (b))
#define DUPLE(a,b,c,d) (RANGE(a,c,d) || RANGE(b,c,d) || RANGE(c,a,b) || RANGE(d,a,b))
#define INCLU(a,b,c,d) (RANGE(a,c,d) && (b,c,d))
#define PW(x) ((x)*(x))
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define MODU 1000000007
#define bitcheck(a,b)   ((a >> b) & 1)
#define bitset(a,b)      ( a |= (1 << b))
#define bitunset(a,b)    (a &= ~(1 << b))
#define MP(a,b) make_pair((a),(b))
#define Manh(a,b) (abs((a).first-(b).first) + abs((a).second - ((b).second))
#define pritnf printf
#define scnaf scanf
#define itn int
#define PI 3.141592653589


#define izryt bool

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T &val) {
	std::fill((T*)array, (T*)(array + N), val);

}

int n;
ll dp[2000001], rui[2000001];

signed main() {
	scanf("%d", &n);

	dp[n - 1] = n;
	rui[n-1] = n;
	for (int i = 2000000; i >= n; i--) {
		rui[i] += 1;
		rui[i] += rui[i+1];
		dp[i] = 1;
	}
	rui[n - 1] += rui[n];

	for (int cur = n - 2; 0 <= cur; cur--) {
		dp[cur] = (dp[cur + 1] + (rui[cur + 3] - rui[cur + n + 2])%MODU)%MODU + ((ll)(n - 1)*(n - 1)%MODU);
		dp[cur] %= MODU;
		rui[cur] += dp[cur];
		rui[cur] += rui[cur+1];
		rui[cur] %= MODU;
	}
	if (dp[0] < 0) dp[0] += MODU;
	printf("%lld\n", dp[0]%MODU);
	return 0;
}

Measured memory_bytes: 32120
n,y = input().split(' ')
n,y = int(n),int(y)


for c_10000 in range(n+1):
	for c_5000 in range(n+1):
		current_money = 10000*c_10000 + 5000*c_5000
		remaining = y - current_money
		c_1000 = remaining//1000 
		if c_1000 == n-(c_10000+c_5000) and c_1000 >= 0:
			print("%i %i %i"%(c_10000,c_5000,c_1000))
			exit()
print("-1 -1 -1")



Measured memory_bytes: 3060
#n, m, q = map(int, input().split())
#List = list(map(int, input().split()))
#req = [list(map(int, input().split())) for _ in range(q)]
#t = t[:-1]
#print(ans[j], end = "") 改行無しで出力
#[0]*n
#sort = sorted(a)[::-1] 降順
s = input()

num = s.count("R")

if num == 2:
    if s[1] == "R":
        print(2)
    else:
        print(1)

else:
    print(num)


Measured memory_bytes: 9080
#include<iostream>
using namespace std;
int main(){
int W,H,x,y,r;
cin>>W>>H>>x>>y>>r;
if(x-r>=0 && y-r>=0 && x+r<=W && y+r<=H){
cout<<"Yes"<<endl;
}
else{
cout<<"No"<<endl;
}
return 0;
}



Measured memory_bytes: 3128
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;

namespace AtCoder
{
	public class Program
	{
		static void Main(string[] args)
		{
			int N = Int32.Parse(Console.ReadLine());
			decimal[] a = Console.ReadLine().Split().Select(p => decimal.Parse(p)).ToArray();

			List<decimal> gu = new List<decimal>(a);

			// 小さい順に鍋に入れる
			while(gu.Count >=2)
			{
				//Console.WriteLine(" in while " + gu.Count);
				gu.Sort();
				decimal next = (gu[0] + gu[1])/2;
				gu.RemoveAt(0);
				gu.RemoveAt(0);
				gu.Add(next);
			}

			decimal ans = (gu[0]);
			Console.WriteLine(ans + "");
		}
	}
}


Measured memory_bytes: 13396
#include <iostream>
#include <vector>
#include <math.h>

int main()
{
	int A = 0, B = 0;
	int ans = 0;

	std::cin >> A >> B;

	ans =ceil((B - 1.0) / (A - 1.0));

	std::cout << ans << std::endl;

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<unordered_map>
#include<algorithm>
#include<cmath>
#include<climits>
#include<iomanip>
#include<bitset>
#include<cstdlib>
#include<queue>
#include<utility> //pair
using namespace std;

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

typedef long long ll;

int main() {
	//入力;
	string s;
	cin >> s;
	REP(i, s.size()) {
		if (s[i] == '1') cout << "9";
		else if (s[i] == '9') cout << "1";
		else cout << s[i];
	}
	cout << endl;

	//小数点以下の桁数表示;
	//cout << fixed << setprecision(15);


	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
typedef long long int ll;
#define endl "\n"
#define ff first
#define ss second 
#define pb push_back
#define INF ll(1e18)
#define MOD 1000000007
#define debug(x) cout<<x<<"\n";
#define pll pair<ll,ll>
#define mp make_pair
#define Craig ios_base::sync_with_stdio(false) , cin.tie(NULL);
#define all(v) v.begin(),v.end()
#define MAX 200015
#define vll vector<ll>

int main()
{   
 
    ll t,d,s;
    cin>>d>>t>>s;
    ll p= d/s;
    if(d%s)p++;
    if(p<=t)cout<<"Yes\n";
    else cout<<"No\n";

}

Measured memory_bytes: 3616
//02
#include<iostream>
#include<queue>
#include<algorithm>
#include<string>

using namespace std;

struct S{
  int x,y,t,p;
  char f[6];
  bool operator<(S a)const{
    return t>a.t;
  }
  int hash(){
    int h=x*30*6+y*6+p;
    string s=f;
    for(int i=0;i<6;i++){
      int c=s.find(*min_element(s.begin(),s.end()));
      h=h*s.size()+c;
      s.erase(c,1);
    }
    return h;
  }
};

int main(){
  for(int w,d;cin>>w>>d,w|d;){
    char g[30][30];
    priority_queue<S> que;
    for(int i=0;i<d;i++){
      for(int j=0;j<w;j++){
	cin>>g[i][j];
	if(g[i][j]=='#'){
	  g[i][j]='w';
	  S is={j,i,0,0,{'r','m','b','g','y','c'}};
	  que.push(is);
	}
      }
    }
    char pm[7];
    cin>>pm;
    static bool p[3888000];
    fill(p,p+3888000,false);
    while(!que.empty()){
      S c=que.top();
      if(c.p==6)break;
      que.pop();
      if(p[c.hash()]++)continue;
      for(int i=0;i<4;i++){
	S n=c;
	n.t++;
	int dx[]={0,-1,0,1};
	int dy[]={-1,0,1,0};
	n.x+=dx[i];
	n.y+=dy[i];
	if(n.x<0||w<=n.x||n.y<0||d<=n.y)continue;
	int fd[][4]={{0,1,5,3},{0,2,5,4},{0,3,5,1},{0,4,5,2}};
	int *cf=fd[i];
	char t=n.f[cf[0]];
	n.f[cf[0]]=n.f[cf[1]];
	n.f[cf[1]]=n.f[cf[2]];
	n.f[cf[2]]=n.f[cf[3]];
	n.f[cf[3]]=t;
	if(g[n.y][n.x]=='w'){
	  que.push(n);
	}else if(g[n.y][n.x]!='k'&&g[n.y][n.x]==n.f[0]&&n.f[0]==pm[n.p]){
	  n.p++;
	  que.push(n);
	}
      }
    }
    if(!que.empty()){
      cout<<que.top().t<<endl;
    }else{
      cout<<"unreachable"<<endl;
    }
  }
  return 0;
}
	  

Measured memory_bytes: 5160
import java.util.*

fun main(args: Array<String>) {
  val sc = Scanner(System.`in`)
  val n = sc.nextInt()
  val b = (1..n - 1).map { sc.nextInt() }

  val a = Array(n) { 0 }
  a[n - 1] = b.get(n - 2)
  for (i in n - 2 downTo 0) {
    val bi = b.get(i)
    a[i] = bi
    if (bi < Math.max(a[i], a[i + 1])) {
      a[i + 1] = bi
    }
  }

  val ans = a.sum()
  println(ans)
}


Measured memory_bytes: 36008
#pragma GCC optimize ("Ofast")
#include "bits/stdc++.h"
	
#define PI 3.141592653589793
#define FAST ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	
// Use for file I/O;
#define FIN string _fname = ""; \
			string _is = _fname + ".in", _os = _fname + ".out"; \
			freopen(_is.c_str(), "r", stdin); \
			freopen(_os.c_str(), "w", stdout);
typedef long long ll;
typedef long double ld;
typedef unsigned int uint;
typedef unsigned long long ull;
 
using namespace std;
 
const ll INF = 1e9 + 10;
const ll INF2 = 1e18 + 10;
const int MOD = 1e9 + 7;
const ld EPS = 1e-4;
 
const int LOGN = 19;
const int MAXN = 2e5;
 
bool cmp(const vector<ll> &a, const vector<ll> &b) {
	return a[0] + a[1] < b[0] + b[1];
}
 
int main() {
	FAST;
 
	int n;
	cin >> n;
	
	vector<vector<ll>> a(n, vector<ll>(3));
	for (int i = 0; i < n; i++) {
		cin >> a[i][0] >> a[i][1] >> a[i][2];
	}

	sort(a.begin(), a.end(), cmp);

	int mw = 20000;

	vector<ll> dp(mw + 1);

	for (int i = 0; i < n; i++) {
		for (int j = mw/2; j >= 0; j--) {
			if (j <= a[i][1]) dp[j + a[i][0]] = max(dp[j + a[i][0]], dp[j] + a[i][2]);
		}
	}

	cout << *max_element(dp.begin(), dp.end());
}

Measured memory_bytes: 3568
from itertools import permutations, combinations,combinations_with_replacement,product
a=list(product(['+','-'],repeat=3))
s=list(input())
for i in a:
    ans=s[0]+i[0]+s[1]+i[1]+s[2]+i[2]+s[3]
    if eval(ans)==7:
        print(ans+'=7')
        break

Measured memory_bytes: 3060
// 2014/09/05 Tazoe

#include <iostream>
using namespace std;

int main()
{
	while(true){
		int n;
		cin >> n;

		if(n==0)
			break;

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

		for(int i=0; i<n+1; i++){
			int tmp[100];
			for(int j=0; j<i; j++){
				tmp[j] = h[j];
			}
			for(int j=i+1; j<n+1; j++){
				tmp[j-1] = h[j];
			}

			bool flg = true;

			int d = tmp[1]-tmp[0];		// 差
			for(int j=1; j<n-1; j++){
				if(tmp[j+1]-tmp[j]!=d){
					flg = false;
					break;
				}
			}

			if(flg){
				cout << h[i] << endl;
				break;
			}
		}
	}

	return 0;
}

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

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

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

template < typename T >
void vprint(T &v){
	REP(i, v.size()){
		cout << v[i] << " ";
	}
	cout << endl;
}

int main(){
	ll N;
	cin >> N;
	vector<ll> a(N);
	REP(i, N) cin >> a[i];

	ll odd=0, fo=0;
	REP(i, N){
		if(a[i]%2==1) odd++;
		if(a[i]%4==0) fo++;
	}
	bool fl1 = (odd<=fo);
	bool fl2 = (odd==fo+1 && odd+fo==N);
	cout << ((fl1||fl2)?"Yes":"No") << endl;
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef pair<ll, ll> PLL;
#define chmax(x, y) do { x = max(x, y); } while(0)
#define chmin(x, y) do { x = min(x, y); } while(0)
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) \
  for (ll i = static_cast<ll>(a); i < static_cast<ll>(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, ) (__VA_ARGS__)  // NOLINT
template<typename T>
using reversed_priority_queue = std::priority_queue<T, std::vector<T>, std::greater<T> >;

// 1001^5 ^ -  1000^5 = 5.010010005001 * 0^12 なので a,b には1000まで考えれば十分
// a^5 = X + b^5
map<ll, ll> mp;

signed main() {
  ll X;
  cin >> X;
  for (ll x = -1000; x <= 1000; x++) {
    mp[x*x*x*x*x] = x;
  }

  for (ll b = -1000; b <= 1000; b++) {
    auto it = mp.find(X + b*b*b*b*b);
    if (it == mp.end()) continue;
    ll a = it->second;
    cout << a << " " << b << endl;
    return 0;
  }
  return 0;
}


Measured memory_bytes: 3692
import math

A, B, H, M = list(map(int, input().split()))

A_rad = (math.pi/6)*(H+(M/60))
B_rad = (math.pi/30)*M

rad = max(A_rad, B_rad) - min(A_rad, B_rad)

d = math.sqrt(A**2 + B**2 - 2*A*B*math.cos(rad))

print(d)

Measured memory_bytes: 9444
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;

class Program
{
    static void Main(string[] args)
    {
        var HW = ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
        var (H, W) = (HW[0], HW[1]);
        var S = new bool[H][];
        for (int i = 0; i < H; i++)
            S[i] = ReadLine().Select(c => c == '#').ToArray();
        
        var hLenMap = GetHLenMap(H, W, S);

        var SInv = new bool[W][];
        for (int i = 0; i < W; i++)
            SInv[i] = new bool[H];
        for (int i = 0; i < W; i++)
            for (int j = 0; j < H; j++)
                SInv[i][j] = S[j][i];

        var vLenMap = GetHLenMap(W, H, SInv);

        var ans = 0;

        for (int i = 0; i < H; i++)
        {
            for (int j = 0; j < W; j++)
            {
                var len = hLenMap[i][j] + vLenMap[j][i] - 1;
                ans = Math.Max(ans, len);
            }
        }

        WriteLine(ans);
    }

    static int[][] GetHLenMap(int H, int W, bool[][] S)
    {
        var hLenMap = new int[H][];
        for (int i = 0; i < H; i++)
        {
            hLenMap[i] = new int[W];

            var start = int.MaxValue;
            var len = 0;
            for (int j = 0; j < W; j++)
            {
                if (S[i][j])
                {
                    for (int k = start; k < j; k++)
                        hLenMap[i][k] = len;

                    start = int.MaxValue;
                    len = 0;
                }
                else
                {
                    if (start == int.MaxValue)
                        start = j;
                    len++;
                }
            }

            if (0 < len)
                for (int k = start; k < W; k++)
                    hLenMap[i][k] = len;
        }

        return hLenMap;
    }
}


Measured memory_bytes: 71152
#include <iostream>
#include <complex>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <cmath>
#include <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <deque>
#include <random>
#include <iomanip>
typedef long long int ll;
typedef long double ld;
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
const ll MOD=1000000007;
const ll MAX_N=500010;
const ll INF=9999999999;
ll dp[3010][3010];

int main(){
    int n;
    cin>>n;
    vector<int> a(n+2);
    for(int i=0;i<n;i++) cin>>a[i];
    for(int i=0;i<3010;i++) dp[i][i]=0;
    for(int i=0;i<n;i++){
        for(int j=i+1;j<=n;j++){
            if((n-i-1)%2==0){
                dp[j-1-i][j]=max(dp[j-1-i][j-1]+a[j-1],a[j-1-i]+dp[j-i][j]);
            }else{
                dp[j-1-i][j]=min(dp[j-1-i][j-1]-a[j-1],-a[j-1-i]+dp[j-i][j]);
            }
        }
    }
    cout<<dp[0][n]<<endl;
    return 0;
}

Measured memory_bytes: 70144
#include<stdio.h>

int main(void)
{

    int n;
    int i,x;

    scanf("%d",&n);

    for(i = 1;i <= n;i++){
      x = i;
      if(x % 3 == 0)
        printf(" %d",i);
      else
        for( ;x > 0;x /= 10)
          if(x % 10 == 3){
            printf(" %d",i);
            break;
          }        
    }

    printf("\n");

    return 0;
}


Measured memory_bytes: 2740
Q = int(input())

import heapq
import sys
input = sys.stdin.readline

INF = 10**18
L = []
R = []
heapq.heappush(L,INF)
heapq.heappush(R,INF)
L_size = 0
R_size = 0
sum_b = 0
sum_L = 0
sum_R = 0

def f1(a,b):
  global sum_b,L_size,R_size,sum_L,sum_R
  sum_b += b
  L_max = -heapq.heappop(L)
  R_min = heapq.heappop(R)
  sum_L -= L_max
  sum_R -= R_min
  X = sorted([L_max,a,R_min])
  if L_size == R_size:
    heapq.heappush(L,-X[0])
    heapq.heappush(L,-X[1])
    heapq.heappush(R,X[2])
    L_size += 1
    sum_L += X[0] + X[1]
    sum_R += X[2]
  else:
    heapq.heappush(L,-X[0])
    heapq.heappush(R,X[1])
    heapq.heappush(R,X[2])
    R_size += 1
    sum_L += X[0]
    sum_R += X[1] + X[2]
  return

def f2():
  min_value = sum_b
  min_x = -L[0]
  if L_size == R_size:
    min_value += sum_R - sum_L
  else:
    min_value += sum_R - sum_L + min_x
  print(min_x,min_value)

QUERY = [[int(x) for x in input().split()] for _ in range(Q)]
for q in QUERY:
  if q[0]&1:
    f1(q[1],q[2])
  else:
    f2()


Measured memory_bytes: 121180
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
#define si scanf
#define so printf
#define N 100
#define M 
#define INF  
template<typename TP>inline bool rd(TP& r)
{
	r=0;
	char tmp=getchar();
	while(tmp<'0'||tmp>'9')
	{
		if(tmp==EOF)
			return 0;
		tmp=getchar();
	}
	while('0'<=tmp&&tmp<='9')
	{
		r=(r<<3)+(r<<1)+tmp-'0';
		tmp=getchar();
	}
	return 1;
	
} 
int n; 
long long a[N];
long long ab(long long xx)
{
	if(xx>=0)
		return xx;
	return -xx;
}
long long mxab=0;
int main()
{
	rd(n);
	for(int i=1;i<=n;++i)
	{
		si("%lld",&a[i]);
		if(ab(a[i])>ab(a[mxab]))
			mxab=i;
	} 
	if(mxab==0)
		mxab=1;
	if(a[mxab]>=0)
	{
		so("%d\n",n*2-1);
		for(int i=1;i<=n;++i)
			so("%d %d\n",mxab,i);
		for(int i=2;i<=n;++i)
			so("%d %d\n",i-1,i);
	}
	else
	{
		so("%d\n",n*2-1);
		for(int i=1;i<=n;++i)
			so("%d %d\n",mxab,i);
		for(int i=n-1;i;--i)
			so("%d %d\n",i+1,i);
	}
	return 0;
} 

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
inline ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
inline ll lcm(ll a, ll b) { return a / gcd(a, b)*b; }
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T>& V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> >& Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T>& mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }
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);}
/*
 <url:>
 問題文============================================================
 =================================================================
 解説=============================================================
 ================================================================
 */

template<class Type>
Type solve(Type res = Type()){
    int A,B,C,D,E,F; cin >> A >> B >> C >> D >> E >> F;
    auto memo = make_v<int>(3005,3005);
    fill_v(memo,0);

    auto dfs = [&](auto self,int L=0,int R=0) -> void{
        if(L+R > F) return;
        if(memo[L][R]) return;
        memo[L][R] = true;

        self(self,L+100*A,R);
        self(self,L+100*B,R);
        self(self,L,R+C);
        self(self,L,R+D);
    };
    dfs(dfs);

    double max_v = -1;
    int L = -1,R = -1;

    for(int i = 100; i <= F; i+=100){
        for(int j = 0; i+j <= F;j++){
            if(i/100 * E < j) break;
            if(!memo[i][j]) continue;

            double a = i;
            double b = j;
            double v = b/(a+b);
            if(max_v < v){
                max_v = v;
                L = i+j; R = j;
            }
        }
    }
    cout << L << " " << R << endl;
    return res;
}
int main(void) {
    cin.tie(0); ios::sync_with_stdio(false);
    solve<ll>(0);
    // cout << fixed << setprecision(12) << solve<ll>() << endl;
    return 0;
}

Measured memory_bytes: 38748
#include <bits/stdc++.h>
#include <cmath>
#include <numeric>
using namespace std;
using ll=long long;
#define rep(i,a,b) for(int i=(a); i<(b); ++i) // a ≦ i < b 
#define Rrep(i,a,b) for(int i=(a);i>=(b);--i) // reverse repeat. a から b まで減少．
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend() //逆イテレータ
#define RANGE(a,b,c) (a).begin()+b,(a).begin()+c // コンテナ a の 要素 b から c へのイテレータ
#define MOD 1000000007
// typedef
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef vector<PII> VP;


int main() {
ll a, b, x; cin >> a >> b >> x;

if (a%x) cout << b / x - a / x << "\n"; //割り切れないとき
else cout << b / x - a / x +1 << "\n";


return 0;
}

// 境界，出力文字列 チェック
// int は ± 2*10⁹.
// map[]は対数時間．unordered_map[]は一定時間．


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <bitset>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
#define rep(i,n) for (int i=0; i<n;++i)
#define rep_down(i,n) for (int i=n-1; i>=0;--i)
typedef long long ll;
using namespace std;
const ll MOD = 1000000007LL;
const int INF = 1000000007;
int N;
ll T[101];
ll L[101];

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

ll lcm(ll a, ll b) {
    ll g = gcd(a, b);
    return a / g * b;
}

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

  cin >> N;
  ll ans = 1ll;
  rep(i, N){
    cin >> T[i];
    ans = lcm(ans, T[i]);
    L[i] = ans;
  }

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pll pair<long long,long long>
#define mod 1000000007
#define endl '\n'
#define IOS std::ios::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL);

ll power(ll a,ll b){
	ll ans=1;
	while(b>0){
		if(b%2!=0){
			ans=(ans*a)%mod;
		}
		a=((a%mod)*(a%mod))%mod;
		b>>=1;
	}
	return ans;
}

int main() {
	IOS;
	int t=1;
	//cin>>t;
	while(t--){
		string s;
		cin>>s;
		int a[131];
		for(int i=0;i<131;i++){
			a[i]=i%13;
		}
		int n=s.size();
		int b[n][13];
		memset(b,0,sizeof(b));
		if(s[0]=='?'){
			for(int i=0;i<13;i++){
				if(i<10)
				b[0][i]=1;
				else
				b[0][i]=0;
			}
		}
		else
		b[0][s[0]-'0']=1;
		
		for(int i=1;i<n;i++){
			for(int j=0;j<13;j++)
			b[i-1][j]%=mod;
			if(s[i]!='?'){
				for(int j=0;j<=12;j++){
					b[i][(j*10+s[i]-'0')%13]=(b[i][(j*10+s[i]-'0')%13]+b[i-1][j])%mod;
				}
				continue;
			}
			for(int j=0;j<=12;j++){
				for(int k=0;k<=9;k++){
					b[i][(j*10+k)%13]=(b[i][(j*10+k)%13]+b[i-1][j])%mod;
				}
			}
		}
		cout<<b[n-1][5]%mod;
	}
	return 0;
}

Measured memory_bytes: 5584
# include <stdio.h>
# include <string.h>
# include <iostream>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

const int M = 5e5 + 10;
const int mod = 1e9 + 7;

int n, a, b; 

int main() {
  std :: ios :: sync_with_stdio(false); 
  std :: cin.tie(0); 
  std :: cout.tie(0);
  ll sum = 0;
  int mi = 2e9;
  bool flag = 1;
  cin >> n;
  for (int i = 1; i <= n; ++ i) {
    cin >> a >> b;
    flag &= (a == b);
    sum += a;
    if(a > b) mi = min(mi, b);
  }
  if(flag) puts("0");
  else cout << sum - mi << endl;
  return 0;
}




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

//============================================================================
#define pred(x) ((x)-1)
#define succ(x) ((x)+1)
//============================================================================
//============================================================================
#define P_START 0.0
#define P_FINISH 100.0
//============================================================================
#define PI 3.141592653589793
#define DMAX 0.005
#define MAXN 6
unsigned int a;
double d, lsX,lsY,costbl[MAXN], sintbl[MAXN];

void koch(int n)
{
    double x,y;
    if (!n){
		x=d * costbl[a % MAXN]+lsX; y=d * sintbl[a % MAXN]+lsY;
        printf("%lf %lf\n", x, y);
        lsX=x, lsY=y;
	}else {
		n--; d /= 3;  koch(n);  a++;  koch(n);
		a += 4;  koch(n);  a++;  koch(n);
		d *= 3;
	}
}
//----------------------------------------------------------------------------
void input(FILE *file)
{
    short n;

    fscanf(file, "%hd", &n);
	for (a = 0; a < MAXN; a++) {
		costbl[a] = cos(a * PI / 3);
		sintbl[a] = sin(a * PI / 3);
	}
    d = P_FINISH;  a = 0; lsX=lsY=P_START;
    printf("%lf %lf\n", lsX, lsY);
    koch(n);
}
//============================================================================
#ifndef DESKTOP
int main()
{
    input(stdin);
    return 0;
}
#endif

Measured memory_bytes: 644
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;
const int MOD = 1e9 + 7;

int main() {
  string a, b, c;
  cin >> a >> b >> c;
  char t = 'a';
  for (int i = 0;; i++) {
    if (t == 'a') {
      if(a.size() == 0) break;
      t = a[0];
      a = a.substr(1);
    } else if (t == 'b') {
      if(b.size() == 0) break;
      t = b[0];
      b = b.substr(1);
    } else if (t == 'c') {
      if(c.size() == 0) break;
      t = c[0];
      c = c.substr(1);
    }
  }
  cout << char(t - 32) << endl;
  return 0;
}

Measured memory_bytes: 3608
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
#define int long long
#define boost() ios_base :: sync_with_stdio(0); cin.tie(); cout.tie(); cout << fixed; cout << setprecision(15); srand(time(NULL))
#define all(x) x.begin(), x.end()
using namespace __gnu_pbds;
using namespace std;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;

int n, dp[100010][5];
int x[100010][5];

int sol (int id, int last) {
  if (id >= n) return 0;
  int &ret = dp[id][last];
  if (ret != -1) return ret;
  ret = 0;
  for (int i = 1; i <= 3; i++) {
    if (i == last) continue;
    ret = max (ret, x[id][i] + sol (id + 1, i));
  }
  return ret;
}

signed main () {
  memset (dp, -1, sizeof dp);
  cin >> n;
  for (int i = 0; i < n; i++) {
    for (int j = 1; j <= 3; j++) {
      cin >> x[i][j];
    }
  }
  int res = 0;
  for (int i = 1; i <= 3; i++) {
    res = max (res, x[0][i] + sol (1, i));
  }
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 15872
#include<stdio.h>
int main(){
  int m,a,b,c,d,i=0;
  scanf("%d",&m);
  a=(m%1000)%100%10;
  b=m%1000%100/10;
  c=m%1000/100;
  d=m/1000;
  if(a==b&&b==c||b==c&&c==d)
  printf("Yes");
    else
        printf("No");
  return 0;
}


Measured memory_bytes: 128
import java.util.*;

class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int[] a = new int[5];
    for (int i = 0; i < 5; i++) a[i] = sc. nextInt();
    System.out.println(a[4]-a[0] <= sc.nextInt() ? "Yay!" : ":(");
  }
}

Measured memory_bytes: 35632
sub f{
	my($u,$r)=($_,0);
	$r+=$-=f($u)-$r for@$u;
	$%+=++$r>=$'&"@_">1;
	$r%$'
}
$_=<>=~$";
$i++?($$_[@$_]=$.++):($%+=$_!=1)for glob<>;
f;
print$%

Measured memory_bytes: 177416
#include <bits/stdc++.h>
using namespace std;
const int oo = 27081993;

int main()
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  string s;
  cin >> s;
  int last = 0;
  long long ans = 0;
  vector<pair<int, int>> st;
  st.push_back({0, oo});
  for (int i = 1; i <= s.size(); i++)
  {
    if (s[i - 1] == '<')
    {
      ans += ++last;
      st.push_back({i, oo});
    }
    else if (last)
    {
      if (last > 1)
        st.push_back({i, last - 1});
      last = 0;
    }
    else
    {
      auto u = st.back();
      st.pop_back();
      ans += i - u.first;
      --u.second;
      if (u.second > 0)
        st.push_back(u);
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 7060
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <cmath>
#include <queue>
#include <cstring>
#include <string>
#include <sstream>
#include <map>
#include <set>
#include <stack>
#include <list>
#include <ctime>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int maxn=100000+10;
const int maxm=100000+10;
const int mod=(int)1e9+7;
const int INF=0x3f3f3f3f;
const ll LINF=(1LL<<62);
const double eps=1e-8;
const double PI=acos(-1.0);
#define mst(a,b) memset(a,b,sizeof(a))
#define rep(i,a,b) for (int i=(a);i<b;i++)
#define ALL(x) x.begin(),x.end()
#define pii pair<int,int>
#define lowbit(x) x&(-x)
#define X first
#define Y second
char s[maxn];
int main(){
#ifdef local
    freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
#endif
    //ios::sync_with_stdio(false); cin.tie(0);
    scanf("%s",s);
    int len=strlen(s),ans=len;
    for (int i=0;i<len-1;i++){
        if (s[i]!=s[i+1]){
            ans=min(ans,max(i+1,len-i-1));
        }
    }
    printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 384
while True:
    n,m,h,k = map(int, input().split())
    if n == 0: break
    pts = []
    for _ in range(n):
        pts.append(int(input()))
    bars = []
    for _ in range(m):
        bars.append(list(map(int, input().split())))
    bars.sort(key=lambda x: x[1])

    nos = [i for i in range(n)]
    barspt = []

    for bar in bars:
        b = bar[0]-1
        barspt.append([nos[b],nos[b+1],0,0])
        nos[b],nos[b+1] = nos[b+1],nos[b]

    nos = [i for i in range(n)]
    for barid in range(m-1,-1,-1):
        b0 = bars[barid][0]-1
        b1 = bars[barid][0]
        barspt[barid][2] = pts[nos[b0]]
        barspt[barid][3] = pts[nos[b1]]
        pts[nos[b0]],pts[nos[b1]] = pts[nos[b1]],pts[nos[b0]]

    atari = -1
    minsc = sum(pts[0:k])

    hosei = 0
    for bar in barspt:
        if atari <= bar[0]-1 and bar[0]-1 < atari+k and (bar[1]-1 < atari or atari+k <= bar[1]-1):
            sc = bar[2]-bar[3]
            if sc < hosei: hosei = sc
        if atari <= bar[1]-1 and bar[1]-1 < atari+k and (bar[0]-1 < atari or atari+k <= bar[0]-1):
            sc = bar[3]-bar[2]
            if sc < hosei: hosei = sc
    print(minsc+hosei)

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


using namespace std;


using ll = long long;


int main() {
    ll N, M;
    cin >> N >> M;
    priority_queue<ll> item;

    for (ll i = 0; i < N; i++) {
        ll a;
        cin >> a;
        item.push(a);
    }

    for (ll i = 0; i < M; i++) {
        ll a = item.top();
        item.pop();

        item.push(a / 2);
    }

    ll ans = 0;
    while (!item.empty()) {
        ans += item.top();
        item.pop();
    }
    cout << ans << endl;
}


Measured memory_bytes: 1400
s = [int(x) for x in list(input())]
x = len(s)
y = [0 if i % 2 ==0 else 1 for i in range(x)]
z = [1 if i % 2 ==0 else 0 for i in range(x)]
count1 = 0
count2 = 0
ans1 = list(zip(s,y))
ans2 = list(zip(s,z))
for a in ans1:
  if a[0] != a[1]:
    count1 += 1
for a in ans2:
  if a[0] != a[1]:
    count2 += 1
print(min(count1,count2))

Measured memory_bytes: 25540
from heapq import heappush,heappop,heapify
from collections import deque,defaultdict,Counter
import itertools
from itertools import permutations,combinations
import sys
import bisect
import string
import math
import time
#import random
def I():
    return int(input())
def MI():
    return map(int,input().split())
def LI():
    return [int(i) for i in input().split()]
def LI_():
    return [int(i)-1 for i in input().split()]
def show(*inp,end='\n'):
    if show_flg:
        print(*inp,end=end)
YN=['Yes','No']
mo=10**9+7
inf=float('inf')
ts=time.time()
sys.setrecursionlimit(10**6)
#input=sys.stdin.readline().rstrip
show_flg=False
show_flg=True

ans=0
n=I()
print(n**2)


Measured memory_bytes: 38640