akhauriyash/Code-Regression huggingface dataset:
#include<algorithm>
#include<iostream>
#include<cstring>
#include<cstdio>
#include<string>
#include<cmath>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<vector>
#include<complex>
#include<iomanip>
#include<unordered_map>
#define deg(x) cerr<<#x<<"="<<x<<endl;
#define fd(x) for(int i=0;i<x;i++)
#define fdd(a,x) for(int i=a;i<x;i++)
#define fx(x,n) for(int i=n-1;i>=x;i--)
#define mst(x) memset(x,0,sizeof(x));
#define fi first
#define se second
#define TB ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
#define ok "ok"
#define HH puts("");
#define ls rt<<1
#define rs rt<<1|1
#define pb(a,b) a.push_back(b);
#define FIN  freopen("1.in","r",stdin);
#define FOUT freopen("1.out","w",stdout);
using namespace std;
typedef long long ll;typedef long long LL;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<string,int> pss;
typedef unsigned long long ull;
const ll mod=1e9+7;
const int inf=1e9+7;
const double eps=1e-6;
ll qpow(ll a,ll b,ll m){ ll r=1;a%=m;for(;b;b>>=1){if(b&1)r=r*a%m;a=a*a%m;}return (r+m)%m;}
const double pi=acos(-1);

int t[501020],a[501020],lst[501020],ans[501020];
vector<pair<pii,int>> ve;
int n,q;

bool cmp(pii u,pii v){
	if(u.se==v.se)return u.fi<v.fi;
	return u.se<v.se;
}

int lowbit(int x){ return x&-x; }
void add(int p,int x){ while(p<=n){ t[p]+=x;p+=lowbit(p); } }
int qsum(int p){ int r=0;while(p){ r+=t[p];p-=lowbit(p); }return r; }

int main(){
	TB
	cin>>n>>q;
	for(int i=1;i<=n;i++)cin>>a[i];
	for(int i=1;i<=q;i++){
		int l,r;cin>>l>>r;
		ve.push_back(pair<pii,int>(pii(r,l),i));
	}
	sort(ve.begin(),ve.end());
	int p=0;
	for(int i=1;i<=n&&p<q;i++){
		if(lst[a[i]])add(lst[a[i]],-1);
		add(i,1);
		lst[a[i]]=i;
		while(ve[p].fi.fi<=i&&p<q){
			// dbg(ve[p].se);
			ans[ve[p].se]=qsum(ve[p].fi.fi)-qsum(ve[p].fi.se-1);
			p++;
		}
	}
	for(int i=1;i<=q;i++)cout<<ans[i]<<endl;
	return 0;
}


Measured memory_bytes: 17548
using System;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {

            string str = Console.ReadLine();

            string[] str2 = str.Split(' ');

            int a = int.Parse(str2[0]);
            int b = int.Parse(str2[1]);
            int c = int.Parse(str2[2]);

            if (a < b && b < c)
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }

        }
    }
}



Measured memory_bytes: 15940
#include<stdio.h>
int main(void)
{
	int n,x;
	scanf("%d",&n);
	x=1;
	while(n>x) x*=2;
	if(x==n) printf("%d\n",x);
	else if(x!=1) printf("%d\n",x/2);
	else printf("1\n");
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ll long long
#define ld long double
#define all(a) (a).begin(),(a).end()
#define mk make_pair
ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=100000000000000000;


int main() {
    ll n;
    string s;
    cin >> n >> s;
    reverse(s.begin(),s.end());
    vector<ll> a(0);
    rep(i,n-1){
        if ((n-i-1)%((i+1)*2)==0) a.push_back(i+1);
    }
    ll ans=0,m=1;
    rep(i,s.size()){
        if (s[i]=='1') (ans+=m)%=mod;
        (m*=2)%=mod;
    }
    (ans+=1)%=mod;
    (ans*=(n*2))%=mod;
    reverse(s.begin(),s.end());
    vector<ll> h(a.size());
    rep(i,a.size()){
        // cout << o << endl;
        ll p=0,mm=1;
        rep(j,a[i]){
            if (s[a[i]-1-j]=='1') (p+=mm)%=mod;
            (mm*=2)%=mod;
        }
        // cout << nn << endl;
        bool r=true;
        int rr=0;
        for (int j=a[i];j<n;j++){
            if (j%a[i]==0) rr=1-rr;
            int f=s[j]-'0',g=s[j%a[i]]-'0';
            if (rr) g=1-g;
            if (f>g) break;
            if (g>f) {
                r=false;
                break;
            }
        }
        if (r) p=(p+1)%mod;
        rep(j,i){
            if (a[i]%a[j]==0) p=(p+mod-h[j])%mod;
        }
        h[i]=p;
        // cout << p << endl;
        ll w=(p*a[i]*2)%mod;
        ans=(ans+mod-(p*n*2-w)%mod)%mod;
        // cout << w << endl;
    }
    cout << ans << endl;
}


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

using namespace std;

int main()
{
    ios_base::sync_with_stdio(0);
    vector<int> a(3);
    cin >> a[0] >> a[1] >> a[2];
    sort(a.begin(), a.end());
    if (a[0] == 5 && a[1] == 5 && a[2] == 7)
        cout << "YES";
    else
        cout << "NO";
    return 0;
}


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

/// read the question correctly (is y a vowel?)
/// look out for SPECIAL CASES (n=1?) and overflow (ll vs int?)

const int mx =  1234567;
const double exp1 =  1e-6;
const int md =  1e9+7;
typedef long long ll;

int ar[mx],xar[mx],uses[mx];
ll arr[mx];
int tab[1000][1000];
string st[1000];
int ar1[mx],ar2[mx];
map<int ,int>mpii;
map<int ,char>mpic;
map<char ,int>mpci;

int main(){

    int tk=1,n,m=0;
//    freopen("in.txt","r", stdin);
//    freopen("out.txt","w", stdout);
    while(scanf("%d",&n) == 1){
        int f = 1;
        for(int i = 0; i < n; i++){
            scanf("%d",ar + i);
            if(ar[i] % 2 == 0){
                if(ar[i] % 5 == 0 || ar[i] % 3 ==0){
                    continue;
                }else f = 0;
            }
        }
    if(f == 1){
        cout<<"APPROVED"<<endl;
        continue;
    }
    cout<<"DENIED"<<endl;
    }

    return 0;
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define mod ((ll)(1e9) + 7LL)

int main(){
	ll n;
	cin >> n;
	ll ar[n],prefix[n];
	for(ll i = 0;i < n;i++){
		cin >> ar[i];
		prefix[i] = ar[i];
	}
	for(ll i = 1;i < n;i++){
		prefix[i] += prefix[i-1];
		prefix[i] %= mod;
	}
	ll ans = 0;
	for(ll i = 0;i < n-1;i++){
		ans += ((ar[i] % mod) * (prefix[n-1] - prefix[i] + mod)) % mod;
		ans %= mod;
	}
	cout<<ans;
}

Measured memory_bytes: 6720
#include<stdio.h>
int main(void){
	int a[4][3][10]={0},b,f,r,v,n,i,j,k;

	scanf("%d",&n);
	while(n){
		scanf("%d %d %d %d",&b,&f,&r,&v);
		a[b-1][f-1][r-1]+=v;
		n--;
	}
	for(i=1;i<=4;i++){
		for(j=1;j<=3;j++){
			for(k=1;k<=10;k++){
				printf(" %d",a[i-1][j-1][k-1]);
			}
			printf("\n");
		}
		if(i<4){
			printf("####################\n");
		}
	}
return 0;
}

Measured memory_bytes: 612
#include <iostream>
#include <vector>

using namespace std;

int main(void) {
	int A,B,K;
	cin >> A >> B >> K;
	vector<int> memo;
	for (int i = 1; i <= min(A,B); ++i) {
		if (A%i == 0 && B%i == 0) {
			memo.push_back(i);
		}
	}
	cout << memo[memo.size()-K] << endl;
	return 0;
}



Measured memory_bytes: 256
n, m = gets.split.map(&:to_i)
ab = m.times.map { gets.split.map(&:to_i) }

sab = ab.sort_by(&:last)
r = sab[0].last
count = 1
1.upto(m - 1) do |i|
  if sab[i].first >= r
    count += 1
    r = sab[i].last
  end
end
puts count


Measured memory_bytes: 12664
#include<bits/stdc++.h>
#define LL long long
#define M 1000000007
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;

int main()
{
	fastio;
	int n, ans=0;
	cin>>n;
	string s;
	cin>>s;
	for(int i=0;i<s.size()-1; i++){
		if(s[i]!=s[i+1])
			ans++;
	}
	cout<<ans+1<<endl;
	return 0;
}

Measured memory_bytes: 512
'use strict';
const main = input => {
  input = input[0].split(' ').map(val => parseInt(val));
  const a = input[0], b = input[1], x = input[2];
  if (x/a <= a*b/2) {
    console.log(Math.atan(a * b * b / 2 / x) * 180 / Math.PI);
  } else {
    console.log(90-(Math.atan(a * a * a / 2 / (a * a * b - x)) * 180 / Math.PI));
    
  }
  
}
main(require("fs").readFileSync("/dev/stdin", "utf8").split('\n'));

Measured memory_bytes: 7372
/*https://atcoder.jp/contests/abc059/tasks/abc059_b*/
#include<bits/stdc++.h>
using namespace std;
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
#ifndef ONLINE_JUDGE
	// for getting input from input.txt
	freopen("input.txt", "r", stdin);
	// for writing output to output.txt
	freopen("output.txt", "w", stdout);
#endif
	// long long m = 1e9;
	string a, b;
	cin >> a >> b;
	// a % m, b % m;
	if (a.length() != b.length())
	{
		if (a.length() > b.length())
			cout << "GREATER";
		else if (a.length() < b.length())
			cout << "LESS";
	}
	else if (a.length() == b.length())
	{
		if (a > b)
			cout << "GREATER";
		else if (a < b)
			cout << "LESS";
		else if (a == b)
			cout << "EQUAL";
	}
}

Measured memory_bytes: 3548
#[allow(unused_macros)]
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)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

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

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

#[allow(unused_macros)]
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, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

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

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

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

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

fn main() {
    input! {
        x: usize,
    }
    let mut nums = vec![1];
    let mut b = 2;
    while b * b <= x {
        let mut c = b * b;
        while c <= x {
            nums.push(c);
            c *= b;
        }
        b += 1;
    }
    nums.sort();
    println!("{}", nums[nums.len() - 1]);
}


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


int main(){
  int N;
  cin >> N;
  vector<int> D(N);
  for(auto& d : D){
    cin >> d;
  }
  sort(D.begin(), D.end());
  D.erase(unique(D.begin(), D.end()), D.end());
  cout << D.size() << endl;
  return 0;
}

Measured memory_bytes: 256
import java.io.IOException;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws IOException {

		Scanner sc = new Scanner(System.in);

		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();

		if ((a * 100 + b * 10 + c) % 4 == 0) {

			System.out.println("YES");

		} else {

			System.out.println("NO");

		}
	}
}


Measured memory_bytes: 23892
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#define maxn 1000005
#define ll long long
using namespace std;
ll map[maxn];
int dx[9]={0,-1,-2,0,0,-1,-1,-2,-2};
int dy[9]={0,0,0,-1,-2,-1,-2,-1,-2};
ll ans;
ll h,w;
ll result[20];
int n;
int sum;
int main()
{ while(~scanf("%lld%lld%d",&h,&w,&n))
    {ll x,y;
    sum=0;
    ans=(h-2)*(w-2);
    memset(map,0,sizeof(map));
    memset(result,0,sizeof(result));
        for(int i=1;i<=n;i++)
    {scanf("%lld%lld",&x,&y);
for(int j=0;j<9;j++)
{
    ll xx=x+dx[j];
    ll yy=y+dy[j];
    if(xx>=1&&xx<=h-2&&yy>=1&&yy<=w-2)
    map[sum++]=(xx-1)*w+yy;
    }
    }

    sort(map,map+sum);


    int cnt=1;
    map[sum]=-1;
    for(int i=0;i<sum;i++)
    {
        if(map[i]==map[i+1])
    {
        cnt++;

    }
    else
    {
        result[cnt]++;
        cnt=1;
        ans-=1;
    }

}
printf("%lld\n",ans);
for(int i=1;i<=9;i++)
    printf("%lld\n",result[i]);
    }
return 0;
    }


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

int main(){
    int a, b;
    string s;
    cin >> a >> b;
    cin >> s;
    vector<char> num{'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'};
    if(s.at(a) == '-'){
        vector<bool> judge2  (s.size(), false);
        judge2.at(a) = true;
        for(int i = 0;i < s.size();i++){
            for(int j = 0;j <  num.size();j++){
                if(i == a)continue;
                else if(s.at(i) == num.at(j))judge2.at(i) = true;
            }
        }
        bool judge = true;
        for(int i = 0;i < judge2.size();i++){
            if(!judge2.at(i))judge = false;
        }
        if(judge)cout << "Yes" << endl;
        else cout << "No" << endl;
    }
    else cout << "No" << endl;
}

Measured memory_bytes: 3608
#include <stdio.h>
#include <algorithm>
#include <iostream>
#include <stack>
#include <vector>
#include <math.h>

using namespace std;

struct Point{
	bool operator<(const struct Point &arg) const{
		if(y != arg.y)return y < arg.y;
		return x < arg.x;
	};
	double x,y;
};

//true?????????
bool calcGaiseki(Point left,Point base, Point right){
	double gaiseki = (left.x-base.x)*(right.y - base.y)-(left.y-base.y)*(right.x-base.x);
	if(gaiseki < -0.00000001)return false;
	else{
		return true;
	}
}

int main(){

	vector<Point> V,UP,DOWN;

	int n;
	double x,y;

	scanf("%d",&n);

	for(int i = 0; i < n; i++){
		scanf("%lf %lf",&x,&y);
		V.push_back(Point());
		V[i].x = x;
		V[i].y = y;
	}

	sort(V.begin(),V.end());

	UP.push_back(V[0]);
	UP.push_back(V[1]);

	DOWN.push_back(V[V.size()-1]);
	DOWN.push_back(V[V.size()-2]);

	for(int i = 2; i < V.size(); i++){
		while(UP.size() > 1 && calcGaiseki(UP[UP.size()-2],UP[UP.size()-1],V[i]) == false)UP.pop_back();
		UP.push_back(V[i]);
	}

	for(int i = V.size()-3; i >= 0; i--){
		while(DOWN.size() > 1 && calcGaiseki(DOWN[DOWN.size()-2],DOWN[DOWN.size()-1],V[i]) == false){
			DOWN.pop_back();
		}
		DOWN.push_back(V[i]);
	}

	printf("%d\n",UP.size()+DOWN.size()-2);
	for(int i = DOWN.size()-1; i >= 1;i--)printf("%.0lf %.0lf\n",DOWN[i].x,DOWN[i].y);
	for(int i = UP.size()-1; i >= 1 ;i--)printf("%.0lf %.0lf\n",UP[i].x,UP[i].y);

}



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

using namespace std;

template<typename S, typename T>
ostream& operator<<(ostream& out, const pair<S, T> p) {
    out << "(" << p.first << "," << p.second << ")";
    return out;
}

template<typename T>
ostream& operator<<(ostream& out, const vector<T>& v) {
    for (auto a: v)
        out << a << " ";
    return out;
}

template<typename T>
ostream& operator<<(ostream& out, const set<T>& S) {
    for (auto a: S)
        cout << a << " ";
    return out;
}

template<typename T>
ostream& operator<<(ostream& out, const multiset<T>& S) {
    for (auto a: S)
        cout << a << " ";
    return out;
}

template<typename S, typename T>
ostream& operator<<(ostream& out, const map<S, T>& M) {
    for (auto m: M)
        cout << "(" << m.first << "->" << m.second << ") ";
    return out;
}

template<typename S, typename T>
pair<S, T> operator+(pair<S, T> a, pair<S, T> b) {
    return make_pair(a.first + b.first, a.second + b.second);
}

template<typename S, typename T>
pair<S, T> operator-(pair<S, T> a, pair<S, T> b) {
    return make_pair(a.first - b.first, a.second - b.second);
}

int solve(string& str) {
    int n = str.size();
    vector<int> A;
    A.assign(n, 0);
    for (int i = 0; i < n; i++) {
        if (str[i] == 'A' || str[i] == 'C' || str[i] == 'G' || str[i] == 'T') {
            A[i] = 1;
        }
    }
    for (int i = 0; i < n; i++) {
        if (i && A[i]) {
            A[i] += A[i-1];
        }
    }
    return *max_element(A.begin(), A.end());
}

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    string str;
    cin >> str;
    cout << solve(str) << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll; 
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main(){
    int k;
    string s;
    cin >> k >> s;
    if(s.length()<=k)cout << s << endl;
    else if(s.length()>k) {
        string ans;
        for(int i=0;i<k;i++){
            ans.push_back(s[i]);
        }
        ans+="...";
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 3576
#include <cstdio>
#include <algorithm>

using namespace std;

char s[2];
int b[2000];
int w[2000];
int bb[4000][2001];
int ww[4000][2001];
int dp[2001][2001];

int main() {
    int n, i, j;
    
    scanf("%d", &n);
    
    for (i = 0; i < n * 2; i++) {
        int x;
        
        scanf("%s %d", s, &x);
        
        x--;
        
        if (s[0] == 'B') {
            b[x] = i;
        } else {
            w[x] = i;
        }
    }
    
    for (i = 0; i < n; i++) {
        for (j = 0; j <= i; j++) {
            bb[b[i]][j] = 1;
            ww[w[i]][j] = 1;
        }
    }
    
    for (i = 1; i < n * 2; i++) {
        for (j = 0; j < n; j++) {
            bb[i][j] += bb[i - 1][j];
            ww[i][j] += ww[i - 1][j];
        }
    }
    
    for (i = 0; i <= n; i++) {
        for (j = 0; j <= n; j++) {
            dp[i][j] = 1e9;
        }
    }
    
    dp[0][0] = 0;
    
    for (i = 0; i <= n; i++) {
        for (j = 0; j <= n; j++) {
            if (i < n) dp[i + 1][j] = min(dp[i + 1][j], dp[i][j] + bb[b[i]][i + 1] + ww[b[i]][j]);
            if (j < n) dp[i][j + 1] = min(dp[i][j + 1], dp[i][j] + bb[w[j]][i] + ww[w[j]][j + 1]);
        }
    }
    
    printf("%d\n", dp[n][n]);
    
    return 0;
}


Measured memory_bytes: 78336
#include <cstdio>
#include <vector>
using namespace std;
typedef long long LL;
const int N = 1e5 + 5;
vector <int> G[N];
LL val[N], sum[N];
int deg[N];
int n, flag;
LL dfs(int o, int f){
	LL tmp, mx = -1;
	for(int i = 0; i < G[o].size(); i ++){
		if(G[o][i] == f) continue;
		tmp = dfs(G[o][i], o);
		mx = mx > tmp ? mx : tmp;
		sum[o] += tmp;
	}
	if(deg[o] == 1){
		if(val[o] < sum[o]) flag = 0;
		return val[o] - sum[o];
	}else{
		if(2*val[o] < sum[o]) flag = 0;
		mx = mx > (2*val[o] - sum[o]) ? mx : (2*val[o] - sum[o]);
		if(mx > val[o]) flag = 0;
		return 2*val[o] - sum[o];
	}
}
int main(){
	scanf("%d", &n);
	for(int i = 1; i <= n; i ++) scanf("%I64d", &val[i]);
	for(int i = 1, u, v; i < n; i ++){
		scanf("%d%d", &u, &v);
		G[u].push_back(v);
		G[v].push_back(u);
		deg[u] ++;
		deg[v] ++;
	}
	flag = 1;
	if(dfs(1, -1) != 0) flag = 0;
	puts(flag?"YES":"NO");
}

Measured memory_bytes: 14336
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <tuple>
#include <cstdio>
#include <cmath>
#define rep(i, n) for(i = 0; i < n; i++)
using namespace std;

signed main() {
	int d, t, s;
	cin >> d >> t >> s;
	if (d <= t * s) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using tlll=tuple<ll,ll,ll>;
using vs=vector<string>;

#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define range(i,a,n) for(int i=(a);i<(n);i++)

#define LINF ((ll)1ll<<60)
#define INF ((int)1<<30)
#define EPS (1e-9)
#define MOD (1000000007ll)
#define fcout(a) cout<<setprecision(a)<<fixed
#define fs first
#define sc second
#define PI 3.1415926535897932384

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

template<class T>bool chmax(T&a,T b){if(a<b){a=b; return true;}return false;}
template<class T>bool chmin(T&a,T b){if(a>b){a=b; return true;}return false;}
template<class S>S acm(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
void YN(bool b){cout<<(b?"YES":"NO")<<"\n";}
void Yn(bool b){cout<<(b?"Yes":"No")<<"\n";}
void yn(bool b){cout<<(b?"yes":"no")<<"\n";}

ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
template<class T>void puta(T&&t){cout<<t<<"\n";}
template<class H,class...T>void puta(H&&h,T&&...t){cout<<h<<' ';puta(t...);}
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1; for(auto s:t){os<<(a?"":" ")<<s;a=0;} return os;}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int a,b,c;
	cin>>a>>b>>c;
	rep(i,70){
		int time=60*i+c;
		if(time%(a+b)<=a){
			cout<<time<<endl;
			return 0;
		}
	}
	cout<<-1<<endl;
}


Measured memory_bytes: 3192
#include<bits/stdc++.h>
#define ll long long
#define rep(i,l,r) for(int (i)=(l);(i)<(r);i++)
#define erep(i,l,r) for(int (i)=(l);(i)<=(r);i++)
#define MOD 1000000007
using namespace std;
int main(){
    cout.precision(10);
    ll n,k;
    cin>>n>>k;
    vector<ll> p(n);
    vector<double> e(n);
    rep(i,0,n){
        cin>>p[i];
        e[i]=(double)(p[i]*(1+p[i]))/(2*p[i]);
        //cout<<e[i]<<endl;
    }
    
    double ans=0;
    rep(i,0,k){
        ans+=e[i];
    }
    double buf=ans;
    rep(j,0,n-k){
        ans=max(ans,buf); 
        buf-=e[j];
        buf+=e[j+k];  
    }
    ans=max(ans,buf);
    cout<<ans<<endl;
}

Measured memory_bytes: 3328
a,b,c=map(int,input().split())
lists=[a,b,c]
ans=0
lists=sorted(lists)
if lists[0]%2==lists[1]%2:
    ans+=(lists[1]-lists[0])//2
    ans+=lists[2]-lists[1]
    print(ans)
else:
    ans+=1
    lists[0]+=1
    lists[2]+=1
    ans+=(lists[1]-lists[0])//2
    ans+=lists[2]-lists[1]
    print(ans)

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

int main(){
    int n;
    cin >> n;
    int a[n],b[n];
    for(int i =0 ;i<n;i++)cin >> a[i];
    for(int i=0;i<n;i++)cin >> b[i];
    int count=0;
    for(int i=0;i<n;i++){
        if(a[i]>b[i])count=count+a[i]-b[i];
    }
    cout << count << endl;
}

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

int main(){
  int a, b;
  cin >> a >> b;
  rep(i, 100)
    rep(j, 100){
      if(i + j == a)
        if(2 * i + 4 * j == b){
          cout << "Yes" << endl;
          return(0);    
        }
    }
  cout << "No" << endl;
}


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

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

int main() {
	int a, b;
	cin >> a >> b;
	if (a > b) cout << "a > b" << endl;
	else if (a < b) cout << "a < b" << endl;
	else if (a == b) cout << "a == b" << endl;

	return 0;
}


Measured memory_bytes: 3100
#include <bits/stdc++.h>
#define rep(i, n) for(ll i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
const double PI=acos(-1);

int main(){ 
    ll w, h, n;
    cin >> w >> h >> n;
    ll w1 = 0, w2 = w, h1 = 0, h2 = h;
    rep(i, n){
        ll x, y, a;
        cin >> x >> y >> a;

        if(a == 1) w1 = max(w1, x);
        else if(a == 2) w2  = min(w2, x);
        else if(a == 3) h1 = max(h1, y);
        else h2 = min(h2, y);
    }
    if(w1 >= w2 || h1 >= h2) cout << 0 << endl;
    else{
        ll ans = (w2-w1)*(h2-h1);
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>

int main(void)
{
	char s[128];
	int conv[256];
	int val[7] = {1, 5, 10, 50, 100, 500, 1000};
	int len;
	int res;
	int i;
	
	for (i = 0; i < 7; i++){
		conv["IVXLCDM"[i]] = i;
	}
	
	while (scanf("%s", s) != EOF){
		res = 0;
		len = strlen(s);
		for (i = 0; i < len; i++){
			if (i < len - 1 && conv[s[i]] < conv[s[i + 1]]){
				res -= val[conv[s[i]]];
			}
			else {
				res += val[conv[s[i]]];
			}
		}
		printf("%d\n", res);
	}
	
	return (0);
}

Measured memory_bytes: 540
# -*- coding:utf-8 -*-
if __name__ == "__main__":
    import sys
    dp = [0.0] * 100001
    dp[1] = 1.0
    for i in xrange(2, 100001):
        p = 1.0
        w = 0.5
        for j in xrange(1,i):
            if p < 1e-13:
                break
            dp[i] += (p*(1-w))*(j+dp[max(0,i-j-1)])
            p *= w
            w *= 0.5
        dp[i] += i*p
    while True:
        N = int(raw_input())
        if N == 0:
            sys.exit()
        print "%.8f" % dp[N]

Measured memory_bytes: 9284
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef pair<int, int> P;
typedef long long ll;
map<char, ll> m;
int main(){
    int n;
    cin >> n;
    rep(i,n){
        string s;
        cin >> s;
        m[s[0]]++;
    }
    vector<ll> v(5);
    v[0] = m['M'];
    v[1] = m['A'];
    v[2] = m['R'];
    v[3] = m['C'];
    v[4] = m['H'];
    ll res = 0;
    rep(i,1<<5){
        int cnt = 0;
        ll tmp = 1;
        rep(j,5){
            if(i&(1<<j)){
                cnt++;
                tmp*=v[j];
            }
        }
        if (cnt == 3)
        {
            res += tmp;
        }
    }
    cout <<res << endl;
    return 0;
}

Measured memory_bytes: 256
while True:
    (m,f,r) = [int(i) for i in input().split()]
    if m == f == r == -1:
        break

    mf = m + f
    if m == -1 or f == -1 or mf < 30:
        print('F')
    elif mf < 50 and r < 50:
        print('D')
    elif mf < 65:
        print('C')
    elif mf < 80:
        print('B')
    else:
        print('A')
    

Measured memory_bytes: 6724
#include<cstdio>
#include<cmath>
#define ll long long
int main()
{
	ll a,b,c;
	scanf("%lld%lld%lld",&a,&b,&c);
	c-=(a+b);
	ll sq=sqrtl(4*a*b);
	if(c>sq)
		printf("Yes");
	else
		printf("No");
	
	return 0;
}

Measured memory_bytes: 128
#include<iostream>
using namespace std;
int n,q;
int arr[55];
bool Find(int x,int i)
{
    if(x==0)return true;
    if(i>=n)return false;
    return Find(x,i+1)||Find(x-arr[i],i+1);
}
int main()
{
    cin>>n;
    for(int i=0;i<n;i++)cin>>arr[i];
    cin>>q;
    while(q--)
    {
        int a;
        cin>>a;
        if(Find(a,0))cout<<"yes"<<endl;
        else cout<<"no"<<endl;
    }
    return 0;
}



Measured memory_bytes: 3100
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		String n = scanner.next();
		int sum = 0;
		for(int i=0;i<n.length();i++){
			sum += Character.getNumericValue(n.charAt(i));
		}
		if(Integer.parseInt(n) % sum == 0){
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}
	}
}


Measured memory_bytes: 21844
/**
*	Author: Apoorva Mittal
*	
**/
#include <bits/stdc++.h>
using namespace std;

#define int long long
#define endl "\n"
#define nl   "\n"
#define vi vector<int>
#define vvi vector<vector<int>>
#define vii vector<pair<int, int>>
#define rep(i, a, b) for (int i = a; i < b; i++)
#define repD(i, a, b) for (int i = a; i >= b; i--)
#define speed                     \
    ios_base::sync_with_stdio(0); \
    cin.tie(0);                   \
    cout.tie(0)
#define init(i, k) memset(i, k, sizeof i)
#define pb push_back
#define pii pair<int, int>
#define ff first
#define ss second
#define all(a) a.begin(), a.end()
#define inp(a) rep(i,0,a.size()) cin>>a[i]; 
#define out(a) rep(i,0,a.size()) cout<<a[i]<<" "; \
                cout<<endl;
#define out2d(a)    \
    rep(i,0,a.size())\
    {rep(j,0,a[0].size())\
    cout<<a[i][j]<<" ";\
    cout<<endl;}      
#define flush			fflush(stdout);
#define lb              lower_bound
#define ub              upper_bound
#define maxe            *max_element
#define mine            *min_element
#define umap            unordered_map
#define uset            unordered_set
#define mset            multiset
#define pqueue          priority_queue
#define precise(x) 		cout<<fixed<<showpoint<<setprecision(x);
#define setbit(x)       __builtin_popcountll(x)
#define gcd(a,b)        __gcd(a,b)
#define deb(x) cout<<#x<<" "<<x<<endl;
#define Y				"YES"
#define N 				"NO"
const int mod = 1e9 + 7;
struct HASH{ 
  // unordered_map<pair<int,int>,int,HASH>m;
  size_t operator()(const pair<int,int>&x)const{
    return hash<long long>()(((long long)x.first)^(((long long)x.second)<<32));
  }
};
int lcm(int a, int b) { return (a * (b / __gcd(a, b))); }
int ncr(int n,int r){int res=1;if(r>n)return 0;if(r>n-r)r=n-r;for(int i=0;i<r;i++){res*=(n-i);res/=(i+1);}return res;}
// ====== Useful functions begin ======
inline int add(int a,int b) {return ((a%mod)+(b%mod))%mod;}
inline int sub(int a,int b) {return ((a%mod)-(b%mod)+mod)%mod;}
inline int mul(int a,int b) {return ((a%mod)*(b%mod))%mod;}
// ====== Useful functions end ======
int pwr(int x,int n){
    if(!n) return 1;
    if(n&1) return mul(x, pwr(mul(x,x),(n-1)/2));
    else return pwr(mul(x,x),n/2);
}
int modinv(int n){ 
    return pwr(n,mod - 2); 
}
const int inf = 1e18;
const int maxn = 1e3 + 5;

//--------------------------------------------------------------------------------------------------------------------------------

//--------------------------------------------------------------------------------------------------------------------------------


void solve()
{
    int r;cin>>r;
    double ans = 2*M_PI*r;
    precise(3)
    cout<<ans<<endl;

}
signed main()
{	
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);

	speed;
	int t=1;
	// cin>>t;
	
	for(int tt=1;tt<=t;tt++)
	{
		// cout<<"Case #"<<tt<<": ";
		solve();
	}
}


Measured memory_bytes: 3804
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = Integer.parseInt(in.next());
		int m = Integer.parseInt(in.next());
		int all = (n + m) * (m + n - 1) / 2;
		int odd = n * m;
		int even = all - odd;
		
		System.out.println(even);
	}
}	

Measured memory_bytes: 22868
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; i++)
using namespace std;
int main() {
    int h, a; cin >> h >> a;
    int ans = h / a;
    if (h % a != 0) ans++;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
from collections import deque
n, m = map(int, input().split())
graph = [[] for _ in range(n+1)]

for i in range(m):
  a, b = map(int, input().split())
  graph[a].append(b)
  graph[b].append(a)

#print(graph)

dist = [-1] * (n+1)
dist[0] = 0
dist[1] = 0

d = deque()
d.append(1)

while d: #dの中が空になるまで続ける
  v = d.popleft()#一番最初に入れたものから探索する。
  for i in graph[v]:#vから行けるところを探索。例v=1,i=2, v=2,i=1,3,4
    if dist[i] != -1: #iが未訪問でなければ（=訪問済みであれば）
      continue#何もしない
    dist[i]=v#一個前の探索地点を入れる（一個前がほしいとき）  
#    dist[i] = dist[v] + 1#iのdistにv＋1したものを追加（原点からの距離がほしいとき）
    d.append(i)#訪問リストにiを追加

#print(graph)
#print(dist)
print('Yes')
[print(dist[i]) for i in range(2,n+1)]

Measured memory_bytes: 34904
N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
count=0
for i in range(N):
    count+=min(A[i],B[i])
    if A[i]<B[i]:
        if A[i+1]>B[i]-A[i]:
            count += B[i] - A[i]
            A[i + 1] -= B[i] - A[i]
        else:
            count += A[i + 1]
            A[i + 1] = 0
print(count)

Measured memory_bytes: 18624
#include <bits/stdc++.h>
#include <numeric>
typedef long long Int;
#define rep(i,a,b) for(Int i=a;i<b;++i)
#define rrep(i,a,b) for(Int i=a;i>=b;--i)
using namespace std;

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

    Int N; cin >> N;
    vector<pair<Int, Int>> tasks(N);
    rep(i, 0, N) cin >> tasks[i].second >> tasks[i].first;

    sort(tasks.begin(), tasks.end());

    Int now = 0;

    rep(i, 0, N) {
        now += tasks[i].second;
        if (now > tasks[i].first) {
            cout << "No" << endl;
            return 0;
        }
    }

    cout << "Yes" << endl;
}

Measured memory_bytes: 3456
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace AizuOnline
{
    internal class Program
    {
        private static void Main(string[] args)
        {
            var n = Console.ReadLine().Split().Select(i => int.Parse(i)).ToArray();
            var H = n[0]; var W = n[1];

            var hw = new int[H, W];
            foreach (var h in Enumerable.Range(0, H))
            {
                var m = Console.ReadLine().Split().Select(i => int.Parse(i)).ToArray();
                for (int w = 0; w < m.Length; w++)
                {
                    hw[h, w] = m[w];
                }
            }

            var dp = new int[H, W];
            for (int i = 0; i < H; i++)
            {
                for (int j = 0; j < W; j++)
                {
                    if (hw[i, j] == 1)
                    {
                        dp[i, j] = 0;
                    }
                    else
                    {
                        if (i == 0 || j == 0)
                        {
                            dp[i, j] = 1;
                        }
                        else
                        {
                            dp[i, j] = Math.Min(dp[i, j - 1],
                                Math.Min(dp[i - 1, j - 1], dp[i - 1, j])) + 1;
                        }
                    }
                }
            }

            var max = int.MinValue;
            for (int i = 0; i < H; i++)
            {
                for (int j = 0; j < W; j++)
                {
                    max = Math.Max(dp[i, j], max);
                }
            }

            Console.WriteLine(max * max);
            Console.ReadLine();
        }
    }
}

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

int main()
{
    int n;
    cin >> n;
    vector<int> d(n);
    rep(n) cin >> d[i];

    sort(d.begin(), d.end());
    cout << d[n / 2] - d[n / 2 - 1] << endl;
}

Measured memory_bytes: 640
#include<iostream>
#include<iomanip>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<vector>
#include<cctype>
using namespace std;
int n,m;
inline void product(){puts((((!n)||(!m)||((n>0)&&(m<0))||((n<0)&&(m>0)))?("Zero"):(((n>0)&&(m>0))?("Positive"):(((abs(n-m))&1)?("Positive"):("Negative")))));return;}
int main()
{
	scanf("%d%d",&n,&m);
	product();
	return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String[] str = sc.nextLine().split(" ");
    for(int i = 0; i < str.length; i++) {
      String[] word = str[i].split("");
      String s = "";
      for(int j = 0; j < word.length; j++) {
        if(word[j].matches("[a-z]")) {
          s += word[j].toUpperCase();
        } else if(word[j].matches("[A-Z]")) {
          s += word[j].toLowerCase();
        } else {
          s += word[j];
        }
      }
      str[i] = s;
      if(i == str.length - 1) {
        System.out.println(str[i]);
      } else {
        System.out.print(str[i] + " ");
      }
    }
  }
}



Measured memory_bytes: 30648
#include <bits/stdc++.h>
#define rep(i, x, N) for (int i = x; i < (N); i++)
using namespace std;
long long gcd(long long a, long long b)
{
    if (a % b == 0)
    {
        return (b);
    }
    else
    {
        return (gcd(b, a % b));
    }
}
int main()
{
    long long A, B, G;
    cin >> A >> B;
    G = gcd(A, B);
    cout << A * B / G << endl;
}


Measured memory_bytes: 256
n = int(input())
s = ''
for i in range(1, n + 1):
    if i % 3 == 0:
        s += ' %d' % i
        continue
    
    j = i
    while j != 0:
        if j % 10 == 3:
            s += ' %d' % i
            break
        j = j // 10
    
print(s)

Measured memory_bytes: 7716
#include <iostream>
#include <string>
#define LL long long

int main(){
	int i, a, b, palindromicNumbers=0;
	std::cin >> a >> b;

	for(i=a;i<=b;i++){
		if(i/10000==i%10 && i/1000%10==i/10%10)
			palindromicNumbers++;
	}

	std::cout << palindromicNumbers << std::endl;
	return 0;
}


Measured memory_bytes: 256
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

s = list(input())
t = list(input())
s.sort()
t.sort(reverse=True)

lens = len(s)
lent = len(t)
for i in range(lens):
    if i==lent:
        print('No')
        exit()
    if s[i]<t[i]:
        print('Yes')
        exit()
    elif s[i]>t[i]:
        print('No')
        exit()
else:
    if len(t)==len(s):
        print('No')
    else:
        print('Yes')

Measured memory_bytes: 61740
#include <iostream>
#include <vector>
#include <map>
#include <cstring>
#include <algorithm>
#include <cstdio>

#define FOR(i, a, b) for(int i = (a), _b = (b); i <= _b; i++)

using namespace std;

const int MAXN = 200000;
map<int, int> ma;

int main() {
  int n;
  ios::sync_with_stdio(false);
  while (cin >> n) {
    int x, res = 0;
    ma.clear();
    FOR(i, 0, n-1) {
      cin >> x;
      if (ma.find(x) == ma.end()) ma[x] = 0;
      ma[x] ++;
    }

    for (auto it: ma) {
      int x = it.first;
      if (ma[x] >= x) res += (ma[x] - x);
        else res += ma[x];
    }

    cout << res << endl;
  }
  return 0;
}


Measured memory_bytes: 4736
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair< ll, ll > Pi;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep2(i,n) for(int i=1;i<=(n);i++)
#define rep3(i,i0,n) for(int i=i0;i<(n);i++)
#define pb push_back
#define mod 1000000007
const ll INF = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
ll gcd(ll a, ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) {return a/gcd(a,b)*b;}
#define all(x) x.begin(), x.end()
#define mp make_pair
bool compare(Pi a, Pi b) {
    if(a.first != b.first){
        return a.first < b.first;
        
    }else{
        return a.second < b.second;
    }
}


bool In_map(ll y,ll x,ll h,ll w){
    if(y<0 || x<0 || y>=h || x>=w){
        return 0;
    }else{
        return 1;
    }
}
const vector<ll> dx{1,0,-1,0};
const vector<ll> dy{0,1,0,-1};


int main() {
    ll N;
    cin >>N;
    vector<ll>A(N);
    rep(i,N){
        cin>>A[i];
        A[i]--;
    }
    ll now=0;
    rep(i,N){
        if(A[now]==1){
            cout<<i+1<<endl;
            return 0;
        }else{
            now=A[now];
        }
    }
    cout << -1 << endl;


    return 0;
    

}

Measured memory_bytes: 4052
#include <iostream>
#include <algorithm>
#include <map>
#include <string>
#include <queue>
#include <vector>
#include <set>
using namespace std;
const int maxn = 2e6+10;
typedef pair<int,int> pii;
typedef long long ll;

int N;
set<int> st;
int main(){
//    freopen("in.txt","r",stdin);
//    freopen("out.txt","w",stdout);

    cin>>N;int t;
    while(N--){
        scanf("%d",&t);
        if(st.find(t) == st.end()){
            st.insert(t);
        }else{
            cout<<"NO"<<endl;
            return 0;
        }
    }
    cout<<"YES"<<endl;
    return 0;
}

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

int main() {
  
  int numStones;
  cin >> numStones;
  vector<int> heights(numStones);
  for(int& height : heights) {
      cin >> height;
  }
  vector<int> costs(numStones, 0);
  costs[1] = abs(heights[1] - heights[0]);

  for(int i = 2; i < costs.size(); i++) {
      costs[i] = min(costs[i-1] + abs(heights[i] - heights[i-1]),
                     costs[i-2] + abs(heights[i] - heights[i-2]));
  }

  cout << costs[costs.size()-1];

  return 0;
}

Measured memory_bytes: 3668
#include<bits/stdc++.h>
using namespace std;
#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define SZ(x) ((int)(x).size())
#define debug(x) cerr << #x << ": " << x << '\n'
#define INF 999999999
typedef long long int Int;
typedef pair<int,int> P;
using ll = long long;
using VI = vector<int>;

int h,w;
vector<vector<int>> c(10,vector<int>(10));
vector<vector<int>> G;
int main(){
    cin >> h >> w;
    for(auto &i:c)for(auto &j:i){
        cin >> j;
    }
    G.resize(h,vector<int>(w));
    for(auto &i:G)for(auto &j:i){ cin >> j;}
    for(int k=9;k>=0;k--){
        for(int i=9;i>=0;i--){
            for(int j=9;j>=0;j--){
                c[i][j] = min(c[i][j],c[i][k]+c[k][j]);
            }   
        }
    }
    int ans = 0;
    rep(i,h){
        rep(j,w){
            if(G[i][j]==-1||G[i][j]==1) continue;
            ans += c[G[i][j]][1];
        }
    }
    cout << ans << endl;

}

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

N,K = inpl()
pls = inpl()
pls.sort()
pls = pls[:K]
print(sum(pls))


Measured memory_bytes: 69116
#include <iostream>
#include <algorithm>

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, strt, n) for (int i = (strt); i < (int)(n); i++)
using namespace std;

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

	int *B = new int[N];
	B[0] = 0;
	rep2(i, 1, N)
		cin >> B[i];

	int *A = new int[N + 1];
	A[0] = 0;
	A[1] = B[1];
	rep2(i, 2, N) {
		A[i] = min(B[i - 1], B[i]);
	}
	A[N] = B[N - 1];

	int sum = 0;
	rep(i, N + 1)
		sum += A[i];
	cout << sum << endl;

	delete[] A;
	delete[] B;

	return 0;
}


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

using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
const int INF = 1e9 + 7;

int n;
vector<PII> ans;

int main()
{
	scanf("%d", &n);
	
	rep1(i, n) rep1(j, i)
	if(i != j && i + j != n + 1 - n % 2) ans.push_back(MP(j, i));
	
	printf("%d\n", (int)ans.size());
	rep(i, ans.size()) printf("%d %d\n", ans[i].first, ans[i].second);
	return 0;
}

Measured memory_bytes: 384
#include <stdio.h>
#include <iostream>
#include <math.h>
using namespace std;

struct Point { 
	double x, y;
};

void koth(int n, Point s1, Point s2) {
	if ( n == 0 ) return;
	Point s, u, t;
	double th = M_PI * 60.0 / 180.0;

	s.x = (2.0 * s1.x + 1.0 * s2.x) / 3.0;
	s.y = (2.0 * s1.y + 1.0 * s2.y) / 3.0;
	t.x = (1.0 * s1.x + 2.0 * s2.x) / 3.0;
	t.y = (1.0 * s1.y + 2.0 * s2.y) / 3.0;
	u.x = (t.x - s.x) * cos(th) - (t.y - s.y) * sin(th) + s.x;
	u.y = (t.x - s.x) * sin(th) + (t.y - s.y) * cos(th) + s.y;

	koth(n - 1, s1, s);
	printf("%.8f %.8f\n", s.x, s.y);
	koth(n - 1, s, u);
	printf("%.8f %.8f\n", u.x, u.y);
	koth(n - 1, u, t);
	printf("%.8f %.8f\n", t.x, t.y);
	koth(n - 1, t, s2);
	return;
}


int main() {
	Point a, b;
	int n;

	scanf("%d", &n);
	a.x = 0;
	a.y = 0;
	b.x = 100.0;
	b.y = 0;
	printf("%.8f %.8f\n", a.x, a.y);
	koth(n, a, b);
	printf("%.8f %.8f\n", b.x, b.y);

	return 0;
}



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

int main() {
	int a, b;
	while (cin >> a >> b) {
		cout << to_string(a + b).length() << endl;
	}
	return 0;
}

Measured memory_bytes: 3160
A, B, K = map(int, input().split())

a = A - K
if a <= 0:
    ansA = 0
    minus = K - A

    ansB = B - minus
    if ansB <= 0:
        print("{} {}".format(ansA, 0))

    else:
        print("{} {}".format(ansA, ansB))

else:
    print("{} {}".format(a, B))



Measured memory_bytes: 3060
import java.util.*;
import java.math.*;
public class Main {
	public static void main(String[] args){
		
		Scanner sc = new Scanner(System.in);
		long a = sc.nextLong();
      	int count = 0; 
        //BigInteger biga = new BigInteger(a); 
        //BigInteger first = new BigInteger("100"); 
        long f = 100;
      
      	while (a > f)
       	{ f*= 1.01;
          count++;
        }				
		System.out.println(count);
	}
}

Measured memory_bytes: 35552
// I SELL YOU...! 
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<chrono>
#include<iomanip>
#include<map>
#include<set>
#define MAX_N 110000
#define MOD 1000000007
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
vector<ll> pows(MAX_N),inv_sum(MAX_N);
void init_io(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(10);
}
ll modinv(ll a, ll m){
  ll b=m,u=1,v=0;
  while(b){
    ll t=a/b;
    a-=t*b; swap(a,b);
    u-=t*v; swap(u,v);
  }
  u%=m;
  if(u<0) u+=m;
  return u;
}
void mod_pw(ll n,ll m){
  pows[0] = 1;
  inv_sum[0] = 1;
  for(ll i=1;i<n;i++){
    pows[i] = i*pows[i-1];
    pows[i] %= m;
    inv_sum[i] = inv_sum[i-1] + modinv(i+1,m);
    inv_sum[i] %= m;
  }
}
signed main(){
  init_io();
  ll n,ans=0,pre=1;
  cin >> n;
  vector<ll> x(n);
  mod_pw(MAX_N,MOD);
  for(int i=0;i<n;i++){
    cin >> x[i];
  }
  for(ll i=0;i<n-1;i++){
    ans += (inv_sum[i]*(x[i+1]-x[i]))%MOD;
    ans %= MOD;
  }
  for(ll i=1;i<n;i++){
    ans *= i;
    ans %= MOD;
  }
  cout << ans << endl;
}


Measured memory_bytes: 2816
#include <iostream>
#include <stdio.h>

const double PI=3.14159265358979323846;

#define rep(i,n) for(int i=0; i<n; i++)
using namespace std;

int main(){
  int n;
  string s,t, ans="";
  cin >> n >> s >> t;
  rep(i,n) ans+=s[i],ans+=t[i];
  cout << ans << endl;
}


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

int main(){
    int N,K,ans=0;
    cin>>N>>K;
    vector<int> x(N);
    for(int i=0;i<N;i++){
        cin>>x.at(i);
    }
    for(int i=0;i<N;i++){
        if(x.at(i)>=K-x.at(i)){
            ans += (K-x.at(i))*2;
        }else{
            ans += x.at(i)*2;
        }
    }
    
    cout<<ans<<endl;
}


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

int n, a[110];

int main(void) {

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

    int ans = 0x3f3f3f3f;
    for(int x = -203; x<=203; x++) {
        int aux = 0;
        for(int i=0; i<n; i++) {
            aux += abs(a[i]-x)*abs(a[i]-x);
        }
        ans = min(ans, aux);
    }
    
    cout << ans << "\n";

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int LINF=1e18;

signed main(){
  int N,K;cin>>N>>K;
  vector<int> a(N),f(N);
  for(int i=0;i<N;i++)cin>>a[i];
  for(int i=0;i<N;i++)cin>>f[i];
  sort(a.begin(),a.end());
  sort(f.rbegin(),f.rend());
  int l=-1,r=LINF;
  while(r-l>1){
    int m=(r+l)>>1;
    int cnt=0;
    for(int i=0;i<N;i++){
      if(a[i]*f[i]>m){
        cnt+=(a[i]*f[i]-m)/f[i];
        if((a[i]*f[i]-m)%f[i])cnt++;
      }
    }
    if(cnt>K)l=m;
    else r=m;
  }
  cout<<r<<endl;
}


Measured memory_bytes: 3456
#include<stdio.h>
#include<string.h>

char str[5];

int main(void){
    int ans=0;
   for (int i=0;i<3;i++){
       scanf("%c", &str[i]);
       if (str[i]=='R') ans++;
   }

   if (str[1]=='S'&&ans==2) ans=1;
   
   printf("%d\n",ans);
  
return 0;
}


Measured memory_bytes: 1660