akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;

int N,M;long long K;
long long X[100005],D[100005];

int P[61][100005];
int ans[100005];

int main(){
	scanf("%d",&N);
	for(int i=1;i<=N;i++) scanf("%lld",&X[i]),D[i]=X[i]-X[i-1],P[0][i]=i;
	scanf("%d%lld",&M,&K);
	while(M--){
		int x;scanf("%d",&x);
		swap(P[0][x],P[0][x+1]);
	}
	for(int i=1;i<=60;i++)
	for(int j=1;j<=N;j++)
		P[i][j]=P[i-1][P[i-1][j]];
	for(int j=1;j<=N;j++) ans[j]=j;
	for(int i=60;~i;i--)if((K>>i)&1)
	for(int j=1;j<=N;j++)
		ans[j]=P[i][ans[j]];
	for(int i=1;i<=N;i++) printf("%lld\n",X[i]=X[i-1]+D[ans[i]]);
}

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

# define Rep(i,a,b) for(int i=a;i<=b;i++)
# define _Rep(i,a,b) for(int i=a;i>=b;i--)
# define RepG(i,u) for(int i=head[u];~i;i=e[i].next)

typedef long long ll;

const int N=1e5+5;

template<typename T> void read(T &x){
   x=0;int f=1;
   char c=getchar();
   for(;!isdigit(c);c=getchar())if(c=='-')f=-1;
   for(;isdigit(c);c=getchar())x=(x<<1)+(x<<3)+c-'0';
    x*=f;
}

int a,b;

int main()
{
    read(a),read(b);
    puts(a<=b?"unsafe":"safe");
    return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for(int i = a; i < b; i++)
#define all(a) a.begin(), a.end()
ll N, M, V, P;
vector<ll> A, S;

int main(){
    cin >> N >> M >> V >> P;
    A.resize(N);
    rep(i, 0, N) cin >> A[i];
    sort(all(A));
    ll lb = -1, ub = N - 1;
    while(ub-lb > 1){
        ll mid = (lb + ub) / 2;
        vector<ll> b;
        rep(i, 0, N) if(mid != i) b.push_back(A[i]);
        ll base = A[mid] + M;
        ll ok = 0;
        reverse(all(b));
        bool bad = 0;
        rep(i, 0, b.size()){
            if(i < P - 1) ok += M;
            else if(base >= b[i]) ok += min(M, base-b[i]);
            else bad = 1;
        }
        if(bad) lb = mid;
        else if(ok >= M * (V-1)) ub = mid;
        else lb = mid;
    }
    cout << N - ub << endl;
}

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

//scanf("%d",&x);
//printf("%d",x);
//for(i=0;i<N;i++){  }
//if( == ){  }else{  }

int main()
{
	int M,D, m,d1,d10,d,Ans=0;

	scanf("%d", &M);
    scanf("%d", &D);

	
	
		for (d = 1; d <= D; d++) {

			d1 = d % 10;
			d10 = d / 10;

			if (1 < (d1 * d10) && (d1 * d10) <= D) {

				if (d1 > 1 && d10 > 1) {

					if ((d1*d10)<=M) {
						Ans++;

						
					}
				}
			}

		}
	
	printf("%d", Ans);


	

}


Measured memory_bytes: 128
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int[] array = new int[3];
		for (int i = 0; i < 3; i++) {
			array[i] = sc.nextInt();
		}
		Arrays.sort(array);
		System.out.println(array[0] + " " + array[2]);
	}
}



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

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int A, B, C, D, E, F;
  cin >> A >> B >> C >> D >> E >> F;
  double mx = -1;
  int max_ws = 0, max_su = 0;
  for (int a = 0; 100 * A * a <= F; a++) {
    for (int b = 0; 100 * B * b <= F; b++) {
      int s = (A * a + B * b) * E;
      for (int c = 0; C * c <= s; c++) {
        for (int d = 0; D * d <= s; d++) {
          int su = C * c + D * d;
          int ws = 100 * A * a + 100 * B * b + su;
          if (su > s) continue;
          if (ws > F) continue;
          if (mx < 100 * su / (double) ws) {
            mx = 100 * su / (double) ws;
            max_ws = ws;
            max_su = su;
          }
        }
      }
    }
  }
  cout << max_ws << " " << max_su << endl;
  return 0;
}

Measured memory_bytes: 256
#!/bin/bash

read n
read -p -a arr

mx=0
cnt=0
vis=()
for i in ${arr[@]}; do
    vis[$i]=$((${vis[$i]} + 1))
    if [[ $mx -lt $i ]]; then
        mx=$i
        cnt=1
    elif [[ $mx -eq $i ]]; then
        cnt=$(($cnt + 1))
    fi
done

for (( i = $(( ($mx + 3) / 2 )) ; i <= $mx ; i++ )) do
    if [[ -z ${vis[$i]} ]]; then
        echo "Impossible"
        exit
    elif [[ ${vis[$i]} -lt 2 ]];then
        echo "Impossible"
        exit
    fi
done

half=$(( ($mx + 1) / 2 ))
if [[ -z ${vis[$half]} ]];then
    echo "Impossible"
    exit
elif [[ ${vis[$half]} -ne $(( $mx % 2 + 1 )) ]];then
    echo "Impossible"
    exit
fi

for (( i = $(( ($mx - 1) / 2 )) ; i >= 1; i-- )) do
    if [[ -n ${vis[$i]} ]];then
        echo "Impossible"
        exit
    fi
done

echo "Possible"

Measured memory_bytes: 376
#include <bits/stdc++.h>
using namespace std;
                     
#define int             long long
#define ld              long double
#define mp              make_pair
#define ff              first
#define ss              second
#define pb              push_back
#define fo(i,n)         for(i=0;i<n;i++)
#define fo1(i,n)        for(i=1;i<=n;i++)
#define FO(i,k,n)       for(i=k;k<=n?i<=n:i>=n;k<=n?i++:i--)
#define all(c)          c.begin(),c.end()
#define rall(c)         c.rbegin(),c.rend()
#define si              set<int>
#define vi              vector<int>
#define mii             map<int,int>
#define pii             pair<int,int>
#define vpii            vector<pii>
#define vvi             vector<vi>
#define usi             unordered_set<int>
#define umii            unordered_map<int,int>
#define pqmx            priority_queue<int>
#define pqmn            priority_queue<int,vi,greater<int> >
#define sp(x)           cout<<setprecision(x)<<fixed;
#define setbits(x)      __builtin_popcountll(x)
#define zerobits(x)     __builtin_ctzll(x)
#define in(a,n)         vi a(n);fo(i,n)cin>>a[i];
#define in1(a,n)        vi a(n+1);fo1(i,n)cin>>a[i];
#define w(t)            int t;cin>>t;while(t--)
#define gcd             __gcd
#define lcm(x,y)        x*(y/gcd(x,y))
#define endl            '\n'
#define PI              3.14159265358979323846
const int inf =         1e18;
const int mod =         1e9+7;
void __p(int x) {cout<<x;}
void __p(int32_t x){cout<<x;}
void __p(float x){cout<<x;}
void __p(double x){cout<<x;}
void __p(ld x) {cout<<x;}
void __p(char x){cout <<'\''<<x<<'\'';}
void __p(const char *x){cout <<'\"' <<x<<'\"';}
void __p(const string &x) {cout<<'\"'<<x<<'\"';}
void __p(bool x) {cout<<(x?"true":"false");}
void _p() {cout << "]\n";}
template<typename T,typename V>     void __p(const pair<T,V> &x) {cout<<'{';__p(x.first);cout<<',';__p(x.second);cout<<'}';}
template<typename T>                void __p(const T &x) {int f = 0; cout << '{'; for (auto &i: x) cout << (f++ ? "," : ""), __p(i); cout << "}";}
template <typename T,typename... V> void _p(T t, V... v) {__p(t);if(sizeof...(v))cout<<", ";_p(v...);}
int po(int x,int p,int m = inf) {int ans=1;x%=m;while(p>0){if(p&1)ans=(ans*x)%m;p=p>>1;x=(x*x)%m;}return ans;}
int inv(int x,int m=mod){return po(x,m-2,m)%m;}
#ifndef ONLINE_JUDGE
#define dbg(x...) cout<<"["<<#x<<"]=[";_p(x)
#else 
#define dbg(x...)
#endif
//=================================================================================




const int N=1e6+6;
int n,m,k,x,y,z,a,b,c,d,i,j,l,r;








void sol()
{   
    cin>>n>>k;
    si s;
    while(k--)
    {
        w(d)cin>>x,s.insert(x);
    }
    
    
    cout<< n-s.size() <<endl;
}





int32_t main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    //sp(10);
    // w(t)
    sol();
    return 0;
}

Measured memory_bytes: 3592
#include<stdio.h>

int main(void)

{

    char x[1001];

    int sum[10000];

    int number;

    int i, j;

    int last = 0;

    for(i = 0; last != 1; i++){

        scanf("%s", x);

        for(j = 0; x[j] != '\0'; j++){

            if(j == 0){

                sum[i] = (int)(x[j] - '0');

            }

            else{

                sum[i] += (int)(x[j] - '0');

            }

        }

        if(x[0] == '0' && x[1] == '\0'){

                last = 1;

                number = i;

        }

    }

    for(i = 0; i < number; i++){

        printf("%d\n", sum[i]);

    }

    return 0;

}

Measured memory_bytes: 544
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define MOD 1000000007ULL;
#define rep(i,n) for(int i=0;i<n;i++)


int main() {
	ll x;
  	cin>>x;
  	
  	ll count=0;
  
  	count+=(x/11)*2;
  	x=x%11;
  	if(x>=7) count+=2;
  	else if(0<x && x<=6) count++;
  	else;
    cout<<count<<endl;
}

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

#define F first 
#define S second
#define PB push_back

using namespace std;

typedef long long LL;
typedef pair<int, int> PII;
typedef priority_queue<int> HEAP;
typedef priority_queue<int, vector<int>, greater<int> > RHEAP;

const int N = 100010, M = 2 * N, mod = 1e9 + 7;

int n, m;
int h[N], e[M], ne[M], idx;
int fact[N], infact[N];
vector<int> depth[N];

void add(int a, int b)
{
	e[idx] = b, ne[idx] = h[a], h[a] = idx ++ ;
}

int qp(int a, int b)
{
	int res = 1;
	while (b)
	{
		if (b & 1) res = (LL)res * a % mod;
		a = (LL)a * a % mod;
		b >>= 1;
	}
	return res;
}

void init()
{
	memset(h, -1, sizeof h);
	fact[0] = infact[0] = 1;
	for (int i = 1; i < N; i ++ )
	{
		fact[i] = (LL)fact[i - 1] * i % mod;
		infact[i] = (LL)infact[i - 1] * qp(i, mod - 2) % mod;
	}
}

void dfs(int u, int fa, int d)
{
	int cnt = 0;
	for (int i = h[u]; ~i; i = ne[i])
	{
		int j = e[i];
		if (fa == j) continue;
		
		cnt ++ ;
		dfs(j, u, d + 1);
	}
	depth[d + 1].PB(cnt);
}

int main()
{
	scanf("%d%d", &n, &m);
	init();
	for (int i = 0; i < n - 1; i ++ )
	{
		int a, b;
		scanf("%d%d", &a, &b);
		add(a, b), add(b, a);
	}
	
	dfs(1, -1, 1);
	
	int res = m;
	for (int i = 2; i <= n; i ++ )
		for (auto u : depth[i])
			if (i == 2) res = (LL)res * fact[m - 1] % mod * infact[m - 1 - u] % mod;
			else res = (LL)res * fact[m - 2] % mod * infact[m - 2 - u] % mod;
	printf("%d\n", res);
    return 0;
}

Measured memory_bytes: 16996
n = int(input())
l = [int(x) for x in input().split()]
from collections import Counter
c = Counter(l)
def motomeru(i):
  return int(c[i]*(c[i]-1)/2)
def herasu(i):
  if c[i] == 0:
    return 0
  else:
    return int((c[i]-1)*(c[i]-2)/2)
zenbu = 0
for i in range(n):
  zenbu = zenbu + motomeru(i+1)
for i in l:
  a = zenbu - motomeru(i) + herasu(i)
  print(a)

Measured memory_bytes: 25768
#include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a,b) for(int i=a;i<=b;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define vi vector<int>
#define vv vector<vi>
#define pb push_back
#define pi pair<int,int>
#define vp vector<pair<int,int> >
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define INF 100000000000
#define eps 1e-7
#define mod 1000000007
#define int ll
using namespace std;

string S, T;
vector<string> cand;

signed main(void) {
    cin>>S>>T;
    rep(i, S.size()-T.size()+1) {
        cerr<<"i:"<<i<<endl;
        bool ok=true;
        Rep(j, i, i+T.size()) {
            cerr<<"j:"<<i<<endl;
            if (S[j]!='?' && S[j]!=T[j-i]) ok=false;
        }
        if (ok) {
            string ans="";
            rep(j,S.size()) {
                if (i<=j&&j<i+T.size()) {
                    ans+=T[j-i];
                } else if (S[j]=='?') {
                    ans+='a';
                } else {
                    ans+=S[j];
                }
            }
            cand.pb(ans);
        }
    }
    if (cand.size()==0) {
        cout<<"UNRESTORABLE"<<endl;
        return 0;
    }
    sort(all(cand));
    cout << cand[0] << endl;
    return 0;
}


Measured memory_bytes: 256
def f(a,b,c):
    if b > a and c > b:
        return True

def main():
    abc = list(map(int,input().split()))
    k = int(input())

    for i in range(k):
        if abc[1] >= abc[2]:
            abc[2] *= 2
        elif abc[0] >= abc[2]:
            abc[2] *= 2
        elif abc[0] >= abc[1]:
            abc[1] *= 2
        if abc[0] < abc[1] < abc[2]:
            print('Yes')
            return
    print('No')


if __name__=='__main__':
    main()


Measured memory_bytes: 9192
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while (true) {
			int H = sc.nextInt();
			int W = sc.nextInt();
			if (H == 0 && W == 0)
				break;
				for (int a = 0; a < H; a++) {
					for (int b = 0; b < W; b++) {
						System.out.print("#");
					}
					System.out.println();
				}
				System.out.println();
		}
	}
}


Measured memory_bytes: 35396
//INCLUDE
//------------------------------------------
#include <iostream>
#include <functional>
#include <algorithm>
#include <math.h>
#include <iomanip>
#include <string>
#include <cstring>
#include <vector>
//DEFINE
//------------------------------------------
#define ll long long
#define ALLv(a)  (a).begin(),(a).end()
#define ALL(a,n)  (a),(a)+n
#define vi vector<long long>
#define vd vector<long double>
#define vs vector<string>
//CONST
//------------------------------------------
#define INF 1010000000000000017LL
#define MOD 1000000007LL
#define EPS 1e-12
#define PI 3.14159265358979323846
//REPEAT
//------------------------------------------
#define   FOR(i,m,n) for(ll (i)=(m);   (i)<(n);  (i)++)
#define   REP(i,n)   for(ll (i)=0;     (i)<(n);  (i)++)
#define  REPS(i,x)   for(ll (i)=1;     (i)<=(x); (i)++)
#define  RREP(i,x)   for(ll (i)=(x)-1; (i)>=0;   (i)--)
#define RREPS(i,x)   for(ll (i)=(x);   (i)> 0;   (i)--)
#define  WREP(i,in,j,jn) REP(i,in)REP(j,jn)
using namespace std;
//-------------------------------------------

int main(void){
  ll N;cin>>N;
  ll Na=0,Nb=0;
  RREPS(i,sqrt(N)){
    if(N%i==0){
      Na=log10(i);
	  Nb=log10(N/i);
      break;
    }
  }
  cout<<max(Na,Nb)+1;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int INF = 1001001001;

int main() {
int A,B;
cin >> A >> B;
if (A <= 5) cout << 0 << endl;
else if (A >= 13) cout << B << endl;
else cout << B/2 << endl;




return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; i++)
#define repr(i, n) for(int i=n; i>=0; i--)
#define reps(i, s, e) for(int i=s; i<e; i++)
#define inf 1e18
#define vsort(v) sort(v.begin(), v.end())
#define vsortr(v) sort(v.begin(), v.end(), greater<lli>())
#define sz(x) x.size()
#define ceil(a, b) (a+b-1)/b
#define ok cout << "ok" << endl;
using namespace std;
using ll = long long;
template<typename T> bool chmax(T &a, T &b){ if(a<b) { a=b; return 1; }}
template<typename T> bool chmin(T &a, T &b){ if(b<a) { a=b; return 1; }}
template<typename T> T gcd(T a, T b){ if(b==0) return a; return gcd(b, a%b); }
template<typename T> T lcm(T a, T b){ return a*b/gcd(a, b); }
template<typename T> T vdebug(vector<T> v){ for(auto vv : v){ cout << vv << " "; } cout << endl; }
template<typename T> T adebug(T arr[], int n){ rep(i, n){ cout << arr[i] << " "; } cout << endl; }
void ans(bool b){ if(b) cout << "Yes" << endl; else cout << "No" << endl; }
void ans2(bool b){ if(b) cout << "YES" << endl; else cout << "NO" << endl; }
int keta(ll num){ int k=0; while(num>0){ num/=10; k++; } return k; }
int dx[] = {1, -1, 0, 0, 1, -1, 1, -1};
int dy[] = {0, 0, 1, -1, 1, -1, -1, 1};


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

    ll x, y;
    cin >> x >> y;
    
    ll cnt = 0;
    while(x <= y){
        x *= 2;
        cnt++;
    }

    cout << cnt << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 1e9
#define ALL(v) v.begin(), v.end()
typedef long long ll;
#define downque(que)  priority_queue<ll> que;
#define upque(que) priority_queue<ll, vector<int>, greater<int>> que;



int main(){
 int n,k; cin>>n>>k;
//2a,2b,2cはkの倍数である必要がある
//kが偶数　k/2の倍数である必要がある
//kが奇数 kの倍数である必要がある

ll ans=0;
ll count1=0;
ll count2=0;

if(k%2==0){//kが偶数
    REP(i,n){
      if((i+1)%(k)==0)count1++;
      else if((i+1)%(k/2)==0)count2++;
    }
}else{//奇数
  REP(i,n){
  if((i+1)%k==0)count1++;
}
}
ans=pow(count1,3)+pow(count2,3);
 cout<<ans<<endl;
}

Measured memory_bytes: 256
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE BangPatterns #-}
import Data.Int
import Data.List
import Control.Monad
import qualified Data.Vector as V
import qualified Data.Vector.Mutable as VM
import qualified Data.Vector.Unboxed as U
import qualified Data.Vector.Unboxed.Mutable as UM
import qualified Data.ByteString.Char8 as BS

infixr 5 !:
(!:) :: a -> [a] -> [a]
(!x) !: xs = x : xs

sieve :: Int -> [Int64]
sieve !max = 2 : U.ifoldr (\i isPrime xs -> if isPrime then fromIntegral (2 * i + 1) !: xs else xs) [] vec
  where
    vec = U.create $ do
      vec <- UM.replicate ((max - 1) `quot` 2 + 1) True
      UM.write vec 0 False -- 1 is not a prime
      -- vec ! i : is (2 * i + 1) prime?
      let clear !p = forM_ [3*p,5*p..max] $ \n -> UM.write vec (n `quot` 2) False
          factorBound = floor (sqrt (fromIntegral max) :: Double)
          loop !i | 2 * i + 1 > factorBound = return ()
                  | otherwise = do b <- UM.read vec i
                                   when b $ clear (2 * i + 1)
                                   loop (i + 1)
      loop 1
      return vec

primes :: [Int64]
primes = sieve (10^6)

factor :: Int64 -> [(Int64, Int)]
factor 0 = error "factor 0"
factor x = loop x primes
  where
    loop 1 _ = []
    loop x (p:ps) = case factorOut 0 x p of
                      (0,y) -> loop x ps
                      (n,y) -> (p,n) : loop y ps
    loop x [] = [(x,1)]
    factorOut !n !x !p | (q,0) <- x `quotRem` p = factorOut (n+1) q p
                       | otherwise = (n, x)

numOfDivisors :: [(Int64, Int)] -> Int64
numOfDivisors xs = product [fromIntegral a + 1 | (p,a) <- xs]
sumOfDivisors :: [(Int64, Int)] -> Int64
sumOfDivisors xs = product [(p^(a+1) - 1) `quot` (p - 1) | (p,a) <- xs]
divisors :: [(Int64, Int)] -> [Int64]
divisors xs = map product $ sequence $ [take (a+1) $ iterate (* p) 1 | (p,a) <- xs]

main = do
  n :: Int64 <- readLn
  let f = factor n
      ds = divisors f
  print $ sum [m | d <- ds, let m = d-1, m > 0, let q = n `quot` d, q < m]


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

int main() {
  int n, T;
  cin >> n >> T;
  vector<int> c(n), t(n);
  for(int i= 0; i < n; i++) cin >> c[i] >> t[i];
  int out = 10000;
  for (int i = 0; i < n; i++) {
    if (t[i] > T) continue;
    out = min(out, c[i]);
  }
  if (out == 10000) cout << "TLE" << endl;
  else cout << out << endl;
  return 0;
}

Measured memory_bytes: 3596
#include <iostream>
#include <bits/stdc++.h>
#include <iomanip>
typedef long long int lli;
#define FAST ios_base::sync_with_stdio(false); cin.tie(NULL);
#define JUGAD freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
#define pb push_back
#define pf push_front
#define mp make_pair
#define ff first
#define ss second
using namespace std;

int main(){
    FAST;
    lli a,b,c,d;
    cin>>a>>b>>c>>d;
    cout<<max({a*c,a*d,b*c,b*d})<<endl;
}



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

using namespace std;
typedef long long ll;

ll n, w, dp[100+9][100000+9], m[100+9], v[100+9];


int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin>>n>>w;
    for(int i=1; i<=n; i++) cin>>m[i]>>v[i];
    for(int i=1; i<=n; i++)
    {
        for(int j=0; j<m[i]; j++) dp[i][j]=dp[i-1][j];
        for(int j=m[i]; j<=w; j++)
            dp[i][j]=max(dp[i-1][j], dp[i-1][j-m[i]]+v[i]);

    }
    cout<<dp[n][w]<<endl;
    return 0;
}


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

#define endl '\n'
#define rep(i,s,n) for (int i = s; i < (n); ++i)

typedef long long ll;
typedef unsigned long long ull;

using namespace std;

int main() {
	// make input and output more efficient
	ios::sync_with_stdio(0);
	cin.tie(0);

	int tests, b;
	cin >> tests >> b;

    cout << tests * b << endl;

	return 0;
}


Measured memory_bytes: 3608
#include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <string>
#include <utility>
#include <algorithm>
#include <functional>
#include <deque>
#define INF 1e9
#define MOD 1000000007
#define mod(x) ((x % MOD) + MOD) % MOD
#define MAX_N 200001

using namespace std;

typedef long long ll;
typedef pair<int,int> P;

ll N, A[MAX_N];
ll cnt[20][MAX_N];

void add(ll i, ll j, ll x) {
  while (j <= N) {
    cnt[i][j] += x;
    j += j & -j;
  }
}

ll sum(ll i, ll j) {
  ll s = 0;
  while (j > 0) {
    s += cnt[i][j];
    j -= j & -j;
  }
  return s;
}

bool C(ll i, ll j) {
  for (ll k = 0; k < 20; k++) {
    if (sum(k, j) - sum(k, i-1) > 1) {
      return false;
    }
  }
  return true;
}

ll binary(ll i) {
  ll lb = i, ub = N+1;

  while (ub - lb > 1) {
    ll mid = (lb + ub) / 2;
    if (C(i, mid)) {
      lb = mid;
    } else {
      ub = mid;
    }
  }
  return lb - i + 1;
}



int main() {
  cin >> N;
  for (ll i = 1; i <= N; i++) {
    cin >> A[i];
    for (ll j = 0; j < 20; j++) {
      if (A[i] >> j & 1) {
        add(j, i, 1);
      }
    }
  }

  ll ans = 0;
  for (ll i = 1; i <= N; i++) {
    ans += binary(i);
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 33024
fn main(){
    let nk: Vec<usize> = read_vec();
    let n = nk[0];
    let k = nk[1];

    let va:  Vec<usize> = read_vec();

    for i in k .. n {
        let ans = if va[i-k] < va[i] { "Yes" } else { "No"};
        println!("{}", ans);
    }
}

#[allow(dead_code)]
fn read_vec<T>() -> Vec<T>
where T: std::str::FromStr,
      T::Err: std::fmt::Debug
{
    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf).expect("failed to read");
    buf.split_whitespace().map(|e| e.parse().unwrap()).collect()
}


Measured memory_bytes: 5836
import core.bitop;
import std.algorithm;
import std.ascii;
import std.bigint;
import std.conv;
import std.functional;
import std.math;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
import std.random;
import std.typecons;
import std.container;

enum MAX = 1_000_100;
ulong MOD = 1_000_000_007;
ulong INF = 1_000_000_000_000;
alias sread = () => readln.chomp();
alias Pass = Tuple!(long, "x", long, "y");

void main()
{
    real a, b, x;
    scan(a, b, x);
    real inv;
    if (2 * x / a <= a * b)
        inv = (a * (b ^^ 2) / (2 * x));
    else
        inv = (2 * x - 2 * (a ^^ 2) * b) / (a ^^ 3);

    auto sita = atan(inv);
    writefln("%3.12s", abs(sita * 180 / PI));
}

T lread(T = long)()
{
    return readln.chomp.to!T();
}

T[] aryread(T = long)()
{
    return readln.split.to!(T[])();
}

void scan(TList...)(ref TList Args)
{
    auto line = readln.split();
    foreach (i, T; TList)
    {
        T val = line[i].to!(T);
        Args[i] = val;
    }
}


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

using namespace std;

int main() {
    string S, T;
    cin >> S >> T;

    int N = S.size(), M = T.size();

    int len[N + 1][M + 1];
    pair<int, int> rev[N + 1][M + 1];
    fill(len[0], len[1], 0);
    for (int i = 0; i <= M; ++i) {
        rev[0][i] = make_pair(0, i - 1);
    }

    for (int i = 1; i <= N; ++i) {
        len[i][0] = 0;
        rev[i][0] = make_pair(i - 1, 0);
        for (int j = 1; j <= M; ++j) {
            if (S[i - 1] == T[j - 1]) {
                len[i][j] = len[i - 1][j - 1] + 1;
                rev[i][j] = make_pair(i - 1, j - 1);
            } else {
                len[i][j] = max(len[i - 1][j], len[i][j - 1]);
                if (len[i - 1][j] > len[i][j - 1]) {
                    rev[i][j] = make_pair(i - 1, j);
                } else {
                    rev[i][j] = make_pair(i, j - 1);
                }
            }
        }
    }

    int x = N, y = M;
    string ans;
    while (x > 0 && y > 0) {
        if (S[x - 1] == T[y - 1]) {
            ans.insert(ans.begin(), S[x - 1]);
        }
        tie(x, y) = rev[x][y];
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 105856
// input macro
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

// body

fn main() {
    input! {
        r: usize,
        d: usize,
        x2000: usize,
    };

    let mut prev: usize = x2000;

    for _i in 1..11 {
        let ans = (r * prev) - d;
        println!("{}", ans);
        prev = ans;
    }
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>																							   
																													   
using namespace std; 																								   
																													   
const int INF = 1000000001;																						   
const float PI = 3.14;																								   
typedef long long LL;																								   
																													   
typedef vector<int> vi;																								   
typedef list<int> li;																								   
typedef queue<int> qi; 																								   
typedef pair<int,int> ii; 																							   
typedef map<string,int> msi; //np msi['nazwa'] = 'liczba'															   
typedef vector<ii> vii; //vector par<int>, do tworzenia tablicy dla grafów wagowych #dijkstra #Bellman_Ford			   
typedef priority_queue< ii, vector<ii>, greater<ii> > pq; //kolejka priorytetowa vectorów par(top()=min) #dijkstra	   
																													   																					   
vector<ii>::iterator iter;																							   
																													   																				   
#define print_list(x) for(it = (x).begin(); it != (x).end(); it++) {cout << *it << " ";}							   
#define print_vector(x) for(it2 = (x).begin(); it2 != (x).end(); it2++) {cout << *it2 << " ";}						   
#define search_list(x) for(it = (x).begin(); it != (x).end(); it++)													   
#define search_vector(x) for(it2 = (x).begin(); it2 != (x).end(); it2++);											   
#define pb(x) push_back(x) 																							   
#define pf(x) push_front(x)																							   
#define mp(x, y) make_pair(x, y)                                                                                       
///////////////////////////////////////////////GLOBAL DEFINITIONS////////////////////////////////////////////////////////



///////////////////////////////////////////////////FUNCTIONS/////////////////////////////////////////////////////////////



/////////////////////////////////////////////////////MAIN////////////////////////////////////////////////////////////////
int main(int argc, char* argv[])																					 
{ios_base::sync_with_stdio(false); cin.tie(NULL);                  												       
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	
	LL k;
	LL suma = 0;
	cin >> k;
	
	for(int i = 1; i <= k; i++){
		for(int j = 1; j <= k; j++){
			for(int l = 1; l <= k; l++){
				suma += gcd(i, gcd(j, l));
			}
		}
	}

	cout << suma << endl;
	

	return 0;
}


Measured memory_bytes: 3656
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <tuple>
#include <climits>
#include <cmath>
#include <unordered_map>

using namespace std;

typedef long long ll;

int main(void) {
  ll N;
  cin >> N;
  vector<ll> H(N, 0);
  for (int i = 0; i < N; i++) cin >> H[i];

  int count = 1;
  ll maxH = H[0];
  for (int i = 1; i < N; i++) {
    maxH = max(maxH, H[i]);
    if (maxH <= H[i])
      count++;
  }
  cout << count << endl;
}


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

satsu = []

con = 0

for i in range(0,N + 1):
  total = 0
  #範囲に注意
  #当初、range(i , N+1)としていたが、
  #当然、0から始めて、Nからi引いた残りの枚数まで、としなければならない
  for j in range(0,N + 1 - i):
    total = (10000 * i) + (5000 * j) + (1000 * (N - (i + j)))
    if total == Y:
      satsu.append([i,j,N - (i + j)])
      con += 1
      break
  if total == Y:
    break

if len(satsu) == 0:
  print(-1,-1,-1)
else:
  ans = satsu[0]
  print(ans[0],ans[1],ans[2])

Measured memory_bytes: 3064
class UnionFind
  def initialize(n); @data = Array.new(n,-1); end
  def find(a); @data[a] < 0 ? a : @data[a] = find(@data[a]); end
  def same?(a,b); find(a) == find(b); end
  def size(a); -@data[find(a)]; end
  def unite(a,b)
    a = find(a); b = find(b)
    return if a == b
    a,b = b,a if @data[a] > @data[b]
    @data[a] += @data[b]; @data[b] = a
  end
end

# UnionFind木で連結成分の要素数を求める
# 友人、ブロックの隣接リスト作成
# 人別(N),友人数(M)で二重ループしながらUF参照
# Mが疎なので計算量はO(M)、ブロックについてもO(K)

n,m,k = gets.split.map &:to_i
UF = UnionFind.new(n)
FR = Array.new(n){[]}
BL = Array.new(n){[]}

m.times do
  a,b = gets.split.map &:to_i
  a -= 1; b -= 1
  UF.unite(a,b)
  FR[a] << b
  FR[b] << a
end

k.times do
  a,b = gets.split.map &:to_i
  a -= 1; b -= 1
  BL[a] << b
  BL[b] << a
end

ans = n.times.map do |i|
  cnt = UF.size(i)
  FR[i].each do |f|
    cnt -= 1 if UF.same?(i,f)
  end
  BL[i].each do |b|
    cnt -= 1 if UF.same?(i,b)
  end
  cnt -= 1
end

puts ans.join(" ")

Measured memory_bytes: 31868
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<string.h>
#include<math.h>
#include<map>
#include<iomanip>

#define MOD 1e9+7;
#define INF 1e17+9;
#define PI acos(-1);

using namespace std;

int main(){
	string s,t;
	cin >> s >> t;
	for(int i=0;i<s.size();i++){
		if(s[i]!=t[i]){
			cout << "No" << endl;
			return 0;
		}
	}
	if(t.size()-s.size()!=1){
		cout << "No" << endl;
		return 0;
	}
	cout << "Yes" << endl; 
	return 0;
}


Measured memory_bytes: 3628
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

#define pb push_back
#define rep(i, a, n) for(int i = (a); i < (n); i++)
#define dep(i, a, n) for(int i = (a); i >= (n); i--)
#define mod (ll)(1e9+7)

__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}

int main() {
  int n, a;
  cin >> n >> a;
  if(n % 500 <= a) cout << "Yes" << endl;
  else cout << "No" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
#define ms(s,x) memset(s,x,sizeof(s))
#define pb push_back
#define inf 0x3f3f3f3f
typedef long long ll;
using namespace std;

const int MAXN = 1e5+5;
const ll MOD = 1e9+7;

ll comb(int m, int n)
{
    ll up = 1, down = 1;
    rep(i, m-n+1, m)
    up *= i;
    rep(i, 1, n)
    down *= i;
    return up/down;
}

int main()
{
    string n;
    int k;
    ll ans;
    cin >> n >> k;
    int len = n.size();
    ans = pow(9, k)*comb(len-1, k);
    if (k == 1)
        ans += n[0]-'0';
    else if (k == 2)
    {
        ans += (n[0]-'1')*comb(len-1, 1)*9;
        rep(i, 1, len-1)
        {
            bool flag = 0;
            rep(j, 1, i-1)
                if (n[j] != '0')
                    flag = 1;
            if (flag)
                ans += 9;
            else
                ans += n[i]-'0';
        }
    }
    else
    {
        ans += (n[0]-'1')*comb(len-1, 2)*9*9;
        rep(i, 1, len-2)
        {
            bool f1 = 1;
            rep(j, 1, i-1)
                if (n[j] != '0')
                    f1 = 0;
            if (f1)
            {
                if (n[i] != '0')
                {
                    ans += (n[i]-'1')*comb(len-i-1, 1)*9;
                    rep(j, i+1, len-1)
                    {
                        bool f2 = 0;
                        rep(k, i+1, j-1)
                            if (n[k] != '0')
                                f2 = 1;
                        if (f2)
                            ans += 9;
                        else
                            ans += n[j]-'0';
                    }
                }
            }
            else
                ans += 9*comb(len-i-1, 1)*9;
        }
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static System.Console;

class Program
{
    static void Main(string[] args)
    {
        new Program().Calc();
    }

    Scanner cin;

    public Program() { }

    bool chmax<T>(ref T a, T b) where T : IComparable<T> { if (a.CompareTo(b) < 0) { a = b; return true; } return false; }
    bool chmin<T>(ref T a, T b) where T : IComparable<T> { if (b.CompareTo(a) < 0) { a = b; return true; } return false; }

    void Calc()
    {
        cin = new Scanner();

        int N = cin.nextInt();

        int[] A = new int[N];

        for (int i = 0; i < N; ++i)
        {
            A[i] = cin.nextInt();
        }

        int[] ans = new int[N];

        for (int i = 0; i < 2; ++i)
        {
            int sign = 0;

            for (int j = i; j < i + N; ++j)
            {
                if (sign % 2 == 0)
                {
                    ans[i] += A[j % N];
                }
                else
                {
                    ans[i] -= A[j % N];
                }

                ++sign;
            }
        }

        for (int i = 2; i < N; ++i)
        {
            int sign = 0;

            if (sign % 2 == 0)
            {
                ans[i] = ans[i - 2] + (A[(i + N - 1) % N] - A[(i + N - 2) % N]) * 2;
            }
            else
            {
                ans[i] = ans[i - 2] + (A[(i + N - 1) % N] - A[(i + N - 2) % N]) * 2;
            }

            ++sign;
        }


        string str = string.Join(" ", ans);

        WriteLine(str);
    }
}

public static class StringExtension
{
    public static char GetChar1(this string str, int indexOneBase)
    {
        return str[indexOneBase - 1];
    }
}

class Scanner
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt()
    {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong()
    {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0)
    {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble()
    {
        return double.Parse(next());
    }


    public double[] ArrayDouble(int N, double add = 0)
    {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}


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

using namespace std;
const long long INF = 1LL <<60;

int main(void){
  long long a,b,c,k;
  cin>>a>>b>>c>>k;
  long long i,j;
  int flg=0;

  if(k<=a){
    cout<<k<<endl;
    return 0;
  }
  else if(k<=(a+b)){
    cout<<a<<endl;
    return 0;
  }
  else{
    cout<<a-(k-(a+b))<<endl;
    return 0;
  }
  
}    


Measured memory_bytes: 3632
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <cassert>
using namespace std;
using ll = long long;
const int INF = 1<<30;
const int MOD = (int)1e9 + 7;
const int MAX_N = (int)1e5 + 5;
#define debug(x) cout << #x << ": " << x << endl
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2>& p) { os << p.first << " " << p.second; return os; }
template<typename T>
ostream &operator<<(ostream &os, const vector<T> &v) { for(int i = 0; i < (int) v.size(); i++) os << v[i] << (i + 1 != v.size() ? " " : ""); return os; }

signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int x; cin >> x;
    vector<int> isPrime(MAX_N, 1);
    isPrime[0] = isPrime[1] = 0;
    for(int i = 2; i < MAX_N; i++)
    {
        if(isPrime[i] == 0) continue;
        for (int j = 2 * i; j < MAX_N; j += i)
        {
            if (isPrime[j] == 1)
            {
                isPrime[j] = 0;
            }
        }
    }
    vector<int> prime;
    prime.push_back(-1);
    for(int i = 0; i < MAX_N; i++)
    {
        if(isPrime[i])
        {
            prime.push_back(i);
        }
        if(prime.back() >= x)
        {
            cout << prime.back() << endl;
            return 0;
        }
    }
    return 0;
}

Measured memory_bytes: 768
#include<bits/stdc++.h>
#define rep(i,n,m) for(int i = (n); i <(m); i++)
#define rrep(i,n,m) for(int i = (n) - 1; i >=(m); i--)
#define pvec(vec) {for (auto v: vec) cout << v << ' '; cout << endl;}
#define pivec(vec) {rep(i, 0, vec.size()) cout << i << ':' << vec[i] << ' '; cout << endl;}

using namespace std;
using ll = long long;

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

    int sum = 0;
    for (auto c: N)
    {
        int now = c - '0';
        sum += now;
    }

    if (sum % 9 == 0)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
    return 0;
}



Measured memory_bytes: 3756
//s.empty() //emptyなら1を出力 入っていれば0を出力
/*//ABC018-B 部分的にreverseをかける解法
int main() {
  string s;
  cin >> s;
  int n;
  cin >> n;
  vector<int>a(n);
  vector<int>b(n);
  rep(i,n) cin>>a.at(i)>>b.at(i);
  rep(i,n)a.at(i)--;
  rep(i,n)b.at(i)--;
  string t;
  rep(i,n){
    t = s;
    for(int k=0;k<=b.at(i)-a.at(i);k++){
      t.at(a.at(i)+k) = s.at(b.at(i)-k);
    }
    s = t;
  }
  cout << s << endl;
}
*///ABC018-B
//  string s;
//  cin >> s;
//  cout << s.at(0) <<endl;
//  cout << s.at(0)-'0' <<endl;
//  Aが16？
//  cout << char(i+48) << endl;//なぜかaは47と得る時がある。+48で出力もaにできる。
//  cout << char(97) << endl;//アスキーコードでaを出力
// sort(b.begin(), b.end());//bという配列を小さい方からソート
// reverse(b.begin(), b.end());//bという配列をリターン
// 10桁でdouble出力するパターン１ 
// printf("%.10f\n", ma);
// 10桁でdouble出力するパターン２
//cout << fixed << setprecision(10);
//  cout << ma << endl;

/*01 02 03 12 13 23　と６回見ていくパターン 
for(int i=0;i<n-1;i++){
  for(int j=i+1;j<n;j++){
    }
  }
*///vector<vector<int>> data(3, vector<int>(4));//int型の2次元配列(3×4要素の)の宣言
//int64_t a;
//10のi乗pow(10, i);
/*string s; stringでの文字列を数字型に変える方法
  cin >> s;
  rep(i,s.size()-2) {
  int a= (s.at(i)-'0')*100 + (s.at(i+1)-'0')*10+ s.at(i+2) -'0';
    */
#include <iomanip>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int kaijou(int n){
  int kaijou_sum = 1;
  if(n!=0){
    for(int i=1;i<=n;i++){
      kaijou_sum *= i;
    }
    return kaijou_sum;
  }
  else return 1;
}

int main() {
  ll n;
  cin >> n;
  vector<ll>a(n+1);
  vector<ll>b(n);
  rep(i,n+1)cin>>a.at(i);
  rep(i,n  )cin>>b.at(i);
  ll sum = 0;
  ll tmp = 0;
  for(int i=0;i<n;i++){
    ll A = a.at(i);
    ll B = b.at(i);
    if(tmp!=0){
      if(A<tmp){
        sum += A;
        A = 0;
      }
      else{
        A = A - tmp;//Aは負の数になってはいけない
        sum += tmp;
      }
      tmp = 0;
    }
    if(A >= B){
      sum += B;
    }
    else{
      sum += A;
      tmp = B - A;
    }
  }
  // A n+1 wosaigonimiru
  ll A = a.at(n);
    if(tmp!=0){
      if(A<tmp){
        sum += A;
        A = 0;
      }
      else{
        A = A - tmp;//Aは負の数になってはいけない
        sum += tmp;
      }
      tmp = 0;
    }
  cout << sum << endl;
}

Measured memory_bytes: 4840
K=gets.to_i
q=[]
cost=[Float::INFINITY]*K

q<<1
cost[1]=1
while !q.empty?
    x=q.shift
    if x==0
        puts cost[x]
        break
    end
    
    t=x*10%K
    if cost[t]>cost[x]
        cost[t]=cost[x]
        q.unshift t
    end

    t=(x+1)%K
    if cost[t]>cost[x]+1
        cost[t]=cost[x]+1
        q << t
    end
end


Measured memory_bytes: 3144
#include <iostream>
#include <stdio.h>
 
using namespace std;
 
int main(){
 	int n;
 	cin >> n;
 	for(int i = 0;i<n;i++){
 		int a,b,c,d;
		cin >> a >> b >> c >> d;
		int p = a*c + b*d;
		int qa,qb,qc;
		if(c>=5&&d<2){
			 qa = (a*c+2*b)*0.8;
		}else if(d>=2&&c<5){
			 qa = (5*a+b*d)*0.8;
		}else if(c<5&&d<2){
			 qa = (5*a+2*b)*0.8;
		}else if(c>=5&&d>=2){
			qa = (a*c + b*d)*0.8;
		}
		
		
		if(qa<p){
			swap(p,qa);
		}
        cout << p <<endl;
    }
    return 0;
}


Measured memory_bytes: 3136
#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<string>
 
using namespace std;

 
const int MAX_N = int(1e6) + 10;
const long long int MOD=1e9+7;
const long long int INF=1e18;
 
typedef long long int ll;
typedef unsigned long long int llu;
 
 
 
inline ll mul(ll a,ll b){
 
    a=(a+MOD)%MOD;
    b=(b+MOD)%MOD;
    ll c=a*b;
    c=(c+MOD)%MOD;
    return c;
}
inline ll add(ll a,ll b){
    a=(a+MOD)%MOD;
    b=(b+MOD)%MOD;
    ll ans=(a+b);
    ans=(ans+MOD)%MOD;
    return ans;
}
ll power(ll a,ll b,ll c=0){
    ll ans=1;
    while(b){
        if(b&1){
            ans=mul(ans,a);
        }
        a=mul(a,a);
        b=b/2;
    }
    return ans;
}
 
  
 
 
#define all(x) (x).begin(),(x).end()




//s.reserve(32768); //updated !
//s.max_load_factor(0.25);


ll a[200005];


int main(){
 
    

    int n;
    cin>>n;

    map<string,int>mp;
    for(int i=1;i<=n;i++){
        string s;
        cin>>s;
        mp[s]++;
    }

    cout<<"AC"<<" "<<"x"<<" "<<mp["AC"]<<"\n";
    cout<<"WA"<<" "<<"x"<<" "<<mp["WA"]<<"\n";
    cout<<"TLE"<<" "<<"x"<<" "<<mp["TLE"]<<"\n";
    cout<<"RE"<<" "<<"x"<<" "<<mp["RE"]<<"\n";

    
    


    



    
    
    




    

}
    

    






    
    

    
 
    
 

 
 
    
 
 


Measured memory_bytes: 3616
import sys

#fin = open("test.txt", "r")
fin = sys.stdin

w = fin.readline()
w = w.rstrip('\n')
w = w.lower()

s = fin.read()
s = s.lower()
s = s.replace('\n', ' ')

s_list = s.split()
idx = 0
count = 0

for e in s_list:
	if w == e:
		count += 1

print(count)

Measured memory_bytes: 7448
#include <bits/stdc++.h>
#define LL long long
#define mem(i, j) memset(i, j, sizeof(i))
#define rep(i, j, k) for(int i = j; i <= k; i++)
#define dep(i, j, k) for(int i = k; i >= j; i--)
#define pb push_back
#define make make_pair
#define INF INT_MAX
#define inf LLONG_MAX
#define PI acos(-1)
#define fir first
#define sec second
using namespace std;

const int N = 2e5 + 10;

pair < LL, LL > a[N], tmp;
LL c[N];
LL dp[100];

bool cmp(pair < LL, LL > A, pair < LL, LL > B) {
    return A.fir * (B.sec + 1) > B.fir * (A.sec + 1);
}

void solve() {

    int n; LL T;
    scanf("%d %lld", &n, &T);
    int cnt1 = 0, cnt2 = 0;
    rep(i, 1, n) {
        scanf("%lld %lld", &tmp.fir, &tmp.sec);
        if(tmp.fir == 0) c[cnt2++] = tmp.sec + 1;
        else a[cnt1++] = tmp;
    }

    sort(c, c + cnt2);
    sort(a, a + cnt1, cmp);

    rep(i, 1, 30) dp[i] = T + 1;
    dp[0] = 0;
    rep(i, 1, cnt2 - 1) c[i] += c[i - 1];

    rep(i, 0, cnt1 - 1) {
        dep(j, 1, 30) {
            dp[j] = min(dp[j], (a[i].fir + 1) * (dp[j - 1] + 1) + a[i].sec);
        }
    }

    int ans = 0;
    rep(i, 0, 30) {
        if(dp[i] > T) continue;
        int add = 0;
        if(cnt2) add = upper_bound(c, c + cnt2, T - dp[i]) - c;
        ans = max(ans, i + add);
    }
    printf("%d\n", ans);
    return ;
}

int main() {

    solve();

    return 0;
}


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

int main() {
    int n;
    cin>>n;
    vector<int> v(n);
    vector<int> c(n);
    for(int i=0; i<n; i++){
        cin >> v.at(i);
    }
    for(int i=0; i<n; i++){
        cin >> c.at(i);
    }
    vector<int> ans(n);
    for(int i=0; i<n; i++){
        ans.at(i)  = v.at(i) - c.at(i);
    }
    sort(ans.begin(),ans.end());
    reverse(ans.begin(),ans.end());
    int sum=0;
    for(int i=0; i<n; i++){
        if(ans.at(i)>=0){
            sum += ans.at(i);
        }
        else{
            break;
        }
    }
    cout << sum << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,a,b) for(ll i=ll(a);i<ll(b);i++)
#define irep(i,a,b) for(ll i=ll(a);i>=ll(b);i--)
using ll = long long;
using namespace std;

int main(){
	ll a,b;
	cin>>a>>b;
	bool p=false;
	ll st=0;
	if((a+b)%2==0){p=true;st=(a+b)/2;}
	if(p) cout<<st;
	else cout<<"IMPOSSIBLE";
	
}

Measured memory_bytes: 256
while True:
    try:
        L=list(map(int,input().split()))
        x=L[0]*L[4]-L[3]*L[1]
        y=L[2]*L[4]-L[5]*L[1]
        z=y/x+0
        w=(L[2]-L[0]*z)/L[1]+0
        print(f"{z:.3f} {w:.3f}")
    except EOFError:
        break


Measured memory_bytes: 5620
#include<bits/stdc++.h>
using namespace std;
#define ll long long                                    // long long省略
#define pb push_back                                    // push_back省略
#define mp make_pair                                    // make_pair省略
#define fi first                                        // first省略
#define se second                                       // second省略
#define itn int                                         // int誤字保険
#define count cout                                      // cout誤字保険
#define vecotr vector                                   // vector誤字保険
#define ednl endl                                       // endl誤字保険
#define opt() cin.tie(0); ios::sync_with_stdio(false)   // 入出力速度改善

#define rep(i,l,r) for(ll i=(l);i<(r);i++)               // 範囲[l, r)で刻み1のfor文(順方向)
#define repp(i,l,r,k) for(ll i=(l);i<(r);i+=(k))         // 範囲[l, r)で刻みkのfor文(順方向)
#define rrep(i,l,r) for(ll i=(r-1);i>=(l);i--)           // 範囲[l, r)で刻み1のfor文(逆方向)
#define rrepp(i,l,r,k) for(ll i=(r-1);i>=(l);i-=(k))     // 範囲[l, r)で刻みkのfor文(逆方向)
#define all(x) (x).begin(), (x).end()                   // vectorのポインタ位置指定用
#define max(p,q)((p)>(q)?(p):(q))                       // max拡張
#define min(p,q)((p)<(q)?(p):(q))                       // min拡張
#define bit(n,m)(((n)>>(m))&1)                          // 変数nのm番目のbitを取り出す

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

int dy[]={0, 1, 0, -1};                                 // 4方向近傍
int dx[]={1, 0, -1, 0};                                 // 4方向近傍

int main(){
    char a,b,c,d;cin>>a>>b>>c>>d;
    if(a == 'A') cout << 'T' << ednl;
  	if(a == 'T') cout << 'A' << ednl;
  	if(a == 'C') cout << 'G' << ednl;
  	if(a == 'G') cout << 'C' << ednl;
}


Measured memory_bytes: 256