akhauriyash/Code-Regression huggingface dataset:
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define INF 100000000
#define rep(i,s,n) for (int i = (int)(s); i < (int)(n); i++)
#define mp make_pair
ll mod = 10e9+7;
ll mod2 = 998244353;

int main(){
    vector<int> a(10e5+10,1);
    a[0] = 0; a[1] = 0;
    rep(i,2,10e5+5){
        if (a[i]==1){
            for(int j=i*2;j<10e5+5;j+=i){
                a[j] = 0;
            }
        }
    }
    vector<int> b(10e5+10,0);
    rep(i,0,10e5+5){
        if (i%2==1 && a[i]==1 && a[(i+1)/2]==1){
            b[i+1] = b[i] + 1;
        }else{
            b[i+1] = b[i];
        }
    }
    int q;cin>>q;
    vector<int> ans;
    rep(i,0,q){
        int l,r;cin>>l>>r;
        ans.push_back(b[r+1]-b[l]);
    }
    for (auto x:ans){
        cout<<x<<endl;
    }
}

Measured memory_bytes: 8952
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>  
#include <stdlib.h> 
#include <string.h> 
#include <math.h>   


int main(void)
{
    int a, b, c, d;

    scanf("%d", &a);
    scanf("%d", &b);

    c = a * (a - 1) / 2;
    d = b * (b - 1) / 2;

 
    printf("%d\n", c + d);


    return 0;
}

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

int main(){
    string s, t;
    cin >> s >> t;
    int a, b;
    cin >> a >> b;
    string u;
    cin >> u;
    if (s == u) a --;
    else b -- ;
    cout << a << " " << b << endl;
}

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

A.sort()
# print(A)
# print(N//2)
for i in range(N // 2):
    # print(i)
    # print(A[i])
    # print(A[i+1])
    
    if A[i] == A[i+1]:
        print("NO")
        exit()
    elif A[-1-i] == A[-2-i]:
        print("NO")
        exit()

print("YES")


Measured memory_bytes: 26804
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
const ll N=2e6+5,mod=1e9+7;
ll fct[N],inv[N],invfct[N];
inline void init(){
    fct[0]=fct[1]=1;
	inv[1]=1;
	invfct[0]=invfct[1]=1;
	for(ll i=2;i<N;i++){
		fct[i]=i*fct[i-1]%mod;
		inv[i]=ll(mod-inv[mod%i])*(mod/i)%mod;
		invfct[i]=ll(inv[i])*invfct[i-1]%mod;
	}
}
inline ll ncr(ll n,ll r){
    if(n<r)return 0;
    return fct[n]*(invfct[r]*invfct[n-r]%mod)%mod;
}
int main(){
    cin.tie(NULL); cout.tie(NULL);
    ios_base:: sync_with_stdio(false);
    init();
    ll n;cin>>n;
    ll ans = fct[n];
    for(ll k=1;k<n;k++){
        ans-=ncr(k-1,n-k-1)*fct[k]%mod*fct[n-k-1]%mod;
        if(ans<0)ans+=mod;
    }
    cout<<ans;
}

Measured memory_bytes: 47104
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define rep1(i,n) for(int i=1;i<=(int)n;i++)
#define rep2(i,j,n) for(int j=i;j<n;j++)
#define rep3(i,j,n) for(int j=i;j<=n;j++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define sp(n) cout << fixed << setprecision(n)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
typedef long long ll;
using namespace std;
int main(void){
    ll a,b,n;cin>>a>>b>>n;
    ll x=min(b-1,n);
    ll res=a*x/b-a*(x/b);
    cout<<res<<endl;
}

Measured memory_bytes: 3620
using System;

namespace _0003
{
	class Program
	{
		static void Main(string[] args)
		{
			string line = Console.ReadLine();
			int l = Convert.ToInt32(line);
			while( 0 < l )
			{
				string t = Console.ReadLine();
				string[] n  = t.Split(' ');
				int a = Convert.ToInt32(n[2]);
				int b = Convert.ToInt32(n[1]);
				int c = Convert.ToInt32(n[0]);
				if(a < b && c < b)
				{
					if (a * a + c * c == b * b)
					{
						Console.WriteLine("YES");
					}
					else 
					{
						Console.WriteLine("NO");
					}
						
				}
				else if (b < c && a < c)
				{
					if (a * a + b * b == c * c)
					{
						Console.WriteLine("YES");
					}
					else
					{
						Console.WriteLine("NO");
					}
				}
				else
				{
					if (b * b + c * c == a * a)
					{
						Console.WriteLine("YES");
					}
					else
					{
						Console.WriteLine("NO");
					}
				}
				l--;
			}
		}
	}
}

Measured memory_bytes: 5508
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<functional>
#include<vector>
#include<queue>
using namespace std;
#define f(i,n) for(int i=0;i<(int)n;i++)
#define MOD 1000000009

int main(void){
	char a[200001];
	char b[200001];
	f(i, 200001){
		a[i] = 0;
		b[i] = 0;
	}
	int n, k;
	int p, q;
	int x, y;
	int z = 0;
	scanf("%d", &n);
	scanf("%s", a);
	scanf("%s", b);
	p = strlen(a);
	q = strlen(b);
	f(i, n){
		x = i % p;
		y = i % q;
		if (a[x] != b[y]){
			if (a[x] > b[y])z = 1;
			break;
		}
	}
	k = n;
	if (z == 0){
		while (z == 0){
			if (k%p == 0){
				z = 2;
				for (int i = 0; i < k / p; i++)printf("%s", a);
				for (int i = 0; i < (n - k) / q; i++)printf("%s", b);
			}
			k -= q;
		}
	}
	else{
		while (z == 1){
			if (k%q == 0){
				z = 2;
				for (int i = 0; i < k / q; i++)printf("%s", b);
				for (int i = 0; i < (n - k) / p; i++)printf("%s", a);
			}
			k -= p;
		}
	}
	return 0;
}

Measured memory_bytes: 768
s=input()

def sigma(n):
  return n*(n+1)//2

total=0
if s[0]=='>':
  cnt=s.find('<')
  if cnt==-1:
    cnt=len(s)
    s=''
  else:
    s=s[cnt:]
  total+=sigma(cnt)
  
flag=True
while flag:
  l=[]
  index1=s.find('>')
  if index1!=-1:
    for i in range(index1):
      l.append(s[i])
    s=s[index1:]
  else:
    l.extend(['<']*len(s))
    s=''
    flag=False
  index2=s.find('<')
  if index2!=-1:
    for i in range(index2):
      l.append(s[i])
    s=s[index2:]
  else:
    l.extend(['>']*len(s))
    s=''
    flag=False
  cnt1=l.count('>')
  cnt2=l.count('<')
  if cnt2<=cnt1:
    total+=sigma(cnt1)+sigma(cnt2-1)
  else:
    total+=sigma(cnt2)+sigma(cnt1-1)

print(total)

Measured memory_bytes: 17164
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i <= n; i++)
#define rep3(i, x, n) for(int i = x; i >= n; i--)
#define elif else if
typedef long long ll;
typedef pair<ll, ll> P;
const ll MOD = 1e9+7;
const ll MOD2 = 998244353;
const ll INF = 1e18;

ll f(ll a, ll b){return a+b;}
int other = 0;

struct segment_tree{
    ll n;
    ll seg[1000000];
    //要素数Nのセグメントツリーを構築
    segment_tree(int N){
        n = 1;
        while(n < N) n *= 2;
        fill_n(seg, 2*n-1, other);
    }
    //i番目の要素をxに変更(0番目から数える)
    void update(int i, ll x){
        i += n-1;
        seg[i] = x;
        while(i > 0){
            i = (i-1)/2;
            seg[i] = f(seg[2*i+1], seg[2*i+2]);
        }
    }
    //要素数N以上の最小の２べきnを取得
    ll size(){return n;}
    //query(a, b, 0, 0, n)でa番目からb-1番目までの演算の結果を取得
    ll query(int a, int b, int i, int l, int r){
        if(a >= r || b <= l) return other;
        elif(a <= l && r <= b) return seg[i];
        else{
            int vl = query(a, b, 2*i+1, l, (l+r)/2);
            int vr = query(a, b, 2*i+2, (l+r)/2, r);
            return f(vl, vr);
        }
    }
};

int main(){
    int N;
    cin >> N;
    ll e[N];
    e[0] = 1;
    rep2(i, 1, N-1) e[i] = (2*e[i-1])%MOD2;
    int x[N], y[N];
    vector<P> vecx, vecy, vec;
    rep(i, N){
        cin >> x[i] >> y[i];
        vecx.push_back(P(x[i], i));
        vecy.push_back(P(y[i], i));
    }
    sort(vecx.begin(), vecx.end());
    sort(vecy.begin(), vecy.end());
    rep(i, N){
        int px = vecx[i].second, py = vecy[i].second;
        x[px] = i, y[py] = i;
    }
    rep(i, N) vec.push_back(P(x[i], y[i]));
    sort(vec.begin(), vec.end());
    int X[N], Y[N];
    rep(i, N) X[i] = vec[i].first, Y[i] = vec[i].second;
    segment_tree segl(N), segr(N);
    ll n = segl.size();
    ll ul[N], ur[N], dl[N], dr[N];
    rep(i, N){
        dl[i] = segl.query(0, Y[i], 0, 0, n);
        ul[i] = i - dl[i];
        segl.update(Y[i], 1);
    }
    rep3(i, N-1, 0){
        dr[i] = segr.query(0, Y[i], 0, 0, n);
        ur[i] = N-1-i - dr[i]; 
        segr.update(Y[i], 1);
    }
    ll ans = (N*e[N-1])%MOD2;
    rep(i, N){
        ll a = (e[ul[i]]-1)*(e[dr[i]]-1) % MOD2;
        ll b = (e[ur[i]]-1)*(e[dl[i]]-1) % MOD2;
        ans += a * e[ur[i]+dl[i]];
        ans %= MOD2;
        ans += b * e[ul[i]+dr[i]];
        ans %= MOD2;
        ans += MOD2*MOD2 - a*b;
        ans %= MOD2;
    }
    cout << ans << endl;
}

Measured memory_bytes: 34780
import collections
n = int(input())
a = list(map(int, input().split()))
x = []
for i in range(n):
    x.append(a[i]-i)
y = []
for j in range(n):
    y.append(-(a[j]+j))
    
X = collections.Counter(x)
Y = collections.Counter(y)



ans = 0
z = X.keys()
#print(z)
for i in z:
    p =X.get(i,0)
    q =Y.get(i,0)
    ans += p*q
print(ans)
    

Measured memory_bytes: 63672
#include <bits/stdc++.h>
#include <math.h>
#define _GLIBCXX_DEBUG
using namespace std;
int main() {

  int H,A;cin>>H>>A;
  
  if(H%A==0){
    cout<<H/A<<endl;
  }
  else if(H%A!=0){
    cout<<1+H/A<<endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <vector>
#include <stack>
#include <cstdio>
#include <string>
#include <bitset>
#include <list>
#include <set>
#include <algorithm>
#include <numeric>
#include <unordered_map>
#include <functional>
#include <queue>
// #include "bits/stdc++.h"

using namespace std;
//debug

#define rep(i, N) for (int i = 0; i < N; i++)
#define rep2(i, N, M) for (int i = N; i < M; i++)
#define pb push_back



typedef long long ll;
typedef pair<ll, ll> pll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<string> vs;
typedef priority_queue<pll, vector<pll>, greater<pll>> greater_pq ;


#define all(a)  (a).begin(),(a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define vec(a) vector<a>

void f(string& str) {
	str.insert(str.begin(), str.back());
	str.pop_back();
}

int main() {
	string a, b;
	cin >> a >> b;
	rep(i, a.size()+1) {
		f(a);
		if (a == b) {
			cout << "Yes";
			return 0;
		}
	}
	cout << "No";
	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, N) for (int i = 0; i < (int)N; ++i)
#define all(a) (a).begin(), (a).end()
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}

long long lcm(long long a, long long b) { return a * b / gcd(a, b); }

int N, M;

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

  set<int> a;

  set<int> b;
  rep(i, N) {
    int k;
    cin >> k;
    k /= 2;
    a.insert(k);
    int j = 0;
    while (((k >> j) & 1) == 0) ++j;
    b.insert(j);
  }

  if (b.size() >= 2) {
    cout << 0 << endl;
    return 0;
  }

  ll cm = 1;
  for (auto it = a.begin(); it != a.end(); it++) {
    cm = lcm(cm, *it);
  }

  int ans = (M / cm + 1) / 2;

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 384
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<string>
#include<cmath>
#include<numeric>
#include<vector>
#include<tuple>
using namespace std;
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define vint vector<int> 
#define vvint vector<vint>
#define ct(a) cout<<a<<endl
typedef long long ll;
const int MOD = 1e9 + 7;

int H;

int main(void)
{
	cin >> H;
	ct(H*(H + 1) / 2);
	return 0;
}


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

int main() {
  int N;
  ll K;
  cin >> N >> K;
  int a[N];

  rep(i, N) {
    cin >> a[i];
  }

  ll p = 0;
  for (int i = 0; i < N; i++) {
    for (int j = i; j < N; j++) {
      if (a[i] > a[j]) p++;
    }
  }

  ll q = 0;
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < N; j++) {
      if (a[i] > a[j]) q++;
    }
  }

  ll ans = p*K % 1000000007 + (q % 1000000007) * (K*(K-1)/2 % 1000000007);
   cout << ans % 1000000007 << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  vector<int> d(N,0);
  int ans = 1;
  for (int i = 0; i < N; i++) {
    cin >> d[i];
  }
  sort(d.begin(),d.end());
  for (int i = 1; i < N; i++) {
    if (d[i-1] < d[i]) {
      ans++;
    }
  }
  cout << ans;
}

Measured memory_bytes: 256
n, x = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
ans = 0
for i in a:
    x-=i
    if x<0:
        print(ans)
        break
    ans += 1
else:
    if x==0:
        print(ans)
    else:
        print(ans-1)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define fo(i, a, b) for (int i = a; i < b; i++)
#define re(i, n) fo(i, 0, n)
#define pb push_back
#define all(s) s.begin(), s.end()
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<double> vd;
typedef vector<string> vs;
int main()
{
  vi n(5), a(5);
  re(i, 5) {
    cin >> n[i];
    a[i] = ((n[i] + 9) / 10) * 10;
  }

  int m = 0, p = 0;
  re(i, 5) {
    m = a[i] - n[i];
    if (p < m) {
      p = m;
    }
  }

  int s = 0;
  re(i, 5) s += a[i];

  cout << s - p << endl;

  return 0;
}


Measured memory_bytes: 256
//by yjz
#include<bits/stdc++.h>
#define FF first
#define SS second
#define MP make_pair
#define PB push_back
typedef long long ll;
using namespace std;
const int mod = 998244353;
int qpow(int x, int k) {return k==0?1:1ll*qpow(1ll*x*x%mod, k>>1)*(k&1?x:1)%mod;}
const int maxn = 1<<18;
int n;
void FWT(int a[])
{
	for (int i=0; i<n; i++)
	{
		for (int j=0; j<(1<<n); j++)
		{
			if (((j>>i)&1)) continue;
			int tmp = a[j+(1<<i)];
			a[j+(1<<i)] = (a[j]-tmp)%mod;
			a[j] = (a[j]+tmp)%mod;
		}
	}
}
void IFWT(int a[])
{
	for (int i=0; i<n; i++)
	{
		for (int j=0; j<(1<<n); j++)
		{
			if (((j>>i)&1)) continue;
			int tmp = a[j+(1<<i)];
			a[j+(1<<i)] = (a[j]-tmp)%mod;
			a[j] = (a[j]+tmp)%mod;
		}
	}
	int inv = qpow(1<<n, mod-2);
	for (int i=0; i<(1<<n); i++) a[i] = 1ll*a[i]*inv%mod;
}

int a[maxn];
int b[maxn];
int ans[maxn];
int main()
{
	scanf("%d", &n);
	int sum = 0;
	for (int i=0; i<(1<<n); i++) scanf("%d", &a[i]), sum += a[i];
	int inv_sum = qpow(sum, mod-2);
	for (int i=0; i<(1<<n); i++) a[i] = 1ll*a[i]*inv_sum%mod;
	FWT(a);
	ll Qd = 0;
	for (int i=1; i<(1<<n); i++)
	{
		Qd = (Qd+qpow(a[i]-1, mod-2))%mod;
	}
	for (int i=1; i<(1<<n); i++)
	{
		assert((a[i]-1)%mod!=0);
		ans[i] = qpow(a[i]-1, mod-2);
//		1ll*qpow((1-a[i]), mod-2)*Qd%mod;
	}
	for (int i=1; i<(1<<n); i++) ans[0] = (ans[0]-ans[i])%mod;
	FWT(ans);
	for (int i=0; i<(1<<n); i++)
	{
		printf("%d\n", (ans[i]%mod+mod)%mod);
	}
    return 0;
}

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

using ll = long long;
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define REP(i, n) FOR(i, 0, n)
#define ALL(c) (c).begin(), (c).end()
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;}
const int MOD = 1000000007;

int main() {
    int n;
    cin >> n;
    vector<ll> a(n + 1);
    vector<ll> b(n);
    REP(i, n + 1) {
        cin >> a[i];
    }
    REP(i, n) {
        cin >> b[i];
    }
    vector<ll> c = a;
    vector<ll> d = b;
    reverse(ALL(c));
    reverse(ALL(d));
    ll t = 0;
    REP(i, n) {
        if (a[i] >= b[i]) {
            t += b[i];
        } else {
            t += a[i];
            b[i] -= a[i];
            if (a[i + 1] >= b[i]) {
                t += b[i];
                a[i + 1] -= b[i];
            } else {
                t += a[i + 1];
                a[i + 1] = 0;
            }
        }
    }
    ll u = 0;
    REP(i, n) {
        if (c[i] >= d[i]) {
            u += d[i];
        } else {
            u += c[i];
            d[i] -= c[i];
            if (c[i + 1] >= d[i]) {
                u += d[i];
                c[i + 1] -= d[i];
            } else {
                u += c[i + 1];
                c[i + 1] = 0;
            }
        }
    }

    cout << max(t, u) << endl;
}


Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll MOD = 1e9 + 7;
const ll INF = LLONG_MAX;
using Tree = vector<pair<int, int>>;

int main()
{
    ll n;
    cin >> n;
    vector<ll> a(n + 1), b(n);
    for (int i = 0; i < n + 1; i++)
    {
        cin >> a[i];
    }
    for (int i = 0; i < n; i++)
    {
        cin >> b[i];
    }
    ll ans = 0;
    for (int i = 0; i < n; i++)
    {
        ll tmp = min(a[i], b[i]);
        ans += tmp;
        b[i] -= tmp;
        a[i] -= tmp;
        if (b[i] > 0)
        {
            ll hoge = min(a[i + 1], b[i]);
            ans += hoge;
            b[i] -= hoge;
            a[i + 1] -= hoge;
        }
    }
    cout << ans << endl;
}

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

int main()
{
    int l, r, d;
    cin >> l >> r >> d;

    int s = 0;

    for (int i = 1; i <= 100; ++i) {
        int x = d * i;
        if (l <= x && x <= r) ++s;
    }

    cout << s << endl;

    return 0;
}


Measured memory_bytes: 3220
#include <bits/stdc++.h>
using namespace std;
#define modulo 1000000007
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 1000000000


int main(){
	
	int N;
	cin>>N;
	
	map<int,int> mp;
	
	for(int i=0;i<N;i++){
		int D;
		cin>>D;
		mp[D]++;
	}
	
	int M;
	cin>>M;
	
	vector<int> T(M);
	
	for(int i=0;i<M;i++){
		cin>>T[i];
	}
	
	for(int i=0;i<M;i++){
		if(mp[T[i]]<=0){
			cout<<"NO"<<endl;
			return 0;
		}
		mp[T[i]]--;
	}
	
	cout<<"YES"<<endl;
	
	return 0;
}

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

int main(){
  int64_t n;
  cin >>n;
  map<int,int>a;
  int64_t tmp,ans=0;
  for(int64_t i=0;i<n;i++){
    cin >>tmp;
    ans+=tmp;
    if(a.count(tmp))
    	a.at(tmp)++;
    else
      a[tmp]=1;
  }
  int64_t q;
  cin >>q;
  for(int64_t i=0;i<q;i++){
    int64_t tmp1,tmp2;
    cin >>tmp1>>tmp2;
    if(a.count(tmp1)){
      if(a.count(tmp2)){
   	  a.at(tmp2)+=a.at(tmp1);
   	  ans-=tmp1*a.at(tmp1);
      ans+=tmp2*a.at(tmp1);
      a.at(tmp1)=0;
      }
     else{
       a[tmp2]=0;
       a.at(tmp2)+=a.at(tmp1);
   	  ans-=tmp1*a.at(tmp1);
      ans+=tmp2*a.at(tmp1);
      a.at(tmp1)=0;
     }
    }
    cout <<ans<<endl;
  }
}

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

#define ll long long

using namespace std;

ll a[100004], n;
int main() {
    cin >> n;
    ll m1 = 0, sign = 1;
    for (int i = 1; i <= n; ++i) {
        cin >> a[i];
        m1 += a[i] * sign;
        sign = -sign;
    }
    cout << m1 << " ";
    for (int i = 1; i < n; ++i) {
        m1 = 2 * a[i] - m1;
        cout << m1 << " ";
    }
    return 0;
}


Measured memory_bytes: 2048
import numpy as np

S = input()

moji = [i for i in S]

a = moji[0]
for i in range(len(moji)):
    if a != moji[i]:
        b = moji[i]
count = 0
count2 = 0
for i in range(0,len(moji)):
    if moji[i] == a:
        count += 1
    elif moji[i] == b:
        count2 += 1
if count == 2 and count2 == 2:
    print("Yes")
else:
    print("No")

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

template <typename T, T Op(T, T), T Unit = T()>
    class SegmentTree {
 public:
  SegmentTree(int size) {
    int two = 1;
    while (two < size) {
      two <<= 1;
    }
    v_.resize(two * 2 - 1, Unit);
  }
  void Set(int i, T v) {
    int index = v_.size() / 2 + i;
    while (true) {
      v_[index] = v;
      if (index == 0) break;
      v = Op(v, v_[index + (index % 2 == 0 ? -1 : 1)]);
      index = (index - 1) / 2;
    }
  }
  T Get(int i) const { return Aggregate(i, i + 1); }
  T Aggregate(int begin, int end) const {
    return aggregate(begin, end, 0, (v_.size() + 1) / 2, 0);
  }

 private:
  T aggregate(int begin, int end, int cbegin, int cend, int index) const {
    if (begin <= cbegin && cend <= end) {
      return v_[index];
    }
    if (cend <= begin || end <= cbegin) {
      return Unit;
    }
    int cmid = (cbegin + cend) / 2;
    return Op(aggregate(begin, end, cbegin, cmid, index * 2 + 1),
              aggregate(begin, end, cmid, cend, index * 2 + 2));
  }
  std::vector<T> v_;
};

// #undef DEBUG  // Uncomment this line to forcefully disable debug print.
#if DEBUG
template <typename T>
void debug(T value) {
  std::cerr << value;
}
template <typename T, typename... Ts>
void debug(T value, Ts... args) {
  std::cerr << value << ", ";
  debug(args...);
}
#define DBG(...)                              \
  do {                                        \
    cerr << #__VA_ARGS__ << ": ";             \
    debug(__VA_ARGS__);                       \
    cerr << " (L" << __LINE__ << ")" << endl; \
  } while (0)
#else
#define DBG(...)
#endif

#define ALL(x) (x).begin(), (x).end()
#define FOR(i, n) for (auto i : (n))
#define REP(i, n) for (int i = 0; i < (int)(n); ++i)

using ll = long long;

using namespace std;

int Union(int a, int b) { return a | b; }
int PopCount(int x) {
  int cnt = 0;
  REP(i, 26) if ((x >> i) & 1) ++cnt;
  return cnt;
}

int main() {
  int N;
  cin >> N;
  SegmentTree<int, Union> tree(N);
  string S;
  cin >> S;
  REP(i, N) tree.Set(i, 1 << (S[i] - 'a'));
  REP(i, N) DBG(i, tree.Get(i));
  int Q;
  cin >> Q;
  REP(q, Q) {
    int t;
    cin >> t;
    if (t == 1) {
      int i;
      char c;
      cin >> i >> c;
      tree.Set(i - 1, 1 << (c - 'a'));
    } else {
      int l, r;
      cin >> l >> r;
      cout << PopCount(tree.Aggregate(l - 1, r)) << endl;
    }
  }
}


Measured memory_bytes: 4996
#include <bits/stdc++.h>
 
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n)  for(int i=0;i<(n);++i)
#define REPr(i, n) for(int i=(n)-1;i>=0; --i)
#define FORq(i, m, n) for(int i = (m);i <= (n);++i)
#define FORqr(i, m, n) for(int i = (n);i >=(m);--i)
#define PB push_back
#define MP make_pair
#define DEBUG printf("%s\n","debug")
#define fst first
#define snd second
#define SIN(x, S) (S.count(x) != 0)
#define M0(x) memset(x,0,sizeof(x))
#define FILL(x, y) memset(x,y,sizeof(x))
#define MM(x) memset(x,-1,sizeof(x))
#define ALL(x) (x).begin(),(x).end()
using namespace std;
typedef pair<int, int> PII;
typedef pair<long long, long long> PLL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<long long> VL;
typedef long long ll;
typedef long long integer;
///////////////////////////////////////////////
/* (๑╹◡╹) */
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
ll MOD = 1000000007;
template<class T>
inline bool chmin(T &a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
 /* (๑╹◡╹)(๑╹◡╹)(๑╹◡╹)*/
template<class T>
inline bool chmax(T &a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}
/* (๑╹◡╹)(๑╹◡╹)(๑╹◡╹)(๑╹◡╹)(๑╹◡╹)(๑╹◡╹) */
///////////////////////////////////////////////


int main() {
int ans2 = 0;
long double W,H;
	ll x,y; cin >> W >> H >> x >> y;

	long double S1 = W * H /2; 
	if(x == W-x)
	{
		if(y == H - y){ans2 = 1;}
	}

	


	cout << S1 << ' ' << ans2 << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
#define ll          long long int
#define ld          long double
#define pb          push_back
#define mp          make_pair
#define ff          first
#define se          second
#define endl        '\n'
#define fd(n)       fixed<<setprecision(n)
#define MAX         100000000000000000
#define MAXN        1000005
#define mod         1000000007  
#define pi          3.1415926535897932384626433
 
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll x;
    cin>>x;
    cout<<1-x;
}

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

class Dice{
    public:
    int face[6];
    Dice(int *x){
    for(int i=0;i<6;i++){
        face[i]=x[i];
    }
    }
void roll_N(){
    int a=face[0],b=face[1],c=face[5],d=face[4];
    face[0]=b;face[1]=c;face[5]=d;face[4]=a;
}
void roll_W(){
    int a=face[0],b=face[2],c=face[5],d=face[3];
    face[0]=b;face[2]=c;face[5]=d;face[3]=a;
}
void roll_S(){
    int a=face[0],b=face[4],c=face[5],d=face[1];
    face[0]=b;face[4]=c;face[5]=d;face[1]=a;
}
void roll_E(){
    int a=face[0],b=face[3],c=face[5],d=face[2];
    face[0]=b;face[3]=c;face[5]=d;face[2]=a;
}
int answer(){
    return face[0];
}
};

int main(){
    int x[6];
    string order;
    for(int i=0;i<6;i++)cin>>x[i];
    Dice d(x);
    cin>>order;
    for(int i=0;i<order.size();i++){
        if(order[i]=='N')d.roll_N();
        if(order[i]=='S')d.roll_S();
        if(order[i]=='E')d.roll_E();
        if(order[i]=='W')d.roll_W();
    }
    cout<<d.answer()<<endl;
    return 0;
}


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

using namespace std;

const int N=1e5+10;

int n,a[N],dep[N],app[N];

void Init()
{
	scanf("%d",&n);
	for (int i=1;i<=n;++i) scanf("%d",&a[i]),app[a[i]]++;
}

void Solve()
{	
	sort(a+1,a+n+1); reverse(a+1,a+n+1);
	
	bool fl=1;
	
	if (a[n]!=(a[1]+1)/2) fl=0;
	
	for (int i=a[n]+1;i<a[1];++i) if (app[i]<2) fl=0;
	
	if (a[1]&1 && app[a[n]]!=2) fl=0;
	
	if (!(a[1]&1) && app[a[n]]!=1) fl=0;
	
	if (fl) printf("Possible\n");
	else printf("Impossible\n");
}

int main()
{
	Init();
	Solve();
	return 0;
}


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

using namespace std;

bool solve(int N, int A, int B, int C, int D, string S)
{
  if (C < D) {
    for (int i = A; i < D; i++) {
      if (S[i] == '#' && S[i+1] == '#') {
        return false;
      }
    }
    return true;
  } else {
    for (int i = B-1; i <= D-1; i++) {
      if (S[i] == '.' && S[i+1] == '.' && S[i+2] == '.') {
        return true;
      }
    }
    return false;
  }
}

int main()
{
  int N, A, B, C, D;
  cin >> N;
  cin >> A;
  cin >> B;
  cin >> C;
  cin >> D;

  string S;
  cin >> S;

  if (solve(N, A-1, B-1, C-1, D-1, S)) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }

  return 0;
}


Measured memory_bytes: 772
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <cmath>
#define rep(i,n) for (int i = 0; i < n; ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;

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

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#include <unordered_map>
#include <unordered_set>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
 
/*** Template Begins ***/
 
typedef long long    ll;
typedef pair<ll,ll>  pll;
typedef pair<ll, pair<int, int> > plll;
typedef vector<long long>  vll;
typedef vector<pll>  vp;
typedef long double ld;
#define pb           push_back
#define INF          INT_MAX/10
#define F            first
#define S            second
// #define mp           make_pair
#define ios          ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define hell         1000000007LL
// #define h 998244353
#define all(a)       (a).begin(),(a).end()
ll power(ll x, ll y, ll p)
{
  ll res = 1;
  x = x % p;
  while (y > 0)
  { 
    if (y & 1) 
      res = (res*x) % p;
    y = y>>1;
    x = (x*x) % p;
  } 
  return res; 
} 
const int MAXN = 2e5+5;

// Debug //
#define trace(x)                 cerr << #x << ": " << x << endl;
#define trace1(x)                cerr << #x << ": " << x << endl;
#define trace2(x, y)             cerr << #x << ": " << x << " | " << #y << ": " << y << endl;
#define trace3(x, y, z)          cerr << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " << z << endl;
#define trace4(a, b, c, d)       cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << endl;
#define trace5(a, b, c, d, e)    cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl;
#define trace6(a, b, c, d, e, f) cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << " | " << #f << ": " << f << endl;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
template <typename T>
using ordered_set = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;
ll euclid(ll x,ll y,ll a,ll b)
{
  return (a-x)*(a-x)+(b-y)*(b-y);
}
// Constants //
bool comp(ll a,ll b)
{
  return a>b;
}
void solve()
{
  set<string> s;
  ll n,i;
  cin>>n;
  string x;
  for(i=0;i<n;i++)
  {
    cin>>x;
    s.insert(x);
  }
  cout<<s.size();
}

int main()
{ 
  ios;
  // freopen("input.txt", "r", stdin);
  // freopen("output.txt", "w", stdout);
  ll t,i;
  t=1;
  // cin>>t;
  while(t--)
  {
    solve();
    // cout<<endl;
  }
  return 0;
}

Measured memory_bytes: 19248
#include <bits/stdc++.h>
using namespace std;
int main() {
  string S;
  string divide[4] = {"dream", "dreamer", "erase", "eraser"};
  cin >> S;
  reverse(S.begin(), S.end());
  for (int i = 0; i < 4; ++i) reverse(divide[i].begin(), divide[i].end());
  bool can = true;
  for (int i = 0; i < S.size();) {
    bool can2 = false;
    for (int j = 0; j < 4; ++j) {
      string d = divide[j];
      if (S.substr(i, d.size()) == d) {
        can2 = true;
        i += d.size();
      }
    }
    if (!can2) {
      can = false;
      break;
    }
  }
  if (can) cout << "YES" << endl;
  else cout << "NO" << endl;
}

Measured memory_bytes: 512
import * as fs from 'fs';

const [s1, s2, s3]: string[] = fs.readFileSync('/dev/stdin', 'utf8').trim().split(' ');

const ans: string = s1.substring(0, 1).toUpperCase() + s2.substring(0, 1).toUpperCase() + s3.substring(0, 1).toUpperCase();
console.log(ans);



Measured memory_bytes: 7372
#include<vector>
#include<iostream>
using namespace std;
using ll = long long;

int main() {
	ll N;
	cin >> N;

	int MOD = 1000000007;
	ll sum = 0;
	vector<ll>A(N);
	for (int i = 0; i < N; i++) {
		cin >> A[i];
		sum += A[i];
		sum %= MOD;
	}

	ll ans = 0;

	for (int i = 0; i < N; i++) {
		sum -= A[i];
		if (sum < 0) sum += MOD;

		ans += A[i] * sum;
		ans %= MOD;
	}

	cout << ans << endl;

}

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

int main() {
	string s;
	getline(cin, s);

	if (s == "1 1 0")cout << "Open" << endl;
	else if (s == "0 0 1")cout << "Open" << endl;
	else cout << "Close" << endl;
	return 0;
}

Measured memory_bytes: 3128
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <algorithm>
#include <cmath>
#include <ios>
#include <ctype.h>
#include <stack>
#include <istream>
#include <stdio.h>
#include <map>
#include <set>
#include <queue>
#include <unordered_map>
#include <functional>
#include <bitset>
#include <list>
#include <deque>
#include <time.h>
#include <random>
#include <iomanip>
#include <fstream>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define REP(i,a,b) for (int i = a; i < (b); ++i)
#define all(x) (x).begin(),(x).end()
#define pint pair<int,int>
const int INF = 1000000007;
const long double EPS = 1e-15;
const long double PI = acos(-1);
typedef long long ll;
using namespace std;
using Graph = vector<vector<int>>;
using Graph_weighted = vector<vector<pair<int,int>>>;
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll lcm(ll a, ll b) { return (a * b) / gcd(a,b); }
ll ceil(const ll a, const ll b) { return (a + b - 1) / b; }
int main(){
  int a,b;
  cin >> a >> b;
  if(a <= b)cout << "unsafe" << endl;
  else cout << "safe" << endl;
  return 0;
}


Measured memory_bytes: 3636
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Scanner;

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

    long M = 1_000_000_007;
    int N = scanner.nextInt();
    int[] primes = primes(1_000_000);
    int[] A = new int[N];
    Map<Integer, Integer> map = new HashMap<>();
    for (int i = 0; i < N; i++) {
      A[i] = scanner.nextInt();
      Map<Integer, Integer> factors = primeFactors(A[i], primes);
      for (Map.Entry<Integer, Integer> e : factors.entrySet()) {
        map.put(e.getKey(), Math.max(map.getOrDefault(e.getKey(), 0), e.getValue()));
      }
    }
    long lcm = 1;
    for (Map.Entry<Integer, Integer> f : map.entrySet()) {
      lcm *= modpow(f.getKey(), f.getValue(), M);
      lcm %= M;
    }

    long res = 0;
    for (int i = 0; i < N; i++) {
      res += lcm * inverse(A[i], M) % M;
      if (res >= M) res -= M;
    }
    System.out.println(res);
  }

  private static long inverse(long a, long mod) {
    return modpow(a, mod - 2, mod);
  }
  
  private static long modpow(long a, long n, long mod) {
    long res = 1;
    while (n > 0) {
      if (n % 2 == 1) res = (res * a) % mod;
      a = (a * a) % mod;
      n >>= 1;
    }
    return res % mod;
  }

  public static int[] primes(int n) {
    boolean[] isNotPrime = new boolean[n + 1];
    isNotPrime[0] = isNotPrime[1] = true;
    for (int i = 2; i < Math.sqrt(n); i++) {
      if (!isNotPrime[i]) {
        for (int j = 2; i * j <= n; j++) {
          isNotPrime[i * j] = true;
        }
      }
    }
    final List<Integer> ls = new ArrayList<>();
    for (int i = 2; i <= n; i++) if (!isNotPrime[i]) ls.add(i);
    int[] res = new int[ls.size()];
    for (int i = 0; i < ls.size(); i++) res[i] = ls.get(i);
    return res;
  }

  public static Map<Integer, Integer> primeFactors(int n, int[] primes) {
    Map<Integer, Integer> map = new HashMap<>();
    for (int p : primes) {
      if (p * p > n) break;
      int count = 0;
      while (n % p == 0) {
        count++;
        n /= p;
      }
      if (count > 0) {
        map.put(p, count);
      }
    }
    if (n > 1) map.put(n, 1);

    return map;
  }
}


Measured memory_bytes: 45616
/*
CODED BY               
**************
DARSHAN JAIN
darshanjain31
**************
*/
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define mp make_pair
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);
#define endl '\n'
#define MOD 1000000007
int main()
{
    fast
    ll n,k;
    cin>>n>>k;
    ll arr[n+2];
    for(int i=1;i<=n;i++){
        cin>>arr[i];
    }
    vector<ll> v;
    int vis[n+2]={0};
    int node=1;
    k++;
    ll mid=node;
    node+=10;
    node+=10;
    node+=10;
    node+=10;
    node+=10;
    node+=10;
    node+=10;
    node+=10;
   	node=mid;
    while(1)
    {
        vis[node]=1;
        v.push_back(node);
        node=arr[node];
        if(vis[node]==1)
        {
            if(v.size()>=k){
                cout<<v[k-1]; return 0;
            }
            int idx=1;
            for(int i=v.size()-1;i>=0;i--)
            {
                if(v[i]==node) {
                    
                    k-=i;
                    ll sz=v.size()-i;
                    k--;
                    k%=sz;
                    cout<<v[i+k];
                    return 0;
                }
            }
            break;
        }
    }
}

Measured memory_bytes: 7660
import numpy as np
N = int(input())
F = [[int(x) for x in input().split()] for _ in range(N)]
P = [[int(x) for x in input().split()] for _ in range(N)]

import itertools
answer = -(10 ** 18)
for a in itertools.product([0,1], repeat = 10):
  if sum(a) == 0:
    continue
  profit = 0
  for shop in range(N):
    profit += P[shop][sum(a[i]*F[shop][i] for i in range(10))]
  if answer < profit:
    answer = profit

print(answer)
  

Measured memory_bytes: 12440
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
void max1(int a, int b, int c)
{
	if (a >= b&&a >= c)printf("%d\n", a);
	else if(a <= b&& b >= c)printf("%d\n", b);
	else printf("%d\n", c);
}
int main()
{
	int a, b,plus,minus,kake;
	scanf("%d%d", &a, &b);
	plus = a + b;
	minus = a - b;
	kake = a*b;
	max1(plus, minus, kake);
	return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<bitset>
using namespace std;

int main(){
	int n;
	int a[2002];
	scanf("%d",&n);
	for(int i = 0 ; i < n ; i ++){
		scanf("%d",&a[i]);
	}
	
	bitset<4000010> B;
	B[0] = true;
	for(int i = 0 ; i < n ; i ++){
		B |= B << a[i];
	}
	
	int sum = 0 ;
	for(int i = 0 ; i < n ; i ++){
		sum += a[i];
	}
	for(int i = (sum+1)/2 ; i <= sum ; i ++){
		if(B[i]){
			cout << i << endl;
			return 0;
		}
	}
}



Measured memory_bytes: 1664
N, Y = list(map(int, input().split()))
answer = [-1, -1, -1]

for x in range(N + 1):
    if Y < 0: break
    elif Y == 0 and x == N:
        answer = [x, 0, 0]
        break
    else:
        for y in range(N + 1 - x):
            if Y == (y * 5000 + (N - x - y) * 1000):
                answer = [x, y, N - x - y]
                Y = 0
                break
            elif Y < (y * 5000 + (N - x - y) * 1000): break
    Y -= 10000

print(answer[0], answer[1], answer[2])

Measured memory_bytes: 3064
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <bitset>
#include <string>
#include <cmath>
#include <complex>
#include <numeric>
#include <cassert>

#include <vector>
#include <array>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <utility>

#define int64 long long
#define uint64 unsigned long long
using namespace std;

int main()
{
	int64 nn;
	cin >> nn;
	vector<int64> aa(nn);
	for(int64 ii = 0;ii < nn;ii++)
	{
		cin >> aa[ii];
	}
	sort(aa.begin(), aa.end());
	reverse(aa.begin(), aa.end());
	int64 ans = aa[0], cnt = 2;
	for(int64 ii = 1;ii < nn;ii++)
	{
		if(cnt == nn)
		{
			break;
		}
		ans += aa[ii];
		cnt++;
		if(cnt == nn)
		{
			break;
		}
		ans += aa[ii];
		cnt++;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 4836
def d_factorization(N, M):
    def prime_factorization_dict(n):
        if n == 1:
            return {2: 0}  # 1は素数の0乗の積とみなす
        i = 2
        table = {}
        while i**2 <= n:
            table[i] = 0
            while n % i == 0:
                table[i] += 1
                n //= i
            if table[i] == 0:
                table.pop(i)
            i += 1
        if n > 1:
            table[n] = 1
        return table

    class Combination(object):
        def __init__(self, n, mod):
            self.mod = mod
            # フェルマーの小定理による組合せの計算
            self.factorial = [1] * (n + 1)  # 0!からn!の結果を格納
            for k in range(1, n):
                self.factorial[k + 1] = (self.factorial[k] * (k + 1)) % mod
            # k!のmodにおける逆元を計算
            self.fact_inv = [1] * (n + 1)
            self.fact_inv[n] = pow(self.factorial[n], mod - 2, mod)
            for k in reversed(range(1, n + 1)):
                self.fact_inv[k - 1] = (self.fact_inv[k] * k) % mod

        def comb(self, n, r):
            if n < 0 or r < 0 or n < r:
                return 0
            return (self.factorial[n] * self.fact_inv[r] * self.fact_inv[n - r]) % self.mod

        def comb_with_repetition(self, n, r):
            if n == 0 and r > 0:
                return 0
            if n >= 0 and r == 0:
                return 1
            return self.comb(n + r - 1, r)

    MOD = 10**9 + 7
    prime_m = prime_factorization_dict(M)
    c = Combination(max(prime_m.values()) + N - 1, MOD)
    ans = 1
    for b in prime_m.values():
        ans = (ans * c.comb_with_repetition(N, b)) % MOD

    return ans

N, M = [int(i) for i in input().split()]
print(d_factorization(N, M))

Measured memory_bytes: 10868
import java.util.*;
import java.io.*;
public class Main {

	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer(br.readLine());
		int x = Integer.parseInt(st.nextToken());
		int a = Integer.parseInt(st.nextToken());
		System.out.println(x < a ? 0: 10);
	}

}


Measured memory_bytes: 20564
import java.util.Scanner;

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

            int a = sc.nextInt();
            int b = sc.nextInt();
            int c = sc.nextInt();
            int i, count = 0;

            for(i = a; i <= b; i++){
                if(c % i == 0){
                    count += 1;
                }
            }

            System.out.println(count);

    }
}


Measured memory_bytes: 26236
IDENTIFICATION DIVISION.
        PROGRAM-ID. AtCoder.
      
        ENVIRONMENT DIVISION.
      
        DATA DIVISION.
        WORKING-STORAGE SECTION.
        01 INP PIC X(100).
        01 A PIC 9(05)V9(15).
        01 B PIC 9(05)V9(15).
      	01 C PIC 9(05)V9(15).
      	01 E PIC 9(05)V9(15).
      	01 D PIC ZZZZZZZZZ.
      	01 X PIC 9(15).
      	01 Y PIC 9(15).
      	01 W PIC 9(15).
      	01 F PIC 9(10).
      	01 t PIC 9(15).
	    01 temp1 PIC 9(15).
        01 temp2 PIC 9(15).
      	01 temp3 PIC 9(15).
        01 N PIC 9(15).
        PROCEDURE DIVISION.
      	MAIN.
      		ACCEPT INP.
			PERFORM VARYING temp1 FROM 1 BY 1
            UNTIL INP(temp1:1) = SPACE
        	END-PERFORM.
        	SUBTRACT 1 FROM temp1.
        	MOVE INP(1:temp1) TO A.
        	ADD 2 TO temp1.
        	PERFORM VARYING temp2 FROM temp1 BY 1
            UNTIL INP(temp2:1) = SPACE
        	END-PERFORM.
        	COMPUTE N = temp2 - temp1.
        	MOVE INP(temp1:N) TO B.
      		ADD 1 TO temp2.
      		PERFORM VARYING temp3 FROM temp2 BY 1
            UNTIL INP(temp3:1) = SPACE
        	END-PERFORM.
        	COMPUTE N = temp3 - temp2.
        	MOVE INP(temp2:N) TO C.
      		COMPUTE A = A - B.
      		IF C > A THEN
      			COMPUTE D = C - A
      			DISPLAY D
      		ELSE
      			DISPLAY "0"
      		END-IF.
		STOP RUN.

Measured memory_bytes: 384
import std.stdio;
import std.conv;
import std.string;
import std.typecons;
import std.algorithm;
import std.array;
import std.range;
import std.math;
import std.regex : regex;
import std.container;
import std.bigint;
import std.ascii;


void main()
{
  int n, a, b;
  int res;
  readf("%s %s %s\n", &n, &a, &b);
  foreach (i; 0..1000) {
    if (a + 1 == b) {
      a--;
    } else {
      a++;
    }
    if (a < 1) {
      res = -1;
      break;
    }

    if (b - 1 == a) {
      b++;
    } else {
      b--;
    }
    if (b > n) {
      res = 1;
      break;
    }
  }

  if (res == 1) {
    writeln("Alice");
  } else if (res == -1) {
    writeln("Borys");
  } else {
    writeln("Draw");
  }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll,ll> pll;
const ll mod=1e9+7;
//const ll mod=998244353;
const ll inf=1LL<<61;

int main() {
  ll n;
  cin >> n;
  vec a(n);
  for(ll i=0;i<n;i++) cin >> a[i];
  ll ans=inf;
  for(ll i=-100;i<=100;i++) {
    ll tans=0;
    for(ll j=0;j<n;j++) tans+=(a[j]-i)*(a[j]-i);
    ans=min(ans,tans);
  }
  cout << ans << endl;
}

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

template <typename T>
void print(const T &v);

int main()
{
    ll n;
    cin >> n;
    string name;
    while (n != 0)
    {
        int amari = n % 26;
        if (amari == 0)
        {
            name.push_back('z');
            --n;
        }
        else
        {
            name.push_back(char(amari - 1 + 'a'));
        }
        n /= 26;
    }
    reverse(name.begin(), name.end());
    cout << name << endl;
}

// Use For Debug
template <typename T>
void print(T const &v)
{
    for (int i = 0; i < v.size(); i++)
    {
        if (i)
            cout << " ";
        cout << v[i];
    }
    cout << endl;
}


Measured memory_bytes: 3628
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <complex>
#include <cstring>
#include <cstdlib>
#include <string>
#include <cmath>
#include <queue>
#include <map>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
const int INF = 1<<30;

char hage[] = {'r','g','b'};
char hoge(char a, char b) {
  REP(i,3)
    if (a != hage[i] && b != hage[i])
      return hage[i];
}
typedef pair<int, string> pis;

int bfs(string s) {
  int res = INF;
  queue<pis> Q;
  map<string, bool> ma;
  Q.push(pis(0,s));
  while(!Q.empty()) {
    pis p = Q.front(); Q.pop();
    string ss = p.second;
    if (ma[ss]) continue;
    ma[ss] = true;
//    cout << p.first << " " <<ss << endl;
    bool f = true;
    REP(i, ss.length()-1)
      if (ss[i] != ss[i+1])
        f = false;
    if (f) return p.first;
    REP(i, ss.length()-1) {
      if (ss[i] != ss[i+1]) {
        string sss = ss;
        sss[i] = sss[i+1] = hoge(ss[i], ss[i+1]);
        Q.push(pis(p.first + 1, sss));
      }
    }
  }
  return -1;
}

int main() {
  string s;
  while(cin >> s, s != "0") {
    int ans = bfs(s);
    if (ans >= 0)
      cout << ans << endl;
    else
      cout << "NA" << endl;
  }
}

Measured memory_bytes: 2200
#include<stdio.h>
int main(void)
{
	//変数を定義。
	int c[3][3];
	int flag = 0;

	//3×3のグリッドを入力。
	for (int i = 0; i < 3; i++) {
		scanf("%d %d %d\n", &c[i][0], &c[i][1], &c[i][2]);
	}

	/*表の上の数値から下の数値を引いた値がそれぞれ等しいと条件が満たされる。
	  例えば、c[0][0] - c[1][0] と c[0][1] - c[1][1]の差が等しい。*/
	for (int j = 0; j < 2; j++) {
		for (int k = 0; k < 2; k++) {
			if (c[j][k] - c[j + 1][k] != c[j][k + 1] - c[j + 1][k + 1]) {
				flag++;
			}
		}
	}

	//フラグの状況に応じて出力。
	if (flag != 0) {
		printf("No\n");
	}
	else if (flag == 0) {
		printf("Yes\n");
	}

	return 0;
}


Measured memory_bytes: 128
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
#define mod 1000000007
#define maxn 5010

int n,a,b;
int ksm(int x,int y){int re=1;for(;(y&1?re=1ll*re*x%mod:0),y;y>>=1,x=1ll*x*x%mod);return re;}
int g[maxn][2],f[maxn][2];
void add(int &x,int y){x=(x+y>=mod?x+y-mod:x+y);}

int main()
{
	scanf("%d %d %d",&n,&a,&b);
	if(a>b)swap(a,b); g[1][1]=1;
	for(int i=2;i<b;i++)
	{
		g[i][1]=(g[i-1][0]+g[i-1][1])%mod;
		for(int j=a;j<i;j++)add(g[i][0],g[i-j][1]);
	}
	f[0][0]=f[0][1]=1;
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<min(a,i+1);j++)add(f[i][0],f[i-j][1]);
		for(int j=1;j<min(b,i+1);j++)
		{
			if(i==n)add(f[i][0],1ll*f[i-j][0]*g[j][0]%mod);
			if(i==j)add(f[i][1],(g[j][0]+g[j][1])%mod);
			else add(f[i][1],1ll*f[i-j][0]*g[j][1]%mod);
		}
	}
	printf("%d",(ksm(2,n)-(f[n][0]+f[n][1])%mod+mod)%mod);
}

Measured memory_bytes: 1808
#include<bits/stdc++.h>
using namespace std;
#define all(v) ((v).begin()),((v).end())
#define ll long long
#define fastIO cout << fixed << setprecision(12), ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr)
double const EPS = 1e-12, PI = acos(-1);
const int N = 4e5 + 9, M = 5e3 + 9, OO = 1e9 + 7, MOD = 1e9 + 7;
const ll inf = 1e18;

ll x[N], y[N];

int main() {
  fastIO;
#ifdef LOCAL
  freopen("input.in", "rt", stdin);
#endif
  int n;
  ll sum = 0, sum2 = 0;
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    cin >> x[i];
    sum += x[i];
    if(!(i & 1))
      sum2 += x[i];
  }
  y[1] = sum - (2 * sum2);
  cout << y[1];
  for (int i = 2; i <= n; ++i) {
    y[i] = 2*x[i-1] - y[i-1];
    cout << ' ' << y[i];
  }
  return 0;
}


Measured memory_bytes: 4224
#include <iostream>
#include <cstdio>
#include <map>

using namespace std;

typedef long long ll;

ll n, k;
ll a[200005];
ll b[200005];
map<ll, ll> ma;
ll ans;

int main()
{
    scanf("%lld%lld", &n, &k);
    ma[0]++;
    for(ll i = 1; i <= n; i++)
    {
        scanf("%lld", &a[i]);
        a[i]--;
        b[i] = b[i - 1] + a[i];
        ma[b[i] % k]++;
        if(i >= k) ma[b[i - k] % k]--;
        ans += ma[b[i] % k] - 1;
    }
    printf("%lld\n", ans);
    return 0;
}


Measured memory_bytes: 17024
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const ll INF = 1e14;
const ll MOD = 1000000007;
const double PI = 3.1415926535897;

signed main() {
    double A, B;
    cin >> A >> B;
    double P,Q,R;
    cin >> P >> Q >> R;
    cout << fixed;
    cout << setprecision(12) << B + (P * B - (B - A) * Q) / (Q + R) << endl;
}


Measured memory_bytes: 3276
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <utility>
#include <cmath>

#define ll long long int
#define pb push_back
#define mk make_pair
#define pq priority_queue

using namespace std;
typedef pair<int, int> P;
typedef pair<ll, int> Pl;
typedef pair<ll, ll> Pll;
const int inf = 1e9;
const ll linf = 1LL << 50;

int main(int argc, char const* argv[])
{
  int x = 0;
  int n;
  cin >> n;
  string s;
  cin >> s;
  int res = 0;
  for(int i = 0; i < n; i++){
    if(s[i] == 'I')x++;
    else x--;
    res = max(res, x);
  }
  cout << res << endl;
	return 0;
}


Measured memory_bytes: 256