akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
map<string,int> mp;

int main() {
  int n;
  cin>>n;
  while(n--) {
    string s;
    cin>>s;
    if(!mp.count(s)) {
      mp[s]=1;
    }
  }
  int s=mp.size();
  cout<<s;
  return 0;
}

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

namespace PCK2015
{
	class Question01
	{
		static void Main()
		{
			Console.WriteLine(Console.ReadLine().Split(' ').Select(x => int.Parse(x)).Aggregate(1, (sum, x) => sum * x));
		}
	}
}

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

using lli = long long int;

template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}

template <class T>ostream &operator<<(ostream &o,const pair<T, T>&p)
{o<<"("<<p.first<<", "<<p.second<<")";return o;}

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

map< lli, lli > prime_factor(lli n) {
  map< lli, lli > ret;
  for(lli i = 2; i * i <= n; i++) {
    while(n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if(n != 1) ret[n] = 1;
  return ret;
}

int main(void){
    lli a, b;
    cin >> a >> b;
    auto m = prime_factor(euclidean_gcd(a, b));
    lli c = 1;
    for(auto& i : m){
        if(i.second > 0) c++;
    }
    cout << c << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
int main(void) {
	int n, k, w[100010], sw[100010];
	long long l, r = 0;
	cin >> n >> k;
	for (int i = 0; i < n; i++) {
		cin >> w[i];
		sw[i] = w[i];
		r += w[i];
	}
	sort(sw, sw + n);
	l = sw[n - 1] - 1;
	while (r - l > 1) {
		long long a = 0, b = 1;
		long long m = (r + l) / 2;
		for (int i = 0; i < n; i++) {
			a += w[i];
			if (a > m) {
				a = w[i];
				b++;
			}
			if (i == n - 1 && a > m) {
				b++;
			}
		}
		if (b > k) {
			l = m;
		}
		else {
			r = m;
		}
	}
	cout << r << endl;
	return 0;
}

Measured memory_bytes: 3924
//------------------------------------------
// C++ templete
//------------------------------------------
#include <bits/stdc++.h>
#define int long long
using namespace std;

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef vector<VS> VVS;

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

//container util
//------------------------------------------
#define pb push_back
#define ALL(a) (a).begin(), (a).end()
#define PRINT(V)     \
  for (auto v : (V)) \
  cout << v << " "
#define PRINTL(V)    \
  for (auto v : (V)) \
  cout << v << endl
#define SORT(V) sort((V).begin(), (V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())

//最大公約数
//------------------------------------------
int GCD(int a, int b) { return b ? GCD(b, a % b) : a; }

//grobal variable
//------------------------------------------
int N, M;
VI Vec;

//main
//------------------------------------------
signed main()
{
  int s;
  cin >> s;
  if(s%1000==0){
    cout << 0;
  }else{
    cout << 1000 - (s % 1000);
  }
}

Measured memory_bytes: 3636
#include<iostream>
#include<vector>
#include<algorithm>
#include<cctype>
#include<utility>
#include<string>
#include<cmath>
#include<cstring>

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


int dp[110][10010];
int v[110],w[110];


int main(){

    int N,W;
    cin >> N >> W;
    REP(i,N){
        cin >> v[i] >> w[i];
    }

    memset(dp,0,sizeof(dp));

    //dp[i][j]:= i番目の品物の中から重さがWを超えない品物を選んだ時の価値の最大

  
    for(int i = 1;i <= N;i++){


        for(int j = 0;j <= W;j++){

            if(j < w[i-1]){//使えない
                dp[i][j] = dp[i-1][j];
            }else{
                dp[i][j] = max(dp[i-1][j],dp[i-1][j-w[i-1]]+v[i-1]);
            }
        }
    }
    cout << dp[N][W] << endl;
   

    return 0;
}


Measured memory_bytes: 7404
import sys
sys.setrecursionlimit(1000000)
memo = {0:1}

def fact(x):
  if x in memo:
    return memo[x]
  memo[x] = x * fact(x - 1)
  return memo[x]

def comb(x, y):
  return fact(x) // fact(x - y) // fact(y)

n, k = map(int, input().split())
if n < k:
  print(0)
else:
  print(comb(n - 1, k - 1) % 1000000007)


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

int main() {
  int sx, sy, tx, ty, x, y;
  cin >> sx >> sy >> tx >> ty;
  x = tx - sx; y = ty - sy;

  for (int i=0; i<y; i++) cout << 'U';
  for (int i=0; i<x; i++) cout << 'R';
  for (int i=0; i<y; i++) cout << 'D';
  for (int i=0; i<x; i++) cout << 'L';
  cout << 'L';
  for (int i=0; i<y+1; i++) cout << 'U';
  for (int i=0; i<x+1; i++) cout << 'R';
  cout << 'D';
  cout << 'R';
  for (int i=0; i<y+1; i++) cout << 'D';
  for (int i=0; i<x+1; i++) cout << 'L';
  cout << 'U' << endl;

  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>

int main(void) {
	char str1[201], str2[201];
	bool flag;
	int i, j, count;

	while(1) {
		scanf("%s", str1);
		if(str1[0] == '.' && str1[1] == '\0') break;
		scanf("%s", str2);

		if(strcmp(str1, str2) == 0){
			printf("IDENTICAL\n");
			continue;
		}

		flag = false;
		i = j = count = 0; 
		while(str1[i] != '\0' || str2[j] != '\0') {
			if(str1[i] != str2[j]) {
				if(flag == false) {
					count = 2;
					break;
				} else{
					if(++count >= 2) break;
					flag = false;
					while(str1[i] != '"') i++;
					while(str2[j] != '"') j++;
				}
			} else if(str1[i] == '"' && str2[j] == '"') {
				flag = !flag;
			}
			i++; j++;
		}//endwhile

		if(count == 1){
			printf("CLOSE\n");
		} else{
			printf("DIFFERENT\n");
		}

	}//endwhile
	return 0;
}


Measured memory_bytes: 2668
N,A,B,C,D=map(int,input().split())
DP=[[0]*(N+1) for i in range(B+1)]
mod=10**9+7

def perm(n,r):
  global mod,g1,g2
  if r<0:
    return g1[n]
  if n<r:
    return 0
  return g1[n]*g2[n-r]%mod

g1=[1,1]
g2=[1,1]
inv=[0,1]
for i in range(2,1000003):
  g1.append((g1[-1]*i)%mod)
  inv.append((-inv[mod%i]*(mod//i))%mod)
  g2.append((g2[-1]*inv[-1])%mod)
DP[A-1][0]=1
for i in range(A,B+1):
  for j in range(N+1):
    DP[i][j]=DP[i-1][j]
    for k in range(C,min(D,j//i)+1):
      DP[i][j]=(DP[i][j]+DP[i-1][j-i*k]*perm((N-j+i*k),i*k)*pow(g2[i],k,mod)*g2[k])%mod
print(DP[B][N])

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

using namespace std;

typedef long long ll;

int main(int argc, char *argv[]) {
  int n, m;
  cin >> n >> m;
  vector<ll> a(2 * m + 2), b(2 * m + 2), v(n);
  for (int i = 0; i < n; ++i) {
    cin >> v[i];
  }
  vector<pair<int, ll>> c;
  ll sum = 0;
  for (int i = 1; i < n; i++) {
    int x = v[i - 1], y = v[i];
    if (x > y) y += m;
    sum += y - x;
    a[x + 2]++, a[y + 1]--;
    b[y + 1] -= (y - x - 1);
  }
  for (int i = 1; i <= 2 * m; i++) {
    a[i] += a[i - 1];
  }
  for (int i = 1; i <= 2 * m; i++) {
    a[i] = (a[i - 1] + b[i] + a[i]);
  }
  ll mx = 0;
  for (int i = 1; i <= m; i++) {
    mx = max(mx, a[i] + a[i + m]);
  }
  cout << sum - mx << endl;
  return 0;
}


Measured memory_bytes: 4096
// Aizu 2489: Palindromic Number
// 2017.9.25 bal4u@uu
// ??°?????????????????¨??????????????????????????????????????°??????????????????
#include <stdio.h>
#include <string.h>

int decNumber(char *n, int len)
{
	char *p;

	if (len == 1 && *n == '0') return 0;
	p = n + len;
	while (1) {
		(*--p)--;
	    if (*p >= '0') break; else *p = '9';
	}
	if (len > 1 && *n == '0') {
		p = n + 1;
		do *(p-1) = *p;	while (*p++);
		len--;
	}
	return len;
}

int incNumber(char *n, int len)
{
	char *p;

	p = n + len;
	while (--p >= n) {
		(*p)++;
	    if (*p <= '9') break;
	    *p = '0';
	}
	if (p < n) {
		p = n + len; *(p+1) = 0;
		while (--p >= n) *(p+1) = *p;
		*n = '1';
		len++;
	}
	return len;
}

int palindromic(char *n, int len)
{
	char *p = n + len - 1;
	while (p >= n) {
		if (*p-- != *n++) return 0;
	}
	return 1;
}

int main()
{
	int nlen, ilen, dlen;
	char n[100], inc[100], dec[100];

	scanf("%s", n), nlen = strlen(n);
	if (palindromic(n, nlen)) { puts(n); return 0; }
	strcpy(inc, n), ilen = nlen;
	strcpy(dec, n), dlen = nlen;
	while (1) {
		dlen = decNumber(dec, dlen);
		if (dlen > 0 && palindromic(dec, dlen)) { puts(dec); break; }
		ilen = incNumber(inc, ilen);
		if (palindromic(inc, ilen)) { puts(inc); break; }
	}
	return 0;
}

Measured memory_bytes: 1820
words = %w[dream dreamer erase eraser]
text = gets.strip
result = 'YES'

until text.size == 0
  deleted = false
  words.each do |w|
    next unless text[-w.size, w.size] == w
    text = text[0..-(w.size + 1)]
    deleted = true
  end
  unless deleted
    result = 'NO'
    break
  end
end

puts result

Measured memory_bytes: 61648
import sys


inint = lambda: int(sys.stdin.readline())
inintm = lambda: map(int, sys.stdin.readline().split())
inintl = lambda: list(inintm())
instr = lambda: sys.stdin.readline()
instrm = lambda: map(str, sys.stdin.readline().split())
instrl = lambda: list(instrm())

n = inint()
A = []
for _ in range(n):
    A.append(inint())

sorted_A = sorted(A)[::-1]

for a in A:
    if a != sorted_A[0]:
        print(sorted_A[0])
    else:
        print(sorted_A[1])


Measured memory_bytes: 84144
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <assert.h>
#include <memory.h>
#include <queue>
#include <string.h>
using namespace std;

#define N 100002
int a[N],val[N];
long long ret[N];
int f(int x,int y,int m) {
  if(x<y) {
    return y-x;
  }
  return m + y-x;
}
vector<pair<int,int> > st[N];
void solve() {
  int n,m;scanf("%d %d ", &n,&m);
  for(int i=0;i<n;++i) {
    scanf("%d ", &a[i]);
  }
  priority_queue<pair<int,int>,vector<pair<int,int> >,greater<pair<int,int> > >pq;
  long long curValue = 0;
  for(int i=0;i<n-1;++i) {
    int val = f(a[i],a[i+1],m);
    if(a[i]<a[i+1]) {
      curValue += val;
      st[a[i]].push_back(make_pair(a[i+1],val));
    } else {
      curValue += a[i+1];
      pq.push(make_pair(a[i+1],val));
      st[a[i]].push_back(make_pair(m+2,val));
    }
  }
  long long R = 1e18;
  for(int i=1;i<=m;++i) {
    while(!pq.empty()) {
      int lim = pq.top().first, val = pq.top().second;
      if(lim<i) {
        curValue += val;
        pq.pop();
      } else {
        break;
      }
    }
    R = min(R, curValue);
    while(!st[i].empty()) {
      pq.push(st[i].back());
      ++curValue;
      st[i].pop_back();
    }
    curValue -= pq.size();
  }
  printf("%lld\n", R);
}

int main() {
  //freopen("input.txt","r",stdin);
  solve();
  return 0;
}


Measured memory_bytes: 6132
#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations,permutations,accumulate # (string,3) 3回
#from collections import deque
from collections import deque,defaultdict,Counter
import decimal
import re
#import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#
# my_round_int = lambda x:np.round((x*2 + 1)//2)
# 四捨五入
import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7
#mod = 9982443453
def readInts():
  return list(map(int,input().split()))
def I():
  return int(input())
n = I()
A = [I() for i in range(n)]
print(len(list(set(A))))


Measured memory_bytes: 10420
import itertools
while True:
    n = int(input())
    if n == 0:
        break
    time = [0]*(60*60*24)
    for _ in range(n):
        h, c = input().split()
        l = 60*60*int(h[0:2]) + 60*int(h[3:5]) + int(h[6:8])
        r = 60*60*int(c[0:2]) + 60*int(c[3:5]) + int(c[6:8])
        time[l] += 1
        time[r] -= 1
    cumsum = list(itertools.accumulate(time))
    print(max(cumsum))


Measured memory_bytes: 12584
#include <iostream>
#include <vector>
#include <string>
#include <tuple>
#include <algorithm>
#include <numeric>
#include <climits>
#include <map>
#include <functional>
#include <cmath>
#include <cassert>
#include <set>

using namespace std;

template<typename T>inline T get(){T x;cin>>x;return x;}

vector<int> get_divisors(int n)
{
    int d = 1;
    vector<int> res;
    int ulimit = sqrt(n);

    while (d <= ulimit) {
        if (n % d == 0) {
            res.push_back(d);
            if (n/d != d)
                res.push_back(n/d);
        }
        d++;
    }
    sort(res.begin(), res.end());
    return res;
}

int main()
{
    int n = get<int>(), m = get<int>();
    auto divisors = get_divisors(m);
    int ans;
    for (int i = divisors.size()-1; i >= 0; i--) {
        if (divisors[i] <= m/n) {
            ans = divisors[i];
            break;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include<string>
using namespace std;
 
int main(){
  int N;
  int D, X;
  cin >> N;
  cin >> D >> X;
  
  int A;
  for (int i = 0; i < N; i++){
      cin >> A;
      int day = 1;
      int count = 0;
      while (day <= D){
          X++;
          count++;
          day = count * A + 1;
      }
  }
  cout << X << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define re(i,n) for(int i=0;i<n;++i)
#define rep(i,l,r) for(int i=l;i<=r;i++)
#define red(i,r,l) for(int i=r;i>=l;i--)
#define db(x) cout<<#x<<"="<<(x)<<" "
#define el cout<<endl
using namespace std;
const int MXN = 510, MXM = 200010, mol = 1e9 + 7;

long long K;
char ch[MXN]; int l;
int main() {
	cin >> ch;
	l = strlen(ch);
	cin >> K;
	for (int i = 0; i < l; ++i)
	{
		if (i + 1 == K) {
			putchar(ch[i]);
			return 0;
		}
		if (ch[i] != '1')
		{
			putchar(ch[i]);
			return 0;
		}
	}
	return 0;
}


Measured memory_bytes: 256
//https://atcoder.jp/contests/dp/tasks/dp_i
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
#ifdef BTK
#define DEBUG if(1)
#else
#define CIN_ONLY if(1)
struct cww {cww() {CIN_ONLY{ios::sync_with_stdio(false); cin.tie(0);}}}star;
#define DEBUG if(0)
#endif
#define ALL(v) (v).begin(),(v).end()
#define REC(ret, ...) std::function<ret (__VA_ARGS__)>
template <typename T>inline bool chmin(T &l, T r){bool a = l>r; if (a)l = r; return a;}
template <typename T>inline bool chmax(T &l, T r){bool a = l<r; if (a)l = r; return a;}
template <typename T>istream& operator>>(istream &is, vector<T> &v){for (auto &it : v)is >> it;return is;}
class range {private: struct I { int x; int operator*() { return x; }bool operator!=(I& lhs) { return x<lhs.x; }void operator++() { ++x; } }; I i, n;public:range(int n) :i({ 0 }), n({ n }) {}range(int i, int n) :i({ i }), n({ n }) {}I& begin() { return i; }I& end() { return n; }};


int main(){
    int N;
    cin>>N;
    vector<double> dp(N+1);
    dp[0]=1;
    for(int i:range(N)){
        vector<double> nxt(N+1);

        double p;
        cin>>p;
        for(int j:range(i+1)){
            nxt[j+1]+=dp[j]*p;
            nxt[j]+=dp[j]*(1-p);
        }
        swap(dp,nxt);
    }
    double ret=0;
    for(int i:range(N/2+1,N+1))ret+=dp[i];
    cout<<fixed;
    cout<<setprecision(10);
    cout<<ret<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void)

{
	int a,h,m,s;
	scanf("%d",&a);

	h=a/3600;
	m=(a%3600)/60;
	s=(a%3600)%60;


	printf("%d:%d:%d\n",h,m,s);

	return 0;

}

Measured memory_bytes: 592
#include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;

int D, n, m;

int compute(int d[], int k){
    int *pos, idx, x;
    
    pos = lower_bound(d, d + n, k);
    idx = distance(d, pos);
    x = min((k + D - d[(idx - 1) % n]) % D, (d[idx % n] + D - k) % D );
    return x;
}

int main() {
    while(cin >> D){
        if ( D == 0 ) return 0;
        cin >> n >> m;
        int d[n], k, x = 0;
        d[0] = 0;
        for ( int i = 1; i < n; i++ ){
        cin >> d[i];
        }
        sort(d, d + n);
        for ( int i = 0; i < m; i++ ){
        cin >> k;
        x += compute(d, k);
        }
    
        cout << x << endl;
    }
    return 0;
}


Measured memory_bytes: 3556
import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int q = scan.nextInt();
		for(int i = 0; i < q; i++) {
			double[]p0 = new double[2];
			double[]p1 = new double[2];
			double[]p2 = new double[2];
			double[]p3 = new double[2];
			p0[0] = scan.nextInt();
			p0[1] = scan.nextInt();
			p1[0] = scan.nextInt();
			p1[1] = scan.nextInt();
			p2[0] = scan.nextInt();
			p2[1] = scan.nextInt();
			p3[0] = scan.nextInt();
			p3[1] = scan.nextInt();
			double[]h1 = project(p0, p1, p2);
			double[]h2 = project(p0, p1, p3);
			double d1 = Math.sqrt(norm(vec(p2, h1)));
			double d2 = Math.sqrt(norm(vec(p3, h2)));
			double t = d1 / (d1 + d2);
			double[]u = vec(p2, p3);
			double x = u[0] * t + p2[0];
			double y = u[1] * t + p2[1];
			//double[]p = getCrossPoint(p0, p1, p2, p3);
			System.out.println(x + " " + y);
		}
		scan.close();
	}
	static double[] getCrossPoint(double[]p1, double[]p2, double[]p3, double[]p4) {
		double[]base = vec(p3, p4);
		double d1 = Math.sqrt(Math.abs(cross(base, vec(p3, p1))));
		double d2 = Math.sqrt(Math.abs(cross(base, vec(p3, p2))));
		double t = d1 / (d1 + d2);
		double[]p = {p1[0] + (p3[0] - p1[0]) * t, p1[1] + (p3[1] - p1[1]) * t};
		return p;
	}
	static double[] project(double[]p1, double[]p2, double[]p3) {
		double[]base = vec(p1, p2);
		double[]u = vec(p1, p3);
		double r = dot(u, base) / norm(base);
		double x = p1[0] + base[0]  * r;
		double y = p1[1] + base[1]  * r;
		double[]h = {x, y};
		return h;
	}
	static double norm(double[]p) {
		return p[0] * p[0] + p[1] * p[1];
	}
	static double[] vec(double[]p1, double[]p2) {
		double[]u = {p2[0] - p1[0], p2[1] - p1[1]};
		return u;
	}
	static double dot(double[]u, double[]v) {
		return u[0] * v[0] + u[1] * v[1];
	}
	static double cross(double[]u, double[]v) {
		return u[0] * v[1] - u[1] * v[0];
	}
}


Measured memory_bytes: 40340
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 1000000000000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


struct LOC{
	LOC(int arg_row,int arg_col){
		row = arg_row;
		col = arg_col;
	}
	int row,col;
};

int H,W;
int diff_row[4] = {-1,0,0,1},diff_col[4] = {0,-1,1,0};
char buf[25][25];
int table[25][25];


bool rangeCheck(int row,int col){

	return row >= 0 && row <= H-1 && col >= 0 && col <= W-1;
}


int main(){

	scanf("%d %d",&H,&W);

	for(int row = 0; row < H; row++){
		scanf("%s",buf[row]);
	}

	int maximum = 0;

	queue<LOC> Q;

	for(int st_row = 0; st_row < H; st_row++){
		for(int st_col = 0; st_col < W; st_col++){
			if(buf[st_row][st_col] == '#')continue;

			for(int row = 0; row < H; row++){
				for(int col = 0; col < W; col++){

					table[row][col] = BIG_NUM;
				}
			}

			table[st_row][st_col] = 0;
			Q.push(LOC(st_row,st_col));

			while(!Q.empty()){

				for(int i = 0; i < 4; i++){

					int adj_row = Q.front().row+diff_row[i];
					int adj_col = Q.front().col+diff_col[i];

					if(rangeCheck(adj_row,adj_col) == false || buf[adj_row][adj_col] == '#')continue;

					int next_dist = table[Q.front().row][Q.front().col]+1;
					if(table[adj_row][adj_col] <= next_dist)continue;

					table[adj_row][adj_col] = next_dist;
					Q.push(LOC(adj_row,adj_col));
				}

				Q.pop();
			}

			for(int row = 0; row < H; row++){
				for(int col = 0; col < W; col++){
					if(buf[row][col] == '#')continue;

					maximum = max(maximum,table[row][col]);
				}
			}
		}
	}

	printf("%d\n",maximum);

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define repz(i, z, n) for (decltype(n) i = (z); i < (n); i++)
#define rep(i, n) for (decltype(n) i = 0; i < (n); i++)

#define REPZ(i, z, n) for (decltype(n) i = (z); i <= (n); i++)
#define REP(i, n) for (decltype(n) i = 0; i <= (n); i++)
#define ALL(v) v.begin(), v.end()
#define SIZE(v) ((ll)(v).size())
#define MAX(v) (*max_element(ALL(v)))
#define MIN(v) (*min_element(ALL(v)))
#define INF 1000000000000  // 1E+12

// 略
#define PB push_back
#define F first
#define S second
#define MP make_pair
#define READ cin >>
#define PRINT cout <<
#define PYES cout << "Yes" << endl;
#define POK cout << "OK" << endl;
#define PNO cout << "No" << endl;
#define PNG cout << "NG" << endl;

using namespace std;

// デバッグ用
void debug_out() { cout << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cout << H << " ";
  debug_out(T...);
}

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; }

#ifdef _DEBUG
#define debug(...) debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif

// typedef
typedef long long ll;
typedef unsigned long long ul;
typedef long double ld;

// const
// 円周率
const double pi = M_PI;
// mod用
// 1E+9 +7
const ll mod = (int)1e+9 + 7;
// 1s間で可能なループ回数2E+8回
// int        最大値2147483647         〜2E+9
// long long  最大値9223372036854775807〜9E+18
// 総和accumulate
// 単純リストvector<type> push_back
// 連想配列map<key,value> insert,
// 集合set<type>
// pair キーとバリューを格納 firstとsecondでアクセス
// 小数点指定 cout << fixed << setprecision(15) << endl;
// to_string<->stoi
// stoll(longlong)
// stod(double)
// deep copy v1->v2 copy(v1.begin(), v1.end(), back_inserter(v2) );
// 大文字65-90(-32)
// 小文字97-122(+32)

int main() {
  // faster
  // C言語流の入出力は使用できない
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  set<int> a;
  rep(i,3){
    int temp; cin >> temp;
    a.insert(temp);
  }
  if(a.size()==2){
    PYES
  }else{
    PNO}

  return 0;
}


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

using namespace std;
typedef long long ll;
const int INF = 1e9;

int main(){
	ll T = 1;
	//cin >> T;
	while (T--){
     int x; int y;
     cin >> x >> y;
     int a = y % 2;
     if (a > 0) {
		 cout << "No" << endl;
		 return 0;
	 } else if (y > x*4) {
		 cout << "No" << endl;
		 return 0;
	 } else {
	 int b = x; int c = 0;
	 while (b >= 0){
	 if (b*4 + c*2 == y) {
		 cout << "Yes" << endl;
		 return 0;
	 } else {
	 c++; b--; }
     } 
     cout << "No" << endl;

}
	  
	}
}
	

Measured memory_bytes: 3612
import java.util.Scanner;

 
public class Main {
 
	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		long a = sc.nextLong();
		long b = sc.nextLong();

		long temp;
		long c = a;
		c *= b;
		while((temp = a%b) != 0) {
			a = b;
			b = temp;
		}
			
		System.out.print(c / b);
		sc.close();
	}
}


Measured memory_bytes: 35732
////////////////////////////////////////////    _LeMur_
#pragma GCC optimize("Ofast,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#define _CRT_SECURE_NO_WARNINGS
#include <unordered_map>
#include <unordered_set>
#include <functional>
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cassert>
#include <chrono>
#include <random>
#include <bitset>
#include <cstdio>
#include <vector>
#include <string>
#include <ctime>
#include <stack>
#include <queue>
#include <cmath>
#include <list>
#include <map>
#include <set>

using namespace std;

const int N = 100005;
const int inf = 1000 * 1000 * 1000;
const int mod = 1000 * 1000 * 1000 + 7;

int a , b , c;

int main(){
	mt19937 myrand(chrono::steady_clock::now().time_since_epoch().count());
    cin >> a >> b >> c;
    if(c + b > a)
        cout << c - (a - b) << endl;
    else
        cout << 0 << endl;
    return 0;
}


Measured memory_bytes: 888
a=[input().split() for _ in range(3)]
n=int(input())
b=[input() for _ in range(n)]
for i in range(3):
    for j in range(3):
        for k in range(n):
            if a[i][j]==b[k]:
                a[i][j]='0'
ans="No"
for i in range(3):
    if a[i][0]==a[i][1]==a[i][2]:
        ans="Yes"
    if a[0][i]==a[1][i]==a[2][i]:
        ans="Yes"
if a[0][0]==a[1][1]==a[2][2]:
    ans="Yes"
if a[0][2]==a[1][1]==a[2][0]:
    ans="Yes"
print(ans)

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

#define ALL(v) v.begin(), v.end()
#define V vector
#define P pair
typedef long long ll;
const int INT_INF = 1e9;
const ll INF = 1LL << 30;
const ll MOD = 1e9 + 7;


int main() {
    int n, k; cin >> n >> k;
    string s; cin >> s;

    int cnt = 0;
    for(int i = 0; i < n - 1; i++){
        if(s[i] == s[i + 1]) cnt++;
    }

    int ans = min(cnt + 2 * k, n - 1);
    cout << ans << endl;
}


Measured memory_bytes: 512
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
using namespace std;

/*BigInteger
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/rational.hpp>
namespace xxx = boost::multiprecision;
using Bint = xxx::cpp_int;
using Real = xxx::number<xxx::cpp_dec_float<1024>>;
*/

#define int long long
#define pb(x) push_back(x)
#define m0(x) memset((x), 0LL, sizeof(x))
#define mm(x) memset((x), -1LL, sizeof(x))

//container
#define ALL(x) (x).begin(), (x).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define EACH(i, c) for (typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define EXIST(s, e) ((s).find(e) != (s).end())
#define UNIQUE(v) (v).erase(unique((v).begin(), (v).end()), (v).end());
#define PERM(c) \
  sort(ALL(c)); \
  for (bool c##p = 1; c##p; c##p = next_permutation(ALL(c)))

// debug
#define GET_VAR_NAME(variable) #variable
#define test(x) cout << GET_VAR_NAME(x) << " = " << x << endl;

// bit_macro
#define Bit(n) (1LL << (n))
#define Bitset(a, b) (a) |= (1LL << (b))
#define Bitunset(a, b) (a) &= ~(1LL << (b))
#define Bitcheck(a, b) ((((a) >> (b)) & 1LL) == 1LL)
#define Bitcount(a) __builtin_popcountll((a))

//typedef
typedef long long lint;
typedef unsigned long long ull;
typedef complex<long double> Complex;
typedef pair<int, int> P;
typedef tuple<int, int, int> TP;
typedef vector<int> vec;
typedef vector<vec> mat;

//constant
constexpr int INF = (int)1e18;
constexpr int MOD = (int)1e9 + 7;
constexpr double PI = (double)acos(-1);
constexpr double EPS = (double)1e-10;
constexpr int dx[] = {-1, 0, 0, 1, 0, -1, -1, 1, 1};
constexpr int dy[] = {0, -1, 1, 0, 0, 1, -1, 1, -1};

//
template <typename T>
void chmax(T &a, T b) { a = max(a, b); }
template <typename T>
void chmin(T &a, T b) { a = min(a, b); }
//
inline int toInt(string s) {
  int v;
  istringstream sin(s);
  sin >> v;
  return v;
}
template <class T>
inline string toString(T x) {
  ostringstream sout;
  sout << x;
  return sout.str();
}

//
struct Accelerate_Cin {
  Accelerate_Cin() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(20);
  };
} Accelerate_Cin;

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

  int sub = 1;
  for (int i = 0; i < N; i++) {
    if (A[i] % 2 == 0) {
      sub *= 2;
    }
  }

  cout << (int)pow(3, N) - sub << endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<algorithm>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<set>
#include<map>
#include<iomanip>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<ll,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define fi first
#define sc second
#define rep(i,x) for(ll i=0;i<x;i++)
#define repn(i,x) for(ll i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())

const int MAX = 510000;
const int MOD = 1000000007;

int main(){
  ll N, A, B, C; cin >> N >> A >> B >> C;
  vector<ll> tmp(3);
  tmp[0] = A; tmp[1] = B; tmp[2] = C;
  vector<ll> a(N);
  rep(i,N){
    string s; cin>>s;
    if(s == "AB") a[i] = 0;
    if(s == "AC") a[i] = 2;
    if(s == "BC") a[i] = 1;
  }

  vector<ll> action(N);

// 操作
  rep(i,N){
    if(tmp[a[i] % 3] < tmp[ (a[i] + 1) % 3] ){
      tmp[a[i] % 3]++;
      tmp[ (a[i] + 1) % 3]--;
      action[i] = a[i];
    }
    else if( tmp[a[i] % 3] == tmp[ (a[i] + 1) % 3] ){
      // 例外
      if(a[i] == a[i + 1] or i == N - 1){
        tmp[a[i] % 3]++;
        tmp[ (a[i] + 1) % 3]--;
        action[i] = a[i];
      }
      else{
        // 次にある方をふやす
        if( (a[i] + a[i + 1] ) % 3 == 0 ){
          // Cを増加
          tmp[2]++;
          tmp[ ( a[i + 1] + 2 ) % 3]--;
          action[i] = 2;
        }
        else if( (a[i] + a[i + 1] ) % 3 == 1 ){
          // Bを増加
          tmp[1]++;
          tmp[ ( a[i + 1] + 2 ) % 3]--;
          action[i] = 1;
        }
        else{
          // Aを増加
          tmp[0]++;
          tmp[ ( a[i + 1] + 2 ) % 3]--;
          action[i] = 0;
        }
      }
    }
    else{
      tmp[a[i] % 3]--;
      tmp[ (a[i] + 1) % 3]++;
      action[i] = (a[i] + 1) % 3;
    }


    // cout << action[i] << " " << tmp[0] << " " << tmp[1] << " " << tmp[2] << endl;
    if(tmp[0] < 0 or tmp[1] < 0 or tmp[2] < 0){
      cout<<"No"<<endl;
      return 0;
    }
  }
  cout<<"Yes"<<endl;
  rep(i,N){
    if(action[i] == 0) cout<<"A"<<endl;
    else if(action[i] == 1) cout<<"B"<<endl;
    else cout<<"C"<<endl;
  }

}


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

int main() {
  int N, X;
  cin >> N >> X;

  int D = 0, count = 1;
  for (int i = 0; i < N; i++) {
    int L;
    cin >> L;

    D += L;

    if (D <= X) {
      count++;
    } else {
      break;
    }
  }

  cout << count << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int             long long int
#define pb              push_back
#define se              second
#define mp              make_pair
#define fi              first
#define del(a,vec)      vec.erase(std::remove(vec.begin(), vec.end(), a), vec.end());
#define search(f,l,v)   binary_search(f,l,v)
#define iter(a,b)       vector<int>::iterator a,b
#define lower(v,num)    lower_bound (v.begin(), v.end(), num);
#define upper(v,num)    upper_bound (v.begin(), v.end(), num); 
#define removecopy(a)   unique(a.begin(), a.end()); 
#define vi              vector<int> 
#define pi              pair<int,int>    
#define vpi             vector<pi>      
#define mlbb            ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)    
int mod =1000000007;
namespace Rahul{
    bool isPrime(int n) 
    {if (n <= 1)  return false; if (n <= 3)  return true; 
    if (n%2 == 0 || n%3 == 0) return false; 
    for (int i=5; i*i<=n; i=i+6) 
        if (n%i == 0 || n%(i+2) == 0) 
           return false; 
    return true; }
    int pow (int x, int n,int mod) {//calculate x^n
    if (n == 0) return 1;

    int res = pow (x, n / 2,mod);

    res = (res * res) % mod;
    if (n % 2) res = (res * x ) % mod;

    return res;
    }
    int _gcd(int a,int b)
    {
        if(a==0)
            return b;
        else    
            return _gcd(b%a,a);
    }
    //s.erase(s.find(2)) where s={1,2,3,3,2}; 
};
using namespace Rahul;
int find(int n)
{
    int co=0;
    while(n)
    {
        if(n%10==0) 
        co++;
        n/=10;
    }
    return co;
}
int find2(int n){
   
        int co=0;
        while(n){
            n=n/10;
            co++;
        }
   return co;
}
int first(int n){
    int num;
    while(n)
        {
            num=n;
            n=n/10;
            
        }
    return   num;  
}
int32_t main()
{
        
     mlbb;   
      int N;
    cin>>N;
    int  five[10000];
    for(int i = 1;i<=30;i++){
        five[i] = pow(5,i)*2;
    }
    int ans = 0;
    for(int i = 1;i<30;i++){
        ans += N/five[i];
    }
    if(N%2 == 1){
        cout << 0 << endl;
    }
    else{
        cout << ans << endl;
    }
    return 0;
    
   
   
     
    
     
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
int main(){
int a,b,c;
cin>>a>>b;
cin>>c;
if(a>b){
    if(c%a==0){
        cout<<c/a<<endl;
    }
    else{cout<<(c/a)+1<<endl;}
}
else{
    if(c%b==0){
        cout<<c/b<<endl;
    }
    else{cout<<(c/b)+1<<endl;}
}
    return 0;
}

Measured memory_bytes: 3548
#include<bits/stdc++.h>
#define ll long long
#define pii pair<int,int>
#define PI 2*acos(0)
#define INF 1e17
#define mx 2*1000000+5
using namespace std;
const ll int p=1000000007;
ll int mod(ll int a,ll int b)
{
    ll int m=a%b;
    if(m<0) m=(b<0)?(m-b):(m+b);
    return m;
}
ll int pro(ll int a[],ll int n,ll int k)
{
    ll int it,res=1,i,j,left,right;
    sort(a,a+n);
    if(a[n-1]==0 && k%2==1) return 0;
    if(a[n-1]<0 && k%2==1){
        for(i=n-1;i>=n-k;i--){
            res*=mod(a[i],p);
            res=mod(res,p);
        }
        return res;
    }
    i=0;j=n-1;
    if(k%2){
        res*=mod(a[j],p);
        res=mod(res,p);
        j--;
        k--;
    }
    k/=2;
    for(it=0;it<k;it++){
        left=a[i]*a[i+1];
        right=a[j]*a[j-1];
        if(left>=right){
            res*=mod(left,p);
            res=mod(res,p);
            i+=2;
        }
        else{
            res*=mod(right,p);
            res=mod(res,p);
            j-=2;
        }
    }
    return res;
}
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    ll int i,j,n,k;
    cin>>n>>k;
    ll int a[n];
    for(i=0;i<n;i++) cin>>a[i];
    cout<<pro(a,n,k)<<endl;
    return 0;
}


Measured memory_bytes: 5228
#include <algorithm>
#include <bitset>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <tuple>
#include <vector>

using namespace std;

#define rep(i, n) for (int64_t i = 0; i < (int64_t)(n); i++)
#define irep(i, n) for (int64_t i = 0; i <= (int64_t)(n); i++)
#define rrep(i, n) for (int64_t i = (n)-1; i >= 0; i--)
#define rirep(i, n) for (int64_t i = n; i >= 0; i--)

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

  vector<int> b(N, 0);
  rep(i, N - 1) {
    int a;
    cin >> a;
    a--;
    b[a]++;
  }

  rep(i, N) { cout << b[i] << "\n"; }

  return 0;
}

Measured memory_bytes: 3676
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
const long long INF = numeric_limits<long long>::max();
typedef long long ll;

void trace(vector<int> a, int n)
{
    for(int i=0; i<n; i++){
        if (i == n-1) cout << a[i] << endl;
        else cout << a[i] << " ";
    }
}
void insertation_sort(vector<int> &a, int n)
{
    for(int i=1; i<n; i++){
        int v = a[i];
        int j = i - 1;
        while(1){
            if(j < 0 || v > a[j]) break;
            a[j+1] = a[j]; 
            j--;
        }
        a[j+1] = v;
        trace(a, n);
    }
}
int main()
{
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    trace(a, n);
    insertation_sort(a, n);
    return 0;
}


Measured memory_bytes: 3172
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long int
using namespace __gnu_pbds;
typedef tree<pair<ll,pair<ll,ll> >, null_type, less<pair<ll,pair<ll,ll> > >, rb_tree_tag, tree_order_statistics_node_update>ordered_set;
#define me BOSS
#define bug() cout<<"AIkahne aise"<<endl
#define PI acos(-1)
/* Precode Start Here *\
     Sieve
void sieve()
{
    for(ll i=3; i<=2000; i+=2)
    {
        for(ll j=i*i; j<=4000000; j+=i)
            A[j]=1;
    }
    v.push_back(2);
    for(ll i=3; i<=4000000; i+=2)
        if(A[i]==0)
            v.push_back(i);
}

     Power Function Modulo P

ll modPow(ll a, ll x, ll p) {
    //calculates a^x mod p in logarithmic time.
    long res = 1;
    while(x > 0) {
        if( x % 2 != 0) {
            res = (res * a) % p;
        }
        a = (a * a) % p;
        x /= 2;
    }
    return res;
}


   factorial

ll fact(ll n)
{
    ll ans=1;
    for(ll i=1;i<=n;i++)
    {
        ans=(ans*i)%mod;
    }
    return ans;
}
     Calculating nCr using Fermats law Theorem

ll modInverse(ll a, ll p) {
    //calculates the modular multiplicative of a mod m.
    //(assuming p is prime).
    return modPow(a, p-2, p);
}


ll modBinomial(ll n, ll k, ll p) {
// calculates C(n,k) mod p (assuming p is prime).

    ll numerator = 1; // n * (n-1) * ... * (n-k+1)
    for (ll i=0; i<k; i++) {
        numerator = (numerator * (n-i) ) % p;
    }

    ll denominator = 1; // k!
    for (ll i=1; i<=k; i++) {
        denominator = (denominator * i) % p;
    }

    // numerator / denominator mod p.
    return ( numerator* modInverse(denominator,p) ) % p;
}
     num of divisor and euler totient

ll phi[1000001],mark[1000001],divi[1000001];;
void divisorPhi(ll n)
{
    for(int i=1;i<=n;i++)
        phi[i]=i;
    for(int i=2;i<=n;i++)
    {
        if(!mark[i])
        {
            for(int j=i;j<=n;j+=i)
            {
                mark[j]=1;
                phi[j]*=(1-1/(double)i);
            }
        }
    }
    for(ll i=1;i<=n;i++)
    {
        for(ll j=i;j<=n;j+=i)
            divi[j]++;
    }
}
/* Precode Ends */
#define mod 1000000007
ll A[5000001],B[5000001];
vector<ll>v;
map<ll,ll>myMap;
set<ll>mySet;
vector<pair<ll,ll> >vp;
priority_queue<ll> pq;
priority_queue<ll, vector<ll>, std::greater<ll> > first;
ll po(ll a,ll n)
{
  ll ans=1;
  for(int i=1;i<=n;i++)
       ans*=a;
    return ans;
}

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

 ll n,ans=0;
 cin>>n;
 for(int i=1;i<=n;i++)
 {
     ll d=n/i;
     ans+=(d*(d+1)/2)*i;
 }
 cout<<ans<<endl;

return 0;
}



Measured memory_bytes: 3644
#include <algorithm>
#include <math.h>
#include <iostream>
#include <utility>
#include <set>
using namespace std;

int min(int a,int b){
    if (a<b) return a;
    else return b;
}
        

int main() {
    int n; cin >> n;
    int odd1[100010]={0};
    int odd2[100010]={0};
    int even1[100010]={0};
    int even2[100010]={0};
    set <int> s;
    for (int i=0; i<n; i++){
        int a;
        cin >> a;
        if (i%2 != 0) {
            odd1[a]++;
            odd2[a]++;
        }
        else {
            even1[a]++;
            even2[a]++;
        }
        s.insert(a);
    }
    sort(odd1,odd1+100010);reverse(odd1,odd1+100010);
    sort(even1,even1+100010);reverse(even1,even1+100010);
    
    int a1,a2;
    for (int i=0; i<100010;i++){
        if (odd2[i] == odd1[0]) {
            a1 = i;
            break;
        }
    }
    for (int i=0; i<100010;i++){
        if (even2[i] == even1[0]) {
            a2 = i;
            break;
        }
    }
    
    if (a1 != a2)
        cout << n - odd1[0]-even1[0];
    else
        cout << min(n - odd1[0] - even1[1],n - even1[0] - odd1[1])<< endl;
    
    
        
    
    
    return 0;
}


Measured memory_bytes: 6528
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define pi M_PI
#define R cin>>
#define Z class
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define REP(i,m,n) for(int i=(int)(m);i<(int)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
template<Z A>void pr(A a){cout<<a;ln;}
template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);}
template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);}
template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);}
template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}
const ll MAX=1000000007,MAXL=1LL<<61,dy[4]={1,0,-1,0},dx[4]={0,1,0,-1};
typedef pair<int,int> P;

void Main() {
  int x1,x2,y1,y2;
  cin >> x1 >> y1 >> x2 >> y2;
  string s="",r="UDDU",r2="RLLR";
  rep(i,4) {
    int xa=x1+dx[i],ya=y1+dy[i];
    int xb=x2+dx[3-i],yb=y2+dy[3-i];
    s+=r[i];
    if(xa<=xb&&ya<=yb) {
      if(!i) {
        rep(k,abs(ya-yb)) s+="U";
        rep(k,abs(xa-xb)) s+="R";
      } else if(i==1) {
        rep(k,abs(ya-yb)) s+="D";
        rep(k,abs(xa-xb)) s+="L";
      } else if(i==2) {
        rep(k,abs(xa-xb)) s+="R";
        rep(k,abs(ya-yb)) s+="U";
      } else {
        rep(k,abs(xa-xb)) s+="L";
        rep(k,abs(ya-yb)) s+="D";
      }
      s+=r2[i];
    }
  }
  pr(s);
}

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


Measured memory_bytes: 256
fun main(args: Array<String>) {
    val (N, K) = listOfLong()
    var n0 = N % K
    val n1 = Math.abs(n0 - K)
    val ans = Math.min(n0, n1)
    println(ans)
}


fun next() = readLine()!!
fun nextInt(delta: Int = 0) = Integer.parseInt(next()) + delta
fun nextLong() = next().toLong()
fun nextDouble() = next().toDouble()
fun listOfString() = next().split(" ")
fun listOfInt() = listOfString().map(String::toInt)
fun listOfLong() = listOfString().map(String::toLong)
fun listOfDouble() = listOfString().map(String::toDouble)
fun listOfInt(delta: Int = 0) = listOfString().map { Integer.parseInt(it) + delta }
fun listOfInt(vararg offset: Int) = listOfString().map { Integer.parseInt(it) }.mapIndexed { index, int -> int + offset[index % offset.size] }
fun listOfLong(delta: Long = 0L) = listOfString().map { java.lang.Long.parseLong(it) + delta }
fun listOfLong(vararg offset: Long) = listOfString().map { java.lang.Long.parseLong(it) }.mapIndexed { index, long -> long + offset[index % offset.size] }
fun listOfDouble(delta: Double = 0.0) = listOfString().map { java.lang.Double.parseDouble(it) + delta }
fun pairIntLong() = listOfLong().let { Pair(it[0].toInt(), it[1]) }
fun tripleIntIntLong() = listOfLong().let { Triple(it[0].toInt(), it[1].toInt(), it[2]) }
fun tripleIntLongLong() = listOfLong().let { Triple(it[0].toInt(), it[1], it[2]) }
fun pairIntLong(offset: Pair<Int, Long> = Pair(0, 0L)) = listOfLong().let { Pair(it[0].toInt() + offset.first, it[1] + offset.second) }
fun tripleIntIntLong(offset: Triple<Int, Int, Long> = Triple(0, 0, 0L)) = listOfLong().let { Triple(it[0].toInt() + offset.first, it[1].toInt() + offset.second, it[2] + offset.third) }
fun tripleIntLongLong(offset: Triple<Int, Long, Long> = Triple(0, 0L, 0L)) = listOfLong().let { Triple(it[0].toInt() + offset.first, it[1] + offset.second, it[2] + offset.third) }





Measured memory_bytes: 36112
#include <bits/stdc++.h>
#define rep(i, n) for(long long int i = 0; i < n; i++)
#define _rep(i, m, n) for(long long int i = m; i < n; i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int N = 1000000;
const ll mod = 1000000007;
using Graph = vector<vector<int>>;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

ll gcd(ll A, ll B){
    if(B == 0)return A;
    return gcd(B, A % B);
}
ll lcm(ll A, ll B){
    return A * B / gcd(A, B);
}

/*------------------------------------------------------------------*/

int main(){
    int n; cin >> n;
    vector<pair<int,int>> a(n), c(n);
    rep(i, n) cin >> a[i].first >> a[i].second;
    rep(i, n) cin >> c[i].first >> c[i].second;
    sort(a.begin(), a.end(), greater<>());
    sort(c.begin(), c.end(), greater<>());

    vector<bool> flaga(n, true), flagc(n, true);
    int count = 0;
    rep(i, n){
        int y_min = 2000;
        int y = -1;
        rep(j, n){
            if(a[i].first < c[j].first and a[i].second < c[j].second){
                if(y_min > c[j].second and flagc[j]){
                    y_min = c[j].second;
                    y = j;
                }
            }
        }
        if(y_min != 2000){
            count++;
            flaga[i] = false, flagc[y] = false;
        }
    }
    cout << count << endl;
}



Measured memory_bytes: 3572
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n; i++)
#define PI 3.14159265359
#define INF 1000100100
#define all(x) (x).begin(),(x).end()
typedef long long ll;
#define P pair<int, int>
#define PP pair<P,P>
using namespace std;

int main(){
    int n,k; cin >> n >> k;
    vector<int> s(n,0);
    rep(i,k){
        int d; cin >> d;
        rep(j,d){
            int a; cin >> a;
            a--;
            s[a]++;
        }
    }
    int ans=0;
    rep(i,n){
        if(!s[i]) ans++;
    }
    cout << ans << endl;
return 0;
}
 

Measured memory_bytes: 3632
#define s(X,Y,Z)(t=X,X=Y,Y=t,p=Z?&X:&Y,*p^=7,a)
m,a,b,c,t,r,*p;main(n){for(;r=a=scanf("%d",&n),n;printf("%d\n", r))for(b=2,c=3;n--;scanf(" %c%*s",&t),m=t-76,r+=m%6==0?s(c,b,m):1<m&m<8?s(b,a,m^7):s(c,a,m>0));}

Measured memory_bytes: 0
/*
    Author : DemonStar
*/

#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
#define ordered_set tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update>
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define all(x) x.begin(), x.end()
#define loop(i, n) for(ll i = 0; i < n; i++)
#define pl pair<ll, ll>
#define vl vector<ll>
#define endl '\n'
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i : x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}

#ifdef LOCAL
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }
    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};


template <typename T, typename TT>
ostream &operator<<(ostream &os, const pair<T, TT> &t) {
    return os << t.first << " " << t.second;
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &t) {
    for (auto &i : t) os << i << " ";
    return os;
}
template <typename T>
istream &operator>>(istream &is, vector<T> &v) {
    for (T &t : v) is >> t;
    return is;
}
template <typename T1, typename T2>
istream &operator>>(istream &is, vector<pair<T1, T2>> &v) {
    for (pair<T1, T2> &t : v) is >> t.first >> t.second;
    return is;
}

const ll mod = 1e9 + 7;
ll sieve[10000001];

int main()
{

#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif

    ll n, ans = 1;
    cin >> n;
    for (int i = 2; i <= n; i++) {
        ans += i * (sieve[i] + 2);
        // debug(i, sieve[i]);
        for (int j = 2 * i; j <= n; j += i) sieve[j]++;
    }
    cout << ans << endl;


#ifdef LOCAL
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s";
#endif

    return 0;
}

Measured memory_bytes: 81728