akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
char c[200005];
int i,n,ans;
int main(){
	scanf("%s",c+1);n=strlen(c+1);
	for(i=1;i<=n;++i)if(c[i]=='?')c[i]='D';
	for(i=1;i<=n;++i)ans+=c[i]=='D';
//	for(i=1;i<n;++i)ans+=c[i]=='P' && c[i+1]=='D';
//	printf("%d\n",ans);
	puts(c+1);
}

Measured memory_bytes: 3868
N = int(input())
A = list(map(int, input().split()))
sa = 0
i = 0
mx = max(A)
flg = 0

while i < len(A)-1:
    if A[i] > A[i+1]:
        sa += A[i]-A[i+1]
        A[i+1] = A[i]
    i += 1

print(sa)

Measured memory_bytes: 32196
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;

int main(){
  int n, m;
  cin >> n >> m;
  pair<int, int> a[m];
  for (int i = 0; i < m; i++)
    cin >> a[i].first >> a[i].second;
  sort(a, a + m,
       [](const pair<int, int> &left, pair<int, int> &right){
         return left.second < right.second;
       });
  int count=0, previous=-1;
  for (int i = 0; i < m; i++){
    if (previous < a[i].first){
      previous = a[i].second - 1;
      count += 1;
    }
  }
  cout << count << endl;
  return 0;
}


Measured memory_bytes: 1024
N, Q = map(int, input().split())
S = input()
t = [0] * (N + 1)
 
for i in range(N):
  t[i + 1] = t[i] + (1 if S[i : i + 2] == 'AC' else 0) # i文字目まででACが出現する数
  
for i in range(Q):
  l, r = map(int, input().split())
  print(t[r-1] - t[l-1])  # 常に引き算で区間を求められる

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

int main(){
    long long n;
    cin >> n;
    string s;
    cin >> s;

    long long cnt_r = 0, cnt_g = 0, cnt_b = 0;

    for(long long i = 0; i < n; i++){
        if(s[i] == 'R') cnt_r++;
        else if(s[i] == 'G') cnt_g++;
        else cnt_b++;
    }

    long long cnt = 0;
    for(long long i = 0; i < n; i++){
        for(long long j = 1; i + 2*j < n; j++){
            if(s[i] != s[i+j] and s[i+j] != s[i+2*j] and s[i+2*j] != s[i]) cnt++;
        }
    }

    cout << cnt_r * cnt_g * cnt_b - cnt << endl;
    return 0;
}

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

using namespace std;

// Repetitions
#define FOR(i,a,n) for(ll i = ((ll) a); i < ((ll) n); ++i)
#define FORR(i, s, g) for(ll i = ((ll)s - 1); i >= ((ll) g); --i)
#define REP(i, n) FOR(i, 0, n)
#define REPR(i, n) FORR(i, n, 0)

// Container Utils
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define SORTALL(v) sort(ALL(v))
#define SZ(a) int((a).size())
#define CLR(a) memset((a), 0 ,sizeof(a))
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())

// For Debug
#define DMP(x)  cerr << #x << " = " << (x) << endl
#define DBG(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl

// Aliases
#define PB push_back
#define MP make_pair
using ll = long long;
using ld = long double;
using str = string;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vs = vector<str>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vpii = vector<pii>;
using vpll = vector<pll>;

// Constant variables
const ld PI = (acos(-1));
const ll MOD = 1000000007;

// I/O Asynchronizing
struct __io_async{
    __io_async(){
        cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20);
    };
};

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

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long ll;
#define MOD (long long)(1e9+7)
using namespace std;

ll n,k,vis[5005];
ll p[5005],c[5005],sum[5005],ans=-1e18;
int main(){
    cin >> n >> k;
    for(int i=1; i<=n; i++) cin >> p[i];
    for(int i=1; i<=n; i++) cin >> c[i];
    for(int i=1; i<=n; i++){
        ll s=c[i];
        vector<ll> t; t.push_back(s);
        for(int j=p[i]; j!=i; j=p[j]) s+=c[j],t.push_back(s);
        int len=t.size();
        for(int j=0; j<len; j++){
            ll rest=k-j-1;
            if(rest<0) break;
            ans=max(ans,t[j]+(rest/len)*max(s,0LL));
        }
    }
    cout << ans;
}


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

int main(){
int c11,c12,c13,c21,c22,c23,c31,c32,c33;
  cin>>c11>>c12>>c13>>c21>>c22>>c23>>c31>>c32>>c33;
  
  if(c12-c11==c22-c21&&c22-c21==c32-c31&&c13-c11==c23-c21&&c33-c31==c13-c11){
    cout<<"Yes"<<endl;
  }
  else{
    cout<<"No"<<endl;
  }
 
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define all(v) v.begin(),v.end()
#define SZ(v) ((int)v.size())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define Max(a, b) a = max(a, b)
#define Min(a, b) a = min(a, b)
#define bit(n) (1LL<<(n))
#define Ans(f, y, n) if(f) cout << y << endl; else cout << n << endl;
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v) cout << #v << "=" << endl; REP(i, v.size()){ cout << v[i] << ","; } cout << endl;
#define mdebug(m) cout << #m << "=" << endl; REP(i, m.size()){ REP(j, m[i].size()){ cout << m[i][j] << ","; } cout << endl;}
#define pb push_back
#define f first
#define s second
#define int long long
#define INF 1000000000000000000

using vec = vector<int>;
using mat = vector<vec>;
using Pii = pair<int, int>;
using PiP = pair<int, Pii>;
using PPi = pair<Pii, int>;
using bools = vector<bool>;
using pairs = vector<Pii>;

template<typename T> void readv(vector<T> &a){ REP(i, a.size()) cin >> a[i]; }
void readv_m1(vector<int> &a){ REP(i, a.size()){cin >> a[i]; a[i]--;} }

//int dx[4] = {1,0,-1,0};
//int dy[4] = {0,1,0,-1};

int mod = 1000000007;
//int mod = 998244353;
#define Add(x, y) x = (x + (y)) % mod
#define Mult(x, y) x = (x * (y)) % mod
#define AddMult(x, y, z) x = (x + (y) * (z)) % mod



signed main(){

    int K, A, B; cin >> K >> A >> B;
    if(A <= B){
        if(K <= A) cout << 1 << endl;
        else cout << -1 << endl;
    }
    else{
        int ans = 1;
        K -= A;
        if(K > 0) ans += 2 * ((K - 1) / (A - B) + 1);
        cout << ans << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = 1001001001;
const ll LINF = 1LL << 60;

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

string n;
int k;

// メモ化再帰
ll dp[110][2][4];

// digit桁目，現状がNと等しい数か，0以外を使用できる残り回数
ll rec(int digit, bool smaller, int k)
{
    if (k == 0)
        return 1;

    // 桁がnの長さよりも大きければ再帰を終了する
    if (digit >= n.size())
        return 0;

    // // 参照型でretを宣言
    // ll &ret = dp[digit][(int)smaller][k];

    // if (ret > 0)
    //     return ret;

    // ret = 0;

    if (dp[digit][(int)smaller][k] > 0)
    {
        return dp[digit][(int)smaller][k];
    }

    ll ret = 0;

    if (smaller)
    {
        ret += rec(digit + 1, true, k);           // 次の桁が0の時
        ret += rec(digit + 1, true, k - 1) * 9LL; // 次の桁が0以外の時
    }
    else
    {
        if (n[digit] == '0') // 次の桁が0しかあり得ない時
        {
            ret += rec(digit + 1, false, k);
        }
        else
        {
            ret += rec(digit + 1, true, k);                        // 0を使う時
            ret += rec(digit + 1, true, k - 1) * (n[digit] - '1'); // n[digit]より小さい数を使う時
            ret += rec(digit + 1, false, k - 1);                   // n[digit]と等しい数を使う時
        }
    }
    dp[digit][(int)smaller][k] = ret;
    return ret;
}

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


Measured memory_bytes: 3608
A, B, K = list(map(int, input().split()))

x = []

for i in range(A, A + K):
    if (i <= B):
        x.append(i)

for i in range(B - K + 1, B + 1):
    if (i >= A):
        x.append(i)

y = set(x)

for i in range(len(y)):
    print(sorted(list(y))[i])

Measured memory_bytes: 3060
#include<bits/stdc++.h> //Ithea Myse Valgulious
namespace chtholly{
typedef long long ll;
#define re0 register int
#define rec register char
#define rel register ll
#define gc getchar
#define pc putchar
#define p32 pc(' ')
#define pl puts("")
/*By Citrus*/
inline int read(){
  int x=0,f=1;char c=gc();
  for (;!isdigit(c);c=gc()) f^=c=='-';
  for (;isdigit(c);c=gc()) x=(x<<3)+(x<<1)+(c^'0');
  return f?x:-x;
  }
template <typename mitsuha>
inline bool read(mitsuha &x){
  x=0;int f=1;char c=gc();
  for (;!isdigit(c)&&~c;c=gc()) f^=c=='-';
  if (!~c) return 0;
  for (;isdigit(c);c=gc()) x=(x<<3)+(x<<1)+(c^'0');
  return x=f?x:-x,1;
  }
template <typename mitsuha>
inline int write(mitsuha x){
  if (!x) return 0&pc(48);
  if (x<0) x=-x,pc('-');
  int bit[20],i,p=0;
  for (;x;x/=10) bit[++p]=x%10;
  for (i=p;i;--i) pc(bit[i]+48);
  return 0;
  }
inline char fuhao(){
  char c=gc();
  for (;isspace(c);c=gc());
  return c;
  }
}using namespace chtholly;
using namespace std;
const int yuzu=2e5;
typedef int fuko[yuzu|10];
fuko u,v;int vis[2][yuzu>>6][yuzu>>6];
vector<int> lj[yuzu|10];

void dfs(int id,int p,int u,int col){
if (vis[id][p][u]) return;
vis[id][p][u]=col;
for (int i:lj[u]) dfs(id,p,i,col);
}

int main(){
int i,n=read(),m=read();
for (i=1;i<=m;++i){
  u[i]=read(),v[i]=read();
  lj[u[i]].push_back(v[i]);
  } 
for (i=1;i<=n;++i){
  vis[0][i][i]=vis[1][i][i]=1;
  int now=0;for (int j:lj[i]) dfs(0,i,j,++now);
  if (lj[i].size()) for (int j=lj[i].size()-1;~j;--j) dfs(1,i,lj[i][j],j+1);
  }
for (i=1;i<=m;++i){
  puts((vis[0][u[i]][v[i]]!=vis[1][u[i]][v[i]])^(vis[0][v[i]][u[i]]>0)?"diff":"same");
  }
}

Measured memory_bytes: 38272
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		//int a = Integer.parseInt(sc.next());
		//int b = Integer.parseInt(sc.next());
		//int c = Integer.parseInt(sc.next());
		//int n = Integer.parseInt(sc.next());
		//long res=n;
		//int l = Integer.parseInt(sc.next());
		//int sum=0;
		String s = sc.next();
		String t = sc.next();
		String b = sc.next();
		//int a = Integer.parseInt(sc.next());
		//String t = sc.next();

		/*if(a==b&&a==c) {
			System.out.println(1);
		}else if(a==b||b==c||a==c){
			System.out.println(2);
		}else {
			System.out.println(3);
		}*/
		System.out.println("A"+t.substring(0,1)+"C");
	}
}




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

#define N 100000

int main(void){
    ios::sync_with_stdio(false);
    vector<bool> prime(N+1,true);
    prime[0]=prime[1]=false;
    for (size_t i = 2; i*i <= N; i++)
    {
        if (prime[i])
        {
            for (size_t j = 2; i*j <= N; j++)
            {
                prime[i*j]=false;
            }
        }
    }
    int likeCnt[N];
    for (size_t i = 1; i <= N; i++)
    {
        likeCnt[i]=likeCnt[i-1]+(i%2==1&&prime[i]&&prime[(i+1)/2]);
    }
    /**************************************/
    int q;
    cin >> q;
    int l,r;
    for (size_t i = 0; i < q; i++)
    {
        cin >> l >> r;
        cout << likeCnt[r] - likeCnt[l-1] << "\n";
    }
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = s; i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << '\n';
#define CFYN(n) cout << ( (n) ? "YES":"NO") << '\n';
#define OUT(n) cout << (n) << '\n';
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;

int main(void)
{
    IOS
    int n; cin >> n;
    multiset<int> mst;

    REP(i,n) {
        int a; cin >> a;
        mst.insert(a);
    }

    int ans = 0;
    while(!mst.empty()) {
        int x = *mst.rbegin();
        auto back = mst.end();
        back--;
        mst.erase(back);
        double l2 = log2(x);
        if (l2 == floor(l2)) {
            auto it = mst.find(x);
            if (it != mst.end()) {
                ans++;
                mst.erase(it);
            }
        } else {
            int x2 = pow(2,ceil(l2));
            auto it = mst.find(x2-x);
            if (it != mst.end()) {
                ans++;
                mst.erase(it);
            }
        }
    }

    cout << ans << '\n';

    return 0;
}

Measured memory_bytes: 9856
def calGCD(x,y):
    while(y > 0):
        x, y = y, x % y
    return x

A,B,C,D = [int(i) for i in input().split()]

CD = C * D // calGCD(C,D)

cntC = (B // C) - (A // C)
cntD = (B // D) - (A // D)
cntCD = (B // CD) - (A // CD)

if A % C == 0:
    cntC += 1
if A % D == 0:
    cntD += 1
if A % CD == 0:
    cntCD += 1

ans = B - A + 1 - (cntC + cntD - cntCD)
print(ans)

Measured memory_bytes: 3064
#include <iostream>
#include <stdio.h>
using namespace std;

int main() {

	int a, b, d, r;
	double f;
	cin >> a >> b;

	d = a / b;
	r = a % b;
	f = (double)a / (double)b;

	printf("%ld %ld %.61f\n", d, r, f);
	return 0;
}


Measured memory_bytes: 3228
/*╔═══╗──╔╗╔╗───────────────────╔╗────────╔═══╦═══╗
  ║║─║╠╗╠╗╔╣╚═╦══╦═╗╔╦╗╔═╗╔══╦══╣╚═╦╦══╦══╣║─║║║─╚╝
  ║╔═╗║╚╝║╚╣║║║╚╝║║─╔╦╗║║║║╚╝║╚╝║╚╝║║║═╬══║╔═╗║╚╩═║
  ╚╝─╚╩══╩═╩╝╚╩══╩╝─╚╩╝╚╝╚╩══╩══╩══╩╩══╩══╩╝─╚╩═══╝*/
#include<bits/stdc++.h>
#define mod 1000000007
#define modc 998244353
#define pb push_back
#define mp make_pair
#define ll long long
#define ull unsigned long long
#define deb(x) cout << #x << " " << x << endl;
#define deb2(x,y) cout << #x << " " << x << " " <<  #y << " " << y << endl
#define deb3(x,y,z) cout << #x << " " << x << " " << #y << " " << y << " " << #z << " "  << z << endl;
#define yes cout << "YES" << endl
#define no cout << "NO" << endl
using namespace std;
template <class T>
string to_binary(T n)
{
	string binaryNum;
	int i = 0;
	while (n > 0) {
		binaryNum.pb((n % 2)+'0');
		n = n / 2;
		i++;
	}
	reverse(binaryNum.begin(),binaryNum.end());
	return binaryNum;
}
template<class T>
bool perfectSq(T n)
{
	if(sqrt(n) == floor(sqrt(n)))
		return true;
	else
		false;
}
void solve()
{
	int i,j;
	ll sum = 0,prod = 1;
	int n;
	cin >> n;
	ll arr[n];
	for(auto &x : arr)
		cin >> x;
	map<ll,int>b;
	for(i=0;i<n;i++)
	{
		b[i+1+arr[i]]++;
		sum+=b[i+1-arr[i]];
	}
	cout << sum << endl;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int t = 1;
	while(t--)
	{
		solve();
	}
}


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

int main()
{
    int n;
    string s[100001];
    cin>>n;
    for (int i = 0; i < n; i++)
    {
        cin>>s[i];
    }
    ll ans=0;
    map<string,int> mp;
    for (int i = 0; i < n; i++)
    {
        for (int j1 = 0; j1 < 9; j1++)
        {
            for (int j2 = 9; j2 > j1; j2--)
            {
                if(s[i][j2-1]>s[i][j2]){
                    char temp = s[i][j2-1];
                    s[i][j2-1] = s[i][j2];
                    s[i][j2] = temp;
                }
            }
        }
        //cout<<s[i]<<endl;
        auto itr=mp.find(s[i]);
        if( itr != mp.end() ) {
            int tmp_int = mp[s[i]];
            mp[s[i]]=tmp_int+1;
            ans+=tmp_int;
        } else {
            mp[s[i]]=1;
        }
    }
    
    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 18176
#include <iostream>
#include <map>
#include <string>
#include <vector>
using namespace std;
typedef vector <int> vi;

int main(void){
	map <char, int> m;
	vi x;
	int num[] = {1,5,10,50,100,500,1000};
	for (int i=0; i<7; i++)
		m["IVXLCDM"[i]] = num[i];

	while (true){
		string roman;
		cin>>roman;
		if (cin.eof()) break;

		int tmp, tmp2= m[roman[0]];
		for (int i=0; i<(int)roman.size(); i++){
			tmp = m[roman[i]];
			if (i!=0 && tmp2<tmp)
				x[i-1] = -tmp2;
			x.push_back(tmp);
			tmp2 = tmp;
		}

		int s=0;
		for (int i=0; i<(int)x.size(); i++)
			s += x[i];
		cout<<s<<endl;
		x.clear();
	}
}

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

using namespace std;

int main() {
    ios::sync_with_stdio(false);

//  freopen("input.txt", "r", stdin);
//  freopen("output.txt", "w", stdout);

    long long n;
    cin >> n;
    string s = "";
    while(n) {
        if(n%26)
            s += 'a' + (n%26 - 1), n /= 26;
        else
            s += 'z', n /= 26, n--;
    }
    reverse(s.begin(), s.end());
    for(int i = 0; i < s.size(); i++)
        cout << s[i];

    return 0;
}


Measured memory_bytes: 3640
#include<iostream>
#include<vector>
#include<utility>
#include<deque>
#include<algorithm>
#include <iomanip>
#include<cmath>

using namespace std;
using ll = long long int;
constexpr int INF = 1 << 29;
constexpr ll MOD = ll(1e9 + 7);

int n;
vector<int> a, b, c;

int main(void) {
	cin >> n;
	for (int i = 0; i < n; i++) {
		int ai;
		cin >> ai;
		a.push_back(ai);
	}
	for (int i = 0; i < n; i++) {
		int bi;
		cin >> bi;
		b.push_back(bi);
	}
	for (int i = 0; i < n-1; i++) {
		int ci;
		cin >> ci;
		c.push_back(ci);
	}

	int ret = b[a[0]-1];
	for (int i = 1; i < n; i++) {
		ret += b[a[i]-1];
		if (a[i] - a[i - 1] == 1) {
			ret += c[a[i]-2];
		}
	}
	cout << ret << endl;
	return 0;
}

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

def gcd(x, y):
    if y == 0:
        return x
    else:
        return gcd(y, x % y)
        
x = gcd(A[0], A[1])
for i in range(2, N):
    x = gcd(x, A[i])

print(x)


Measured memory_bytes: 14252
#include <bits/stdc++.h>
#define rep3(i, s, n, a) for (int i = (s); i < (int)(n); i += a)
#define rep2(i, s, n) rep3(i, s, n, 1)
#define rep(i, n) rep2(i, 0, n)

using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<int, int>;

int n;
vector<int> a;

void update(int i, int x);
int query(int x, int y, int k, int l, int r);

int main(){
    int h, w, m, colmax=0;
    cin >> h >> w >> m;
    n = w;
    rep(i, 30) {
      if ((n - 1) < 1 << i) {
        n = 1 << i;
        break;
      }
    }

    rep(i, 2 * n - 1) { a.push_back(0); }

    vector<int> col(h, 0), row(w, 0);
    vector<int> tmph;
    vector<vector<int>> collist(h, tmph);
    rep(i, m){
        int x, y;
        cin >> x >> y;
        col[x-1]++;
        row[y-1]++;
        colmax = max(colmax, col[x-1]);
        collist[x-1].push_back(y-1);
    }
    vector<int> cind;
    vector<vector<int>> cmax;
    rep(i, h){
        if(col[i]==colmax){
            cind.push_back(i);
            cmax.push_back(collist[i]);    
        }
    }
    rep(i, w){
        update(i, row[i]);
    }
    int clen=cmax.size(), res=0;
    rep(i, clen){
        int clislen = cmax[i].size();
        rep(j, clislen){
            update(cmax[i][j], row[cmax[i][j]]-1);
        }
        res = max(res, query(0, n, 0, 0, n));
        rep(j, clislen) { 
            update(cmax[i][j], row[cmax[i][j]]); 
        }
    }
    cout << colmax + res << endl;
    return 0;
}

void update(int i, int x) {
  i += n - 1;
  a[i] = x;
  while (i > 0) {
    i = (i - 1) / 2;
    a[i] = max(a[i * 2 + 1], a[i * 2 + 2]);
  }
}

int query(int x, int y, int k, int l, int r) {
  if (r <= x || y <= l) return 0;
  if (x <= l && r <= y)
    return a[k];
  else {
    int vl = query(x, y, k * 2 + 1, l, (l + r) / 2);
    int vr = query(x, y, k * 2 + 2, (l + r) / 2, r);
    return max(vl, vr);
  }
}

Measured memory_bytes: 48728
#include<bits/stdc++.h>
#include<iostream>
using namespace std;
const int MAX=1e9+7;
const int mod=1e9+7;
#define INF 0x3f3f3f3f
#define ll long long
int a[3][3],b[10];
int main()
{
	ios::sync_with_stdio(0);cin.tie(0);
	for(int i=0;i<3;i++)
	for(int j=0;j<3;j++)
	cin>>a[i][j];
	int n;
	cin>>n;
	set<int>b;
	int x;
	bool flag = false;
	for(int i=0;i<n;i++)
	{ 
		cin >> x; b.insert(x);
	}
	for(int i=0;i<3;i++)
		if (b.count(a[i][0]) && b.count(a[i][1]) && b.count(a[i][2]))flag = true;
		else if (b.count(a[0][i]) && b.count(a[1][i]) && b.count(a[2][i]))flag = true;
	if (b.count(a[0][0]) && b.count(a[1][1]) && b.count(a[2][2]))flag = true;
	if (b.count(a[0][2]) && b.count(a[1][1]) && b.count(a[2][0]))flag = true;
	if (flag)cout << "Yes";
	else cout << "No";
	
}

Measured memory_bytes: 256
import numpy as np
n,m,c = map(int,input().split())
b = np.array(list(map(int, input().split())))
# b = np.array(b)
# a = []
ans = 0
for i in range(n):
    a = np.array(list(map(int, input().split())))
    if (np.dot(a,b)+c) >0:
        ans += 1
    # a.append(list(map(int, input().split())))
print(ans)

Measured memory_bytes: 14404
void main() {
	auto ip = rs.to!(dchar[]).map!(v => v - '0').array;
	char[][] calc;
	void gen(char[] arr, int n) {
		if(n == 3) {
			calc ~= arr;
		}
		else {
			gen(arr ~ '+', n+1);
			gen(arr ~ '-', n+1);
		}
	}
	gen([], 0);

	foreach(v; calc) {
		ulong ind;
		int tmp = ip[0];
		while(ind < 3) {
			switch(v[ind]) {
				case '+':
					tmp += ip[ind+1];
					break;
				case '-':
					tmp -= ip[ind+1];
					break;
				default: break;
			}
			ind++;
		}
		//tmp.writeln;
		if(tmp == 7) {
			"%d%s%d%s%d%s%d=7".writefln(ip[0], v[0], ip[1], v[1], ip[2], v[2], ip[3]);
			return;
		}
	}
}

// ===================================

import std.stdio;
import std.string;
import std.functional;
import std.algorithm;
import std.range;
import std.traits;
import std.math;
import std.container;
import std.bigint;
import std.numeric;
import std.conv;
import std.typecons;
import std.uni;
import std.ascii;
import std.bitmanip;
import core.bitop;

T readAs(T)() if (isBasicType!T) {
	return readln.chomp.to!T;
}
T readAs(T)() if (isArray!T) {
	return readln.split.to!T;
}

T[][] readMatrix(T)(uint height, uint width) if (!isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		res[i] = readAs!(T[]);
	}
	return res;
}

T[][] readMatrix(T)(uint height, uint width) if (isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		auto s = rs;
		foreach(j; 0..width) res[i][j] = s[j].to!T;
	}
	return res;
}

int ri() {
	return readAs!int;
}

double rd() {
	return readAs!double;
}

string rs() {
	return readln.chomp;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,a) for(int i=0;i<int(a);++i)
#define REP(i,a,b) for(int i=int(a);i<int(b);++i)
#define pb push_back
#define mp make_pair
#define F first
#define S second
using ll = long long;
using itn = int;
using namespace std;
static const long double GRATIO=(long double)(1+sqrt(5))/2;
ll GCD(ll a, ll b){
    return b ? GCD(b, a%b) : a;
}
ll LCM(ll a, ll b){
    return a/GCD(a,b)*b;
}
int main(){
    string s;
    cin>>s;
    cout<<s[0]<<s.size()-2<<s[s.size()-1]<<endl;
}


Measured memory_bytes: 384
#include <iostream>

using namespace std;

int main() {
    int n;
    cin >> n;
    int m, a, r, c, h;
  	m = a = r = c = h = 0;
    string name;
    for (int i = 0; i < n; i++) {
        cin >> name;
        switch (name[0]) {
            case 'M':
                m++;
                break;
            case 'A':
                a++;
                break;
            case 'R':
                r++;
                break;
            case 'C':
                c++;
                break;
            case 'H':
                h++;
                break;
            default:
                continue;
        }
    }
    int march[5] = {m, a, r, c, h};
    long long res = 0LL;
    for (int i = 0; i < 5; i++) {
        for (int j = i+1; j < 5; j++) {
            for (int k = j+1; k < 5; k++) {
                res += (long long)march[i] * (long long)march[j] * (long long)march[k];
            }
        }
    }
  	//cout << m << " " << a << " " << r << " " << c << " " << h << endl;
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <string>
#include <iomanip>
#include <math.h>
#include <utility>
#include <vector>
#include <map>
#include <cstdlib>
#define div1 1000000007
const long long INF = 1LL << 60;
using namespace std;
// a>b -> a==b;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
// a<b -> a==b;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

int L[2001], N;

// index が条件を満たすかどうか
bool isOK(int index, int key) {
    if (L[index] >= key) return true;
    else return false;
}

// 汎用的な二分探索のテンプレ
int binary_search(int key) {
    int left = -1; //「index = 0」が条件を満たすこともあるので、初期値は -1
    int right = N; // 「index = a.size()-1」が条件を満たさないこともあるので、初期値は a.size()

    /* どんな二分探索でもここの書き方を変えずにできる！ */
    while (right - left > 1) {
        int mid = left + (right - left) / 2;

        if (isOK(mid, key)) right = mid;
        else left = mid;
    }

    /* left は条件を満たさない最大の値、right は条件を満たす最小の値になっている */
    return right;
}

int main(void)
{
    long long i, j, k, num, ans;

    cin >> N;

    for(i=1; i<=N; i++){
        cin >> L[i];
    }

    sort(L+1, L+N+1);

    // 長い2辺を固定して、一番短い辺を2分探索で求める
    for(i=N; i>=3; i--){
        for(j=i-1; j>=2; j--){
            num = binary_search(L[i]-L[j]+1); // L[i]-L[j]+1以上

            if(num < j){
                ans += j-num;
            }
        }
    }

    cout << ans << endl;

    return 0;
}

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

int main(){
    long long a,b, n;
    cin >> n >> a >> b;
    long long k = a+b;
    long long  ans=0;
    long long  r;
    if(n%k<a){
        r = n%k;
    }
    else{
        r = a;
    }
    ans = n/k * a + r;
    cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
      	long X = sc.nextInt();
        int A = 0;
        int B = 0;
		
      	for(int i=-130; i<130; i++){
          for(int j=-130; j<130; j++){
            if(Math.pow(i,5) - Math.pow(j,5) == X){
              A = i;
              B = j;
              break;
            }
          }
        }
        System.out.println(A+" "+B);
    }
}


Measured memory_bytes: 38892
#include<iostream>
#include<math.h>
#define ll long long 
using namespace std;
int main ()
{  ll x,k,d;
   cin>>x>>k>>d;
    x=fabs(x);
	ll K=x/d;
	if(k-K<0) cout<<x-d*k<<endl;
	else
	{  k-=K;
	    x=x%d;
	if(k%2==0) cout<<x<<endl;
	else  cout<<d-x<<endl;	  
    }
    return 0;
}

Measured memory_bytes: 3612
import sys
from io import StringIO
import unittest

# 再起限界
import sys
sys.setrecursionlimit(4100000)


def resolve():
    original_s = list(sys.stdin.readline().split()[0])
    sum_list = []
    sum_list_append = sum_list.append

    def dfs(s, sum):
        if len(s) == 0:
            sum_list_append(sum)
            return
        if len(s) == 1:
            sum_list_append(sum + int(s[0]))
            return

        dfs(s[1:], sum + int(s[0]))

        dfs([s[0] + s[1]] + s[2:], sum)

    dfs(original_s, 0)
    print(sum(sum_list))


if __name__ == "__main__":
    resolve()


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """125"""
        output = """176"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """9999999999"""
        output = """12656242944"""
        self.assertIO(input, output)


Measured memory_bytes: 49776
def gcd(x,y):
    while y>0:
        x,y = y,x%y
    return x
A,B,C,D = map(int,input().split())
c1 = B//C-(A-1)//C
d1 = B//D-(A-1)//D
E = (C//gcd(C,D))*D
e1 = B//E-(A-1)//E
print(B-A+1-c1-d1+e1)

Measured memory_bytes: 9036
#include <iostream>
using namespace std;
int solve(void){
    int X;
    cin >> X;
    int Q = X / 100;
    int P = X % 100;
    
    int sum = 0;
    for(int i=0;i<Q;i++){
        if(sum + 5 <= P)sum+=5;
        else if(sum + 4 <= P)sum+=4;
        else if(sum + 3 <= P)sum+=3;
        else if(sum + 2 <= P)sum+=2;
        else if(sum + 1 <= P)sum+=1;
        
        if(sum == P)return 1;
    }
    return 0;
    
}
int main(void){
    
    int ans = solve();
    cout << ans << endl;
}


Measured memory_bytes: 3188
//tenka1_b.cpp
//Sun Nov 25 18:06:00 2018

#include <iostream>
#include <string>
#include <queue>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <math.h>
#define INTINF 2147483647
#define LLINF 9223372036854775807
using namespace std;
using ll=long long;
typedef pair<int,int> P;

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

	int a[n],b[n];
	int bottom = -1;
	int score = -1;
	for (int i=0;i<n;i++){
		cin >> a[i] >> b[i];
		if (bottom < a[i]){
			bottom = a[i];
			score = b[i];
		}
	}

	cout << bottom + score << endl;
//	printf("%.4f\n",ans);
}

Measured memory_bytes: 1024
#define _USE_MATH_DEFINES
#include<iostream>
#include<cstdlib>
#include<algorithm>
#include<cmath>
#include<string>
#include<set>
#include<map>
#include<stdbool.h>
#include<math.h>
#include<sstream>
#include<math.h>
#include<vector>
#include<functional>
#include<queue>
#include<utility>
#include<bitset>
typedef long long ll;
#define N (1000000000+7)
#define INF 1e10
using namespace std;
typedef pair<ll, ll> P;
int dx[4] = { 1,0,-1,0 };
int dy[4] = { 0,1,0,-1 };

bool used[110];

bool cmp(const pair<int,int> &a,const pair<int,int> &b) {
	return a.first * a.first + a.second * a.second > b.first*b.first + b.second * b.second;
}

int main(void){
	int n, r=0, b=0;
	string s;
	cin >> n >> s;
	for (int i = 0;i < n;i++) {
		if (s[i] == 'R')r++;
		else b++;
	}
	if (r > b)cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
import sys

input = sys.stdin.readline

N, M = map(int, input().split())

p = []
S = []
ans = 0
pena = 0
count = [0] * N
check = set()
for _ in range(M):
    l = list(map(str, input().split()))
    p.append(int(l[0]))
    S.append(l[1])

for i in range(M):
    if p[i] not in check:
        if S[i] == 'AC':
            pena += count[p[i]-1]
            ans += 1
            check.add(p[i])
        elif S[i] == 'WA':
            count[p[i]-1] += 1

print(ans, pena)


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

using namespace std;

using lint = long long;

int main(void)
{
    int N;
    cin >> N;
    vector<pair<int, int> > A(N);
    for(int i = 0; i < N; i++){
        cin >> A[i].first;
        A[i].second = i+1;
    }
    sort(A.begin(), A.end());
    for(int i = 0; i < N; i++){
        cout << A[i].second;
        if(i < N-1) cout << " ";
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 1664
import math
N,D = map(int, input().split())
count=0
if(N>=1 and N<=2*10**5 and D>=0 and D<=2*10**5):
    for i in range(N):
        X,Y = map(int,input().split())
        if(abs(X)<=2*10**5 and abs(X)<=2*10**5):
            if(math.sqrt(X*X+Y*Y)<=D):
                count += 1
print(count)

Measured memory_bytes: 9068
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
const int INF = (1<<30)-1;
const long long LINF = (1LL<<62)-1;
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, 1, 0, -1};
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; }

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<int> s(n);
  rep(i, n) cin >> s[i];
  ll ans = 0;
  for (int c = 1; c < n-1; c++) {
    ll sum = 0;
    set<int> used;
    for (int i = 0; c*i < n-1; i++) {
      int a = n-1-c*i;
      int b = a-c;
      if (!(a > b && a < n && b > 0))
        break;
      if (used.find(c*i) != used.end() || used.find(n-1-c*i) != used.end() || c*i == n-1-c*i)
        break;
      sum += s[c*i];
      sum += s[n-1-c*i];
      used.insert(c*i);
      used.insert(n-1-c*i);
      chmax(ans, sum);
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 5376
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; i++)
#define RFOR(i, a, n) for (ll i = (ll)n - 1; i >= (ll)a; i--)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) RFOR(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define bra(first, second) '(' << first << ',' << second << ')'
constexpr ll MOD = 1000000007;
//constexpr ll MOD = 998244353;
ll INF = 1001001001001001001;
long double EPS = 1e-9;
long double PI = 3.141592653589793238;
template <typename T>
void remove(std::vector<T> &vector, unsigned int index)
{
   vector.erase(vector.begin() + index);
}

using Graph = vector<vector<tuple<ll, ll, ll>>>;

// MOD確認

int main(){
   ll A,B;
   cin >> A >> B;
   cout << A * B << endl;
}


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

#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
typedef pair<int, int> pint;
const int INF = 1 << 30;
const ll LINF = 1LL << 60;
const int MOD = 1e9 + 7;


int main() {
    int n, m; cin >> n >> m;
    vector<int> x(n); rep(i, n) cin >> x[i];
    sort(x.begin(), x.end());
    vector<vector<int>> y(m);
    rep(i, n) {
        y[x[i] % m].push_back(x[i]);
    }
    vector<int> cnt(m);
    rep(i, n-1) {
        if (x[i+1] == x[i]) {
            cnt[x[i]%m]++;
            i++;
        }
    }
    int ans = 0;
    ans += y[0].size() / 2;
    for (int i = 1; i < m/2; i++) {
        int p1 = i;
        int p2 = m - i;
        int n1 = y[p1].size();
        int n2 = y[p2].size();
        if (n1 < n2) {
            swap(p1, p2);
            swap(n1, n2);
        }

        if (n1 == n2) ans += n1;
        else {
            ans += n2;
            ans += min(cnt[p1], (n1-n2) / 2);
        }
    }
    if (m/2 == 0) {
        cout << ans << endl;
        return 0;
    }
    
    if (m % 2 == 0) ans += y[m/2].size() /2;
    else {
        int p1 = m / 2;
        int p2 = m - p1;
        int n1 = y[p1].size();
        int n2 = y[p2].size();
        if (n1 < n2) {
            swap(p1, p2);
            swap(n1, n2);
        }

        if (n1 == n2) ans += n1;
        else {
            ans += n2;
            ans += min(cnt[p1], (n1-n2) / 2);
        }
    }
    cout << ans << endl;

    return 0;
}


    


Measured memory_bytes: 6528
S = input()
flag = False
if S[0] == S[1] and S[1] != S[2] and S[2] == S[3]:
    flag = True
if S[0] == S[2] and S[2] != S[3] and S[1] == S[3]:
    flag = True
if S[0] == S[3] and S[1] != S[3] and S[1] == S[2]:
    flag = True

if flag:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 9128
#include <bits/stdc++.h>
#define pb push_back
typedef long long ll;
typedef long double la;
using namespace std;

int main(){
    int n,t,a;
    cin >> n >> t >> a;
    vector<ll> h(n);
    vector<ll> b(n);
    vector<ll> c(n);
    for(int i=0;i<n;i++){
        cin >> h[i];
    }
    la min = 1e100;
    int ans = 0;
    for(int i=0;i<n;i++){
        if(min > abs(t-h[i]*0.006-a)){
            min = abs(t-h[i]*0.006-a);
            ans = i+1;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <sstream>
#include <functional>
#include <map>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <stack>
#include <deque>
#include <set>
#include <list>
#include <numeric>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> P;
typedef pair<P,ll> PP;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const ll INF = 1LL<<29;
const ll mod = 1e9+7;
#define rep(i,n) for(int (i)=0;(i)<(ll)(n);++(i))
#define repd(i,n,d) for(ll (i)=0;(i)<(ll)(n);(i)+=(d))
#define all(v) (v).begin(), (v).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset((m),(v),sizeof(m))
#define chmin(X,Y) ((X)>(Y)?X=(Y),true:false)
#define chmax(X,Y) ((X)<(Y)?X=(Y),true:false)
#define fst first
#define snd second
#define UNIQUE(x) (x).erase(unique(all(x)),(x).end())
template<class T> ostream &operator<<(ostream &os, const vector<T> &v){int n=v.size();rep(i,n)os<<v[i]<<(i==n-1?"":" ");return os;}
#define N 310
#define M 3
ll n, m;
vector<PP> v;
int t[1<<M];
ll dp[N][N][N];
int d[M];
int main(){
	rep(i, 1<<M) t[i] = __builtin_popcount(i);
	cin>>n>>m;
	rep(i, m){
		int a, b, c;
		cin>>a>>b>>c;
		v.push_back(PP(P(a, b), c));
		if(b==1 && c>1){
			cout<<0<<endl;
			return 0;
		}
	}
	sort(all(v));
	dp[1][0][0] = dp[0][1][0] = dp[0][0][1] = 1;
	ll res = 0;
	int p = 0;
	for(int ii = 1; ii < n; ii++){
		while(p<m && v[p].fst.fst<=ii+1) p++;
		rep(j, m){
			if(ii+1>v[j].fst.snd){
				for(int k = j; k < m-1; k++) v[k] = v[k+1];
				m--;
				p--;
				j--;
			}
		}
		rep(jj, max(1, ii)) rep(kk, max(1, ii)){
			if(jj && jj==kk) continue;
			d[0] = ii; d[1] = jj; d[2] = kk;
			rep(_, M){
				swap(d[0], d[1]); swap(d[1], d[2]);
				//rotate(d, d+1, d+M);
				if(dp[d[0]][d[1]][d[2]]==0) continue;
				int d2[3];
				memcpy(d2, d, sizeof(d));
				int x = ii+1;
				rep(i, M){
					swap(x, d[i]);
					bool ok = true;
					rep(j, p){
						if(d[i]!=v[j].fst.snd){

							continue;
						}
						int cnt = 0;
						rep(k, M) if(v[j].fst.fst<=d[k] && d[k]<=v[j].fst.snd) cnt++;
						//if(cnt>v[j].snd || (d[i]==v[j].fst.snd&&cnt!=v[j].snd)){
						if(cnt!=v[j].snd){
							ok = false;
							break;
						}
					}
					if(ok) {
						if(ii+1==n){
							(res += dp[d2[0]][d2[1]][d2[2]]);
							if(res>mod) res -= mod;
						} else {
							dp[d[0]][d[1]][d[2]]+=dp[d2[0]][d2[1]][d2[2]];
							if(dp[d[0]][d[1]][d[2]]>mod) dp[d[0]][d[1]][d[2]] -= mod;
						}
					}
					swap(x, d[i]);
				}
			}
		}
	}
	cout<<res<<endl;
	return 0;
}


Measured memory_bytes: 225536
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define all(x) (x).begin(),(x).end()
#define INF 10000000
using ll = long long ;

using namespace std;

int main(){
    int w,h,x,y;
    cin >> w >> h >> x >> y;
    cout << double(w)*double(h)/2.0<< ' ';
    cout  << (x+x==w && y+y == h) << endl;
}

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

int main()
{
    int n, ans = 0;
    cin >> n;
    vector<int> p(n);
    rep(i,n) cin >> p[i];
    sort(p.rbegin(), p.rend());
    ans += p[0] / 2;
    for (int i = 1; i < n; i++) ans += p[i];
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

// https://atcoder.jp/contests/code-festival-2016-qualb/tasks/codefestival_2016_qualB_b
public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int a = sc.nextInt();
		int b = sc.nextInt();
		String s = sc.next();
		sc.close();

		String[] array = s.split("");

		int tmp_fore = 1;
		int tmp = 0;

		for(int i=0;i<n;i++) {
			if(array[i].equals("a")) {
				if(a+b>tmp) {
					System.out.println("Yes");
					tmp++;
				}else {
					System.out.println("No");
				}
			}else if(array[i].equals("b")) {
				if(a+b>tmp) {
					if(b>=tmp_fore) {
						System.out.println("Yes");
						tmp++;
						tmp_fore++;
					}else {
						System.out.println("No");
					}
				}else {
					System.out.println("No");
				}
			}else {
				System.out.println("No");
			}

		}
	}
}


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

int main(){
    ll a,b,k;
    cin >> a >> b >> k;
    ll sa = a - k;
    if(sa > 0) cout << sa << ' ' << b;
    else if(sa < 0){
        if(sa + b < 0) cout << '0' << ' ' << '0';
        else cout << '0' << ' ' << sa + b;
    }
    else if(sa == 0) cout << '0' << ' ' << b;
    return 0;
}

Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map.Entry;
import java.util.PriorityQueue;
import java.util.Scanner;

class Main {
    static final int MOD = 1000000007;
    static final int INF = 1 << 30;

    Main() {
        Scanner sc = new Scanner(System.in);
        long ans = 0;
        long H = sc.nextLong();
        long W = sc.nextLong();
        if(H==1 || W==1){
        System.out.println(1);
        return;
        }
        long ht = H/2+H%2;
        long hd = H/2;
        long wt = W/2+W%2;
        long wd = W/2;
        ans += ht*wt;
        ans += hd*wd;
        System.out.println(ans);
    }

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

Measured memory_bytes: 22612
#include <cstdio>
#include <cstring>
#include <string>
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;

    int main(){
      int R;
      cin >> R;
      if(R<1200){
       cout << "ABC" << endl; 
      }
      if(R>=1200 && R<2800){
       cout << "ARC" << endl; 
      }
      if(R>=2800){
       cout << "AGC" << endl; 
      }
	return 0;
}


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

typedef long long ll;

using namespace std;

int main() {
    string s;
    ll k, i = 0;
    cin >> s >> k;
    while (i < k - 1 && s.at(i) == '1') ++i;
    cout << s.at(i) << endl;
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
  int n;
  scanf("%d", &n);
  int a[n-1],i;
  int s[n];
  for(i = 0; i < n ; i++)
    s[i] = 0;
  for(i = 0; i < n-1 ; i++)
  {
    scanf("%d", &a[i]);
    s[a[i]-1] += 1;
  }
  for(i = 0; i < n ; i++)
    printf("%d\n", s[i]);
  
  return 0;
}

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

#define PI acos(-1.0)
#define INF 1e18
#define inf 0x3f3f3f3f
#define FAST_IO ios::sync_with_stdio(false)

const int N = 1e5 + 10;
typedef long long LL;

int n, m;
int dis[N];
bool vis[N];
vector < pair<int, int> > E[N];

bool dfs(int u) {
	vis[u] = 1;
	for(auto p : E[u]) {
		int v = p.first;
		int d = p.second;
		if(!vis[v]) {
			dis[v] = dis[u] + d;
			if(!dfs(v)) return false;
		} else if((dis[u] + d) != dis[v]) return false;
	}
	return true;
}

int main() {
	FAST_IO;
	cin >> n >> m;
	int u, v, w;
	for(int i = 1; i <= m; i++) {
		cin >> u >> v >> w;
		E[u].push_back(make_pair(v, w));
		E[v].push_back(make_pair(u, -w));
	}
	for(int i = 1; i <= n; i++) {
		if(!vis[i]) {
			if(!dfs(i)) {
				cout << "No" << endl;
				return 0;
			}
		}
	}
	cout << "Yes" << endl;
	return 0;
}

Measured memory_bytes: 11136
#include<bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef pair<int,int> pii;
typedef vector< pii > vii;

#define ll          long long
#define ff          first
#define ss          second
#define pb          push_back
#define mkp         make_pair
#define sz          size()

#define forf(a,b,c)    for(int i=a;i<=b;i+=c)
#define forr(a,b,c)    for(int i=a;i>=b;i-=c)
#define all(a)      a.begin(),a.end()
#define mem(a,b)    memset(a,b,sizeof(a))
#define pi          2*acos(0.0)
#define End         return 0;
#define nl endl

#define scan1(a)    scanf("%d",&a)
#define scan2(a,b)  scanf("%d %d",&a,&b)
#define scan3(a,b,c)  scanf("%d %d %d",&a,&b,&c)
#define scanl(a)    scanf("%lld",&a)
#define scanll(a,b) scanf("%lld %lld",&a,&b)
#define scanlll(a,b,c) scanf("%lld %lld %lld",&a,&b,&c)

#define print1(a)    printf("%d",a)
#define print2(a,b)  printf("%d %d",a,b)
#define print3(a,b,c)  printf("%d %d %d",a,b,c)
#define printl(a)    printf("%lld",a)
#define printll(a,b) printf("%lld %lld",a,b)
#define printlll(a,b,c) printf("%lld %lld %lld",a,b,c)

#define MAXN        100000007
#define INF 0x3f3f3f3f
bool mark[100005];vi prime;
void seive(ll N){for(int i=2;i<=N;i++){if(mark[i]==false){prime.pb(i);for(int j=i+i;j<N;j+=i)mark[j]=true;}}}
//freopen("input.txt", "r", stdin);

int main()
{
   ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
   string s,t;
   cin>>s>>t;
   int res=0;
   for(int i=0;i<3;i++){
    if(s[i]==t[i])res++;
   }
   cout<<res<<endl;
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;

#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i, s, n) for(int i = (s), i##_len=(n); i < i##_len; ++i)
#define FORS(i, s, n) for(int i = (s), i##_len=(n); i <= i##_len; ++i)
#define VFOR(i, s, n) for(int i = (s); i < (n); ++i)
#define VFORS(i, s, n) for(int i = (s); i <= (n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define REPS(i, n) FORS(i, 0, n)
#define VREP(i, n) VFOR(i, 0, n)
#define VREPS(i, n) VFORS(i, 0, n)
#define RFOR(i, s, n) for(int i = (s), i##_len=(n); i >= i##_len; --i)
#define RFORS(i, s, n) for(int i = (s), i##_len=(n); i > i##_len; --i)
#define RREP(i, n) RFOR(i, n, 0)
#define RREPS(i, n) RFORS(i, n, 0)
#define ALL(v) (v).begin(), (v).end()
#define SORT(v) sort(ALL(v))
#define RSORT(v) sort(ALL(v), greater<decltype(v[0])>())
#define SZ(x) ((int)(x).size())
#define PB push_back
#define MP make_pair
#define MT make_tuple
#define BIT(n) (1LL<<(n))
#define UNIQUE(v) v.erase(unique(ALL(v)), v.end())

using ll = long long;
using PII = pair<int, int>;
using VI = vector<int>;
using VD = vector<double>;
using VLL = vector<ll>;
using VS = vector<string>;
using VC = vector<char>;
using VB = vector<bool>;

const int MOD = 1000000007;
const int INF = 1000000000;

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




int main(){
    int a, b, c; cin >> a >> b >> c;
    bool okay = false;
    if(a < c && c < b) okay = true;
    if(b < c && c < a) okay = true;
    cout << (okay ? "Yes\n" : "No\n");
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
using vi  = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;

int main() {
  vvi c(3, vi(3));
  rep(i, 3) {
    rep(j, 3) {
      cin >> c[i][j];
    }
  }
  int a, b;
  a = c[0][0] - c[0][1];
  b = c[0][1] - c[0][2];
  bool check = false;
  rep(i, 2) {
    if (c[i+1][0] - c[i+1][1] == a && c[i+1][1] - c[i+1][2] == b) {
      check = true;
    }
    else {
      check = false;
      break;
    }
  }
  if (check) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 3596
#include<bits/stdc++.h>
using namespace std;
using lint = long long;
template<typename T = lint>inline T in() { T x; cin >> x; return x; }
#define INF           1e9
#define INFL          static_cast<lint>(INF)
#define REP(i,n)      for(lint i=0,i##_len=(n);i<i##_len;++i)
#define REP1(i,n)     for(lint i=1,i##_len=(n);i<=i##_len;++i)
#define REPR(i,n)     for(lint i=n-1;i>=0;--i)
#define REPR1(i,n)    for(lint i=n;i>0;--i)
#define REPI(i,ini,n) for(lint i=(ini),i##_len=(n);i<i##_len;++i)
#define REPC(i,obj)   for(auto i:obj)
#define R_UP(a,b)     (((a)+(b)-1)/(b))
#define ALL(obj)      (obj).begin(),(obj).end()
int main()
{
	int n = in();
	vector<int>a(n);
	REPC(&i, a)i = in();
	int q = in();
	REP(i, q)
	{
		int k = in();
		cout << lower_bound(a.begin(), a.end(), k) - a.begin() << endl;
	}
}


Measured memory_bytes: 3096