akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define REP(i, a, n) for (long long i = (a); i < (long long)(n); ++i)
#define REPC(i, a, n) for (long long i = (a); i <= (long long)(n); ++i)
#define ALL(t) t.begin(), t.end()
#define RALL(t) t.rbegin(), t.rend()
#define MATINIT(type, row, col, init) \
  vector<vector<type>>(row, vector<type>(col, init));
#define Yes(cond) cout << (cond ? "Yes" : "No") << endl;
#define YES(cond) cout << (cond ? "YES" : "NO") << endl;
using namespace std;
using LL = long long;
using ULL = unsigned long long;
template <class T>
using VEC = std::vector<T>;
template <class T>
using MAT = std::vector<std::vector<T>>;
void DUMP() { cerr << endl; }
template <class Head, class... Tail>
void DUMP(Head &&head, Tail &&... tail) {
  cerr << head << ", ";
  DUMP(std::move(tail)...);
}
template <typename T>
ostream &operator<<(ostream &os, vector<T> &vec) {
  os << "{";
  for (auto v : vec) os << v << ",";
  os << "}";
  return os;
}
template <typename T>
ostream &operator<<(ostream &os, set<T> &s) {
  os << "{";
  for (auto p : s) os << p << ",";
  os << "}";
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, map<T1, T2> &m) {
  os << "{";
  for (auto p : m) os << p << ",";
  os << "}";
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, pair<T1, T2> p) {
  os << "[" << p.first << " " << p.second << "]";
  return os;
}

int main() {
  int N, M;
  cin >> N >> M;
  VEC<LL> A(N);
  REP(i, 0, N) cin >> A[i];
  VEC<pair<LL, LL>> B(M);
  REP(i, 0, M) { cin >> B[i].second >> B[i].first; }
  sort(ALL(A));
  sort(ALL(B), greater<pair<LL, LL>>());
  // DUMP(A);
  // DUMP(B);

  // DUMP("HI");
  int count = 0;
  int j = 0;
  REP(i, 0, M) {
    // DUMP(i);
    while (B[i].second > 0) {
      // DUMP(A);
      if (B[i].first > A[j]) {
        A[j] = B[i].first;
        B[i].second--;
        j++;
        count++;
      } else {
        break;
      }
    }
  }
  LL sum = 0;
  REP(i, 0, N) { sum += A[i]; }
  cout << sum << endl;

  return 0;
}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
#include <complex>
#include <iomanip>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define fi first
#define se second
#define mp make_pair
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;

ll N,M,H,W,K,Q,A,B,C,L,R;
string S,T;
const ll MOD = (1e+9) + 7;
const ll INF = 1LL << 60;
typedef pair<ll,ll> P;

typedef vector<P> vp;
typedef vector<vp> matP;


int main() {
    cin>>N>>M;
    ll ans = 0;
    ans += 100 * N;
    ans += 1800 * M;
    rep(i,M) ans *= 2;
    cout<<ans<<endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	static int n;
	static int m;
	static int a[], b[];
	static boolean visited[];
	static boolean graph[][];

	public static void main(String[] args) {
		try (Scanner sc = new Scanner(System.in)) {
			int a = sc.nextInt();
			int b = sc.nextInt();
			System.out.println(2*b -a);
		}
	}
}


Measured memory_bytes: 23764
#include "bits/stdc++.h"
using namespace std;
#define int long long
#define double long double
#define low lower_bound
#define upp upper_bound
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define Rep(i,n) for (int i = (int)(n); i >= 0; i--)
#define all(vec) vec.begin(),vec.end()
#define rever(vec) reverse(all(vec));
#define cend cout << endl;
#define prique(T) priority_queue<T,vector<T>,greater<T>>
struct edge { int to, cost; };
using P = pair<int, int>;
using PP=pair<P, int>;
const int mod = 1e9 + 7, inf = 1e16;

int modpow(int x, int n) {
	int ans = 1;
	while (n > 0) {
		if (n & 1) {
			ans *= x;
			if (mod <= ans) ans %= mod;
		}
		x *= x;
		if (mod <= x) x %= mod;
		n >>= 1;
	}
	return ans;
}

int fact_memo[114514];
int fact(int n) {
	int ans = 1;
	if (fact_memo[n]) return fact_memo[n];
	rep(i, n) {
		ans *= (i + 1);
		if (mod <= ans) ans %= mod;
		fact_memo[i + 1] = ans;
	}
	return (ans + mod) % mod;
}

int comb(int n, int r) {
	if (n < r) return 0;
	if (n - r < r) r = n - r;
	return (fact(n) * modpow(fact(n - r), mod - 2) % mod * modpow(fact(r), mod - 2) + mod) % mod;
}

int perm(int n, int r) {
	if (n < r) return 0;
	if (n - r < r) r = n - r;
	return (fact(n) * modpow(fact(n - r), mod - 2) % mod + mod) % mod;
}

int gcd(int a, int b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}

int lcm(int a, int b) {
	return a * b / gcd(a, b);
}

bool pri(int p) {
	for (int i = 2; i * i <= p; i++) if (p % i == 0) return false;
	return p > 1;
}

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

P operator+(const P& a, const P& b) {
	return P(a.first + b.first, a.second + b.second);
}
P operator-(const P& a, const P& b) {
	return P(a.first - b.first, a.second - b.second);
}

signed main() {
	int k, x;
	cin >> k >> x;
	for (int i = x - k + 1; i < x + k; i++) {
		cout << i << " ";
	}
	cend;
}

Measured memory_bytes: 256
#ifndef HOME
#pragma GCC optimize "-O3"
#endif

#include <bits/stdc++.h>

using ll = long long;
using ull = unsigned long long;
using ld = long double;
using namespace std;

const int MX = 1007;
const int INF =1e9 + 7;

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

string a[MX];
int d[MX][MX];

int main() {
    ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
    int n, m;
    cin >> n >> m;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        for (int j = 0; j < m; j++) {
            d[i][j] = INF;
        }
    }

    queue<pair<int, int> > q;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            if (a[i][j] == '#') {
                d[i][j] = 0;
                q.emplace(i, j);
            }
        }
    }

    while (!q.empty()) {
        int x, y;
        tie(x, y) = q.front();
        q.pop();
        for (int dr = 0; dr < 4; dr++) {
            int nx = x + dx[dr], ny = y + dy[dr];
            if (nx >= 0 && ny >= 0 && nx < n && ny < m && d[nx][ny] > d[x][y] + 1) {
                d[nx][ny] = d[x][y] + 1;
                q.emplace(nx, ny);
            }
        }
    }

    int ans = 0;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            ans = max(ans, d[i][j]);
        }
    }

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



Measured memory_bytes: 13456
#include<iostream>
using namespace std;
struct Card
{
	char c;
	int value;
};
void PrintCard(Card* c,int n)
{
	for(int i=1;i<n;i++)
	{
		cout<<c[i].c<<c[i].value<<" ";
	}
	cout<<c[n].c<<c[n].value<<endl;
}

void BubbleSort(Card* c,int n)
{
	for(int i=1;i<=n;i++)
		for(int j=1;j<=n-i;j++)
		{
			if(c[j].value>c[j+1].value){
				Card temp=c[j];
				c[j]=c[j+1];
				c[j+1]=temp;
			}
		}
}

void SelectSort(Card* c,int n)
{
	for(int i=1;i<=n;i++)
	{
		int temp=i;
		for(int j=i+1;j<=n;j++)
		{
			if(c[temp].value>c[j].value)temp=j;
		}
		if(temp!=i){
		Card t=c[temp];
		c[temp]=c[i];
		c[i]=t;	
		}
	}	
}

bool IsEqual(Card* c1,Card* c2,int n)
{
	for(int i=1;i<=n;i++)
	{
		if(c1[i].c!=c2[i].c)return false;
	}
	return true;
}
int main()
{
	int n;
	Card c[37];
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		cin>>c[i].c>>c[i].value;
	}
	Card c1[37];
	for(int i=1;i<=n;i++)
		c1[i]=c[i];
	
	BubbleSort(c,n);
	PrintCard(c,n);
	cout<<"Stable"<<endl;
	SelectSort(c1,n);
	PrintCard(c1,n);
	if(IsEqual(c,c1,n))cout<<"Stable"<<endl;
	else cout<<"Not stable"<<endl;
	return 0;
}


Measured memory_bytes: 3108
#ifdef DEBUG
#define _GLIBCXX_DEBUG
#endif
//#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
typedef long double ld;
typedef long long ll;
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    //freopen("input.txt", "r", stdin);
    ll a, b, c, d;
    cin >> a >> b >> c >> d;
    cout << max({a * c, a * d, b * c, b * d});
    return 0;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
using namespace std;
typedef long long ll;
int INF = (1LL << 30) - 1;
int MOD = 1e9+7;
main(){
    int A,B,C;
    cin >> A >> B >> C;
    if(B < A)swap(A,B);
    if(C >= A && C <= B)cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <bits/stdc++.h>
#define ll long long

using namespace std;

int main()
{
    int n;
    cin >> n;
    //vector<ll> a(n);
    ll last = 0;
    ll asum = 0;
    ll elem;
    for (int i = 0; i < n; i++)
    {
        cin >> elem;
        if (elem < last)
        {
            asum += last - elem;
        }
        else
        {
            last = elem;
        }
    }
    //ll asum = accumulate(a.begin(), a.end(), 0);
    //ll sub = asum - bsum;
    cout << asum << endl;
    return 0;
}

Measured memory_bytes: 3588
n=int(input())
l=[0,0,0,0,0]
for _ in range(n):
    s=input()
    if s[0]=='M':l[0]+=1
    if s[0] == 'A': l[1] += 1
    if s[0] == 'R': l[2] += 1
    if s[0] == 'C': l[3] += 1
    if s[0] == 'H': l[4] += 1

for i in l:
    if i==0:l.remove(i)
total=len(l)
if total<3:ans=0
else:
    ans=0
    for i in range(0,total-2):
        for j in range(i+1,total-1):
            for k in range(j+1,total):
                ans+=l[i]*l[j]*l[k]
print(ans)

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

int main(){
  int N;
  uint64_t c[4] = {0};

  cin >> N;
  vector<string> vecS(N);

  for (int i = 0; i < N; i++) {
    cin >> vecS.at(i);
    if (vecS.at(i) == "AC")
    {
      c[0]++;
    }
    else if (vecS.at(i) == "WA")
    {
      c[1]++;
    }
    else if (vecS.at(i) == "TLE")
    {
      c[2]++;
    }
    else if (vecS.at(i) == "RE")
    {
      c[3]++;
    }    
  }
  cout << "AC x " << c[0] << endl;
  cout << "WA x " << c[1] << endl;
  cout << "TLE x " << c[2] << endl;
  cout << "RE x " << c[3] << endl;

  return 0;
}

Measured memory_bytes: 6424
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;

namespace AC
{
    class Program
    {
        static void Main(string[] args)
        {
            var X = ReadInt();
            var K = 1;
            while (!(K * X >= 360 && K * X % 360 == 0)) K++;

            Console.WriteLine(K);
            Console.ReadLine();
        }

        static string Read() { return Console.ReadLine(); }
        static int ReadInt() { return int.Parse(Read()); }
        static long ReadLong() { return long.Parse(Read()); }
        static string[] ReadArrayString() { return Read().Split(' '); }
        static int[] ReadArrayInt() { return Read().Split(' ').Select(s => int.Parse(s)).ToArray(); }
        static long[] ReadArrayLong() { return Read().Split(' ').Select(s => long.Parse(s)).ToArray(); }
    }
}


Measured memory_bytes: 27484
H, W = map(int, input().split())
n = int(input())
a = list(map(int, input().split()))

area = [[0]*W for _ in range(H)]

color = 1
filled = 0
for h in range(H):
    if h%2==0: sec = range(W)
    else: sec = range(W-1, -1, -1)
    for w in sec:
        area[h][w] = color
        filled+=1
        if filled == a[color-1]:
            color+=1
            filled = 0
    print(*area[h], sep=' ')

Measured memory_bytes: 3828
#include "bits/stdc++.h"

using namespace std;

vector<int> vals;
vector<int> minVal;
int k;
int dp(int currPos)
{
    if(currPos <= 0) {return 0;}
    if(currPos == 1){return abs(vals[1] - vals[0]);}
    if(minVal[currPos] != INT_MAX){return minVal[currPos];}
    else
    {
        int mVal = INT_MAX;
        for(int x = 1; x <= k; ++x)
        {
            if(currPos >= x)
            {
                mVal = min(mVal, dp(currPos - x) + abs(vals[currPos] - vals[currPos - x]));
            }
        }
        minVal[currPos] = mVal;
        return minVal[currPos];
    }
}
int main()
{
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin >> n >> k;
    int temp;
    for(int x = 0; x < n; ++x)
    {
        cin >> temp;
        vals.push_back(temp);
        minVal.push_back(INT_MAX);
    }
    cout <<  dp(n - 1) << "\n";
    return 0;
}

Measured memory_bytes: 6004
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(0);cin.tie(NULL)
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
#define trace(x)  cerr << #x << ": " << x << endl;
typedef long long ll;
typedef long double ld;const ll N=1e5+5;
int main()
{
    ll n;cin>>n;
    map<string,ll> mp;mp["AC"]=0;mp["WA"]=0;mp["TLE"]=0;mp["RE"]=0;
    for(ll i=0;i<n;i++){string s;cin>>s;mp[s]++;}
    {
        cout<<"AC"<<" x "<<mp["AC"]<<"\n";
        cout<<"WA"<<" x "<<mp["WA"]<<"\n";
        cout<<"TLE"<<" x "<<mp["TLE"]<<"\n";
        cout<<"RE"<<" x "<<mp["RE"]<<"\n";

    }
}

Measured memory_bytes: 3632
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <numeric>
#include <tuple>
#include <stack>

#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) x.begin(),x.end()
#define print(s) cout << s << endl
typedef long long ll;
using namespace std;

int ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}

int main() {
	string s; cin >> s;
	int count  = 0;
	rep(i,3){
		if (s[i] == 'o') count++;
	}
	cout << 700 + 100*count << endl;
}

Measured memory_bytes: 256
#include<cstdio>

int n, a, b, t, ans;
int main(){
    while(~scanf("%d %d %d", &n, &a, &b)){
        ans = 0;
        while(n--){
            scanf("%d", &t);
            if(t < a || t >= b){
                ans++;
            }
        }
        printf("%d\n", ans);
    }
    return 0;
}


Measured memory_bytes: 128
n=int(input())
ans=0
for i in range(1,n+1):
    if 0<i<10:
        ans+=1
    elif 9<i<100:
        ans+=0
    elif 99<i<1000:
        ans+=1
    elif 999<i<10000:
        ans+=0
    elif 9999<i<100000:
        ans+=1
    else:
        ans+=0
print(ans)

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

int main(){
  string s;
  cin >> s;
  int n = atoi(s.c_str());
  int sum = 0;
  for(int i = 0; i < s.size(); i++){
    sum += atoi(s.substr(i,1).c_str());
  }
  if(n % sum == 0)cout << "Yes" << endl;
  else cout << "No" << endl;
  
}

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

int main(){
    ll N; cin>>N;
    ll a[N+1];
    a[0] = 0;
    rep(i, N){
        ll b; cin>>b;
        a[i+1] = a[i] + b;
    }

    ll min = 10e17;
    FOR(i, 1, N){
        min = std::min(abs(a[i]-(a[N]-a[i])), min);
    }

    cout << min << endl;
}


Measured memory_bytes: 5192
def main():
    H, W = [int(i) for i in input().split()]
    grid = [[0]*W for i in range(H)]
    for h in range(H):
        grid[h] = [int(i) % 2 for i in input().split()]
    ans = []
    # print(grid)
    # 上一行に圧縮
    for h, row in reversed(list(enumerate(grid))):
        for w, num in enumerate(row):
            if h == 0:
                continue
            if grid[h][w] == 0:
                continue
            move = h
            grid[h][w] = 0
            y = h
            x = w
            for i in range(move):
                ans.append((y+1, x+1, y-1+1, x+1))
                x, y = x, y-1
                if grid[y][x] == 1:
                    break
            grid[y][x] = (grid[y][x]+1)%2
    # print(grid)
    # 一点に圧縮
    for w, num in reversed(list(enumerate(grid[0]))):
        if w == 0:
            continue
        if grid[0][w] == 0:
            continue
        move = w
        grid[0][w] = 0
        y = 0
        x = w
        for i in range(move):
            ans.append((y+1, x+1, y+1, x-1+1))
            y, x = y, x-1
            if grid[y][x] == 1:
                # print("a")
                break
        # print("b")
        grid[y][x] = (grid[y][x]+1)%2
    # print(grid)
    print(len(ans))
    for op in ans:
        print("%d %d %d %d" % op)



            
            

if __name__ == "__main__":
    main()

Measured memory_bytes: 73308
#include<iostream>
#include <string> 
#include <vector>  
#include<math.h>

#define INF 1000000000
using namespace::std;


long Lmax(long x, long y) {
	if (x > y)return x;
	return y;
}

int max(int x, int y) {
	if (x > y)return x;
	return y;
}

long Lmin(long x, long y) {
	if (x < y)return x;
	return y;
}


int min(int x, int y) {
	if (x < y)return x;
	return y;
}

int abs(int a) {
	if (a < 0) {
		return -a;
	}
	return a;
}
long long ans;
int N, M,F,K,H, W,L,sa,X[2000000], Y[2000000], Z[2000000],  k[3],B,C,n[2];
string s[50], t[100];
int chx[4] = { 1,0,0,-1 };
int chy[4] = { 0,1,-1,0 };
bool a, b, c;
int main() {
	cin >> H>>W;
	for (int i = 0; i < H; i++) {
		cin >> s[i];
	}

	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			a = false;
			if (s[i][j] == '#') {
				for (int k = 0; k < 4; k++) {
					if (i + chx[k] >= 0 && i + chx[k] < H&&j + chy[k] >= 0 && j + chy[k] < W) {
						if (s[i + chx[k]][j + chy[k]] == '#') {
							a = true;
						}
					}
				}
				if (a == false) {
					cout << "No" << endl;
					return 0;
				}
			}
		}
	}

	cout <<"Yes" << endl;
	return 0;
}




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

int main(){
    int a[3];
    cin >> a[0] >> a[1] >> a[2];
    int K;
    cin >> K;
    sort(a,a+3);
    for (int i = 0; i < K; i++){
        a[2] *= 2;
    }
    cout << a[0] + a[1] + a[2] << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long int
#define pb push_back
#define pob pop_back
#define vi vector<ll>
#define mp make_pair
#define sz size()
#define rep1(i,n) for(ll i=1;i<=n;i++)
#define rep(i,n) for(ll i=0;i<n;i++)
#define fast ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define maxx 100005
#define edge pair<ll,ll>
#define mod 1000000007
using namespace std;
 
 
// ¦¦¦¦¦¦¦¦¦¦¦¦+++++++++++++++++¦¦¦++++++¦¦
// ¦¦¦¦¦¦¦¦¦¦¦¦¦++++++++++++¦¦¦¦¦¦¦¦¦¦+++¦¦
// ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦++++++++¦¦¦¦¦+++++++¦++¦¦
// ¦¦¦¦¦¦¦¦++¦¦¦¦¦¦++++++¦¦¦¦+++++++++++++¦
// ¦¦¦¦¦¦¦++++++¦¦¦++++++¦¦++++++++++++++¦¦
// ¦¦¦¦¦¦¦+++++++¦¦¦+++++++++++++++++++++¦¦
// ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦++++++¦¦¦¦¦¦¦¦¦++++¦¦
// ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦+++++¦¦¦¦¦¦¦¦+++++++¦ 
// ¦¦¦¦¦¦¦¦¦¦++¦¦¦¦¦¦¦+++++++++++++++++++¦¦
// ¦¦¦¦¦¦¦++++¦¦¦¦¦¦¦¦+++++++++++++++++++¦¦
// ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦+++++++++++++++++++¦¦
// ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦+++++++++++++++++++¦¦
// ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦+++++++++++++++++++¦¦
// ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦+++++++++++++++++++¦¦ 
// ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦++++++++++++++++++++¦¦
// ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦++++++++++++¦¦+¦++¦¦¦
// ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦+++++++¦¦+++++¦¦¦
// ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦+¦¦¦¦+++¦¦¦¦++++++¦¦¦
// ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦+++¦¦+¦¦¦¦¦+++++++¦¦¦¦
// ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦+++++++++++¦¦¦¦
// ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦+++++++++++++++++++¦¦¦¦¦
// ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦++++++++++++++++¦¦¦¦¦¦
// ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦+++++++++++¦¦¦¦¦¦¦
// ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦+¦¦¦+++++++++++¦¦¦¦¦¦¦¦
// ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦+++++++++¦¦¦¦¦¦¦¦¦
// ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦++++++++¦¦¦¦¦¦¦¦¦¦
// ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦++++++¦¦¦¦¦¦¦¦¦¦¦¦

//ll dp[maxx];
//ll par[maxx];


int main()
{
	ll n,k;
	cin>>n>>k;
	if(k==1)
	{
		cout<<0<<endl;
		return 0;
		
	}
	if(n%k==0)
	{
		cout<<0<<endl;
		return 0;
		
	}
	ll d;
	if(k>=n)
	{
		if(k-n>n)
		cout<<n<<endl;
		else
		cout<<k-n<<endl;
		return 0;
	}
	ll t;
	t=n%k;
	d=k-t;
	ll p;
	p=min(t,d);
	cout<<p<<endl;
	return 0;
}
//cout<<"YES"<<endl;

//cout<<"NO"<<endl;

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

int main(void)
{
	string str;
	
	while (getline(cin, str)){
		string res;
		for (int i = 0; i < 26; i++){
			for (int j = 0; j < str.size(); j++){
				if (str[j] != ' ' && str[j] != '.') res += (str[j] -'a' + i ) % 26 + 'a';
				else res += str[j];
			}
//			cout << i + 1 << " " << res << endl;
			if (res.find("this") != -1){
				cout << res << endl;
				break;
			}
			if (res.find("the") != -1){
				cout << res << endl;
				break;
			}
			if (res.find("that") != -1){
				cout << res << endl;
				break;
			}
			res.clear();
		}
	}
	
	return 0;
}

Measured memory_bytes: 0
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define ALL(o) (o).begin(), (o).end()
using namespace std;
typedef int_fast64_t ll;

size_t i, j;
ll N, K, S = 0;
ll A[500], B[500];

bool solve(ll m) {
    for(i = 0; i < N; i++) B[i] = A[i] % m;
    sort(B, B + N);
    ll cnt = 0, buff = 0, tmp;
    for(i = 0, j = N - 1; i <= j; i++) {
        if(B[i] == 0 || B[i] == m) continue;
        buff = B[i];
        cnt += B[i];
        B[i] = 0;
        while(buff && j >= 0) {
            if(B[j] == 0 || B[j] == m) {
                j--;
                continue;
            }
            tmp = m - B[j];
            if(tmp > buff) {
                B[j] += buff;
                break;
            } else {
                buff -= tmp;
                j--;
            }
        }
    } 
    return cnt <= K;
}

int main() {
    scanf("%lld %lld", &N, &K);
    REP(i, N) {
        scanf("%lld", A + i);
        S += A[i];
    }
    ll x = 1, y;
    vector<ll> cand;
    while(x * x <= S) {
        if(S % x == 0) {
            y = S / x;
            if(solve(y)) {
                printf("%lld\n", y);
                return 0;
            }
            cand.push_back(x);
        }
        x++;
    }
    reverse(ALL(cand));
    for(auto& c : cand) if(solve(c)) {
        printf("%lld\n", c);
        break;
    }
	return 0;
}

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

int main()
{

        long long n,m,a,b,c,d,e,f,g,h,p,q,r,fr,sc,tr,sz,tz,i,j,k,mx=LLONG_MIN,mn=LLONG_MAX;
        long long x=0,y=0,cnt=0,res=0,ttl=0,ans=0,sum=0; long long flg=0,flag=1,na=0,as=1;
        vector<long long>u,v,w; vector< pair<long long,long long> >vct; vector<string>vst;
        set<long long>st,nt,tt; map<long long,long long>mp,nq,qr; string str,ttr,ntr;

        scanf("%lld",&n);

        while(n%2==0)
        {
            if(mp[2]==0)v.push_back(2); mp[2]++; n=n/2;
        }

        for(i=3;i*i<=n;i+=2)
        {
            while(n%i==0)
            {
                if(mp[i]==0)v.push_back(i); mp[i]++; n=n/i;
            }

        }

        if(n>1)v.push_back(n); mp[n]=1;

        sz=v.size();

        for(i=0;i<sz;i++)
        {
            fr=v[i]; sc=mp[fr];

            h=1; x=0;

            while(1)
            {
                x=x+h;
                if(x>sc)break;

                ans++;


                h++;

            }

        }

        printf("%lld\n",ans);









    return 0;
}





Measured memory_bytes: 3776
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
#define pb push_back 
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define ll long long
#define si(x) scanf("%d",&x)
#define sd(x) scanf("%lf",&x)
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int a[3]={300000,200000,100000};
int main(int argc, char** argv) {
	int x,y;
	si(x);
	si(y);
	int ans=0;
	if(x==1&&y==1)
	{
		ans+=400000;
	}
	rep(i,1,3)
	{
		if(x==i)ans+=a[i-1];
		if(y==i)ans+=a[i-1];
	}
	cout<<ans;
	return 0;
}

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

int main() {
  int N,K;
  cin >> N >> K;
  int min_dis=0;
  for(int i=0;i<N;i++){
    int x;
    cin >> x;
    int B_dis=0;
    if(K>x) {
      B_dis=K-x;
    }else{
      B_dis=x-K;
    }
    if(x>B_dis) {
      min_dis += B_dis * 2;
    }else{
      min_dis += x * 2;
    }
  }
  cout << min_dis << endl;

}


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

int y,m,d;

int day[1024][12];
//int year;

int sum = 0;

void solve(){
    cin >> y >> m >> d;


    int count = 0;

    for(int i=1;i<y;i++){
        for(int j=1;j<=10;j++){
            count += day[i][j];
        }
    }

    for(int i=1;i<m;i++){
        count += day[y][i];
    }
    count += d;
    count -= 1;
    //cout << "count : " << count << endl;

    int ans = sum - count;
    cout << ans << endl;
}

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

    // init
    for(int i=1;i<1024;i++){
        for(int j=1;j<=10;j++){
            if(j%2==1){
                day[i][j] = 20;
            }else{
                day[i][j] = 19;
            }
        }
	if(i%3==0)
		for(int j=1;j<=10;j++){
			day[i][j] = 20;
		}
    }

    for(int i=1;i<1000;i++){
        for(int j=1;j<=10;j++){
            sum += day[i][j];
        }
    }

    //cout << sum << endl;

    rep(i,n){
        solve();
    }
}

Measured memory_bytes: 3136
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>
#include<map>
#include<iomanip>
#include<queue>
#include<stack>
#include<time.h>
#define rep(i,n)for(int i=0;i<n;i++)
#define int long long
#define ggr getchar();getchar();return 0;
#define prique priority_queue
#define mod 1000000007
#define inf 1e15
#define key 1e9
using namespace std;
typedef pair<int, int>P;
void yes() { cout << "Yay!" << endl; }
void no() { cout << ":(" << endl; }
template<class T> inline void chmax(T& a, T b) {
	a = std::max(a, b);
}
template<class T> inline void chmin(T& a, T b) {
	a = std::min(a, b);
}
const int MAX = 330000;
int fac[MAX], finv[MAX], inv[MAX];
// テーブルを作る前処理
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % mod;
		inv[i] = mod - inv[mod % i] * (mod / i) % mod;
		finv[i] = finv[i - 1] * inv[i] % mod;
	}
}

// 二項係数計算
long long COMB(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}
bool prime(int n) {
	int cnt = 0;
	for (int i = 1; i <= sqrt(n); i++) {
		if (n % i == 0)cnt++;
	}
	if (cnt != 1)return false;
	else return n != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x / gcd(x, y) * y;
}
int kai(int x, int y) {
	int res = 1;
	for (int i = x - y + 1; i <= x; i++) {
		res *= i; res %= mod;
	}
	return res;
}
int mod_pow(int x, int y, int m) {
	int res = 1;
	while (y) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}
int comb(int x, int y) {
	if (y > x)return 0;
	return kai(x, y)* mod_pow(kai(y, y), mod - 2, mod) % mod;
}
void debug_out() { cerr << endl; }

template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
	cerr << " " << to_string(H);
	debug_out(T...);
}

#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
struct edge { int to, cost; };
int par[114514], rrank[114514];//親、木の深さ
void init(int n) {
	rep(i, n) {
		par[i] = i;
		rrank[i] = 0;
	}
}
int find(int x) {
	if (par[x] == x) {
		return x;
	}
	else return par[x] = find(par[x]);
}
void unite(int x, int y) {
	x = find(x);
	y = find(y);
	if (x == y)return;
	if (rrank[x] < rrank[y]) {
		par[x] = y;
	}
	else {
		par[y] = x;
		if (rrank[x] == rrank[y])rrank[x]++;
	}
}
bool same(int x, int y) {
	return find(x) == find(y);
}
string s;
int dight(int i, int j) {
	int ans = 0;
	for (int k = i; k <= j; k++) {
		ans += (s[k] - '0') * mod_pow(10, j - k, inf);
	}
	return ans;
}
signed main() {
	cin >> s;
	int n = s.size();
	int p = 0;
	rep(i, 1 << (n - 1)) {
		int memo = 0;
		rep(j, n - 1) {
			if ((i >> j) & 1) {
				p += dight(memo, j);
				memo = j + 1;
			}
		}
		p += dight(memo, n - 1);
	}
	cout << p << endl;
	ggr
}

Measured memory_bytes: 384
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <set>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cstring>
#include <iterator>
#include <bitset>
#include <unordered_set>
#include <unordered_map>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <utility>
#include <memory>
#include <functional>
#include <deque>
#include <cctype>
#include <ctime>
#include <numeric>
#include <list>
#include <iomanip>

#if __cplusplus >= 201103L
#include <array>
#include <tuple>
#include <initializer_list>
#include <forward_list>

#define cauto const auto&
#else

#endif

using namespace std;


typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll;
typedef vector<vector<long long> > vvll;

#define VV(T) vector<vector< T > >

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
    v.assign(a, vector<T>(b, t));
}

template <class F, class T>
void convert(const F &f, T &t){
    stringstream ss;
    ss << f;
    ss >> t;
}

#define GET_MACRO(_1, _2, _3, NAME, ...) NAME
#define _rep(i,n) _rep2((i),0,(n))
#define _rep2(i,a,b) for(int i=(a);i<(b);++i)
#define rep(...) GET_MACRO(__VA_ARGS__, _rep2, _rep)(__VA_ARGS__)
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define fi first
#define se second
#define mkp make_pair
#define DEBUG
#ifdef DEBUG
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#else
#define dump(x) 
#define debug(x) 
#endif

#define MOD 1000000007LL
#define EPS 1e-8
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL
#define maxs(x,y) x=max(x,y)
#define mins(x,y) x=min(x,y)

void mainmain(){
	string a,b;
	cin>>a>>b;
	rep(i,a.size()){
		cout<<a[i];
		if(i<b.size()) cout<<b[i];
	}
	cout<<endl;
}


signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout<<fixed<<setprecision(20);
    mainmain();
}

Measured memory_bytes: 256
n,C = map(int,input().split())
d = [[int(i) for i in input().split()] for _ in range(C)]
c = [[int(i)-1 for i in input().split()] for _ in range(n)]

cnt = [[0]*C for _ in range(3)]
for i in range(n):
    for j in range(n):
        for k in range(C):
            for r in range(3):
                if (i+j)%3 == r: cnt[r][k] += d[c[i][j]][k]

ans = float("inf")
for i in range(C):
    for j in range(C):
        if i == j: continue
        for k in range(C):
            if i == k or j == k: continue
            ans = min(ans, cnt[0][i] + cnt[1][j] + cnt[2][k])
print(ans)

Measured memory_bytes: 47452
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner scn = new Scanner(System.in);
    int N = scn.nextInt();
    scn.nextLine();

    long anagCombi = 0;

    ArrayList<String> sorted = new ArrayList<>();
    for (int i = 0; i < N; i++) {
      String s = scn.nextLine();
      Character[] chars = new Character[10];
      for (int j = 0; j < 10; j++) {
        chars[j] = s.charAt(j);
      }

      Arrays.sort(chars, new Comparator<Character>() {
        public int compare(Character c1, Character c2) {
          int cmp = Character.compare(Character.toLowerCase(c1.charValue()), Character.toLowerCase(c2.charValue()));
          if (cmp != 0)
            return cmp;
          return Character.compare(c1.charValue(), c2.charValue());
        }
      });
      StringBuilder sb = new StringBuilder(chars.length);
      for (char c : chars) {
        sb.append(c);
      }
      sorted.add(sb.toString());

    }

    Collections.sort(sorted);
    sorted.add("dummy");
    String prev = sorted.get(0);
    long sameCount = 1L;
    for (int i = 1; i < sorted.size(); i++) {
      if (sorted.get(i).equals(prev)) {
        sameCount++;
      } else {

        if (sameCount > 1) {
          anagCombi += calcNumOfCombination(sameCount, 2L);
        }
        prev = sorted.get(i);
        sameCount = 1L;

      }
    }

    System.out.printf("%d", anagCombi);

  }

  public static long calcNumOfCombination(long n, long r) {
    long num = 1;
    for (long i = 1; i <= r; i++) {
      num = num * (n - i + 1) / i;
    }
    return num;
  }

}


Measured memory_bytes: 118264
import java.util.Scanner;

	public class Main {

		public static void main(String[] args) {

			Scanner sc = new Scanner(System.in);
			
			int h = sc.nextInt();
			int w = sc.nextInt();
			String[] S = new String[h];
			char[][] s = new char[h][w];
			int[][] ret = new int[h+2][w+2];
			
			for(int i=0;i<h;i++) {
				S[i]=sc.next();
			}
			
			
			for(int i=0;i<h;i++) {
				for(int j=0;j<w;j++) {
					s[i][j]=S[i].charAt(j);
				}
			}
			
			
			
			for(int i=0;i<h;i++) {
				for(int j=0;j<w;j++) {
					if(s[i][j]=='#') {
						ret[i+1][j+1]= -1;
						if(ret[i][j]!=-1) {
							ret[i][j]++;
						}
						if(ret[i][j+1]!=-1) {
							ret[i][j+1]++;
						}
						if(ret[i][j+2]!=-1) {
							ret[i][j+2]++;
						}
						if(ret[i+1][j]!=-1) {
							ret[i+1][j]++;
						}
						if(ret[i+1][j+2]!=-1) {
							ret[i+1][j+2]++;
						}
						if(ret[i+2][j]!=-1) {
							ret[i+2][j]++;
						}
						if(ret[i+2][j+1]!=-1) {
							ret[i+2][j+1]++;
						}
						if(ret[i+2][j+2]!=-1) {
							ret[i+2][j+2]++;
						}
						
					}
					
				}
			}
			
			
			
			for(int i=1;i<h+1;i++) {
				for(int j=1;j<w+1;j++) {
					if(ret[i][j]==-1) {
						System.out.print("#");
					}else {
						System.out.print(ret[i][j]);
					}
					
				}
				System.out.println("");
			}
			
			
			
		}	
	}

Measured memory_bytes: 22356
#include <string>
#include <vector>
#include <cmath>
#include <list>
#include <set>
#include <algorithm>
#include <map>
#include <iostream>
#include <sstream>
#include <queue>
#include <iomanip>

using namespace std;


int main()
{
	unsigned long long a, b, c;

	cin >> a >> b >> c;

	unsigned long long aa = (a % 2) * b * c;
	unsigned long long bb = a * (b%2) * c;
	unsigned long long cc = a * b * (c%2);

	unsigned long long ans = min(aa, min(bb, cc));

	cout << ans << endl;

	return 0;
}

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

int n,m;
int C[20];

const int INF = 1e9;
int used[21][50001];
int mem[21][50001];
int dfs(int i,int j){
  if(j == n) return 0;
  if( i == m || j > n) return INF;
  if(used[i][j]) return mem[i][j];
  used[i][j] = 1;
  int a = dfs(i, j + C[i]) + 1;
  int b = dfs(i+1, j);
  return mem[i][j] = min(a, b);
}

signed main(){
  
  cin>>n>>m;
  for(int i=0;i<m;i++) cin>>C[i];
  
  int ans = dfs(0,0);
  cout<<ans<<endl;
  
  return 0;
}



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

using namespace std;
typedef long long ll;

#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, a, b) for (int i = (a); i < (b); ++i)
#define all(a) (a).begin(), (a).end()
#define all2(a, b) (a).begin(), (a).begin() + (b)
#define debug(vari) cerr << #vari << " = " << (vari) << endl;


int keta(int n){
    int cnt=0;
    while(n){
        n /= 10;
        cnt++;
    }
    return cnt;
}

int main()
{
    int n;
    cin >> n;
    int ans = 0;
    rep2(i, 1, n + 1)
    {
        if(keta(i)%2==1){
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#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;

    cin >> s;
    cout << ((s[2] == s[3] && s[4] == s[5]) ? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <cmath> // sqrt
#define _GLIBCXX_DEBUG // check []
#define DIVISOR 1000000007

using namespace std;
typedef pair<int,int> pii;
typedef pair<int64_t, int64_t> pII;

template<typename T>
void cins(vector<T>& arr) { for(T& e: arr) cin >> e; }

#ifdef DEBUG
#define debug(fmt, ...) \
    printf("[debug: %s] " fmt, __func__, __VA_ARGS__)
#define ps(arr) \
    debug("size %ld: ", arr.size()); \
    for(auto e: arr) cout << e << " "; \
    cout << endl;
#else
#define debug(fmt, ...)
#define ps(arr)
#endif


#define INF 10000

int main(void) {
    int num; int llimit;
    cin >> num >> llimit;
    vector<pii> arr(num+1); // arr[num] ... for guard
    for(int i = 0; i < num; i++) {
        int count, bonus;
        cin >> count >> bonus;
        arr[i] = make_pair(count, bonus);
    }

    int ans = INF;
    for(int pat = 0; pat < (1<<num); pat++) {
        int sum = 0;
        int count = 0;
        int partial = num;
        // get bonus
        for(int bit = 0; bit < num; bit++) {
            if(!(pat & (1<<bit))) {
                partial = bit; continue;
            }
            int point = (bit+1)*100;
            pii p = arr[bit];
            sum += (p.first*point + p.second);
            count += p.first;
        }
        // get highest score partially
        pii p = arr[partial];
        int point = (partial+1)*100;
        int rem = llimit-sum;
        int cnt = 0;
        if(rem>=1) cnt = (rem-1)/point + 1;
        cnt = min(cnt, p.first);
        count += cnt;
        sum += point*cnt;
        debug("cnt: %d(partial: %d) -> %d\n", count, partial, sum);
        if(sum >= llimit) ans = min(ans, count);
    }

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

Measured memory_bytes: 3580
#include <bits/stdc++.h>
#include <math.h>
#include <cmath>

using namespace std;
using ll =long long;
using vi = vector<int>; 
using vvi = vector<vi>; 
using vl = vector<ll>; 
using vvl = vector<vl>; 
using vs = vector<string>;
using vvs = vector<vs>; 
using vc = vector<char>;
using vvc = vector<vc>; 
using vb = vector<bool>;
using vvb = vector<vb>; 

#define rep(i,n) ;for( int i =0; i < n ; i ++)
#define all(a) a.begin(),a.end()
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define f(i,a,b) for(int i=a;i<b;i++)
#define pri(a)  printf("%.14lf\n",a);
#define MOD 1000000007
bool is_int_lround(double x){
  return std::lround(x)==x;
}
ll keta(ll x){
  ll n=0;
  while(x>0){
    x /=10 ;
    n ++;
  }
  return n;
}

ll conbi(int n,int m){
  
  cin>>n>>m;
  vector<ll> a(100);
  a[0] =1;
  for(int i=0;i<14;i++){
    a[i+1]=a[i]*(i+1);
  }
  return a[n] /(a[m] *a[n-m]);
}

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;//繰り返し二乗法
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
ll kaijoMOD(ll x){
  ll z=1;
  if(x==0){
    return 1;
  }
  while(x>0){
    z *=x;
    z %=MOD;
    x--;
  }
  return z;
}
ll yakusu_num(ll n){
  vl yakusu(n+1,1);
  for(ll i=2;i*i<=n;i++){ 
    while(n%i==0){
      n /=i;
      yakusu[i]++;
    }
  }
  if(n!=1)yakusu[n]++;
  ll num=1;
  for(ll i=0;i<=n;i++){
    num*=yakusu[i];
  }
  return num;
}

int H,W;
vs s(50);
vi dv ={-1,0,1,0};vi du={0,-1,0,1};
int cnt=1;
int dfs(int u,int v){
  s[u][v]='.';
  
  rep(i,4){
   
      int nu =u +du[i],nv=v+dv[i];
      if(nu<0||nu>=H||nv<0||nv>=W)continue;
      if(s[nu][nv]=='.')continue;
      cnt ++;
      dfs(nu,nv);
    
  }
  return cnt;

}
int keta_wa(int x){
  int tot=0;
  while(x>0){
    tot +=x%10;
    x/=10;
  }
  return tot;
}

//vc alp ={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
//cout<<""<<endl;
int main(){
  int r,g,b;cin>>r>>g>>b;
  if( (100*r+10*g+b)%4==0 )cout<<"YES"<<endl;
  else cout<<"NO"<<endl;
}





Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<(n);++i)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define all(x) (x).begin(), (x).end()
#define PI 3.14159265358979323846264338327950L
using namespace std;
typedef long long ll;
typedef long double ld;
int main() {
    int n;
    cin>>n;
    long a;
    int two=0,four=0,other=0;
    rep(i,n){
        cin>>a;
        if(a%2==0){
            if(a%4==0) four++;
            else two++;
        }
        else other++;
    }
    bool flag=false;
    if(two==0){
        if(other<=four+1) flag=true;
    }
    else{
        if(other<=four) flag=true;
    }
    if(flag) cout<<"Yes";
    else cout<<"No";
}

Measured memory_bytes: 3612
#include<bits/stdc++.h>
using namespace std;
int dp[3][110]={0};
int main()
{
    int n;
    while(cin>>n)
    {
        for(int i=1;i<=2;i++)
            for(int j=1;j<=n;j++)
            cin>>dp[i][j];
        for(int i=1;i<=2;i++)
            for(int j=1;j<=n;j++)
            dp[i][j]+=max(dp[i-1][j],dp[i][j-1]);
        cout<<dp[2][n]<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
d=[0]*1e5;d[1]=p=1;n=gets.to_i.times{|i|p*=i+1};(2..n).map{|i|c=0;(p/=i;c+=1)while p%i<1;75.downto(0){|k|c.times{|j|d[k.*j+2]+=d[k]}}};p d[75]

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

int main() {
  
  int N, A, B, S;
  cin >> N >> A >> B;
  
  // 計算後の値 S を追加
  S = N * A;
    
  // テスト
//  cout << S << endl;
//  cout << B << endl;
  
  // 条件の記載
  if (S <= B) {
    cout << S << endl;
  }
    else {
      cout << B << endl;
    }
    
}

Measured memory_bytes: 256
import sys
from itertools import accumulate

read = sys.stdin.read

N, K, *p = map(int, read().split())

p = [(1 + i) / 2 for i in p]
p = [0] + p
P = list(accumulate(p))
answer = max(b - a for a, b in zip(P, P[K:]))

print(answer)


Measured memory_bytes: 25420
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder.Abc
{
    class QuestionB
    {
        public static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            // 整数配列の入力
            var inputLongArray = Console.ReadLine().Split(' ').Select(i => long.Parse(i)).ToArray();

            var a = inputLongArray[0];
            var b = inputLongArray[1];
            var k = inputLongArray[2];

            if(b - a + 1 > 2 * k) {
                for (long i = a; i < a + k; i++) {
                    Console.WriteLine(i);
                }

                for (long i = b - k + 1; i <= b; i++) {
                    Console.WriteLine(i);
                }
            } else {
                for(long i = a; i <= b; i++) {
                    Console.WriteLine(i);
                }
            }

            Console.Out.Flush();
        }
    }
}


Measured memory_bytes: 13396
#include <stdio.h>

int main(void){
    int W, H, x, y, r;
    scanf("%d %d %d %d %d\n", &W, &H, &x, &y, &r);
    
    if (((x-r)>=0)&&((x+r)<=W)&&((y-r)>=0)&&((y+r)<=H)){
        printf("Yes\n");
    } else {
        printf("No\n");
    }
}



Measured memory_bytes: 2100
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#define _USE_MATH_DEFINES
#include <math.h>
#include <iomanip>
#include <stdio.h>
#include <numeric>
#include <cmath>
#include <limits>
#include <bitset> 
#include <iterator> 
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include<deque>
#include <regex>
#include <list> 
#define rep(i,n) for(ll i=0;i<(n); ++i)
#define per(i,n) for(ll i=n-1;i>=0; --i)
#define all(x) (x).begin(),(x).end()
#define _GLIBCXX_DEBUG
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
typedef long long ll;
const ll MOD = 1000000007;
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}
ll getDigit(ll n) {
	ll cnt = 0;
	while (n != 0) {
		n /= 10;
		cnt++;
	}
	return cnt;
}
typedef pair<double,long long> pair_t;
bool comp(const pair_t& a, const pair_t& b) {
	if (a.first == b.first)return  a.second > b.second;
	else {
		return a.first > b.first;
	}
}
string shrink(string s,char c) {
	string t;
	for (ll k = 0; k < s.length() - 1; k++) {
		if (s[k] == c)t += s[k];
		else if (s[k + 1] == c)t += s[k+1];
		else t += s[k];
	}
	return t;
}

int main() {
	ll cnt = 0, mCnt = INF;
	string s,t="";
	cin >> s;
	for (char i = 'a'; i <= 'z'; i++) {
		t = s;
		cnt = 0;
		while (count(all(t),i) != t.length()) {
			if (count(all(t), i) == 0) {
				cnt = INF;
				break;
			}
			t = shrink(t, i);
			cnt++;
		}
		mCnt = min(cnt,mCnt);
	}
	cout << mCnt << endl;
}

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<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define REP(i, n) for(int i=0; i<(n); ++i)
#define FOR(i, a, b) for(int i=(a); i<(b); ++i)
#define FORR(i, a, b) for(int i=(b)-1; i>=(a); --i)

#define DEBUG(x) cout<<#x<<": "<<x<<'\n'
#define DEBUG_VEC(v) cout<<#v<<":";REP(i, v.size())cout<<' '<<v[i];cout<<'\n'
#define ALL(a) (a).begin(), (a).end()

#define CHMIN(a, b) a=min((a), (b))
#define CHMAX(a, b) a=max((a), (b))

const ll MOD=1000000007ll;
// const ll MOD=998244353ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

const double EPS=1e-11;
#define EQ0(x) (abs((x))<EPS)
#define EQ(a, b) (abs((a)-(b))<EPS)

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	string s;
	ll k;
	cin>>s>>k;
	REP(i, s.size()){
		if(s[i]!='1' && k>i){
			cout<<s[i]<<'\n';
			return 0;
		}
	}
	cout<<1<<'\n';
	return 0;
}


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

int main() {
  int n, c=0;
  cin >> n;
  vector<ll> l(n);
  for(int i=0;i<n;i++)
    cin >> l.at(i);
  
  sort(l.begin(), l.end());
  
  for(int i=0;i<n-2;i++)
    for(int j=i+1;j<n-1;j++){
      if(l.at(i)==l.at(j))
        continue;
      for(int k=j+1;k<n;k++){
        if(l.at(j)==l.at(k))
          continue;
        if(l.at(i) + l.at(j) > l.at(k))
          c++;
      }
    }
  cout << c;
  return 0;
}


Measured memory_bytes: 3632
#include<stdio.h>
#include<math.h>
int main(void){

	int X,i,j,k,a=0;

	scanf("%d",&X);

		for(j=(int)sqrt(X);j>0;j--)
			for(k=2;(pow(j,k)<=X)&&(k<=9);k++)
				if(pow(j,k)<=X&&pow(j,k)>a)
					a=pow(j,k);

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

	return 0;
}

Measured memory_bytes: 128
#include "stdio.h"
#include "string.h"
#include "stdlib.h"

int compare(const void *a, const void *b)
{
    return strcmp(a,b);
}

int main(void)
{
    int n;
    scanf("%d",&n);
    char s[n][11];
    int i,j;
    int count=0;
    int flag=0;

    scanf("%s",s[0]);
    for(i=1;i<n;i++)
    {
        scanf("%s",s[i]);
    }

    qsort(s,n,11,compare);
    for(j=0;j<n;j++)
    {
        if(strcmp(s[j],s[j+1])!=0)
        {
            count++;
        }
    }
    printf("%d",count);

    return 0;
}

Measured memory_bytes: 5744
package main

import (
	"fmt"
)

func main() {
	var s string
	fmt.Scan(&s)
	f := true
	
	for i := 0; i < 3; i++ {
		if string(s[i]) == string(s[i+1]) {
			f = false
		}
	}
	
	if f {
		fmt.Println("Good")
	} else {
		fmt.Println("Bad")
	}
}


Measured memory_bytes: 512
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>

#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))

int main(void){
    int s, w;
    scanf("%d%d",&s ,&w);
    if(w>=s){
        printf("unsafe");
    }
    else{
        printf("safe");
    }
    return 0; 
}


Measured memory_bytes: 1732
# lcmを求めればいいと思います はい
# なんかダメでした
# なんかアルゴリズムのコアは合ってたけどa,bとansの取扱がミスってたっぽい

n = gets.chomp.to_i

def gcd(a, b)
  return gcd(b, a) if a<b
  return a if b==0
  return gcd(b, a%b)
end

def lcm(a, b)
  return (a*b/gcd(a, b))
end

if n==1
  puts gets.chomp.to_i
else
  a = gets.chomp.to_i
  ans = 0
  (n-1).times do
    b = gets.chomp.to_i
    a = lcm(a, b)
  end
  puts a
end

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



int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
	int x,y,z;
  cin >> x >> y >> z;
  x-=z;
  cout << x/(z+y) << endl;
  return 0;
    

}


Measured memory_bytes: 256