akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define ll              long long int
#define ull             unsigned long long int
#define mod             1000000007 
#define pb              push_back
#define mp              make_pair
#define count_1(n)      __builtin_popcountll(n) //set bits


bool isPrime(ll n) {

  if (n == 1) {
    return false;
  }

  for (ll i = 2; i*i <=n; i++) {
    if (n % i == 0) return false;
  }

  return true;
}

 
   
ll power(ll x, ll y, ll p)  
{  
    ll res = 1;     
    x = x % p;  
                
    if (x == 0) return 0;  
  
    while (y > 0)  
    {  
        if (y & 1)  
            res = (res*x) % p; 
        y = y>>1; 
        x = (x*x) % p;  
    }  
    return res;  
} 

int binarySearch(int arr[], int l, int r, int x) 
{ 
    if (r >= l) { 
        int mid = l + (r - l) / 2; 
  
        if (arr[mid] == x) 
            return mid; 
  
        if (arr[mid] > x) 
            return binarySearch(arr, l, mid - 1, x); 
  
        return binarySearch(arr, mid + 1, r, x); 
    } 
  
    return -1; 
} 

  

int main(){
    
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
  ll n;
  cin>>n;
  ll a[n],sum=0;
  for(ll i=0;i<n;i++){
    cin>>a[i];
    if(i>0){
        if(a[i]<a[i-1])
            {
                sum+=a[i-1]-a[i];
                a[i]=a[i-1];
            }
    }
  }
  cout<<sum;
  }

Measured memory_bytes: 5168
from collections import Counter
import bisect
N = int(input())
A = list(map(int,input().split()))
cnt = Counter(A)
A.sort()
ans = 0
MX = 10**6
P = [0] * (MX+1)
for a in A:
    if P[a]==0:
        for i in range(MX+1):
            x = a*i
            if x > MX:
                break
            P[x] = 1
        if cnt[a]==1:
            ans+=1
print (ans)


Measured memory_bytes: 38592
#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
#include<queue>
#include<stack>
#include<map>
#include<math.h>
#include<string>
#include <cctype>
#include <cstdlib>
#include<bitset>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, s, n) for (int i = s; i < (int)(n); i++)
#define out(x) cout << x << endl;
#define INF 1ll<<60;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

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

int main(){
    int n; cin >> n;
    ll a[n];
    rep(i, n) cin >> a[i];

    ll money = 1000;
    rep(i, n-1){
        ll num = 0;
        if(a[i]<a[i+1]) num = money/a[i];
        money += (a[i+1]-a[i])*num;
    }

    out(money);
}

Measured memory_bytes: 3636
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
using namespace std;
typedef long long  ll;
#define rep(i,s,n)for(ll i=s;i<n;i++)
#define repe(i,s,n)for(ll i=s;i<=n;i++)

int main() {
	ll n, a, b; cin >> n >> a >> b;
	ll x[100001] = {};
	rep(i, 0, n)cin >> x[i];

	ll cost = 0;
	rep(i, 1, n) {
		cost += min((x[i] - x[i-1])*a, b);
	}
	cout << cost << endl;

	return 0;
}

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

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

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

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

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

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

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

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}
fn main(){
    input!{
        a:i64,
        b:i64,
        t:i64,
    }
    let ans =  (t/a) * b;
    println!("{}",ans);
}

Measured memory_bytes: 4352
N, M = map(int, input().split())

ac = [False] * N
pe = [0] * N
cnt = 0

for _ in range(M):
    p, s = input().split()
    p = int(p) - 1

    if ac[p]:
        continue

    if s == 'AC':
        ac[p] = True
        cnt += pe[p]
    else:
        pe[p] += 1

print(sum(ac), cnt)

Measured memory_bytes: 4596
#include<bits/stdc++.h>
using namespace std;
long  long  l,r;

int main()
{
	scanf("%lld%lld",&l,&r);
	long long ans=2019;
	for(long long i=l;i<=r;++i)
	{
		for(long long j=i+1;j<=r;++j)
		{
			ans=min(ans,(i*j)%2019);
			if(ans==0)
			{
				cout<<ans<<endl;
				return 0;
			}
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3732
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int  N, K, x, Min, Sum, i;
  cin >> N >> K ;
  
  for (i = 0;i < N ;i++){
    cin >> x;
    if(x < K - x){
      Sum += x * 2;
    }
    else{
      Sum += (K - x) * 2;
    }
    if(i == N - 1){
      cout << Sum <<endl;
    }
  }
}
    

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

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

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define irep(it, stl) for(auto it = stl.begin(); it != stl.end(); it++)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout << (ans) << '\n'
#define STLL(s) strtoll(s.c_str(), NULL, 10)
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int;
#define endl '\n';
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
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;}
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);}};
const int INF = INT_MAX;
const ll LLINF = 1LL<<60;
const ll MOD = 1000000007;
const double EPS = 1e-9;



int main() {
    
    int n;
    cin>>n;
    vi v(n);
    rep(i,n)cin>>v[i];
    int ans=0;
    rep(i,n){
        if(v[i]>i)continue;
        else {
            if(v[v[i]-1]==i+1){ans++;}
        }
    }
    fin(ans);
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define Rep(i,s,n) for(int i=s;i<n;i++)
#define fi first
#define se second
#define all(c) c.begin(),c.end()
typedef long long int ll;
typedef pair<int, int> P;
typedef long double ld;
void Ans(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}

const ll INF=1001001001;
const ll mod=1000000007;

int main(){
  ll n,k;
  cin>>n>>k;
  ll a[n];
  rep(i,n){
    cin>>a[i];
    a[i]--;
  }
  vector<ll> at(n,-1);
  ll c=0;
  at[0]=c;
  ll now=0;
  ll g;
  while(1){
    now=a[now];
    c++;
    if(at[now]==-1){
      at[now]=c;
    }
    else{
      g=at[now];
      break;
    }
  }
  
  if(k<c){
    rep(i,n){
      if(at[i]==k){
        cout<<i+1<<endl;
      }
    }
  }
  
  else{
    k-=g;
    k%=(c-g);
    k+=g;
    rep(i,n){
      if(at[i]==k){
        cout<<i+1<<endl;
      }
    }
  }
}

Measured memory_bytes: 6428
import java.util.*;

public class Main {
    private static final Scanner scn = new Scanner(System.in);
    
    public static void main(String[] args) {
        int n = scn.nextInt(), m = scn.nextInt();
        int[] b = new int[m];
        int[][] a = new int[n][m];
        for(int i = 0; i < n; i++) {
            for(int j = 0; j < m; j++) {
                a[i][j] = scn.nextInt();
            }
        }
        for(int i = 0; i < m; i++) {
            b[i] = scn.nextInt();
        }
        for(int i = 0, sum; i < n; i++) {
            for(int j = sum = 0; j < m; j++) {
                sum += a[i][j] * b[j];
            }
            System.out.println(sum);
        }
    }
}

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

int main(){
    int N, M;
    cin >> N >> M;
    int a[50], b[50];
    for(int i=0;i<M;i++)
        cin >> a[i] >> b[i];
    
    for(int i=0;i<N;i++){           // N個の都市
        int count[N] = {};          // 都市iとつながっている都市
        for(int j=0;j<M;j++){       // M本の道路
            if(a[j] == i+1)
                count[b[j]-1]++;
            if(b[j] == i+1)
                count[a[j]-1]++;
        }
        int ans = 0;
        for(int k=0;k<N;k++){
            if(i != k && count[k] > 0)
                ans += count[k];
        }
        cout << ans << endl;
    }

}

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

#define rep(i,n) for(ll i=0;i<(n);++i)
using ll = long long;
using pll = pair<ll,ll>;
constexpr ll INF = (1LL<<60);
constexpr ll MOD = (1e9+7);
//constexpr ll MOD = (998244353);
template<class T> bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T> bool chmin(T &a,const T &b){if(a>b){a=b;return 1;}return 0;}
void dump(){cerr<<endl;}
template<class T,class... Ts> void dump(T&& h, Ts&&... t){cerr<<h<<", ";dump(forward<Ts>(t)...);}
template<class T> istream &operator>>(istream&is,vector<T>&v){for(auto &elemnt:v)is>>elemnt;return is;}
template<class T,class U> istream &operator>>(istream&is,pair<T,U>&p){is>>p.first>>p.second;return is;}
template<class T>vector<T> vec(size_t a){return vector<T>(a);}
template<class T, class... Ts>auto vec(size_t a, Ts... ts){return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...));}
template<class T>vector<T> _vec(size_t a,T v){return vector<T>(a,v);}
template<class T, class... Ts>auto _vec(size_t a, Ts... ts){return vector<decltype(_vec<T>(ts...))>(a, _vec<T>(ts...));}

constexpr ll COM_MAX = (ll)1e6;
vector<ll> fac(COM_MAX),finv(COM_MAX),inv(COM_MAX);
// 前処理
void comb_init(){
  fac[0]=fac[1]=1;
  finv[0]=finv[1]=1;
  inv[1]=1;
  for(int i=2;i<COM_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;
  }
}
// 二項係数計算
ll comb(ll n,ll k){
  if(n<k)return 0;
  if(n<0||k<0)return 0;
  return fac[n]*(finv[k]*finv[n-k]%MOD)%MOD;
}
// 重複組み合わせ
ll nHk(ll n,ll k){
  return comb(n+k-1,n-1);
}

signed main(){

  ll n;
  cin>>n;
  vector<ll> a(n);
  cin>>a;

  map<ll,ll> cnt;
  ll ans = 1;
  rep(i,n){
    if(a[i]==0)ans *= 3-cnt[a[i]];
    else if(cnt.count(a[i]))ans *= cnt[a[i]-1]-cnt[a[i]];
    else ans *= cnt[a[i]-1];
    ans %= MOD;
    cnt[a[i]]++;
  }
  cout<<(ans)<<endl;

}

Measured memory_bytes: 30720
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,a,b) for(int i = (a); i < (b); i++)
#define iter(it,c) for(auto it = (c).begin(); it != (c).end();++it)
#define pb push_back
#define fs first
#define sc second
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<vi> vvi;
typedef vector<vii> vvii;

const int INF = ~(1<<31);
const double pi = acos(-1);
const double EPS = 1e-9;
typedef unsigned long long ull;

template <class T> T smod(T a, T b) {
  return (a % b + b) % b; }

int main() {
    cin.sync_with_stdio(false);
    int n;
    cin >> n;
    vi A(n);
    rep(i,0,n) cin >> A[i];
    int bst = INF;
    int sm1 = 0;
    int sm2 = 0;
    rep(i,0,n) {
        sm1 = 0;
        sm2 = 0;
        rep(j,0,i+1) sm1 += A[j];
        rep(j,i+1,n) sm2 += A[j];
        bst = min(bst, abs(sm1-sm2));
    }
    cout << bst << endl;
    return 0;
}


Measured memory_bytes: 256
import re

S = input()
key = 'keyence'

pattern = [r"^.*keyence$",
r"^k.*eyence$",
r"^ke.*yence$",
r"^key.*ence$",
r"^keye.*nce$",
r"^keyen.*ce$",
r"^keyenc.*e$",
r"^keyence.*$",]

judge = "NO"

for p in pattern :
    result = re.match(p, S)
    if result :
        judge = "YES"

print(judge)

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

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

const long long INF = 1LL << 60;

int main(){
    string S,T;
    cin >> S >> T;
    bool ans = true;
    for (int i = 0; i < S.size(); i++){
        if (S.at(i) != T.at(i)) ans = false; 
    }
    cout << (ans ? "Yes" : "No") << endl;
}

Measured memory_bytes: 3628
#include <stdio.h>

int main(){
    int k,n,i,tmp,j,u=0;
    int a[1000];
    scanf("%d %d",&n,&k);
    for(i=0;i<n;i++){
        scanf("%d",&a[i]);
    }
     for (i=0; i<n; i++) {
    for (j=i+1; j<n; j++) {
      if (a[i] > a[j]) {
        tmp =  a[i];
        a[i] = a[j];
        a[j] = tmp;
      }
    }
  }
  for(i=0;i<k;i++){
      u += a[i];
  }
    printf("%d\n",u);

    return 0;

}

Measured memory_bytes: 1736
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
using namespace std;

int main()
{
	int A, B, K;
	cin >> A;
	cin >> B;
	cin >> K;
	vector<int> cd;
	int M = min(A, B);
	for (int i = 1; i <= M; i++)
	{
		if (A%i==0 && B%i == 0)
		{
			cd.push_back(i);
		}
	}
	int N = cd.size();
	cout << cd[N - K] << endl;
	return 0;
}


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

int main(){
    int N;
    string S;
    cin >> N;
    cin >> S;
    int count[1000000]= {};
    int mincount;
    for (int i = 1; i < N; i++){
        if (S[i] == 'E') count[0]++;
    }
    mincount = count[0];
    
    for (int i = 1; i < N; i++){
        if (S[i - 1] == 'W') count[i] = count[i -1] + 1;
        else count[i] = count[i - 1];
        if (S[i] == 'E') count[i] -= 1;
        if (count[i] < mincount) mincount = count[i];
    }
    /*for (int i = 0; i < N; i++){
        cout << count[i] << endl;
    }*/
    cout << mincount << endl;

    //iはリーダーの位置
    /*int count[1000000] = {};
    for (int i = 0; i < N; i++){
        for (int j = 0; j < i; j++){
            if (S[j] == 'E') count[i]++;
        }
        for (int j = i + 1; j < N; j++){
            if (S[j] == 'W') count[i]++;
        }
    }
    int maxcount = 0;
    for (int i = 0; i < N; i++){
        if (maxcount < count[i]) maxcount = count[i];
    }
    cout << N - 1 - maxcount << endl;
    */
    return 0;

}

Measured memory_bytes: 4612
#include<bits/stdc++.h>
using namespace std;
vector<int>adj[200005];
bool vis[200005];
int maxi=0;
int dfs(int u){
    int ans=0;
    if(!vis[u]){
        vis[u]=true;
        ans++;
        for(auto v : adj[u]){
            ans+=dfs(v);
        }
    }
    return ans;
}
int main(){
	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output1.txt","w",stdout);
	#endif
    ios_base::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
	int n,m;
    cin>>n>>m;
    memset(vis,false,sizeof(vis));
    for(int i=0;i<m;i++){
        int a,b;
        cin>>a>>b;
        a--;
        b--;
        adj[a].push_back(b);
        adj[b].push_back(a);
    }
    for(int i=0;i<n;i++){
        if(!vis[i]){
            maxi=max(maxi,dfs(i));
        }
    }
    cout<<maxi;
 
}

Measured memory_bytes: 20908
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
//#define ll long long
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
#define all(x) (x).begin(),(x).end()
ll tmp1,tmp2,tmp3;
const ll mod = 1000000007;
const int INF = 1e9;
const ll INFLONG = 1e18;
void swap(ll *x,ll *y){
  ll tmp;
  tmp = *x;
  *x = *y;
  *y = tmp;
}

int main(){
  ll a1,a2,a3;
  cin >> a1 >> a2 >> a3;
  if(a1 + a2 + a3 >= 22){
    cout << "bust" << endl;
  }else{
    cout << "win" << endl;
  }
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <map>
#include <tuple>
#include <cmath>
using namespace std;
#define _GLIBCXX_DEBUG

int main(void){

    int N, L;
    cin >> N >> L;
    vector<string> str(N);
    string combine_str;

    for(int i = 0; i < N; i++){
        cin >> str.at(i);
    }

    sort(str.begin(), str.end());

    for(int i = 0; i < N; i++){
        combine_str += str.at(i);
    }

    cout << combine_str << endl;

}

Measured memory_bytes: 256
a, b, k = map(int, input().split())
nums = []
for i in range(min(a, b)-1):
    if ((a % (i+1) == 0) and (b % (i+1) == 0)):
        nums.append(i+1)
if ( max(a,b) % min(a,b) == 0 ):
    nums.append(min(a,b))
print(nums[-1*k])

Measured memory_bytes: 3060
import itertools
N = int(input())
S = input()
cnt = i = 0
j = N - 1
while True:
    while i < N and S[i] == 'R':
        i += 1
    while 0 <= j and S[j] == 'W':
        j -= 1
    if j < i:
        break
    cnt += 1
    i += 1
    j -= 1
print(cnt)


Measured memory_bytes: 9416
#include<cstdio>
#include<iostream>
#include<cstring>
using namespace std;
    char a[60],b[60];
int main ()
{
    scanf("%s",&a);
    scanf("%s",&b);
    for(int i=0;i<=50;i++){
        if(a[i]!=0)cout<<a[i];
        if(b[i]!=0)cout<<b[i];
    }
    return 0;
}

Measured memory_bytes: 256
MOD = 10 ** 9 + 7
INF = 10 ** 10
import sys
sys.setrecursionlimit(100000000)
dy = (-1,0,1,0)
dx = (0,1,0,-1)

def main():
    m,k = map(int,input().split())
    if k >= pow(2,m):
        print(-1)
        return
    if m == 1:
        if k == 1:
            print(-1)
        else:
            print('{0} {0} {1} {1}'.format(0,1))
        return
    
    ans = [k]
    ans2 = [k]
    lim = pow(2,m)
    for i in range(lim):
        if i != k:
            ans.append(i)
        if lim - i - 1 != k:
            ans2.append(lim - i - 1)
    ans += ans2
    print(*ans)  

if __name__ =='__main__':
    main()  

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

int main() {
  string s;
  cin >> s;
  if(s.size() == 2) cout << s << endl;
  else{
    reverse(s.begin(),s.end());
    cout << s << endl;
  }
}

Measured memory_bytes: 256
n=int(input())
for i in range(n):
    runner=0
    out=0
    score=0
    while 1:
        state=input()
        if state=="HIT":
            if runner<3:
                runner+=1
            else:
                score+=1
        elif state=="HOMERUN":
            score+=runner+1
            runner=0
        else:
            out+=1
            if out==3:break
    print(score)


Measured memory_bytes: 5584
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
ll ans = 0;
const ll INF = 1LL << 60; //MAX 9223372036854775807

int main()
{
string s , t ;
cin >> s >> t ;
vector<vector<ll>> v(s.size(), vector<ll>(26,INF) );
vector<vector<ll>> ta(26, vector<ll>() );
rep(i,s.size()){
  ta[s[i]-'a'].push_back(i);
}
rep(i,26){
  if(ta[i].size()!=0)ta[i].push_back(ta[i][0]+s.size());
}
rep(i,s.size()){
  rep(j,26){
    auto itr = upper_bound(ta[j].begin(), ta[j].end(), i);
    if(itr!=ta[j].end())v[i][j]=*itr-i;
  }
}
ll now=0;
rep(i,t.size()){
  if(!(i==0&&t[0]==s[0])){
  ans+=v[now][t[i]-'a'];
  now+=v[now][t[i]-'a'];
  now%=s.size();
  if(ans>=INF){
    cout << -1 << endl;
    return 0;
  }
  }
}

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


Measured memory_bytes: 25856
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n,x,l,p,ans;cin>>n>>x;p=0;ans=1;
  for(int i=0;i<n;i++){
    cin>>l;
    p=p+l;
    if(x>=p){
      ans+=1;
    }
  }
  cout<<ans<<endl;
}

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

int main()
{
	string n;
	int l;
	while (cin >> n >> l, l) {
		vector<int> v;
		int cur, nex, lmax, _lmin;
		bool f = 1;
		while (f) {
			while (n.size() != l) n = "0" + n;
			cur = atoi(n.c_str());
			v.push_back(cur);
			int lmin, lmax;
			sort(n.begin(), n.end());
			lmin = atoi(n.c_str());
			sort(n.rbegin(), n.rend());
			lmax = atoi(n.c_str());
			int nex = lmax - lmin;
			for (int j = 0; j < v.size(); j++) {
				if (v[j] == nex) {
					cout << j << " " << nex << " " << v.size()-j << endl;
					f = 0;
				}
			}
			stringstream ss;
			ss << nex;
			n = ss.str();
		}
	}
	
	return 0;
}

Measured memory_bytes: 1256
#include <bits/stdc++.h>
#define REP(i, n) for(int i=0;i<int(n);++i)
using namespace std;
template<class A>void pr(A a){cout << (a) << endl;}
template<class A,class B>void pr(A a,B b){cout << a << " "  ;pr(b);}
template<class A,class B,class C>void pr(A a,B b,C c){cout << a << " " ;pr(b,c);}
template<class A,class B,class C,class D>void pr(A a,B b,C c,D d){cout << a << " " ;pr(b,c,d);}
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
// for copy
// for(int i=0;i<N;++i) {

int main(void) {
  ll N;cin>>N;
  int m = sqrt(N) + 1;
  vector<ll> v;
  for(int i=1;i<m;++i) {
    if (N%i==0) {
      v.push_back(i-1+(N/i)-1);
    }
  }
  pr(*min_element(v.begin(), v.end()));
  return 0;
}



Measured memory_bytes: 384
import java.util.Scanner;

public class Main {
	/*
	 * あなたの課題は、あるクラスの数学の成績を付けるプログラムを作成することです。
	 *
	 * プログラムは複数の学生のテストの点数を読み込みます。
	 *
	 * テストの点数は、中間試験の点数 m、期末試験の点数 f、再試験の点数 r で構成されています。
	 *
	 * 中間試験と期末試験は 50 点満点（m, f ? 50）、再試験は 100 点満点 （r ? 100）です。
	 *
	 * 試験を受けていない場合は点数を -1 とします。
	 *
	 * 以下の手順で成績が付けられます：
	 *
	 * 中間試験、期末試験のいずれかを欠席した場合成績は F。 中間試験と期末試験の合計点数が 80 以上ならば成績は A 。
	 * 中間試験と期末試験の合計点数が 65 以上 80 未満ならば成績は B。 中間試験と期末試験の合計点数が 50 以上 65 未満ならば成績は C。
	 * 中間試験と期末試験の合計点数が 30 以上 50 未満ならば成績は D。 ただし、再試験の点数が 50 以上ならば成績は C。
	 * 中間試験と期末試験の合計点数が 30 未満ならば成績は F。 Input
	 * 複数のデータセットが入力として与えられます。各データセットでは、空白で区切られた m、f、r が 1 行に与えられます。
	 *
	 * m、f、r がすべて -1 のとき入力の終わりとします。
	 *
	 * Output 各データセットについて、成績（A、B、C、D、または F）を１行に出力して下さい。
	 *
	 * Sample Input 40 42 -1 20 30 -1 0 2 -1 -1 -1 -1 Sample Output A C F
	 */
	public static void main(String[] args) throws Exception {

		boolean flg = true;

		Scanner sc = new Scanner(System.in);

		while (flg) {
			int m = sc.nextInt();
			int f = sc.nextInt();
			int r = sc.nextInt();

			if (m == -1 && f == -1 && r == -1) {

				flg = false;

			} else if (m == -1 || f == -1) {

				System.out.println("F");

			} else {

				if (m + f < 30) {
					System.out.println("F");
				} else if (m + f < 50) {
					if (r >= 50) {
						System.out.println("C");
					} else {
						System.out.println("D");
					}
				} else if (m + f < 65) {
					System.out.println("C");
				} else if (m + f < 80) {
					System.out.println("B");
				} else {
					System.out.println("A");
				}

			}

		}
		sc.close();
	}
}

Measured memory_bytes: 19392
A,B,Z=map(int,input().split())

import math

if 2*Z>=A*A*B:
    theta = math.atan2(2*(B-Z/(A**2))/A,1)
    print(math.degrees(theta))
else:
    theta = math.atan2(B,2*Z/(A*B))
    print(math.degrees(theta))

Measured memory_bytes: 3060
// AOJ 0372: Three Meals
// 2017.11.14 bal4u@uu

#include <stdio.h>
#include <string.h>

long long tbl[3][1440];
int min[3], max[3];

int bitcount64(long long x)
{
	x = ((x & 0xAAAAAAAAAAAAAALL) >>  1) + (x & 0x55555555555555LL);
	x = ((x & 0xCCCCCCCCCCCCCCLL) >>  2) + (x & 0x33333333333333LL);
	x = ((x & 0xF0F0F0F0F0F0F0LL) >>  4) + (x & 0x0F0F0F0F0F0F0FLL);
	x = ((x & 0x00FF00FF00FF00LL) >>  8) + (x & 0xFF00FF00FF00FFLL);
	x = ((x & 0xFF0000FFFF0000LL) >> 16) + (x & 0x00FFFF0000FFFFLL);
	x = ((x & 0xFFFFFF00000000LL) >> 32) + (x & 0x000000FFFFFFFFLL);
	return (int)x;
}

int main()
{
	int n, i, j, at, ht, bt, f, cnt, ans;
	long long b;
	
	scanf("%d", &n);
	memset(tbl, 0, sizeof(tbl));
	min[0] = min[1] = min[2] = 1440;
	max[0] = max[1] = max[2] = 0;

	for (b = 1, i = 0; i < n; i++, b <<= 1) for (j = 0; j < 3; j++) {
		int sh, sm, eh, em, t;
		scanf("%d%d%d%d", &sh, &sm, &eh, &em);
		sh = sh*60+sm, eh = eh*60+em;
		if (sh < min[j]) min[j] = sh;
		if (eh > max[j]) max[j] = eh;
		for (t = sh; t <= eh; t++) tbl[j][t] |= b;
	}
	cnt = n;
	for (j = 0; j < 3; j++) {
		f = 0;
		for (i = min[j]; i <= max[j]; i++) {
			int t;
			if ((t = bitcount64(tbl[j][i])) > f) f = t;
		}
		if (f < cnt) cnt = f;
	}
	if (cnt == 0) { ans = 0; goto done; }

	ans = 0;
	for (at = min[0]; at <= max[1]; at++) {
		ht = at+1; if (ht < min[1]) ht = min[1];
		for ( ; ht <= max[1]; ht++) {
			bt = ht+1; if (bt < min[2]) bt = min[2];
			for ( ; bt <= max[2]; bt++) {
				if ((f = bitcount64(tbl[0][at] & tbl[1][ht] & tbl[2][bt])) > ans) {
					ans = f;
					if (ans == cnt) goto done;
				}
			}
		}
	}
done:
	printf("%d\n", ans);
	return 0;
}

/*
5
1:00 2:00   3:30 4:30    6:00 7:00
2:30 3:00   4:00 5:00    5:30 6:30
1:30 2:30   4:30 5:00    6:30 7:00
2:30 3:00   5:00 6:00    6:30 7:00
1:00 2:00   3:00 3:30    4:00 5:00
*/

Measured memory_bytes: 1880
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
typedef long long ll;
typedef long long ld;


int main() {
	// violinista forever xd
	ios::sync_with_stdio(0),cin.tie(0);
	
	ll n, a, b,tmp,aux,rta,tmp2;
    cin>>n>>a>>b;
    tmp = n / (a + b);
    aux = n % (a + b);
    tmp2 = min(a, aux);
    rta = a * tmp + tmp2;
	cout<<rta<<endl;
	
	return 0;
}

Measured memory_bytes: 3608
#include<vector>
#include<iostream>
#include<stdio.h>
#include<stdlib.h>
#include <iostream>
#include <algorithm>
#include <map>
#include <cmath>
#include<queue>
#include <sstream>
#include <set>
#include<stack>
#include <utility>
#define INF 1000000000000
const long long MOD = 1000000007;

using namespace std;
typedef long long llong;

//int isalpha(char ch): ch がアルファベットなら true を返す
//int isdigit(char ch): ch が数字なら true を返す
//int islower(char ch): ch が小文字なら true を返す
//int isupper(char ch): ch が大文字なら true を返す
//int tolower(char ch): ch の小文字を返す
//int toupper(char ch): ch の大文字を返す

//string型
//size()	文字数を返す
//Insert()	（指定した場所に）文字・文字列を挿入する
//erase()	（指定した場所の）文字・文字列を削除する
//clear()	すべての文字を削除する
//substr()	文字列の（指定した）部分文字列を返す
//replace()	（指定した）部分文字列を新しい文字列に置換する
//c_str()変換
//文字列の比較は、<=や==などを使え
//replace関数を使い、簡単に文字列を置換
//リバース関数：reverse(str.begin(), str.end());
//map<type, type> dict;で宣言
//グラフ理論用変数
//vector<vector<llong> > graph(N);

//ソート
//降順sort(v.begin(), v.end(), std::greater<Type>());

//大文字から小文字へんかん
//w[i] = w[i]-'A'+'a';

//vector
//assignメソッド　引数：サイズ、値
//与えられたサイズと値でvectorを初期化する

//queueクラス
//find()次に取り出す値の表示をする。
//pop()値を取り出す。戻り値はなし
//push()キューに値をプッシュする

//priority_queueクラス

//切り上げ
//ceil
//floor

llong dfs(llong n, vector<llong> &dp){
    if(n<0){
        return INF;
    }
    if(n==0){
        return 0;
    }
    if(dp[n]!=-1){
        return dp[n];
    }
    llong ans=INF;
    ans = min(dfs(n-1, dp)+1, ans);
    for(int i=1; pow(6,i)<=n; i++){
        ans = min(dfs(n-pow(6,i), dp)+1, ans);
    }    
    for(int i=1; pow(9,i)<=n; i++){
        ans = min(dfs(n-pow(9,i), dp)+1, ans);
    }   
    dp[n] = ans;
    return ans; 
}

int main(){
    llong N;
    cin >> N;
    vector<llong> dp(N+1, -1);
    cout << dfs(N, dp) << endl;
    return 0;
}

Measured memory_bytes: 9860
import numpy as np
N,M=map(int,input().split())
A=np.array(list(map(int,input().split())))
ninki_array = A>=1/(4*M)*np.sum(A)
ninki_num = np.sum(ninki_array)
if ninki_num>=M:
    print('Yes')
else:
    print('No')




Measured memory_bytes: 21688
#include<bits/stdc++.h>
using namespace std;
int n,W,a[109],w[109];
long long dp[109][100009];
int main()
{
    cin>>n>>W;
    memset(dp,-1,sizeof(dp));
    dp[0][0]=0;
    for(int i=1;i<=n;i++)cin>>w[i]>>a[i];
    for(int i=1;i<=n;i++)
    {
        //cout<<a[i]<<"\n";
        for(int j=0;j<=W;j++)
        {
            if(dp[i-1][j]!=-1&&j+w[i]<=W)
                {
                    dp[i][j+w[i]]=max(dp[i][j+w[i]],dp[i-1][j]+a[i]);
                    //cout<<dp[i][j+w[i]]<<" ";
                }
            dp[i][j]=max(dp[i][j],dp[i-1][j]);
        }
    }
    long long ans=0;
    for(int i=1;i<=n;i++)
    {
        for(int j=0;j<=W;j++)
        {
            ans=max(dp[i][j],ans);
        }
    }
    cout<<ans;
}


Measured memory_bytes: 85376
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <bits/stdc++.h>

using namespace std;
 
//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
 
//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}
 template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
 
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
 
//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define fore(i,a) for(auto &i:a)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
 
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
 
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
 

LL gcd(LL a, LL b){
    if(b == 0) return a;
    return gcd(b,a%b);
}

LL lcm(LL a, LL b){
    LL g = gcd(a,b);
    return a/g *b;
}


int main(){
    LL a,b,r,x;
    cin >> a >> b;
    string S,T;
    cin >> S >> T;
    LL tmp=0;
    x=a*b;
    LL N=a,M=b;
    if(a<b){
    tmp = a;
    a = b;
    b = tmp;
  }
     r = a % b;
  while(r!=0){
    a = b;
    b = r;
    r = a % b;
  }
    LL y=x/b;
    LL res_S[N];
    LL res_T[M];
    for(int i=0;i<N;++i){
        res_S[i]=i*y/N;
    }
    
    for(int i=0;i<M;++i){
        res_T[i]=i*y/M;
    }
    LL react=0;
    LL pos=0;
    bool exist=true;
    LL n=N/y,m=M/y;
    map<LL,char>res1,res2;
    REP(i,N){
        LL pos = i*(y/N);
        res1[pos]=S[i];
    }
    
    REP(i,M){
        LL pos = i*(y/M);
        res2[pos]=T[i];
    }
    for(LL i = 0; i < y; i+=lcm(y/N,y/M)){
        if(res1[i]!='\0' && res2[i]!= '\0' && res1[i]!=res2[i]){
            cout << -1 << endl;
            return 0;
        }
    }
    cout << y << endl;
    return 0;
}

Measured memory_bytes: 12160
program ABC149D
    implicit none
    integer::N,K
    integer::R,S,P
    character(10**5)::T
    integer::ans
    integer::i
    read*,N,K
    read*,R,S,P
    read*,T
    ans=0
    do i=1,K
        if(T(i:i)=="s")ans=ans+R
        if(T(i:i)=="p")ans=ans+S
        if(T(i:i)=="r")ans=ans+P
    end do
    do i=K+1,N
        if(T(i:i)==T(i-K:i-K))T(i:i)="n"
        if(T(i:i)=="s")ans=ans+R
        if(T(i:i)=="p")ans=ans+S
        if(T(i:i)=="r")ans=ans+P
    end do
    print"(i0)",ans
end program ABC149D

Measured memory_bytes: 700
#include<cstdio>
#include<iostream>
using namespace std;
int n,ans;
int f(int x)
{
    int s=0;
    while(x)
    {
        s+=x%10;
        x/=10;
    }
    return s;
}
int main()
{
    cin>>n;
    ans=f(1)+f(n-1);
    for(int i=2;i<=(n>>1)+1;++i)
        ans=min(ans,f(i)+f(n-i));
    cout<<ans;
    return 0;
}

Measured memory_bytes: 256
//インクルード(アルファベット順)
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#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(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
//#include<unordered_map>//イテレータあるけど順序保持しないmap
//#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列
#include<valarray>//なんとなく追加
//メモ：表示桁数を大きくする　　cout << fixed << setprecision(20) << cm << endl;
using namespace std;
typedef long long ll;

//マクロ
//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() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値を求める
#define MIN(x) *min_element(ALL(x)) //最小値を求める
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素
#define PI acos(-1.0)
#define answer(ans) cout<<ans<<endl;
#define input(N) cin >> N ;

int calc(int n){
    double R=0,en;
    R=n%10;
    en=n/10;
    if(en!=0){
    R+=calc(en);
    }
    return R;
}

signed main() {
int N;
cin >> N;
if(N % calc(N)==0){
cout << "Yes" <<endl;
}
else{
    cout << "No" << endl;
}
return 0;
}


Measured memory_bytes: 3572
S = input()

count_0 = 0
count_1 = 0

for i,s in enumerate(S):
    if s == "0" and i%2==0:
        count_1 += 1
        continue
    elif s=="1" and i%2==0:
        count_0 += 1
        continue
    if s == "1" and i%2==1:
        count_1 += 1
    elif s=="0" and i%2==1:
        count_0 += 1

print(min(count_0,count_1))


Measured memory_bytes: 3188
from queue import Queue
def isSafe(row, col):
    return row >= 0 and col >= 0 and row<h and col<w and mat[row][col] != '#'


def bfs(row, col):
    visited = [[False]*w for _ in range(h)]
    que = Queue()
    dst = 0
    que.put([row, col, 0])
    visited[row][col] = True
    moves = [[-1, 0],[1, 0], [0, -1], [0, 1]]
    while not que.empty():
        root = que.get()
        row, col, dst = root
        for nrow, ncol in moves:
            row2 = row + nrow
            col2 = col + ncol 
            if isSafe(row2, col2) is True and visited[row2][col2] is False:
                visited[row2][col2] = True
                que.put([row2, col2, dst+1])
                 
    return dst 

h, w = map(int, input().split())
mat = [input() for _ in range(h)]
ans = 0
for row in range(h):
    for col in range(w):
        if mat[row][col] == '.':
            ans = max(ans, bfs(row, col))

print(ans)



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

int main() {
 int n;
 cin >> n;
 int a[n];
 rep(i,n){ cin >> a[i] ;}

 int max=0;
 int index=0;
 int counter =0;
 rep(i,n){
     if(a[i]>max){
         max = a[i];
         index =i;
     }
     
 }

 sort(a,a+n);

 rep(i,n){
     if(i==index){
         cout << a[n-2] << endl;

     }
     else{
         cout << max << endl;
     }
 }


}

Measured memory_bytes: 2432
#include <bits/stdc++.h>
#define N 100005
using namespace std;
int read(){
    int x=0,f=1;char ch=getchar();
    while(!isdigit(ch)){if(ch=='-')f=-1;ch=getchar();}
    while(isdigit(ch))x=x*10+ch-'0',ch=getchar();
    return f*x;
}
typedef struct node{
	int d,x,y;
}node;
node d[N];
int ab(int x,int y){
	int t=x-y;
	if(t<0) return t*-1;
	else return t;
}
int main(){
	ios::sync_with_stdio(false);
	int n;cin>>n;
	int t1,x1,y1;
	for(int i=1;i<=n;i++){
		cin>>d[i].d>>d[i].x>>d[i].y;
	}
	t1=ab(d[1].x,0)+ab(d[1].y,0);
	if(t1>d[1].d||(d[1].d-t1)%2==1){
		cout<<"No"<<endl;
		return 0;
	}
	for(int i=2;i<=n;i++){
		t1=d[i].d-d[i-1].d;
		if(t1<ab(d[i].x,d[i-1].x)+ab(d[i].y,d[i-1].y)||(t1-ab(d[i].x,d[i-1].x)+ab(d[i].y,d[i-1].y))%2==1){
			cout<<"No"<<endl;return 0;
		}
	}
	cout<<"Yes"<<endl;
	return 0;
}


Measured memory_bytes: 1408
n = int(input())
red = [list(map(int,input().split())) for _ in range(n)]
blue = [list(map(int,input().split())) for _ in range(n)]
blue.sort(key=lambda x:(x[0],x[1]))
check = [False]*n
for i in range(n):
    a = -1
    c = -1
    for j in range(n):
        if check[j]:continue
        if blue[i][0] > red[j][0] and blue[i][1] > red[j][1]:
            if a < red[j][1]:
                a = red[j][1]
                c = j
    if c != -1:
        check[c] = True
print(check.count(True))

Measured memory_bytes: 39152
#include <cstdio>
#include <algorithm>
using namespace std;
int n,m;
static int h[200], r[200];
static int dp[200];
int calc(int i) {if(dp[i] == -1) {
dp[i] = 1;
for(int j = 0; j < n+m; j++) {
if(h[j] < h[i] && r[j] < r[i]) {
dp[i] = max(dp[i], calc(j)+1);
}
}
}
return dp[i];
}
int main() {
for(int tci = 0; ; tci++) {
scanf("%d", &n); if(n==0) break;
for(int i = 0; i < n; i++) {
scanf("%d%d", h+i, r+i);
}
scanf("%d", &m);
for(int i = 0; i < m; i++) {
scanf("%d%d", h+n+i, r+n+i);
}
fill(dp, dp+n+m, -1);
int mv = 0;
for(int i = 0; i < n+m; i++) {
mv = max(mv, calc(i));
}
printf("%d\n", mv);
}
return 0;
}

Measured memory_bytes: 2704
#include <bits/stdc++.h>
using namespace std;
int main(){
    int t,a,b,c;
    cin>>a>>b>>c;
    cin>>t;
    int sum=0,tmp;
    if(a>b&&a>c){
        sum=b+c;
        tmp=a;
    }else if(b>a&&b>c){
        sum=a+c;
        tmp=b;
    }else{
        sum=a+b;
        tmp=c;
    }
    for(int i=0;i<t;i++){
        tmp*=2;
    }
    sum=sum+tmp;
    printf("%d\n",sum);
}

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

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

using ll = long long;
using ld = long double;
ll INF = LLONG_MAX;

using vi = vector<int>;
using vll = vector<ll>;
using pii = pair<int, int>;

namespace output {
	void pr(int x) { cout << x; }
	void pr(long x) { cout << x; }
	void pr(ll x) { cout << x; }
	void pr(unsigned x) { cout << x; }
	void pr(unsigned long x) { cout << x; }
	void pr(unsigned long long x) { cout << x; }
	void pr(float x) { cout << x; }
	void pr(double x) { cout << x; }
	void pr(ld x) { cout << x; }
	void pr(char x) { cout << x; }
	void pr(const char* x) { cout << x; }
	void pr(const string& x) { cout << x; }
	void pr(bool x) { pr(x ? "true" : "false"); }
	template<class T> void pr(const complex<T>& x) { cout << x; }
	
	template<class T1, class T2> void pr(const pair<T1,T2>& x);
	template<class T> void pr(const T& x);
	
	template<class T, class... Ts> void pr(const T& t, const Ts&... ts) { 
		pr(t); pr(ts...); 
	}
	template<class T1, class T2> void pr(const pair<T1,T2>& x) { 
		pr("{",x.f,", ",x.s,"}"); 
	}
	template<class T> void pr(const T& x) { 
		pr("{"); // const iterator needed for vector<bool>
		bool fst = 1; for (const auto& a: x) pr(!fst?", ":"",a), fst = 0; 
		pr("}");
	}
	
	void print() { pr("\n"); } // print w/ spaces
	template<class T, class... Ts> void print(const T& t, const Ts&... ts) { 
		pr(t); if (sizeof...(ts)) pr(" "); print(ts...); 
	}
}

using namespace output;

int main() {
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int N, K; cin >> N >> K;
	vll arr (N); 
	F0R(i, N) cin >> arr[i];
	ll rs = 0;
	ll ls = 0;
	ll ms = 0;
	F0R(i, K) ms += arr[i];
	FOR(i, K, N) rs += max(0LL, arr[i]);
	
	ll best = ls + max(0LL, ms) + rs;
	for (int l = 0; l + K < N; ++l) {
		ls += max(0LL, arr[l]);
		ms -= arr[l];
		ms += arr[l+K];
		rs -= max(0LL, arr[l+K]);
		best = max(best, ls + max(0LL, ms) + rs);
	}
	print(best);
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
 
#define rep(i,n) for (int i = 0; i<(n); i++)
#define in(n) cin >> (n)
#define out(ans) cout << (ans) << endl;
#define keta(n) cout << fixed << setprecision((n));
using ll = int64_t;
using v = vector<int>;


int main() {
  string t;
  cin >> t;
  int jisu;
  jisu = t.size();
  for (int i = 0; i < jisu; i++) {
    if (t.at(i)=='?') {
      t.at(i) = 'D';
    }
  }
  
  cout << t << endl;

}

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

int main(){
	int n;
	cin >> n;
	int64_t d[n];
	for(int64_t &i:d) cin >> i;
	int m;
	cin >> m;
	int64_t t[m];
	for(int64_t &i:t) cin >> i;
	sort(d, d + n);
	sort(t, t + m);
	for(int i = 0, j = 0; i < m; i++, j++){
		while(j < n && t[i] != d[j]) j++;
		if(j == n){
			cout << "NO" << endl;
			return 0;
		}
	}
	cout << "YES" << endl;
	return 0;
}

Measured memory_bytes: 3328
I=input;n=int(I())
def f(x):
    a=x%10;x//=10
    while x:
        if x%10+1!=a:return 0
        a=x%10;x//=10
    return 1

a=list(map(int,I().split()))
b=-1
for i in range(n):
    for j in a[i+1:]:
        c=a[i]*j
        if(f(c) and b<c):b=c
print(b)

Measured memory_bytes: 7796
#include <bits/stdc++.h>
    using namespace std;
    using ll=long long;
    int main(){
      ll N, x=0; cin >> N;
      for(ll i=2; i<=sqrt(N); i++){
        ll e=0, p=0;
        while(N%i==0) {
          e++;
          if(e>p){
            x++;
            p=e;
            e=0;
          }
          N/=i;
        }
      }
      if(N!=1) x++;
      cout << x;
      return 0;
    }

Measured memory_bytes: 3676
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>
#include <ctype.h>
#include <stdint.h>
#include <string.h>
#include <wchar.h>
#include <math.h>

#define N_MAX (100)
#define P_MAX (100)
#define DP_ARRAY_SIZE (N_MAX * P_MAX / 32 + 1)

#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define ABS(a) ((a) < 0 ? -(a) : (a))
#define ABSS(a, b) ((a) > (b) ? (a) - (b) : (b) - (a))

int compare_sz_asc(const void* a, const void* b) {
    return *((size_t*)a) < *((size_t*)b) ? -1 : 1;
}

int compare_sz_desc(const void* a, const void* b) {
    return *((size_t*)a) > * ((size_t*)b) ? -1 : 1;
}

int compare_i64_asc(const void* a, const void* b) {
    return *((int64_t*)a) < *((int64_t*)b) ? -1 : 1;
}

int compare_i64_desc(const void* a, const void* b) {
    return *((int64_t*)a) > * ((int64_t*)b) ? -1 : 1;
}

int compare_c_asc(const void* a, const void* b) {
    return *((char*)a) < *((char*)b) ? -1 : 1;
}

int compare_c_desc(const void* a, const void* b) {
    return *((char*)a) > * ((char*)b) ? -1 : 1;
}

static size_t powSz(const size_t base, const size_t exp) {
    if (exp == 0) {
        return 1;
    }

    if (exp == 1) {
        return base;
    }

    if (exp % 2 == 0) {
        return powSz(base * base, exp / 2);
    }
    else {
        return base * powSz(base, exp - 1);
    }
}

static size_t comb(const size_t n, const size_t r) {
    size_t result = 1;

    for (size_t i = 0; i < r; i++) {
        result *= n - i;
        result /= i + 1;
    }

    return result;
}

static uint64_t combU64(const uint64_t n, const uint64_t r) {
    uint64_t result = 1;

    for (uint64_t i = 0; i < r; i++) {
        result *= n - i;
        result /= i + 1;
    }

    return result;
}

static size_t gcdZu(size_t m, size_t n) {
    size_t temp;

    while (m % n != 0) {
        temp = n;
        n = m % n;
        m = temp;
    }

    return n;
}

static uint64_t gcdU64(uint64_t m, uint64_t n)
{
    uint64_t temp;

    while (m % n != 0) {
        temp = n;
        n = m % n;
        m = temp;
    }

    return n;
}

int main(void) {
    uint64_t x;

    scanf("%"PRIu64, &x);

    uint64_t cnt = (x / 11) * 2;

    x %= 11;

    if (0 < x && x <= 6) {
        cnt++;
    }
    else if (6 < x) {
        cnt += 2;
    }

    printf("%"PRIu64, cnt);

    return 0;
}


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

namespace CSharp
{
    class Program
    {
        static void Main()
        {
            var N = int.Parse(Console.ReadLine());
            var A = Console.ReadLine().Split().Select(int.Parse).ToArray();

            var flag = true;
            for (int i = 0; i < N; i++)
            {
                if (A[i] % 2 == 0)
                {
                    if (A[i] % 3 != 0 && A[i] % 5 != 0)
                    {
                        flag = false;
                    }
                }
            }
            Console.WriteLine(flag ? "APPROVED" : "DENIED");
        }
    }
}

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

const int INF=0x3f3f3f3f;
const ll INFL=0x3f3f3f3f3f3f3f3f;
const int MOD=1000000007;

int main(){
	int n,K;cin>>n>>K;
	int cnt=0;
	while(n){
		cnt++;
		n/=K;
	}
	cout<<cnt<<endl;
}

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

using namespace std;

const int mod = 1e9 + 7;

void add(int& a, int b){
	a += b;
	if(a >= mod){
		a -= mod;
	}
}

void sub(int& a, int b){
	a -= b;
	if(a < 0){
		a += mod;
	}
}

int main(void){
	int n, m;
	cin >> n >> m;
	vector<int> s(n + 1), t(m + 1);
	for(int i = 1 ; i <= n ; i++){
		cin >> s[i];
	}
	for(int j = 1 ; j <= m ; j++){
		cin >> t[j];
	}
	vector<vector<int>> dp(n + 1, vector<int>(m + 1, 0)); 
	vector<vector<int>> sum(n + 1, vector<int>(m + 1, 0));
	for(int i = 1 ; i <= n ; i++){
		for(int j = 1 ; j <= m ; j++){
			add(sum[i][j], sum[i - 1][j]);
			add(sum[i][j], sum[i][j - 1]);
			sub(sum[i][j], sum[i - 1][j - 1]);
			if(s[i] != t[j]) continue;
			add(dp[i][j], sum[i - 1][j - 1] + 1);
			add(sum[i][j], dp[i][j]);
		}
	}
	int ans = 1;
	for(int i = 1 ; i <= n ; i++){
		for(int j = 1 ; j <= m ; j++){
			add(ans, dp[i][j]);
		}
	}
	cout << ans << endl;
	return 0;
}

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

using namespace std;

#define be begin
#define en end

#define ALL(a) (a).be() , (a).en()
#define REP(i,n) for(int (i)=0;(i)<(n);(i)++)        //repeat n times
#define REP2(i,s,n) for(int (i)=(s);(i)<(n);(i)++)   //repeat from s to n 
#define REPD(i,n) for(int (i)=(n);(i)>=0;(i)--)      //repeat from n to 0
#define REPD2(i,s,e) for(int (i)=(s);(i)>=(e);(i)--) //repeat from s to e

using LL = long long;

const int MOD = 1000000007;

LL BMPow(int x,int n,int m=0){
	LL ans=1;LL p=x;
	if(m==0){ while(n>0){if(n&1==1){ans*=p;} p*=p; n>>=1;}}
	else{ while(n>0){if(n&1==1){ans=(ans*p)%m;} p=(p*p)%m ;n>>=1;}}
	return ans;
}

LL factorial(int x,int m=0){
	LL a=1;
	if(m==0){REPD2(i,x,1){a*=i;}}else{REPD2(i,x,1){a=(a*i)%m;}}
	return a;
}

LL modInv(LL x,int m){return BMPow(x,m-2,m);}

int main(){
	int x,y;
	cin>>x>>y;
	if((x+y)%3!=0){
		cout<<0<<endl;
		return 0;
	}
	int n = (1./3.)*(2*y-x);
	int m = (1./3.)*(2*x-y);

	if(n<0 || m<0){
		cout<<0<<endl;
		return 0;
	}

  	cout<<(factorial(n+m,MOD)*(modInv((factorial(n,MOD)*factorial(m,MOD))%MOD,MOD)))%MOD<<endl;
	
	return 0;
}

Measured memory_bytes: 256