akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

using ll = long long;
using Pi = pair<int, int>;
using Pl = pair<ll, ll>;
using vint = vector<int>;
using vvint = vector<vint>;
using vvvint = vector<vvint>;
using vll = vector<ll>;
using uint = unsigned int;
using ull = unsigned long long;

template<typename T> using uset = unordered_set<T>;
template<typename T1, typename T2> using umap = unordered_map<T1, T2>;

constexpr int INF = (1 << 30) - 1;
constexpr ll LLINF = 1LL << 60;
constexpr int dy[] = {1, 0, -1, 0, 1, -1, -1, 1};
constexpr int dx[] = {0, 1, 0, -1, 1, 1, -1, -1};
constexpr char el = '\n';
constexpr int mod = 1000000007;

template<typename T> T gcd(T a, T b) { return (b ? gcd(b, a % b) : a); }
template<typename T> T lcm(T a, T b) { return (a / gcd(a, b) * b); }
template<typename T1, typename T2> inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }

template<typename T>
ostream& operator <<(ostream &os, vector<T> &v) {
	for (auto &u : v) os << u << el;
	return (os);
}

template<typename T>
istream& operator >>(istream &is, vector<T> &v) {
	for (auto &u : v) is >> u;
	return (is);
}

template<typename T1, typename T2>
istream& operator >>(istream &is, pair<T1, T2> &p) {
	return (is >> p.first >> p.second);
}

int main() {
	ll A, B, C, D; cin >> A >> B >> C >> D;
	if (A > C) swap(A, C);
	if (B > D) swap(B, D);

	ll da = C - A, db = D - B;
	if (da == 0 || db == 0) { cout << 0 << endl; return (0); }
	ll div = gcd(da, db);
	cout << (da/div + db/div - 1) * div << endl;
	return (0);
}


Measured memory_bytes: 256
n,k = map(int,input().split())


t = []
for i in range(n+1):
    t += [i]
t = set(t)
s = set()
for j in range(k):
    di = int(input())
    s.update(map(int,input().split()))
t = t-s-{0}
print(len(t))

Measured memory_bytes: 9196
using System;
using System.Collections.Generic;
using System.Text;
 
class TEST{
	static void Main(){
		while(true){
			var s =Console.ReadLine();
			var t = s.Split(' ');
			if(t[0]=="0" && t[1]=="0" && t[2]=="0")break; 
			int[] Block=new int[3];
			Block[0]=int.Parse(t[0]);			
			Block[1]=int.Parse(t[1]);			
			Block[2]=int.Parse(t[2]);			
			Array.Sort(Block);
			int d2=Block[0]*Block[0]+Block[1]*Block[1];

			var n=int.Parse(Console.ReadLine());
			for(int i=0;i<n;i++){
				var hole=int.Parse(Console.ReadLine());
				hole=4*hole*hole;
				Console.WriteLine(hole<=d2?"NA":"OK");	
			}		
		}


	}

}

Measured memory_bytes: 5420
package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)
	var a = make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&a[i])
	}
	var ans float64
	for i := 0; i < n; i++ {
		ans += 1.0 / float64(a[i])
	}
	ans = 1.0 / ans
	fmt.Println(ans)
}


Measured memory_bytes: 512
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;

namespace AtCoder_Beginner_Contest_134
{
    class Program
    {
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }
        static void Main(string[] args)
        {
            SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
            Solve();
            Out.Flush();
        }
        static void Solve()
        {
            var N = Sarray()[0];
            var Ai = new long[N];
            for (var i = 0; i < N; ++i)
            {
                Ai[i] = Sarray()[0];
            }
            var max = new long[N];
            var revmax = new long[N];
            max[0] = Ai[0];
            revmax[0] = Ai[N - 1];
            for (var i = 1; i < N; ++i)
            {
                max[i] = Math.Max(max[i - 1], Ai[i]);
                revmax[i] = Math.Max(revmax[i - 1], Ai[N - 1 - i]);
            }
            WriteLine(revmax[N - 2]);
            for (var i = 0; i < N - 2; ++i)
            {
                WriteLine(Math.Max(max[i], revmax[N - 3 - i]));
            }
            WriteLine(max[N - 2]);
        }
    }
}


Measured memory_bytes: 23076
#include <iostream>
#include<vector>
using namespace std;
class disjointset
{
public:
	vector<int> rank;
	vector<int> p;
	
	void makeset(int x)
	{
		p[x]=x;
		rank[x]=0;
		return;
	}
	disjointset(int s)
	{
		rank.resize(s,0);
		p.resize(s,0);
		for(int i=0;i<s;i++)makeset(i);
		return;
	}
	int findset(int x)
	{
		if(x!=p[x])p[x]=findset(p[x]);
		return p[x];
	}
	void link(int x,int y)
	{
		if(rank[x]>rank[y])p[y]=x;
		else
		{
			p[x]=y;
			if(rank[x]==rank[y])rank[y]++;
		}
		return;
	}
	bool same(int x,int y)
	{
		return findset(x)==findset(y);
	}
	void unite(int x,int y)
	{
		link(findset(x),findset(y));
		return;
	}
};

int main() {
	int n,q;cin>>n>>q;
	disjointset d=disjointset(n);
	int a,b,c;
	for(int i=0;i<q;i++)
	{
		cin>>a>>b>>c;
		if(a)
		{
			if(d.same(b,c))cout<<1<<endl;
			else cout<<0<<endl;
		}
		else d.unite(b,c);
	}
	return 0;
}

Measured memory_bytes: 3200
n=input()
l=len(n)
s=0
if l>1:
    if l%2==1:
        s+=int(n[1:])+1+(int(n[0])-1)*(10**(l-1))
        l-=1
    for i in range(int(l/2)):
        s+=9*10**(i*2)
    print(s)
else:
    print(int(n))


Measured memory_bytes: 3060
x1,y1,x2,y2 = map(int,input().split())

if x1<=x2 and y1<=y2:
    x3 = x2 - (abs(y2 - y1))
    y3 = y2 + (abs(x2 - x1))
    x4 = x3 - (abs(x2 - x1))
    y4 = y3 - (abs(y2 - y1))
elif x1>x2 and y1<=y2:
    x3 = x2 - (abs(y2 - y1))
    y3 = y2 - (abs(x2 - x1))
    x4 = x3 + (abs(x2 - x1))
    y4 = y3 - (abs(y2 - y1))
elif x1>x2 and y1>y2:
    x3 = x2 + (abs(y2 - y1))
    y3 = y2 - (abs(x2 - x1))
    x4 = x3 + (abs(x2 - x1))
    y4 = y3 + (abs(y2 - y1))
else:
    x3 = x2 + (abs(y2 - y1))
    y3 = y2 + (abs(x2 - x1))
    x4 = x3 - (abs(x2 - x1))
    y4 = y3 + (abs(y2 - y1))
print(x3,y3,x4,y4)

Measured memory_bytes: 3064
import sys, copy, math, heapq, bisect
from itertools import accumulate
from collections import deque, defaultdict, Counter
input = sys.stdin.readline # 文字列の入力のとき'/n'まで受け取るので注意!!!
sys.setrecursionlimit(500000)

N = int(input())
G = [dict() for i in range(N)]
for i in range(N-1):
    a,b = map(int,input().split())
    G[a-1][b-1] = i
    G[b-1][a-1] = i
ans = [0]*(N-1)
visited = [0]*N
def dfs(i,color):
    visited[i] += 1
    c = 1
    for j in G[i]:
        if visited[j]:
            continue
        if c==color:
            c += 1
        ans[G[i][j]] = c
        dfs(j,c)
        c += 1
dfs(0,0)
print(max(ans))
for i in range(N-1):
    print(ans[i])


Measured memory_bytes: 80628
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repo(i,n) for(int i = 1; i < (int)(n); i++)
#define pb push_back
#define mp make_pair
#define np next_permutation
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
#define pi acos(-1.0)
const ll INF = 1LL<<61;
template<class T>bool chmax(T &a, const T &b) { 
  if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) {
  if (b<a) { a=b; return 1; } return 0; }
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }
ll jou(ll N, ll P){if(P==0) return 1;
  if(P%2==0){ll t = jou(N, P/2);return t*t % mod;
  }return (N * jou(N, P-1)) % mod;}  //jou(n,mod-2)で逆元
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//'大文字'+=32;    で小文字に
//  cout << fixed << setprecision (20);   小数点以下2０桁まで
//実行時間制約2秒では２×10^8回くらいまで計算できる




int main() {
  ll n,a,b;
  cin>>n>>a>>b;

  ll c=b/a;  //c以下なら歩く

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

  ll ac=0;
  ll bc=0;
  repo(i,n){
    if(p[i]-p[i-1]<=c) ac+=p[i]-p[i-1];
    else bc++;
  }

  cout << ac*a+bc*b << endl;
}

Measured memory_bytes: 1024
#include<iostream>
#include<string>
#include<vector>
#include<iomanip>
#include<algorithm>
#include<queue>
#include<stack>
#include<map>
using namespace std;
#define ll long long
int main(){
    int a,b,c;
    cin >> a >> b >> c;
    int r;
    while(a%b!=0){
      r=a%b;
      a=b;
      b=r;
    }
    if(c%b==0)cout<<"YES";else cout << "NO";
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
double pi= 3.45192653589793;

int main(){
	double x,h;
	while(true){
		cin>>x>>h;
		if(x==0 && h==0){
			break;
		}
		double c = (x/2)*(x/2) + h*h;
		c=sqrt(c);
		cout<<setprecision(20)<<x*x+c*x*2<<endl;
	}
}


Measured memory_bytes: 3188
#include<stdio.h>
void bubbleSort(int A[100], int n){
    int j, flag, swap;
    int cnt = 0;
    flag = 1;
    while(flag){
        flag = 0;
        for(j=n-1; j>0; j--){
            if(A[j] < A[j-1]){
                swap = A[j-1];
                A[j-1] = A[j];
                A[j] = swap;
                flag = 1;
                cnt++;
            }
        }
    }
    printf("%d", A[0]);
    for(j=1; j<n; j++){
        printf(" %d", A[j]);
    }
    printf("\n");
    printf("%d\n", cnt);
}

int main(){
    int i, N, A[100];

    scanf("%d", &N);

    for(i=0; i<N; i++){
        scanf("%d", &A[i]);
    }

    bubbleSort(A,N);

    return 0;
}

Measured memory_bytes: 1780
#!/usr/bin/env python3

import sys
sys.setrecursionlimit(300000)


def solve(n: int, a: "List[int]"):
    a.sort(reverse=True)
    r0 = a[0]
    r1 = a[1]
    h = r0 // 2
    for v in a[1:]:
        if abs(v - h) < abs(r1 - h):
            r1 = v
    print(r0, r1)
    return

def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    n = int(next(tokens))  # type: int
    a = [int(next(tokens)) for _ in range(n)]  # type: "List[int]"
    solve(n, a)

if __name__ == '__main__':
    main()


Measured memory_bytes: 15940
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

from itertools import chain
from functools import reduce
from collections import OrderedDict, Counter, deque
import operator

IS = lambda: int(input())
IA = lambda: [int(x) for x in input().split()]
IM = lambda N: [IA() for _ in range(N)]

s = input()
d = set("ACGT")

ans = 0
cur = 0
for x in s:
    if x in d:
        cur += 1
        ans = max(ans, cur)
    else:
        cur = 0
print(ans)

Measured memory_bytes: 3828
($N,$A,$B,$C,$D)=glob<>;
$M=$C>$D?$C:$D;
$s=<>;
$t=substr($s,$A-1,$M-$A+1);
print+(($C>$D&substr($s,$B-2,$D-$B+3)!~'\.\.\.')|$t=~'##')?No:Yes

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

#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pb push_back
#define fi first
#define se second
#define pii pair<int,int>
#define pll pair<ll,ll>
#define mii map<int,int>
#define mll map<ll,ll>
#define all(x) (x).begin(),(x).end()
#define S(x) (int)(x).size()
#define L(x) (int)(x).length()

#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
typedef tree<int , null_type , less<int> , rb_tree_tag , tree_order_statistics_node_update> ordered_set;

const int mod = 1e9+7;
const ll infl = 0x3f3f3f3f3f3f3f3fLL;
const int infi = 0x3f3f3f3f;

void solve()
{
	int l,r,d,i;
	cin>>l>>r>>d;
	int cnt=0;
	for(i=l;i<=r;i++) if(i%d==0) cnt++;
	cout<<cnt<<'\n';
}

int main()
{
	IOS
	int t=1;
	//cin>>t;
	while(t--)
	{
		solve();
	}
}


Measured memory_bytes: 3560
import java.io.IOException;
import java.io.InputStream;
import java.util.InputMismatchException;

public class Main {

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

    String a = in.readString();
    String b = in.readString();
    boolean ok = true;
    if (b.length() - a.length() == 1) {
      for (int i = 0; i < a.length(); i++) {
        if (a.charAt(i) != b.charAt(i))  ok = false;
      }
    } else ok = false;
    if (ok) System.out.println("Yes");
    else System.out.println("No");
  }

  static class InputReader {

    private final InputStream stream;
    private final byte[] buf = new byte[8192];
    private int curChar, snumChars;
    private SpaceCharFilter filter;

    public InputReader(InputStream stream) {
      this.stream = stream;
    }

    public int snext() {
      if (snumChars == -1) throw new InputMismatchException();
      if (curChar >= snumChars) {
        curChar = 0;
        try {
          snumChars = stream.read(buf);
        } catch (IOException e) {
          throw new InputMismatchException();
        }
        if (snumChars <= 0) return -1;
      }
      return buf[curChar++];
    }

    public int nextInt() {
      int c = snext();
      while (isSpaceChar(c)) {
        c = snext();
      }
      int sgn = 1;
      if (c == '-') {
        sgn = -1;
        c = snext();
      }
      int res = 0;
      do {
        if (c < '0' || c > '9') throw new InputMismatchException();
        res *= 10;
        res += c - '0';
        c = snext();
      } while (!isSpaceChar(c));
      return res * sgn;
    }

    public long nextLong() {
      int c = snext();
      while (isSpaceChar(c)) {
        c = snext();
      }
      int sgn = 1;
      if (c == '-') {
        sgn = -1;
        c = snext();
      }
      long res = 0;
      do {
        if (c < '0' || c > '9') throw new InputMismatchException();
        res *= 10;
        res += c - '0';
        c = snext();
      } while (!isSpaceChar(c));
      return res * sgn;
    }

    public int[] nextIntArray(int n) {
      int a[] = new int[n];
      for (int i = 0; i < n; i++) {
        a[i] = nextInt();
      }
      return a;
    }

    public String readString() {
      int c = snext();
      while (isSpaceChar(c)) {
        c = snext();
      }
      StringBuilder res = new StringBuilder();
      do {
        res.appendCodePoint(c);
        c = snext();
      } while (!isSpaceChar(c));
      return res.toString();
    }

    public String nextLine() {
      int c = snext();
      while (isSpaceChar(c)) c = snext();
      StringBuilder res = new StringBuilder();
      do {
        res.appendCodePoint(c);
        c = snext();
      } while (!isEndOfLine(c));
      return res.toString();
    }

    public boolean isSpaceChar(int c) {
      if (filter != null) return filter.isSpaceChar(c);
      return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
    }

    private boolean isEndOfLine(int c) {
      return c == '\n' || c == '\r' || c == -1;
    }

    public interface SpaceCharFilter {
      public boolean isSpaceChar(int ch);
    }
  }
}


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

#define _USE_MATH_DEFINES
#include<cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>
#include<iomanip>
#include<unordered_set>
#include<unordered_map>
#include<bitset>
#include<complex>

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

//typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;
typedef vector< vector<int> > mat;

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

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD =  (int)1e9 + 7;
const double EPS = 1e-9;

const int MAX = 510000;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

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

	COMinit();

	int N,K;
	cin>>N>>K;

	int ans=0;
	rep(i,0,min(N,K+1))
	{
		int res=COM(N,i)*COM(N-1,N-1-i);
		res%=MOD;
		ans+=res;
		ans%=MOD;
	}

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

Measured memory_bytes: 12160
#include <stdio.h>

int main(){
    int h1, h2, t, tyo = 0, hisi = 0;

    while(scanf("%d, %d, %d", &h1, &h2, &t) != EOF){
        if(h1 == h2) hisi++;
        else if(((h1 * h1) + (h2 * h2)) == (t * t)) tyo++;
    }
    printf("%d\n%d\n", tyo, hisi); 
    return 0;
}

Measured memory_bytes: 596
#include<bits/stdc++.h>
#define f first
#define s second
using namespace std;

long long dp[1000][1000];
char a[1000][1000];

int main()
{
    int n, m; cin >> n >> m;
    for(int i = 0; i < n; i++)
        for(int j = 0; j < m; j++)
        {
            cin >> a[i][j];
            if(a[i][j] == '#')
                dp[i][j] = -1;
        }
    dp[0][0] = 1;
    for(int i = 0; i < n; i++)
        for(int j = 0; j < m; j++)
        {
            if(dp[i][j] == -1) continue;
            if(j) dp[i][j] += max(1ll*0, dp[i][j-1]);
            if(i) dp[i][j] += max(1ll*0, dp[i-1][j]);
            dp[i][j] %= 1000000007;
        }
    cout << dp[n-1][m-1];
}


Measured memory_bytes: 9088
#include<iostream>
using namespace std;
int main()
{
	int sumg=0;
	int sump=0;
	char a;
	int ans=0;
	while(cin>>a)
	{
		if(a=='g')
		{
			if(sump<sumg)
			{
				ans++;
				sump++;
			}
			else	sumg++;
		}
		if(a=='p')
		{
			if(sump<sumg)
				sump++;
			else
			{
				ans--;
				sumg++;
			} 
		}
		
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		if(a < b){
			if(b < c){
				System.out.printf("%d %d %d\n",a,b,c);
			}else if(a < c){
				System.out.printf("%d %d %d\n",a,c,b);
			}else{
				System.out.printf("%d %d %d\n",c,a,b);
			}
		}else{
			if(a < c){
				System.out.printf("%d %d %d\n",b,a,c);
			}else if(b < c){
				System.out.printf("%d %d %d\n",b,c,a);
			}else{
				System.out.printf("%d %d %d\n",c,b,a);
			}
		}
	}
}


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

typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
typedef pair <ll, ll> pll;
typedef pair <int, int> pii;

typedef tree <ll, null_type, less <ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
// order_of_key(val): returns the number of values less than val
// find_by_order(k): returns an iterator to the kth largest element (0-based)

#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(a) a.begin(), a.end()
#define sz(a) (ll)(a.size())
#define endl "\n"

template <class Ch, class Tr, class Container>
basic_ostream <Ch, Tr> & operator << (basic_ostream <Ch, Tr> & os, Container const& x) 
{
    os << "{ ";
    for(auto& y : x) 
    {
        os << y << " ";
    }
    return os << "}";
}

template <class X, class Y>
ostream & operator << (ostream & os, pair <X, Y> const& p) 
{
    return os << "[" << p.ff << ", " << p.ss << "]";
}

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

    return gcd(b, a%b);
}

ll modexp(ll a, ll b, ll c)
{   
    a%=c;

    ll ans = 1;

    while(b)
    {
        if(b&1)
        {
            ans = (ans*a)%c;
        }

        a = (a*a)%c;
        b >>= 1;
    }

    return ans;
}

ll nxt()
{
    ll x;
    cin >> x;
    return x;
}

const ll L = 1e5+5;

void solve()
{
    ll n = nxt(), a = nxt(), b = nxt();

    if(a%2 == b%2)
    {
        cout << abs(a-b)/2 << endl;
    }

    else
    {
        ll must = min(a-1, n-b);
        ll diff = (b-a);

        cout << must + 1 + (diff-1)/2 << endl;
    }
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    
    ll T = 1;
    // T = nxt();

    while(T--)
    {
        solve();
    }

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#ifdef HIRO
#define d(f_, ...) printf((f_), ##__VA_ARGS__)
#else
#define d(f_, ...)
#endif

using namespace std;
typedef long long ll;

int main() {
#ifdef HIRO
  string file_path(QUIZ);
  ifstream cin(file_path + "/input.txt");
  std::cin.rdbuf(cin.rdbuf());
#endif
  int n,a,b;
  // int m;
  cin >> n>>a>>b;
  // cin >> m;
  int ans = 0;
  for(int i = 1; i <= n; ++i) {
    int j = i;
    int sum = 0;
    while(j) {
      sum += j % 10;
      j /= 10;
    }
    if(sum>=a&&sum<=b) ans += i;
  }


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



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

using namespace std;

int main()
{
    int a,b;
    cin >> a;
    cin >> b;
    long double n = (a + (double)b)/2;
    if(ceil(n) == floor(n))
        cout << (long long int)n;
    else
        cout << "IMPOSSIBLE";
    return 0;
}


Measured memory_bytes: 3616
#include <iostream>
#include <bits/stdc++.h>
#define int long long
#define sc(x) scanf("%lld",&(x));
#define sci(x) scanf("%d",&(x));
#define si signed
#define P pair<int,int>
#define fi first
#define se second

using namespace std;
int n,m,k;
int A[15];
int ans = 1e9;
int S[14][1005];
bool check(int l,int r,int L,int R)
{
    int ans =0;
    for(int i=l;i<=r;i++){
        ans += S[i][R]-S[i][L-1];
    }

    return ans<=k;
}
bool Chk(int L,int mid)
{
    int x=0;
    for(int i=1;i<n;i++){
        if(A[i]==1){
            if(!check(x,i-1,L,mid)){
                return false;
            }
            x = i;
        }
    }
    if(!check(x,n-1,L,mid)){
        return false;
    }
    return true;
}
void cal()
{
    int a=0;
    bool flag = true;
    for(int i=1;i<n;i++){
        if(A[i])a++;
    }
    int L = 1, R = m;
    while(L<=R){
        int l = L, r= R;
        while(l+1<r){
            int x = 0;
            int mid = (l+r)/2;
            bool f = Chk(L,mid);
            if(f){
                l = mid;
            }else r = mid-1;
        }
        if(Chk(L,l+1)){
            L = l+2;
            //cout<<l<<endl;
        }else if(Chk(L,l))L = l+1;
        else {flag = false;break;}
        if(L>R)a--;
        if(L==R){
            if(!Chk(L,R)){
                flag = false;
                break;
            }
        }
        a++;
    }
    if(flag)
    ans = min(ans,a);

}
void dfs(int x)
{
    if(x==n){
        cal();
       return;
    }
    A[x] = 0;
    dfs(x+1);
    A[x] = 1;
    dfs(x+1);
}
char s[14][1005];

si main() {
    sc(n)sc(m)sc(k)
    for(int i=0;i<n;i++){
        scanf("%s",s[i]+1);
    }
    for(int i=0;i<n;i++){
        for(int j=1;j<=m;j++){
            S[i][j]=(s[i][j]=='1')+S[i][j-1];
        }
        S[i][m+1]=S[i][m+2]=S[i][m];
    }
    dfs(1);
    cout<<ans<<'\n';
    return 0;
}


Measured memory_bytes: 384
parseInt(x) = parse(Int, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)

const n,k=parseMap(split(readline()))
const a=sort(parseMap(split(readline())))
function f(x,y)
    res=0
    for i in a
        res+=ceil(Int,i/x)-1
    end
    isless(y,res)
end

# f(二分探索の結果,k)を基準として二分探索を行う
println(searchsortedfirst(1:a[end],k,lt=f))

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


int dfs(int c,int s){
    if( c == 0 ) return s == 0;
    int ans = 0;
    for(int i = 0 ; i < 10 ; i++){
        ans += dfs(c-1, s-i);
    }
    return ans;
}

int main() {
    int n;
    while(cin >> n) cout << dfs(4, n) << endl;
}


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

string a,b="CF"; //打表
int al,bl;

int main(){
    getline(cin,a);
    al=a.length();
    for(int i=0;i<al;i++)
        if(a[i]==b[bl]){ //当找到一个的时候加一
            bl++;
            if(bl==2)   //都找到的时候就退出
                break;
        }
    if(bl==2) cout<<"Yes"; 
    else cout<<"No";
    cout<<endl;
    return 0;
}

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

int main()
{
    string s;
    cin >> s;
    int ans = 1000;
    for (int i = 0; i <= s.size() - 3; i++) {
        string t = s.substr(i, 3);
        ans = min(ans, abs(753 - stoi(t)));
    }
    cout << ans << endl;
    return 0;
}

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

int main() {
  string s;
  cin >> s;
  if(s == "SUN") {
    cout << 7;
  } else if(s == "MON") {
    cout << 6;
  } else if(s == "TUE") {
    cout << 5;
  } else if(s == "WED") {
    cout << 4;
  } else if(s == "THU") {
    cout << 3;
  } else if(s == "FRI") {
    cout << 2;
  } else {
    cout << 1;
  }
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <algorithm>
#include <climits>
#include <cstring>
#include <cmath>
#include <stack>
#include <iomanip>
#include <tuple>
#include <functional>
#include <cfloat>
#include <map>
#include <set>
#include <array>
#include <stdio.h>
#include <string.h>
using ll = long long;
using namespace std;
//LLONG_MAX = 90^18
#define int long long
#define CONTAINS(v,n) (find((v).begin(), (v).end(), (n)) != (v).end())
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define ARY_SORT(a, size) sort((a), (a)+(size))
#define REMOVE(v,a) (v.erase(remove((v).begin(), (v).end(), (a)), (v).end()))
#define REVERSE(v) (reverse((v).begin(), (v).end()))
#define ARY_REVERSE(v,a) (reverse((v), (v)+(a)))
#define LOWER_BOUND(v,a) (lower_bound((v).begin(), (v).end(), (a)))
#define UPPER_BOUND(v,a) (upper_bound((v).begin(), (v).end(), (a)))
#define REP(i, n) for (int (i)=0; (i) < (n); (i)++)
#define CONTAINS_MAP(m, a) (m).find((a)) != m.end()
void YesNo(bool b) { cout << (b ? "Yes" : "No"); }
void Yes() { cout << "Yes"; }
void No() { cout << "No"; }
//max_element



signed main()
{
	char ch;
	cin >> ch;
	ch++;
	cout << ch << endl;
}




Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
int main() {
	long hp;
	cin >> hp;
	long at = 0;
	long qua = 1;
	while (hp > 0) {
		at += qua;
		qua *= 2;
		hp /= 2;
	}
	cout << at <<'\n';
	return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("O2")
#include <bits/stdc++.h>
using namespace std;
typedef long long                   ll;
typedef long double                 ld;
typedef pair<int,int>               pii;
typedef pair<ll,ll>                 pll;
typedef pair<double,double>         pdd;
typedef pair<ld,ld>                 pld;
typedef pair<string , string>       pss;
#define ts(x)                       to_string(x)
#define ti(x)                       stoi(x)
#define all(x)                      (x).begin(),(x).end()
#define F                           first
#define S                           second
#define Mp                          make_pair
#define tab                         '\t'
#define sep                         ' '
#define mine(v)                     *min_element(all(v))
#define maxe(v)                     *max_element(all(v))
#define error(x)                    cerr << #x << " = " << x << endl
#define fast_io                     ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define file_io                     freopen("in.txt" , "r+" , stdin) ; freopen("out.txt" , "w+" , stdout);
#define endl                        "\n"
inline ll input(){ll n; cin >> n ; return n;}
ll pw(ll a , ll b)  { return (!b ? 1 : (b & 1 ? a * pw(a * a , b / 2) : pw(a * a , b / 2))); }

const int MAXN = 1e3 + 10;
const int MOD = 1e9 + 7;
const int MOD2 = 998244353;
const ll INF = 8e18;

bool mark[MAXN][MAXN];

ll dp[MAXN][MAXN];

int main(){
    fast_io;
    //cout << fixed << setprecision(15);
    //scanf("%d %d %f %lld %s %c", &x);
    //printf("%d %d %f %lld %s %c", x);
    int H, W;
    string s;
    cin >> H >> W;
    for(int i = 1; i <= H; i++){
        cin >> s;
        for(int j = 1; j <= W; j++){
            if(s[j - 1] == '#'){
                mark[i][j] = 1;
            }
        }
    }
    for(int i = 1; i <= H ; i ++){
        for(int j = 1; j <= W; j++){
            if(mark[i][j] == 1){
                dp[i][j] = 0;
                continue;
            }
            if(i == 1 && j == 1){
                dp[i][j] = 1;
                continue;
            }
            if(i == 1){
                dp[i][j] = dp[i][j - 1] % MOD;
            }
            else if(j == 1){
                dp[i][j] = dp[i - 1][j] % MOD;
            }
            else{
                dp[i][j] = (dp[i - 1][j] % MOD) + (dp[i][j - 1] % MOD);
                dp[i][j] = dp[i][j] % MOD;
            }
        }
    }
    cout << dp[H][W] % MOD;
    return 0;
}



Measured memory_bytes: 9216
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**6)
# buff_readline = sys.stdin.buffer.readline
buff_readline = sys.stdin.readline
readline = sys.stdin.readline

INF = 2**62-1


def read_int():
    return int(buff_readline())


def read_int_n():
    return list(map(int, buff_readline().split()))


def read_float():
    return float(buff_readline())


def read_float_n():
    return list(map(float, buff_readline().split()))


def read_str():
    return readline().strip()


def read_str_n():
    return readline().strip().split()


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap



@mt
def slv(N, C, STC):
    from collections import Counter
    se = [(2*s, 0, c) for s, t, c in STC]
    te = [(2*t+1, 1, c) for s, t, c in STC]
    e = se + te
    e.sort(reverse=True)
    r = Counter()
    ans = 0
    while e:
        _, k, c = e.pop()
        if k == 0:
            r[c] += 1
        else:
            r[c] -= 1
            if r[c] == 0:
                r.pop(c)
        ans = max(ans, len(r))
    return ans


def main():
    N, C = read_int_n()
    STC = [read_int_n() for _ in range(N)]
    print(slv(N, C, STC))


if __name__ == '__main__':
    main()


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

const ll mod = 1000000007;
struct mint {
    ll x;  // typedef long long ll;
    mint(ll x = 0) : x((x % mod + mod) % mod) {}
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod - a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) {
        (x *= a.x) %= mod;
        return *this;
    }
    mint operator+(const mint a) const {
        mint res(*this);
        return res += a;
    }
    mint operator-(const mint a) const {
        mint res(*this);
        return res -= a;
    }
    mint operator*(const mint a) const {
        mint res(*this);
        return res *= a;
    }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t >> 1);
        a *= a;
        if (t & 1) a *= *this;
        return a;
    }

    mint inv() const {
        return pow(mod - 2);
    }
    mint& operator/=(const mint a) {
        return (*this) *= a.inv();
    }
    mint operator/(const mint a) const {
        mint res(*this);
        return res /= a;
    }
};

struct combination {
    vector<mint> fact, ifact;
    // init struct with \"n\" of \"nCk\" (maximum number in other words)
    combination(int n) : fact(n + 1), ifact(n + 1) {
        assert(n < mod);
        fact[0] = 1;
        for (int i = 1; i <= n; ++i) fact[i] = fact[i - 1] * i;
        ifact[n] = fact[n].inv();
        for (int i = n; i >= 1; --i) ifact[i - 1] = ifact[i] * i;
    }
    // c(n,k) returns mint that contains nCk (mod p (= 1e9+7)) in x
    // i.e.) mint num = c(n,k), then num.x == nCk (mod p (= 1e9+7))
    mint operator()(int n, int k) {
        if (k < 0 || k > n) return 0;
        return fact[n] * ifact[k] * ifact[n - k];
    }

    // nPk - permutation
    mint p(int n, int k) {
        return fact[n] * ifact[n - k];
    }
};

int main() {
	ll n;
    cin >> n;
    mint ans = mint(10).pow(n);
    ans -= mint(9).pow(n);
    ans -= mint(9).pow(n);
    ans += mint(8).pow(n);
    cout << ans.x << endl;
}


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

ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }

vector<pair<ll, ll>> factorize(ll n) {
    vector<pair<ll, ll>> res;
    for (ll i = 2; i*i <= n; i++) {
        if (n % i) continue;
        res.emplace_back(i, 0);
        while (n % i == 0) {
            n /= i;
            res.back().second++;
        }
    }
    if (n != 1) res.emplace_back(n, 1);

    return res;
}

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

    ll A, B;
    cin >> A >> B;

    ll g = gcd(A,B);
    auto f = factorize(g);
    cout << f.size() + 1LL << endl;

    return 0;
}


Measured memory_bytes: 256
#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::io::*;
use std::str::FromStr;

pub fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed reading char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed parsing")
}

use std::cmp::{min};
use std::num;

fn main() {
    
    let l = read::<u64>();
    let r = read::<u64>();
    
    const MOD : u64 = 2019;
    
    let mut min = MOD;
    
    if (l % 673) >= (r % 673) { min = 0; }
    else {
        let s = l as usize;
        let g = r as usize;
        
        'outer : for i in s..g {
            for j in i+1..g+1 {
                if (((i * j) as u64) % MOD) < min {
                    min = ((i * j) as u64 % MOD); 
                }
                if min == 0 {break 'outer;}
            }
        }
    }
    
    println!("{}",min);
}

Measured memory_bytes: 4352
#include<bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define int long long
#define pb push_back
#define mp make_pair
#define fi first
#define se second
using namespace std;

const int N = 1e5+6, inf = -1e9-7;
int n, w[N];
vector <int> adj[N];

signed main(){
	cin >> n;
	for (int i=0; i<n-1; i++){
		int u, v;
		cin >> u >> v; u--, v--;
		adj[u].pb(v);
		adj[v].pb(u);
	}
	int k; cin >> k;
	priority_queue <pair <int, int> > q;
	for (int i=0; i<n; i++){
		w[i] = inf;
	}
	while (k--){
		int idx, val; 
		cin >> idx >> val;
		idx--; w[idx] = val;
		q.push(mp(w[idx], idx));
	}	
	bool ok = true;
	while (!q.empty()){
		int u = q.top().fi, v = q.top().se;
		q.pop();
		for (int i=0; i<(int)adj[v].size(); i++){
			int p = adj[v][i];
			if (w[p] != inf){
				if (abs(w[p]-u) != 1){
					ok = false;
					break;
				}
			}
			else{
				w[p] = u-1;
				q.push(mp(w[p], p));
			}
		}
	}
	if (ok){
		cout << "Yes\n";
		for (int i=0; i<n; i++) cout << w[i] << "\n";
	}
	else cout << "No\n";
}



Measured memory_bytes: 12192
#include <stdio.h>

int main(void){
	int x, y;
	int tx, ty;
	int gcd, lcm;

	while(scanf("%d %d", &x, &y) != EOF){
		tx = x;
		ty = y;
		int r;

		while((r = x % y) != 0){
			x = y;
			y = r;
		}

		gcd = y;
		lcm = tx /gcd * ty;

		printf("%d %d\n", gcd, lcm);
	}

	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
using LL = long long int;
#define incID(i, l, r) for(int i = (l)    ; i <  (r); ++i)
#define incII(i, l, r) for(int i = (l)    ; i <= (r); ++i)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); --i)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); --i)
#define inc(i, n)  incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define dec(i, n)  decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))
#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define  ALL(v)  v.begin(),  v.end()
#define RALL(v) v.rbegin(), v.rend()
auto setmin   = [](auto & a, auto b) { return (b <  a ? a = b, true : false); };
auto setmax   = [](auto & a, auto b) { return (b >  a ? a = b, true : false); };
auto setmineq = [](auto & a, auto b) { return (b <= a ? a = b, true : false); };
auto setmaxeq = [](auto & a, auto b) { return (b >= a ? a = b, true : false); };
auto fl = [](auto a, auto b) { assert(b != 0); return a / b - (a % b != 0 && ((a >= 0) != (b >= 0)) ? 1 : 0); };
auto ce = [](auto a, auto b) { assert(b != 0); return a / b + (a % b != 0 && ((a >= 0) == (b >= 0)) ? 1 : 0); };
auto mo = [](auto a, auto b) { assert(b != 0); a %= b; if(a < 0) { a += abs(b); } return a; };
LL gcd(LL a, LL b) { return (b == 0 ? a : gcd(b, a % b)); }
LL lcm(LL a, LL b) { return a / gcd(a, b) * b; }
#define bit(b, i) (((b) >> (i)) & 1)
#define SI(v) static_cast<int>(v.size())
#define RF(e, v) for(auto & e: v)
#define until(e) while(! (e))
#define if_not(e) if(! (e))
#define ef else if
#define UR assert(false)

// ---- ----

int main() {
	LL h;
	cin >> h;
	map<LL, LL> mp;
	mp[0] = 0;
	function<LL(LL)> f = [&](LL x) -> LL {
		if(mp.count(x) == 1) { return mp[x]; }
		LL v = 2 * f(x / 2) + 1;
		mp[x] = v;
		return mp[x];
	};
	
	cout << f(h) << endl;
	
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <iomanip>
#include <queue>
#include <deque>
#include <map>
#include <unordered_map>
#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
#define repr(e,x) for(auto& e:x)
using namespace std;
typedef long long ll;

ll a,b,x;

int main(){
    cin>>a>>b>>x;

    ll ans=b/x-a/x;
    if(a%x==0) ans++;

    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <tuple>
#include <cstring>
#include <functional>
using namespace std;
typedef long long ll;
typedef pair<long long, long long> P;
#define rep(i, n) for(long long i=0; i<n; i++)
#define reps(i, s, e) for(long long i=s; i<e; i++)
#define repr(i, n) for(long long i=n-1; i>=0; i--)
#define reprs(i, s, e) for(long long i=e-1; i>=s; i--)

int main(){

    cin.tie(0);
    ios::sync_with_stdio(false);

    ll n; cin >> n;

    ll cnt[10][10] = {};

    reps(i, 1, n+1){
        ll tail = i % 10;
        if(tail == 0) continue;

        ll head = i;
        while(head >= 10){
            head /= 10;
        }

        // cout << head << " " << tail << endl;

        cnt[head][tail]++;
    }

    ll ans = 0;

    reps(i, 1, 10){
        reps(j, i, 10){
            // cout << i << " " << j << " " << cnt[i][j] << " " << cnt[j][i] << endl;
            if(i == j){
                ans += cnt[i][j] * cnt[i][j];
            }
            else{
                ans += 2 * cnt[i][j] * cnt[j][i];
            }
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
n = int(input())
import math as m
t1 , a1 = map(int,input().split())
tt = t1
aa = a1
for i in range(n-1):
    t, a = map(int,input().split())
    n = ((max((tt//t),(aa//a))))
    if tt > t*n or aa> a*n:
        n = n + 1
    tt = t * n
    aa = a * n
print(tt + aa)

Measured memory_bytes: 3064
package main

import (
   "fmt"
   "sort"
)

type restaurant struct {
   id, rate int
   city     string
}

func solution(n int, restaurants []restaurant) []int {
   sort.SliceStable(restaurants, func(i, j int) bool {
        if restaurants[i].city == restaurants[j].city {
                return restaurants[i].rate > restaurants[j].rate
        }
        return restaurants[i].city < restaurants[j].city
   })

   out := make([]int, n)
   for i := range restaurants {
        out[i] = restaurants[i].id
   }
   return out
}

func main() {
   var n int
   fmt.Scan(&n)
   restaurants := make([]restaurant, n)
   for i := range restaurants {
        restaurants[i].id = i + 1
        fmt.Scan(&restaurants[i].city, &restaurants[i].rate)
   }
   for _, t := range solution(n, restaurants) {
        fmt.Println(t)
   }
}

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

#define lli long long int
#define REP(i,s,l) for(lli i=s;i<l;i++)
#define DEBUG 0
#define INF (1LL<<50)
#define MOD 1000000007

int main(){
    int a, b, c;
    vector<int> r(3);
    for(int i=0; i<3; i++) cin >> r.at(i);

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

    cout << r[0]+r[1] << endl;
    return 0;
}

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

int main()
{
        int N, i;
        int cntB = 0;
        int cntR = 0;
        char *str;

        scanf("%d", &N);
        str = malloc(N+1);

        scanf("%s", str);

        for(i = 0; i < N; i++) {
                if(str[i] == 'B') {
                        cntB++;
                } else if(str[i] == 'R') {
                        cntR++;
                }
        }

        if(cntR > cntB) {
                printf("Yes\n");
        } else {
                printf("No\n");
        }

        return 0;
}

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

using namespace std;
typedef long long LL;
int _max(int x, int y) {return x > y ? x : y;}
const int N = 200001;
const int mod = 924844033;
int read() {
	int s = 0, f = 1; char ch = getchar();
	while(ch < '0' || ch > '9') {if(ch == '-') f = -1; ch = getchar();}
	while(ch >= '0' && ch <= '9') s = s * 10 + ch - '0', ch = getchar();
	return s * f;
}
void put(int x) {
	if(x < 0) putchar('-'), x = -x;
	if(x >= 10) put(x / 10);
	putchar(x % 10 + '0');
}

int main() {
	int T = read();
	while(T--) {
		int a = read(), b = read();
		LL hh = (LL)a * b - 1;
		if(hh == 0) {puts("0"); continue;}
		int l = 1, r = 1e9, uu = 0;
		while(l <= r) {
			int mid = (l + r) / 2;
			if((LL)mid * mid <= hh) l = mid + 1, uu = mid;
			else r = mid - 1;
		} int ans = uu * 2;
		if(uu == hh / uu) ans--;
		if(a == uu && b == uu) ans--;
		else {
			if(a <= uu) ans--;
			if(b <= uu) ans--;
		} put(ans), puts("");
	}
	return 0;
}

Measured memory_bytes: 256
// #pragma GCC target("avx")  // CPU 処理並列化
// #pragma GCC optimize("O3")  // CPU 処理並列化
// #pragma GCC optimize("unroll-loops")  // 条件処理の呼び出しを減らす
// #define BEGIN_STACK_EXTEND(size) void * stack_extend_memory_ = malloc(size);void * stack_extend_origin_memory_;char * stack_extend_dummy_memory_ = (char*)alloca((1+(int)(((long long)stack_extend_memory_)&127))*16);*stack_extend_dummy_memory_ = 0;asm volatile("mov %%rsp, %%rbx\nmov %%rax, %%rsp":"=b"(stack_extend_origin_memory_):"a"((char*)stack_extend_memory_+(size)-1024));
// #define END_STACK_EXTEND asm volatile("mov %%rax, %%rsp"::"a"(stack_extend_origin_memory_));free(stack_extend_memory_);

#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
#include<numeric>
#include<unordered_set>
#include<unordered_map>
#include<complex>
using namespace std;
const long long mod=998244353;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const long double EPS=1e-9;
const long double INF=1e+10;
const long double PI=acos(-1.0);
const int C_SIZE = 3100000;
const int UF_SIZE = 3100000;
namespace{
	long long fact[C_SIZE];
	long long finv[C_SIZE];
	long long inv[C_SIZE];
	long long Comb(int a,int b){
	 	if(a<b||b<0)return 0;
	 	return fact[a]*finv[b]%mod*finv[a-b]%mod;
	}
	void init_C(int n){
		fact[0]=finv[0]=inv[1]=1;
		for(int i=2;i<n;i++){
			inv[i]=(mod-(mod/i)*inv[mod%i]%mod)%mod;
		}
		for(int i=1;i<n;i++){
			fact[i]=fact[i-1]*i%mod;
			finv[i]=finv[i-1]*inv[i]%mod;
		}
	}
	long long pw(long long a,long long b){
		if(a<0LL)return 0;
		if(b<0LL)return 0;
		long long ret=1;
		while(b){
			if(b%2)ret=ret*a%mod;
			a=a*a%mod;
			b/=2;
		}
		return ret;
	}
	long long pw_mod(long long a,long long b,long long M){
		if(a<0LL)return 0;
		if(b<0LL)return 0;
		long long ret=1;
		while(b){
			if(b%2)ret=ret*a%M;
			a=a*a%M;
			b/=2;
		}
		return ret;
	}
	int pw_mod_int(int a,int b,int M){
		if(a<0)return 0;
		if(b<0)return 0;
		int ret=1;
		while(b){
			if(b%2)ret=(long long)ret*a%M;
			a=(long long)a*a%M;
			b/=2;
		}
		return ret;
	}
	int ABS(int a){return max(a,-a);}
	long long ABS(long long a){return max(a,-a);}
	double ABS(double a){return max(a,-a);}
	int sig(double r) { return (r < -EPS) ? -1 : (r > +EPS) ? +1 : 0; }
	int UF[UF_SIZE];
	void init_UF(int n){
		for(int i=0;i<n;i++)UF[i]=-1;
	}
	int FIND(int a){
		if(UF[a]<0)return a;
		return UF[a]=FIND(UF[a]);
	}
	void UNION(int a,int b){
		a=FIND(a);b=FIND(b);if(a==b)return;
		if(UF[a]>UF[b])swap(a,b);
		UF[a]+=UF[b];UF[b]=a;
	}
}
// ここから編集しろ
int main(){
	long long a,b,c;scanf("%lld%lld%lld",&a,&b,&c);
	long long t=min(a,c);
	a-=t;
	c-=t;
	t=min(b,c);
	b-=t;
	c-=t;
	printf("%lld %lld\n",a,b);
}

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

int main() {
    int N, K;
    cin >> N >> K;
    vector<int> A(N+2, 0);
    for (int i = 1; i <= N; i++) cin >> A[i];
    for (int i = 0; i < min(K, 100); i++) {
        vector<int> imos(N+2, 0);
        for (int j = 1; j <= N; j++) {
            imos[max(j-A[j], 0)]++;
            imos[min(j+A[j]+1, N+1)]--;
        }
        for (int j = 1; j <= N; j++) {
            imos[j] += imos[j-1];
        }
        swap(A, imos);
    }
    for (int i = 1; i <= N; i++) {
        cout << A[i];
        if (i <= N-1) cout << " ";
        else cout << endl;
    }
    return 0;
}

Measured memory_bytes: 5188
#include <iostream>

using namespace std;

int main()
{
   int a ,h ,n ,m=0;
   cin>>h>>n;
   while (n>0){
    cin>>a;
    m+=a;
    n--;
   }
    if (m>=h)
        cout<<"Yes";
    else
        cout<<"No";
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,m;
    cin >> n >> m;
    vector<int>l(m);
    vector<int>r(m);
    for(int i=0;i<m;i++)cin >> l[i] >> r[i];
    sort(l.begin(),l.end());
    reverse(l.begin(),l.end());
    sort(r.begin(),r.end());
    cout << max(r[0]-l[0]+1,0) << endl;
    
}

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

int keta(int x) {
  int ans = 0;
  while (x > 0) {
    ans += x%10;
    x /= 10;
  }

  return ans;
}

int main() {
  int n; cin >> n;
  if (n%keta(n) == 0) cout <<"Yes"<< endl;
  else cout << "No" << endl;
  return 0;
}

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

#define IO  ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL);
#define endl '\n'
#define ll long long
#define f first
#define s second
#define mod 1000000007
#define INF 0x3f3f3f3f3f3f3f3f
using namespace std;
const int M=1e5+5;

int main()
{
    IO
    int n;
    ll a[M],m,sum[M]={},ans=0;
    map<ll,int>mp;
    cin>>n>>m;
    for(int i=0;i<n;i++) cin>>a[i];
    sum[0]=a[0];
    for(int i=1;i<n;i++) {
       sum[i]=sum[i-1]+a[i];
    }
    for(int i=0;i<n;i++) {
        ans+=(mp[sum[i]%m]);
        mp[sum[i]%m]++;
    }
    cout<<ans+mp[0]<<endl;
    return 0;
}

Measured memory_bytes: 9044
from collections import deque
a=[1,2,3,4,5,6,7,8,9]
q=deque(a)
while(1):
    x=q.popleft()
    s=str(x)
    n=len(s)
    n1=int(s[n-1])
    c1=str(int(s[n-1])-1)
    c2=str(int(s[n-1])+1)
    a.append(int(s+s[n-1]))
    q.append(int(s+s[n-1]))
    if(n1>0):
        a.append(int(s+c1))
        q.append(int(s+c1))
    if(n1<9):
        a.append(int(s+c2))
        q.append(int(s+c2))
    if(len(a)>200005):
        break
a.sort()
k=int(input())
print(a[k-1])
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    


Measured memory_bytes: 60888