akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
constexpr ll TEN(int n) { return (n==0) ? 1 : 10*TEN(n-1); }
template<class T> using V = vector<T>;
template<class T> using VV = V<V<T>>;

template<class D>
struct Hungarian {
    V<D> le, ri;
    V<int> perm;

    Hungarian(const VV<D> &c) {
        int n = int(c.size()), m = int(c[0].size());
        assert(n <= m);
        le = V<D>(n, D(0)); ri = V<D>(m, D(0));
        perm = V<int>(n);
        V<int> to_r(n, -1), to_l(m, -1);

        auto cost = [&](int l, int r) { return c[l][r] + le[l] + ri[r]; };
        for (int l = 0; l < n; l++) {
            V<bool> l_u(n), r_u(m);
            V<int> tr(m, -1), min_l(m, l);
            l_u[l] = true;
            while (true) {
                int b = -1;
                D d = numeric_limits<D>::max();
                for (int j = 0; j < m; j++) {
                    if (!r_u[j] && cost(min_l[j], j) < d) {
                        b = j;
                        d = cost(min_l[j], j);
                    }
                }
                for (int i = 0; i < n; i++) if (l_u[i]) le[i] -= d;
                for (int j = 0; j < m; j++) if (r_u[j]) ri[j] += d;
                tr[b] = min_l[b];
                int c = to_l[b];
                if (c == -1) {
                    while (b != -1) {
                        int a = tr[b], z = to_r[a];
                        to_l[b] = a;
                        to_r[a] = b;
                        b = z;
                    }
                    break;
                }
                r_u[b] = l_u[c] = true;
                for (int j = 0; j < m; j++) {
                    if (cost(c, j) < cost(min_l[j], j)) {
                        min_l[j] = c;
                    }
                }
            }
        }
        perm = to_r;
    }    
};

using D = double;
const D PI = acos(D(-1)), EPS = 1e-10;
using P = complex<D>;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(20) << fixed;

    D ans = 0;

    int n;
    cin >> n;
    V<P> up(n), dw(n);
    D x, y;
    cin >> x >> y;
    for (int i = 0; i < n; i++) {
        cin >> x >> y; up[i] = P(x, y);
        cin >> x >> y; dw[i] = P(x, y);
        ans += abs(up[i]-dw[i]);
    }

    int l = int(up.size()), r = int(dw.size());
    VV<D> cost(l, V<D>(r));
    for (int i = 0; i < l; i++) {
        for (int j = 0; j < r; j++) {
            cost[i][j] = abs(up[i] - dw[j]);
        }
    }
    auto perm = Hungarian<D>(cost).perm;
    for (int i = 0; i < l; i++) {
        ans += cost[i][perm[i]];
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 3896
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#define rep(i, n) for(i = 0; i < n; i++)
using namespace std;

void chmin(int &a, int b) { a = min(a, b); }

int INF = 1e+9;
int n;
int a[18];
int b[18];
int dp[1 << 18][18];

int main() {
	int i, j, k;
	
	cin >> n;
	rep(i, n) cin >> a[i];
	rep(i, n) cin >> b[i];
	
	rep(i, (1 << n)) rep(j, n) dp[i][j] = INF;
	
	rep(i, n) {
		dp[1 << i][i] = 0;
	}
	
	rep(i, (1 << n) - 1) {
		int bcnt = 0;
		rep(j, n) if ((i >> j) % 2) bcnt++;
		
		rep(j, n) {
			if (dp[i][j] >= INF) continue;
			
			int last;
			if (bcnt % 2 != j % 2) { last = a[j]; }
			else { last = b[j]; }
			
			rep(k, n) {
				if ((i >> k) % 2) { continue; }
				
				int now;
				if ((bcnt + 1) % 2 != k % 2) { now = a[k]; }
				else { now = b[k]; }
				if (last > now) continue;

				int cst = 0;
				int l;
				for (l = k + 1; l < n; l++) if ((i >> l) & 1) cst++;
				
				chmin(dp[i + (1 << k)][k], dp[i][j] + cst);
			}
		}
	}
	
	int ans = INF;
	rep(j, n) {
		chmin(ans, dp[(1 << n) - 1][j]);
	}
	if (ans >= INF) cout << -1 << endl;
	else cout << ans << endl;
	return 0;
}

Measured memory_bytes: 18688
#include<stdio.h>

int main(void)
{
	int i, j,x,y;

	while (1)
	{
		scanf("%d %d", &i, &j);
		if (i == 0 && j == 0)break;
		for (x = 0; x < i; x++)
		{
			for (y = 0; y < j; y++)
			{
				printf("#");
			}
			printf("\n");
		}
		printf("\n");
	}
	return 0;
}


Measured memory_bytes: 2104
using System;

class Program
{
    static void Main(string[] args)
    {
        var input = Console.ReadLine().Split(' ');
        var a = Convert.ToInt32(input[0]);
        var b = Convert.ToInt32(input[1]);
        var c = Convert.ToInt32(input[2]);

        var result = a + c == 2 * b ? "YES" : "NO";
        Console.WriteLine(result);
    }
}

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

// @@ !! LIM()

int main(int argc, char *argv[]) {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout << setprecision(20);

  ll N; cin >> N;
  multiset<ll> cur;
  for (ll i = 0; i < N; i++) {
    ll a; cin >> a;
    if (cur.empty()) {
      cur.insert(a);
      continue;
    }
    auto it = cur.lower_bound(a);
    if (it == cur.begin()) {
      cur.insert(a);
      continue;
    }
    it--;
    cur.erase(it);
    cur.insert(a);
  }
  cout << cur.size() << endl;
  return 0;
}



Measured memory_bytes: 4992
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt(), k=sc.nextInt();
        int[] arr = new int[n];
        for (int i=0; i<n; i++) arr[i] = sc.nextInt();
        int ans = 0;
        n = n - k;
        while (n > 0) {
            n -= (k-1);
            ans++;
        }
        System.out.println(ans+1);
    }
}

Measured memory_bytes: 47608
#![allow(dead_code)]
use crate::scanner::Scanner;
fn main() {
    let mut scan = Scanner::new();
    let s = scan.read::<usize>();
    let w = scan.read::<usize>();
    println!("{}", if s <= w { "unsafe" } else { "safe" });
}
mod scanner {
    use std::io::{stdin, BufReader, Bytes, Read, Stdin};
    use std::str::FromStr;
    pub struct Scanner {
        buf: Bytes<BufReader<Stdin>>,
    }
    impl Scanner {
        pub fn new() -> Scanner {
            Scanner {
                buf: BufReader::new(stdin()).bytes(),
            }
        }
        pub fn read_next<T: FromStr>(&mut self) -> Option<T> {
            let token = self
                .buf
                .by_ref()
                .map(|c| c.unwrap() as char)
                .skip_while(|c| c.is_whitespace())
                .take_while(|c| !c.is_whitespace())
                .collect::<String>();
            token.parse::<T>().ok()
        }
        pub fn read<T: FromStr>(&mut self) -> T {
            self.read_next().unwrap()
        }
        pub fn readn<T: FromStr>(&mut self, n: usize) -> Vec<T> {
            (0..n).map(|_| self.read::<T>()).collect()
        }
        pub fn chars(&mut self) -> Vec<char> {
            self.read::<String>().chars().collect()
        }
        pub fn char(&mut self) -> char {
            self.read::<String>().chars().next().unwrap()
        }
    }
}



Measured memory_bytes: 2148
H,W,A,B=map(int,input().split())
N=H+W
mod=10**9+7
factl=[1]
for i in range(1,N+1):
    factl.append(factl[-1]*i%mod)
invl=[pow(factl[-1],mod-2,mod)]
for i in range(N,0,-1):
    invl.append(invl[-1]*i%mod)
invl.reverse()
def Comb(a,b):
    return factl[a]*invl[a-b]*invl[b]
ans=0
for i in range(H-A):
    ans+=Comb(B+i-1,i)*Comb((W-B-1)+(H-i-1), H-i-1)
    ans%=mod
print(ans)

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

using namespace std;

int main(){
	int n,m;
	cin >> n >> m;
	pair<int,int> mp;
	mp.first=0;
	mp.second=0;
	vector<pair<int,int> > list(m,mp);
	vector<int> delist(0);
	for(int i=0;i<m;i++){
		cin >> list[i].first;
		cin >> list[i].second;
		if(list[i].first==1){
			delist.push_back(list[i].second);
		}
	}
	bool flag=false;
	sort(list.begin(),list.end());
	sort(delist.begin(),delist.end());
	if(*lower_bound(delist.begin(),delist.end(),n)==n){
		flag=true;
	}
	vector<int>::iterator it1;
	vector<pair<int,int> >::iterator it2;
	mp.second=-2000000;
	for(it1=delist.begin();it1!=delist.end();++it1){
		mp.first=*it1;
		pair<int,int> temp;
		for(it2=lower_bound(list.begin(),list.end(),mp);temp=*it2,temp.first==mp.first;++it2){
			if(temp.second==n){
				flag=true;
				break;
			}
		}
		if(flag)break;

	}
	if(flag)cout << "POSSIBLE" << endl;
	else cout << "IMPOSSIBLE" << endl;

	return 0;
}


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

using namespace std;

const int max_n = 200222, mod = 998244353;
const int max_x = 1000111;

int n, a[max_n];
int mn_d[max_x];

void prec() {
    mn_d[1] = 1;
    for (int i = 2; i < max_x; ++i) {
        if (mn_d[i] == 0) {
            mn_d[i] = i;
            for (int j = 2 * i; j < max_x; j += i) {
                if (mn_d[j] == 0) {
                    mn_d[j] = i;
                }
            }
        }
    }
}

vector<pair<int, int>> all;
vector<int> res, p;

void rec(int pos, int x) {
    if (pos == all.size()) {
        res.push_back(x);
        return;
    }
    for (int i = 0; i <= all[pos].second; ++i) {
        rec(pos + 1, x);
        x *= all[pos].first;
    }
}

void factorize(int x) {
    res.clear();
    p.clear();
    if (x == 1) {
        res.push_back(1);
        return;
    }
    all.clear();
    int last = 0, cnt = 0;
    while (x != 1) {
        if (mn_d[x] == last) {
            ++cnt;
        } else {
            if (last) {
                all.push_back({last, cnt});
                p.push_back(last);
            }
            last = mn_d[x];
            cnt = 1;
        }
        x /= mn_d[x];
    }
    all.push_back({last, cnt});
    p.push_back(last);
    rec(0, 1);
    sort(res.begin(), res.end());
}

long long sum[max_x], dp[max_x];

int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    prec();
    scanf("%d", &n);
    for (int i = 0; i < n; ++i) {
        scanf("%d", &a[i]);
        factorize(a[i]);
        for (int d : res) {
            sum[d] += a[i];
        }
    }
    int ans = 0;
    for (int i = 0; i < n; ++i) {
        factorize(a[i]);
        for (int d : res) {
            sum[d] -= a[i];
        }
        for (int d : res) {
            dp[d] = sum[d];
        }
        //reverse(res.begin(), res.end());
        for (int pr : p) {
            for (int d : res) {
                if (d % pr == 0) {
                    dp[d / pr] -= dp[d];
                }
            }
        }
        //cout << i << ": ";
        long long add = 0;
        for (int d : res) {
            add += dp[d] / d;
            //cout << "(" << d << " " << dp[d] << " " << sum[d] << ") ";
        }
        //cout << endl;
        add %= mod;
        ans += (add * a[i]) % mod;
        ans %= mod;
    }
    printf("%d\n", ans);
    return 0;
}


Measured memory_bytes: 20608
#include <bits/stdc++.h>
#include "unistd.h"
using namespace std;
#define WA cout<<"char134217728";exit(0)
#define RE throw
#define TLE sleep(1000)
#define FOR(i,a,b) for(int i=(a),i##formax=(b);i<i##formax;i++)
#define FORR(i,a,b) for(int i=(a),i##formax=(b);i>=i##formax;i--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define pcnt __builtin_popcount
#define sz(x) (int)(x).size()
#define maxs(x,y) x=max(x,y)
#define mins(x,y) x=min(x,y)
#define show(x) cout<<#x<<" = "<<x<<endl;
#define all(a) (a.begin()),(a.end())
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define perm(c) sort(all(c));for(bool c##p=1;c##p;c##p=next_permutation(all(c)))
#define uniq(v) sort(all(v));v.erase(unique(all(v)), v.end());
#define bit(n) (1LL<<(n))
#define randInt(l,r) (uniform_int_distribution<ll>(l,r)(rnd))
#define randDouble(l,r) (uniform_real_distribution<double>(l,r)(rnd))
#define dout(d) printf("%.12f\n",d)

typedef long long ll;
typedef __int128_t lll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
template<class T>using V=vector<T>;
template<class T>using VV=V<V<T>>;
template<class T,class Y>ostream& operator<<(ostream& o,const pair<T,Y>& p){return o<<"("<<p.fi<<", "<<p.se<<")";}
template<typename A,size_t N,typename T>void Fill(A (&array)[N],const T&v){fill((T*)array,(T*)(array+N),v);}
lll gcd(lll a,lll b,lll &x,lll &y){if(!b){x=1;y=0;return a;}lll d=gcd(b,a%b,y,x);y-=a/b*x;return d;}
ll gcd(ll a,ll b){lll x=0,y=0;return gcd(a,b,x,y);}
ll modInv(ll a,ll m){lll x,y;gcd(a,m,x,y);return (x%m+m)%m;}
ll modPow(lll a,lll n,ll m){if(!a)return a;lll p=1;for(;n>0;n>>=1,a=a*a%m)if(n&1)p=p*a%m;return(ll)p;}
bool isPrime(ll n){if(n<2||n%2==0)return n==2;lll t=n-1,d=t/(t&-t);for(lll a:{2,325,9375,28178,450775,9780504,1795265022})if(a%n){for(t=d,a=modPow(a,t,n);t!=n-1&&a!=1&&a!=n-1;a=a*a%n,t=t*2%n);if(a!=n-1&&t%2==0)return 0;}return 1;}
const int IINF = 1e9+6;
const ll LINF = 1e18;
const int MOD = 1e9+7;
const double PI = acos(-1);
const double EPS = 1e-10;
static random_device rd;
static mt19937 rnd(rd());

const int N = 1e5;
int a, b, k;
main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> a >> b >> k;
  FORR(i, 100, 1){
    if(a%i || b%i) continue;
    k--;
    if(!k){
      cout << i << endl;
      return 0;
    }
  }
}

Measured memory_bytes: 256
#include<stdio.h>
using namespace std;
//scanf("%d%d",&W,&H);
//printf("%d\n",c);
int main() {
  int a,i,max,min;
  long s=0; 
  scanf("%d",&a);
  int b[a];
  
  for(i=0; i<a; i++){
    scanf("%d",&b[i]);
  }
  
  i=0;
  max=b[0];
  min=b[0];
  
  for(i=0; i<a; i++){
  
    s=s+b[i]; 
    if(max<b[i]){
      max=b[i];
    }
    if(min>b[i]){
      min=b[i];
    }
  }
  printf("%d %d %ld\n",min,max,s);
}
  
  
  


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

const ll mod=1000000007;

int main() {
  ll N;cin>>N;
  vector<int> A(N);rep(i,N) cin>>A[i];
  vector<ll> B(N+1,0);
  for(int i=0;i<N;i++){
    B[i+1]=B[i]+A[i];
  }
  
  ll sum=0;
  for(int i=0;i<N-1;i++){
    sum+=A[i]*((B[N]-B[i+1])%mod);
    sum%=mod;
  }
  
  cout << sum << endl;
}


Measured memory_bytes: 5544
# inputを高速化する。
import sys
input = sys.stdin.readline

k = int(input())

lunlun = [1,2,3,4,5,6,7,8,9]

def generator_lunlun(n):
    final = n % 10
    if final > 0:
        yield n * 10 + final - 1
    yield n * 10 + final
    if final < 9:
        yield n * 10 + final + 1
        
     
p = 0
while len(lunlun) < k:
    for result in generator_lunlun(lunlun[p]):
        lunlun.append(result)
    p += 1

print(lunlun[k-1])

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

signed main(void){
  
  int N,M; cin >> N >> M;
  string s; cin >> s;
  vector<int> A(N,0); //頂点iに隣接するAの個数をa[i]に入れる
  vector<int> B(N,0);
  
  vector<set<int>> check(N);
  vector<vector<int>> to(N);
  
  for(int i = 0; i < M; i++){ 
    
    int a,b; cin >> a >> b; 
    a--; b--;
    
    if( a > b ){ swap(a,b);}
    
    if( check[a].find(b) != check[a].end() || check[b].find(a) != check[b].end()){ continue;} 
    //すでにa-b間を繋いだことがある
    
    to[a].push_back(b); 
    to[b].push_back(a);
    
    check[a].insert(b);
    check[b].insert(a);
    
    //見たことなければ新情報
    
    if( s[b] == 'A' ){ A[a]++;} else{ B[a]++;}
    if( s[a] == 'A' ){ A[b]++;} else{ B[b]++;}
  }
  
  queue<int> Q;
  
  int cnt = 0;
  vector<bool> marked(N,false); 
  //一度ダメになったらもう一度判定する必要はない
  
  for(int i = 0; i < N; i++){ 
    if( !(A[i] > 0 && B[i] > 0) ){
      Q.push(i);  marked[i] = true;cnt++;
    }
  }
  //初めから条件を満たさないものについてはドシドシqueueに入れる
  
  while(!Q.empty()){ 
    
    int p = Q.front(); Q.pop();
    
    for(auto q : to[p] ){ 
      if( q == p || marked[q] ){ continue;} //自分自身に伝搬させる必要はない　元からだめ
      
      if( s[p] == 'A' ){ 
        A[q]--;
      }
      else{ 
        B[q]--;
      }
      
      if( !(A[q] > 0 && B[q] > 0 ) ){ 
        
        Q.push(q); cnt++; marked[q] = true;
      }
      //ダメなら追加
    }//for-auto
  }//while
  
  if( cnt == N ){ cout << "No" << endl;}
  else{ cout <<"Yes" << endl;}
  
  return 0;
}
  
    
    

Measured memory_bytes: 42116
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

int main() {

  int n;
  cin >> n;

  for(int q=0;q<n;q++) {
    string str;
    cin >> str;

    string train;

    train.clear();
    int ima = 0;
    int head = 0,tail=0;
    train += str[0];
    for(int i=0;i<str.size();i++) {

      if(str[i] == '>' ) {
	ima++;
	if(head < ima) {
	train += str[i+1];
	head = ima;
	}
      }
      else if(str[i] == '<'){
	ima--;
	if(tail > ima) {
	  tail = ima;
	  reverse(train.begin(),train.end());
	  train += str[i+2];
	  reverse(train.begin(),train.end());
	}
      }

    }
    
    cout << train << endl;

  }

  return 0;

}

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

int main(){
	int n;
	cin >> n;
	for(int l=0; l < n; l++){
		bool isLined = true;
		int num[10];
		int b = -1, c = -1;
		for(int i=0; i < 10; i++){
			cin >> num[i];
		}

		for(int i=0; i < 10; i++){
			if(num[i] < b && num[i] < c){
				isLined = false;
				break;
			}
			else if(b < num[i] && c < num[i]){
				if(b < c) c = num[i];
				else b = num[i];
			}
			else if(b < num[i]){
				b = num[i];
			}
			else c = num[i];
		}
		if(isLined) cout << "YES" << endl;
		else cout << "NO" << endl;

	}
}

Measured memory_bytes: 1152
parseInt(x::String) = parse(Int, x)
parseInt(x::SubString{String}) = parse(Int, x)
parseInt(x::Char) = parse(Int, x)
parseInt(x::Float64) = trunc(Int, x)
parseFloat(x::String) = parse(Float64, x)
parseFloat(x::Int) = trunc(Float64, x)
parseFloat(x::SubString{String}) = parse(Float64, x)
parseFloat(x::Char) = parse(Float64, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)

function main()
    k,s=parseMap(split(readline()))
    ans=0
    for i in 0:k
        for j in 0:k
            if 0<=s-(i+j)<=k
                ans+=1
            end
        end
    end
    println(ans)
end
main()

Measured memory_bytes: 111160
public class Main{
  public void run(java.io.InputStream in, java.io.PrintStream out){
    java.util.Scanner sc = new java.util.Scanner(in);
/*answer*/
    int i, j;
    char[][] ch;
    String str;

    ch = new char[8][8];
    for(;sc.hasNext();){
      for(i = 0;i < 8;i++){
        str = sc.next();
        for(j = 0;j < 8;j++)ch[i][j] = str.charAt(j);
      }
      for(i = 0;i < 8;i++)for(j = 0;j < 8;j++){
        if(ch[i][j] == '1'){
          if(i < 5 && ch[i + 3][j] == '1'){
            out.println("B"); break;
          }else if(j < 5 && ch[i][j + 3] == '1'){
            out.println("C"); break;
          }else if(i < 7 && ch[i + 1][j] == '1'){
            if(j < 7 && ch[i][j + 1] == '1'){
              if(ch[i + 1][j + 1] == '1'){
                out.println("A"); break;
              }else if(i != 0 && ch[i - 1][j + 1] == '1'){
                out.println("D"); break;
              }else if(j != 0 && ch[i + 1][j - 1] == '1'){
                out.println("G"); break;
              }
            }else if(j < 7 && ch[i + 1][j + 1] == '1'){
              if(j != 0 && ch[i][j - 1] == '1'){
                out.println("E"); break;
              }else if(i < 6 && ch[i + 2][j + 1] == '1'){
                out.println("F"); break;
              }
            }
          }
        }
      }
    }

    sc.close();
  }
  public static void main(String[] args){
    (new Main()).run(System.in, System.out);
  }
}

Measured memory_bytes: 20044
#define pi 3.14159265358979323846
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <numeric>
#include <algorithm>
#include <iomanip>
using namespace std;
long double a, b, x, ans;
long double aatan(long double m, long double n);

int main() {
	cin >> a >> b >> x;

	if (x <= a * a * b / 2.0) {
		ans = 90 - (aatan(2 * x,(a * b * b)) * 180.0 / pi);
	} else {
		ans = 90 - (aatan(a * a * a ,(2 * b * a * a - 2 * x)) * 180.0 / pi);
	}

	cout << setprecision(20) << ans;
	return 0;
}
long double aatan(long double m, long double n) {
	if (n != 0) {
		return atan(m/n);
	}
	return(0.5 * pi);
}

Measured memory_bytes: 256
//! ----------------------------------------------
//! Framework <https://github.com/vain0x/procon>
//!
//! See the bottom of file for solution.
//! ----------------------------------------------

#![allow(unused_imports)]
#![allow(non_snake_case)]

use std::cell::RefCell;
use std::cmp::{max, min, Ordering};
use std::collections::*;
use std::fmt::{Debug, Display, Formatter, Write as FmtWrite};
use std::io::{stderr, stdin, BufRead, Write};
use std::mem::{replace, swap};
use std::ops::*;
use std::rc::Rc;

/// Print values to standard error if debug mode.
#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), stderr());
            writeln!(err, "\x1B[33m{}\x1B[0m = {:?}", e, $e).unwrap()
        })*
    };
}

/// Read from standard input and parse each word.
/// - `read!(T, U, ..)` parses a line as a tuple of words.
/// - `read![[T]]` parses a line as an array of words.
/// - `read![..; N]` parses `N` lines, using `read!(..)` repeatedly.
#[allow(unused_macros)]
macro_rules! read {
    ([$t:ty] ; $n:expr) =>
        ((0..$n).map(|_| read!([$t])).collect::<Vec<_>>());
    ($($t:ty),+ ; $n:expr) =>
        ((0..$n).map(|_| read!($($t),+)).collect::<Vec<_>>());
    ([$t:ty]) =>
        (rl().split_whitespace().map(|w| w.parse().unwrap()).collect::<Vec<$t>>());
    ($($t:ty),*) => {{
        let buf = rl();
        let mut w = buf.split_whitespace();
        ($(w.next().unwrap().parse::<$t>().unwrap()),*)
    }};
}

/// Read a line from standard input.
#[allow(dead_code)]
fn rl() -> String {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();

    #[allow(deprecated)]
    buf.trim_right().to_owned()
}

// -----------------------------------------------
// Solution
// -----------------------------------------------

pub fn gcd(x: i64, y: i64) -> i64 {
    if y == 0 {
        x.abs()
    } else {
        gcd(y, x % y)
    }
}

fn main() {
    let (A, B) = read!(i64, i64);

    println!("{}", A / gcd(A, B) * B)
}


Measured memory_bytes: 4352
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<string>
using namespace std;
int main(){

	int n;
	cin >> n;
	int a,b;
	cin >> a >> b;
	int c;
	cin >> c;
	int top[110] = {0};
	for(int i = 0; i < n; i++) cin >> top[i];
	sort(top,top+n);
	reverse(top,top+n);
    //for(int i = 0; i < n; i++) cout << top[i] << endl;
    int mx = 0;
    mx = c/a;
    for(int i = 0; i < n; i++){
        c += top[i];
        if(mx < c/(a+(b*(i+1)))) mx = c/(a+(b*(i+1)));
    }
    cout << mx << endl;

	return 0;
}

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

typedef long long ll;
ll INF = 1LL << 60;

int 
main() 
{

  string s, t; cin >> s >> t;

  for(int i = s.size() - 1; t.size() - 1 <= i ; i--){
    int count = 0;
    int tmpindex = t.size() - 1;
    for(int k =  i; 0 <= tmpindex; k--){
     if(s[k] == t[tmpindex] || '?' == s[k]) count++;
     tmpindex--;
    }
    if(count == t.size()){
      int tmpindex2 = t.size() - 1;
      for(int l = i; 0 <= tmpindex2; l--){
        s[l] = t[tmpindex2];
        tmpindex2--;
      }
      rep(i, 0, s.size()){
        if(s[i] == '?') s[i] = 'a';
      }
      cout << s << endl;
      return 0;
    }
  }

  cout << "UNRESTORABLE" << endl;

  return 0;
}




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

int main() {
  string n;
  cin >> n;
  if (n[0] == '7' || n[1] == '7' || n[2] == '7') {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 3628
// Can U hack it?

#include<bits/stdc++.h>

#define F first
#define S second
#define PB push_back
#define sz(s) int((s).size())
#define bit(n,k) (((n)>>(k))&1)

using namespace std;

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

const int maxn=610,mod=1e9+7;

int p[maxn],f[maxn],dp[maxn+3][maxn+3],ans,n,k;

void calc(int a,int b){
    int cnt1=0,cnt2=0,cnt3=0;
    for(int i=a;i<=b;i++)
	b=max(b,p[i]);
    for(int i=1;i<a;i++)
	if(a<p[i] && p[i]<b)
	    return;
    int pos=b+1;
    while(pos<=2*n){
	if(p[pos]!=0 && p[pos]<a)
	    break;
	pos++;
    }
    for(int i=pos-1;i>b;i--){
	if(p[i]!=0 && p[i]>pos)
	    pos=i;
    }
    for(int i=1;i<a;i++)
	cnt1+=p[i]==0;
    for(int i=a;i<b;i++)
	cnt2+=p[i]==0;
    for(int i=b+1;i<pos;i++)
	cnt3+=p[i]==0;
    for(int i=pos;i<=2*n;i++)
	cnt1+=p[i]==0;
    //    cout<<a<<" "<<b<<" "<<cnt1<<" "<<cnt2<<" "<<cnt3<<"   "<<"Before "<<ans<<" ";
    for(int i=0;i<=cnt3;i++)
	ans=(1ll*ans+1ll*dp[cnt2][i]*f[cnt1+cnt3-i])%mod;
    //    cout<<"After "<<ans<<"   delta : "<<((ans-bf+mod)%mod)<<" "<<endl;
}

int DP[maxn][maxn];

int main(){
    f[0]=1;
    for(int i=2;i<maxn;i+=2)
	f[i]=1ll*f[i-2]*(i-1) %mod;
    dp[0][0]=1;
    for(int sm=1;sm<maxn;sm++){
	for(int i=1;i<=sm;i++){
	    int j=sm-i;
	    if(i>=2)
		dp[i][j]=1ll*(i-1)*dp[i-2][j]%mod;
	    for(int k=1;k<=j;k++)
		dp[i][j]=(dp[i][j]+dp[i-1+k-1][j-k])%mod;
	}
    }
    cin>>n>>k;
    for(int i=0;i<k;i++){
	int a,b;cin>>a>>b;
	p[a]=b;
	p[b]=a;
    }
    for(int i=1;i<=2*n;i++){
	if(p[i]==0){
	    for(int j=i+1;j<=2*n;j++)
		if(p[j]==0)
		    p[i]=j,p[j]=i,calc(i,j),p[i]=0,p[j]=0;
	}
	else if(p[i]>i){
	    calc(i,p[i]);
	}
    }
    //    cout<<ans<<endl;

    // another solver
    int ANS=0;
    for(int ln=1;ln<2*n;ln++){
	for(int l=1;l+ln<=2*n;l++){
	    int r=l+ln;
	    int cnt1=0,cnt2=0;
	    bool is=0;
	    for(int w=l;w<=r;w++)
		cnt1+=p[w]==0,is|=(p[w]<l&&p[w]!=0) || p[w]>r;
	    if(is)
		continue;
	    DP[l][r]=f[cnt1];
	    for(int w=r-1;w>=l;w--)
		cnt2+=p[w+1]==0,DP[l][r]=(1ll*DP[l][r]-1ll*f[cnt2]*DP[l][w])%mod;
	    ANS=(1ll*ANS+1ll*f[2*(n-k)-cnt1]*DP[l][r])%mod;
	}
    }
    if(ANS<0) ANS+=mod;
    cout<<ANS<<endl;
    return 0;
}

/*
20 10 
10 18
11 17
14 7
4 6
30 28
19 24
29 22
25 32
38 34
36 39
*/


Measured memory_bytes: 3200
class Dice:
    def __init__(self):
        self.number = [i for i in range(6)]
        self.tmp = [i for i in range(6)]
        self.set_cmd = 'NNNNWNNNWNNNENNNENNNWNNN'


    def setNumber(self,n0,n1,n2,n3,n4,n5):
        self.number[0] = n0
        self.number[1] = n1
        self.number[2] = n2
        self.number[3] = n3
        self.number[4] = n4
        self.number[5] = n5

    def next(self,direction):
        for i in range(6):
            self.tmp[i] = self.number[i]

        if direction == 'E':
            self.setNumber(self.tmp[3], self.tmp[1], self.tmp[0], self.tmp[5], self.tmp[4], self.tmp[2])
        elif direction == 'N':
            self.setNumber(self.tmp[1], self.tmp[5], self.tmp[2], self.tmp[3], self.tmp[0], self.tmp[4])
        elif direction == 'S':
            self.setNumber(self.tmp[4], self.tmp[0], self.tmp[2], self.tmp[3], self.tmp[5], self.tmp[1])
        elif direction == 'W':
            self.setNumber(self.tmp[2], self.tmp[1], self.tmp[5], self.tmp[0], self.tmp[4], self.tmp[3])
    def get_result(self):
        return self.number[0]

    def cheak(self,altanative):

        flag = True

        for i in range(len(self.set_cmd)):
            self.next(self.set_cmd[i])
            flag = True
            for j in range(6):
                if self.number[j] != altanative.number[j]:
                    flag = False
                    break
            else:
                if flag == True:
                    return flag

        return flag

dice1 = Dice()
Dice_arr = []
n = int(input())

for i in range(n):
    dice = Dice()
    fig1 = list(map(int,input().split()))
    dice.setNumber(fig1[0],fig1[1],fig1[2],fig1[3],fig1[4],fig1[5])
    Dice_arr.append(dice)

judge = False

for i in range(n-1):
    for j in range(i+1,n):
        if Dice_arr[i].cheak(Dice_arr[j]) == True:
            judge = True
            break

if judge:
    print("No")
else:
    print("Yes")






















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

struct edge {
    int from, to;
};

struct graph {
    int n;
    vector<vector<edge>> ev;
    graph(int _n) {
        n = _n;
        ev.assign(n+1, vector<edge>());
    }
    void push_edge(int i, int j) {
        ev[i].push_back({i, j});
    }
};

void tp_dfs(int v, graph &g, vector<bool> &visited, deque<int> &tps) {
    visited[v] = true;
    for (int i = 0; i < g.ev[v].size(); i++) {
        int nextv = g.ev[v][i].to;
        if (visited[nextv]) continue;
        tp_dfs(nextv, g, visited, tps);
    }
    tps.push_front(v);
}

deque<int> TopologicalSort(graph &g) {
    deque<int> tps;
    vector<bool> visited(g.n+1, false);
    for (int i = 1; i <= g.n; i++) {
        if (!visited[i]) {
            tp_dfs(i, g, visited, tps);
        }
    }
    return tps;
}

int main() {
    int n, m; cin >> n >> m;
    graph g(n);
    for (int i = 0; i < m+n-1; i++) {
        int p, q; cin >> p >> q;
        g.push_edge(p, q);
    }
    deque<int> tps = TopologicalSort(g);
    vector<int> parent(n+1, 0);
    for (int i = 0; i < n; i++) {
        int v = tps[i];
        for (int j = 0; j < g.ev[v].size(); j++) {
            int vv = g.ev[v][j].to;
            parent[vv] = v;
        }
    }
    for (int i = 1; i <= n; i++) {
        cout << parent[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 12416
#!/usr/bin/env python3
import sys
INF = float("inf")


def solve(A: int, B: int):
    print((A+B) % 24)
    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    solve(A, B)


if __name__ == '__main__':
    main()


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

int main()
{
    int n;
    cin >> n;
    int arr[n][3];
    for (int i = 0; i != n; ++i) scanf("%d %d %d", &arr[i][0], &arr[i][1], &arr[i][2]);
    int dp[n][3];
    for (int i = 0; i != 3; ++i) dp[0][i] = arr[0][i];
    for (int i = 1; i != n; ++i)
        for (int j = 0; j != 3; ++j)
        {
            dp[i][j] = 0;
            for (int k = 0; k != 3; ++k)
                if (j != k)
                    dp[i][j] = max(dp[i][j], arr[i][j] + dp[i - 1][k]);
        }
    cout << max({dp[n - 1][0], dp[n - 1][1], dp[n - 1][2]});
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = s; i < (int)(n); i++)
#define Clear(a) a = decltype(a)()
#define all(a) a.begin(),a.end()
#define vec vector
typedef long long ll;
typedef pair<ll,ll> P;
//const ll big=998244353;
const ll big=1000000007LL;
const ll INF=1000000000000000000LL;//1e18
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
ll max(ll x,ll y){
if(x>y)return x;
else return y;
}
ll min(ll x,ll y){
if(x<y)return x;
else return y;
}
ll expm(ll x,ll y){
    if(y==0)return 1;//0^0=1
    if(x==1||x==0)return x;
    if(y%2==1)return (expm(x,y-1)*x)%big;
    ll t=expm(x,y/2);
    return (t*t)%big;
}
ll exp(ll x,ll y){
    if(y==0)return 1;//0^0=1
    if(x==1||y==0)return x;
    if(y%2==1)return exp(x,y-1)*x;
    ll t=exp(x,y/2);
    return t*t;
}
ll inv(ll x){
    return expm(x,big-2);
}


int main(){
    ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    cout << fixed << setprecision(10);
    /*--------------------------------*/

    int q;cin >> q;
    vec<bool> prime(200000,true);
    prime[0]=false;prime[1]=false;
    rep(i,150000){
        if(!prime[i])continue;
        for(int j=i*2;j<=150000;j+=i)prime[j]=false;
    }
    vector<int> near(200000);
    rep2(i,1,150000){
        if(prime[i]&&prime[(i+1)/2])near[i]=near[i-1]+1;
        else near[i]=near[i-1];
    }
    vec<P> r(q);
    rep(i,q){
        cin >> r[i].first >> r[i].second;
    }
    rep(i,q){
        cout << near[r[i].second]-near[r[i].first-1] << endl;
    }
}

Measured memory_bytes: 5576
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds;
using namespace std;
typedef tree<pair<int,int>,null_type,less<pair<int,int>>,rb_tree_tag,tree_order_statistics_node_update> oset;
#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 {
#ifdef 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__) << "] "
using ll = long long;

int dp[110000];
void test_case() {
	int n;cin >> n;
	vector<int> hash(n);
	for(int i = 0;i<n;++i) cin >> hash[i];
	dp[0] = 0;
	dp[1] = abs(hash[1]-hash[0]);
	for(int i = 2; i<n;i++)
	{
		dp[i] = min((dp[i-1]+abs(hash[i]-hash[i-1])),(dp[i-2]+abs(hash[i]-hash[i-2])));
	}
	cout << dp[n-1] << '\n';
}
 
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int T=1;
	//cin >> T;
	while(T--) {
		test_case(); 
		
	}
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
const int MOD=(int)1e9+7;
const int INF=(int)1e9;
const ll LINF=(ll)1e18;

struct Combination{
    vector<ll> fac,finv,inv;
    Combination(int mx){init(mx);}
    void init(int mx){
        fac.resize(mx+1);
        finv.resize(mx+1);
        inv.resize(mx+1);
        fac[0]=fac[1]=1;
        finv[0]=finv[1]=1;
        inv[1]=1;
        for(int i=2;i<=mx;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;
        }
    }
    ll calc(int n,int k){
        return fac[n]*(finv[k]*finv[n-k]%MOD)%MOD;
    }
};

int main(){
    ll n;
    cin>>n;
    Combination comb(n);
    ll x[n];
    for(int i=0;i<n;i++){
        cin>>x[i];
    }
    ll t=0;
    ll ans=0;
    for(ll i=1;i<=n-1;i++){
        t=(t*i+comb.fac[i-1])%MOD;
        ll d=x[i]-x[i-1];
        ll tmp=(comb.calc(n-1,i)*comb.fac[n-1-i])%MOD;
        tmp=(tmp*t)%MOD;
        tmp=(tmp*d)%MOD;
        ans=(ans+tmp)%MOD;
    }
    cout<<ans<<endl;
}

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

int main(){
    while(1){
        string s;
        cin >> s;
        if(s=="#") break;

        int y,m,d;
        cin >> y >> m >> d;
        if(y<31 || (y==31 && m<5)){
            cout << s << " " << y << " " << m << " " << d << endl;
        }else{
            cout << "? " << y-30 << " " << m << " " << d << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 3132
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
//#include<boost/multiprecision/cpp_int.hpp>
//#include<boost/multiprecision/cpp_dec_float.hpp>
//namespace mp=boost::multiprecision;
//#define mulint mp::cpp_int
//#define mulfloat mp::cpp_dec_float_100
using namespace std;
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
//constexpr int MOD=1000000007;
constexpr int MOD=998244353;
#define INF (1<<30)
#define LINF (lint)(1LL<<56)
#define endl "\n"
#define rep(i,n) for(lint (i)=0;(i)<(n);(i)++)
#define reprev(i,n) for(lint (i)=(n-1);(i)>=0;(i)--)
#define Flag(x) (1<<(x))
#define Flagcount(x) __builtin_popcountll(x)
#define pint pair<int,int>
#define pdouble pair<double,double>
#define plint pair<lint,lint>
#define fi first
#define se second
typedef long long lint;
int dx[8]={1,1,0,-1,-1,-1,0,1};
int dy[8]={0,1,1,1,0,-1,-1,-1};
const int MAX_N=2e5+5;
//struct edge{lint to,num;};
//vector<int> bucket[MAX_N/1000];

vector<int> edge[600];

int main(void){
    int N,M;
    cin >> N >> M;
    rep(i,M){
        int u,v;
        cin >> u >> v;
        u--,v--;
        edge[u].push_back(v);
    }
    double ans=1e9;
    rep(i,N){
        double dp[N]={};
        reprev(j,N){
            vector<int> es=edge[j];
            int cnt=es.size();
            vector<double> to;
            rep(k,es.size()) to.push_back(dp[es[k]]);
            if(i==j){
                double maxi=0,ers=0;
                rep(k,to.size()) if(maxi<to[k]) maxi=to[k],ers=k;
                if(cnt>1) to.erase(to.begin()+ers);
            }
            rep(k,to.size()) dp[j]+=(to[k]+1)/to.size();
        }
        ans=min(ans,dp[0]);
    }
    cout << ans << endl;
}

Measured memory_bytes: 4876
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
int main()
{
	string S,T;
	cin >> S >> T;

	int Sl = S.size();
	int Tl = T.size();
	int judge = 0;

	if(Tl == Sl+1){
		rep(i,Sl){
			if(S[i] != T[i]){
				judge++;
				break;
			}
		}
	}

	if(judge==0)
		cout << "\nYes";
	else
		cout << "\nNo";

	cin >> judge;
	
	return 0;	
}

Measured memory_bytes: 3572
#include <bits/stdc++.h>
using namespace std;
/*
int main(){
	double N; cin >> N;
	double x = N / 111.0;
	int ans = ceil(x) * 111;

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

// 数え上げる
int main(){
	int N; cin >> N;

	for (int i=N; i<1000; ++i){
		if (i % 111 == 0){
			cout << i << endl;
			break;
		}
	}
}




Measured memory_bytes: 256
a, b, c, d = map(int, input().split())
count_a = 0
count_b = 0
if c % b == 0:
    count_a = c//b
else:
    count_a = c//b + 1

if a % d == 0:
    count_b = a//d
else:
    count_b = a//d + 1

if count_a <= count_b:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 61852
from collections import Counter

N = int(input())
D = list(map(int, input().split()))

c = Counter(D)
ans = 0
if D[0] == 0 and c[0] == 1:
    ans = 1
    M = max(D)
    for i in range(1, M + 1):
        if c[i] == 0:
            ans = 0
            break
        ans *= c[i - 1] ** c[i]
        ans %= 998244353
print(ans)


Measured memory_bytes: 19928
using System;
 
class Program {
    private static int Main() {
        var input = Console.ReadLine();
         
        double r = double.Parse( input );
 
        var area = r * r * Math.PI;
        var length = 2 * r * Math.PI;
 
        var output = string.Format( "{0} {1}", area, length );
        Console.WriteLine( output );
 
        return 0;
    }
}

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

typedef long long int ll;
typedef unsigned long long int ull;
#define rep(i,n) for(auto i=0;i<(n);i++)
#define rep1(i,n) for(auto i=1;i<=(n);i++)
#define all(x) (x).begin(),(x).end()

using namespace std;


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


int main(){
  string s;
  cin >> s;
  ll mod = 1e9 + 7;



  ll minn = 0;
  ll n = s.size();
  vector<ll> m(n, 0);
  ll e = 1;
  m[0] = 1;
  rep1(i, n-1){
    e *= 10;
    e %= 13;
    m[i] = e;
  }

  rep(i, n){
    if(s[i] != '?') minn += (s[i]-'0') * m[n-i-1];
    minn %= 13;
  }

  vector<vector<ll>> dp(n+1, vector<ll>(13, 0));
  dp[0][minn] = 1;

  rep1(i, n){
    if(s[i-1] != '?'){
      rep(j, 13) dp[i][j] = dp[i-1][j];
      continue;
    }

    rep(j, 10){
      ll add = (j * m[n-i]) % 13;
      rep(t, 13){
        ll g = (add + t) % 13;
        dp[i][g] += dp[i-1][t];
        dp[i][g] %= mod;
      }
    }
  }


  cout << dp[n][5] << endl;


  return 0;
}



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

#define ALL(v) v.begin(), v.end()
#define V vector
#define P pair
#define ld long double
#define ll long long
#define mod 1000000007
#define IINF INT_MAX
#define INF 1LL << 30


int main() {
    char c; cin >> c;
    char ans = c + 1;
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0,i##_max=(N);i<i##_max;++i)
#define repp(i,l,r) for(int i=(l),i##_max=(r);i<i##_max;++i)
#define per(i,N) for(int i=(N)-1;i>=0;--i)
#define perr(i,l,r) for(int i=r-1,i##_min(l);i>=i##_min;--i)
#define all(arr) (arr).begin(), (arr).end()
#define SP << " " <<
#define SPF << " "
#define SPEEDUP cin.tie(0);ios::sync_with_stdio(false);
#define MAX_I INT_MAX //1e9
#define MIN_I INT_MIN //-1e9
#define MAX_UI UINT_MAX //1e9
#define MAX_LL LLONG_MAX //1e18
#define MIN_LL LLONG_MIN //-1e18
#define MAX_ULL ULLONG_MAX //1e19
  typedef long long ll;
  typedef pair<int,int> PII;
  typedef pair<char,char> PCC;
  typedef pair<ll,ll> PLL;
  typedef pair<char,int> PCI;
  typedef pair<int,char> PIC;
  typedef pair<ll,int> PLI;
  typedef pair<int,ll> PIL; 
  typedef pair<ll,char> PLC; 
  typedef pair<char,ll> PCL; 

inline void YesNo(bool b){ cout << (b?"Yes" : "No") << endl;}
inline void YESNO(bool b){ cout << (b?"YES" : "NO") << endl;}
inline void Yay(bool b){ cout << (b?"Yay!" : ":(") << endl;}

int main(void){
  SPEEDUP
  cout << setprecision(15);
  int X,Y;cin >> X >> Y;
  int ans = 0;
  if(X==1 && Y==1) ans += 400000;
  map<int,int> mp;
  mp[1] = 300000;
  mp[2] = 200000;
  mp[3] = 100000;
  ans += mp[X];
  ans += mp[Y];
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
import sys


N, M = [int(x) for x in input().split()]
A = [input() for _ in range(N)]
B = [input() for _ in range(M)]

for i in range(N - M + 1):
    for j in range(N - M + 1):
        found = True
        for _i in range(M):
            for _j in range(M):
                if A[i + _i][j + _j] != B[_i][_j]:
                    found = False
                    break
            if not found:
                break
        if found:
            print('Yes')
            sys.exit()
print('No')


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

using namespace std;

const long long INF = LONG_LONG_MAX;
const int maxsum = (int) (1e5 + 1);
const long long mod = (long long) (1e9 + 7);


int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    string s, t;
    int n, m;
    cin >> n >> m;
    vector<vector<long long> > dp(n);
    vector<string> a(n);
    for (int i = 0; i < n; ++i) {
        dp[i].resize(m);
    }
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }
    dp[0][0] = 1;
    for (int i = 1; i < m; ++i) {
        if (a[0][i - 1] == '.') dp[0][i] = dp[0][i - 1];
    }
    for (int j = 1; j < n; ++j) {
        if (a[j - 1][0] == '.') dp[j][0] = dp[j - 1][0];
    }
    for (int i = 1; i < n; ++i) {
        for (int j = 1; j < m; ++j) {
            if (a[i][j - 1] == '.') dp[i][j] += dp[i][j - 1];
            if (a[i - 1][j] == '.') dp[i][j] += dp[i - 1][j];
            dp[i][j]%=mod;
        }
    }
    cout << dp[n-1][m-1] << "\n";
    return 0;
}

Measured memory_bytes: 9216
#include<bits/stdc++.h>
using namespace std;
bool cmp(int a,int b)
{
	return a>b;
}
int  main() 
{
	int n,k,x;
	cin>>n>>k;
	int a[200000+5]={0};
	
	for(int i=0;i<n;i++)
	{
		cin>>x;
		a[x]++;
	}
	sort(a+1,a+200000+1,cmp);
	int count=0;
	for(int i=k+1;i<=200000;i++)
	count+=a[i];
	cout<<count<<endl;
	return 0;
}


Measured memory_bytes: 1024
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include <math.h>
#include <time.h>

typedef int32_t i32;
typedef int64_t i64;
typedef double f64;

void *const null=(void *)0;
i64 const llinf=4611686018427387903LL;
i64 const mod=1000000009LL;
f64 const pi=3.141592653589793;
f64 const rad=57.295779513082323;

#define CODE_

i32 main(void){
    char *s=(char *)calloc(26LL,sizeof(char));
    for(i64 i=0LL;i<3LL;++i) s[i]=(char)i+'X';
    for(i64 i=3LL;i<26LL;++i) s[i]=(char)(i-3LL)+'A';
    char c;
    while(1){
        scanf("%c",&c);
        if(c=='\n') break;
        printf("%c",s[(i64)(c-'A')]);
    }
    printf("\n");
    return 0;
}



Measured memory_bytes: 2104
package main

import (
  "fmt"
)

func main() {
  var k, a, b int
  var yen int = 0
  var biscuit uint64 = 1
  fmt.Scan(&k)
  fmt.Scan(&a)
  fmt.Scan(&b)
  var isNoSell = a - 1 >= b
  for i := 0; i < k; i++ {
    if (isNoSell) {
      biscuit++
    } else {
      if yen > 0 {
        yen -= 1
        biscuit += uint64(b)
      } else if biscuit >= uint64(a) && i < k - 1 && b - a > 2 {
        biscuit -= uint64(a)
        yen += 1
      } else {
        biscuit++
      }
    }
  }
  fmt.Println(biscuit)
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define P pair<ll,ll>
#define FOR(I,A,B) for(ll I = ll(A); I < ll(B); ++I)
#define FORR(I,A,B) for(ll I = ll((B)-1); I >= ll(A); --I)
#define TO(x,t,f) ((x)?(t):(f))
#define SORT(x) (sort(x.begin(),x.end())) // 0 2 2 3 4 5 8 9
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin()) //xi>=v  x is sorted
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin()) //xi>v  x is sorted
#define NUM(x,v) (POSU(x,v)-POSL(x,v))  //x is sorted
#define REV(x) (reverse(x.begin(),x.end())) //reverse
ll gcd(ll a,ll b){if(a%b==0)return b;return gcd(b,a%b);}
ll lcm(ll a,ll b){ll c=gcd(a,b);return ((a/c)*(b/c)*c);}
#define NEXTP(x) next_permutation(x.begin(),x.end())
const ll INF=ll(1e18)+ll(7);
const ll MOD=1000000007LL;
#define out(a) cout<<fixed<<setprecision((a))





int main(){
	
	ll N;
	cin >> N;
	vector<ll> be(N),no(N),ne(N);
	FOR(i,0,N){
		cin >> no[i];
		ne[i] = no[i];
		be[i] = N-no[i];
	}

	if(NEXTP(be)){
		cout << N-be[0];
		FOR(i,1,N)cout << ' ' << N-be[i];
		cout << "\n";
	}
	cout << no[0];
	FOR(i,1,N)cout << " " << no[i];
	cout<<"\n";

	if(NEXTP(ne)){
		cout << ne[0];
		FOR(i,1,N)cout << " "<< ne[i] ;
		cout<<"\n";
	}
}



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

using namespace std;

#define FOR(i,n) for(int i=0; i<n; ++i)
#define FORR(i,a,n) for(int i=a; i<n; ++i)
#define ALL(c) (c).begin(), (c).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))

const int INF = 0x3f3f3f3f;

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<string> VS;
typedef pair<int,int> PI;
typedef pair<ll,ll> PL;
 
//int in() { int x; scanf("%d", &x); return x; }
//ll lin() { ll x; scanf("%lld", &x); return x; }
//void printfv(VI a){ int n = a.size(); FOR(i, n) cout << a[i] << " "; }

const ll MAX = 1e18;

int main(void){
    std::ios_base::sync_with_stdio(false);

    int n;
    cin >> n;

    ll ans = 1;
    bool ng = false;
    FOR(i, n){
    	ll tmp;
    	cin >> tmp;

    	if(tmp == 0){
    		cout << 0 << endl;
    		return 0;
    	}

    	if(ng || MAX/ans < tmp){
    		ng = true;
    	}

    	ans *= tmp;    	
    }

    if(ng) 
    	cout << -1 << endl;
	else
    	cout << ans;

    return 0;
}

Measured memory_bytes: 3632
import std.conv;
import std.array;
import std.string;
import std.algorithm;
import std.stdio;


void main() {
	ulong r = 1;
	enum ulong RMax = 1000000000000000000UL;
	enum ulong EMax = 100000UL;

	readln;
	auto a = readln.chomp.split(' ').map!(to!ulong).array;

	foreach (e;a) {
		if (e == 0) {
			writeln("0");
			return;
		}
	}

	foreach (e;a) {
		if ((r / EMax) * e > (RMax / EMax)) {
			writeln("-1");
			return;
		}
		r *= e;
	}

	if (r > RMax) {
		writeln("-1");
	} else {
		writeln(r);
	}
}


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

#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <algorithm>

#include <bits/stdc++.h>
#include <cmath>
#include <limits>

using namespace std;
typedef long long LL;

int main(int argc, char* argv[]){
	cin.tie(0);
	ios::sync_with_stdio(false);

	string S;
	cin >> S;

	int ans = 700;
	for(int i=0; i<S.size(); i++){
		if(S[i] == 'o'){
			ans += 100;
		}
	}
	printf("%d\n", ans);
	return 0;
}



Measured memory_bytes: 3588