akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define MODNum 1000000007
#define REP(type, i, a, b) for( type i = a; i < b; i++ )
typedef long long ll;

using namespace std;
bool IsPrime(int num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            // 素数ではない
            return false;
        }
    }

    // 素数である
    return true;
}
int main (void) {
    ll N, ans;
    scanf("%lld", &N);
    ans = N;
    if ( N == 2 ){
        printf("2\n");
        return 0;
    }
    if ( N % 2 == 0 ) ans++;
    while ( !IsPrime(ans) ){
        ans += 2;
    }
    printf("%lld\n", ans);
    return 0;
}

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

int main(){
    int n; cin >> n;
    rep(i, n) {
        int a; cin >> a;
        if(a%2 == 0){
            if(a%3 && a%5){
                cout << "DENIED" << endl;
                return 0;
            }
        }
    }
    cout << "APPROVED" << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

const int maxM = 2e5+7;
const int maxV = 90010;

const int MOD = 1e9+7;

int T;
const int maxN = 2e5+8;
const ll INF = 1000000000000000010LL;
const int K = 15;
int n;
int a[maxN];
int b[maxN];

int main() {
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&a[i]);
	}
	for(int i=n/2+1;i<=n;i++)
	{
		b[i] = a[i];
	}
	for(int i=n/2;i>=1;i--)
	{
		int x = 2*i;
		int res = 0;
		while(x<=n)
		{
			res += b[x];
			x += i;
		}
		res %= 2;
		if(res != a[i])
			b[i] = 1;
	}
	vector<int> ans;
	for(int i=1;i<=n;i++)
	{
		if(b[i] == 1)
			ans.push_back(i);
	}
	int s = ans.size();
	cout<<s<<endl;
	for(auto x:ans)
	{
		cout<<x<<endl;
	}
    return 0;
}


Measured memory_bytes: 2936
import java.util.Scanner;

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

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int i = 0;
		while (++i <= n) {
			int x = i;
			if (x % 3 == 0) System.out.print(" " + i);
			else
				for (; x != 0; x /= 10)
					if (x % 10 == 3) {
						System.out.print(" " + i);
						break;
					}
		}
		System.out.println();
	}
}

Measured memory_bytes: 28936
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

#define repd(i, a, b) for (ll i = (a); i < (b); i++)
#define rep(i, n) repd(i, 0, n)

using namespace std;

namespace mp = boost::multiprecision;
using Bint = mp::cpp_int;

using ll = long long;
ll mod = pow(10, 9) + 7;

template <typename T> void output(T, ll);
ll gcd(ll, ll);
ll lcm(ll, ll);
Bint comb(Bint, Bint);
void prime_map(map<ll, ll> &, ll);

int main() {
    // source
    ll a, b;
    cin >> a >> b;
    if ((b - a) % 2 == 0) {
        ll ans = a + (b - a) / 2;
        cout << ans << endl;
    } else {
        cout << "IMPOSSIBLE" << endl;
    }
    return 0;
}

Bint comb(Bint a, Bint b) {
    Bint ans = 1;

    if (a < b) {
        return 0;
    }

    rep(i, b) {
        ans *= a - i;
        ans /= i + 1;
    }

    return ans;
}

template <typename T> void output(T a, int precision) {
    if (precision > 0) {
        cout << setprecision(precision) << a << "\n";
    } else {
        cout << a << "\n";
    }
}

template <typename T> T min(T a, T b) {

    if (a < b) {
        return a;
    } else {
        return b;
    }
}

ll gcd(ll a, ll b) {
    if (b == 0) {
        return a;
    }
    return gcd(b, a % b);
}

ll lcm(ll a, ll b) { return a * b / gcd(a, b); }

void prime_map(map<ll, ll> &m, ll num) {
    ll cache = num;
    repd(i, 2, sqrt(num) + 2) {
        if (num % i == 0) {
            if (m[i] == 0) {
                m[i] = 1;
            } else {
                m[i]++;
            }

            num /= i;
            break;
        }
    }

    if (cache == num) {
        if (m[num] == 0) {
            m[num] = 1;
        } else {
            m[num]++;
        }
        return;
    } else {
        prime_map(m, num);
    }
}


Measured memory_bytes: 256
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdalign>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif
#define LL long long
#define ull unsigned long long
#define mp make_pair
#define N 100009
const LL INF = 0x3f3f3f3f;
using namespace std;
LL h[N];
LL n, a, b;

bool judge(LL mid)
{
    LL ans = mid;
    for(int i = 1; i <= n; i++)
    {
        LL tm = h[i] - b*mid;
        if(tm > 0)
        {
            LL cnt = tm / (a - b) + (tm % (a - b) == 0 ? 0 : 1);
            ans -= cnt;
            if(ans < 0)
                return false;
        }
    }
    return true;
}
int main()
{
    scanf("%lld%lld%lld", &n, &a, &b);
    for(int i = 1; i <= n; i++)
        scanf("%lld", &h[i]);
    LL l = 0, r = INF;
    LL ans = INF;
    while(l <= r)
    {
        LL mid = (l + r)>>1;
        if(judge(mid))
            ans = mid, r = mid - 1;
        else
            l = mid + 1;
    }
    printf("%lld\n", ans);
    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define pt(sth) cout << sth << "\n"
#define chmax(a, b) {if(a<b) a=b;}
#define chmin(a, b) {if(a>b) a=b;}
#define moC(a, s, b) (a)=((a)s(b)+MOD)%MOD
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
static const ll INF=1e18;
static const ll MAX=101010;
static const ll MOD=1e9+7;
static const ll LOGN=55;


int main(void) {
  ll N, K;
  cin >> N >> K;
  ll a[1111];
  ll s[1111]={};
  ll i, j;
  
  for(i=1; i<=N; i++) {
    cin >> a[i];
    s[i]=a[i]+s[i-1];
  }
  
  vector<ll> v;
  ll cnt[44]={};
  for(i=0; i<N; i++) {
    for(j=i+1; j<=N; j++) {
      ll t=s[j]-s[i];
      v.push_back(t);
      ll bit=0;
      while(t>0) {
        if(t&1) cnt[bit]++;
        bit++;
        t>>=1;
      }
    }
  }
  
  ll f[MAX*10];
  memset(f, 1, sizeof(f));
  ll ans=0;
  for(ll b=40; b>=0; b--) {
    if(cnt[b]>=K) {
      ans+=pow(2, b);
      
      for(i=0; i<v.size(); i++) {
        if(!f[i]) continue;
        
        if(v[i]>>b&1) continue;
          
        f[i]=0;
        ll t=v[i];
        ll bit=0;
        while(t>0) {
          if(t&1) cnt[bit]--;
          bit++;
          t>>=1;
        }
        
      }
    }
  }
  
  pt(ans);
}






Measured memory_bytes: 12396
use std::io::stdin;

fn main() {
    let mut s = String::new();
    stdin().read_line(&mut s).ok();
    let mut itr = s.split_whitespace().map(|e| e.parse().unwrap());
    let n: usize = itr.next().unwrap();
    let l: usize = itr.next().unwrap();
    let mut v = Vec::new();

    for _ in 0..n {
        let mut s = String::new();
        stdin().read_line(&mut s).ok();

        v.push(String::from(s.trim()));
    }
    v.sort();
    let ans = v.join("");

    println!("{}", ans);
}


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

using namespace std;



int main(int argc, char *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int N;
    cin >> N;
    
    int cnt = 0;
    
    for (int i = 1; i <= N; i += 1) {
        string s = to_string(i);
        if (s.length() % 2 != 0) {
            cnt++;
        }
    }
    
    cout << cnt << endl;
    
    return 0;
}


Measured memory_bytes: 256
<?php
fscanf(STDIN,'%d %d',$n,$k);
$a = explode(" ",trim(fgets(STDIN)));
$sum = 0;
$i = 0;
for ($j = $k;$j < $n;++$j) {
    if ($a[$j] > $a[$i++]) {
        echo 'Yes'.PHP_EOL;
    } else {
        echo 'No'.PHP_EOL;
    }
}

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

cnt = 0
inf = 10 ** 18

def rest_2(n):
    return n % 2

def div_2(n):
    return n / 2
  
for i in range(inf):
  B = list(map(rest_2, A))
  A = list(map(div_2, A))

  if 1 in B:
    print(cnt)
    break
  
  cnt += 1

Measured memory_bytes: 3064
import sys

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline


def main():
    N, K = [int(x) for x in input().split()]
    P = [int(x) - 1 for x in input().split()]
    C = [int(x) for x in input().split()]

    ans = max(C)
    for i in range(N):
        next = P[i]
        cnt = 0
        cycle_value = 0

        while True:
            cycle_value += C[next]
            cnt += 1
            if next == i:
                break
            next = P[next]

        j = 0
        tmp = 0
        next = P[i]
        while True:
            tmp += C[next]
            j += 1
            ans = max(ans, tmp + ((K - j) // cnt) * max(0, cycle_value))
            if j == K or next == i:
                break
            next = P[next]
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 74004
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <cassert>

using namespace std;
typedef long long LL;
template <typename F, typename S> std::ostream& operator<<(ostream& os, const pair<F,S>& p) {
    os << "(" << p.first << "," << p.second << ")"; return os; }
template <typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
    os << "["; for(const T& a: v){ os << a << ", "; } os << "]"; return os; }
template <typename K, typename V> ostream& operator<<(ostream& os, const map<K,V>& m) {
    os << "{"; for(const auto& p: m){ os << p.first <<":"<< p.second << ", "; } os << "]"; return os; }


map<LL,LL> factorize(LL val){
    assert(val > 0);
    map<LL,LL> factor;
    for(LL p = 2; p*p <= val; ++p){
        while(val % p == 0){
            ++factor[p];
            val /= p;
        }
    }
    if(val > 1) ++factor[val];
    return factor;
}


int main(){
    LL n, p;
    cin >> n >> p;
    map<LL,LL> f = factorize(p);
    LL ans = 1;
    for(auto p: f){
        ans *= pow(p.first, (p.second / n));
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 512
n,k = map(int,input().split())
x = list(map(int,input().split()))
 
kyori=10**9
for i in range(n-k+1):
#print(x[i:k+i])
  if x[k+i-1]<=0:
    kyori = min(kyori,abs(x[i]))
  elif x[i]<0 and 0<x[k+i-1]:
    kyori = min(kyori,abs(x[i]*2)+abs(x[k+i-1]),abs(x[i])+abs(x[k+i-1]*2))
  elif 0<=x[i]:
    kyori = min(kyori,abs(x[k+i-1]))
print(kyori)

Measured memory_bytes: 14240
#include <iostream>

using namespace std;

int N;
int p;

int main()
{
    cin >> N;
    int max = 0;
    int ans = 0;
    for (int i = 0; i < N; i++) {
        cin >> p;
        if (p > max) {
            max = p;
        }
        ans += p;
    }

    ans = ans - max + (max / 2);
    cout << ans << endl;

    return 0;

}


Measured memory_bytes: 256
#include<iostream>
#include<unordered_map>
#include<bits/stdc++.h>
#include<map>
#include<set> 
#include<iterator> 
using namespace std;
typedef long long ll;
typedef vector<int> vi;
int main(){
	ll x;
	cin>>x;
	ll p=100;
	ll count=0;
	while(p<x){
		p=p+p/100;
		count++;
	}
	cout<<count;
	return 0;
}

Measured memory_bytes: 3636
import java.util.Scanner;

public class Main {

	static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		judgeSquare();
	}

	private static void judgeSquare() {
		int lect = 0;
		int diamond = 0;


			while (sc.hasNext()) {
				String[] str = sc.nextLine().split(",");
				int a = Integer.parseInt(str[0]);
				int b = Integer.parseInt(str[1]);
				int c = Integer.parseInt(str[2]);

					if ( c * c == a * a + b * b  ) {
						lect++;
					} else if ( a == b ) {
						diamond++;
					}
			}

		System.out.println(lect);
		System.out.println(diamond);

	}

}



Measured memory_bytes: 26152
#include <cstdio>
#include <iostream>
#include <algorithm>
using namespace std;
#define maxx 450100
#define infinity 2000000000
typedef long long ll;

int L[maxx/2+2],R[maxx/2+2];
ll ans=0;

void merge(int A[],int left,int mid,int right){
	int n1=mid-left,n2=right-mid;
	for(int i=0;i<n1;i++) L[i]=A[left+i];
	for(int i=0;i<n2;i++) R[i]=A[mid+i];
	int i=0,j=0;
	L[n1]=R[n2]=infinity;
	for(int x=left;x<right;x++){
		if(L[i]<=R[j]) {
			A[x]=L[i++];
		}else{
			A[x]=R[j++];
			ans+=n1-i;
		}
	}
	return ;
}

void merge_sort(int A[],int left ,int right){
	if(left+1<right){
		int mid =(left+right)/2;
		merge_sort(A,left,mid);
		merge_sort(A,mid,right);
		merge(A,left,mid,right);
	}
	return ;
}

int main (){
	int n;
	cin>>n;
	int A[maxx];
	for(int i=0;i<n;i++) cin>>A[i];
	merge_sort(A,0,n);
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 4668
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin >> n;
    vector<int> l(n);
    int i,j;
    int sum=0;
    for(i=0;i<n;i++)cin >> l.at(i);
    for(i=0;i<n;i++){
        sum=0;
        for(j=0;j<n;j++){
            if(j!=i){
                sum+=l.at(j);
            }
        }
        if(sum<=l.at(i)){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define F(i,s,e) for(int i=s;i<e;++i)

int main()
{
    int n;
    cin >> n;
    vector<int> a(n);
    F(i,0,n) cin >> a[i];

    int cnt=0;
    F(i,0,n){
        for(int j=n-1;j>i;--j){
            if(a[j]<a[j-1]){
                int t=a[j];
                a[j]=a[j-1];
                a[j-1]=t;
                ++cnt;
            }
        }
    }

    F(i,0,n){
        cout << a[i];
        if(i!=n-1) cout << ' ';
    }
    cout << endl << cnt << endl;
    return 0;
}


Measured memory_bytes: 3100
#include<iostream>
#include<string>
#include<algorithm>
#define REP(i, n) for(int i = 0; i < n; ++i)
using namespace std;

int main()
{
    int N;
    string S;
    cin >> N;
    cin >> S;
    char cur = S[0];
    int ans = 1;
    for (int i = 1; i < N; ++i){
        if (cur == S[i]){
            continue;
        } else {
            cur = S[i];
            ans += 1;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1144
#include <iostream>
#include<algorithm>
#include<string>
#include<vector>
#define _USE_MATH_DEFINES
#include <math.h>
#include <iomanip>
#include <stdio.h>
#include <numeric>

using namespace std;

int main()
{
	int h, w;
	cin >> h >> w;
	vector<string> s(h);
	for (int i = 0; i < h;i++)cin >> s[i];
	for (int i = 0; i < h; i++) {
		cout << s[i] << endl;
		cout << s[i] << endl;
	}
}

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

int main(){
    lint N, A[5]; cin >> N;
    for(int i=0;i<5;i++) cin >> A[i];

    lint x = *min_element(A, A+5);
    cout << (N+x-1) / x + 4 << endl;
    return 0;
}

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

using namespace std;

int main() {

	int h, n;
	cin >> h >> n;
	int sum = 0;
	while (n--) {
		int x;
		cin >> x;
		sum += x;
	}
	cout << (sum >= h ? "Yes" : "No");
}



Measured memory_bytes: 256
/*
	Name:
	Author: xiaruize
	Date:
*/

#include<bits/stdc++.h>
using namespace std;
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define LL long long

int main()
{
 	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	char c;
	cin>>c;char c2=c+1;
	cout<<c2<<endl;	
	return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC061A
{
	class Program
	{
		static void Main(string[] args)
		{
			int a, b,c;
			var word = Console.ReadLine().Split(' ');
			a = int.Parse(word[0]);
			b = int.Parse(word[1]);
			c = int.Parse(word[2]);
			if ((a <= c) && (c <= b))

			{
				Console.WriteLine("Yes");
			}
			else
			{
				Console.WriteLine("No");
			}
			
			Console.ReadKey();




		}
	}
}


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

using namespace std;

#define int long long
#define rep(i,x) for(int i=0;i<x;++i)

struct node {
    int p, q, r, b;
};

vector<node> sticks;
int par[105];

int n;

int gcd(int a, int b)
{
    int tmp;
    while (b != 0) {
        tmp = b;
        b = a % b;
        a = tmp;
    }

    return a;
}

int lcm(int a, int b)
{
    return a / gcd(a, b) * b;
}

int dfs(int cur)
{
    if (cur == -1) return 1;

    node& s = sticks[cur];

    int rch = dfs(s.r), bch = dfs(s.b);
    int a = lcm(rch * s.p, bch * s.q);

    return a / s.p + a / s.q;
}

signed main()
{
    while (cin >> n, n) {
        sticks.resize(n);
        memset(par, -1, sizeof(par));

        rep(i, n) {
            int p, q, r, b;
            cin >> p >> q >> r >> b;
            r--, b--;
            sticks[i] = node{p, q, r, b};

            if (r >= 0) par[r] = i;
            if (b >= 0) par[b] = i;
        }

        int root;

        {
            int cur = 0;
            do {
                root = cur;
                cur = par[cur];
            } while (cur != -1);
        }

        cout << dfs(root) << endl;
    }
}

Measured memory_bytes: 2984
#include <iostream>
#include <vector>
#include <utility>
#include <map>
#include <algorithm>
#include <queue>
#include <cmath>

using namespace std;

int main() {
	int a, b, sum, sub, mul, ans;
	cin >> a >> b;
	sum = a + b;
	sub = a - b;
	mul = a * b;
	ans = max(sum, sub);
	ans = max(ans, mul);
	cout << ans << endl;
};

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

#define LL long long
#define Dl double
#define Pb push_back
#define Po pop_back
#define Mp make_pair
#define Ub upper_bound
#define Lb lower_bound
#define In insert
#define All(x) x.begin(), x.end()
#define mem(a, b) memset(a, b, sizeof(a))
#define fast ios_base::sync_with_stdio(0);cin.tie(0)

using namespace std;

typedef vector<LL> Vl;
typedef vector<Vl> VVl;
typedef pair<LL, LL> Pll;
typedef vector<Pll> Vpl;
typedef queue<LL> Ql;
typedef stack<LL> Sl;
#define X first
#define Y second
#define mx3 1010
#define mx4 10010
#define mx5 100010
#define mx6 1000010

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

    LL w, h, n;
    cin >> w >> h >> n;

    LL mnx = 0, mny = 0, mxx = w, mxy = h;
    for(LL i = 0; i < n; i++){
        LL x, y, a;
        cin >> x >> y >> a;

        if(a == 1)
            mnx = max(x, mnx);
        if(a == 2)
            mxx = min(x, mxx);
        if(a == 3)
            mny = max(y, mny);
        if(a == 4)
            mxy = min(y, mxy);
    }

    mxx -= mnx;
    mxy -= mny;

    if(mxx < 0 || mxy < 0)
        return cout << 0 << '\n', 0;

    cout << mxx * mxy << '\n';

    return 0;
}



Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;


public class Main {

	/**
	 * @param args
	 * @throws IOException 
	 */
	public static void main(String[] args) throws IOException {
		// TODO Auto-generated method stub
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String str = br.readLine();
		
		int ones = 0;
		for(int i = 0; i < str.length() ; i++){
			if(str.charAt(i) == '1'){
				ones++;;
			}
		}
		
		System.out.println(ones);
	}

}


Measured memory_bytes: 23124
import Control.Monad
import Data.Functor
import System.IO

minVal = minBound :: Int

main = do
  n <- readInt <$> getLine
  if n == 0 then return () else do
    xs <- replicateM n (readInt <$> getLine)
    print $ solve xs
    main

solve :: [Int] -> Int
solve = loop minVal 0
  where loop v _ [] = v
        loop v s (x:xs) = loop (max v w) w xs
          where w = max (s + x) x

readInt :: String -> Int
readInt = read

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

int main(){
    long long r, D, x;
    cin >> r >> D >> x;
    vector<long long> ans(10);
    
    for(int i=0; i<10; i++) {
        if( i == 0 ) ans[0] = r*x - D;
        else  ans[i] = r*ans[i-1] - D;
    }

    for(int i =0; i<10; i++) {
        cout << ans[i] << endl;
    }
}

Measured memory_bytes: 3572
#include <stdio.h>

int main(){
    int i, a, b, c, N;
    scanf("%d", &N);

    for(i = 0; i < N; i++){
        scanf("%d %d %d", &a, &b, &c);
        if(a*a == b*b + c*c || b*b == a*a + c*c || c*c == a*a + b*b){
            printf("YES\n");
        }
        else{
            printf("NO\n");
        }
    }
    return 0;
}

Measured memory_bytes: 580
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define vi vector<ll>
#define vvi vector<vi>
#define Q queue<ll>
#define DQ deque<ll> 
#define pb push_back
#define pf push_front
#define popf pop_front
#define popb pop_back
#define mp make_pair
#define mt make_tuple
#define f first
#define s second
#define ub upper_bound
#define lb lower_bound
#define loop(x,y,z) for(ll i=x; i<=y; i+=z)
#define rloop(x,y,z) for(ll i=x; i>=y; i-=z)
#define all(x) x.begin(), x.end()
#define sum(x) accumulate(all(x),0LL)
#define minE(x) *min_element(all(x))
#define maxE(x) *max_element(all(x))
#define mem(a,b) memset(a,b,sizeof(a))
#define watch(x) cout<<(#x)<<" is "<<x<<endl
#define endl "\n"
#define mod 1000000007

ll gcd(ll a, ll b){
	return (!b)?a:gcd(b,a%b);
}

void display(vi &v,string c){
	for(auto x:v) cout<<x<<c;
}

int main(){
	IOS
	string str;
	cin>>str;
	ll n=str.size();
	vector<vi> dp;
	loop(0,n-1,1){
		vi temp(13,0);
		dp.pb(temp);
	}
	ll curr;
	if (str[0]=='?'){
		loop(0,9,1){
			dp[0][i]=1;
		}
	}
	else{
		dp[0][str[0]-'0']=1;
	}
	loop(1,n-1,1){
		if (str[i]=='?') curr=-1;
		else curr=str[i]-'0';
		
		for(ll dig=0; dig<10; dig++){
			if (curr!=-1 and curr!=dig) continue;
			for(ll rem=0; rem<13; rem++){
				dp[i][(rem*10+dig)%13]+=dp[i-1][rem];
			}
		}
		for(ll rem=0; rem<13; rem++) dp[i][rem]%=mod;
	}
	// for(auto x:dp){
	// 	for(auto y:x){
	// 		cout<<y<<" ";
	// 	}
	// 	cout<<endl;
	// }
	cout<<dp[n-1][5];
	return 0;
}


Measured memory_bytes: 14336
M, K = gets.chomp.split(" ").map(&:to_i);

if K >= (2 ** M) then
  puts -1
elsif M == 1 && K == 1 then
  puts -1
elsif M == 1 && K == 0 then
  puts '0 1 1 0'
else
  a = []
  (0...2 ** M).each{|i|
    next if i == K
    a << i
  }
  a.shuffle!
  a.each{|i| printf("#{i} ")}
  printf("#{K} ")
  a.reverse.each{|i| printf("#{i} ")}
  printf("#{K} ")
end


Measured memory_bytes: 7548
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
int main() {
    int n, m;
    cin >> n >> m;
    vector<int> h(n);
    for (int i = 0; i < n; i++)
        cin >> h[i];
    vector<int> a(m), b(m);
    for (int i = 0; i < m; i++) {
        int ai, bi;
        cin >> ai >> bi;
        a[i] = ai-1;  b[i] = bi-1;
    }
    
    vector<bool> g(n, true);
    for (int i = 0; i < m; i++) {
        if (h[a[i]] <= h[b[i]])
            g[a[i]] = false;
        if (h[a[i]] >= h[b[i]])
            g[b[i]] = false;
    }
    
    int ans = 0;
    for (int i = 0; i < n; i++)
        if (g[i])
            ans++;
        
    cout << ans << endl;
    
    return 0;
}


Measured memory_bytes: 4528
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define pii pair<int, int>
#define F first
#define S second
#define pb push_back
#define pp pop_back

const int P = 1000000007;

using namespace std;


int main(){

	vector<int> a(3);
	int k, ans = 0;
	cin >> a[0] >> a[1] >> a[2] >> k;
	for(int i=0; i<3; i++){
		ans += min(k, a[i])*(1-i);
		k = max(0, k-a[i]);
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 3636
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <stdio.h>
using namespace std;
#define int long long
int MOD = 1000000007;
vector<int> X;

int val = 0;

int dfs(int a, int k) {
	if (a == k)return 0;
	dfs(a + 1, k);

	val ^= (1 << a);
	X.push_back(a);

	dfs(a + 1, k);
}

vector<int> X2;
int dfs3(int a, int k) {
	if (a == k)return 0;
	dfs3(a + 1, k);

	val ^= (1 << a);
	X2.push_back(a);

	dfs3(a + 1, k);
}
int dfs2(int a, int k) {
	if (a == k - 1) {
		val ^= (1 << a);
		X2.push_back(a);
		return 0;
	}
	if (a >= k)return 0;


	dfs2(a + 2, k);

	val ^= (1 << (a));
	X2.push_back(a);

	dfs2(a + 2, k);



	val ^= (1 << (a + 1));
	X2.push_back(a + 1);


	dfs2(a + 2, k);


	X2.pop_back();



	val ^= (1 << (a));
	X2.push_back(a);

	dfs3(a + 2, k);

	val ^= (1 << (a));
	X2.push_back(a);




}



signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N, A, B;

	cin >> N >> A >> B;


	int T = A ^ B;
	vector<int> I0;
	vector<int> I1;
	int idx = 0;
	for (int i = 0; i < N; i++) {
		if (T % 2 == 0) {
			I0.push_back(i);
		}
		else {
			I1.push_back(i);
		}
		T /= 2;
	}
	vector<int> res;
	if (I1.size() % 2 == 0) {
		cout << "NO" << endl;
		return 0;
	}
	else {
		cout << "YES" << endl;

		dfs(0, I0.size());
		dfs2(0, I1.size());

		//cerr << I0.size() << " " << I1.size() << endl;
		//cerr << X.size() << " " << X2.size() << endl;

		res.push_back(A);
		for (int i = 0; i <= (int)X2.size(); i++) {
			for (int j = 0; j < X.size(); j++) {
				res.push_back(res.back() ^ (1 << I0[X[j]]));
			}

			if (i < (int)X2.size()) {
				res.push_back(res.back() ^ (1 << I1[X2[i]]));
			}
		}

	}
	cerr << res.size() << endl;
	for (int i = 0; i < res.size(); i++) {
		if (i > 0)cout << " ";
		cout << res[i];
	}
	cout << endl;
}

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

#define N 8
#define FREE -1
#define NOT_FREE 1

int row[N], col[N], dpos[2 * N - 1], dneg[2 * N - 1];

bool X[N][N];

void initialize() {
  for ( int i = 0; i < N; i++ ) { row[i] = FREE; col[i] = FREE; }
  for ( int i = 0; i < 2 * N - 1; i++ ) { dpos[i] = FREE; dneg[i] = FREE; }
}

void printBoard() {
  for ( int i = 0; i < N; i++ )
    for ( int j = 0; j < N; j++ )
      if ( X[i][j] )
        if ( row[i] != j ) return;

  for ( int i = 0; i < N; i++ ) {
    for ( int j = 0; j < N; j++ )
      cout << ( ( row[i] == j ) ? "Q" : "." );
    cout << endl;
  }
}

void recursive(int i) {
  if ( i == N ) {
    printBoard(); return;
  }

  for ( int j = 0; j < N; j++ ) {
    if ( NOT_FREE == col[j] ||
         NOT_FREE == dpos[i + j] ||
         NOT_FREE == dneg[i - j + N - 1] ) continue;
    row[i] = j; col[j] = dpos[i + j] = dneg[i - j + N - 1] = NOT_FREE;
    recursive(i + 1);
    row[i] = col[j] = dpos[i + j] = dneg[i - j + N - 1] = FREE;
  }
}

int main() {
  initialize();

  for ( int i = 0; i < N; i++ )
    for ( int j = 0; j < N; j++ ) X[i][j] = false;

  int k; cin >> k;
  for ( int i = 0; i < k; i++ ) {
    int r, c; cin >> r >> c;
    X[r][c] = true;
  }

  recursive(0);

  return 0;
}


Measured memory_bytes: 3100
# frame, ?????????, ????????? x, y

def distance(x, y, x2, y2)
  Math.sqrt( ( (x - x2) ** 2 + (y - y2) ** 2 ) )
end

def result_sort(pass)
  pass.sort!{|a, b|
    if a[:distance] != b[:distance]
      b[:distance] <=> a[:distance]
    else
      a[:time] <=> b[:time]
    end
  }
end

def solve(data)
  pass = {0.0 => [], 1.0 => []}
  (0 .. data.length - 2).each{|i|
    if data[i][2] == data[i + 1][2] && data[i][1] != data[i + 1][1]
      pass[ data[i][2] ].push({
        :team     => data[i][2],
        :time     => ( data[i + 1][0] - data[i][0] ) * (1.0 / 60.0),
        :distance => distance(data[i][3], data[i][4], data[i + 1][3], data[i + 1][4]),
      })
    end
  }
  result_sort pass[0.0]
  result_sort pass[1.0]
  pass
end

def main
  n = gets.to_i
  data = (0 .. n - 1).map{|n|
    STDIN.gets.split(" ").map{|x| x.to_f }
  }
  result = solve(data)
  puts result[0.0].empty? ? "-1 -1" : "#{ result[0.0][0][:distance] } #{ result[0.0][0][:time] }"
  puts result[1.0].empty? ? "-1 -1" : "#{ result[1.0][0][:distance] } #{ result[1.0][0][:time] }"
end

main

Measured memory_bytes: 8952
#include<stdio.h>
int main(void)
{
	char s[100];
	char t[110];
	int m=0;
	int n=0;
	int x=0;
	scanf("%s",s);
	scanf("%s",t);
	
	while(s[n]){
		n++; 
	}
	while(t[m])
	m++;
	
	for(int i=0; i<n; i++){
		if(s[i] == t[i])
		 x++;
	}
	
	if(n==m)
	printf("No");
	
	
	else if(n==x)
	printf("Yes");
	
	else
	printf("No");
	
	return 0;
}


Measured memory_bytes: 1704
import java.util.*;

public class Main {
	
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
      HashSet<Integer> set = new HashSet<>();
      int count = 0;
      for (int i = 0; i < n; i++){
        int x = sc.nextInt();
        if (set.contains(x)){
          count++;
        } else {
          set.add(x);
          }
        }
      count++;
      count = count / 2 * 2;
        System.out.println(n - count);
	}
}

Measured memory_bytes: 60524
#include <bits/stdc++.h>
#define cout16 cout << setprecision(16) 
#define rep(i,n) for(int i=0;i<n;i++ )
#define rep2(i,f,n) for(int i=f;i<n;i++ )
#define MAX(A) *max_element(A.begin(),A.end())
#define MIN(A) *min_element(A.begin(),A.end())
#define SORT(A) sort(A.begin(),A.end())
#define REV(A) reverse(A.begin(),A.end())
typedef long long int ll;
using vi = std::vector<int>;
using vvi = std::vector<std::vector<int>>;
using vll = std::vector<ll>;
using vvll = std::vector<std::vector<ll>>;
using P = std::pair<int,int>;
using vp = std::vector<P>;
using namespace std;
#define INF 1001001001
#define LL_INF 1001001001001001001
#define fi first
#define se second

int main(void) {
	int n,k; cin >> n >> k;
	string s; cin >> s;
	vi a(n); rep(i,n) a[i] = s[i]-'0';
	vp st;
	st.emplace_back(0,a[0]);
	rep(i,n-1){
		if(a[i]!=a[i+1]) st.emplace_back(i+1,a[i+1]);
	}
	int nk = st.size();
//	rep(ik,nk) cout << st[ik].fi << " " << st[ik].se << endl;
	int ans = 0;
	rep(ik,nk){
		int l = st[ik].fi;
		int r;
		int jk = ik+2*k+1;
		if(st[ik].se==0){
			jk--;
			if(ik!=0) l = st[ik-1].fi;
		}
		if(jk>=nk) r = n;
		else r = st[jk].fi;
		ans = max(ans,r-l);
	}
	cout << ans << endl;
}




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

int main()
{
  long N, Q;
  cin >> N;
  map<long, long> A;
  long long S = 0;
  for (int i = 0; i < N; i++)
  {
    long tmp;
    cin >> tmp;
    S += tmp;
    if (A.count(tmp)) A.at(tmp)++;
    else A[tmp] = 1;
  }
  cin >> Q;
  for (int i = 0; i < Q; i++)
  {
    long B, C, numB;
    cin >> B >> C;
    if (A.count(B))
    {
      numB = A.at(B);
      A.at(B) = 0;
      S -= B*numB;
      S += C*numB;
      if (A.count(C)) A.at(C) += numB;
      else A[C] = numB;
    }
    cout << S << endl;
  }
}


Measured memory_bytes: 8768
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define ll long long
#define _GLIBCXX_DEBUG
const ll MOD = 1000000007;
const int MAX = 510000;

// 最大公約数
ll gcd(ll m, ll n) {
  if (n==0) return abs(m);
  else return gcd(n, m%n);
}

// 最小公倍数
ll lcm(ll m, ll n) {
  return abs(m)/gcd(m, n)*abs(n);
}

int main() {
  int N;
  cin >> N;
  vector<ll> T(N);
  for (int i=0; i<N; i++) cin >> T[i];
  ll ans = T[0];
  for (int i=1; i<N; i++) ans = lcm(ans, T[i]);
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <queue>
#include <map>
#include <stack>
#include <bitset>
#include <numeric> //lcm
#include <iomanip> //double精度 setprecision

using namespace std;

#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = n-1; i >= 0; --i)
#define rep1(i,n) for(int i = 1; i <= (n); ++i)
#define rrep1(i,n) for(int i = (n); i >= 1; --i)
#define REP(i,n,m) for(int i = (n); i < (m); ++i)
#define all(vec) (vec).begin(),(vec).end()

#define debug(vec) for(auto v : vec) cerr << v << " "; cerr << endl;
#define debug2D(vec2D) for(auto vec : vec2D) { for (auto v : vec) cerr << v << " "; cerr << endl; } 
#define debugP(vec) for(auto v : vec) cerr << "(" << v.first << "," << v.second << ") "; cerr << endl;
#define debug2DP(vec2D) for(auto vec : vec2D) { for (auto v : vec) cerr << "(" << v.first << "," << v.second << ") "; cerr << endl; } 

typedef long long ll;

constexpr ll INF = 1000000000; //10^10
//const ll MOD = 998244353;
constexpr ll MOD = 1000000007;

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

int main() {
  ll n; cin >> n;
	vector<vector<int>> mat(n, vector<int>(n,2));

	rep(i, n) {
	  int a; cin >> a;
		rep(j, a) {
		  int x, y; cin >> x >> y;
			mat[i][x-1] = y;
		}
	}

	int ans = 0;
	rep(state, 1 << n) {
	  bool ok = true;
	  vector<int> honest;
		rep(i,n) if (state >> i & 1) honest.push_back(i);

		rep(j, n) { 
		  bool exist[3] = {0}, isHonest = false;
		  for (int i : honest) {
			  if (i == j) isHonest = true;
			  exist[mat[i][j]] = true;
			}
			if ((isHonest && exist[0]) || (!isHonest && exist[1])) {ok = false; break; }
		}

		if (!ok) continue;
      
		int popcnt = 0;
		rep(i,n) popcnt += state >> i & 1;
		chmax(ans, popcnt);
	  
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

var sc = bufio.NewReaderSize(os.Stdin, 1024*1024*1)

func main() {
	list := getStdinIntArr()
	A := list[0]
	B := list[1]
	fmt.Printf("%d\n", A*B)
}

func getStdin() string {
	return readLine()
}
func getStdinInt() int {
	str := getStdin()
	rtn, _ := strconv.Atoi(str)
	return rtn
}
func getStdinInt64() int64 {
	str := getStdin()
	rtn, _ := strconv.ParseInt(str, 10, 64)
	return rtn
}
func getStdinIntArr() []int {
	str := getStdin()
	list := strings.Split(str, " ")
	rtn := make([]int, len(list))
	for idx, val := range list {
		rtn[idx], _ = strconv.Atoi(val)
	}
	return rtn
}

func getStdinIntArr64() []int64 {
	str := getStdin()
	list := strings.Split(str, " ")
	rtn := make([]int64, len(list))
	for idx, val := range list {
		rtn[idx], _ = strconv.ParseInt(val, 10, 64)
	}
	return rtn
}

func readLine() string {
	buf := make([]byte, 0, 0)
	for {
		l, p, e := sc.ReadLine()
		if e != nil {
			panic(e)
		}
		buf = append(buf, l...)
		if !p {
			break
		}
	}
	return string(buf)
}


Measured memory_bytes: 1764
import java.util.Scanner;
public class Main
{
	public static void main(String[] args)
	{
		Scanner sc = new Scanner(System.in);
		int N =sc.nextInt();
		Boolean flg = false;

		for(int i = 1; 10 > i; i++)
		{
			if(N % i == 0)
			{
				if((N / i) < 10) {
					flg = true;
					break;
				}
			}
		}
		System.out.println(flg?"Yes":"No");
	}
}

Measured memory_bytes: 21972
#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <iomanip>
#include <vector>
#include <cstring>
#include <queue>
#include <map>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
using namespace std;
using ll = long long;
using ld = long double;
using ull = unsigned long long;
using uld = unsigned long long;
using P = pair<int,int>;
const int dx[4] = {0,1,0,-1};
const int dy[4] = {1,0,-1,0};
template<class T> inline bool chmax(T &a,T& b){if(a < b){a = b; return true;} else return false;}
template<class T> inline bool chmin(T &a,T& b){if(a > b){a = b; return true;} else return false;}
//function area

//main area
int main(){
    ll x, k, d;
    cin >> x >> k >> d;
    ll ans = 0;
    if(x < 0){
        d *= -1;
    }
    if(x/d >= k){
        ans = abs(x - k*d);
    }
    else{
        if(x < 0){
            x *= -1;
            d *= -1;
        }
        if(x/d % 2 == k%2){
            ans = x%d;
        }
        else{
            ans = d - x%d;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3568
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define FORD(i,a,b) for(int i=a;i>=b;i--)
#define ALL(a)  (a).begin(),(a).end()
#define SZ(a) int((a).size())
#define SORT(c) sort((c).begin(),(c).end())
#define PB push_back
#define MP make_pair
#define MEMSET(v, h) memset((v), h, sizeof(v))
#define sqr(x)  ((x) * (x)) 
#define cub(x)  ((x) * (x) * (x))
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; }
// int gcd(int a,int b){return b?gcd(b,a%b):a;}

ll dp[200100];
ll colorsum[200100];
ll c[200100];
ll MOD = pow(10,9) + 7;

int main() {
  ll n; cin >> n;
  FOR(i,0,n-1) cin >> c[i];

  dp[0] = 1;
  FOR(i,1,n){
    dp[i] += dp[i-1];

    if(c[i-1]!=c[i]){
      dp[i] += colorsum[c[i-1]];
      dp[i] %= MOD;
      colorsum[c[i-1]] = dp[i]; 
    }
  }

  cout << dp[n] << endl;



}


Measured memory_bytes: 4992
//
// AtCoder ABC123-B - Five Dishes
//
#include <bits/stdc++.h>
using namespace std;

int tmx(int x) {
    if ( x % 10 == 0) {
       return (x);

    } else {
        return ( (x/10 + 1)*10);
    }
}
int main(){
    vector<int> dish(5);

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

    int minElapse = 1000000;
    int elapse;
    for(int i=0; i <120; i++) {
        elapse =0;
        // for(auto x : dish) {
        for(int j=0; j<5; j++) {
            if (j==4) {
                elapse += dish[j];    
            } else {
                elapse += tmx(dish[j]);
            }   
        }
        minElapse = min(minElapse, elapse);

        next_permutation(dish.begin(), dish.end());

    }
    cout << minElapse << endl;
    return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
import sys
import heapq
input = lambda: sys.stdin.buffer.readline()[:-1].decode('utf-8')
sys.setrecursionlimit(10**8)
inf = float('inf')
mod = 10**9+7

n,m=map(int,input().split())
LRC=[list(map(int,input().split())) for i in range(m)]
LRC.sort(key=lambda tup:tup[1])

#####segfunc######
def segfunc(x,y):
   return min(x,y)


def init(init_val):
    #set_val
    for i in range(n):
        seg[i+num-1] = init_val[i]
    #built
    for i in range(num-2, -1, -1):
        seg[i] = segfunc(seg[2*i+1], seg[2*i+2])


def update(k, x):
    k += num-1
    seg[k] = x
    while k:
        k = (k-1)//2
        seg[k] = segfunc(seg[k*2+1], seg[k*2+2])


def query(p, q):
    if q <= p:
        return ide_ele
    p += num-1
    q += num-2
    res = ide_ele
    while q-p > 1:
        if p & 1 == 0:
            res = segfunc(res, seg[p])
        if q & 1 == 1:
            res = segfunc(res, seg[q])
            q -= 1
        p = p//2
        q = (q-1)//2
    if p == q:
        res = segfunc(res, seg[p])
    else:
        res = segfunc(segfunc(res, seg[p]), seg[q])
    return res


#####単位元######
ide_ele =inf

#num:n以上の最小の2のべき乗
num = 2**(n-1).bit_length()
seg = [ide_ele]*2*num

dp=[inf]*(n)
dp[0]=0

init(dp)



for L,R,C in LRC:
    L-=1;R-=1
    # print(query(L, R))
    dp[R] = min(dp[R], query(L, R)+C)
    update(R, dp[R])

print(dp[n-1] if dp[n-1]!=inf else -1)
# print(dp[:10])



Measured memory_bytes: 129832
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <climits>
#include <cmath>
#include <utility>
#include <string>
#include <cstring>
#include <functional>

using namespace std;

int main() {

	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
    int a, b;
    cin >> a >> b;

    for (int i = b * 10; i <= 1010; ++i) {
        if (fabs(floor(0.08 * i) - a) < 1e-6 && fabs(floor(0.1 * i) - b) < 1e-6) {
            cout << i << endl;
            return 0;
        }
    }

    cout << -1 << endl;
	return 0;
}

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

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

  set<int> a;
  a.insert(s);
  int n = s;
  for(int i = 2; i < 1000001; i++) {
    if(n % 2 == 0) n /= 2;
    else n = 3 * n + 1;

    if(a.count(n)) { cout << i << endl; return 0; }
    a.insert(n);
  }
 return 0;
}

Measured memory_bytes: 256
# coding:utf-8

import math

def main():
    n = int(raw_input())
    ws = map(int, raw_input().split())
    result = 100000000000000
    for i in range(n+1):
        small = 0
        large = 0
        for j in range(i):
            small += ws[j]
        for k in range(i,n):
            large += ws[k]
        result = min(result, abs(large - small))
    print result

if __name__ == "__main__":
    main()



Measured memory_bytes: 2568
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
lint M = 1e18;

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

    lint a;
    cin >> a;
    string b;
    cin >> b;
    string c = {b[0], b[2], b[3]};
    lint res = a * stoi(c);
    cout << res/100 << endl;
    
    return 0;
}

Measured memory_bytes: 3652
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <stack>
#define N 1000006
#define ls(x) x << 1
#define rs(x) x << 1 | 1

using namespace std;

struct edge{
	int to, nxt;
}e[N];

struct flag{
	int pl, id;

	friend bool operator < (flag a, flag b){
		return a.pl < b.pl;
	}
}x[N];

int n, cnt, ans, tot, num;
int rkx[N], rky[N], fir[N], dfn[N], low[N], co[N];
bool vis[N];

stack < int > st;

int read();
bool cmp(flag, flag);
void build(int ,int ,int);
bool check(int);
void link(int ,int ,int ,int ,int ,int);
void add(int ,int);
void tarjan(int);

int main(){
	n = read();n <<= 1;int l = 0, r = 0;
	for(int i = 0; i < n; ++i) x[i].pl = read(), x[i].id = i, r = max(r, x[i].pl);
	sort(x, x + n);
	for(int i = 0; i < n; ++i) rkx[x[i].id] = i;
	while(l <= r){
		int mid = (l + r) >> 1;
		if(check(mid)) ans = mid, l = mid + 1;
		else r = mid - 1;
	}
	cout << ans << endl;
	return 0;
}

int read(){
	int x = 0;char ch = getchar();
	for(; !isdigit(ch); ch = getchar());
	for(; isdigit(ch); ch = getchar()) x = (x << 3) + (x << 1) + (ch ^ 48);
	return x;
}

void add(int u,int v){
	e[++cnt].to = v;e[cnt].nxt = fir[u];fir[u] = cnt;
	return ;
}

void build(int pos,int l,int r){
	if(pos != 1) add(pos >> 1, pos);
	if(l == r){
		rky[l] = pos;return ;
	}
	int mid = (l + r) >> 1;
	build(ls(pos), l, mid);build(rs(pos), mid + 1, r);
	return ;
}

void link(int pos,int l,int r,int nl,int nr, int d){
	if(nl > nr) return ;
	if(l >= nl && r <= nr){
		add(d, pos); return ;
	}
	int mid = (l + r) >> 1;
	if(mid >= nl) link(ls(pos), l, mid, nl, nr, d);
	if(mid < nr) link(rs(pos), mid + 1, r, nl, nr, d);
	return ;
}

bool check(int p){
	num = tot = cnt = 0;
	memset(fir, 0, sizeof fir);memset(vis, false, sizeof vis);memset(dfn, 0, sizeof dfn);
	build(1, 0, (n << 1) - 1);
	for(int i = 0; i < n; ++i){
		add(rky[i], rky[rkx[x[i].id ^ 1] + n]); add(rky[i + n], rky[rkx[x[i].id ^ 1]]);
		int l = upper_bound(x, x + n, (flag){x[i].pl - p, 0}) - x;
		int r = lower_bound(x, x + n, (flag){x[i].pl + p, 0}) - x - 1;
		if(l > r) continue;
		link(1, 0, (n << 1) - 1, l + n, i + n - 1, rky[i]);
		link(1, 0, (n << 1) -1, i + n + 1, r + n, rky[i]);
	}
	for(int i = 0; i < (n << 1); ++i)
		if(!dfn[rky[i]]) tarjan(rky[i]);
	for(int i = 0; i < n; ++i)
		if(co[rky[i]] == co[rky[i + n]]) return false;
	return true;
}

void tarjan(int u){
	low[u] = dfn[u] = ++tot;vis[u] = true;st.push(u);
	for(int i = fir[u]; i; i = e[i].nxt){
		int v = e[i].to;
		if(!dfn[v]) tarjan(v), low[u] = min(low[u], low[v]);
		else if(vis[v]) low[u] = min(low[u], low[v]);
	}
	if(low[u] == dfn[u]){
		++num;
		do{
			co[u] = num;
			u = st.top(); st.pop();vis[u] = false;
		}while(dfn[u] != low[u] && !st.empty());
	}
	return ;
}


Measured memory_bytes: 30720
#include<bits/stdc++.h>
using namespace std;
#define ll         long long int
#define co         cout
#define ci         cin
#define sf1(n)     scanf("%lld",&n)
#define sf2(n,m)   scanf("%lld %lld",&n,&m);
#define sf3(n,m,p) scanf("%lld %lld %lld",&n,&m,&p)
#define pf1(n)     printf("%lld\n",n);
#define mem(a,b)   memset(a,b,sizeof(a))
#define en         cout<<endl;
#define pb         push_back
#define gcd(n,m)   __gcd(n,m)
#define lcm(n,m)   ((n)/__gcd(n,m))*(m)
#define fi         first
#define se         second
#define coy        cout<< "YES"<<endl;
#define con        cout<< "NO"<<endl;
#define f(a,b)     for(ll i=a;i<b;i++)
#define all(x)     (x).begin(),(x).end()
#define allr(x)    (x).rbegin(),(x).rend()
#define pi         pair<ll,ll>
#define br         break;
#define i64        long long
#define PI         2*acos(0.0)

int main()
{
    ll t,n,g,k,m,mx=0,mn=1e9,c,res,c1,x,y,w,z,c2;
    ci>>n;
    vector<ll>a(n),b(n);
    f(0,n) ci>>a[i];
    f(0,n) ci>>b[i];
    x=0;y=0;res=0;
    f(0,n)
    {
       res+=max(0LL,a[i]-b[i]);
    }
    co<<res;
}


Measured memory_bytes: 3600
from collections import Counter
N = int(input())
S = []
for _ in range(N):
  S.append(input())
c = Counter(S)

print(f"AC x {c['AC']}")
print(f"WA x {c['WA']}")
print(f"TLE x {c['TLE']}")
print(f"RE x {c['RE']}")


Measured memory_bytes: 16616
#include <iostream>
#include <string>

using namespace std;

int main(){
	string s;
	cin >> s;

	for (int i = 1; i < s.size(); i++){
		if (s[i-1] == s[i]){
			cout << "Bad" << endl;
			return 0;
		}
	}

	cout << "Good" << endl;
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
  int N,i,count=1,max;
  scanf("%d",&N);
  int A[N];
  for(i=0;i<N;i++) scanf("%d",&A[i]);
  max=1;
  for(i=0;i<N;i++)
  {
    if(A[i]==1)
    {
      count++;
    }
    else
    {
      count=1;
    }
    if(max<count) max=count;
  }
  printf("%d\n",max);
  return 0;
}



Measured memory_bytes: 2100
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,-1,sizeof(x))
const int INF = 1000000001;

int main(){
  char a[3][3];
  rep(i, 3){
    rep(j, 3){
      cin >> a[i][j];
    }
  }
  cout << a[0][0]<<a[1][1]<<a[2][2] <<endl;
}

Measured memory_bytes: 256
a = list(int(input()) for _ in range(5))
s = sum(a)

b = [i for i in a if i % 10 != 0]

if b:
    a_ = list(10-(j % 10) for j in b)
    a_.sort()
    a_.pop(-1)
    print(s + sum(a_))
else:
    print(s)

Measured memory_bytes: 3060
n = gets.chomp.to_i #=> d.size
d = Hash.new(0)
gets.chomp.split(" ").each do |i|
  d[i] += 1
end
m = gets.chomp.to_i #=> t.size
t = Hash.new(0)
gets.chomp.split(" ").each do |i|
  t[i] += 1
end

t.each do |k,v|
  if d[k] < v
    puts "NO"
    exit
  end
end

puts "YES"

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

using namespace std;

constexpr int INF = 1e8;
constexpr int MAX_N = 100;
int N;
char s[MAX_N] = {'\0'};

void input()
{
  scanf("%d", &N);
  scanf("%s", &s);
}

void solve()
{
  int sum = 0;
  for(int i = 0; i < N; i++)
  {
    if(s[i] == 'R')
    {
      sum++;
    }
  }

  if(sum <= N/2)
  {
    printf("No");
  }
  else
  {
    printf("Yes");
  }
}

int main()
{
  input();
  solve();

  return 0;
}

Measured memory_bytes: 256