akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <numeric>
#include <string>
#include <algorithm>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <utility>
using namespace std;
#define INF 100000000
#define REP(i, n) for(int (i)=0; (i)<(n); (i)++)
#define rep(i, n) for(int (i)=1; (i)<=(n); (i)++)
typedef pair<int, int> P;
typedef long long ll;

int main(){
    int N, M, Q;
    cin >> N >> M >> Q;
    vector<vector<int> > ruiseki(N+1, vector<int>(N+1, 0));
    REP(i, M){
        int L, R;
        cin >> L >> R;
        ruiseki[L][R]++;
    }
    //二次元累積和table作成
    REP(i, N) {
        REP(j, N) {
            ruiseki[i][j + 1] += ruiseki[i][j];
        }
    }
 
    REP(i, N) {
        REP(j, N + 1) {
            ruiseki[i + 1][j] += ruiseki[i][j];
        }
    }

    REP(i, Q){
        int p, q;
        cin >> p >> q;
        cout << ruiseki[q][q] - ruiseki[q][p-1] - ruiseki[p-1][q] + ruiseki[p-1][p-1] << endl;
    }
    return 0;
}

Measured memory_bytes: 1920
#include <algorithm>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <set>
#include <stdio.h>
#include <string>
#include <utility>
#include <vector>

using namespace std;

int main() {
  int a, b;
  cin >> a >> b;
  cout << (a - 1) * (b - 1) << endl;
  return 0;
}


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

int main(){
    int N;
    cin >> N;
    vector<int> t(N+1, 0), x(N+1, 0), y(N+1, 0);
    for(int i = 1; i < N+1; ++i) {
        cin >> t[i] >> x[i] >> y[i];
    }

    for(int i = 1; i < N+1; ++i) {
        if( (abs(x[i] - x[i-1]) + abs(y[i]-y[i-1]) > t[i]-t[i-1]) 
        || (abs(x[i] - x[i-1]) + abs(y[i]-y[i-1]))%2 != (t[i]-t[i-1])%2) {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 1408
#include<stdio.h>
int main(){
  int a,b,c;
  scanf("%d%d%d",&a,&b,&c);
  if(a<=b&&b<=c){
    printf("%d",c-a);
  }else if(a<=c&&c<=b){
    printf("%d",b-a);
  }else if(b<=a&&a<=c){
    printf("%d",c-a);
  }else if(b<=c&&c<=a){
    printf("%d",a-b);
  }else if(c<=a&&a<=b){
    printf("%d",b-c);
  }else{
    printf("%d",a-c);
  }
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> P;
 
int main() {

    string n;
    cin >> n;

    ll sum = 0;
    rep(i,n.size()) {
        sum += (n[i]-'0');
    }

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

 return 0;
}

Measured memory_bytes: 3720
/****************************************************
*   Template for coding contests                    *
*   Author    :    Sanjeev Sharma                   *
*   Email     :    thedevelopersanjeev@gmail.com    *
*****************************************************/
#pragma GCC optimize ("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC optimize("no-stack-protector,fast-math")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>

#define deb(x) cout << #x << " is " << x << "\n";

using namespace std;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    double a, b;
    cin >>a >>b;
    cout <<ceil(a/b);
    return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String line = sc.nextLine();
        int H = Integer.parseInt(line.split(" ")[0]);
        int W = Integer.parseInt(line.split(" ")[1]);

        String[][] craymore = new String[H][W];
        int count = 0;
        while (sc.hasNext()) {
            craymore[count] = sc.nextLine().split("");
            count++;
        }

        sc.close();
        boolean isCan = true;

        for (int i = 0; i < H; i++) {
            for (int j = 0; j < W; j++) {
                if (craymore[i][j].equals(".")) {
                    continue;
                }
                boolean isCan2 = false;
                for (int k = -1; k <= 1; k++) {
                    // System.out.println("k is [" + k + "]");
                    if (i + k < 0 || i + k >= H) {
                        continue;
                    }
                    for (int l = -1; l <= 1; l++) {
                        // System.out.println("l is [" + l + "]");
                        if (j + l < 0 || j + l >= W || k == l || k == -1 * l) {
                            continue;
                        }
                        // System.out.println("origin points : (" + i + ", " + j + ")");
                        // System.out.println("check pattern : (" + (int) (k + i) + ", " + (int) (l + j)
                        // + ")");
                        if (craymore[k + i][l + j].equals("#")) {
                            isCan2 = true;
                            break;
                        }
                    }
                    if (isCan2) {
                        break;
                    }
                }
                if (!isCan2) {
                    isCan = false;
                    break;
                }
            }
            if (!isCan) {
                break;
            }
        }
        if (isCan) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}

Measured memory_bytes: 22996
#include<bits/stdc++.h>
using namespace std;
 
int main(){
  int n;
  long long int ans=0;
  cin >> n;
  for(int i=1;i<=n;i++){
    if(i%3!=0&&i%5!=0){
      ans += i;
    }
  }
  cout << ans;
  return 0;
}

Measured memory_bytes: 3636
from collections import deque

n,q=map(int,input().split())
ab=[list(map(int,input().split())) for i in range(n-1)]
p=[0 for i in range(n+1)]
edge=[[] for i in range(n+1)]
que=deque([])
que.append(1)
visited=[False for i in range(n+1)]
visited[0]=True
for i,j in ab:
  edge[i].append(j)
  edge[j].append(i)
for i in range(q):
  a,b=map(int,input().split())
  p[a]+=b

while que:
  v=que.pop()
  visited[v]=True
  for nv in edge[v]:
    if visited[nv]==True:
      continue
    p[nv]+=p[v]
    que.append(nv)
p.pop(0)
print(*p)


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

int main(void) {
    int n, ans;
    vector<int> a;
    cin >> n;
    a.resize(n);
    for (int i = 0; i < n; i++)
        cin >> a[i];
    sort(a.begin(), a.end());
    
    ans = a[0];
    for (int i = 0; i < n - 2; i++) {
        int temp = a[i + 1] - a[i];
        if ((a.back() - a[i]) - (a[i] + 1) < temp - 1)
            break;
        else
            ans = a[i + 1];
    }
    cout << a.back() << ' ' << ans << endl; 
}


Measured memory_bytes: 640
/*
      HET PAGHADAR
      DA-IICT
      @HET262
*/
 
#include<bits/stdc++.h>
using namespace std;
typedef long double ld;
typedef long long ll;
typedef vector<ll> vec; 
#define inf LLONG_MAX
#define bp __builtin_popcountll
#define pb push_back
#define ff first
#define ss second
#define P pair<ll,ll>
#define N 1000005
#define LG 20
#define mod 1000000007
#define FAST ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

string s;
ll dp[N][2];

ll solve(ll n,ll bo)
{
      if(n==0)
            return bo;
            
      ll &ans=dp[n][bo];
      
      if(ans!=-1)
            return ans;
      
      if(bo)
      {
            ans=min(9-(s[n]-'0')+solve(n-1,1),(s[n]-'0')+1+solve(n-1,0));
      }
      else
      {
            ans=min((s[n]-'0')+solve(n-1,0),10-(s[n]-'0')+solve(n-1,1));
      }
      
      return ans;
      
}

int32_t main()
{
      FAST;
      
      cin>>s;
      
      s='a'+s;
      
      memset(dp,-1,sizeof(dp));
      
      cout<<solve(s.size()-1,0);
      
}

Measured memory_bytes: 63816
count = gets.chomp.to_i
cities = gets.chomp.split.map(&:to_i)
powers = gets.chomp.split.map(&:to_i)
monsters = 0
count.times do |i|
	if powers[i] > cities[i]
		powers[i] -= cities[i]
		monsters += cities[i]
		if powers[i] > cities[i + 1]
			monsters += cities[i + 1]
			cities[i + 1] = 0
		else
			cities[i + 1] -= powers[i]
			monsters += powers[i]
		end
	else
		monsters += powers[i]
	end
end
puts monsters

Measured memory_bytes: 17572
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<string>
#include<cstring>
#include<algorithm>
using namespace std;
int n=0;
char c;

int main()
{
    while (1)
    {
        scanf("%c",&c);
        if (c=='\n') break;
        if (c=='+') n++;else n--;
    }
    cout<<n<<endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define st first
#define nd second
#define mp make_pair
#define pb push_back
#define mod 1000000007
#define N 100005
using namespace std;
typedef long long ll;
ll n, k, a[N], dp[105][N], pre[105][N];

int main() {
	// freopen("in.txt", "r", stdin);
	// freopen("out.txt", "w", stdout);
	scanf("%lld %lld",&n ,&k);
	for(int i = 1; i <= n; i++)
		scanf("%lld",a + i);
	pre[n + 1][0] = dp[n + 1][0] = 1;
	for(int i = 1; i < N; i++)
		pre[n + 1][i] = 1;
	for(int i = n; i >= 1; i--){
		for(int k = 0; k < N; k++)
			dp[i][k] = (pre[i + 1][k] - ((k - a[i] - 1 < 0)?0:pre[i + 1][k - a[i] - 1]) + mod)%mod;
		pre[i][0] = dp[i][0];
		for(int k = 1; k < N; k++)
			pre[i][k] = (pre[i][k - 1] + dp[i][k])%mod;
		// for(int k = 0; k <= 4; k++)
			// printf("dp[%d][%d] = %d\n", i, k, dp[i][k]);
	}
	printf("%lld\n", dp[1][k]);
	return 0;
}

Measured memory_bytes: 159232
#include <bits/stdc++.h>
#define ll long long
#define P pair<int,int>
#define MAX_N 200002
using namespace std;

int main(){
    int s;
    string A;
    cin>>A;
    s = A.length();
    for(int i =0; i<s; i++){
        cout<<'x';
    }
    cout<<endl;
    return 0;
}

Measured memory_bytes: 256
_,M = map(int,input().split())
result = {}
for i in range(M):
    P, Q = input().split()
    if P not in result:
        result[P] = [Q]
    else:
        if result[P][-1]=='AC':
            pass
        else:
            result[P].append(Q)
AC = 0
WA = 0
numbers = list(result.values())
for i in range(len(numbers)):
    AC += numbers[i].count('AC')
    if numbers[i][-1]=='WA':
        pass
    else:
        WA += numbers[i].count('WA')
        
print(AC,WA)

Measured memory_bytes: 30408
def examC():
    N = I()
    d = defaultdict(int)
    for i in range(N):
        curD = defaultdict(int)
        S = SI()
        for s in S:
            curD[s]+=1
        if i==0:
            d = curD
            continue
        for s in alphabet:
            d[s] = min(d[s],curD[s])
    d = sorted(d.items())
    ans = ""
    for key,i in d:
        ans +=key*i
    print(ans)
    return

def examD():
    N, M = LI()
    X = LI(); Y = LI()
    distX = [0]*N; distY = [0]*M
    for i in range(N-1):
        distX[i+1] = X[i+1]-X[i]
    for i in range(M-1):
        distY[i+1] = Y[i+1]-Y[i]
    numX = [0]*N; numY = [0]*M
    for i in range(N):
        numX[i] = i*(N-i)
    for i in range(M):
        numY[i] = i*(M-i)
    LX = 0; LY = 0
    for i in range(N):
        LX += distX[i]*numX[i]
        LX %= mod
    for i in range(M):
        LY += distY[i]*numY[i]
        LY %= mod
#    print(numX,distX); print(numY,distY)
    ans = (LX*LY) % mod
    print(ans)
    return

import sys,copy,bisect,itertools,heapq,math
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
alphabet = [chr(ord('a') + i) for i in range(26)]

if __name__ == '__main__':
    examD()


Measured memory_bytes: 28308
let main () =
  let x = Scanf.scanf "%d\n" (fun a -> a) in
  let ans = BatArray.make (x+1) false in
  ans.(1) <- true;
  for i = 2 to x do
    let n = ref @@ i * i in
    while !n <= x do
      ans.(!n) <- true;
      n := !n * i;
    done;
  done;
  for i = x downto 1 do
    if ans.(i) then (print_int i; exit 0)
  done;;

let _ = main ()


Measured memory_bytes: 384
#include <iostream>
#include <cstdio>
using namespace std;
int main(){
	int m,d;
	int day[12] = {31,29,31,30,31,30,31,31,30,31,30,31};
	int y[12];
	string s[7] = {"Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"};
	y[0] = 3;
	for(int i=1;i<12;i++) y[i] = (y[i-1]+day[i-1])%7;
	while(1){
		cin >> m >> d;
		if(m==0) break;
		int t = (y[m-1]+d-1)%7;
		cout << s[t] << endl;
	}
}

Measured memory_bytes: 1196
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> pl;
typedef vector<pl> vp;
#define fore(i,a,b) for(ll i=(a);i<=(b);++i)
#define rep(i,n) fore(i,0,(n)-1)
#define forer(i,a,b) for(ll i=(b);i>=(a);--i)
#define repr(i,n) forer(i,0,(n)-1)
#define all(x) (x).begin(),(x).end()
const ll INF=1001001001;
const ll LINF=1001001001001001001;
const ll D4[]={0,1,0,-1,0};
const ll D8[]={0,1,1,0,-1,-1,1,-1,0};
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;}
template<class T>
ll sum(const T& a){return accumulate(all(a),0LL);}

void solve(){
    ll n,W;cin>>n>>W;
    vl w(n),v(n);
    rep(i,n)cin>>w[i]>>v[i];

    vl dp(W+1,0);
    rep(i,n)repr(j,W+1){
        if(j>=w[i])chmax(dp[j],dp[j-w[i]]+v[i]);
    }
    cout<<dp[W]<<endl;
}

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


Measured memory_bytes: 1024
N = int(input())

taro =[]
hanako=[]
for i in range(N):
    columns = list(input().split())
    taro.append(columns[0])
    hanako.append(columns[1])

taroScore = 0
hanakoScore = 0

for t, h in zip(taro, hanako):
    if t > h:
        taroScore += 3
    elif t == h:
        taroScore +=1
        hanakoScore +=1
    else:
        hanakoScore +=3
print(taroScore, hanakoScore, sep=" ")


Measured memory_bytes: 5620
#include<cstdio>
#include<iostream>
#include<string>
#include<cstring>
#include<cmath>
#include<algorithm>
#define M 1010
#define N 1000000
#define D double
#define LL long long
using namespace std;
LL n,dp[N],mod=1e9+7;
int main()
{
	std::ios::sync_with_stdio(false);
	cin>>n;
	dp[3]=1;
	for(int i=4;i<=n;i++) dp[i]=(dp[i-1]+dp[i-3])%mod;
	cout<<dp[n];
	return 0;
}
/*
*/


Measured memory_bytes: 3668
n,m,q=map(int,input().split())
book=[[0]*(n+1) for _ in range(n+1)]
for _ in range(m):
    r,l=map(int,input().split())
    book[r][l] +=1

for i in range(n+1):
    for j in range(n+1):
        book[i][j] +=book[i][j-1]

for i in range(n+1):
    for j in range(n+1):
        book[i][j] +=book[i-1][j]

for x,y in [map(int,input().split()) for i in range(q)]:
    print(book[y][y]-book[y][x-1]-book[x-1][y]+book[x-1][x-1])

Measured memory_bytes: 90328
#include <bits/stdc++.h>
#define INT long
#define oo 987654321
#define OO 9999999987654321
#define MOD 998244353
using namespace std;
INT n, m;
int main()
{
    ios::sync_with_stdio(false);
    cin>>m>>n;
    if( n == 1 ) cout<<0<<endl;
    else if( m < n ) cout<<1<<endl;
    else if( m == n ) cout<<0<<endl;
    else cout<<m-n<<endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;
#define rep(i,a,n)	for(int i=a;i<n;i++)
int main(){
	int n;
	cin>>n;
	int a[100010];
	rep(i,0,n+3){
		a[i]=0;
	}
	long long int sum=0;
	long long int ans=0;
	rep(i,0,n){
		cin>>a[i];
		if(i!=0&&a[i]>0&&a[i-1]>0){
			sum++;
			a[i]--;
			a[i-1]--;
		}		
		sum+=(a[i]/2);
		a[i]-=a[i]/2*2;	
	}
	cout<<sum<<endl;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
//#include<boost/multiprecision/cpp_int.hpp>
//using boost::multiprecision::cpp_int;

#define int long long
#define cint cpp_int
#define endl "\n"
#define REP(i,a,n) for(int i=a;i<n;++i)
#define REPR(i,a,n) for(int i=a;i>n;--i)
#define RUP(a,b) (((a)+(b)-1)/(b))
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define MOD 1000000007
#define INF LLONG_MAX/2
#define PI acos(-1.0)

typedef long long ll;
typedef pair<int,int> Pii;
typedef tuple<int,int,int> Tiii;
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef vector<Pii> VPii;
typedef vector<string> Vs;
typedef priority_queue<int> PQi;

template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
void vout(Vi &v){for(int i=0;i<(v).size();i++) cout<<v[i]<<" ";cout<<endl;}
void vout(Vs &v){for(int i=0;i<(v).size();i++) cout<<v[i]<<" ";cout<<endl;}
void vvout(VVi &v){for(int i=0;i<(v).size();i++) vout(v[i]);}
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a/gcd(a,b)*b;}
int mypow(int x, int n, int m){if(n==0)return 1;if(n%2==0)return mypow(x*x%m,n/2,m);else return x*mypow(x,n-1,m)%m;}
int digit(int k,int i){string s = to_string(k);return s[s.size()-i]-'0';}
void uniq(Vi &v){sort(v.begin(),v.end()); v.erase(unique(v.begin(),v.end()),v.end());} //vectorの同じ要素消す
int ctoi(char c){if(c>='0'&&c<='9'){return c-'0';}return 0;}
int leng(int n){string s=to_string(n); return s.size();} //intの桁数
int digitsum(int n){int ret=0; while(n>0){ret+=n%10;n/=10;}return ret;} //桁和
int lesscount(int x,Vi &a){return lower_bound(a.begin(),a.end(),x)-a.begin();} //vector aにおけるx未満の数の個数
int orlesscount(int x,Vi &a){return upper_bound(a.begin(),a.end(),x)-a.begin();} //vector aにおけるx以下の数の個数
int morecount(int x,Vi &a){return a.size()-orlesscount(x,a);} //vector aにおけるxより大きい数の個数
int ormorecount(int x,Vi &a){return a.size()-lesscount(x,a);} //vector aにおけるx以上の数の個数
int count(int x,Vi &a) {return upper_bound(ALL(a),x)-lower_bound(ALL(a),x);} //vector aにおけるxの個数
Vi accum(Vi &v){Vi ret((v).size()+1);REP(i,0,(v).size()) ret[i+1]=ret[i]+v[i];return ret;}
bool comp(Pii a,Pii b){
    if(a.second != b.second) return a.second<b.second;
    else return a.first<b.first;
}

signed main(){cin.tie(0);cout.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);
    int n;
    cin>>n;
    Vi a(n);
    REP(i,0,n) cin>>a[i];

    int max_of_a = *max_element(ALL(a));
    int min_of_a = *min_element(ALL(a));

    cout<<2*(n-1)<<endl;
    if(max_of_a >= -min_of_a){
        int max_index = max_element(ALL(a)) - a.begin();
        REP(i,0,n){
            if(i != max_index) cout<<max_index+1<<" "<<i+1<<endl;
        }
        REP(i,0,n-1){
            cout<<i+1<<" "<<i+2<<endl;
        }
    }else{
        int min_index = min_element(ALL(a)) - a.begin();
        REP(i,0,n){
            if(i != min_index) cout<<min_index+1<<" "<<i+1<<endl;
        }
        REPR(i,n-1,0){
            cout<<i+1<<" "<<i<<endl;
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <set>

using namespace std;

unsigned long long gcd(unsigned long long  a, unsigned long long b) {
	if(b > a) return gcd(b, a);
	
	unsigned long long r = a % b;
	while(r!=0){
    	a = b;
	    b = r;
    	r = a % b;
	}

	return b;
}

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

	std::set<unsigned long long> s;

	for(int i=0; i<N; i++) {
		unsigned long long x;
		cin >> x;
		s.insert(x);
	}

	int size = s.size();

	std::set<unsigned long long>::iterator itr = s.begin();
	unsigned long long ret = *itr;
	itr++;

	while(itr != s.end()) {
		unsigned long long t = *itr;
		unsigned long long g = gcd(ret, t);

		if(ret % g == 0) {
			ret = t * (ret / g);
		} else if(t % g == 0) {
			ret = ret * (t / g);
		} else {
			ret = (ret * t) / g;
		}

		itr++;
	}

	cout << ret << endl;

    return 0;
}




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

int main(void){
    ll n;
    cin >> n;
    string s;
    while (n) {
        s += 'a' + ((n-1) % 26);
        n = (n-1)/26;
    }
    reverse(all(s));
    cout << s << endl;
    return 0;
}


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

int main() {
  int N,A,B;
  cin >> N >> A >> B;
  
  if (N*A > B) {
    cout << B << endl;
  }
    else if (N*A < B) {
      cout << N*A << endl;
    }
   else if (N*A == B) {
     cout << B << endl;
   }
}

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

public class Main{

	public static void main(String[] args) throws NumberFormatException, IOException {
		// TODO Auto-generated method stub
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		
		int price = 100000;
		for (int i = 0; i < n; i++) {
			price *= 1.05;
			if (price % 1000 > 0) {
				price += 1000 - (price % 1000);
			}
		}
		
		System.out.println(price);
	}

}

Measured memory_bytes: 24136
N = int(input())
D = list(map(int, input().split()))
MOD = 998244353

a = [0 for _ in range(N)]
for d in D:
    a[d] += 1

if D[0] != 0 or a[0] != 1:
    ans = 0
else:
    ans = 1
    for i in range(1, N):
        ans = (ans * pow(a[i - 1], a[i], MOD)) % MOD
        # print(ans)
        # ans = pow(ans, max(a[i] * D[i - 1], 1), MOD)
print(ans)


Measured memory_bytes: 56048
N=int(input())
inl = list(map(int,input().split()))

max_v = -100000000
max_i = -1
min_v = 100000000
min_i = -1
for i, num in enumerate(inl):
    if max_v < num: 
        max_v = num 
        max_i = i
    if min_v > num:
        min_v = num
        min_i = i

outl = []
if abs(min_v) > abs(max_v):
    for i in range(N):
        if inl[i] > min_v:
            inl[i] += min_v
            outl.append((min_i, i))
    for i in reversed(range(1, N)):
        if inl[i-1] > inl[i]:
            inl[i-1] += inl[i]
            outl.append((i, i-1))
else:
    for i in range(N):
        if inl[i] < max_v:
            inl[i] += max_v
            outl.append((max_i, i))
    for i in range(1, N):
        if inl[i-1] > inl[i]:
            inl[i] += inl[i-1]
            outl.append((i-1, i))

# print(inl)

print(len(outl))
for i,j in outl:
    print(i+1, j+1)


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

void sort_array(int s[], int n) {
	for (int i = 0; i < n - 1; i++) {
		for (int j = i + 1; j < n; j++) {
			if (s[i] < s[j]) swap(s[i], s[j]);
		}
	}
}

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

	int h[100001];
	for (int i = 0; i < n; i++) cin >> h[i];
	//sort_array(h, n);
	sort(h, h + n);

	int min = 1000000000;
	/*for (int i = 0; i <= n - k; i++) {
		int abs = h[i] - h[i + k - 1];
		if (abs < min) min = abs;
	}*/
	for (int i = 0; i <= n - k; i++) {
		int abs = h[i + k - 1] - h[i];
		if (abs < min) min = abs;
	}

	cout << min << endl;

	return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <algorithm>
#include <math.h>
#include <vector>
#include <string>
#include <queue>
#include <map>
#include <utility>
#include <iomanip>  // std::setprecision()
#include <set>

using namespace std;
using ll = long long;
#define rep(i,a,b) for(ll i=(a); i<(b); i++)
#define YES cout << "YES" << endl;
#define NO cout << "NO" << endl;
#define yes cout << "Yes" << endl;
#define no cout << "No" << endl;
#define pai 3.14159265358979323846
ll gcd(ll a, ll b){if (a%b == 0)  return(b);else  return(gcd(b, a%b));}
ll lcm(ll a, ll b){return a * b / gcd(a, b);}
/* map<string,int> */
/* 大文字を小文字に変換 tolower*/
/* 小文字を大文字に変換 toupper*/
/* 辞書順 next_permutation(a.begin(),a.end()) */
 
int main() {
    string s,t;
    cin >> s >>t;
    if (s == t) {
        cout << "Yes" << endl;
        return 0;
    }
    string n;
    n = s;
    rep(j,0,s.size()+1) {
        rep(i,0,s.size()) {
            if (i ==0) {
                n[0] = s[s.size()-1];
            } else {
                n[i] = s[i-1];
            }
        }
        if (n == t)  {
            cout << "Yes" <<endl;
            return 0;
        }
        s = n;
    }
    cout << "No" << endl;
}

Measured memory_bytes: 3100
{-# LANGUAGE ScopedTypeVariables #-}
import qualified Data.Array as A
import Control.Monad
import qualified Data.Set as Set

readInput :: Read a => IO [a]
readInput = map read . words <$> getLine

main = do
    table :: A.Array (Int,Int) Int <- A.listArray ((0,0),(2,2)) . concat <$> replicateM 3 readInput
    n <- readLn
    marks <- Set.fromList <$> replicateM n readLn
    putStrLn $ case or [and [Set.member (table A.! (c, r)) marks | c <- [0..2]] | r <- [0..2]]
      || or [and [Set.member (table A.! (c, r)) marks | r <- [0..2]] | c <- [0..2]]
      || and [Set.member (table A.! (c, c)) marks | c <- [0..2]]
      || and [Set.member (table A.! (c, 2 - c)) marks | c <- [0..2]] of
          False -> "No"
          True -> "Yes"

Measured memory_bytes: 508
#include<iostream>
#include<string>
#include <stdio.h>

using namespace std;
long max(long N, long K){
  if(N>=K)return N;
  else return K;
}

int main(){
  long N,K;
  cin >> N >> K;
  long long c = 0;
  if(K==0){
    cout<<N*N<<endl;
    return 0;
  }
  else{
  for(int i=K+1;i<=N;i++){
    c += (N/i)*(i-K)+max(N%i-K+1,0);
  }
  cout << c << endl;
  }
  return 0;
}


Measured memory_bytes: 256
using System;
//(条件１)RGB全部異なる
//(条件２)j-i!=k-j
//まず(1)から考えると、#R*#G*#B(#は、~の数)
//その中から(2)を抜く。N<=4000でi,jがわかるとkも決まるので計算量はO(n^2)
//(2)変形するとk=2j-i

class Program
{
    static void Main()
    {
        int n = int.Parse(Console.ReadLine());
        string s = Console.ReadLine();
        int[] A = new int[n];
        int[] C = new int[3];//0=#B, 1=#R, 2=#G
        for(int i=0; i < n; i++)
        {
            A[i] = s[i] % 3;//%3をとるとB(66)=0,G(71)=2,R(82)=1となる
            C[A[i]]++;
        }
        long ans = (long)C[0] * C[1] * C[2];//C[0]にlongつけないと計算過程でオーバーフローする
        for(int j=0; j < n; j++)
        {
            for(int i=0; i < j; i++)
            {
                int k = j + (j - i);
                if (k < n)
                {
                    if (A[i] == A[j]) continue;
                    if (A[i] == A[k]) continue;
                    if (A[k] == A[j]) continue;
                    ans--;
                }
            }
        }
        Console.WriteLine(ans);
    }
}
//class Program
//{
//    static void Main()
//    {
//        int n = int.Parse(Console.ReadLine());
//        string s = Console.ReadLine();
//        int r=0, g=0, b=0;
//        for(int i=0; i < n; i++)
//        {
//            switch (s[i])
//            {
//                case 'R':
//                    r++;
//                    break;
//                case 'G':
//                    g++;
//                    break;
//                case 'B':
//                    b++;
//                    break;
//            }
//        }
//        long sum = r * g * b;
//        int sc = 0;//重複カウント
//        int temp;
//        for(int i = 0; i < n; i++)
//        {
//            for(int j = 0; j < n; j++)
//            {
//                temp = 2 * j - i;
//                if (!(2 <= temp && temp <n)) continue;
//                if (!(i < temp)) continue;
//                if (s[i] != s[j] && s[j] != s[temp]) sc++;
//            }
//        }
//        Console.WriteLine(sum - sc);
//    }
//}



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

signed main(){
    int N, K; cin >> K >> N;
    vector<int> a(N);
    for(int i = 0; i < N; i++) cin >> a[i];
    int ans = 1e9;
    for(int i = 0; i < N; i++){
        int clock, unclock;
        if(i == 0){
            clock = (-a[0] + a[N - 1]);
            unclock = K - (a[1] - a[0]);
        }
        if(i == N - 1){
            clock = -a[0] + a[N - 1];
            unclock = K - (a[N - 1] - a[N - 2]);
        }
        else{
            clock = K - (a[i + 1] - a[i]);
            unclock = K - (a[i] - a[i - 1]);
        }
        ans = min(clock, ans);
        ans = min(ans, unclock);
    }
    cout << ans << endl;
}


Measured memory_bytes: 1792
H, W = map(int, input().split())
N = int(input())
a = [(j, int(i)) for j, i in enumerate(input().split(), 1)]

data = [[0]*W for _ in range(H)]

h, w = 0, 0
for n, x in a:
    for i in range(x):
        data[h][w] = n

        if h % 2 == 0:
            if w == W - 1:
                h += 1
            else:
                w += 1
        else:
            if w == 0:
                h += 1
            else:
                w -= 1

for x in data:
    for y in x:
        print(y, end=' ')
    print()


Measured memory_bytes: 4500
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef double db; //
typedef string str; //
//
typedef pair<int,int> pi;
typedef pair<ll,ll> pl; //
typedef pair<db,db> pd; //
//
typedef vector<int> vi; 
typedef vector<ll> vl; //
typedef vector<db> vd; //
typedef vector<str> vs; //
typedef vector<pi> vpi;
typedef vector<pl> vpl; //
typedef vector<pd> vpd; //
 
typedef tree<pi, null_type, less<pi>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
 
#define mp make_pair
#define f first
#define s second
#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define rall(x) (x).rbegin(), (x).rend() //
#define rsz resize
#define ins insert //
#define ft front() //
#define bk back()
#define pf push_front //
#define pb push_back
#define eb emplace_back //
#define lb lower_bound //
#define ub upper_bound //
 
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)
#define trav(a,x) for (auto& a: x)
 
const int MOD = 1e9+7; // 998244353;
const int MX = 2e5+5; //
const ll INF = 1e18; //
const ld PI = acos((ld)-1);
const int xd[4] = {1,0,-1,0}, yd[4] = {0,1,0,-1}; //
mt19937 rng((uint32_t)chrono::steady_clock::now().time_since_epoch().count()); //
//
template<class T> bool ckmin(T& a, const T& b) { 
	return b < a ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) { //
	return a < b ? a = b, 1 : 0; } //
constexpr int pct(int x) { return __builtin_popcount(x); } //
constexpr int bits(int x) { return 31-__builtin_clz(x); } // floor(log2(x)) //
constexpr int cdiv(int a, int b) { return a/b+!(a<0||a%b == 0); } // division of a by b rounded up, assumes b > 0 //
// IGNORE
int fstTrue(function<bool(int)> f, int lo, int hi) {
	hi ++; assert(lo <= hi); // assuming f is increasing
	while (lo < hi) { // find first index such that f is true 
		int mid = (lo+hi)/2; 
		f(mid) ? hi = mid : lo = mid+1; 
	} 
	return lo;
}
template<class T> void remDup(vector<T>& v) { 
	sort(all(v)); v.erase(unique(all(v)),end(v)); }
struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }
 
    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
// IGNORE
//
int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int N, K;
	cin >> N >> K;
	int A[N];
	F0R(a, N)
		cin >> A[a];
	FOR(a, K, N){
		if(A[a] > A[a - K])
			cout << "Yes" << endl;
		else
			cout << "No" << endl;
	}
}


Measured memory_bytes: 4392
#include<iostream>
#include<iterator>
#include<vector>
#include<algorithm>
using namespace std;
typedef long long ll;

vector<int> ns;
ll count_inversions(int, int);

int main()
{
  int n; cin >> n; // number of iterations
  ns = vector<int> {istream_iterator<int>{cin}, istream_iterator<int>{}};
  cout << count_inversions(0, ns.size()) << endl;
}

ll merge(int l, int r, int m)
{
  vector<int> tmp;
  int i=l, j=m;
  ll cnt=0;
  while(i<m and j<r) {
    if(ns[i]<ns[j]) {
      tmp.push_back(ns[i++]);
    } else { // elements guaranteed to be unique
      tmp.push_back(ns[j++]);
      cnt += (m-i);
    }
  }
  while(i<m) {
    tmp.push_back(ns[i++]);
  }
  while(j<r) {
    tmp.push_back(ns[j++]);
  }
  copy(tmp.begin(), tmp.end(), &ns[l]);
  return cnt;
}

// sort [l, r)
ll count_inversions(int l, int r)
{
  if (r-l <= 1) return 0;  // at most one element
  ll left_inversions = count_inversions(l, (r+l)/2);
  ll right_inversions = count_inversions((r+l)/2, r);
  ll merge_inversions = merge(l, r, (r+l)/2);
  return left_inversions + right_inversions + merge_inversions;
}


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

int main() {
  int N, sum, ans = 10e8;
  cin >> N;
  vector<int> v(N);
  rep(i, 0, N) { cin >> v[i]; }
  rep(i, -100, 101) {
    sum = 0;
    rep(j, 0, N) {
      if (i != v[j]) {
        sum += (i - v[j]) * (i - v[j]);
      }
    }
    ans = min(ans, sum);
  }
  cout << ans << endl;
  getchar();
}

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

std::pair<int, long long> rec(int depth, int prev, int rem){
    if(!depth) return std::make_pair(1, 0);
    int count = 0;
    if(prev!=0){
        std::pair<int, long long> p = rec(depth-1, prev-1, rem);
        count += p.first;
        if(count >= rem){
            int cp = prev-1;
            for (int i = 1; i < depth; ++i) {
                cp*=10;
            }
            return std::make_pair(100000, cp + p.second);
        }
    }
    std::pair<int, long long> p = rec(depth-1, prev, rem-count);
    count += p.first;
    if(count >= rem){
        int cp = prev;
        for (int i = 1; i < depth; ++i) {
            cp*=10;
        }
        return std::make_pair(100000, cp + p.second);
    }
    if(prev!=9){
        std::pair<int, long long> p = rec(depth-1, prev+1, rem-count);
        count += p.first;
        if(count >= rem){
            int cp = prev+1;
            for (int i = 1; i < depth; ++i) {
                cp*=10;
            }
            return std::make_pair(100000, cp + p.second);
        }
    }
    return std::make_pair(count, 0);
}

int main(){
    int k;
    std::cin >> k;
    for (int depth = 0; depth < 10; ++depth) {
        for (int prev = 1; prev < 10; ++prev) {
            std::pair<int, long long> p = rec(depth, prev, k);
            k -= p.first;
            if(k <= 0){
                long long cp = prev;
                for (int i = 0; i < depth; ++i) {
                    cp *= 10;
                }
                std::cout << cp + p.second;
                return 0;
            }
        }
    }
}

Measured memory_bytes: 256
from sys import exit

l,r = map(int,input().split())

if l%673 == 0 or r%673 == 0:
    if l%3 == 0 or r%3 == 0:
        print(0)
        exit()
    else:
        for i in range(l, min(r,l+2)+1):
            if i%3 == 0:
                print(0)
                exit()
elif l//673 != r//673:
    for i in range(l, min(r,l+2)+1):
        if i%3 == 0:
            print(0)
            exit()

ans = 2019
for i in range(l,r):
    for j in range(i+1, r+1):
        ans = min(ans, (i*j%2019))
        if ans == 0:
            break
    if ans == 0:
        break
print(ans)

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

int main() {
	string S;
	cin >> S;
	int a = 0;
	for (char& i : S) {
		if (i == 'o') ++a;
	}
	if (a - S.size() < -7) cout << "NO";
	else cout << "YES";
}

Measured memory_bytes: 256
import math
N, x = map(int, input().split())
L = [int(x) for x in input().split()]
ans = 0
for i in range(1,N):
    if L[i-1] + L[i] > x:
        if L[i-1] > x:
            ans += L[i-1] - x
            ans += L[i]
            L[i] = 0
        else:
            ans += L[i] + L[i-1] - x
            L[i] = x - L[i-1]
print(ans)


Measured memory_bytes: 20328
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <random>
#include <cstdio>
#include <cmath>
#include <climits>
#include <map>
#include <queue>
#include <functional>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (int) n; i++)
#define rep1(i, n) for(int i = 1; i <= (int) n; i++)
#define all(v) v.begin(),v.end()
const ll mod = 1e9+7;

int main() {
    ll n,W;
    cin >> n >> W;
    vector<ll> w(n),v(n);
    ll vsum = 0;
    rep(i,n) {
        cin >> w[i] >> v[i];
        vsum += v[i];
    }
    vector<ll> dp(vsum+1, (ll)1e18); // dp[i] := 価値の総和がiになるように選んだときの重さ
    dp[0] = 0; // 価値0(全く品物を入れない)のとき重さも0
    
    rep(i,n) {
        for (int j = vsum; j >= v[i]; j--)
        {
            // 価値v[i]の品物を選択した可能性のある状態 == dp[v[i]]からdp[vsum]
            // 価値v[i]の品物を選択し得る状態 == dp[0]からdp[vsum-v[i]]
            // 価値v[i]の品物を選択した可能性のある状態を，
            // min{選択しなかった場合の重さ, 選択しうる状態から実際に選択した場合の重さ} で更新
            dp[j] = min(dp[j], dp[j-v[i]]+w[i]);
        }
    }

    for (int i = vsum; i >= 0; i--)
    {
        if (dp[i] <= W) {
            cout << i << endl;
            return 0;
        }
    }
    return 0;
}

Measured memory_bytes: 3952
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define ss second
#define ff first
#define pb push_back
int main(){
    ios_base::sync_with_stdio(0);
    int n;
    cin>>n;
    int s=0;
    for(int i=n;i<=1000000;i++){
            if(n==2){
                cout<<2;
                return 0;
            }
    for(int j=2;j<=ceil(sqrt(i));j++){

        if(i%j==0){
            break;
        }
        if(j>=sqrt(i)){
            cout<<i;
            return 0;
        }
    }
    }

    return 0;
}



Measured memory_bytes: 256
sx,sy,tx,ty=map(int,input().split())
dx=tx-sx
dy=ty-sy
 
a="U"*dy+"R"*dx
b="D"*dy+"L"*dx
c="L"+"U"*(dy+1)+"R"*(dx+1)+"D"
d="R"+"D"*(dy+1)+"L"*(dx+1)+"U"
print(a+b+c+d)

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

int main(){
  int n, m;
  cin >> n >> m;
  vector<vector<P>> Ni(n, vector<P>(0));
  vector<int> Mi(m);
  for(int i=0; i<m; ++i){
    int a, b, c;
    cin >> a >> b >> c;
    --a; --b;
    Ni[a].push_back(make_pair(b,i));
    Ni[b].push_back(make_pair(a,i));
    Mi[i] = c;
  }
  priority_queue<P,vector<P>,greater<P>> que;
  map<int, bool> usedMi;
  for(int i=0; i<n; ++i){
    que.push(make_pair(0, i));
    vector<int> minc(n,INF);
    minc[i] = 0;
    while(!que.empty()){
      int c, xi;
      tie(c,xi) = que.top();
      que.pop();
      if(minc[xi] < c) continue;
      for(P pi : Ni[xi]){
        if(c+Mi[pi.second] < minc[pi.first]){
          minc[pi.first] = c+Mi[pi.second];
          que.push(make_pair(c+Mi[pi.second],pi.first));
        }
      }
    }
    queue<int> que2;
    vector<bool> seached(n,true);
    que2.push(i);
    while(!que2.empty()){
      int x = que2.front();
      que2.pop();
      seached[x] = false;
      for(P pi : Ni[x]){
        if(seached[pi.first] && minc[pi.first] == minc[x] + Mi[pi.second]){
          usedMi[pi.second] = true;
          que2.push(pi.first);
        }
      }
    }
  }
  cout << m - usedMi.size() << endl;
}

Measured memory_bytes: 256
using System;
class RemainderMinimization2019{
	public static void Main(){
		int n = int.Parse(Console.ReadLine());
		string[] str = Console.ReadLine().Split(' ');
		int[] damA = new int[n];
		int[] ans = new int[n];
		for(int a=0;a<n;a++){
			damA[a] = int.Parse(str[a]);
		}
		ans[0]=0;
		for(int a=0;a<n;a++){
            if(a%2==0){
              ans[0]+=damA[a];
            }else{
              ans[0]-=damA[a];
            }
		}
    for(int a=1;a<n;a++){
			ans[a]=2*damA[a-1]-ans[a-1];
		}
		for(int a=0;a<n;a++){
		  Console.Write("{0} ",ans[a]);
	  }
		Console.WriteLine("");
	}
}


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

int main()
{
    int r, g, b;
    cin >> r >> g >> b;
    int k;
    cin >> k;
    if(r < g && g < b) {cout << "Yes"; return 0;}

    while(k){
        if(r < g && g < b) {cout << "Yes"; return 0;}
        if(r >= g) g *= 2, k--;
        else if(g >= b) b *= 2, k--;
    }
    if(r < g && g < b) {cout << "Yes"; return 0;}
    else cout << "No";

    return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
///a[0] != 0のとき、Si <0,Si+1<=0ならSi+c = 1を満たすcとa[i]の差をカウント
//aをソートして、前から順に見ていき、初めの要素から２だけ大きい要素までの個数をカウントしていく

int main(){
  int N;
  cin >> N;
  vector<int> a(N);
  rep(i,N){
      cin >> a[i];
  }
  sort(a.begin(),a.end());
  a.push_back(-1);

  vector<pair<int,int>> p;
  int count = 1;
  for(int i = 0;i<N;i++){
      
      if(a[i] == a[i+1]){
          count++;
      }
      if(a[i] != a[i+1]){
        p.push_back(make_pair(a[i],count));
        count = 1;
      }
  }
  
  int ans = 0;
  for(int i = 0;i<p.size();i++){
      int s = p[i].first;
      int j = i;
      int c = 0;
      while(p[j].first <= s+2 && j<p.size()){
          c += p[j].second;
          j++;
      }
      ans = max(c,ans);
  }

  cout << ans << endl;
}

Measured memory_bytes: 1656
def create_prime_list(limit):
    """ ??¨??????????????????????????§limit?????§????´???°?????????????±???????
    https://ja.wikipedia.org/wiki/%E3%82%A8%E3%83%A9%E3%83%88%E3%82%B9%E3%83%86%E3%83%8D%E3%82%B9%E3%81%AE%E7%AF%A9
    """
    x = limit**0.5
    primes = []
    # print('x={0}'.format(x))
    nums = [x for x in range(2, limit+1)]
    while nums[0] <= x:
        primes.append(nums[0])
        current_prime = nums[0]
        nums = [x for x in nums if x % current_prime != 0]
    primes.extend(nums)
    # print(primes)
    return primes



def calc_divisors(n):
    """ n????????????????????¨?????§????????°????????? """
    if n in Primes:
        return [n]
    results = []
    i = 2
    start_num = n
    while n >= i**2:
        if n%i==0:
            while n%i==0:
                results.append(i)
                n //= i
            if n in Primes:
                results.append(n)
                n = 1
        i += 1
    #print('{0}????´???°: {1}'.format(start_num, results))
    if not results:
        results = [start_num]
    return results


Primes = set()
if __name__ == '__main__':
    # ??????????????\???
    target_number = int(input())
    # target_number = 999993031
    # target_number = 1463616



    # ?¨?????????????
    Primes = set(create_prime_list(int(10**4.5)+1))
    results = calc_divisors(target_number)

    # ???????????¨???
    print('{0}: {1}'.format(target_number, ' '.join(map(str, results))))

Measured memory_bytes: 9008
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using pll = pair<ll, ll>;

const ld pi = acos(-1.);
const ll INF = 1000000000;

int main() {
    ios_base::sync_with_stdio(false);
    string s;
    cin >> s;
    ll n = s.length();
    ll ans = 1 + (n * (n - 1)) / 2;
    map<char, int> mp;
    for(int i = 0; i < s.length(); ++i){
        ++mp[s[i]];
    }
    for(auto pr: mp){
        ll k = pr.second;
        ans -= (k * (k - 1)) / 2;
    }
    cout << ans << endl;
    return 0;
}

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

int N;

using namespace std;

int main(){
  cin >> N;
  int maxa = -1, mina = 10000;
  vector<int> a(N);
  for(int i = 0; i < N; i++){
    cin >> a[i];
    if(a[i] <= mina) mina = a[i];
    if(a[i] >= maxa) maxa = a[i];
  }
  cout << maxa - mina;
}


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

#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.end(), cont.begin()
#define mp make_pair
#define pb push_back
#define X first
#define Y second
#define MOD 1000000007

#define trace1(x)                    cout <<#x<<": "<<x<< endl;
#define trace2(x, y)                 cout <<#x<<": "<<x<<" | "<<#y<<": "<<y<< endl;
#define trace3(x, y, z)              cout <<#x<<": "<<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl;
#define trace4(a, b, c, d)           cout <<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl;

typedef long long ll;
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(NULL);
    ll i,j,n,m;
    cin>>n;
    ll a[n];
    for(i=0;i<n;i++)
    cin>>a[i];
    sort(a,a+n);
    cout<<max(ll(0),a[n/2]-a[n/2-1]);
    return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
using ll = long long;
const int MOD = 1e9+7;
#define put(n) cout<<(n)<<endl
#define rep(i,N) for(int(i)=0;(i)<(N);++(i))
#define rrep(i,N) for(int (i)=(N-1);(i)>=(0);--(i))
#define all(v) (v).begin() , (v).end()
#define rall(v) (v).rbegin() , (v).rend()
#define pb(n) push_back(n)

double Abs(double D){
    if(D < 0) D = -D;
    return D;
}

int main(){
   double N,T,A;
   cin >> N >> T >> A;
   vector<double> H(N);
   rep(i,N) cin>>H[i];

   double diff = 1000000;
   int ans;

   rep(i,N){
       if(Abs(A - (T-H[i]*0.006)) < diff){
           ans = i+1;
           diff = Abs(A - (T-H[i]*0.006));
       }
   }

   cout << ans << endl;

}


Measured memory_bytes: 256
import * as fs from 'fs'
const reader = (s: string) =>
  s
    .split(' ')
    .join('\n')
    .split('\n')
    .map(t => parseInt(t, 10))

function Main(input: string) {
  const [N, K, Q, ...A] = reader(input)
  const score: number[] = new Array(N).fill(K - Q)

  for (const i of A) {
    score[i - 1]++
  }

  const yes = score.map(num => {
    if (num > 0) {
      return 'Yes'
    } else {
      return 'No'
    }
  })

  console.log(yes.join('\n'))
}

Main(fs.readFileSync('/dev/stdin', 'utf8'))


Measured memory_bytes: 31236
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

using namespace std;
int main()
{
    int n,m;
    scanf("%d %d",&n,&m);
    if(m>=n)
        printf("Yes\n");
    else
        printf("No\n");
    return 0;

}


Measured memory_bytes: 256
// -------- START : snippet -------- //

#include <bits/stdc++.h>
using namespace std;

struct IoSetup {
    IoSetup() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(10);
        cerr << fixed << setprecision(10);
    }
} iosetup;

// -------- START : macro -------- //

#define ll long long
#define rep(i,n) for(int i=0;i<int(n);++i)
#define rep1(i,n) for(int i=1;i<=int(n);++i)
#define len(c) (ll)c.size()
#define all(v) (v).begin(),(v).end()
#define lb(v,x) (lower_bound(all(v),x)-v.begin())
#define ub(v,x) (upper_bound(all(v),x)-v.begin())
#define has(c,x) (c.find(x) != c.end())
#define uniq(v) v.erase(unique(all(v)),v.end())
#define bit(k) (1LL<<(k))
#define INF int(1e9)

template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

// -------- END : macro -------- //

// -------- START : debug macro -------- //

template<class T,class U> ostream& operator<<(ostream& ost, const pair<T,U> &p) { ost << "(" << p.first << ", " << p.second << ")"; return ost; }
#define ostream_container { ost << "{"; for(const auto &t : v) { if (&t != &*v.begin()) ost << ", "; ost << t; } ost << "}"; return ost; }
template<class T> ostream& operator<<(ostream &ost, const vector<T> &v) ostream_container
template<class T> ostream& operator<<(ostream &ost, const set<T> &v) ostream_container
template<class T,class U> ostream& operator<<(ostream &ost, const map<T,U> &v) ostream_container

template<class H> void recursive_debug(string s, H h) {
    cerr << "\033[33m" << s << " = " << h << endl << "\033[m";
}
template<class H,class... T> void recursive_debug(string s, H h, T... t) {
    int comma = s.find(',');
    cerr << "\033[33m" << s.substr(0,comma) << " = " << h << ", ";
    recursive_debug(s.substr(comma+1), t...);
}
#define debug(...) recursive_debug(#__VA_ARGS__, __VA_ARGS__)

// -------- END : debug macro -------- //

// -------- END : snippet -------- //

int main(void) {
    ll n, d;
    cin >> n >> d;
    int cnt = 0;
    rep(i,n) {
        ll x,y;
        cin >> x >> y;
        if (x*x + y*y <= d*d) {
            cnt++;
        }
    }
    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 3648
# AOJ 1192: Tax Rate Changed
# Python3 2018.7.14 bal4u

while True:
	x, y, s = map(int, input().split())
	if x == 0: break
	ans = 0
	for p1 in range(1, s+1):
		for p2 in range(p1, s+1):
			t = p1 + p2 + (p1*x)//100 + (p2*x)//100
			if t > s: break
			if t != s: continue
			t = p1 + p2 + (p1*y)//100 + (p2*y)//100
			if t > ans: ans = t
	print(ans)



Measured memory_bytes: 5592