akhauriyash/Code-Regression huggingface dataset:
#[allow(unused_macros)]
macro_rules ! input { ( source = $ s : expr , $ ( $ r : tt ) * ) => { let mut iter = $ s . split_whitespace ( ) ; let mut next = || { iter . next ( ) . unwrap ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; ( $ ( $ r : tt ) * ) => { let stdin = std :: io :: stdin ( ) ; let mut bytes = std :: io :: Read :: bytes ( std :: io :: BufReader :: new ( stdin . lock ( ) ) ) ; let mut next = move || -> String { bytes . by_ref ( ) . map ( | r | r . unwrap ( ) as char ) . skip_while ( | c | c . is_whitespace ( ) ) . take_while ( | c |! c . is_whitespace ( ) ) . collect ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; }
#[allow(unused_macros)]
macro_rules ! input_inner { ( $ next : expr ) => { } ; ( $ next : expr , ) => { } ; ( $ next : expr , $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let $ var = read_value ! ( $ next , $ t ) ; input_inner ! { $ next $ ( $ r ) * } } ; }
#[allow(unused_macros)]
macro_rules ! read_value { ( $ next : expr , ( $ ( $ t : tt ) ,* ) ) => { ( $ ( read_value ! ( $ next , $ t ) ) ,* ) } ; ( $ next : expr , [ $ t : tt ; $ len : expr ] ) => { ( 0 ..$ len ) . map ( | _ | read_value ! ( $ next , $ t ) ) . collect ::< Vec < _ >> ( ) } ; ( $ next : expr , chars ) => { read_value ! ( $ next , String ) . chars ( ) . collect ::< Vec < char >> ( ) } ; ( $ next : expr , usize1 ) => { read_value ! ( $ next , usize ) - 1 } ; ( $ next : expr , $ t : ty ) => { $ next ( ) . parse ::<$ t > ( ) . expect ( "Parse error" ) } ; }

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

    let mut ret = 0;
    for i in 0..n {
        ret += ceil_div(d, a[i]);
    }
    println!("{}", x + ret);
}

#[allow(dead_code)]
fn ceil_div(x: u64, y: u64) -> u64 {
    (x + y - 1) / y
}

Measured memory_bytes: 4352
#include<stdio.h>
int main(void)
{
	int a,b,c;
	scanf("%d/%d/%d",&a,&b,&c);
	if(2019<a || (a<=2019 && 5<=b)){
		printf("TBD\n");
	}
	else{
		printf("Heisei\n");
	}
	return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<algorithm>
#define INF 1800000000
using namespace std;

int dp[1003][1003];

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

	int d[1000], c[1000];
	for (int i = 0;i < n;i++)cin >> d[i];

	for (int j = 0;j < m;j++)cin >> c[j];

	for (int i = 0;i <= max(m,n);i++) {
		for (int j = 0;j <=max(m,n);j++) {
			dp[i][j] = INF;
		}
	}

	for (int i = 0;i < max(m, n);i++)dp[0][i] = 0;

	for (int i = 1;i <= m;i++) {
		for (int j = 1;j <= min(n,i);j++) {
			dp[j][i] = min(dp[j][i-1], dp[j-1][i-1] + (d[j-1]*c[i-1]));
		}
	}
	cout << dp[n][m] << endl;
	getchar();
	getchar();
	return 0;
}

Measured memory_bytes: 6980
#include<bits/stdc++.h>
#define rep(i,n) for (int i=0;i<(n);i++)
#define PI 3.14159265358979323846264338327950L
using namespace std;
using P = pair<int,int>;
using ll = long long;
using namespace std;
int main(void){
    int n;
    cin >> n;
    int b[n];
    int a[n]; rep(i, n){
        cin >> a[i];
        b[i] = a[i];
    }
    int cnt = 0;
    sort(b, b+n);
    rep(i, n){
        for(int j = i; j < n; ++j){
            swap(a[i], a[j]);
            rep(k, n){
                if(a[k] == b[k]){++cnt;}
            }
            if(cnt == n){cout << "YES" << endl; return 0;}
            swap(a[i], a[j]);
            cnt = 0;
        }
    }
    cout << "NO" << endl;
    return 0;
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
#define int long long int
#define endl '\n'
int M = 1e9 + 7;
int32_t main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int x;
  cin >> x;
  int a = 100;
  for (int i = 1; i <= 4000; ++i)
  {
    a = a * (1.01);
    if (a >= x)
    {
      cout << i;
      break;
    }
  }
}

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

using namespace std;

int main()
{
    int n,m;
    long long int value,ans=0;
    cin>>n>>m;
    for(int i=0;i<m;i++)
    {
        cin>>value;
        ans+=value;
    }
    if(ans>n)
    {
        cout<<"-1"<<endl;
    }
    else{
        cout<<n-ans<<endl;
    }
    return 0;
}


Measured memory_bytes: 3644
N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))

count=0

D=[A[0]]

for i in range(N):
    s=B[i]-D[i]
    if s>0:
        d=A[i+1]-s
        if d>0:
            d=d
            count+=B[i]
        else :
            d=0
            count+=D[i]+A[i+1]
    else:
        d=A[i+1]
        count+=B[i]
    D.append(d)

print(count)

Measured memory_bytes: 24260
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
//for(int i = 0; i<n; i++)
 
 
int main()
{
    int n;cin>>n;
    vector<int> a(n);
    for(int i = 0; i<n; i++) cin>>a[i];
    sort(a.begin(),a.end());
    cout << a[n-1] - a[0] << endl;
    return 0;
    
}

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

typedef pair<int,int> P;

vector<int> edges[100001];

int N;

int visited[100001];

int Fennec;
int Snuke;

int main()
{
    cin >> N;
    int a,b;
    for(int i = 0;i < N - 1;i++)
    {
        cin >> a >> b;

        edges[a].push_back(b);
        edges[b].push_back(a);
    }

    queue<P> q;
    q.push(P(1,0));
    q.push(P(N,1));
    visited[1] = 1;
    visited[N] = 1;
    while(!q.empty())
    {
        int v = q.front().first;
        int turn = q.front().second;
        q.pop();
        for(int i = 0;i < edges[v].size();i++)
        {
            int to = edges[v][i];

            if(visited[to] == 0)
            {
                q.push(P(to,turn));
                if(turn == 0) Fennec++;
                else Snuke++;
                visited[to] = 1;
            }
        }
    }

    if(Fennec > Snuke) cout << "Fennec";
    else cout << "Snuke";
    return 0;
}

Measured memory_bytes: 6400
#include <iostream>
#include <map>
#include <vector>
#include <cmath>
#include <string>
#include <cstring>
#include <algorithm>
#include <climits>
#include <stack>
#include <queue>
#include <set>
#include <cctype>
#include <bitset>
#include <type_traits>

#include <list>
using namespace std;

#define REP(i, n) for (int i = 0; i < (n); ++i)
#define rep(i, a, b) for (int i = a; i < (b); ++i)
#define YES(j) cout << (j ? "YES" : "NO") << endl;
#define Yes(j) std::cout << (j ? "Yes" : "No") << endl;
#define yes(j) std::cout << (j ? "yes" : "no") << endl;

long long M = 1e9 + 7;
typedef long long ll;
vector<ll> fac(1100001);  //n!(mod M)
vector<ll> ifac(1100001); //k!^{M-2} (mod M)
//a,bの範囲的にこれだけ配列を用意していけば十分

ll mpow(ll x, ll n)
{ //x^n(mod M) ←普通にpow(x,n)では溢れてしまうため，随時mod計算
    ll ans = 1;
    while (n != 0)
    {
        if (n & 1)
            ans = ans * x % M;
        x = x * x % M;
        n = n >> 1;
    }
    return ans;
}

ll comb(ll a, ll b)
{ //aCbをmod計算
    if (a == 0 && b == 0)
        return 1;
    if (a < b || a < 0)
        return 0;
    ll tmp = ifac[a - b] * ifac[b] % M;
    return tmp * fac[a] % M;
}

ll perm(ll a, ll b)
{
    if (a < b)
        return 0;
    ll tmp = ifac[a - b] % M;
    return tmp * fac[a] % M;
}

ll dupc(ll a, ll b)
{
    if (a == 0 && b == 0)
        return 1;
    if (a < 0 || b == 0)
        return 0;
    ll tmp = ifac[a - 1] * ifac[b] % M;
    return tmp * fac[a + b - 1] % M;
}
int main(void)
{
    long long x, y;
    cin >> x >> y;

    fac[0] = 1;
    ifac[0] = 1;
    for (ll i = 0; i < 1000000; i++)
    {
        fac[i + 1] = fac[i] * (i + 1) % M;              // n!(mod M)
        ifac[i + 1] = ifac[i] * mpow(i + 1, M - 2) % M; // k!^{M-2} (mod M) ←累乗にmpowを採用
    }

    ll a, b;

    a = (2 * x - y) / 3;
    b = (-x + 2 * y) / 3;

    if ((2 * x - y) % 3 == 0 && (-x + 2 * y) % 3 == 0)
    {
        if (a < 0 || b < 0)
        {

            cout << "0" << endl;
        }
        else
        {
            cout << comb(a + b, a) % M << endl;
        }
    }
    else
    {
        cout << "0" << endl;
    }
}

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

#ifdef _DEBUG
#define debug(x) cout<<#x<<": "<<x<<endl
#else
#define debug(x)
#endif

using namespace std;

int64_t M = 1e9+7;

vector<int64_t> inv_tbl(2000000);

int64_t modpow(int64_t n, int64_t m) {
    if (m == 0) return 1;
    else if (m % 2 == 0) { 
        int64_t r = modpow(n, m / 2);
        return (r * r) % M;
    } else {
        int64_t r = modpow(n, m / 2);
        return ((n * r) % M * r) % M;
    }
}

int64_t inv(int n) {
    return inv_tbl[n];
}

void compute_inv() {
    for (size_t i = 0; i < inv_tbl.size(); ++i) {
        inv_tbl[i] = modpow(i, M - 2);
    }
}

int64_t comb(int n, int k) {
    int64_t c = 1;
    for (int i = 1; i <= k; ++i) {
        c = (((n - i + 1) * inv(i)) % M * c) % M;
    }
    return c;
}

int main() {
    compute_inv();
    int n, a, b;
    cin >> n >> a >> b;
    int64_t res = modpow(2, n) - 1 - comb(n, a) - comb(n, b);
    /* cout << modpow(2, n) << endl;
    cout << comb(n, a) << endl;
    cout << comb(n, b) << endl; */
    res = (res + 3 * M) % M;
    cout << res << endl;
}

Measured memory_bytes: 16000
import java.util.*;

public class Main {
	Scanner sc;
	long L, R;
	
	private static long MOD = 1000000007L;
	private static final long[] MASK;
	static {
		MASK = new long[64];
		MASK[0] = 0L;
		for (int i = 1; i < 64; i++) MASK[i] = MASK[i-1] * 2 + 1;
	}
	private static final long[] POW3;
	static {
		POW3 = new long[64];
		POW3[0] = 1L;
		for (int i = 1; i < 64; i++) POW3[i] = (POW3[i-1] * 3L) % MOD;
	}
	
	public Main() {
		sc = new Scanner(System.in);
	}
	
	private void calc() {
		L = sc.nextLong();
		R = sc.nextLong();
		
		System.out.println(count(0, 0, 63));
		System.out.flush();
	}
	
	private long count(long x, long y, int maskn) {
		if ( (x|y) != 0 && (y>>>1) >= x) return 0L;
		if (R < x || R < y) return 0L;
		if ((y | MASK[maskn]) < L || (x | MASK[maskn]) < L) return 0L;
		if (L <= x && (y | MASK[maskn]) <= R) return POW3[maskn];
		maskn--;
		long nextBit = MASK[maskn]+1L;
		long su = count(x | nextBit, y | nextBit, maskn);
		long sl = count(x, y, maskn);
		if (x == y) return (su + sl + count(x, y | nextBit, maskn)) % MOD;
		else if ( L < x ) return (2 * su + sl) % MOD;
		else if ( (y | MASK[maskn+1]) < R) return (su + 2 * sl) % MOD;
		return (su + sl + count(x, y | nextBit, maskn)) % MOD;
	}

	public static void main(String[] args) {
		new Main().calc();
	}

}

Measured memory_bytes: 21844
#include<cstdio>
#include<algorithm>
using namespace std;
int n,m;
long long inv[1000003],fac[1000003],ans,sum;
inline long long c(register int n,register int m) {
	return fac[n]*inv[m]%998244353*inv[n-m]%998244353;
}
int main() {
	scanf("%d%d",&n,&m);
	if(n<m) {
		swap(n,m);
	}
	ans=n;
	fac[0]=1;
	fac[1]=1;
	inv[0]=1;
	inv[1]=1;
	for(register int i=2; i<=n+m; ++i) {
		fac[i]=fac[i-1]*i;
		fac[i]%=998244353;
		inv[i]=(998244353-998244353/i)*inv[998244353%i];
		inv[i]%=998244353;
	}
	for(register int i=2; i<=n+m; ++i) {

		inv[i]*=inv[i-1];
		inv[i]%=998244353;
	}
	for(register int i=1; i<=m; ++i) {
		sum+=c(i<<1,i)*c(n+m-(i<<1),n-i);
		sum%=998244353;
	}
	printf("%lld",((sum*inv[2]%998244353*inv[n+m]%998244353*fac[n]%998244353*fac[m]%998244353)+ans)%998244353);
	return 0;
}

Measured memory_bytes: 15744
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repi(i, s, n) for (int i = (s); i < (n); i++)
#ifdef LOCAL
#define INPUT_FILE                              \
  ifstream in("atcoder-problems/abc114_b.txt"); \
  cin.rdbuf(in.rdbuf());
#define print_vec(v)                        \
  rep(l, v.size()) { cout << v[l] << " "; } \
  cout << endl;
#else
#define INPUT_FILE
#define print_vec(v)
#endif
#define CIN_OPTIMIZE \
  cin.tie(0);        \
  ios::sync_with_stdio(false);
typedef pair<int, int> P;
typedef long long ll;
typedef pair<ll, ll> pl;
const int INF = 100100100;
const ll LINF = 1e18 + 100;
const int MOD = 1e9 + 7;

int main() {
  INPUT_FILE CIN_OPTIMIZE;

  string S;
  cin >> S;

  int ans = INF;
  rep(i, S.size() - 2) {
    int t = (S[i] - '0') * 100 + (S[i + 1] - '0') * 10 + (S[i + 2] - '0');
    ans = min(ans, abs(753 - t));
  }

  cout << ans << endl;
}

Measured memory_bytes: 256
A = int(input())
B = int(input())
C = int(input())
X = int(input())
 
ans =0
for i in range(A+1):
  for j in range(B+1):
    for k in range(C+1):
      tmp = 500*i + 100*j + 50*k
      if X == tmp: 
        ans +=1
print(ans)

Measured memory_bytes: 3060
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<queue>
#include<stack>
#include <cassert>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
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; }
typedef long long ll;
typedef pair<int,int> P;

const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  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;
  }

  // for prime mod
  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 {
  //fact 階乗　iface 階乗の逆数
  vector<mint> fact, ifact;
  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;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
};

int main(){
    int n,m,k;
    cin >> n >> m >> k;
    combination c(200005);
    mint ans = 0;
    for(int d=1;d<=n-1;d++){
        ans += (mint)d*c(n*m-2,k-2)*m*m*(n-d);
    }
    for(int d=1;d<=m-1;d++){
        ans += (mint)d*c(n*m-2,k-2)*n*n*(m-d);
    }
    cout << ans.x << endl;
}

Measured memory_bytes: 3328
#include <bits/stdc++.h>
#define nmax 100005

using namespace std;

string s; 
int n,ans[nmax];

bool check(){
	for(int i=2;i<n;i++){
		if((ans[i-1]==0)){
			if((s[i-1]=='o'))
				ans[i]=ans[i-2];
			else
				ans[i]=1-ans[i-2];
		}
		else{
			if(s[i-1]=='o')
				ans[i]=1-ans[i-2];
			else
				ans[i]=ans[i-2];
		}
	}
	if(ans[0]==0){
		if(s[0]=='o' && (ans[n-1]!=ans[1])){
			return 0;
		}
		if(s[0]=='x' && (ans[n-1]==ans[1])){
			return 0;
		}
	}
	else{
		if(s[0]=='x' && (ans[n-1]!=ans[1])){
			return 0;
		}
		if(s[0]=='o' && (ans[n-1]==ans[1])){
			return 0;
		}
	}
	if(ans[n-1]==0){
		if(s[n-1]=='o' && (ans[n-2]!=ans[0])){
			return 0;
		}
		if(s[n-1]=='x' && (ans[n-2]==ans[0])){
			return 0;
		}
	}
	else{
		if(s[n-1]=='x' && (ans[n-2]!=ans[0])){
			return 0;
		}
		if(s[n-1]=='o' && (ans[n-2]==ans[0])){
			return 0;
		}
	}
	return 1;
}

int main(){
	cin >> n;
	cin >> s;
	bool flag=0;
	for(int i=0;i<2;i++){
		for(int j=0;j<2;j++){
			ans[0]=i;
			ans[1]=j;
			if(check()){
				flag=1;
				break;
			}
		}
		if(flag){
			break;
		}
	}
	if(!flag){
		cout << -1 << endl;
	}
	else{
		for(int i=0;i<n;i++){
			if(!ans[i]){
				cout << 'S';
			}
			else{
				cout << 'W';
			}
		}
	}
	cout << endl;
	return 0; 
}

Measured memory_bytes: 896
#include <iostream>

int main() {
	int N;
	std::cin >> N;

	int M;
	std::cin >> M;

	char a[] = "Yes";
	char b[] = "No";

	if (N == M) {
		std::cout << a << std::endl;
	}
	else {
		std::cout << b << std::endl;
	}
	return 0;
}

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

import javax.swing.plaf.synth.SynthOptionPaneUI;

public class Main {

	public static void main(String[] args) throws NumberFormatException, IOException {
		// TODO Auto-generated method stub
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[][] as = new String[3][3];
		for(int i = 0; i < 3 ; i++) {
			String[] sub = br.readLine().split(" ");
			for(int j = 0 ; j < 3 ; j++) {
				as [i][j] = sub[j];
			}
		}
		boolean[][] flag = new boolean[3][3] ;
		int n = Integer.parseInt(br.readLine());
		for(int i = 0; i< n ; i++) {
			String s = br.readLine();
			for(int j = 0 ; j < 3 ; j++) {
				for(int k = 0 ; k < 3 ; k++) {
					if(as[j][k].equals(s)) {
						flag[j][k] = true;
					}
				}
			}
		}	
		
		if(isBingo(flag)) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
		


	}

	static boolean isBingo(boolean[][] b) {
		if(b[0][0] && b[0][1] && b[0][2]||
				b[1][0] && b[1][1] && b[1][2]||
				b[2][0] && b[2][1] && b[2][2]||
				b[0][0] && b[1][0] && b[2][0]||
				b[0][1] && b[1][1] && b[2][1]||
				b[0][2] && b[1][2] && b[2][2]||
				b[1][1] && b[2][2] && b[0][0]||
				b[0][2] && b[1][1] && b[2][0] ) {
			return true;
		}
		return false;
	}
	
}


Measured memory_bytes: 21204
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n;
  cin >> n;
  string s;
  map<string,int> mp;
  while(n--){
  	cin>>s;
    mp[s]++;
  }
  cout<<"AC x "<<mp["AC"]<<"\n";
  cout<<"WA x "<<mp["WA"]<<"\n";
  cout<<"TLE x "<<mp["TLE"]<<"\n";
  cout<<"RE x "<<mp["RE"]<<"\n";
}


Measured memory_bytes: 3616
//C
//#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>


#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdalign>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>

//Hang in there!

using namespace std;


int main() {
	int A, B;
	cin >> A >> B;
	for (int i = 1; i <= 3; i++) {
		if (A * B * i % 2 == 1) {
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;
}



Measured memory_bytes: 256
def check(S):
    ans = 0
    for i in range(1,len(S)):
        if S[i-1] == 'A' and S[i] == 'B':
            ans += 1
    return ans

N = int(input())
s = []
a = 0
b = 0
ab = 0

ans = 0

for i in range(N):
    S = input()
    ans += check(S)
    if S[0] == 'B' or S[-1] == 'A':
        s.append(S)
        if S[0] == 'B' and S[-1] != 'A':
            b += 1
        elif S[0] != 'B' and S[-1] == 'A':
            a += 1
        else:
            ab += 1

if ab == 0:
    ans += min(a,b)
else:
    if a == 0 and b == 0:
        ans += ab - 1
    else:
        ans += ab + min(a,b)

print(ans)

Measured memory_bytes: 3700
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstdio>
#include <iomanip>
#include<string>
#include <stack>
#include<queue>
#include<map>
#include <stdlib.h>
#include <set>
typedef long long ll;
using namespace std;

int main() {

	int s = 0, g = 999;
	int n, cnt = 0, mi = 999;

	cin >> n;
	vector<int> v(n);
	for (int i = 0; i < n; i++)
		v[i] = 0;
	for (int i = 0; i < n; i++)
		cin >> v[i];

	for (int k = 0; k < n; k++) {
		if (v.at(k) != 0) {
			s = k;
			break;
		}

	}

	while (1) {
		int sum = 0;
		mi = 9999;
		for (int i = 0; i < n; i++) {
			sum += v.at(i);
		}
		if (sum == 0) {
			cout << cnt << endl;
			return 0;
		}
		for (int i = s; i < n; i++) {
			if (v[i] == 0)
				break;
			mi = min(mi, v[i]);
			g = i;
		}

		for (int i = s; i < g + 1; i++) {

			v.at(i) -= mi;
		}

		for (int k = 0; k < n; k++) {
			if (v.at(k) != 0) {
				s = k;
				break;
			}
		}
		cnt += mi;

	}

}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
//template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

int main(){
    int N, L; cin >> N >> L;
    vector<string> a;
    for(int i=0; i<N; i++){
        string s; cin >> s;
        a.push_back(s);
    }

    sort(a.begin(), a.end());
    string s = "";
    for(int i=0; i<N; i++) s += a[i];

    cout << s << endl;
}

Measured memory_bytes: 256
import java.util.*;

class Main{
    public static void main(String[]args){
		Scanner sc = new Scanner(System.in);
		int iline = sc.nextInt();
		int reti = 0;
        for(int i=1;;i++){
        	if(iline<i*i){
        		break;
        	}
        	reti++;
        }
        
		System.out.println(reti*reti);
    }
}


Measured memory_bytes: 21844
fn main() {
    let mut v: Vec<Vec<usize>> = vec![Vec::new(); 3];
    for i in 0..v.len() {
        let mut s = String::new();
        std::io::stdin().read_line(&mut s).unwrap();
        v[i] = s.trim().split(' ').map(|x| x.parse().unwrap()).collect();
    }

    for i in 0..v[0][0]+1 {
        for j in 0..v[1][1]+1 {
            for k in 0..v[2][2]+1 {
                let x = v[0][0] - i;
                let y = v[1][1] - j;
                let z = v[2][2] - k;

                if v[0][1] == i + y && v[0][2] == i + z &&
                   v[1][0] == j + x && v[1][2] == j + z &&
                   v[2][0] == k + x && v[2][1] == k + y {
                       println!("Yes"); return;
                   }
            }
        }
    }

    println!("No");
}



Measured memory_bytes: 4352
import java.io.*;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Main {

    static class Task {

        public void solve(int testNumber, InputReader in, PrintWriter out) {
            char midC = ' ';
            for (int i = 0; i < 3; i++) {
                String str = in.next();
                if (i == 1) {
                    midC = str.charAt(0);
                }
            }
            out.println("A" + midC + "C");
        }
    }

    private static void sort(double[] arr) {
        Double[] objArr = Arrays.stream(arr).boxed().toArray(Double[]::new);
        Arrays.sort(objArr);
        for (int i = 0; i < arr.length; i++) {
            arr[i] = objArr[i];
        }
    }

    private static void sort(int[] arr) {
        Integer[] objArr = Arrays.stream(arr).boxed().toArray(Integer[]::new);
        Arrays.sort(objArr);
        for (int i = 0; i < arr.length; i++) {
            arr[i] = objArr[i];
        }
    }

    private static void sort(long[] arr) {
        Long[] objArr = Arrays.stream(arr).boxed().toArray(Long[]::new);
        Arrays.sort(objArr);
        for (int i = 0; i < arr.length; i++) {
            arr[i] = objArr[i];
        }
    }

    private static void solve() {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Task task = new Task();
        task.solve(1, in, out);
        out.close();
    }

    public static void main(String[] args) {
        new Thread(null, () -> solve(), "1", 1 << 26).start();
    }

    static class InputReader {

        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

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

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

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

    }

}

Measured memory_bytes: 32724
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        int H,W,i,j;
        H=scan.nextInt();
        W=scan.nextInt();

        while(H!=0 || W!=0){
            for(i=0;i<H;i++){
                for(j=0;j<W;j++){
                    if((i%2==0 && j%2==0)||(i%2==1 && j%2==1)){
                        System.out.print("#");
                    }else{
                        System.out.print(".");
                    }
                }
                System.out.print("\n");
            }
            System.out.print("\n");
            H=scan.nextInt();
            W=scan.nextInt();
        }

    }
}


Measured memory_bytes: 37900
#include <bits/stdc++.h>
#define For(i,a,b) for(int i=a;i<=b;i++)
#define F first
#define S second
#define all(x) x.begin(),x.end()
#define sz(x) ((int)x.size())
#define int ll
using namespace std;
using ll=long long;
using pii=pair<int,int>;

int gcd(int a,int b) { return b==0?a:gcd(b,a%b); }

struct union_find
{
	int n;
	int par[100050];
	int block;
	union_find(int nn)
	{
		n=nn;
		block=n;
		For(i,0,n-1) par[i]=i;
	}
	int find(int a)
	{
		if(par[a]==a) return a;
		int tmp=find(par[a]);
		par[a]=tmp;
		return tmp;
	}
	void add(int a,int b)
	{
		int pa=find(a);
		int pb=find(b);
		if(pa==pb) return;
		par[pa]=pb;
		block--;
	}
};

int32_t main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	int n,m; cin>>n>>m;
	union_find un(n);
	int a,b,c;
	while(m--)
	{
		cin>>a>>b>>c;
		un.add(a-1,b-1);
	}
	cout<<un.block<<"\n";
	return 0;
}















Measured memory_bytes: 1024
#include<stdio.h>
int main()
{
	int n;
	scanf("%d",&n);
	int i;
	int a,min=2000000000,max=0;
	for(i=0;i<n;i++)
	{
		scanf("%d",&a);
		if(min>a)min=a;
		if(max<a)max=a;
	}
	printf("%d\n",max-min);
	return 0;
}

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

 

int main()
{ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin>>n;
    int cnt,a,b;
    cnt=0;
    bool flag=false;
    for(int i=0;i<n;i++)
    {
    	cin>>a>>b;
    	if(a==b)
    	{
    		cnt++;
    	}
    	else
    	{
    		cnt=0;
    	}
    	if(cnt==3)
    	{
    		flag=true;
    	}
    }
    if(flag)
    	cout<<"Yes"<<endl;
    else
    	cout<<"No"<<endl;
	return 0;

}

Measured memory_bytes: 3660
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.*;
public class Main{
	
	public static void main(String[]args) {
		PrintWriter out = new PrintWriter(System.out);
		Scanner sc=new Scanner (System.in);
		int k=sc.nextInt();
		  int n=7;
		  n%=k;
		  int i;
		  for(i=0;i<k+1;i++){
		    if(n==0){
		    break;
		    }
		  	n*=10;
		    n+=7;
		    n%=k;
		  }
		  if(i==k+1){System.out.println(-1);}
		  else{
		    System.out.print(i+1);
		  }
		out.close();
	}
}

Measured memory_bytes: 27300
class UnionFind:
  def __init__(self, num):
    self.rank = [0]*num
    self.par = [i for i in range(num)] #基準(par = parentのpar)
    self.n   = num
    self.size = [1]*num

#親を探す
  def find(self, x):
    if self.par[x] == x:
      return x
    else:
      self.par[x] = self.find(self.par[x]) #自分じゃなきゃ親を探す
      return self.par[x]

#集合を結合する(結合する前に親のポインタを取得する)
  def union(self, x, y):
    x = self.find(x)
    y = self.find(y)
    if x == y:
      return
    if self.rank[x] > self.rank[y]: #ランクの高い方に基準を合わせる
      self.par[y] = x
      self.size[x]+=self.size[y]
      self.size[y] = 0
    else:
      self.par[x] = y
      self.size[y] += self.size[x]
      self.size[x] = 0
      if self.rank[x] == self.rank[y]:
        self.rank[y] += 1

  def same(self, x, y):
    return self.find(x) == self.find(y)

  def all_find(self):
    ls=[]
    for i in range(len(self.par)):
      ls.append(self.find(i))
    return ls

n,m=map(int,input().split())
edges=[[0]*n for i in range(n)]
AB=[]
ans=UnionFind(n)
for i in range(m):
  a,b=map(int,input().split())
  AB.append([a-1,b-1])
  edges[a-1].append(b-1)
  edges[b-1].append(a-1)
  ans.union(a-1,b-1)
cnt=0
for i in range(m):
  uf=UnionFind(n)
  for j in range(m):
    if i==j:
      continue
    a,b=AB[j]
    uf.union(a,b)
  if len(set(uf.all_find()))>1:
    cnt+=1
print(cnt)




Measured memory_bytes: 3188
#include <stdio.h>

int main() {
    char c;
    int i, s = 0;

    while(1) {
        c = getchar();
        if (c == '\n') {
            if (s <= 0) break;
            printf("%d\n", s);
            s = 0;
        }else{
            i = c - '0';
            s += i;
        }
    }
    return 0;
}


Measured memory_bytes: 2044
//  Created by conan1024hao in 2020.
//  Copyright © 2020 conan1024hao. All rights reserved.
//  専用ライブラリです、自由にコピーして構いません。
//  感谢看我的代码！Wechat:conan1024hao Twitter/QQ:810396815
#pragma GCC optimize ("O3")
#include <iostream>
#include <iomanip>
#include <istream>
#include <ostream>
#include <sstream>
#include <iterator>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <utility>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <ctime>
#include <cctype>
#include <cstdlib>
#define IINF 10e8
#define INF 10e16
#define MOD 1000000007
#define mod 1000000007
#define rep(i, a, n) for (ll i = a; i < (ll)(n); i++)
#define Endl endl
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define mmax(x,y)(x>y?x:y)
#define mmin(x,y)(x<y?x:y)
#define chmax(x,y) x=mmax(x,y)
#define chmin(x,y) x=mmin(x,y)
#define all(x) (x).begin(),(x).end()
#define siz(x) (ll)(x).size()
#define PI acos(-1.0)
using namespace std;
//using Int=int_fast64_t;
typedef long long int ll;
typedef long long int LL;
typedef pair<ll,ll>Pll;
typedef pair<int,int>Pin;
long long GCD(long long a, long long b) { return b ? GCD(b, a%b) : a; }
long long LCM(long long a, long long b)  {return a/GCD(a,b)*b;}
int dx[4]={-1,0,1,0};
int dy[4]={0,-1,0,1};
char dir[4]={'u','l','d','r'};
ll cmp1(pair<ll,string>a,pair<ll,string> b){
        if(a.fi!=b.fi)
        return a.fi<b.fi;
        else
        return a.se<b.se;
}

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

//---------------------------------------------------------------------------
int main(){//問題をちゃんと見ろ!!!!!!!!!!!!!!!!!      llか??????????统一类型        memset()!!!!!!!!!!!!       ペナを減らせ!!!!!!!!!!!!!
    cin.tie(0);
    ios::sync_with_stdio(false);
    //-------------------------------
    int n,k;cin>>n>>k;
    if(k>(n-1)*(n-2)/2){
        cout<<-1<<endl;
        return 0;
    }
    vector<Pin>ans;
    for(int i=2;i<=n;i++)
        ans.pb(mp(1,i))  ;
    int sum=(n-1)*(n-2)/2-k;
    for(int i=2;i<n;i++){
        for(int j=i+1;j<=n;j++){
            if(sum==0)break;
            ans.pb(mp(i,j));
            sum--;
            if(sum==0)break;
        }
        if(sum==0)break;
    }
    cout<<ans.size()<<endl;
    for(int i=0;i<ans.size();i++){
        cout<<ans[i].fi<<" "<<ans[i].se<<endl;
    }
    //-------------------------------
    return 0;
}
//---------------------------------------------------------------------------








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

int main() {
	int q;
	cin >> q;
	vector<int> A;
	for (int i = 0; i < q; ++i) {
		int query;
		cin >> query;
		if (query == 0) {
			int x;
			cin >> x;
			A.push_back(x);
		}
		else if (query == 1) {
			int p;
			cin >> p;
			cout << A[p] << endl;
		}
		else A.pop_back();
	}
}


Measured memory_bytes: 3872
N,K=input().split()
def delete(a,n):
  j=len(a)
  for i in range(j):
    n=[l for l in n if l!=int(a[i])]
    
  return n

def get(y):
  first=[]
  for i in range(y):
    first.append(i+1)
    
  return first

answer=get(int(N))
for i in range(int(K)):
  v=input()
  b=input().split()
  answer=delete(b,answer)
  
print(len(answer))

Measured memory_bytes: 9212
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define MAX 100

int top=0,S[MAX];

int isEmpty();
int isFull();
void push(int);
int pop();

int main(){
  int a,b;
  char s[MAX];

  while(scanf("%s",s) != EOF){
    if(s[0] == '+'){
      a = pop();
      b = pop();
      push(a+b);
    }
    else if(s[0] == '-'){
      a = pop();
      b = pop();
      push(b-a);
    }
    else if(s[0] == '*'){
      a = pop();
      b = pop();
      push(a*b);
    }
    else push(atoi(s));
  }
  printf("%d\n",pop());

  return 0;
}

/*int isEmpty(){
  if(top == 0) return 1;
  return 0;
}

int isFull(){
  if(top >= MAX - 1) return 1;
  return 0;
}
*/
void push(int x){
  /*  if(isFull()==1) printf("overflow\n");*/
  top++;
  S[top] = x;
}

int pop(){
  /*if(isEmpty()==1) printf("underflow\n");*/
  top--;
  return S[top+1];
}

Measured memory_bytes: 548
function Main(input) {	input = input.split("\n");
	tmp = input[0].split(" ");
	var max = parseInt(tmp[1], 10)+parseInt(tmp[0], 10);
	var min = parseInt(tmp[1], 10)-parseInt(tmp[0], 10)+1;
    var answer = min;
    for(var i=min+1;i<max;i++){
      answer = answer+" "+String(i);
    };
    console.log(answer);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7500
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <math.h>
#include <cmath>
#include <limits.h>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <functional>
#include <stdio.h>
using namespace std;

long long MOD = 1000000007;

int main() {
    
    
    long long a = 0;
    long long b = 0;
    int N;
    cin >> N;
    vector<long long> A(N);
    
    for ( int i = 0; i < N; i++ ) {
        cin >> A[i];
    }
    
    sort( A.begin(), A.end(), greater<long long>() );
    
    for ( int i = 0; i < N-1; i++ ) {
        if ( A[i] == A[i+1] ) {
            if ( !a ) { a = A[i]; i++; }
            else { b = A[i]; break; }
        }
    }
    
    cout << a*b << endl;
    
    return 0;
}

Measured memory_bytes: 1024
#include <stdio.h>

int main(void){
	int a,b,c,i;
	int count=0;

	scanf("%d %d %d", &a, &b, &c);
	for(i=a;i<=b;i++){
		if(c%i==0) count++;
	}
	printf("%d\n",count);
	return 0;
}



Measured memory_bytes: 2108
#include <iostream>
#include <algorithm>
#include <utility>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <math.h>
#include <string.h>
#include <iomanip>
#include <numeric>
#include <cstdlib>
#include <cstdint>
#include <cmath>
#include <functional>
#include <limits>
#include <cassert>
#include <bitset>
 
using namespace std;
 
/* template */
 
using ll = long long;
 
void debug_out() { std::cout << std::endl; }
 
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cout << H << " ";
  debug_out(T...);
}
 
#ifdef LOCAL
#define debug(...) cout << "debug: "; debug_out(__VA_ARGS__)
#else
#define debug(...) 
#endif
 
#define rep(i, a, n) for (int i = (int)(a); i < (int)(n); i++)
#define rrep(i, a, n) for (int i = ((int)(n-1)); i >= (int)(a); i--)
#define Rep(i, a, n) for (long long i = (long long)(a); i< (long long)(n); i++)
#define RRep(i, a, n) for (long long i = ((long long)(n-1ll)); i>=(long long)(a); i--)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
 
template <typename T>
std::ostream& operator<<(std::ostream& os, std::vector<T> vec) {
  for (std::size_t i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
  return os;
}
 
struct Edge{
    int to;
    ll weight;
    Edge(int t, ll w) : to(t), weight(w){ }
};
 
struct edge{
    int from;
    int to;
    ll weight;
    edge(int f,int t,ll w) : from(f), to(t), weight(w){ }
};
 
 
using Graph = vector<vector<Edge>>;
using graph = vector<vector<int>>;
using edges = vector<edge>;
 
template <class T>
inline bool chmin(T &a, T b){
    if (a > b){
        a = b;
        return true;
    }
    return false;
}
 
template <class T>
inline bool chmax(T &a, T b){
    if (a < b){
        a = b;
        return true;
    }
    return false;
}
 
template <class T>
T lcm(T a, T b){
    return (a*b)/gcd(a,b);
}
 
ll ctoi(char c) {
	switch (c) {
	case '0': return 0; case '1': return 1; case '2': return 2;
	case '3': return 3; case '4': return 4; case '5': return 5;
	case '6': return 6; case '7': return 7; case '8': return 8;
	case '9': return 9;  default: return 0;
	}
}
 
constexpr ll LNF = 1LL<<50;
 
constexpr int INF = 1e9+7;
 
const long double PI=3.14159265358979323846;
 
 
vector<int> dx = {1,0,-1,0};
vector<int> dy = {0,1,0,-1};
 
/* template */

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    ll d,t,s; cin >> d >> t >> s;
    ll x = (d+s-1)/s;
    if(x<=t){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
}


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

string D[7]={"SAT","FRI","THU","WED","TUE","MON","SUN"};

int main(){
	string S;
	cin >> S;
	for(int i=0;i<7;i++)if(S==D[i])cout << i+1 << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <math.h>
#include <cmath>
#include <limits.h>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <functional>
#include <stdio.h>
using namespace std;

long long MOD = 1000000007;


int main() {
    
    long long ans = 0;
    long long alphabet[26] = {0};
    string A;
    cin >> A;
    
    for ( char c = 'a'; c <= 'z'; c++ ) {
        
        long long count =  0;
        for ( auto& s : A ) {
            if ( s == c ) { count++; }
        }
        alphabet[ c - 'a' ] = count;
    }
    
    ans += A.length() * ( A.length()-1 ) / 2;
    
    for ( int i = 0; i < 26; i++ ) {
        if ( alphabet[i] > 1 ) {
            ans -= alphabet[i] * ( alphabet[i]-1 ) / 2;
        }
    }
    
    cout << ans+1 << endl;
    
    return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
int main(){
  long long n,d;
  cin>>n>>d;
  long long x[n],y[n];
  for(int i=0;i<n;i++)
  {
    cin>>x[i]>>y[i];
  }
  int c=0;
  for(int i=0;i<n;i++)
  {
    if(sqrt((x[i]*x[i])+(y[i]*y[i])) <= (double) d){
      c++;}
   }
  cout<<c;
  return 0;
}

Measured memory_bytes: 6800
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<queue>
#include<deque>
#include<cmath>
#include<map>
#include<unordered_map>
#include<set>
#include<cstring>
#include<iomanip> //cout << fixed << setprecision(15) << x << endl;

using namespace std;
typedef long long ll;
const ll INF = 1e9 + 6;
const ll MOD = 1e9 + 7;
const ll LLINF = 1e18;
#define Pint pair<int, int>
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rnr(i,a,b) for(int i=int(a);i>=int(b);i--)
#define rep(i,b) rng(i,0,b)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
/* -- template -- */

int main() {
    ll a, b, x; cin >> a >> b >> x;
    ll ans = ll(b / x) - ll(a / x) + (a % x == 0);
    cout << ans << endl;
}


Measured memory_bytes: 256
using System;
using System.Numerics;
using System.Linq;
using System.Collections.Generic;
using System.Text;

namespace debug
{
    class ProgramC
    {
        static void Main(string[] args)
        {
            //入力
            string[] s = Console.ReadLine().Split(' ');
            long n = long.Parse(s[0]);
            long k = long.Parse(s[1]);
            long sum = 0;
            long mod = 1000000000 + 7;

            long[] wa = new long[n+1];

            for (long i = 0; i < n + 1; i++)
            {
                if (i == 0)
                    wa[0] = 0;
                else
                    wa[i] = i + wa[i - 1];
            }
            
            for (long i = k; i <= n + 1; i++)
            {
                if (i < n + 1)
                {
                    long temp = wa[n] - wa[n - i] - wa[i - 1] + 1;
                    sum += temp % mod;
                }
                else
                    sum += 1;
                sum %= mod;

            }

            if (sum < 0)
                sum = mod - sum;

            Console.WriteLine(sum);
            
        }
    }

}


Measured memory_bytes: 28784
#include <bits/stdc++.h>
#define ll long long int
#define yorn(f) cout<<((f)?"Yes":"No")<<endl;
#define YORN(f) cout<<((f)?"YES":"NO")<<endl;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define put(x) cout << x << endl;
#define println(x) cout << x << endl;
using namespace std;
int main()
{
    int r, d, x;
    cin >> r >> d >> x;

    rep(i, 10) {
        x = r * x - d;
        put(x)
    }

    
    return 0;
}

Measured memory_bytes: 3576
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <queue>
#include <string>
#include <stack>
#include <cmath>
#include <list>
#include <iomanip>
#include <set>
#include <map>
#include <sstream>
#include <string.h>
#include <fstream>
#include <stdio.h>

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
typedef pair<int, int> PII;
typedef vector<int> VI;

#define FOR(i,a,b) for(int (i)=(a);i<(b);++(i))
#define RFOR(i,a,b) for(int (i)=(a)-1;(i)>=(b);--(i))
#define MP make_pair
#define MOD 1000000007
#define INF 1000000001
#define PB push_back
#define eps 1e-5
#define X first
#define Y second

int n, m;
string s;
char a[200000], b[200000];


bool ok1(int pos) {
    // cout << pos << endl;
    FOR (i,0,m)
    {
        if (s[pos] == a[i])
        {
            if (b[i] == 'L') pos--;
            else pos++;
        }
        
        // cout << i<<" "<<pos << endl;
        
        if (pos == -1) return true;
        if (pos == n) return false;
    }
    
    return false;
}

bool ok2(int pos) {
    FOR (i,0,m)
    {
        if (s[pos] == a[i])
        {
            if (b[i] == 'L') pos--;
            else pos++;
        }
        
        if (pos == -1) return false;
        if (pos == n) return true;
    }
    
    return false;
}

int main()
{
    cin >> n >> m;
    cin >> s;
    FOR (i,0,m) cin >> a[i] >> b[i];
    int n1 = 0, n2 = 0;
    
    int l, r;
    l = -1, r = n-1;
    while (l != r)
    {
        int x = (l+r+1)/2;
        if (ok1(x)) l = x;
        else r = x-1;
    } n1 = l+1;
    
    l = 0, r = n;
    while (l != r)
    {
        int x = (l+r)/2;
        if (ok2(x)) r = x;
        else l = x+1;
    } n2 = n-l;
    
    cout << n-n1-n2;
}


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

int main(){
  int n, k;
  string s;
  cin >> n >> s >> k;
  for(int i=0;i<n;i++){
    if(s[i]!=s[k-1])s[i]='*';
  }
  cout << s << endl;

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep2(i, m, n) for(int i=int(m); i<int(n); i++)
#define rep(i, n) rep2(i, 0, n)
#define all(a) a.begin(), a.end()
using ll = long long;
using ld = long double;
using V = vector<int>;
using Vll = vector<ll>;
using Vld = vector<ld>;
using VV = vector<V>;
using VVll = vector<Vll>;
using VVld = vector<Vld>;
using P = pair<int, int>;
using Pll = pair<ll, ll>;
using Pld = pair<ld, ld>;
const int INF = 1<<30;
const ll INFll = 1ll<<62;
const ld EPS = 1e-10;
const int MOD = int(1e9)+7;
template<typename T> inline bool chmin(T& a, T b) {if(a>b) {a=b; return true;} return false;}
template<typename T> inline bool chmax(T& a, T b) {if(a<b) {a=b; return true;} return false;}


int main() {
  int n, m; cin >> n >> m;
  V s(n), t(m);
  rep(i, n) cin >> s[i];
  rep(i, m) cin >> t[i];


  VVll dp(n+1, Vll(m+1));

  rep(i, n+1) dp[i][0] = 1;
  rep(i, m+1) dp[0][i] = 1;

  rep(i, n) rep(j, m) {
    dp[i+1][j+1] = dp[i+1][j] + dp[i][j+1];
    if (s[i] != t[j]) dp[i+1][j+1] -= dp[i][j];
    dp[i+1][j+1] = (dp[i+1][j+1] + MOD) % MOD;
  }
  cout << dp[n][m] << endl;
  return 0;
}


Measured memory_bytes: 31616
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <cmath>
#include <bitset>
#include <iomanip>
#include <stack>
#include <list>
#include <map>
#include <unordered_map>
#include <chrono>
#include <numeric>
using namespace std;
using ll = long long;
const long long INF = (long long)1e18+1;
#define DIV 1000000007
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
#ifdef TEST
    chrono::system_clock::time_point start, end;
    start = chrono::system_clock::now();
#endif
    long idx=0;
    long N;
    cin >> N;
    string S;
    cin >> S;
    ll total = 0;
    vector<long> R;
    vector<long> G;
    vector<long> B;
    for(size_t i=0;i<N; i++)
    {
        if(S[i] == 'R') R.push_back(i);
        else if(S[i] == 'G') G.push_back(i);
        else if(S[i] == 'B') B.push_back(i);
    }
    ll out_of_rule = 0;
    for(size_t i=0;i<R.size(); i++)
    {
        for(size_t j=0;j<G.size(); j++)
        {
            ll index = abs(R[i] - G[j]);
            //cerr << R[i] << "," << G[j] << ":" << index << endl;
            if(index % 2 == 0 && S[min(R[i], G[j]) + index/2] == 'B') out_of_rule++;
            if(max(R[i], G[j]) + index < N && S[max(R[i], G[j]) + index] == 'B') out_of_rule++;
            if(min(R[i], G[j]) - index >= 0 && S[min(R[i], G[j]) - index] == 'B') out_of_rule++;
        }
    }
    cout << R.size()*G.size()*B.size() - out_of_rule << endl;
#ifdef TEST
    end = chrono::system_clock::now();
    cerr << static_cast<double>(chrono::duration_cast<chrono::microseconds>(end - start).count() / 1000.0) << "[ms]" << endl;
#endif
    return 0;
}

Measured memory_bytes: 3652
n=int(input())
ans=0
cnt=0
a=list(map(int,input().split()))
for i in range(n):
    for j in range(100):
        if a[i]%2==0:
            a[i]=a[i]//2
            cnt+=1
        else:
            ans+=cnt
            cnt=0
print(ans)

Measured memory_bytes: 4148
'use strict'

function main(input) {
    const s = Number(input.split('\n')[0].split(' ')[0]);
    const w = Number(input.split('\n')[0].split(' ')[1]);
    if (s <= w) console.log('unsafe');
    else console.log('safe');
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 29628
import java.util.Scanner;
public class Main {
	static Scanner scan=new Scanner(System.in);
	static int gcd (int a, int b) {return b>0?gcd(b,a%b):a;}
	static long lcm (int a, int b) {return a*b/gcd(a,b);}
	static int max(int a,int b) {return a>b?a:b;}
	static int min(int a,int b) {return a<b?a:b;}
	static long factorial(int i) {return i==1?1:i*factorial(i-1);}
	static int lower_bound(int a[],int key) {
		int low=0,high=a.length;
		while(low<high) {
			int mid=((high-low)/2)+low;
			if(a[mid]<=key)low=mid+1;
			else high=mid;
		}
		return high;
		}
	static int upper_bound(int a[],int key) {
		int low=0,high=a.length;
		while(low<high) {
			int mid=((high-low)/2)+low;
			if(a[mid]<key)low=mid+1;
			else high=mid;
		}
		return high;
		}
	static boolean isPrime (int n) {
		if (n==2) return true;
		if (n<2 || n%2==0) return false;
		double d = Math.sqrt(n);
		for (int i=3; i<=d; i+=2)if(n%i==0){return false;}
		return true;
	}
		public static void main(String[] args) {
			int a=scan.nextInt();
			int b=scan.nextInt();
			int c=scan.nextInt();
			int densya=a*b;
			int takusi=c;
			System.out.println(densya<takusi?densya:takusi);
		}
}


Measured memory_bytes: 21844
#include <stdio.h>

int main(void) {
  int A, B, max, sum, sub, mul;

  scanf("%d %d", &A, &B);
  sum = A + B;
  sub = A - B;
  mul = A * B;

  max = sum;
  if (max < sub) max = sub;
  if (max < mul) max = mul;

  printf("%d\n", max);

  return 0;
}


Measured memory_bytes: 128