akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (n); i++)
using ll = long long;
using namespace std;
int main(){
    string s;cin>>s;
    if(s[0]=='7'||s[1]=='7'||s[2]=='7')
    cout<<"Yes"<<endl;
    else
    {
        cout<<"No"<<endl;
    }
    
}

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

string S, T;

void read() {
    cin >> S >> T;
}


void work() {
    int cnt = 0;
    for (int i = 0; i < S.size(); ++i) {
        cnt += S[i] != T[i];
    }
    cout << cnt << endl;
}


int main() {
    read();
    work();
    return 0;
}


Measured memory_bytes: 3840
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll dp[405][405];
ll pre[405];

ll fun(int i, int j){
    if(i==j) return 0;
    if(dp[i][j]!=-1) return dp[i][j];
    ll ans=LLONG_MAX;
    for(int k=i;k<j;k++){
        ans=min(ans,fun(i,k)+fun(k+1,j));
    }
    ans+=pre[j]-(i-1>=0?pre[i-1]:0);
    return dp[i][j]=ans;
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    memset(dp,-1,sizeof(dp));
    int n;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>pre[i];
        if(i>0) pre[i]+=pre[i-1];
    }
    cout<<fun(0,n-1)<<"\n";
}

Measured memory_bytes: 1536
#include<bits/stdc++.h>
 using namespace std;
#define INF 1000000000
#define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
int a[101];
int main(){
    int N;
    cin>>N;
    REP(i,N){
        cin>>a[i];
    }
    int m=-1;
    REP(i,N){
        m=max(m,a[i]);
    }
    int c=(m+1)/2;
    bool check=true;
    if(m%2==1){
       int cc=0;
       REP(i,N){
           if(c==a[i])cc++;
       }
       if(cc!=2)check=false;
    }else{
       int cc=0;
       REP(i,N){
           if(c==a[i])cc++;
       }
       if(cc!=1)check=false;
    }
    for(int i=c+1;i<m+1;i++){
        int cc=0;
        REP(j,N){
            if(i==a[j]){
               cc++;
            }
        }
        if(cc<2){
           check=false;
        }
    }
    if(check){
       cout<<"Possible"<<endl;
    }else{
       cout<<"Impossible"<<endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
#define SIZE 100005
#define INF 1000000005LL

using namespace std;
typedef long long int ll;
typedef pair <int,int> P;

int N;
int A[SIZE];
ll K;
const int MAX = 110000;
const int MOD = 1000000007;

ll fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
// O(n)
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
// 二項係数計算
// O(1)
ll COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

map<int,int> mp;

int main()
{
	int n,a,fst,snd;
	COMinit();
	cin >> n;
	rep(i,0,n+1){
		cin >> a;
		if(mp[a]==0)mp[a]=i+1;
		else{
			snd = i+1;
			fst = mp[a];
		}
	}
	fst--;snd--;
	int LR = n - (snd - fst);
	rep(i,0,n+1){
		ll ans = COM(n+1,i+1) - COM(LR,i) + MOD;
		ans %= MOD;
		printf("%lld\n",ans);
	}
	return 0;
}


Measured memory_bytes: 8448
#include <iostream>
#include <utility>
#include <vector>
#include <algorithm>
#include <queue>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;

int N,K;
int V[200];
priority_queue<int> que;

int ans = 0;

int main() {
  cin >> N >> K;
  rep(i,N){
    cin >> V[i];
  }
  rep(l,N+1){
    for(int r=l;r<N+1;r++){
      bool debug = false;
      if (l == 3 && r == N) debug = true;
      int tmp_sum = 0;
      int get_count = 0;
      while(!que.empty()) {
        que.pop();
      }
      rep(k,l) {
        tmp_sum += V[k];
        get_count++;
        que.push(-V[k]);
      }
      for(int k=N-1;k>=r;k--){
        tmp_sum += V[k];
        get_count++;
        que.push(-V[k]);
      }
      if (debug) {
        cerr << tmp_sum << " " << get_count << endl;
      }
      if (get_count > K) continue;
      int nokori_K = K - get_count;
      while(nokori_K > 0 && !que.empty()) {
        int tmp = que.top();
        que.pop();
        if (debug) cerr << tmp << endl;
        if (tmp < 0) break;
        tmp_sum += tmp;
        nokori_K--;
      }
      
      if (tmp_sum > ans) ans = tmp_sum;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <limits>
#include <cmath>
using namespace std;
using ll = long long;
const int INF = 1<<30;
const int MOD = (int)1e9 + 7;
const int MAX_N = (int)1e5 + 5;
#define debug(x) cout << #x << ": " << x << endl

signed main(void)
{
    int n; cin >> n;
    string s, t; cin >> s >> t;
    string ans = "";
    for(int i = 0; i < n; i++)
    {
        ans += s[i];
        ans += t[i];
    }
    cout << ans << endl;
    return 0;
}

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

void order(vector<int>& vec) {
  vector<int> s(vec);
  sort(s.begin(), s.end());
  vector<int> ans(vec.size());
  for (size_t i = 0; i < vec.size(); ++i) {
    ans[i] = distance(s.begin(), lower_bound(s.begin(), s.end(), vec[i])) + 1;
  }
  vec.swap(ans);
}

int main() {
  ios_base::sync_with_stdio(false), cin.tie(NULL);

  int n, m;
  cin >> n >> m;
  unordered_map<int, vector<int>> cities;
  vector<int> city_arr;
  city_arr.reserve(n);
  for (int i = 0; i < m; ++i) {
    int p, y;
    cin >> p >> y;
    cities[p - 1].push_back(y);
    city_arr.push_back(p - 1);
  }
  for (auto& elm : cities) {
    order(elm.second);
  }
  vector<int> idx(n, 0);
  for (int i = 0; i < m; ++i) {
    int c = city_arr[i];
    cout << setw(6) << setfill('0') << c + 1<< setw(6) << setfill('0')
         << cities[c][idx[c]] << "\n";
    idx[c] += 1;
  }
}


Measured memory_bytes: 11044
#include <iostream>
#include <vector>
#include <numeric>
#include <algorithm>
#include <queue>
#include <utility>
#include <tuple>
#include <climits>
using namespace std;
using Int = long long;

int N, M;
struct info { int L, R, D; };
vector<info> dat;
vector<int> pos;
vector<bool> walked;

bool walk(int n, int i)
{
    walked[n] = true;
    int j = i;
    while (j < dat.size() && dat[j].L == dat[i].L) j++;
    for (int k = i; k < j; k++) {
        int m = dat[k].R;
        if (pos[m] == INT_MIN) {
            pos[m] = pos[n] + dat[k].D;
        } else if (pos[n] + dat[k].D != pos[m]) {
            return true;
        }
    }
    for (int k = i; k < j; k++) {
        int m = dat[k].R;
        if (!walked[m]) {
            if (walk(m, partition_point(dat.begin(), dat.end(), [=](info &a){return a.L<m;}) - dat.begin()))
                return true;
        }
    }
    return false;
}

int main()
{
    cin >> N >> M;
    pos.resize(N+1);
    walked.resize(N+1);
    fill(pos.begin(), pos.end(), INT_MIN);
    for (int i = 0; i < M; i++) {
        int l, r, d;
        cin >> l >> r >> d;
        dat.push_back({l, r, d});
        dat.push_back({r, l, -d});
    }
    sort(dat.begin(), dat.end(), [](info &a, info &b){return a.L < b.L;});
    for (int i = 0; i < dat.size(); i++) {
        int L = dat[i].L;
        if (pos[L] != INT_MIN) continue;
        pos[L] = 0;
        if (walk(L, i)) {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}

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

int main() {
  int N, a, b, c, d;
  cin >> N;
  d = N%10;
  c = (N-d)/10%10;
  b = ((N-d)/10-c)/10%10;
  a = (((N-d)/10-c)/10-b)/10%10;
  if(a==b&&b==c)
    cout << "Yes" << endl;
  else if(b==c&&c==d)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
 
int main() {

    int m, f, r;
    char grade;
    int amount = 0;

    while (true) 
    {
        scanf("%d %d %d\n", &m, &f, &r);
        amount = m + f;

        if (m== -1 && f== -1 && r== -1)
            break;

        if (m== -1 || f== -1)
        {
            printf("F\n");
        }
        else if (amount<30)
        {
            printf("F\n");
        }
        else if (50<=r && 30<=amount && amount<50)
        {
            printf("C\n");
        }
        else if (30<=amount && amount<50)
        {
            printf("D\n");
        }
        else if (50<=amount && amount<65)
        {
            printf("C\n");
        }
        else if (65<=amount && amount<80)
        {
            printf("B\n");
        }
        else if (80<=amount)
        {
            printf("A\n");
        }
    }

    return 0;
}


Measured memory_bytes: 2624
S = input()
T = input()
koho = []

for i in range(len(S)-len(T)+1):
    for j in range(len(T)):
        if S[i+j] != '?' and S[i+j] != T[j]:
            break
    else:
        koho.append(S[:i]+T+S[i+len(T):])
result = sorted([s.replace('?', 'a') for s in koho])
print('UNRESTORABLE' if result == [] else result[0])

Measured memory_bytes: 3064
fn main() {
    let mut s = String::new();
    let _ = std::io::stdin().read_line(&mut s);
    let mut splits = s.trim().split_whitespace();

    let a = splits.next().unwrap().parse::<i32>().unwrap();
    let b = splits.next().unwrap().parse::<i32>().unwrap();
    let c = splits.next().unwrap().parse::<i32>().unwrap();

    let mut ans = c - (a - b);
    if ans < 0 { ans = 0 }
    println!("{}", ans);
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
#define all(x) x.begin(),x.end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
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;}
typedef long long ll;

int n,m,h,a;
string s,t;

int main() {
  cin >> h >> a;
  cout << (h+a-1)/a << endl; 
}

Measured memory_bytes: 256
import collections
N = int(input())
A = list(map(int, input().split()))

l = []
r = []
al = []
for i, x in enumerate(A):
  if i % 2 == 0:
    l.append(x)
  else:
    r.append(x)
  al.append(x)

c = collections.Counter(l)
d = collections.Counter(r)
e = collections.Counter(al)

if len(e.keys()) <= 1:
  print(N//2)
  exit()
else:
  mx = -1
  ans = 0
  ck = max(c.items(), key=lambda x:x[1])[0]
  cmx = max(c.items(), key=lambda x:x[1])[1]

  dk = max(d.items(), key=lambda x:x[1])[0]
  dmx = max(d.items(), key=lambda x:x[1])[1]

  if ck == dk:
    if cmx > dmx:
      ans += N//2 - cmx
      ans += N//2 - d.most_common(2)[1][1]
    elif cmx < dmx:
      ans += N//2 - dmx
      ans += N//2 - c.most_common(2)[1][1]
    else:
      if c.most_common(2)[1][1] >= d.most_common(2)[1][1]:
        ans += N//2 - dmx
        ans += N//2 - c.most_common(2)[1][1]
      else:
        ans += N//2 - cmx
        ans += N//2 - d.most_common(2)[1][1]
  else:
      ans += N//2 - cmx
      ans += N//2 - dmx

print(ans)


Measured memory_bytes: 26264
#include <stdio.h>

int main(){
    int a[32] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    int K;

    scanf("%d\n",&K);
    printf("%d\n",a[K-1]);
    return 0;
}

Measured memory_bytes: 128
let split_nums str =
  Str.split (Str.regexp " ") str
  |> List.map int_of_string

let print_array a =
  let n = Array.length a in
  for i = 0 to n - 2 do
    Printf.printf "%d " a.(i)
  done;
  Printf.printf "%d\n" a.(n-1)

let insertion_sort lst =
  let array = Array.of_list lst in
  let n = Array.length array in
  for i = 1 to n - 1 do
    print_array array;
    let v = array.(i) in
    let j = ref (i - 1) in
    while !j >= 0 && array.(!j) > v do
      array.(!j+1) <- array.(!j);
      j := !j - 1;
    done;
    array.(!j+1) <- v;
  done;
  print_array array

let () =
  let _ = read_int () in
  read_line ()
  |> split_nums
  |> insertion_sort

Measured memory_bytes: 4120
n,k=map(int,input().split())
A=[]
for i in range(n):
    a=list(map(int,input().split()))
    A.append(a)
S=sorted(A,key=lambda x:x[0])
i=0

while i<n:
    a=S[i][1]
    if k<=a:
        print(S[i][0])
        exit()
    else:
        k-=S[i][1]
        i+=1

Measured memory_bytes: 29912
n = int(input())
dp = [[0] * 10 for _ in range(10)]
ans = 0

for i in range(1, n+1):
    top = int(str(i)[0])
    end = int(str(i)[-1])
    ans += 2 * dp[end][top]
    if top == end:
        ans += 1
    dp[top][end] += 1

print(ans)

Measured memory_bytes: 3064
#include <stdio.h>
int main(){
	int n, i, j, k;
	int p[1000000];
	while(scanf("%d", &n) != EOF){
		for(i = 0; i<n; i++) p[i] = 0;
		p[0] = 1;
		for(i=2 ; i<=n/2; i++){
			for(j=2; i*j<=n; j++){
				if(p[i*j -1] ==0) p[i*j-1] =1; 
			}
		}
		for(i =0; i<n; i++){
			if(p[i] == 0) k++;
		}
			printf("%d\n",k );
			k = 0;
	}
	return 0;
}

Measured memory_bytes: 4500
#include <bits/stdc++.h>
#define exrep(i, a, b) for(long long i = a; i <= b; i++)
#define rep(i,n)for(long long i=0;i<(long long)(n);i++)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> P;
typedef vector<ll> vl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vector<ll> > vvl;
typedef vector<vector<P> > vvp;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
 
const ll MOD=1e9+7;
const ll INF=1e18;
const int MAX=510000;
const double pi=acos(-1);
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};


  
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false); 
  
  int n;
  cin >> n;
  vector<int> vec(n);
  ll sum=0;
  rep(i,n){
    cin >> vec[i];
    sum+=vec[i];
  }
  if(sum%10!=0)cout << sum << endl;
  else{
    sort(vec.begin(),vec.end());
    rep(i,n){
      if(vec[i]%10!=0){
        sum-=vec[i];
        cout << sum << endl;
        return 0;
      }
    }
    cout << 0 << endl;
  }
  return 0;     
}


Measured memory_bytes: 256
// Problem : A - Circle Pond
// Contest : AtCoder - AtCoder Beginner Contest 163
// URL : http://0s.mf2gg33emvzc42tq.dd34.ru/contests/abc163/tasks/abc163_a
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>

using namespace std;

int main(){
	double r;
	
	cin >> r;
	
	cout <<fixed << setprecision(2)<< 2 * 3.14 * r << endl;
	return 0;	
}


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



int main(void){
    long W=0, H=0, x=0, y=0;
    
    std::cin>>W>>H>>x>>y;

    double ans = (double)W*H/2;
    int flag=0;
    if(2*x==W && 2*y==H){flag=1;}
    printf("%f %d", ans, flag);


    //printf("%d",result);

    return 0;


}



Measured memory_bytes: 256
N = int(input())
s = str(input())
"""l = ["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"]
ans = ""
for i in range(len(s)):
    ans+= l[(l.index(s[i])+N)%26]
print(ans)"""
ans = ""
for i in range(len(s)):
    ans += chr((ord(s[i]) - ord('A') + N) % 26 + ord('A'))
print(ans)

Measured memory_bytes: 3060
# B - Checkpoints
N, M = list(map(int, input().split()))
P = [list(map(int, input().split())) for i in range(N)]
C = [list(map(int, input().split())) for i in range(M)]

ans = [0] * N
for i in range(N): # i番目の人
    D = [10 ** 10] * M
    D_hikaku = 10 ** 10
    for j in range(M): # jのチェックポイント

        D = abs(P[i][0]-C[j][0]) + abs(P[i][1]-C[j][1])
        if D < D_hikaku:
            D_hikaku = D
            ans[i] = j + 1
        else:
            pass

for i in range(N):
    print(ans[i])

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
using namespace std;
const int RANDOM1 = chrono::high_resolution_clock::now().time_since_epoch().count();
struct chash {
    int operator()(int x) const { return hash<int>{}(x ^ RANDOM1); }
};
#define ll long long
#define mod 998244353
#define pb push_back
#define mp make_pair
#define deb(x) cout<<#x<<" : "<<x<<"\n";
#define debug(x,y) cout<<#x<<" : "<<x<<"\t"<<#y<<" : "<<y<<"\n";
#define ff first
#define ss second
#define ub upper_bound
#define lb lower_bound
#define all(a) (a).begin(),(a).end()
#define bs binary_search
#define sz size()
#define vi vector<int>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define ld long double
#define clr fflush(stdout);
//#define clr cout.flush();
#define N 100001
#define fpr(i,a,b) for(int i=a;i<b;i++)
#define fdr(i,a,b) for(int i=a;i>b;i--)
#define repp(i,a,b,d) for(int i=a;i<b;i+=d)
#define repd(i,a,b,d) for(int i=a;i>b;i-=d)
#define LLMIN LLONG_MIN
#define LLMAX LLONG_MAX
#define AKASH_PATEL ios_base::sync_with_stdio(false);
#define SVNIT_SURAT cin.tie(NULL);cout.tie(NULL);
#define mset(x,a) memset(x,a,sizeof(x));
#define nl cout<<'\n';
#define print(c) cout<<c<<'\n';
#define setp(n) cout << fixed << setprecision(n)
#define take_arr(a,n) fpr(i,0,n) cin>>a[i];
#define print_arr(a,n) for(int i=0;i<n;i++) {cout<<a[i]<<" ";} cout<<'\n';
#define take_mat(mat,n,m) fpr(i,0,n) fpr(j,0,m) cin>>mat[i][j];
#define set_mat(mat,n,m,k) fpr(i,0,n) fpr(j,0,m) mat[i][j]=k;
#define print_mat(dist,n,m) for(int i=0;i<n;i++){for(int j=0;j<m;j++){cout<<dist[i][j]<<" ";}cout<<'\n';}
template< class T > bool inside(T a, T b, T c) { return a<=b && b<=c; }
int main()
{
    AKASH_PATEL;
    SVNIT_SURAT;
    int n,s;
    cin>>n>>s;
    int a[n];
    take_arr(a,n)
    ll dp[3001][3001];
    mset(dp,0)
    ll ans=0;
    fpr(i,0,n)
    {
        memcpy(dp[i+1],dp[i], sizeof(dp[0]));
        dp[i+1][a[i]]=(dp[i+1][a[i]]+i+1)%mod;
        fpr(j,0,s-a[i]+1)
        {
            if(j+a[i]<=s)
            dp[i+1][j+a[i]]=(dp[i+1][j+a[i]]+dp[i][j])%mod;
        }
        ans=(ans+dp[i+1][s])%mod;
    }
    print(ans)
    return 0;
}





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

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

long long MOD = 1000000000 + 7;

template<typename T>
T gcd(T a, T b) {
  if(a < b) swap(a,b);
    
  if(b == 0) return a;
  return gcd(b, a % b);
}

int main(){
  cout << setprecision(10);
  ll N,K; cin >> N >> K;

  ll gcd_val;
  ll max_val = 0;
  for(int i = 0; i < N; i++){
    ll tmp; cin >> tmp;
    max_val = max(max_val, tmp);
    if(tmp == K){
      cout << "POSSIBLE" << endl;
      return 0;
    }
    if(i == 0){
      gcd_val = tmp;
    } else { 
      gcd_val = gcd(gcd_val, tmp);
    }
  }

  if(K > max_val){
    cout << "IMPOSSIBLE" << endl;
    return 0;
  }

  if(K % gcd_val == 0){
    cout << "POSSIBLE" << endl;
    return 0;
  } else { 
    cout << "IMPOSSIBLE" << endl;
    return 0;
  }
}


Measured memory_bytes: 3556
// Copyright 2017 wu_qing
#include <cstdio>
#include <cstdint>
const int N = 600;
int64_t H, W, h, w, x, y, v[N][N], sum;
int main() {
    scanf("%lld%lld%lld%lld", &H, &W, &h, &w);
    if (w * h == 1) {
        printf("No\n");
        return 0;
    }
    x = 999999999 / (w * h - 1);
    y = -x * (w * h - 1) - 1;
    for (int i = 1; i <= H; i++)
        for (int j = 1; j <= W; j++)
            v[i][j] = x;
    for (int i = h; i <= H; i += h)
        for (int j = w; j <= W; j += w)
            v[i][j] = y;
    for (int i = 1; i <= H; i++)
        for (int j = 1; j <= W; j++)
            sum += v[i][j];
    if (sum > 0) {
        printf("Yes\n");
        for (int i = 1; i <= H; i++) {
            printf("%lld", v[i][1]);
            for (int j = 2; j <= W; j++)
                printf(" %lld", v[i][j]);
            printf("\n");
        }
    } else {
        printf("No\n");
    }
}


Measured memory_bytes: 5120
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 1e6 + 50;
const int mod = 1e9 + 7;
ll ans[maxn];
int main()
{
    std::ios::sync_with_stdio(false);
    ll n;
    cin >> n;
    ans[1] = 0, ans[2] = 0, ans[3] = 1;
    ans[4] = 1;
    for(int i = 5;i < maxn;i++){
        ans[i] = ans[i - 2] + ans[i - 3] + ans[i - 4];
        ans[i] %= mod;
    }
    cout << ans[n] << endl;
    return 0;
}


Measured memory_bytes: 11440
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws Exception {
		// TODO 自動生成されたメソッド・スタブ
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		String W = in.readLine();
		String[] N = W.split(" ");
		int ans = Integer.parseInt(N[0])-Integer.parseInt(N[1])*2;
		if(ans <=0){
			ans =0;
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 23124
#include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;
int main(){
	int a,i;
	double b;
	scanf("%d",&a);
	b = sqrt(a);
	if(fabs(b-(int)b )!=0){
		for (i=a-1;i>=1;i--){
			b = sqrt(i);
			if (fabs(b-(int)b)==0) {printf("%d\n",i); break;}
		}
	}
	else {printf("%d\n",a);}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
    string s;
    cin>>s;
    bool b=0;
    bool e=0;
    for(int i=0;i<3;i++){
        if(s[i]=='A'){b=1;}
        else if(s[i]=='B'){e=1;}
    }
    if(b==1&&e==1){cout<<"Yes";}
    else {cout<<"No";}
    return 0;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-

import os
import datetime

def main():
    # スペース区切りの整数の入力
    a, b, c = map(int, input().split())
    int_dict = {}
    int_dict[a] = ""
    int_dict[b] = ""
    int_dict[c] = ""

    if len(int_dict) == 2:
        print("Yes")
    else:
        print("No")

if __name__ == '__main__':
    main()

Measured memory_bytes: 3440
import itertools

n = int(input())
F = [None for i in range(n)]
P = [None for i in range(n)]
for i in range(n):
    F[i] = list(map(int, input().split()))
for i in range(n):
    P[i] = list(map(int, input().split()))
comb = list(itertools.product([0,1],repeat=10))
comb.pop(0)
# print(F)
# print(P)
# print(comb)

ans = -float("INF")
for i in comb:
    koho = 0
    for j in range(n):
        count = 0
        for k in range(10):
            if i[k]==1 and F[j][k]==1:
                count+=1
        koho += P[j][count]
    ans = max(ans,koho)

print(ans)


Measured memory_bytes: 3188
#include <iostream>
#include <vector>
#include <cmath>
#include <string>
#include <algorithm>
#include <iomanip>
#include <map>
#include <bitset>
#include <cstdio>
#include <set>
#include <stack>
#include <queue>
#include <cassert>
#include <numeric>
#define rep(i,n) Rep(i,0,n)
#define Rep(i,k,n) for(int i=k ; i<n ; i++)
#define rep1(i,n) for(int i=1 ; i<=n ; i++)
#define vi vector<int>
#define vii vector<vector<int>>
#define mii map<int,int>
#define Sort(v) sort(v.begin(),v.end())
#define Reverse(v) reverse(v.begin(),v.end())
#define ALL(a)  (a).begin(),(a).end()
#define pb push_back
#define mp make_pair
//#define int ll
typedef long long ll;

const int md = 1000000007;
const int INF = 1<<30;
using namespace std;

int main(){
    string s,t; cin >> s >> t;
    char ans = t[0];
    printf("A%cC\n",ans);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define MOD 1000000007
#define ll long long
#define mp make_pair
#define pb push_back 
using namespace std;
string s;
int n, k;
ll dp[10010][110][2];	
ll getmod(ll a, ll b, ll mod){
	ll ans = 1;
	while(b){
		if(b & 1){
			ans = (ans * a) % mod;
		}
		a = (a * a) % mod;
		b /= 2;
	}
	return ans;
}
ll fun(int a, int d, int t){
	if(a == n){
		if(d == 0)
			return 1;
		return 0;
	}
	if(dp[a][d][t] != -1)
		return dp[a][d][t];
	dp[a][d][t] = 0;
	int x = (s[a] - '0');
	int lim = (t == 1) ? (s[a] - '0') : 9;
	for(int i = 0; i <= lim; i++){
		int tt = 0;
		if(i == x)
			tt = t;
		ll dig = i;
		dp[a][d][t] = (dp[a][d][t] + fun(a + 1, (d + dig) % k, tt)) % MOD;
	}
	return dp[a][d][t];
}
int main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cin >> s;
	n = s.length();
	cin >> k;
	memset(dp, -1, sizeof(dp));
	cout << (fun(0, 0, 1) - 1 + MOD) % MOD << '\n';
}

Measured memory_bytes: 18304
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

func main() {
	abc := getIntSlice(3)
	sort.Ints(abc)

	ans := 0
	ans += (abc[2]-abc[0])/2 + (abc[2]-abc[1])/2

	if (abc[0]%2 == abc[1]%2) && (abc[0]%2 != abc[2]%2) {
		ans++
	} else if abc[0]%2 != abc[1]%2 {
		ans += 2
	}

	fmt.Println(ans)
}

// -----------------------------------------

var sc = bufio.NewScanner(os.Stdin)

func init() {
	// buf := 200001
	// sc.Buffer(make([]byte, buf), buf)
	sc.Split(bufio.ScanWords)
}

func getInt() int {
	i, err := strconv.Atoi(getString())
	if err != nil {
		panic(err)
	}
	return i
}

func getIntSlice(n int) []int {
	is := make([]int, n)
	for i := range is {
		is[i] = getInt()
	}
	return is
}

func getString() string {
	sc.Scan()
	s := sc.Text()
	return s
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define per(i, n) for (int i = (int)(n-1); i >= 0; i--)
#define sz(x) int(x.size())
#define all(x) (x).begin(), (x).end()
#define INF 2e9
typedef long long ll;
typedef pair<int, int> P;

int main() {
    int n; cin >> n;
    vector<int> h(n);
    rep(i, n) cin >> h[i];

    int ans = 0;
    int tmp = 0;
    for (int i=n-1; i>=1; i--) {
        if (h[i-1] >= h[i]) {
            tmp++;
        }
        else {
            ans = max(ans, tmp);
            tmp = 0;
        }
    }

    ans = max(ans, tmp);

    cout << ans << endl;

}

Measured memory_bytes: 768
N = int(input())
L = [int(x) for x in input().split()]
L.sort()

count = 0
for i in range(N-2):
    for j in range(i,N-1):
        for k in range(j,N):
            if L[i] != L[j] and L[i] != L[k] and L[j] != L[k] and L[i] + L[j] > L[k]:
                count += 1

print(count)


Measured memory_bytes: 67984
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        if (N*500 >= sc.nextInt()) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}

// cool function

//     public static boolean isPrime(int n) {
//        return !new String(new char[n]).matches(".?|(..+?)\\1+");
//    }


Measured memory_bytes: 22484
#include <stdio.h>
#include <string.h>
 
 
int main ()
{
	int a, b, ctr=0;
	char kode[100];
	
	scanf ("%d %d",&a,&b);
	scanf ("%s",kode);
	
		
	int i = 0;
	while (i<=strlen(kode))
	{
		i++;
		if (kode[i] == '-')
		{
		ctr++;
		}
	}
	
	if (ctr>1) 
	{
		printf ("No");
		return 0;
	}
	
	if (kode [a] != '-')
	{
			printf ("No");
			return 0;
	}
	
	
	printf ("Yes");
	
return 0;	
}

Measured memory_bytes: 1728
import java.util.*;
public class Main{
  public static void main(String[] args) {
    Scanner sc=new Scanner(System.in);
    String s,t;
    s=sc.next();
    t=sc.next();
    int a=0;

    for (int i=0;i<3;i++) {
      if (s.charAt(i)==t.charAt(i)) {
        a++;
      }
    }

    System.out.println(a);

  }
}


Measured memory_bytes: 23764
//----------BHAVIK DIWANI(PICT_COMP)---------------
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define test ll t; cin>>t; while(t--)
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define mod 1000000007
#define ll long long
#define int long long
#define ull unsigned long long
#define MAX 1000005
#define pb push_back
#define mkp make_pair
#define vi vector<int>
#define pii pair<int,int>
#define endl '\n'
#define vs vector<string>
#define mii map<int,int>
#define msi map<string,int>
#define vpii vector< pair<int, int > >
#define vpsi vector< pair< string ,int > >
#define forci(p,q) for(int i=p;i<q;i++)
ll gcd(ll a,ll b){ if(b==0) return a;    return gcd(b,a%b);}
ll lcm(ll a,ll b) { return (a/gcd(a,b)*b);}
ull power(ull a, ull b) {a %= mod;  ull res = 1;  while (b > 0) { if (b & 1) res = res * a % mod;  a = a * a % mod;  b >>= 1; }  return res%mod; }
ll modmul(ll x, ll y){return (x*y)%mod;}
ll modadd(ll x, ll y){return (x+y)%mod;}
ll modsub(ll x, ll y){return (x-y+mod)%mod;}
ll fact[1000007]={0};
void facto() {fact[0]=1;fact[1]=1;for(int i=2;i<1000007;i++)fact[i]=(fact[i-1]*i)%mod;}
ll ncr(ll n,ll r) {ll res=1; res=fact[n]; res=(res*(power(fact[r],mod-2)))%mod; res=(res*(power(fact[n-r],mod-2)))%mod; return res;}
ll npr(ll n,ll r) {ll res=1; res=fact[n]; res=(res*(power(fact[n-r],mod-2)))%mod; return res;}
inline long long toint(const std::string &s) {std::stringstream ss; ss << s; long long x; ss >> x; return x;}
inline std::string tostring(long long number) {std::stringstream ss; ss << number; return ss.str();}
inline std::string tobin(long long x) {return std::bitset<63>(x).to_string();}
/*bool prime[MAX];
ull sieve(){memset(prime,true,sizeof(prime));for(ull p=2;p*p<MAX;p++){if(prime[p]==true){for(ull i=2*p;i<MAX;i+=p){prime[i]=false;}}}prime[0]=0;prime[1]=0;
}*/
/*int inv[1000001]={0};
void findinverse(){inv[1] = 1;for(int i = 2; i <=1e6 ; ++i)	inv[i] = (mod - (mod/i) * inv[mod%i] % mod) % mod;}
*/
using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> orderedSet;
typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> orderedMultiset;
int solve()
{
	int n;
	cin>>n;
	int a[n];
	forci(0,n)
		cin>>a[i];
	int cnt=0;
	for(int i=0;i<n;i++){
		for(int j=i+1;j<n;j++){
			for(int k=j+1;k<n;k++){
				if(a[i]!=a[j] && a[j]!=a[k] && a[i]!=a[k]){
					if(a[i]+a[j]>a[k] && a[j]+a[k]>a[i] && a[k]+a[i]>a[j])
						cnt++;
				}
			}
		}
	}
	cout<<cnt<<endl;
	return 0;
}
signed main()
{
	fastio;
//	test
		solve();
}




Measured memory_bytes: 3648
N = int(input())
S = [input() for i in range(N)]

S_sorted = sorted(S)
dupulication = [0 for i in range(N)]
dupMax = 0
output=""

for i in range(N-1):
    if(S_sorted[i+1] == S_sorted[i]):
        dupulication[i+1] = dupulication[i] + 1
        if (dupulication[i+1] >= dupMax):
            dupMax = dupulication[i+1]

for i in range(N):
    if dupulication[i]==dupMax:
        output += S_sorted[i]+"\n"

###########　出力
print(output)

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

#define ll long long
#define value(x) cout << #x << " " << x << '\n';
#define print_vec(vec)    \
    for (auto x : vec)    \
        cout << x << " "; \
    cout << endl;

void solve()
{
    string a, b;
    cin >> a;
    cin >> b;
    int ans = 0;
    for (int i = 0; i < a.size(); i++)
    {
        if (a[i] != b[i])
        {
            ans++;
        }
    }
    cout << ans << '\n';
}

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

Measured memory_bytes: 3904
#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>;

int main() {
  double w, h, x, y; cin >> w >> h >> x >> y;
  cout << fixed << setprecision(6) << 1. * w * h / 2 << " ";
  if (x == w / 2 && y == h / 2) cout << 1;
  else cout << 0;
  return 0;
}

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

int main(){
    int N;
    cin >> N;
    vector<int> A(N);
    for(int i = 0; i < N; i++)cin >> A[i];
    sort(A.begin(), A.end());
    
    int cnt = 0;
    int now = A[0];
    int ans = 1;
    
    for(int i = 1; i < N; i++){
        if(A[i] == now)cnt++;
        else{
            now = A[i];
            ans++;
        }
    }
    
    if(cnt % 2 == 1)ans--;
    
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 640
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

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

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

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

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

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

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

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

fn ceil(a: usize, b: usize) -> usize {
    ((a as i64 + b as i64 - 1) / b as i64) as usize
}


fn main() {
    input! {
        d: usize,
        g: usize,
        pc: [(usize, usize); d],
    }
    let mut p=Vec::new();
    let mut c=Vec::new();
    for i in 0..d {
        p.push(pc[i].0);
        c.push(pc[i].1);
    }
    let mut min_time = std::usize::MAX;
    for i in 0..1 << d {
        let mut time = 0;
        let mut score = 0;
        // 全部使い切る場合
        for j in 0..d {
            // iに含まれる奴ら
            if 1 << j & i == 0 {
                time += p[j];
                score += c[j] + 100 * (j + 1) * p[j];
            }
        }

        // gより小さかったら
        if score < g {
            let mut p_max = std::usize::MIN;
            for j in 0..d {
                // iに含まれない
                if !(1 << j & i == 0) {
                    p_max = j;
                }
            }
            let r_time = ceil(g - score, (p_max + 1) * 100);
            if r_time >= p[p_max]  {
                continue;
            }
            score += r_time * (p_max + 1) * 100;
            time += r_time;
        }
        use std::cmp;
        min_time = cmp::min(time, min_time);
    }
    println!("{}", min_time);
}

Measured memory_bytes: 4352
import sys
import itertools
# import numpy as np
import time
import math
 
sys.setrecursionlimit(10 ** 7)
 
from collections import defaultdict
 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N, M = map(int, readline().split())
A = map(int, readline().split())

import heapq
q = []
for a in A:
    heapq.heappush(q, -a)

while M > 0:
    a = -heapq.heappop(q)
    a //= 2
    heapq.heappush(q, -a)
    M -= 1

ans = 0
while len(q) > 0:
    ans += abs(heapq.heappop(q))
print(ans)


Measured memory_bytes: 12880
#include<bits/stdc++.h>
#define int long long
#define P pair<int,int>
#define F first
#define S second
#define f(i,n) for(int i=0;i<(n);i++)
#define INF LLONG_MAX/3
#define eps LDBL_EPSILON
#define mod 1000000007
#define pie 3.141592653589793238462643383279
#define Bpri priority_queue
#define Spri priority_queue<P,vector<P>,greater<P>>
using namespace std;
signed main(){
	int n;
	cin>>n;
	if(n%2){
		cout<<(n*(n-2)+1)/2<<endl;
		f(i,n){
			f(j,n){
				if(i<j&&i+j+2!=n) cout<<i+1<<" "<<j+1<<endl;
			}
		}
	}
	else{
		cout<<(n*(n-2))/2<<endl;
		f(i,n){
			f(j,n){
				if(i<j&&i+j+1!=n) cout<<i+1<<" "<<j+1<<endl;
			}
		}
	}
    return 0;
}


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

#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)
#define rrep(i,n) for (int i=(n)-1;i>=0;i--)
#define rrep2(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define all(a) (a).begin(),(a).end()

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<P> vp;
typedef vector<ll> vll;

bool check(vector<int> deg) {
	// degree of start and end should be odd
	if (deg[1] % 2 == 0) return false;
	if (deg[2] % 2 == 0) return false;

	// degree of other vertice should be even
	rep2(i, 3, deg.size()) {
		if (deg[i] % 2 != 0) return false;
	}

	return true;
}

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

	int a, b;
	vector<int> deg(1000, 0);

	while (cin >> a >> b) {
		if (a == 0 && b == 0) {
			if (check(deg)) {
				cout << "OK" << endl;
			} else {
				cout << "NG" << endl;
			}

			deg.clear();
			deg.resize(1000, 0);

		} else {
			deg[a]++;
			deg[b]++;
		}
	}
}

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

const int MAXL = 128;
const int Q = 850;

int main() {
	using namespace std;
	ios_base::sync_with_stdio(false), cin.tie(nullptr);

	string chars =
		"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
		"abcdefghijklmnopqrstuvwxyz"
		"0123456789";
	assert(chars.size() == 62);
	const bool TEST = false;

	string TEST_ANS;
	if (TEST) {
		std::random_device rd;
		mt19937 mt(rd());
		for (int i = 0; i < MAXL - 1; i++) {
			TEST_ANS += chars[mt() % 2];
		}
	}

	int QUERY_CNT = 0;

	auto query = [&](string q) -> int {
		QUERY_CNT++;
		cout << '?' << ' ' << q << '\n' << flush;
		int v; cin >> v;
		return v;
	};

	auto get_cnt = [&](char c) -> int {
		if (TEST) {
			QUERY_CNT++;
			int res = 0;
			for (char v : TEST_ANS) {
				res += v == c;
			}
			return res;
		}
		return MAXL - query(string(MAXL, c));
	};
	vector<int> cnts(62);
	for (int i = 0; i < 62; i++) {
		cnts[i] = get_cnt(chars[i]);
	}
	int L = accumulate(cnts.begin(), cnts.end(), 0);

	auto is_subseq = [&](string q) -> bool {
		assert(int(q.size()) <= L);
		if (TEST) {
			QUERY_CNT++;
			int i = 0;
			for (char c : TEST_ANS) {
				if (c == q[i]) {
					i++;
					if (i == int(q.size())) return true;
				}
			}
			return false;
		}
		return query(q) == L - int(q.size());
	};

	string ans; ans.reserve(L);
	for (int z = 0; z < 62; z++) {
		char c = chars[z];
		int cnt = cnts[z];
		int last = -1;
		for (int i = 0; i < cnt; i++) {
			int mi = last, ma = int(ans.size());
			while (ma - mi > 1) {
				int md = (mi + ma) / 2;
				if (is_subseq(string(i+1, c) + ans.substr(md))) {
					ma = md;
				} else {
					mi = md;
				}
			}
			ans.insert(ans.begin()+ma, c);
			last = ma;
		}
	}

	//cerr << TEST_ANS << '\n';
	//cerr << ans << '\n';
	if (TEST) {
		assert(ans == TEST_ANS);
	}
	cerr << QUERY_CNT << '\n';
	assert(QUERY_CNT <= Q);

	cout << '!' << ' ' << ans << '\n';
	return 0;
}


Measured memory_bytes: 3800
#include <bits/stdc++.h>
#define REP(i,s,e) for(int i=(s); i<(e);i++)
#define rep(i,n) REP(i,0,n)
#define rep1(i,n) REP(i,1,n)
#define repe(i,n) for(auto &&i:n)
#define all(v) (v).begin(),(v).end()
#define decimal fixed<<setprecision(20)
#define fastcin() cin.tie(0);ios::sync_with_stdio(false)
using namespace std;
using LL = long long;
using Graph = vector<vector<int>>;
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 INF = 1e9;
const LL LLINF = 1e16;

int main(){
    fastcin();

    int a, b;
    cin >>a >> b;
    cout << max(0, a-2*b) << endl;
    
}

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

#ifdef LOCAL
#include "/home/shahraaz/bin/debug.h"
#else
#define db(...)
#endif

using ll = long long;
#define f first
#define s second
#define pb push_back
#define all(v) v.begin(), v.end()

const int NAX = 2e5 + 5, MOD = 1000000007;

class Solution
{
private:
public:
    Solution() {}
    ~Solution() {}
    void solveCase()
    {
        string n;
        cin >> n;
        if (count(all(n), '7'))
            cout << "Yes";
        else
            cout << "No";
    }
};

int32_t main()
{
#ifndef LOCAL
    ios_base::sync_with_stdio(0);
    cin.tie(0);
#endif
    int t = 1;
    // cin >> t;
    Solution mySolver;
    for (int i = 1; i <= t; ++i)
    {
        mySolver.solveCase();
#ifdef LOCAL
        cerr << "Case #" << i << ": Time " << chrono::duration<double>(chrono::steady_clock::now() - TimeStart).count() << " s.\n";
        TimeStart = chrono::steady_clock::now();
#endif
    }
    return 0;
}


Measured memory_bytes: 3652
# caddi2018bB - AtCoder Alloy
import sys
input = sys.stdin.readline

def main():
    n, h, w = list(map(int, input().rstrip().split()))
    R = [list(map(int, input().rstrip().split())) for _ in range(n)]
    ans = sum(1 for a, b in R if a >= h and b >= w)
    print(ans)


if __name__ == "__main__":
    main()

Measured memory_bytes: 3188
#include <stdio.h>
int main(){
  char c[200000];
  int i=0;
  scanf("%s", c);
  while(c[i]!='\0'){
    if(c[i]=='?'){
      if(c[i-1]=='P'){
        c[i]='D';
      }else if(c[i+1]=='?'){
        c[i]='P';
        c[i+1]='D';
      }else if(c[i+1]=='D'){
        c[i]='P';
      }else{
        c[i]='D';
      }
    }
    i++;
  }
  printf("%s", c);
  return 0;
}

Measured memory_bytes: 1928
S=input()
Q=int(input())
checker=-1#-1で正向き、1で反転
BUF1,BUF2="",""
for _ in range(Q):
  B=input().split()
  if len(B)==3:
    T,F,C=B
    if all([F=="1",checker==-1]):
      BUF1+=C
    elif all([F=="1",checker==1]):
      BUF2+=C
    elif all([F=="2",checker==-1]):
      BUF2+=C
    elif all([F=="2",checker==1]):
      BUF1+=C
  else:
    checker*=-1
S=BUF1[::-1]+S+BUF2
print(S if checker==-1 else S[::-1])


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

int main(){
    long long int n,ans=1000000000000;
    cin>>n;
    for(long long int i=1;i<=sqrt(n);i++)
      if(n%i==0) ans=min(ans,n/i+i-2);
    cout<<ans;

}


Measured memory_bytes: 256
#include<algorithm>
#include<iostream>
#include<cstring>
#include<fstream>
#include<bitset>
#include<cstdio>
#include<string>
#include<vector>
#include<cmath>
#include<queue>
#include<stack>
#include<map>
#include<set>
#define INF 0X3F3F3F3F
#define N 5005
#define M 2000005
#define LL long long
#define FF(i,a,b) for(int i=a;i<=b;++i)
#define RR(i,a,b) for(int i=a;i>=b;--i)
#define FJ(i,a,b) for(int i=a;i<b;++i)
#define SC(x) scanf("%d",&x)
#define SCC(x,y) scanf("%d%d",&x,&y)
#define SCCC(x,y,z) scanf("%d%d%d",&x,&y,&z)
#define SS(x) scanf("%s",x)
#define PR(x) printf("%d\n",x)
#define CL(a, x) memset(a, x, sizeof(a))
#define _q fd[rt]
#define _l fd[rt << 1]
#define _r fd[rt << 1 | 1]
#define MID int mid=((l+r)>>1)
#define lson rt << 1, l, mid
#define rson rt << 1 | 1, mid + 1, r
#define zero(x) (((x)>0?(x):-(x))<EPS)
#define PB push_back
#define PII pair<int,int>
#define PLL pair<long long,long long>
#define MP make_pair
#define IN freopen("in.txt","r",stdin)
#define OUT freopen("out.txt","w",stdout)
using namespace std;
int n, k;
int a[N];
bool f[5005][5005];
bool g[5005][5005];
int main(){
   
    int ans, maxn;
    int i, j, p1, p2;
    SCC(n, k);
    int big = 0;
    int num = 0;
    FF(i, 1, n){
        SC(a[++num]);
        if(a[i] >= k){
            ++big;
            --num;
        }
    }
    f[0][0] = 1;
    FF(i, 1, num){
        FF(j, 0, k - a[i]){
            if(f[i - 1][j])f[i][j + a[i]] = 1;
        }
        FF(j, 0, k)if(f[i - 1][j])f[i][j] = 1;
    }
    for(i = 0; i <= num + 1; ++i)
        g[i][0] = 1;
    RR(i, num, 1){
        FF(j, 0, k - a[i]){
            if(g[i + 1][j])g[i][j + a[i]] = 1;
        }
        FF(j, 0, k)if(g[i + 1][j])g[i][j] = 1;
    }

    ans = big;

    for(i = 1; i <= num; ++i)
    {
        p2 = k - 1;
        int ok = 0;
        for(j = 0; j <= k-1; ++j)
        {
            if(!f[i-1][j]) continue;
            while(p2 > k-1-j) --p2;
            while(p2 >= 0 && p2 >= k - a[i] - j)
            {
                if(g[i+1][p2]){
                    ok = 1; goto c;
                }
                --p2;
            }
        }
        c:;
        if(ok) ++ans;
    }

    printf("%d\n", n - ans);
    return 0;
}


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

#define fastio 			ios::sync_with_stdio(0);	cin.tie(0); cout.tie(0);  cout<<fixed;  cout<<setprecision(12);
#define randomINT 		mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
#define	newl 			cout<<"\n"
#define DISP(as)		for(auto it : as) cout<<it<<" ";newl;
#define DISP1(as)		for(auto it : as) cout<<it.f<<" "<<it.s<<") ";newl;
#define all(x)         	(x).begin(),(x).end()
#define mset(x,val)    	memset(x,val,sizeof(x))
#define newl           	cout<<"\n"
#define pb             	push_back
#define mp             	make_pair
#define f 				first
#define s 				second
#define dline          cerr<<"///REACHED///\n";
#define deb1(x)        cerr<<#x<<" = "<<x<<'\n';
#define deb2(x,y)      cerr<<'['<<#x<<','<<#y<<"] = "<<'['<<x<<','<<y<<']'<<'\n';
#define deb3(x,y,z)    cerr<<'['<<#x<<','<<#y<<','<<#z<<"] = "<<'['<<x<<','<<y<<','<<z<<']'<<'\n';

typedef long long 				ll;
typedef long double 			ld;
typedef vector<ll> 				vll;
typedef pair<ll , ll> 			pll;
typedef pair<ld, ld> 			pld;
typedef unordered_map<ll, ll> 	um;
typedef vector<pll> 			vpll;

const ll 	MAX5 	= 	2e+5 + 99;
const ll 	MAX7 	= 	1e+7 + 7;
const ll 	MAXN 	= 	MAX7;
const ll   	INF   	=  	0x7f7f7f7f7f7f7f7f;
const int  	INFi 	=  	0x7f7f7f7f;
const ll 	MOD		=  	1e+9 + 7;

// <------------- Declare Variables Here ------------> //

ll T = 1;
ll n, k, l, q, x, y, m;
string s, t;

ll rem;
ll cnt[3];


// < ----------- func eh ---------------- ? //



// <------------- Start of main() -------------------> //

void MAIN() {
	cin >> n >> k >> q;
	vll a(n+1,k);
	ll t1 = q;
	while(q--) {
		cin>>x;
		a[x]++;
	}
	//DISP(a);
	for(ll i=1;i<=n;i++) {
		if(a[i] - t1 > 0 ) cout<<"Yes\n";
		else cout<<"No\n";
	}
}

int main() {
	fastio; randomINT;
	//cin >> T;
	while (T--) {
		MAIN();
	}
	return 0;
}

Measured memory_bytes: 4016
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>

using namespace std;

int main(){
    long long  A,B,N,rest,answer;
    cin >> N>>A>>B;
    rest=N%(A+B);
    if(rest>A) answer=((N-rest)/(A+B))*A+A;
    else answer=((N-rest)/(A+B))*A+rest;

    cout << answer << endl;
    
}






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

int INF = 1e9 + 7;

map<int, int>prime_factor(int n) {
	map<int, int>res;
	for (int i = 2;i <= n;i++) {
		int a = i;
		for (int j = 2;j*j <= a;j++) {
			while (a%j == 0) {
				res[j]++;
				a /= j;
			}
		}
		if (a != 1)res[a]++;//nは素数
	}
	return res;
}

int main() {
	int n;
	cin >> n;
	map<int, int>mp = prime_factor(n);
	long long ans = 1;
	for (int i = 2;i <= n;i++) {
		ans *= mp[i] + 1;
		ans %= INF;
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <utility>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>

#define rep(i,j,k) for(int i=(int)j;i<(int)k;i++)
#define itrep(i,x) for(auto i=(x).begin(); i!=(x).end();i++)
#define Sort(x) sort((x).begin(),(x).end())
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define vec vector
#define INF INT_MAX
#define INFL 1e18
#define MOD 1000000007
#define pb push_back
#define MP make_pair
#define PI 3.1415926535
typedef long long int ll;
typedef std::pair<int,int> P;
int D=1;
int dx[4]={0,1,0,-1},dy[4]={-1,0,1,0};

using namespace std;


int main(){
    set<string> st;
    string s;
    int k;
    cin>>s>>k;
    rep(i,0,s.size()){
        rep(j,1,k+1){
            st.insert(s.substr(i,j));
        }
    }
    int ct=0;
    for(auto x:st){
        if(ct==k-1)cout<<x<<endl;
        ct++;
    }
    return 0;
}


Measured memory_bytes: 1664
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  long long x;
  cin >> x;
 
 //cout << x%11 << endl;
 
if (x%11>6)  {
 cout << (x-x%11)/11*2+2 << endl;
}
  
if ((x%11<7) && (x%11>0))  {
 cout << (x-x%11)/11*2+1 << endl;
} 
  
if (x%11==0)  {
 cout << (x-x%11)/11*2 << endl;
}  
  
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int rest(int a,int b){
  if(b==0)return a;
  return rest(b,a%b);
}
int main(){
  int a,b;
  cin>>a>>b;
  int gcd=rest(a,b);
  long long ans=(long long)(a)*b/gcd;
  cout<<ans<<endl;
}

Measured memory_bytes: 256