akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#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 <iomanip>//setprecision
#include<math.h>
#include <functional>
#include<climits>
using namespace std;
#define rep(i, n)        for(int i=0; i<(int)(n); ++i)
int main(){ 
  string a;cin>>a;
  a[5]=' ';
  a[13]=' ';
  cout<<a;
  }


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
using namespace std;

#define rep(i,a,n) for(int (i)=(a); (i)<(n); (i)++)
#define repq(i,a,n) for(int (i)=(a); (i)<=(n); (i)++)
#define repr(i,a,n) for(int (i)=(a); (i)>=(n); (i)--)
#define all(v) begin(v), end(v)
#define pb(a) push_back(a)
#define fr first
#define sc second
#define INF 2000000000
#define int long long int

#define X real()
#define Y imag()
#define EPS (1e-10)
#define EQ(a,b) (abs((a) - (b)) < EPS)
#define EQV(a,b) ( EQ((a).X, (b).X) && EQ((a).Y, (b).Y) )
#define LE(n, m) ((n) < (m) + EPS)
#define LEQ(n, m) ((n) <= (m) + EPS)
#define GE(n, m) ((n) + EPS > (m))
#define GEQ(n, m) ((n) + EPS >= (m))

typedef vector<int> VI;
typedef vector<VI> MAT;
typedef pair<int, int> pii;
typedef long long ll;

typedef complex<double> P;
typedef pair<P, P> L;
typedef pair<P, double> C;

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

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

signed main() {
    int n; cin >> n;
    int x = 800 * n;
    int y = 200 * (n / 15);
    cout << x - y << endl;
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<algorithm>
#include<cmath>
#include<climits>
#include<string>
#include<set>
#include<numeric>
#include<map>
#include<iostream>
using namespace std;
#define rep(i,n) for(int i = 0;i<((int)(n));i++)
#define reg(i,a,b) for(int i = ((int)(a));i<=((int)(b));i++)
#define irep(i,n) for(int i = ((int)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(int i = ((int)(b));i>=((int)(a));i--)
typedef long long ll;
typedef pair<ll, ll> mp;

ll N,a,b,c,T[101],Q,K,x[100010],y[100010];
vector<vector<int> > movable(100010);
vector<vector<int> > cost(100010);
ll dist[100010];
int visited[100010]={};

void dfs(int before){
	// cout<<before<<"|"<<dist[before]<<endl;
	rep(i,movable[before].size()){
		if(visited[movable[before][i]]==0){
			visited[movable[before][i]]=1;
			dist[movable[before][i]]=dist[before]+cost[before][i];
			dfs(movable[before][i]);
		}
	}
}

int main(void){
	cin>>N;
	rep(i,N-1){
		cin>>a>>b>>c;
		movable[a].push_back(b);
		movable[b].push_back(a);
		cost[a].push_back(c);
		cost[b].push_back(c);
	}
	cin>>Q>>K;
	//Kを根にした各頂点の深さを求めれば良い。
	dist[K]=0;
	visited[K]=1;
	dfs(K);
	rep(i,Q)cin>>x[i]>>y[i];
	rep(i,Q)cout<<dist[x[i]]+dist[y[i]]<<endl;
	return 0;
}

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

int alpha_to_int(char a) {
    string alpha = "abcdefghijklmnopqrstuvwxyz";
    return alpha.find(a);
}

char int_to_alpha(int i) {
    string alpha = "abcdefghijklmnopqrstuvwxyz";
    return alpha.at(i);
}

int count_common(string s, string t) {
    vector<int> vs(26), vt(26), vst(26);
    for (int i = 0; i < s.size(); i++) {
        vs[alpha_to_int(s[i])] = 1;
    }
    for (int i = 0; i < t.size(); i++) {
        vt[alpha_to_int(t[i])] = 1;
    }
    rep(i,26) {
        vst[i] = vs[i] * vt[i];
    }
    return accumulate(vst.begin(), vst.end(), 0);
}

int main() {
    int n;
    string s;
    cin >> n >> s;
    int ans = 0;
    for (int i = 1; i < n; i++) {
        ans = max(count_common(s.substr(0,i), s.substr(i, n-i)), ans);
    }
    cout << ans << endl;
}



Measured memory_bytes: 256
// Best practice
 
#include<bits/stdc++.h>
 
#define int         long long
#define pb          push_back
#define pf          emplace_front
#define all(a)      (a).begin(),(a).end()
#define rall(a)     (a).rbegin(),(a).rend()
#define pii         pair<int,int>
#define psi         pair<string,int>
#define vi          vector<int>
#define vpii        vector<pii>
#define vvi         vector<vi>
#define sz(x)       (int)(x).size()
#define x           first
#define y           second
#define endl        '\n'
#define tezz        ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define MOD         1000000007
#define hell        998244353
#define prec(n)     fixed<<setprecision(n)
#define ini(a, i)   memset(a, i, sizeof(a))
#define output(x)   cout << (x ? "YES" : "NO")<<endl;
using namespace std;
 
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge {c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
    #ifndef LOCAL
    ~debug() { cerr << endl; }
    eni(!=) cerr << boolalpha << i; ris; }
    eni(==) ris << range(begin(i), end(i)); }
    sim, class b dor(pair < b, c > d) {
      ris << "(" << d.first << ", " << d.second << ")";
    }
    sim dor(rge<c> d) {
      *this << "[";
      for (auto it = d.b; it != d.e; ++it)
        *this << ", " + 2 * (it == d.b) << *it;
      ris << "]";
    }
    #else
    sim dor(const c&) { ris; }
    #endif
};
#define imie(...) "[" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
 
 
// const int dx[4] = { -1, 1, 0, 0};
// const int dy[4] = {0, 0, -1, 1};
// int dX[] = { -1, -1, -1, 0, 0, 1, 1, 1 };
// int dY[] = { -1, 0, 1, -1, 1, -1, 0, 1 };
 
 
// Code from Here -------------------------------------------------------------------------------

signed main() {
    tezz
 
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif

    int n, k, p, q;
    cin >> n >> k;
    int ans = 0;
    for(int i=0; i<n; i++){
        cin >> p >> q;
        ans += ((p*p + q*q)<=k*k);
    }
    cout << ans << endl;
 
    return 0;
}  

Measured memory_bytes: 3652
n = int(input())
a = list(map(int, input().split()))

ans = True

for i in range(n):
    if a[i] % 2 == 0 and (a[i] %3 != 0 and a[i] % 5 != 0):
        ans = False
        break

print('APPROVED' if ans else 'DENIED')

Measured memory_bytes: 3060
/*
 * じょえチャンネルを応援します！
 * https://www.youtube.com/watch?v=gPFr7q7eLL8
 */
void main() {
	auto N = ri;
	auto X = readAs!(int[]);
	ulong res = ulong.max;
	foreach(i; 1..101) {
		ulong tmp;
		foreach(v; X) {
			tmp += pow((v - i), 2);
		}
		res = min(res, tmp);
	}
	res.writeln;
}

// ===================================

import std.stdio;
import std.string;
import std.functional;
import std.algorithm;
import std.range;
import std.traits;
import std.math;
import std.container;
import std.bigint;
import std.numeric;
import std.conv;
import std.typecons;
import std.uni;
import std.ascii;
import std.bitmanip;
import core.bitop;

T readAs(T)() if (isBasicType!T) {
	return readln.chomp.to!T;
}
T readAs(T)() if (isArray!T) {
	return readln.split.to!T;
}

T[][] readMatrix(T)(uint height, uint width) if (!isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		res[i] = readAs!(T[]);
	}
	return res;
}

T[][] readMatrix(T)(uint height, uint width) if (isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		auto s = rs;
		foreach(j; 0..width) res[i][j] = s[j].to!T;
	}
	return res;
}

int ri() {
	return readAs!int;
}

double rd() {
	return readAs!double;
}

string rs() {
	return readln.chomp;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define rep(i,n) for (int i = (0); i < (n); ++i)
#define rng(x) (x).begin(),(x).end()
#define rrng(x) (x).rbegin(),(x).rend()
#define debug(x) cout << #x << " = " << (x) << endl;
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define uni(x) x.erase(unique(rng(x)),x.end())
#define SP << " " <<
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
const int mod = 1000000007;
const double EPS = 1e-9;
const int INF = 1<<30;
const ll INFLL = 1LL<<60;
//cout << fixed << setprecision(10);

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

int main () {
  int n;
  cin >> n;
  vi a(n);
  rep(i,n) cin >> a[i];
  
  int b1 = 0, b2 = 0, b4 = 0;
  auto f = [&](int x) {
    int cnt = 0;
    while (x%2 == 0) {
      x /= 2;
      cnt++;
    }
    return cnt;
  };

  rep(i,n) {
    if (f(a[i]) == 0) b1++;
    else if (f(a[i]) == 1) b2++;
    else b4++;
  }
  
  if (b2 == 0) puts(b1 <= b4+1 ? "Yes" : "No");
  else puts(b1 <= b4 ? "Yes" : "No");
  return 0;
}

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

using namespace std;
typedef long long ll;

struct Node{
    int left, right;
    bool lazy;
    int k;
}nodes[2][800000];

void build(int tp, int u, int l, int r, int n){
    nodes[tp][u].left = l;
    nodes[tp][u].right = r;
    nodes[tp][u].k = n;
    nodes[tp][u].lazy = false;
    if(l == r){
        return;
    }
    build(tp, u << 1, l, (l + r) >> 1, n);
    build(tp, (u << 1) + 1, ((l + r) >> 1) + 1, r, n);
    return;
}

int query(int tp, int u, int x){
    if(!nodes[tp][u].lazy)
        return nodes[tp][u].k;
    if(x <= nodes[tp][u << 1].right)
        return query(tp, u << 1, x);
    else
        return query(tp, (u << 1) + 1, x);
}

void modify(int tp, int u, int l, int r, int k){
    if(nodes[tp][u].left == l && nodes[tp][u].right == r && !nodes[tp][u].lazy){
        if(k < nodes[tp][u].k)
            nodes[tp][u].k = k;
        return;
    }
    if(nodes[tp][u].left == l && nodes[tp][u].right == r && k < nodes[tp][u].k){
        nodes[tp][u].k = k;
        nodes[tp][u].lazy = false;
        return;
    }
    if(!nodes[tp][u].lazy){
        nodes[tp][u << 1].lazy = false;
        nodes[tp][(u << 1) + 1].lazy = false;
        nodes[tp][u << 1].k = nodes[tp][u].k;
        nodes[tp][(u << 1) + 1].k = nodes[tp][u].k;
    }
    nodes[tp][u].lazy = true;
    if(r <= nodes[tp][u << 1].right)
        modify(tp, u << 1, l, r, k);
    else if(l >= nodes[tp][(u << 1) + 1].left)
        modify(tp, (u << 1) + 1, l, r, k);
    else{
        modify(tp, u << 1, l, nodes[tp][u << 1].right, k);
        modify(tp, (u << 1) + 1, nodes[tp][(u << 1) + 1].left, r, k);
    }
    nodes[tp][u].k = min(nodes[tp][u << 1].k, nodes[tp][(u << 1) + 1].k);
}


void solve(){
    int n, q;
    cin >> n >> q;
    build(0, 1, 1, n, n);
    build(1, 1, 1, n, n);
    long long ans = (n - 2) * 1ll * (n - 2);
    while(q--){
        int t, x;
        cin >> t >> x;
        int m = query(t - 1, 1, x);
        if(m <= 2)
            continue;
        ans -= m * 1ll - 2;
        modify(2 - t, 1, 2, m - 1, x);
    }
    cout << ans << "\n";
}

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

Measured memory_bytes: 20012
# でつoO(YOU PLAY WITH THE CARDS YOU'RE DEALT..)
import sys
def main():
    input = sys.stdin.readline
    R, C, K = map(int, input().split())
    M = [[0] * C for _ in range(R)]
    for _ in range(K):
        r, c, v = map(int, input().split())
        M[r - 1][c - 1] = v

    # dp[i][j][k]=(i,j)にいてその行でk個取得済みの場合の価値の最大値
    dp = [[-1] * 4 for _ in range(C)]
    dp[0][0] = 0
    dp[0][1] = M[0][0]
    for i in range(R):
        nxt = [[-1] * 4 for _ in range(C)]
        for j in range(C):
            now = dp[j]
            for k in range(4):
                nowk = now[k]
                if nowk < 0: continue
                # 下へ
                if i < R - 1:
                    down = nxt[j]
                    # 取らない
                    down[0] = max(down[0], nowk)
                    # 取る
                    v = M[i + 1][j]
                    if v > 0:
                        down[1] = max(down[1], nowk + v)
                # 右へ
                if j < C - 1:
                    right = dp[j + 1]
                    # 取らない
                    right[k] = max(right[k], nowk)
                    # 取る
                    v = M[i][j + 1]
                    if v > 0 and k < 3:
                        right[k + 1] = max(right[k + 1], nowk + v)
        if i < R - 1: dp = nxt
    print(max(dp[C - 1]))

if __name__ == '__main__':
    main()


Measured memory_bytes: 227772
#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = a; i < (b); i++)
#define rrep(i, a, b) for (int i = a; i >= (b); i--)
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
using P = pair<int, int>;
template <class T>
inline bool chmin(T& a, T b) {
   if (a > b) {
      a = b;
      return true;
   }
   return false;
}
template <class T>
inline bool chmax(T& a, T b) {
   if (a < b) {
      a = b;
      return true;
   }
   return false;
}
void hr() {
   cerr << "--------------" << endl;
}
const int INF = 1001001001;
const int MOD = 1000000007;

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

   int n, q;
   string s;
   cin >> n >> s >> q;
   vector<set<int>> is(26);
   rep(i, 0, n) is[s[i] - 'a'].insert(i);
   rep(i, 0, q) {
      int f;
      cin >> f;
      if (f == 1) {
         int id;
         char c;
         cin >> id >> c;
         id--;
         is[s[id] - 'a'].erase(id);
         s[id] = c;
         is[s[id] - 'a'].insert(id);
      } else {
         int l, r;
         cin >> l >> r;
         l--;
         int ans = 0;
         rep(i, 0, 26) {
            auto it = is[i].lower_bound(l);
            if (it != is[i].end() && *it < r) ans++;
         }
         printf("%d\n", ans);
      }
   }
   return 0;
}

Measured memory_bytes: 24220
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<bitset>
using namespace std;
//#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define ARDEB(i,X) cout<< #X <<"["<<i<<"]: "<<X[i]<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define ARDEB(i,X) {}
#define END {}
#endif
typedef long long int ll;
#define int long long
typedef pair<int,int> P;
struct edge{int to,cost;};
#define REP(i,n) for(int i=0;i<(n);i++)
const int INF=100000000000000000;

signed main(){
	string S,T="keyence";
	cin>>S;
	for(int i=1;i<=S.size();i++){
		for(int j=0;j<S.size();j++){
			string sub,sub2;
			for(int k=0;k<=j;k++){
				sub+=S[k];
			}
			for(int k=j+i;k<S.size();k++){
				sub2+=S[k];
			}
			if(sub+sub2==T){
				DEB(sub)DEB(sub2)END
				cout<<"YES"<<endl;
				return 0;
			}
		}
	}
	cout<<"NO"<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int n;
	int i, j;
	int signal;
	int num;
	int a[10] = {63, 6, 91, 79, 102, 109, 125, 39, 127, 111};

	while (1){
		scanf("%d", &n);

		if (n == -1){
			break;
		}

		signal = 0;

		for (i = 0; i < n; i++){
			scanf("%d", &num);

			signal ^= a[num];

			for (j = 6; j >= 0; j--){
				printf("%d", (signal >> j) & 1);
			}
			printf("\n");

			signal = a[num];
		}
	}

	return (0);
}

Measured memory_bytes: 600
#include <iostream>
#include <string>
#include <cstring>

std::string str;

int memo[303][303][303];

int dp(int l, int r, int k) {
	if(k < 0) {
		return -1e9;
	} else if(l > r) {
		return 0;
	}
	int &ans = memo[l][r][k];
	if(ans != -1) {
		return ans;
	}
	ans = 0;
	if(str[l] == str[r]) {
		ans = 1 + (l != r) + dp(l + 1, r - 1, k);
	}
	ans = std::max(std::max(ans, 1 + (l != r) + dp(l + 1, r - 1, k - 1)), std::max(dp(l + 1, r, k), dp(l, r - 1, k)));
	return ans;
}

int main() {
	int k;
	std::cin >> str >> k;
	memset(memo, -1, sizeof memo);
	std::cout << dp(0, str.size() - 1, k) << '\n';
}

Measured memory_bytes: 108928
#B
s = input()

kisu = []
gusu = []
for i in range(len(s)):
    if i % 2 == 0:
        kisu.append(s[i])
    else:
        gusu.append(s[i])


if kisu.count("L") == 0:
    if gusu.count("R") == 0:
        print("Yes")
    else:
        print("No")
else:
    print("No")

Measured memory_bytes: 3060
#!/usr/bin/env python3
import collections as cl
import sys


def II():
    return int(sys.stdin.readline())


def MI():
    return map(int, sys.stdin.readline().split())


def LI():
    return list(map(int, sys.stdin.readline().split()))


def main():
    bingo_num = []

    for i in range(3):
        N = LI()
        bingo_num.append(N)

    N = II()

    for i in range(N):
        b = II()
        for row_i in range(3):
            for col_j in range(3):
                if bingo_num[row_i][col_j] == b:
                    bingo_num[row_i][col_j] = 0

    for i in range(3):
        if sum(bingo_num[i]) == 0:
            print("Yes")
            exit()

    for j in range(3):
        if bingo_num[0][j] + bingo_num[1][j] + bingo_num[2][j] == 0:
            print("Yes")
            exit()

    sum_naname = 0
    sum_naname_2 = 0
    for i in range(3):
        sum_naname += bingo_num[i][i]
        sum_naname_2 += bingo_num[i][2 - i]

    if sum_naname == 0 or sum_naname_2 == 0:
        print("Yes")
        exit()
    print("No")


main()


Measured memory_bytes: 65084
import java.util.*;

class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		int K = sc.nextInt();
		List<Integer> a = new ArrayList<Integer>();
		for (int i=1;i<=100;i++) {
			if (A%i==0) {
				a.add(i);
			}
		}
		List<Integer> b = new ArrayList<Integer>();
		for (int i=1;i<=100;i++) {
			if (B%i==0) {
				b.add(i);
			}
		}
		List<Integer> c = new ArrayList<Integer>();
		for (int i=0;i<a.size();i++){
			if (b.contains(a.get(i))) {
				c.add(a.get(i));
			}
		}
		System.out.println(c.get(c.size()-K));
	}
}

Measured memory_bytes: 22740
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author alireza_kaviani
 */

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;

template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;

#define all(x)                      (x).begin(),(x).end()
#define Sort(x)                     sort(all((x)))
#define X                           first
#define Y                           second
#define sep                         ' '
#define endl                        '\n'
#define SZ(x)                       ll(x.size())

ll poww(ll a, ll b, ll md) {
    return (!b ? 1 : (b & 1 ? a * poww(a * a % md, b / 2, md) % md : poww(a * a % md, b / 2, md) % md));
}

const ll MAXN = 1000 + 10;
const ll LOG = 22;
const ll INF = 8e18;
const ll MOD = 1e9 + 7; // 998244353; // 1e9 + 9;

ll n , m , dp[MAXN][MAXN];
string s[MAXN];

int main() {
    ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    for(ll i = 0 ; i < MAXN ; i++)  fill(dp[i] , dp[i] + MAXN , INF);
    for(ll i = 0 ; i < MAXN ; i++)  dp[0][i] = dp[i][0] = 0;

    cin >> n >> m;
    s[0] = string(m + 10 , '.');
    for(ll i = 1 ; i <= n ; i++)    cin >> s[i] , s[i] = "." + s[i];

    dp[1][1] = (s[1][1] == '#' ? 1 : 0);
    for(ll i = 1 ; i <= n ; i++){
        for(ll j = 1 ; j <= m ; j++){
            if(i != 1)  dp[i][j] = min(dp[i][j] , dp[i - 1][j] + (s[i][j] == '#' && s[i - 1][j] == '.'));
            if(j != 1)  dp[i][j] = min(dp[i][j] , dp[i][j - 1] + (s[i][j] == '#' && s[i][j - 1] == '.'));
        }
    }
    cout << dp[n][m] << endl;

    return 0;
}
/*

*/


Measured memory_bytes: 8320
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
#define rep(i,n) for(ll i=0;i<(n);i++)
#define repr(i,n) for(ll i=(n-1);i>=0;i--)
#define all(x) x.begin(),x.end()
#define br cout << "\n";
using namespace std;
const int INF = 1e9;
const int MOD = 1e9+7;
using Graph = vector<vector<ll>>;
template<class T> inline bool chmin(T &a, T b) { if(a > b){ a = b; return true;} return false;}
template<class T> inline bool chmax(T &a, T b) { if(a < b){ a = b; return true;} return false;}

// 0 false, 1 true 
// string to int : -48
// ceil(a)  1.2->2.0
// c++17	g++ -std=c++17 a.cpp

int main() {
    std::cout << std::fixed << std::setprecision(15);
    ld x;
    cin >> x;

    ll count = 1;
    ll tmp = 100;
    while(true){
        tmp = tmp * 1.01;
        ll tmp2 = tmp / 1;
        if(tmp2 >= x){
            break;
        }
        count++;
    }

    cout << count << endl;

}

Measured memory_bytes: 3728
/*
このコード、と～おれ!
Be accepted!
∧＿∧　
（｡･ω･｡)つ━☆・*。
⊂　　 ノ 　　　・゜+.
　しーＪ　　　°。+ *´¨)
 　　　　　　　　　.· ´¸.·*´¨) ¸.·*¨)
		  　　　　　　　　　　(¸.·´ (¸.·'* ☆
					*/

#include <stdio.h>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstring>
#include <vector>
#include <numeric>
#include <iostream>
#include <random>
#include <map>
#include <unordered_map>
#include <queue>
#include <regex>

#pragma GCC optimize("Ofast")
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define rep1(i, n) for(int i = 1; i <= (n); ++i)
#define rep2(i, n) for(int i = 2; i < (n); ++i)
#define repr(i, n) for(int i = n; i >= 0; --i)
#define reprm(i, n) for(int i = n - 1; i >= 0; --i)
#define printynl(a) printf(a ? "yes\n" : "no\n")
#define printyn(a) printf(a ? "Yes\n" : "No\n")
#define printYN(a) printf(a ? "YES\n" : "NO\n")
#define printin(a) printf(a ? "possible\n" : "inposible\n")
#define printdb(a) printf("%.50lf\n", a)//少数出力
#define printdbd(a) printf("%.16lf\n", a)//少数出力(桁少なめ)
#define prints(s) printf("%s\n", s.c_str())//string出力
#define all(x) (x).begin(), (x).end()
#define allsum(a, b, c) ((a + b) * c / 2)//等差数列の和、初項,末項,項数
#define pb push_back
#define priq priority_queue
#define rpriq priq<int, vector<int>, greater<int>>
#define deg_to_rad(deg) (((deg)/360.0)*2.0*PI)
#define rad_to_deg(rad) (((rad)/2.0/PI)*360.0)
#define Please return
#define AC 0

using ll = long long;

constexpr int INF = 1073741823;
constexpr int MINF = -1073741823;
constexpr ll LINF = ll(4661686018427387903);
constexpr ll MOD = 1000000007;
const double PI = acos(-1);

using namespace std;

void scans(string& str) {
	char c;
	str = "";
	scanf("%c", &c);
	if (c == '\n')scanf("%c", &c);//最初の改行対策
	while (c != '\n' && c != -1) {
		str += c;
		scanf("%c", &c);
	}
}

void scanc(char& str) {
	char c;
	scanf("%c", &c);
	if (c == -1)return;
	while (c == '\n') {
		scanf("%c", &c);
	}
	str = c;
}

double acot(double x) {
	return PI / 2 - atan(x);
}

/*-----------------------------------------ここからコード-----------------------------------------*/


int main() {
	
	int a, b, c;
	scanf("%d%d%d", &a, &b, &c);
	if(a > c)swap(a, c);
	if(b > c)swap(b, c);
	printf("%d\n", a + b);
	
	Please AC;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define vi vector<ll>
#define vvi vector<vi>
#define BITLE(n) (1LL<<((ll)n))
#define SUBS(s,f,t) ((s).substr((f),(t)-(f)))
#define ALL(a) (a).begin(),(a).end()
#define Max(a) (*max_element(ALL(a)))
#define Min(a) (*min_element(ALL(a)))
using namespace std;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll k;cin>>k;
  string s;cin>>s;
  if(s.size() <= k)cout<<s<<endl;
  else{
    for(int i=0;i<k;i++){
      cout<<s[i];
    }
    cout<<"..."<<endl;
  }
  return 0;
}

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

class MyClass
{
    public static void Main(string[] args)
    {
        var N = int.Parse(Console.ReadLine());
        var a = Console.ReadLine().Split().Select(int.Parse).ToArray();

        for (int i = 0; i < N; i++)
        {
            var v = a[i];
            var j = i - 1;
            while (j >= 0 && a[j] > v)
            {
                a[j + 1] = a[j];
                j--;
            }
            if (i > 0)
            {
                a[j + 1] = v;
            }
            Console.WriteLine(string.Join(" ", a));
        }
    }
}


Measured memory_bytes: 18308
n, k = map(int, input().split())
a = []

for i in range(k):
    d = int(input())
    a.append(list(map(int, input().split())))

# print(a)
ans = 0

for i in range(1, n+1):
    for j in range(len(a)):
        if i in a[j]:
            break
    else:
        ans += 1

print(ans)




Measured memory_bytes: 67572
#include<stdio.h>

long LCM(int a, int b)
{
	long i = 2;
	long lcm;
	
	if(a > b)
	{
		lcm = a;
		while(lcm % b != 0)
		{
			lcm = a * i;
			++i;
		}
		return lcm;
	}
	else
	{
		lcm = b;
		while(lcm % a != 0)
		{
			lcm = b * i;
			++i;
		}
		return lcm;
	}
	
}

long GCD(int a, int b)
{
	long gcd;
	
	if(a > b)
	{
		gcd = a % b;
		while(gcd != 0)
		{
			a = b;
			b = gcd;
			gcd = a % b;
		}
		return b;
	}
	else
	{
		gcd = b % a;
		while(gcd != 0)
		{
			b = a;
			a = gcd;
			gcd = b % a;
		}
		return a;
	}
}

int main(void)
{
	long a, b;
	long gcd, lcm;

	while(scanf("%ld %ld", &a, &b) != EOF)
	{
		gcd = GCD(a, b);
		lcm = LCM(a, b);
		printf("%ld %ld\n", gcd, lcm);
	}

	return 0;
}

Measured memory_bytes: 596
#include<stdio.h>
 int main(){
 int i,a,b,c;
 int t;

 scanf("%d%d%d",&a,&b,&c);
 t=0;

 for(i=a;i<=b;i++){
 if(c%i==0)t++;
 }

 printf("%d\n",t);
 return 0; 
 }



Measured memory_bytes: 2108
#include <iostream>
#include <string>
#include <vector>

int main()
{
        int n, k;
        std::vector<int> a;

        std::cin >> n >> k;
        for (int i = 0; i < n; ++i) {
                int x;
                std::cin >> x;
                a.push_back(x);
        }

        int count = (n - 1 + (k - 2)) / (k - 1);
        std::cout << count << "\n";
        return 0;
}

Measured memory_bytes: 892
#include<string>
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<array>
#include<map>
using namespace std;
typedef long long int llint;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
const int mod=1000000007;
const llint big=1e18+10;
const long double pai=3.141592653589793238462643383279502884197;
const long double eps=1e-9;
template <class T,class U>void mineq(T& a,U b){if(a>b){a=b;}}
template <class T,class U>void maxeq(T& a,U b){if(a<b){a=b;}}
llint gcd(llint a,llint b){if(a%b==0){return b;}else return gcd(b,a%b);}
llint lcm(llint a,llint b){return a/gcd(a,b)*b;}
int main(void){
	llint n,i,q,ans=1;cin>>n;
	vector<int>a(n);
	for(i=0;i<n;i++){cin>>q;ans=lcm(ans,q);}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <sstream>
#include <iomanip>
#define rep(i,n) for(int i = 0; i < n; i++)
#define rep1(i,n) for(int i = 1; i <= n; i++)
#define co(x) cout << x <<endl
#define cs(x) cout << x <<" "
#define ALL(a) (a).begin(),(a).end()
typedef long long ll;
using namespace std;
int numP2(int);

int main()
{
	int N;
	cin >> N;
	vector<int> num2(3, 0);
	rep(i, N)
	{
		int tmp;
		cin >> tmp;
		int num = numP2(tmp);
		if (num == 0)num2[0]++;
		else if (num == 1)num2[1]++;
		else num2[2]++;
	}
	if (num2[1] == 0)
	{
		if (num2[2] >= num2[0]-1)
		{
			co("Yes");
			return 0;
		}
		else
		{
			co("No");
			return 0;
		}
	}
	else
	{
		if (num2[2] >= num2[0])
		{
			co("Yes");
			return 0;
		}
		else
		{
			co("No");
			return 0;
		}
	}
	return 0;
}

int numP2(int a)
{
	int res = 0;
	while (a % 2 == 0)
	{
		a /= 2;
		res++;
	}
	return res;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = (s); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) for(int i = (n); i >= 0; i--)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << '\n';
#define CFYN(n) cout << ( (n) ? "YES":"NO") << '\n';
#define OUT(n) cout << (n) << '\n';
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;

vector<vector<int>> g;
int ans = 0;

void dfs(vector<bool> visit, int par,int cnt) {
    visit[cnt] = true;
    if (find(ALL(visit),false) == visit.end()) {
        ans++;
        return;
    }
    for(auto x:g[cnt] ) {
        if (x == par) continue;
        if (visit[x]) continue;
        dfs(visit,cnt,x);
    }
}

int main(void)
{
    IOS
    int N, M;
    cin >> N >> M;
    g.resize(N);
    REP(i,M) {
        int a, b;
        cin >> a >> b;
        a--; b--;
        g[a].push_back(b);
        g[b].push_back(a);
    }
    dfs(vector<bool>(N),-1,0);

    cout << ans << '\n';


    return 0;
}

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

int main(){
  int n, q, query, t, x;
  cin >> n >> q;
  vector<priority_queue<int>> Q(n);
  for(int i = 0; i < q; i++){
    cin >> query;
    if(query == 0){
      cin >> t >> x;
      Q[t].push(x);
    }else if(query == 1){
      cin >> t;
      if(!Q[t].empty()){
        cout << Q[t].top() << endl;
      }
    }else{
      cin >> t;
      if(!Q[t].empty()){
        Q[t].pop();
      }
    }
  }
  return 0;
}


Measured memory_bytes: 4016
#include<iostream>
using namespace std;
int main() {
	int a[5];
	int ans = 0;
	for (int i = 0; i < 5; i++) {
		cin >> a[i];
	}
	for (int i = 0; i < 5; i++) {
		if (a[i] == 0) {
			ans = i + 1;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3632
#上下方向の探索と左右方向の探索をまとめる
#まず表を完成させる-->全マスの探索
H, W = map(int, input().split())
lst = [['#'] * (W+2)]
lst += [['#'] + list(input()) + ['#'] for i in range(H)]
lst += [['#'] * (W+2)]


lst_ue = [[0] * (W+2) for i in range(H+2)]
lst_shita = [[0] * (W+2) for i in range(H+2)]
lst_migi = [[0] * (W+2) for i in range(H+2)]
lst_hidari = [[0] * (W+2) for i in range(H+2)]

for i in range(1, H+1):
    for j in range(1, W+1):
        lst_hidari[i][j] = 0 if lst[i][j] == '#' else 1 + lst_hidari[i][j-1]
    for j in range(W, 0, -1):
        lst_migi[i][j] = 0 if lst[i][j] == '#' else 1 + lst_migi[i][j+1]

for j in range(1, W+1):
    for i in range(1, H+1):
        lst_ue[i][j] = 0 if lst[i][j] == '#' else 1 + lst_ue[i-1][j]
    for i in range(H+1, 0, -1):
        lst_shita[i][j] = 0 if lst[i][j] == '#' else 1 + lst_shita[i+1][j]

ans = 0
for i in range(1,H+1):
    for j in range(1, W+1):
        ans = max(ans, lst_ue[i][j]+lst_shita[i][j]+lst_migi[i][j]+lst_hidari[i][j]-3)

print (ans)


Measured memory_bytes: 313096
def main():
  s = list(input())
  divide = []
  compare = 0
  for i in range(len(s)):
    if s[i] == compare and i != len(s)-1:
      s[i+1] = s[i] + s[i+1]
    elif s[i] == compare:
      break
    else:
      compare = s[i]
      divide.append(s[i])
      # print(divide)
  print(len(divide))


if __name__ == '__main__':
  main()


Measured memory_bytes: 9636
#include <iostream>
#include <stdio.h>
using namespace std;
int main()
{
	int t;
	int x[6];
	for (t = 0; t < 6; t++)
		cin >> x[t];
	int k = x[5];

	int max = x[0];
	int min = x[0];
	int v;
	for (v = 0; v < 5; v++) {
		if (max < x[v])
			max = x[v];
		if (min > x[v])
			min = x[v];
	}
	int sabun = max - min;

	if (sabun <= k)
		cout << "Yay!";
	else
		cout << ":(";



	
}


Measured memory_bytes: 256
def readinput():
    a,b,k=list(map(int,input().split()))
    return a,b,k

def main(a,b,k):
    ans=0
    count=0
    for i in range(min(a,b),0,-1):
        if a%i==0 and b%i==0:
            count+=1
            if count==k:
                return i


if __name__=='__main__':
    a,b,k=readinput()
    ans=main(a,b,k)
    print(ans)


Measured memory_bytes: 3064
n=int(input())
 
cnt=0
tmp=0
 
while n>tmp:
    cnt+=1
    tmp+=26**cnt
 
num=n-(tmp//26)

ans=["0"]*cnt

for i in range(1, cnt+1):
    j=num%26
    num//=26
    add=chr(ord("a")+j)
    ans[-i]=add

print(*ans, sep='')

Measured memory_bytes: 61888
a,b,c,k=map(int,input().split())
aa=0
if(k<=a):
    aa+=k
if(k>a):
    aa+=a
    k=k-a
if(k<=b and k>0):
    k=0
if(k>b):
    k=k-b
if(k<=c and k>0):
    aa=aa-k
if(k>c and k>0):
    aa=aa-c
print(aa)

Measured memory_bytes: 9200
#include <bits/stdc++.h>
#pragma gcc optimize("ofast")
using namespace std;

#define ll long long //data types used often, but you don't want to type them time by time
#define ull unsigned long long
#define ui unsigned int
#define mod 1000000007
#define us unsigned short
#define IOS ios_base::sync_with_stdio(0); //to synchronize the input of cin and scanf
#define INF LONG_MAX
#define PI 3.1415926535897932384626
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define rep(x,j,n)for(int x=j;x<n;x++)
typedef vector<pair<ll,ll>> vpi;
typedef vector<ll> vi;
typedef vector<vi> vvi;


int main(){
    ll h,n; cin>>h>>n;
    vpi arr(n);
    rep(i,0,n)cin>>arr[i].fi>>arr[i].se;

    vi dp(h+1,INT_MAX);
    dp[0] = 0;

    rep(i,1,h+1)
    {
        dp[i] = INT_MAX;
        for(ll j = 0;j<n;j++)
        {
            if(i-arr[j].fi<=0)dp[i]=min(dp[i],arr[j].se);
            else dp[i] = min(dp[i],dp[i-arr[j].fi]+arr[j].se);
        }
    }
    cout<<dp[h]<<endl;
    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i = 0; i < (N); i++)
#define repo(i,N) for(int i = 1; i < (N); i++)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
//#define num 1000000007
#define pi acos(-1.0)
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//#define int long long


int main() {
  string s;
  cin >> s;
  
  cout << (s=="abc" || s=="acb" || s=="bac" || 
         s=="bca" || s=="cab" || s=="cba" ?"Yes":"No" ) << endl;

  
}

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

using namespace std;

using ll = long long;
constexpr ll MOD = 1e9 + 7;
constexpr ll INF = 1e18;

int main() {
    ll n, m, i, j, k;
    for(i=1;i<=5;i++){
        cin >> n;
        if(n==0){
            cout << i << endl;
            return 0;
        }
    }
    return 0;
}

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

int main() {
    using namespace std;
    unsigned long N;
    cin >> N;
    vector<unsigned long> inv(N);
    for(unsigned long i = 0, p; i < N;){
        cin >> p;
        inv[p - 1] = ++i;
    }
    copy(inv.begin(), inv.end(), ostream_iterator<unsigned long>(cout, " "));
    return 0;
}

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

 

int main()
{ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n,l;
    cin>>n>>l;
    int total=l*n+((n*(n+1))/2)-n;
    if(l>=0)
    {
    	cout<<total-l<<endl;
    }
    else
    {
    	if(abs(l)>=n)
    	{
    		cout<<total-(l+n-1)<<endl;
    	}
    	else
    	{
    		cout<<total<<endl;
    	}
    }
	return 0;

}


Measured memory_bytes: 3640
#include<bits/stdc++.h>
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
#define pb push_back
int dy[]={0, 0, 1, -1, 1, 1, -1, -1};
int dx[]={1, -1, 0, 0, 1, -1, -1, 1};

#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define mp make_pair
#define fi first
#define sc second
char s[200000];
int main(){
	cin >> s;
	int n = strlen(s);
	int ans = n;
	REP(i,n - 1) {
		if(s[i] != s[i + 1]) {
			int a = max(i + 1,n - i - 1);
			ans = min(a,ans);
		}
	}
	cout << ans << endl;
	return 0;
}


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

int main() {
  string s;
  cin >> s;
  cout << ((s == "ABC") ? "ARC" : "ABC") << endl;
}


Measured memory_bytes: 3624
#include<iostream>
#include<algorithm>
#include<functional>
#include<cmath>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<deque>
using namespace std;
#define ll long long
const int mod = 1000000007;
const ll INF = 1000000000000000000;

int a[110];
int cnt[1000010];
int main()
{
	int s;
	cin >> s;
	int ans = mod;
	int i = 0;
	for (int i = 0; i <= 1000000; i++) cnt[i] = 0;
	while (true) {
		if (cnt[s] >= 1) {
			cout << i + 1 << endl;
			return 0;
		}
		cnt[s]++;
		if (s % 2 == 0) s /= 2;
		else s = s * 3 + 1;
		i++;
	}
}


Measured memory_bytes: 4096
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i < (n+1); ++i)
using namespace std;
using ll = long long;
const int INF = -100100100;
typedef pair<int,int> P;

int main(){
    int x,y,z;
    cin >> x >> y >> z;
    printf("%d %d %d\n", z,x,y);
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int N = 1e5+20;
int n,a[N],b[N],Max,ans;
long long c[N*2];
inline int lowbit(int x) { return x & (-x); }
inline void insert(int p,long long v) { p += n+1; for (;p<=2*n+1;p+=lowbit(p)) c[p] += v; }
inline long long query(int p) { p += n+1; long long res = 0; for (;p;p-=lowbit(p)) res += c[p]; return res; }
inline void input(void)
{
    scanf("%d",&n);
    for (int i=1;i<=n;i++)
        scanf("%d",&a[i]) , Max = max( Max , a[i] );
}
inline long long check(int val)
{
    long long res = 0;
    for (int i=1;i<=n;i++)
        b[i] = a[i] <= val ? 1 : -1;
    for (int i=1;i<=n;i++)
        b[i] += b[i-1];
    memset( c , 0 , sizeof c );
    for (int i=0;i<=n;i++)
    {
        res += query( b[i] - 1 );
        insert( b[i] , 1 );
    }
    return res;
}
inline void BinarySearch(void)
{
    int l = 0 , r = Max , mid;
    while ( l + 1 < r )
    {
        mid = l + r >> 1;
        if ( check(mid) >= 1LL*n*(n+1)/2/2 + 1 ) r = mid;
        else l = mid;
    }
    check(l) == 1LL*n*(n+1)/2/2 + 1 ? ans = l : ans = r;
}
int main(void)
{
    input();
    BinarySearch();
    printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
#define pb push_back
#define FOR(i, a, b) for (long long i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define MOD 1000000007
#define INF 93193111451418101
#define MIN -93193111451418101
#define EPS 1e-11
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;

int main() {
  ll n;
  cin >> n;
  if (n == 3) {
    cout << "2 5 63" << endl;
    return 0;
  }
  vector<ll> v;
  v.pb(2);
  v.pb(3);
  v.pb(4);
  v.pb(9);
  n -= 4;
  ll twonow = 15, threenow = 8;
  FOR(i, 0, 5000) {
    if ((n - 3 * i) / 2 < 2500) {
      ll three = i * 3, two = (n - 3 * i) / 2 * 2;
      REP(i, three) {
        v.pb(threenow);
        threenow += 2;
      }
      REP(i, two) {
        v.pb(twonow);
        twonow += 6;
      }
      if ((n - 3 * i) % 2 == 1)
        v.pb(6);
      break;
    }
  }
  REP(i, v.size()) {
    if (i)
      cout << " ";
    cout << v[i];
  }
  cout << endl;
}


Measured memory_bytes: 640
#include <bits/stdc++.h> 
using namespace std;
typedef long long ll; const ll MM = 1000000000;ll mod = MM + 7;
#define rep(i, n) for(ll i=0; i<n; i++)
#define Rep(i, j, n) for(int i=j; i<n; i++)
#define all(vec) vec.begin(), vec.end()
template<class T> inline bool chmin(T& a, T b) {if(a > b) {a = b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b) {if(a < b) {a = b; return true;} return false;}
const ll INF = 1LL << 60;

int main() {
    int a, b, c, d; cin >> a >> b >> c >> d;
    if(d == 1) cout << 1 << endl;
    else cout << 0 << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(long long i=0; i<n; i++)
#define Rep(i,n) for(long long i=1; i<n; i++)
#define ll long long
#include <math.h>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <numeric>
#include <queue>
#include <set>
#include <vector>


using namespace std;
#define PI acos(-1)
using P =pair<int,int>;

ll f(ll x,ll c,ll d){
    ll res =x;
    res -=x/c;
    res -=x/d;
    res+= x/lcm(c,d);
    return res;
}

vector<int> to[100005];
const ll inf =100000000;

vector<ll>a,b,c,d;
ll n,m,q;
ll ans=0;
void bfs(vector<ll> v){
   if(v.size()==n+1) {
       ll sum=0;
       rep(i,q){
           if(v[b[i]]-v[a[i]]==c[i])sum+=d[i];
       }
       ans=max(ans,sum);
       return;
   }
   v.push_back(v.back());
   bfs(v);
   while(v.back()<m){
       v.back()++;
       bfs(v);
   }
}

int main(){
ll n,x,t;
cin>>n>>x>>t;
if(n%x==0)cout<<n/x*t<<endl;
else cout<<(n/x+1)*t;
}


Measured memory_bytes: 5972
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <bitset>
#include <cstdio>
#include <limits>
#include <vector>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <fstream>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <unordered_map>

using namespace std;


int main() {

    vector<int> vc{399,799,1199,1599,1999,2399,2799,3199};
    vector<int> res(vc.size(),0);
    int other = 0;
    int num;
    cin>>num;

    int ai;
    bool f = false;

    for(int i = 0; i < num; ++i){
        cin>>ai;
        f = false;
        for(int j = 0; j < vc.size(); ++j){
            if(ai <= vc[j]){
                res[j]++;
                f = true;
                break;
            }
        }

        if(!f){
            other++;
        }
    }

    int ret = 0;
    for(auto& v: res){
        if(v != 0)
            ret++;
    }

    int mi;
    int ma;

    if(ret == 0){
        mi = 1;
        ma = other;
    }
    else{
        mi = ret;
        ma = ret+other;
    }

    cout<<mi<<" "<<ma<<endl;

    return 0;
}


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

int main() {
    int K;
    cin >> K;
    string S;
    cin >> S;
    int L = S.size();
    if (L <= K) cout << S << endl;
    else cout << S.substr(0, K) << "..." << endl;
    return 0;
}

Measured memory_bytes: 3632
#include<algorithm>
#include<iostream>
#include<cmath>
#include<cstdio>
using namespace std;
#define H_MAX 100000
int W,H,N;
int MX[H_MAX],X[H_MAX];


int main(void){
	int x,y;
	cin>>W>>H>>N;
	for(int i=0;i<H;i++)MX[i]=X[i]=-1;
	for(int i=0;i<N;i++){
		cin>>x>>y;
		X[y]=max(X[y],x);
	}
	MX[H-1]=0;
	for(int i=H-2;i>=0;i--){
		MX[i]=max(MX[i+1],X[i+1]);
	}
	
	int ans=H;
	for(int i=0;i<H;i++){
		ans=min(ans,i+MX[i]);
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 3880
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd
from itertools import accumulate, permutations, combinations, product, groupby, combinations_with_replacement
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from heapq import heappush, heappop
from functools import reduce
from decimal import *
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

X = Decimal(INT())
print(((Decimal(-1)+(8*X).sqrt())/Decimal(2)).quantize(Decimal("0"), rounding=ROUND_CEILING))


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

int main(){
 int N, K;
 cin >> N >> K; 
  int count=0;
  for(int i=0;i<N;i++){
  int tmp;
   cin>> tmp;
    count+=min(tmp,K-tmp);
  }
      count*=2;
  cout<<count<<endl;
}

Measured memory_bytes: 256
(defun split-string (s d)
  (let ((l (concatenate 'list s))
        (r (list nil))
        (tmp (list nil)))
    (dolist (n l)
      (if (eql n d)
          (progn
            (push (parse-integer (concatenate 'string (cdr (reverse tmp)))) r)
            (setq tmp (list nil)))
          (push n tmp)))
    (let ((check (parse-integer (concatenate 'string (cdr (reverse tmp))) :junk-allowed t)))
      (unless (null check)
        (push check r)))
    (cdr (reverse r))))

(defun main ()
  (let ((i (read-line)))
    (let ((l (split-string i #\Space)))
      (format t "~a~%" (1+ (- (nth 0 l) (nth 1 l)))))))

(main)

Measured memory_bytes: 13028
import functools

import os
import sys

sys.setrecursionlimit(10000)
INF = float('inf')


def inp():
    return int(input())


def inpf():
    return float(input())


def inps():
    return input()


def inl():
    return list(map(int, input().split()))


def inlf():
    return list(map(float, input().split()))


def inls():
    return input().split()


def inpm(line):
    return [inp() for _ in range(line)]


def inpfm(line):
    return [inpf() for _ in range(line)]


def inpsm(line):
    return [inps() for _ in range(line)]


def inlm(line):
    return [inl() for _ in range(line)]


def inlfm(line):
    return [inlf() for _ in range(line)]


def inlsm(line):
    return [inls() for _ in range(line)]


def Yesif(cond):
    print('Yes' if cond else 'No')


def YESIF(cond):
    print('YES' if cond else 'NO')


def yesif(cond):
    print('yes' if cond else 'no')



a, b, c , d = inl()
print(max(a*b, c*d))

Measured memory_bytes: 3572