akhauriyash/Code-Regression huggingface dataset:
import sys
import copy
import math
import bisect
import pprint
import bisect
from functools import reduce
from copy import deepcopy
from collections import deque
from decimal import *


def lcm(x, y):
    return (x * y) // math.gcd(x, y)


if __name__ == '__main__':
    s = int(input())
    count =0

    for i in range(30):
      for j in range(30):
          if s - (4 *i + 7*j) ==0:
              count +=1
          elif s - (4 *i + 7*j) < 0:
               continue

    if count ==0:
        print("No")
    else:
        print("Yes")


Measured memory_bytes: 5784
#include<stdio.h>

int main()
{
  char s[200001], t[200001];
  scanf("%s", s);
  scanf("%s", t);
  
  int i = 0, count = 0;
  while (s[i] != '\0') {
    if (s[i] != t[i]) {
      count++;
    }
    i++;
  }
  
  printf("%d\n", count);
  
  return 0;
}

Measured memory_bytes: 2108
#include<bits/stdc++.h>
#define rep(i,N) for(int i=0;i<(N);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
const int mod = 1e9+7;
typedef long long ll;
typedef pair<ll,int> P;
typedef set<int> S;
vector<int> to(200010,0);
vector<ll> time1[500010];
ll n,k;
void bfs(int i, ll count){
    //cout<<count<<endl;
    if(count>n+n+10) return;
    time1[i].push_back(count);
    bfs(to[i],count+1);
}

int main(){
    cin>>n>>k;
    rep(i,n){
        int x;
        cin>>x;
        x--;
        to[i]=x;
    }
    bfs(0,0);
    for(int i=0;i<n;i++){
        bool ok = 0;
        int now = 1;
        while(1){
            //cout<<i<<"check"<<endl;
            //cout<<time1[i].size()<<endl;
            if(time1[i].size()==0) break;
            if(now+1>time1[i].size()-1){
                //cout<<i<<" is  out"<<endl;
                break;
            }

            if(time1[i][now]-time1[i][now-1]==time1[i][now+1]-time1[i][now]){
                ok = 1;
                break;
            }
            now++;
        }
        //cout<<"end"<<endl;
        if(ok){
            ll loop = time1[i][now]-time1[i][now-1];
            if((k-time1[i][now-1])%loop==0){
                if(k>=time1[i][now-1]){
                    cout<<i+1<<endl;
                    //cout<<"answer"<<endl;
                    return 0;
                }else{
                    rep(i,n){
                        for(auto u : time1[i]){
                            if(u==k){
                                cout<<i+1<<endl;
                                return 0;
                            }
                        }
                    }
                }
            }
        }
    }
                        rep(i,n){
                        for(auto u : time1[i]){
                            if(u==k){
                                cout<<i+1<<endl;
                                return 0;
                            }
                        }
                    }
    return 0;
}

Measured memory_bytes: 35972
import queue

mod = 998244353
INF = 1<<29
lINF = 1<<35

n,m = list(map(int,input().split()))

# indexを部屋番号とし、各部屋から繋がる部屋番号をリストに持つ
graph = [[] for _ in range(n)]
for i in range(m):
    x,y = list(map(int,input().split()))
    graph[x-1].append(y-1)
    graph[y-1].append(x-1)
# 各部屋に設定する番号を記録
v = [-1 for _ in range(n)]
# 部屋１は-1以外にする
v[0] = [0]
# queueを作成し部屋１を追加
q = queue.Queue()
q.put(0)
while not q.empty():
    # queueの先頭（今の部屋番号）を取り出す
    x = q.get()
    # 今いる部屋とつながる部屋を順に探索
    for y in graph[x]:
        if v[y] != (-1):
            continue
        q.put(y)
        v[y] = x
print('Yes')
for i in range(1,n):
    print(v[i]+1)

Measured memory_bytes: 34500
#include<stdio.h>
int main(void)
{
	int a,s,f,r;
	for(;;)
	{
		scanf("%d",&s);
		if(s==0)
			break;
		scanf(" %d",&f);
		r=0;
		for(;s<=f;s++)
		{
			a=s;
			for(;a%2==0;a/=2){}
			for(;a%3==0;a/=3){}
			for(;a%5==0;a/=5){}
			if(a==1)
				r++;
		}
		printf("%d\n",r);
	}
	return 0;
}

Measured memory_bytes: 600
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <iterator>
#include <numeric>
#include <bitset>
#include <cassert>
#include <functional>

using namespace std;
typedef long long int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << (x) << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)

int main() {
	int N;
	cin >> N;
	vector<ll> A(N + 1), B(N + 1, 0);
	rep(i, N + 1) {
		cin >> A[i];
	}
	rep(i, N) {
		cin >> B[i];
	}

	ll cnt = 0;
	rep(i, N) {
		if (A[i] >= B[i]) {
			cnt += B[i];
		}
		else {
			if (A[i] + A[i + 1] >= B[i]) {
				cnt += B[i];
				A[i + 1] -= (B[i] - A[i]);
			}
			else {
				cnt += A[i] + A[i + 1];
				A[i + 1] = 0;
			}
		}
	}
	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 1792
import java.io.*;
import java.util.*;

public class Main{
    public static void main(String[] args)throws Exception{
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int m=sc.nextInt();
        for(int i=0;i<m;i++){
            n-=sc.nextInt();
        }
        if(n>=0){
            System.out.println(n);
        }else{
            System.out.println(-1);
        }
    }
}

Measured memory_bytes: 46192
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
#include <functional>
#include <ctime>
#include <cmath>
#include <limits>
#include <numeric>
#include <type_traits>
#include <iomanip>
#include <float.h>
#include <math.h>
using namespace std;
using ll = long long;


unsigned euclidean_gcd(unsigned a, unsigned b) {
    if (a < b) return euclidean_gcd(b, a);
    unsigned r;
    while ((r = a % b)) {
        a = b;
        b = r;
    }
    return b;
}

class UnionFind {
public:
    vector <ll> par;
    vector <ll> siz;
    UnionFind(ll sz_) : par(sz_), siz(sz_, 1LL) {
        for (ll i = 0; i < sz_; ++i) par[i] = i;
    }
    void init(ll sz_) {
        par.resize(sz_);
        siz.assign(sz_, 1LL);
        for (ll i = 0; i < sz_; ++i) par[i] = i;
    }
    ll root(ll x) {
        while (par[x] != x) {
            x = par[x] = par[par[x]];
        }
        return x;
    }
    bool merge(ll x, ll y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        if (siz[x] < siz[y]) swap(x, y);
        siz[x] += siz[y];
        par[y] = x;
        return true;
    }

    bool issame(ll x, ll y) {
        return root(x) == root(y);
    }

    ll size(ll x) {
        return siz[root(x)];
    }
};

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

long long modinv(long long a, long long mod) {
    return modpow(a, mod - 2, mod);
}

void dfs(vector<vector<ll>> &p, vector<ll> &oyaa,ll &ans,ll now,ll oyan, vector<ll> &ansoyaa,ll nnow,ll node,ll &nownode) {
    if (nownode <= node)return;
    if (oyaa[now] != -1 && nownode > node) {
        oyaa[now] = oyan;
        ans = now;
        nownode = node;
        for (int i = 0; i < oyaa.size(); i++) {
            ansoyaa[i] = oyaa[i];
        }
        oyaa[now] = -1;
        return;
    }
    oyaa[now] = oyan;
    for (int i = 0; i < p[now].size(); i++) {
        dfs(p, oyaa, ans, p[now][i], now,ansoyaa,nnow,node+1,nownode);
    }
    oyaa[now] = -1;
    return;
}

int main() {
    ll n, m;
    cin >> n >> m;
    vector<vector<ll>>z(n);
    for (int i = 0; i < m; i++) {
        ll a, b;
        cin >> a >> b;
        z[a - 1].push_back(b - 1);
    }
    vector<ll> oya(n,-1);
    vector<ll> zoya(n, -1);
    ll ans = -1;
    ll s = 123456789;
    for (int i = 0; i < n; i++) {
        dfs(z, zoya, ans, i, 999999, oya,i,1,s);
    }
    
    if (ans == -1)cout << -1 << endl;
    else {
        vector<ll> zans(1,ans);
        ll bans = ans;
        for (int i = 0; i < 123456789; i++) {
            bans = oya[bans];
            if (bans == ans)break;
            zans.push_back(bans);
        }
        cout << zans.size() << endl;
        for (int i = 0; i < zans.size(); i++) {
            cout << zans[i]+1 << endl;
        }
    }
}

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

class Modular
{
    private const int M = 1000000007;
    private long value;
    public Modular(long value) { this.value = value; }
    public static implicit operator Modular(long a)
    {
        var m = a % M;
        return new Modular((m < 0) ? m + M : m);
    }
    public static Modular operator +(Modular a, Modular b)
    {
        return a.value + b.value;
    }
    public static Modular operator -(Modular a, Modular b)
    {
        return a.value - b.value;
    }
    public static Modular operator *(Modular a, Modular b)
    {
        return a.value * b.value;
    }
    public static Modular Pow(Modular a, int n)
    {
        switch (n)
        {
            case 0:
                return 1;
            case 1:
                return a;
            default:
                var p = Pow(a, n / 2);
                return p * p * Pow(a, n % 2);
        }
    }
    public static Modular operator /(Modular a, Modular b)
    {
        return a * Pow(b, M - 2);
    }
    private static readonly List<int> facs = new List<int> { 1 };
    private static Modular Fac(int n)
    {
        for (int i = facs.Count; i <= n; ++i)
        {
            facs.Add((int)(Math.BigMul(facs.Last(), i) % M));
        }
        return facs[n];
    }
    public static Modular Ncr(int n, int r)
    {
        return (n < r) ? 0
        : (n == r) ? 1
        : Fac(n) / (Fac(r) * Fac(n - r));
    }
    public static explicit operator int(Modular a)
    {
        return (int)a.value;
    }
}

class Program
{
    public static int[] ReadInts()
    {
        return Console.ReadLine().Split().Select(int.Parse).ToArray();
    }

    public static void Main()
    {
        var n = ReadInts();
        Console.WriteLine((int)Modular.Pow(n[0], n[1]));
    }
}


Measured memory_bytes: 20404
#include<iostream>
#include<string>
#include <vector>
#include <algorithm>
using ll = long long;
using namespace std;
int main() {
    int n;
    cin >> n;
    
    ll total = 0;
    for (int i = 1; i <= n; i++) {
        if (i % 3 != 0 && i % 5 != 0)
            total += i;
    }

    cout << total << endl;
    
    return 0;
}


Measured memory_bytes: 3632
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<set>
#include<queue>
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pb push_back
#define rep(i,n) for(ll i=0;i<n;i++)
#define INF 1e9+7
#define LLINF 1e18
using namespace std;
const int MOD = 1e9 +7;




int main(){
    ll N,a[100010],b[100010],c[100010],ans=0;
    cin>>N;
    rep(i,N) cin>>a[i];
    rep(i,N) cin>>b[i];
    rep(i,N) cin>>c[i];
    sort(a,a+N);
    sort(c,c+N);
    rep(i,N){
        ans += (lower_bound(a,a+N,b[i])-a)*(N-(upper_bound(c,c+N,b[i])-c));
    }
    cout <<ans<<endl;
    return 0;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << x << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){return o<<"("<<p.fs<<","<<p.sc<<")";}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){o<<"sz = "<<vc.size()<<endl<<"[";for(const T& v:vc) o<<v<<",";o<<"]";return o;}

int N;
vector<int> p;
vector<vector<int>> G;

vector<int> getcycle(){
	int v = 0;
	rep(i,N) v = p[v];
	vector<int> ret;
	int o = v;
	do{
		ret.pb(v);
		v = p[v];
	}while(v!=o);
	reverse(all(ret));
	return ret;
}

int getval(int v,int p=-1){
	set<int> st;
	for(int u:G[v]) if(u!=p){
		st.insert(getval(u));
	}
	rep(i,N+10){
		if(!st.count(i)) return i;
	}
}

int main(){
	cin>>N;
	p.resize(N);
	G.resize(N);
	rep(i,N){
		cin>>p[i];p[i]--;
		G[p[i]].pb(i);
	}
	vector<int> cycle = getcycle();

	vector<int> vals;
	int K = cycle.size();
	rep(i,K){
		int v = cycle[i];
		int u = cycle[(i+1)%K];
		vals.pb(getval(v,u));
	}
	reverse(all(vals));
	rep(t,2){
		vector<int> x = vals;
		x[0] += t;
		x.pb(x[0]);
		rep1(i,K){
			if(x[i]==x[i-1]) x[i]++;
		}
		if(x[0]==x[K]){
			puts("POSSIBLE");
			return 0;
		}
	}
	puts("IMPOSSIBLE");
	return 0;
}


Measured memory_bytes: 13556
#include <iostream>
#include <stdio.h>
#include <cstring>
#include <math.h>
#include <algorithm>
#include <vector>
#include <string>
#include <stdlib.h>
#include <queue>
#include <stack>
#include <utility>
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define ll long long
#define INF 1000000001
#define mod 1000000007
using namespace std;

int main(){
	int k,s;
	cin>>k>>s;
	ll ans=0;
	rep(i,k+1){
		rep(j,k+1){
			if(s-k<=i+j && i+j<=s){
				ans++;
			}
		}
	}
	cout<<ans<<endl;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define ll long long
#define mod 1000000007
using namespace std;
ll gcd(ll a, ll b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);

}
int main()
{
    ios_base:: sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
    ll n,m;
    cin>>n>>m;
    ll mini=min(n,m);
    ll maxi=max(n,m);
    for(ll i=0;i<maxi;i++)
        cout<<mini;
}


Measured memory_bytes: 256
import java.util.Scanner;

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

    char[] S = scanner.next().toCharArray();
    long res = 0;
    int count = 0;
    for (int i = S.length - 1; i >= 0; i--) {
      if (i > 0 && S[i] == 'C' && S[i - 1] == 'B') {
        count++;
        i--;
      } else if (S[i] == 'A') {
        res += count;
      } else {
        count = 0;
      }
    }
    System.out.println(res);
  }
}


Measured memory_bytes: 27028
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;

template<int64_t MOD> struct Mint {
    int64_t v;
    Mint(int64_t x) { v = x % MOD; if(v < 0)  v += MOD; }

    Mint operator-() { return Mint{-v}; };
    Mint operator+(Mint x) { return Mint(v + x.v); };
    Mint operator-(Mint x) { return Mint(v - x.v); };
    Mint operator*(Mint x) { return Mint(v * x.v); };
    Mint operator/(Mint x) { return Mint(v * pow(x.v, MOD-2).v); };

    Mint& operator+=(Mint x) { return *this = (*this + x); };
    Mint& operator-=(Mint x) { return *this = (*this - x); };
    Mint& operator*=(Mint x) { return *this = (*this * x); };
    Mint& operator/=(Mint x) { return *this = (*this / x); };

    static Mint pow(Mint base, int64_t exp) {
        if(exp == 0)  return Mint(1);
        return pow(base*base, exp/2) * (exp&1 ? base : Mint(1));
    }

    friend ostream& operator<<(ostream& os, Mint x) { return os << x.v; }
};

template<class T> struct Counting {
    void init(int64_t n) {
        _fact.assign(n+1, 1);
        for(int64_t i = 1; i <= n; i++)  _fact[i] = T(i) * _fact[i-1];
    }

    T fact(int64_t n) {
        assert(0 <= n && n < (int)_fact.size());
        return _fact[n];
    }

    T comb(int64_t n, int64_t k) {
        if(n < k)  return 0;
        return fact(n) / (fact(k) * fact(n-k));
    }

    private:
        vector<T> _fact;
};


#define NO() { cout << 0 << endl; return 0; }
const int64_t MOD = 1e9+7;
using mint = Mint<MOD>;
lint n;
string s;

int main() {
    cin >> n >> s;
    vector<char> lr;

    lint cnt = 0;
    mint ans(1);
    for(auto e : s) {
        bool left = (cnt + (e == 'B')) % 2;
        if(left)  cnt++;
        else      ans *= mint(cnt--);
        if(cnt < 0)  NO();
    }
    if(cnt != 0)  NO();

    Counting<mint> c;  c.init(100009);
    ans *= c.fact(n);
    cout << ans << endl;
}

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

using namespace std;

int main(){
  int a2,a3,b1,b2,b3; vector<vector<int>> c(3,vector<int>(3));
  
  for(int i = 0; i < 3; i++){
    for(int j = 0; j < 3; j++){ cin >> c[i][j];}}
  
  b1 = c[0][0]; b2 = c[0][1]; b3 = c[0][2];
  a2 = c[1][0] - b1; a3 = c[2][0] - b1;
  
  if( a2 + b2 == c[1][1] && a2 + b3 == c[1][2] && a3 + b2 == c[2][1] && a3 + b3 == c[2][2]){
    cout << "Yes" << endl;}
  else{cout << "No" << endl;}
  return 0;}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define db(x) cerr << __LINE__ << ": " << #x << " = " << (x) << endl;
#define ll long long
#define ld long double
#define pll pair<ll, ll>
#define MOD 1000000007
#define FOR(i, n) for(ll i = 0; i < n; i++)
using namespace std;
const long long INF = 3*1e18;

int main() {
    ios::sync_with_stdio(0);    
    cin.tie(0);
    ll a, b, n;
    cin >> a >> b >> n;
    if(a % b == 0){
        ll nonmulti = min(n, b-1);
        ld frac = ((ld) (nonmulti) / (ld)(b)) - (nonmulti / b);
        //db(frac);
        ld ans = (ld) a * (ld) frac;
        cout << floor(ans) << "\n";
    } else {
        ll num = min(n, b-1);
        ll ans = ((a * num)/b);
        cout << ans << "\n";
    }
}

Measured memory_bytes: 3744
/*
    nah nah nah
*/
#include <bits/stdc++.h>
#define ll long long
#define fir first
#define sed second
#define i64 int64_t
#define pii pair< int,int >
using namespace std;
ifstream fi("");
ofstream fo("");

int main(){

string s;
cin>>s;
map<string,int> a;
a["MON"]=6;
a["TUE"]=5;
a["WED"]=4;
a["THU"]=3;
a["FRI"]=2;
a["SAT"]=1;
a["SUN"]=7;
cout<<a[s];

}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long ll;

int a[100002] = {};
ll dp[100001] = {};
int l;

ll dfs(int i){
    if(dp[i] != 0)  return dp[i];
    ll ret = l-a[i];
    if(a[i] < a[i-1] && a[i] < a[i+1]){
        ret += max(dfs(i-1), dfs(i+1));
    }else if(a[i] < a[i-1]){
        ret += dfs(i-1);
    }else if(a[i] < a[i+1]){
        ret += dfs(i+1);
    }
    return dp[i] = ret;
}

int main(){
    int n;
    cin >> n >> l;

    for(int i = 1; i <= n; i++) cin >> a[i];

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

    cout << *max_element(dp+1, dp+n+1) << endl;

    return 0;
}


Measured memory_bytes: 6020
import sys
from functools import lru_cache

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N, K, *A = map(int, read().split())

    counter = [0] * 40
    for a in A:
        for i in range(40):
            if a & (1 << i):
                counter[i] += 1

    B = [0] * 40
    for i in range(39):
        if counter[i] < N - counter[i]:
            B[i + 1] = B[i] + (1 << i)
        else:
            B[i + 1] = B[i]

    C = [0] * 40
    for i in range(39, 0, -1):
        if K & (1 << i):
            C[i - 1] = C[i] + (1 << i)
        else:
            C[i - 1] = C[i]

    ans = 0
    for a in A:
        ans += K ^ a

    for i in range(40):
        if K & (1 << i):
            x = B[i] + C[i]
            res = 0
            for a in A:
                res += x ^ a
            if ans < res:
                ans = res

    print(ans)
    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 20748
#include<bits/stdc++.h>
using namespace std;
const int N = 110;
int n,m,bel[N],a[N][N];
bool E[N][N],vis[N];
vector<int> vec[N][N];
bool find(int i)
{
	for(int j = 1;j <= n;j ++)
		if(!vis[j] && E[i][j])
		{
			vis[j] = 1;
			if(!bel[j] || find(bel[j]))
			{
				bel[j] = i;
				return 1;
			}
		}
	return 0;
}
void print()
{
	for(int i = 1;i <= n;i ++)
		for(int j = 1;j <= m;j ++)
			printf("%d%c",a[i][j],j == m?'\n':' ');
}
int main()
{
	scanf("%d%d",&n,&m);
	for(int i = 1;i <= n;i ++)
		for(int j = 1;j <= m;j ++)
		{
			int x;scanf("%d",&x);
			vec[i][(x-1)/m+1].push_back(x);
		}
	for(int i = 1;i <= m;i ++)
	{
		for(int j = 1;j <= n;j ++)
			for(int k = 1;k <= n;k ++)
				E[j][k] = (!vec[j][k].empty());
		memset(bel,0,sizeof(bel));
		for(int j = 1;j <= n;j ++)
			memset(vis,0,sizeof(vis)),find(j);
		for(int j = 1;j <= n;j ++)
		{
			int k = bel[j];
			a[k][i] = vec[k][j].back();
			vec[k][j].pop_back();
		}
	}
	print();
	for(int i = 1;i <= m;i ++)
		for(int j = 1;j <= n;j ++)
			for(int k = j+1;k <= n;k ++)
				if(a[j][i] > a[k][i])
					swap(a[j][i],a[k][i]);
	print();
	return 0;
}

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

#define maxsiz 1000000
#define F first
#define S second
#define fr(i,k,n) for(int i = k ; i < n ; i++ )
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define printvect(a,n) fr(i,0,n) cout << a[i] << " " ;
#define point pair<int,int>
#define pii pair<int,int>
#define pib pair<int,bool>
#define arr vector<int> 
#define vectin(a,n) fr(i,0,n) { cin >> a[i] ; }
typedef unsigned long long int ull;

int main()
{
	string s;
	cin >> s ;
	string total;
	total = s.substr(0,4) + ' ' + s.substr(4,s.length()-1);
	cout << total << endl ;
}

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

public class AtCoderA
{
    static void Main()
    {
        var sc = new Scanner();

        long a = sc.NextLong();
        long b = sc.NextLong();
        long m = sc.NextLong();
        long[] aa = sc.LongArray();
        long[] bb = sc.LongArray();

        long answer = aa.Min() + bb.Min();

        for (int i = 0; i < m; i++)
        {
            long tmpAnswer = aa[sc.NextLong() - 1] + bb[sc.NextLong() - 1] - sc.NextLong();
            answer = Math.Min(answer, tmpAnswer);
        }

        Console.WriteLine(answer);
    }

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            while (_index >= _line.Length)
            {
                _line = Console.ReadLine().Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            _line = Console.ReadLine().Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}


Measured memory_bytes: 60592
#include<algorithm>
#include<iostream>
#include<cstdlib>
#include<cstring>
#include<cstdio>
using namespace std;
char s[1000+10];
int main()
{
	scanf("%s",s+1);
	int sum=0,i=1;
	while(s[i]!='/'){
		sum=sum*10+s[i]-'0';
		i++;
	}
	if(sum<2019){
		printf("Heisei\n");
		return 0;
	}
	if(sum>2019){
		printf("TBD\n");
		return 0;
	}
	i++;sum=0;
	while(s[i]!='/'){
		sum=sum*10+s[i]-'0';
		i++;
	}
	if(sum<4){
		printf("Heisei\n");
		return 0;
	}
	if(sum>4){
		printf("TBD\n");
		return 0;
	}
	i++;sum=0;
	while(i<=strlen(s+1)){
		sum=sum*10+s[i]-'0';
		i++;
	}
	if(sum<=30){
		printf("Heisei\n");
		return 0;
	}
	if(sum>30){
		printf("TBD\n");
		return 0;
	}
	return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String args[]) throws Exception {
        Scanner sc = new Scanner(System.in);
        long n = sc.nextLong();
        long sum = 0L;
        for(long m = 1; m * m <= n; m++) {
        	if(n % m != 0) continue;
        	long k = n / m;
        	if(k - 1 != 0 && n / (k - 1) == n % (k - 1))
        		sum += k - 1;
        	if(m - 1 != 0 && n / (m - 1) == n % (m - 1))
        		sum += m - 1;
        }
        System.out.println(sum);
    }
}


Measured memory_bytes: 22868
#include <stdio.h>
#include <string.h>
using namespace std;
void tosmall(char *c,int size) {
  for (int i = 0; i < size;i++) {
    if (c[i] >= 65 && c[i] <= 90) c[i] += ('a' - 'A');
  }
}
void clear(char *a, int size) {
  for (int i = 0; i < size; i++) a[i] = '\0';
}
int main() {
  char c[20] = {'\0'}, substr[11] = {'\0'},end[12] = "END_OF_TEXT";
  int count = 0,size = 0;
  int b[11]={0};
  scanf("%s", substr);
  while(scanf("%s", c)) {
    size = sizeof(c)/sizeof(c[0]);
    if (!strcmp(c,end)) break;
    tosmall(c, size);
    if (!strcmp(c,substr)) count++;
    clear(c, size);
  }
  printf("%d\n", count);
  return 0;
}



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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
using P = pair<ll, ll>;
using V = vector<ll>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep1(i, n) for(ll i=1;i<=(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
#define ALL(obj) (obj).begin(), (obj).end()
#define MOD 1000000007
#define INF 1000000000

ll y[2005][2005];
ll t[2005][2005];

void solve_abc_d() {
	ll h, w;
	cin >> h >> w;

	vector<string> s(h);
	rep(i, h) {
		cin >> s[i];
	}

	rep(i, h)rep(j, w) {
		if (s[i][j] == '#') {
			y[i][j] = 0;
			t[i][j] = 0;
		}
		else {
			if (j != 0) {
				y[i][j] = y[i][j - 1] + 1;
			}
			else {
				y[i][j] = 1;
			}

			if (i != 0) {
				t[i][j] = t[i - 1][j] + 1;
			}
			else {
				t[i][j] = 1;
			}
		}
	}

	rrep(i, h - 1, 0)rrep(j, w - 1, 0) {
		if (j != w - 1) {
			if (y[i][j] != 0 && y[i][j + 1] != 0) {
				y[i][j] = y[i][j + 1];
			}
		}

		if (i != h - 1) {
			if (t[i][j] != 0 && t[i + 1][j] != 0) {
				t[i][j] = t[i + 1][j];
			}
		}
	}

	ll ans = 0;
	rep(i, h)rep(j, w) {
		ans = max(ans, y[i][j] + t[i][j] - 1);
	}

	cout << ans << "\n";
}

int main(void) {
	cin.tie(0);
	ios::sync_with_stdio(false);
	//cout << fixed;
	//cout << setprecision(7);

	solve_abc_d();

	return 0;
}


Measured memory_bytes: 67200
#[macro_use]
mod input {

use std;
use std::io;

const SPLIT_DELIMITER: char = ' ';

#[macro_export]
#[allow(unused_macros)]
macro_rules! input {
    ( $($x:expr ),*) => {
        {
            let temp_str = input_line_str();
            let mut split_result_iter = temp_str.split_whitespace();
                $(
                let buf_split_result = split_result_iter.next();
                let buf_split_result = buf_split_result.unwrap();
                    ($x) = buf_split_result.parse().unwrap();
                )*
        }
    };
}

#[allow(dead_code)]
pub fn input_line_str() -> String {
    let mut s = String::new();
    io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

#[allow(dead_code)]
pub fn p<T>(t: T)
where
    T: std::fmt::Display,
{
    println!("{}", t);
}

#[allow(dead_code)]
pub fn input_vector2d<T>(line: usize) -> Vec<Vec<T>>
where
    T: std::str::FromStr,
{
    let mut v: Vec<Vec<T>> = Vec::new();

    for _ in 0..line {
        let vec_line = input_vector();
        v.push(vec_line);
    }
    v
}

#[allow(dead_code)]
pub fn input_vector<T>() -> Vec<T>
where
    T: std::str::FromStr,
{
    let mut v: Vec<T> = Vec::new();

    let s = input_line_str();
    let split_result = s.split(SPLIT_DELIMITER);
    for z in split_result {
        let buf = match z.parse() {
            Ok(r) => r,
            Err(_) => panic!("Parse Error"),
        };
        v.push(buf);
    }
    v
}

#[allow(dead_code)]
pub fn str2vec(s: &str) -> Vec<char> {
    let mut v: Vec<char> = Vec::new();
    for c in s.chars() {
        v.push(c);
    }
    v
}

}

use input::*;
use std::cmp;

fn next_permutation(v: &mut Vec<usize>) {
    let mut i = 1;
    let mut j = 0;
    let mut jj = (99999999, 0);
    while i < v.len() {
        if v[i] < v[i - 1] {
            break;
        }
        i += 1;
    }
    if i == v.len() {
        return;
    }
    while j < i {
        if v[i] < v[j] {
            if jj.0 > v[j] {
                jj = (v[j], j);
            }
        }
        j += 1;
    }
    v.swap(i, jj.1);
    v[0..i].reverse();
}

fn get_permutation(n: usize) -> usize {
    if n == 1 {
        return 1;
    }
    get_permutation(n - 1) * n
}

fn main() {
    let (n, m, r): (usize, usize, usize);
    input!(n, m, r);
    let mut graph = vec![vec![999999999999; n]; n];
    let mut rv = input_vector::<usize>();
    let mut sum = 99999999999;
    for z in &mut rv {
        *z -= 1;
    }
    for _ in 0..m {
        let (a, b, c): (usize, usize, usize);
        input!(a, b, c);
        graph[a - 1][b - 1] = c;
        graph[b - 1][a - 1] = c;
    }

    //ワーシャルフロイド法
    for z in 0..n {
        for x in 0..n {
            for y in 0..n {
                graph[x][y] = cmp::min(graph[x][y], graph[x][z] + graph[z][y]);
            }
        }
    }
    rv.sort();
    rv.reverse();
    for _ in 0..get_permutation(r) {
        let mut sum_buf = 0;
        for z in 0..r - 1 {
            sum_buf += graph[rv[z]][rv[z + 1]];
        }
        sum = cmp::min(sum_buf, sum);
        next_permutation(&mut rv);
    }
    p(sum);
}

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

#define int         long long
#define pb          push_back
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define x           first
#define y           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define hell        1000000007
#define rep(i,a,b)  for(int i=a;i<b;i++)
using namespace std;
int n,M,val[100005],ans[100005];
vi a[100005];
vi val2[100005];
vi ans2[100005];
void dfs(int node,int par){
    val[node]=1;
    for(auto i:a[node]){
        if(i==par) continue;
        dfs(i,node);
        val[node]=val[node]*(val[i]+1)%M;
    }
    vi pre,suf;
    for(auto i:a[node]){
        if(i==par) pre.pb(1);
        else pre.pb(val[i]+1);
    }
    suf=pre;
    rep(i,1,sz(pre)) pre[i]=pre[i-1]*pre[i]%M;
    for(int j=sz(suf)-2;j>=0;j--){
        suf[j]=suf[j]*suf[j+1]%M;
    }
    rep(i,0,sz(a[node])){
        if(a[node][i]==par) val2[node].pb(-1);
        else val2[node].pb((i-1>=0?pre[i-1]:1)*(i+1<sz(suf)?suf[i+1]:1)%M);
    }
}
void dfs2(int node,int par){
    rep(i,0,sz(a[node])){
        int cur=a[node][i];
        if(cur==par)continue;
        ans[cur]=(ans2[node][i]+1)*val[cur]%M;
        // ans[i]=(ans[node]*val[i]+val[i])%hell;
        ans2[cur].resize(sz(a[cur]));
        rep(j,0,sz(a[cur])){
            if(a[cur][j]==node) continue;
            ans2[cur][j]=(ans2[node][i]+1)*val2[cur][j]%M;
        }
        dfs2(cur,node);
    }
}
void solve(){
    cin>>n>>M;
    rep(i,0,n-1){
        int x,y;
        cin>>x>>y;
        a[x].pb(y);
        a[y].pb(x);
    }
    dfs(1,0);
    ans[1]=val[1];
    ans2[1].resize(sz(a[1]));
    rep(i,0,sz(a[1])){
        ans2[1][i]=val2[1][i]%M;
    }
    dfs2(1,0);
    rep(i,1,n+1) cout<<ans[i]<<endl;
}

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t=1;
    // cin>>t;
    while(t--){
        solve();
    }
    return 0;
}

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

bool cmp(int x,int y){
  return x>y;
}

int a[107];
int main(){
  int N,sum=0;
  scanf("%d",&N);
  for(int i=0;i<N;i++){
    scanf("%d",a+i);
  }
  sort(a,a+N,cmp);
  a[N]=0;
  for(int i=0;i<N;i+=2){
    sum+=a[i]-a[i+1];
  }
  printf("%d\n",sum);
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
typedef long long ll;
const int MOD = 1000000007;
const int INF = 1010000000;
const double EPS = 1e-10;
using namespace std;
//cout << fixed << setprecision(0)
int main() { 
  int a,b,c,d;cin>>a>>b>>c>>d;
  string ans = "No";
  if(abs(a-c)<=d||(abs(a-b)<=d&&abs(b-c)<=d))ans = "Yes";
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <iomanip>
#include <algorithm>
#include <cmath>
#define REP(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using arr = vector<ll>;
constexpr ll MOD = 1000000007;
constexpr ll INF = 1LL << 60;
constexpr int MAX = 110000;
long fac[MAX], inv[MAX], finv[MAX];
void init()
{
    fac[0] = inv[0] = finv[0] = 1;
    fac[1] = inv[1] = finv[1] = 1;
    for (int i = 2; i < MAX; ++i)
    {
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
long C(int n, int k)
{
    if (n < 0 || k < 0 || n < k)
        return 0;
    return (fac[n] * finv[n - k] % MOD) * finv[k] % MOD;
}

ll n, b;

int main()
{
  cin >> n >> b;
  ll r = n - b;
  init();
  REP(i, b)
    cout << C(b - 1, i) * C(r - i + i + 1, i + 1) % MOD << '\n';
  return 0;
}

Measured memory_bytes: 2816
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int l,r,v;
  cin>>l>>r>>v;
  int count=0;
  for(int i=l;i<=r;i++)
  {
    if(i%v==0)
    {
      count++;
    }
  }
  cout<<count<<endl;
}

Measured memory_bytes: 3588
#include <stdio.h>
  
#define MAX 250

int main(){
  
  int H[MAX];
  int n;
  int i;
  
  scanf("%d",&n);

  for( i = 1 ; i <= n ; i++ )
    scanf("%d",&H[i]);
  
  for( i = 1 ; i <= n ; i++ ) {
    
    printf("node %d: key = %d, ",i,H[i]);

    if( i/2 > 0 ) printf("parent key = %d, ",H[i/2]);

    if( i*2 <= n ) printf("left key = %d, ",H[i*2]);

    if( i*2+1 <= n ) printf("right key = %d, ",H[i*2+1]);

    printf("\n");
  }
  return 0;
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
#include <unistd.h>
#include <random>

using namespace std;
typedef long long int LL;
typedef long long int LLint;
typedef pair<int,int> intpair;
typedef pair<bool,bool> boolpair;
typedef pair<string,string> strpair;
typedef pair<LL,LL> LLpair;
typedef pair<double,double> doublepair;
typedef pair<float,float> floatpair;
typedef vector<int> intvector;
typedef vector<bool> boolvector;
typedef vector<string> strvector;
typedef vector<LL> LLvector;
typedef vector<double> doublevector;
typedef vector<float> floatvector;
#define wait(sec) usleep((sec) * 1000000)
#define ED return 0;
#define TEST cout << "OK" << endl;
#define UP(a,b) ((a+(b-1))/b)
#define SORT(vec) sort(vec.begin(),vec.end());
#define DOUBLECHANGE(count) cout << setprecision(count);
#define REV(vec) reverse(vec.begin(),vec.end());
#define ipow(x,y) LL(pow(x,y))
#define INF 999999999
const long long mod = 1000000007;

int main(){
    //    random_device rnd;
    //    mt19937 mt(rnd());
    cin.tie(0);
    ios::sync_with_stdio(false);
    long long int N;
    cin >> N;
    long long int sqrtN = sqrt(N);
    for(long long int i = sqrtN;i > 0;i--){
        if(N % i == 0){
            cout << i + N/i - 2 << endl;
            return 0;
        }
    }
}


Measured memory_bytes: 384
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <map>

using namespace std;
using llong = long long;
const int MOD=1000000007;


int main(int argc, char**argv){
    int n;
    cin >> n;
    vector<int> h(n);
    for (int i = 0; i < n; i++){
        cin >> h[i];
    }

    int ans = 1;
    for (int i = 1; i < n; i++){
        int j;
        for (j = i - 1; j >= 0; j--){
            if (h[i] < h[j]){
               break;
            }
        }
        if (j < 0){
            ans++;
        }
    }
    cout << ans << endl;

    return 0;
}













Measured memory_bytes: 256
// BROWNIE TK

#include <bits/stdc++.h>

typedef long long int lli;
typedef unsigned long long int ulli;
typedef long double ldb;

#define pb push_back
#define popb pop_back
#define si size()
#define be begin()
#define en end()
#define all(v) v.be, v.en
#define le length()
#define mp make_pair
#define mt make_tuple
#define F first
#define S second

#define forz(i, n) for (int i = 0; i < n; i++)
#define bui(i, m, n) for (int i = m; i < n; i++)
#define rforz(i, n) for (int i = n - 1; i >= 0; i--)
#define mui(i, m, n) for (int i = n - 1; i >= m; i--)
#define deci(n) fixed << setprecision(n)
#define high(n) __builtin_popcount(n)
#define parity(n) __builtin_parity(n)
#define ctz(n) __builtin_ctz(n)
#define lb lower_bound
#define ub upper_bound
#define er equal_range
#define maxe *max_element
#define mine *min_element
#define mod 1000000007
#define mod2 998244353
#define kira ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)

#define endl "\n"
#define p0(a) cout << a << " "
#define p1(a) cout << a << endl
#define p2(a, b) cout << a << " " << b << endl
#define p3(a, b, c) cout << a << " " << b << " " << c << endl
#define p4(a, b, c, d) cout << a << " " << b << " " << c << " " << d << endl

using namespace std;

/*STD fucntions*/
lli power(lli x,lli y,lli p)
{
	lli res=1;
	x=x%p;
	while(y>0)
	{
		if(y&1)
			res=(res*x)%p;
		//y must be even now
		y=y>>1; //y=y/2
		x=(x*x)%p;
	}
	return res;
}
lli gcd(lli a, lli b)
{
  if (b == 0)
    return a;
  return gcd(b, a % b);
}
lli lcm(lli a, lli b)
{ return a * b / gcd(a, b); }
lli max(lli a, lli b) 
{
  if (a > b)
    return a;
  return b;
}
lli min(lli a, lli b) 
{
  if (a < b)
    return a;
  return b;
}
lli bins(lli arr[], lli l, lli r, lli x)
{
  if (r >= l) {
    lli mid = l + (r - l) / 2;
    if (arr[mid] == x)
      return mid;
    if (arr[mid] > x)
      return bins(arr, l, mid - 1, x);
    return bins(arr, mid + 1, r, x);
  }
  return -1;
}
lli modi(lli a,lli m)
{
// fermat little thm where m is prime
return power(a,m-2,m);
}
/*CODE BEGINS*/
int main()
{
 kira;
 lli n,k;
 cin>>n>>k;
 lli h[n];
 forz(i,n)cin>>h[i];
 vector<lli>dp(n,mod);
 dp[0]=0;
 dp[1]=abs(h[1]-h[0]);
 for(int i=2;i<n;i++)
 {
   for(int j=1;j<=min(k,i);j++)
   {
     dp[i]=min(dp[i],dp[i-j]+abs(h[i]-h[i-j]));
   }
 }
 //forz(i,n)p0(dp[i]);
 p0(dp[n-1]);
 return 0;
}

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

int main(){
  int n;
  cin>>n;
  vector<int>h(n);
  for(int i=0;i<n;i++){
    cin>>h[i];
  }
  reverse(h.begin(),h.end());
  int ans=0;
  int sa=0;
  for(int i=0;i<n-1;i++){
    if(h[i]<=h[i+1]){
      sa++;
    }
    else{
      sa=0;
    }
    ans=max(ans,sa);
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;

int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};

bool pairCompare(const P& firstElof, const P& secondElof){
    return firstElof.second > secondElof.second;
}

int main(){	
	cin.tie(0);
   	ios::sync_with_stdio(false);
	
	vector< P > v;
	int x, y;
	int res = 0;
	REP(i, 5){
		cin >> x;
		y = x%10;
		if(y == 0) res += x;
		else v.push_back( make_pair(x, y) );
	}
    sort(v.begin(), v.end(), pairCompare);
	int size = (int)v.size();
    REP(i, size) {
		if (i != size-1) res += v[i].first + (10 - v[i].second);
        else res += v[i].first;
    }

	cout << res << '\n';

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
    using namespace std;
     
    int main() {
    int A, B, N, X, Y, Z;
      cin >> A >> B;
      N=0;
      for (int i = 0; i < 9; i++) {
        X = 0;
        X += 10001*(i+1);
        for (int j = 0; j < 10; j++) {
          Y = 0;
          Y += 1010*j;
          for (int k = 0; k < 10; k++){
            Z=0;
            Z += X + Y + 100*k;
            if(Z>=A && Z<=B)
                N++;
          }
        }
      }
     cout << N << endl;
    }

Measured memory_bytes: 256
#include<stdio.h>
main()
{
	int n;
	scanf("%d",&n);
	int a[n],c=1;
	scanf("%d",&a[0]);
	int min=a[0];
	for(int i=1;i<n;i++)
	{
		scanf("%d",&a[i]);
		if(a[i]<min)
		{
			min=a[i];
			c++;
		}
	}
	printf("%d",c);
}

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

#define rep(i,n) for(int i=0;i<(n);i++)

using namespace std;

int main(){
	int h,w,n; scanf("%d%d%d",&h,&w,&n);
	if(h<w) swap(h,w);
	printf("%d\n",(n+h-1)/h);
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int ac = 0;
        int wa = 0;
        int tle = 0;
        int re = 0;
        for(int i=0; i<n; i++) {
            String s = in.next();
            if(s.equals("AC")) {
                ac++;
            }
            if(s.equals("WA")) {
                wa++;
            }
            if(s.equals("TLE")) {
                tle++;
            }
            if(s.equals("RE")) {
                re++;
            }
        }
        System.out.println("AC x " + ac);
        System.out.println("WA x " + wa);
        System.out.println("TLE x " + tle);
        System.out.println("RE x " + re);
    }
}


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

void trace(int A[], int N) {
	for( int i = 0; i < N; i++ ) {
		if(i) cout << " ";
		cout << A[i];
	}
	cout << endl;
}

int selectionSort(int A[], int N) {
	int sw = 0, minj;
	for( int i = 0; i < N; i++ ) {
		minj = i;
		for( int j = i; j < N; j++ ) {
			if(A[j] < A[minj])
				minj = j;
		}
		if(minj != i) {
			swap(A[i], A[minj]);
			sw++;
		}
	}
	return sw;
}

int main()
{
	int A[100], N, sw;
	cin >> N;
	for( int i = 0; i < N; i++ ) cin >> A[i];

	sw = selectionSort(A, N);
	
	trace(A, N);
	cout << sw << endl;

	return 0;
}


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

int f(int i){
  int count = 0;
  while(i > 0){
    count += i%10;
    i /= 10;
  }
  return count;
}

int main(){
  int n;
  cin >> n;
  if(n % f(n) == 0) puts("Yes");
  else puts("No");
  return 0;
}


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

int N, M;
vector<vector<int> > V;
int dp[100001];

int walk(int i){
    /* 子供いない時 */
    if(V[i].size() == 0) return 0;
    /* すでに更新されている時 */
    if(dp[i] != 0) return dp[i];
    int now = 0;
    for(int j = 0; j < V[i].size(); j++){
        now = max(now, walk(V[i][j]) + 1);
    }
    
    return dp[i] = now;
}

int main(void){
    // Your code here!
    cin >> N >> M;
    V.resize(N);
    
    int x, y;
    for(int i = 0; i < M; i++){
        cin >> x >> y;
        x--;
        y--;
        V[x].push_back(y);
    }
    
    for(int i = 0; i < N; i++) dp[i] = 0;
    int ans = 0;
    for(int i = 0; i < N; i++){
        ans = max(ans, walk(i));
    }
    cout << ans << endl;
}


Measured memory_bytes: 8192
#include <iostream>

using namespace std;

int main(){
  int A,B,C;
  cin>>A>>B>>C;
  bool res=false;
  for(int i=1;i<B;i++){
    int tmp=A*i%B;
    if(tmp==C){
      res=true;
      break;
    }
  }
  if(res)
    cout<<"YES"<<endl;
  else
    cout<<"NO"<<endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
  string N;
  cin >> N;
  char s = N[N.length()-1];
  if(s == '3'){
    cout << "bon" << endl;
    return 0;
  }
  if(s == '2' || s == '4' || s == '5' || s == '7' || s == '9'){
    cout << "hon" << endl;
    return 0;
  }
  else{
    cout << "pon" << endl;
  }
  return 0;
}

Measured memory_bytes: 3632
n=int(input())
p=list(map(int,input().split()))
a=[1]*(n+1)
b=[1]*(n+1)
a[0],b[n]=0,0
for i in range(n):
  a[p[i]]=i+1
  b[p[i]-1]=i+1
for i in range(n):
  a[i+1]+=a[i]
  b[n-1-i]+=b[n-i]
print(*a[1:])
print(*b[:n])

Measured memory_bytes: 76212
#include <bits/stdc++.h>
#define INF 2e9
using namespace std;
typedef long long llong;
typedef long double ldouble;
 
using Graph = vector<vector<int>>;
 
int main(){
  llong H, W;
  cin >> H >> W;
  if(H==1 || W==1){
    cout << 1 << endl;
    return 0;
  }
  if(H%2==0){
    cout << H/2 * W << endl;
  }else{
    if(W%2==0){
      cout << H * W/2 << endl;
    }else{
      cout << H * (W-1)/2 + (H+1)/2 << endl;
    }
  }
}

Measured memory_bytes: 256
from collections import deque
from heapq import heapify,heappop,heappush,heappushpop
from copy import copy,deepcopy
from itertools import product,permutations,combinations,combinations_with_replacement
from collections import defaultdict,Counter
from bisect import bisect_left,bisect_right
# from math import gcd,ceil,floor,factorial
# from fractions import gcd
from functools import reduce
from pprint import pprint

INF = float("inf")

def myinput():
    return map(int,input().split())

def mylistinput(n):
    return [ list(myinput()) for _ in range(n) ]

def mycol(data,col):
    return [ row[col] for row in data ]

def mysort(data,col,reverse_flag):
    data.sort(key=lambda x:x[col],reverse=reverse_flag)
    return data

def mymax(data):
    M = -1*float("inf")
    for i in range(len(data)):
        m = max(data[i])
        M = max(M,m)
    return M

def mymin(data):
    m = float("inf")
    for i in range(len(data)):
        M = min(data[i])
        m = min(m,M)
    return m

def mycount(ls,x):
    # lsはソート済みであること
    l = bisect_left(ls,x)
    r = bisect_right(ls,x)
    return (r-l)

def myoutput(ls,space=True):
    if space:
        if len(ls)==0:
            print(" ")
        elif type(ls[0])==str:
            print(" ".join(ls))
        elif type(ls[0])==int:
            print(" ".join(map(str,ls)))
        else:
            print("Output Error")
    else:
        if len(ls)==0:
            print("")
        elif type(ls[0])==str:
            print("".join(ls))
        elif type(ls[0])==int:
            print("".join(map(str,ls)))
        else:
            print("Output Error")

x,a,b = myinput()

if b<=a:
    print("delicious")
    exit()
elif b<=(a+x):
    print("safe")
    exit()
else:
    print("dangerous")
    exit()

Measured memory_bytes: 38256