akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<vector>
#include<deque>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<algorithm>
#include<functional>
#include<utility>
#include<bitset>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<cstdio>

using namespace std;

#define REP(i,n) for(int i=0;i<int(n);i++)
#define foreach(c,itr) for(__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)
typedef long long ll;


int N,K,R,S,P;
int mx(string x){

	int n=x.size(),c=0;
	x+='A';
	char b='B';
	for(int i=0;i<n;i++){

		if(i==0){
			if(x[0]=='r'){
				b='p';
				c+=P;
			}
			if(x[0]=='s'){
				b='r';
				c+=R;
			}
			if(x[0]=='p'){
				b='s';
				c+=S;
			}
		}


		else if(n>1 && x[i-1]!=x[i]){
			if(x[i]=='r'){
				b='p';
				c+=P;
			}
			if(x[i]=='s'){
				b='r';
				c+=R;
			}
			if(x[i]=='p'){
				b='s';
				c+=S;
			}
		}


		else if(n>1 && x[i-1]==x[i]){
			if(x[i]=='r' && b=='p'){
				b=x[i+1];
			}
			else if(x[i]=='r' && b!='p'){
				b='p';
				c+=P;
			}
			else if(x[i]=='s' && b=='r'){
				b=x[i+1];
			}
			else if(x[i]=='s' && b!='r'){
				b='r';
				c+=R;
			}
			else if(x[i]=='p' && b=='s'){
				b=x[i+1];
			}
			else if(x[i]=='p' && b!='s'){
				b='s';
				c+=S;
			}

		}


	}

	return c;


}

int main(void){
	          int i,j,k;

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


	          cin >> N >> K >> R >> S >> P;
	          string T;
	          cin >> T;

	          vector<string> v(K);
	          for(i=0;i<N;i++){
	        	  v[i%K]+=T[i];
	          }

	          int ans=0;

	          for(i=0;i<K;i++){
	        	  int d=mx(v[i]);
	        	  ans+=d;

	          }


	          cout << ans << endl;



	          return 0;
}


Measured memory_bytes: 5200
#include <bits/stdc++.h>
using namespace std;
static const int MAX = 200000;

int main() {
  int n, R[MAX];
  cin >> n;
  for (int i = 0; i < n; i++) cin >> R[i];

  int maxv = -2000000000;
  int minv = R[0];
  for (int i = 1; i < n; i++) {
    maxv = max(maxv, R[i] - minv);
    minv = min(minv, R[i]);
  }

  cout << maxv << endl;
  return 0;
}


Measured memory_bytes: 3876
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>

using namespace std;

#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define repn(i, n) for(int (i) = 1; (i) <= (n); (i)++)
#define repr(i, n) for(int (i) = (n-1); (i) >= 0; (i)--)
#define all(x) (x).begin(), (x).end()
#define lint long long

int main(){
    int n; string s; cin >> n >> s;
    vector<int> c; int tmp = 0;
    rep(i, n){
        if(s[i] == 'W') tmp++;
        c.push_back(tmp);
    }

    int res = c[0]-c[n-1]+n-1;
    rep(i, n){
        if(i == 0) continue;
        int r = c[i-1]+c[i]-c[n-1]+n-i-1;
        res = min(res, r);
    }

    cout << res << endl;
}


Measured memory_bytes: 2804
#!/usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#A
def A():
    s = S()
    s.sort()
    if s == ["a", "b", "c"]:
        print("Yes")
    else:
        print("No")
    return

#B
def B():
    a, b, k = LI()
    ans = []
    for i in range(a, min(a + k, b + 1)):
        ans.append(i)
    for i in range(max(b - k + 1, a + k), b + 1):
        ans.append(i)
    for i in ans:
        print(i)
    return

#C
def C():
    abc= LI()
    abc.sort()
    a,b,c = abc
    a1 = (c - a) % 2
    b1 = (c - b) % 2
    if a1 and b1:
        print((c - a) // 2 + (c - b) // 2 + 1)
        return
    if a1 or b1:
        print((c - a) // 2 + (c - b) // 2 + 2)
        return
    print((c - a) // 2 + (c - b) // 2 )

    return

#D
def D():
    return

#Solve
if __name__ == '__main__':
    C()


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

int main()
{
    int n, m;
    cin >> n >> m;
    vector<int> city(n, 0);
    for (int i = 0; i < m; i++) {
        int a, b;
        cin >> a >> b;
        city.at(a - 1)++;
        city.at(b - 1)++;
    }
    for (auto&& i : city) {
        cout << i << endl;
    }
}


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

int main() {
  string S, T;
  cin >> S >> T;

  int ans = T.size();
  for (int i = 0; i <= S.size() - T.size(); i++) {
    int tmp = 0;
    for (int j = 0; j < T.size(); j++) {
      if (T[j] != S[i + j]) tmp++;
    }
    ans = min(ans, tmp);
  }

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


Measured memory_bytes: 3608
import java.util.*;

public class Main { //クラス名はMain
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
      int n=sc.nextInt();
      double m=0;
      //double c=1;
      for(int i=0;i<n;i++){
      		double a=sc.nextDouble();
        	m+=1.0/a;
        	//c*=a;
      }
      	System.out.println(1/m);
    }
}

Measured memory_bytes: 23380
#include <bits/stdc++.h>
using namespace std;
#define all(x) x.begin(),x.end()
#define sz(x) (int)(x).size()
#define trav(x,v) for(auto &x:v)
#define For(i,a,b) for(int i=(a);i<=(b);i++)
#define Ford(i,a,b) for(int i=(a);i>=(b);i--)
#define rep(i, n) for (int i=0;i<(n);i++)
#define repd(i,n) for(int i=(n)-1;i>=0;i--)
#define debug(x) {cerr<<"L"<<__LINE__ <<" : "<<#x<<" = "<<(x)<<endl;}


using vi=vector<int>;
using pii=pair<int,int>;
using ll=long long;
using vll=vector<ll>;
using pll=pair<ll,ll>;

//const int EPS=1e-9;


int main() {
    // freopen("input.txt","r",stdin);
    // freopen("output.txt","w",stdout);
    // or
    //ifstream fin("input.txt");
    //ofstream fout("ouput.txt");
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    cin.exceptions(cin.failbit);
    //Solution
    int a,b;
    cin>>a>>b;
    int area=a*b;
    int p=2*(a+b);
    cout<<area<<" "<<p<<endl;
}



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

typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<ll,ll> pii;
typedef vector<pii> vpii;

#define pb(x) push_back(x)
#define ppb() pop_back()
#define mp(x,y) make_pair(x,y)
#define mod 1000000007
#define FOR0(i,n) for(ll i=0;i<n;i++)
#define FOR(i,a,b) for(ll i = a; i < b; i++)
#define FORD(i,a,b) for(ll i=(a);i>=(int)(b);i--)
#define sf(n) scanf("%lld", &n)
#define sfc(x) scanf("%c", &x)
#define pf(x) printf("%lld", x)
#define pff(x) printf("%lf", x)
#define pfc(x) printf("%c", x)
#define pfs(x) printf("%s", x)
#define sf2(a,b) scanf("%lld %lld", &a, &b)
#define sf3(a,b,c) scanf("%lld %lld %lld", &a, &b, &c)
#define pfn(n) printf("%lld\n", n)
#define pfs(n) printf("%lld ", n)
#define ff first
#define ss second   
#define mem(a,b) memset(a,b,sizeof(a))
#define sz size()
#define ll long long
#define all(c) (c).begin(),(c).end()
#define fast ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
const ll INF = 2e18;

bool prime[1000009];    
unordered_map<ll,ll> largest_factor;
void SieveOfEratosthenes(ll n)
{
    memset(prime,true, sizeof(prime)); 
    prime[1]=false;
    for (ll p=2; p*p<=n; p++)
    {
        if (prime[p] == true)
        {
            for (ll i=p*p; i<=n; i += p){
                prime[i] = false;
                largest_factor[i]=p;
            }

        }
    }
}


ll power(ll x,ll y)
{
    if (y == 0)
        return 1;
    else if (y%2 == 0)
        return power(x, y/2)*power(x, y/2);
    else
        return x*power(x, y/2)*power(x, y/2);
}


ll mod_power(ll a,ll b,ll m){
    ll res=1;
    a%=m;
    while(b){
        if(b&1){
            res=res*a%m;
        }
        a=a*a%m;
        b>>=1;
    }
    return res;
}


int main(){
    fast
    ll a,b,c,k;
    cin>>a>>b>>c>>k;
    ll ans=0;
    if(k>=a){
        ans+=a;
        k-=a;
    }   
    else{
        ans=k;
        k=0;
    }
    if(k>=b){
        k-=b;
    }   
    else{
        k=0;
    }

    if(k>=c){
        ans-=c;
        k-=c;
    }   
    else{
        ans-=k;
        k=0;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3656
import sys
input = sys.stdin.readline
# sys.setrecursionlimit(100000)


def main():
    R = int(input())
    if R < 1200:
        print("ABC")
    elif 1200 <= R and R < 2800:
        print("ARC")
    else:
        print("AGC")


if __name__ == "__main__":
    main()


Measured memory_bytes: 61792
import sys
sys.setrecursionlimit(1000000)
input = sys.stdin.readline
def ii(): return int(input())
def mi(): return map(int, input().rstrip().split())
def lmi(): return list(map(int, input().rstrip().split()))
def li(): return list(input().rstrip())
# template

# BEGIN CUT HERE
class UnionFind():
    def __init__(self,n):
        self.data = [-1] * n
    
    def unite(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x == y:
            return
        elif self.data[x] < self.data[y]:
            x, y = y, x  # swap
        self.data[x] += self.data[y]
        self.data[y] = x
    
    def find(self, x):
        if self.data[x] < 0:
            return x
        self.data[x] = self.find(self.data[x])
        return self.data[x]

    def same(self, x, y):
        return self.find(x) == self.find(y)
    
    def size(self, x):
        return self.data[self.find(x)]
        
# END CUT HERE

def ABC120_D():
    n, m = mi()
    a = [0] * m
    b = [0] * m
    for i in range(m):
        a[i], b[i] = mi()
        
    uf = UnionFind(n)
    ans = [0] * (m + 1)
    ans[m] = n * (n - 1) // 2

    for i in range(m - 1, -1, -1):
        a[i] -= 1
        b[i] -= 1
        ans[i] = ans[i + 1]
        if uf.same(a[i], b[i]):
            continue
        
        x = uf.size(a[i])
        y = uf.size(b[i])
        ans[i] -= x * y
        
        uf.unite(a[i],b[i])
    
    for i in range(1, m + 1):
        print(ans[i])



if __name__ == '__main__':
    ABC120_D()


Measured memory_bytes: 47092
#include<bits/stdc++.h>
 
using namespace std;
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
 
#define IN_REP          int tt; cin >> tt; while(tt--)
#define sim             template<class T
#define ris 						return * this
#define dor 						> debug & operator <<
#define eni(x) 			sim > typename enable_if<sizeof dud<T>(0) x 1, debug&>::type operator<<(T i)
sim > struct rge { T b, e; };
sim > rge<T> range(T i, T j) { return rge<T>{i, j}; }
sim > auto dud(T* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
  ~debug() { cerr << endl; }
	eni(!=) { cerr << boolalpha << i; ris;}
	eni(==) { ris << range(begin(i), end(i)); }
	sim, class U dor(pair<U,T> d) { ris << "(" << d.first << ", " << d.second << ")"; }
	sim dor(rge<T> d) {
		*this << "[";
		for (auto it = d.b; it != d.e; ++it) *this << ", " + 2 * (it == d.b) << *it;
		ris << "]";
	}
#else
  sim dor(const T&) { ris; }
#endif
};
#define pr(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

#define F               first
#define S               second
#define all(a)          std::begin(a), std::end(a)
#define sz(x)           (ll)(x).size()
#define IOS             ios::sync_with_stdio(false);cin.tie(NULL)
#define EPS             (ld) 1e-9
const ll MOD = (ll) 1e9 + 7;
const ld PI = acos(-1);
sim>T gcd(T x, T y) {return (y==0) ? x : gcd(y, x % y);}
sim>void mini(T &a, T b) { a = min(a, b); }
sim>void maxi(T &a, T b) { a = max(a, b); }
sim>T mul(T x, T y) {return (x * y) % MOD;}
sim>inline T power(T a, T b) {T res = 1;while (b > 0) {if (b&1) { res = mul(res, a); }a = mul(a, a);b >>= 1;}return res%MOD;}
sim>inline T modInverse(T n) { return power(n, MOD - 2, MOD) % MOD; }
string to_string(string s) { return '"' + s + '"';}
string to_string(char s) { return string(1, s);}
string to_string(const char* s) { return to_string((string) s);}
sim, class U>string to_string(pair<T, U> p) {return to_string(p.F) + " " + to_string(p.S);}

const int MX = (int) 6e3 + 5;
 
int main(int argc, char** argv){
    int n, m;
    cin >> n;
    vector<int> a(n);
    for(int i = 0; i < n; ++i) cin >> a[i];
    sort(all(a));
    ld sum = a[0];
    for(int i = 1; i < n; ++i) sum = (sum + a[i]) /2;
    cout << sum << endl;
    return 0;
}
 


Measured memory_bytes: 256
import java.util.Scanner;

/**
 * https://abc043.contest.atcoder.jp/tasks/arc059_a
 */
public class Main {

	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] a = new int[N];
		for(int i=0; i<N; i++) a[i] = sc.nextInt();
		sc.close();
		
		int ans = Integer.MAX_VALUE;
		for(int i=-100; i<=100; i++){
			int cost = 0;
			for(int j=0; j<N; j++){
				cost += (i-a[j])*(i-a[j]);
			}
			ans = Math.min(ans, cost);
		}
		
		System.out.println(ans);

	}

}

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

int main(){
    int r,g,b;
    cin >> r >> g >> b;
    int N = r*100 + g*10 + b;
    if(N % 4 == 0){
        cout << "YES";
    }else{
        cout << "NO";
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#define MAX 1000000000;
using namespace std;

int main(void)
{
	int n, now = 0, flag[101] = {};
	long ans = 0, an[100][100], min[100];

	cin >> n;

	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++)
			cin >> an[i][j];
		min[i] = MAX;
	}

	do {
		long key = MAX;
		long key_i;
		flag[now] = 1;
		flag[100] = 0;

		for (int i = 0; i < n; i++) {
			if (an[now][i] != -1 && an[now][i] < min[i] && flag[i] == 0)
				min[i] = an[now][i];
			if (flag[i] == 0 && min[i] < key) {
				key = min[i];
				key_i = i;
			}
			if (flag[i] == 1)
				flag[100]++;
		}

		now = key_i;
		ans += key;

	} while (flag[100] != n - 1);

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 3140
my ($line) = split(/\s+/, <STDIN>);
my @s = split(//, $line);
my $len = @s;

my ($odd, $even) = (0,0);
for (my $i=0; $i<$len; $i+=2) {
    $even++ if $s[$i] == 0;
}
for (my $i=1; $i<$len; $i+=2) {
    $odd++ if $s[$i] == 1;
}

#print "len=$len, odd=$odd, even=$even\n";
my $val = abs($odd+$even);
$val = $len - $val if $val * 2 > $len;

print "$val\n";


Measured memory_bytes: 16384
import sys
input = lambda: sys.stdin.readline().rstrip()

def main():
    n, m = map(int, input().split())
    x = sorted(list(map(int, input().split())))
    diff = []
    for i in range(1, m):
        diff.append(x[i]-x[i-1])
    diff.sort(reverse=True)
    print(x[-1]-x[0]-sum(diff[:n-1]))
        
if __name__ == '__main__':
    main()

Measured memory_bytes: 20544
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int arr[]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    int k;
    cin>>k;
    cout<<arr[k-1]<<endl;
    return 0;
}


Measured memory_bytes: 256
import qualified Data.ByteString.Char8 as BS
import Data.Maybe
import Data.Array.IArray

isPrime :: Integral a => a -> Bool
isPrime n
  | n <= 2    = n == 2
  | otherwise = odd n && f 3
  where
    f i
      | i^2 > n   = True
      | otherwise = n `rem` i /= 0 && f (i+2) 

primesArray :: Int -> Array Int Bool
primesArray n = listArray (0,n) $ map isPrime [0..n]

main :: IO ()
main = do
    _ <- getLine
    lr <- map ((\[a,b] -> (a,b))
        . map (fst . fromJust . BS.readInt) . BS.words) . BS.lines
        <$> BS.getContents :: IO [(Int,Int)]
    let m = 10^5
        p = primesArray m
        f n = p!n && p!((n+1) `div` 2)
        c = listArray (0,m)
                $ scanl (\a i -> if f i then a+1 else a)
                0 [1..m] :: Array Int Int
        solve l r = (c!r) - (c!(l-1))
    mapM_ (print . uncurry solve) lr


Measured memory_bytes: 17148
while True:
    n, x = map(int, input().split())
    if (n == x == 0):
        break

    count = 0
    for a in range(1, x // 3):
        for b in range(a + 1, x // 2):
            for c in range(b + 1, n + 1):
                Sum = a + b + c
                if (Sum == x):
                    count += 1 
    print(count)

Measured memory_bytes: 7696
from collections import defaultdict


class DisjoinSet:
    def __init__(self, N):
        self.par = [-1] * N
        self.sz = [1] * N

    def root(self, x):
        if self.par[x] < 0:
            return x
        else:
            self.par[x] = self.root(self.par[x])
            return self.par[x]

    def unite(self, a, b):
        a = self.root(a)
        b = self.root(b)
        if a == b:
            return
        if self.sz[a] > self.sz[b]:
            a, b = b, a
        self.par[a] = b
        self.sz[b] += self.sz[a]

    def same(self, a, b):
        return self.root(a) == self.root(b)

    def size(self, x):
        return self.sz[self.root(x)]

    def __str__(self):
        clusters = defaultdict(list)
        for x in range(N):
            clusters[self.root(x)].append(x)
        return str(list(clusters.values()))


N, M, K = map(int, input().split())

A, B = [], []
for _ in range(M):
    a, b = map(int, input().split())
    A.append(a - 1)
    B.append(b - 1)

C, D = [], []
for _ in range(K):
    c, d = map(int, input().split())
    C.append(c - 1)
    D.append(d - 1)

data = DisjoinSet(N)
for a, b in zip(A, B):
    data.unite(a, b)

ans = [data.size(x) - 1 for x in range(N)]

for a, b in zip(A, B):
    ans[a] -= 1
    ans[b] -= 1

for c, d in zip(C, D):
    if data.same(c, d):
        ans[c] -= 1
        ans[d] -= 1

print(' '.join(map(str, ans)))


Measured memory_bytes: 113720
#define _CRT_SECURE_NO_WARNINGS
//#define _USE_MATH_DEFINES
#include<stdio.h>
//#include<stdlib.h>
//#include<math.h>
#include<string.h>
//#include<time.h>
#define P(type,x) fprintf(stdout,"%"#type"\n",x)

int main() {
	int n, m, p,i,ans,a;
	int map[1001];
	while (fscanf(stdin, "%d%d", &n, &m), n || m) {
		memset(map, 0, sizeof(map));
		for (i = 1; i <= n; i++) fscanf(stdin, "%d", map + i);
		p = 1;
		ans = 0;
		for (i = 0; i < m; i++) {
			fscanf(stdin, "%d", &a);
			if (ans) continue;
			p += a;
			p += map[p];
			if (p >= n) ans = i + 1;
		}
		P(d, ans);
	}
	return 0;
}

Measured memory_bytes: 604
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1e9;
const ll MOD = 1e9 + 7;
#define all(v) v.begin(), v.end()
#define repi(i, n, init) for (ll i = init; i < (n); i++)
#define repd(i, n, init) for (ll i = (n); i >= init; i--)
#define repm(i, m) for (auto i = m.begin(); i != m.end(); i++)
#define repb(bit, n, init) for (ll bit = init; bit < (1 << n); ++bit)

vector<ll> fact, invfact;
ll modpower(ll x, ll n, ll mod)
{
    ll res = 1;
    while (n)
    {
        if (n & 1)
            res = res * x % mod;
        x = x * x % mod;
        n >>= 1;
    }
    return res;
}
ll inv(ll n)
{
    return modpower(n, MOD - 2, MOD);
}
void COMinit(ll k)
{ //空っぽの配列を二つ
    k++;
    fact.resize(k, 0);
    invfact.resize(k, 0);
    fact[0] = 1;
    repi(i, k, 1)
    {
        fact[i] = fact[i - 1] * i % MOD;
    }
    invfact[k - 1] = inv(fact[k - 1]);
    repd(i, k - 2, 0)
    {
        invfact[i] = invfact[i + 1] * (i + 1) % MOD;
    }
    return;
}
ll nCk(ll n, ll k)
{ //この関数を使う前にCOMinit
    if (k < 0 || n < k)
        return 0LL;
    return fact[n] * invfact[k] % MOD * invfact[n - k] % MOD;
}
ll com(ll n, ll k)
{
    ll iv = 1;
    ll fa = 1;
    repi(i, k, 0)
    {
        fa *= (n - i);
        fa %= MOD;
    }
    repi(i, k + 1, 1)
    {
        iv *= inv(i);
        iv %= MOD;
    }
    return fa * iv % MOD;
}

//---------main function----------

int main()
{
    ll k;
    string s;
    cin >> k >> s;
    ll n = s.size();
    ll ans = 0;
    COMinit(n + k);
    repi(i,k + 1,0){
        ll now = modpower(25,i,MOD);
        now *= nCk(i + n - 1,n-1);
        now %= MOD;
        now *= modpower(26,k-i,MOD);
        now %= MOD;
        if(now < 0)now += MOD;
        ans += now;
        ans %= MOD;
    }
    cout << ans << endl;
    return 0;
}

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

bool f(vector<int> &v, int x, int k) {
    lint cnt = 0;
    for (auto i: v) {
        cnt += (i+x-1)/x - 1;
    }
    if (cnt <= k) return true;
    return false;
}

int main() {
    int n,k; cin >> n >> k;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    int ok = *max_element(a.begin(), a.end() );
    int ng = 0;
    while (abs(ok-ng) > 1) {
        int mid = (ok+ng) / 2;
        if (f(a,mid,k)) ok = mid;
        else ng = mid;
    }
    cout << ok << endl;
}


Measured memory_bytes: 4004
//Dedicated to the two things I don't have in my life
//Ekagrata and Ekagrata
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define mp make_pair
#define all(c)	c.begin(),c.end()
int main()
{
    ios_base :: sync_with_stdio(false);
    cin.tie(0), cout.tie(0);
    vector <int> everything;
    for(int i = 111; i <= 999; i += 111)
        everything.pb(i);
    int n;
    cin >> n;
    cout << (*(lower_bound(all(everything), n))) << endl;
    return 0;
}

Measured memory_bytes: 256
use std::str::FromStr;
use std::fmt::Debug;
use std::cmp;
use std::collections::VecDeque;

#[allow(dead_code)]
fn read_as_vec<T>() -> Vec<T>
where T: FromStr, <T as FromStr>::Err : Debug{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().split_whitespace().map(|c| T::from_str(c).unwrap()).collect()

}

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

fn count_white(gamemap: &Vec<Vec<i64>>) -> i64{
    let mut ans = 0;

    for line in gamemap{
        for grid in line{
            if *grid != -1{
                ans += 1;
            }
        }
    }

    return ans;
}

fn main(){
    let line = read_as_vec::<usize>();
    let (h, w) = (line[0], line[1]);

    let mut gamemap = Vec::new();
    let wall = -1;
    //initialize map
    for _ in 0..h{
        let mut line: Vec<char> = read_as_string().chars().collect::<Vec<char>>();
        let mut int_line: Vec<i64> = vec![];

        for grid in &mut line{
            if *grid == '#'{
                int_line.push(wall);
            }else{
                int_line.push(std::i64::MAX);
            }
        }
        gamemap.push(int_line);
    }
    gamemap[0][0] = 0;

    let mut queue: VecDeque<(usize, usize)> = VecDeque::new();
    queue.push_back((0, 0));

    while let Some((i, j)) = queue.pop_front(){
        if i == h-1 && j == w-1{
            break;
        }

        if i > 0 && gamemap[i-1][j] != wall{
            if gamemap[i-1][j] > gamemap[i][j]+1{
                gamemap[i-1][j] = gamemap[i][j]+1;
                queue.push_back((i-1, j));
            }
        }

        if i < h-1 && gamemap[i+1][j] != wall{
            if gamemap[i+1][j] > gamemap[i][j]+1{
                gamemap[i+1][j] = gamemap[i][j]+1;
                queue.push_back((i+1, j));
            }
        }

        if j > 0 && gamemap[i][j-1] != wall{
            if gamemap[i][j-1] > gamemap[i][j]+1{
                gamemap[i][j-1] = gamemap[i][j]+1;
                queue.push_back((i, j-1));
            }
        }

        if j < w-1 && gamemap[i][j+1] != wall{
            if gamemap[i][j+1] > gamemap[i][j]+1{
                gamemap[i][j+1] = gamemap[i][j]+1;
                queue.push_back((i, j+1));
            }
        }


    }

    //println!("{}", gamemap[h-1][w-1]);
    if gamemap[h-1][w-1] == std::i64::MAX{
        println!("-1");
    }else{
        let num_white = count_white(&gamemap);
        println!("{}", num_white - gamemap[h-1][w-1] - 1);
    }
}


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

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

typedef long long ll;
using namespace std;
int mod = 1000000007;

int main(void){
    int N, M;
    while(true){
        cin >> N >> M;
        if(N == 0) break;
        vector<priority_queue<int>> pq(M);
        rep(i, N){
            int d, v; cin >> d >> v;
            pq[d-1].push(v);
        }
        int acc = 0;
        rep(i, M) acc += pq[i].top();
        cout << acc << endl;
    }
    return 0;
}


Measured memory_bytes: 3164
N = int(input())
e = [0]*(N+1)
for i in range(2,N+1):
    cur = i
    for j in range(2,i+1):
        while cur % j == 0:
            e[j] += 1
            cur //= j

def num(m):
    return len(list(filter(lambda x: x >= m-1,e)))

ans = num(75) + num(25)*(num(3)-1) + num(15)*(num(5)-1)\
    + num(5)*(num(5)-1)*(num(3)-2)//2
print(ans)

Measured memory_bytes: 38516
//author:luckYrat(twitter:@luckYrat_)
//<ここに一言>

//せんげん！
#include <iostream>

#include <cmath>
#include <algorithm>
#include <iomanip>

#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <bitset>

#include <cctype>
#include <utility>
#include <climits>


//なまえくーかん！
using namespace std;
using ll = long long;
using P = pair<ll,ll>;

//てーすう！
const int mod = 1000000007;
const int inf = (1<<30)-1;
const ll linf = (1LL<<62LL)-1;
const double EPS = (1e-10);

//でふぁいん！
#define anyfill(n,s) setw(n) << setfill(s)
#define loop(s) for(int i = 0; s > i; i++)
#define rep(i,q) for(int i = 0; (q) > i; i++)
#define repp(i,n,q) for(int i = n; (q) > i; i++)
#define dep(i,q) for(int i = (q); 0 < i; i--)

//みじかく！
#define pb push_back
#define fir first
#define scn second
#define ednl endl

//いぇすのー！
#define YesNo(a) (a?"Yes":"No")
#define YESNO(a) (a?"YES":"NO")
#define yesno(a) (a?"yes":"no")

//きんぼーnほーこー！！
P ar4[4] = {{0,1},{0,-1},{1,0},{-1,0}};
P ar8[8] = {{-1,-1},{-1,0},{-1,1},{0,-1},{0,1},{1,-1},{1,0},{1,1}};
/*
確認ポイント
cout << fixed << setprecision(n) << 小数計算//n桁の小数表記になる

計算量は変わらないが楽できるシリーズ
min(max)_element(iter,iter)で一番小さい(大きい)値のポインタが帰ってくる
count(iter,iter,int)でintがiterからiterの間にいくつあったかを取得できる
*/
template <typename T>
T gcd(T a,T b){
  if(a%b==0)return b;
  else return gcd(b,a%b);
}
__attribute__((constructor))
void initial() {
 cin.tie(0);
 ios::sync_with_stdio(false);
}
int main(){
  int n;cin>>n;
  long long ans = 0;
  for(int i = 1; n >= i; i++){
    for(int j = 1; n >= j; j++){
      for(int k = 1; n >= k; k++){
        ans += gcd(i,gcd(j,k));
      }
    }
  }
  cout << ans << endl;
}

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

int main(){
    int X, Y, Z, k;
    cin >> X >> Y >> Z >> k;

    vector<ll> x(X), y(Y), z(Z);
    for(int i=0; i<X; i++) cin >> x[i];
    for(int i=0; i<Y; i++) cin >> y[i];
    for(int i=0; i<Z; i++) cin >> z[i];

    vector<ll> xy;
    for(int i=0; i<X; i++){
        for(int j=0; j<Y; j++) xy.push_back(x[i] + y[j]);
    }
    sort(xy.rbegin(), xy.rend());

    vector<ll> xyz;
    for(int i=0; i<min(k, X*Y); i++){
        for(int j=0; j<Z; j++) xyz.push_back(xy[i] + z[j]);
    }
    sort(xyz.rbegin(), xyz.rend());

    for(int i=0; i<k; i++) cout << xyz[i] << endl;
    return 0;
}

Measured memory_bytes: 43240
<?php
fscanf(STDIN, "%d%d%d", $n, $a, $b);
$x = array_map("intval", explode(" ", trim(fgets(STDIN))));
$p = 0;
for($i = 1; $i < $n; $i++){
  $d = $x[$i] - $x[$i-1];
  $p += min($a*$d, $b);
}
echo $p,"\n";


Measured memory_bytes: 16884
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int mod = 1000000007;
const double PI = acos(-1);

int main()
{
	int n, m, k;
	cin >> n >> m >> k;
	vector<int> a(n+1), b(m);
	for (int i = 1; i <= n; i++) cin >> a[i];
	for (int i = 0; i < m; i++) cin >> b[i];
	vector<ll> s(m + 1);
	for (int i = 1; i <= m; i++) s[i] = s[i - 1] + b[i - 1];

	ll timeA = 0;
	int ansA = 0;
	int finalAns = 0;
	for (int i = 0; i <= n; i++) {
		if (timeA + a[i] <= k) {
			timeA += a[i];
			if (a[i] != 0) ansA++;
		}
		else break;
		ll time = timeA;
		int ans = ansA;
		int ok = 0;
		int ng = s.size();
		while (1 < abs(ok - ng)) {
			int c = (ng + ok) / 2;
			if (s[c] + time <= k) ok = c;
			else ng = c;
		}
		ans += ok;
		finalAns = max(finalAns, ans);
	}
	cout << finalAns << endl;
}


Measured memory_bytes: 6436
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main() {
  int N;
  cin >> N;
  vector<ll> A(N);
  vector<ll> B(N - 1);
  for(int i = 0; i < N - 1; i++) {
    cin >> B[i];
  }
  ll sum = 0;
  for(int i = 0; i < N; i++) {
    if(i == 0) {
      A[i] = B[i];
    }
    else if(i == N - 1) {
      A[i] = B[i - 1];
    }
    else {
      A[i] = min(B[i - 1], B[i]);
    }
    sum += A[i];
  }
  cout << sum << endl;
}

Measured memory_bytes: 3620
#include <iostream>
#include <iomanip>
#include <climits>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
using namespace std;
typedef long long ll;
typedef pair <ll, ll> pll;

const int maxN = 1e5 + 5;
const ll INF = LLONG_MAX;
const ll MOD = 1e9 + 7;

ll gcd(ll a, ll b){return !b ? a : gcd(b, a % b);}
ll modP(ll a, ll b) {return (!b ? 1 : (modP(a, b / 2) * modP(a, b / 2) * (b % 2 ? a : 1)) % MOD);}

ll k, a, b;

int main(){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> k >> a >> b;
	if (b - a <= 2 || a > k){
		return cout << k + 1 << endl, 0;
	}
	cout << a + (b - a) * (k - a + (k - a) % 2) / 2 + (k - a + 1) % 2 << endl;
	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
const int INF=1<<30,MOD=1000000007;
const ll LINF=1ll<<60;
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) _repi(i,0,n)
#define _repi(i,a,b) for(int i=a,i##_l=(b);i<i##_l;++i)
#define REP(...) _overload3(__VA_ARGS__,_repi,_rep,)(__VA_ARGS__)
#define REPR(i,n) for(int i=n-1;i>=0;--i)
#define REPARR(i,v) for(int i=0;i<v.size();++i)
#define all(v) (v.begin()),(v.end())
#define bit(n) (1ll<<(n))
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(a>b){a=b;return true;}return false;}
#define YES(n) cout<<((n)?"YES":"NO")<<endl
#define Yes(n) cout<<((n)?"Yes":"No")<<endl
#define yes(n) cout<<((n)?"yes":"no")<<endl
#define poss(n) cout<<((n)?"":"im")<<"possible"<<endl
#define Poss(n) cout<<((n)?"P":"Imp")<<"ossible"<<endl
template<typename T>ostream&operator<<(ostream&o,const vector<T>&v){o<<"{";for(T i:v)o<<i<<',';o<<"}";return o;}
template<typename T>ostream&operator<<(ostream&o,const set<T>&v){o<<"{";for(T i:v)o<<i<<',';o<<"}";return o;}
template<typename T,typename U>ostream&operator<<(ostream&o,const pair<T,U>&v){o<<"("<<v.first<<", "<<v.second<<")";return o;}

int main(){
    int a,b,c;
    cin>>a>>b>>c;
    int ans=0;
    if(c&&b){
        if(c>=b){
            ans+=b*2;
            c-=b;
            b=0;
        }else{
            ans+=c*2;
            b-=c;
            c=0;
        }
    }

    if(c&&a){
        if(c>=a){
            ans+=a;
            c-=a;
            a=0;
        }else{
            ans+=c;
            a-=c;
            c=0;
        }
    }
    if(c)ans++;
    if(b)ans+=b;
    cout<<ans<<endl;

    
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>
#define $ if(0)

using namespace std;

long long n;
long long x , y;
void work () {
	long long a , b , i , x1 , y1 , x2 , y2;
	scanf ( "%lld" , &n );
	scanf ( "%lld%lld" , &x , &y );
	for ( i = 2 ; i <= n ; i++ ) {
		scanf ( "%lld%lld" , &a , &b );
		x1 = x + (a - (x%a))%a;
		y1 = (x1/a)*b;
		y2 = y + (b - (y%b))%b;
		x2 = (y2/b)*a;
		x = max ( x1 , x2 ); y = max ( y1 , y2 );
		$ printf ( "%lld %lld\n" , x , y );
	}
	printf ( "%lld\n" , x + y );
}
int main () {
	work ();
	return 0;
}

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

int main() {
  int A, B, C, D;
  cin >> A >> B >> C >> D;
  
  if ((A + B)>(C + D)){
    cout << "Left" << endl;
  }else if((A + B)==(C + D)){
    cout << "Balanced" << endl;
  }else{
    cout << "Right" <<endl;
  }
}

Measured memory_bytes: 256
from math import *




s=input()

if(0<int(s[2:])<13 and 0<int(s[0:2])<13):
	print("AMBIGUOUS")
elif(0<int(s[2:])<13):
	print("YYMM")
elif(0<int(s[0:2])<13):
	print("MMYY")
else:
	print("NA")






Measured memory_bytes: 3060
using System.Numerics;
using System;

public class hello
{
    public static void Main()
    {
        var n = int.Parse(Console.ReadLine().Trim());
        for (int i = 0; i < n; i++)
        {
            var a = BigInteger.Parse(Console.ReadLine().Trim());
            var b = BigInteger.Parse(Console.ReadLine().Trim());
            var c = a + b;
            if (c.ToString().Length > 80) Console.WriteLine("overflow");
            else Console.WriteLine(c);
        }
    }
}





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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define INF 1L << 30
#define long long long
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }


int N;

vector<vector<long>> a(pow(10,5)+10, vector<long>(3));
vector<vector<long>> dp(pow(10, 5)+10, vector<long>(3, 0));

/*
int rec(int n){
	if (n == 0) return 0;
	if (dp.at(n) > 0) return dp.at(n)

	rep(i, 3){
		chmax(rec(n-1), dp.at(n).at(i), )
	}
}
*/

int main(){
	cin >> N;
	rep(i,N) cin >> a.at(i).at(0) >> a.at(i).at(1) >> a.at(i).at(2);

	for (int i=1; i<N+1; i++){
		rep(j, 3){
			rep(k, 3){
				if (k != j) chmax(dp.at(i).at(j), dp.at(i-1).at(k) + a.at(i-1).at(j)) ;
			}
			
		}
	}

	long res = 0;
	rep(j, 3){
		
		chmax(res,dp.at(N).at(j));
		
	}
	cout << res << endl;
	return 0;
}


Measured memory_bytes: 11136
#include <bits/stdc++.h>
const int N=2005;
int d[N],a[N],c[N],b[N],n,k,q,ans=1000000000;
int solve(int x){
	int cnt=0,tot=0;
	for (int i=1;i<=n+1;i++){
		if (a[i]<x){
			if (cnt>=k){ 
				std::sort(c+1,c+cnt+1);
				for (int j=1;j+k-1<=cnt;j++) d[++tot]=c[j];
			}
			cnt=0;
		}else c[++cnt]=a[i];
	}
	if (tot<q) return ans;
	std::sort(d+1,d+tot+1);
	return d[q]-d[1];
}
int main(){
	scanf("%d%d%d",&n,&k,&q);
	for (int i=1;i<=n;i++) scanf("%d",&a[i]),b[i]=a[i];
	std::sort(b+1,b+n+1);
	for (int i=1;i<=n;i++)
		ans=std::min(ans,solve(b[i]));
	printf("%d\n",ans);
}

Measured memory_bytes: 3772
#include <stdio.h>

int main(){
  int N,D,X,sche;
  int count=0,check=1;

  scanf("%d%d%d",&N,&D,&X);

  for(int i=0;i<N;i++){
   scanf("%d",&sche);
   check=1;
   while(1){
     check+=sche;
     if(check<=D)count++;
     else break;
   }
 }
 printf("%d",count+X+N);
 return 0;
}


Measured memory_bytes: 128
#pragma GCC optimize("Ofast") 
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define mp make_pair
#define all(a) a.begin(),a.end()
#define lb lower_bound
#define ub upper_bound
#define owo ios_base::sync_with_stdio(0);cin.tie(0);
#define MOD (ll)(1e6+3)
#define INF (ll)(1e18)
#define debug(...) fprintf(stderr, __VA_ARGS__),fflush(stderr)
#define time__(d) for(long blockTime = 0; (blockTime == 0 ? (blockTime=clock()) != 0 : false);\
debug("%s time : %.4fs\n", d, (double)(clock() - blockTime) / CLOCKS_PER_SEC))
typedef long long int ll;
typedef long double ld;
typedef pair<ll,ll> PII;
typedef pair<int,int> pii;
typedef vector<vector<int>> vii;
typedef vector<vector<ll>> VII;
ld eval(ll x,ll y,ll x1,ll y1)
{
	ld r = (x-x1);
	ld r1 = (y-y1);
	return sqrt(r*r+r1*r1);
} 
int main()
{
	ld n;
	cin>>n;
	vector<ld>x(n),y(n);
	for(int i=0;i<n;i++)cin>>x[i]>>y[i];
	ld ans = 0;
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<n;j++){
			if(i == j)continue;
			ld res = eval(x[i],y[i],x[j],y[j]);
			res/=n;
			ans+=res;
		}
	}
	ld p = 1;
	cout<<fixed<<setprecision(10)<<ans;
}



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

const int C = 2019;

int main(){
  int L, R; cin >>L >>R;
  int ans=2018, l, r;

  if(L/C < R/C) ans = 0;
  else{
    l = L%C; r = R%C;
    for(int i=l;i<r;i++){
      for(int j=i+1;j<r+1;j++){
        if(ans>i*j%C) ans = i*j%C;
      }
    }
  }

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


Measured memory_bytes: 256
/*
ID: anonymo14
TASK: wormhole
LANG: C++                 
*/
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pair<int,int>> vpii;

#define F first
#define S second
#define PU push
#define PUF push_front
#define PUB push_back
#define PO pop
#define POF pop_front
#define POB pop_back

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

#define MOD 1000000007

void solve(int test_case) {//223
	vi arr(1000);
	REP(i,1,999) {
		arr[i]=i*(i+1)/2;
	}
	int a,b;
	cin>>a>>b;
	REP(i,1,998) {
		if(arr[i]-a==arr[i+1]-b) {
			cout<<arr[i]-a;
			return;
		}
	}
}

int main() {
	
	////// FILE BASED IO////
	//freopen("wormhole.in", "r", stdin);
	//freopen("wormhole.out", "w", stdout);
	///////////////
	
	ios::sync_with_stdio(0);
	cin.tie(0);
	int t=1;
	//cin>>t;
	REP(i,1,t) {
		solve(i);
	}
	return 0;
}	


Measured memory_bytes: 3572
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		//List<String> list= new ArrayList<String>(Arrays.asList(s.split("")));
		//List<Integer> list=new ArrayList<Integer>();
		//Integer[] array = new Integer[m];
		int n = sc.nextInt();
		List<Integer> list=new ArrayList<Integer>();
		for(int i=0;n>i;i++) {
			int a = sc.nextInt();
			list.add(a);
		}
		list.set(0, list.get(0)-1);
		for(int i=0;list.size()-1>i;i++) {
			int a = list.get(i);
			int b = list.get(i+1);
			if(a<b)
				list.set(i+1, b-1);
			else if(a>b) {
				System.out.println("No");
				System.exit(0);
			}
		}
		System.out.println("Yes");
	}
}

Measured memory_bytes: 57956
#include<bits/stdc++.h>
using namespace std;
typedef complex<double> P;

namespace std{
  bool operator < ( const P &a, const P &b ){
    return (a.real()==b.real()?a.imag()<b.imag():a.real()<b.real());
  }
};

typedef pair<int,int> Pair;
double eps=1e-9;

int n;
int vw,vc;
P t[2000];

void func(){
  map<P , set<P> > G;
  set<P> st;
  for(int i=0;i<n;i++){
    st.insert(t[i]);
  }
  
  set<Pair> K;
  for(int i=0;i+1<n;i++){
    P v=t[i+1]-t[i];
    if(v.imag()<-eps){
      while(1){
        set<Pair> :: iterator it;
        it=K.lower_bound( Pair(t[i+1].imag(),-1) );
        if(it==K.end())break;
        if(t[i].imag() < it->first)break;
        P base=v/abs(v.imag());
        double length=t[i].imag()-it->first;
        
        st.insert(t[i]+base*length);
        //        G[ t[i]+base*length ].insert( t[it->second] );
        G[ t[it->second]  ].insert( t[i]+base*length );
        
        K.erase(it);
      }
    }
    if(v.imag()>eps){
      K.insert( Pair(t[i].imag(), i ) );
    }
  }

  K.clear();
  for(int i=n-1;i-1>=0;i--){
    P v=t[i-1]-t[i];
    if(v.imag()<-eps){
      while(1){
        set<Pair> :: iterator it;
        it=K.lower_bound( Pair(t[i-1].imag(),-1) );
        if(it==K.end())break;
        if(t[i].imag() < it->first)break;
        P base=v/abs(v.imag());
        double length=t[i].imag()-it->first;

        st.insert(t[i]+base*length);
        G[ t[i]+base*length ].insert( t[it->second] );

        K.erase(it);
      }
    }
    if(v.imag()>eps){
      K.insert( Pair(t[i].imag(), i ) );
    }
  }

  set<P> :: iterator it;
  vector<P> u;
  for(it=st.begin();it!=st.end();it++){
    u.push_back(*it);
    //    printf("%.3f %.3f\n",it->real(),it->imag());
  }

  vector<double> dp( st.size() , 1e30 );
  dp[0]=0;
  for(int i=0;i+1<(int)st.size();i++){
    dp[i+1]=min(dp[i+1],dp[i]+abs(u[i]-u[i+1])/(double)vw);

    for(it=G[u[i]].begin();it!=G[u[i]].end();it++){
      P to=*it;
      int target=lower_bound(u.begin(),u.end(),to)-u.begin();
      dp[target]=min(dp[target],dp[i]+
                     abs(u[i].real()-u[target].real())/(double)vc);
    }
  }
  printf("%.6f\n",dp.back());
}

int main(){
  while(1){
    scanf("%d",&n);
    if(n==0)break;
    scanf("%d %d",&vw,&vc);
    for(int i=0;i<n;i++){
      int x,y;
      scanf("%d %d",&x,&y);
      t[i]=P(x,y);
    }
    func();
  }
  return 0;
}

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

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

    if (a % x == 0)
        low = a / x - 1;
    else
        low = a / x;

    cout << b / x - low;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
    int n,a[200],sum=0,ans=1000000000;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>a[i];
        sum=0;
        while(a[i]%2==0){
            a[i]=a[i]/2;
            sum++;
        }
        if(ans>sum)
            ans=sum;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
(n, m) = tuple(map(int, input().split(" ")))
h = list(map(int, input().split(" ")))
l = [-1 for i in range(n)]
for i in range(m):
    (a, b) = tuple(map(int, input().split(" ")))
    if l[a - 1] < h[b - 1]:
        l[a - 1] = h[b - 1]
    if l[b - 1] < h[a - 1]:
        l[b - 1] = h[a - 1]
c = 0
for i in range(n):
    if l[i] == -1 or l[i] < h[i]:
        c += 1
print(c)

Measured memory_bytes: 20136
#include<algorithm>     //sort,二分探索,など
#include<bitset>        //固定長bit集合
#include<cmath>         //pow,logなど
#include<complex>       //複素数
#include<deque>         //両端アクセスのキュー
#include<fstream>       //ファイルストリーム（標準入力変更用）
#include<functional>    //sortのgreater
#include<iomanip>       //setprecision(浮動小数点の出力の誤差)
#include<iostream>      //入出力
#include<iterator>      //集合演算(積集合,和集合,差集合など)
#include<map>           //map(辞書)
#include<numeric>       //iota(整数列の生成),gcdとlcm(c++17)
#include<queue>         //キュー
#include<set>           //集合
#include<stack>         //スタック
#include<string>        //文字列
#include<unordered_map> //イテレータあるけど順序保持しないmap
#include<unordered_set> //イテレータあるけど順序保持しないset
#include<utility>       //pair
#include<vector>        //可変長配列

//名前
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef map<string, int> msi;
typedef map<string, ll> msll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pllll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll>> vvll;
typedef vector<vector<string>> vvs;
typedef vector<vector<bool>> vvb;

//定数
const ll MOD = 1000000007;
const ll INF = 1000000000000000000;

//マクロ
#define rep(i,n) for(int i=0;i<n;i++)
#define reps(i,s,e) for(int i=s;i<e;i++)
#define repse(i,s,e) for(int i=s;i<=e;i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define in(x1) cin >> x1
#define in2(x1, x2) cin >> x1 >> x2
#define in3(x1, x2, x3) cin >> x1 >> x2 >> x3
#define inN(x, N) rep(i, N) in(x[i])
#define outl(x) cout << x << endl
#define out2l(x, y) cout << x << " " << y << endl 

//よく使う関数
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

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

    //標準入力をファイルに変更
    //std::ifstream in("input.txt");
    //std::cin.rdbuf(in.rdbuf());

    string S;
    in(S);

    if (S[2] != S[3])
    {
        outl("No");
        return 0;
    }

    if (S[4] != S[5])
    {
        outl("No");
        return 0;
    }

    outl("Yes");
    return 0;
}

Measured memory_bytes: 3632
h,w,m=map(int, input().split())
a=[0]*m
hc=[0]*w
wc=[0]*h
for i in range(m):
	x,y=map(int, input().split())
	a[i]=[x-1,y-1]
	hc[y-1]+=1
	wc[x-1]+=1
hcm=max(hc)
wcm=max(wc)
hk=[0]*w
wk=[0]*h
for i in range(len(hc)):
	if hc[i]==hcm:
		hk[i]=1
for i in range(len(wc)):
	if wc[i]==wcm:
		wk[i]=1
c=0
for i in range(len(a)):
	if wk[a[i][0]]==1 and hk[a[i][1]]==1:
		c+=1
if c==sum(hk)*sum(wk):
	print(hcm+wcm-1)		
else:
	print(hcm+wcm)

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

int main(void){
    using namespace std;
    int l,r,ans=2018;
    cin>>l>>r;
    if(r-l>=2018 || l%2019-r%2019>0){
        cout<<"0"<<endl;
        return 0;
    }
    for(int i=l%2019;i<r%2019;i++){
        for(int j=i+1;j<=r%2019;j++){
            if(ans>(i*j)%2019)ans=(i*j)%2019;
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define LL long long
#define ULL unsigned long long
#define mem(i, j) memset(i, j, sizeof(i))
#define rep(i, j, k) for(int i = j; i <= k; i++)
#define dep(i, j, k) for(int i = k; i >= j; i--)
#define pb push_back
#define make make_pair
#define INF INT_MAX
#define inf LLONG_MAX
#define PI acos(-1)
using namespace std;

const int N = 1e2 + 5;

const LL mod = 1e9 + 7;

LL ksm(LL a, LL b) { LL ans = 1LL; while(b) { if(b & 1) ans = ans * a % mod; a = a * a % mod; b >>= 1; }  return ans; }


char a[N][N];

int dp[N][N];

void solve() {
    int n, m;
    scanf("%d %d", &n, &m);

    rep(i, 1, n) scanf("%s", a[i] + 1);

    if(a[1][1] == '#') dp[1][1] = 1;

    rep(i, 1, n) rep(j, 1, m) {
        if(i == 1 && j == 1) continue;
        int tmp1 = INF, tmp2 = INF;
        if(i - 1 >= 1) tmp1 = dp[i - 1][j];
        if(j - 1 >= 1) tmp2 = dp[i][j - 1];
        if(i - 1 >= 1 && a[i - 1][j] != a[i][j] && a[i][j] == '#') tmp1++;
        if(j - 1 >= 1 && a[i][j - 1] != a[i][j] && a[i][j] == '#') tmp2++;
        
        dp[i][j] = min(tmp1, tmp2);
        
        
    }
    printf("%d\n", dp[n][m]);
}

int main() {
//    int _; scanf("%d", &_);
//    while(_--) solve();


    solve();

    return 0;
}


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

using namespace std;
typedef long long ll;
#define lp(x,q) for(ll i=x ;i<q;i++)
#define sor(v) sort(v.begin(),v.end())
#define rsor(v) sort(v.rbegin(),v.rend())
#define df vector<ll>
#define minn(v) *min_element(v.begin(),v.end())
#define maxx(v) *max_element(v.begin(),v.end())
#define MY_TORNADO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

#define rev(v) reverse(v.begin(),v.end())
#define print(v) for(auto f:v)cout<<f<<" ";
//Global variable :
ll cou,ans=0,mx=INT_MIN,mn=INT_MAX,sum=0,modu=1e9+7;

//use scanf,printf,getline
int main(){
MY_TORNADO;

char a;
cin>>a;
cout<<char(a+1);
return 0;}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main() {
  int N, K, Q;
  int a[N];
  cin >> N;
  cin >> K;
  cin >> Q;

  for (int i = 0; i < N; i++) {
    a[i] = 0;
  }
  for (int i = 0; i < Q; i++) {
    int x;
    cin >> x;
    a[x - 1] += 1;
  }
  for (int i = 0; i < N; i++) {
    if (Q - a[i] < K) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
  }

  return 0;
}


Measured memory_bytes: 2944
package main

import "fmt"

func main() {
  var H, W int
  var black byte
  fmt.Scan(&H, &W)
  L := make([]string, H)
//  white = 46
  black = 35
  
  for i:=0; i<H; i++ {
      fmt.Scan(&L[i])
  }
  l :=[]int{1,0,-1,0} 
  m :=[]int{0,1,0,-1} 
  
  for i:=0; i<H; i++ {
    for j := 0; j<W; j++ {
      if L[i][j] == black {
        for k:=0;k<4;k++ {
          if i+l[k]<0||i+l[k]>H-1||j+m[k]<0||j+m[k]>W-1 {
            continue
          }
          if L[i+l[k]][j+m[k]] == black {
            break
          }
          if k == 3 {
	        fmt.Println("No")
   	        return
          }
        }
      }
    }
  }
  fmt.Println("Yes")
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#include <algorithm>
#include <string>
using namespace std;
int gcd(int a, int b){
	return (b > 0)? gcd(b, a % b) : a ;
}
// N=4くらいまで書き出して眺めると多項式が見えてくる．証明は帰納法で．
int main() {
	int N; 
	cin >> N; 
	int A[114514] = {}; 
	for(int i = 0; i < N; i++){
		cin >> A[i];
	}
	sort(A, A+N); 
	long long int ans = 1; 
	long long int P = 998244353; 
// 1つずつ順番にかけていくことを考えると以下が帰納法で示せる．
	for(int i = 0; i < N; i++){
		int g = gcd(i, A[i]); 
		ans = (ans * (long long) g) % P; 
	}
	cout << ans << endl;
}

Measured memory_bytes: 640