akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include <vector>

using namespace std;

int a,b,c,d,e,f;

bool canin(int s,int x,int y){
  for(int i = 0;i <= s;i += x){
    if((s - i) % y == 0) return true;
  }
  return false;
}

void sugarList(vector<int>& v){
  int max = e*f/(100 );
  // cout << max << " sugarmax\n";                                                                                                                                                                               
  for(int i = 0;i <= max;i++){
    if(canin(i,c,d)){
      // cout << i << " sugar \n";                                                                                                                                                                               
      v.push_back(i);
    }
  }
}

void waterList(vector<int>& v){
  int max = f/(100 );
  for(int i = 0;i <= max;i++){
    if(canin(i,a,b)){
      v.push_back(i);
    }
  }
}

bool check(int w,int s){
  if(w*e < s){
    return false;
  }
  if(w*100 + s > f){
    return false;
  }
  return true;
}

double dense(int w,int s){
  if(w <= 0) return -1;
  return (double)s/(s + 100*w);
}

pair<int,int> solve(){
  vector<int> sugar;
  sugarList(sugar);
  // cerr << sugar.size() << " hoge\n";                                                                                                                                                                          
  vector<int> water;
  waterList(water);
  // cerr << water.size() << " hoge\n";                                                                                                                                                                          

  double maxdense = -1;
  pair<int,int> ret(-1,-1);

  for(auto& s : sugar){
    for(auto&w : water){
      if(check(w,s)){
        if(dense(w,s) > maxdense){
          maxdense = dense(w,s);
          ret.first = w;
          ret.second = s;
        }
      }
    }
  }
  return ret;
}

int main()
{
  // 整数の入力                                                                                                                                                                                                  
  cin >> a;
  cin >> b;
  cin >> c;
  cin >> d;
  cin >> e;
  cin >> f;

  // cerr << a << ":" << b << ":" << c << ":" << d << ":" << e << ":" << f << "\n";                                                                                                                              

  pair<int,int> s = solve();
  cout << 100*s.first + s.second << " " << s.second << "\n";

  return 0;
}





Measured memory_bytes: 256
import java.io.*;
import java.util.*;
import java.util.function.*;

final class Solver {
	static final Solver INSTANCE = new Solver();

	void solve(Supplier<String> sc) {
		int A = Integer.parseInt(sc.get());
		int B = Integer.parseInt(sc.get());
		System.out.println(A * B);
	}
}

class Main {
	public static void main(String... args) {
		System.setOut(new PrintStream(new BufferedOutputStream(System.out)));
		var reader = new BufferedReader(new InputStreamReader(System.in));
		Solver.INSTANCE.solve(new Supplier<>() {
			StringTokenizer line;

			public String get() {
				while (line == null || !line.hasMoreTokens()) try {
					line = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new UncheckedIOException(e);
				}
				return line.nextToken();
			}
		});
		System.out.flush();
	}
}

Measured memory_bytes: 32776
using System;
using System.Text;
using System.Collections;
using System.Collections.Generic;

using System.Linq;
using System.Text.RegularExpressions;
using System.Diagnostics;
using System.Threading; 


class Program
{
	public const int Inf = 1 << 29;
	public static int[,] dp = new int[100,100];
	public static int[,] arrayList = new int[100,100];
	public static int cnt = 0;
	static void Main()
	{
		string line;
		for (int i = 0; i < 100; ++i) {
			for (int j = 0; j < 100; j++) {
				dp[i, j] = -1;
				arrayList[i, j] = -1;
			}
		}
		while (!string.IsNullOrEmpty(line = Console.ReadLine())) {
			string[] s = line.Split(',');
			
			for (int i = 0; i < s.Length; i++)
			{
				arrayList[cnt, i] = int.Parse(s[i]);
			}
			cnt++;
		}
		
		Console.WriteLine(solve(0, 0));
	}

	static int solve(int a, int b)
	{

		if (cnt == a)
		{
			return 0;
		}
		if (b < 0 || arrayList[a,b] == -1)
		{
			return -Inf;
		}
		if (dp[a,b] >= 0)
		{
			return dp[a,b];
		}
		var res = cnt / 2 > a ? Math.Max(solve(a + 1, b) + arrayList[a,b], solve(a + 1, b + 1) + arrayList[a,b]) : Math.Max(solve(a + 1, b) + arrayList[a,b], solve(a + 1, b - 1) + arrayList[a,b]);
		return dp[a,b] = res;
	}
}

Measured memory_bytes: 5808
import java.util.*;
import java.util.function.*;
import java.lang.*;
import java.io.*;


public class Main {
    
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();
        System.out.println(A*B);
        
    }
}


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

typedef long long ll;

#define rep(a,b,c) for(int a=b,a##end=c;a<=a##end;++a)
#define drep(a,b,c) for(int a=b,a##end=c;a>=a##end;--a)


char IO;
int rd(){
	int s=0,f=0;
	while(IO=getchar(),IO<'0'||IO>'9')if(IO=='-')f=1;
	do s=(s<<1)+(s<<3)+(IO^'0');
	while(IO=getchar(),IO>='0'&&IO<='9');
	return f?-s:s;
}

const int N=1e5+10,K=50;

int n;
int a[N];

int main(){
	rep(i,1,n=rd()) a[i]=rd();
	sort(a+1,a+n+1);
	if(n&1) return puts("0"),0;
	int mid=n/2;
	printf("%d\n",a[mid+1]-a[mid]);
}








Measured memory_bytes: 640
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <bits/stdc++.h>
using namespace std;
using namespace __gnu_pbds;

template <class K, class T = null_type>
using ordered_tree = tree<K, T, less<K>, rb_tree_tag, tree_order_statistics_node_update>;
#define qrank order_of_key
#define qkth find_by_order


#define df(b, e) ((b) > (e))
#define fore(i, b, e) for(auto i = (b) - df(b, e); i != e - df(b, e); i += 1 - 2 * df(b, e))
#define sz(x) (int) (x.size())
#define all(x) x.begin(), x.end()
#define f first
#define s second
#define eb emplace_back
#define ENDL '\n'
typedef long long lli;
typedef long double ld;
typedef pair<lli, lli> ii;

template <class T>
struct rge { T b, e; };

template <class T>
rge<T> range(T i, T j) {
  return rge<T>{i, j};
}

template <class T> auto dud(T *x) -> decltype(cerr << *x, 0);
template <class T> char dud(...);

struct debug {
  ~debug() { cerr << endl; }

  template <class T>
  typename enable_if<sizeof dud<T>(0) != 1, debug &>::type operator << (T i) {
    cerr << boolalpha << i;
    return *this;
  }

  template <class T>
  typename enable_if<sizeof dud<T>(0) == 1, debug &>::type operator << (T i) {
    return *this << range(begin(i), end(i));
  }

  template <class A, class B>
  debug &operator << (pair<A, B> d) {
    return *this << "(" << d.f << ", " << d.s << ")";
  }

  template <class T>
  debug &operator << (rge<T> d) {
    *this << "[";
    for (auto it = d.b; it != d.e; ++it)
      *this << ", " + 2 * (it == d.b) << *it;
    return *this << "]";
  }
};

#define deb(...) " " << #__VA_ARGS__ ": " << (__VA_ARGS__) << " "

template <class T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define qrank order_of_key // Number of items < x  ---               qrank
#define qkth find_by_order // ith largest element (0-indexed)       qkth

const int inf = 1e9 + 7;
const int N = 105;

lli dp[N][2][4];
bool done[N][2][4];
string s;
int k, n;


lli f(int k, bool small, int cnt) {
    //debug() << deb(k) deb(small);
    if (cnt > ::k) return 0;
    if (k == n)
        return cnt == ::k;
    auto &ans = dp[k][small][cnt];
    if (done[k][small][cnt]) return ans;
    done[k][small][cnt] = 1;
    ans = 0;
    int mx = (small ? 9: s[k] - '0');
    fore (i, 0, mx + 1)
        ans += f(k + 1, small | (i < s[k] - '0'), cnt + (i != 0));
    return ans;
}

int main() {
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    cin >> s >> k;
    n = sz(s);
    cout << f(0, 0, 0) << '\n';
    return 0;
}


Measured memory_bytes: 256
'use strict';

const main = (input) => {
    const p = input.split('\n');
    const N = parseInt(p[0], 10);
    const t = p.slice(1, 1 + N);
    let last = null;
    const dict = {};
    let r = true;
    t.forEach(word => {
        if (typeof dict[word] !== 'undefined') {
            r = false;
        }
        const new_first = word.substr(0, 1);
        const new_last = word.substr(-1);
        if (last != null && last != new_first) {
            r = false;
        }
        last = new_last;
        dict[word] = true;
    });
    console.log (r ? 'Yes' : 'No');
};

const isTest = false;

if (isTest) {
    main('4\nhoge\nenglish\nhoge\nenigma');
    main('9\nbasic\nc\ncpp\nphp\npython\nnadesico\nocaml\nlua\nassembly');
} else {
    main(require('fs').readFileSync('/dev/stdin', 'utf8'));
}

Measured memory_bytes: 21064
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef long double ld;
int main()
{
  int n,ans;
  double t,a,h;
  double mini = 1e9;
  cin >> n >> t >> a;
  REP(i,n){
    cin >> h;
    double temp = t - h * 0.006;
    if(mini > abs(temp-a)){
      mini = abs(temp-a);
      ans = i+1;
    }
  }

  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
from math import gcd
n,m = map(int,input().split())
z = n * m // gcd(n,m)
s = input()
t = input()
n = z // n
m = z // m
x = 0
y = 0
i = 0
j = 0
while x < z and y < z:
    if x > y:
        y += m
        j += 1
    elif x < y:
        x += n
        i += 1
    else:
        if s[i] != t[j]:
            print(-1)
            exit(0)
        x += n
        y += m
        i += 1
        j += 1
print(z)

Measured memory_bytes: 9312
#include "bits/stdc++.h"

using namespace std;
typedef long long ll;
#define rep(i, j, n) for (int i = j; i < n; i++)
#define out(ans) cout << ans << endl;
const long long mod = 1e9 + 7;

int cnt[10];
ll ans=0;
ll n;

void dfs(ll num, bool x, bool y, bool z){

  if(num>n)return;
  if(x&&y&&z)ans++;

  dfs(10*num+3,true,y,z);
  dfs(10*num+5,x,true,z);
  dfs(10*num+7,x,y,true);
}

int main(){

  cin>>n;

  dfs(0,0,0,0);

  out(ans);

  return 0;
}


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

// types
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
typedef vector<ll> vll;

// macros
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#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 FOR(i,a,b) for(int i=(a);i<(b);i++)
#define PB push_back
#define EB emplace_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL

// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double eps = 1e-10;
const int MOD = 1e9 + 7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  
  ll n,m;
  cin >> n >> m;
  ll edge[n][n];
  REP(i, n){
    REP(j, n)
      edge[i][j] = 0;
  }
  
  vll a(m), b(m);
  REP(i, m){
    cin >> a[i] >> b[i];
    a[i]--;
    b[i]--;
    edge[a[i]][b[i]]++;
    edge[b[i]][a[i]]++;
  }
  
  REP(i, n){
    ll ans = 0;
    REP(j, n){
        ans+=edge[i][j];
    }
    cout << ans << endl;
  }
}

Measured memory_bytes: 256
#![allow(unused_imports)]
#![allow(clippy::many_single_char_names)]

// language: Rust(1.42.0)
// check available crates on AtCoder at "https://atcoder.jp/contests/language-test-202001"
// My Library Repo' is at "https://github.com/Loptall/prcn_lib"

/*
    そう甘くはないんだな〜w
*/

// from std...
use std::cmp::{
    max, min, Ordering,
    Ordering::{Equal, Greater, Less},
    Reverse,
};
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};
use std::convert::TryInto;
use std::mem::swap;
use std::num::{NonZeroU32, ParseIntError};
use std::ops::{
    Add, AddAssign, BitAnd, BitAndAssign, BitOr, BitOrAssign, BitXor, BitXorAssign, Div, DivAssign,
    Index, IndexMut, Mul, MulAssign, Neg, Rem, RemAssign, Shl, ShlAssign, Shr, ShrAssign, Sub,
    SubAssign,
};
use std::process::exit;
use std::{f32, f64, i128, i16, i32, i64, i8, isize, u128, u16, u32, u64, u8, usize};

// Dep' crates are...
use itertools::*;
use itertools_num::*;
use lazy_static::lazy_static;
use maplit::{btreemap, btreeset, hashmap, hashset};
use num_bigint::{BigInt, BigUint};
use num_complex::Complex;
use num_integer::{binomial, gcd, lcm, multinomial, Integer};
use num_rational::Rational;
use num_traits::{clamp, one, pow, zero, Num, NumAssignOps, NumOps, One, Pow, Zero};
use permutohedron::Heap;
use proconio::{
    fastout, input, is_stdin_empty,
    marker::{Bytes, Chars, Isize1, Usize1},
};
use rand::random;

pub const MOD10E9_7: usize = 1000000007;
pub const MOD99_: usize = 998244353;
pub const MAX: usize = std::usize::MAX;
pub const PI: f64 = f64::consts::PI;
pub const A: u8 = 65;

// code...
// #[fastout]
fn main() {
    input! {
        n: usize
    }

    let mut memo = vec![0; n + 1];

    for a in 1..=100 {
        for b in 1..=100 {
            for c in 1..=100 {
                if f(a, b, c) <= n {
                    memo[f(a, b, c)] += 1;
                }
            }
        }
    }

    for a in memo.into_iter().skip(1) {
        println!("{}", a);
    }
}

fn f(x: usize, y: usize, z: usize) -> usize {
    x * x + y * y + z * z + x * y + y * z + z * x
}


Measured memory_bytes: 2096
#pragma region Macros
#include <bits/stdc++.h>
#define SORT(x) sort((x).begin(), (x).end())
#define RSORT(x) sort((x).rbegin(), (x).rend())
#define ALL(x) (x).begin(), (x).end()
#define REV(x) reverse(ALL(x))
#define rep(i, n) for (ll i = 0; i < n; i++)
#define reps(i, m, n) for (ll i = m; i < n; i++)
#define repr(i, m, n) for (ll i = m; i >= n; i--)
#define SP << " " <<
#define INF2 1000000000000000037
#define INF  1000000007
#define lwb(x,n) distance(x.begin(),lower_bound(ALL(x),(n)))
#define upb(x,n) distance(x.begin(),upper_bound(ALL(x),(n)))
#ifdef _MY_DEBUG
#define CHOOSE(a) CHOOSE2 a
#define CHOOSE2(a0,a1,a2,a3,x,...) x
#define debug_1(x1) cout<<#x1<<": "<<x1<<endl
#define debug_2(x1,x2) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<endl
#define debug_3(x1,x2,x3) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<endl
#define debug_4(x1,x2,x3,x4) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<", "#x4<<": "<<x4<<endl
#define de(...) CHOOSE((__VA_ARGS__,debug_4,debug_3,debug_2,debug_1,~))(__VA_ARGS__)
#else
#define de(...)
#endif
using namespace std;
using ll = long long;
using ld = long double;
template<class T = ll> using v = vector<T>;
template<class T = ll> using vv = vector<vector<T>>;
template<class T = ll> using vvv = vector<vector<vector<T>>>;
template<class T> bool maxi(T &a, const T &b){ if(a<b){a=b;return 1;}return 0;}
template<class T> bool mini(T &a, const T &b){ if(b<a){a=b;return 1;}return 0;}
template<class T> ll sumer(const T& a){ return accumulate(ALL(a),0LL); }
template<class T, class U> ostream &operator<<(ostream &os, const pair<T,U> &pe) { os << pe.first << " " << pe.second; return os;}
template<class T> ostream &operator<<(ostream &os, const v<T> &ve) { rep(i,ve.size()) os<< (i?" ":"")<<ve[i]; return os;}
ll topbit(ll a) { return a==0?-1:63-__builtin_clzll(a);}
ll botbit(ll a) { return a==0?64:__builtin_ctzll(a);}
ll popcount(ll a) { return __builtin_popcountll(a);}
#define dame {cout<< retword <<"\n"; return;}
#pragma endregion
//--MODIFS---------------------------------
#pragma region Modifs
#define retword "-1"
#define MOD  1000000007
using P  = pair<ll,ll>;
using TP  = tuple<ll,ll,ll>;
#pragma endregion
//--GLOBAL---------------------------------

//--MAIN-----------------------------------
void Main() {
    ll N,M;
    cin>>N>>M;
    v<> A(M);
    rep(i,M) cin>>A[i];
    ll sum=sumer(A);
    if(sum>N) dame;
    cout<< N-sum <<"\n";
    
}
//--START----------------------------------
int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    // ll Qkai; cin>>Qkai; while(Qkai--) Main();
    Main();
}
//-----------------------------------------

Measured memory_bytes: 3740
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <stack>
#include <set> 
#include <map>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstring>
#include <iomanip>
#define REP(i,n) for(int i=0; i<(n); ++i)
#define FOR(i,a,b) for(int i=(a); i<(b); ++i)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 100100100;
const ll INFLL = 1001001001001001001;  // > 10^18
const int MOD = (int)1e9 + 7;
const ll MODLL = (ll)1e9 + 7;
const double EPS = 1e-9;

int main () {

    int n; cin >>n;
    vector<int> a(n+1); REP(i,n) cin >> a[i+1];
    vector<bool> b(n+1, false);

    int i = 1;
    int count = 0;
    while (b[i] == false) {
        if (i == 2) {
            b[2] = true;
            break;
        } 
        b[i] = true;
        i = a[i];
        count += 1;
    }

    if (b[2]) {
        cout << count << endl;
    } else {
        cout << -1 << endl;
    } 

    return 0;
}




Measured memory_bytes: 768
#include <bits/stdc++.h>
#include <string>
#include <iostream>
#include <iomanip>
using namespace std;

int main()
{
    string S;
    cin >> S;
    string A = "No";
    for (int i = 0; i < 2; i++)
    {
        if (S.at(i) != S.at(i + 1))
        {
            A = "Yes";
            break;
        }
    }
    cout << A << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void){
    string s;
    cin>>s;
    std::deque<string> deq;
    string tmp="";
    for (int i=0;i<s.size();i++) {
        tmp+=s[i];
        if (i!=s.size()-1) {
            if (s[i]=='>'&&s[i+1]=='<') {
                deq.emplace_back(tmp);
                tmp="";
            }
        } else {
            deq.emplace_back(tmp);
        }
    }
    long long int sum=0;
    for (int i=0;i<deq.size();i++) {
        string mark=deq[i];
        long long int inc=0,dec=0;
        for (int j=0;j<mark.size();j++) {
            if (mark[j]=='<') {
                inc++;
            } else {
                dec++;
            }
        }
        if (inc>dec) {
            dec--;
            if (dec>=0&&dec%2==0) {
                sum+=(dec+1)*(dec/2);
            } else {
                sum+=(dec+1)*(dec/2)+(dec+1)/2;
            }
            if (inc>=0&&inc%2==0) {
                sum+=(inc+1)*(inc/2);
            } else {
                sum+=(inc+1)*(inc/2)+(inc+1)/2;
            }
        } else if (inc<dec) {
            inc--;
            if (dec>=0&&dec%2==0) {
                sum+=(dec+1)*(dec/2);
            } else {
                sum+=(dec+1)*(dec/2)+(dec+1)/2;
            }
            if (inc>=0&&inc%2==0) {
                sum+=(inc+1)*(inc/2);
            } else {
                sum+=(inc+1)*(inc/2)+(inc+1)/2;
            }
        } else {
            if (dec>=0&&dec%2==0) {
                sum+=(dec+1)*(dec/2);
            } else {
                sum+=(dec+1)*(dec/2)+(dec+1)/2;
            }
            if (inc>=0&&inc%2==0) {
                sum+=(inc+1)*(inc/2);
            } else {
                sum+=(inc+1)*(inc/2)+(inc+1)/2;
            }
            sum-=inc;
        }
    }
    cout<<sum<<endl;
}

Measured memory_bytes: 7764
# import numpy as np
# import math
# import copy
# from collections import deque
import sys
input = sys.stdin.readline
# sys.setrecursionlimit(10000)


def main():
    S = int(input())

    mod = 10 ** 9 + 7

    perm = [0 for i in range(2001)]
    perm[3] = 1

    for i in range(4,S+1):
        perm[i] = perm[i-3] + perm[i-1]
        perm[i] %= mod

    print(perm[S])



main()


Measured memory_bytes: 9192
#include <cstdlib>
#include <iostream>
#include <cstdint>
#include <vector>
#include <string>
#include <complex>
#include <bitset>
#include <queue>
#include <boost/lexical_cast.hpp>
#include <boost/algorithm/string/predicate.hpp>
#include <boost/multi_array.hpp>

using namespace std;

#if 0
// memo
abs()

start_with(str, "hoge");
ends_with(str, "hoge");

std::sort(d.begin(), d.end());
d.erase(std::unique(d.begin(), d.end()), d.end());
#endif

using namespace boost;
using namespace boost::algorithm;

static inline bool isOdd(int v)
{
    return v & 0x01;
}

int main()
{
    int H,W;
    cin >> H >> W;

    const int INF = 50*50;
    boost::multi_array<char, 2> a(extents[H][W]);
    boost::multi_array<int, 2> d(extents[H][W]);
    const auto HW = a.num_elements();

    auto itr = a.origin();
    auto jtr = d.origin();
    int whiteCount = 0;
    for (size_t i = 0; i < HW; ++i, ++itr, ++jtr) {
        cin >> *itr;
        if (*itr == '.') {
            whiteCount++;
        }
        *jtr = INF;
    }

    cerr << whiteCount;
    std::queue<std::pair<int, int>> q;

    q.push(std::make_pair(0, 0));
    d[0][0] = 0;
    bool goal = false;
    while (!q.empty()) {
        auto p = q.front();
        auto x = p.first;
        auto y = p.second;
        q.pop();

        if (x == W-1 && y == H-1) {
            goal = true;
            break;
        }
        else {
            int xx, yy;
            yy = y - 1;
            xx = x;
            if (0 <= xx && xx < W && 0 <= yy && yy < H) {
                if (a[yy][xx] == '.' && d[yy][xx] == INF) {
                    q.push(std::make_pair(xx, yy));
                    d[yy][xx] = d[y][x] + 1;
                }
            }
            yy = y + 1;
            xx = x;
            if (0 <= xx && xx < W && 0 <= yy && yy < H) {
                if (a[yy][xx] == '.' && d[yy][xx] == INF) {
                    q.push(std::make_pair(xx, yy));
                    d[yy][xx] = d[y][x] + 1;
                }
            }
            yy = y;
            xx = x - 1;
            if (0 <= xx && xx < W && 0 <= yy && yy < H) {
                if (a[yy][xx] == '.' && d[yy][xx] == INF) {
                    q.push(std::make_pair(xx, yy));
                    d[yy][xx] = d[y][x] + 1;
                }
            }
            yy = y;
            xx = x + 1;
            if (0 <= xx && xx < W && 0 <= yy && yy < H) {
                if (a[yy][xx] == '.' && d[yy][xx] == INF) {
                    q.push(std::make_pair(xx, yy));
                    d[yy][xx] = d[y][x] + 1;
                }
            }
        }
    }
    if (goal) {
        cout << (whiteCount - (d[H-1][W-1] + 1)) << endl;
    }
    else {
        cout << "-1" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int 
#define mod 1000000007
#define endl "\n"
#define pb push_back
#define mp make_pair
bool bo(pair<ll,ll> a,pair<ll,ll> b)
{
	return a.second<b.second;
}
int main()
{
    ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll n,a,b,i,j,x=0,y;
	vector<pair<ll,ll> > t;
	cin>>n;
	for(i=0;i<n;i++)
	{
		cin>>a>>b;
		t.pb(mp(a,b));
	}
	sort(t.begin(),t.end(),bo);
	for(i=0;i<n;i++)
	{
		x+=t[i].first;
		if(x>t[i].second)
		{
			cout<<"No";
			return 0;
		}
	}
	cout<<"Yes";	
	return 0;
}

Measured memory_bytes: 6384
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

#define F first
#define S second
#define int long long
#define ll long long
//#define int  unsigned long long
#define pb push_back
//#define double long double

using namespace std;
using namespace __gnu_pbds;
typedef  tree< int , null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
const int mod = 998244353;
const int N = 160000;
const int K = 20000;
int ans[2][N], d[N], f[N], n;
vector < int > g[N], b;
void dfs(int v, int p = -1){
    f[v] = 1;
    for (auto u: g[v]){
        if (u == p || d[u] == 1) continue;
        dfs(u, v);
    }
}
void gen(int k, vector < int > sz){
    ans[k][1] = 1;
    ans[k][n] = n;
    int l = 2;
    sz.back();
    for (auto i: sz){
        int x = i;
        ans[k][l + i] = l;
        int y = l + 1;
        int z = l;
        for (int j = l; j < l + i; j++){
            ans[k][j] = y;
            y++;
        }
        l = z + i + 1;
    }
}
main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
   // freopen("input.txt", "r", stdin);
    cin >> n;
    if (n == 2){
        cout << "1 2";
        return 0;
    }
    for (int i = 1; i < n; i++){
        int u, v;
        cin >> u >> v;
        g[u].pb(v);
        g[v].pb(u);
        d[u]++;
        d[v]++;
    }
    int s;
    for (int i = 1; i <= n; i++){
        if (d[i] == 1){
            int v = g[i][0];
            f[v] = 1;
        }
    }
    int k = 0;
    for (int i = 1; i <= n; i++){
        if (f[i]){
            k++;
            s = i;
        }
    }
    dfs(s);
    if (k == 1){
        cout << "1 ";
        for (int i = 3; i < n; i++){
            cout << i << " ";
        }
        cout << "2 " << n;
        return 0;
    }
    for (int i = 1; i <= n; i++){
        int cnt = 0;
        for (auto v: g[i]){
            if (f[v]) cnt++;
        }
        if (cnt != 1 && cnt != 2){
            cout << -1;
            return 0;
        }
        if (cnt == 1 && f[i]){
            b.pb(i);
        }
    }
    if (b.size() != 2){
        cout << -1;
        return 0;
    }
    s = b[0];
    int v = s;
    int p = -1;
    vector < int > sz;
    while(1){
        sz.pb(d[v] - 2);
        int q = 1;
        for (auto u: g[v]){
            if (u != p && f[u]){
                p = v;
                v = u;
                q = 0;
                break;
            }
        }
        if (q == 1) break;
    }
    gen(0, sz);
    reverse(sz.begin(), sz.end());
    gen(1, sz);
    for (int i = 1; i <= n; i++){
        if (ans[0][i] < ans[1][i]){
            for (int j = 1; j <= n; j++){
                cout << ans[0][j] << " ";
            }
            return 0;
        }
        if (ans[0][i] > ans[1][i]){
            for (int j = 1; j <= n; j++){
                cout << ans[1][j] << " ";
            }
            return 0;
        }
    }
    for (int i = 1; i <= n; i++) cout << ans[0][i] << " ";
}


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

int main() { 
    int n, ans = 0;
    cin >> n;
    int a[n], L[n+1], R[n+1];
    for(int i = 0; i < n; i++) {
        cin >> a[i];
    }
    L[1] = a[0], R[n-1] = a[n-1];
    for(int i = 0; i < n-1; ++i) {
        L[i+2] = __gcd(L[i+1], a[i+1]);
        R[n-i-2] = __gcd(R[n-i-1], a[n-i-2]);
    }
    L[0] = R[n-1], R[n] = L[1];
    for(int i = 0; i < n; i++) {
        ans = max(ans, __gcd(L[i], R[i+1]));
    }

    cout << ans << '\n';

    return 0;
}


Measured memory_bytes: 1408
package main

import (
	"fmt"
)

type ll int64


func main() {

	var S int
	fmt.Scan(&S)


	//out
	if S == 25{
		fmt.Println("Christmas")
	}else if S == 24 {
		fmt.Println("Christmas Eve")
	}else if S == 23 {
		fmt.Println("Christmas Eve Eve")
	}else if S == 22 {
		fmt.Println("Christmas Eve Eve Eve")
	}



}




Measured memory_bytes: 512
import numpy as np
N, D = map(int, input().split())
X = []
for _ in range(N):
    X.append(np.array(list(map(int, input().split()))))
ans = 0
for i in range(N - 1):
    for j in range(i + 1, N):
        if np.sqrt(np.sum((X[i] - X[j]) ** 2)).is_integer():
            ans += 1
print(ans)

Measured memory_bytes: 12492
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <limits.h>

int main(void)
{
	int n;
	long long sum = 0;
	scanf("%d", &n);

	for (int i = 1; i <= n; i++)
	{
		if (i % 3 == 0 || i % 5 == 0)
			continue;
		else
			sum += i;
	}

	printf("%lld", sum);
	return 0;
}


Measured memory_bytes: 1708
import java.util.Scanner;

public class Main {

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

		int n = scan.nextInt();

		Dice[] d = new Dice[n];
		for (int i = 0; i < n; i++)
			d[i] = new Dice(scan.nextInt(), scan.nextInt(), scan.nextInt(), scan.nextInt(), scan.nextInt(),
					scan.nextInt());
		for (int i = 0; i < n; i++)
			for (int j = i + 1; j < n; j++)
				if (d[i].checkEqual(d[j])) {
					System.out.println("No");
					System.exit(0);
				}

		System.out.println("Yes");

		scan.close();
		System.exit(0);
	}

}

class Dice {
	int Upp, Sou, Est, Wst, Nor, Bot;

	public Dice(int upp, int sou, int est, int wst, int nor, int bot) {
		Upp = upp;
		Sou = sou;
		Est = est;
		Wst = wst;
		Nor = nor;
		Bot = bot;
	}

	public boolean checkEqual(Dice d) {
		String pattern = "WWWSWWWSWWWSSWWWSSSWWWWWSWWW ";
		for (int i = 0; i < pattern.length(); i++) {
			if (equal(d))
				return true;
			operate(pattern.charAt(i));
		}
		return false;
	}

	public boolean equal(Dice d) {
		if (Upp == d.getUpp() && Sou == d.getSou() && Est == d.getEst() && Wst == d.getWst() && Nor == d.getNor()
				&& Bot == d.getBot())
			return true;
		else
			return false;
	}

	public void rotate(int upp, int sou) {
		if (sou == Wst || sou == Est)
			operate('E');
		for (int i = 0; i < 4; i++) {
			if (sou == Sou)
				break;
			operate('N');
		}
		for (int i = 0; i < 4; i++) {
			if (upp == Upp)
				break;
			operate('E');
		}
	}

	public int getEst() {
		return Est;
	}

	public int getWst() {
		return Wst;
	}

	public int getNor() {
		return Nor;
	}

	public int getBot() {
		return Bot;
	}

	public int getSou() {
		return Sou;
	}

	public void operate(char op) {
		int tmp;
		switch (op) {
		case 'S':
			tmp = Upp;
			Upp = Nor;
			Nor = Bot;
			Bot = Sou;
			Sou = tmp;
			break;
		case 'E':
			tmp = Upp;
			Upp = Wst;
			Wst = Bot;
			Bot = Est;
			Est = tmp;
			break;
		case 'W':
			tmp = Upp;
			Upp = Est;
			Est = Bot;
			Bot = Wst;
			Wst = tmp;
			break;
		case 'N':
			tmp = Upp;
			Upp = Sou;
			Sou = Bot;
			Bot = Nor;
			Nor = tmp;
			break;
		}
	}

	public int getUpp() {
		return Upp;
	}

}

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

#define rep(i, n) REP(i, 0, n)
#define REP(i, k, n) for(int i = (int)k; i < (int)n; i++)
#define rrep(i, n) RREP(i, 0, n)
#define RREP(i, k, n) for(int i = (int)n-1; i > (int)k-1; i--)
#define mmax(start, end) *max_element(start, end)
#define mmin(start, end) *min_element(start, end)
#define ALL(x) (x).begin(), (x).end()
#define debug(x) cerr << #x << " " << x << endl;

typedef long long ll;

int dx[4] = {1, -1, 0, 0};
int dy[4] = {0, 0, 1, -1};
int dx8[8] = {-1, -1, -1, 0, 0, 1, 1, 1};
int dy8[8] = {-1, 0, 1, -1, 1, -1, 0, 1};

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

    int N;
    ll x;
    cin >> N >> x;
    ll a[100001];
    REP(i,1,N+1) cin >> a[i];

    ll ans = 0;
    if (a[1] > x) {
        ans += a[1] -x;
        a[1] = x;
    }

    REP(i,2,N+1) {
        if (a[i] > x-a[i-1]) {
            ans += a[i] - (x-a[i-1]);
            a[i] = x-a[i-1];
        }
    }

    cout << ans << endl;
    // rep(i,N+1) debug(a[i]);
    return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <string.h>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
using namespace std;
int a[103];
int main(){
	int n,maxn=-1;
	cin>>n;
	for(int i=1;i<=n;i++) cin>>a[i];
	for(int i=1;i<=n;i++)
		for(int j=i+1;j<=n;j++){
			if(abs(a[i]-a[j])>maxn) maxn=abs(a[i]-a[j]);
		}
	cout<<maxn<<endl;
	return 0;
}


Measured memory_bytes: 256
#include<cstdio>

using namespace std;

int main(){
  int n,m,flag=0;
  char a[51][51],b[51][51];
  scanf("%d %d",&n,&m);
  for(int i=0;i<n;i++)
    scanf("%s",a[i]);
  for(int i=0;i<m;i++)
    scanf("%s",b[i]);
  for(int i=0;i<=n-m;i++)
    for(int j=0;j<=n-m;j++){
      flag=1;
      for(int k=0;k<m;k++)
        for(int l=0;l<m;l++){
          if(a[i+k][j+l]!=b[k][l])
            flag=0;
          else if(flag&&k==m-1&&l==m-1){
            printf("Yes\n");
            return 0;
          }
        }
    }
  printf("No\n");
}

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
using namespace std;

int main(){
    int n;
    double x, ans=0;
    string u;
    cin >> n;
    for(int i=0; i<n; i++){
        cin >> x >> u;
        if(u=="JPY"){
            ans += x;
        }
        else{
            ans += x*380000;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <vector> 
#include <math.h> 
using namespace std;
int main(void){
    int N; cin >> N;
    vector<int> h(N);
    int i = 0;
    int max = 0;
    int ans = 0;
    while (i < N) {
        cin >> h[i];
        if (h[i] >= max) ans++;
        if (max < h[i]) max = h[i];
        i++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3636
#-*-coding:utf8;-*-
#qpy:3
#qpy:console
n, m = map(int, input().split())
food = []
like = 0
for i in range(n):
    food.append(input().split())
    del food[i][0]
for i in range(1, m+1):
    for j in range(n):
        if str(i) in food[j]:
            if j == n-1:
                like += 1
        else:
            break
print(like)


Measured memory_bytes: 3060
#include<iostream>

int main(){
	int A, B, C, D, P;
	std::cin >> A >> B >> C >> D >> P;
	int X = A * P;
	int Y;
	if (P <= C) {
		Y = B;
	}
	else {
		Y = B + (P - C)*D;
	}
	if (X > Y) {
		std::cout << Y << std::endl;
	}
	else if (X < Y) {
		std::cout << X << std::endl;
	}
	else if (X == Y) {
		std::cout << X << std::endl;
	}
	return 0;
}


Measured memory_bytes: 3096
#include<bits/stdc++.h>
using namespace std;
#define ll  long long
#define FASTINOUT ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
const ll mod = 1e9+7;
const int N=2e5+9;
int main()
{
    FASTINOUT;
    int x,y,sum=0;
    cin>>x>>y;
    x--,y--;
    cout<<y/x+(y%x!=0);
    return 0;
}


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

typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define REP(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) std::cout << x << '\n'
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define sz(x) ((int)(x).size())
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { ll g = gcd(a, b); return a / g * b; }
const int dx[4] = { 1, 0, -1,  0 };
const int dy[4] = { 0, 1,  0, -1 };
const int INF = INT_MAX / 2;
const ll  inf = LLONG_MAX / 2;
const int mod = 1000000007;
const int MAX_N = 101010;
const long double PI = acos(-1);

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(10);
	/*------------------------------*/

	ll n;
	cin >> n;
	vector<ll> a(n);
	rep(i, n) cin >> a[i];

	ll g = a[0];
	for (int i = 1; i < n; i++) {
		g = gcd(g, a[i]);
	}

	out(g);
	
	return 0;
}

Measured memory_bytes: 1024
import sys

fact = [-1] * 2001

fact[0] = 1
for i in range(1, 2001):
    fact[i] = (fact[i-1]*i)

def combinations(n, k):
    return (fact[n] // (fact[n-k] * fact[k])) % 1000000007

def solve(N, i):
    # 赤いボール K の i 箇所(両端含んでよい)を選ぶ
    r = combinations(N-K+1, i)

    # 青いボール (N-K) に i-1 個の仕切りを入れる
    b = combinations(K-1, i-1)
    #return (N, i), r * b, "C(%d,%d)=%d"%(K+1, i, r), b
    return (r * b) % 1000000007


N, K = map(int, input().split())
# K <= N <= 2000
for i in range(1, K+1):
    print(solve(N, i))


Measured memory_bytes: 5748
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#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;
typedef long long ll;

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

    ll n, k;
    cin >> n >> k;

    vector<ll> a(n);
    rep(i, n) {
        cin >> a[i];
        --a[i];
    }

    vector<ll> journey;
    int prev = 0;
    rep(i, 2*n+1000) {
        int curr = a[prev];
        if(i == k-1){
            cout << curr+1 << endl;
            return 0;
        }
        journey.push_back(curr);
        prev = curr;
    }
    // rep(i, 20) cout << journey[i] << " ";
    // cout << endl;

    ll loop_end = journey[n];
    ll loop_start = n-1;
    while(journey[loop_start] != loop_end){
        --loop_start;
    }

    ll period = n - loop_start;

    k %= period;

    while(k < n) k += period;

    cout << a[journey[k-2]]+1 << endl;



    return 0;
}

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

int N;
const int MAX_N = 1.0e5 + 100;
ll A[MAX_N], B[MAX_N];

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

    ll tmp = 0;
    for (int i = N-1; i >= 0; i--) {
        A[i] += tmp;
        if (A[i] % B[i] != 0) {
            tmp += B[i] - (A[i] % B[i]);
        }
    }

    cout << tmp << endl;


    return 0;
}


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

using namespace std;

typedef long long ll;
typedef long double ld;

const int md = 1e9 + 7;

void add(int &a, int b) {
    a += b;
    if (a >= md) a -= md;
}

int mul(int a, int b) {
    return ((ll)a * b) % md;
}

int main() {
    ios_base::sync_with_stdio(false); cin.tie(0); cout.setf(ios::fixed); cout.precision(20);
    #ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    int n;
    cin >> n;
    string s;
    cin >> s;
    if (s[0] == 'W') {
        cout << "0\n";
        return 0;
    }
    int cnt = 1;
    int ans = 1;
    for (int i = 1; i < 2 * n; ++i) {
        int t = (s[i] == 'W' ? 1 : 0);
        if ((cnt ^ t) % 2 == 1) {
            if (cnt == 0) {
                cout << "0\n";
                return 0;
            }
            ans = mul(ans, cnt);
            --cnt;
        } else {
            ++cnt;
        }
    }
    if (cnt != 0) {
        cout << "0\n";
        return 0;
    }
    for (int i = 2; i <= n; ++i) ans = mul(ans, i);
    cout << ans << '\n';
}

Measured memory_bytes: 720
#include <bits/stdc++.h>
using namespace std;
int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);

    long n,m;
    cin >> n >> m;
    if (m == 1 && n == 1){
        cout << 1 << endl;
    }else if(m == 1 || n == 1){
        cout << max(n-2,m-2) << endl;
    }else{
        cout << (n * m) - ((2 * m) + (2 * n) - 4) << endl;
    }
}

Measured memory_bytes: 256
#include <stdio.h>
#include <tuple>
#include <queue>

int main(void){
    int L; scanf("%d", &L);
    int n = 0; while((1 << (n+1)) <= L) n++;
    std::queue<std::tuple<int, int, int>> Q;
    for(int x = 0; x + 1 <= n; ++x) Q.emplace(x, x+1, 0), Q.emplace(x, x+1, 1 << x);
    int N = (1 << n) - 1; int U = L - N - 1;
    int l = L;
    for(int d = n; d >= 0; --d) if((U >> d) & 1){ // 101
        Q.emplace(d, n, l - (1 << d) ); l -= (1 << d);
    }

    printf("%d %lu\n", n+1, Q.size());
    while(not Q.empty()){
        int x, y, c; std::tie(x, y, c) = Q.front(); Q.pop();
        printf("%d %d %d\n", x + 1, y + 1, c);
    }
    return 0;
}

Measured memory_bytes: 888
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,m,i,ans1=0,ans2=0;
	cin>>n>>m;
    if(n==m)
    {
    	for(i=1;i<=n;i++)
    	printf("%d",n);
    }
    else if(n>m)
    {
    	for(i=1;i<=n;i++)
    	printf("%d",m);
    }
    else
    {
    	for(i=1;i<=m;i++)
    	printf("%d",n);
    }
} 

Measured memory_bytes: 256
import sys

input = sys.stdin.readline
from collections import *


def bfs():
    q = deque([1])
    dist = [0] * (N + 1)
    while q:
        v = q.popleft()

        for nv in G[v]:
            if dist[nv] == 0:
                dist[nv] = v
                q.append(nv)

    return dist


N, M = map(int, input().split())
G = [[] for _ in range(N + 1)]

for _ in range(M):
    a, b = map(int, input().split())
    G[a].append(b)
    G[b].append(a)

dist = bfs()

print("Yes")
for i in range(2, N + 1):
    print(dist[i])


Measured memory_bytes: 91596
// ====================================
//   author: M_sea
//   website: https://m-sea-blog.com/
// ====================================
#include <bits/stdc++.h>
#define file(x) freopen(#x".in","r",stdin); freopen(#x".out","w",stdout)
#define debug(...) fprintf(stderr,__VA_ARGS__)
using namespace std;
typedef long long ll;

int read() {
	int X=0,w=1; char c=getchar();
	while (c<'0'||c>'9') { if (c=='-') w=-1; c=getchar(); }
	while (c>='0'&&c<='9') X=X*10+c-'0',c=getchar();
	return X*w;
}

const int N=500000+10;

int n,D,Q,d[N];
int pos[N],dp[N];

int main() {
	n=read(),D=read();
	for (int i=1;i<=n;++i) d[i]=read();
	pos[0]=D;
	for (int i=1;i<=n;++i) pos[i]=min(pos[i-1],abs(pos[i-1]-d[i]));
	dp[n+1]=1;
	for (int i=n;i;--i)
		dp[i]=(2*dp[i+1]<=d[i])?dp[i+1]:dp[i+1]+d[i];
	Q=read();
	while (Q--) {
		int p=read();
		puts((dp[p+1]<=pos[p-1])?"YES":"NO");
	}
	return 0;
}

Measured memory_bytes: 9456
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define call(var) cout<<#var<<"="<<var<<endl;
#define dup(x,y) (((x)+(y)-1)/(y))
using ll=long long;
using vi = vector<int>;
using vl = vector<ll>;
using vb = vector<bool>;
using Graph = vector<vi>;
using P = pair<int,int>;
const int MOD=(int)1e9+7;
const int INF=(int)1e9;
const ll LINF=(ll)1e18;
const int INTMAX = 2147483647;
template<class t,class u> void chmax(t&a,u b){if(a<b)a=b;}
template<class t,class u> void chmin(t&a,u b){if(b<a)a=b;}

int main(){
    int s,w;cin >> s >> w;
    if(w>=s){
        cout << "unsafe" << endl;
    }else{
        cout << "safe" << endl;
    }
}

Measured memory_bytes: 3620
t,n,m,r;main(){for(scanf("%d",&t);t--;printf("%d\n",r))for(scanf("%d%d",&n,&m),r=0;m-n;m/=2,n/=2)r+=(n%2+2)%2+(m%2+2)%2,n+=(n%2+2)%2,m-=(m%2+2)%2;exit(0);}

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

#define int long long
typedef pair<int, int> P;
#define mod 1000000007
#define INF (1LL<<60)
 
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define repi(itr, ds) for (auto itr = ds.begin(); itr != ds.end(); itr++)
#define YES puts("YES")
#define Yes puts("Yes")
#define NO  puts("NO")
#define No  puts("No")
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
 
const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };
 
 
#if 1
//-------------
// DUMPマクロ
// https://www.creativ.xyz/dump-cpp-652/
 
// vector
template <typename T>
istream& operator>>(istream& is, vector<T>& vec) {
    for (T& x : vec) is >> x;
    return is;
}
// pair
template <typename T, typename U>
ostream& operator<<(ostream& os, pair<T, U>& pair_var) {
    os << "(" << pair_var.first << ", " << pair_var.second << ")";
    return os;
}
// vector
template <typename T>
ostream& operator<<(ostream& os, const vector<T>& vec) {
    os << "{";
    for (int i = 0; i < vec.size(); i++) {
        os << vec[i] << (i + 1 == vec.size() ? "" : ", ");
    }
    os << "}";
    return os;
}
// map
template <typename T, typename U>
ostream& operator<<(ostream& os, map<T, U>& map_var) {
    os << "{";
    repi(itr, map_var) {
        os << *itr;
        itr++;
        if (itr != map_var.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
// set
template <typename T>
ostream& operator<<(ostream& os, set<T>& set_var) {
    os << "{";
    repi(itr, set_var) {
        os << *itr;
        itr++;
        if (itr != set_var.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
 
#define DUMPOUT cerr
 
void dump_func() {
    DUMPOUT << endl;
}
template <class Head, class... Tail>
void dump_func(Head&& head, Tail&& ... tail) {
    DUMPOUT << head;
    if (sizeof...(Tail) > 0) {
        DUMPOUT << ", ";
    }
    dump_func(std::move(tail)...);
}
#ifdef _DEBUG
#define DEB
#define dump(...)                                                              \
    DUMPOUT << "  " << string(#__VA_ARGS__) << ": "                            \
            << "[" << to_string(__LINE__) << ":" << __FUNCTION__ << "]"        \
            << endl                                                            \
            << "    ",                                                         \
        dump_func(__VA_ARGS__)
#else
#define DEB if (false)
#define dump(...)
#endif
#endif

signed main() {
    
    int a, b;
    cin >> a >> b;
    cout << (a+b)%24 << endl;
    
    return 0;
}


Measured memory_bytes: 256
//ProblemB

//#define USE_STDIO
//#define USE_LOG
//#define FILE_ERR

#ifdef _MYPC
#include "mypc.h"
#endif // _MYPC

#ifndef debug
#define debug(...)
#endif // !LOG

#ifndef REDIRECT_STDIO
#define REDIRECT_STDIO {ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);}
#endif // REDIRECT_STDIO

//include
#include <iostream>
#include <string>
#include <vector>
#include <bitset>
#include <list>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <algorithm>
#include <numeric>
#include <functional>
#include <memory>
#include <complex>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <iomanip>

using namespace std;

//int
using ll = long long;
using ull = unsigned long long;
using uint = unsigned;

//pair
using pii = std::pair<int, int>;
using pll = std::pair<ll, ll>;

//vector
template<typename T> using vt = std::vector<T>;
template<typename T> using vvt = vt<vt<T>>;
template<typename T> using vvvt = vt<vvt<T>>;
using vi = vt<int>;
using vvi = vvt<int>;
using vvvi = vvvt<int>;
using vl = vt<ll>;
using vvl = vvt<ll>;
using vvvl = vvvt<ll>;
using vb = vt<bool>;
using vpii = vt<pii>;

static inline vvi Solve();

int main(int argc, char* argv[]) {
	REDIRECT_STDIO;

	auto rst = Solve();
	if(rst.empty()) {
		cout << "No" << endl;
	} else {
		cout << "Yes" << endl;
		cout << rst.size() << '\n';
		for(const auto& r : rst) {
			cout << r.size();
			for(auto a : r) {
				cout << ' ' << a;
			}
			cout << '\n';
		}
		cout << flush;
	}
	return 0;
}

//ProblemB
vvi Solve() {
	int n; cin >> n;
	int k = (int)sqrt(n * 2.0) + 1;
	if(k * (k - 1) < n * 2) k++;
	if(k * (k - 1) != n * 2) return {};

	vvi rst(k);
	int cur = 1;
	for(int i = 0; i < k; i++) for(int j = i + 1; j < k; j++) {
		rst[i].push_back(cur);
		rst[j].push_back(cur);
		cur ++;
	}
	return rst;
}


Measured memory_bytes: 2304
import java.io.PrintWriter

fun main(args: Array<String>) {
    PrintWriter(System.out).use { out ->
        solve(out)
        out.flush()
    }
}


fun solve(out: PrintWriter) {
    val (n, k) = readLongList()
    var ans = 0L
    val MOD = 1000000007L
    for (i in k..(n + 1)) {
        ans = (ans + (i * (2 * n - i + 1) / 2 - i * (i - 1) / 2 + 1)) % MOD
    }
    println(ans)
}

fun readInteger() = readLine()!!.toInt()
fun readLong() = readLine()!!.toLong()
fun readStringList() = readLine()!!.split(" ")
fun readIntegerList() = readStringList().map(String::toInt)
fun readLongList() = readStringList().map(String::toLong)
fun readDoubleList() = readStringList().map(String::toDouble)


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

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

  //stringの先頭2文字をstringで取り出し
  string s1 = string{S[0]}+string{S[1]};
  string s2 = string{S[2]}+string{S[3]};
  int num1 = stoi(s1);
  int num2 = stoi(s2);

  int counter1=0;
  for(int i = 1;i<=12;i++)
  {
    if(num1 == i)
    {
      counter1 = 1;
    }
  }
  int counter2=0;
  for(int i = 1;i<=12;i++)
  {
    if(num2 == i)
    {
      counter2 = 1;
    }
  }
  if (counter1==1 && counter2==1)
    cout << "AMBIGUOUS" << endl;
  else if(counter1==1 && counter2==0)
    cout << "MMYY" << endl;
  else if(counter1==0 && counter2==1)
    cout << "YYMM" << endl;
  else
    cout << "NA" << endl;
}


Measured memory_bytes: 256