akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<iomanip>
#include<set>

using namespace std;

int main()
{
		int n;
		cin >> n;
		vector<string> u(n);
		for(int i=0;i<n;i++)
			cin >> u[i];
		int m;
		cin >> m;
		bool open=false;
		for(int i=0;i<m;i++)
		{
			string t;
			cin >> t;
			bool flag=false;
			for(int j=0;j<u.size();j++)
			{
				if(t==u[j])
					flag=true;
			}
			if(flag)
			{
				if(open)
					cout << "Closed by " << t << endl;
				else
					cout << "Opened by " << t << endl;
				open=(!open);
			}
			else
			{
				cout << "Unknown " << t << endl;
			}

		}





}


Measured memory_bytes: 3236
#include <bits/stdc++.h>
using namespace std;
const int maxn = 3005;
const int mod = 998244353;
long long mem[2][maxn][maxn];
int C, D;

long long dp(int state, int A, int B) {
  if(A > C || B > D) return 0;
  if(B == D) {
    long long res = 1;
    for(int i = 1; i <= C - A; i++) res = (res * B) % mod;
    return res * (1 - state);
  }
  long long &ans = mem[state][A][B];
  if(ans != -1) return ans;
  ans = 0;
  if(state == 0) {
    ans += dp(0, A, B + 1) * A;
    ans += dp(1, A + 1, B) * B;
    ans %= mod;
  } else {
    ans += dp(1, A + 1, B) * B;
    ans += dp(0, A, B + 1);
    ans %= mod;
  }
  return ans;
}
int main() {
  int A, B;
  cin >> A >> B >> C >> D;
  memset(mem, -1, sizeof mem);
  cout << dp(0, A, B) << endl;
  return 0;
}


Measured memory_bytes: 145140
use std::io;
use std::cmp;
use std::collections::BinaryHeap;
use std::collections::HashMap;
use std::collections::HashSet;
use std::f64::consts::PI;

fn read_line() -> String {
    let mut buf = String::new();
    io::stdin().read_line(&mut buf).ok();
    buf
}


fn main() {
    let line: Vec<usize> = read_line().split_whitespace().map(|s| s.parse().unwrap()).collect();
    let n = line[0];
    let m = line[1];
    let mut memo = vec![0; n];
    let mut acs = vec![false; n];

    for i in 0..m {
        let line = read_line();
        let line: Vec<&str> = line.split_whitespace().collect();
        let x = line[0].parse::<usize>().unwrap() - 1;
        match line[1] {
            "AC" => {
                acs[x] = true;
            },
            _ => {
                if !acs[x] {
                    memo[x] += 1;
                }
            }
        }
    }
    let mut ans1 = 0;
    let mut ans2 = 0;
    for i in 0..n {
        if acs[i] {
            ans1 += 1;
            ans2 += memo[i];
        }
    }
    println!("{} {}", ans1, ans2);
}


Measured memory_bytes: 4352
from operator import mul
from functools import reduce
N, *A = map(int, open(0).read().split())

while len(A) > 1:
  n = len(A)
  if n & 1:
    A.append(1)
    n += 1
  L, R = A[:n//2], A[n//2:]
  A = [x * y for x, y in zip(L, R)]
x = A[0]
if x > 10 ** 18:
  x = -1
print(x)

Measured memory_bytes: 22044
#include <bits/stdc++.h>
#define rep(begin, end) for (i=begin;i<end;i++)
#define repj(begin, end) for (j=begin;j<end;j++)
#define init(arr, end, val) for (i=0;i<end;i++) arr[i] = val;
#define printint(i0, i1) printf("%d %d\n", i0, i1)

using namespace std;
typedef long long int ll;
const int inf = 1000000000;
const int mod = 1000000007;
const int nil = -1;
int i, n, m, k, a, b;
bool checked[100001];
queue<int> q;
set<pair<int,int>> s;

int main() {
    scanf(" %d %d", &n, &m);
    rep(1,n+1) checked[i] = false;
    rep(0,m) {
        scanf(" %d %d", &a, &b);
        s.insert(make_pair(a,b));
        s.insert(make_pair(b,a));
    }
    int cnt = 0;
    rep(1, n+1) {
        if (!checked[i]) {
            cnt++;
            q.push(i);
            while (q.size() != 0) {
                int cur = q.front(); q.pop();
                checked[cur] = true;
                for (auto it = s.lower_bound(make_pair(cur, -1)); it != s.lower_bound(make_pair(cur+1, -1)); it++) {
                    if (!checked[it->second]) q.push(it->second);
                }
            } 
        }
    }
    printf("%d\n", cnt-1);
}

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

int main() {
  int N, K;
  cin >> N >> K;
  vector<long long> h(N);
  long long m = 0;
  for(int i = 0; i < N; i++) {
    cin >> h.at(i);
  }
  sort(h.begin(), h.end());
  for(int i = 0; i < N - K + 1; i++) {
    if(i == 0) {
      m = h.at(i+K-1) - h.at(i);
    }
    else {
      m = min(m,h.at(i+K-1) - h.at(i));
    }
  }
  cout << m << endl;
}


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

int n;
int gcd (int x, int y) {
	if (x < y) swap(x, y);
	while (y) {
		int r = x % y;
		x = y, y = r;
	}
	return x;
}

int main () {
	scanf("%d", &n);
	printf("%d\n", 360 / gcd(n, 360));
	return 0;
}

Measured memory_bytes: 3816
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
using namespace std;

#define ll         long long
#define PI         acos(-1.0)
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)

//羊0狼1
//○0×1
//動物とまるばつの情報のXORをみて0なら同じ、1なら違うとなる

int N;
int animal[100000];
int info[100000];

bool dfs(int animal1, int animal2, int n){
    animal[n-1]=animal1;
    animal[n]=animal2;
    if(n==N-1){
        if(((animal2^info[n])?animal1^1:animal1)!=animal[0]) return false;
        if(((animal[0]^info[0])?animal2^1:animal2)!=animal[1]) return false;
        return true;
    }
    return dfs(animal2,(animal2^info[n])?animal1^1:animal1,n+1);
}

int main(){
    cin>>N;
    string s;
    cin>>s;
    FOR(i, 0, N) info[i] = (s[i]=='o'?0:1);
    FOR(i, 0, 2){
        FOR(j, 0, 2){
            if(dfs(i,j,1)){
                FOR(k, 0, N) cout << (animal[k]==0?"S":"W");
                cout << endl;
                return 0;
            }
        }
    }
    cout << -1 << endl;
}

Measured memory_bytes: 1408
N = int(input())

S = str(input())

if N%2!=0:
    
    print("No")
    
else:
    
    new_string1 = S[0:N//2]
    
    new_string2 = S[N//2:N]
    
    if new_string2 == new_string1:
        
        print("Yes")
        
    else:
        print("No")
    
    

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

int main() {
  int k;
  cin >> k;
  string ans = "";
  rep(i,k) ans += "ACL";
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3552
#include <iostream>
#include <algorithm>
#include <math.h>
#include <string>
#include <set>
#include <vector>
using namespace std;
typedef long long ll;



int main()
{
    string s, t;
    cin >> s >> t;
  	int ls, lt;
  	ls = s.size();
  	lt = t.size();
  	for (int i = 0; i < ls-lt+1; i++)
      	if (s.substr(i,lt) == t)
    	cout << i << endl;
    return 0;
}



Measured memory_bytes: 3216
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
using namespace std;
int main(){
  long long int a,b,n,x,q;
  cin>>a>>b>>n;
  (n>=b?x=b-1:x=n);
  
  q=floor((a*x)/b)-a*(floor(x/b));
  cout<<q;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define FILES                    \
	ifstream cin( "input.txt" ); \
	ofstream cout( "input.txt" );
#define FAST                             \
	std::ios_base::sync_with_stdio( 0 ); \
	std::cin.tie( 0 );                   \
	std::cout.tie( 0 );
#define FIXED cout << fixed << setprecision( 20 )
#define pb push_back
#define eps 1e-9
#define mod 1000000007
#define int long long
using graph = std::vector<std::vector<int>>;
using pll = std::pair<int, int>;
using ll = long long;
namespace my {
	int max( int x ) {
		return x;
	}
	template<typename... Args>
	int max( int x, Args... args ) {
		int y = max( args... );
		return ( x < y ) ? y : x;
	}
	int min( int x ) {
		return x;
	}
	template<typename... Args>
	int min( int x, Args... args ) {
		int y = min( args... );
		return ( x < y ) ? x : y;
	}
	int max( std::vector<int>& t ) {
		int mx = -1e18;
		for( int i = 0; i < t.size(); i++ ) {
			mx = std::max( mx, t[i] );
		}
		return mx;
	}
	int min( std::vector<int>& t ) {
		int mn = 1e18;
		for( int i = 0; i < t.size(); i++ ) {
			mn = std::min( mn, t[i] );
		}
		return mn;
	}
}	// namespace my

void z_f( std::vector<int>& z, std::string& s ) {
	int l = 0, r = 0;
	for( int i = 1; i < s.size(); i++ ) {
		if( r >= i ) {
			z[i] = std::min( r - i + 1, z[i - l] );
		}
		int& x = z[i];
		while( i + x < s.size() && ( s[i + x] == s[x] ) ) {
			++x;
		}
		if( i + x - 1 > r ) {
			l = i;
			r = i + x - 1;
		}
	}
}
void solve() {
	int x, k, d;
	std::cin >> x >> k >> d;
	x = std::abs( x );
	if( (x + d - 1) / d >=  k ) {
		std::cout << std::abs(x - d * k) << '\n';
	} else {
		int count = x / d;
		if( ( k - count ) % 2 ) {
			std::cout << std::abs( x - d * ( count + 1 ) ) << '\n';
		} else {
			std::cout << std::abs(x - d * count) << '\n';
		}
	}
}
main() {
	int t = 1;
	FAST;
	// std::cin >> t;
	while( t-- ) {
		solve();
	}
}

Measured memory_bytes: 3648
#include <stdio.h>
int main(){
    char a[200000]={};
    scanf("%s",a);
  for(int i=0;i<200000;i++){
    if(a[i]==0)
      return 0;
   if(a[i]=='?')
    a[i]='D';
   printf("%c",a[i]);
  }
  return 0;
}


Measured memory_bytes: 1804
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
const double PI = acos(-1);
const double EPS = 1e-15;
long long INF=(long long)1E17;
#define i_7 (long long)(1E9+7)
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
using namespace std;
bool prime(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}

long long gcd(long long a, long long b){
  if(a<b){
    swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd(b,a%b);
  }
}
 
long long lcm(long long x, long long y){
  return (x/gcd(x,y))*y;
}
 
class UnionFind {
    public:
    //各頂点の親の番号を格納する。その頂点自身が親だった場合は-(その集合のサイズ)を入れる。
    vector<int> Parent;
    
    //クラスを作るときは、Parentの値を全て-1にする。
    //以下のようにすると全てバラバラの頂点として解釈できる。
    UnionFind(int N) {
        Parent = vector<int>(N, -1);
    }
    
    //Aがどのグループに属しているか調べる
    int root(int A) {
        if (Parent[A] < 0) return A;
        return Parent[A] = root(Parent[A]);
    }
    
    //自分のいるグループの頂点数を調べる
    int size(int A) {
        return -Parent[root(A)];//先祖をrootで取っておきたい。
    }
    
    //AとBをくっ付ける
    bool connect(int A, int B) {
        //AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
        A = root(A);
        B = root(B);
        if (A == B) {
            //すでにくっついてるからくっ付けない
            return false;
        }
        
        //大きい方(A)に小さいほう(B)をくっ付けたい
        //大小が逆だったらAとBをひっくり返す。
        if (size(A) < size(B)) swap(A, B);
        
        //Aのサイズを更新する
        Parent[A] += Parent[B];
        //Bの親をAに変更する
        Parent[B] = A;
        
        return true;
    }
};

int main(){
  int n,l;
  cin>>n>>l;
  int apple[n+1];
  apple[0]=0;
  int s=0;
  REPP(i,n){
    apple[i] = l+i-1;
    s += apple[i];
  }
  int m=1000;
  int ans;
  REPP(i,n){
    if(abs(apple[i])<m){
      m = abs(apple[i]);
      ans = s - apple[i];
    }
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 384
import java.io.InputStream;
import java.io.PrintStream;
import java.util.Scanner;

public class Main {
	InputStream in = System.in;
	PrintStream out = System.out;

	public void _main(String[] args) {
		Scanner sc = new Scanner(in);

		long K = sc.nextLong();
		long A = sc.nextLong();
		long B = sc.nextLong();

		sc.close();

		if (B - A > 2 && K >= (A + 1)) {
			// A枚→B枚の変換をできるだけやる

			long ans = 1;

			//最初にA枚必要
			K -= (A - 1);
			ans += (A - 1);

			// 2手一組なので奇数なら1回たたいて増やす
			if (K % 2 == 1) {
				K--;
				ans++;
			}

			// 2消費することで、(B-A)枚増える
			ans += (K / 2) * (B - A);

			out.println(ans);

		} else {
			// A枚→B枚の変換は不利なのでK回叩いて増やす
			out.println(K + 1);
		}

	}

	public static void main(String[] args) {
		new Main()._main(args);
	}
}


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

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

    for(int i=n; i<=999; i++){
        if( i%10 == (i/10)%10 && i%10 == i/100 ){
            cout << i << endl;
            return 0;
        }
    }

    return 0;
}

Measured memory_bytes: 3584
import java.util.Scanner;
public class Main {
  public static long gcd (long a, long b) {
    if (b%a == 0) {
      return a;
    }
    else return gcd(b%a, a);
  }
  public static void main (String [] args) {
    Scanner s = new Scanner (System.in);
    while (s.hasNextLong()) {
      long a = s.nextLong();
      long b = s.nextLong();
      long c = a * b;
      long d = gcd(a, b);
      c = c/d;
        System.out.println(d + " " + c);
    }
  }
}

Measured memory_bytes: 12000
def f():
 global d
 p=[d[0]]
 for i in range(len(d)-1):
  a,b=d[i],d[i+1]
  r=(b-a)/3
  p+=[a+r,a+r+r*(1+3**.5*1j)/2,b-r,b]
 d=p
d=[0j,100+0j]
for _ in[0]*int(input()):f()
for e in d:print(e.real,e.imag)


Measured memory_bytes: 5884
#include <iostream>
#include <vector>
#include <string>
#include <stdio.h>
#include <stdlib.h>

using namespace std;

int main()
{
	int a[32] = { 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51 };
	int i = 0;
	cin >> i;
	cout << a[i - 1] << endl;

	return 0;

}

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

int main()
{
    string s;
    cin>>s;
    int flag=0;
    for(int i=0;i<s.size();i++)
    {
        if(s[i]=='A'&&s[i+1]=='C')
            flag=1;
    }
    if(flag==1)
        printf("Yes\n");
    else printf("No\n");

    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int A[100][100];
int v[100];
void MST(int);
   
main(){
  int n, i, j;
  scanf("%d", &n);
  for(i = 0; i < n; i++){
    for(j = 0; j < n; j++){
      scanf("%d", &A[i][j]);
    }
  }
  MST(n);
  return 0;
}
   
void MST(int n){
  int i, j, k=1, X[100], minCost, min, sum=0;
     
  X[0] = 0;
  v[0] = 1;
  for(i = 1; i < n; i++){
    v[i] = 0;
  }
  while(1){
    minCost = 2001;
    for(i = 0; i < k; i++){
      for(j = 0; j < n; j++){
    if(A[X[i]][j] < minCost && A[X[i]][j] != -1 && v[j] != 1){
      minCost = A[X[i]][j];
      min = j;
    }
      }
    }
    if(k != n){
      X[k] = min;
      v[min] = 1;
      sum += minCost;
      k++;
    }
    else break;
  }
  printf("%d\n", sum);
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
//Optimisations
#pragma GCC target ("avx2")
#pragma GCC optimization ("unroll-loops")
#pragma GCC optimize("O2")
//shortcuts for functions
#define pb push_back
#define mp make_pair
#define ff first 
#define ss second
#define all(v) v.begin(),v.end()
#define prec(n) fixed<<setprecision(n)
#define n_l '\n'
// make it python 
#define gcd __gcd
#define append push_back
#define str to_string
// utility functions shortcuts
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define sswap(a,b) {a=a^b;b=a^b;a=a^b;}
#define swap(a,b) {auto temp=a; a=b; b=temp;}
#define init(dp) memset(dp,-1,sizeof(dp));
#define set0(dp) memset(dp,0,sizeof(dp));
#define bits(x) __builtin_popcount(x)
#define SORT(v) sort(all(v))
#define endl "\n"
#define forr(i,n) for(ll i=0;i<n;i++)
// declaration shortcuts
typedef long long int ll;
#define int ll
// Constants
constexpr int dx[] = {-1, 0, 1, 0, 1, 1, -1, -1};
constexpr int dy[] = {0, -1, 0, 1, 1, -1, 1, -1};
constexpr ll INF = 1999999999999999997; 
constexpr int inf= INT_MAX;
constexpr int MAXSIZE = int(1e6)+5;
constexpr auto PI  = 3.14159265358979323846L;
constexpr auto oo  = numeric_limits<int>::max() / 2 - 2;
constexpr auto eps = 1e-6;
constexpr auto mod = 1000000007;
constexpr auto MOD = 1000000007;
constexpr auto MOD9 = 1000000009;
constexpr auto maxn = 100006;
//void IOfile(){
//freopen(file_name, reade_mode, stdin);
//freopen(file_name, write_mode, stdout);
//}
void fastio(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
}
int32_t main(){
	fastio();
	int r;
	cin>>r;
	setprecision(5);
	r = 2*r;
	double ans = (double)3.1415*(double)r;
	cout<<ans;
}

Measured memory_bytes: 3800
#!/usr/bin/env python3
import sys
from itertools import accumulate
from bisect import bisect_left

def solve(N: int, M: int, A: "List[int]"):
    A.sort()

    right = 2*A[-1]+1
    left = 0

    while right - left > 1:
        mid = (left+right)//2

        # A[i]+A[j] >= midになるようなi,jの組み合わせの個数 mを 求めたい
        # m >= Mならok
        m = 0
        for i in range(N):
            a = A[i]
            res = mid - a
            # Aからres以上のものを探す
            index = bisect_left(A,res)
            m += N-index
        
        if m >= M:
            left = mid
        else:
            right = mid

    # M通り以上の握手ができる最小の組み合わせの幸福度
    B = sorted(A,reverse=True)
    accum_B = list(accumulate(B))
    answer = 0
    handshake_count = 0
    for i in range(N):
        res = left - A[i]
        if res > A[-1]:
            continue
        index = bisect_left(A,res)
        answer += (N-index)*A[i]+accum_B[N-index-1]
        handshake_count += (N-index)

    # 握手の回数がmを越えたときはその分の幸福度を引く
    if handshake_count>M:
        answer -= left*(handshake_count-M)
    print(answer)
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, M, A)

if __name__ == '__main__':
    main()


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

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

	int a[N];
	for (int i = 0; i < N; i++) {
		cin >> a[i];
	}


	int magic = 0;
	int temp_color_of_slime = a[0];
	int temp_number_of_slime = 1;

	for (int i = 0; i < N; i++) {
		if (a[i+1] == temp_color_of_slime) {
			temp_number_of_slime++;
		} else {
			magic += temp_number_of_slime/2;
			temp_color_of_slime = a[i+1];
			temp_number_of_slime = 1;
		}
	}

	cout << magic << endl;
}

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

int main(void){
  int n,m,arr[30],temp,sum = 0;
  for(int i = 0; i < 30; i++)arr[i] = 0;
  cin >> n >> m;
  for(int i = 0; i < n; i++){
    int k;
    cin >> k;
    for(int j = 0; j < k; j++){
      cin >> temp;
      arr[temp - 1]++;
    }
  }

  for(int i = 0; i < m; i++){
    if(arr[i] == n)sum++;
  }
  cout << sum << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>

std::vector<long long> divisors(long long n) {
	std::vector<long long> ret(1, 1);
	long long m = sqrt(n);
	for (long long i = 2; i <= m; i++) {
		if (n % i == 0) ret.push_back(i);
	}
	if (m == sqrt(n)) {
		for (long long i = ret.size() - 2; i >= 0; i--) {
			ret.push_back(n / ret[i]);
		}
	} else {
		for (long long i = ret.size() - 1; i >= 0; i--) {
			ret.push_back(n / ret[i]);
		}
	}
	return ret;
}

std::vector<long long> common_divisors(long long a, long long b) {
    if (a > b) std::swap(a, b);
    std::vector<long long> v = divisors(a);
    std::vector<long long> ret(1, 1);
    for (long long i = 1; i < v.size(); i++) {
        if (b % v[i] == 0) ret.push_back(v[i]);
    }
    return ret;
}

bool is_prime(long long n) {
    if (n == 1) return false;
    if (n == 2) return true;
    if (n % 2 == 0) return false;
    for (long long i = 3; i <= sqrt(n); i += 2) {
        if (n % i == 0) return false;
    }
    return true;
}

int main() {
    long long a, b;
    std::cin >> a >> b;
    std::vector<long long> v = common_divisors(a, b);
    long long ans = 1;
    for (auto i : v) {
        if (is_prime(i)) ans++;
    }
    std::cout << ans << std::endl;
}

Measured memory_bytes: 3724
#include <iostream>
#include <vector>
using namespace std;
typedef long long ll;

ll gcd(ll x,ll y){
    if (x<y) swap(x,y);
    if (y==0) return x;
    else return gcd(y,x%y);
}

int main(){
    ll A,B,C,D,ans;
    cin >> A >> B >> C >> D;
    ans = B - A + 1;
    ll ac,ad,bc,bd;
    ac = (A-1) / C;
    ad = (A-1) / D;
    bc = B / C;
    bd = B / D;
    ll acd,bcd;
    ll lcm = C * D / gcd(C,D);
    acd = (A-1) / lcm;
    bcd = B / lcm;
    ans -= (bc-ac) + (bd-ad) - (bcd-acd);
    cout << ans << endl;
    return 0;
}


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

using namespace std;

constexpr int MAX_V = 110;

int V, cmp[MAX_V];
bool used[MAX_V];
vector<int> G[MAX_V], rG[MAX_V], vs;

void add_edge(int from, int to)
{
    G[from].emplace_back(to);
    rG[to].emplace_back(from);
}

void dfs(int v)
{
    used[v] = 1;
    for (int i = 0; i < (int)G[v].size(); i++) {
        if (!used[G[v][i]]) {
            dfs(G[v][i]);
        }
    }
    vs.emplace_back(v);
}

void rdfs(int v, int k)
{
    used[v] = 1;
    cmp[v] = k;
    for (int i = 0; i < (int)rG[v].size(); i++) {
        if (!used[rG[v][i]]) {            
            rdfs(rG[v][i], k);
        }
    }
}

int scc()
{
    memset(used, 0, sizeof(used));
    vs.clear();
    for (int v = 0; v < V; v++) {
        if (!used[v]) {
            dfs(v);
        }
    }
    memset(used, 0, sizeof(used));
    int k = 0;
    for (int i = vs.size() - 1; i >= 0; i--) {
        if (!used[vs[i]]) {
            rdfs(vs[i], k++);
        }
    }
    return k;
}

vector<int> g[MAX_V];

void init(int N)
{
    V = N;
    for (int i = 0; i < N; i++) {
        G[i].clear();
        rG[i].clear();
        g[i].clear();
    }
}

double solve(int N, const vector<double>& P)
{
    int n = scc();
    vector<double> p(n, 1);
    
    vector<int> out(n), in(n);
    for (int i = 0; i < N; i++) {
        for (const auto& to : G[i]) {
            if (cmp[i] != cmp[to]) {
                out[cmp[i]]++;
            }            
        }

        for (const auto& from : rG[i]) {
            if (cmp[i] != cmp[from]) {
                in[cmp[i]]++;
            }
        }
    }
    
    for (int i = 0; i < N; i++) {
        p[cmp[i]] *= P[i];
    }
    double res = 1;
    for (int i = 0; i < n; i++) {
        if (out[i] >= 0 && in[i] == 0) {
            res *= (1.0 - p[i]);
        }
    }
    return res;
}

int main()
{
    int N, m;
    while (cin >> N, N > 0) {
        init(N);
        vector<double> P(N);        
        for (int i = 0; i < N; i++) {
            cin >> P[i] >> m;
            for (int j = 0; j < m; j++) {
                int a;
                cin >> a; a--;
                add_edge(i, a);
            }
        }       
        printf("%.10f\n", solve(N, P));
    }    
    return 0;
}

Measured memory_bytes: 3396
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import numpy as np


def main():
    N, M = map(int, input().split())

    AC = np.array([0] * N)
    WA = np.array([0] * N)

    for i in range(M):
        p, S = input().split()

        if AC[int(p) - 1] == 0 and S == 'WA':
            WA[int(p) - 1] += 1
        else:
            AC[int(p) - 1] = 1
    print(sum(AC), sum(AC * WA))


if __name__ == "__main__":
    main()


Measured memory_bytes: 16624
#include <bits/stdc++.h>
  
using namespace std;
  
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define pb push_back
#define all(r) r.begin(),r.end()
#define rall(r) r.rbegin(),r.rend()
#define fi first
#define se second
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
const int INF = 1e9;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;

int main(){
	int a, b, c;
	cin >> a >> b >> c;
	cout << (a <= c && c <= b ? "Yes" : "No") << endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;


public class Main {
	public static void main(String[] args){

		Scanner sc = new Scanner(System.in);

		String s = sc.next();
		String ss = sc.next();


        int N = Integer.parseInt(s);
        int R = Integer.parseInt(ss);

        int cont = 0;
        while(N > 0) {
        	N = N / R;
        	cont ++;
        }
        System.out.println(cont);
	}
}

Measured memory_bytes: 22740
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bitset>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<iomanip>
using namespace std;

#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define INF 2e9
#define MOD 1000000007
#define LINF (long long)4e18

using ll = long long;
using Pi = pair<int,int>;
using Pl = pair<ll,ll>;





int main(){
 int N; cin >> N;
 vector<ll> a(N);
 rep(i,N) cin >> a[i];
 map<ll,ll> m;
 rep(i,N){
   m[a[i]]++;
 }
 int cnt = 0;
 ll now = 0;
 int cnt0 = 0;
 bool flag = true;
 for(auto it = m.begin(); it != m.end(); it++){
   if(it -> second != N/3) flag = false;
   now ^= it -> first;
   cnt++;
 }
 bool ok = false;
 if(N % 3 == 0 && now == 0 && cnt == 3 && flag) ok = true;
 rep(i,N){
   if(a[i] == 0) cnt0++;
 }
 if(N % 3 == 0 && cnt0 == N/3 && cnt == 2) ok = true;
 if(cnt0 == N && cnt == 1) ok = true;
 if(ok) cout << "Yes" << endl;
 else cout << "No" << endl;
}


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

#define REP(i, e) for(int (i) = 0; (i) < (e); ++(i))
#define FOR(i, b, e) for(int (i) = (b); (i) < (e); ++(i))
#define ALL(c) (c).begin(), (c).end()
#define ACC(c) (accumulate(ALL(c), 0LL))
#define PRINT(x) cout << (x) << "\n"

using namespace std;
using ll = long long;
using pint = pair<int, int>;
using pll = pair<ll, ll>;

inline int std_in(int& a) {return scanf("%d", &a);}
auto pint_compare = [](pint x, pint y) -> bool{return (x.first < y.first);};
const int MOD = 1000000007;

signed main(){
    ll N, K;
    cin >> N >> K;
    ll ans = (N / K) * (N / K) * (N / K);
    if(K % 2 == 0){
        ans += ((N + K / 2) / K) * ((N + K / 2) / K) * ((N + K / 2) / K);
    }
    PRINT(ans);
    return 0;
}

Measured memory_bytes: 256
//written by libra9z
#include <algorithm>
#include <iostream>
#include <sstream>
#include <iomanip>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <list>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <cstring>
#include <cmath>
#include <cstdlib>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define rep(i,n) for (int i=0;i<(n);i++)
#define repit(it,a) for (__typeof(a.begin()) it=a.begin();it!=a.end();++it)
#define RET(p,x) return p<<x<<endl,0
#define all(a) (a).begin(),(a).end()
#define reunique(v) v.erase(unique(all(v)),v.end())
#define sz(a) (int)a.size()
#define sqr(x) ((x)*(x))
const int inf=1e9;
const ll lnf=1e18;
const int mod=1e9+7;
int h,w;
char s[13][13];
string ss[13];
int a[13];
int b[13];
void dfs1(int x,bool f)
{
	if (x==w)
	{
		puts("YES");
		exit(0);
	}
	else if (b[x]!=-1) dfs1(x+1,f);
	else
	{
		for (int i=x+1;i<w;++i)
		{
			if (b[i]!=-1) continue;
			int j;
			for (j=0;j<h;++j) if (s[j][x]!=s[a[j]][i]) break;
			if (j==h)
			{
				b[x]=i;
				b[i]=x;
				dfs1(x+1,f);
				b[x]=b[i]=-1;
			}
		}
		if (!f)
		{
			int j;
			for (j=0;j<h;++j) if (s[j][x]!=s[a[j]][x]) break;
			if (j==h)
			{
				b[x]=x;
				dfs1(x+1,true);
				b[x]=-1;
			}
		}
	}
}
void dfs2(int x,bool f)
{
	if (x==h) dfs1(0,!(w&1));
	else if (a[x]!=-1) dfs2(x+1,f);
	else
	{
		for (int i=x+1;i<h;++i)
		{
			if (a[i]!=-1) continue;
			if (ss[x]!=ss[i]) continue;
			a[x]=i;
			a[i]=x;
			dfs2(x+1,f);
			a[x]=a[i]=-1;
		}
		if (!f)
		{
			a[x]=x;
			dfs2(x+1,true);
			a[x]=-1;
		}
	}
}
int main()
{
	ios_base::sync_with_stdio(0);cin.tie();cout.tie();
	cout<<setprecision(15);
	cin>>h>>w;
	for (int i=0;i<h;++i) cin>>s[i],ss[i]=s[i],sort(ss[i].begin(),ss[i].end());
//	for (ll i=0;i<100000000000;++i)h*=-1;
	for (int i=0;i<h;++i) a[i]=-1;
	for (int i=0;i<w;++i) b[i]=-1;
	dfs2(0,!(h&1));
	cout<<"NO\n";
	return 0;
}

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

int main() {
	int n, a, b, c, x;
	while(cin >> n >> a >> b >> c >> x && (n || a || b || c || x)){
		int y[200], now = 0;
		bool ended = false;
		for(int i = 0; i < n; ++i)
			cin >> y[i];
		for(int f = 0; f <= 10000; ++f){
			if(y[now] == x)
				now++;
			if(now == n){
				cout << f << endl;
				ended = true;
				break;
			}
			x = (a * x + b) % c;
		}
		if(!ended)
			cout << "-1" << endl;
	}
	return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
#define IOS                                                                    \
  ios::sync_with_stdio(0);                                                     \
  cin.tie(0);                                                                  \
  cout.tie(0)
#define pb push_back
#define ff first
#define ss second
#define all(x) (x).begin(), (x).end()
#define sz(x) (int)(x).size()
using namespace std;
using ll = long long;
using vi = vector<int>;
using pii = pair<ll, ll>;
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fLL;
ll bpow(ll b, ll p, ll m = 1000000007LL) {
  ll rt = 1;
  for (; p; p >>= 1, b = b * b % m)
    if (p & 1)
      rt = rt * b % m;
  return rt;
}
vector<int> g[100005];
int d[100005];
int bt[100005];
int main() {
  IOS;
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    int u, v;
    cin >> u >> v;
    g[u].pb(v), g[v].pb(u);
  }
  for (int i = 1; i <= n; i++)
    d[i] = INF;
  queue<int> q;
  q.push(1);
  d[1] = 0;
  while (!q.empty()) {
    int u = q.front();
    q.pop();
    for (int v : g[u]) {
      if (d[v] > d[u] + 1) {
        bt[v] = u, d[v] = d[u] + 1;
        q.push(v);
      }
    }
  }
  for (int i = 1; i <= n; i++) {
    if (d[i] == INF) {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
  for (int i = 2; i <= n; i++) {
    cout << bt[i] << endl;
  }
}


Measured memory_bytes: 10944
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define print(x)cout<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;

int main() {
  int n;
  cin >> n;
  ll A,B;
  cin >> A >> B;
  ll C = A-B;
  vl h(n);
  rep(i,n) cin>>h[i];

  ll l = -1, r = 1001001001;
  ll ans = r;
  while(r-l>1){
    ll m = l+(r-l)/2;
    ll cnt = 0;
    rep(i,n){
      ll tmp = (h[i] - B*m);
      if(tmp<0) tmp = 0;
      cnt+=tmp/C + (tmp%C >0);
    }
    if(cnt <= m){
      mins(ans,m);
      r = m;
    }
    else{
      l = m;
    }
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 1024
#define debug_interval ','
#define dump_interval ' '
#define debug_toggle 1
//{
#include<bits/stdc++.h>
using namespace std;
#define hi cerr<<"hi"<<endl;
#define int long long
#define INT_MAX LLONG_MAX
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define fi first
#define se second
#define mp make_pair
#define rev reverse
#define dans dump(ans)
#define MOD 1000000007
#define amp(v,n) (v).count(n)?v[n]++:v[n]=1
#define sysp system("pause")
#define PI acos(-1)
#define pf push_front
#define ins insert

//{
inline int toInt(string s){int v;istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}
template<class...A> inline void dump(){cout<<endl;}
template<class...A> inline void dump_rest() {cout<<endl;}
template<class T, class...A> inline void dump_rest(const T& first, const A&... rest){cout<<dump_interval<<first;dump_rest(rest...);}
template<class T,class...A> inline void dump(const T&first,const A&...rest){cout<<first;dump_rest(rest...);}
template<class...A> inline void debug(){cerr<<endl;}
template<class...A> inline void debug_rest() {cerr<<endl;}
template<class T, class...A> inline void debug_rest(const T& first, const A&... rest){cerr<<debug_interval<<first;debug_rest(rest...);}
template<class T,class...A> inline void debug(const T&first,const A&...rest){if(debug_toggle)cerr<<first,debug_rest(rest...);}
unsigned XorShift(void){static unsigned x = 123456789;static unsigned y = 362436069;static unsigned z = 521288629;static unsigned w = 88675123;unsigned t;t = x ^ (x << 11);x = y; y = z; z = w;return w = (w ^ (w >> 19)) ^ (t ^ (t >> 8));}
//}

typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}
template<int m>class mint{private:int i;public:mint() : i(0){}mint(int i): i((i%m+m)%m){}mint operator+(const mint& o){return o.i+i;}mint operator*(const mint& o){return o.i*i;}mint operator-(){return -i;}operator int() {return i;}};

//}

int n,m,c,ans;

main(){
	cin>>n>>m>>c;
	int b[m],a[n][m];
	rep(i,m)cin>>b[i];
	rep(i,n)rep(j,m)cin>>a[i][j];
	rep(i,n){
		int t=0;
		rep(j,m){
			t+=a[i][j]*b[j];
		}
		t+=c;
		if(t>0)ans++;
	}
	dans;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define INF 1e9
#define N 510
#define MAX_V N
using namespace std;
typedef map<int,int> M;
M g[N];
bool used[MAX_V];      //DFS??§?????§??????????????????????????°

int dfs(int v,int t,int f){
  if(v == t)return f;
  used[v]=true;
  
  for(M::iterator it=g[v].begin();it!=g[v].end() ;it++){
    int to=it->first;
    int &cap=it->second;
    if(!used[to] && cap > 0){
      int d = dfs(to ,t , min(f,cap));
      if(d > 0){
	cap -= d;
	g[to][v]+=d;
	return d;
      }
    }
  }
  return 0;
}

int max_flow(int s,int t){
  int flow = 0;
  for(;;){
    memset(used,0,sizeof(used));
    int f = dfs(s, t, INF);
    if(f == 0)return flow;
    flow += f;
  }
}

bool check(int s,int t){
  memset(used,0,sizeof(used));
  return dfs(s,t,1);
}

int main(){
  int n,m,q;
  cin>>n>>m>>q;
  for(int i=0,a,b;i<m;i++){
    cin>>a>>b;a--,b--;
    g[a][b]=g[b][a]=1;
  }
  
  int flow=max_flow(0,n-1);
  while(q--){
    int op,a,b;
    cin>>op>>a>>b;a--,b--;
    if(op==1){
      g[a][b]=g[b][a]=1;
      flow+=max_flow(0,n-1);
    }
    if(op==2){
      if(!g[a][b]||!g[b][a]){
	if(!g[b][a])swap(a,b);
	if(check(a,b));
	else flow--,check(a,0),check(n-1,b);

      }
      g[a][b]=g[b][a]=0;
    }
    cout <<flow<<endl;
  }
  
  return 0;
}

Measured memory_bytes: 5064
<?php
$input = explode(' ', trim(fgets(STDIN)));
$stick_cnt = $input[0];
$connect_cnt = $input[1];
$sticks = explode(' ', trim(fgets(STDIN)));
rsort($sticks);
$answer = 0;
for ($i=0; $i < $connect_cnt; $i++) {
  $answer += $sticks[$i];
}
echo $answer."\n";


Measured memory_bytes: 3828
#include "bits/stdc++.h"
#define FI first.first
#define SE first.second
#define TH second
#define fi first
#define se second
#define th second

using namespace std;

void debug_out() { cerr << endl; }
 
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
 
#ifdef DEBUG
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

class DebugStream {}LOG;
template <typename T>DebugStream &operator<<(DebugStream &s, const T&) { return s; }
#ifdef DEBUG
#define LOG clog
#endif

typedef long long ll;
typedef pair<ll, ll> ii;
typedef long double ld;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());

const int maxN = 3e3 + 9, maxV = 1e6 + 9, MOD = 998244353, SQ = 335, lg = 20, bs = 29;

ll dp[maxN];
int n, S;

void add(ll& x, ll y) {
	x += y;
	if(x >= MOD) x -= MOD;
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	#ifdef DEBUG
	freopen("input.txt", "r", stdin);
	#endif

	cin >> n >> S;
	for(int i = 0, inp; i < n; i++) {
		cin >> inp;
		if(inp > S) continue;
		if(inp == S) {
			add(dp[S], ll(i + 1) * (n - i));
			continue;
		}
		add(dp[S], dp[S - inp] * (n - i) % MOD);
		for(int i = S - 1; i - inp > 0; i--)
			add(dp[i], dp[i - inp]);
		add(dp[inp], i + 1);
	}
	cout << dp[S] << '\n';
}



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

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	string s; cin >> s;
	string t="2019/04/30";
	if (s<=t) cout << "Heisei" << endl;
	else cout << "TBD\n" << endl;
	return 0;
}


Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Sparsh Sanchorawala
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ACirclePond solver = new ACirclePond();
        solver.solve(1, in, out);
        out.close();
    }

    static class ACirclePond {
        public void solve(int testNumber, InputReader s, PrintWriter w) {
            w.println(2 * Math.PI * s.nextInt());
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}



Measured memory_bytes: 33284
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int x,y,j;
	cin>>x>>y;
	for(int i=0;i<=x;++i)
	{
		j=x-i;
		if((i*4+j*2)==y)
		{
			cout<<"Yes";
			return 0;
		}
	}
	cout<<"No";
	 return 0;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define ll long long
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end))) // rep(i, 1, 5) --> {1,2,3,4} // rep(i, 5, 1) --> {4,3,2,1} // rep(it, end(v), begin(v)) --> *it

using namespace std;

int main()
{
    int n, m;
    cin >> n >> m;
    ll sum = 0;
    rep(i, 0, m)
    {
        int a;
        cin >> a;
        sum+=a;
    }
    cout << (sum<=n?n-sum:-1);
    return 0;
}

Measured memory_bytes: 3552
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <climits>
#include <string>
#include <vector>
#include <utility>
#include <functional>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cassert>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<double, ll> P;

const ll MOD = ll(1e9 + 7);
const ll INF = LLONG_MAX;
const ll MAX_N = ll(1e3) + 5;
const double EPS = 1e-8;
const double PI = 3.14159265359;
int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};
#define REP(i, n) for (ll i = 0; i < n; i++)
#define REPR(i, n) for (ll i = n; i >= 0; i--)
#define FOR(i, m, n) for (ll i = m; i < n; i++)

int main() {
    int d,n;
    cin >> d >> n;
    n += n/100;
    REP(i,d)n*=100;
    cout << n << endl;
    return 0;
}


Measured memory_bytes: 256
#include"bits/stdc++.h"
#include<boost/multi_array.hpp>
#include<boost/optional.hpp>
#include<boost/range/irange.hpp>
#include<boost/range/algorithm.hpp>
#include<boost/range/adaptors.hpp>
#include<boost/operators.hpp>
#include<boost/dynamic_bitset.hpp>

namespace adaptor = boost::adaptors;
using index_t = std::size_t;

typedef std::vector<std::map<index_t, std::int64_t>> edge_t;

template<class Value, class Compare>auto bellman_ford(std::vector<std::map<index_t, Value>>const& edge, Compare compare, index_t goal)
{
	auto N = edge.size();
	std::vector<boost::optional<Value>> result(N);
	result[0] = Value();
	auto loop = [&](index_t s)
	{
		for (auto c : boost::irange(s, N))
		{
			for (auto i : boost::irange<index_t>(0, N))
			{
				for (auto&& e : edge[i])
				{
					auto j = e.first;
					auto v = e.second;
					if (result[i] && (!result[j] || compare(*result[i] + v, *result[j])))
					{
						result[j] = *result[i] + v;
					}
				}
			}
		}
	};
	loop(1);
	auto ret = result[goal];
	loop(0);
	return ret == result[goal] ? ret : boost::none;
}

void Main()
{
	index_t N, M;
	std::int64_t P;
	std::cin >> N >> M >> P;
	edge_t edge(N);
	for (auto c : boost::irange<index_t>(0, M))
	{
		index_t A, B;
		std::int64_t C;
		std::cin >> A >> B >> C;
		--A; --B;
		if (edge[A].count(B))
		{
			edge[A][B] = std::max(edge[A][B], C - P);
		}
		else
		{
			edge[A][B] = C - P;
		}
	}
	auto result = bellman_ford(edge, std::greater<>(), N - 1);
	std::cout << (result ? std::max(std::int64_t(), *result) : -1) << std::endl;
}

int main()
{
	std::cin.tie(nullptr);
	std::ios_base::sync_with_stdio(false);
	std::cout << std::fixed << std::setprecision(15);
	Main();
}

Measured memory_bytes: 768
#include <bits/stdc++.h>
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) FOR(i, 0, n)
#define ll long long
using namespace std;

const ll P = 1000000007;
int gcd(int a, int b) { return b != 0 ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }

int main()
{
  cout << fixed << setprecision(10);
  int A,B;
  cin >> A >> B;
  if(A>B)
  {
    cout << 2*A-1 << endl;
  }
  else if(A==B)
  {
    cout << 2*A << endl;
  }
  else
  {
    cout << 2*B-1 << endl;
  }
  return 0;
}


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

#define pb push_back

#define ll long long

#define ft first

#define sd second

using namespace std;

const int N = 5050 ;

bool used[N];

ll z , r , w ;

ll p = -1 ;

int main(){

    int n ;
    cin >> n ;
    string s , t ;
    cin >> s >> t ;
    for(int i = 0 ; i < n ; i ++ ){
        cout<<s[i]<<t[i];
    }

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int N=3005;
ll dp[N][N];
int n,x[N];
int main()
{
	cin>>n;
	for(int i=1;i<=n;i++)cin>>x[i];
	for(int i=1;i<=n;i++)dp[i][i]=x[i];
	for(int i=n;i>=1;--i)
	{
		for(int j=i+1;j<=n;j++)
		{
			dp[i][j]=max(x[i]-dp[i+1][j],x[j]-dp[i][j-1]);
		}
	}
	cout<<dp[1][n]<<endl;
	return 0;
}

Measured memory_bytes: 70016
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vs = vector<string>;
using vll = vector<long long>;
using vvi = vector<vector<int>>;
using vvll = vector<vector<long long>>;
template<class T> inline bool chmax(T &a, T b) { if (a<b) {a=b; return 1;} return 0;}
template<class T> inline bool chmin(T &a, T b) { if (b<a) {a=b; return 1;} return 0;}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int x1, y1, x2, y2, x3, y3, x4, y4;
    cin >> x1 >> y1 >> x2 >> y2;
    x3 = x2 + y1 - y2;
    y3 = -x1 + x2 + y2;
    x4 = x1 + y1 - y2;
    y4 = -x1 + x2 + y1;
    printf("%d %d %d %d\n", x3, y3, x4, y4);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

int main() {

	int n; cin >> n;
	vector<pair<int, int>> p, q;
	for (int i = 0; i < n; i++) {
		int a, b; cin >> a >> b;
		p.push_back({ a,b });
	}
	for (int i = 0; i < n; i++) {
		int c, d; cin >> c >> d;
		q.push_back({ c,d });
	}
	sort(p.begin(), p.end());
	sort(q.begin(), q.end());
	int ans = 0;
	int index = 0;
	int cntInBox = 0;
	vector<bool> used(n, false);
	for (int i = 0; i < n; i++) {
		int line = q[i].first;
		while (true) {
			if (index == n) break;
			if (q[i].first < p[index].first) {
				break;
			}
			index++;
			cntInBox++;
		}
		if (cntInBox == 0) continue;
		int ansIndex;
		int tmp = -1;
		for (int j = 0; j < index; j++) {
			if (used[j]) continue;
			if (p[j].second < q[i].second) {
				if (chmax(tmp , p[j].second)) {
					ansIndex = j;
				}
			}
		}
		if (tmp != -1) {
			ans++;
			used[ansIndex] = true;
			cntInBox--;
		}
	}
	cout << ans << endl;
	return 0;
}

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

using namespace std;

typedef long long ll;

const ll maxx = 1e5 + 20;

ll a[maxx], l, n;

int main()
{
	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	cin >> n >> l;
	for(int i = 0; i < n; i++) cin >> a[i];
	for(int i = 0; i < n - 1; i++)
	{
		if (a[i] + a[i + 1] >= l)
		{
			cout << "Possible" << '\n';
			for(int j = 1; j < i + 1; j++) cout << j << '\n';
			for(int j = n - 1; j > i + 1; j--) cout << j << '\n';
			cout << i + 1 << '\n';
			return 0;
		}
	}
	cout << "Impossible" << '\n';
	return 0;
}

Measured memory_bytes: 1664
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<algorithm>
#include<cmath>
#include<queue>
#include<vector>
#include<stack>
using namespace std;

#define REP(i,n) for(int i=0;(i)<(n);(i)++)
#define ll long long

int main() {
	int a,b;
        char s;
	cin >> a >> s >> b;
	

	cout << (s=='+'?a+b:a-b) << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <limits>
#include <map>
#include <set>
#include <tuple>
#include <vector>

template <class... Ts> using tuple_t = std::tuple<Ts...>;
template <class T, class U> using map_t = std::map<T, U>;
template <class T, class U> using pair_t = std::pair<T, U>;
template <class T> using vector_t = std::vector<T>;
template <class T> using set_t = std::set<T>;

int min(const vector_t<int> &nums) {
  int min_ = std::numeric_limits<int>::max();
  for (auto &i : nums)
    if (min_ > i)
      min_ = i;
  return min_;
}

int max(const vector_t<int> &nums) {
  int max_ = std::numeric_limits<int>::min();
  for (auto &i : nums)
    if (max_ < i)
      max_ = i;
  return max_;
}

void next(vector_t<int> &mins, vector_t<int> &maxs, int cut) {
  vector_t<int> min_next;
  vector_t<int> max_next;
  for (int i = 0; i < mins.size(); ++i) {
    if (mins[i] <= cut && cut < maxs[i])
      continue;
    min_next.push_back(mins[i]);
    max_next.push_back(maxs[i]);
  }
  mins = min_next;
  maxs = max_next;
}

int main() {
  int N, M, a, b;
  std::cin >> N >> M;
  vector_t<int> mins;
  vector_t<int> maxs;
  for (int i = 0; i < M; ++i) {
    std::cin >> a >> b;
    mins.push_back(a);
    maxs.push_back(b);
  }
  int count = 0;
  while (mins.size()) {
    next(mins, maxs, max(mins));
    ++count;
  }
  std::cout << count << std::endl;
  return 0;
}

Measured memory_bytes: 2324