akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
const int inf = 1e9 + 7;
const ll INF = 1e18;
#define abs(x) (x >= 0 ? x : -(x))
#define lb(v, x) (int)(lower_bound(all(v), x) - v.begin())
#define ub(v, x) (int)(upper_bound(all(v), x) - v.begin())
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
template<typename T> T pow(T a, int b) { return b ? pow(a * a, b / 2) * (b % 2 ? a : 1) : 1; }
const int mod = 1000000007;
ll modpow(ll a, int b) { return b ? modpow(a * a % mod, b / 2) * (b % 2 ? a : 1) % mod : 1; }
template<class T> ostream& operator<<(ostream& os, const vector<T>& v) { rep(i, sz(v)) { if (i) os << " "; os << v[i]; } return os; }
template<class T, class U> ostream& operator<<(ostream& os, const pair<T, U>& p) { os << p.F << " " << p.S; return os; }
template<class T> inline void add(T &a, int b) { a += b; if (a >= mod) a - mod; }

void solve();

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

    int T;
    // cin >> T;
    T = 1;

    while (T--) {
      solve();
    }
}


void solve() {
  int n, d, a;
  cin >> n >> d >> a;
  vector<pair<int, ll> > v(n);
  rep(i, n) cin >> v[i].F >> v[i].S;
  sort(all(v));

  vector<ll> acc(n);
  ll cnt = 0;
  rep(i, n) {
    if (i) acc[i] += acc[i - 1];
    v[i].S += acc[i];
    if (v[i].S <= 0) continue;

    int x = (v[i].S + a - 1) / a;
    // cout << i << " " << x << " " << v[i].S << endl;
    cnt += x;
    int it = upper_bound(all(v), pair<int, ll>(1LL * v[i].F + 2 * d + 1, -1)) - v.begin();
    acc[i] -= 1LL * x * a;
    if (it != sz(v)) acc[it] += 1LL * x * a;
  }

  cout << cnt << endl;
}


Measured memory_bytes: 4992
# #!/usr/bin/env python3
# # -*- coding: utf-8 -*-


def main():
    N = int(input())
    A = list(map(int, input().split()))
    B = list(map(int, input().split())) + [0]
    C = [0] * (N + 1)

    result = 0
    for i in range(N + 1):
        if A[i] <= B[i] + C[i]:
            result += A[i]
            B[i] -= max(0, A[i] - C[i])
            if i < N:
                C[i + 1] = B[i]
        else:
            result += B[i] + C[i]

    print(result)


if __name__ == "__main__":
    main()


Measured memory_bytes: 18476
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cassert>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <bitset>
#include <queue>
#include <deque>
#include <cmath>
#include <unordered_map>
#include <set>
#include <map>
#define INCANT cin.tie(0), cout.tie(0), ios::sync_with_stdio(0), cout << fixed << setprecision(20);
#define rep(i,n) for (int i=0; i<n;++i)
#define ALL(a)  (a).begin(),(a).end()
typedef long long ll;
using namespace std;
const ll MOD = 1e9+7LL;
const int INF = 2e9;
int N;
int A[200005], B[200005];


int main() {
  INCANT;
  cin >> N;
  int a,b;
  rep(i, N) {
    cin >> a >> b;
    A[i] = a+b;
    B[i] = a-b;
  }
  sort(A, A+N);
  sort(B, B+N);
  
  cout << max(A[N-1]-A[0], B[N-1]-B[0]) << endl;
  
  return 0;
}

Measured memory_bytes: 5180
#include "bits/stdc++.h"
using namespace std;
typedef  long long ll;
const int MAX_N=106;
int main(){
    // freopen("in.txt","r",stdin);
    // freopen("out.txt","w",stdout);
   string s,s1; cin>>s>>s1; int ans=0;
   for(int i=0;i<s.size();i++){
       ans+=(s[i]!=s1[i]);
   }
   cout<<ans;
}

Measured memory_bytes: 3904
import math

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

kakudo = abs(30 * H + 0.5 * M - 6 * M)

Cnijou = (A ** 2 + B ** 2) - (2 * A * B * math.cos(math.radians(kakudo)))

print(math.sqrt(Cnijou))

Measured memory_bytes: 9508
using System;

namespace A
{
    class Program
    {
        static void Main(string[] args)
        {
            solver();
        }
        static void solver()
        {
            var HWAB = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
            var H = HWAB[0]; var W = HWAB[1]; var A = HWAB[2]; var B = HWAB[3];

            var map = new bool[H, W];
            for (int i = 0; i < H; i++)
            {
                for (int j = 0; j < W; j++)
                {
                    map[i, j] = ((i < B) == (j < A));
                }
            }

            for (int i = 0; i < H; i++)
            {
                for (int j = 0; j < W; j++)
                {
                    Console.Write(map[i, j] ? "1" : "0");
                }
                Console.WriteLine();
            }
        }
    }
}


Measured memory_bytes: 13140
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef double D;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int,int> PII;
typedef pair<ll,ll> PLL;
 
#define rd(x) scanf("%d",&x)
#define rd2(x,y) scanf("%d %d",&x,&y)
#define rl(x) scanf("%lld",&x)
#define rl2(x,y) scanf("%lld %lld",&x,&y)
#define wd(x) printf("%d" ,x)
#define wd2(x,y) printf("%d %d",x,y)
#define wl(x) printf("%lld",x)
#define wl2(x,y) printf("%lld %lld",x,y)
#define PC(x) putchar(x)
#define GC() getchar()
#define NL printf("\n")
#define SP printf(" ")
 
#define F first
#define S second
#define MP make_pair
#define PB push_back

#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL)
#define fr(i,s,e) for(int i=s;i<e;i++)
#define frl(i,s,e) for(ll i=s;i<e;i++)
#define frr(i,s,e) for(int i=s-1;i>=e;i--)
#define frv(i,a) for(int i = 0;i<(int)a.size();i++)
#define frvr(i,a) for(int i = a.size()-1;i>=0;i--)
#define tr(i,a) for(typeof(a.begin()) i = a.begin(); i != a.end();i++)

#define mod 1000000007
#define maxn 100009
#define maxr 100009
vector<vector<int>> adlist(100005);
multiset<pair<int,long long>> adlist1[100005];
int ans[100005]={};
void dfs(int now)
{
	for(auto i=adlist[now].begin();i!=adlist[now].end();++i)
	{
		//auto p=*i;
		if(ans[*i]==0)
		{
			ans[*i]=1;
			dfs(*i);
		}
	}
}
int main(){
	
	int n,m;
	cin>>n>>m;
	//ll w;
	int u,v,z;
	fr(i,0,m){
		cin>>u>>v>>z;
		u--,v--;
		adlist[u].PB(v);
		adlist[v].PB(u);
	}

	int rans=0;
	fr(i,0,n)
	{
		if(ans[i]==0)
		{
			ans[i]==1;
			rans++;
			dfs(i);
		}
	}
	cout<<rans<<endl;
	return 0;
}

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

#define OK 0
#define NG 1
 
int main() {
    int n, i;
    long A[210];

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

    int ans = OK;
    int cnt = 0;

    while( ans == OK )
    {
        for( i = 0; i < n; i++ )
        {
            if(A[i] % 2 == 0)
            {
                A[i] /= 2;
            }
            else
            {
                ans = NG;
            }
        }

        if(ans == OK)
        {
            cnt++;
        }
    }

    cout << cnt << endl;

    return 0;
}


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

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

    int V[N];
    for (int i = 0; i < N; ++i) {
        std::cin >> V[i];
    }

    int C, sum = 0;
    for (int i = 0; i < N; ++i) {
        std::cin >> C;
        if (V[i] > C) {
            sum += (V[i] - C);
        }
    }

    std::printf("%d\n", sum);

    return 0;
}


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

int main() {
  long int N;
  cin>>N;
  long long int ans;
  ans=0;
  vector<long int> A(N+1);
  for (long int i=1 ; i<=N ; i++){
    for(long int j=i;j<=N;j+=i){
		A[j]+=j;
    }
    ans+=A[i];
  }
  cout << ans << endl;
}

Measured memory_bytes: 81400
#include <algorithm>
#include <bitset>
//#include <boost/multiprecision/cpp_int.hpp>
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstring>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <sstream>
#include <stdio.h>
#include <string>
#include <tuple>
#include <vector>
// namespace mp = boost::multiprecision;
using namespace std;
using ull = unsigned long long;
using ld = long double;
// using ll = boost::multiprecision::cpp_int;
using ll = long long;
#define FOR(i, N) for(ll i = 0; i < N; ++i)

#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
// using int = ll;
ll gcd(ll m, ll n) {
    if(n == 0)
        return abs(m);
    return (gcd(n, m % n));
}
void putYN(bool b) {
    if(b) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}
void swap(ll &a, ll &b) {
    ll tmp = a;
    a = b;
    b = tmp;
}
ll combi(ll n, ll k) {
    ll r = 1, rr = 1;
    for(ll i = 0; i < k; ++i) {
        r *= (n - i);
        rr *= (i + 1);
        // r %= 1000000007;
        // rr %= 1000000007;
    }
    r /= rr;
    // r %= 1000000007;
    return r;
}
int main() {
  ll A,B;
  cin>>A>>B;
  if(A>=10||B>=10){
    cout<<-1<<endl;
  }else{
    cout<<A*B<<endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int N;
    cin >> N;
    vector<double> num(N);
    for (int i = 0;i < N;i++){
        cin >> num.at(i);
    }

    double calc;
    double befcalc = 0;
    for (int i = 0;i < N;i++){
        befcalc = 1 / num.at(i) + befcalc;
    }

    calc = 1 / befcalc;

    cout << setprecision(13) << calc << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const long long INF = 1LL << 60;
const int MOD = 1000000007;

int main() {
    ll N;
    cin >> N;
    vector<ll> A(N+2);
    A[0] = 0;
    for (int i = 1; i <= N; i++) cin >> A[i];
    A[N+1] = 0;

    ll sum = 0;
    for (int i = 0; i <= N; i++){
      sum += abs(A[i] - A[i + 1]);
    }

    for (int i = 0; i < N; i++) {
      cout << sum - abs(A[i + 1] - A[i]) - abs(A[i + 1] - A[i + 2]) +abs(A[i] - A[i + 2])<< endl;
    }
    return 0;
}

Measured memory_bytes: 3996
from collections import defaultdict
from collections import deque
from string import ascii_uppercase
import sys, bisect, math, heapq

stdin = sys.stdin
read_int = lambda : list(map(int,stdin.readline().split()))
read_str = lambda : stdin.readline().rstrip()

S = read_str()

def solve():
    if len(S) < 2 or len(S) % 2 == 1:
        return 'No'
    for i, s in enumerate(S):
        if i % 2 == 0:
            if s != 'h': return 'No'
        else:
            if s != 'i': return 'No'
    return 'Yes'

if __name__ == "__main__":
    print(solve())

Measured memory_bytes: 4080
n, m = map(int, input().split())
min, max = 1, n

for i in range(m):
    l, r = map(int, input().split())
    if min < l:
        min = l
    if r < max:
        max = r

if min <= max:
    print(max-min+1)
else:
    print(0)


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

const int mod = 1e9 + 7;
int x[100005], y[100005];
signed main() {
	int n, m;
	scanf("%lld%lld", &n, &m);
	for (int i = 0; i < n; i++)
		scanf("%lld", x + i);
	for (int i = 0; i < m; i++)
		scanf("%lld", y + i);
	int W = 0, H = 0;
	for (int l = 0, r = n - 1; l < r; l++, r--)
		W = (W + (x[r] - x[l]) * (r - l)) % mod;
	for (int l = 0, r = m - 1; l < r; l++, r--)
		H = (H + (y[r] - y[l]) * (r - l)) % mod;
	printf("%lld\n", (W * H) % mod);
	return 0;
}

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

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

  int dp[1005][1005];
  rep(i,1005)rep(j,1005) dp[i][j] = 1005;
  rep(i,a.size()+1) dp[i][0] = i;
  rep(i,b.size()+1) dp[0][i] = i;

  rep(j,a.size())rep(k,b.size()){
    if(a[j]==b[k]) dp[j+1][k+1] = min(dp[j+1][k+1],dp[j][k]);
    else{
      dp[j+1][k+1] = min(dp[j][k+1]+1,dp[j+1][k+1]);
      dp[j+1][k+1] = min(dp[j+1][k]+1,dp[j+1][k+1]);
      dp[j+1][k+1] = min(dp[j][k]+1,dp[j+1][k+1]);
    }
  }
  

  cout << dp[a.size()][b.size()] << endl;
}


Measured memory_bytes: 7176
s=input()
ans=0
numans=0
for i in range(len(s)):
    if s[i]=="A" or s[i]=="C" or s[i]=="G" or s[i]=="T":
        ans+=1
    else:
        if ans>numans:
            numans=ans
            ans=0
if ans>numans:
    numans=ans
    ans=0
print(numans)


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<long long, long long> P;
struct edge{long long to,cost;};
const int inf = 1<<27;
const long long INF = 1LL << 60;
const int COMBMAX = 1001001;
const long long MOD = 1000000007;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define eachdo(v, e) for(const auto& e : (v))
#define all(v) (v).begin(), (v).end()
#define lower_index(v, e) (long long)distance((v).begin(), lower_bound((v).begin(), (v).end(), e))
#define upper_index(v, e) (long long)distance((v).begin(), upper_bound((v).begin(), (v).end(), e))
long long mpow(long long a, long long n, long long mod = MOD){long long res = 1; while(n > 0){if(n & 1)res = res * a % mod; a = a * a % mod; n >>= 1;} return res;}
void yn(bool j){cout << (j ? "Yes" : "No") << endl; return;}
template<class Head> void pt(Head&& head){cout << head << endl; return;}
template<class Head, class... Tail> void pt(Head&& head, Tail&&... tail){cout << head << " "; pt(forward<Tail>(tail)...);}
template<class T> void debug(T v){rep(i, v.size()) cout << v[i] << " " ; cout << endl;}
template<class T> void debug2(T v){rep(i, v.size()){rep(j, v[i].size()) cout << v[i][j] << " " ; cout << endl;}}
template<class T1, class T2> long long bcount(T1 v, T2 a){return upper_index(v, a) - lower_index(v, a);} 
template<class T1, class T2> inline bool chmin(T1 &a, T2 b){if(a > b){a = b; return true;} return false;}
template<class T1, class T2> inline bool chmax(T1 &a, T2 b){if(a < b){a = b; return true;} return false;}
template<class T1, class T2> void sortTwoVecter(vector<T1> &f, vector<T2> &s, bool isReverse = false){
    vector<pair<T1, T2>> p;
    rep(i, f.size()) p.emplace_back(make_pair(f[i], s[i]));
    if (!isReverse) sort(p.begin(), p.end());
    else sort(p.rbegin(), p.rend());
    rep(i, f.size()) tie(f[i], s[i]) = p[i];
    return;
}

int main(){
    ll N; cin >> N;
    vector<ll> s(N);
    rep(i, N) cin >> s[i];
    vector<vector<bool>> dp(N + 1, vector<bool>(10100, false));
    dp[0][0] = true;
    rep(i, N) rep(j, 10100){
        dp[i + 1][j] = dp[i][j] | dp[i + 1][j];
        if (0 <= j - s[i]) dp[i + 1][j] = dp[i + 1][j] | dp[i][j - s[i]];
    }
    for(ll i= 10050; 0 <= i; i--){
        if (i % 10 == 0) continue;
        if (dp[N][i]){
            pt(i);
            return 0;
        }
    }
    pt(0);

}

Measured memory_bytes: 384
import java.util.*;
import java.lang.*;
import java.io.*;

public class Main {
    static class Fast {
        BufferedReader br;
        StringTokenizer st;

        public Fast() {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }
static int arr[];
    public static void main(String args[]) throws Exception {
        Fast in = new Fast();
        int n = in.nextInt();
        int a = in.nextInt(), b = in.nextInt();
        for (int i = 0; i < (int)1e6; i++) {
            if(a+1==b){
                if(a-1==0){
                    System.out.println("Borys");
                    return;
                }else {
                    a--;
                }
            }else {
                a++;
            }
            if(b-1==a){
                if(b+1==n+1){
                    System.out.println("Alice");
                    return;
                }else {
                    b++;
                }
            }else{
                b--;
            }
        }
        System.out.println("Draw");
    }
}






Measured memory_bytes: 22484
from copy import deepcopy
h,w,k=map(int, input().split())
maze=[list(input()) for _ in range(h)]
ans=0
for bit in range(1<<h):
    #print(bit)

    #全行消したらスキップ
    if bit == 2**h:
        continue
    
    t1=deepcopy(maze)
    #指定された行を塗りつぶす
    for i in range(h):
        if bit & (1<<i):
            for j in range(w):
                t1[i][j] = "."
    
    #列について考える
    for Bit in range(1<<w):
        #全列消したらスキップ
        if Bit == 2**w:
            continue

        t2=deepcopy(t1)
        #print(t2)
        #指定された列を塗りつぶす
        for n in range(w):
            if Bit & (1<<n):
                for l in range(h):
                    t2[l][n] = "."
        #print(t2)
        #各行ごとに＃の数を確認
        cnt = 0
        for m in range(h):
            cnt += t2[m].count("#")
        if cnt == k:
            ans += 1
print(ans)

Measured memory_bytes: 9340
#include <bits/stdc++.h>
#define FOR(i, a, n) for(int (i) = (int)(a); (i) < (int)(n); ++(i))
#define FORe(i, a, n) for(int (i) = (int)(a); (i) <= (int)(n); ++(i))
#define rFOR(i, a, n) for(int (i) = (int)(n)-1; (i) >= (int)(a); --(i))
#define REP(i, n) FOR((i), 0, (n))
#define REPe(i, n) FORe((i), 0, (n))
#define rREP(i, n) rFOR((i), 0, (n))
#define rep(i, n) FOR((i), 0, (n))
#define all(v) (v).begin(), (v).end()
using namespace std;
using ll = long long;
using P = pair<int,int>;

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 a, b;
  cin >> a >> b;
  a += b;
  int num;
  num = stoi(a);
  FOR(i, 1, 100005) {
    int tmp = num/i;
    if (tmp<i) break;
    if (num%i) continue;
    else if (i==tmp) {
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;


  return 0;
}

Measured memory_bytes: 256
#include <fstream>
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <bitset>
#include <iomanip>
 
using namespace std;
typedef long long ll;
typedef unsigned long long ull;


int main(int argc, const char * argv[]) {
    int X, Y;
    cin >> X >> Y;

    if (Y % 2 != 0) {
        cout << "No" << endl;
        return 0;
    }

    if (2*X - (Y/2) < 0 || (Y/2) - X < 0) {
        cout << "No" << endl;
        return 0;
    }
    cout << "Yes" << endl;

    return 0;
}

Measured memory_bytes: 3104
menu=[None]*5
min=None
min_i=-1
for i in range(5):
  menu[i]=int(input())
  wait = menu[i]%10
  if min==None or (min > wait and wait != 0):
    min=wait
    min_i=i
    
sum = 0
for i in range(5):
  if i==min_i:
    sum = sum + menu[i]
  else:
    sum = sum + (menu[i]%10!=0)*10+(menu[i]//10)*10

print(sum)



Measured memory_bytes: 3060
<?php
  
$n = trim(fgets(STDIN));
$s = trim(fgets(STDIN));

$c = 0;
for($i=0; $i<$n; $i++){
  if (($s[$i]=='A' && $s[$i+1]=='B') && $s[$i+2]=='C'){
    $c++;
  }
}

echo $c;

?>

Measured memory_bytes: 4728
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(
            new InputStreamReader(System.in));
        StringBuilder str = new StringBuilder();
        String[] data;
        int x, y;
        while (true) {
            data = br.readLine().split(" ");
            x = Integer.parseInt(data[0]);
            y = Integer.parseInt(data[1]);
            if (x == 0 && y == 0) {
                break;
            }
            if (x < y) {
                str.append(x).append(" ").append(y).append("\n");
            } else {
                str.append(y).append(" ").append(x).append("\n");
            }
        }
        System.out.print(str);
    }
}

Measured memory_bytes: 26544
package main

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

var sc = bufio.NewScanner(os.Stdin)

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

func intScanner() int {
	n, _ := strconv.Atoi(Scanner())
	return n
}

func floatScanner() float64 {
	n, _ := strconv.ParseFloat(Scanner(), 64)
	return n
}
func stringToInt(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}
func stringSliceScanner(n int) []string {
	a := make([]string, n)
	for i := 0; i < n; i++ {
		a[i] = Scanner()
	}
	return a
}
func intSliceScanner(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = intScanner()
	}
	return a
}
func larger(a, b int) int {
	if a < b {
		return b
	} else {
		return a
	}
}
func smaller(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}
func max(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x < a[i] {
			x = a[i]
		}
	}
	return x
}
func min(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x > a[i] {
			x = a[i]
		}
	}
	return x
}
func abs(x int) int {
	if x < 0 {
		x = -x
	}
	return x
}

var mod int = 1000000007

func main() {
	buf := make([]byte, 0)
	sc.Buffer(buf, mod)
	sc.Split(bufio.ScanWords)
	n := Scanner()
	for _, r := range n {
		if string(r) == "1" {
			fmt.Print(9)
		} else if string(r) == "9" {
			fmt.Print(1)
		} else {
			fmt.Print(string(r))
		}
	}
	fmt.Println("")
}


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

int main() {
    int a, b, c, x, y;

    cin >> a >> b >> c >> x >> y;
    int ans = a * x + b * y;
    for (int i = 0; i <= max(x, y); i++) {
        ans = min(ans, 2 * c * i + a * max(x - i, 0) + b * max(y - i, 0));
    }

    cout << ans << endl;
}

Measured memory_bytes: 3640
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(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

pair<int, int> P[100010];
int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    
    rep(i, N) {
        cin >> P[i].first >> P[i].second;
    }
    sort(P, P + N, greater<pair<int,int>>());
    cout << P[0].first + P[0].second << endl;


    return 0;
}


Measured memory_bytes: 1024
#include <ctype.h>
#include <limits.h>
#include <math.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main(int argc, char **argv)
{
    long h;
    scanf("%ld", &h);
    int g = 0;
    while (h) {
        h >>= 1;
        g++;
    }
    printf("%.0lf\n", pow(2.0, g) - 1.0);
    return EXIT_SUCCESS;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef string str;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector <pii> vpii;
typedef vector <pll> vpll;
typedef map <str,int> mapsi;
typedef map <str,int> :: iterator mapsitr;
typedef map <int , int> mint;
typedef map <ll , ll> mll;
typedef set <int> si;
typedef set <ll> sll;
typedef si :: iterator sitr;
typedef si :: reverse_iterator rsitr;
typedef sll :: iterator sltr;
typedef sll :: reverse_iterator rsltr;
#define mset multiset
typedef mset <int> msi;
typedef mset <ll> msll;
typedef msi :: iterator msitr;
typedef msi :: reverse_iterator msritr;
typedef msll :: iterator msltr;
typedef msll :: reverse_iterator mslritr;
#define mp make_pair
#define pb push_back
#define pob pop_back
#define pf push_front
#define pof pop_front
#define fi first
#define se second
#define fs first.second
#define ss second.second
#define ff first.first
#define sf second.first
#define newl '\n'
char to_upper (char x){
    if( 97 <= int(x) && int(x) <= 126)return char(x-32);
    else if( 65 <= int(x) && int(x) <= 90)return x;
}
char to_lower (char x){
    if( 97 <= int(x) && int(x) <= 126)return x;
    else if( 65 <= int(x) && int(x) <= 90)return char(x+32);
}
int numerize (char x){
    if(48 <= int(x) && int(x) <= 57)return int(x-'0');
    else if( 97 <= int(x) && int(x) <= 126)return int(x-96);
    else if( 65 <= int(x) && int(x) <= 90)return int(x-64);
}
//void IO(){
//	#ifndef ONLINE_JUDGE
//	    freopen("input.txt", "r", stdin);
//	    freopen("output.txt", "w", stdout);
//	#endif
//}
// end of Template

str s;
int main(){
	//IO();
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin>>s;
    s[3]='8';
    cout<<s<<newl;
}


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

int main(){
	int n, m;
	int total_wa = 0;
	int count = 0;
	string s;
	array<bool, 100000> ac = {false};
	array<int, 100000> wa = {0};

	cin >> n >> m;

	for(size_t i = 0; i < m; i++) {
		cin >> n >> s;
				
		if(ac[n]) {
			continue;
		}

		if(s == "AC") {
			ac[n] = true;
			count++;
			total_wa += wa[n];
		} else if(s == "WA") {
			wa[n]++;
		}
	}

	printf("%d %d\n", count, total_wa);
}


Measured memory_bytes: 768
patterns = [
    [1, 2, 3, 4, 5, 6],
    [1, 3, 5, 2, 4, 6],
    [1, 5, 4, 3, 2, 6],
    [1, 4, 2, 5, 3, 6],
    [2, 6, 3, 4, 1, 5],
    [2, 3, 1, 6, 4, 5],
    [2, 1, 4, 3, 6, 5],
    [2, 4, 6, 1, 3, 5],
    [3, 6, 5, 2, 1, 4],
    [3, 5, 1, 6, 2, 4],
    [3, 1, 2, 5, 6, 4],
    [3, 2, 6, 1, 5, 4],
    [4, 6, 2, 5, 1, 3],
    [4, 2, 1, 6, 5, 3],
    [4, 1, 5, 2, 6, 3],
    [4, 5, 6, 1, 2, 3],
    [5, 3, 6, 1, 4, 2],
    [5, 6, 4, 3, 1, 2],
    [5, 4, 1, 6, 3, 2],
    [5, 1, 3, 4, 6, 2],
    [6, 2, 4, 3, 5, 1],
    [6, 3, 2, 5, 4, 1],
    [6, 4, 5, 2, 3, 1], 
    [6, 5, 3, 4, 2, 1]
]

a = list(map(int,input().split()))
b = list(map(int, input().split()))

d = dict(zip(list(range(1, 7)), a))

ds = []
for pattern in patterns:
    c = [d.get(x) for x in pattern]
    ds.append(c)

if b  in ds:
    print('Yes')
else:
    print('No')



Measured memory_bytes: 5620
// written by : soumya_27
#include<bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
#define int long long
#define ld long double
#define mod ((int)1e9+7)//998244353//((int)1e18+7)
#define M_PI 3.14159265358979323846
// #define maxx ((int)1e7+7)
#define pb push_back
#define ins insert
#define F first
#define S second
#define ins insert
#define pii pair <int , int>
#define lb lower_bound
#define ub upper_bound
#define usefile freopen("input.txt","r",stdin); freopen("ou(tp)ut.txt","w",stdout);
#define fast ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define test int t; cin >> t; while(t--)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
int exp(int x,int y,int p){ int res=1; while(y) {if(y%2) res=(res*x%p)%p; x=(x*x)%p; y/=2; } return res;}
int expo(int x,int y){ int res=1; while(y) {if(y%2) res=(res*x%mod)%mod; x=(x*x)%mod; y/=2; } return res;}
int add(int a, int b) {return (a%mod + b%mod + mod)%mod;}
int sub(int a, int b) {return (a%mod - b%mod + mod)%mod;}
int mul(int a, int b) {return ((a%mod)*(b%mod) + mod)%mod;}
int inv(int x) {return expo(x, mod-2);}
#define debug(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)     
#define time__(d) for(long blockTime = 0; (blockTime == 0 ? (blockTime=clock()) != 0 : false); debug("%s time : %.4fs", d, (double)(clock() - blockTime) / CLOCKS_PER_SEC))
using namespace std;

void solve()
{
    fast
    // test
    {
        int i, j, n;
        cin >> n;
        int modv = 0;
        for(i=1 ; i<1000006 ; i++)
        {
            if((modv*10 + 7)%n == 0)
            {
                cout << i;
                return;
            }
            modv = (modv*10 + 7)%n;
           // if(i == 999982) cout << modv << "\n";
        }
        cout << -1 << "\n";
    }
}

signed main()
{
    // time__("solve")
    {
        solve();
    }
    return 0;
}

Measured memory_bytes: 3652
#include <stdio.h>

int main(void) {
  int N;
  int V[20];
  int C[20];
  scanf("%d", &N);
  for(int i = 0; i < N; i++) {
    scanf("%d", &V[i]);
  }
  for(int i = 0; i < N; i++) {
    scanf("%d", &C[i]);
  }

  int X = 0;
  for(int i = 0; i < N; i++) {
    if(V[i] > C[i])
      X += (V[i] - C[i]);
  }
  
  printf("%d\n", X);
  return 0;
}


Measured memory_bytes: 128
#include <stdio.h>
#define N 44
void fib(int);
int f[N];
int main(){
  
  int n;

  scanf("%d",&n);
  fib(n);

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

  return 0;
}

void fib(int n)
{
  int i;
  
  f[0] = 1;
  f[1] = 1;
  for(i=2; i<=n; i++){
    f[i] = f[i-2]+f[i-1];
  }
}

Measured memory_bytes: 596
"use strict";

const main = arg => {
    arg = arg.trim().split("\n");
    const N = parseInt(arg[0]);
    const A = arg[1].split(" ").map(n=>parseInt(n));
    
    let cnt = 0;
    
    for(let i=0; i<N; i++) {
        // console.log("A[i]:" + A[i]);
        // console.log("cnt:" + cnt);
        // console.log("---")
        if(A[i] === (cnt + 1)) {
            // console.log("true")
            cnt++;
        }
    }
    
    // console.log("lastCnt:" + cnt)

    if(cnt !== 0) {
        console.log(N - cnt);
    } else {
        console.log(-1);
    }
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

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

namespace TYC
{
	typedef long long ll;
	const int N = 205;

	int n, m, s, t, ecnt, Head[N], dep[N], cur[N], R[N][N];
	struct edge { int to, next, w; } E[N * N];
	vector<int> A[N][N], P[N];

	inline void add(const int u, const int v, const int w)
	{
		E[++ecnt] = (edge){v, Head[u], w};
		Head[u] = ecnt;
		E[++ecnt] = (edge){u, Head[v], 0};
		Head[v] = ecnt;
	}	

	bool bfs()
	{
		static queue<int> Q;
		memset(dep, 0, sizeof(int[t + 1]));
		memcpy(cur, Head, sizeof(int[t + 1]));
		dep[s] = 1;
		Q.push(s);
		while (!Q.empty())
		{
			int u = Q.front();
			Q.pop();
			for (int i = Head[u], v; i; i = E[i].next)
				if (E[i].w && !dep[v = E[i].to])
					dep[v] = dep[u] + 1, Q.push(v);
		}
		return dep[t];
	}

	int dfs(const int u, const int mn)
	{
		if (u == t || !mn)
			return mn;
		int v, w, used = 0;
		for (int &i = cur[u]; i; i = E[i].next)
			if (E[i].w && dep[v = E[i].to] == dep[u] + 1)
			{
				w = dfs(v, min(E[i].w, mn - used));
				used += w;
				E[i].w -= w;
				E[i ^ 1].w += w;
				if (used == mn)
					return used;
			}
		if (!used)
			dep[u] = -1;
		return used;
	}

	void work()
	{
		scanf("%d%d", &n, &m);
		for (int i = 1, x; i <= n; i++)
			for (int j = 1; j <= m; j++)
			{
				scanf("%d", &x);
				A[i][(x - 1) / m + 1].push_back(x);
			}
		s = n << 1 | 1, t = s + 1;
		for (int k = 1; k <= m; k++)
		{
			ecnt = 1;
			memset(Head, 0, sizeof(int[t + 1]));
			for (int i = 1; i <= n; i++)
			{
				add(s, i, 1);
				add(i + n, t, 1);
				for (int j = 1; j <= n; j++)
					if (A[i][j].size())
						add(i, j + n, 1);
			}
			while (bfs())
				dfs(s, 0x3f3f3f3f);
			for (int u = 1; u <= n; u++)
				for (int i = Head[u], v; i; i = E[i].next)
					if (!E[i].w && (v = E[i].to - n) <= n)
					{
						R[u][k] = A[u][v].back();
						P[k].push_back(A[u][v].back());
						A[u][v].pop_back();
					}
			sort(P[k].begin(), P[k].end());
		}
		for (int i = 1; i <= n; i++, puts(""))
			for (int j = 1; j <= m; j++)
				printf("%d ", R[i][j]);
		for (int i = 1; i <= n; i++, puts(""))
			for (int j = 1; j <= m; j++)
				printf("%d ", P[j][i - 1]);
	}
}

int main()
{
	TYC::work();
	return 0;
}

Measured memory_bytes: 2048
#include <iostream>
#include <cmath>
#include <algorithm>
#include <iostream>
#include <cmath>
#include <algorithm>
using namespace std;
int main(){
  int n, m, i, j, ans=0;
  cin >> n >> m;
  int x[m];
  for(i=0; i<m; i++)
    cin >> x[i];
  if(n>=m){
    cout << 0;
    return 0;
  }
  sort(x, x+m);
  for(i=0; i<m-1; i++)
    x[i]=x[i+1]-x[i];
  sort(x, x+m-1);
  for(i=0; i<(m-n); i++)
    ans+=x[i];
  cout << ans;
  return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
#define prArr(Arr,n) for(int _=0;_<n;_++)   cout<<(Arr)[_]<<" ";
using namespace std;
const int INF=(int)0x3f3f3f3f;
const int MOD=(int)1e9+7;

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    long long a,b,x,n;
    cin>>a>>b>>n;
    x=min(n,b-1);
    cout<<(a*x)/b-a*(x/b);
    return 0;
}


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

namespace Algorithm
{
    class Program
    {
        static void Main(string[] args)
        {
            var l = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int H = l[0], W = l[1];
            var ans = new int[H, W];
            var map = new string[H];
            for (var i = 0; i < H; i++)
                map[i] = Console.ReadLine();

            var dot = 0;
            for (var i = 0; i <= H; i++)
            {
                for (var j = 0; j <= W; j++)
                {
                    if (i != H && j != W)
                    {
                        if (map[i][j] == '.') dot++;
                    }
                }
            }

            var dy = new int[] {1,0,-1,0};
            var dx = new int[] {0,1,0,-1};
            var q = new Queue<Tuple<int,int>>();
            q.Enqueue(new Tuple<int,int>(0,0));
            ans[0,0] = 1;
            while (q.Count > 0) {
               var t = q.Dequeue();
               var h = t.Item1;
               var w = t.Item2;
               for (var i = 0; i < 4; i++) {
                  var nextH = h + dy[i];
                  var nextW = w + dx[i];
                  if (nextH < 0 || nextW < 0 || nextH == H || nextW == W) continue;
                  if (map[nextH][nextW] == '.' && ans[nextH,nextW] == 0) {
                        q.Enqueue(new Tuple<int,int>(nextH, nextW));
                        ans[nextH, nextW] = ans[h, w] + 1;
                  }
               }
            }
            
            Console.WriteLine(ans[H-1,W-1] == 0 ? -1 : dot - ans[H-1,W-1]);

        }      
    }
}


Measured memory_bytes: 13524
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <string>
using namespace std;
int main() {
	int N; cin >> N;
	string S; cin >> S;
	for (int i = 0; i < S.size(); i++) {
		S.at(i) += N;
		if (S.at(i) > 90)S.at(i) -= 26;
	}
	cout << S << endl;
}


Measured memory_bytes: 256
#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 dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
const ll INF=1e18;


int main() {
	int	k;
	cin >> k;
	int a[1000001] = {};
	a[1] = 7 % k;
	for(int i = 2;i<=k;i++){
		a[i] = (a[i - 1]*10 + 7) % k;
	}
	for(int i = 1; i <= k;i++){
		if(a[i] == 0){
			cout << i <<endl;
			return (0);
		}
	}
	cout << "-1" << endl;
}

Measured memory_bytes: 7516
#include <bits/stdc++.h>
 
#define f(i,a,b) for( ll i = a; i < b ; i++ ) 
#define af(i,a,b) for( ll i = a; i >= b ; i--)
#define rep(i,a,b,k) for(ll i = a; i < b ; i+= k )
#define arep(i,a,b,k) for( ll i = a; i >= b ; i-= k)
#define ones(x) (ll) __builtin_popcount(x)
#define fs first
#define sc second
#define pb push_back
#define po pop_back
#define mp make_pair  
#define sz(a) (ll) a.size()
#define all(a) a.begin(), a.end()
#define sor(a) sort( a.begin(), a.end() )
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL)
#define ller ios::sync_with_stdio(false);cin.tsie(nullptr);cout.tie(nullptr)
#define watch(x) cout << (#x) << " is " << (x) << endl
#define PI 3.1415926535
using namespace std;
typedef long long ll;
typedef long double ld; 
typedef pair<ll,ll> ii ;
typedef vector<ll>  vi ;
typedef vector<ii> vii ;
const ll mod = 1e9+7;
const ll MAX = 2e5+7;
const ll inf = 1e9+7;


ll a[MAX];
int main() {
	fastio;
  ll n, k, l=0, r, mid, x;
	cin>>n>>k;
  f(i,0,n) cin>>a[i];
  r = inf;
  while (r-l>1) {
    mid = (l+r)/2;
    x = 0;
    f(i,0,n) x += (a[i]-1)/mid;
    if (x<=k) r=mid;
    else l=mid;
  }
  cout<<r<<"\n";
	return 0;
}

Measured memory_bytes: 5132
def s(n,a):
    N=n*(n+1)/2
    sa=sum(a)
    if sa%N!=0:
        return False
    if sa<N:
        return False
    sn=sa/N
    da=[]
    for i in xrange(n-1):
        da.append(a[i+1]-a[i])
    da.append(a[0]-a[n-1])
    if max(da)>sn:
        return False
    if sum(da)!=0:
        return False
    for di in da:
        if (sn-di)%n!=0:
            return False
    return True
    
n = int(raw_input())
a = [int(i) for i in raw_input().split(" ")]
if s(n,a):
    print "YES"
else:
    print "NO"

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

using namespace std;

uint64_t sqrti(uint64_t n)
{
  return static_cast<uint64_t>(ceil(sqrtl(static_cast<long double>(n))));
}

int main()
{
  uint64_t N;
  cin >> N;
  
  uint64_t K = sqrti(N), S = 0;
  for (uint64_t k = 1; k <= K; ++k) {
    if (N % k > 0) { continue; }
    
    uint64_t m = (N / k) - 1;
    if (k < m) { S += m; }
  }
  cout << S << endl;
  
  return 0;
}

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

#define FasterIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)

int main(){
    FasterIO;

    int a, b;

    while(cin>>a>>b){
        if(b%a)
            cout<<b-a;
        else
            cout<<b+a;
        cout<<endl;
    }

    return 0;
}


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

using namespace std;

int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    for(int i = 0; i < n; i++){
        cin >> a[i];
    }
    vector<int> result(n);
    for(int i = 0; i < n; i++){
        result[a[i] - 1] = i + 1;
    }
    for(int i = 0; i < n; i++){
        cout << result[i] << " ";
    }
    cout << "" << endl;
}

Measured memory_bytes: 1664
n = int(input())
dp = [float('inf')]*(n+1)
dp[0] = 0
for i in range(n+1):
    power = 1
    #6の階乗
    while power <= i:
        dp[i] = min(dp[i], dp[i-power]+1)
        power *= 6
    #9の階乗
    power = 1
    while power <= n:
        dp[i] = min(dp[i], dp[i-power]+1)
        power *= 9
print(dp[n])


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

using namespace std;

int main()
{
   int n,i,j,cnt=0;
   cin>>n;
   for(i=1;i<10;i++)
   {
     for(j=1;j<10;j++)
     {
       if(i*j==n)
       {
         cnt=1;
         break;
       }
     }
   }
   if(cnt)
     cout<<"Yes\n";
   else
     cout<<"No\n";
   return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

const int N=2e5+5;
int a[N];
int n;

int ind[N];

int main() {
        cin >> n;
        for (int i=n-1; i>=0; i--) {
                if (i%2 == n%2) {
                        ind[(n+i)/2] = i;
                } else {
                        ind[(n-1-i)/2] = i;
                }
        }

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

        for (int i=0; i<n; i++) {
                cout << a[ind[i]] << " ";
        }

        cout << "\n";
}

Measured memory_bytes: 3712
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
ll solve(ll a, ll b) {
	ll ans = 0;
	if (a % 3 && b % 3) {
		ll s[3] = { b / 3 * a,a / 2 + b / 3 * 2 * (a / 2),(a + 1) / 2 + b / 3 * 2 * ((a + 1) / 2) };
		if (b % 3 == 2)s[0] += a;
		sort(s, s + 3);
		ans = min(s[2] - s[0], a);
	}
	return ans;
}
int main() {
	ll h, w;
	cin >> h >> w;
	cout << min(solve(h, w), solve(w, h)) << endl;
	return 0;
}

Measured memory_bytes: 256
import std.stdio, std.string, std.conv;
import std.range, std.algorithm, std.array, std.typecons, std.container;
import std.math, std.numeric, core.bitop;


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

    int ans;

    foreach (ai ; a) {
        while (ai % 2 == 0) {
            ans++;
            ai /= 2;
        }
    }

    writeln(ans);
}













































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: 636
using System;
using System.Collections.Generic;

namespace aoj.volume0 {
	struct PointInt {
		private int _x, _y;
		public PointInt(int x, int y) {
			_x = x;
			_y = y; }
		public int x { get { return _x; } set { _x = value; } }
		public int y { get { return _y; } set { _y = value; } }
	}
	class _0071 {
		public static void Main() {
			var n = int.Parse(Console.ReadLine());
			int[,] map = new int[8,8];
			for (int i = 0; i < n; i++) {
				Console.ReadLine();
				for (int j = 0; j < map.GetLength(0); j++) {
					var str = Console.ReadLine();
					for (int k = 0; k < str.Length; k++)
						map[j, k] = str[k] - '0';
				}
				var s = new Stack<PointInt>();
				s.Push(new PointInt(int.Parse(Console.ReadLine()) - 1, int.Parse(Console.ReadLine()) - 1));

				while (s.Count != 0) {
					var ep = s.Pop();
					map[ep.y, ep.x] = 2;
					for (int x = ep.x, c = 0; x >= 0 && c <= 3; x--, c++)
						if (map[ep.y, x] == 2) continue;
						else if (map[ep.y, x] == 1) { s.Push(new PointInt(x, ep.y)); map[ep.y, x] = 2; }
						else map[ep.y, x] = 2;
					for (int y = ep.y, c = 0; y >= 0 && c <= 3; y--, c++)
						if (map[y, ep.x] == 2) continue;
						else if (map[y, ep.x] == 1) { s.Push(new PointInt(ep.x, y)); map[y, ep.x] = 2; }
						else map[y, ep.x] = 2;
					for (int x = ep.x, c = 0; x < 8 && c <= 3; x++, c++)
						if (map[ep.y, x] == 2) continue;
						else if (map[ep.y, x] == 1) { s.Push(new PointInt(x, ep.y)); map[ep.y, x] = 2; }
						else map[ep.y, x] = 2;
					for (int y = ep.y, c = 0; y < 8 && c <= 3; y++, c++)
						if (map[y, ep.x] == 2) continue;
						else if (map[y, ep.x] == 1) { s.Push(new PointInt(ep.x, y)); map[y, ep.x] = 2; }
						else map[y, ep.x] = 2;
				}

				Console.WriteLine("Data " + (i + 1) + ":");
				for (int j = 0; j < map.GetLength(0); j++, Console.Write("\n"))
					for (int k = 0; k < map.GetLength(1); k++)
						Console.Write((map[j, k] == 2) ? 0 : map[j, k]);
			}
		}
	}
}

Measured memory_bytes: 10008
import java.util.Arrays;
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
		try{
			int min = 0;
			int max = 0;
			Scanner sc = new Scanner(System.in);
			int N = sc.nextInt();
			int[] list = new int[4801];
			Arrays.fill(list, 0);
			for(int i = 0; i < N; i++){
				int temp = sc.nextInt();
				list[temp] += 1;
			}
//			Rating 1-399 : gray
			int count = 0;
			for(int i = 1; i< 400; i++){
				count+=list[i];
			}
			if(count > 0){
				min++;
				max++;
			}
//			Rating 400-799 : brown
			count = 0;
			for(int i = 400; i< 800; i++){
				count+=list[i];
			}
			if(count > 0){
				min++;
				max++;
			}
//			Rating 800-1199 : green
			count = 0;
			for(int i = 800; i< 1200; i++){
				count+=list[i];
			}
			if(count > 0){
				min++;
				max++;
			}
//			Rating 1200-1599 : cyan
			count = 0;
			for(int i = 1200; i< 1600; i++){
				count+=list[i];
			}
			if(count > 0){
				min++;
				max++;
			}
//			Rating 1600-1999 : blue
			count = 0;
			for(int i = 1600; i< 2000; i++){
				count+=list[i];
			}
			if(count > 0){
				min++;
				max++;
			}
//			Rating 2000-2399 : yellow
			count = 0;
			for(int i = 2000; i< 2400; i++){
				count+=list[i];
			}
			if(count > 0){
				min++;
				max++;
			}
//			Rating 2400-2799 : orange
			count = 0;
			for(int i = 2400; i< 2800; i++){
				count+=list[i];
			}
			if(count > 0){
				min++;
				max++;
			}
//			Rating 2800-3199 : red
			count = 0;
			for(int i = 2800; i< 3200; i++){
				count+=list[i];
			}
			if(count > 0){
				min++;
				max++;
			}
//			Rating over 3200
			count = 0;
			for(int i = 3200; i< 4801; i++){
				count+=list[i];
			}
			max = min+count;
			min = (min == 0)? 1 : min;
			System.out.println(min + " " + max);
		}catch(Exception e){
			e.printStackTrace();
		}
	} 
}

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

#define debug(...) fprintf(stderr, __VA_ARGS__)

#ifndef AT_HOME
#define getchar() IO::myGetchar()
#define putchar(x) IO::myPutchar(x)
#endif

namespace IO {
	static const int IN_BUF = 1 << 23, OUT_BUF = 1 << 23;

	inline char myGetchar() {
		static char buf[IN_BUF], *ps = buf, *pt = buf;
		if (ps == pt) {
			ps = buf, pt = buf + fread(buf, 1, IN_BUF, stdin);
		}
		return ps == pt ? EOF : *ps++;
	}

	template<typename T>
	inline bool read(T &x) {
		bool op = 0;
		char ch = getchar();
		x = 0;
		for (; !isdigit(ch) && ch != EOF; ch = getchar()) {
			op ^= (ch == '-');
		}
		if (ch == EOF) {
			return false;
		}
		for (; isdigit(ch); ch = getchar()) {
			x = x * 10 + (ch ^ '0');
		}
		if (op) {
			x = -x;
		}
		return true;
	}

	inline int readStr(char *s) {
		int n = 0;
		char ch = getchar();
		for (; isspace(ch) && ch != EOF; ch = getchar())
			;
		for (; !isspace(ch) && ch != EOF; ch = getchar()) {
			s[n++] = ch;
		}
		s[n] = '\0';
		return n;
	}

	inline void myPutchar(char x) {
		static char pbuf[OUT_BUF], *pp = pbuf;
		struct _flusher {
			~_flusher() {
				fwrite(pbuf, 1, pp - pbuf, stdout);
			}
		};
		static _flusher outputFlusher;
		if (pp == pbuf + OUT_BUF) {
			fwrite(pbuf, 1, OUT_BUF, stdout);
			pp = pbuf;
		}
		*pp++ = x;
	}

	template<typename T>
	inline void print_(T x) {
		if (x == 0) {
			putchar('0');
			return;
		}
		static int num[40];
		if (x < 0) {
			putchar('-');
			x = -x;
		}
		for (*num = 0; x; x /= 10) {
			num[++*num] = x % 10;
		}
		while (*num){
			putchar(num[*num] ^ '0');
			--*num;
		}
	}

	template<typename T>
	inline void print(T x, char ch = '\n') {
		print_(x);
		putchar(ch);
	}

	inline void printStr_(const char *s, int n = -1) {
		if (n == -1) {
			n = strlen(s);
		}
		for (int i = 0; i < n; ++i) {
			putchar(s[i]);
		}
	}

	inline void printStr(const char *s, int n = -1, char ch = '\n') {
		printStr_(s, n);
		putchar(ch);
	}
}
using namespace IO;

const int N = 10000005, P = 998244353;

int n;
int fac[N], inv[N], pw[N];

int qpow(int a, int b) {
	int s = 1;
	for (; b; b >>= 1) {
		if (b & 1) {
			s = 1ll * s * a % P;
		}
		a = 1ll * a * a % P;
	}
	return s;
}

void init(int n) {
	fac[0] = 1;
	for (int i = 1; i <= n; ++i) {
		fac[i] = 1ll * fac[i - 1] * i % P;
	}
	inv[n] = qpow(fac[n], P - 2);
	for (int i = n; i; --i) {
		inv[i - 1] = 1ll * inv[i] * i % P;
	}
	pw[0] = 1;
	for (int i = 1; i <= n; ++i) {
		pw[i] = 2ll * pw[i - 1] % P;
	}
}

int C(int n, int m) {
	if (m < 0 || m > n) {
		return 0;
	}
	return 1ll * fac[n] * inv[m] % P * inv[n - m] % P;
}

int main() {
	read(n);
	init(n);
	int ans = 0;
	for (int i = n / 2 + 1; i <= n; ++i) {
		ans = (ans + 1ll * pw[n - i] * C(n, i)) % P;
	}
	ans = (qpow(3, n) - 2 * ans) % P;
	print((ans + P) % P);
}


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

int main(){
  int n, k;
  cin >> n >> k;
  int nk = n /k;
  ll ans = (ll)nk * nk * nk;
  if(k%2 == 0){
    k /= 2;
    nk = n /k -nk;
    ans += (ll)nk * nk * nk;
  }
  cout << ans << endl;
}

Measured memory_bytes: 3600
#include<iostream>
#include<vector>
#include<algorithm>
#include<tuple>
using namespace std;

int main() {
  int N;
  cin >> N;
  vector<tuple<string,int,int>> vec(N);
  for(int i = 0;i < N;i++) {
    string A;
    int B;
    cin >> A >> B;
    vec.at(i) = make_tuple(A,100 - B,i);
  }
  sort(vec.begin(), vec.end());
  for(int j = 0;j < N;j++) {
    cout << get<2>(vec[j]) + 1 << endl;
  }
}

Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var n, m, x int
	fmt.Scan(&n, &m, &x)
	a := make([]int, m)
	for i := range a {
		fmt.Scan(&a[i])
	}

	// fmt.Println(n, m, x, a)
	left := 0
	right := 0
	for _, v := range a {
		if v <= x {
			left++
		} else {
			right++
		}
	}
	if left <= right {
		fmt.Println(left)
	} else {
		fmt.Println(right)
	}

}


Measured memory_bytes: 512