akhauriyash/Code-Regression huggingface dataset:
//set many funcs template
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<stdbool.h>
#define inf 1072114514
#define llinf 4154118101919364364
#define mod 1000000007
#define pi 3.1415926535897932384

int max(int a,int b){if(a>b){return a;}return b;}
int min(int a,int b){if(a<b){return a;}return b;}
int zt(int a,int b){return max(a,b)-min(a,b);}
int round(int a,int b){if((a%b)*2 >= b){return (a/b)+1;}return a/b;}
int ceil(int a,int b){if(a%b==0){return a/b;}return (a/b)+1;}
int gcd(int a,int b){int c;while(b!=0){c=a%b;a=b;b=c;}return a;}
int lcm(int a,int b){int c=gcd(a,b);a/=c;return a*b;}
int nCr(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
int fact(int a){int i,r=1;for(i=1;i<=a;i++){r*=i;}return r;}
int pow(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}
long long llmax(long long a,long long b){if(a>b){return a;}return b;}
long long llmin(long long a,long long b){if(a<b){return a;}return b;}
long long llzt(long long a,long long b){return llmax(a,b)-llmin(a,b);}
long long llround(long long a,long long b){if((a%b)*2 >= b){return (a/b)+1;}return a/b;}
long long llceil(long long a,long long b){if(a%b==0){return a/b;}return (a/b)+1;}
long long llgcd(long long a,long long b){long long c;while(b!=0){c=a%b;a=b;b=c;}return a;}
long long lllcm(long long a,long long b){long long c=llgcd(a,b);a/=c;return a*b;}
long long llnCr(long long a,long long b){long long i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
long long llfact(long long a){long long i,r=1;for(i=1;i<=a;i++){r*=i;}return r;}
long long llpow(long long a,long long b){long long i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}
double dbmax(double a,double b){if(a>b){return a;}return b;}
double dbmin(double a,double b){if(a<b){return a;}return b;}
double dbzt(double a,double b){return dbmax(a,b)-dbmin(a,b);}
int sortfncsj(const void *a,const void *b){if(*(int *)a>*(int *)b){return 1;}if(*(int *)a==*(int *)b){return 0;}return -1;}
int sortfnckj(const void *a,const void *b){if(*(int *)a<*(int *)b){return 1;}if(*(int *)a==*(int *)b){return 0;}return -1;}
int llsortfncsj(const void *a,const void *b){if(*(long long *)a>*(long long *)b){return 1;}if(*(long long *)a==*(long long *)b){return 0;}return -1;}
int llsortfnckj(const void *a,const void *b){if(*(long long *)a<*(long long *)b){return 1;}if(*(long long *)a==*(long long *)b){return 0;}return -1;}
int dbsortfncsj(const void *a,const void *b){if(*(double *)a>*(double *)b){return 1;}if(*(double *)a==*(double *)b){return 0;}return -1;}
int dbsortfnckj(const void *a,const void *b){if(*(double *)a<*(double *)b){return 1;}if(*(double *)a==*(double *)b){return 0;}return -1;}

int main(void){
    int i,j,n,k,a[262144],r=inf,nr;
    scanf("%d",&n);
    for(i=1;i<=n;i++){
        scanf("%d",&a[i]);
        nr=0;
        while(a[i]%2==0){a[i]/=2;nr++;}
        r=min(r,nr);
    }
    printf("%d\n",r);
    return 0;
}

Measured memory_bytes: 128
/**
Code by Nitin1184
**/
# include <bits/stdc++.h>
# define ll long long
# define pi 3.14159265358979323846
# define M 1000000007
# define pb push_back
# define mp make_pair
# define ff first
# define ss second
 
using namespace std;
 
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int x;
    cin>>x;
    cout<<360/__gcd(360,x)<<endl;
    return 0;
}

Measured memory_bytes: 3600
#include <algorithm>
#include <cassert>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;

#define rep(i, n) for(ll i = 0; i < n; i++)
#define REP(i, n) for(ll i = 1; i < n + 1; i++)
#define PI 3.14159265359
#define EPS 0.0000000001
#define MOD 1000000007
//cout << std::fixed << std::setprecision(15) << y << endl;


int main(){
    string O, E;
    cin >> O >> E;

    rep(i, O.size()){
        cout << O[i];
        if(i <= E.size() - 1){
            cout << E[i];
        }
    }
    cout << endl;

    return 0;
}

Measured memory_bytes: 3600
open Printf
open Scanf

let id x = x
let pair x y = x, y

let n = scanf "%d" id
let vs = Array.init n (fun _ -> scanf " %d" id)

let () = Array.sort (fun x y -> x - y) vs

let odd1 vs =
  let mid = n / 2 in
  let up = ref (n - 1) in
  let lo = ref 0 in
  let r1 = ref 0 in
  let p = ref vs.(mid) in
  for i = 0 to n / 2 - 1 do
    r1 := !r1 + abs (!p - vs.(!up));
    p := vs.(!up);
    decr up;
    r1 := !r1 + abs (!p - vs.(!lo));
    p := vs.(!lo);
    incr lo
  done;
  !r1
  
let odd2 vs =
  let mid = n / 2 in
  let up = ref (n - 1) in
  let lo = ref 0 in
  let r1 = ref 0 in
  let p = ref vs.(mid) in
  for i = 0 to n / 2 - 1 do
    r1 := !r1 + abs (!p - vs.(!lo));
    p := vs.(!lo);
    incr lo;
    r1 := !r1 + abs (!p - vs.(!up));
    p := vs.(!up);
    decr up
  done;
  !r1

let even1 vs =
  let mid = n / 2 in
  let up = ref (n - 1) in
  let lo = ref 0 in
  let r1 = ref 0 in
  let p = ref vs.(mid) in
  for i = 0 to n / 2 - 2 do
    r1 := !r1 + abs (!p - vs.(!lo));
    p := vs.(!lo);
    incr lo;
    r1 := !r1 + abs (!p - vs.(!up));
    p := vs.(!up);
    decr up
  done;
  r1 := !r1 + abs (!p - vs.(mid - 1));
  !r1

let even2 vs =
  let mid = n / 2 - 1 in
  let up = ref (n - 1) in
  let lo = ref 0 in
  let r1 = ref 0 in
  let p = ref vs.(mid) in
  for i = 0 to n / 2 - 2 do
    r1 := !r1 + abs (!p - vs.(!up));
    p := vs.(!up);
    decr up;
    r1 := !r1 + abs (!p - vs.(!lo));
    p := vs.(!lo);
    incr lo;
  done;
  r1 := !r1 + abs (!p - vs.(mid + 1));
  !r1

let () =
  if n mod 2 = 0 then begin
    let e1 = even1 vs in
    let e2 = even2 vs in
    printf "%d\n" (max e1 e2)
  end else begin
    let o1 = odd1 vs in
    let o2 = odd2 vs in
    printf "%d\n" (max o1 o2)
  end


Measured memory_bytes: 5504
#include <stdio.h>
#include <math.h>
 
double area3(double x1, double y1, double x2, double y2, double x3, double y3)
{
    double a, b, c, z;
 
    a = sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2));
    b = sqrt((x1-x3)*(x1-x3) + (y1-y3)*(y1-y3));
    c = sqrt((x2-x3)*(x2-x3) + (y2-y3)*(y2-y3));
    z = (a+b+c)/2.0;
    return sqrt(z*(z-a)*(z-b)*(z-c));
}
 
int main()
{
    double x0, y0, x1, y1, x2, y2;
    double s=0.0;
 
    scanf("%lf,%lf", &x0, &y0);
    scanf("%lf,%lf", &x1, &y1);
    
    while (scanf("%lf,%lf", &x2,&y2)==2) {
        s+=area3(x0, y0, x1, y1, x2, y2);
        x1=x2;
        y1=y2;
    }
    printf("%.6lf\n", s);
    return 0;
}


Measured memory_bytes: 2024
#include<stdio.h>
#include<math.h>
#define MAX 100

float inf = INFINITY;

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

int main(){
  int n, i, k, j, l;
  int p[MAX+1];
  int m[MAX+1][MAX+1];

  scanf("%d", &n);

  for( i = 1 ; i <= n; i++)
  {
    scanf("%d%d", &p[i-1], &p[i]);
  }

  for( i = 0 ; i <= n ; i ++ ){
    m[i][i] = 0;
  }

  for( l = 2; l <= n; l++)
  {
    for( i = 1; i <= n - l + 1; i++)
    {
      j = i + l - 1;
      m[i][j] = 1<<21;
      for( k = i; k <= j - 1; k++)
      {
        m[i][j] = minof(m[i][j], m[i][k] + m[k + 1][j] + p[i-1] * p[k] * p[j]);
      }
    }
  }

  printf("%d\n", m[1][n]);
  return 0;
}



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

int main(){
    int i,j,h,w;
    cin >> h >> w;
    char square[h][w];
    int left[h][w];
    int right[h][w];
    int up[h][w];
    int down[h][w];
    for(i = 0; i < h; i++){
        for(j = 0; j < w;j++){
            cin >> square[i][j];
        }
    }
    /*for(i = 0; i < h; i++){
        for(j = 0; j < w;j++){
            cout << square[i][j];
        }
        cout << endl;
    }*/
    for(i = 0; i < h; i++){
        left[i][0] = 0;
        right[i][w-1] = 0;
    }
    for(i = 0; i < w; i++){
        up[0][i] = 0;
        down[h-1][i] = 0;
    }
    for(i = 0; i < h; i++){
        for(j = 1; j < w; j++){
            if(square[i][j-1] == '#'){
                left[i][j] = 0;
            }
            else{
                left[i][j] = left[i][j-1]+1;
            }
        }
    }

    for(i = 0; i < h; i++){
        for(j = w-2; j >= 0; j--){
            if(square[i][j+1] == '#'){
                right[i][j] = 0;
            }
            else{
                right[i][j] = right[i][j+1]+1;
            }
        }
    }

    for(j = 0; j < w; j++){
        for(i = h-2; i >= 0; i--){
            if(square[i+1][j] == '#'){
                down[i][j] = 0;
            }
            else{
                down[i][j] = down[i+1][j]+1;
            }
        }
    }

    for(j = 0; j < w; j++){
        for(i = 1; i < h; i++){
            if(square[i-1][j] == '#'){
                up[i][j] = 0;
            }
            else{
                up[i][j] = up[i-1][j]+1;
            }
        }
    }

    int ans = -1;

    for(i = 0; i < h; i++){
        for(j = 0; j < w;j++){
            if(square[i][j] == '#'){
                ans = max(ans,-1);
            }
            else{
                ans = max(ans,left[i][j]+right[i][j]+up[i][j]+down[i][j]+1);
            }
        }
    }
    cout << ans << endl;
    
    


}

Measured memory_bytes: 66688
n, m = map(int, input().split())

prev_l, prev_r = 1, 100000
for _ in range(m):
    l, r = map(int, input().split()) 
    prev_l, prev_r = max(l, prev_l), min(r, prev_r)

if prev_r < prev_l:
    print(0)
else:
    print(prev_r - prev_l + 1)

Measured memory_bytes: 3188
#include <iostream>
#include <set>

using namespace std;

int main() {
    int A, B, K;
    cin >> A >> B >> K;
    set<int> ans;
    for (int i = 0; i < min(K, B - A + 1); ++i) {
        ans.insert(A + i);
        ans.insert(B - i);
    }

    for (int a : ans) cout << a << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FS ios_base::sync_with_stdio(0);
#define FOR(i,s,e) for(int i=s; i<e; ++i)
#define FFOR(i,s,e) for(int i=s; i<=e; ++i)
#define mem(o,s) memset(s,o,sizeof(s));
typedef long long ll;
#define MOD 1000000007
#define pi pair<int,int>
#define fi first
#define se second
#define pb push_back


int main(){
  FS
  int a,b;
  cin>>a>>b;
  string A,B;
  FOR(i,0,b) A+=(char)('0'+a);
  FOR(i,0,a) B+=(char)('0'+b);
  if(A<B) cout<<A<<'\n';
  else cout<<B<<'\n';
}
    


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

#include <bits/stdc++.h>
using namespace std;

class ACirclePond {
 public:
  void solve(std::istream &in, std::ostream &out) {
      int r;
      in >> r;
      out << setprecision(20) << fixed << 2.0 * r * M_PI << '\n';
  }
};

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ACirclePond solver;
    std::istream &in(std::cin);
    std::ostream &out(std::cout);
    solver.solve(in, out);
    return 0;
}

Measured memory_bytes: 3800
#include<bits/stdc++.h>
using namespace std;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string ss;
    cin>>ss;
    vector<int> a(30,0);
    
    for(int i=0;i<ss.size();i++){
        int j=ss[i]-'a';
        a[j]++;
    }
    for(int i=0;i<27;i++){
        if(a[i]>1){
            cout<<"no"<<endl;
            return 0;
        }
    }
    cout<<"yes"<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <set>
#include <vector>
#include <map>
#include <cstdio>
#include <utility>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <cassert>
#include <climits>
using namespace std;
typedef long long ll;
#define DEBUG
#ifdef DEBUG
	#define debug printf
#else
	#define debug(...)
#endif
int main(int argc, char const *argv[])
{
	string s;
	cin>>s;
	for(int i = 0;i < s.size() - 1; ++i)
	{
		for(int j = i;j< s.size(); ++j)
		{
			string s2 = s.substr(0,i) + s.substr(j);
			if(s2 == "keyence")
			{
				printf("YES\n");
				return 0;
			}
		}
	}
	printf("NO\n");
	return 0;
}

Measured memory_bytes: 256
import sys
import os

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

MOD = 10 ** 9 + 7


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N = ii()
    AN = il()
    AM = il()
    ans = 0
    for n in range(1, N + 1):
        tmp = sum(AN[:n])
        tmp += sum(AM[n - 1:])
        ans = max(ans, tmp)

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define uli unsigned long long int
#define INF 999999999999999999
#define rep(i,m,n) for(lli i = m;i < n;i++)
#define rrep(i,m,n) for(lli i=m-1;i>=n;i--)
#define pb(n) push_back(n)
#define UE(N) N.erase(unique(N.begin(),N.end()),N.end());
#define Sort(n) sort(n.begin(), n.end())
#define Rev(n) reverse(n.begin(),n.end())
#define Out(S) cout << S << endl
#define NeOut(S) cout << S
#define HpOut(S) cout << setprecision(25) << S << endl
#define Vec(K,L,N,S) vector<L> K(N,S)
#define DV(K,L,N,M,S) vector<vector<L>> K(N,vector<L>(M,S))
#define TV(K,L,N,M,R,S) vector<vector<vector<L>>> K(N,vector<vector<L>>(M,vector<L>(R,S)))
#define pint pair<lli,lli>
#define paf(L,R) pair<L,R>
#define mod 1000000007
#define MAX 10000000
#define ALL(a)  a.begin(),a.end()
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
long long 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;
    }
}
lli nCr(lli n, lli r){
    if (n < r) return 0;
    if (n < 0 || r < 0) return 0;
    return fac[n] * (finv[r] * finv[n - r] % mod) % mod;
}
int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  lli A,B,C,D,E,F,N,M,K,L,R,X,Y,Z,W,H,sum=0,num=0,flag=0;string S,T;
  cin >> N;
  Out(3*N*N);
}


Measured memory_bytes: 256
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <tuple>
# include <unordered_map>
# include <numeric>
# include <complex>
# include <bitset>
# include <random>
# include <chrono>
# include <cstdlib>
# include <tuple>
# include <array>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
using D = double;
constexpr int INF = 2147483647;
constexpr int HINF = INF / 2;
constexpr double DINF = 100000000000000000.0;
constexpr double HDINF = 50000000000000000.0;
constexpr long long LINF = 9223372036854775807;
constexpr long long HLINF = 4500000000000000000;
const double PI = acos(-1);
template <typename T_char>T_char TL(T_char cX) { return tolower(cX); };
template <typename T_char>T_char TU(T_char cX) { return toupper(cX); };
typedef pair<LL, LL> pii;
const int vy[] = { -1, -1, -1, 0, 1, 1, 1, 0 }, vx[] = { -1, 0, 1, 1, 1, 0, -1, -1 };
const int dx[4] = { 0,1,0,-1 }, dy[4] = { 1,0,-1,0 };
int popcnt(unsigned long long n) { int cnt = 0; for (int i = 0; i < 64; i++)if ((n >> i) & 1)cnt++; return cnt; }
int d_sum(LL n) { int ret = 0; while (n > 0) { ret += n % 10; n /= 10; }return ret; }
int d_num(LL n) { int ret = 0; while (n > 0) { ret++; n /= 10; }return ret; }
LL gcd(LL a, LL b) { if (b == 0)return a; return gcd(b, a%b); };
LL lcm(LL a, LL b) { LL g = gcd(a, b); return a / g*b; };
# define ALL(qpqpq)           (qpqpq).begin(),(qpqpq).end()
# define RALL(qpqpq)           (qpqpq).rbegin(),(qpqpq).rend()
# define UNIQUE(wpwpw)        sort(ALL((wpwpw)));(wpwpw).erase(unique(ALL((wpwpw))),(wpwpw).end())
# define LOWER(epepe)         transform(ALL((epepe)),(epepe).begin(),TL<char>)
# define UPPER(rprpr)         transform(ALL((rprpr)),(rprpr).begin(),TU<char>)
# define FOR(i,tptpt,ypypy)   for(LL i=(tptpt);i<(ypypy);i++)
# define RFOR(i,tptpt,ypypy)  for(LL i=(tptpt);i>=(ypypy);i--)
# define REP(i,upupu)         FOR(i,0,upupu)
# define INIT                 std::ios::sync_with_stdio(false);std::cin.tie(0)

LL n, d[303030], sum;

int main() {
	cin >> n;
	REP(i, n)cin >> d[i];
	REP(i, n) {
		sum = max(sum - 10, d[i]);
		if (sum < 10) {
			cout << "no" << endl;
			return 0;
		}
	}
	sum = 0;
	for (int i = n - 1; i >= 0; i--) {
		sum = max(sum - 10, d[i]);
		if (sum < 10) {
			cout << "no" << endl;
			return 0;
		}
	}
	cout << "yes" << endl;
}


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

#define REP(i, n) for(int (i)=0;(i)<(n);++(i))
#define REPV(iter, v) for(auto (iter)=(v).begin(); (iter)!=(v).end();++(iter))
#define ALL(v) (v).begin(),(v).end()

#define MOD 1000000007

using namespace std;

typedef long long ll;

map<ll, ll> primeFactorization(ll n)
{
    map<ll, ll> primeFacMap;
    ll q = 2;
    while(q * q <= n)
    {
        while(n % q == 0)
        {
            n = n / q;
            if (primeFacMap.find(q) == primeFacMap.end())
            {
                primeFacMap[q] = 1;
            }
            else
            {
                primeFacMap[q]++;
            } 
        }
        q++;
    }
    if (n != 1) primeFacMap[n] = 1;

    return primeFacMap;
}

int main()
{
    ll N;
    cin >> N;
    map<ll, ll> pMap = primeFactorization(N);
    ll ans = 0;
    REPV(it, pMap)
    {
        ll q = it->second;
        ll count = 1;
        while(q - count >= 0)
        {
            q -= count;
            count++;
            ans++;
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 3632
Y=[0]*1001
Y[1]=1
for i in range(2,34):
  for j in range(2,10):
    if i**j<=1000:
      Y[i**j]=i**j
#print(Y)

for i in range(1,1001):
  if Y[i]==0:
    Y[i]=Y[i-1]
print(Y[int(input())])

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

#pragma GCC optimize ("O2")
#pragma GCC optimize ("tree-vectorize")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define FFOR(i, a, b) FOR(i, a, b+1)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) FOR(i, 1, n+1)
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define LEN(x) (int)(x).size()
#define DUMP(x) cerr<<__LINE__<<' '<<#x<<"="<<(x)<<endl;
#define popcnt(x) __builtin_popcount(x)
#define popcntll(x) __builtin_popcountll(x)
#define pb push_back
#define eb emplace_back
#define mp make_pair

using namespace std;
using lint = long long;
using pii =  pair<int, int>;
using pll =  pair<lint, lint>;
template <typename T> using vc = vector<T>;
template <typename T> using vvc = vector<vector<T>>;
template <typename T> inline bool chmax(T &a, T b){if(a<b){a = b; return true;} return false;}
template <typename T> inline bool chmin(T &a, T b){if(a>b){a = b; return true;} return false;}

constexpr lint ten(int n) {return n==0 ? 1 : ten(n-1)*10;}

class DSemiCommonMultiple {
public:
    void solve(std::istream& in, std::ostream& out){
        ios_base::sync_with_stdio(false);
        in.tie(nullptr), out.tie(nullptr);
        int N, M;
        in>>N>>M;
        M *= 2;
        vc<lint> A(N);
        for(auto& a : A) in>>a;
        lint L = 1;
        REP(i, N){
            L = L / __gcd(L, A[i]) * A[i];
            if(L>M){
                out<<"0\n";
                return;
            }
        }
        REP(i, N){
            if(L/A[i]%2==0){
                out<<"0\n";
                return;
            }
        }
        lint k = M / L;
        out<<(k+1)/2<<'\n';
    }
};


int main() {
	DSemiCommonMultiple solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 3948
n,m,c=map(int,input().split())
b=list(map(int,input().split()))
a=[0]*n
for i in range(n):
    a[i]=list(map(int,input().split()))

ans=0

for i in range(n):
    p=0
    for k in range(m):
        p+=a[i][k]*b[k]
    p+=c
    if p>0:
        ans+=1

print(ans)

Measured memory_bytes: 9156
from heapq import heappush, heappop, heapify

x,y,a,b,c = map(int, input().split())
p = sorted(list(map(int, input().split())), reverse=True)
q = sorted(list(map(int, input().split())), reverse=True)
r = sorted(list(map(int, input().split())), reverse=True)

R = p[:x]
B = q[:y]

heapify(R)
heapify(B)
for i in range(c):
  if min(R[0],B[0]) > r[i]:
    break
  if R[0] < B[0]:
    heappop(R)
    heappush(R,r[i])
  else:
    heappop(B)
    heappush(B,r[i])

print(sum(R) + sum(B))

Measured memory_bytes: 23456
#include <iostream>
#include <string>
using namespace std;
using ll = long long;

int main() {
	string S, T;
	cin >> S >> T;
	int count = 0;
	for (int i = 0; i < S.size(); i++) {
		if (S[i] != T[i]) {
			count++;
		}
	}
	cout << count << endl;
	return 0;
}


Measured memory_bytes: 3812
def getinputdata():

    # 配列初期化
    array_result = []    
    data = input()
    array_result.append(data.split(" "))

    flg = True

    try:
        while flg:

            data = input()

            if(data != ""):
                
                array_result.append(data.split(" "))

                flg = True

            else:

                flg = False
    finally:

        return array_result

arr_data = getinputdata()

x = int(arr_data[0][0])

b = 1
p = 2
maxdata = 1

while b ** p < x:

    chkflg = True

    while chkflg:

        if b ** p <= x:

            if maxdata <= b ** p:
                
                maxdata = b ** p

            b += 1

        else:

            b = 2
            p += 1
            chkflg = False

print(maxdata)


Measured memory_bytes: 3064
N,K=map(int,input().split())
V=list(map(int,input().split()))

ans=0
for nab in range(1,min(N+1,K+1)):
    nr=K-nab
    for na in range(nab+1):
        nb=nab-na
        vt=sorted(V[:na]+V[N-nb:])
        for ncd in range(min(nr+1,nab+1)):
            np=sum(vt[ncd:])
            ans=max(ans,np)

print(ans)
            


Measured memory_bytes: 3060
#include <iostream>
#include <bits/stdc++.h>
#include <string>
#include <ctype.h>
#include <algorithm>
#include <cmath>
#include <vector>

#define REP(i, n) for(int i=0;i<(int)(n);i++)
#define ALL(x) (x).begin(),(x).end()
#define square(x) (x) * (x)

const int INF = 1e9;

using namespace std;

int main() {
    int t;
    vector<int> a;
    REP(i, 3) {
        cin >> t;
        a.push_back(t);
    }
    sort(ALL(a));

    REP(i, 2) cout << a[i] << " ";
    cout << a[2] << endl;
    return 0;
}

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

int main() {
	// your code goes here

    int n; cin>>n;
    long double dp[n+1][n+1];

   long double p[n];
    for(int i=0;i<n;i++)
    {
        cin>>p[i];
    }
     for(int i=0;i<=n;i++)
     for(int j=0;j<=n;j++)
       dp[i][j]=0;
       
    dp[0][0]=1.0;
   
    for(int i=1;i<=n;i++)
    {
        for(int j=0;j<=n;j++)
        {
            if(j==0)
          {  //cout<<1.0-p[i-1]<<" "<<dp[i-1][j]<<endl;
              dp[i][j]=(1.0-p[i-1])*dp[i-1][j]; }
            else {
                //cout<<dp[i-1][j-1]<<endl;
                dp[i][j]=p[i-1]*dp[i-1][j-1]+(1.0-p[i-1])*dp[i-1][j];
                
            }
        }
    }
    
    // for(int i=0;i<=n;i++)
    // {
    //     for(int j=0;j<=n;j++)
    //     cout<<dp[i][j]<<" ";
        
    //     cout<<endl;
    // }
    long double r=0.0;
    int i;
    
     i=n/2+1;
    for(;i<=n;i++) r+=dp[n][i];
    //cout<<r<<endl;
  printf("%.12Lf\n",r);
    
 	return 0;
}


Measured memory_bytes: 144348
#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
using namespace std;
#define rep(i,x) for(ll i = 0; i < (ll)(x); i++)
#define rrep(i,x) for(ll i = (ll)(x)-1;0 <= i; i--)
#define reps(i,x) for(ll i = 1; i < (ll)(x)+1; i++)
#define rreps(i,x) for(ll i = (ll)(x); 1 <= i; i--)
#define debug(x) cerr << #x << ": " << (x) << "\n";
#define all(x) (x).begin(), (x).end()
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<vector<ll>>> vvvl;
const ll INF = numeric_limits<ll>::max()/4;
const int n_max = 1e5+10;

int main(){
    ll n,r; cin >> n >> r;
    ll ans;
    if(n >= 10){
        ans = r;
    }
    else{
        ans = r + 100 * (10-n);
    }
    cout << ans <<endl;

}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
const int maxn = 555;
// not tested
template<typename T> class compresser{
public:
    static void compress_and_push(vector<T> & to_compress){
        to_compress = compress(to_compress);
    }
    static vector<T> compress(vector<T> to_compress){
        vector<T> copy = compressed_values(to_compress);
        for(T & v : to_compress)
            v = lower_bound(copy.begin(), copy.end(), v) - copy.begin();
        return to_compress;
    }
    static vector<T> compressed_values(vector<T> to_compress){
        sort(to_compress.begin(), to_compress.end());
        to_compress.erase(unique(to_compress.begin(), to_compress.end()), to_compress.end());
        return to_compress;
    }
};
bool diff(vector<long long> u, vector<long long> v){
    sort(u.begin(), u.end());
    sort(v.begin(), v.end());
    for(int e = 0; e < v.size(); e++) if(u[e] != v[e]) return true;
    return false;
}
void dfs(vector<vector<int> > & graph, vector<int> & seen, int cur){
    seen[cur] = 1;
    for(int nxt : graph[cur]) if(! seen[nxt]) dfs(graph, seen, nxt);
}
int M(){
    int n;
    if(!(cin >> n)) return 0;
    vector<long long> A(n), B(n);
    for(long long & v : A) cin >> v;
    for(long long & v : B) cin >> v;
    long long xorsumA = 0;
    for(long long v : A) xorsumA ^= v;
    long long xorsumB = 0;
    for(long long v : B) xorsumB ^= v;
    A.push_back(xorsumA);
    B.push_back(xorsumB);
    if(A == B) printf("0\n");
    else{
        if(diff(A, B)) printf("-1\n");
        else{
            compresser<long long> solver;
            solver.compress_and_push(A);
            solver.compress_and_push(B);
            vector<vector<int> > graph(200200);
            vector<int > seen(200200);
            int ed = 0;
            set<int> used;
            for(int e = 0; e < n; e++){
                if(A[e] != B[e]) {
                    graph[A[e]].push_back(B[e]);
                    graph[B[e]].push_back(A[e]);
                    used.insert(A[e]);
                    used.insert(B[e]);
                    ed++;
                }
            }
            used.insert(A[n]);
            used.insert(B[n]);
            int comps = 0;
            for(int v : used){
                if(!seen[v]){
                    //cout << v << endl;
                    dfs(graph, seen, v);
                    comps++;
                }
            }
            //cout << "cc " << comps << endl;
            printf("%d\n", ed + comps - 1);
        }
    }
    return 1;
}
int main(){
    while(M());
    return 0;
}


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

using namespace std;
typedef long long ll;

#define out(ans) cout << ans << endl
#define in(n) cin >> n
#define floop(i, N) for (ll i = 0; i < N; i++)
#define floop1(i, N) for (ll i = 1; i <= N; i++)
#define floopi(i, j, N) for (ll j = i + 1; j < N; j++)

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

constexpr int inf = 1e9;
constexpr ll linf = 1e18;

void solve();

int main()
{
    solve();
}

void solve()
{
    ll n, m;
    in(n);
    in(m);
    vector<pair<ll, ll>> p(n);
    floop(i, n)
    {
        in(p[i].first);
        in(p[i].second);
    }
    sort(p.begin(), p.end());
    ll ans = 0;
    floop(i, n)
    {
        while (p[i].second > 0 && m > 0)
        {
            ans += p[i].first;
            p[i].second--;
            m--;
        }
    }
    out(ans);
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
int main(){
  long A,B;
  cin>>A>>B;
  long i=100000;
  while(i>0){
    if(A%i==0&&B%i==0)break;
    else i--;
  }
  long a=A/i;
  cout<<a*B<<endl;
}
  

Measured memory_bytes: 256
#include <stdio.h>

void selectionSort(int A[], int N) {
    int i, j;
    int tmp, minj;
    int c = 0;
    for (i = 0; i < N; i++) {
        minj = i;
        for (j = i; j < N; j++) {
            if (A[j] < A[minj])
                minj = j;
        }

        if (i != minj) {
            tmp = A[i];
            A[i] = A[minj];
            A[minj] = tmp;

            c++;
        }
    }
    for (i = 0; i < N; i++) {
        printf("%d", A[i]);
        if (i != N-1)
            printf(" ");
        else
            printf("\n%d\n", c);
    }
}

int main()
{
    int i;
    int N, A[101];

    scanf("%d", &N);

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

    selectionSort(A, N);

    return 0;
}

Measured memory_bytes: 1804
#include<iostream>
#include<algorithm>
#include<vector>

using namespace std;
#define MAX  1000000000


int main()
{
	int a, b, ab;

	cin >> a >> b;
	ab = a + b;

	if (a % 3 == 0 || b % 3 == 0 || ab % 3 == 0) {
		cout << "Possible"<< endl;
	}
	else {
		cout << "Impossible" << endl;
	}

	return (0);
}

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

typedef long long ll;
 
using tpl = tuple<int, int, int>;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

void fastStream(){cin.tie(0);std::ios_base::sync_with_stdio(0);}

const int mod = 1000000000 + 7;

string K;
int D;
ll dp[10100][110][2];

ll rec(int pos, int rem, int is_less){
    if(dp[pos][rem][is_less] >= 0) return dp[pos][rem][is_less];
    ll res = 0;
    if(pos == (int)K.size()) res = (rem == 0);
    else{
        if(is_less){
            // 任意の数字を選べる
            for(int i = 0; i < 10; i++) 
                (res += rec(pos + 1, (rem + i) % D, is_less)) %= mod;
        }
        else{
            // 自分より小さい数字
            for(int i = 0; i < K[pos] - '0'; i++)
                (res += rec(pos + 1, (rem + i) % D, 1)) %= mod;
            // 同じ数字
            (res += rec(pos + 1, (rem + (K[pos] - '0')) % D, is_less)) %= mod;
        }
    }
    return dp[pos][rem][is_less] = res;
}

int main() {

    cin >> K;
    cin >> D;
    memset(dp, -1, sizeof(dp));
    cout << (rec(0, 0, 0) - 1 + mod) % mod << endl;

    return 0;
}


Measured memory_bytes: 18432
#include <bits/stdc++.h>
#define Int int64_t

using namespace std;

template <typename T>
T gcd(T a, T b) { return (b ? gcd(b, a % b) : a); }

template <typename T>
T lcm(T a, T b) { return (a * b) / gcd(a, b); }

int main() {
	Int a, b;
	cin >> a >> b;
	cout << lcm(a, b) << endl; 

	return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env ruby

numbers = gets.split.map(&:to_i)
WIDTH = numbers[1]
HEIGHT = numbers[0]
result = []

HEIGHT.times do 
    temp = 0
    row = gets.split.map(&:to_i)
    row.each do |value|
        temp += value
        result << value
    end
    result << temp
    row.clear
    if HEIGHT == 1 then
        break
    end
end

(WIDTH+1).times do |index|
    temp = 0
    HEIGHT.times do |rownumber|
        temp += result[(rownumber*(WIDTH+1)) + index]
    end
    result << temp
end

result.count.times do |i|
    print result[i]
    if i % (WIDTH+1.0) == WIDTH then
        puts ""
    else 
        print " "
    end
end


Measured memory_bytes: 7076
function Main(input) {
  input=input.split("\n");
  if(input[input.length-1]===''){
    input.pop();
  }
  const a=input[0].split(' ')[0]-0;
  const b=input[0].split(' ')[1]-0;
  if(a<b){
    console.log((a+'').repeat(b));
  }else{
    console.log((b+'').repeat(a));
  }
}


//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
  



  


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

using namespace std;

int main() {
	int N;
	cin >> N;
	vector<string> S(N);
	int xa = 0, bx = 0, ba = 0, sum = 0;
	for (auto& s : S) {
		cin >> s;
		if (s[0]=='B' && s.back() != 'A') ++bx;
		if (s.back()=='A' && s[0] != 'B') ++xa;
		if (s.back()=='A' && s[0]=='B') ++ba;
		for (int i=0;i+1<s.size();++i) {
			if (s[i]=='A'&&s[i+1]=='B') ++sum;
		}
	}
	sum += max(0,ba-1);
	if (ba&&xa) {
		++sum;
		--xa;
	}
	if (ba&&bx) {
		++sum;
		--bx;
	}
	int mn = min(xa,bx);
	sum += mn;
	xa -= mn;
	bx -= mn;
	// cout << sum << " " << xa << " " << bx << " " << ba << endl;
	// ba %= 2;
	cout << sum << endl;
}

Measured memory_bytes: 768
#include "stdio.h"
#include "string.h"

int main(void){
  char S[10];
  int price = 700;

  scanf("%s", S);

  if(S[0] == 'o'){price += 100;}
  if(S[1] == 'o'){price += 100;}
  if(S[2] == 'o'){price += 100;}

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

  return 0;
}


Measured memory_bytes: 128
#include <iostream>

#include<math.h>

#include<stdio.h>

#include<string.h>

#include<vector>

#include<algorithm>



typedef long long lli;

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

#define rep1(i, n) for(int i=1; i < (int)(n); i++)

#define all(x) (x).begin(),(x).end()

#define fill(x,y) memset(x,y,sizeof(x))

#define debug1(i) cout << i << '\n'

#define debug2(i,j) cout << i << j << '\n'



using namespace std;



int main() {
	char s[100001];

	cin >> s;
	
	int i = 0;
	
	int ans1=0, ans2=0;
	for (; s[i] != '\0'; i++) {
		if (i % 2 == 0) {
			if (s[i] != '0') ans1++;
		}
		else {
			if (s[i] != '1')ans1++;
		}
	}
	
	i = 0;
	for (; s[i] != '\0'; i++) {
		if (i % 2 == 1) {
			if (s[i] != '0') ans2++;
		}
		else {
			if (s[i] != '1') ans2++;
		}
	}
	

	cout << ((ans1 < ans2) ? ans1 : ans2);
}

Measured memory_bytes: 384
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef vector<ll> vl;
typedef vector<vector<ll> > vvl;
#define REP(var, a, b) for (int var = (a); var < (b); var++)
#define rep(var, n) for (int var = 0; var < (n); ++var)
#define ALL(c) (c).begin(), (c).end()
#define rALL(c) (c).rbegin(), (c).rend()
ll MOD = 1000000007;

int main() {
  //
  ll a;
  cin >> a;
  string s;
  cin >> s;
  if (a >= 3200)
    cout << s << endl;
  else
    cout << "red" << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
/*** Template Begins ***/
 
typedef long long   ll;
typedef pair<ll,ll> pll;
typedef long double ld; 
#define rep(i,a,b) for(i=a;i<b;i++)
#define pb           push_back
#define F            first
#define S            second
#define ios          ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define hell   1000000007LL
#define all(a)       (a).begin(),(a).end()
ll power(ll x, ll y, ll p){ ll res = 1;x = x % p;while (y > 0) {if (y & 1) res = (res*x) % p;y = y>>1;
  x = (x*x) % p;} return res;} 

const long double PI = acos(-1);
// Debug //
#define trace(x)                 cerr << #x << ": " << x << endl;
#define trace1(x)                cerr << #x << ": " << x << endl;
#define trace2(x, y)             cerr << #x << ": " << x << " | " << #y << ": " << y << endl;
#define trace3(x, y, z)          cerr << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " << z << endl;
#define trace4(a, b, c, d)       cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << endl;
#define trace5(a, b, c, d, e)    cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl;
#define trace6(a, b, c, d, e, f) cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << " | " << #f << ": " << f << endl;
ll euclid(ll x,ll y,ll a,ll b){
  return (a-x)*(a-x)+(b-y)*(b-y);
}
void solve()
{
  ll n,i,j;
  cin>>n;
  ll ans=0,x,N=1000000;
  std::vector<ll> v(1000005,0);
  for(i=0;i<n;i++)
  {
    cin>>x;
    v[x]++;
  }
  for(i=1;i<=N;i++)
  {
    if(v[i])
    {
      for(j=2*i;j<=N;j+=i)
        if(v[j])
          v[j]=0;
    }
    if(v[i]>1)
      v[i]=0;
  }
  for(i=1;i<=N;i++)
  {
    // if(v[i])
    //   trace2(i,v[i]);
    ans +=v[i];
  }
  cout<<ans<<endl;
}
int main()
{ 
  ios;
  // freopen("input.txt", "r", stdin);
  // freopen("output.txt", "w", stdout);
  ll t=1,i=1;
  // cin>>t;
  while(i<=t)
  {
    solve();
    i++;
  }
  return 0;
}


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

int main() {
    int N;
    cin >> N;
    vector<vector<int>> data(N + 1, vector<int>(3, 0));
    for (int i = 1; i < N + 1; i++) {
        for (int j = 0; j < 3; j++) {
            cin >> data[i][j];
        }
    }
    vector<vector<int>> dp(N + 1, vector<int>(3, 0));
    for (int i = 1; i < N + 1; i++) {
        for (int j = 0; j < 3; j++) {
            /*
            int temp = max(dp[i - 1][j - 1], dp[i - 1][j - 2]);
            python_list[-2] c++ はできない
            */
            int temp = max(dp[i - 1][(j + 1) % 3], dp[i - 1][(j + 2) % 3]);
            dp[i][j] = data[i][j] + temp;
        }
    }
    int ans = 0;
    for (int i = 0; i < 3; i++) {
        ans = max(dp[N][i], ans);
    }
    cout << ans << endl;
    /*
    for (int i = 0; i < N + 1; i++) {
        for (int j = 0; j < 3; j++) {
            cout << dp[i][j] << " ";
            if (j == 2)
                cout << endl;
        }
    }
    */
}

Measured memory_bytes: 14328
/*main*/
#include <iostream>
#include <stdio.h>
#include <cstdlib>
using namespace std;

typedef long long LL;
LL N,molecule,denominator;
int main()
{
    LL h,n,w;
    int flag = 0;
    scanf("%I64d",&N);
    for(h=1; h<=3500; h++)
    {
        for(n=1; n<=3500; n++)
        {
            molecule = 4*h*n - N*n - N*h;
            denominator = N*h*n;
            if(molecule>0 && denominator%molecule==0)
            {
                w = denominator / molecule;
                printf("%I64d %I64d %I64d",h,n,w);
                flag = 1; break;
            }
        }
        if(flag) break;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
const ll mod=1000000007;
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;

int main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    cin>>n;
    ll a[n],d[n],sum=0;
    for(int i=0;i<n;i++){
        cin>>a[i];
        if(i){
            d[i-1]=a[i]-a[i-1];
        }
        sum+=a[i];
    }
    d[n-1]=a[0]-a[n-1];
    ll k=sum/(n*(n+1)/2);
    if(sum==k*(n*(n+1)/2)){
        for(int i=0;i<n;i++){
            if(d[i]<=k&&(d[i]-k)%n==0){
                continue;
            }
            else{
                cout << "NO"<<endl;
                return 0;
            }
        }
        cout << "YES"<<endl;
    }
    else{
        cout <<  "NO"<<endl;
    }
    return 0;
}


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

using namespace std;

int h,w;
char s[55][55];
bool flag[55][55];
int dp[55][55];
int cnt = 0;

struct P{
public:
    int h, w, dep;
};

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

    cin >> h >> w;

    for (int i = 0;i < h;i++){
        for (int j = 0;j < w;j++){
            cin >> s[i][j];
            if (s[i][j] == '#') cnt++;
        }
    }

    queue<P> q;
    q.push(P{0,0,0});
    while(!q.empty()){
        P now = q.front(); q.pop();
        dp[now.h][now.w] = now.dep;
        if (s[now.h+1][now.w] != '#' && !flag[now.h+1][now.w] && now.h+1 < h){q.push(P{now.h+1,now.w,now.dep+1});flag[now.h+1][now.w] = true; } 
        if (s[now.h][now.w+1] != '#' && !flag[now.h][now.w+1] && now.w+1 < w){q.push(P{now.h,now.w+1,now.dep+1});flag[now.h][now.w+1] = true; }  
        if (s[now.h-1][now.w] != '#' && !flag[now.h-1][now.w] && now.h-1 >= 0){q.push(P{now.h-1,now.w,now.dep+1});flag[now.h-1][now.w] = true; }       
        if (s[now.h][now.w-1] != '#' && !flag[now.h][now.w-1] && now.w-1 >= 0){q.push(P{now.h,now.w-1,now.dep+1});flag[now.h][now.w-1] = true; }
    }

    if (dp[h-1][w-1] == 0) cout << "-1" << endl;
    else cout << h*w - cnt - dp[h-1][w-1] - 1 << endl;


    return 0;

}

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

typedef long long ll;

#define p_ary(ary,a,b,i) do { cout << "["; for (int (i) = (a);(i) < (b);++(i)) cout << ary[(i)] << ((b)-1 == (i) ? "" : ", "); cout << "]\n"; } while(0)
#define p_map(map,it) do {cout << "{";for (auto (it) = map.begin();;++(it)) {if ((it) == map.end()) {cout << "}\n";break;}else cout << "" << (it)->first << "=>" << (it)->second << ", ";}}while(0)

struct LazySegmentTree {
private:
    int n;
    vector<ll> node,lazy;
    vector<bool> upd;
public:
    LazySegmentTree(vector<ll> v) {
        int sz = v.size();
        n = 1;
        while (n < sz) n *= 2;
        node.resize(2*n-1);
        lazy.resize(2*n-1,0);
        upd.resize(2*n-1,false);
        for (int i = 0;i < sz;++i) node[i+n-1] = v[i];
        for (int i = n-2;i >= 0;--i) node[i] = node[i*2+1]+node[i*2+2];
    }

    void eval(int k,int l,int r) {
        if (upd[k]) {
            node[k] = lazy[k]*(r-l);
            if (r-l > 1) {
                lazy[2*k+1] = lazy[2*k+2] = lazy[k];
                upd[2*k+1] = upd[2*k+2] = true;
            }
            lazy[k] = 0;
            upd[k] = false;
        }
    }

    void update(int a,int b,ll x,int k = 0,int l = 0,int r = -1) {
        if (r < 0) r = n;
        eval(k,l,r);
        if (b <= l || r <= a) return;
        if (a <= l && r <= b) {
            lazy[k] = x;
            upd[k] = true;
            eval(k,l,r);
        } else {
            update(a,b,x,2*k+1,l,(l+r)/2);
            update(a,b,x,2*k+2,(l+r)/2,r);
            node[k] = node[2*k+1]+node[2*k+2];
        }
    }

    ll getsum(int a,int b,int k = 0,int l = 0,int r = -1) {
        if (r < 0) r = n;
        if (b <= l || r <= a) return 0;
        eval(k,l,r);
        if (a <= l && r <= b) return node[k];
        ll vl = getsum(a,b,k*2+1,l,(l+r)/2);
        ll vr = getsum(a,b,2*k+2,(l+r)/2,r);
        return vl+vr;
    }
};

int main() {
    int n,q;
    cin >> n >> q;
    LazySegmentTree seg(vector<ll>(n,0));
    for (int i = 0;i < q;++i) {
        int c,s,t;
        cin >> c >> s >> t;
        if (c) cout << seg.getsum(s,t+1) << endl;
        else {
            int x;
            cin >> x;
            seg.update(s,t+1,x);
        }
    }
    return 0;
}


Measured memory_bytes: 7876
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
 
#define vl vector<ll>
#define vi vector<int>
 
#define ff first
#define ss second
 
#define pb push_back
#define MOD 1000000007
//const int nax = 1e6+5;
#define inf 4e18
 
#define display(v) for(int i =0;i<v.size();++i)cout << v[i] << " "
#define all(v) v.begin(),v.end()
ll sqr(ll x){return x*x;}
inline ll add(ll a, ll b){ ll c = a + b; if(c >= MOD) c -= MOD; return c; }
inline ll mul(ll a, ll b){ return (a * 1ll * b) % MOD; }
inline ll sub(ll a, ll b){ ll c = a - b; if(c < 0) c += MOD; return c; }
const int nax = 100*1000 + 10;

ll mx = 1000000000000001;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
   
    ll n; cin>>n; //n--;
    string str;
    int i =1;
    ll ok = 26;
    while(n){
      ll v= n%26;
      if(v == 0){
        v = 26;
        n = (n-1)/26;
      }
      else{
          n/=26;
      }
      str += (char)(v-1+'a');
        
        
    }
    reverse(all(str));
    cout << str;
    



    
    
    return 0;
}
    
// Химаншу    

Measured memory_bytes: 3652
import sys


S = [int(_) for _ in list(input())]
K = int(input())
t = 0
while t <= len(S) - 1:
    if S[t] == 1:
        t += 1
    else:
        break

if K <= t:
    print(1)
    sys.exit()
else:
    print(S[t])
    sys.exit()


Measured memory_bytes: 2940
#define _USE_MATH_DEFINES
#define INF 100000000

#include <iostream>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>
#include <cctype>
#include <utility>

using namespace std;

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


static const double EPS = 1e-8;

int tx[] = {-1,0,1,0};
int ty[] = {0,1,0,-1};

P formula(const string &str, int pos=0);
P factor(const string &str, int pos = 0);
P term(const string &str, int pos = 0);

P formula(const string &str, int pos){
	if(str[pos] == '('){
		P res1_ = formula(str,pos+1);
		pos = res1_.second;
		char ch = str[pos];
		P res2_ = formula(str,pos+1);

		if(ch=='*') return P(min(res1_.first,res2_.first),res2_.second+1);
		if(ch=='+') return P(max(res1_.first,res2_.first),res2_.second+1);
	}
	else if(isdigit(str[pos])){
		return P(str[pos]-'0',pos+1);
	}

	else if(str[pos] == '-'){
		P res_ = formula(str,pos+1);
		if(res_.first==0) res_.first=2;
		else if(res_.first==2) res_.first=0;

		return res_;
	}
}


int main()
{
	string str;
	while(getline(cin,str)){
		if(str == ".") break;
		int res = 0;
		for(int p=0;p<=2;p++){
			for(int q=0;q<=2;q++){
				for(int r=0;r<=2;r++){
					string tmp = str;
					for(int i=0;i<tmp.size();i++){
						if(tmp[i]=='P') tmp[i] = '0' + p;
						else if(tmp[i]=='Q') tmp[i] = '0' + q;
						else if(tmp[i]=='R') tmp[i] = '0' + r;
					}
					//P result;
					//result = formula(tmp,0);
					//printf("%s = %d\n",tmp.c_str(),result.first);
					if(formula(tmp,0).first == 2) res++;
				}
			}
		}

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

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

int main() {
  string s, t;
  cin>>s>>t;
  rep(i,s.size()){
    if(s[i]!=t[i]){
      cout<<"No"<<endl;
      return 0;
    }
  }
  cout<<"Yes"<<endl;


}

Measured memory_bytes: 3596
N, K = map(int, input().split())
A = list(map(int, input().split()))


def f(n):
    cnt = 0
    for a in A:
            # a/nが偶数の場合
        if a % n == 0:
            cnt += a//n-1
        # a/nが奇数の場合
        else:
            cnt += a//n
    return True if K >= cnt else False


l = 0
r = max(A)
# 二分探索
while r - l > 1:
    m = (r+l)//2
    if f(m):
        r = m
    else:
        l = m
print(r)


Measured memory_bytes: 30984
#include <iostream>

using namespace std;

int main() {
    int n, q, s[10000];

    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> s[i];
    }
    cin >> q;
    int c = 0;
    for (int i = 0; i < q; i++) {
        int t;
        cin >> t;
        for (int j = 0; j < n; j++) {
            if (t == s[j]) {
                c++;
                break;
            }
        }
    }

    cout << c << endl;
}

Measured memory_bytes: 1200
import java.util.*;
import static java.lang.System.*;

public class Main {
	static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		int a,b;
		String[] ar = sc.nextLine().split(" ");
		Deque<Integer> deque = new ArrayDeque<>();
		for (int i=0; i<ar.length; i++) {
			if (ar[i].equals("+")) {
				a = deque.removeFirst();
				b = deque.removeFirst();
				deque.addFirst(a+b);
			}
			else if (ar[i].equals("-")) {
				a = deque.removeFirst();
				b = deque.removeFirst();
				deque.addFirst(b-a);
			}
			else if (ar[i].equals("*")) {
				a = deque.removeFirst();
				b = deque.removeFirst();
				deque.addFirst(a*b);
			}
			else {
				deque.addFirst(Integer.parseInt(ar[i]));
			}
		}
		out.println(deque.getFirst());
	}
}



Measured memory_bytes: 26296