akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using 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++)
ll factorial(int i) {       //階乗
    if (i == 0) return 1;
    return (factorial(i - 1)) * i;
}
 
int main() {
    int m, d;
    cin >> m >> d;
    int count = 0;
    for(int i = 22; i <= d; i++) {
         if((i % 10) * (i / 10) <= m && i % 10 >= 2) count++;
    }
    cout << count << endl;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<vector<int>> vvi;
typedef vector<vector<string>> vvs;
typedef vector<vector<char>> vvc;
typedef vector<vector<bool>> vvb;
typedef pair<int,int> P;
#define vrep(v,n) for(int i=0;i<n;i++){cin >> v.at(i);} //配列vにn個の要素を入力する
#define rep(i, l, n) for (int i = l; i < (int)(n); i++)
#define repn(i, l, n) for (int i = l; i <= (int)(n); i++)

const int mod = 1000000007;

int main(){
    int n;
    cin >> n;
    vector<ll> v(1001);
    
    repn(i, 2, n){
        int x = i;
        repn(j, 2, i){
            while(x%j==0){
                v[j]++;
                x /= j;
            }
        }
    }

    ll ans = 1;
    rep(i, 0, v.size()){
        ans = ans * (v[i] + 1) % mod;
    }
    cout << ans%mod;
    

    
}

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

int main(){
  string s;
  cin >> s;
  int n = int(s.size());
  vector<int> ans(n);
  
  rep(ri,2){
    int cnt = 0;
    rep(i,n){
      if(s[i]=='R'){
        cnt++;
      }else{
        ans[i-1] += (cnt+2-1)/2;
        ans[i] += cnt/2;
        cnt = 0;
      }
    }
    reverse(s.begin(),s.end());
    reverse(ans.begin(),ans.end());
    rep(i,n){
      if(s[i]=='R'){
        s[i] = 'L';
      }else{
        s[i] = 'R';
      }
    }
  }
  rep(i,n){
    cout << ans[i] << endl;
  }
}

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

int main(){
  int n;
  scanf("%d\n", &n);
  while(n--){
    int runner=0, out=0, score=0;
    while(true){
      string s;
      cin>>s;
      if(s=="HIT"){
        if(runner==3)score++;
        else runner++;
      }
      else if(s=="HOMERUN"){
        score+=(runner+1);
        runner=0;
      }
      else if(s=="OUT"){
        out++;
        if(out==3)break;
      }
    }
    cout<<score<<endl;
  }
  return 0;
}

Measured memory_bytes: 1240
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vvl = vector<vl>;
const int INF = 1 << 28;
const ll MOD = 1000000007;
template <class T>
bool chmax(T &a, const T &b) {
    return (a < b) ? (a = b, 1) : 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    return (b < a) ? (a = b, 1) : 0;
}

int main() {
    int n;
    cin >> n;
    vi h(n);
    for (int i = 0; i < n; ++i) {
        cin >> h[i];
    }
    vi dp(n + 1, 0);
    dp[1] = abs(h[1] - h[0]);
    for (int i = 2; i < n; ++i) {
        dp[i] = min(dp[i - 2] + abs(h[i] - h[i - 2]), dp[i - 1] + abs(h[i] - h[i - 1]));
    }
    cout << dp[n - 1] << "\n";
    return 0;
}

Measured memory_bytes: 1024
#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 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 1000000000
#define eps 1e-7
#define mod 1000000007
#define int ll
using namespace std;

int l[8];
int N, A, B, C;

int dfs(vi log) {
    int i = log.size();
    if (i == N) {
        int totalMP = 0;
        int a=0, b=0, c=0;
        rep(j, N) {
            switch(log[j]) {
                case 0: //A
                    if (a > 0) totalMP += 10;
                    a += l[j];
                    break;
                case 1: //B
                    if (b > 0) totalMP += 10;
                    b += l[j];
                    break;
                case 2: //C
                    if (c > 0) totalMP += 10;
                    c += l[j];
                    break;
            }
        }
        if (a * b * c == 0) return INF;
        totalMP += abs(A-a) + abs(B-b) + abs(C-c);
        return totalMP;
    }
    vi logA = log;
    logA.pb(0);
    int chooseA = dfs(logA);
    vi logB = log;
    logB.pb(1);
    int chooseB = dfs(logB);
    vi logC = log;
    logC.pb(2);
    int chooseC = dfs(logC);
    vi logD = log;
    logD.pb(3);
    int chooseD = dfs(logD);
    return min(chooseA, min(chooseB, min(chooseC, chooseD)));
}

signed main(void) {
    cin >> N >> A >> B >> C;
    rep(i, N) {
        cin >> l[i];
    }
    vi log;
    cout << dfs(log) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
    int counter[101];
    int buffer, i, max = 0;

    // 0埋め
    for(i = 1; i <= 100; i++) counter[i]= 0;

    while(cin >> buffer) counter[buffer]++;

    // カウントアップしようね
    for(i = 1; i <= 100; i++)
        max = counter[i] >= max ? counter[i] : max;

    // Modeを表示する
    for(i = 1; i <= 100; i++) {
        if(counter[i] != max) continue;
        cout << i << endl;
    }
}


Measured memory_bytes: 3076
#include<bits/stdc++.h>
#define rep(i, a, b) for(int (i)=(a);(i)<(b);(i)++)
#define drep(i, a, b) for(int (i)=(a);(i)>=(b);(i)--)
#define MAGICLINE ios_base::sync_with_stdio(0)
#define pb push_back
#define mp make_pair
#define se second
#define fs first
using namespace std;
typedef long long LL;
typedef long double LD;
typedef pair<int, pair<int, int> > PII;
typedef priority_queue<PII,
                       vector<PII>,
                       greater<PII> > dijQ;

const int MN = 100002;
LL ans[MN][2], val[MN], weigh[MN];

void Move(int n){
    rep(i, 0, n+1){
        ans[i][0] = max(ans[i][0], ans[i][1]);
        ans[i][1] = 0;
    }
}

int main(){
    int n, m; cin >> n >> m;
    rep(i, 0, n){
        cin >> weigh[i] >> val[i];
    }

    rep(j, 0, n){
        rep(i, 1, m+1){
            if(i - weigh[j] < 0) continue;
            ans[i][1] = max(ans[i][0], ans[i-weigh[j]][0] + val[j]);
        }
        Move(m);
    }

    LL fin = 0;
    rep(i, 0, m+1) fin = max(fin, ans[i][0]);
    cout << fin << "\n";
    return 0;
}


Measured memory_bytes: 1792
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<ctime>
using namespace std;
long long a[1000010];
int main()
{
    int n,x=1,ans=0;//x表示一个数出现的次数，赋值1 
    cin>>n;
    for(int i=0;i<n;i++)
       cin>>a[i];
    sort(a,a+n);//先排序，更方便判断奇偶 
    for(int i=1;i<n;i++)
    {
        if(a[i]==a[i-1])//出现相同的数，x+1然后mod2 
          x=(x+1)%2;
        else
        {
            ans+=x;//单独的一个数，ans+1，x重新赋值为1，进行循环 
            x=1;
        }      
    }
    if(x%2)//再次判断 ，若不为0，则ans+1 
      ans++;
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 4360
#include <bits/stdc++.h>
#include <stdlib.h>
#include <string>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define inf 1001001001
#define mod 1000000007
#define pi 3.141592653589793
int nx[2]={1,0};
int ny[2]={0,1};

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

int main (){
    double l;
    cin >> l;
    printf("%.12lf\n",l*l*l/27);
    return 0;
}

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

//type
#define ll long long
typedef pair<int, int> P;
//定数
#define INF 1000000000000 //10^12:∞
#define MOD 1000000007    //10^9+7:合同式の法
#define MAXR 100000       //10^5:配列の最大のrange
//略記
#define PB push_back //挿入
#define MP make_pair //pairのコンストラクタ
#define F first      //pairの一つ目の要素
#define S second     //pairの二つ目の要素
#define Z class
// OTHER
// xの二乗を返す (関数テンプレート版)
template <typename T>
T square(T x) { return x * x; }
#define chmax(x, y) (x = max(x, y))
#define chmin(x, y) (x = min(x, y))
// loop
#define rep(i, n) for (int i = 0; i < (n); i++)
#define REPD(i, n) for (ll i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = a; i <= ll(b); i++)
#define FORD(i, a, b) for (ll i = a; i >= ll(b); i--)
#define FORA(i, I) for (const auto &i : I)

// vector
#define ALL(x) x.begin(), x.end()

// output
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define isYES(x) printf("%s\n", (x) ? "YES" : "NO")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define ln cout << '\n'
template <Z A>
void pr(A a)
{
  cout << a;
  ln;
}
template <Z A, Z B>
void pr(A a, B b)
{
  cout << a << ' ';
  pr(b);
}

int ans = 0;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

int main()
{
  int k, x;
  cin >> k >> x;
  int ans = x - k + 1;

  rep(i, k * 2 - 1)
  {
    cout << ans << " ";
    ans++;
  }
}


Measured memory_bytes: 3640
using namespace std;
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <map> // pair

int main(){

    //int size = 100000;
    vector<pair<long long,long long>> v;

    long long N,M;
    cin >> N >> M;

    for(long long i=0;i<N;i++){
        long long a,b;
        cin >> a >> b;
        //cout << a << " " << b << endl;
        //v[i] = make_pair(a, b);
        v.push_back(make_pair(a, b));
    }    
    
    //cout << v[0].first << " " << v[0].second << endl;
    //cout << v[1].first << " " << v[1].second << endl;


    //sort(v.begin(), v.end(), <pair<int,int> >());
    sort(v.begin(), v.end());
    

    //cout << v[0].first << " " << v[0].second << endl;
    //cout << v[1].first << " " << v[1].second << endl;


    long long i = 0;
    long long ans = 0;

    while(M>0){
        if(v[i].second <= M){
            M -= v[i].second;
            ans += v[i].first * v[i].second;
        }else{
            ans += v[i].first * M;
            M = 0;
        }
        i++;
    }

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


Measured memory_bytes: 2420
from collections import Counter
N = int(input())
S=[]

for n in range(N):
    S.append(Counter(list(input())))

S_=dict(S[0])
for s in S:
    if len(S_) > len(s):
        S_=dict(s)

for s in S:
    for s_ in S_.keys():
        S_[s_]=min(s[s_],S_[s_])

S_key=list(S_.keys())
S_key.sort()

ans=''
for k in S_key:
    ans += k*S_[k]
print(ans)


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

using namespace std;

bool is_palindrome(string s, int i, int j) {
    for (int k = i; k <= j; ++k) {
        if (s[k] != s[j + i - k]) return false;
    }
    return true;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s;
    cin >> s;
    int n = (int) s.size();
    if (is_palindrome(s, 0, n-1) && is_palindrome(s, 0, (n-3)/2) && is_palindrome(s, (n+1)/2, n-1)) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
int A, B, C;
  long long K;
  cin >> A >> B >> C >> K;
  
  //Kが奇数
  if(K&1 == 1)
    cout << B-A << endl;
  //Kが偶数のとき
  else
  	cout << A-B << endl;
  
return 0;
}

Measured memory_bytes: 3592
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
from collections import deque

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

DR = [1, -1, 0, 0]
DC = [0, 0, 1, -1]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
     
def main():
    N, M, st = LI()
    G = [[] for _ in range(N)]
    for _ in range(M):
        a, b, cost = LI()
        G[a].append((cost, b))

    def dijkstra(st):
        d = [inf] * N
        q = []
        d[st] = 0
        heapq.heappush(q, (0, st))
        while q:
            dist, u = heapq.heappop(q)
            for cost, v in G[u]:
                if dist + cost < d[v]:
                    d[v] = dist + cost
                    heapq.heappush(q, (d[v], v))
        return d
    d = dijkstra(st)
    for num in d:
        if num == inf:
            print("INF")
        else:
            print(num)





main()




Measured memory_bytes: 92624
import java.util.Scanner;

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

        while(true){
            
            a = sc.nextInt();
            op = sc.next();
            b = sc.nextInt();

            if(op.equals("+")){
                System.out.println(a+b);

            }else if(op.equals("-")){
                System.out.println(a-b);

            }else if(op.equals("*")){
                System.out.println(a*b);

            }else if(op.equals("/")){
                System.out.println(a/b);

            }else if(op.equals("?")){
                break;
            }
    
        }

        sc.close();

        }
    


}


Measured memory_bytes: 26428
import java.util.*;


class Main {
  public static void main(String[] args) {
	Scanner scanner = new Scanner(System.in);
    
    int N = scanner.nextInt(); //next(文字列), nextDouble, nextLine(1行)とか
    int ans = 0;
    for (int i = 1; i <= N ; i++){
      for (int j = 1; j <= N; j++){
        for (int k = 1; k <= N; k++){
          ans += GCD(i,j,k);
        }
      }
    }
    System.out.println(ans);
  }

  public static int GCD(int x, int y, int z) {
    
    while (x != y){
      if (x > y){
        x = x-y;
      }else{
        y = y -x;
      }
    }
    
    while (x != z){
      if (x > z){
        x = x-z;
      }else{
        z = z -x;
      }
    }    
    return z;
  }


}




Measured memory_bytes: 35788
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    string S;
    cin >> n;
    cin >> S;
    int mx = 0;
    int cnt;
    bool left, right;
    for (int i=1; i<n;i++){
        cnt = 0;
        for (char c='a';c<='z';c++){
            left = false;
            right = false;
			for(int j=0;j<n;j++)
				if(S[j]==c){
                    if (j<i){
					    left=true;
                    }else{
                        right=true;
                    }
                }
           if (left&&right){
                cnt++;
            }
        }

        mx = max(mx,cnt);
    }
    cout << mx << endl;
}

Measured memory_bytes: 256
use std::io::Read;

fn main() {
    let mut buf = String::new();

    // 標準入力から全部bufに読み込む
    std::io::stdin().read_to_string(&mut buf).unwrap();

    // 行ごとのiterが取れる
    let mut iter = buf.split_whitespace();
    let a: u32 = iter.next().unwrap().parse().unwrap();
    let b: u32 = iter.next().unwrap().parse().unwrap();

    if a * b % 2 == 0 {
        println!("Even");
    } else{
        println!("Odd");
    }
}

Measured memory_bytes: 4352
#include <iostream>
#include <string>
#include <algorithm>
#include <ctime>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cassert>
#include <bitset>
#include <list>
#include <cstdio>
#include <stdio.h>
#include <string.h>
#include <limits.h>
#include <math.h>
#include <cmath>
#include <tuple>
#include <cassert>
#include <array>
#include <iomanip>

using namespace std;
using ll = long long;
using pii = pair<int, int>;
using ti = tuple<int, int, int>;

#define REP(i,m,n) for(int i=(m); i<(n); i++)
#define RREP(i,n,m) for(int i=(n);i>=(m); i--)
#define pb push_back
#define mp make_pair
#define debug(x) cerr << #x << ": " << x << endl
// #define int long long 

const double eps=1e-14;
const int mod = 1e9 + 7;
const int inf = ((1<<30)-1);
const ll linf = (1LL<<60);
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a, b;
    cin >> a >> b;
    if(a<=9 && b<=9) cout << a*b;
    else cout << -1;
    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<iostream>
#include<queue>
#include<vector>
#include <bitset>
using namespace std;
#define INF 110000000000
#define MAX 100000
typedef long long ll;
typedef pair<ll,int> P;

int main(){
  int N,M,a,b;
  cin>>N>>M;
  vector<int> V[110000];
  for(int i=0;i<N;i++){
    cin>>a>>b;
    V[a].push_back(b);
  }
  ll ans=0;
  priority_queue<int> q;
  for(int i=1;i<=M;i++){
    for(int j=0;j<V[i].size();j++){
      q.push(V[i][j]);
    }
    if(q.empty()) continue;
    ans+=q.top();
    q.pop();
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 5888
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;
#define int long long
using P = pair<int,int>;
struct edge{int from, to, cost;};
edge graph[2200];
int dist[1100];
const int INF = 1001001001001ll;
bool ng = false;
signed main(){
    int v,e,r;cin >> v >>e >> r;
    rep(i,e){
        cin >> graph[i].from >> graph[i].to >> graph[i].cost;
    }
    rep(i,v)dist[i] = INF;
    dist[r] = 0;
    int cnt = 0;
    while(1){
        cnt++;
        bool update = false;
        rep(i,e){
            auto e = graph[i];
            if(dist[e.from] != INF && dist[e.to] > dist[e.from] + e.cost){
                dist[e.to] = dist[e.from] + e.cost;
                update = true;
            }
        }
        if(!update)break;
        if(cnt > v){
            ng = true;
            break;
        }
        

        
    }
    if(ng){
        cout << "NEGATIVE CYCLE" << endl;
        return 0;
    }
    rep(i,v){
        if(dist[i] == INF)cout << "INF" << endl;
        else cout << dist[i] << endl;
    }

    return 0;
}


Measured memory_bytes: 3120
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <deque>
#include <cctype>
#include <cstdio>
#include <math.h>
using namespace std;
int main(){
    string s;
    cin >> s;
    long long ans=0;
    long long cnt=0;
    for(int i=s.length()-1;i>=0;i--){
        if(s[i]=='B'){
            ans += s.length()-1-i-cnt;
            cnt++;
        }
    }
    cout << ans <<  endl;
}

Measured memory_bytes: 640
#include <iostream>

using namespace std;

class A {
	int T, X;
public:
	void solve()
	{
		double ans{ (double)T / X };
		cout << ans << endl;
	}

	A() { cin >> T >> X; }
};

int main()
{
	A solution;
	solution.solve();

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <string>
#include <algorithm>
#include <string.h>
#include <ctype.h>
#include <math.h>
#include <float.h>
#include <iomanip>
#include <iostream>
using namespace std;


int main(){

    string S,ans="";
    cin >>S;

    for(int i=0;i<S.length();i++){
        if((i+1)%2==1){
            ans+=S[i];
        }
    }

    cout <<ans<<endl;

    return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#define nl "\n"
#define for(variable,initial,final) for(variable=initial;variable<final;++variable)
using namespace std;
int main()
{
     string s,t;
     cin>>s>>t;
     int i; int counter=0;
     for(i,0,s.size())
     if(s[i]!=t[i])
     counter++;
     cout<<counter<<nl;

 return 0;
}


Measured memory_bytes: 3920
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int k = sc.nextInt();
    int x = sc.nextInt();
    if(k*500>=x){
      System.out.println("Yes");
    }else{
      System.out.println("No");
    }
  }
  

  
}

Measured memory_bytes: 23636
class Main{
 
public static void main(String[] args){
  int count5 = 0;
  int count7 = 0;
  
  java.util.Scanner scanner = new java.util.Scanner(System.in);
  
  for(int i = 0; i < 3; i++){
  	String str = scanner.next();
    if(str.equals("5")){
      count5++;
    } else if(str.equals("7")){
      count7++;
    }
  }
  
  if(count5 == 2 && count7 == 1){
  	System.out.println("YES");
  }else {
  	System.out.println("NO");
  }
}
}

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

using namespace std;
#define  ll long long
#define ld long double
#define f first
#define s second

int n , g , p[11] , c[11] , mn=1e9;
bool vis[11];

void solve(int i , int sum , int cnt)
{
    if (i > n)
    {
        int rem = g-sum;
        if (rem <= 0) mn = min(mn , cnt);
        else
        {
            for(int j=n; j>0; j--)
            {
                if (vis[j]) continue;
                for(int k=1; k<=p[j]; k++)
                {
                    rem -= j*100 , cnt++;
                    if (rem <= 0)
                    {
                        mn = min(mn , cnt);
                        return;
                    }
                }
            }
        }
        return;
    }

    vis[i] = 1;
    solve(i+1 , sum+p[i]*i*100+c[i] , cnt+p[i]);
    vis[i] = 0;
    solve(i+1 , sum , cnt);
}

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

    cin >> n >> g;
    for(int i=1; i<=n; i++)
    {
        cin >> p[i] >> c[i];
    }

    solve(1,0,0);
    cout << mn << '\n';

    return 0;
}

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

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

int main(){
        ll a,b,k;
        cin>>a>>b>>k;
        ll tmp=a,res=b;
        bool ok=true;
        for(int i=0;i<k;i++){
                if(tmp%2){
                        tmp--;
                        res+=tmp/2;
                        tmp/=2;
                }else{
                        res+=tmp/2;
                        tmp/=2;
                }
                swap(tmp,res);
                if(ok)ok=false;
                else ok=true;
        }
        if(ok)cout<<tmp<<" "<<res<<endl;
        else cout<<res<<" "<<tmp<<endl;
        return 0;
}


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

using namespace std;

#define debug(n) cerr << #n << ':' << n << endl;
#define dline    cerr << __LINE__ << endl;

using ll = long long;
using ull = unsigned long long;
template<class T, class U> using P = pair<T,U>;
template<class T> using Heap = priority_queue<T>;
template<class T> using heaP = priority_queue<T,vector<T>,greater<T>>;
template<class T,class U> using umap = unordered_map<T,U>;
template<class T> using uset = unordered_set<T>;

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

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

template<class T, size_t N, class U>
void Fill(T (&a)[N], const U&v){
    fill((U*)a,(U*)(a+N),v);
}

template<class T,class U>
istream& operator >> (istream&is, P<T,U>&p){
  is >> p.first >> p.second;
  return is;
}

template<class T>
istream& operator >> (istream&is, vector<T>&v){
  for(auto&e:v){
    is >> e;
  }
  return is;
}
int main(){
  int n; cin >> n;
  vector<int> a(n),t(n);
  for(int i = 0; i < n; ++i)cin >> a[i] >> t[i];
  vector<P<int,int>> v(n);
  for(int i = 0; i < n; ++i){
    v[i] = {a[i]+t[i],i};
  }
  sort(v.rbegin(), v.rend());
  ll ans = 0;
  for(int i = 0; i < n; ++i){
    if(i%2==0)ans += a[v[i].second];
    else ans -= t[v[i].second];
  }
  cout << ans << endl;
}


Measured memory_bytes: 4848
N = int(input())
l = list(map(int,input().split()))

INF = 10 ** 17

start = []
start.append((0, l[0]))
start.append((0,max(l[0],l[1])))

for i in range(2, N):
    if i % 2 == 0:
        left = [start[-1][1], start[-2][0] + l[i]]
        right = [start[-2][1] + l[i]]
    else:
        left = [start[-1][0], start[-2][0] + l[i]]
        right = [start[-1][1], start[-2][1] + l[i]]
    start.append((max(left),max(right)))

if N % 2:
    print(start[-1][0])
else:
    print(start[-1][1])


Measured memory_bytes: 101372
#include <iostream>
#include <math.h>
#include <algorithm>

using namespace std;

int main(){
  int a,b,c,k;
  cin >> a >> b >> c >> k;
  for(int i=0;i<k;i++){
    if(a >= b) {
      b *=2;
    }
    else if(b >= c){
      c *=2;
    }
  }
  if(b > a && c > b) cout << "Yes";
  else cout << "No";
  return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(int (i) = (s);(i) <= (e);(i)++)
#define all(x) x.begin(),x.end()

int N;
int M;
vector<int> A;
vector<int> cnt;

vector<vector<int>> sum;

int main(){
  cin >> N >> M;
  A.resize(N);
  cnt.resize(M);
  sum.resize(M,vector<int>(N + 1,0));
  rep(i,0,N - 1){
    cin >> A[i];
    A[i]--;
    cnt[A[i]]++;
    rep(j,0,M - 1){
      sum[j][i + 1] += sum[j][i] + (A[i] == j);
    }
  }

  vector<i64> dp(1 << M,1e9);
  dp[0] = 0;
  for(int s = 0;s < 1 << M;s++){
    int start = 0;
    rep(i,0,M - 1){
      if(s & (1 << i)){
        start += cnt[i];
      }
    }
    rep(i,0,M - 1){
      if(!(s & (1 << i))){
        int t = s | (1 << i);
        int end = start + cnt[i] - 1;
        int nhere = sum[i][start] - sum[i][0] + sum[i][N] - sum[i][end + 1];
        dp[t] = min(dp[t],dp[s] + nhere);
      }
    }

  }

  cout << dp[(1 << M) - 1] << endl;
}



Measured memory_bytes: 19420
#include <iostream>
#include <string>
#include <math.h>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <set>
#include <queue>
#include <deque>
#include <map>
#include <stack>
using namespace std;

#define mod 1000000007
#define ten5 100005
#define ten52 200005
#define ten6 1000005
#define PI 3.1415926
#define pb(x) push_back(x)
#define all(x) x.begin(),x.end()
#define mkpr(x1,x2) make_pair(x1,x2)
typedef long long int ll;


//stack<char> stk;
//set<ll> sll;
//map<string,ll> mp,mp1;
//map<pair<ll,ll>,ll>::iterator iter;
//map<ll,ll> mp;
//deque<char> deq;
//vector<ll> vll;
ll num[ten52];
ll path[ten52];

int main(void)
{
    //double ans=0.0,d,d1,d2;
    //float f,g,h;
    long long int m,n,i,j,k=0,save;
    long long int a,a1,a2,a3,sum;
    string s,s1,s2;
    //char c,c1;
    sum=a=a1=a2=a3=0;
    cin>>n>>m;
    save=m;
    for(i=0;i<n;i++)
    {
        cin>>num[i];
        path[i+1]=-1;
    }
    for(i=1,j=1;i<=(n>=m?m:n);i++)
    {
        if(path[num[j-1]]==-1)
        {
            path[num[j-1]]=i;
            j=num[j-1];
        }
        else
        {
            sum=i-path[num[j-1]];
            m-=path[num[j-1]];
            break;
        }
    }
    if(save!=m)
    {
        m%=sum;
        for(j=0,k=1;j<i-sum+m;j++) k=num[k-1];
    }
    else
        for(j=0,k=1;j<m;j++) k=num[k-1];
    cout<<k;
    return 0;
}





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

int main(){
 string a;
 getline(cin,a);
 for(int i=0;i<a.size();i++){
	 if(a[i]>='a'&&a[i]<='z')cout<<(char)(a[i]-32);
	 else cout<<a[i];
	}
	cout<<endl;
 return 0;
 }


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

#define _GLIBCXX_DEBUG
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define all(x) begin(x), end(x)
typedef long long ll;
typedef pair<int, int> pii;
const int inf=100100100;
const ll  INF=1001000100010001000;
const int mod=(int)1e9+7;

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

int main(){
    int n;
    cin>>n;
    int t=n+10;
    ll a[n][3],dp[n+1][3]={0};
    rep(i,0,n){
        rep(j,0,3){
            cin>>a[i][j];
        }
    }
    rep(i,0,n){
        rep(j,0,3){
            rep(k,0,3){
                if(k==j)continue;
                chmax(dp[i+1][k],dp[i][j]+a[i][k]);
            }
        }
    }
    ll ans=0;
    rep(i,0,3){
        //cout<<dp[1][i]<<endl;
        chmax(ans,dp[n][i]);
    }
    cout<<ans<<endl;
return 0;
}

Measured memory_bytes: 4992
#include<stdio.h>
int d[2][100010],w=0;
int ta[100010],to[200010],nt[200010];
void f(int s){
  int i,j,t,r,q[100010];
  d[w][q[t=0]=s]=1;
  for(r=1;r-t;t++){
    for(i=ta[q[t]];i+1;i=nt[i]){
      if(d[w][to[i]])continue;
      d[w][to[i]]=d[w][q[t]]+1;
      q[r++]=to[i];
    }
  }
}
int main(){
  int n,a,b,i;
  scanf("%d",&n);
  for(i=0;i<n;i++)ta[i+1]=-1;
  for(i=0;i<n-1;i++){
    scanf("%d %d",&a,&b);
    nt[i    ]=ta[to[i+n]=a];
    nt[i+n  ]=ta[to[i  ]=b];
    ta[a]=i;
    ta[b]=i+n;
  }
  f(1);
  w++;//for(i=1;i<=n;i++)printf("%d %d\n",d[0][i],d[1][i]);
  f(n);
  for(i=a=b=0;i<n;i++){
    if(d[0][i+1]>d[1][i+1])b++;
    else a++;
  }
  //for(i=1;i<=n;i++)printf("%d %d\n",d[0][i],d[1][i]);
  printf("%s\n",b<a?"Fennec":"Snuke");
  return 0;
}

Measured memory_bytes: 3328
#include "bits/stdc++.h"
using namespace std;
#define repr(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repr(i,0,n)
#define reprrev(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)
#define reprev(i,n) reprrev(i,0,n)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define mp make_pair
#define mt make_tuple
#define MOD 1000000007
#define PI 3.1415926535
typedef long long ll;
typedef pair<int, int> Pi;
typedef pair<ll, ll> Pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<Pi> vPi;
typedef vector<Pll> vPll;
typedef vector<vector<int>> vvi;
typedef vector<vector<bool>> vvb;
typedef vector<vector<ll>> vvll;
typedef vector<vector<char>> vvc;
typedef vector<vector<string>> vvs;
typedef vector<vector<double>> vvd;
typedef vector<vector<Pi>> vvPi;
typedef priority_queue<int, vector<int>, greater<int>> pqli;
typedef priority_queue<ll, vector<ll>, greater<ll>> pqlll;
typedef priority_queue<Pi, vector<Pi>, greater<Pi>> pqlP;
string YN(bool y) { return (y?"YES":"NO"); }
string yn(bool y) { return (y?"Yes":"No"); }
string ON(bool y) { return (y?"OK":"NG"); }
int main(void)
{
	int n, max=-1, min=1001;

	cin>>n;

	vi a(n);

	rep(i, n) cin>>a[i];

	rep(i, n){
		if(max<a[i]) max=a[i];
		if(min>a[i]) min=a[i];
	}
	cout<<max-min<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A, B, C, D;
  cin >> A >> B >> C >>D;
  
  if (A+B > C+D) {
    cout << "Left";
  }
  
  else if (A+B == C+D) {
    cout << "Balanced";
  }
  
  else {
    cout << "Right";
  }
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<char, int> P;

int main() {
	int N;
	cin >> N;
	int sum = 0;
	int i;
	for (i = 1; i <= N; i++) {
		sum += i;
		if (sum >= N) break;
	}
	for (int j = 1; j <= i; j++) {
		if (j != sum - N) cout << j << endl;
	}
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
	long long n;
	long long a[5];//a[n]是从n+1号城市到n+1号城市一分钟运输的人 
	cin>>n;
	long long minn=1100000000000000; 
	for(int i=0;i<5;i++){
		cin>>a[i];
		if(a[i]<minn){
			minn=a[i];
		}
	}
	long long tmp;
	if(n%minn==0){
		tmp=n/minn;
	}else{
		tmp=n/minn+1;
	}
	long long ans=tmp+4;
	cout<<ans;
}

Measured memory_bytes: 256
x,d,m[];main(h,X,Y,S){for(;x--||~scanf("%d,%d,%d",&X,&Y,&S,x=99);)hypot(x%10-X,x/10-Y)*2<=S+1?h-=!m[x],d=fmax(++m[x],d):0;d=!printf("%d\n%d\n",99+h,d);}

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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  string S;
  cin >> S;
  if(S <= "2019/04/30") {
    cout << "Heisei" << endl;
  } else {
    cout << "TBD" << endl;
  }
}

Measured memory_bytes: 256
//k_tourist
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
#include<bits/stdc++.h>
#define mod 1000000007
#define ll long long
#define mx 100005
#define non __builtin_popcount
#define ml map<ll, ll> 
#define uml unordered_map<ll, ll>
#define ms map<string , ll> 
#define all(a) (a).begin(),(a).end()
#define ff first
#define ss second
#define pl pair<ll, ll>
#define vl vector<ll>
#define vll vector<pl>
#define tpl pair<ll, pl>
#define vlll vector<tpl>
#define vs vector<string>
#define pb push_back
#define mk make_pair
#define M_PI 3.14159265358979323846
#define endl '\n'
#define fst ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define si(x) scanf("%d",&x)
#define sl(x) scanf("%I64d",&x)
#define inf ((ll)1e12 + 1)
#define bs binary_search
#define pq priority_queue
#define ub upper_bound
#define lb lower_bound
#define pow powr
#define sp(a) setprecision(a)
#define rep(i,a,b)  for (i=(a);i<(b);i++)
#define nrep(i,a,b) for (i=(a);i>(b);i--)
using namespace std;
using namespace __gnu_pbds;  

typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update>  ordered_set;
 
ll powr(ll a,ll b)
{
	ll res=1;
	while(b)
	{
		if(b&1)res=(res*a)%mod;
		a=(a*a)%mod;
		b>>=1;
	}
	return res;
}

void flag(ll fl){

	if(fl)
	cout<<"NO";
	else
	cout<<"YES";
}

ll n, wt[105], dp[mx][105], val[105];

ll knap(ll v, ll i){

	// if(i == n )
	// return 0;

	if(!v)
	return 0;

	if(i == n)
	return inf;

	if(dp[v][i] != -1)
	return dp[v][i];

	if(val[i] > v)
	return dp[v][i]= knap(v, i+1);

	return dp[v][i] = min(wt[i] + knap(v- val[i], i+1), knap(v, i+1));


}

void bta_de_yarr(){

	ll i, j, fl=0, ans, m, w;

	cin>>n>>w;

	rep(i, 0, n)
	cin>>wt[i]>>val[i];

	rep(i, 0, mx){

		rep(j, 0, n+1)
		dp[i][j] = -1;
	}

	 ans= 0;

	rep(i, 0, mx){

		if(knap(i, 0) <= w)
		ans= i;

		// cout<<knap(i, 0)<<endl;
		//ans= max(ans, i);
	}

	// cout<<knap(90, 0)<<endl;
	
	cout<<ans;
	// flag(fl);
	cout<<endl;
}

int main(){
    fst

	// freopen("input.txt","r",stdin);
    // freopen("output.txt","w",stdout);
	ll t;
    t= 1;
	//cin>>t;
    while(t--){
        bta_de_yarr();
    }
    return 0;
}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Measured memory_bytes: 82304
#include <iostream>
using namespace std;
int main(void){
    int n;
    cin >> n;
    int b[n];
    for(int i=0;i<n;i++){
        b[i]=0;
    }
    for(int i=2;i<=n;i++){
        int ai;
        cin >> ai;
        b[ai-1]++;
    }
    for(int i=0;i<n;i++){
        cout << b[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 4368
#include<iostream>
#include<string>
#include<algorithm>
#include<set> 
#define LL long long 
using namespace std;
#define inf 0x3f3f3f3f
struct node
{
	int a,b,t;
}a[100005];
int dp[100005];
bool cmp(node a,node b)
{
	if(a.b==b.b) return a.a>b.a;
	return a.b>b.b;
}
int main()
{
	int n,h;
	cin>>n>>h;
	int maxa=-1;
	int maxb=-1;
	int in=1;
	for(int i=1;i<=n;i++)
	{
		cin>>a[i].a>>a[i].b;
		a[i].t=i;
		if(a[i].a>maxa)
		{
			in=i;
			maxa=a[i].a;
			maxb=a[i].b;
		}	
	}
	int ans=inf;
	sort(a+1,a+1+n,cmp);
	for(int i=1;i<=n;i++) dp[i]=dp[i-1]+a[i].b;
	int ans1=inf,ans2=inf;
	bool flag=false;
	for(int i=1;i<=n;i++)
	{	
		if(a[i].a==maxa) flag=true;
		int t=0,th=h;
		t+=i;
		th-=dp[i];
		if(th<=0){
			ans=min(ans,t);
		}
		else{
			if(flag){
				if(th%maxa!=0) t++;
				t+=th/maxa; 
				ans=min(ans,t);
			}
			else{
				if(th%a[i].a!=0) t++;
				t+=th/a[i].a; 
				ans=min(ans,t);
			}
		}
	}
	cout<<ans<<endl;
} 

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

typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef long long int ll;
typedef vector<ii> vii;

#define NIL -1

vii ans;
class Graph {
    int V;    
    list<int> *adj;    
    void bridgeUtil(int v, bool visited[], int disc[], int low[],
                    int parent[]);
public:
    Graph(int V);   
    void addEdge(int v, int w); 
    void bridge();    
};
 
Graph::Graph(int V) {
    this->V = V;
    adj = new list<int>[V];
}
 
void Graph::addEdge(int v, int w) {
    adj[v].push_back(w);
    adj[w].push_back(v);  
}
 
void Graph::bridgeUtil(int u, bool visited[], int disc[], 
                                  int low[], int parent[]) {
    static int time = 0;
 
    visited[u] = true;
 
    disc[u] = low[u] = ++time;
 
    list<int>::iterator i;
    for (i = adj[u].begin(); i != adj[u].end(); ++i) {
        int v = *i; 
        if (!visited[v]) {
            parent[v] = u;
            bridgeUtil(v, visited, disc, low, parent);
 
            low[u]  = min(low[u], low[v]);
           
            if (low[v] > disc[u])
              ans.push_back(make_pair(u,v));
        }
 
        else if (v != parent[u])
            low[u]  = min(low[u], disc[v]);
    }
}
 
void Graph::bridge() {
    bool *visited = new bool[V];
    int *disc = new int[V];
    int *low = new int[V];
    int *parent = new int[V];
 
    for (int i = 0; i < V; i++) {
        parent[i] = NIL;
        visited[i] = false;
    }
 
    for (int i = 0; i < V; i++)
        if (visited[i] == false)
            bridgeUtil(i, visited, disc, low, parent);
}

int a, b, n, m;
int main() {
    cin >> n >> m;
    Graph g(n);
    while(m--) {
        cin >> a >> b;
        a--, b--;
        g.addEdge(a, b);
    }
    g.bridge();
    cout << ans.size() << endl;
    return 0;
}

Measured memory_bytes: 256
A,B,C = map(int, input().split())
K = int(input())
N = 0

while B <= A:
    if N < K:
        B = B*2
        N += 1
    else:
        print('No')
        break
else:
    if C > B:
        print('Yes')
    elif C <= B:
        while C <=B:
            if N < K:
                C = C*2
                N += 1
            else:
                print('No')
                break
        else:
            print('Yes')
        

Measured memory_bytes: 9124
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "math.h"
#include "utility"
#include "string"
#include "map"
#include "unordered_map"
#include "iomanip"
#include "random"

using namespace std;
const long long int MOD = 1000000007;

long long int power(long long int x, long long int n, long long int M) {
	long long int tmp = 1;

	if (n > 0) {
		tmp = power(x, n / 2, M);
		if (n % 2 == 0) tmp = (tmp*tmp) % M;
		else tmp = (((tmp*tmp) % M)*x) % M;
	}
	return tmp;
}

long long int N, M, K, Q, W, H, L, R;
long long int ans;

using namespace std;


int main() {
	ios::sync_with_stdio(false);
	cin >> N >> M >> K;
	while (N) {
		int num[1000];
		int sum = 0;
		for (int i = 1; i <= N; i++) {
			cin >> num[i];
			sum += num[i];
		}
		sum = sum*(100 - K);
		if (!num[M])cout << "0\n";
		else cout << sum / num[M] << endl;
		cin >> N >> M >> K;
	}
	return 0;
}

Measured memory_bytes: 3100
import java.util.Scanner;


class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner (System.in);
		
		int a, b, c, sqr;
		String n;
		
		while(scan.hasNextInt())
		{
			n = "";
			a = scan.nextInt();
			b = scan.nextInt();
			
			n =  n + a + b;
			c = Integer.parseInt(n);
			sqr = (int)Math.sqrt(c);
			
			if(sqr * sqr == c)
				System.out.println("Yes");
			else
				System.out.println("No");
			
		}

	}

}

Measured memory_bytes: 21844
n = int(input())
cards = sorted(list(map(int, input().split())), reverse=True)
alice = []
bob = []
for i in range(0, n, 2):
    alice.append(cards[i])
    try:
        bob.append(cards[i+1])
    except:
        break
print(sum(alice) - sum(bob))

Measured memory_bytes: 9004
import java.util.Scanner;
public class Main{
	public static void main(String[]args){
	Scanner scan=new Scanner(System.in);
	int a=scan.nextInt();
	String b=scan.next();
	long ans=1;
	long alpha[]={1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1};
	for(int i=0;i<b.length();i++) {
		char ch=b.charAt(i);
		alpha[ch-'a']++;
	}
	for(int i=0;i<26;i++) {
		ans*=alpha[i];
		ans%=1000000007;
	}
	System.out.println(ans-1);
	scan.close();
	}
}

Measured memory_bytes: 25812
//#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
#define PI 3.14159265359
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
const long long INF= 1e+18+1;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll> >vvl;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> T;
const ll MOD=1000000007LL;
string abc="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
int main(){
  ll a,b,c;cin>>a>>b>>c;
  if(a==b&&b==c)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}

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

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int tarouPoint = 0;
		int hanakoPoint = 0;
		int n = Integer.parseInt(br.readLine());
		for (int i = 0; i < n; i++) {
			String[] cards = br.readLine().split(" ");
			int j = cards[0].compareTo(cards[1]);
			if (j < 0) hanakoPoint += 3;
			else if (0 < j) tarouPoint += 3;
			else {
				tarouPoint++;
				hanakoPoint++;
			}
		}
		System.out.println(tarouPoint + " " + hanakoPoint);
	}
}

Measured memory_bytes: 25692
#include<bits/stdc++.h>
#include<cmath>
#include<string>
using namespace std;
int main(){
    long long X;
  	cin>>X;
  int cnt=0;
  long long K=100;
	while(K<X){
      K*=1.01;
      cnt++;
    }
  cout<<cnt;
}


Measured memory_bytes: 3636
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main(void) {
  int N, Q;
  cin >> N >> Q;
  string S;
  cin >> S;
  

  vector<int> sum(N+1, 0);
  for (int i = 0; i < N; ++i) {
    sum[i+2] = sum[i+1];
    if (S[i] == 'A' && S[i+1] == 'C') {
      sum[i+2]++;
    }
  }

  int l, r;
  for (int i = 0; i < Q; ++i) {
    cin >> l >> r;
    cout << sum[r] - sum[l] << endl;
  }
  
}


Measured memory_bytes: 1408
#include<iostream>
#include<string>
#include<algorithm>

using namespace std;

const int MAX = 100;

int main() {
	int N,A;
	cin >> N>>A;
	int p = N%500;
  if(p<=A){
	cout << "Yes"<< endl;
}
else{
	cout << "No"<< endl;
}
	return 0;
}


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

if A == B:
    print(1)
    
elif A < B:
    if N == 1:
        print(0)
    elif N == 2:
        print(1)
    else:
        print((N-2)*B - (N-2)*A +1)
        
else:
    print(0)

Measured memory_bytes: 2940
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC118A
{
    class Program
    {
        static void Main(string[] args)
        {
                string[] m = Console.ReadLine().Split(' ');
                int a = int.Parse(m[0]);
                int b = int.Parse(m[1]);

                if ((b % a) == 0)
                    Console.WriteLine(a + b);

                else
                    Console.WriteLine(b - a);

            }
        }
    }


Measured memory_bytes: 13140
#include <iostream>
#include <math.h>
#include <cstdio>
using namespace std;

int p[500000];
int id,q;
int k;

int parent(int i){
    if(i%2==0){
        return i/2;
    }else{
        return (i-1)/2;
    }
}

int left(int i){
    return 2*i;
}

int right(int i){
    return 2*i+1;
}

int inside(int i){
    if(i > id || i <= 0){
        return 0;
    }else{
        return 1;
    }
}

void maxHeapify(int i){
    if(inside(left(i))==0||(p[right(i)]<=p[i]&&p[left(i)]<=p[i])){
    }else{
        if(p[left(i)]>=p[right(i)]){
            q = p[left(i)];
            p[left(i)] = p[i];
            p[i] = q;
            maxHeapify(left(i));
        }else{
            q = p[right(i)];
            p[right(i)] = p[i];
            p[i] = q;
            maxHeapify(right(i));
        }
    }
}

int main(){
    cin >> id;
    for(int m = 0; m <= 8; m++){
        if(id>=pow(2,m)){
            k = (int)pow(2,m);
        }
    }
    for(int m = 1; m <= id; m++){
        cin >> p[m];
    }
    for(int m = id; m >= 1; m--){
        maxHeapify(m);
    }
    for(int m = 1; m <= id; m++){
        printf(" %d", p[m]);
    }
    printf("\n");
    return 0;
}

Measured memory_bytes: 3136
#include<bits/stdc++.h>
using namespace std;
int main(){
    int a;
    cin >> a;
    vector<int> b(a);
    for(int i = 0; i < a; i++){
        cin >> b[i];
    }
 int cnt = 0, ans = 0;
 for(int i = 0; i < b.size();i++){
     if(b[i] > cnt + 1)
     ans++;
     else if(b[i] == cnt + 1)
     cnt++;
     else if(b[i] <= cnt)
     ans++;
 }
 if(cnt == 0)
 cout << -1 << endl;
 else
 cout << ans << endl;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define rap(i,n) for(int i=0;i<n;++i)
using namespace std;
signed main(){
int a[5],k;
  rap(i,3){
    cin>>a[i];
}    
  sort(a,a+3);
  cin>>k;
  rap(i,k) a[2]*=2;
  cout<<a[0]+a[1]+a[2]<<"\n";
}  

Measured memory_bytes: 256
h,w,k=map(int,input().split())
b=[]
v=[[0]*w for _ in range(h)]
sh=0
sw=0
for i in range(h):
    s=list(input())
    b.append(s)
    
    if 'S' in s:
        sh=i
        sw=s.index('S')
#ans=10**18
d=[[0,1],[1,0],[-1,0],[0,-1]]

def bfs(y,x):
    ans=10**18
    c=0
    q=[(y,x)]
    v[y][x]=1
    ans=min(y,x,h-1-y,w-1-x)
    while c<k:
        p=[]
        c+=1
        for i,j in q:
            for di,dj in d:
                if 0<=i+di<h and 0<=j+dj<w and v[i+di][j+dj]!=1 and b[i+di][j+dj]!='#':
                    p.append((i+di,j+dj))
                    v[i+di][j+dj]=1
                    ans=min(ans,i+di,j+dj,h-1-i-di,w-1-j-dj)
        q=p
    return ans
ans=bfs(sh,sw)
print(1+(ans+k-1)//k)


Measured memory_bytes: 74716
//#include<bits/stdc++.h>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<stdlib.h>
#include<queue>
#include<map>
#include<vector>
#include<cmath>
#include<fstream>
#include <set>
//freopen(".in","r",stdin);
//freopen(".out","w",stdout);
//freopen("input.txt","r",stdin);
//freopen("output.txt","w",stdout);
const int  MAXN =2e5+10;
const int mod = 1e9 + 7;
const long long INF = 0x7f7f7f7f7f7f7f7f;
const int inf= 0x3f3f3f3f;
#define eps 1e-8
#define PI 3.1415926535898
#define lowbit(x) (x&(-x))
using namespace std ;
//getline(cin,s);
//set<ll>::iterator it;
//map<int,int>::iterator it;
//unordered_map
typedef long long ll;
int main()
{
	ll n,ans=0;
	scanf("%lld",&n);
	ans=(1+n)*n/2;
	for(ll i=2;i<=n;i++)
	{
		for(ll j=i;j<=n;j+=i)
		{
			ans+=j;
		}
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 3792
from collections import deque

n = int(input())

anslist = deque()

for i in range(n):
    query = list(map(int, input().split()))
    if query[0] == 0:
        if query[1] == 0:
            anslist.appendleft(query[2])
        elif query[1] == 1:
            anslist.append(query[2])
    elif query[0] == 1:
        print(anslist[query[1]])
    elif query[0] == 2:
        if query[1] == 0:
            anslist.popleft()
        elif query[1] == 1:
            anslist.pop()



Measured memory_bytes: 21976
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(1000000)
input = sys.stdin.readline
INF = 2**62-1

def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(N, K, C, S):
    def f(S):
        r = 0
        w = []
        c = 0
        for s in S:
            if r == 0 and s == 'o':
                w.append(1)
                r = C
                c += 1
            else:
                w.append(0)
                r = max(0, r-1)

        return w
    lw = f(S)
    rw = list(reversed(f(reversed(S))))
    if sum(lw) != K:
        return
    for i, (l, r) in enumerate(zip(lw, rw)):
        if l == r == 1:
            print(i+1)


def main():
    N, K, C = read_int_n()
    S = read_str()
    (slv(N, K, C, S))


if __name__ == '__main__':
    main()


Measured memory_bytes: 10704