akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
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; }
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define mp make_pair
#define si(x) int(x.size())
const int mod=1000000007,MAX=400005;
const ll INF=1LL<<60;

int main(){
    
    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int N;cin>>N;
    ll ans=0;
    
    for(ll i=1;i<=N;i++){
        ll c=N/i;
        ans+=(1+c)*(c)/2*i;
    }
    
    cout<<ans<<endl;
    
}


Measured memory_bytes: 3640
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using u64 = unsigned long long;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

template<u32 M = 1000000007>
struct modint{
    u32 val;
    modint(): val(0){}
    template<typename T>
    modint(T t){t %= (T)M; if(t < 0) t += (T)M; val = t;}

    modint pow(ll k) const {
        modint res(1), x(val);
        while(k){
            if(k&1) res *= x;
            x *= x;
            k >>= 1;
        }
        return res;
    }
    template<typename T>
    modint& operator=(T t){t %= (T)M; if(t < 0) t += (T)M; val = t; return *this;}
    modint inv() const {return pow(M-2);}
    modint& operator+=(modint a){val += a.val; if(val >= M) val -= M; return *this;}
    modint& operator-=(modint a){if(val < a.val) val += M-a.val; else val -= a.val; return *this;}
    modint& operator*=(modint a){val = (u64)val*a.val%M; return *this;}
    modint& operator/=(modint a){return (*this) *= a.inv();}
    modint operator+(modint a) const {return modint(val) +=a;}
    modint operator-(modint a) const {return modint(val) -=a;}
    modint operator*(modint a) const {return modint(val) *=a;}
    modint operator/(modint a) const {return modint(val) /=a;}
    modint operator-(){return modint(M-val);}
    bool operator==(const modint a) const {return val == a.val;}
    bool operator!=(const modint a) const {return val != a.val;}
    bool operator<(const modint a) const {return val < a.val;}
};
using mint = modint<MOD>;

int main() {
    int n;
    cin >> n;
    vector<int> dp(1 << 20);
    for (int i = 0; i < n; ++i) {
        int x;
        scanf("%d", &x);
        dp[x]++;
    }
    for (int i = 0; i < 20; ++i) {
        for (int j = 0; j < (1 << 20); ++j) {
            if(!(j & (1 << i))) dp[j] += dp[j^(1 << i)];
        }
    }
    vector<mint> mul2(n+1);
    mul2[0] = 1;
    for (int i = 0; i < n; ++i) {
        mul2[i+1] = mul2[i]+mul2[i];
    }
    mint ans = 0;
    for (int i = 0; i < (1 << 20); ++i) {
        if(__builtin_popcount(i)&1) ans -= mul2[dp[i]];
        else ans += mul2[dp[i]];
    }
    cout << ans.val << "\n";
    return 0;
}


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

using vi = vector<int>;
using vvi = vector<vi>;

int main()
{
    ios_base::sync_with_stdio(0);

    int u = 10;

    vvi cost(u, vi(u));

    int h, w; cin >> h >> w;

    for(int i = 0; i < u; i++)
    for(int j = 0; j < u; j++)
        cin >> cost[i][j];

    vvi v(h, vi(w));

    for(int i = 0; i < h; i++)
    for(int j = 0; j < w; j++)
        cin >> v[i][j];

    vi dist(u, INT_MAX);
    set<vi> q;

    dist[1] = 0;
    q.insert({0, 1});

    while(!q.empty())
    {
        auto elt = *begin(q); q.erase(elt);

        int c = elt[0];
        int k = elt[1];

        for(int i = 0; i < u; i++) if(i != k)
        {
            int newc = c + cost[i][k];

            if(newc < dist[i])
            {
                dist[i] = newc;
                q.insert({dist[i], i});
            }
        }
    }

    int ans = 0;

    for(int i = 0; i < h; i++)
    for(int j = 0; j < w; j++) if(v[i][j] != -1)
        ans += dist[v[i][j]];

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

Measured memory_bytes: 384
#C問題
import math
N, K =map(int, input().split())
#確率
p = []
for i in range(1, N+1):
    if i < K:
        #print(i)
        a = math.ceil((math.log2(K/i)))
        #print(a)
        p.append((0.5**a)/N)
        #print(p)
    if i >= K:
        p.append(1/N)
        #print(p)
print(sum(p))

Measured memory_bytes: 6296
#include <iostream>
#include <algorithm>
#include <queue>
#include <map>

using namespace std;

int h, w, n;
int sx, sy;
char input[1002][1002];
char stage[1002][1002];

typedef pair<int, int> P;

int dir[] = { 0, 1, 0, -1, 0 };
map<int, P> chs;


int solve(int xs, int ys, int cur)
{
	if(cur > n) return 0;
	queue<P> que;
	queue<int> count;
	for (int i = 0; i < 1002; i++)
	{
		for (int j = 0; j < 1002; j++)
		{
			stage[i][j] = input[i][j];
		}
	}
	que.push(P(xs, ys));
	count.push(0);
	while (!que.empty())
	{
		P now = que.front(); que.pop();
		int c = count.front(); count.pop();
		for (int i = 0; i < 4; i++)
		{
			P next = P(now.first + dir[i], now.second + dir[i + 1]);
			if(stage[next.second][next.first] == 'X') continue;
			if(next == chs[cur])
			{
				return solve(next.first, next.second, cur + 1) + c + 1;
			}
			stage[next.second][next.first] = 'X';
			que.push(next);
			count.push(c + 1);
		}
	}
	return 0;
}

int main()
{
	fill(input[0], input[0] + sizeof(input), 'X');
	cin >> h >> w >> n;
	for (int i = 1; i < h + 1; i++)
	{
		for (int j = 1; j < w + 1; j++)
		{
			cin >> input[i][j];
			if(input[i][j] == 'S')
			{
				sy = i; sx = j;
			}
			char c = input[i][j] - '0';
			if(c < 10 && c > 0)
			{
				chs[c] = P(j, i);
			}
		}
	}
	cout << solve(sx, sy, 1) << endl;
	return 0;
}

Measured memory_bytes: 3196
using System;


class A {
    public long f(long b, long n){
        long ans = 0;
        if(n<b){
            ans = n;
        } else {
            ans = f(b,n/b)+n%b;
        }
        return ans;
    }
    public long calc(long n, long s){
        
        if(n<s) return -1;
        if(n==s) return n+1;
        long up = (long)Math.Sqrt(n)+1;
        for(long i=2;i<up;i++){
            if(s==f(i,n)){
                return i;
            }
        }
        
        for(long i=up;i>0;i--){
            if( (i+n-s)%i==0){
                long b = (i+n-s)/i;
                if(s==f(b,n)){
                    return b;
                }
            } 
        }
        return -1;
        
    }
}

class Program {
    static void Main(string[] args){
        A a = new A();
        long n = long.Parse(Console.ReadLine());
        long s = long.Parse(Console.ReadLine());
        Console.WriteLine(a.calc(n,s));
    }
}

Measured memory_bytes: 2648
#pragma gcc optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort(ALL(V)) //小さい方からソート
#define REV(V) reverse(ALL(V)) //リバース
#define RSORT(V) SORT(V);REV(V) //大きい方からソート
#define NPN(V) next_permutation(ALL(V)) //順列
#define pb(n) push_back(n)
#define endl '\n'
#define Endl '\n'
#define DUMP(x)  cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define yes(n) cout << ((n) ? "yes" : "no"  ) << endl
#define Yay(n) cout << ((n) ? "Yay!": ":(") << endl
#define RAPID cin.tie(0);ios::sync_with_stdio(false)
#define VSUM(V) accumulate(ALL(V), 0)
#define MID(a,b,c) (a) < (b) && (b) < (c)
#define MIDe(a,b,c) (a) <= (b) && (b) <= (c)
#define IN(n) cin >> n
#define IN2(a,b) cin >> a >> b
#define IN3(a,b,c) cin >> a >> b >> c 
#define IN4(a,b,c,d) cin >> a >> b >> c >> d
#define VIN(V) for(int i = 0; i < (V).size(); i++) {cin >> (V).at(i);}
#define OUT(n) cout << n << endl
#define VOUT(V) REP(i, (V).size()) {cout << (V)[i] << endl;}
#define VOUT2(V) REP(i, (V).size()) {cout << (V)[i] << " ";} cout<<endl;
#define FIX cout << fixed << setprecision(15)

// 型マクロ定義
#define int long long
#define P pair<ll,ll>
#define Vi vector<ll>
#define VVi vector<vector<ll>>
#define Vd vector<double>
#define Vb vector<bool>
#define Vs vector<string>
#define Vc vector<char>
#define M map<ll,ll>
#define S set<ll>
#define PQ priority_queue<ll>
#define PQG priority_queue<ll,V,greater<ll>
//

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

using ll = long long;
using Graph = vector<vector<int>>;

const int MOD = 1000000007;
const int INF = 1061109567;
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

int gcd(int a,int b){return b != 0 ? gcd(b, a % b) : a;} //最大公約数
int lcm(int a, int b){return a * b / gcd(a, b);}
string toStrUp(string str){char diff = 'A'-'a';REP(i,str.size()) str[i] += diff;return str;}
string gCh(string str, int key){return str.substr(key,1);}

signed main() {
  RAPID;
  // デフォルト変数定義
  int n=0,m=0,a=0,b=0,c=0,d=0,x=0,y=0,z=0;
  string s="",t="";
  //

  // ここから
  IN2(a,b);
  if(a > 0) OUT("Positive");
  else if (b >= 0) OUT("Zero");
  else if ((-(a+b))%2==1)OUT("Positive");
  else OUT("Negative");
}

Measured memory_bytes: 256
#include<algorithm>
#include<cstring>
#include <iostream>
#include <cstdio>
#include <queue>
#include <map>
#include <set>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<double,double> pdd;
typedef unsigned long long ull;
typedef set<int>::iterator sit;
#define st first
#define sd second
#define mkp make_pair
#define pb push_back
void tempwj(){freopen("hash.in","r",stdin);freopen("hash.out","w",stdout);}
ll gcd(ll a,ll b){return b == 0 ? a : gcd(b,a % b);}
ll qpow(ll a,ll b,ll mod){a %= mod;ll ans = 1;while(b){if(b & 1)ans = ans * a % mod;a = a * a % mod;b >>= 1;}return ans;}
struct cmp{bool operator()(const pii & a, const pii & b){return a.second < b.second;}};
int lb(int x){return  x & -x;}
//friend bool operator < (Node a,Node b)   重载
const int inf = 0x3f3f3f3f;
const ll INF = 0x3f3f3f3f3f3f3f3f;
const ll mod = 1e9 + 7;
const int maxn = 305+10;


int main()
{
	int n,d;
	scanf("%d%d",&n,&d);
	ll f = 1ll *d * d;
	int ans =0 ;
	for (int  i=1 ; i <= n; i ++ )
	{
		ll x,y;
		scanf("%lld%lld",&x,&y);
		ll temp = x * x + y * y;
		if(temp <= f)
		{
			ans ++ ;
		}

	}
	cout<<ans<<endl;

}



Measured memory_bytes: 3256
N, M = map(int, input().split()) 
ans = []
if M % 2 != 0:
    for i in range((M + 1)//2):
        ans.append((1 + i, M + 1 - i))
        
    for j in range((M - 1)//2):
        ans.append((M + 2 + j, 2*M + 1 - j))
else:
    for i in range(M//2):
        ans.append((1 + i, M + 1 - i))
        ans.append((M + 2 + i, 2*M + 1 - i))
              
for i in range(M):
    print(*ans[i])

Measured memory_bytes: 74044
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned ll
#define ld long double
#define pb push_back
#define pf push_front
#define dll deque<ll>
#define vll vector<ll>
#define pll pair<ll,ll>
#define mapll map<ll,ll>
#define endl "\n"
#define all(v) v.begin(),v.end()
#define deb(x) cout<<x
using namespace std;
void swap(auto*,auto*);
ld dist(ll x1,ll y1,ll x2,ll y2)
{
	return (ld)sqrt((ll)pow(x1-x2,2)+(ll)pow(y1-y2,2));
}
int main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    ll n; cin>>n; ll last=0;
    if(n%2==0) cout<<-1<<endl;
    else{
    unordered_set<ll> s; ll c=1; ll k=7;
    for(;;c++)
    {
    	if(k<n) k+=7*pow(10,c);
    	else break;
    }
    s.insert(k%n); ll x=k%n; bool flag=0;
    for(;;c++)
    {
    	if(x==0) break;
    	x=(x*10+7)%n;
    	if(s.find(x)!=s.end()) {flag=1; break;}
    	else s.insert(x);
    }
    if(flag) cout<<-1<<endl;
    else
    cout<<c<<endl;
}
}
void swap(auto &a,auto &b)
{
    auto temp=a; a=b; b=temp;
}

Measured memory_bytes: 43096
(defparameter x (read))
(defparameter y (read))
(defparameter a (- (* x 2) (/ y 2)))
(defparameter b (/ (- y (* x 2)) 2))

(if (and (integerp a) (integerp b) (>= a 0) (>= b 0))
 (princ "Yes")
   (princ "No")
 )

Measured memory_bytes: 24376
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<stdint.h>
#include<malloc.h>
#include<math.h>
#include<x86intrin.h>


int my_gets(char *buf,int nBuf,FILE *fp){
    int ch;

    while(--nBuf >0){
        ch=getc(fp);
        if(ch==EOF || ch=='\n')
            break;
        *(buf++)=(char)ch;
    }
    *(buf)='\0';

    return nBuf;
}

void InputIntAry(int *a,int nDigit,int N){      //nDigitは想定される最大桁数
    char *buf,*ptr;

    buf=(char*)malloc( (N*(nDigit+2)) * sizeof(char) );
    my_gets(buf,N*(nDigit+2),stdin);

    ptr=strtok(buf," ");
    while(ptr!=NULL && N-->0){
        *(a++)=atoi(ptr);
        ptr=strtok(NULL," ");
    }
    free(buf);
}

int CmpInt(const void *a, const void *b){        //b-aを返す(qsortなら4321)
    return *((int*)b)- *((int*)a);
}

typedef struct{
    int A,B;
} JobInfo_t;

int CmpJob(const void *p1, const void *p2){
    JobInfo_t Job1=*(JobInfo_t*)p1, Job2=*(JobInfo_t*)p2;

    if(Job1.A == Job2.A){
        return Job2.B - Job1.B;
    }
    else{
        return Job1.A - Job2.A;
    }
}

#define MAX_OF(a,b) (((a)>(b))?(a):(b))

int main(){
    int A,B;

    scanf("%d %d",&A,&B);
    printf("%d\n", MAX_OF(A+B,MAX_OF(A*B,A-B)));

    return 0;
}

/*int main(){
    int N,M;
    JobInfo_t Job[100000];

    scanf("%d %d%*c", &N, &M);
    for(int i=0;i<N;i++){
        scanf("%d %d%*c", &(Job[i].A), &(Job[i].B));
    }
    qsort(Job, N, sizeof(JobInfo_t), CmpJob);

    int allowed=0,max;
    for(int i=0;i<N;i++){
        
    }
    return 0;
} */

Measured memory_bytes: 128
#include <iostream>
using namespace std;
int main (){

	int H ,W;

	while (1){
		cin >> H >> W ;
		if ( H == 0 && W == 0)break;

		for (int i = 0; i < H;i++){
			for (int j = 0;j < W ;j++){
				cout << "#";
			}
		cout << "\n" ;
		}

		cout << endl;

	}
	return 0;
}

Measured memory_bytes: 1156
#include<bits/stdc++.h> 
using namespace std; 
  
int main() 
{ 
int a,b,c;
cin>>a>>b>>c;
 if (a == 5 && b == 5 && c == 7)cout << "YES" << endl;
    else if (a == 5 && b == 7 && c == 5)cout << "YES" << endl;
    else if(a == 7 && b == 5 && c == 5)cout << "YES" << endl;
    else cout << "NO" << endl;
    

  return 0;
} 

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> P;
map <int,int> mp;
vector<int> V;
list<int> L;
stack<int> S;
queue<int> Q;
deque<int> dq;
#define INF (1<<30)
#define INFLL (1ll<<60)
#define EPS (1e-10)
static const int MAX=1e5;
static const int MOD=1e9+7;
static const int NMAX=50;
static const int MMAX=50;
int a,b;
int main(){
    cin.tie(0);  ios::sync_with_stdio(false);
    cin>>a>>b;
    cout<<(a<=b?a:a-1)<<"\n";
    
    
    return 0;
}


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

cnt=0
for i in range(k):
    cnt+=p[i]
ans=cnt
for j in range(k,n):
    cnt=cnt-p[j-k]+p[j]
    ans=max(cnt,ans)


print('{:.20f}'.format((ans+k)/2))

Measured memory_bytes: 24812
#include<iostream>
#include<cstdio>
using namespace std;
typedef long long LL;
LL res;
LL a[300],ans[10],flag[10];

void dfs(int pos,int cnt){
    if(pos>4){
        if(cnt==3){
            LL sum=1;
            for(int i=0;i<5;i++){
                if(flag[i])
                    sum*=ans[i];
            }
            res+=sum;
        }
        return;
    }
    if(ans[pos]){
        flag[pos]=1;
        dfs(pos+1,cnt+1);
        flag[pos]=0;
    }
    dfs(pos+1,cnt);
}

int main(){
    int n;
    scanf("%d",&n);
    for(int i=1;i<=n;i++){
        char s[105];
        scanf("%s",s);
        if(s[0]=='M')
            ans[0]++;
        if(s[0]=='A')
            ans[1]++;
        if(s[0]=='R')
            ans[2]++;
        if(s[0]=='C')
            ans[3]++;
        if(s[0]=='H')
            ans[4]++;
    }
    dfs(0,0);
    printf("%lld\n",res);
    return 0;
}


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

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

typedef long long ll;

class BIT{
public:
	vector<ll> bit;
	int n;
	//1-indexed
	BIT(){init();}
	BIT(int n):n(n){init();}
	void init(){
		bit.clear();
		bit.resize(n+1,0);
	}
	ll sum(int i){
		ll s=0;
		while(i>0){
			s+=bit[i];
			i-=i&-i;
		}
		return s;
	}
	void add(int i,ll x){
		while(i<=n){
			bit[i]+=x;
			i+=i&-i;
		}
	}
	ll sum0(int i){
		return sum(i+1);
	}
	void add0(int i,ll x){
		add(i+1,x);
	}
};

const int MAX_N=2*1e5+5;
ll a[MAX_N],b[MAX_N];

int main(){
	ll n,k;
	cin>>n>>k;
	BIT bit(n+1);
	rep(i,n){
		cin>>a[i+1];
		a[i+1]+=a[i]-k;
		b[i+1]=a[i+1];
	}
	sort(b,b+n+1);
	map<ll,ll> data;
	int cnt=0;
	rep(i,n+1){
		if(i){
			if(b[i]!=b[i-1])data[b[i]]=cnt++;
		}
		else data[b[i]]=cnt++;
	}
	ll ans=0;
	rep(i,n+1){
		ans+=bit.sum0(data[a[i]]);
		bit.add0(data[a[i]],1);
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 17408
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;

int main()
{
	int n, h, w;
	cin>>n>>h>>w;
	cout<<(n-h+1)*(n-w+1)<<endl;
	return 0;
}

Measured memory_bytes: 256
P = 998244353
A, B, C, D = map(int, input().split())
X = [[0] * 3001 for _ in range(3001)]
X[A][B] = 1
for a in range(A, 3001):
    for b in range(B, 3001):
        X[a][b] += (X[a-1][b] * b + X[a][b-1] * a - X[a-1][b-1] * (a-1) * (b-1)) % P

print(X[C][D])

Measured memory_bytes: 136548
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define stoi stoll
using pii=pair<int,int>;
#define all(c) begin(c),end(c)
#define rall(c) rbegin(c),rend(c)
#define fore(x,c) for(auto &&x:c)
#define rep(i,a,n) for(int i=a,i##len=(int)(n);i<i##len;++i)
#define rrep(i, a, n) for(int i=(int)(n-1);i>=a;--i)
#define sz(c) ((int)c.size())
#define contains(c,x) (c.find(x)!=end(c))
#define inseg(l,x,r) ((l)<=(x)&&(x)<(r))
#define dump(...)
#define pb push_back
#define _ 0
const signed INF_=1001001001; const long long INF=1001001001001001001LL;
const int DX[9]={0,1,0,-1,1,1,-1,-1,0},DY[9]={-1,0,1,0,-1,1,1,-1,0};
template<class T> ostream& operator<<(ostream &os,const vector<T> &v) {
    for (auto i = begin(v); i != end(v); i++) os<<*i<<(i==end(v)-1?"":" ");return os;}
template<class T> istream& operator>>(istream &is,vector<T> &v) {
    for (auto i = begin(v); i != end(v); i++) is>>*i;return is;}
template<class T,class U> istream& operator>>(istream &is, pair<T,U> &p) {
    is>>p.first>>p.second;return is;}
template<class T, class U> bool chmax(T &a,const U &b){return a<b?a=b,1:0;}
template<class T, class U> bool chmin(T &a,const U &b){return a>b?a=b,1:0;}
template <class T> void psum(T& c) {partial_sum(begin(c), end(c), begin(c));}
template<class T> using heap=priority_queue<T,vector<T>,greater<T>>;
struct before_main_function {
    before_main_function() {
        cin.tie(0); ios::sync_with_stdio(0);
        cout << setprecision(15) << fixed;
        // #define endl "\n"
    }
} before_main_function;
//------------------8<------------------------------------8<--------------------

signed main() {
    int A, B, T;
    cin >> A >> B >> T;
    int t = T / A;
    cout << t * B << endl;
    return (0^_^0);
}



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

using namespace std;

#define ll long long
#define ld long double
#define P pair<ll, ll>

#define FORm(i, m) for (auto i = m.begin(); i != m.end(); i++)

#define all(v) v.begin(), v.end()

#define sortAl(v) sort(all(v))
#define sortAlr(v)          \
  sort(v.begin(), v.end()); \
  reverse(v.begin(), v.end())

#define cout(n) cout << fixed << setprecision(n)

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

template <class T>
inline void chmax(T &a, T b) {
  a = std::max(a, b);
}
template <class T>
inline void chmin(T &a, T b) {
  a = std::min(a, b);
}

#define mod (ll)(1e9 + 7)
#define INF LLONG_MAX

vector<vector<pair<ll, ll>>> b(100001);
vector<ll> nodes(100001);

void update_branch(int n) {
  FORm(itr, b[n]) {
    if (itr->first == 1 || nodes[itr->first]) {
      continue;
    }
    nodes[itr->first] = nodes[n] + itr->second;
    update_branch(itr->first);
  }
}

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

  ll n;
  cin >> n;

  rep(i, n - 1) {
    vector<ll> tmp(3);
    cin >> tmp[0] >> tmp[1] >> tmp[2];
    b[tmp[0]].push_back(make_pair(tmp[1], tmp[2]));
    b[tmp[1]].push_back(make_pair(tmp[0], tmp[2]));
  }

  update_branch(1);

  REP(i, n + 1) {
    cout << nodes[i] % 2 << endl;
  }

  return 0;
}


Measured memory_bytes: 9472
import java.util.*;
 
class Main{
    Scanner sc = new Scanner(System.in);
 
    Main(){
    int a=sc.nextInt();
    int b=sc.nextInt();
    System.out.print( (a/b)+" "+(a%b)+" " );
    System.out.printf("%.8f\n", (double)a/b );
    }
 
    public static void main(String[] args){
    new Main();
    }
}


Measured memory_bytes: 26464
#include<bits/stdc++.h>
typedef long long ll;
#define REP(i,n) for(int i = 0;i < (n);i++)
#define rep(i,m,n) for(int i = (m);i < (n);i++)
#define P pair<int,int>
#define pb push_back
#define mk make_pair
using namespace std;
#define Vec(a) vector <int> a
const int INF = 1 << 20;
const int MOD = 1e9+7;





int main(){
  string s,t;
  cin >> s >> t;
  if(s.size() > t.size()){
    cout << "GREATER" << endl;
    return 0;
  }
  else if(s.size() < t.size()){
    cout << "LESS" <<endl;
    return 0;
  }
  else{
    REP(i,s.size()){
      int a = s[i] - '0';
      int b = t[i] - '0';
      if(a > b){
	cout << "GREATER" << endl;
	return 0;
      }
      else if(b > a){
	cout << "LESS" <<endl;
	return 0;
      }
    }
  }
  cout << "EQUAL" << endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdlib>
#include<cstring>
#include<stack>
#include<queue>
#include<algorithm>
#include<vector>
#include<math.h>
#include<bitset>
#include<iomanip>
#include<numeric>
using namespace std;

typedef stack<int> IntStack;
typedef queue<int> IntQueue;

const double pi = 3.141592653589793;


//文字0~9をint型0~9に変換
int char_to_int(char c)
{
	if (c == '0') return 0;
	if (c == '1') return 1;
	if (c == '2') return 2;
	if (c == '3') return 3;
	if (c == '4') return 4;
	if (c == '5') return 5;
	if (c == '6') return 6;
	if (c == '7') return 7;
	if (c == '8') return 8;
	if (c == '9') return 9;
	else return -1;
}
//a^b mod MODを計算
long long int ModPower(long long int a, long long int b, long long int MOD)
{
	if (b == 0) return 1;
	else if (b % 2 == 0)
	{
		long long int d = ModPower(a, b / 2, MOD);
		return (d*d) % MOD;
	}
	else
	{
		return (a*ModPower(a, b - 1, MOD)) % MOD;
	}
}
//nCr mod MODを計算
long long int ModCombi(long long int n, long long int r, long long int MOD)
{
	if (n == 0 || r == 0) return 1;

	long long int Kn = 1, Kr = 1, Knr = 1;

	long long int temp = 1;
	for (long long int i = 1; i <= n; i++)
	{
		temp *= i;
		temp %= MOD;
		if (i == n) Kn = temp;
		if (i == r) Kr = temp;
		if (i == n - r) Knr = temp;
	}

	long long int x = ModPower(Kr, MOD - 2, MOD);
	long long int y = ModPower(Knr, MOD - 2, MOD);

	long long int ans;
	ans = Kn * x;
	ans %= MOD;
	ans *= y;
	ans %= MOD;

	return ans;
}


/*ここまでテンプレ*//*ここまでテンプレ*//*ここまでテンプレ*//*ここまでテンプレ*/



int main()
{
	int N;
	pair<long int, long int> BA[200005];

	cin >> N;
	for (int i = 0; i < N; i++)
	{
		cin >> BA[i].second >> BA[i].first;
	}

	sort(BA, BA + N);

	long long int S = 0;

	bool j = true;
	for (int i = 0; i < N; i++)
	{
		S += BA[i].second;
		if (S > BA[i].first)
		{
			j = false;
			break;
		}
	}

	if (j) cout << "Yes";
	else cout << "No";

	return 0;
}


Measured memory_bytes: 3328
#include<bits/stdc++.h>
using namespace std;
#define int long long
inline int read()
{
    int f=1,w=0;char x=0;
    while(x<'0'||x>'9') {if(x=='-') f=-1; x=getchar();}
    while(x!=EOF&&x>='0'&&x<='9') {w=(w<<3)+(w<<1)+(x^48);x=getchar();}
    return w*f;
}
const int N=200010;
const int INF=1e18;
int num_edge,n,Cnt;
int Cir[N],Vis[N],Val[N];
int head[N<<1],fa[N],Jud[N];
struct Edge{int next,to;} edge[N<<1];
inline void Add(int from,int to)
{
	edge[++num_edge].next=head[from];
	edge[num_edge].to=to;
	head[from]=num_edge;
}
inline void Dfs(int pos)
{
	for(int i=head[pos];i;i=edge[i].next)
		if(!Cir[edge[i].to]) Dfs(edge[i].to);
	for(int i=head[pos];i;i=edge[i].next)
		if(!Cir[edge[i].to]) Jud[Val[edge[i].to]]=1;
	for(;Jud[Val[pos]];Val[pos]++);
	for(int i=head[pos];i;i=edge[i].next)
		if(!Cir[edge[i].to]) Jud[Val[edge[i].to]]=0;
}
main(){
	int pos=1;n=read();
	for(int i=1;i<=n;i++) fa[i]=read(),Add(fa[i],i);
	for(;!Vis[pos];pos=fa[pos]) Vis[pos]=1;
	for(;!Cir[pos];pos=fa[pos]) Cir[pos]=1;
	int Max=-1,Min=INF;
	for(int i=1;i<=n;i++)
		if(Cir[i]) Cnt++,Dfs(i),Max=max(Max,Val[i]),Min=min(Min,Val[i]);
	if(Max==Min&&Cnt&1) puts("IMPOSSIBLE");
	else puts("POSSIBLE");
}


Measured memory_bytes: 15360
#include <math.h>

#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
#define PI 3.14159265358979323846264338327950L
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define SIZE_OF_ARRAY(array) (sizeof(array) / sizeof(array[0]))

int main() {
  int A, B, C;

  cin >> A >> B >> C;

  if (A <= C && C <= B)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}


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

template<typename T_char>
T_char ToUpper(T_char cX){return toupper(cX);}

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

  cout << s.substr(0,3);
  return 0;
}

Measured memory_bytes: 3596
#include <iostream>
#include <cmath>
#include <climits>
#include <string>
#include <numeric>
#include <vector>
#include <queue>
#include <map>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <set>

using namespace std;
using ll = long long;

template<typename T> void print(T t) { cout << t << endl; }
ll MOD = 1000000007;

int main() {
	ll X, n;
	cin >> X;
	for (n = 0; X * 2 > n * (n + 1); n++) {}
	print(n);
}


Measured memory_bytes: 3636
#include<bits/stdc++.h>
#define F first
#define S second
using namespace std;

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

    for (int i = 1; i < n; i++) {
        if (x[i - 1] != x[i]) {
            s += x[i - 1];
        }
    }
    if (s[s.size() - 1] != x[n - 1]) s += x[n - 1];
    cout << s.size() << "\n";
}


Measured memory_bytes: 512
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <complex>
#include <string>
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()

vector<int> del1(vector<int> v) {
  REP(j,9) {
    if (count(ALL(v), j) >= 3) {
      v.erase(find(ALL(v),j));
      v.erase(find(ALL(v),j));
      v.erase(find(ALL(v),j));
    }
  }
  return v;
}
vector<int> del2(vector<int> v) {
  REP(j,7) {
    while(true) {
      vector<int>::iterator i1 = find(ALL(v),j), i2 = find(ALL(v),j+1),i3 = find(ALL(v),j+2);
      if (i1!=v.end()&&i2!=v.end()&&i3!=v.end()) {
        v.erase(i1); v.erase(i2-1); v.erase(i3-2);
      } else {
        break;
      }
    }
  }
  return v;
}

bool func(vector<int> v) {
  REP(i,9) {                         
    vector<int> vv(v);
    if (count(ALL(vv), i) < 2) continue;
    vv.erase(find(ALL(vv),i));
    vv.erase(find(ALL(vv),i));

    vector<int> vvv(vv);  
    vvv = del1(vvv);
    vvv = del2(vvv);

    if (vvv.size()==0)
      return true;
    vvv = vv;
  
    vvv = del2(vvv);
  
    vvv = del1(vvv);
   
    if (vvv.size()==0)
      return true;
  }
  return false;
}

int main() {
  string s;
  while(cin>>s) {

    vector<int> v(13);
    REP(i,13)
      v[i] = s[i] - '1';
    
    int f = 0;
    REP(i,9) {
      if (count(ALL(v), i)==4) continue;
      vector<int> vv(v);
      vv.push_back(i);
      sort(ALL(vv));
      if (func(vv)) {
        if (f)
          cout << " ";
        cout << i + 1;
        f = 1;
      }
    }
    if (f==0) cout << 0;
    cout << endl;
  }
}

Measured memory_bytes: 0
import sys
sys.setrecursionlimit(10**7)
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return sys.stdin.readline().strip()
def LILI(n): return [LI() for _ in range(n)]
INF = 10 ** 18
MOD = 10 ** 9 + 7

def main(): 
    N = II()
    p = LF()

    # dp[これまでに表が出た数][コインの番号], 中身は確率
    dp = [[0.0 for _ in range(N+1)] for _ in range(N)]
    dp[0][0] = 1 - p[0]
    dp[0][1] = p[0]

    for i, pos in enumerate(p[1:]):
        for j in range(i+2):
            dp[i+1][j] += dp[i][j]*(1-pos)
            dp[i+1][j+1] += dp[i][j]*pos

    ans = sum(dp[N-1][N//2+1:])

    print(ans)

main()

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

int main(){
  long long A, B, C;
  cin >> A >> B >> C;
  long long count = 0;
  for(;A % 2 == 0 && B % 2 == 0 && C % 2 == 0;){
    if(A == B && B == C){
      cout << -1 << endl;
      return 0;
    }
    long long a, b, c;
    a = A / 2;
    b = B / 2;
    c = C / 2;
    A = b + c;
    B = a + c;
    C = a + b;
    count++;
  }
  cout << count << endl;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
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;
}
using ll = long long;
const ll MOD = 1e9 + 7;
const long long INF = 1LL << 60;

int main()
{
    int n;
    cin >> n;
    vector<int> a(3 * n);
    rep(i, 3 * n) cin >> a.at(i);

    sort(a.begin(), a.end(), greater<int>());

    ll answer = 0;
    ll count = 1;
    for (int i = 1; i < 3 * n; i += 2)
    {
        if (count > n)
            break;
        answer += a.at(i);
        count++;
    }

    cout << answer << endl;
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    string s;
    cin >> s;
    int y=stoi(s.substr(0,4));
    int m=stoi(s.substr(5,6));
    string ans="TBD";
    if (y<=2018 || (y==2019 && m<=4)) ans="Heisei";
    cout << ans << endl;
}

Measured memory_bytes: 256
//arc075_d.cpp
//Tue Jul  9 21:52:46 2019

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

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

	ll h[n];
	for (int i=0;i<n;i++){
		cin >> h[i];
	}

	sort(h,h+n,greater<ll>());

	int start = 0;
	int end = h[0]/b+2;
	ll ans = LLINF;
	while (abs(start-end)>1){
		ll mid = (start+end)/2;
		ll temp = 0;
		for (int i=0;i<n;i++){
			if (h[i]>mid*b){
				ll x = (h[i]-mid*b)/(a-b);
				if ((h[i]-mid*b)%(a-b)!=0){
					x++;
				}
				temp = temp + x;
			}
		}
//		cout << start << " " << end << " " << temp << " " << mid << endl;
		if (temp<=mid){
			if (ans > mid){
				ans = mid;
			}
			end = mid;
		}else {
			start = mid;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {
	public static void main(String ...args) {
		try(Scanner scanner = new Scanner(System.in)){
			int N = scanner.nextInt();
			String N2 = Integer.toBinaryString(N);
			String N3 = N2.replaceAll("1", "0");
			String N4 = N3.replaceFirst("^0", "1");
			System.out.println(Integer.parseInt(N4, 2));
		}
	}
}


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
#define REP(i, n) for(int i=0; i<n; i++)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const ll MOD = 1e9+7;

ll H[100100];
int main(){
    int N;
    cin >> N;
    REP(i,N){
        ll h;
        cin >> h;
        H[i] = h;
    }

    bool ans = true;
    ll last = H[N-1];
    for(int i = N-2; i >= 0; i--){
        ll h = H[i];
        if(last < h){
            if(h - last >= 2) ans = false;
            else h--;
        }
        last = h;
    }

    if(ans){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 1024
#include <stdio.h>
#include <assert.h>
#include <fstream>
#include <iostream>
#include <algorithm>
#include <array>
#include <vector>
#include <queue>
#include <set>
#include <cmath>
#include <unordered_map>

long long pow_mod(long long x, long long n, long long mod_num) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) { res = (res * x) % mod_num; }
        x = (x * x) % mod_num;
        n = (n >> 1);
    }
    return res;
}

class Combi_Num {
    public:
    long long mod_num;
    std::vector<long long> factorial, factorial_inv, inv;
    Combi_Num() {}
    Combi_Num(const int n, const long long mod_num_in) {
        mod_num = mod_num_in;
        factorial.resize(n+1, 0);
        factorial_inv.resize(n+1, 0);
        inv.resize(n+1, 0);
        factorial[0] = 1;
        factorial_inv[0] = 1;
        inv[0] = 1;
        for (int i = 1; i <= n; i++) {
            factorial[i] = (factorial[i-1] * i) % mod_num;
            inv[i] = pow_mod(i, mod_num - 2, mod_num);
            factorial_inv[i] = (factorial_inv[i-1] * inv[i]) % mod_num;
        }
    }

    long long calc(const int n, const int r) {
        return (factorial[n] * ((factorial_inv[r] * factorial_inv[n-r]) % mod_num)) % mod_num;
    }
};

const long long MOD = 1000000007;
const int MAX_N = 100050;
int N;
long long A[MAX_N];

Combi_Num combi_num = Combi_Num(MAX_N, MOD);
long long ac[MAX_N];

int main(int argc, char **argv) {
    std::cin >> N;

    for (int i = 1; i <= N; i++) {
        std::cin >> A[i];
    }

    ac[0] = 0;
    for (int i = 1; i <= N; i++) {
        ac[i] = ac[i-1] + (combi_num.factorial[N] * combi_num.inv[i]) % MOD;
        ac[i] = ac[i] % MOD;
    }

    long long ret = 0;
    for (int i = 1; i <= N; i++) {
        long long tmp = 0;
        tmp = (tmp + ac[i]) % MOD;
        tmp = (tmp + ac[N-i+1]) % MOD;
        tmp = (tmp - ac[1] + MOD) % MOD;
        ret = ret + (tmp * A[i]) % MOD;
        ret = ret % MOD;
    }

    std::cout << ret << std::endl;
    
    return 0;
}

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

int main()
{
    int a,b,c,d;
    int k;
    cin>>k;
    d=k%10;
    k/=10;
    c=k%10;
    k/=10;
    b=k%10;
    k/=10;
    a=k;

    while(1)
    {
        if(a+b+c+d==7) {cout<<a<<"+"<<b<<"+"<<c<<"+"<<d<<"=7"<<endl;return 0;}
        if(a+b+c-d==7) {cout<<a<<"+"<<b<<"+"<<c<<"-"<<d<<"=7"<<endl;return 0;}
        if(a+b-c+d==7) {cout<<a<<"+"<<b<<"-"<<c<<"+"<<d<<"=7"<<endl;return 0;}
        if(a-b+c+d==7) {cout<<a<<"-"<<b<<"+"<<c<<"+"<<d<<"=7"<<endl;return 0;}
        if(a-b-c+d==7) {cout<<a<<"-"<<b<<"-"<<c<<"+"<<d<<"=7"<<endl;return 0;}
        if(a-b+c-d==7) {cout<<a<<"-"<<b<<"+"<<c<<"-"<<d<<"=7"<<endl;return 0;}
        if(a+b-c-d==7) {cout<<a<<"+"<<b<<"-"<<c<<"-"<<d<<"=7"<<endl;return 0;}
        if(a-b-c-d==7) {cout<<a<<"-"<<b<<"-"<<c<<"-"<<d<<"=7"<<endl;return 0;}
        break;

    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long a[3],t,b,ans;
int main()
{
	cin>>a[0]>>a[1]>>a[2];
	sort(a,a+3);
	ans=a[2]-a[1]; 
	a[1]+=ans;
	a[0]+=ans;
	ans+=(a[2]-a[0])/2;
	if((a[2]-a[0])%2)ans+=2;
	cout<<ans<<endl; 
}

Measured memory_bytes: 256
function main(input) {
   input = input.trim();
  const a = input.split("");
  a.sort();
  console.log(a[0] == a[1]
		    &&a[2] == a[3]
		    &&!(a[0] == a[2])?"Yes":"No");
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 29456
N = int(input())
As = list(map(int, input().split()))

# 偶数２つ　→　偶数
# 奇数２つ　→　偶数

# 奇数が偶数個ある必要がある
# 偶数は何個でも構わない

if sum(map(lambda x : x % 2, As)) % 2 == 0:
  print("YES")
else:
  print("NO")

Measured memory_bytes: 14108
ans=0
n=gets.chomp.to_i
def dvi(n)
  d=0
  for i in 1..n
    d += 1 if n%i==0
  end
  return d
end

while n>=0
 if n%2==0
   n-=1
 else
   ans+=1 if dvi(n)==8
   n-=2
 end
end

puts ans

Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
// --------------------------------------------------------
#define FOR(i,l,r) for (int i = (l); i < (r); ++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(c) (c).begin(), (c).end()
#define RALL(c) (c).rbegin(), (c).rend()
#define SORT(c) sort(ALL(c))
#define RSORT(c) sort(RALL(c))
#define MIN(c) *min_element(ALL(c))
#define MAX(c) *max_element(ALL(c))
#define SUM(c) accumulate(ALL(c), 0)
#define SUMLL(c) accumulate(ALL(c), 0LL)
#define SZ(c) ((int)(c).size())
#define debug(x) cerr << #x << " = " << (x) << '\n';
using P = pair<int,int>;
using VP = vector<P>;
using VVP = vector<VP>;
using VS = vector<string>;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<ll>;
using VVLL = vector<VLL>;
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const ll MOD = 1000000007;
// const ll MOD = 998244353;
const int INF = 1 << 30;
// const ll INF = 1LL << 62;
// --------------------------------------------------------


int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(10);

    int N, L; cin >> N >> L;

    int ans = 0;
    if (L >= 0) {
        FOR(i, 2, N + 1) ans += i - 1 + L;
    } else if (N - 1 >= -L) {
        FOR(i, 1, N + 1) ans += i - 1 + L;
    } else {
        FOR(i, 1, N) ans += i - 1 + L;
    }
    cout << ans << '\n';

    return 0;
}


Measured memory_bytes: 3588
#include <iostream>
using namespace std;
 
int main() {
	// your code goes here
	int n,k;
	cin>>n>>k;
	int a[n+5],sum[n+4],i;
	for(i=0;i<n;i++)
	cin>>a[i];
	sum[0]=a[0];
	for(i=k;i<n;i++)
	{
		if(a[i]>a[i-k])
		cout<<"Yes"<<endl;
		else
		cout<<"No"<<endl;
	}
	return 0;
}

Measured memory_bytes: 4416
#include <cstdio>
#include <algorithm>
#define N 500500
using namespace std;

typedef long long lld;
inline lld ABS(lld x) {return (x<0ll) ? -x : x;}
lld n,i,D,Q,d[N],now[N],f[N];

int main() {
	scanf("%lld%lld",&n,&D);
	for (i=1;i<=n;i++) scanf("%lld",d+i);
	now[1] = D;
	for (i=2;i<=n;i++) now[i] = min(now[i-1],ABS(now[i-1] - d[i-1]));
	f[n] = 1;
	for (i=n-1;i>0;i--) if (d[i+1] && f[i+1]*2 > d[i+1]) f[i] = f[i+1] + d[i+1];  else f[i] = f[i+1];
	
	for (scanf("%lld",&Q);Q--;) {
		scanf("%lld",&i);
		puts(f[i] <= now[i] ? "YES" : "NO");
	}
}

Measured memory_bytes: 13568
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define int long long
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e18;

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    string s;
    cin >> s;
    int cnt = 0;
    int ans = 1;
    for(int i = 0; i < s.size(); i++){
        if(s[i] == 'B'){
            if(cnt % 2 == 0){
                cnt++;
            }else{
                (ans *= cnt) %= mod;
                cnt--;
            }
        }else{
            if(cnt % 2 == 0){
                (ans *= cnt) %= mod;
                cnt--;
            }else{
                cnt++;
            }
        }
    }
    if(cnt != 0) ans = 0;
    for(int i = 1; i <= n; i++) (ans *= i) %= mod;
    cout << ans << endl;
}

Measured memory_bytes: 720
#include<iostream>
#include<algorithm>

using namespace std;

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

    int a[1000000];
    fill(a, a + 1000000, 0);
    a[s]++;
    for(int i = 2; true; i++){
        if (s % 2 == 0) {
            s /= 2;
        }else{
            s = 3 * s + 1;
        }
        if (a[s] > 0) {
            cout << i << '\n';
            return 0;
        }
        a[s]++;
    }
    
}

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

#define sz(a) int((a).size())
#define all(c) c.begin(), c.end()
#define ll long long
#define pb push_back
#define zoom                          \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);
#define pl pair<ll, ll>
#define MOD 1000000007
#define endl "\n"
#define ff first
#define ss second
#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
#define trace(v)                                   \
    for (auto it = v.begin(); it != v.end(); it++) \
        cerr << *it << " ";                        \
    cerr << endl;
#define tr(container, it) \
    for (typeof(container.begin()) it = container.begin(); it != container.end(); it++)

#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)

typedef pair<int, int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pii> vpi;
typedef vector<pll> vpl;
typedef vector<vi> vvi;

void solve()
{
    int n;
    cin>>n;

    if(n>=400 && n<600){
        cout<<"8"<<endl;
        return;
    } 
    if(n>=600 && n<800){
        cout<<"7"<<endl;
        return;
    } 
    if(n>=800 && n<1000){
        cout<<"6"<<endl;
        return;
    } 
    if(n>=1000 && n<1200){
        cout<<"5"<<endl;
        return;
    } 
    if(n>=1200 && n<1400){
        cout<<"4"<<endl;
        return;
    } 
    if(n>=1400 && n<1600){
        cout<<"3"<<endl;
        return;
    } 
    if(n>=1600 && n<1800){
        cout<<"2"<<endl;
        return;
    } 
    if(n>=1800 && n<2000){
        cout<<"1"<<endl;
        return;
    }
}

int main()
{
    zoom;
    ll t=1;
    //cin >> t;

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

Measured memory_bytes: 3604
#include<string>
#include<stdio.h>
#include<iostream>
#include<iomanip>
#include<ios>
#include<algorithm>
#include<stack>
#include<queue>
#include<cmath>
#include<type_traits>
#include<random>
#include<vector>

using namespace std;

	

int main()
{
int A,B;

cin >> A >> B;

bool judge = 0;

for(int i=1;i<21;i++)
{
	if(A*i == B)
	{
		judge = 1;
	}
}

if(judge == 1)
{
	cout << A + B;
}
else
{
	cout << B - A;
}


}

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

const int MAX = 2100;


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

    vector<int> cum(MAX, 0), c(MAX+1, 0);
    for(int i=0; i<n; i++) c[l[i]]++;
    for(int i=0; i<MAX; i++) cum[i+1] = cum[i] + c[i]; // 累積和

    ll ans = 0;
    for(int i=0; i<n; i++){
        for(int j=0; j<n; j++){
            if(i == j) continue;
            int left = abs(l[i] - l[j]) + 1;
            int right = l[i] + l[j];
            int count = cum[right] - cum[left];
            if(left <= l[i] && l[i] < right) count--;
            if(left <= l[j] && l[j] < right) count--;
            ans += max(count, 0);
        }
    }

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

Measured memory_bytes: 3644
n=list(input())
for i in range(len(n)):
    n[i]=int(n[i])

ans=""
for i in range(1<<3):
    num=n[0]
    num += n[1] if (i>>0)&1 else -n[1]
    num += n[2] if (i>>1)&1 else -n[2]
    num += n[3] if (i>>2)&1 else -n[3]
    if num==7:
        ans=str(n[0])
        ans+= "+" if (i>>0)&1 else "-"
        ans+= str(n[1])
        ans+= "+" if (i>>1)&1 else "-"
        ans+= str(n[2])
        ans+= "+" if (i>>2)&1 else "-"
        ans+=str(n[3])+"=7"

print(ans)

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

int N;
vector<int> tako;
int sum = 0;

int main(){
  cin >> N;
  tako.resize(N);

  for(int i = 0; i < N; i++){
    int v; cin >> v;
    tako[i] = v;
  }

  for(int i = 0; i < N; i++){
      for(int j = i+1; j < N; j++)
        sum += tako[i] * tako[j];
  }

  cout << sum << endl;
  return 0;

  
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
#include<complex>
#include<numeric>
using namespace std;

typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef pair<int, int>P;
typedef pair<ll, ll> LP;
typedef long double ld;
typedef pair<ld, ld> LDP;
typedef vector<vector<ll>> mat;
typedef vector<int> vec;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define all(v) (v).begin(),(v).end()
const ll mod = 1000000007;
const ll INF = mod * mod;
const ld eps = 1e-12;
const ld pi = acos(-1.0);
//int qp(int a,ll b){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
ll qp(ll a,ll b,int mo){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
int dx[4] = { 0,1,0,-1 };
int dy[4] = { 1,0,-1,0 };

void solve() {
    ll a,b,c,n,k;
    string s, t;
    ll ans;
    double dans;
    string sans;


    cin  >> n >>k;
    ans=0;

    rep(i,n){
        ll hoge;
        cin >> hoge;
        if(hoge>=k) ans++;
    }


    std::cout << ans << endl; 
    // std::cout << sans << endl; 
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(10);
    solve();
    // stop
        return 0;
}

Measured memory_bytes: 256
import math
import itertools
import statistics
#import numpy as np
import collections

n = int(input())
t = list(map(int, input().split()))
#a = list(map(int, input().split()))
m = int(input())
p = []
d = []

for i in range(m):
    x,y = [int(j) for j in input().split()]
    p.append(x)
    d.append(y)

total = sum(t)
for i in range(m):
    ans = total - t[p[i]-1] + d[i]
    print(ans)

Measured memory_bytes: 5144
A, B, M = map(int, input().split())
arr1 = list(map(int, input().split()))
arr2 = list(map(int, input().split()))
ticket = []
for i in range(M):
    ticket.append(list(map(int, input().split())))
result = min(arr1) + min(arr2)
for i in ticket:
    x1 = i[0] - 1
    x2 = i[1] - 1
    temp = arr1[x1] + arr2[x2] - i[2]
    result = min(result, temp)
print(result)




Measured memory_bytes: 38488