akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
int main () {
  int s1s2s3;
  cin >> s1s2s3;
  cout << s1s2s3 / 100 + (s1s2s3 % 100 - s1s2s3 % 10) / 10 + s1s2s3 % 10 << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <string>
#include <sstream>
#include <stack>
#include <algorithm>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <cstdlib>
#include <bitset>
#include <tuple>
#include <assert.h>
#include <deque>
#include <bitset>
#include <iomanip>
#include <limits>
#include <chrono>
#include <random>
#include <array>
#include <unordered_map>
#include <functional>
#include <complex>
#include <numeric>
#include <cctype>

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
//constexpr long long MAX = 5100000;
constexpr long long INF = 1LL << 60;
constexpr int inf = 1000000007;
constexpr long long mod = 1000000007LL;
//constexpr long long mod = 998244353LL;
const long double PI = acos((long double)(-1));

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


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

struct Point {
	int x, y;
	Point() :x(0), y(0) {}
	Point(int x, int y) :x(x), y(y) {}
};

using Points = vector<Point>;
pair<int, int> f(Point a, Point b) {
	if (a.x == b.x) {
		return { inf,inf };
	}
	a.x -= b.x;
	a.y -= b.y;
	int g = gcd(abs(a.x), abs(a.y));
	a.x /= g;
	a.y /= g;
	if (a.x < 0) {
		a.x *= -1;
		a.y *= -1;
	}
	return { a.x,a.y };
}



int main()
{

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	int n; cin >> n;
	Points p(n); for (int i = 0; i < n; i++) cin >> p[i].x >> p[i].y;
	map<pair<int, int>, vector<pair<int, int>>> mp;
	for (int i = 0; i < n; i++) {
		for (int j = i + 1; j < n; j++) {
			mp[f(p[i], p[j])].emplace_back(i, j);
		}
	}
	vector<int> dp(1 << n);
	for (int S = 0; S < (1 << n); S++) {
		for (auto& e : mp) {
			auto& v = e.second;
			int nS = S;
			int cnt = 0;
			for (auto& p : v) {
				if ((nS >> p.first & 1) or (nS >> p.second & 1)) continue;
				cnt++;
				nS |= (1 << p.first);
				nS |= (1 << p.second);
			}
			chmax(dp[nS], dp[S] + cnt * (cnt - 1) / 2);
		}
	}
	cout << dp[(1 << n) - 1] << endl;
}



Measured memory_bytes: 3248
//  Copyright © 2020 Diego Garcia Rodriguez del Campo. All rights reserved.
#include<bits/stdc++.h>
#define MAX 200005
#define optimiza_io cin.tie(0); ios_base::sync_with_stdio(0);
#define forn(i,a,b) for (int i = a; i <= b; i ++ )
#define mod(n,k) (((n%k)+k)%k)
using namespace std;
typedef long long ll;

int main()
{
    optimiza_io
    long double R;
    cin >> R;
    cout << fixed << setprecision( 10 ) << R * 2 * 3.1415926535897932 << "\n";
    return 0;
}

// CHECAR LIMITES 

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

int main(){
	int N, M;
	cin >> N >> M;
	int a[N], b[N], c[M], d[M];
	for(int i=0; i<N; i++){
		cin >> a[i] >> b[i];
	}
	for(int i=0; i<M; i++){
		cin >> c[i] >> d[i];
	}
	for(int i=0; i<N; i++){
		int min_dist=abs(a[i]-c[0])+abs(b[i]-d[0]),ans=1;
		for(int j=1; j<M; j++){
			int cur_dist=abs(a[i]-c[j])+abs(b[i]-d[j]);
			if(min_dist>cur_dist){
				min_dist = cur_dist;
				ans=j+1;
			}
		}
		cout << ans << endl;
	}
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(q,w,e) for(int q=(w);q<=e;q++)
const int N=105;
int n,m;
char a[N][N];
bool s[N],t[N];
int main() {
    scanf("%d%d",&n,&m);
    rep(i,1,n) scanf("%s",a[i]+1);
    rep(i,1,n) rep(j,1,m) {
        if (a[i][j]=='#') {
            s[i]=true; break;
        }
    }
    rep(j,1,m) rep(i,1,n) {
        if (a[i][j]=='#') {
            t[j]=true; break;
        }
    }
    rep(i,1,n) {
        bool bo=false;
        rep(j,1,m) {
            if (!s[i] || !t[j]) continue;
            printf("%c",a[i][j]);
            bo=true;
        }
        if (bo) printf("\n");
    }
    return 0;
}

Measured memory_bytes: 256
// Happy Birthday!

#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
#include <unordered_map>
#include <ios>
#include <iomanip>
#include <string>
#include <numeric>

using namespace std;

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

    if (a <= 8 && b <= 8) {
        cout << "Yay!" << endl;
    } else {
        cout << ":(" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
def main():
    ls = list(input())
    ans  = [0]*(len(ls))
    ls.append("R")
    cnt_r,cnt_l = 0,0
    check_r,check_l = 0,0
    now = "R"
    for i in range(len(ls)):
        if ls[i]=="R":
            if now =="R":
                cnt_r += 1
            else:
                if (cnt_l+cnt_r)%2==0:
                    cnt = (cnt_l+cnt_r)//2
                    ans[check_r]=cnt
                    ans[check_l]=cnt 
                else:
                    cnt = (cnt_l+cnt_r+1)//2

                    if cnt_l>cnt_r:
                        if cnt_l%2==1:
                            ans[check_l]=cnt
                            ans[check_r]=cnt-1
                        else:
                            ans[check_l]=cnt-1
                            ans[check_r]=cnt
                    else:
                        if cnt_r%2==1:
                            ans[check_l]=cnt-1
                            ans[check_r]=cnt
                        else:
                            ans[check_l]=cnt
                            ans[check_r]=cnt-1
                cnt_r = 1
                cnt_l = 0
                now = "R"
        else:
            if now=="R":
                cnt_l += 1
                check_r = i-1
                check_l = i
                now ="L"
            else:
                cnt_l += 1
    for i in ans:
        print(i,end=" ")
    
    
if __name__ == '__main__':
    main()

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

using namespace std;

int main() {
  int n;cin>>n;
  vector<int> a(n);
  rep(i,n)cin>>a[i];
  int ans=0;
  rep(i,n)for(int j=i+1;j<n;j++){
    ans=max(ans,abs(a[i]-a[j]));
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 3600
#include <bits/stdc++.h>
using namespace std;
int main() {
	string s, t;
	cin >> s;
	cin >> t;
	if (s == t) {
		cout << "Yes" << endl;
		return 0;
	}
	for (int i = 1; i < s.length(); i++) {
		s = s.substr(1) + s.at(0);
		if (s == t) {
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;
}

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

long long gcd(ll x, ll y){
	if(x > y) swap(x, y);
	while(x != 0){
		y %= x;
		swap(x, y);
	}
	return y;
}


int main(){
	int N; cin >> N;
	int s[N];
	rep(i, N){
		char c; cin >> c;
		if(c == 'R') s[i] = 0;
		if(c == 'G') s[i] = 1;
		if(c == 'B') s[i] = 2;
	}
	int r[N], g[N], b[N];
	for(int i=N-1; i>=0; i--){
		if(i==N-1) r[i] = 0;
		else{
			r[i] = r[i+1] + (s[i+1] == 0);
		}
	}
	for(int i=N-1; i>=0; i--){
		if(i==N-1) g[i] = 0;
		else{
			g[i] = g[i+1] + (s[i+1] == 1);
		}
	}
	for(int i=N-1; i>=0; i--){
		if(i==N-1) b[i] = 0;
		else{
			b[i] = b[i+1] + (s[i+1] == 2);
		}
	}
	ll ans = 0;
	for(int i=0; i<N; i++){
		for(int j=i+1; j<N; j++){
			if(s[i] == s[j]) continue;
			int x = 3-s[i]-s[j];
			if(x==0){
				ans += r[j];
				if(2*j-i < N && s[2*j-i] == x) ans--;
			}
			if(x==1){
				ans += g[j];
				
				if(2*j-i < N && s[2*j-i] == x) ans--;
			}
			if(x==2){
				ans += b[j];
				if(2*j-i < N && s[2*j-i] == x) ans--;
			}
		}
	}
	
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3636
#include <iostream>
#include <fstream>
#include <cassert>
#include <typeinfo>
#include <vector>
#include <stack>
#include <cmath>
#include <set>
#include <map>
#include <string>
#include <algorithm>
#include <cstdio>
#include <queue>
#include <iomanip>
#include <cctype>
#include <random>
#include <time.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<P,int> pip;
typedef vector<pip> vip;
const int inf=1<<28;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-8;
const ll mod=1e9+7;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

struct point{
	double x,y;
	point operator+(point p){
		return point{x+p.x,y+p.y};
	}
	point operator-(point p){
		return point{x-p.x,y-p.y};
	}
	point operator*(double p){
		return point{x*p,y*p};
	}
	point operator/(double p){
		if(!p) return point{0,0}; 
		return point{x/p,y/p};
	}
	bool operator==(point p){
		return fabs(x-p.x)<eps&&fabs(y-p.y)<eps;
	}
	bool operator<(point p){
		if(fabs(x-p.x)>eps) return x<p.x;
		return y<p.y;
	}
};

typedef pair<point,point> pp;
typedef vector<point> VP;
const point O{0,0};

double Length(point x,point y){
	point z=y-x;
	return sqrt(z.x*z.x+z.y*z.y);
}

point Normal(point p){
	return point{p.y,-p.x};
}

int n;
VP p;

int f(point q){
	int res=0;
	for(int i=0;i<n;i++) if(Length(p[i],q)<1+eps) res++;
	return res;
}

int main(){
	while(1){
		cin>>n;
		if(!n) break;
		p=VP(n);
		for(int i=0;i<n;i++) cin>>p[i].x>>p[i].y;
		int res=1;
		for(int i=0;i<n;i++) for(int j=i+1;j<n;j++){
			point c=(p[i]+p[j])/2,e=Normal(p[i]-p[j]);
			double l=Length(c,p[i]);
			e=e/Length(O,e)*sqrt(1.0-l*l);
			res=max(res,max(f(c+e),f(c-e)));
		}
		cout<<res<<endl;
	}
}

Measured memory_bytes: 3268
s = list(input())
k = int(input())

s2 = s + s
s3 = s + s + s

tmp = s[0]
c = 0
for i in range(1,len(s)):
    if s[i] == tmp:
        s[i] = "@"
        c += 1
    tmp = s[i] 

tmp = s2[0]
c2 = 0
for i in range(1,len(s2)):
    if s2[i] == tmp:
        s2[i] ="@"
        c2 += 1
    tmp = s2[i]

tmp = s3[0]
c3 = 0
for i in range(1,len(s3)):
    if s3[i] == tmp:
        s3[i] ="@"
        c3 += 1
    tmp = s3[i]

if c2-c == c3-c2:
    ans = c + (k-1)*(c2-c)
else:
    if k%2 != 0:
        ans = c + ((k-1)//2)*(c3-c)
    else:
        ans = c + ((k-2)//2)*(c3-c2) + c2 - c
print(ans)


Measured memory_bytes: 3064
from collections import Counter
S = input()

c = Counter(S)
if c['W'] == 0 or c['B'] == 0:
    print(0)
    exit()

now = ''
count = 0
for i in range(len(S)):
    if i == 0:
        now = S[i]
        continue
    if now == S[i]:
        continue
    else:
        count += 1
        now = S[i]
        continue

print(count)


Measured memory_bytes: 9368
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
constexpr ll mod=1e9+7;

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

Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
const ll INF = 1LL << 60;

int main(){
    ll n, k, q;
    cin >> n >> k >> q;
    vector<ll> cnt(n,0);
    rep(i,q){
        ll a;
        cin >> a;
        cnt[a-1] ++;
    }
    for(int i=0; i<n; i++){
        if(cnt[i] > q-k){
            cout << "Yes" << endl;
        }
        else{
            cout << "No" << endl;
        }
    }


}

Measured memory_bytes: 4044
n, k=map(int, input().split())

point = 0
result = 0
for index in range(n):
    if point >= k:
        break
    
    tmp_count=0
    tmp_value=(index+1)
    while tmp_value < k:
        tmp_value*=2
        tmp_count+=1
        
    double_num=tmp_count

    result+=(1/n)*((1/2)**double_num)


print(result)

Measured memory_bytes: 3064
#include <stdio.h>
#include <string.h>
#include <algorithm>

using namespace std;

#define N 110000
#define _for(i, a, b) for (int i = (a); i < (b); ++i)

typedef long long ll;

struct Node {
    ll val, val2, id;
    bool operator < (const Node &u) const {
        return (val + val2) > (u.val + u.val2);
    }
};

int vis[N];
Node a[N], b[N];

int main() {
    int n;
    while (scanf("%d", &n) != EOF) {
        memset(vis, 0, sizeof(vis));
        for (ll i = 0; i < n; ++i) {
            scanf("%lld%lld", &a[i].val, &b[i].val);
            a[i].id = b[i].id = i;
            a[i].val2 = b[i].val;
            b[i].val2 = a[i].val;
        }
        int cur = 0, cnt = 0, i = 0, j = 0;
        sort(a, a + n); sort(b, b + n);
        ll sum1 = 0, sum2 = 0;
        while (cnt < n) {
            while (i < n && vis[a[i].id]) i++;    //分别归位
            while (j < n && vis[b[j].id]) j++;
            if (!cur) {
                sum1 += a[i].val, vis[a[i].id] = 1;
                //else sum1 += b[j].val2, vis[b[j].id ] = 1;
            } else {
                sum2 += b[j].val, vis[b[j].id] = 1;
                //else sum2 += a[i].val2, vis[a[i].id] = 1;
            }
            cnt++;
            cur = cur ^ 1;
        }
        printf("%lld\n", sum1 - sum2);
    }
    return 0;
}


Measured memory_bytes: 5504
#include<bits/stdc++.h>
#define faster  ios :: sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long
#define ull unsigned long long
#define pb push_back
const double PI = acos(-1.0);
using namespace std;

int main()
{
    faster

    int n,k;
    cin>>n>>k;

    int a[n];

    for(int i=0; i<n; i++)
        cin>>a[i];

    sort(a,a+n);

    ll s=0;

    for(int i=0; i<k; i++)
        s=s+a[i];

    cout<<s<<endl;






    return 0;
}


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

using namespace std;


int main(){

    int n;
    scanf("%d",&n);
    pair< int , int >mx;
    mx.first=0;
    mx.second=0;
    while(n -- ){
        int a,b;
        scanf("%d%d",&a,&b);
        if(a>mx.first){
            mx.first=a;
            mx.second=b;
        }
        
    }
    cout<<mx.first+mx.second<<endl;
    
    
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long finish(string s)
{
	long long cnt=0,res=0;
	for(int i=0;i<s.size();i++)
	{
		cnt++;
		if(i==s.size()-1||s[i]!=s[i+1])
		{
			res+=cnt/2;
			cnt=0;
		}
	}
	return res;
}
int main()
{
	int ans1=0;
	long long ans=0;
	string s;
	cin>>s;
	int n;
	cin>>n;
	bool k=true;
	for(int i=1;i<s.size();i++)
		if(s[i]!=s[i-1])
			k=false;
	if(k==true)
	{
		cout<<s.size()*n/2;
		return 0;
	}
	else
		cout<<finish(s)+(finish(s+s)-finish(s))*(n-1)<<endl;
	return 0;	
} 

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,N) for (int i = 0; i < (N); ++i)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main(void){
  int n;
  cin >> n;
  vector <int> p(n);
  rep(i,n) cin >> p[i];

  int ans = 0;
  for (int i = 1; i <= n - 2; i++){
    if (p[i] != max({p[i - 1], p[i], p[i + 1]}) && p[i] != min({p[i - 1], p[i], p[i + 1]})){
      ans ++;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 3620
#include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) for(int i = 0; i < (b); i++)
#define all(a) (a).begin(), (a).end()
#define show(x)  cerr << #x << " = " << (x) << endl;
using namespace std;

template<typename T>
ostream& operator << (ostream& os, vector<T>& v){
	rep(i,v.size()){ os << v[i] << (i == v.size() - 1 ? "" : " "); } return os;
}
template<typename T>
istream& operator >> (istream& is, vector<T>& v){
	for(T& x: v){ is >> x; } return is;
}

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

	vector<long long> a(n);
	cin >> a;

	vector<long long> minus;
	rep(i,n){
		a[i] -= i + 1;
	}

	sort(all(a), greater<long long>());
	long long ans = 0;
	long long k = a[n / 2];
	rep(i,n){
		a[i] -= k;
		ans += abs(a[i]);
	}


	cout << ans << endl;
}


Measured memory_bytes: 1792
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_mut)]
#[allow(non_snake_case)]
fn main() {
    input!{
        N: u64,
        K: u64,
        A: [u64; N],
    }

    let mut check_flag = true;
    let mut output: Vec<u64> = Vec::with_capacity(40);
    let mut count;
    for digit in (0..40).rev() {
        if check_flag && (K >> digit) % 2_u64 == 0 {
            output.push(0);
            continue;
        }
        count = [0, 0];
        for a in A.iter() {
            count[(*a as usize >> digit) % 2_usize] += 1;
        }

        if count[0] > count[1] {
            output.push(1);
        } else {
            check_flag = false;
            output.push(0);
        }
    }

    let mut X: u64 = (0..40).rev().zip(output.iter()).map(|(p, s)| 2_u64.pow(p) * *s).sum();

    println!("{}", A.iter().map(|a| *a ^ X).sum::<u64>());

}


Measured memory_bytes: 4352
N = int(input())
from collections import deque
inp = []
for k in range(N-1):
  a, b = map(int, input().split())
  if a > b:
    a, b = b-1, a-1
  else:
    a, b = a-1, b-1
  inp.append((a, b, k))
inp.sort(key = lambda x: x[0])
inp = deque(inp)
mark = [[] for _ in range(N)]
def binary_search(list, item):
    low = 0
    high = len(list) - 1
    while low <= high:
        mid = (low + high) //2
        guess = list[mid]
        if guess == item:
            #return mid
            return True
        if guess > item:
            high = mid -1
        else:
            low = mid + 1

    #return None
    return False

from bisect import insort
ans = [0 for _ in range(N-1)]
now = 0
cnt = 0
while inp:
  item = inp.popleft()
  cnt += 1
  if now < item[0]:
    now = item[0]
    cnt = 1
  while binary_search(mark[item[0]], cnt) or binary_search(mark[item[1]], cnt):
    cnt += 1
  insort(mark[item[1]], cnt)
  ans[item[2]] = cnt
color = max(ans)
print(color)
for k in range(N-1):
  print(ans[k])

Measured memory_bytes: 33724
n = int(input())
if n==0:
    print('0')
    exit(0)
i = 1
s = []
while n!=0:
    if n%2**i>0:
        s.append('1')
        n -= (-2)**(i-1)
    else:
        s.append('0')
    i += 1
print(''.join(s[::-1]))

Measured memory_bytes: 3060
#pragma GCC optimize(2)
#include <bits/stdc++.h>
#define MIN -10000000
#define MAX 10000000
#define debug printf("%d",__LINE__)
using namespace std;
int main()
{
	unsigned long long n, mn = 100, cnt = 0;
	cin >> n; 
	while(mn < n)
	{
		mn += mn / 100;
		cnt = cnt + 1;
	}
	cout << cnt;
	return 0;
}


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

int main(){
  long long n,t[101];
  cin>>n;
  long long ans=1;
  for(int i=0;i<n;++i)cin>>t[i];
  for(int i=0;i<n;++i){
    ans=ans/__gcd(ans,t[i])*t[i];
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
    unsigned long long n;
    cin >> n;
    unsigned long long power = 1;
    for (unsigned long long i = 0; i < n; ++i) {
        power = (power * (i + 1)) % 1000000007;
    }
    cout << power << endl;
    return EXIT_SUCCESS;
}

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

int main() {

	string s; cin>>s;
	if(s[2]==s[3]&&s[4]==s[5]){
		cout<<"Yes";
	}
	else{
		cout<<"No";
	}

	int l; cin>>l;
	
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main(){
  ll h,a;
  cin>>h;
  cin>>a;
  ll count=0;
  while(h>0)
  {
    h=h-a;
    count++;
  }
  cout<<count<<"\n";
return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main()
{
  int f=0,s=0,t=0,m,i;
  for(i=0;i<10;i++){
    scanf("%d",&m);
    if(m>f){
      t=s;
      s=f;
      f=m;
    }
    else if(m>s){
      t=s;
      s=m;
    }
    else if(m>t){
      t=m;
    }
  }
  printf("%d\n%d\n%d\n",f,s,t);
  return 0;
}

Measured memory_bytes: 1028
#include <bits/stdc++.h>
#define int long long

#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)a, i##_len=(b); i<i##_len; i++)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)

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

using namespace std;

using P = pair<int,int>;
using ll = long long;

const long long INF = LLONG_MAX/3;

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

struct UnionFind{
	std::vector<int> par,siz;
	void init(int n){
		par.resize(n);
		for(int i=0;i<n;i++)par[i]=i;
		siz.resize(n,1);
	}
	UnionFind(int n){
		init(n);
	}
	int root(int n){
		if(par[n]==n)return n;
		else return par[n]=root(par[n]);
	}
	bool issame(int x,int y){
		return (root(x)==root(y));
	}
	bool marge(int a,int b){
		if(issame(a,b))return false;
		else{
			a=root(a),b=root(b);
			if(siz[a]<siz[b])swap(a,b);
			siz[b]+=siz[a];
			par[a]=par[b];
			return true;
		}
	}
	int size(int n){
		return siz[root(n)];
	}
};

long long gcd(long long a,long long b){
    if(b==0)return a;
    return gcd(b,a%b);
}
long long lcm(long long i,long long j){
    return i*(j/gcd(i,j));
}

const int MOD=1e9+7;
long long fac[510000], finv[510000], inv[510000];
long long MAX=510000;
bool COMinited=false;
long long COM(int n, int k){
	if(COMinited==false){
		fac[0] = fac[1] = 1;
    	finv[0] = finv[1] = 1;
    	inv[1] = 1;
    	for (int i = 2; i < MAX; i++){
        	fac[i] = fac[i - 1] * i % MOD;
        	inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        	finv[i] = finv[i - 1] * inv[i] % MOD;
    	}
		COMinited=true;
	}
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
long long modinv(long long a, long long mod) {
    return modpow(a, mod - 2, mod);
}
template< typename T >
struct BinaryIndexedTree {
  vector< T > data;

  BinaryIndexedTree(int sz) {
    data.assign(++sz, 0);
  }

  T sum(int k) {
    T ret = 0;
    for(++k; k > 0; k -= k & -k) ret += data[k];
    return (ret);
  }

  void add(int k, T x) {
    for(++k; k < data.size(); k += k & -k) data[k] += x;
  }
};
signed main(){
	int a,b;
	cin>>a>>b;
	rep(i,1,10000){
		if((int)((double)i*0.08)==a&&(int)((double)i*0.1)==b){
			cout<<i<<endl;
			return 0;
		}
	}
	cout<<-1<<endl;
}


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

typedef long long   signed int LL;
typedef long long unsigned int LU;

#define incID(i, l, r) for(int i = (l)    ; i <  (r); i++)
#define incII(i, l, r) for(int i = (l)    ; i <= (r); i++)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); i--)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); i--)
#define  inc(i, n) incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define  dec(i, n) decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)

#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))

#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define PQ priority_queue

#define  ALL(v)  v.begin(),  v.end()
#define RALL(v) v.rbegin(), v.rend()
#define  FOR(it, v) for(auto it =  v.begin(); it !=  v.end(); ++it)
#define RFOR(it, v) for(auto it = v.rbegin(); it != v.rend(); ++it)

template<typename T> bool   setmin(T & a, T b) { if(b <  a) { a = b; return true; } else { return false; } }
template<typename T> bool   setmax(T & a, T b) { if(b >  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmineq(T & a, T b) { if(b <= a) { a = b; return true; } else { return false; } }
template<typename T> bool setmaxeq(T & a, T b) { if(b >= a) { a = b; return true; } else { return false; } }
template<typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }

// ---- ----

int n, k, q, a[2001];

int main() {
	cin >> n >> k >> q;
	inc(i, n) { cin >> a[i]; }
	a[n] = 0;
	
	int ans = 1e9;
	inc(e, n) {
		bool f = false;
		vector<int> w, z;
		incII(i, 0, n) {
			bool g = (a[i] >= a[e]);
			
			if(g) { w.PB(a[i]); }
			
			if(f && ! g) {
				if(w.size() >= k - 1) {
					sort(ALL(w));
					int t = w.size() - (k - 1);
					inc(j, t) { z.PB(w[j]); }
				}
				w.clear();
			}
			
			f = g;
		}
		
		sort(ALL(z));
		if(z.size() >= q) { setmin(ans, z[q - 1] - z[0]); }
		// if(z.size() >= 1) { cout << z.size() << ": " << z[q - 1] << " --- " << z[0] << endl;	}
	}
	
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 256
def main():
    import sys
    input=sys.stdin.readline
    h,w=map(int,input().split())
    grid=[list(map(int,input().split())) for i in range(h)]
    
    ans=[]
    a_append=ans.append
    for i in range(h):
        for j in range(w-1):
            if grid[i][j]%2!=0:
                grid[i][j+1]+=1
                a_append([i+1,j+1,i+1,j+2])
    for i in range(h-1):
        if grid[i][w-1]%2!=0:
            grid[i+1][w-1]+=1
            a_append([i+1,w,i+2,w])
    n=len(ans)
    print(n)
    for i in range(n):
        print(*ans[i])
if __name__=='__main__':
    main()

Measured memory_bytes: 30288
import sys
sys.setrecursionlimit(10**6)
N, A, B = map(int, input().split())
h = []
for _ in range(N):
    h.append(int(input()))


def check(m):
    cnt = 0
    for i in range(N):
        cnt += max(-(-(h[i]-m*B)//(A-B)), 0)
    return cnt <= m


def binary_search(l, r):
    c = (l+r)//2
    if r-l == 1:
        return l if check(c) else r

    if check(c):
        return binary_search(l, c)
    else:
        return binary_search(c, r)

print(binary_search(0, 10**9+1))


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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
template<class T> inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template<class T> inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
int64_t abs(int64_t n) {
  if (n < 0) {
    n = -n;
  }
  return n;
}

int main() {
  int n, k;
  cin >> n >> k;
  vector <int> h(n);
  rep(i, n) {cin >> h.at(i);}
  vector <int64_t> dp((int)pow(10, 5)+10, (int)pow(10, 9)+10);
  dp.at(0) = 0;
  for (int i = 1; i < n; i++) {
    chmin(dp.at(i), dp.at(i-1)+abs(h.at(i)-h.at(i-1)));
    if (i-k >= 0) {
      for (int j = 0; j < k; j++) {
        chmin(dp.at(i), dp.at(i-1-j)+abs(h.at(i)-h.at(i-1-j)));
      }
    } else {
      for (int j = 0; j <= i-1; j++) {
        chmin(dp.at(i), dp.at(i-1-j)+abs(h.at(i)-h.at(i-1-j)));
      }
    }
  }
  cout << dp.at(n-1) << endl;
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
#include <ext/numeric>

using namespace std;
using namespace __gnu_cxx;

#define sz(v)           ((int)((v).size()))
#define clr(v, d)       memset(v, d, sizeof(v))
#define rep(i, v)       for(int i=0; i<sz(v); ++i)
#define lp(i, n)        for(int i=0; i<(int)(n); ++i)
#define lpi(i, j, n)    for(int i=(j); i<(int)(n); ++i)
#define lpd(i, j, n)    for(int i=(j); i>=(int)(n); --i)
//#define INF             1000000000
//#define INF             100000000000000

typedef long long ll;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;

void init(){
	std::ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
}

const int N = 1e5+5;
const int M = 104;

int dp[N][2];

int arr[M];

int n, k;

bool solve(int cur_k, bool turn){
	if(cur_k < 0)
		return turn;
	int & cur = dp[cur_k][turn];
	if(cur != -1)
		return cur;
	lp(i, n)
		if(solve(cur_k - arr[i], !turn) == turn)
			return (cur = turn);
	return (cur = !turn);
}

int main()
{
	clr(dp, -1);
	cin >> n >> k;
	lp(i, n)
		cin >> arr[i];
	cout << (solve(k, 0)?"Second":"First");
	return 0;
}


Measured memory_bytes: 8832
l, r = map(int, input().split())
ans = []
for i in range(l, r+1):
    for j in range(i+1, r+1):
        if j == i+1:
            start = (i*j) % 2019
        tmp = (i*j) % 2019
        if tmp == 0:
            print(0)
            exit()
        # if j != i+1 and tmp == start:
        #     break
        # else:
        #     ans.append(tmp)
        ans.append(tmp)
print(min(ans))

Measured memory_bytes: 43632
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#include <set>
#define MOD 1000000007
#define mkp make_pair
typedef long long ll;
using namespace std;

int main(){
  ll N;
  cin>>N;
  vector<ll> A(N);
  for(int i=0;i<N;i++){
    cin>>A[i];
  }

  vector<pair<ll,int>> val(3,mkp(0,0));
  for(int i=0;i<N;i++){
    for(int j=0;j<3;j++){
      int a=val[j].first;
      int b=val[j].second;
      if(b==0){
        val[j]=mkp(A[i],1);
        break;
      }else{
        if(a==A[i]){
          val[j]=mkp(a,b+1);
          break;
        }else if(j==2){
          cout<<"No"<<endl;
          return 0;
        }
      }
    }
  }

  int n=0;
  for(int i=0;i<3;i++){
    if(val[i].second==0) break;
    n++;
  }

  if(n==1){
    if(val[0].first!=0){
      cout<<"No"<<endl;
      return 0;
    }
  }else if(n==2){
    if(val[0].first==0){
      if(val[0].second*2!=val[1].second){
        cout<<"No"<<endl;
        return 0;
      }
    }else if(val[1].first==0){
      if(val[1].second*2!=val[0].second){
        cout<<"No"<<endl;
        return 0;
      }
    }else{
      cout<<"No"<<endl;
      return 0;
    }
  }else if(n==3){
    for(int i=0;i<3;i++){
      for(int j=i+1;j<3;j++){
        int z=(i+1)^(j+1);
        z--;
        if((val[i].first^val[j].first)!=val[z].first){
          cout<<"No"<<endl;
          return 0;
        }
        if(val[i].second!=val[j].second){
          cout<<"No"<<endl;
          return 0;
        }
      }
    }
  }else{
    cout<<"No"<<endl;
    return 0;
  }

  cout<<"Yes"<<endl;

  return 0;
}


Measured memory_bytes: 1024
N = int(input())
T, A = map(int, input().split())
H_list = list(map(int, input().split()))
length = len(H_list)

tmpr_list = [T - h * 0.006 for h in H_list]
abs_min = abs(tmpr_list[0] - A)
abs_min_index = 1

for i in range(length):
    if abs_min >= abs(tmpr_list[i] - A):
        abs_min = abs(tmpr_list[i] - A)
        abs_min_index = i + 1

print(abs_min_index)


Measured memory_bytes: 3064
import java.util.Scanner;

public class Main {

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

    private Scanner scan = new Scanner(System.in);
    private int a;
    private int b;

    public Main() {
	a = Integer.parseInt(scan.next());
	b = Integer.parseInt(scan.next());

	scan.close();
    }

    public final void answer() {
	int tmp = b;

	while(tmp > 0) {
	    tmp = tmp / 10;
	    a = a * 10;
	}

	a = a + b;

	int max = (int)Math.sqrt(a);
	String ans = "No";
	for (int i = 1; i <= max; i++) {
	    if(a % i == 0 && a / i == i) {
		ans = "Yes";
		break;
	    }
	}

	System.out.println(ans);
	
    }
}


Measured memory_bytes: 23764
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define rep(i, n) for(int i=0;i<n;++i)
#define rrep(i, n) for(int i=n;i>=0;--i)
const int inf=1e9+7;
const ll mod=1e9+7;
const ll mod1=998244353;
const ll big=1e18;
const double PI=2*asin(1);

ll DP[3005][3005];

int main() {
  int A, B, C, D;
  cin>>A>>B>>C>>D;
  DP[A][B] = 1;
  for(int i=A+1;i<=C;++i) {
    DP[i][B] = DP[i-1][B]*B%mod1;
  }
  for(int j=B+1;j<=D;++j) {
    DP[A][j] = DP[A][j-1]*A%mod1;
  }
  for(ll i=A+1;i<=C;++i) {
    for(ll j=B+1;j<=D;++j) {
      DP[i][j] = DP[i-1][j]*j%mod1 + DP[i][j-1]*i%mod1 - DP[i-1][j-1]*(i-1)%mod1*(j-1)%mod1;
      DP[i][j] = (DP[i][j]+mod1)%mod1;
    }
  }
  cout<<DP[C][D]<<endl;
}



Measured memory_bytes: 73864
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <cstdint>

using namespace std;

int main() {
	uint64_t n,m,a,b;
	vector<pair<uint64_t,uint64_t>> d;
	cin >> n >> m;
	for(uint64_t i = 0;i < n;i++) {
		cin >> a >> b;
		d.push_back(make_pair(a,b));
	}
	sort(d.begin(),d.end());
	uint64_t c = 0,p = 0;
	auto itr = d.begin();
	while(c != m) {
		if(itr->second + c <= m) {
			c += itr->second;
			p += itr->first * itr->second;
			itr++;
		} else {
			c++;
			p += itr->first;
		}
	}
	cout << p << endl;
#ifdef _DEBUG
	system("pause");
#endif
}

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

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

int n, m;
int dp[200];
pair<int, int> data[200];

int main() {
	while (cin >> n, n) {
		REP(i, n) scanf("%d %d", &data[i].first, &data[i].second);
		cin >> m;
		FOR(i, n, n + m) scanf("%d %d", &data[i].first, &data[i].second);
		
		sort(data, data + n + m);
		fill(dp, dp + n + m, 1);
		
		REP(i, n + m) REP(j, i) {
			if (data[i].first > data[j].first && data[i].second > data[j].second) {
				dp[i] = max(dp[i], dp[j] + 1);
			}
		}
		
		int ans = -1;
		REP(i, n + m) ans = max(ans, dp[i]);
		cout << ans << endl; 
	}
	return 0;
}

Measured memory_bytes: 1244
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<unordered_map>
#include<bitset>
#include<iomanip>
#include<list>
#include<deque>
using namespace std;
//#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define END {}
#endif
typedef long long ll;
#define int ll
#define uset unordered_set
#define umap unordered_map
typedef std::pair<int,int> P;
struct edge{int to,cost;};
const int INF=100000000000000000;
const int INF2=9223372036854775807;
const int MOD=1000000007;
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define min(X,Y) (((int)(X)<(int)(Y))?(X):(Y))
#define max(X,Y) (((int)(X)>(int)(Y))?(X):(Y))
#define MAX(X,Y) (*max_element(X,Y))
#define MIN(X,Y) (*min_element(X,Y))
#define NP(X,Y) next_permutation(X,Y)
#define setp(X,Y) cout<<fixed<<setprecision(Y)<<X;
int ceil2(int a,int b){if(a%b==0){return a/b;}else{return a/b+1;}}
int pow2(int a,int b){int r=1;for(int i=1;i<=b;i++){r*=a;}return r;}
int Log2(int a){int t=0;while(1){if(a==0||a==1){break;}a/=2;t++;}return t;}

signed main(){
	int N;
	string S,T;
	cin>>N>>S>>T;
	REP(i,N){
		cout<<S[i];
		cout<<T[i];
	}
	cout<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const long long INF = 123456789;
const long long MOD = 1000000007;
const long double PI = 3.1415926;
#define FOR(i, r, n) for (ll i = (ll)(r); i < (ll)(n); i++)
#define RFOR(i, r, n) for (ll i = (ll)(n - 1); i >= r; i--)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) RFOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define RALL(x) x.rbegin(), x.rend()
typedef long long int ll;
typedef vector<ll> vi;
typedef vector<pair<ll, ll>> vp;
typedef vector<string> vs;
typedef vector<char> vc;
typedef list<ll> lst;

ll n, m, k, ans = 0, sum = 0, cnt = 0;
string s;
char c;

#define Endl endl

/*--------------------template--------------------*/

int main()
{
    ll a, b, c, d;
    cin >> a >> b >> c >> d;
    if (a + b < c + d)
    {
        cout << "Right" << endl;
    }
    else if (a + b > c + d)
    {
        cout << "Left" << endl;
    }
    else
    {
        cout << "Balanced" << endl;
    }
}

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

void change( int& x, int& y )
{
    int aux;
    aux = x;
    x = y;
    y = aux;
}
int main()
{
    int a,b,c;
    int aux;
    cin >> a >> b >> c;
    if( a > b)
    change( a, b );
    if( a > c )
    change( a , c );
    if( b > c)
    change( b ,c );
    
    cout<<a<<" "<<b<<" "<<c<<endl;

    return 0; 
}



Measured memory_bytes: 3080
S = input()
T = input()
dic = {}
for i,s in enumerate(S):
  if s not in dic:
    dic[s] = [i]
  else:
    dic[s].append(i)
#print(dic)
ind = -1
loop = 0
import bisect
for t in T:
  if t not in dic:
    ans = -1
    break
  if dic[t][-1]<=ind:
    loop += 1
    ind = dic[t][0]
  else:
    i = bisect.bisect_right(dic[t],ind)
    ind = dic[t][i]
  #print(ind)
#print(loop,ind)
else:
  ans = len(S)*loop+ind+1
          
print(ans)   

#print(*ans[1:], sep='\n')


Measured memory_bytes: 46320
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,datetime
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inpl(): return list(map(int, input().split()))
def inpl_s(): return list(input().split())

H,W = inpl()
MAP = [['.']*(W+2)]
for i in range(H):
	MAP.append(['.'] + list(input()) + ['.'])
MAP.append(['.']*(W+2))

x = y = 1
while x < W or y < H:
	ri = MAP[y][x+1]
	do = MAP[y+1][x]
	le = MAP[y][x-1]
	up = MAP[y-1][x]
	if ri == do or [ri,do,le,up].count('#')>2:
		print('Impossible')
		sys.exit()
	else:
		if ri == '#':
			x += 1
		else:
			y += 1


ri = MAP[y][x+1]
do = MAP[y+1][x]
le = MAP[y][x-1]
up = MAP[y-1][x]

if [ri,do,le,up].count('#')>=2:
	print('Impossible')
else:
	print('Possible')


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

struct Dri{
	long long A;
	long long B;
}store[100005];
bool cmp(struct Dri a, struct Dri b){
	return a.A < b.A;
}
int main(){
	int N, M;
	long long sum = 0;
	cin >> N >> M;
	for(int i = 1; i <= N; i++){
		cin >> store[i].A >> store[i].B;
	} 
	sort(store+1, store+N+1, cmp);
	int i = 1;
	for(int i = 1; i <= N; i++){
		if(M <= 0)
		break;
		if(M >= store[i].B){
			M -= store[i].B;
			sum += store[i].A * store[i].B;
		}
		else{
			sum += store[i].A * M;
			M = 0;
		}
	}
	cout << sum;
	return 0;
}


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

signed main(){
  string S,T;
  cin>>S>>T;
  string ans="No";
  rep(i,26){
    string SS=S;
    SS+=i+'a';
    if(SS==T){
      ans="Yes";
      break;
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 3604
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<iomanip>
using namespace std;

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


Measured memory_bytes: 256
#include <iostream>
using namespace std;
const int MAX = 1000000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main() {
	
 	COMinit();
	long long x,y;
  	cin >> x >> y;
  	if((2*x-y)%3 ==0 && (2*y-x)%3 == 0) {
    
    long long a = (2*x-y)/3;
    long long b = (2*y-x)/3;
      
    cout << COM(a+b, a) << endl;;
    
    
    
    } else {
    	cout << 0 << endl;
   }
}

Measured memory_bytes: 27072
/*
Created on Mon Aug 31 14:20:02 2020

@author: roastedcoder

*/
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long int ull;
const int mod = 1e9+7;
const int INF = INT_MAX;
#define endl "\n"
#define append push_back
#define roastedcoder ios_base::sync_with_stdio(false); cin.tie(NULL);
//__________________________________________________________________


int main() {
	roastedcoder
	string s; cin>>s;
	if(s[1] == 'R') {
		if(s[0] == 'R' && s[2] == 'R') cout<<3;
		else if(s[0] == 'R' || s[2] == 'R') cout<<2;
		else cout<<1;
	}
	else if(s[0] == 'R' || s[2] == 'R') cout<<1;
	else cout<<0;
}

//__________________________________________________________________
/*
Sample Input:
RRS


Sample Output:
2

*/

Measured memory_bytes: 3632
#include <string>
#include <vector>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <map>
#include <list>
#include <set>
#include <numeric>
#include <queue>
#include <stack>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <climits>
#include <cfloat>
#include <ctime>
#include <complex>
#include <cassert>
#include <array>
#include <bitset> 
#include <unordered_map>
#include <random>

using namespace std;
typedef long long LL;
typedef pair<int,int> P;

const int L=200*1000+1;
int p[L];
vector<int> edge[L];
bool done[L];
vector<int> order,order1;
void dfs(int i){
	done[i]=false;
	for(auto j:edge[i]){
		if(done[j]){
			dfs(j);
		}
	}
	order.push_back(i);
}
void dfs1(int i){
	done[i]=true;
	if(!done[p[i]]){
		dfs1(p[i]);
	}
	order1.push_back(i);
}

int a[L];
int main() {
	int N;
	scanf("%d",&N);
	for(int i=1;i<=N;i++){
		scanf("%d",p+i);
		edge[p[i]].push_back(i);
	}
	for(int i=1;i<=N;i++){
		if(!done[i]){
			dfs1(i);
		}
	}
	reverse(order1.begin(),order1.end());
	for(auto i:order1){
		if(done[i]){
			dfs(i);
		}
	}
	
	//reverse(order.begin(),order.end());
	/*
	for(auto i:order){
		cerr << i << endl;
	}
	*/
	for(int t=0;t<2;t++){
		memset(a,0,sizeof(a));
		int f=-1;
		for(auto i:order){
			vector<int> v;
			for(int k:edge[i]){
				if(a[k]==0){
					f=i;
				}
				else{
					v.push_back(a[k]);
				}
			}
			sort(v.begin(),v.end());
			int w=0;
			for(int q:v){
				if(w+1<q){
					break;
				}
				w=q;
			}
			if(f==i){
				a[i]=w+1+t;
			}
			else{
				a[i]=w+1;
			}
			//cerr << i << ": " << a[i] << endl;
		}
		//cerr << "# " << f << endl;
		if(t==0){
			if(a[f]!=a[order.back()]){
				puts("POSSIBLE");
				return 0;
			}
		}
		else{
			if(a[order.back()]+1==a[f]){
				puts("POSSIBLE");
				return 0;
			}
		}
	}
	puts("IMPOSSIBLE");

	return 0;
}



Measured memory_bytes: 21364
N, K = map(int, input().split())
h = [0] + list(map(int, input().split()))
dp = [10**10] * (N+1)
dp[0] = dp[1] = 0
for i in range(1, N+1):
    for k in range(1, K+1):
        if i + k <= N:
            dp[i+k] = min(dp[i+k], dp[i]+abs(h[i] - h[i+k]))
print(dp[N])

Measured memory_bytes: 52960
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int[] x = new int[5];
		
		for(int i=0;i<5;i++) {
			x[i] = scan.nextInt();
		}
		
		for(int j=0;j<5;j++) {
			if(x[j] == 0) {
				System.out.println(j+1);
			}
		}

	}

}


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

typedef unsigned long long ll;

ll md = 1000000007;

int main(int, char**)
{
	int n; 
	cin >> n;
	vector<int> p(n);
	for (int i = 0; i < n; ++i) {
		cin >> p[i];
	}

	sort(p.begin(), p.end());
	int x = n / 2;
	int ans = 0;
	ans = p[x] - p[x-1];
	if (ans < 0) ans = 0;
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 640
<?php

fscanf(STDIN, "%d", $n);
$A = array_map('intval', explode(' ', trim(fgets(STDIN))));

$m_cnt = 0;
$z_cnt = 0;
$m_min = PHP_INT_MAX;
$sum = 0;
for ($i = 0; $i < $n; ++$i) {
    if ($A[$i] === 0) {
        ++$z_cnt;
    } elseif($A[$i] < 0) {
        ++$m_cnt;
    }

    $sum += abs($A[$i]);

    $m_min = min($m_min, abs($A[$i]));
}

if ($m_cnt % 2 === 0) {
    echo $sum;
} else {
    if ($z_cnt !== 0) {
        echo $sum;
    } else {
        echo $sum - 2 * $m_min;
    }
}


Measured memory_bytes: 16884
package main

import (
	"fmt"
	"sort"
)

func main() {
	var n, sum int
	fmt.Scan(&n)
	a := make([]int, n)

	for i := range a {
		fmt.Scan(&a[i])
	}
	sort.Ints(a)
	for _, v := range a {
		sum += v
	}
	fmt.Printf("%d %d %d\n", a[0], a[n-1], sum)
}


Measured memory_bytes: 1788
using System;
using System.Collections.Generic;
class Solve{
    int N;
    long[] a;
    public Solve(){}
    public static int Main(){
        new Solve().Calc();
        return 0;
    }
    void Calc(){
        getinput();
        long count = 0;
        long d = 0;
        for(int i=0;i<N;i++){
            if(a[i] <= d){
                count += a[i];
                d = 0;
            }
            else{
                count += d + (a[i] - d) / 2;
                d = (a[i] - d) % 2; 
            }
        }
        Console.WriteLine(count);
    }
    void getinput(){
        N = int.Parse(Console.ReadLine());
        a = new long[N];
        for(int i=0;i<N;i++){
            a[i] = Int64.Parse(Console.ReadLine());
        }
    }    
}

Measured memory_bytes: 7512