akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define ll long long
#define rep(i,a,b) for(i=a;i<b;i++)
#define pb push_back
#define all(v) v.begin(),v.end()
#define F first
#define S second
#define hell 1000000007
using namespace std;
void solve()
{
  ll n,m,i,j,k,c=0,y=0,ans=0,a,b;
  string s;
  cin>>a>>b>>c>>k;
  while(a>=b) b*=2,y++;
  while(b>=c) c*=2,y++;
  if(y<=k) cout<<"Yes";
  else cout<<"No";


}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t=1;
   // cin>>t;
    while(t--)
    solve();
}


Measured memory_bytes: 3648
import java.util.*;

public class Main {

    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        boolean ans = false;
        for (int i = 0; i < 100; i++) {
            int tmp = n - i * 4;
            if (tmp < 0)
                break;
            if (tmp % 7 == 0)
                ans = true;
        }

        System.out.println(ans ? "Yes" : "No");

    }

}


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

int board[111];
double dp[111][111];    // dp[i][j]: iマス目にjターン目にいる確率

void solve(int n, int t, int l, int b) {
    for (int i = 0; i <= n; i++) board[i] = 0;
    int lose, back;
    for (int i = 0; i < l; i++) {
        cin >> lose;
        board[lose] = 1;
    }
    for (int i = 0; i < b; i++) {
        cin >> back;
        board[back] = 2;
    }
    for (int i = 0; i <= t; i++) {
        for (int j = 0; j <= n; j++) dp[i][j] = 0.0;
    }
    dp[0][0] = 1.0;
    for (int i = 0; i < t; i++) {
        for (int j = 0; j < n; j++) {
            int next_turn = i + (board[j] == 1 ? 2 : 1);
            for (int k = 1; k <= 6; k++) {
                int next_pos = j + k;
                if (next_pos > n) next_pos = 2 * n - j - k;
                if (board[next_pos] == 2) next_pos = 0;
                dp[next_turn][next_pos] += dp[i][j] / 6;
            }
        }
    }
    double ans = 0.0;
    for (int i = 1; i <= t; i++) ans += dp[i][n];
    cout << fixed << setprecision(6);
    cout << ans << endl;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, T, L, B;
    while (true) {
        cin >> N >> T >> L >> B;
        if (N == 0 && T == 0 && L == 0 && B == 0) break;
        solve(N, T, L, B);
    }
    return 0;
}


Measured memory_bytes: 3336
#include <bits/stdc++.h>
using namespace std;
#define dump(x) cout << (x) << endl
typedef long long ll;
typedef pair<int, int> pi;
typedef vector<int> V;

int main() {
  int x;
  cin >> x;
  int t = 0;
  int i = 0;
  while (t < x) {
    i++;
    t += i;
  }
  dump(i);
  return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;

partial class Solver
{
    public void Run()
    {
        var A = ni();
        var B = ni();
        int ans = 0;
        if (A >= 13)
        {
            ans = B;
        }
        else if (6 <= A)
        {
            ans = B / 2;
        }
        else
        {
            ans = 0;
        }
        cout.WriteLine(ans);
    }
}


// PREWRITEN CODE BEGINS FROM HERE
partial class Solver : Scanner
{
    public static void Main(string[] args)
    {
        new Solver(Console.In, Console.Out).Run();
    }

    TextReader cin;
    TextWriter cout;

    public Solver(TextReader reader, TextWriter writer)
        : base(reader)
    {
        this.cin = reader;
        this.cout = writer;
    }
    public Solver(string input, TextWriter writer)
        : this(new StringReader(input), writer)
    {
    }

    public int ni() { return NextInt(); }
    public int[] ni(int n) { return NextIntArray(n); }
    public long nl() { return NextLong(); }
    public long[] nl(int n) { return NextLongArray(n); }
    public double nd() { return NextDouble(); }
    public string ns() { return Next(); }
}

public class Scanner
{
    private TextReader Reader;
    private Queue<String> TokenQueue = new Queue<string>();
    private readonly CultureInfo ci = CultureInfo.InvariantCulture;

    public Scanner()
        : this(Console.In)
    {
    }

    public Scanner(TextReader reader)
    {
        this.Reader = reader;
    }

    public int NextInt() { return Int32.Parse(Next(), ci); }
    public long NextLong() { return Int64.Parse(Next(), ci); }
    public double NextDouble() { return double.Parse(Next(), ci); }
    public string[] NextArray(int size)
    {
        var array = new string[size];
        for (int i = 0; i < size; i++) array[i] = Next();
        return array;
    }
    public int[] NextIntArray(int size)
    {
        var array = new int[size];
        for (int i = 0; i < size; i++) array[i] = NextInt();
        return array;
    }

    public long[] NextLongArray(int size)
    {
        var array = new long[size];
        for (int i = 0; i < size; i++) array[i] = NextLong();
        return array;
    }

    public String Next()
    {
        if (TokenQueue.Count == 0)
        {
            if (!StockTokens()) throw new InvalidOperationException();
        }
        return TokenQueue.Dequeue();
    }

    public bool HasNext()
    {
        if (TokenQueue.Count > 0)
            return true;
        return StockTokens();
    }

    private bool StockTokens()
    {
        while (true)
        {
            var line = Reader.ReadLine();
            if (line == null) return false;
            var tokens = line.Trim().Split(" ".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
            if (tokens.Length == 0) continue;
            foreach (var token in tokens)
                TokenQueue.Enqueue(token);
            return true;
        }
    }
}


Measured memory_bytes: 13268
#include <bits/stdc++.h>
using namespace std;
int main(){
    int  a, b ,c;
    char X,Y;
    string S1,S2,S3;
    cin >>S1 >> S2 >> S3;
    if(S1[S1.size() - 1] == S2[0] && S2[S2.size() - 1] == S3[0]) cout << "YES" << endl;
    else cout << "NO" << endl;
}


Measured memory_bytes: 256
from sys import exit

def rotate(l, d):
    if d == 'S':
        return [l[4], l[0], l[2], l[3], l[5], l[1]]
    if d == 'N':
        return [l[1], l[5], l[2], l[3], l[0], l[4]]
    if d == 'W':
        return [l[2], l[1], l[5], l[0], l[4], l[3]]
    if d == 'E':
        return [l[3], l[1], l[0], l[5], l[4], l[2]]
    if d == 'R':
        return [l[0], l[2], l[4], l[1], l[3], l[5]]

d1 = list(map(int, input().split()))
d2 = list(map(int, input().split()))


for k in 'EE':
    for i in 'NNNN':
        for j in 'RRRR':
            if d1 == d2:
                print('Yes')
                exit(0)
            else:
                d2 = rotate(d2, j)
                
        d2 = rotate(d2, i)
        
    d2 = rotate(d2, k)
            
print('No')

    



Measured memory_bytes: 5612
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <queue>
#include <set>
#include <numeric>
#include <cmath>

using namespace std;

typedef long long int lld;

const lld mod = 1e9+7;
const lld INF = 1e9;
//const lld MAXN = 1e9;

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

	lld ans = 0;
	//int cnt = 0;
	while(1)
	{
		//cnt++;
		//if(cnt>30) break;
		bool ch = true;
		lld x[50] = {0};
		// for(int i = 0; i < n; i++) cout << a[i] << " ";
		// printf("\n");
		lld ope = 0;
		for(int i = 0; i < n; i++)
		{
			if (a[i]>=n) ch = false;
			x[i] = a[i]/n;
			ope += x[i];
			a[i] -= x[i]*n;
		}
		if(ch) break;
		for(int i = 0; i < n; i++)
		{
			a[i] += ope - x[i];
		}
		ans+=ope;
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline

def main():
    N, M = map(int, input().split())
    ab = sorted([list(map(int, input().split())) for i in range(M)], key = lambda x:x[1])
    count = 0
    break_ = -1
    for a, b in ab:
        a -= 1; b -= 1;
        if a > break_:
            count += 1
            break_ = b-1
    print(count)

if __name__ == "__main__":
    main()


Measured memory_bytes: 29924
import java.io.PrintWriter
import java.util.*
import java.math.*
import java.lang.*

val pw = PrintWriter(System.out)
val MOD: Long = (1e+9 + 7).toLong()

fun main(args: Array<String>) {
    val n = readInt() 
    val h = readListOfInt()
    val h2 = (0 until n).map { 0 }.toMutableList()

    var count = 0
    var start = 0
    while(start < n) {
        if(h2[start] < h[start]) {
            for(end in start until n) {
                if(h2[end] == h[end]) break
                h2[end]++
            }
            count++
            start--
        }
        start++
    }
    println(count)
    pw.flush()
}

/****** Declared Functions and Data Structures ******/
// IO
fun read() = readLine()!!
fun readInt() = read().toInt()
fun readLong() = read().toLong()
fun readDouble() = read().toDouble()
fun readListOfString() = read().split(" ")
fun readListOfInt() = readListOfString().map { it.toInt() }
fun readListOfLong() = readListOfString().map { it.toLong() }
fun readListOfDouble() = readListOfString().map { it.toDouble() }

fun Double.format(digits: Int) = String.format("%.${digits}f", this)
fun Float.format(digits: Int) = String.format("%.${digits}f", this)

fun print(value: Any) { pw.print(value) }
fun println(value : Any) { pw.println(value) }

fun<T> permutations(src: List<T>): List<List<T>> {
    if(src.size == 1) return listOf(src)
    val perms = mutableListOf<List<T>>()
    val insertElement = src[0]
    permutations(src.drop(1)).forEach { perm ->
        for(i in 0..perm.size) {
            val newPerm = perm.toMutableList()
            newPerm.add(i, insertElement)
            perms.add(newPerm.toList())
        }
    }
    return perms
}

// return nCr, if you want nCr, please access v[n][r]
fun combinations(n: Long): List<List<Long>> {
    val v = (0..n).map { (0..n).map{0L}.toMutableList() }.toMutableList()
    for(i in 0 until v.size) {
        v[i][0] = 1L
        v[i][i] = 1L
    }
    for(i in 0 until v.size) {
        for(j in 1 until i) {
            v[i][j] = (v[i-1][j-1] + v[i-1][j]) % MOD
        }
    }
    return v.map { it.toList() }.toList()
}

// should be a >= b
fun gcd(a: Long, b: Long): Long = 
    if(b == 0L) a else gcd(b, a % b)

// shoud be a >= b
fun lcm(a: Long, b: Long): Long = 
    a / gcd(a, b) * b

fun sumDigits(num_: Long): Long {
    var num = num_
    var rtn: Long = 0
    while(num != 0.toLong()) {
        val tmp = num % 10
        rtn += tmp
        num /= 10
    }
    return rtn
}

fun isDecimal(v: Double): Boolean = ((v - Math.floor(v)) != 0.0)

// Data Structures
class Stack<T>(private var st: MutableList<T> = mutableListOf<T>()) {
    fun isEmpty() = st.isEmpty()
    fun top(): T = st.last()
    fun push(e: T) { st.add(e) }
    fun pop() { st = st.dropLast(1).toMutableList() }
}

class Queue<T>(private var que: MutableList<T> = mutableListOf<T>()) {
    fun isEmpty() = que.isEmpty()
    fun top(): T = que.first()
    fun push(e: T) { que.add(e) }
    fun pop() { que = que.drop(1).toMutableList() }
}


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

using namespace std;

int main() {
    string a, b, c;
    cin >> a >> b >> c;
    int la = (int)a.length();
    int lb = (int)b.length();
    if (a[la-1] == b[0] && b[lb-1] == c[0]){
        cout << "YES" << endl;
    }
    else{
        cout << "NO" << endl;
    }
    return 0;
}

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

int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  for (int i = 0; i < N; i++) cin >> A[i];
  long long int ans = 0;
  int idx = 0, cnt = 0;
  for (int i = 0; i < N; i++) {
    if (abs(A[i]) <= abs(A[idx])) {
      idx = i;
    }
    if (A[i] < 0) cnt++;
    ans += abs(A[i]);
  }
  if (cnt % 2 == 1) {
    ans -= 2 * abs(A[idx]);
  }
  cout << ans << endl;
}


Measured memory_bytes: 640
/**
 *    author  : 𝒌𝒚𝒐𝒎𝒖𝒌𝒚𝒐𝒎𝒖𝒑𝒖𝒓𝒊𝒏
 *    created : 2020-04-03 22:00:05
**/

#include <iostream>
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <complex>
#include <numeric>
#include <bitset>
#include <cassert>
#include <cctype>
#include <iomanip>
#include <random>
#include <utility>
#include <chrono>

using namespace std;

using int64 = long long;

template<class T> using binary_heap = std::priority_queue<T, std::vector<T>, std::greater<T>>;
template<class T> std::ostream& operator<<(std::ostream& os, const std::vector<T>& vec) { os << '{'; size_t n = vec.size(); for (size_t i = 0; i < n; ++i) { os << vec[i]; if (i != n - 1) os << ','; } os << '}'; return os; }
template<class T, class U> std::ostream& operator<<(std::ostream& os, const std::pair<T, U>& p) { return os << '{' << p.first << " " << p.second << '}'; }
template<class T, class U> std::ostream& operator<<(std::ostream& os, const std::map<T, U>& mp) { os << '{'; for (auto it = mp.begin(); it != mp.end(); ++it) { os << '{' << it->first << ':' << it->second << '}'; if (it != --mp.end()) os << ','; } os << '}'; return os; }
template<class T> std::ostream& operator<<(std::ostream& os, const std::set<T>& st) { os << '{'; for (auto it = st.begin(); it != st.end(); ++it) { os << *it; if (it != --st.end()) os << ','; } os << '}'; return os; }
template<class T> std::istream& operator>>(std::istream& is, std::vector<T>& vec) { size_t n = vec.size(); for (size_t i = 0; i < n; ++i) is >> vec[i]; return is; }

#define all(_) begin(_), end(_)
#define rall(_) rbegin(_), rend(_)

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]: ", debug_out(__VA_ARGS__)
#else
#define debug(...) 1728
#endif

void debug_out() { std::cerr << '\n'; }

template <class Head, class... Tail>
void debug_out(Head&& head, Tail&&... tail) {
  std::cerr << head;
  if (sizeof...(Tail) != 0) std::cerr << ", ";
  debug_out(std::forward<Tail>(tail)...);
}

template<class T> std::vector<T> divisor(T n) {
  std::vector<T> res;
  for (T i = 1; i * i <= n; ++i) {
    if (n % i == 0){
      res.push_back(i);
      if (i * i != n){
        res.push_back(n / i);
      }
    }
  }
  std::sort(res.begin(), res.end());

  return res;
}

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

  int64 a, b; cin >> a >> b;
  vector<int64> va = divisor(a), vb = divisor(b);
  debug(va, vb);

  vector<int64> res;

  set_intersection(all(va), all(vb), inserter(res, res.end()));
  debug(res);

  auto IsValid = [&](int64 x) -> bool {
    if (x == 1) return true;
    for (int64 i = 2; i * i <= x; ++i) {
      if (x % i == 0) return false;
    }
    return true;
  };

  int ans = 0;

  for (int64 e : res) ans += IsValid(e);

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 512
////////////////////////    W H I T E C L O U D    ////////////////////////
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define FAST() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)


int main()
{
    FAST();
    ll n,i;
    cin>>n;
    ll a,b,cnt=0,maxx=0;
    for(i=1; i<=n; i++)
    {
        cin>>a>>b;
        if(a==b){cnt++;maxx=max(maxx,cnt);}
        else cnt=0;
    }
    if(maxx>=3)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;



    return 0;
}







Measured memory_bytes: 3648
def get_i() #空白区切の入力を数値(整数)の配列で返す
  return gets.chomp.split(" ").map(&:to_i)
end
def get_f() #空白区切の入力を数値(実数)の配列で返す
  return gets.chomp.split(" ").map(&:to_f)
end
def get() #空白区切の入力を文字列の配列で返す
  return gets.chomp.split(" ")
end
def get_nsp() #入力されたものを一文字ずつに区切った文字列の配列で返す
  return gets.chomp.split("")
end
def yn_judge(bool,y="Yes",n="No") #boolに真偽を投げることで、trueならy、falseならnの値を出力する
  return bool ? y : n 
end
def array(size1,init=nil,size2=1) #size2に二次元配列時の最初の要素数、size1に次の配列の大きさ、initに初期値を投げることでその配列を返す
  if size2==1
    return Array.new(size1){init}
  else
    return Array.new(size2){Array.new(size1){init}}
  end
end

A,B=get_i
if A<B*2
    puts 0
else
    puts A-B*2
end

Measured memory_bytes: 1788
#include<bits/stdc++.h>
using namespace std;
using ll = long long int;
using ld = long double;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define IFOR(i,a,b) for(int i=(b-1);i>=(a);--i)
#define RPT(i,a,b) for(int i=(a);i<((a)+(b));++i)
#define IRPT(i,a,b) for(int i=((a)+(b)-1);i>=(a);--i)

void solve(){
  ll a, b; cin  >> a >> b;
  if(a==1 || b==1) {cout << 1 << '\n'; return;}
  if(a>b) swap(a,b);
  vector<ll> prime;
  for(ll i = 2; i< 1000010; ++i){
    bool yprime = true;
    for(auto x: prime){
      if(i%x==0) {yprime = false; break;}
      if(x*x>i) break;
    }
    if(yprime) prime.push_back(i);
  }
  {
    bool yprime = true;
    for(auto x: prime){
      if(a%x==0) {yprime = false; break;}
    }
    if(yprime) prime.push_back(a);
    yprime = true;
    for(auto x: prime){
      if(b%x==0) {yprime = false; break;}
    }
    if(yprime) prime.push_back(b);
  }
  vector<ll> p(prime.size(),0);
  {
    for(int i=0; i<prime.size(); ++i){
      ll cnt = 0;
      while(a % prime[i] == 0){ a /= prime[i]; cnt++;}
      p[i] = cnt;
      if(a==1) break;
    }
    if(a>1) {prime.push_back(a);p.push_back(1);}
    for(int i=0; i<prime.size(); ++i){
      ll cnt = 0;
      while(b % prime[i] == 0){ b /= prime[i]; cnt++;}
      p[i] = min(p[i],cnt);
    }
  }
  ll ans = 1;
  //for(int i=0; i<p.size(); ++i) if(p[i]>0) cout << prime[i] << "," << p[i] << " ";
  for(auto x: p) {ans += (x>0);  }
  cout << ans << '\n'; //cout << 359120361600%12457 << " " << 390691501200%12457;
}

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

Measured memory_bytes: 2164
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		
		int count = 0;
		for (int i = 1 ; i <= a; i++) {
			
			String s = new String(i+"");
			
			if (s.length()%2 == 1) {
				count ++;
			}
		}
		
		System.out.println(count);
	}
}


Measured memory_bytes: 37716
//
//AtCoder Beginner Contest 123
//B
//

#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <ctime>
#include <queue>
#include <map>
#include <set>
#include <tuple>
#include <functional>
#include <cassert>
#include <bitset>
#include <numeric>

using namespace std;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define SIZE(x) (int)(x).size()
#define SIZEL(x) (ll)(x).size()
#define MSG(a) cout << #a << " " << a << endl;

using ll = long long;
using ld = long double;
using Graph = vector<vector<int>>;

const double PI = 3.14159265358979323846;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

ll gcd(ll x, ll y) { return (x % y)? gcd(y, x % y): y; }    //最大公約数
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }            //最小公倍数

int main()
{
    vector<int> a(5);
    int mv = 1000;
    REP(i, 5) {
        cin >> a[i];
        if (a[i]%10 > 0) mv = min(mv, a[i]%10);
    }

    int ans=0;
    REP(i,5){
        ans+= ((a[i]+9)/10)*10;
    }
    if (mv != 1000){
        ans = ans - 10 + mv;
    }

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


Measured memory_bytes: 3568
#include <bits/stdc++.h>
#define rep(i,n1) for(int i=0;i<n1;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define yesno(flg) if(flg){cout<<'YES'<<endl;}else{cout<<'NO'<<endl;}
#define vi vector<int>
#define pb push_back
#define i197 1000000007
#define MAX_N 200002
using namespace std;

typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<Pii,int> Piii;
typedef pair<int,ll> Pil;
typedef pair<ll,ll> Pll;
typedef pair<string,int> Psi;
typedef pair<Psi,int> Psii;

const int inf=1000000000;
struct edge{
	int myc,to,c,cost;
};
struct pos{
	int to,cost,color;
};
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};

vi vec[200001];
int x[200001]={};
int dp[200001];

int main() {
	int n;
	cin>>n;
	bool flg=false;
	rep(i,8){
		if((n%(i+2)==0)&&(n/(i+2)<10))flg=true;
	}
	if(n<10)flg=true;
	if(flg){
		cout<<"Yes"<<endl;
	}else{
		cout<<"No"<<endl;
	}
	return 0;
}


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


int main() {
    ll x;
    cin >> x;
    
   for(int i=-118 ;i<120;i++){
       for(int j=-119;j<119;j++){
           if(i*i*i*i*i-j*j*j*j*j==x){
                 cout << i << " " << j <<  endl;
           return   0;
           }
       }
   }
    return 0;
}
    



Measured memory_bytes: 3644
#include<cstdio>
#include<iostream>
#define ll long long
using namespace std;
int n,p,a[51];
ll f[51][51][2501],ans;
int main(){
	scanf("%d%d",&n,&p);
	for (int i=1; i<=n; i++) scanf("%d",&a[i]);
	f[0][0][0]=1;
	for (int i=1; i<=n; i++)
		for (int j=0; j<=i; j++){
			for (int k=0; k<=2500; k++){
				f[i][j][k]+=f[i-1][j][k];
				if (j>=1&&k>=a[i])
				f[i][j][k]+=f[i-1][j-1][k-a[i]];
			}
		}
	for (int i=1; i<=n; i++)
		ans+=f[n][i][i*p];
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 49152
object Main extends App {
	val pw = new java.io.PrintWriter(System.out)

	@scala.annotation.tailrec
	def loop(start: Int, end: Int)(f: Int => Unit): Unit =
		if (start < end) {
			f(start)
			loop(start + 1, end)(f)
		}

	val n = Scanner.nextInt
	val d = Scanner.nextLong

	val ans = Array.fill(n)(1).filter { _ =>
		val x, y = Scanner.nextLong
		x * x + y * y <= d * d
	}.sum

	pw.println(ans)
	pw.flush()
}

object Scanner {
	private val buf = new Array[Byte](1024); private var ptr = 0; private var len = 0

	@inline private def isPrintableChar(c: Int): Boolean = 33 <= c && c <= 126
	@inline private def hasNextByte(): Boolean = if (ptr >= len) { ptr = 0; len = System.in.read(buf); len > 0 } else true
	@inline private def hasNext(): Boolean = {
		while (hasNextByte() && !isPrintableChar(buf(ptr))) ptr += 1
		hasNextByte()
	}
	@inline private def readByte(): Byte = if (hasNextByte()) { val res = buf(ptr); ptr += 1; res } else -1

	def next(): String = {
		if(!hasNext()) ???
		val sb = new StringBuilder; var b = readByte()
		while (isPrintableChar(b)) { sb.append(b.toChar); b = readByte() }
		sb.toString
	}

	def nextInt(): Int = {
		val n = nextLong()
		if (n < Int.MinValue || Int.MaxValue < n) ???
		n.toInt
	}

	def nextLong(): Long = {
		if(!hasNext()) ???
		var minus = false; var b = readByte()
		if (b == '-') { minus = true; b = readByte() }

		@scala.annotation.tailrec
		def go (b: Byte, n: Long = 0): Long = if ('0' <= b && b <= '9') go(readByte(), n * 10 + b - '0') else if (minus) -n else n

		go(b)
	}

	def nextDouble(): Double = next().toDouble
}


Measured memory_bytes: 57744
#include <stdio.h>

int main(void)
{
        int x,y,i;
        scanf("%d%d",&x,&y);

        for(i=0;i<=x;i++){
                if(i*4+(x-i)*2==y) {
                        printf("Yes\n");
                        return 0;
                }
        }
        printf("No\n");
        return 0;
}


Measured memory_bytes: 1644
#include<cstdio>
#include<cmath>
#include<cstring>
#include<cstdlib>
#include<cassert>
#include<ctime>
#include<algorithm>
#include<iterator>
#include<iostream>
#include<sstream>
#include<cctype>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<list>
#include<stack>
#include<functional>
#include<utility>
#include<numeric>
#include<bitset>
#include<iterator>
#define INF (int)1e9
#define MOD 1000000007
#define tr(c, it) for(typeof((c).begin()) it = (c).begin(); it != (c).end(); it++)
#define debug(x) cout<<#x" = "<<(x)<<endl
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define sz size
#define ll long long
#define all(c) c.begin(), c.end()
#define rall(c) c.rbegin(), c.rend()
#define MEM(a, b) memset(a, (b), sizeof(a))
#define present(container, element) (container.find(element) != container.end())
#define cpresent(container, element) (find(all(container), element) != container.end())
#define FOR(i,n) for(int (i)=0;(i)<(n);++(i))
#define printa(a,L,R) for(int i=L;i<R;i++) cout<<a[i]<<(i==R-1?"\n":" ")
#define printv(a) printa(a,0,a.size())
#define print2d(a,r,c) for(int i=0;i<r;i++) for(int j=0;j<c;j++) cout<<a[i][j]<<(j==c-1?"\n":" ")
#define PRE(i, m, n, in) for(int (i)=(m);(i)<(n);i+=in)
#define RFOR(i, n) for(int i=n ; i>=0 ; i--)
#define RPRE(i, j, k, in) for(int i=j ; i>=k ; i-=in)
#define FOREACH(it, l) for (auto it = l.begin(); it != l.end(); it++)
#define IN(A, B, C) assert( B <= A && A <= C)
#define ERS(A, P) A.erase(A.begin() + P)
#define CPY(A, B) memcpy(A, B, sizeof(A))
#define INS(A, P, B) A.insert(A.begin() + P, B)
#define rev(v) reverse(v.begin(),v.end())
#define srt(v) sort(v.begin(),v.end())
#define grtsrt(v) sort(v.begin(),v.end(),greater<int>())
#define mnv(v) *min_element(v.begin(),v.end())
#define mxv(v) *max_element(v.begin(),v.end())
#define countv(v,a) count(v.begin(),v.end(),a)
#define toint(a) atoi(a.c_str())
using namespace std;
typedef pair<int, int> II;
typedef pair<ll, ll> LL;
typedef vector <int> VI;
typedef vector <ll> VL;
typedef vector<string> VS;
typedef vector <VS> VSS;
typedef vector <II> VII;
typedef vector <LL> VLL;
typedef vector <VI> VVI;
typedef vector <VL> VVL;
typedef vector <VII> VVII;
typedef vector <VLL> VVLL;
typedef map<int,int> MPII;
typedef map<ll,ll> MPLL;
typedef map<string, int>MPSI;
typedef map<string, ll>MPSL;
typedef map<int, string>MPIS;
typedef map<ll, string> MPLS;
typedef map<string, string> MPSS;
typedef set<int> SETI;
string tostr(int n) {stringstream rr;rr<<n;return rr.str();}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    // freopen("input.txt", "r", stdin);
    int n; cin >> n; VI h(n);
    int cnt = 0; int ma_val = 0;
    FOR(i, n) {
      cin >> h[i];
      if(h[i] >= ma_val) {
        cnt += 1;
      }
      ma_val = max(h[i], ma_val);
    }
    std::cout << cnt << '\n';
    return 0;
}


Measured memory_bytes: 256
import sys

sys.setrecursionlimit(10 ** 6)  # 再帰関数の再帰の深さを設定
to_index = lambda x: int(x) - 1  # 入力した数字に1を引いたものを返す
print_list_in_2D = lambda x: print(*x, sep="\n")  # リストの要素を改行を挟んで表示する関数

# 入力を整数に変換して受け取る
def input_int():
    return int(input())

def map_int_input():
    return map(int, input())

MII = map_int_input

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

def MII_to_index():
    return map(to_index, input())

def MII_split_to_index():
    return map(to_index, input().split())

# 入力全てを整数に変換したものの配列を受け取る
def list_int_inputs():
    return list(map(int, input()))

LII = list_int_inputs

def LII_split():
    return list(map(int, input().split()))

# 2次元リスト化
def LII_2D(rows_number):
    return [LII() for _ in range(rows_number)]

def LII_split_2D(rows_number):
    return [LII_split() for _ in range(rows_number)]

N, X, Y = MII_split()

dist_counts = {}
for start_node in range(N - 1):
    back_s = abs(start_node - (X - 1))
    for i in range(start_node, N):
        dist_t = back_s + 1 + abs(Y - 1 - i)
        dist = min(dist_t, i - start_node)
        if dist in dist_counts:
            dist_counts[dist] += 1
        else:
            dist_counts[dist] = 1

for k in range(1, N):
    print(dist_counts[k] if k in dist_counts else 0)

Measured memory_bytes: 3572
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
#define fr(i,n) for(ll i=0;i<(n);++i)
#define Fr(i,n) for(long long i=1;i<=(n);++i)
#define ifr(i,n) for(long long i=(n)-1;i>=0;--i)
#define iFr(i,n) for(long long i=(n);i>0;--i)

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  ll x,y,xx,yy,l;
  cin>>x>>y>>xx>>yy;
  l =max(abs(x-xx),abs(y-yy));
  cout<<xx+y-yy<<" "<<yy+xx-x<<" "<<x+y-yy<<" "<<y+xx-x;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<cstring>
#define MP make_pair
#define PB push_back
using namespace std;
typedef pair<int, bool> PIB;
typedef vector<PIB> VP;
typedef VP::iterator VPI;

int n, m;

int triangle[2][5010][2];
VP tilt[5005], vertical[5005];
int ans = 0;

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

  for(int i = 0; i < m; i++){
    int a, b, x;
    cin >> a >> b >> x;

    vertical[a].PB(MP(b, true));
    vertical[a + x + 1].PB(MP(b, false));

    tilt[a].PB(MP(b + 1, false));
    tilt[a + x + 1].PB(MP(b + x + 2, true));
  }

  for(int i = 1; i <= n; i++){
    sort(tilt[i].begin(), tilt[i].end());
    sort(vertical[i].begin(), vertical[i].end());
  }

  for(int i = 1; i <= n; i++){
    memset(triangle[i & 1], 0, sizeof triangle[i & 1]);

    int nownum = 0;
    VPI p1 = vertical[i].begin(), p2 = tilt[i].begin();

    for(int j = 1; j <= i; j++){
      triangle[i & 1][j][0] = triangle[!(i & 1)][j][0];
      triangle[i & 1][j][1] = triangle[!(i & 1)][j - 1][1];

      while(p1 != vertical[i].end() && p1->first == j){
	triangle[i & 1][j][0] += p1->second ? 1 : -1;
	p1++;
      }
      while(p2 != tilt[i].end() && p2->first == j){
	triangle[i & 1][j][1] += p2->second ? 1 : -1;
	p2++;
      }

      nownum += triangle[i & 1][j][0] + triangle[i & 1][j][1];
      if(nownum > 0)
	ans++;
    }
  }

  cout << ans << endl;

  return 0;
}

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

const double PI = acos(-1);
const double EPS = 1e-15;
using ll = long long;
using ull = unsigned long long;
const int inf = 2e9;
const ll INF = 2e18;
const ll MOD = 1e9+7;
typedef pair<int,int> P;

#define REP(i,n) for (int i = 0; i < (n); i++)
#define sz(s) (s).size()
#define pb push_back
#define fi first
#define se second
#define mp make_pair

int main(){
  string s1,s = "CODEFESTIVAL2016";
  cin >> s1;
  int ans = 0;
  REP(i,sz(s)) {
    if (s1[i] != s[i]) ans++;
  }
  cout << ans << endl;
  return 0;
}


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

struct edge{
  int64_t from;
  int64_t to;
  int64_t cost;
};

int main(){
  int64_t N, M;
  cin >> N >> M;
  vector<edge> G(M);
  for(int i=0; i<M; i++){
    int64_t a, b, c;
    cin >> a >> b >> c;
    a--; b--;
    edge add;
    add.from = a;
    add.to = b;
    add.cost = c*-1;
    G.at(i) = add;
  }
  int64_t INF = 1e18;
  vector<int64_t> dist(N,INF);
  dist.at(0) = 0;
  bool inf = false;
  for(int i=0; i<N; i++){
    for(int j=0; j<M; j++){
      edge e = G.at(j);
      if(dist.at(e.to) > dist.at(e.from) + e.cost){
        dist.at(e.to) = dist.at(e.from) + e.cost;
        if(i == N-1 && e.to == N-1){
          inf = true;
        }
      }
    }
  }
  if(inf){
    cout << "inf" << endl;
  }
  else{
    cout << dist.at(N-1)*-1 << endl;
  }
}

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

public class Main {

	public static void main(String[] args) throws Exception {
		// TODO ?????????????????????????????????????????????
		BufferedReader br =
				new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		int[][] am = new int[n][n];

		for (int i=0; i < n; i++) {
			String[] data = br.readLine().split(" ");
			int k = Integer.parseInt(data[1]);

			for (int j=0; j < k; j++) {
				int v = Integer.parseInt(data[2+j]);
				am[i][v-1] = 1;
			}
		}

		for (int i=0; i < n; i++) {
			System.out.print(am[i][0]);
			for (int j=1; j < n; j++) {
				System.out.print(" " + am[i][j]);
			}
			System.out.println();
		}
	}

}

Measured memory_bytes: 29828
#include <bits/stdc++.h>
using namespace std;
#define IO ios_base::sync_with_stdio(false); cin.tie(NULL);

#define endl '\n'
#define D(x) cout << #x << " = " << (x) << endl;

vector<vector<vector<long double>>> dp;

long double solve(int n, int one, int two, int three) {
  if (one < 0 or two < 0 or three < 0) {
    return 0;
  }

  if (!one and !two and !three) {
    return 0;
  }

  long double &ret = dp[one][two][three];
  if (ret < 0) {
    int m = one + two + three;
    ret = (long double) n / m;

    ret += ((long double) one / m) * solve(n, one - 1, two, three);
    ret += ((long double) two / m) * solve(n, one + 1, two - 1, three);
    ret += ((long double) three / m) * solve(n, one, two + 1, three - 1);
    // cout << one << " " << two << " " << three << " = " << ret << endl;
  }

  return ret;
}

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

  vector<int> v(n);
  for (auto &x : v) cin >> x;

  int one = count(v.begin(), v.end(), 1);
  int two = count(v.begin(), v.end(), 2);
  int three = count(v.begin(), v.end(), 3);

  dp.resize(n + 1);
  for (auto &t2 : dp) {
    t2.resize(n + 1);
    for (auto &t1 : t2) {
      t1.resize(n + 1);
      fill(t1.begin(), t1.end(), -1);
    }
  }

  long double ans = solve(n, one, two, three);
  cout << fixed << setprecision(10) << ans << endl;

  return 0;
}


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

using namespace std;
int qs[105];
string s[105];
int main(){
    int n;
    scanf("%d",&n);
    for(int i = 1; i <= n;i++){
        cin >> s[i];
        scanf("%d",qs + i);
        qs[i]+=qs[i-1];
    }
    string x;
    cin >> x;
    int pos = 0;
    for(int i = 1;i<=n;i++){
        if(s[i] ==  x){
            pos = i;
            break;
        }
    }
    printf("%d",qs[n] - qs[pos]);

}


Measured memory_bytes: 256
n,h = map(int,input().split())
A = [list(input()) for i in range(n)] 
lim = 10 **9 +7
c = [[0 for _ in range(h)] for _ in range(n)] 

for i in range(0,n):
    for j in range(0,h):
        if not A[i][j] =="#":
            if i ==0 and j ==0:
                c[i][j] = 1
            elif i-1<0:
                c[i][j] = c[i][j-1]
            elif j-1<0:
                c[i][j] = c[i-1][j] 
            else:
                c[i][j] = c[i-1][j] + c[i][j-1]
        c[i][j] %= lim
print(c[-1][-1])

Measured memory_bytes: 52436
l, r = map(int, input().split())
d = [0]*2019
ans = 2019

for i in range(l, min(r, l + 2019)):
    for j in range(l + 1, min(r + 1, l + 2019)):
        ans = min(i*j%2019, ans)
        if ans == 0:
            break

print(ans)

Measured memory_bytes: 3060
t = input()
t = list(t)

if t[0] == "?":
    t[0] = "D"

if t[-1] == "?":
    t[-1] = "D"

for i in range(1, len(t)-1):
    if t[i] == "?":
        if t[i-1] == "P":
            t[i] = "D"
        elif t[i-1] == "D":
            if t[i+1] == "P":
                t[i] = "D"
            else:
                t[i] = "P"

print("".join(t))

Measured memory_bytes: 10864
n, k = map(int, input().split())
arr = [int(j) for j in input().split()]

s, e = 1, 100000000000

while s <= e:
   # print(s, e)
    mid = (s+e)//2
    temp = 0
    for x in arr:
        temp += x//mid
        if x%mid == 0:
            temp -= 1
    #print(temp)
    if temp <= k:
        ans = mid
        e = mid-1
    else:
        s = mid+1

print(ans)

Measured memory_bytes: 94004
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <string>
#include <deque>
#include <numeric>
#include <set>
using namespace std;

vector<int> z_algorithm(const string& s){
    vector<int> prefix(s.length());
    
    for(int i = 1, j = 0; i < s.length(); ++i){
        if(i + prefix[i - j] < j + prefix[j]){
            prefix[i] = prefix[i - j];
        }
        else{
            int k = max(0, j + prefix[j] - i);
            while(i + k < s.length() && s[k] == s[i + k]){
                ++k;
            }
            prefix[i] = k;
            j = i;
        }
        prefix[0] = (int)s.length();
    }
    
    return prefix;
}

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

    int n;
    string s;
    cin >> n >> s;

    int ans = 0;
    for(int i = 0; i < n; ++i){
        string t = s.substr(i, n - i);
        vector<int> tmp = z_algorithm(t);

        for(int id = 0; id < n - i; ++id){
            if(tmp[id] <= id){
                ans = max(ans, tmp[id]);
            }
        }
    }

    cout << ans << endl;
}

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


int main(){
  
 int n;
 cin>>n; 
 int a=n;
 int po=2;
  int ans=0;
  while(a)
  {
   	int rem=a%10;
    ans+=rem*pow(10,po);
    po--;
    a=a/10;
    
  }
  //cout<<"ans is "<<ans<<endl;
  if(n==ans)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
  
}


Measured memory_bytes: 256
import java.util.Scanner;
public class Main{
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int a=scan.nextInt();
		int b=scan.nextInt();
		if(a==2||b==2) {
			System.out.println("No");
			return;
		}
		if(a==1) {
			if(b==3||b==5||b==7||b==8||b==10||b==12) {
				System.out.println("Yes");
			}
			else {
				System.out.println("No");
			}
		}
		if(a==3) {
			if(b==5||b==7||b==8||b==10||b==12) {
				System.out.println("Yes");
			}
			else {
				System.out.println("No");
			}
		}
		if(a==4) {
			if(b==6||b==9||b==11) {
				System.out.println("Yes");
			}
			else {
				System.out.println("No");
			}
		}
		if(a==5) {
			if(b==7||b==8||b==10||b==12) {
				System.out.println("Yes");
			}
			else {
				System.out.println("No");
			}
		}
		if(a==6) {
			if(b==9||b==11) {
				System.out.println("Yes");
			}
			else {
				System.out.println("No");
			}
		}
		if(a==7) {
			if(b==8||b==10||b==12) {
				System.out.println("Yes");
			}
			else {
				System.out.println("No");
			}
		}
		if(a==8) {
			if(b==10||b==12) {
				System.out.println("Yes");
			}
			else {
				System.out.println("No");
			}
		}
		if(a==9) {
		if(b==11) {
			System.out.println("Yes");
		}
		else {
			System.out.println("No");
		}
		}
		if(a==10) {
			if(b==12) {
			System.out.println("Yes");
		}
			else {
				System.out.println("No");
			}
		}
		if(a==11) {
			System.out.println("No");
		}
		if(a==12) {
			System.out.println("No");
		}
	}
}

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

fn main() {
    input! {
        n: usize,
        ss: [String; n]
    };
    let arr = ["AC", "WA", "TLE", "RE"];
    let mut hm: HashMap<&str, isize> = HashMap::new();
    for s in ss.iter() {
        *hm.entry(s).or_insert(0) += 1;
    }
    for judge in arr.iter() {
        println!("{} x {}", judge, *hm.entry(judge).or_insert(0));
    }
}


Measured memory_bytes: 7812
#include<bits/stdc++.h>
using namespace std;
//Optimisations
#pragma GCC target ("avx2")
#pragma GCC optimization ("unroll-loops")
#pragma GCC optimize("O2")
//shortcuts for functions
#define pb push_back
#define mp make_pair
#define ff first 
#define ss second
#define all(v) v.begin(),v.end()
#define prec(n) fixed<<setprecision(n)
#define n_l '\n'
// make it python 
#define gcd __gcd
#define append push_back
#define str to_string
// utility functions shortcuts
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define sswap(a,b) {a=a^b;b=a^b;a=a^b;}
#define swap(a,b) {auto temp=a; a=b; b=temp;}
#define init(dp) memset(dp,-1,sizeof(dp));
#define set0(dp) memset(dp,0,sizeof(dp));
#define bits(x) __builtin_popcount(x)
#define SORT(v) sort(all(v))
#define endl "\n"
#define forr(i,n) for(ll i=0;i<n;i++)
// declaration shortcuts
typedef long long int ll;
#define int ll
// Constants
constexpr int dx[] = {-1, 0, 1, 0, 1, 1, -1, -1};
constexpr int dy[] = {0, -1, 0, 1, 1, -1, 1, -1};
constexpr ll INF = 1999999999999999997; 
constexpr int inf= INT_MAX;
constexpr int MAXSIZE = int(1e6)+5;
constexpr auto PI  = 3.14159265358979323846L;
constexpr auto oo  = numeric_limits<int>::max() / 2 - 2;
constexpr auto eps = 1e-6;
constexpr auto mod = 1000000007;
constexpr auto MOD = 1000000007;
constexpr auto MOD9 = 1000000009;
constexpr auto maxn = 100006;
//void IOfile(){
//freopen(file_name, reade_mode, stdin);
//freopen(file_name, write_mode, stdout);
//}
void fastio(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
}
int32_t main(){
	fastio();
	int n,m;
	cin >> n >> m;
	vector<vector<int>>v;
	for(int i = 0; i < m; i++){
		int x;
		cin >> x;
		vector<int>c;
		for(int j = 0; j < x; j++){
			int k;
			cin >> k;
			c.push_back(k);
		}
		v.push_back(c);
	}
	int p[m];
	for(int i = 0; i < m; i++) cin >> p[i];
	int ans = 0;
	for(int i = 0; i < (1<< n); i++){
		int on[n];
		for(int j = 0; j < n; j++) on[j] = 0;
		for(int j = 0; j < n; j++){
			if(i & (1<<j)) on[j] = 1;
		}
		int c = 0;
		for(int j = 0; j < m; j++){
			int cnt = 0;
			for(int k = 0; k < v[j].size(); k++){
				cnt += on[v[j][k] - 1];
			}
			if(cnt % 2 == p[j]) c++;
		}
		if(c == m) ans++;
	}
	cout << ans;
}

Measured memory_bytes: 3624
import java.util.Scanner;

public class Main
{
	public static void main(String[] args)
	{
		Scanner sc=new Scanner(System.in);
		int N=sc.nextInt();
		int[] a=new int[N];
		int[] dd=new int[(int)Math.pow(10, 5)+1];
		int max=0;
		int buf=0;
		for(int i=0;i<N;i++)
		{
			a[i]=sc.nextInt();
			dd[a[i]]++;
		}
		for(int i=0;i<N;i++)
		{
			if(a[i]==0){buf=dd[0]+dd[1];}
			else if(a[i]==(int)Math.pow(10, 5)){buf=dd[(int)Math.pow(10, 5)]+dd[(int)Math.pow(10, 5)-1];}
			else{buf=dd[a[i]]+dd[a[i]-1]+dd[a[i]+1];}
			max=(buf>=max)?buf:max;
		}
		System.out.println(max);
	}
}

Measured memory_bytes: 58552
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;

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

    for(int i = a; i <= b; i++) {
        if(i % k == 0) {
            cout << "OK" << endl;
            return 0;
        }
    }

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


Measured memory_bytes: 3560
#include <bits/stdc++.h>
#define ll long long
ll n,i,j,k,ans=0;
int main()
{
	scanf("%lld",&n);
	for (i=1;i<=n;i=j+1)
	{
		j=n/(n/i);
		k=n/i;
		if ((n%k==0) && (n/k-1>=i) && (n/k-1<=j)) ans+=n/k-1;
	}
	printf("%lld\n",ans);
	return 0;
}

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

int main()
{
    long K,X;
    std::cin >> K >> X;
    if(500*K>=X){
        std::cout << "Yes" << std::endl;
    }else{
        std::cout << "No" << std::endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i, a, b) for(ll i = (a); i < (ll)b; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF 1000000000000000
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;
typedef pair<ll, ll> p;
constexpr int MOD = 1000000007;
template <class T> inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

void print(const std::vector<int> &v) {
    std::for_each(v.begin(), v.end(), [](int x) { std::cout << x << " "; });
    std::cout << std::endl;
}
vector<vector<char>> grid;
vector<vector<long long>> L;
vector<vector<long long>> R;
vector<vector<long long>> D;
vector<vector<long long>> U;
int H, W;

int getseq(int i, int j) {
    long long cnt = L[i][j] + R[i][j] + D[i][j] + U[i][j] - 3;
    return cnt;
}

int main() {
    cin >> H >> W;
    grid.resize(H);
    L.resize(H);
    D.resize(H);
    U.resize(H);
    R.resize(H);
    REP(i, H) {
        grid[i].resize(W);
        L[i].resize(W);
        D[i].resize(W);
        U[i].resize(W);
        R[i].resize(W);
    }
    REP(i, H) {
        REP(j, W) { cin >> grid[i][j]; }
    }
    REP(i, H) {
        REP(j, W) {
            if(grid[i][j] == '.') {
                if(j != 0) {
                    L[i][j] = 1 + L[i][j - 1];
                } else {
                    L[i][j] = 1;
                }
            } else if(grid[i][j] == '#') {
                L[i][j] = 0;
            }
            //逆順
            if(grid[i][W - j - 1] == '#') {
                R[i][W - j - 1] = 0;
            } else if(grid[i][W - j - 1] == '.') {
                if(j != 0) {
                    R[i][W - j - 1] = R[i][W - j] + 1;
                } else {
                    R[i][W - j - 1] = 1;
                }
            }
        }
    }
    // cout << "a" << endl;
    REP(j, W) {
        REP(i, H) {
            if(grid[i][j] == '#') {
                U[i][j] = 0;
            } else {
                if(i != 0) {
                    // cout << "e" << endl;
                    U[i][j] = 1 + U[i - 1][j];
                } else {
                    // cout << "ma" << endl;
                    U[i][j] = 1;
                }
            }
            if(grid[H - i - 1][j] == '#') {
                D[H - i - 1][j] = 0;
            } else {
                if(i != 0) {
                    // cout << "e" << endl;
                    D[H - i - 1][j] = 1 + D[H - i][j];
                } else {
                    // cout << "ma" << endl;
                    D[H - i - 1][j] = 1;
                }
            }
        }
    }
    // cout << "b" << endl;
    long long ans = 0;
    REP(i, H) {
        REP(j, W) {
            if(grid[i][j] == '.') {
                ans = max(ans, (long long)getseq(i, j));
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 129536
from sys import exit, stdin
C = [list(map(int, stdin.readline().rstrip().split())) for _ in range(3)]
a1,a2,a3,b1,b2,b3 = 0,0,0,0,0,0
for i in range(0,101):
    a1=i
    b1, b2, b3 = C[0][0]-a1,C[0][1]-a1,C[0][2]-a1
    for j in range(0,101):
        a2=j
        j_flag = a2+b1 == C[1][0] and a2+b2 == C[1][1] and a2+b3 == C[1][2]
        for k in range(0,101):
            a3=k
            k_flag = a3+b1 == C[2][0] and a3+b2 == C[2][1] and a3+b3 == C[2][2]
            if j_flag == True and k_flag == True:
                print('Yes')
                exit()
print('No')

Measured memory_bytes: 3064
#![allow(unused_imports)]
#![allow(unused_macros)]
// use proconio::input;
use std::cmp::{Ordering::*, Reverse};
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, VecDeque};
use std::io::{self, BufWriter, Write};
use std::str::{self, SplitAsciiWhitespace};

// I have no idea what I'm doing

macro_rules! answer {
    ($out:ident, $ans:expr) => {
        writeln!($out, "{}", $ans)
    };
}

fn main() -> Result<(), io::Error> {
    let (stdin, stdout) = (io::stdin(), io::stdout());
    let mut scan = UnsafeScanner::new(stdin.lock());
    let mut out = BufWriter::new(stdout.lock());

    let t: i32 = scan.token();

    answer!(out, (t >= 30).yes())
}

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

/// Mostly copied from https://github.com/EbTech/rust-algorithms/blob/master/src/scanner.rs
/// Same API as Scanner but nearly twice as fast, using horribly unsafe dark arts
/// **REQUIRES** Rust 1.34 or higher
pub struct UnsafeScanner<R> {
    reader: R,
    buf_str: Vec<u8>,
    buf_iter: SplitAsciiWhitespace<'static>,
}

impl<R: io::BufRead> UnsafeScanner<R> {
    pub fn new(reader: R) -> Self {
        Self {
            reader,
            buf_str: vec![],
            buf_iter: "".split_ascii_whitespace(),
        }
    }

    /// This function should be marked unsafe, but noone has time for that in a
    /// programming contest. Use at your own risk!
    pub fn token<T: str::FromStr>(&mut self) -> T {
        loop {
            if let Some(token) = self.buf_iter.next() {
                return token.parse().ok().expect("Failed parse [Scanner]");
            }
            self.buf_str.clear();
            self.reader
                .read_until(b'\n', &mut self.buf_str)
                .expect("Failed read");
            self.buf_iter = unsafe {
                let slice = str::from_utf8_unchecked(&self.buf_str);
                std::mem::transmute(slice.split_ascii_whitespace())
            }
        }
    }

    pub fn pair<T: str::FromStr>(&mut self) -> (T, T) {
        (self.token(), self.token())
    }
}

// aka #![feature(bool_to_option)]
trait BoolThen {
    fn then_<T>(self, f: impl FnOnce() -> T) -> Option<T>;
}

impl BoolThen for bool {
    fn then_<T>(self, f: impl FnOnce() -> T) -> Option<T> {
        if self {
            Some(f())
        } else {
            None
        }
    }
}

trait BoolToYes {
    fn yes(self) -> &'static str;
}

impl BoolToYes for bool {
    fn yes(self) -> &'static str {
        match self {
            true => "Yes",
            false => "No",
        }
    }
}


Measured memory_bytes: 2192