akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
#include <stdlib.h>
#include<string.h>
#include<math.h>
#define loop(i, l, r) for(i=l; i<r; i++)/*Instead of function, (for).*/
#define rep(i,r) for(i=0; i<r; i++)
#define Max(a, b) ((a) > (b) ? (a) : (b))
#define Min(a, b) ((a) < (b) ? (a) : (b))
typedef long long int lli;
/*Return Combination ,(nCr)*/
int combi(int n, int r)
{
	if(r==0 || r==n) return 1;
	else return combi(n-1,r) + combi(n-1,r-1);
}
/*Return gcd(a, b)*/
int gcd(int a, int b){
	if(b == 0) return a;
	else return gcd(b, a % b);
}
//qsort�֐��Ɏg��compare�֐�,(long long int, int, double�^)
int compare_lli(const void *a, const void *b)
{
    return *(lli*)a - *(lli*)b;
}
int compare_int(const void *a, const void *b)
{
    return *(int*)a - *(int*)b;
}
int compare_double(const void *a, const void *b)
{
    return *(double*)a - *(double*)b;
}
/*qsort(data, 10, sizeof(int_lli_double), compare_int);*/
/*qsort(�z��, �v�f��, sizeof(�z��̌^), compare_�z��̌^);*/
int chek(int *tmp1, int *tmp2, int n){
	int i;
	for(i=0; i<n; i++){
		if(tmp1[i] != tmp2[i]){
			return 1;
		}
	}
	return 0;
}//2�̔z�񂪈�v���邩�̔���_(return��v��0,�s��v���P)
int main(void)
{
	int x, y, z;
	int a, b, c;
	scanf("%d%d%d", &x, &y, &z);
	a = z;
	b = x;
	c = y;
	printf("%d %d %d ", a, b, c);
	return 0;
}

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

template <typename T>
vector<T> make_vector(int sz)
{
	return vector<T>(sz);
}

template <typename T, typename... U>
auto make_vector(int sz, U... tails)
{
	return vector<decltype(make_vector<T>(tails...))>(sz, make_vector<T>(tails...));
}

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

	int64_t n = s.size();

	int64_t ans = 0;

	auto dp = make_vector<int64_t>(3, 673);
	dp[0][0] = 1;

	for (int64_t i = 0, j = 0, k = 0; i < n; i++)
	{
		int64_t d = (s[i] - '0');

		j = (10 * j + d) % 3;
		k = (10 * k + d) % 673;

		{
			auto next = make_vector<int64_t>(3, 673);
			for (int64_t x = 0; x < 3; x++)
			{
				for (int64_t y = 0; y < 673; y++)
				{
					next[x][(10 * y) % 673] += dp[x][y];
				}
			}
			swap(dp, next);
		}

		ans += dp[j][k]++;
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 3728
#include <bits/stdc++.h>
typedef long long i64;
using std::cout;
using std::endl;
using std::cin;

int main(){
	int a, b; cin >> a >> b;
	
	if(a == 1) cout << 1867 + b << endl;
	else if(a == 2) cout << 1911 + b << endl;
	else if(a == 3) cout << 1925 + b << endl;
	else if(a == 4) cout << 1988 + b << endl;
	else {
		if(b < 1912) cout << "M" << b - 1867 << endl;
		else if(b < 1926) cout << "T" << b - 1911 << endl;
		else if(b < 1989) cout << "S" << b - 1925 << endl;
		else cout << "H" << b - 1988 << endl;
	}
	return 0;
}



Measured memory_bytes: 3108
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <limits>

using namespace std;
typedef long long int ll;
const int MOD = 1000000007;
void sayYes() { cout << "Yes" << endl; };
void sayNo() { cout << "No" << endl; };
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }                   // 最大公約数
ll lcm(ll a, ll b) { return a * b / gcd(a, b); };                      // 最小公倍数
ll getDigit(ll num) { return log10(num) + 1; }                         // 桁数
ll digitSum(ll n) { return (n < 10) ? n : digitSum(n / 10) + n % 10; } // 各桁の和
#define rep(i, n) for (ll i = 0; i < n; i++)

void Main()
{
    int n, m;
    cin >> n >> m;
    int sum = 0;
    rep(i, m)
    {
        int a;
        cin >> a;
        sum += a;
    }

    if (n - sum >= 0)
    {
        cout << n - sum << endl;
    }
    else
    {
        cout << -1 << endl;
    }

    return;
}

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

Measured memory_bytes: 3704
use std::io::{self, BufRead, BufWriter, Write};

fn solve<R, W>(reader: R, mut writer: W)
where
    R: BufRead,
    W: Write,
{
    let mut lines = reader.lines();
    let a_line = lines.next().unwrap().unwrap();
    let mut splited = a_line.trim().split_whitespace();
    let a: i32 = splited.next().unwrap().parse().unwrap();
    let b: i32 = splited.next().unwrap().parse().unwrap();

    let mut ans = a - b * 2;
    if ans < 0 {
        ans = 0;
    }

    writeln!(&mut writer, "{}", ans).unwrap();
}

fn main() {
    let stdio = io::stdin();
    let input = stdio.lock();

    let stdout = io::stdout();
    let output = BufWriter::new(stdout.lock());

    solve(input, output);
}

#[cfg(test)]
mod tests {
    use super::*;

    const TESTS: &'static [(&'static [u8], &'static [u8])] = &[
        (
            br"12 4", br"4
",
        ),
        (
            br"20 15", br"0
",
        ),
        (
            br"20 30", br"0
",
        ),
    ];

    #[test]
    fn test_a() {
        for &(input, expected) in TESTS {
            let mut output = Vec::new();
            solve(input, &mut output);
            let expected_str = String::from_utf8(expected.to_vec()).unwrap();
            let output_str = String::from_utf8(output).unwrap();
            assert_eq!(expected_str, output_str);
        }
    }
}


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

#define INCANT cin.tie(0), ios::sync_with_stdio(false), cout << fixed << setprecision(20)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,n) FOR(i,0,n)
#define all(x) (x).begin(),(x).end()
#define out(a) cout << a << endl
#define PRINT(V) for (auto v : (V)) cout << v << " "

const int MOD = 1000000007;
const double PI = acos(-1.0);

void solve() {
    ll K;
    cin >> K;
    deque<ll> q;
    FOR(i, 1, 10){
        q.push_back(i);
        if(i==K){
            out(i);
            return;
        }
    }
    ll count=9;
    while(true){
        ll a = q.front();
        q.pop_front();
        ll amari = a%10;

        if(amari != 0){
            count++;
            ll b = amari-1;
            ll c = a*10+b;
            if(count==K) {
                out(c);
                return;
            }
            q.push_back(c);
        }
        count++;
        ll b = amari;
        ll c = a*10+b;
        if(count==K) {
            out(c);
            return;
        }
        q.push_back(c);

        if(amari != 9){
            count++;
            ll b = amari+1;
            ll c = a*10+b;
            if(count==K) {
                out(c);
                return;
            }
            q.push_back(c);
        }

    }

}
int main() {
    INCANT;
    solve();
    return 0;
}




Measured memory_bytes: 3968
#include<iostream>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<string>
#include<stack>
#include<queue>
#include<deque>
#include<set>
#include<map>
#include<algorithm>
#include<functional>
#include<utility>
#include<cmath>
#include<complex>
#include<iomanip>

using namespace std;

#define REP(i,s,e) for(int i=int(s);i<=int(e);i++)
#define rep(i,n) for(int i=0;i<int(n);i++)
#define pi 3.14159265358979

int main(void){

	int n;
	cin >> n;
	rep(i,n){
	vector<int>cn(9),p; vector<char>cc(9);

	rep(j,9) cin >> cn[j];
	rep(j,9) cin >> cc[j];

	rep(j,9) p.push_back(j);

	bool f=false;
	while(next_permutation(p.begin(),p.end())){

		for(int j=0;j<9;j+=3){
			vector<int>c;
			c.push_back(cn[p[j]]);
			c.push_back(cn[p[j+1]]);
			c.push_back(cn[p[j+2]]);
			sort(c.begin(),c.end());

			int d1=c[1]-c[0],d2=c[2]-c[1];
			if(cc[p[j]]==cc[p[j+1]] && cc[p[j+1]]==cc[p[j+2]] && d1==d2 && (d1==0 || d1==1))
	        f=true;
			else{ f=false; break;}
		}

		if(f){
			cout << 1 << endl; break;
		}
	}

    if(!f) cout << 0 << endl;

	}

	return 0;
}

Measured memory_bytes: 1220
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.OptionalInt;
import java.util.regex.Pattern;
import java.util.stream.Stream;

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

    new Main().run();
  }

  public void run() {
    
    try(BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {

      int n = Integer.parseInt(br.readLine());
      String line = br.readLine();
      final Pattern delim = Pattern.compile(" ");
      int[] arrayS = delim
        .splitAsStream(line)
        .parallel()
        .mapToInt(Integer::parseInt)
        .toArray();

      OptionalInt max =
        Arrays.stream(arrayS).max();

      dispIntArray( countingSort(arrayS, max.getAsInt()) );
    }
    catch ( IOException e ) {
      System.out.println("IOException!");
    }

  }

  public int[] countingSort(int[] a, int k) {

    int   aLength = a.length;
    int[] result  = new int[aLength];
    int[] counter = new int[k+1];

    for (int var : a) {
      counter[var]++;
    }

    for (int i=1, max=k+1; i < max; i++) {
      counter[i] += counter[i-1];
    }

    for (int i=aLength-1, val=0; i>=0; i--) {
      val = a[i];
      result[counter[val]-1] = val;
      counter[val]--;
    }

    return result;
  }

  public void dispIntArray(int[] target) {
    StringBuilder s = new StringBuilder();

    for (int i : target) { s.append(i).append(" "); }
    s.setLength(s.length()-1);

    System.out.println(s);
  }
}


Measured memory_bytes: 201552
#include<iostream>
#include <algorithm>
#include <string>
#include<math.h>
#include<stdio.h>
#include<vector>
#define rep(i,n)for(int i=0;i<n;i++)
//printf("%.yf\n",x); xを小数点以下y桁で
using namespace std;
int main() {
	int a, b, c, d, e, f;
	cin >> a >> b >> c >> d >> e >> f;
	if (e - a <= f) {
		cout << "Yay!" << endl;
	}
	else {
		cout << ":(" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
//#pragma warning disable
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System;
using System.Numerics;
using System.Threading.Tasks;
using static System.Math;
using static System.Console;
class Z { static void Main() => new K(); }
class K
{
	int F() => int.Parse(ReadLine());
	long FL() => int.Parse(ReadLine());
	int[] G() => ReadLine().Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse).ToArray();
	long[] GL() => ReadLine().Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries).Select(long.Parse).ToArray();
	public const int MOD = 1000000007;
	public K()
	{
		SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
		Solve();
		Out.Flush();
	}
	void Solve()
	{
		var S = Console.ReadLine();
		Console.WriteLine(S[0] == S[2] ? "Yes" : "No");
	}
}


Measured memory_bytes: 11092
#include<iostream>

using namespace std;

typedef long long ll;

constexpr int BASE = 1000000007;

int main() {
	ll ans=0;
	ll n, k;
	cin >> n >> k;
	ll low = k * (k - 1) / 2;
	ll high = k * (2 * n - k + 1) / 2;
	ans += high - low+1;
	ans %= BASE;
	for (ll i = k + 1;i <= n + 1;i++) {
		low += i - 1;
		high += n - i + 1;
		ans += high - low+1;
		ans %= BASE;
	}
	cout << ans << endl;
}

Measured memory_bytes: 3152
h, w = map(int, input().split())
a = [list(input()) for i in range(h)]

tate = []
yoko = []
for i in range(h):
    for j in range(w):
        if a[i][j] == "#":
            yoko.append(i)
            tate.append(j)

for i in range(h):
    for j in range(w):
        if i in yoko and j in tate:
            print(a[i][j], end="")
    if i in yoko:
        print()


Measured memory_bytes: 4724
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;
using vl = vector<ll>;

/* short */
#define pb push_back
#define mp make_pair
#define Fi first
#define Se second
#define ALL(v) begin(v), end(v)
#define RALL(v) rbegin(v), rend(v)

/* REPmacro */
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define FORR(i, a, b) for(int i = (a); i >= (b); i--)
#define REP(i, n) for(int i = 0; i < (n); i++)
#define FOREACH(x, a) for(auto x : a)

/* exchange */
#define CHMIN(a, b) (a) = min((ll)(a), (ll)(b))
#define CHMAX(a, b) (a) = max((ll)(a), (ll)(b))

/* function */
#define IN(x) cin >> x
#define DEBUG(x) cerr << (x) << " "
#define LN() cerr << "\n"
#define PRINT(x) cout << (x) << endl
#define BR cout << endl

/* const */
const int ARRAY = 100005;
const int INF = 1001001001; // 10^9
const ll LINF = 1001001001001001001; // 10^18
const int MOD = 1e9 + 7;

ll N = 0;
string S;
ll t;
ll ret = 0;

ll used[10][10];
ll table[ARRAY];
ll appear[10];

void input() {
  IN(N);
  IN(S);
  REP(i, 10) {
    REP(j, 10) {
      used[i][j] = 0;
    }
    appear[i] = 0;
  }
  REP(i, N) {
    table[i] = 0;
  }
  ll c = S[N-1] - '0';
  FORR(i, N-2, 0) {
    ll c = S[i+1] - '0';
    if (appear[c] == 0) {
      table[i] = table[i+1] + 1;
    } else {
      table[i] = table[i+1];
    }
    appear[c] = 1;
  }
  REP(i, N) {
    DEBUG(table[i]);
  }
  LN();
}

void solve() {
  REP(i, N) {
    ll l = S[i] - '0';
    FOR(j, i+1, N) {
      ll m = S[j] - '0';
      if (!used[l][m]) {
        DEBUG(l);
        DEBUG(m);
        DEBUG(table[j]);
        LN();
        ret += table[j];
        used[l][m] = 1;
      }
    }
  }
  PRINT(ret);
}

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


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

constexpr int inf = 0x3f3f3f3f;
constexpr ll linf = 0x3f3f3f3f3f3f3f3fLL;

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

    string s; cin >> s;
    string ans;
    for (auto &c: s) {
        if (c == 'B') {
            if (!ans.empty()) ans.pop_back();
        } else {
            ans.push_back(c);
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
import math

N = int(input())

if N == 0:
    print(0)
    exit()

S = []
while True:
    if N == 1:
        S.append(1)
        break
    tmp = N%2
    S.append(tmp)
    if tmp == 1:
        N -= 1
    N = int(N/(-2))

s = map(str, reversed(S))
ans = ''.join(s)
print(ans)


Measured memory_bytes: 3060
fun main(args: Array<String>) {
    val (n, k) = readLine()!!.toString().split(' ').map { it.toInt() }
    val arr = readLine()!!.toString().split(' ').map { it.toInt() }.toIntArray()
    var ans = 0
    fun check(x: Int): Boolean {
        var count = 0L
        for (i in 0 until n) {
            count += (arr[i] + x - 1) / x - 1
        }
        return count <= k
    }

    var l = 1
    var r = arr.max()!!
    while (l <= r) {
        val mid = l + (r - l) / 2
        if (check(mid)) {
            ans = mid
            r = mid - 1
        } else {
            l = mid + 1
        }
    }
    println(ans)
}

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

using namespace std;

using ll = long long;
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define FORE(i, a, b) for (int i = (a); i <= (b); ++i)
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repe(i, n) for (int i = 0; i <= (n); ++i)
#define ALL(v) (v).begin(), (v).end()
#define SP cout << fixed << setprecision(10)
typedef pair<int, int> P;
const int INF = (int)1e9;
const int MOD = (int)1e9 + 7;
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }

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

    int n, d;
    cin >> n >> d;
    int x[n][d];
    rep(i, n) rep(j, d) cin >> x[i][j];

    int cnt = 0;
    rep(i, n) {
        FOR(j, i, n) {
            if (i != j) {
                double sum = 0;
                rep(k, d) { sum += (x[i][k] - x[j][k]) * (x[i][k] - x[j][k]); }
                if (sqrt(sum) == (int)(sqrt(sum))) cnt++;
            }
        }
    }

    cout << cnt << endl;

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cmath>
using namespace std;
int cal_digit(int x){
    int digit(1);
    while(x/10 != 0){
        x /= 10;
        digit++;
    }
    return digit;
}
int main(void){
    int a,b;
    cin>>a>>b;
    int c = a * pow(10,cal_digit(b)) + b;
    bool yes(false);
    int i(0);
    while(i*i <= c){
        i++;
        if(i*i == c)yes = true;
    }
    if(yes)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}

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

#ifdef DONLINE_JUDGE
//freopen("a.in", "r", stdin);
//freopen("a.out","w",stdout); // console output is better (in most cases)
#else
// add i/o method of specific testing system
#endif

using namespace std;

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

    int a, b;
    char op;
    while (cin >> a >> op >> b, op != '?')
    {
        if (op == '+')
            cout << a + b << endl;
        if (op == '*')
            cout << a * b << endl;
        if (op == '-')
            cout << a - b << endl;
        if (op == '/')
            cout << a / b << endl;
    }

    return 0;
}


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

int main(){
  int N;
  cin >> N;
  vector<int> A(N);
  for(int i=0;i<N;i=i+1){
    cin >> A.at(i);
  }
  sort(A.begin(),A.end());
  int max_def;
  max_def = A.at(N-1)-A.at(0);
  cout << max_def << endl;
}


Measured memory_bytes: 256
import sys
from bisect import *
from heapq import *
from collections import *
from itertools import *
from functools import *

sys.setrecursionlimit(100000000)
input = lambda: sys.stdin.readline().rstrip()

K, X = map(int, input().split())
print(' '.join(map(str, [X + i for i in range(-K + 1, K)])))



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


int main(){
    ll N,A,B;
    cin >> N >> A >> B;
    ll cnt = 0;
    ll cntr = (ll)(N/(A+B));
    ll amari = N-cntr*(A+B);
    if(amari<A){
        cnt = cntr*A+amari;
    }else{
        cnt = (cntr+1)*A;
    }
    cout << cnt << endl;
}


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

const int MAXN = 100000+9;
int n;
int cnt[MAXN];

int main(){
	scanf("%d",&n);
	int i;
	for(i=1;i<=n;i++){
		int x;
		scanf("%d",&x);
		if(x==0){
			cnt[0]++;
			cnt[1]++;
			continue;
		}
		cnt[x]++;
		cnt[x-1]++;
		cnt[x+1]++;
	}
	int ans=0;
	for(i=0;i<=100000+1;i++){
		ans=max(ans,cnt[i]);
	}
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 512
using System;
using System.Linq;

namespace ConsoleApp3
{
    internal class Program
    {
        private static void Main(string[] args)
        {
            var input1 = int.Parse(Console.ReadLine());
            
            if (input1 >= 30)
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }
        }
    }
}


Measured memory_bytes: 27516
#include <stdio.h>
int main()
{
    int N, A[100010];
    int i, ans = 0;
    scanf("%d", &N);
    for (i = 0; i < N; i++)
    {
        scanf("%d",& A[i]);
        if (A[i] % 2 == 1)
        {
            ans++;
        }
    }
    if (ans % 2 == 1)
    {
        printf("NO\n");
    }
    else
        printf("YES\n");
}


Measured memory_bytes: 640
// {{{ include
#include <cstdio>
#include <cmath>
#include <cstring>
#include <iostream>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <algorithm>
// }}}
#include <cassert>
#include <cctype>

using namespace std;

struct Parser {
  typedef string::const_iterator cursor_t;
  inline void consume(cursor_t& cur, char expected){
    assert(*cur == expected);
    ++cur;
  }
  bool equation(cursor_t& cur){
    bool r = formula(cur);
    consume(cur, '=');
    return r == formula(cur);
  }
  bool formula(cursor_t& cur){
    if (isupper(*cur)){
      bool r = *cur == 'T';
      ++cur;
      return r;
    }
    if (islower(*cur)){
      int x = *cur - 'a';
      ++cur;
      return (state >> x) & 1;
    }
    if (*cur == '-'){
      ++cur;
      return !formula(cur);
    }
    if (*cur == '('){
      ++cur;
      bool r = formula(cur);
      if (*cur == '*'){
        ++cur;
        r = formula(cur) && r;
      }
      else if (*cur == '+'){
        ++cur;
        r = formula(cur) || r;
      }
      else if (*cur == '-'){
        ++cur;
        consume(cur, '>');
        r = !(!formula(cur) && r);
      }
      consume(cur, ')');
      return r;
    }
    assert(0);
  }
  bool eval(const string& s){
    auto b = s.begin();
    bool r = equation(b);
    assert(b == s.end());
    return r;
  }
  void setState(int st){
    state = st;
  }
  int state;
};

int main()
{
  Parser parser;
  string S;
  while (cin >> S, S != "#"){
    for (int i = 0; i < (1 << 12); i++){
      parser.setState(i);
      if (!parser.eval(S)){
        puts("NO");
        goto END;
      }
    }
    puts("YES");
END:;
  }

  return 0;
}

Measured memory_bytes: 1232
def solve(a, b, k):
    if a >= k:
        res_a = a - k
        res_b = b
    elif a + b >= k:
        res_a = 0
        res_b = a + b - k
    else:
        res_a = 0
        res_b = 0
    return "{} {}".format(res_a, res_b)


def main():
    a, b, k = map(int, input().split())
    res = solve(a, b, k)
    print(res)


def test():
    assert solve(2, 3, 3) == "0 2"
    assert solve(500000000000, 500000000000, 1000000000000) == "0 0"


if __name__ == "__main__":
    test()
    main()


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
int main(){
  int s;
  cin >> s;
  int t;
  cin >> t;
  int mini = min(t, s);
  int maxi = max(t, s);
  for(int i = 0; i < maxi; i++){
    cout << mini;
  }
  cout << endl;
}

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

int main() {
  int A, B, C, D;
  cin >> A >> B >> C >> D;
  if (A + B > C + D) {
      cout << "Left" << endl;
  } 
  else if (A + B == C + D){
      cout << "Balanced" << endl;
  }
  else {
      cout << "Right" << endl;  }
}

Measured memory_bytes: 256
def check(a, b, mid):
  k = min(mid, (a + mid + 1) // 2)
  return (a + mid + 1 - k) * k < a * b

def solve(a, b):
  ok = 0
  ng = b
  while ng - ok > 1:
    mid = (ok + ng) // 2
    if check(a, b, mid):
      ok = mid
    else:
      ng = mid
  return a - 1 + ok

q = int(input())
for i in range(q):
  a, b = map(int, input().split())
  print(solve(min(a, b), max(a, b)))


Measured memory_bytes: 3064
# via https://stackoverflow.com/questions/15347174/python-finding-prime-factors

def prime_factors(n):
    i = 2
    factors = []
    while i * i <= n:
        if n % i:
            i += 1
        else:
            n //= i
            factors.append(i)
    if n > 1:
        factors.append(n)
    return factors
n, p = map(int, input().split())

pp = prime_factors(p)
from collections import defaultdict

c = defaultdict(int)
for p in pp:
    c[p] += 1

ans = 1
for k in c.keys():
    ans *= k ** (c[k] // n)

print(ans)

Measured memory_bytes: 3316
#include <bits/stdc++.h>
using namespace std;
#define ll long long  
template <typename T>
bool PN(T x){ if (x <= 1) return false; if (x == 2) return true; for (int i = 2; i < sqrt(x) + 1; i++) if (x % i == 0) return false; return true;}

const ll MOD = 1e9+7;

void solve(){
  int n, m; cin >> n >> m;
  char picture[n][m];
  for(int i = 0; i < n; ++i){
    for(int j = 0; j < m; ++j){
      cin >> picture[i][j];
    }
  }

  for(int i = 0; i < m+2; ++i) cout << "#";
  cout << endl;
  for(int i = 0; i < n; ++i){
    cout << "#";
    for(int j = 0; j < m; ++j) cout << picture[i][j];
    cout << "#" << endl;
  }
  for(int i = 0; i < m+2; ++i) cout << "#";
  cout << endl;
  
}

int main()
{
  solve();
  return 0;
}

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

int main() {
  string S;
  int cn = 0;
  vector<bool> flag(26);

  cin >> S;
  for(int i=0;i<S.size();++i){
    flag.at(S.at(i) - 'a') = true;
  }
  for(int i=0;i<26;++i){
    if(!flag.at(i)){
      cout << (char)(i + 'a') << endl;
      return 0;
    }
  }
  cout << "None" << endl;
  return 0;
}


Measured memory_bytes: 3704
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        sc.nextLine();
        String S[] = new String[N];
        for (int i = 0; i < N; i++) {
            S[i] = sc.next();
        }
        Arrays.sort(S);
        StringBuffer buf = new StringBuffer("");
        for (int i = 0; i < N; i++) {
            buf.append(S[i]);
        }
        System.out.println(buf);
        sc.close();
    }   
}


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

using namespace std;

vector<int> field[10][10];
int n,m,p;
pair<int,int> orders[1000];

// x,y,zツ篠イツづ個陛サツ古シツづ鳴づ個進ツづ淞陛サ
const int dy[]={1,0,0, 1,1, 0,0,  1,1, -1,1,1,1};
const int dx[]={0,1,0, 1,-1, 1,-1,  0,0, 1,-1,1,1};
const int dz[]={0,0,1, 0,0, 1,1,   1,-1, 1,1,-1,1};

// ツ債。ツ嘉アツづ個タツーツδ督づ盈-sequenceツつェツ環ョツ青ャツつオツつスツつゥツづつ、ツつゥ
bool check(int x,int y){
    int dig=field[y][x][field[y][x].size()-1];
    // ツつサツづェツつシツづェツづ個陛サツ古シツづ可妥篠つオツづ、ツつサツづォツづづつ「ツづゥツつゥツ陳イツづ猟づゥ
    for(int i = 0; i < 13; i++){
        int cnt=-1;
        int cx=x;
        int cy=y;
        int cz=field[cy][cx].size()-1;
        while(cy>=0&&cx>=0&&cz>=0&&cy<n&&cx<n&cz<field[cy][cx].size()&&field[cy][cx][cz]==dig){
            cy+=dy[i];
            cx+=dx[i];
            cz+=dz[i];
            cnt++;
        }
        cx=x;cy=y;cz=field[cy][cx].size()-1;
        while(cy>=0&&cx>=0&&cz>=0&&cy<n&&cx<n&cz<field[cy][cx].size()&&field[cy][cx][cz]==dig){
            cy-=dy[i];
            cx-=dx[i];
            cz-=dz[i];
            cnt++;
        }
        if(cnt>=m)return true;
    }
    return false;
}

int main(){
    while(cin>>n>>m>>p&&!(n==0&&m==0&&p==0)){
        for(int i = 0; i < n; i++)for(int j = 0; j < n; j++) field[i][j].clear();
        for(int i = 0; i < 1000; i++)
            orders[i].first=orders[i].second=0;
        for(int i = 0; i < p; i++){
            cin>>orders[i].second>>orders[i].first;
            orders[i].first--;
            orders[i].second--;
        }
        // m-sequenceツつェツ個ゥツづつつゥツづつスツづァbreak
        for(int i = 0; i < p; i++){
            int num=1;
            if(i%2==0)num=0;
            field[orders[i].first][orders[i].second].push_back(num);
            if(check(orders[i].second,orders[i].first)){
                if(i%2==0)
                    cout<<"Black "<<i+1<<endl;
                else
                    cout<<"White "<<i+1<<endl;
                break;
            }
            if(i==p-1)
                cout<<"Draw"<<endl;
        }
    }
    return 0;
}

Measured memory_bytes: 0
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] array = new int[n];
        for (int i = 0; i < n; i++) {
            array[i] = sc.nextInt();
        }
        
        int now = array[0];
        int max = 0;
        int count = 0;
        for (int i = 1; i < n; i++) {
            if (array[i] <= now) {
                count++;
            } else {
                max = Math.max(max, count);
                count = 0;
            }
            now = array[i];
        }
        max = Math.max(max, count);
        System.out.println(max);
    }
}


Measured memory_bytes: 49856
// BISMILLAHIR RAHMANIR RAHEEM
// ALLAH IS WATCHING ME
// ALLAH save us from COVID-19.Amin.

//█▀█─█──█──█▀█─█─█
//█▄█─█──█──█▄█─█▄█
//█─█─█▄─█▄─█─█─█─█


#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp> //order_of_key return number of elements less than x, find_by_order return index (pointer use kora lgbe)

using namespace std;
using namespace __gnu_pbds;

#define ull    unsigned long long
#define ll     long long
#define ios    ios::sync_with_stdio(0);cin.tie(0);
#define ses    "\n"
#define all(x) (x).begin(), (x).end()
//#define INF   ((int)2e18)
#define ii pair<ll, ll>

string digit="0123456789";
string small="abcdefghijklmnopqrstuvwxyz";
string capital="ABCDEFGHIJKLMNOPQRSTUVWXYZ";

int dx8[] = {0, 0, 1, 1, 1, -1, -1, -1}; // 8-direction.......
int dy8[] = {1,-1, 1, -1, 0, 0, -1, 1};
int dx4[]= {1,-1,0,0}; // 4-direction...........
int dy4[]= {0,0,1,-1};

const int N=1e6+5;
const ll M=1e18;

typedef tree< ll, null_type, less<ll>, rb_tree_tag,tree_order_statistics_node_update> ordered_set;
typedef tree<pair<ll, ll>,null_type,less<pair<ll, ll>>,rb_tree_tag,tree_order_statistics_node_update> ordered_multiset;

struct Edge
{
    int u, vv;
    bool operator<(Edge const& other)
    {
        return vv > other.vv;
    }
}; // eta joss jinis.krsukal er jnno and sort 1 out of 3 or more er jnno better

/////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////
//main function is here.........
int main()
{
   // ios
   ll x,y,z;
   cin>>x>>y>>z;
   swap(x,y);
   swap(x,z);
   cout<<x<<" "<<y<<" "<<z<<ses;

}


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

#define int long long
#define fi first
#define se second
#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 rep11(i,n) for(int i=1;i<(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define repm(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define sperase(v,n) (v).erase(remove(all(v), n), (v).end())
#define vdelete(v) (v).erase(unique(all(v)), (v).end())
#define pb(n) push_back(n)
#define mp make_pair
#define MOD 1000000007
#define INF 9223372036854775807

bool ans;
string s;

signed main() {
    cin >> s;
    rep(i,s.size()-1) if (s[i] == 'A' && s[i+1] == 'C') ans = true;
    if (ans) cout << "Yes" << endl;
    else cout << "No" << endl;
}












Measured memory_bytes: 256
from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
import itertools
from itertools import permutations, combinations, accumulate
import sys
import bisect
import string
import math
import time


def I(): return int(input())


def MI(): return map(int, input().split())


def LI(): return [int(i) for i in input().split()]


def LI_(): return [int(i)-1 for i in input().split()]


def StoI(): return [ord(i)-97 for i in input()]


def ItoS(nn): return chr(nn+97)


def input(): return sys.stdin.readline().rstrip()


def show(*inp, end='\n'):
    if show_flg:
        print(*inp, end=end)


YN = ['No', 'Yes']
MOD = 10**9+7
inf = float('inf')
IINF = 10**10
l_alp = string.ascii_lowercase
u_alp = string.ascii_uppercase
ts = time.time()
sys.setrecursionlimit(10**6)
nums = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10']


show_flg = True
show_flg = False


def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)


def lcm(a, b):
    return a*b // gcd(a, b)


def good(A, N):
    # A = sorted(A)
    ans = A[0]
    # for i in range(1, N):
    #     ans = fractions.gcd(A[i], ans)
    for i in range(1, N):
        ans = lcm(ans, A[i])
    return ans


def main():
    N, M = MI()
    a = LI()

    if any([i % 2 for i in a]):
        print(0)
        return

    ha = [x//2 for x in a]
    n = good([x//2 for x in a], N)
    # print(n)

    if not all([(n // x) % 2 for x in ha]):
        print(0)
        return

    # print(n, n // 2, M)
    if n > M:
        print(0)
    else:
        t = M // n
        if t % 2 == 0:
            t -= 1
        print(t // 2 + 1)


if __name__ == '__main__':
    main()


Measured memory_bytes: 64236
#include<stdio.h>
int main(void)
{
	int x,y,temp;
	while(1){
		scanf("%d %d",&x,&y);
		if(x==0&&y==0)break;
		if(x>y){
			temp=x;
			x=y;
			y=temp;
		}
		printf("%d %d\n",x,y);
	}
	return 0;
}

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

// #define multitest 1
#ifdef WIN32
#define db(...) ZZ(#__VA_ARGS__, __VA_ARGS__);
#define pc(...) PC(#__VA_ARGS__, __VA_ARGS__);
template <typename T, typename U>
ostream &operator<<(ostream &out, const pair<T, U> &p)
{
	out << '[' << p.first << ", " << p.second << ']';
	return out;
}
template <typename Arg>
void PC(const char *name, Arg &&arg)
{
	std::cerr << name << " { ";
	for (const auto &v : arg)
		cerr << v << ' ';
	cerr << " }\n";
}
template <typename Arg1>
void ZZ(const char *name, Arg1 &&arg1)
{
	std::cerr << name << " = " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void ZZ(const char *names, Arg1 &&arg1, Args &&... args)
{
	const char *comma = strchr(names + 1, ',');
	std::cerr.write(names, comma - names) << " = " << arg1;
	ZZ(comma, args...);
}
#else
#define db(...)
#define pc(...)
#endif

using ll = long long;
#define f first
#define s second
#define pb push_back
const long long mod = 1000000007;
auto TimeStart = chrono::steady_clock::now();

const int nax = 2e5 + 10;

void solve()
{
	int n;
	cin >> n;
	vector<int> V(n);
	for (auto &x : V)
		cin >> x;
	sort(V.begin(), V.end());
	long double ans = V[0];
	for (int i = 1; i < n; ++i)
	{
		ans = (ans + V[i]) / 2;
	}
	cout << fixed << setprecision(9);
	cout << ans;
}

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int t = 1;
#ifdef multitest
	cin >> t;
#endif
	while (t--)
		solve();
#ifdef WIN32
	cerr << "\n\nTime elapsed: " << chrono::duration<double>(chrono::steady_clock::now() - TimeStart).count() << " seconds.\n";
#endif
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <list>
#include <algorithm>
#include <cmath>
#include <stack>
#include <limits>
#include <set>
using namespace std;

#define REP(i,n) for(int (i)=0; (i)<(n); (i)++)
#define FOR(i,a,b) for(int (i)=(a); (i)<(b); (i)++)
#define PUSH(n,v) for(int i=0; i<(n); i++) {int j; cin >> j; v.push_back(j);}
#define ALL(v) v.begin(), v.end()

void printvector4(vector<int> v) {
    REP(i,v.size()-1) {
        cout << v[i] << " ";
    }
    cout << v[v.size()-1] << endl;
}

void countingSort(vector<int> &v, int maxv) {
    vector<int> cnt(maxv+1, 0);
    REP(i,maxv+1) cnt[i] = 0;
    REP(i,v.size()) {
        cnt[v[i]]++;
    }
    int i = 0, j = 0;
    while (j < v.size()) {
        if (cnt[i]) {
            REP(k,cnt[i]) {
                v[j] = i;
                j++;
            }
        }
        i++;
    }
}

int main() {
    int n;
    cin >> n;
    int maxv = 0;
    vector<int> v;
    REP(i,n) {
        int j;
        cin >> j;
        maxv = max(maxv, j);
        v.push_back(j);
    }
    countingSort(v, maxv);
    printvector4(v);
    return 0;
}

Measured memory_bytes: 16932
#![allow(unused_imports)]
// use itertools::Itertools;
use proconio::{input, marker::*};

fn main() {
    input! {
        n: usize
    };
    for i in 1..=n {
        let mut vecs = vec![];
        // x >= y >= z
        for x in 1..=i {
            let xx = x * x;
            if xx >= i {
                continue;
            }
            for y in 1..=x {
                let yy = y * y;
                let xy = x * y;
                if (xx + yy + xy) >= i {
                    continue;
                }
                for z in 1..=y {
                    let sum = xx + yy + z * z + xy + y * z + z * x;
                    if sum == i {
                        vecs.push(vec![x, y, z]);
                    } else if sum > i {
                        break;
                    }
                }
            }
        }
        let count = vecs.iter().fold(0, |acc, vec| {
            if (vec[0] == vec[1]) && (vec[1] == vec[2]) {
                acc + 1
            } else if (vec[0] == vec[1]) || (vec[1] == vec[2]) {
                acc + 3
            } else {
                acc + 6
            }
        });
        println!("{}", count);
    }
}


Measured memory_bytes: 2072
#include<bits/stdc++.h>
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define sz(x)  (long long)(x).size()
#define sqr(x) (x)*(x)
#define sof sizeof
#define ins insert
#define lowerB lower_bound
#define upperB upper_bound
#define mkp make_pair
#define mkt make_tuple
#define act(a,v) (get<(long long)a>(v))
#define mod 1000000007
#define mod1 998244353
#define N 1000003
#define inf 1e18
#define minf -1e18
#define min3(a,b,c) min(a,min(b,c));
#define max3(a,b,c) max(a,max(b,c));
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define sumall(v) accumulate(all(v),(ll)0)
#define sum accumulate
#define FastIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define PRECISION std::cout.unsetf ( std::ios::floatfield );std::cout.precision(15)
#define PI M_PI
#define fi first
#define se second
#define here cout<<"RSSB"<<endl
#define showzero cout<<std::showpoint
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*b)/gcd(a,b)
#define br "\n"
#define sp " "
#define zero (ll)0
using namespace  std ;
typedef double db;
typedef long long ll ;
typedef vector<int>vi ;
//typedef vector<l>vl ;
typedef vector<ll>vll ;
typedef vector<vector<ll> >vvl ;
typedef pair<int,int> pii ;
typedef pair<ll,ll> pll ;
typedef vector<pll>vpll;
typedef vector<string>vstr;
typedef vector<bool>vbool ;
void READ(vll &v, ll n)
{
    ll a ;
    for(ll i=0 ; i<n ; i=i+1)
    {
        cin>>a ;
        v.pb(a) ;
    }
}
void PRINT(vll &v , ll a = 0)
{
    //ll a ;
    for(ll i=a ; i<v.size() ; i=i+1)
    {
        v[i] = max((ll)0,v[i]);
        cout<<v[i]<<" " ;
    }
    cout<<"\n" ;
}
/*vbool isprime(N,true);
vll spf(N,0);
vll prime;
void sieve()
{
    isprime[0] = isprime[1] = false;
    for(ll i = 2 ; i<N ; i++)
    {
        if(isprime[i])
        {
            for(ll j=2*i ; j<N ; j+=i)
            {
                isprime[j] = false;
                if(spf[j]==0)
                {
                    spf[j] = i;
                }
            }
            prime.pb(i);
        }
    }
}*//*
ll nck(ll n , ll k ,ll m=1e18+7)
{
    ll i , j,b=1,c=1 ;
    if(n-k<k)
    {
        k = n-k ;
    }
    while(k)
    {
        b*=n ;
        c*=k ;
        ll g = __gcd(b,c) ;
        b/=g ;
        c/=g ;
        n--;
        k-- ;
    }
    return(b) ;
}*//*
long long power(long long k , long long n , long long m=mod)
{
    long long res = 1;
    while(n)
    {
        if(n%2!=0)
        {
            res = (res*k)%m ;
        }
        k = (k*k)%m ;
        n = n/2 ;
    }
    return(res) ;
}*/
ll n,m,k,l,r;
bool ok = false;
int main()
{
    FastIO ;
    PRECISION ;
    ll a,b,c,d,i,j,t,x,y,z;//,x1,y1,z1,e,f;
    ll p,q,r,u,w ;
    char ch,chr ;
    string str,st,str1,str2,str3,str4;
    //ll a1=0,a2=0,b1=0,b2=0,c1=0 ;
    //cin>>str>>str1;
    cin>>a>>b;
    if(a<=b)
    {
        cout<<"unsafe";
    }
    else
    {
        cout<<"safe";
    }
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<long long,long long> pll;
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);++i)
constexpr int mod=1000000007;
constexpr int mod1=998244353;
vector<int> dx={0,1,0,-1},dy={-1,0,1,0};
bool inside(int y,int x,int h,int w){
	if(y<h && y>=0 && x<w && x>=0) return true;
	return false;
}





int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	string s;cin >> s;
	ll k;cin >> k;
	if(s.size() == 1){
		cout << k / 2 << endl;
		return 0;
	}
	int n = s.size(), l = 0, r = n - 1;
	rep(i,n - 1){
		if(s.at(i) == s.at(i + 1)) l++;
		else break;
	}
	for(int i = n - 1; i > 0; i--){
		if(s.at(i) == s.at(i - 1)) r--;
		else break;
	}
	ll cnt = 0;
	if(s.at(0) != s.at(n - 1)){
		bool flg = true;
		rep(i,n - 1){
			if(flg){
				if(s.at(i) == s.at(i + 1)){
					cnt++;
					flg = false;
				}
			}
			else{
				flg = true;
			}
		}
		cnt *= k;
	}
	else{
		bool flg = true;
		for(int i = l + 1; i < r; i++){
			if(flg){
				if(s.at(i) == s.at(i + 1)){
					cnt++;
					flg = false;
				}
			}
			else{
				flg = true;
			}
		}
		cnt *= k;
		cnt += (k - 1) * ((l + 1 + (n - r)) / 2);
		cnt += (l + 1) / 2;
		cnt += (n - r) / 2;
		if(r <= l) cnt = n * k / 2;
	}
	cout << cnt << endl;
}


Measured memory_bytes: 256
#[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 ) * } } ; }
#[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 , chars ) => { read_value ! ( $ next , String ) . chars ( ) . collect ::< Vec < char >> ( ) } ; ( $ next : expr , usize1 ) => { read_value ! ( $ next , usize ) - 1 } ; ( $ next : expr , $ t : ty ) => { $ next ( ) . parse ::<$ t > ( ) . expect ( "Parse error" ) } ; }

fn main() {
    input! {
        n: u64,
        a: u64
    }

    println!("{}", if n % 500 <= a {"Yes"} else {"No"});
}

Measured memory_bytes: 4352
#include <iostream>
#include <algorithm>
#include<math.h>
#include<string>
#include<vector>
using namespace std;
int main(void) {
	int n;
	long long a[100010];
	long long min;
	int count = 0;
	int temp;

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

	while (true)
	{

		sort(a, a + n);
		for (int min_i = n - 1;min_i >= 0;min_i--)
		{
			if (a[min_i] != 0)
			{
				min = a[min_i];
				temp = min_i;
			}
		}
		for (int i = temp+1;i < n;i++)
		{
			a[i] = a[i] % min;
			if (a[i] == 0)
			{
				count++;
			}
		}
		if (count == (n - temp-1))
			break;
		count = 0;
	}
	
	cout << min << endl;
	
	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#ifdef _DEBUG
#define dlog(str) cout << "====" << str << endl;
#else
#define dlog(str)
#endif
#define INF 999999999
#define MOD 1000000007
#define REP(i, n) for(int i = 0, i##_l = (n); i < i##_l; i++)
#define FOR(i, s, e) for(int i = s, i##_l = (e); i < i##_l; i++)
#define LLI long long int
#define _min(a, b) ((a < b) ? a : b)
#define _max(a, b) ((a < b) ? b : a)
#define chmax(a, b) a = _max(a, b)
#define chmin(a, b) a = _min(a, b)
#define bit(a, shift) ((a>>shift)&1))
#define pm(a) ((a) ? 1 : -1)
#define SORT(v) sort(v.begin(), v.end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
// int 2.14E±9    lli 9.2E±18    double 1.7E±380

int main() {
    cout << fixed << setprecision(10);
    int N;
    cin >> N;
    vector<int> h(N);
    REP(i, N) {
        cin >> h[i];
    }
    for(int i = N - 2; 0 <= i; i--) {
        if(h[i] > h[i + 1]) {
            h[i]--;
        }
    }
    FOR(i, 1, N) {
        if(h[i - 1] > h[i]) {
            cout << "No";
            return 0;
        }
    }
    cout << "Yes";

    return 0;
}

Measured memory_bytes: 640
from sys import stdin

n = int(stdin.readline().rstrip())

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

while True:
    if len(prime_factorize(n)) == 1:
        print(n)
        break
    else:
        n += 1




Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define int long long
#define INF 1e+18
using namespace std;

signed main(){
	int n,a;
	cin >> n >> a;
	int mi = n;
	for(int i = 2;i < 50;i++){
		int low = 0,up = 2100000;
		while(up - low > 1){
			int mid = (low + up) / 2,tmp = 1;
			bool flag = false;
			for(int j = 0;j < i;j++){
				if(j < mid % i) tmp *= mid / i + 1;
				else tmp *= mid / i;
				if(tmp >= n){
					flag = true;
					break;
				}
			}
			if(flag) up = mid;
			else low = mid;
		}
		mi = min(mi,up + a * (i - 1));
	}
	cout << mi << endl;
	return 0;
}

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

int main()
{
	int N, T;
	cin >> N >> T;
	
	int A[100000];
	for (int i = 0; i < N; i++) {
		cin >> A[i];
	}


	int max_profit = 0;
	int lowest_price = A[0];
	int ans = 1;
	for (int i = 1; i < N; i++) {
		int profit = A[i] - lowest_price;

		if (profit == max_profit) {
			ans++;
		}
		else if (profit > max_profit) {
			max_profit = profit;
			ans = 1;
		}
		else if (A[i] < lowest_price) {
			lowest_price = A[i];
		}

	}

	// cout << max_profit << endl;


	cout << ans << endl;

	return 0;

}


Measured memory_bytes: 640
#include<iostream>
long n,k,a,i,j,m=1e9+7,v[9<<9];main(){for(std::cin>>n>>k;i++<n;)for(j=0;j++<n;(a+=(k*(k-1)/2+(i<j)*k)*(v[i]>v[j]))%=m)i-1||std::cin>>v[j];std::cout<<a;}

Measured memory_bytes: 256
#include <iostream> 
#include <stdlib.h> 
#include <string.h> 
#include <string> 
#include <sstream>
#include <cstring> 
#include<cmath>
using namespace std;
int main() {
	int x, y, z;
	cin >> x >> y >> z;
	cout << (x - y) % z;


}

Measured memory_bytes: 3596
#[allow(dead_code)]
fn is_whitespace(c: &char) -> bool {
    c.is_whitespace()
}

#[allow(dead_code)]
fn is_eol(c: &char) -> bool {
    ['\r', '\n'].contains(c)
}

#[allow(unused_macros)]
macro_rules! input {
    ($var:ident, $($r:tt)*) => {
        input_inner!{$var, $($r)*}
    };

    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        #[allow(unused_mut, unused_variables, bare_trait_objects)]
        let mut next = move |f: &Fn(&char)->bool| -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|f(&c))
                .take_while(|c|!f(&c))
                .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 ; eol ]) => {
        $next(&is_eol).split(' ').map(|x| x.parse::<$t>().unwrap()).collect::<Vec<_>>()
    };

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

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

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

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

    ($next:expr, parser) => {
        $next
    };

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

#[allow(unused_imports)]
use std::cmp::{max, min};
#[allow(unused_imports)]
use std::collections::{BinaryHeap, HashMap, HashSet};

#[allow(dead_code)]
struct Edge {
    from: usize,
    to: usize,
}

#[allow(dead_code)]
type Graph = Vec<Vec<usize>>;
#[allow(dead_code)]
const M: usize = 1_000_000_007;

fn main() {
    input! {
        n: usize,
        a: [usize; n],
    }

    let mut cnt = vec![0; n + 1];
    for &a in &a {
        cnt[a] += 1;
    }

    let mut sum = 0usize;
    for &x in &cnt {
        if x > 0 {
            sum += x * (x - 1) / 2;
        }
    }
    for &a in &a {
        let mut t = sum;
        t -= cnt[a] * (cnt[a] - 1) / 2;
        if cnt[a] - 1 > 0 {
            t += (cnt[a] - 1) * (cnt[a] - 2) / 2;
        }
        println!("{}", t);
    }
}


Measured memory_bytes: 10748