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

int* mallocint(int si)
{
    return (int*) malloc(si * sizeof(int));
}

int* inputint(int n)
{
    int *ans = mallocint(n);
    for( int i = 0; i < n; i++ ) cin >> ans[i];
    return ans;
}

int main()
{
    vector<int> s;
    int index = 0;
    int pre = 0;
    string sline;
    cin >> sline;
    for( int i = 0; i < sline.length(); i++ )
    {
        char c = sline[i];
        if( c == '<')
        {
            if( pre < 0 )
            {
                s.push_back(pre);
                pre = 0;
            }
            pre++;
        }
        else if( c == '>')
        {
            if( pre > 0 )
            {
                s.push_back(pre);
                pre = 0;
            }
            pre--;       
        }
        else
        {
            break;
        }
    }
    if( pre != 0 ) s.push_back(pre);

    int sl = s.size();
    long long i = 0;
    long long ans = 0;
    if (s[i] < 0)
    {
        int t = -s[i];
        while( t > 0 ) 
        {
            ans += t;
            t--;
        }
        i++;
    }

    while( i < sl )
    {
        {
            int t = 1;
            while( t < s[i] ) 
            {
                ans += t;
                t++;
            }
        }
        if ( i + 1 >= sl )
        {
            ans += s[i];
            break;
        }
        
        ans += max(s[i], -s[i + 1]);
        for( int t = -s[i + 1] - 1; t > 0; t--)
        {
            ans += t;
        }

        i += 2;
    }

    cout << ans;

    return 0;    
}

Measured memory_bytes: 2048
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        System.out.println(dfs(s, 0));

    }

    private static long dfs(String s, int depth) {
        if (s.length() - 1 == depth) {
            long sum = 0;
            String[] sary = s.split("\\+");
            for (String a: sary) {
                sum += Long.parseLong(a);
            }
            return sum;
        }
        long sum = 0;
        sum += dfs(s, depth + 1);
        s = s.substring(0, depth + 1) + "+" + s.substring(depth + 1);
        sum += dfs(s, depth + 2);

        return sum;
    }
}

Measured memory_bytes: 23764
n, k = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]

def find_min_cycle(a):
    memo = {1: 0}
    idx = 0
    cnt = 1

    while a[idx] not in memo:
        memo[a[idx]] = cnt
        cnt += 1
        idx = a[idx]-1

    return memo[a[idx]], cnt-memo[a[idx]], memo

offset, cycle_len, memo = find_min_cycle(a)
rmemo = {v: k for k, v in memo.items()}

if k <= offset:
    print(rmemo[k])
else:
    i = (k-offset)%cycle_len
    print(rmemo[offset+i])


Measured memory_bytes: 142752
//コンパイラ最適化用
#pragma GCC optimize("Ofast")
#define _GLIBCXX_DEBUG
//インクルード(アルファベット順)
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<chrono>//実行時間計測
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm,accumulate
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//順序保持しないmap
#include<unordered_set>//順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列
#include<bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<int, int> pii;
typedef pair<ll, ld> pld;
typedef pair<pii, int> ppiii;
typedef pair<pii, ll> ppiill;
typedef pair<pll, ll> ppllll;
typedef pair<pli, int> pplii;
typedef map<int, int> mii;
typedef deque<ll> dll;
typedef queue<ll> qll;
typedef priority_queue<ll> pqll;
typedef priority_queue<ll, vector<ll>, greater<ll>> pqrll;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<vector<int>> vvint;
typedef vector<vector<pll>> vvpll;

//マクロ
//forループ
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(ll i=0;i<ll(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--)
//xにはvectorなどのコンテナ
#define ALL(x) x.begin(),x.end() 
#define SIZE(x) ll(x.size()) 
//定数
#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 cin(x) cin >> x

signed main(){
    //入力の高速化用のコード
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    //入力
    ll N = 0;
    cin >> N ;

    vector<double> X(N);
    vector<string> U(N);
    REP(i,N) {cin >> X[i]; cin >> U[i];}


    //本文
    double ans = 0;
    REP(i,N){
        if(U[i]=="JPY")ans += X[i];
        else ans += X[i]*380000;
    }
    //出力
    cout << ans << endl;
    //REP(i,N) cout << ans.at(i) <<endl;
  return 0;
}

Measured memory_bytes: 3824
import java.util.*;

public class Main {
	Scanner sc = new Scanner(System.in);
	int prim(int cost[][],int mincost[],boolean used[],int V){
		for(int i = 0;i < V;i++){
			mincost[i] = Integer.MAX_VALUE;
			used[i] = false;
		}
		mincost[0] = 0;
		int res = 0;
		while(true){
			int v = -1;
			for(int u = 0;u < V;u++){
				if(!used[u] && (v == -1 || mincost[u] < mincost[v])) v = u;
			}
			if(v == -1)break;
			used[v] = true;
			res += mincost[v];
			for(int u = 0;u < V;u++){
				if(mincost[u] > cost[v][u]){
					mincost[u] = cost[v][u];
				}
			}
		}
		return res;
	}
	void doIt() { 
		while(true){
			int n = sc.nextInt();
			int m = sc.nextInt();
			if(n+m==0)break;
			int cost[][] = new int [n][n];
			int mincost[] = new int [n];
			boolean used[] = new boolean[n];
			for(int i = 0;i < n;i++){
				for(int j = 0;j < n;j++){
					cost[i][j] = Integer.MAX_VALUE;
					if(i == j)cost[i][j] = 0;
				}
			}
			for(int i = 0;i < m;i++){
				int a = sc.nextInt();
				int b = sc.nextInt();
				cost[a][b] = sc.nextInt();
				cost[b][a] = cost[a][b];
			}
			System.out.println(prim(cost,mincost,used,n));
		}
     }
    public static void main(String[] args) {
    	// TODO Auto-generated method stub
    	new Main().doIt();
    }
}

Measured memory_bytes: 23292
#include <bits/stdc++.h>
#define GET_REP(_1, _2, _3, NAME, ...) NAME
#define rep(...) GET_REP(__VA_ARGS__, irep, _rep)(__VA_ARGS__)
#define rep1(...) GET_REP(__VA_ARGS__, irep1, _rep1)(__VA_ARGS__)
#define _rep(i, n) irep (i, 0, n)
#define _rep1(i, n) irep1(i, 1, n)
#define irep(i, a, n) for (int i = a; i < (int)(n); ++i)
#define irep1(i, a, n) for (int i = a; i <= (int)(n); ++i)
#define rrep(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define rrep1(i, n) for (int i = (int)(n); i >= 1; --i)
#define allrep(X, x) for (auto &&X : x)
#define all(x) begin(x), end(x)
#ifdef LOCAL
  #include "../../Lib/cout_container.hpp"
  #define debug(x) cout << #x " => " << (x) << endl
#else
  #define debug(x) 0
#endif
using lint = long long;
constexpr int    INF  = 1 << 28;
constexpr lint   INFL = 1LL << 60;
constexpr int    MOD  = (int)1e9 + 7;
constexpr double EPS  = 1e-9;
using namespace std;
namespace { struct INIT { INIT() { cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(15); } } INIT; }

int main(void) {
  int d;
  cin >> d;
  unordered_map<int, string> map{{25, "Christmas"}, {24, "Christmas Eve"}, {23, "Christmas Eve Eve"}, {22, "Christmas Eve Eve Eve"}};
  cout << map[d] << endl;
  return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <cstdio>
#include <string>
#include <iostream>
#include <vector>
#include <climits>
#include <algorithm>
#include <cmath>
#include <map>
#include <queue>

using namespace std;

void SolveA()
{
	int n, cnt = 0;
	scanf("%d", &n);

	while (n >= 3)
	{
		n = n - 3;
		cnt++;
	}

	printf("%d\n", cnt);
}

void SolveB()
{
	int n;
	scanf("%d", &n);

	string s = "";
	for (int i = 0; i < n; i++)
	{
		string str;
		cin >> str;
		s.append(str);
	}
	

	bool isPink = false;

	if (s.find('Y') != string::npos)
	{
		isPink = true;
	}

	if (isPink)
	{
		printf("Four\n");
	}
	else
	{
		printf("Three\n");
	}
}

int main()
{
	//SolveA();
	SolveB();
}

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

int main() 
{
    int A, B;
    cin >> A >> B;

    int sum = -101;
    sum = max(sum, A+B);
    sum = max(sum, A-B);
    sum = max(sum, A*B);
    cout << sum << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
int main(void){
 int A,B;
 cin>>A>>B;
 if(A==1&&B!=1) cout<<"Alice";
 else if(B==1&&A!=1) cout<<"Bob";
 else if(A<B) cout<<"Bob";
 else if(A>B) cout<<"Alice";
 else cout<<"Draw";
 return 0;
 
 
}


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

/* debug macros */
#ifdef WAFDAYO
#define DBG_PRINT(s, t, u) { std::cerr << s << " \e[2m=\e[m \e[1m" << t << "\e[m" << u; }
#else
#define DBG_PRINT(s, t, u) {}
#endif
#define dbg(x) DBG_PRINT(#x, x, std::endl)
#define dbgn(x) DBG_PRINT(#x, x, ", ")
#define idbg(x, i) DBG_PRINT(#x "[" << i << "]", x[i], std::endl)
#define idbgn(x, i) DBG_PRINT(#x "[" << i << "]", x[i], ", ")

/* IO utilities */
struct read_input { read_input() {}; template<class T> operator T() { T t; std::cin >> t; return t; } };

/* types and constants */
typedef long long i64;
const i64 inf = (i64)1.05e18;
// const int inf = (int)1.05e9;
const i64 mod = 998244353;

i64 modpow(i64 x, i64 a) {
	i64 y = 1;
	for(int i = 0; i < 63; i++) {
		if((a >> i) & 1LL) {
			y = y * x % mod;
		}
		x = x * x % mod;
	}
	return y;
}

int main() {

	int n = read_input();

	int inv_lim = max(n, 10);
	vector<i64> inv(inv_lim + 1);

	inv[1] = 1;
	for(int i = 2; i <= inv_lim; i++) {
		inv[i] = inv[mod % i] * (mod - mod / i) % mod;
	}

	vector<i64> fact(n + 1);
	vector<i64> fact_inv(n + 1);

	fact[0] = fact_inv[0] = 1;
	for(int i = 1; i <= n; i++) {
		fact[i] = fact[i - 1] * i % mod;
		fact_inv[i] = fact_inv[i - 1] * inv[i] % mod;
	}

	i64 ans = modpow(3, n);
	i64 r = modpow(2, n / 2);

	for(int k = n / 2 + 1; k <= n; k++) {
		r = r * inv[2] % mod;
		i64 nck = fact[n] * (fact_inv[n - k] * fact_inv[k] % mod) % mod;
		i64 s = nck * r * 2 % mod;
		ans = ans - s;
		if(ans < 0) {
			ans += mod;
		}
	}

	printf("%lld\n", ans);

	return 0;
}


Measured memory_bytes: 234624
#include<stdio.h>
struct Card{char suit;int value; };
int main()
{
  struct Card a[101],b[101];
  int n,i,j,k,mini,m,sum=0; 
  char ch;
  scanf("%d%c",&n,&ch);
  for(i=0;i<n;i++){ 
    scanf("%c%d%c",&a[i].suit,&a[i].value,&ch);
  }
  for(i=0;i<n+1;i++){
    b[i]=a[i];
  }
  
  for(i=0;i<n-1;i++){
    for(j=n-1;j>i;j--){
      if(a[j].value<a[j-1].value){
	m=a[j].value;
	a[j].value=a[j-1].value;
 	a[j-1].value=m;
	ch=a[j].suit;
        a[j].suit=a[j-1].suit;
        a[j-1].suit=ch;
      }
    }
  }  
  for(i=0;i<n-1;i++){
    mini=i; 
    m=b[i].value;
    for(j=i;j<n;j++){
      if(b[j].value<m){
	m=b[j].value;
	mini=j;
      }
    }
    if(m!=b[i].value){
      k=b[i].value;
      b[i].value=b[mini].value;
      b[mini].value=k;
      ch=b[i].suit;
      b[i].suit=b[mini].suit;
      b[mini].suit=ch;
    }
  }
  for(i=0;i<n;i++){
    if(a[i].suit==b[i].suit && a[i].value==b[i].value){
    sum++;
    }
  }
  for(i=0;i<n-1;i++){
    printf("%c%d ",a[i].suit,a[i].value);
  }
  printf("%c%d",a[i].suit,a[i].value);
  printf("\nStable\n");

  for(i=0;i<n-1;i++){
    printf("%c%d ",b[i].suit,b[i].value);
  }
  printf("%c%d",b[i].suit,b[i].value);
  if(sum==n)printf("\nStable\n");
  else printf("\nNot stable\n");

  return 0;
}

Measured memory_bytes: 608
import java.util.*;
import java.lang.*;
import java.io.*;

public class Main {
    static HashMap<String,Integer>dp;
    public static void main(String []args){
        Scanner in=new Scanner(System.in);
        int n=in.nextInt();
        int i=0;
        HashSet<Integer>set=new HashSet<>();
        while(n-->0){
            int a=in.nextInt();
            set.add(a);
        }
        System.out.println(set.size());
    }
}






Measured memory_bytes: 21844
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define print(x)cout<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;

int main() {
	ll x,k,d;
	cin >> x >> k  >> d;
	ll ans = 1001001001001001LL;
	if(abs(d*k)<=abs(x)){
		ans = abs(x)-abs(d*k);
		
	}
	else{
		ll c = ceil(x/d);
		if((k-c)%2 == 0){
			ans = abs(x) - abs(c*d);
		}
		else{
			ans = min(abs(abs(x) - abs(c*d)-d), abs(abs(x) - abs(c*d)+d));
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3632
macro_rules! scan {
    () => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().to_string()
        }
    };
    (;;$n:expr) => {
        (0..$n).map(|_| scan!()).collect::<Vec<_>>()
    };
    ($t:ty) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t:ty),*) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            (
                $(iter.next().unwrap().parse::<$t>().unwrap(),)*
            )
        }
    };
    ($t:ty;;) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.split_whitespace()
                .map(|t| t.parse::<$t>().unwrap())
                .collect::<Vec<_>>()
        }
    };
    ($t:ty;;$n:expr) => {
        (0..$n).map(|_| scan!($t;;)).collect::<Vec<_>>()
    };
    ($t:ty; $n:expr) => {
        (0..$n).map(|_|
                    scan!($t)
        ).collect::<Vec<_>>()
    };
    ($($t:ty),*; $n:expr) => {
        (0..$n).map(|_|
                    scan!($($t),*)
        ).collect::<Vec<_>>()
    };
}

fn main() {
    let n = scan!(i64);
    let graph = scan!(i64;;n);

    for k in 0..graph.len() {
        for i in 0..graph.len() {
            for j in 0..graph.len() {
                if graph[i][j] > graph[i][k] + graph[k][j] {
                    println!("{}", -1);
                    return;
                }
            }
        }
    }

    let mut ans = 0;
    for i in 0..graph.len() {
        for j in 0..graph.len() {
            let mut shortest = true;
            for k in 0..graph.len() {
                if k != i && k != j && graph[i][j] == graph[i][k] + graph[k][j] {
                    shortest = false;
                }
            }
            if shortest {
                ans += graph[i][j]
            }
        }
    }

    println!("{}", ans / 2);
}


Measured memory_bytes: 4352
#include <iostream>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define pb(a) push_back(a)

typedef long long ll;
using namespace std;

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

//const int dy[] = { 0, 0, 1, -1 };
//const int dx[] = { 1, -1, 0, 0 };
const int dx[8] = { 1, 0, -1, 0, 1, -1, -1, 1 };
const int dy[8] = { 0, 1, 0, -1, 1, 1, -1, -1 };
ll gcd(ll a, ll b);
ll lcm(ll x, ll y);

vector<ll> a;


int main()
{
	// 頂点数と辺数
	ll a,b,c,x,y;
	ll ans=INF;
	cin >> a >> b >> c >> x >> y;

	for (ll i = 0; i <= 100000; i++) {
		ll tmp = i * 2 * c + max((ll)0, x - i)*a + max((ll)0, y - i)*b;
		ans = min(ans, tmp);
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map> 
using namespace std;
#define ll long long
#define all(x) x.begin(),x.end()

int const N = 200001; 
int n, a, b, c, f[N];
string s[N]; 
map<char,int> mp;

int main(){
    scanf("%d%d%d%d", &n, &a, &b, &c);
    mp['A'] = a;
    mp['B'] = b;
    mp['C'] = c;
    vector<char>an; 
    for(int i = 0; i<n; ++i){
      cin >> s[i];
      ++f[s[i][0]];
      ++f[s[i][1]];
    }
    for(int i = 0; i<n; ++i){
       int x = mp[s[i][0]], y = mp[s[i][1]];
       if(x < y)an.push_back(s[i][0]), mp[s[i][0]]++, mp[s[i][1]]--;
       else if(x > y)an.push_back(s[i][1]), mp[s[i][1]]++, mp[s[i][0]]--;
       else if(x == y){
         if(i+1 < n && x == 1){
            --mp[s[i][0]], ++mp[s[i][1]];
            int afx = mp[s[i+1][0]], afy = mp[s[i+1][1]];
            if(afx + afy){an.push_back(s[i][1]);continue;}
            mp[s[i][0]] += 2, mp[s[i][1]] -= 2;
            an.push_back(s[i][0]);
         }
         else an.push_back(s[i][0]), mp[s[i][0]]++, mp[s[i][1]]--;
       }
       if(mp['A'] < 0 || mp['B'] < 0 || mp['C'] < 0)return puts("No"), 0;
    }
    puts("Yes");
    for(auto i: an)cout << i <<"\n";
}


Measured memory_bytes: 7960
#pragma GCC optimize("Ofast","unroll-loops","omit-frame-pointer","inline") //Optimization flags
#pragma GCC option("arch=native","tune=native","no-zero-upper") //Enable AVX
#pragma GCC target("avx2") //Enable AVX

#include <bits/stdc++.h>

using namespace std;

#define db(x) cout << (x) << '\n';
#define all(x) x.begin(),x.end()
#define UNIQUE(x) sort(all(x)),x.resize(unique(all(x))-x.begin())
#define LB(v,x) lower_bound(all(v),x)
#define UB(v,x) upper_bound(all(v),x)
#define endl "\n"
#define F first
#define S second
#define PB push_back
#define PF push_front
#define int long long
#define double long double
#define trick int m = (l+r)>>1,lc=n<<1,rc=lc|1

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

int dy[]={0,1,1,1,0,-1,-1,-1};
int dx[]={-1,-1,0,1,1,1,0,-1};
const int maxn = 1e5;
const int OO = 1e18;
const int mod = 1e9 + 7;
const double PI = acos(-1);

void maxself(int &a,int b)
{a=max(a,b);}
void minself(int &a,int b)
{a=min(a,b);}

int32_t main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);

	int n,m;
	cin >> n >> m;
	vector<bool>mk(n+1,0);
	vi WA(n+1,0);
	int ac=0,wa=0;
	for(int i=0;i<m;i++)
    {
        int p;
        string s;
        cin >> p >> s;
        if(s == "AC")
        {
            mk[p] = true;
        }
        else if(mk[p] == false)
        {
            WA[p]++;
        }
    }
    for(int i=0;i<=n;i++)
        if(mk[i]==true)
        ac++,wa+=WA[i];
    cout << ac << ' ' << wa;
	return 0;
}



Measured memory_bytes: 3920
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;

typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;

template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()

const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001;


ll po (ll b, ll p) { return !p?1:po(b*b%MOD,p/2)*(p&1?b:1)%MOD; }
ll inv (ll b) { return po(b,MOD-2); }

ll ad(ll a, ll b) { return (a+b)%MOD; }
ll sub(ll a, ll b) { return (a-b+MOD)%MOD; }
ll mul(ll a, ll b) { return a*b%MOD; }
ll divi(ll a, ll b) { return mul(a,inv(b)); }

int N;
vi h(N);

pi get(vi x);

pi process(vi& cur) {
    for (int& i: cur) i --;
    pi z = get(cur);
    cur.clear();
    return z;
}

pi solve(vi x) {
    vpi ret;
    vi cur;
    ll a = 2, b = 1;
    for (int i: x) {
        if (i > 1) cur.pb(i);
        else {
            b = mul(2,b);
            if (sz(cur)) {
                ret.pb(process(cur));
                assert(sz(cur) == 0);
            }
        }
    }
    if (sz(cur)) ret.pb(process(cur));
    
    // dp[x][1] = 2*dp[a][1]*dp[b][1]*...
    // dp[x][0] = 2^rem*(dp[a][0]+dp[a][1])*(dp[b][0]*dp[b][1])*... is this correct?
    for (auto t: ret) {
        a = mul(a,t.f);
        b = mul(b,ad(t.f,t.s));
    }
    // for (int i: x) cout << i << " ";
    // cout << "| " << a << " " << b << "\n";
    return {a,b};
}

pi transform(pi t, int mn) {
    // cout << "OOPS\n";
    int ne = mul(po(2,mn-1),t.f);
    t.s = ad(t.s,sub(ne,t.f));
    t.f = ne;
    return t;
    // dp[x][1] = dp[a][1];
    // dp[x][0] = dp[a][0]+dp[a][1]
    // repeat mn-1 times
}

pi get(vi x) {
    int mn = MOD; F0R(i,sz(x)) mn = min(mn,x[i]);
    F0R(i,sz(x)) x[i] -= (mn-1);
    /*for (int i: x) cout << i << " ";
    cout << "\n";
    cout << mn << "\n";
    exit(0);*/
    pi t = solve(x);
    return transform(t,mn);
}

int main() {
    // cout << brute({1,2,})
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin >> N; h.resize(N);
    F0R(i,N) {
        // h[i] = rand() % 1000000000+1;
        cin >> h[i];
    }
    cout << get(h).s;
    // dp[x][1] = 2*(dp[a][1]*dp[b][1]*dp[c][1]*...)
    // dp[x][0] = (dp[a][0]+2*dp[a][1])*(dp[b][0]+2*dp[b][1])*...*2^stuff-dp[x][1];
}

/* Look for:
* the exact constraints (multiple sets are too slow for n=10^6 :( ) 
* special cases (n=1?)
* overflow (ll vs int?)
* array bounds
*/

Measured memory_bytes: 384
n, m = map(int, input().split())
ab = []
for _ in range(m):
    ab.append(list(map(int, input().split())))

ab.sort(key=lambda x: x[1])
count = 0
current_right = 0
for i in range(m):
    if ab[i][0] >= current_right:
        count += 1
        current_right = ab[i][1]

print(count)

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

bool isP(int X){
  for(int i=2;i*i<=X;i++) if(X%i==0) return false;
  return true;
}

int main() {
  int X;
  cin >> X;
  while(true){
    if(isP(X)){
      cout << X << endl;
      return 0;
    }
    X++;
  }
  return 0;
}


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

int main() {
    string s;
    cin >> s;
    
    for(int bin=0; bin<(1 << 3); bin++){
      string tmp = s.substr(0, 1);
      // cout << tmp << endl;
      int ans = stoi(tmp);
      char op[3];
      for(int i=0; i<3; i++){
        tmp = s.substr(i+1, 1);
        // cout << tmp << endl;
        if(bin >> i & 1){
          ans += stoi(tmp);
          op[i] = '+';
        }
        else{
          ans -= stoi(tmp);
          op[i] = '-';
        }
        // cout << s[i+1] << " " << ans << endl;      
      }
      // cout << bin << " " << ans << endl;
      if(ans == 7){
        cout << s[0] << op[0] << s[1] << op[1] << s[2] << op[2] << s[3] << "=7" << endl;
        return 0;
      }
    }
    
    cout << "No solutions" << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int exp(int x,int y){
  int z=1;
  for(int i=0;i<y;i++){
    z=z*x;
  }
  return z;
}

int main(){
  int n,k,a;
  cin>>n>>k;
  a=1;
for(int i=0;i<n;i++){
  if(n>=exp(k,i))a=i+1;
  else break;
} 
cout<<a<<endl;
}

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

int main(){
  int H, W;
  cin >> H >> W;
  string s;
  vector<string> S(H+2, string(W+2, '#'));
  int cnt = 0;
  rep(h, H){
    cin >> s;
    S[h+1] = '#' + s + '#';
    for(auto x: S[h+1]) if (x == '.') cnt++;
  }
  int I[H+2][W+2] = {};
  QP Q;
  Q.push(make_pair(1, 1));
  I[1][1] = 1;
  int h, w, nh, nw;
  int dh[4] = {1, 0, -1, 0};
  int dw[4] = {0, 1, 0, -1};
  while (!Q.empty()){
    h = Q.front().first;
    w = Q.front().second;
    Q.pop();
    rep(i, 4){
      nh = h + dh[i];
      nw = w + dw[i];
      if (S[nh][nw] == '.' && I[nh][nw] == 0){
        Q.push(make_pair(nh, nw));
        I[nh][nw] = I[h][w] + 1;
      }
    }
  }
  int ans = (I[H][W]) ? cnt - I[H][W]: -1;
  cout << ans << endl;
  return 0;
}


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

typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef long double ld;
const int inf=1e9+7;
const ll INF=1LL<<60 ;
const ll mod=1e9+7 ;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<int, int> P;
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
#define debug(x)  cout << #x << " = " << (x) << endl;
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; }
//#define int long long

void solve() {
	int k; cin >> k;
    vector<int> g[100100], h[100100];
    rep(v, k) {
        g[v].push_back((v + 1) % k);
        h[v].push_back((10 * v) % k);
    }
    deque<int> deq;
    vector<int> d(k, inf);
    d[1] = 1;
    deq.push_back(1);
    while(!deq.empty()) {
        int v = deq.front(); deq.pop_front();
        for(auto& nv: h[v]) {
            if(chmin(d[nv], d[v])) {
                deq.push_front(nv);
            }
        }
        for(auto& nv: g[v]) {
            if(chmin(d[nv], d[v] + 1)) {
                deq.push_back(nv);
            }
        }
    }
    cout << d[0] << endl;
}

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

Measured memory_bytes: 11776
#include<cstdio>
using namespace std;
long long a,b,c;
int main(){
	scanf("%lld%lld%lld",&a,&b,&c);long long d=c-a-b;
	if(a+b>=c){
		printf("No");
		return 0;
	}
	if(4*a*b<d*d) printf("Yes");
	else printf("No");
	return 0;
}

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

int main() {
    long long n, a, b; cin >> n >> a >> b;
    long long h[n];
    for (int i = 0; i < n; i++) cin >> h[i];

    long long ng = 0, ok = 1e9;
    while (abs(ng - ok) > 1)
    {
        long long mid = (ng + ok) / 2;
        long long exp = 0;
        for (int i = 0; i < n; i++)
        {
            long long t = max(h[i] - mid * b, 0LL);
            exp += (t + a - b - 1) / (a - b);
        }
        if(exp > mid) ng = mid;
        else ok = mid;
    }
    cout << ok << endl;
    return 0;
}

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

int main(){
    list<int> line;
    int c;
    char code[2000000];
    int time;
    cin >> time;
    list<int>::iterator he;
    for(int i=0;i<time;i++){
        cin >> code;
        if(code[6]=='F')line.pop_front();
        else if(code[6]=='L')line.pop_back();
        else{
            cin>>c;
            if(code[0]=='i')line.push_front(c);
            else{
                line.push_back(c);
                for(he=line.begin();*he!=c;++he);
                if(++he!=line.end())line.erase(--he);
                line.pop_back();
            }
        }
        }
    int doll=line.back();
    line.pop_back();
    for(he=line.begin();he!=line.end();++he){
        cout<<*he<<' ';
        
    }
    cout<<doll<<endl;
    cin>>time;
}


Measured memory_bytes: 34248
#include <stdio.h>

int main(void)
{
	int a, b;
	scanf("%d", &a); scanf("%d", &b);
	int c = a / b;
	int d = a % b;
	double f =(double)a / b;
	
	printf("%d %d %.5lf\n", c, d, f);
	return 0;
}


Measured memory_bytes: 2120
#include <bits/stdc++.h>
using namespace std;
 
#define speed ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
#define ub(a,x) upper_bound(a.begin(),a.end(),x)-a.begin()
#define lb(a,x) lower_bound(a.begin(),a.end(),x)-a.begin()
#define ll long long int
#define endl "\n"
#define all(v) v.begin(),v.end()
#define ff first
#define ss second
#define pb push_back
#define PI 3.1415926535897932384626
#define keep_unique(v) sort(v.begin(),v.end());v.erase(unique(v.begin(),v.end()),v.end());

 
// #include <ext/pb_ds/assoc_container.hpp> // Common file
// #include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
// using namespace __gnu_pbds;
// typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;


void solveFunction()
{
    int n;
    cin>>n;
    ll ans = 0;
    for(int i=1;i<=n;i++)
    {
    	if(i%3==0||i%5==0) continue;
    	else ans += i;
    }
    cout<<ans;
}

main()  
{
    speed;
    int t = 1;
    //cin>>t;
    while(t--)
    {
        solveFunction();
    }
}



Measured memory_bytes: 3616
#include<stdio.h>
int main(void){
  char *s="python3 -c\""
"import math\n"
"import random\n"
"class Prime:\n"
"    seed_primes=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97]\n"
"    def is_prime(self,n):\n"
"        is_prime_common=self.is_prime_common(n)\n"
"        if is_prime_common is not None:return is_prime_common\n"
"        if n<2000000:return self.is_prime_brute_force(n)\n"
"        return self.is_prime_miller_rabin(n)\n"
"    def is_prime_common(self,n):\n"
"        if n==1:return False\n"
"        if n in Prime.seed_primes:return True\n"
"        if any(map(lambda x:n%x==0,self.seed_primes)):return False\n"
"    def is_prime_brute_force(self,n):\n"
"        for k in range(2,int(math.sqrt(n))+1):\n"
"            if n%k==0:return False\n"
"        return True\n"
"    def is_prime_miller_rabin(self,n):\n"
"        d=n-1\n"
"        while d&1==0:d>>=1\n"
"        witnesses=self.get_witnesses(n)\n"
"        for w in witnesses:\n"
"            y=pow(w,d,n)\n"
"            while d!=n-1and y!=1and y!=n-1:\n"
"                y=y*y%n\n"
"                d<<=1\n"
"            if y!=n-1and d&1==0:return False\n"
"        return True\n"
"    def get_witnesses(self,num):\n"
"        def _get_range(num):\n"
"            if num<2047:return 1\n"
"            if num<1373653:return 2\n"
"            if num<25326001:return 3\n"
"            if num<3215031751:return 4\n"
"            if num<2152302898747:return 5\n"
"            if num<3474749660383:return 6\n"
"            if num<341550071728321:return 7\n"
"            if num<3825123056546413051:return 9\n"
"            return 12\n"
"        return self.seed_primes[:_get_range(num)]\n"
"    def gcd(self,a,b):\n"
"        if a<b:return self.gcd(b,a)\n"
"        if b==0:return a\n"
"        while b:a,b=b,a%b\n"
"        return a\n"
"    @staticmethod\n"
"    def f(x,n,seed):\n"
"        p=Prime.seed_primes[seed%len(Prime.seed_primes)]\n"
"        return(p*x+seed)%n\n"
"    def find_factor(self,n,seed=1):\n"
"        if self.is_prime(n):return n\n"
"        x,y,d=2,2,1\n"
"        count=0\n"
"        while d==1:\n"
"            count+=1\n"
"            x=self.f(x,n,seed)\n"
"            y=self.f(self.f(y,n,seed),n,seed)\n"
"            d=self.gcd(abs(x-y),n)\n"
"        if d==n:\n"
"            return self.find_factor(n,seed+1)\n"
"        return self.find_factor(d)\n"
"    def find_factors(self,n):\n"
"        primes={}\n"
"        if self.is_prime(n):\n"
"            primes[n]=1\n"
"            return primes\n"
"        while n>1:\n"
"            factor=self.find_factor(n)\n"
"            primes.setdefault(factor,0)\n"
"            primes[factor]+=1\n"
"            n//=factor\n"
"        return primes\n"
"*d,=sorted(Prime().find_factors(math.factorial(int(input()))).values())\n"
"a=0\n"
"n=len(d)\n"
"for i in range(n):\n"
"    for j in range(i+1,n):\n"
"        for k in range(j+1,n):\n"
"            a+=3*(d[i]>3)or d[i]>1and d[j]>3and d[k]>3\n"
"        a+=(2*(d[i]>13)or d[i]>3and d[j]>13)+(2*(d[i]>23)or d[i]>1and d[j]>23)\n"
"    a+=d[i]>73\n"
"print(a)\n"
"\"";
  system(s);
  return 0;
}            

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

#define REP(i,n) for (int i=0;i<(n);i++)
#define PII pair<int,int>
#define LL long long

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

  return 0;
}


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

#define REP(i,n) for(int i=0;i<n;i++)
typedef long long int lli;
typedef pair<int, int> P;

int main() {
    int a, b, T;
    cin >> a >> b >> T;
    cout << (T / a) * b << endl;
}


Measured memory_bytes: 256
import sys
n = int(input())
xl = []
for _ in range(n):
    x, l = map(int, input().split())
    xl.append((x, l))
xl.sort(key=lambda x:x[0])
if n==1:
    print(1)
    sys.exit(0)
i=0
j=1
ans=n
while j<len(xl):
    if xl[i][0]+xl[i][1] <= xl[j][0]-xl[j][1]:
        i = j
        j = i+1
    else:
        ans -= 1
        if xl[i][0]+xl[i][1] < xl[j][0]+xl[j][1]:
            j += 1
        else:
            i = j
            j = i+1
print(ans)


Measured memory_bytes: 18260
using System;
using System.Linq;

class Program
{
    public static void Main()
    {
        double[] data = Console.ReadLine().Split().Select(double.Parse).ToArray();
        int a = (int)(data[0] / data[1]);
        double b = data[0] % data[1];
        double c = data[0] / data[1];
        
        Console.WriteLine("{0} {1} {2:F5}",a,b,c);
    }
}


Measured memory_bytes: 18512
// Original: https://github.com/tanakh/competitive-rs
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

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

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

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

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

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

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

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

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

#[allow(unused_imports)]
use std::cmp::{max, min};
#[allow(unused_imports)]
use std::collections::BTreeMap;

fn main() {
    input!(n: usize, k: usize, hs: [i64; n]);

    const INF: i64 = 1 << 30;
    let mut dp = vec![INF; n + 10];
    dp[0] = 0;
    dp[1] = dp[0] + (hs[1] - hs[0]).abs();

    for i in 0..n {
        for x in 1..k + 1 {
            let next = min(i + x, n - 1);
            let cost = dp[i] + (hs[next] - hs[i]).abs();
            dp[next] = min(dp[next], cost);
        }
    }

    println!("{}", dp[n - 1]);
}


Measured memory_bytes: 6396
#include<iostream>

typedef long long ll;
ll dp[1001][21];
ll A[1001];

int main(){
	ll n;
	std::cin >> n;
	for (int i = 0; i < n; ++i){
		std::cin >> A[i];
	}
	dp[0][0] = 1;
	for (int i = 0; i < n-1; ++i){
		for (int j = 0; j <= 20; ++j){
			if (j + A[i] <= 20){
				dp[i+1][j + A[i]] += dp[i][j];
			}
			if (i && j - A[i] >= 0){
				dp[i+1][j - A[i]] += dp[i][j];
			}
		}
	}
	std::cout << dp[n-1][A[n-1]] << std::endl;
	return 0;
}

Measured memory_bytes: 1176
#include <iostream>
#include <cstdio>
#include <map>
#include <algorithm>
#include <vector>
#include <string>
#include <utility>
#include <queue>
#define INF 1e9+7
#define rep(i,n) for(int i=0;i<n;i++)
#define NO cout<<"NO"<<endl;
#define YES cout << "YES"<<endl;
#define No cout << "No"<<endl;
#define Yes cout << "Yes"<<endl;
#define all(a) a.begin(),a.end()
#define P pair<int,int>

//(int)'a'は97 (int)'A'は65 (int)'1'は49
//おまじない

using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;

const int maxn=100000;

int main(){
   
    int ans=1;
    int d=0;
    int n;
    int x;
    int l[100];
    
    cin >> n>>x;
    rep(i,n){
        cin >> l[i];
    }
    rep(i,n){
        if(d+l[i]<=x){
            d+=l[i];
            ans++;
        }else{
            break;
        }
    }
    
    cout << ans<<endl;
    
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int a,b;
	scanf("%d",&a);
	scanf("%d",&b);
	if(!(a % 3) || !(b % 3) || !((a + b) % 3)) printf("Possible\n");
	else printf("Impossible\n");
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int maxn=2e5+10;
char s[maxn];
int vis[maxn];
int n,a,b,c,d;
int main()
{

    scanf("%d%d%d%d%d",&n,&a,&b,&c,&d);
    scanf("%s",s+1);
   // int len=strlen(s+1);
    //cout<<len<<endl;
    if(s[c]=='#'||s[d]=='#')
         puts("No");
    else
    {
        if(a>b)
        swap(a,b),swap(c,d);
        int f1=0;
        for(int i=a; i<=max(c,d); i++)
        {
            if(s[i]=='#'&&s[i-1]=='#')
            {
                  f1=1;
                 break;
            }
        }
        if(f1)
            puts("No");
        else
        {    
            if(c<d)
                puts("Yes");
            else
            {
                    int  f=0;
                for(int i=b+1; i<=d+1; i++)
                {
                    if(s[i]=='.'&&s[i-1]=='.'&&s[i-2]=='.')
                          f=1;
                }
                if(f)
                    puts("Yes");
                else
                    puts("No");
            }
        }

    }
    return 0;
}


Measured memory_bytes: 384
#include<stdio.h>
int main(void){
    long long int N,A,B,Ans,R;
    int i=-1;
    scanf("%lld",&N);
    scanf("%lld",&A);
    scanf("%lld",&B);
    R=N/(A+B);
    if(A==0){
        printf("%d",0);
        return 0;    
    }
    if((N-(A+B)*R)>=A){
        Ans=R*A+A;
        printf("%lld",Ans);
    }else{
        Ans=R*A+(N-(A+B)*R);
        printf("%lld",Ans);
    }

    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <bitset>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <cstring>
#include <utility>
#include <vector>
#include <complex>
#include <valarray>
#include <fstream>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <numeric>
#include <climits>

#define _overload(a, b, c, d, ...) d
#define _rep1(X, A, Y) for (int (X) = (A);(X) <= (Y);++(X))
#define _rep2(X, Y) for (int (X) = 0;(X) < (Y);++(X))
#define rep(...) _overload(__VA_ARGS__, _rep1, _rep2)(__VA_ARGS__)
#define rrep(X,Y) for (int (X) = Y-1;(X) >= 0;--(X))
#define all(X) (X).begin(),(X).end()
#define _size(X) (int)((X).size())
#define mod(n, m) (((n)%(m)+(m))%m)
#define fi first
#define sc second
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
const int INFINT = 1 << 30;                          // 1.07x10^ 9
const ll INFLL = 1LL << 60;                          // 1.15x10^18
const double EPS = 1e-10;
const int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};

const int MAX_N = 200000, MAX_C = 200000;
int N;
int C[MAX_N+1];
ll dp[MAX_N+1];
ll last[MAX_N+1];

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

  cin >> N;
  rep(i, 1, N) cin >> C[i];

  dp[1] = 1;
  last[C[1]] = 1;
  for (int i = 2; i <= N; ++i) {
      if (C[i-1] == C[i] || last[C[i]] == 0) {
          dp[i] = dp[i-1];
      } else {
          dp[i] = mod(dp[i-1] + dp[last[C[i]]], MOD);
      }
      last[C[i]] = i;
  }

  cout << dp[N] << endl;

  return 0;
}


Measured memory_bytes: 4224
N, Q = map(int, input().split())
S = input()
AC = [0]
n = 0
for i in range(1,len(S)):
    if S[i-1] == 'A' and S[i] == 'C':
        n += 1
    AC.append(n)
for _ in range(Q):
    l, r = map(int, input().split())
    print(AC[r-1]-AC[l-1])

Measured memory_bytes: 6100
def main():
    A = [list(map(int, input().split())) for _ in range(3)]
    N = int(input())
    B = [int(input()) for _ in range(N)]

    for b in B:
        for i in range(3):
            if b in A[i]:
                A[i][A[i].index(b)] = 0

    if sum(A[0]) == 0 or sum(A[1]) == 0 or sum(A[2]) == 0:
        print("Yes")
    elif A[0][0] == A[1][0] == A[2][0] == 0:
        print("Yes")
    elif A[0][1] == A[1][1] == A[2][1] == 0:
        print("Yes")
    elif A[0][2] == A[1][2] == A[2][2] == 0:
        print("Yes")
    elif A[0][0] == A[1][1] == A[2][2] == 0:
        print("Yes")
    elif A[0][2] == A[1][1] == A[2][0] == 0:
        print("Yes")
    else:
        print("No")


if __name__ == "__main__":
    main()

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <unordered_set>

std::vector<int> a[12];
std::vector<int> c;
int n, m, x;
int ans = 10000000;

void f(std::vector<int> now, int count, int sum = 0)
{
  ++count;
  if (count > n) return;
  bool isOk = true;
  for (auto itr: now)
  {
    if (itr < x)
    {
      isOk = false;
      break;
    }
  }
  if (isOk)
  {
    ans = std::min(ans, sum);
    return;
  }
  f(now, count, sum);
  for (int i = 0; i < m; ++i)
  {
    now[i] += a[count - 1][i];
  }
  sum += c[count - 1];

  isOk = true;
  for (auto itr: now)
  {
    if (itr < x)
    {
      isOk = false;
      break;
    }
  }
  if (isOk)
  {
    ans = std::min(ans, sum);
    return;
  }
  else
  {
    f(now, count, sum);
  }
  
  return;
}

int main()
{
  std::cin >> n >> m >> x;
  for (int i = 0; i < n; ++i)
  {
    int value;
    std::cin >> value;
    c.push_back(value);
    for (int j = 0; j < m; ++j)
    {
      int achive;
      std::cin >> achive;
      a[i].push_back(achive);
    }
  }
  std::vector<int> init(m);
  f(init, 0);
  if (ans != 10000000)
  {
    std::cout << ans << std::endl;
  }
  else
  {
    std::cout << "-1" << std::endl;
  }
  
  return 0;
}

Measured memory_bytes: 3636
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <string>
#include <functional>
#include <utility>
#include <queue>
#include <vector>
#include <string>
using namespace std;
typedef long long int ll;
const ll  MOD = 1000000007;
typedef pair<int,int> P;


int main(){
  ll W,H;
  ll p[100100];
  ll q[100100];
  ll ruip[100100];
  ll ruiq[100100];
  ll sum=0;
  cin >> W >> H;
  for(int i=0;i<W;i++){
    cin >> p[i];
    sum += p[i] * (H+1);
  }
  sort(p,p+W);
  ruip[0] = p[0];
  for(int i=1;i<W;i++){
    ruip[i] = ruip[i-1] + p[i];
    //cout << " " << ruip[i] << endl;
  }
  for(int i=0;i<H;i++){
    cin >> q[i];
    sum += q[i] * (W+1);
  }
  sort(q,q+H);
  ruiq[0] = q[0];
  for(int i=1;i<H;i++){
    ruiq[i] = ruiq[i-1] + q[i];
    //cout << " " << ruiq[i] << endl;
  }
  int t=0;
  for(int i=0;i<H;i++){
    while(q[i] > p[t] && t<W){
      t++;
    }
    //cout << t << endl;
    if(t>0){
      sum -= (ruip[W-1] - ruip[t-1]);
      sum -= t*q[i];
    }
    else{
      sum -= ruip[W-1];
    }
  }

  cout << sum << endl;
}


Measured memory_bytes: 2688
#include "bits/stdc++.h"
using namespace std;

int main(void) {
    int n;
    cin >> n;
    double tmp;
    string sss;
    double ans = 0.0;
    for (int i = 0; i < n; ++i) {
        cin >> tmp >> sss;
        if (sss == "JPY") {
            ans += tmp;
        }
        else {
            ans += 380000.0 * tmp;
        }
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <sstream>
#include <complex>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cmath>
#include <cassert>
#include <fstream>
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(a,b) for(:a<b;a++)
#define SSTR( x ) static_cast< std::ostringstream & >( \
        ( std::ostringstream() << std::dec << x ) ).str()
#define ALL(s) (s).begin(), (s).end()
using namespace std;
typedef long long unsigned int llu;
typedef long long ll;



int main (){
  int x;
  int ans;
  while (cin >> x){
    int ans = 0;
    for(int j = 2;j < 40;j++){
      REP(i,500){
	
	if(pow(i ,j) <= x){
	  int a = pow(i,j);
	    ans =max( ans,a );
	}
	else break;
      }
    }

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


Measured memory_bytes: 256
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        int ans = 0;
        for (int i = 0; i < n; i++) {
            int h = sc.nextInt();
            if(k <= h) ans++;
        }
        System.out.println(ans);
        sc.close();

    }

}


Measured memory_bytes: 46148
#include<stdio.h>
#include<stdlib.h>
int compare(const void *a, const void *b) {
    if (*(long*)a - *(long*)b < 0)
        return -1;
    else
        return 1;
}
int main() {
    long z[222222], x, y;
    int h, w, n, i;
    scanf("%d%d%d", &h, &w, &n);
    for (i = 0; i < 222222; i++)
        z[i] = 0;
    for (i = 0; i < n; i++) {
        scanf("%ld%ld", &x, &y);
        z[i] = x + y * 1000000;
    }
    qsort(z, n, sizeof(long), compare);
    int p = 0,t=1,ans=h;
    for (i = 1; i <= w; i++) {
        if (z[p] / 1000000 == i&&z[p] % 1000000 <= ans)
            ans = z[p]%1000000 - 1;
        while (z[p] / 1000000 == i)
            p++;
        t++;
        while (z[p] %1000000 < t&& z[p] / 1000000 == i + 1)
            p++;
        while (z[p] % 1000000 == t&& z[p] / 1000000 == i+1) {
            t++;
            p++;
        }
    }
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 3452