akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define RNG(i,from,to) for(int i=(from); i<(int)(to); i++)
#define gcd(i,j) __gcd((i), (j))
typedef long long ll;
typedef pair<int, int> pii;
template<typename S, typename T> string to_string(pair<S, T> p) { return "("+to_string(p.first)+","+to_string(p.second)+")"; }
template<typename T> string to_string(T p[2]) { return "["+to_string(p[0])+","+to_string(p[1])+"]"; }
template<typename T> void println(T e){ cout << to_string(e) << endl; }
template<typename T> void println(const vector<T>& v){ cout << "[";for(const auto& e : v){ cout << to_string(e) << ","; }cout << "]";cout << endl; }
template<typename T> void println(const vector<vector<T>>& vv){ for(const auto& v : vv){ println(v); } }
template<typename Iter> void println(Iter first, Iter last){ for(auto it=first; it != last; it++){ cout << *it << " "; }; cout << endl; }
const ll DVSR = 1e9+7;
const ll LG = 1e15;

const ll UPB = 230001;
int main(int argc, char const *argv[])
{
  ll D, G; cin >> D >> G;
  G /= 100;
  vector<vector<ll>> DP(D, vector<ll>(UPB));
  vector<pair<ll,ll>> INL(D);
  REP(i, D) {
    REP(j, UPB) {
      DP[i][j] = LG;
    }
    DP[i][0] = 0;
    cin >> INL[i].first >> INL[i].second;
    INL[i].second /= 100;
  }
  // println(G);
  // println(INL);
  REP(i, D) {
    ll score = i+1;
    if (i == 0) {
      RNG(k, 1, INL[i].first) {
        DP[i][score*k] = k;
      }
      DP[i][score*INL[i].first + INL[i].second] = INL[i].first;
    } else {
      RNG(k, 1, INL[i].first) {
        RNG(j, 0, UPB-20000) {
          DP[i][j + score*k] = min(DP[i-1][j]+k, DP[i-1][j + score*k]);
        }
      }
      RNG(j, 0, UPB-20000) {
        DP[i][j + score*INL[i].first + INL[i].second] = min(DP[i-1][j]+INL[i].first, DP[i-1][j + score*INL[i].first + INL[i].second]);
      }
    }
  }
  ll res = LG;
  RNG(i, G, UPB) {
    res = min(res, DP[D-1][i]);
  }
  println(res);
  return 0;
}


Measured memory_bytes: 20096
def solve(L, R):
    if L == 0:
        return 0

    if R - L + 1 >= 2019:
        return 0

    ans = float("inf")
    for i in range(L, R):
        for j in range(i + 1, R + 1):
            ans = min(ans, (i * j) % 2019)
    return ans


L, R = map(int, input().split())
print(solve(L, R))


Measured memory_bytes: 3060
import math
import fractions
import bisect
import collections
import itertools
import heapq
import string
import sys
import copy
from collections import deque
sys.setrecursionlimit(10**7)
MOD = 10**9+7
def gcd(a,b):return fractions.gcd(a,b) #最大公約数
def lcm(a,b):return (a*b) // fractions.gcd(a,b) #最小公倍数
def iin(): return int(input()) #整数読み込み
def ifn(): return float(input()) #浮動小数点読み込み
def isn(): return input().split() #文字列読み込み
def imn(): return map(int, input().split()) #整数map取得
def fmn(): return map(float, input().split()) #浮動小数点map取得
def iln(): return list(map(int, input().split())) #整数リスト取得
def iln_s(): return sorted(iln()) # 昇順の整数リスト取得
def iln_r(): return sorted(iln(), reverse=True) # 降順の整数リスト取得
def fln(): return list(map(float, input().split())) # 浮動小数点リスト取得
def join(l, s=''): return s.join(l) #リストを文字列に変換
def perm(l, n): return itertools.permutations(l, n) # 順列取得
def perm_count(n, r): return math.factorial(n) // math.factorial(n-r) # 順列の総数
def comb(l, n): return itertools.combinations(l, n) # 組み合わせ取得
def comb_count(n, r): return math.factorial(n) // (math.factorial(n-r) * math.factorial(r)) #組み合わせの総数
def two_distance(a, b, c, d): return ((c-a)**2 + (d-b)**2)**.5 # 2点間の距離
def m_add(a,b): return (a+b) % MOD

def sieves_of_e(n):
    is_prime = [True] * (n+1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5)+1):
        if not is_prime[i]: continue
        for j in range(i * 2, n+1, i): is_prime[j] = False
    return is_prime

N,M = imn()
G = [[] for _ in range(N)]
dp = [-1 for _ in range(N)]

for i in range(M):
    xy = iln()
    G[xy[0]-1].append(xy[1]-1)

def dfs(v):
    if dp[v] != -1: return dp[v]
    ans = 0
    for n in G[v]:
        ans = max(ans, dfs(n)+1)
    dp[v] = ans
    return dp[v]

ans = 0
for i in range(N):
    ans = max(ans, dfs(i))
print(ans)

Measured memory_bytes: 67312
#include <iostream>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cassert>
#include <ctime>
#include <sstream>
#include <algorithm>
#include <functional>
#include <numeric>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>

using namespace std;

#define f first
#define s second
#define pb push_back
#define mp make_pair
#define ll long long
#define pii pair < int, int >
#define pll pair < long long, long long>
#define ull unsigned long long
#define y1 stupid_cmath
#define left stupid_left
#define right stupid_right
#define vi vector <int>
#define sz(a) (int)a.size()
#define forit(it, s) for(__typeof(s.begin()) it = s.begin(); it != s.end(); it++)
#define all(a) a.begin(), a.end()
#define sqr(x) ((x) * (x))

const int inf = (int)1e9;
const int mod = inf + 7;
const double eps = 1e-9;
const double pi = acos(-1.0);

ll read_long() {
    ll ans = 0;
    char c;
    bool started = false;
    bool is_negative = false;
    while (true) {
        c = getchar();
        if ((c < '0' || c > '9') && c != '-' && !started) continue;
        if ((c < '0' || c > '9') && c != '-' && started) break;
        if (started) {
            ans = ans * 10;
        }
        started = true;
        if (c == '-') is_negative = true;
        else ans += c - '0';
    }
    if (is_negative) ans *= -1;
    return ans;
}

// n / a[1] * a[1] / a[2] * a[2] / a[3] * a[3] ... 

int k, a[100100];

ll get(ll n) {
    for (int i = 0; i < k; i++) {
        n /= a[i];
        n *= a[i];
    }
    return n;
}

int main(){

    scanf("%d", &k);
    for (int i = 0; i < k; i++) {
        scanf("%d", a + i);
    }

    ll l = 0, r = (ll)1e18;
    ll best = -1;

    while (l <= r) {
        ll mid = (l + r) >> 1;
        ll cur = get(mid);
        if (cur < 2) {
            l = mid + 1;
        } else if (cur > 2) {
            r = mid - 1;
        } else {
            best = mid;
            l = mid + 1;
        }
    }

    if (best == -1) {
        printf("-1\n");
        return 0;
    }

    ll mn = -1, mx = best;
    l = 0; r = (ll)1e18;

    while (l <= r) {
        ll mid = (l + r) >> 1;
        ll cur = get(mid);
        if (cur < 2) {
            l = mid + 1;
        } else if (cur > 2) {
            r = mid - 1;
        } else {
            mn = mid;
            r = mid - 1;
        }
    }

    printf("%lld %lld\n", mn, mx);

    return 0;
}


Measured memory_bytes: 640
def solve(a):
    m, diff, ans = 10 ** 10, 0, 0
    for i in range(len(a)):
        if a[i] < m:
            m = a[i]
        elif a[i] - m > diff:
            diff = a[i] - m
            ans = 1
        elif a[i] - m == diff:
            ans += 1

    return ans


def solve2(a):
    if len(a) <= 3:
        return 1

    base = a[-1]
    m = 10 ** 10
    diff_list = []
    for i in range(len(a) - 2, -1, -1):
        if a[i] >= base:
            diff_list.append(base - m)
            base = a[i]
            m = 10 ** 10
        m = min(m, a[i])
    else:
        diff_list.append(base - m)

    return diff_list.count(max(diff_list))


def main():
    n, t = map(int, input().split())
    a = list(map(int, input().split()))

    print(solve2(a))


if __name__ == '__main__':
    main()


Measured memory_bytes: 15060
#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 per(i,n) for(int i=int(n)-1;i>=0;i--)
#define per1(i,n) for(int i=int(n);i>0;i--)
#define foreach(i,n) for(auto &&i:n)
#define all(x) (x).begin(),(x).end()
#define SORT(x) sort(all(x))
#define GSORT(x) sort(all(x), greater<int>())
#define REV(x) reverse(all(x))
#define MAX(x) *max_element(all(x))
#define MIN(x) *min_element(all(x))
#define LOWitr(x, n) lower_bound(all(x), n)
#define UPRitr(x, n) upper_bound(all(x), n)
#define cii(x) int x;cin >> x
#define cill(x) LL x;cin >> x
#define cis(x) string x;cin >> x
#define co(x) cout << x << endl
#define dump(x)  cout << #x << " = " << (x) << endl
#define truecheck assert
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define fastcin() cin.tie(0);ios::sync_with_stdio(false)
using namespace std;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef long long int64;
template<class T,class U>bool chmax(T &a, const U &b) { if (a<b) { a=b; return true; } return false; }
template<class T,class U>bool chmin(T &a, const U &b) { if (b<a) { a=b; return true; } return false; }
const int INF = 1e9, MOD = 1e9 + 7;
const LL LLINF = 1e16;

int main() {
    fastcin();
    cout << fixed << setprecision(10);
    cii(a);
    cii(b);
    auto ans = (a <= 8 && b <= 8)
            ?"Yay!"
            :":(";
    co(ans);
    return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(10**6)


def dfs(s):
    for t in g[s]:
        if dist[t] > -1:
            if (dist[s] + 1 - dist[t]) % 2 == 1:
                print(-1)
                exit()
            continue
        dist[t] = dist[s] + 1
        dfs(t)


n = int(input())
s = [list(input()) for _ in range(n)]
g = [[] for _ in range(n)]
mat = [[10**9] * n for _ in range(n)]
for i in range(n):
    mat[i][i] = 0
    for j in range(i + 1, n):
        if s[i][j] == '1':
            g[i].append(j)
            g[j].append(i)
            mat[i][j] = mat[j][i] = 1
dist = [-1] * n
dist[0] = 0
dfs(0)

for k in range(n):
    for i in range(n):
        for j in range(n):
            mat[i][j] = min(mat[i][j], mat[i][k] + mat[k][j])
ans = 0
for i in range(n):
    for j in range(n):
        ans = max(ans, mat[i][j])
print(ans + 1)


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

using namespace std;

#define loop(i, n) for(int i = 0;i < int(n);i++)
#define rloop(i, n) for(int i = int(n);i >= 0;i--)
#define range(i, a, b) for(int i = int(a);i <= int(b);i++)
#define SZ(c) int(c.size())
#define ALL(c) c.begin(), c.end()
#define RALL(c) c.rbegin(), c.rend()
#define PI acos(-1)
#define pb push_back
#define mp make_pair
#define fr first
#define sc second
#define sfi1(v) scanf("%d",&v)
#define sfi2(v1, v2) scanf("%d %d",&v1,&v2)
#define sfi3(v1, v2, v3) scanf("%d %d %d",&v1,&v2,&v3)
#define sfll1(v) scanf("%I64d",&v);
#define sfll2(v1, v2) scanf("%I64d %I64d",&v1,&v2)
#define sfll3(v1, v2, v3) scanf("%I64d %I64d %I64d",&v1,&v2,&v3)
#define endl '\n'

typedef vector<int> vi;
typedef vector<pair<int, int> > vii;
typedef long long ll;
typedef pair<int, int> pii;

const int N = 1e5 + 5;
int a[N][3];
set<pii> s[3][3];
int n[3];
ll ans = 0;

void insert(int idx, int cur) {
    ans += a[idx][cur];
    loop(other, 3) {
        if (other == cur)continue;
        s[cur][other].insert({-a[idx][cur] + a[idx][other], idx});
    }
}

void erase(int idx, int cur) {
    ans -= a[idx][cur];
    loop(other, 3) {
        if (other == cur)continue;
        s[cur][other].erase({-a[idx][cur] + a[idx][other], idx});
    }
}

int main() {

#ifndef ONLINE_JUDGE
//    freopen("in.in", "r", stdin);
    //freopen("out.in", "w", stdout);
#endif
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    loop(i, 3)cin >> n[i];
    loop(i, n[0] + n[1] + n[2]) {
        loop(j, 3)cin >> a[i][j];
        if (i < n[0])insert(i, 0);
        else if (i < n[0] + n[1])insert(i, 1);
        else insert(i, 2);
    }

    bool done = true;
    while (done) {
        done = false;
        loop(i, 3) {
            loop(j, 3) {
                if (i == j)continue;
                while (prev(end(s[i][j]))->first + prev(end(s[j][i]))->first > 0) {
                    done = true;
                    int ai = prev(end(s[i][j]))->second;
                    int aj = prev(end(s[j][i]))->second;
                    erase(ai, i);
                    erase(aj, j);
                    insert(ai, j);
                    insert(aj, i);
                }
            }
        }


        loop(i, 3) {
            loop(j, 3) {
                if (i == j)continue;
                loop(k, 3) {
                    if (k == i || k == j)continue;
                    while (prev(end(s[i][j]))->first + prev(end(s[j][k]))->first + prev(end(s[k][i]))->first > 0) {
                        done = true;
                        int ai = prev(end(s[i][j]))->second;
                        int aj = prev(end(s[j][k]))->second;
                        int ak = prev(end(s[k][i]))->second;
                        erase(ai, i);
                        erase(aj, j);
                        erase(ak, k);
                        insert(ai, j);
                        insert(aj, k);
                        insert(ak, i);
                    }
                }
            }
        }
    }

    cout << ans << endl;


    return 0;
}


Measured memory_bytes: 14204
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <string>
#include <bitset>
#include <cstring>
#include <map>
#include <math.h>
#include <queue>
#include <set>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i,n) for (int i = 0; i < n; i++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define fi first
#define se second
#define pb push_back
#define mp make_pair
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; }
const int INF = 1<<30;
const ll LINF = 1LL<<58;
const int mod = 1000000007;


int main(){
    int a, b, c;
    cin >> a >> b >> c;
    cout << max(0, c-(a-b)) << endl;
}


Measured memory_bytes: 256
import sys

sys.setrecursionlimit(1000000)

import bisect
import math
import collections
import heapq


def solve(X, Y):
    for k in range(X + 1):
        t = X - k
        if Y == (k * 4) + (t * 2):
            return "Yes"
    return "No"


if __name__ == "__main__":
    X, Y = tuple(map(int, input().split(" ")))
    print(solve(X, Y))


Measured memory_bytes: 9480
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
	int a[3],sum=0;
	cin>>a[0]>>a[1]>>a[2];
	sort(a,a+3);
	if(a[0]==a[1]&&a[1]==a[2])
		sum=0;
	else 
	{
		if(a[0]==a[1])
			sum=a[2]-a[1];
		else					//a,b,c全不相同 
		{
			sum+=(a[2]-a[1]);
			a[0]+=sum;
			int z=(a[2]-a[0]+1)/2;
			if(a[0]+2*z==a[2])
				sum+=z;
			else
				sum+=z+1;
		}	
	}
	cout<<sum<<endl;
}

Measured memory_bytes: 256
int main(){
int i,o,x,y,z;
for(z=0;1;z++){
scanf("%d %d",&x,&y);
if(x==0 && y==0){
break;
}

for(i=0;i<x;i++){
  for(o=0;o<y;o++){
  printf("#");
   }
printf("\n");
}
printf("\n");


}
return 0;
}

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

using namespace std;

int main()
{
  long long n, a, b;
  cin >> n >> a >> b;
  long long ans = n / (a + b) * a;
  if(n%(a+b) <= a){
    ans += n % (a+b);
  }else{
    ans += a;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <set>
#include <queue>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstring>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
#include <numeric>
#include <functional>

using namespace std;
#define ALL(x)              (x).begin(),(x).end()
typedef long long           ll;
#define REP(i, n)           for (ll i = 0 ; i < (ll)n ; ++i)
#define REPN(i, m, n)       for (ll i = m ; i < (ll)n ; ++i)
#define INF                 (ll)2e9
#define MOD                 (1000 * 1000 * 1000 + 7)
#define Ceil(x, n)          (((((x))+((n)-1))/n))
#define CeilN(x, n)         (((((x))+((n)-1))/n)*n)
#define FloorN(x, n)        ((x)-(x)%(n))
#define IsOdd(x)            (((x)&0x01UL) == 0x01UL)
#define IsEven(x)           (!IsOdd((x)))
#define M_PI                3.14159265358979323846
typedef pair<ll, ll>	    P;

/*-----------------------------------------------------------------------------
　処理
 -----------------------------------------------------------------------------*/
int main()
{
	ll N;
	cin >> N;
	vector<ll> A(N - 1);
	REP(i, N - 1) {
		cin >> A[i];
		A[i]--;
	}

	vector<ll> numCnt(N, 0);
	REP(i, N - 1) {
		numCnt[A[i]]++;
	}

	REP(i, N) {
		cout << numCnt[i] << endl;
	}
	return 0;
}


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

#define ALL(v) v.begin(), v.end()
#define V vector
#define P pair
typedef long double ld;
typedef long long ll;
const int MOD =  1000000007;
const int IINF = INT_MAX;
const ll INF = 1LL << 60;


int main() {
    int a, b; cin >> a >> b;
    if(a & 1 && b & 1) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}


Measured memory_bytes: 3596
import java.util.Scanner;
class Main {
	private static int[] S = {0,1,2,3,4,5,6,7,8,9,10,11,12,13};
	private static int[] H = {0,1,2,3,4,5,6,7,8,9,10,11,12,13};
	private static int[] C = {0,1,2,3,4,5,6,7,8,9,10,11,12,13};
	private static int[] D = {0,1,2,3,4,5,6,7,8,9,10,11,12,13};
	public void kami() {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		for(int i = 1; i <= n; i++){
			String j = sc.next();
			if(j.equals("S")){
				int J = sc.nextInt();
				switch(J){
				case 1:
					S[J] = S[J] - J;
				case 2:
					S[J] = S[J] - J;
				case 3:
					S[J] = S[J] - J;
				case 4:
					S[J] = S[J] - J;
				case 5:
					S[J] = S[J] - J;
				case 6:
					S[J] = S[J] - J;
				case 7:
					S[J] = S[J] - J;
				case 8:
					S[J] = S[J] - J;
				case 9:
					S[J] = S[J] - J;
				case 10:
					S[J] = S[J] - J;
				case 11:
					S[J] = S[J] - J;
				case 12:
					S[J] = S[J] - J;
				case 13:
					S[J] = S[J] - J;
				}
			}else if(j.equals("H")){
				int J = sc.nextInt();
				switch(J){
				case 1:
					H[J] = H[J] - J;
				case 2:
					H[J] = H[J] - J;
				case 3:
					H[J] = H[J] - J;
				case 4:
					H[J] = H[J] - J;
				case 5:
					H[J] = H[J] - J;
				case 6:
					H[J] = H[J] - J;
				case 7:
					H[J] = H[J] - J;
				case 8:
					H[J] = H[J] - J;
				case 9:
					H[J] = H[J] - J;
				case 10:
					H[J] = H[J] - J;
				case 11:
					H[J] = H[J] - J;
				case 12:
					H[J] = H[J] - J;
				case 13:
					H[J] = H[J] - J;
				}
			}else if(j.equals("C")){
				int J = sc.nextInt();
				switch(J){
				case 1:
					C[J] = C[J] - J;
				case 2:
					C[J] = C[J] - J;
				case 3:
					C[J] = C[J] - J;
				case 4:
					C[J] = C[J] - J;
				case 5:
					C[J] = C[J] - J;
				case 6:
					C[J] = C[J] - J;
				case 7:
					C[J] = C[J] - J;
				case 8:
					C[J] = C[J] - J;
				case 9:
					C[J] = C[J] - J;
				case 10:
					C[J] = C[J] - J;
				case 11:
					C[J] = C[J] - J;
				case 12:
					C[J] = C[J] - J;
				case 13:
					C[J] = C[J] - J;
				}
			}else if(j.equals("D")){
				int J = sc.nextInt();
				switch(J){
				case 1:
					D[J] = D[J] - J;
				case 2:
					D[J] = D[J] - J;
				case 3:
					D[J] = D[J] - J;
				case 4:
					D[J] = D[J] - J;
				case 5:
					D[J] = D[J] - J;
				case 6:
					D[J] = D[J] - J;
				case 7:
					D[J] = D[J] - J;
				case 8:
					D[J] = D[J] - J;
				case 9:
					D[J] = D[J] - J;
				case 10:
					D[J] = D[J] - J;
				case 11:
					D[J] = D[J] - J;
				case 12:
					D[J] = D[J] - J;
				case 13:
					D[J] = D[J] - J;
				}
			}
		}
		for(int x = 1; x <= 13; x++){
			if(S[x] > 0){
				System.out.println("S " + S[x]);
			}
		}
		for(int x = 1; x <= 13; x++){
			if(H[x] > 0){
				System.out.println("H " + H[x]);
			}
		}
		for(int x = 1; x <= 13; x++){
			if(C[x] > 0){
				System.out.println("C " + C[x]);
			}
		}
		for(int x = 1; x <= 13; x++){
			if(D[x] > 0){
				System.out.println("D " + D[x]);
			}
		}
	}

	public static void main(String[] args) {

		new Main().kami();
	}

}

Measured memory_bytes: 18064
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
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(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int a, b;
	cin >> a >> b;
	--a; --b;
	vector<vector<char>> grid(100, vector<char>(100, '.'));
	rep(i,50){
		if(i%2 == 1) continue;
		rep(j,100){
			if(j%2 == 1) continue;
			if(b > 0){
				grid[i][j] = '#';
				--b;
			}
		}
	}
	for(int i = 50; i < 100; ++i){
		rep(j,100){
			grid[i][j] = '#';
			if(i%2 == 0) continue;
			if(j%2 == 1) continue;
			if(a > 0){
				grid[i][j] = '.';
				--a;
			}
		}
	}
	cout << 100 << " " << 100 << endl;
	rep(i,100){
		rep(j,100) cout << grid[i][j];
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
#define REP(i,a,b) for(int i=(a);i<(b);i++)
#define RREP(i,a,b) for(int i=(a);i>=(b);i--)
#define pq priority_queue
#define P pair<int,int>
#define P2 pair<int,P>
#define P3 pair<int,P2>
typedef long long ll; typedef long double ld;
using namespace std;
const int INF=1e9, MOD=1e9+7, around[]={0,1,1,-1,-1,0,-1,1,0,0};
const ll LINF=1e18;
const ld PI=abs(acos(-1));
int n,q,a,b,c;

struct UnionFind{
	vector<int> data;
	
	UnionFind(int sz){
		data.assign(sz, -1);
	}
	
	bool unite(int x,int y){
		x = find(x); y = find(y);
		if(x == y) return false;
		if(data[x] > data[y]) swap(x, y);
		data[x] += data[y];
		data[y] = x;
		return true;
	}
	
	int find(int k){
		if(data[k] < 0) return k;
		return data[k] = find(data[k]);
	}
	
	bool same(int x,int y){
		x = find(x); y = find(y);
		if(x == y) return true;
		else return false;
	}
	
	int size(int k){
		return -data[find(k)];
	}
};

int main(){
	cin >> n >> q;
	UnionFind data(n);
	
	REP(i,0,q){
		cin >> a >> b >> c;
		if(a==0) data.unite(b, c);
		else cout << data.same(b, c) << endl;
	}	
	return 0;
}



Measured memory_bytes: 3156
#include<stdio.h>
int main(){
	int n,m,z1[100][100],z2[100],sum[100]={0};
	int a,b,c,d,e,f,g;
	scanf("%d %d",&n,&m);
	for(a=0;a<n;a++){
		for(b=0;b<m;b++){
			scanf("%d",&z1[a][b]);
		}
	}
	for(a=0;a<m;a++){
		scanf("%d",&z2[a]);
	}
	for(a=0;a<n;a++){
		for(b=0;b<m;b++){
			sum[a]+=z1[a][b]*z2[b];
		}
	}
	for(a=0;a<n;a++){
		printf("%d\n",sum[a]);
	}
	return 0;
}

Measured memory_bytes: 640
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define mt make_tuple
#define pqueue priority_queue
const int inf=1e9+7;
const ll mod=1e9+7;
const ll mod1=998244353;
const ll big=1e18;
const double PI=2*asin(1);

int main() {
  string S;
  cin>>S;
  for(int i=0;i<S.size();++i) {
    if(S[i]==',') cout<<" ";
    else cout<<S[i];
  }
  cout<<endl;
}


Measured memory_bytes: 3600
#include <stdio.h>
#include <string.h>
#include <ctype.h>
  
  
  
int main(int argc, const char * argv[]) {
    // insert code here...
      
    while (1) {
        char yama[201];
        scanf("%s",yama);
        if(yama[0] == '-'){
            break;
        }
  
        int m;
        scanf("%d",&m);
          
        int i;
        for(i=0;i<m;i++){
            int h;
            scanf("%d",&h);
              
            char head[201] = {},tail[201] = {};
            strncpy(tail, yama, h);
            strcpy(head, yama+h);
              
            char *sum = strcat(head, tail);
            strcpy(yama, sum);
              
        }
          
        printf("%s\n",yama);
          
    }
  
      
    return 0;
}


Measured memory_bytes: 2036
def get_int
  gets.chop.to_i
end

def get_ints
  gets.chop.split.map(&:to_i)
end

def get_double
  gets.chop.to_f
end

def get_str
  gets.chop
end

def get_strs
  gets.chop.split
end

def main
  n, k, q = get_ints
  a_arr = []
  points = [k - q] * n
  0.upto(q - 1) do |i|
    a = get_int
    a -= 1
    points[a] += 1
  end
  0.upto(n - 1) do |i|
    point = points[i]
    if point > 0
      puts "Yes"
    else
      puts "No"
    end
  end
end

if __FILE__ == $0
  main
end


Measured memory_bytes: 4988
import java.util.*;
import static java.lang.Math.*;
import java.math.BigInteger;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		// 入力
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int k = sc.nextInt();

		// 計算
		int result = 0;
		int max = max(a, max(b, c));
		result = a + b + c + (int)(max*(pow(2, k) -1));
		

		// 出力
		System.out.println(result);
	}
}


Measured memory_bytes: 23124
import bisect
N=int(input())
ue=list(map(int,input().split()))
naka=list(map(int,input().split()))
sita=list(map(int,input().split()))
sita.sort(),naka.sort(),ue.sort()
count2=[0]*N
count1=[0]*N
for i in range(N):
    m = naka[i]
    k=naka[i]
    small=bisect.bisect_left(ue,k)
    count1[i]=small
    big = bisect.bisect_right(sita, m)
    count2[i]=N-big
ans=0
for i in range(N):
    ans+=count1[i]*count2[i]
print(ans)


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

A = [0] * N
B = [0] * N

for i in range(N):
    A[i], B[i] = map(int, input().split())

A.sort()
B.sort()

if N % 2 == 0:
    n1 = N // 2 - 1
    n2 = N // 2
    ans = B[n1] - A[n1] + B[n2] - A[n2] + 1
    print(ans)

else:
    n = N // 2
    ans = B[n] - A[n] + 1
    print(ans)

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

int main() {
  int n,a,res=32;
  cin >> n;
  for(int i=0;i<n;i++){
    cin >> a;
    for(int j=0;j<res;j++){
      if(a%2!=0){
        res=j;
        break;
      }
      a/=2;
    }
  }
  cout << res << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<math.h>
#include<map>
#include<algorithm>
#include<set>
#include <stdexcept>
#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;
typedef long long ll;
int ceil(int a,int b){// a以上でｂの倍数の最小値を出力//
    return (a+b-1)/b*b;
}
int stoii(string s){ //stoi関数の代用//
    return atoi(s.c_str());
}
int main(void){
  int x,a,b;
  cin>>x>>a>>b;
  cout<<(x-a)%b<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#define A 100

int sw=0;

void selectionsort(int *a, int n){
  int i,j,tmp,minj;

  for(i=0;i<n-1;i++){
    minj=i;
    for(j=i;j<n;j++){
      if(a[j]<a[minj]) minj=j;
    }
    tmp=a[i];
    a[i]=a[minj];
    a[minj]=tmp;
    if(i!=minj) sw++;
  }
}

void print(int *a, int n){
  int i;

  for(i=0;i<n-1;i++) printf("%d ",a[i]);
  printf("%d\n%d\n",a[i],sw);
}

int main(){
  int i,n,a[A];

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

  selectionsort(a,n);
  print(a,n);

  return 0;
}


Measured memory_bytes: 2100
#include <algorithm>
#include <cmath>
#include <map>
#include <iostream>
#include <string>
#include <vector>

using namespace std;

void A_Serval_vs_Monster(void) {

	int H, A;
	cin >> H >> A;

	cout << ((H % A == 0) ? H / A : int(H / A) + 1);
	return;
}

void B_Common_Raccoon_vs_Monster(void) {

	int H, N;
	cin >> H >> N;

	int sum = 0;
	int A;
	for (int loop = 0; loop < N; loop++) {
		cin >> A;
		sum += A;
	}

	cout << ((sum >= H) ? "Yes" : "No") << flush;
	return;
}

void C_Fennec_vs_Monster(void) {

	int N, K;
	cin >> N >> K;

	vector<int> H(N);
	for (int& it : H) cin >> it;
	sort(H.begin(), H.end());

	long long sum = 0;
	for (int loop = 0; loop < N - K; loop++) sum += H[loop];

	cout << sum << flush;
	return;
}

void D_Caracal_vs_Monster(void) {

	long H;
	cin >> H;

	for (int loop = 0; loop < 50; loop++) {

		if (H == 1) {
			cout << long(std::pow(2, loop + 1) - 1);
			return;
		}

		H = long(H / 2);
	}
	return;
}

int main(void) {

	//A_Serval_vs_Monster();
	//B_Common_Raccoon_vs_Monster();
	//C_Fennec_vs_Monster();
	D_Caracal_vs_Monster();
	return 0;
}


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

using namespace std;
long long x[10000010], y[10000010];
#define rep(i, n) for (int i = 0; i < (n); i++)
#define lep(j, n) for (int j = 0; j < (n); j++)
#define reps(i, n) for (int i = 1; i < (n); i++)
#define leps(i, n) for (int j = 1; j < (n); j++)
#define all(x) (x).begin(), (x).end()
#define pii pair<int, int>
#define int long long
#define gsort(x, n) sort((x), (x) + (n), greater<int>());
#define setout(n, x) setw(n) << setfill(x)
#define Fixed fixed << setprecision(10);
const long long mod = 1e9 + 7;

signed main()
{

   cin.tie(0);
   ios::sync_with_stdio(false);

   int a, b;
   cin >> a >> b;

   if (a % 500 == 0)
      cout << "Yes" << '\n';
   else if ((a % 500) <= b)
      cout << "Yes" << '\n';
   else
      cout << "No" << '\n';
}

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

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

	vector<vector<vector<ll>>> dp(N+1, vector<vector<ll>>(2, vector<ll>(3, -1LL<<60)));

	// dp[i][j][k]: i番目, i要素目を取らないならj = 1, k: これまで連続で選ばなかった箇所の個数
	dp[0][1][0] = 0;

	for(int i=1;i<=N;i++) {
		for(int j=0;j<2;j++) {
			for(int k=0;k<3;k++) {
				// 取らない
				if(k + j < 3) dp[i][1][k+j] = max(dp[i][1][k+j], dp[i-1][j][k]);
				// 取る
				if(j == 1) dp[i][0][k] = max(dp[i][0][k], dp[i-1][j][k] + A[i-1]);
			}
		}
	}
	if(N % 2 == 0) cout << max(dp[N][1][0], dp[N][0][1]) << endl;
	else cout << max(dp[N][0][2], dp[N][1][1]) << endl;
}

Measured memory_bytes: 34396
#include <float.h>
#include <inttypes.h>
#include <limits.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <math.h>
#ifdef __cplusplus
#include <bits/stdc++.h>
#endif

#define getchar getchar_unlocked
#define putchar putchar_unlocked
int32_t nextint(void){ char c=getchar_unlocked(); while(c!='-'&&(c<'0'||'9'<c)) c=getchar_unlocked(); bool s=false; if(c=='-'){s=true;c=getchar_unlocked();} uint32_t x=0; while('0'<=c && c<='9'){ x=x*10+c-'0'; c=getchar_unlocked(); } return s?-x:x; }
int64_t nextlong(void){ char c=getchar_unlocked(); while(c!='-'&&(c<'0'||'9'<c)) c=getchar_unlocked(); int s=0; if(c=='-'){s=1;c=getchar_unlocked();} uint64_t x=0; while('0'<=c && c<='9'){ x=x*10+c-'0'; c=getchar_unlocked(); } return s?-x:x; }
uint32_t nextstr(char *s){ char c=getchar_unlocked(); while(c==' '||c=='\n') c=getchar_unlocked(); uint32_t len=0; while(c!=' '&&c!='\n'){ *s++=c; len++; c=getchar_unlocked(); } *s='\0'; return len; }

int main(void){
	int l=nextint();
	int k=1;
	int n=0;
	while(k*2<=l){k*=2; n++;}
	int m=n*2;
	for(int i=n-1; i>=0; i--){
		if(l&(1<<i)) m++;
	}
	printf("%d %d\n", n+1, m);
	for(int i=0; i<n; i++){
		printf("%d %d %d\n", i+1, i+2, 0);
		printf("%d %d %d\n", i+1, i+2, 1<<i);
	}
	int b=1<<n;
	for(int i=n-1; i>=0; i--){
		if(l&(1<<i)){
			printf("%d %d %d\n", i+1, n+1, b);
			b+=1<<i;
		}
	}
}


Measured memory_bytes: 1580
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO.Pipes;
using System.Linq;
using System.Reflection.PortableExecutable;
using System.Runtime.InteropServices.ComTypes;
using System.Runtime.InteropServices.WindowsRuntime;
using System.Security.Cryptography.X509Certificates;

namespace cswork
{
    class Program
    {
        class Scanner
        {
            string[] s;
            int i;

            char[] cs = new char[] { ' ' };

            public Scanner()
            {
                s = new string[0];
                i = 0;
            }

            public string next()
            {
                if (i < s.Length) return s[i++];
                string st = Console.ReadLine();
                while (st == "") st = Console.ReadLine();

                s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
                i = 0;
                return next();
            }

            public int nextInt()
            {
                return int.Parse(next());
            }

            public long nextLong()
            {
                return long.Parse(next());
            }

            public double nextDouble()
            {
                return double.Parse(next());
            }
        }

        public Program() { }

        static void Main(string[] args)
        {
            new Program().Omame();
        }

        Scanner cin;
        const int MAXIN = 1024;
        bool[] used = new bool[MAXIN];
        int[] perm = new int[MAXIN];

        List<int[]> permList = new List<int[]>();

        public void Permutation(int pos, int n, int length)
        {
            if (pos == n)
            {
                permList.Add((int[])perm.Clone());
            }

            for (int i = 0; i < n; i++)
            {
                if (!used[i])
                {
                    perm[pos] = i;
                    used[i] = true;
                    Permutation(pos + 1, n, length);
                    used[i] = false;
                }
            }
        }

        void Omame()
        {
            cin = new Scanner();
            int N = cin.nextInt();
            int K = cin.nextInt();

            long ans = 0;
            long[] start = new long[N + 1];
            long[] end = new long[N + 1];
            end[0] = N;
            for (int i = 1; i < N + 1; i++)
            {
                start[i] = start[i - 1] + i;
                end[i] = end[i - 1] + N - i;
            }

            for (int i = K; i <= N + 1; i++)
            {
                long s = start[i - 1];
                long e = end[i - 1];
                ans = (ans + e - s + 1) % (1000000000 + 7);
            }

            Console.WriteLine(ans);
        }

    }
}


Measured memory_bytes: 30960
#include<bits/stdc++.h>
using namespace std;
int main () {
  int N;
  cin >> N;
  vector<int>L(N);
  for (int i = 0; i < N; i ++) cin >> L[i];
  sort(L.begin(), L.end());
  int ans = 0;
  for (int i = 0; i < N - 2; i ++) {
    for (int j = i + 1; j < N - 1; j ++) {
      for (int k = j + 1; k < N; k ++) {
        if (L[i] != L[j] && L[i] != L[k] && L[j] != L[k]) {
          if (L[k] < L[i] + L[j]) {
            ans ++;
          }
        }
      }
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
template<class T> ostream& operator<<(ostream &os, vector<T> V) { os << "[ "; for(auto v : V) os << v << " "; return os << "]"; }
template<class T> ostream& operator<<(ostream &os, set<T> S){ os << "{ "; for(auto s:S) os<<s<<" ";return os<<"}"; }
template<class L, class R> ostream& operator<<(ostream &os, pair<L,R> P) { return os << "(" << P.first << "," << P.second << ")";}
template<class L, class R> ostream& operator<<(ostream &os, map<L,R> M) { os << "{ "; for(auto m:M) os<<"("<<m.first<<":"<<m.second<<") "; return os<<"}"; }
#ifdef LMAO
    #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>
    void __f(const char* name, Arg1&& arg1){cerr << name << " : " << arg1 << endl;}
    template <typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){ const char* comma = strchr(names + 1, ','); cerr.write(names, comma - names) << " : " << arg1<<" | "; __f(comma+1, args...); }
#else
    #define trace(...) 42
#endif
#define ff first
#define ss second
#define pb push_back
#define eb emplace_back
#define endl "\n"
#define tcase int tt; cin>>tt; while(tt--)
#define tcase2 int tt; cin>>tt; for(int qq=1;qq<=tt;qq++)
#define all(x) x.begin(), x.end()
typedef long long int ll;
typedef  unsigned long long int ull;
typedef long double ld;
const int MAX = 1000010;
const int MOD2 = 998244353;
const int MOD = 1000000007; 
const int INF = 1e8;    
const ll LLINF = 0x3f3f3f3f3f3f3f3f;
const ld EPS = 1e-7;
#define forn(i, n) for(int i = 0; i < (int)n; i++)
#define forne(i, a, b) for(int i = a; i <= b; i++)   
/*****************start************/

int main()
{
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);cout<<fixed<<setprecision(25);cerr<<fixed<<setprecision(10);
    auto start = std::chrono::high_resolution_clock::now();
    int a;
    cin>>a;
    cout<<(a+a*a+a*a*a)<<endl;
    auto stop = std::chrono::high_resolution_clock::now(); 
    auto duration = std::chrono::duration_cast<std::chrono::nanoseconds>(stop - start); 
    // cerr << "Time taken : " << ((long double)duration.count())/((long double) 1e9) <<"s "<< endl;     
    return 0;
}


Measured memory_bytes: 3636
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <iomanip>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstring>
#include <climits>

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> V;
typedef map<int, int> M;

constexpr ll INF = 1e18;
constexpr ll MOD = 1e9 + 7;
constexpr double PI = 3.14159265358979323846;
constexpr int di[] = {0, 0, 1, -1};
constexpr int dj[] = {1, -1, 0, 0};

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

    int n, k;
    string s;
    cin >> n >> s >> k;

    REP(i, n)
    {
        if (s[k - 1] != s[i])
            s[i] = '*';
    }

    cout << s << endl;

    return 0;
}

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

constexpr long long INF = 1LL<<60;

long long subtask(int N, long long A) {
    vector<long long> dp(N+1, INF);
    dp[1] = 0;
    for (int i = 1; i <= N/2; i++) {
        for (int j = 2; i * j <= N; j++) {
            dp[i * j] = min(dp[i * j], dp[i] + j + A);
        }
    }
    long long ans = INF;
    for (int i = 1; i <= N; i++)
        ans = min(ans, dp[i] + (N - 1) / i + 1);
    return ans;
}

int main() {
    long long N, A; cin >> N >> A;
    long long ans = N;
    for (long long i = 2; i * i <= N; i++) {
        ans = min(ans, A + i + 1 + (N - 1) / i);
    }
    for (int t = 2; 1LL << t <= N; t++) {
        int k = 2 * t, s = 2, a = t, b = 0;
        long long d = 1LL << t;
        while (d <= N) {
            ans = min(ans, A * t + k + 1 + (N - 1) / d);
            k++;
            d = d / s * (s + 1);
            if (a == 1) { s++; a = t; b = 0; }
            else { a--; b++; }
        }
    }
    cout << ans << endl;
    if (N <= 1e7)
        cerr << N << " " << A << " " << (ans == subtask(N, A) ? "OK" : "WA") << endl;
}


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

const int MAX = 3000000;
const int MOD = 1000000007;

ll fac[MAX], finv[MAX], inv[MAX];

void init_ncr() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[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 long ncr(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main(int argc, char *argv[]) {
  ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);

  ll x,y;
  cin>>x>>y;
  if(x>y)swap(x,y);
  ll mod = pow(10,9) + 7;
  init_ncr();

  if( (x+y) % 3 != 0 ) {
    cout<<0<<endl;
    return 0;
  }
  if(x==y) {
    cout<<ncr(2 * x / 3, x / 3)<<endl;
  }else if ( x*2==y )  {
    cout<<1<<endl;
  }else{
    ll dif =(y-x);
    ll n = (x - dif) / 3 * 2 + dif;
    ll r = (x - dif) / 3 + dif;
    cout<<ncr(n, r)<<endl;
  }

  return 0;
}


Measured memory_bytes: 70528
#include <bits/stdc++.h>
using namespace std;
 
bool SecondCompare(const pair<int,int> &a,const pair<int,int> &b)
{
       return a.second<b.second;
}
 
bool SecondCompareDes(const pair<int,int> &a,const pair<int,int> &b)
{
       return a.second>b.second;
}
 
long long a[2010], z, w, lmax, lmin, rmax, rmin, ans, mem;
long long s[2010];
int n;

int main(){
    cin >> n >> z >> w;
    for(int i = 0; i < n; i++){
        cin >> s[i];
    }

    if(n==1)    cout << abs(s[0]-w) << endl;
    else{
        if(abs(s[n-1]-w) > abs(s[n-2]-s[n-1]))  ans = abs(s[n-1]-w);
        else{
            ans = abs(s[n-2]-s[n-1]);
        }
        cout << ans << endl;
    }

}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <iostream>
#include <sstream>
#include <cmath>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>

using namespace std;

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

static const double eps = 10e-8;

struct IC{
	int fare;
	int dist;
};

int main(){
	int dpt,arv;

	struct IC ic[] = {
		300,6,
		500,13,
		600,18,
		700,23,
		1350,43,
		1650,58,

		350,7,
		450,12,
		600,17,
		1150,37,
		1500,52,

		250,5,
		400,10,
		1000,30,
		1350,45,

		250,5,
		850,25,
		1300,40,

		600,20,
		1150,35,

		500,15,
	};

	while(~scanf("%d",&dpt)){
		if(dpt==0) break;
		
		int hDpt,mDpt;
		scanf("%d %d",&hDpt,&mDpt);
		scanf("%d",&arv);
		int hArv,mArv;
		scanf("%d %d",&hArv,&mArv);

		int DptT = hDpt*60+mDpt;
		int ArvT = hArv*60+mArv;


		int idx=0;
		int fare=0,dist=0;
		for(int i=1;i<=7;i++){
			for(int j=i+1;j<=7;j++){
				if(i==dpt && j==arv){
					fare = ic[idx].fare;
					dist = ic[idx].dist;
					goto found;
				}
				idx++;
			}
		}

found:;

		if(((17*60+30 <= DptT && DptT <= 19*60+30)
			|| (17*60+30 <= ArvT && ArvT <= 19*60+30))
			&& dist <= 40){
				fare /=2;
		}

		int tmp = fare / 50;
		if(fare % 50) fare = 50 * (tmp+1);

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

Measured memory_bytes: 0
#include<iostream>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
#include<limits>
#include<sstream> 
#include<unordered_map>      

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef int itn;
typedef vector<int> vi;
typedef vector<ll> vl;

const int inf = numeric_limits<int>::max() >> 2;
const ll linf = numeric_limits<ll>::max() >> 2;
const ull ulinf = numeric_limits<ull>::max() >> 2;
const double pi = acos(-1);
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const int dx8[8]={-1,0,1,-1,1,-1,0,1};
const int dy8[8]={-1,-1,-1,0,0,1,1,1};

#define p_queue(i) priority_queue<i> 
#define rp_queue(i) priority_queue<i, vector<i>, greater<i>> 
#define umap(i,j) unordered_map<i,j>
#define P(p) cout<<(p)<<endl
#define PS(p) cout<<(p)<< " "
#define IN cin >> 
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define rrep(i,m,n) for(int i = (m-1); i >= (int)(n); i--)
#define inrep(n,a) for(int i = 0; i < (int)(n); i++)cin >> a[i];
#define mod(i) ((i)%(ll)(1e9 + 7))
#define divm(a,b) (mod(a * modpow((ll)b,(ll)(1e9+5))))
#define rsort(a,b,c) sort(a, b, greater<c>())
#define vsort(v) sort(v.begin(), v.end())
#define rvsort(v) sort(v.begin(), v.end(), greater<c>()) 
#define ft first
#define sd second
#define pb push_back
#define it insert
#define sz(x) ((int)(x).size())
#define lb(a,n,k) (lower_bound(a,a+n,k) - a) 
#define vlb(a,k)  (lower_bound(a.begin(),a.end(),k) - a.begin())
#define ub(a,n,k) (upper_bound(a,a+n,k) - a) 
#define vub(a,k)  (upper_bound(a.begin(),a.end(),k) - a.begin())
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return

ll modpow(ll i,ll j){ ll tmp=1; while(j){ if(j%2)tmp=mod(tmp*i);i=mod(i*i);j/=2;}return tmp;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }

vector<string> split(const string &str, char sep){
    vector<string> v;
    stringstream ss(str);
    string buffer;
    while( getline(ss, buffer, sep) ) {
        v.push_back(buffer);
    }
    return v;
}

//ll ncr[100][100];
//ll nCr(int n, int r){if(n==r) ret ncr[n][r] = 1; if(r==0) ret ncr[n][r] = 1; if(r==1) ret ncr[n][r] = n;if(ncr[n][r]) ret ncr[n][r]; ret ncr[n][r] = nCr(n-1,r) + nCr(n-1,r-1);}

//ll npr[100][100]={};
//ll nPr(int n,int r){if(npr[n][r])ret npr[n][r];if(r==0)ret npr[n][r] = 1;if(r==1)ret npr[n][r] = n;ret npr[n][r] = n * nPr(n-1,r-1);}

//ll nHr(int n,int r){ret nCr(n+r-1,r);}

///////////////////////////////////////////////////////////////////////////


int main(){
    
    int n;
    string s;
    cin >> n >> s;
    map<char,int> m;
    rep(i,0,sz(s))m[s[i]]++;

    ll ans = 1;
    for(auto i:m){
	ans *= i.sd+1;
	ans = mod(ans);
    }

    P(ans - 1);
	
    return  0;
}


Measured memory_bytes: 512
import math
N,K = map(int,input().split())
def combinations_count(n, r):
    return math.factorial(n) / (math.factorial(n - r) * math.factorial(r))

def cmb(n, r, mod):

    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 1000000007
g1 = [1, 1]
g2 = [1, 1]
inverse = [0, 1]

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )

for i in range(1,K+1):
    # print(i)
    if N-K+1-i<0:
        print(0)
    else:
        first = int(cmb(N-K+1, i,mod))
        last  = int(cmb(K-1, i-1,mod))
        print((first*last)%mod)


Measured memory_bytes: 3572
#include <iostream>
#include <iomanip>
#include <cmath>
#include <vector>
#include <queue>
#include <limits>
#include <algorithm>
#include <string>
#include <map>
#include <set>
using namespace std;

int main()
{
	string A, B;
	cin >> A >> B;

	string res;
	if (A.size() == B.size()) {
		bool equel = true;
		for (size_t i = 0; i < A.size(); i++) {
			if (A[i] > B[i]) {
				res = "GREATER";
				equel = false;
				break;
			} else if (A[i] < B[i]) {
				res = "LESS";
				equel = false;
				break;
			}
		}
		if (equel)
			res = "EQUAL";
	} else {
		res = A.size() > B.size() ? "GREATER" : "LESS";
	}

	cout << res << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
using namespace std;
int main(){
  int n,k;
  cin >> n >> k;
  long double p[n];
  for(int i = 0;i<n;i++){
    cin >> p[i];
    p[i]=(1+p[i])/2;
  }
  long double ans,now;
  now = 0;
  for(int i = 0;i<k;i++) now+=p[i];
  ans = now;
  for(int i = k;i<n;i++){
    now+=(p[i]-p[i-k]);
    ans=max(ans,now);
  }
  cout << setprecision(20) << ans << endl;
}


Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef vector<ll> vll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define Sort(a) sort(a.begin(), a.end())
#define fin(ans) cout << (ans) << endl
const int INF = 1<<30;
const ll MOD = 1000000007;

int main() {
  string s,t,u;
  double a, b;
  cin >> a;
  //cin >> a >> b;
  //cin >> s >> t >> u;
  
  cout << 2*a*M_PI << endl; 
  
}

Measured memory_bytes: 3756
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n - 1; 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 VSORTR(v) sort(v.rbegin(), v.rend());
#define ALL(v) (v).begin(),(v).end()
 
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll, ll>;

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

    ll n, k, s;
    cin >> n >> k >> s;
    REP(i, k) {
        cout << s << " ";
    }
    ll ng = 1e9;
    if (s == ng) {
        REP(i, n - k) cout << 1 << " ";
        return 0;
    }
    REP(i, n - k) cout << ng << " ";
    return 0;
}

Measured memory_bytes: 1280
h,w=gets.split(" ").map(&:to_i)
a=[]
h.times do |i|
  a<<gets.chomp.split("")
end
a.delete_if{|j| j.include?("#")==false}
b=a.transpose
b.delete_if{|j| j.include?("#")==false}
c=b.transpose
c.each do |outer|
  puts outer.join("")
end


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

using ll=long long;
ll a[550][550];
ll c, res, tot;
ll n, m, h, w;

void Init()
{
	cin>>n>>m>>h>>w;
}

void Solve()
{
	for (int i = h; i <= n; i += h)
		for (int j = w; j <= m; j += w) tot++;
	
	if (n * m - h * w * tot > 0)
		c = tot / (n * m - h * w * tot) + 1;
	else c = 1;
	
	for (int i = 1; i <= n; i++)
		for (int j = 1; j <= m; j++) a[i][j] = c;
		
	res = c * n * m;
	
	for (int i = h; i <= n; i += h)
		for (int j = w; j <= m; j += w)
		{
			res -= c;
			a[i][j] = - (h * w - 1) * c - 1;
			res += - (h * w - 1) * c - 1;
		}
}

int main()
{
	Init();
	Solve();	

	if (res > 0)
	{
		puts("Yes");
		for (int i = 1; i <= n; i++)
		{
			for (int j = 1; j <= m; j++)
			{
				cout<<a[i][j]<<" ";
			}
			puts("");
		}
	}
	else puts("No");
	return 0;
}

Measured memory_bytes: 3456