akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int > pii;
inline ll qpow(ll a,ll b,ll mod){ll res=1;while(b){if(b&1)res = (res*a)%mod;a=(a*a)%mod;b>>=1;}return res;}
const int mod = 1e9 + 7;
const int MAXN = 2e5 + 7;

int a[MAXN];
int main(){
    int n;
    cin >> n;
    for(int i = 1; i <= n; ++i) cin >> a[i];
    sort(a+1, a+1+n);
    cout << a[n/2 + 1] - a[n/2] << endl;
    return 0;
}

Measured memory_bytes: 640
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

N = list(str(input()))
N = map(int, N)

cum = 0
for n in N:
    cum += n
    cum %= 9
if cum%9==0:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 77844
N = int(input())
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]
C = [int(i) for i in input().split()]

res = 0
for i in range(len(A)):
    res += B[A[i] - 1]
    if i + 1 < N:
        if A[i+1] == A[i] + 1:
            res += C[A[i] - 1]

print(res)

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

using namespace std;

typedef long long ll;

#define faster ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0)

#define endl "\n"

int main()
{
	faster;
	ll n;
	cin >> n;

	ll limit = 1000000000000000000;

	vector<ll> a(n);

	for (auto &x : a)
		cin >> x;

	sort(a.begin(), a.end());
	ll prod = a[0];
	if (prod == 0)
	{
		cout << 0 << endl;
	}
	else
	{

		bool flag = false;

		for (int i = 1; i < n ; i++)
		{
			if (a[i] > (limit / prod))
			{
				flag = true;
				break;
			}
			prod *= a[i];
		}
		if (flag)
			cout << -1 << endl;
		else
		{
			cout << prod << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 3988
r, c = map(int, input().split())
r_sum = [0 for i in range(r)]
c_sum = [0 for i in range(c)]
all = 0
A = [list(map(int, input().split())) for i in range(r)]
for i in range(r) :
	for j in range(c) :
		r_sum[i] += A[i][j]

for j in range(c) :
	for i in range(r) :
		c_sum[j] += A[i][j]

for i in range(r) :
	for j in range(c) :
		print(A[i][j],end=" ")
	print(r_sum[i])

for j in range(c) :
	print(c_sum[j],end=" ")
	all += c_sum[j]
print(all)



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

using namespace std;
using ll = long long;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
	REP(i, v.size()) { if (i)os << " "; os << v[i]; }return os;
}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
	REP(i, v.size()) { if (i)os << endl; os << v[i]; }return os;
}

const ll INF = 1LL << 60;
ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;

#define int long long

inline void my_io() {

	std::ios::sync_with_stdio(false);

	std::cin.tie(0);

	cout << fixed << setprecision(16);

	//cout << setprecision(10) << scientific << ans << endl;

}

signed main() {
	ll x, a;

	cin >> x >> a;

	if (x < a) {
		cout << 0 << endl;
	}
	else {
		cout << 10 << endl;
	}
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) throws IOException {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskX solver = new TaskX();
		solver.solve(1, in, out);
		out.close();
	}

	static int INF = 1 << 30;
	static long LINF = 1L << 55;
	static int MOD = 1000000007;
	static int[] mh4 = { 0, -1, 1, 0 };
	static int[] mw4 = { -1, 0, 0, 1 };
	static int[] mh8 = { -1, -1, -1, 0, 0, 1, 1, 1 };
	static int[] mw8 = { -1, 0, 1, -1, 1, -1, 0, 1 };

	static class TaskX {

		public void solve(int testNumber, InputReader in, PrintWriter out) {

			long a = in.nextLong()-1;
			long b = in.nextLong()-1;

			out.println(a*b);

		}
	}

	static class InputReader {
		BufferedReader in;
		StringTokenizer tok;

		public String nextString() {
			while (!tok.hasMoreTokens()) {
				try {
					tok = new StringTokenizer(in.readLine(), " ");
				} catch (IOException e) {
					throw new InputMismatchException();
				}
			}
			return tok.nextToken();
		}

		public int nextInt() {
			return Integer.parseInt(nextString());
		}

		public long nextLong() {
			return Long.parseLong(nextString());
		}

		public double nextDouble() {
			return Double.parseDouble(nextString());
		}

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

		public int[] nextIntArrayDec(int n) {
			int[] res = new int[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextInt() - 1;
			}
			return res;
		}

		public long[] nextLongArray(int n) {
			long[] res = new long[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextLong();
			}
			return res;
		}

		public long[] nextLongArrayDec(int n) {
			long[] res = new long[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextLong() - 1;
			}
			return res;
		}

		public InputReader(InputStream inputStream) {
			in = new BufferedReader(new InputStreamReader(inputStream));
			tok = new StringTokenizer("");
		}
	}

}


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

int main(){
    int N,R,G,B;
    cin >> R >> G >> B >> N;
    int count = 0;

    for(int i =0; R*i <= N; i++){
        for(int j = 0; R*i+G*j <= N; j++){
            if( (N-(R*i + G*j))%B == 0 ){
                count ++;
            }
        }
    }

    cout << count << endl;
    
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define REP(i,n) for(ll i=0;i<(n);i++)
#define INF 1e9
#define All(x) (x).begin(),(x).end()
#define F first
#define S second
#define Cout(x) cout << (x) << endl
typedef long long ll;
using namespace std;

bool is_prime(const unsigned n){
    switch(n){
        case 0: // fall-through
        case 1: return false;
        case 2: return true;
    }

    // n > 2 が保証された

    for(unsigned i=2;i<n;++i){
        if(n%i == 0) return false;
    }

    return true;
}

int main(){
    int x;cin>>x;
    while(1){
        if(is_prime(x)){
            cout<<x<<endl;
            return 0;
        }else{
            x++;
        }
    }
}

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

#define REP(i, x, n) for (int i = x; i < (int)(n); i++)
#define RREP(i, x, n) for (int i = x - 1; i >= (int)(n); i--)
#define rep(i, n) REP(i, 0, n)
#define rrep(i, n) RREP(i, n, 0)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define MAX 1e9 + 7

using namespace std;

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

int main(void)
{
    int n, a, b;
    cin >> n >> a >> b;
    (((n * a) > b) ? cout << b << endl : cout << n * a << endl);
    return 0;
}

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

string base_convert(long long n, int b) {
  if (!n) return "0";
  string res = "";
  while (n) {
    int r = n % b;
    n /= b;
    if (r < 0) {
      if (b > 0) {r += b, n--;}
      else {r -= b, n++;}
    }
    res += to_string(r);
  }
  reverse(res.begin(), res.end());
  return res;
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n; cin >> n;
  cout << base_convert(n, -2) << '\n';
  return 0;
  
}

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

typedef long long ll;
int main()
{
//    ll  n,ans=0;
//    scanf("%lld",&n);
//    long long  a[20],b[20];
//    a[0]=9,b[0]=6;
//    for(int i=1; i<14; i++)
//    {
//        a[i]=a[i-1]*9;
//        b[i]=b[i-1]*6;
//    }
//    for(int i=14; i>=0; i--)
//    {
//        while(n>=a[i] || n>=b[i])
//        {
//            if(n>=a[i])
//            {
//                ans++;
//                n-=a[i];
//            }
//            if(n>=b[i])
//            {
//                ans++;
//                n-=b[i];
//            }
//        }
//    }
//    printf("%lld\n",ans+n);
    int a,b;
    int t[1010];
    t[0]=0;
    for(int i=1; i<1005; i++)
        t[i]=t[i-1]+i;
    cin>>a>>b;
    cout<<t[b-a]-b<<endl;
    return 0;
}


Measured memory_bytes: 256
use proconio::input;
use std::collections::BinaryHeap;
use std::collections::HashSet;

fn main() {
    input! {
        x: usize,
        y: usize,
        z: usize,
        k: usize,
        mut a: [usize; x],
        mut b: [usize; y],
        mut c: [usize; z],
    }

    let mut heap = BinaryHeap::new();
    a.sort_by(|a, b| b.cmp(a));
    b.sort_by(|a, b| b.cmp(a));
    c.sort_by(|a, b| b.cmp(a));
    // (value, index_a, index_b, index_c)
    heap.push((a[0] + b[0] + c[0], 0, 0, 0));

    let mut set = HashSet::new();
    for _ in 0..k {
        let com = heap.pop().unwrap();
        //println!("a {} b {} c {} {}", com.1, com.2, com.3, com.0);
        println!("{}", com.0);
        if com.1 + 1 < x
            && !set.contains(&(a[com.1 + 1] + b[com.2] + c[com.3], com.1 + 1, com.2, com.3))
        {
            heap.push((a[com.1 + 1] + b[com.2] + c[com.3], com.1 + 1, com.2, com.3));
            set.insert((a[com.1 + 1] + b[com.2] + c[com.3], com.1 + 1, com.2, com.3));
        }
        if com.2 + 1 < y
            && !set.contains(&(a[com.1] + b[com.2 + 1] + c[com.3], com.1, com.2 + 1, com.3))
        {
            heap.push((a[com.1] + b[com.2 + 1] + c[com.3], com.1, com.2 + 1, com.3));
            set.insert((a[com.1] + b[com.2 + 1] + c[com.3], com.1, com.2 + 1, com.3));
        }
        if com.3 + 1 < z
            && !set.contains(&(a[com.1] + b[com.2] + c[com.3 + 1], com.1, com.2, com.3 + 1))
        {
            heap.push((a[com.1] + b[com.2] + c[com.3 + 1], com.1, com.2, com.3 + 1));
            set.insert((a[com.1] + b[com.2] + c[com.3 + 1], com.1, com.2, com.3 + 1));
        }
    }
}


Measured memory_bytes: 3020
#include <iostream>
#include <sstream>
#include <algorithm>
#include <cstdio>
#include <math.h>
#include <set>
#include <map>
#include <queue>
#include <string>
#include <string.h>
#include <bitset>
#define REP(i,a,n) for(int i=a;i<=n;++i)
#define PER(i,a,n) for(int i=n;i>=a;--i)
#define hr putchar(10)
#define pb push_back
#define lc (o<<1)
#define rc (lc|1)
#define mid ((l+r)>>1)
#define ls lc,l,mid
#define rs rc,mid+1,r
#define x first
#define y second
#define io std::ios::sync_with_stdio(false)
#define endl '\n'
#define DB(a) ({REP(__i,1,n) cout<<a[__i]<<' ';hr;})
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int P = 1e9+7, INF = 0x3f3f3f3f;
ll gcd(ll a,ll b) {return b?gcd(b,a%b):a;}
ll qpow(ll a,ll n) {ll r=1%P;for (a%=P;n;a=a*a%P,n>>=1)if(n&1)r=r*a%P;return r;}
ll inv(ll x){return x<=1?1:inv(P%x)*(P-P/x)%P;}
inline int rd() {int x=0;char p=getchar();while(p<'0'||p>'9')p=getchar();while(p>='0'&&p<='9')x=x*10+p-'0',p=getchar();return x;}
//head



const int N = 1e6+10, inv2 = (P+1)/2;
int n,m,k,fac[N],ifac[N],po[N],ipo[N];
int C(int a, int b, int c) {
	return fac[a+b+c]*(ll)ifac[a]%P*ifac[b]%P*ifac[c]%P;
}
int main() {
	ifac[0]=fac[0]=po[0]=ipo[0]=1;
	REP(i,1,N-1) { 
		fac[i]=fac[i-1]*(ll)i%P;
		po[i]=po[i-1]*3ll%P;
	}
	ifac[N-1]=inv(fac[N-1]),ipo[N-1]=inv(po[N-1]);
	PER(i,1,N-2) { 
		ifac[i]=ifac[i+1]*(i+1ll)%P;
		ipo[i]=ipo[i+1]*3ll%P;
	}
	cin>>n>>m>>k;
	int ans = 0, ret = 0;
	REP(i,0,m) { 
		if (i==0) {
			REP(j,0,k) ret = (ret+(ll)ipo[j]*ifac[j]%P*fac[n+i+j-1])%P;
		}
		ans = (ans+(ll)ipo[i]*ifac[i]%P*ret)%P;
		ret = 3ll*inv2%P*ret%P*(n+i)%P;
		ret = (ret-(ll)ipo[k]*inv2%P*fac[n+i+k]%P*ifac[k])%P;
	}
	ans = (ll)ans*po[m+k]%P*ifac[n-1]%P;
	if (ans<0) ans += P;
	printf("%d\n", ans);
}









Measured memory_bytes: 15872
h = {
  'a' => gets.chomp.split(//),
  'b' => gets.chomp.split(//),
  'c' => gets.chomp.split(//)
}

k = h['a'].shift
while h[k] != ''
  break if h[k].empty?
  k = h[k].shift
end

puts(k.upcase)

Measured memory_bytes: 1788
from collections import Counter
n = int(input())
s = list(map(int,input().split()))
s1 = []
s2 = []

#文字列を２つに分割、問題文よりs1とs2の数は同じ
for i in range(n):
  if i%2 == 1:
    s2.append(s[i])
  else:
    s1.append(s[i])
#print(s1,s2)
s1_counter = Counter(s1)
s2_counter = Counter(s2)
s1_len = len(s1)
s2_len = len(s2)
s1_most_common = s1_counter.most_common()
s2_most_common = s2_counter.most_common()

if s1_most_common[0][0] != s2_most_common[0][0]:
  print(s1_len-s1_most_common[0][1]+s2_len-s2_most_common[0][1])
else:  
  if len(s1_most_common) + len(s2_most_common) == 2:
    print(n//2)
  elif s1_most_common[0][1] > s2_most_common[0][1]:
    print(s1_len-s1_most_common[0][1]+s2_len-s2_most_common[1][1])
  elif s1_most_common[0][1] < s2_most_common[0][1]:
    print(s1_len-s1_most_common[1][1]+s2_len-s2_most_common[0][1])
  else:
    if s1_most_common[1][1] < s2_most_common[1][1]:
      print(s1_len-s1_most_common[0][1]+s2_len-s2_most_common[1][1])
    else:
      print(s1_len-s1_most_common[1][1]+s2_len-s2_most_common[0][1])





Measured memory_bytes: 23776
#include <iostream>
#include <vector>

using namespace std;

class C {
	int N, M;
	vector<vector<int>> edges;
	int allNodesAreVisited{ 0 };
public:
	void solve_dfs()
	{
		edges.resize(N);
		int a, b;
		for (int i{ 0 }; i < M; i++)
		{
			cin >> a >> b;
			a--; b--;
			edges[a].push_back(b);
			edges[b].push_back(a);
		}

		for (int shift{ 0 }; shift < N; shift++) allNodesAreVisited |= (1 << shift);

		cout << dfs(0, 0) << endl;

	}

	int dfs(const int& node, int status)
	{
		if (status & (1 << node)) return 0; // check if multiple visits

		status |= (1 << node);
		if (status == allNodesAreVisited) return 1; // check if all nodes are visited

		int possiblePaths{ 0 };

		for (int nextNode : edges[node])
			possiblePaths += dfs(nextNode, status);

		return possiblePaths;
	}

	C()
	{
		cin >> N >> M;
	};
};


int main()
{
	C solution;
	solution.solve_dfs();

	return 0;
}

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

int main() {
  int a, b;
  cin >> a >> b;
  if(b == 1)
    cout << 0 << endl;
  else{
    for(int i = 1; i < 100000000; i++){
      if((a - 1) * i + 1 < b)
        continue;
      else{
        cout << i << endl;
        break;
      }
    }
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int mod = 1e9 + 7;
const int inf = (1 << 30) - 1;
const ll infll = (1LL << 61) - 1;
#define fast() ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define digit(N) cout << fixed << setprecision((N))

int a, m;

int main()
{
    cin >> m;
    digit(14);
    a = (m + 1) / 2;
    cout << (double)a / (double)m << endl;
}

Measured memory_bytes: 256
import sys
from math import factorial, ceil, floor
from bisect import bisect_right as bsr
from operator import itemgetter as ig
from collections import defaultdict as dd
from collections import deque

# お約束
args = None
INF = float("inf")
MOD = int(1e9 + 7)
def int1(n):
    return int(n) - 1
def input():
    return next(args)
def parse(*params):
    if len(params) == 1:
        return params[0](next(args))
    return tuple(p(v) for p, v in zip(params, next(args).split()))
def debug(*v):
    if __debug__:
        print(*v, file=sys.stderr)

# エントリーポイント
def main():
    N, Q = parse(int, int)
    edges = [[] for _ in range(N + 1)]
    for _ in range(N - 1):
        a, b = parse(int, int)
        edges[a] += [b]
        edges[b] += [a]
    vals = [0] * (N + 1)
    for _ in range(Q):
        p, x = parse(int, int)
        vals[p] += x

    counter = [0] * (N + 1)
    que = deque()
    que.append((1, 0))
    alr = [False] * (N + 1)
    while que:
        v, x = que.pop()
        alr[v] = True
        counter[v] += x + vals[v]
        for n in edges[v]:
            if not alr[n]:
                que.append((n, counter[v]))

    print(*counter[1:])

if __name__ == '__main__':
    args = iter(sys.stdin.read().split("\n"))
    main()


Measured memory_bytes: 96836
#include <bits/stdc++.h>
#define F first
#define S second
#define PB push_back
#define PF push_front
#define MP make_pair
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int,int> pii;
const int maxn = 5e5 + 10;
const int block = 600;
const ull inf = 1e19;
const int mod = 1e8;

int main () {
	ios_base::sync_with_stdio (false);
	int n, a, b;
	cin >> n >> a >> b;
	int k = b - a - 1;
	if (k % 2 == 0)
		return cout << "Borys" << endl, 0;
	cout << "Alice" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define finish(x) return cout << x << endl, 0
#define ll long long

int n;
vector <int> ans[2000];

int s(int x){
    return x * (x - 1) / 2;
}
int f(int n){
    int sq = sqrt(n) - 5;
    sq = max(sq, 0);
    for(int i = sq ; ; i++){
        if(s(i) > n) break;
        if(s(i) == n) return i;
    }
    cout << "No" << endl;
    exit(0);
}
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cin >> n;
    int k = f(n);
    int cur = 1;
    for(int i = 1 ; i <= k ; i++){
        for(int j = i + 1 ; j <= k ; j++){
            ans[i].push_back(cur);
            ans[j].push_back(cur);
            cur++;
        }
    }
    cout << "Yes" << endl << k << endl;
    for(int i = 1 ; i <= k ; i++){
        cout << ans[i].size() << " ";
        for(auto &j : ans[i]) cout << j << " ";
        cout << endl;
    }
}


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

int main(){
    int n,m;
    cin >> n >> m;
    string s;
    cin >> s;
    vector<int> stops(1,n);
    int where=n;
    while(where){
        bool next=false;
        for(int i=max(0,where-m); i<where; i++){
            if(s.at(i)=='0'){
                where=i;
                stops.push_back(i);
                next=true;
                break;
            }
        }
        if(!next){
            cout << -1 << endl;
            return 0;
        }
    }
    int st=stops.size()-1;
    vector<int> ans(st);
    rp(i,st){
        ans.at(i)=stops.at(i)-stops.at(i+1);
    }
    reverse(ans.begin(),ans.end());
    rp(i,st){
        cout << ans.at(i) << " ";
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 1528
box = []

for i in range(3):
        a = list(map(int,input().split()))
        box.append(a)


for a1 in range(101):
        for a2 in range(101):
                a1_b1 = box[0][0]-a1
                a1_b2 = box[1][0]-a1
                a1_b3 = box[2][0]-a1
                a2_b1 = box[0][1]-a2
                a2_b2 = box[1][1]-a2
                a2_b3 = box[2][1]-a2
                
                f = True
                if a1_b1 != a2_b1 or a1_b2 != a2_b2 or a1_b3 != a2_b3:
                        f = False
                a1_b = [a1_b1,a1_b2,a1_b3] 
                a2_b = [a2_b1,a2_b2,a2_b3] 
                res = True
                a1_a3 = []
                a2_a3 = []
                for i in range(3):
                        if (box[i][2]-a1_b[i]) != (box[i][2]-a2_b[i]):
                                res = False
                        a1_a3.append(box[i][2] - a1_b[i])
                        a2_a3.append(box[i][2] - a2_b[i])
                
                a3 = a1_a3[0]
                for i in range(1,3):
                        if a3 != a1_a3[i]:
                                res = False
                a3_b = []
                for i in range(3):
                        a3_b.append(box[i][2]- a3)
                
                a3_b = []
                for i in range(3):
                        a3_b.append(box[i][2] - a3)
                
                a = [a1,a2,a3]
                b = a3_b

                for i in range(3):
                        for j in range(3):
                                if box[i][j] != (b[i]+a[j]):
                                        res = False

                res = True
                for i in range(3):
                        for j in range(3):
                                if box[i][j] != (b[i]+a[j]):
                                        res = False
                #for i in range(3):
                #        print(a1_b[i]+a1,a1_b[i]+a2,)
                if res:
                        print("Yes")
                        exit()
                
print("No")


Measured memory_bytes: 3188
#include <bits/stdc++.h>
#define bug1(x) cout<<#x<<" = "<<x<<endl
#define bug2(x,y) cout<<#x<<" = "<<x<<" "<<#y<<" = "<<y<<endl
#define bug3(x,y,z) cout<<#x<<" = "<<x<<" "<<#y<<" = "<<y<<" "<<#z<<" = "<<z<<endl
#define bug4(x,y,z,m) cout<<#x<<" = "<<x<<" "<<#y<<" = "<<y<<" "<<#z<<" = "<<z<<" "<<#m<<" = "<<m<<endl

using namespace std;

template<class T> 
ostream& operator<<(ostream &os, vector<T> input) {
    os << "[ ";
    for(auto elem : input) { 
		os << elem << " ";
	}
	return os << "]";
}

template<class T> 
ostream& operator<<(ostream &os, set<T> input) {
    os << "{ ";
    for(auto elem : input) { 
		os << elem << " ";
	}
	return os << "}";
}

template<class T> 
ostream& operator<<(ostream &os, unordered_set<T> input) {
    os << "{ ";
    for(auto elem : input) { 
		os << elem << " ";
	}
	return os << "}";
}

template<class T> 
ostream& operator<<(ostream &os, multiset<T> input) {
    os << "{ ";
    for(auto elem : input) { 
		os << elem << " ";
	}
	return os << "}";
}

template<class T> 
ostream& operator<<(ostream &os, unordered_multiset<T> input) {
    os << "{ ";
    for(auto elem : input) { 
		os << elem << " ";
	}
	return os << "}";
}

template<class L, class R> 
ostream& operator<<(ostream &os, map<L,R> input) {
    os << "{ ";
    for(auto elem : input) { 
		os << "(" << elem.first << "," << elem.second << ") ";
	}
	return os << "}";
}

template<class L, class R> 
ostream& operator<<(ostream &os, unordered_map<L,R> input) {
    os << "{ ";
    for(auto elem : input) { 
		os << "(" << elem.first << "," << elem.second << ") ";
	}
	return os << "}";
}

#define ll long long
const int MAXN = 100005;
const int INF = 1e9;
const int MOD = 1e9 + 7;

class TaskC {
private:

public:
	void solveOne(int it){
		ll n;
		cin >> n;
		ll ans = 0;
		for(ll a = 1; a <= n ; a++) {
			for(ll b = 1; a*b + 1 <= n ; b++) {
				ans++;
			}
		}
		cout << ans << endl;

	}

	void solve(){
		int tc = 1;
		for(int it = 1; it <= tc; it++){
			solveOne(it);
		}
	}
};


int main(){
	ios_base::sync_with_stdio(false);
	TaskC solver;
	solver.solve();
	return 0;
}


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

using namespace std;

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

    long long n, k;
    long long freq[200111];
    long long cities[200111];
    long long count_pass = 0;

    cin >> n >> k;

    for (int i = 1; i <= n; i++)
        cin >> cities[i];


    long long n_c = 1;
    freq[1]++;

    n_c = cities[1];
    freq[n_c]++;
    count_pass++;

    long long f_c_c;
    
    long cities_in_cicle = 0, cities_n_in_cicle = 0;
    while ((freq[n_c] <= 2) && (count_pass < k))
    {
        n_c = cities[n_c];
        count_pass++;
        freq[n_c]++;
       
    }

    if (count_pass == k)
    {
        cout << n_c << endl;
        return 0;
    }
    for (int i = 1; i <= n; i++)
    {
        if (freq[i] == 1)
            cities_n_in_cicle++;
        if (freq[i] >= 2)
            cities_in_cicle++;
    }

    f_c_c = n_c;
    
    k-=cities_n_in_cicle;
    if (cities_in_cicle > 0)
        for (int i = 1; i <= (k%cities_in_cicle); i++)
            n_c = cities[n_c];

    cout << n_c << endl;
    return 0;
}

Measured memory_bytes: 6780
n = int(input())
s = input()
e = s.count('E')
w = s.count('W')
ans = 1000000
e_counter = 0
w_counter = 0
for i in range(len(s)):
    if s[i] == 'E':
        e_counter += 1
    else:
        w_counter += 1
    d = w_counter
    if s[i] == 'W':
        d -= 1
    ans1 = d + (e - e_counter)
    ans = min(ans1, ans)
print(ans)

Measured memory_bytes: 9608
su_ramen = 700

tamago = False
chashu = False
negi = False

toppings = input()

if toppings[0] == "o":
  tamago = True
if toppings[1] == "o":
  chashu = True
if toppings[2] == "o":
  negi = True

topping_cost = 100*(tamago+chashu+negi)
odai = su_ramen + topping_cost
print(odai)

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

typedef unsigned uint;
typedef long long INT;
typedef unsigned long long UINT;
const int INF = 1001001001;
const INT INFLL = 1001001001001001001LL;

 int in() { int x; scanf("%d", &x); return x; }
double fin() { double x; scanf("%lf", &x); return x; }
INT lin() { INT x; scanf("%lld", &x); return x; }
UINT luin() { UINT x; scanf("%llu", &x); return x;}


int main(){
    int a, b, c;
    double fa, fb, fc;
    char S[128], sa[128], sb[128], sc[128];
    // int N = in();
    // int K = in();
    // scanf("%s", S);

    int N = in();
    int M = in();

    std::vector<pair<int,int>> vecEdge;
    for (int i = 0; i < M; ++i) {
         vecEdge.push_back(pair(in(), in()));
    }

    std::multimap<int, int> mapEdge;
    for (auto pair : vecEdge) {
        mapEdge.insert(make_pair(pair.first, pair.second));
        mapEdge.insert(make_pair(pair.second, pair.first));
    }

    std::vector<int> vecTo(N + 1);

    for (int& nTo : vecTo) {
        nTo = -1;
    }
    vecTo[1] = 0;

    std::queue<int> que;
    que.push(1);
    while(!que.empty()) {
        int nStart = que.front();
        que.pop();

        auto lit = mapEdge.lower_bound(nStart);
        auto uit = mapEdge.upper_bound(nStart);

        while(lit != uit) {
            int nNext = lit->second;
            if (vecTo[nNext] == -1) {
                que.push(nNext);
                vecTo[nNext] = nStart;
            }
            ++lit;
        }
    }

    printf("Yes\n");

    for (int i = 2; i <= N; ++i) {
        printf("%d\n", vecTo[i]);
    }


    return 0;
}







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

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; }

using ll = long long;
using P = pair<ll,ll>;
using graph = vector<vector<int>>;

const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const ll INF = 1LL<<60;
const ll mod = 998244353LL;

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

int main() {
  int H,W,N;
  cin>>H>>W>>N;
  vector<int> v(N);
  rep(i,N) cin>>v[i];
  vector<vector<int>> ans(H,vector<int>(W));
  int cnt = 0;
  int p = 0;
  rep(i,H){
    rep(j,W){
      ans[i][j] = p;
      cnt++;
      if(v[p]==cnt){
        p++;
        cnt=0;
      }
    }
  }
  rep(i,H){
    if(i%2==1) reverse(ans[i].begin(),ans[i].end());
  }
  rep(i,H){
    rep(j,W) cout<<ans[i][j]+1<<" ";
    cout<<endl;
  }
}

Measured memory_bytes: 3680
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <algorithm>
#include <cmath>
#include <iomanip>

long long f(long long n, long long x)
{
    if(n>=0)
        return n/x + 1;
    else if(n==-1)
        return 0;
}

int main()
{
    // std::cout << std::fixed << std::setprecision(5);
    long long a, b, x;

    std::cin >> a >> b >> x;

    long long ans = f(b, x) - f(a-1, x);
    
    std::cout << ans << std::endl;

    return 0;
}

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

int main(){

    int K;
    cin >> K;

    int sum = 0;
    for (int a = 1; a <= K; a++){
        for (int b = 1; b <= K; b++){
            for (int c = 1; c <= K; c++){
                sum += __gcd(a, __gcd(b, c));
            }
        }
    }

    cout << sum << endl;

    return 0;
}

Measured memory_bytes: 3596
#include<stdio.h>
int n,s;
int rec(int sum,int dig,int cnt);
int main(){
  while(1){
  scanf("%d %d",&n,&s);
  if(n==0 && s==0){
    break;
  }
  printf("%d\n",rec(0,0,0));
  }
  return 0;
}
int rec(int sum,int dig,int cnt){
  if(cnt>n || sum>s)return 0;
  if(cnt==n && sum==s)return 1;
  if(dig>9)return 0;
  int ret=0;
  ret+=rec(sum+dig,dig+1,cnt+1);
  ret+=rec(sum,dig+1,cnt);
  return ret;
}

Measured memory_bytes: 600
n,m=map(int,input().split())
s=[[] for i in range(n)]
for i in range(m):
  a,b=map(int,input().split())
  s[a-1].append(b)
for j in s[0]:
  if n in s[j-1]:
    print("POSSIBLE")
    exit()
print("IMPOSSIBLE")


Measured memory_bytes: 29080
#include<iostream>
#include<vector>
#include<utility>
#include<cmath>

#define INF (1 << 29)

using namespace std;

int fix(int num)
{
    return min(255, max( num, 0) );
}

int main()
{
    int N, M;
    while(cin >> N >> M, (N))
    {

        vector<int> in_C(M);
        for(auto& _c : in_C)
        {
            cin >> _c;
        }

        vector<int> in_X(N);
        for(auto& _x : in_X)
        {
            cin >> _x;
        }

        int dp[2][256];
        for(int i = 0; i < 256; i++)
        {
            dp[0][i] = dp[1][i] = INF;
        }

        for(int i = 0; i < M; i++)
        {
            int sub = fix(128 + in_C[i]);
            dp[0][sub] = pow(in_X[0] - sub, 2.0);
        }

        for(int n = 1; n < N; n++)
        {
            for(int i = 0; i < 256; i++)
            {
                if(dp[0][i] == INF)continue;
                for(int j = 0; j < M; j++)
                {
                    int sub = fix(i + in_C[j]);
                    int nextScore = dp[0][i] + pow( in_X[n] - sub, 2.0 );
                    dp[1][sub] = min(dp[1][sub], nextScore);
                    /*
                    cout << sub << endl;
                    cout << dp[0][sub] << endl;
                    cout << pow( in_X[n] - sub, 2.0 ) << endl;
                    cout << endl;
                    //*/
                }
            }
            for(int i = 0; i < 256; i++)
            {
                dp[0][i] = dp[1][i];
                dp[1][i] = INF;
            }
        }

        int ans = INF;
        for(int i = 0; i < 256; i++)
        {
            ans = min(ans, dp[0][i]);
            //cout << i << " : "<< ans << endl;
        }
        cout << ans << endl;

    }



    return 0;
}

Measured memory_bytes: 3096
#include<iostream>
#include<vector>
using namespace std;
typedef long long int ll;
static const ll MOD = 1000000007;

ll mod_pow(ll n, ll x){
	if(n == 0) return 1;
	ll ret = mod_pow(n / 2, x * x % MOD) % MOD;
	if(n % 2) return ret * x % MOD;
	return ret;
}

ll comb(int n, int k){
	if(k < 0 || k > n) return 0;
	vector<ll> memo(n + 1);
	memo[0] = 1; memo[1] = 1;
	for(int i = 2; i <= n; i++){
		memo[i] = memo[i - 1] * (ll)i;
		memo[i] %= MOD;
	}
	return ((memo[n] * mod_pow(MOD - 2, memo[k])) % MOD) * mod_pow(MOD - 2, memo[n - k]) % MOD;
}

int main(){
	int n, k;
	cin >> n >> k;
	cout << comb(k, n) << endl;
	return 0;
}



Measured memory_bytes: 3116
// :)
// "Khodaya, be man "Tagwaye setiz" biamooz ta
//  dar anbuh masuliat nalaghzam ..." -Shariati
#include <bits/stdc++.h>

using namespace std;
typedef long long int64;
typedef pair<int,int> pii;
typedef pair<int64,int> pii32;
typedef pair<int64,int64> pii64;

#define PB push_back
#define MP make_pair
#define F first
#define S second
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()

const int maxn = 1e5+10;
const int64 MO = 1e9+7;
const int64 IN = 1e9;

vector <pii64> v1;
vector <int64> v;
int64 n;

int main () {
	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	cin >> n;
	int64 x = n;
	for (int64 i = 2; i * i <= x; i++) {
		if (x % i)
			continue;
		int cnt = 0;
		while (x % i == 0) {
			cnt++;
			x /= i;
		}
		v1.PB( MP( i, cnt ) );
	}
	if (x - 1)
		v1.PB( MP( x, 1 ) );
	v.PB( 1 );
	for (int i = 0; i < sz(v1); i++) {
		int f = sz(v);
		int64 cur = 1;
		for (int t = 0; t < v1[i].S; t++) {
			cur *= v1[i].F;
			for (int j = 0; j < f; j++)
				v.PB( v[j] * cur );
		}
	}
	int64 ans = 0;
	for (auto x : v)
		if (x != 1 && n / (x - 1) == n % (x - 1))
			ans += x - 1;
	cout << ans << "\n";
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N, M;
  cin >> N >> M;
  
  for (int i = 0; i < N; i++){
    if (i == 0){
      for (int j = 0; j < M + 2; j++) cout << "#";
      cout << endl;
    }
    
    vector<char> str(M);
    for (int j = 0; j < M; j++) cin >> str.at(j);
    
    cout << "#";
    for (int j = 0; j < M; j++) cout << str.at(j);
    
    cout << "#" << endl;
    
    if (i == N - 1){
      for (int j = 0; j < M + 2; j++) cout << "#";
      cout << endl;
    }
  }
}

Measured memory_bytes: 256
using System;

namespace B___eeeee
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());
            var S = Console.ReadLine();
            var K = int.Parse(Console.ReadLine());

            char check = S[K-1];
            string result = "";

            for (int i = 0 ; i < N ; i++)
            {
                if(S[i] == check)
                {
                    result += check;
                }else{
                    result += "*";
                }
            }

            Console.WriteLine(result);
        }
    }
}


Measured memory_bytes: 11092
using System;

public class Hello
{
    public static void Main()
    {
        var x = long.Parse(Console.ReadLine().Trim());
        var rx =(int)((Math.Sqrt(1 + 8 * x) - 1) / 2);
        Console.WriteLine(getAns(x, rx));
    }
    public static int getAns(long x, int rx)
    {
        if (rx * rx + rx >= 2 * x) return rx;
        else return rx + 1;
    }
}

Measured memory_bytes: 11092
import java.util.Scanner;

class Main
{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		
		int[] n = new int[100];
		int[] x = new int[100];
		int[] k = new int[100];
		int i = 0;
		
		n[0] = 1;
		x[0] = 1;
		
		while(!(n[i]==0 && x[i]==0)){
			i++;
			n[i] = scan.nextInt();
			x[i] = scan.nextInt();
			k[i] = 0;
			
			for(int q=1; q<=n[i]; q++){
			for(int j=1; j<=n[i]-1; j++){
			for(int h=1; h<=n[i]-2; h++){
				if(q>j && j>h && q+j+h==x[i]){
					k[i]++;}}}}}
			
			for(int q=1; q<i; q++){
				System.out.println(k[q]);}
	}
}


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

class Program
{
    static void Main()
    {
        var N = int.Parse(Console.ReadLine());
        var p = new int[N];
        for (int i = 0; i < N; i++)
        {
            p[i] = int.Parse(Console.ReadLine());
        }
        Console.WriteLine(p.Sum() - p.Max() / 2);
    }
}

Measured memory_bytes: 27884
#include<stdio.h>
#include<algorithm>
#include<math.h>
using namespace std;
double PI=acos(-1.0);
double EPS=1e-9;
double th;
double p;
double o;
double calc(double r,double a,double v){
	double x=o-(r*cos(a));
	double y=r*sin(a);
	double t=sqrt(x*x+y*y)/v;
	double s=(th+a)/p;
	return t-s;
}
int main(){
	int a,b,c,d;
	scanf("%d%d%d%d",&a,&b,&c,&d);
	double x=sqrt(a*a+b*b);
	o=x;
	th=atan2(b,a)-c*PI/180;
	while(th<-EPS)th+=PI*2;
	while(th>2*PI+EPS)th-=PI*2;
	if(th>PI)th=PI*2-th;
	double left=0;
	double right=10000;
	double v=PI*d/180;
	p=v;
	//printf("%f\n",th);
	for(int i=0;i<100;i++){
		double M=(left+right)/2;
		double r=M/v;
		
		if(r>=x){
			right=M;continue;
		}
		double L=0;
		double R=PI/2-asin(r/x);
		bool ok=false;
		for(int j=0;j<100;j++){
			double m1=(L*2+R)/3;
			double m2=(L+R*2)/3;
			double t1=calc(r,m1,M);
			double t2=calc(r,m2,M);
			if(t1<0)ok=true;
			if(t2<0)ok=true;
			if(t1<t2)R=m2;
			else L=m1;
		}
	//	printf("%f %f %f %f\n",M,r,x,L);
		if(ok)right=M;
		else left=M;
	}
	printf("%.12f\n",left);
}

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

bool u_is_ok(int index, int key, const vector<int> &v) {
    return v.at(index) < key;
}

int u_binary_search(int key, const vector<int> &v) {
    int ng = (int)v.size();
    int ok = -1;

    while (abs(ok - ng) > 1) {
        int mid = (ok + ng) / 2;

        if (u_is_ok(mid, key, v)) ok = mid;
        else ng = mid;
    }
    return ok;
}

bool b_is_ok(int index, int key, const vector<int> &v) {
    return v.at(index) > key;
}

int b_binary_search(int key, const vector<int> &v) {
    int ng = -1;
    int ok = (int)v.size();

    while (abs(ok - ng) > 1) {
        int mid = (ok + ng) / 2;

        if (b_is_ok(mid, key, v)) ok = mid;
        else ng = mid;
    }
    return ok;
}

int main() {
    int n;
    cin >> n;
    vector<int> l(n);
    for (int i = 0; i < n; i++) {
        cin >> l.at(i);
    }

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

    long long cnt = 0;
    for (int i = 0; i < n; i++) {
        for (int j = i + 1; j < n; j++) {
            int u = u_binary_search(l.at(i) + l.at(j), l);
            int b = max(b_binary_search(l.at(i) - l.at(j), l), b_binary_search(l.at(j) - l.at(i), l));
            long long res = u - b + 1;
            if (l.at(b) <= l.at(i) && l.at(i) <= l.at(u)) res--;
            if (l.at(b) <= l.at(j) && l.at(j) <= l.at(u)) res--;
            cnt += max(0ll, (long long)res);
        }
    }
    cout << cnt / 3 << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define oo 1e18
#define fi first
#define se second
#define sp(iiii) setprecision(iiii)
#define IO ios_base::sync_with_stdio(false); cin.tie(0)
#define ms(aaaa,xxxx) memset(aaaa,xxxx,sizeof(aaaa))
#define cntbit(xxxx) __builtin_popcount(xxxx)
#define getbit(xxxx,aaaa) ((xxxx>>(aaaa-1))&1)
#define _cos(xxxx) cos(xxxx*acos(-1)/180)
#define _sin(xxxx) sin(xxxx*acos(-1)/180)
#define _tan(xxxx) tan(xxxx*acos(-1)/180)
#define PE cout<<fixed
#define sqr(x) ((x)*(x))
 
typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<pair<int,int>,int> piii;
typedef pair<long long,long long> pll;
typedef pair<pair<long long,long long>,long long> plll;
 
const ld pi=acos(-1);

ll n,s,p,k,i,res,t;

ll calc(ll x,ll y) {
    ll kq=0;
    while (x>0) {
        kq+=x%y;
        x/=y;
    }
    return kq;
}

int main() {
    IO;
    cin>>n>>s;
    if (s>n) {
        cout<<-1;
    }
    else if (s==n) {
        cout<<n+1;
    }
    else {
        res=oo;
        p=sqrt(n);
        for (i=2;i<=p;i++) {
            if (calc(n,i)==s) {
                cout<<i<<'\n';
                return 0;
            }
        }
        k=n-s;
        t=sqrt(k);
        for (i=1;i<=t;i++) {
            if (k%i==0) {
                if ((i<=p)&&((k/i)>=p)&&((i+(n%(k/i+1)))==s)) {
                    res=min(res,k/i+1);
                }
            }
        }
        if (res==oo) {
            cout<<-1<<'\n';
            return 0;
        }
        cout<<res<<'\n';
    }
}
    

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

using namespace std;

int main(){

int x,y;

while(1){

cin >> x >> y;

if( x==0 && y==0) break;

else if(x > y){
swap(x,y);

cout << x << " " << y << endl;

}

else{

cout << x << " " << y << endl;

}

}

return 0;

} 

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

#define CPP_STR(x) CPP_STR_I(x)
#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_STR_I(args...) #args
#define CPP_CAT_I(x,y) x ## y

#define ASSERT(expr...) assert((expr))

using i8  = int8_t;
using u8  = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;

using f32 = float;
using f64 = double;
// }}}

constexpr i64 INF = 1'010'000'000'000'000'017LL;

constexpr i64 MOD = 1'000'000'007LL;

constexpr f64 EPS = 1e-12;

constexpr f64 PI = 3.14159265358979323846;

#define M5 100007

// util {{{
#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)

#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))
#define ll long long int
#define VI vector <ll>
template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }

template<typename T, size_t N>
i64 SIZE(const T (&)[N]) { return static_cast<i64>(N); }

template<typename T, typename U, typename Comp=less<>>
bool chmax(T& xmax, const U& x, Comp comp={}) {
    if(comp(xmax, x)) {
        xmax = x;
        return true;
    }
    return false;
}

template<typename T, typename U, typename Comp=less<>>
bool chmin(T& xmin, const U& x, Comp comp={}) {
    if(comp(x, xmin)) {
        xmin = x;
        return true;
    }
    return false;
}
// }}}

// init {{{
struct ProconInit {
    static constexpr int IOS_PREC = 15;
    static constexpr bool AUTOFLUSH = false;

    ProconInit() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(IOS_PREC);
        if(AUTOFLUSH)
            cout << unitbuf;
    }
} PROCON_INIT;
// }}}

//--------------------------------------------------------------------



void solve() {
    string S;
    cin >> S;
    if(S=="AAA" || S=="BBB"){
        cout << "No";
    } else{
        cout << "Yes";
    }

}

signed main() {

    solve();

    return 0;
}

Measured memory_bytes: 256
import bisect,collections,copy,itertools,math,string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())
def main():


    n = I()
    time = [0 for _ in range(n)]
    start = [0 for _ in range(n)]
    freq = [0 for _ in range(n)]

    for i in range(n-1):
        time[i], start[i], freq[i] = LI()

    ans = [0 for _ in range(n)]

    for i in range(n):
        before = 0
        after = 0
        for j in range(i,n-1):
            if before < start[j]:
                after = start[j]
            else:
                after = before - before%freq[j] + freq[j]*(before%freq[j] != 0)

            before = after + time[j]

        ans[i] = before

    print(*ans, sep="\n")



main()


Measured memory_bytes: 69712
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
int d,G;
int p[10],c[10];
int dp[1001];
main()
{
	cin>>d>>G;
	for(int i=0;i<d;i++)cin>>p[i]>>c[i];
	for(int i=0;i<d;i++)
	{
		for(int k=1000;k>=1;k--)
		{
			for(int j=1;j<=p[i]&&j<=k;j++)
			{
				dp[k]=max(dp[k],dp[k-j]+(i+1)*100*j+(j==p[i]?c[i]:0));
			}
		}
	}
	for(int i=0;i<=1000;i++)
	{
		if(dp[i]>=G)
		{
			cout<<i<<endl;
			return 0;
		}
	}
}


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

#define endl '\n'
#define fi first
#define se second
#define MOD(n,k) ( ( ((n) % (k)) + (k) ) % (k))
#define forn(i,n) for (int i = 0; i < n; i++)
#define forr(i,a,b) for (int i = a; i <= b; i++)
#define all(v) v.begin(), v.end()
#define pb(x) push_back(x)

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ii> vii;

const int MX = 200005;
int n, m, d[MX], col[MX], w[MX], bs[MX], q[MX];
vii adj[MX];

void no () {
	cout << -1 << endl;
	exit(0);
}

int main () {
	ios_base::sync_with_stdio(0); cin.tie(0);
	
	cin >> n >> m;
	
	for (int i = 1; i <= n; i++)
		cin >> d[i];
	
	forn (i, m) {
		int u, v;
		cin >> u >> v;
		adj[u].emplace_back(v, i);
		adj[v].emplace_back(u, i);
	}

	iota(q, q + n, 1);
	sort(q, q + n, [&] (int i, int j) {
		return d[i] < d[j];
	});

	forn (_, n) {
		int u = q[_];
		if (bs[u]) continue;

		int same = -1, prep = -1;
		for (ii &v : adj[u]) {
			if (bs[v.fi]) prep = v.fi;
			if (d[u] == d[v.fi]) same = v.fi;
		}

		if (prep != -1) {
			col[u] = 1 - col[prep];
			
			for (ii &v : adj[u]) {
				if (v.fi == prep) w[v.se] = d[u];
				else if (bs[v.fi]) w[v.se] = 1e9;
			}
		} else if (same != -1) {
			col[u] = 1;
			
			for (ii &v : adj[u]) {
				if (v.fi == same) w[v.se] = d[u];
				else if (bs[v.fi]) w[v.se] = 1e9;
			}

			for (ii &v : adj[same]) {
				if (bs[v.fi]) w[v.se] = 1e9;
			}
			
			bs[same] = 1;
		} else no();

		bs[u] = 1;
	}

	for (int i = 1; i <= n; i++)
		cout << "WB"[col[i]];
	cout << endl;

	forn (i, m) cout << w[i] << endl;

	return 0;
}


Measured memory_bytes: 16268
from collections import defaultdict

n, x, y = map(int, input().split())
x -= 1
y -= 1

d = defaultdict(int)
for i in range(n-1):
    for j in range(i+1, n):
        path = min([j-i, abs(x-i)+abs(y-j)+1, abs(x-j)+abs(y-i)+1])
        d[path] += 1

for i in range(1, n):
    print(d[i])


Measured memory_bytes: 50908
#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<set>
#include<string>
#include<string.h>
#include<complex>
#include<math.h>
using namespace std;
typedef long long int llint;
typedef vector<int> vint;
typedef vector<llint> vllint;
typedef vector<pair<int, int>> vpint;
typedef vector<pair<llint, llint>> vpllint;
#define rep(i,n) for(int i=0;i<n;i++)
#define yes(ans) if(ans)cout<<"yes"<<endl;else cout<<"no"<<endl;
#define Yes(ans) if(ans)cout<<"Yes"<<endl;else cout<<"No"<<endl;
#define YES(ans) if(ans)cout<<"YES"<<endl;else cout<<"NO"<<endl;
#define POSSIBLE(ans) if(ans)cout<<"POSSIBLE"<<endl;else cout<<"IMPOSSIBLE"<<endl;

class UnionFind {
public:
	//親の番号を格納する。親だった場合は-(その集合のサイズ)
	vector<int> Parent;

	//作るときはParentの値を全て-1にする
	//こうすると全てバラバラになる
	UnionFind(int N) {
		Parent = vector<int>(N, -1);
	}

	//Aがどのグループに属しているか調べる
	int root(int A) {
		if (Parent[A] < 0) return A;
		return Parent[A] = root(Parent[A]);
	}

	//自分のいるグループの頂点数を調べる
	int size(int A) {
		return -Parent[root(A)];//親をとってきたい
	}

	//AとBをくっ付ける
	bool connect(int A, int B) {
		//AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
		A = root(A);
		B = root(B);
		if (A == B) {
			//すでにくっついてるからくっ付けない
			return false;
		}

		//大きい方(A)に小さいほう(B)をくっ付けたい
		//大小が逆だったらひっくり返しちゃう。
		if (size(A) < size(B)) swap(A, B);

		//Aのサイズを更新する
		Parent[A] += Parent[B];
		//Bの親をAに変更する
		Parent[B] = A;

		return true;
	}
};

bool check(int a, int b) {
	return a > b;

}

int main() {
	int n, m, c;
	cin >> n >> m >> c;
	vint b(m);
	rep(i, m) {
		cin >> b[i];
	}
	vector<vector<int>>a(n, vector<int>(m));
	rep(i, n) {
		rep(j, m) {
			cin >> a[i][j];
		}
	}
	int ans = 0;
	int cnt;
	rep(i, n) {
		cnt = c;
		rep(j, m) {
			cnt += a[i][j] * b[j];
		}
		if (cnt > 0) {
			ans++;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll  long long int
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back
#define pp pop_back
#define in insert
#define ff first
#define ss second
#define e endl
#define MAXN 200005
#define debug cout<<"we are debuuging"<<endl;
#define MOD 998244353
ll fast_expo(ll x,ll p)
{if(p==0) return 1;
else if(p%2==0){ ll t=fast_expo(x,p/2)%MOD;return (t*t)%MOD;} else return (x*(fast_expo(x,p-1))%MOD)%MOD;}
int main()
{
     int a[3];
     cin>>a[0]>>a[1]>>a[2];
     sort(a,a+3);
     cout<<(a[0]*a[1])/2<<e;
}


Measured memory_bytes: 256
import numpy as np
import sys
line = sys.stdin.readline

H, W = map(int, line().split())
grid = np.full((H + 2, W + 2), 1000)
grid[1:-1, 1:-1] = (np.array([list(line().rstrip()) for _ in range(H)]).reshape(H, W) == '#') * 1
grid2 = grid.copy()
grid2[1:-1, 1:-1] = np.where(grid2[1:-1, 1:-1] < 1, 1, 0)

down = grid.copy()
for i in range(1, H + 1):
    down[i, 1:-1] = (down[i - 1, 1:-1] * grid2[i - 1, 1:-1] + grid2[i, 1:-1]) * grid2[i, 1:-1]

up = grid.copy()
for i in range(H, 0, -1):
    up[i, 1:-1] = (up[i + 1, 1:-1] * grid2[i + 1, 1:-1] + grid2[i, 1:-1]) * grid2[i, 1:-1]

right = grid.copy()
for i in range(1, W + 1):
    right[1:-1, i] = (right[1:-1, i - 1] * grid2[1:-1, i - 1] + grid2[1:-1, i]) * grid2[1:-1, i]

left = grid.copy()
for i in range(W, 0, -1):
    left[1:-1, i] = (left[1:-1, i + 1] * grid2[1:-1, i + 1] + grid2[1:-1, i]) * grid2[1:-1, i]

v = np.minimum(down, up)
h = np.minimum(left, right)

answer = np.minimum(v, h)
for i in range(1, H):
    answer[i + 1] = np.minimum(answer[i] + 1, answer[i + 1])
for i in range(H, 0, -1):
    answer[i - 1] = np.minimum(answer[i] + 1, answer[i - 1])
print(int(answer[1:-1, 1:-1].max()))

Measured memory_bytes: 86504
#include <stdio.h>
#include <math.h>



#ifndef DEBUG 
#define fprintf (void)
#endif 

double absval(double x);

int main(void){

	int n;
	int i;
	double sum,avg,var,ds;
	
	while(1){
		sum=0;
		var=0;
		scanf("%d",&n);
		
		if(n==0){
			break;
		}
		
		double s[n];
		
		for(i=0;i<n;i++){
			scanf("%lf",&s[i]);
			sum+=s[i];
			fprintf(stdout,"%lf\n",sum);
		}
		
		avg=sum/n;
		fprintf(stdout,"%lf\n",avg);
		
		for(i=0;i<n;i++){
			ds=avg-s[i];
			fprintf(stdout,"%lf\n",ds);
			var+=ds*ds;
			fprintf(stdout,"%lf\n",var);
		}
		
		printf("%lf\n",sqrt(var/n));
	}
	
	return 0;
}

Measured memory_bytes: 2716