akhauriyash/Code-Regression huggingface dataset:
// import chie template :) {{{
import std.stdio, std.algorithm, std.array, std.string, std.math, std.conv,
    std.range, std.container, std.bigint, std.ascii, std.typecons;

// }}}
// nep.scanner {{{
class Scanner
{
    import std.stdio : File, stdin;
    import std.conv : to;
    import std.array : split;
    import std.string : chomp;

    private File file;
    private char[][] str;
    private size_t idx;

    this(File file = stdin)
    {
        this.file = file;
        this.idx = 0;
    }

    private char[] next()
    {
        if (idx < str.length)
        {
            return str[idx++];
        }

        char[] s;
        while (s.length == 0)
        {
            s = file.readln.chomp.to!(char[]);
        }

        str = s.split;
        idx = 0;

        return str[idx++];
    }

    T next(T)()
    {
        return next.to!(T);
    }

    T[] nextArray(T)(size_t len)
    {
        T[] ret = new T[len];

        foreach (ref c; ret)
        {
            c = next!(T);
        }

        return ret;
    }

    void scan()()
    {
    }

    void scan(T, S...)(ref T x, ref S args)
    {
        x = next!(T);
        scan(args);
    }
}
// }}}

void main()
{
    auto cin = new Scanner;
    int n;
    cin.scan(n);
    auto ar = new long[][](2, n);
    long res = -1;
    ar[0] = cin.nextArray!long(n);
    ar[1] = cin.nextArray!long(n);
    foreach (i; 0 .. n)
    {
        res = max(res, ar[0][0 .. i + 1].sum + ar[1][i .. n].sum);
    }
    writeln(res);
}


Measured memory_bytes: 256
ans = 0
Ri = 0 # 10 - inputを10で割ったあまり
Rm = 0 # 10 - inputを10で割ったあまりの最大値

for _ in range(5):
	I = int(input())

	# 調理後の待ち時間がある場合はその時間を算出
	if I%10 != 0:
		Ri = 10 - I%10

	# 調理時間を10分単位で加算
	ans += 10 * ((I + 9)//10) 

	# 調理後の待ち時間の最大値を入れ替え
	if Ri > Rm:
		Rm = Ri 

# 調理時間の合計から、待ち時間の最大値を引き答えとする
ans = ans - Rm

# 解答
print(ans)

Measured memory_bytes: 3060
#include <iostream>

int main() {

    char s[4];
    std::cin >> s;

    int a1 = s[0] - '0';
    int a2 = s[1] - '0';
    int a3 = s[2] - '0';
    int a4 = s[3] - '0';
    int front = a1 * 10 + a2;
    int back =a3 * 10 + a4;

    //YYMMである
    if(front == 0 || (front > 12 && front <= 99) ){//YYMMの可能性がある
        if(back > 0 && back < 13){
            std::cout << "YYMM" << std::endl;
        }else {//MMが00はありえない->NO
            std::cout << "NA" << std::endl;
        }
    }else {//MMYYの可能性がある
        if(back > 0 && back < 13){
            std::cout << "AMBIGUOUS" << std::endl;
        }
        else  {
            std::cout << "MMYY" << std::endl;
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
#define prtd(var, i) cout << fixed << setprecision(i) << var << endl;
#define ll long long
#define P pair<int, int>
using namespace std;
 
int main(){
    int n;
    cin >> n;
    vector<int> A(n+1);
    for(int i = 1; i <= n; i++){
        int a;
        cin >> a;
        A[i] = a;
    }
    int cnt = 0;
    for(int i = 1; i <= n; i++){
        int tmp = A[i];
        if(i == A[tmp]) cnt++;
    }
    cout << cnt/2 << endl;
    return 0;
}

Measured memory_bytes: 3732
// Contest: AtCoder Beginner Contest 156 (https://atcoder.jp/contests/abc156)
// Problem: A: Beginner (https://atcoder.jp/contests/abc156/tasks/abc156_a)


// region {{{ boilerplate
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <chrono>
#include <cstdint>
#include <deque>
#include <exception>
#include <forward_list>
#include <functional>
#include <initializer_list>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <limits>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

#if __cplusplus >= 201703L
#   include <optional>
#   include <string_view>
#   include <variant>
#endif

using namespace std;

#if __cplusplus >= 201703L
#   define all(a)      begin(a),end(a)
#   define sz(x)       ((int)size(x))
#else
#   define all(a)      (a).begin(),(a).end()
#   define sz(x)       ((int)(x).size())
#endif

#define rep(a, b)      for(int a = 0; a < (b); ++a)
#define reps(a, b, c)  for(int a = (b); a < (c); ++a)
#define trav(a, b)     for(auto& a : b)

using ll = long long;
using ld = long double;
using u64 = uint64_t;
using u32 = uint32_t;

using pi = pair<int, int>;
using pl = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vpi = vector<pi>;

#if __cplusplus >= 201703L
#   define MAYBE_UNUSED [[maybe_unused]]
#else
#   define MAYBE_UNUSED
#endif

MAYBE_UNUSED static constexpr int INF = (int)1e9 + 5;
MAYBE_UNUSED static constexpr ll INFL = (ll)1e18 + 5;
MAYBE_UNUSED static mt19937 rng((u32)chrono::duration_cast<chrono::nanoseconds>(chrono::high_resolution_clock::now().time_since_epoch()).count());
//endregion }}}

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

    int n, r; cin >> n >> r;
    if (n >= 10)
        cout << r << '\n';
    else {
        cout << (r + 100 * (10 - n)) << '\n';
    }

    return 0;
}

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

int main(){
    priority_queue<int> PQ;
    
    char com[10];
    int key;
    while(1){
        cin >> com;
        if(com[0]=='i'){
            cin >> key;
            PQ.push(key);
        }else if(com[1]=='x'){
            cout << PQ.top() << endl;
            PQ.pop();
        }else if(com[1]=='n'){
            break;
        }
    }
    
    return 0;
}

Measured memory_bytes: 6932
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
 #define int long long

#define all(X) (X).begin(), (X).end()
#define reset(X) memset(X, 0, sizeof(X))
#define mp(a, b) make_pair(a, b)
#define pb push_back
#define endl '\n'
#define fi first
#define se second


using namespace __gnu_pbds;
using namespace std;
// const int mod=1e9+7;
 const int mod=998244353;
 // const int mod=1e9+9;
// const int INF=4e18+10;
const int INF=4e18+10;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template <typename T>
using ordered_multiset = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define read(n) int n; cin>>n;
#define readv(x, n) vector<int> x(n); for(auto &i:x) cin>>i;


typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef pair<int, int> pii;

template<typename T1,typename T2>
void set_min(T1& a, T2 b)
{
    a=min(a, (T1)b);
}


int multiply(int a, int b, int in_mod){return (a*b)%in_mod;}
int mult_identity(int a){return 1;}


auto power(auto a, int b, int in_mod)
{
    auto prod=mult_identity(a);
    auto mult=a%in_mod;
    while(b!=0)
    {
        if(b%2)
        {
            prod=multiply(prod,mult, in_mod);

        }
        mult=multiply(mult, mult,in_mod);
        b/=2;
    }
    return prod;
}
int mod_inv(int q, int in_mod)
{

    return power(q, in_mod-2,in_mod);
}



void solve()
{
    int n;
    cin>>n;
    vector<string > data(n);
    for(int i=0;i<n;i++)
        cin>>data[i];


    string mx="";
    vector<int> count(26, INF);
    for(int i=0;i<n;i++)
    {
        vector<int> inner_count(26, 0);

        for(auto j:data[i])
            inner_count[j-'a']++;
        for(int i=0;i<26;i++)
        {
            count[i] = min(count[i], inner_count[i]);
        }
    } 


    for(int i=0;i<26;i++)
    {
        mx+=string(count[i], 'a'+i);
    }

    cout<<mx<<endl;
}

signed main()

{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    #ifndef ONLINE_JUDGE
    if(fopen("INPUT.txt","r"))
    {
        freopen ("INPUT.txt" , "r" , stdin);
        freopen ("OUTPUT.txt" , "w" , stdout);
    }
    #endif
    auto clk=clock();
    mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
    // -------------------------------------Code starts here---------------------------------------------------------------------

    int t=1;
    // cin>>t;
    for(int test=1;test<=t;test++)
    {
        // cout<<"Case #"<<test<<": ";
        // cout<<endl;
        solve();
        // cout<<endl;

    }

    // -------------------------------------Code ends here------------------------------------------------------------------


    clk = clock() - clk;
    cerr << fixed << setprecision(6) << "Time: " << ((double)clk)/CLOCKS_PER_SEC << "\n";
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define npos std::string::npos
#define sortv(v) sort(v.begin(), v.end())
typedef long long ll;
using namespace std;
int main()
{
	int a, p;
  	cin >> a >> p;
  	cout << (a * 3 + p) / 2 << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
const ll mod=1000000007;
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;
int h,w,a[50][50];
int dy[8]={-1,-1,-1,0,0,1,1,1},dx[8]={-1,0,1,-1,1,-1,0,1};
ll uni[2500];
ll root(ll u){
    if(uni[u]<0)return u;
    return uni[u]=root(uni[u]);
}

void connect(int a,int b){
    a=root(a);
    b=root(b);
    if(a==b)return;
    if(uni[a]>uni[b]){
        a^=b;
        b^=a;
        a^=b;
    }
    uni[a]+=uni[b];
    uni[b]=a;
    return;
}
ll size(ll u){
    return -uni[root(u)];
}

int main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    vector<int> v;
    while(1){
    	cin>>w>>h;
    	if(!(h||w))break;
    	for(int i=0;i<h;i++){
    		for(int j=0;j<w;j++){
    			cin>>a[i][j];
    			uni[j*h+i]=(a[i][j])?-1:0;
    		}
    	}
    	for(int i=0;i<h;i++){
    		for(int j=0;j<w;j++){
    			if(a[i][j]){
    				for(int k=0;k<8;k++){
    					int x=dx[k]+j;
    					int y=dy[k]+i;
    					if(x<0||x>=w||y<0||y>=h)continue;
    					if(a[y][x]){
    						connect(j*h+i,x*h+y);
    					}
    				}
    			}
    		}
    	}
    	int ans=0;
    	for(int i=0;i<h;i++){
    		for(int j=0;j<w;j++){
    			if(a[i][j]&&uni[j*h+i]<0)ans++;
    		}
    	}
    	v.pb(ans);
    }
    for(auto& i:v)cout << i<<endl;
    return 0;
}




Measured memory_bytes: 3196
// include
// ------------------------------------------------
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <math.h>

using namespace std;

// func
// ------------------------------------------------
int CalcSumOfDigit(int n);      // 各桁の和を計算する。
string upper(string str);       // 英字を大文字に変換する。
string lower(string str);       // 英字を小文字に変換する。

// define
// ------------------------------------------------
#define all(a)        (a).begin(),(a).end()
#define rall(a)       (a).rbegin(),(a).rend()
#define pb            push_back
#define sz(a)         int((a).size())
#define rep(i,n)      for(int(i)=0;(i)<(n);(i)++)
#define repe(i,n)     for(int(i)=0;(i)<=(n);(i)++)
#define vsort(v)      sort((v).begin(),(v).end())
#define rvsort(v)     sort(rall((v)))
#define vi            vector<int>
#define GCD(a,b)      __gcd((a),(b))
#define LCM(a,b)      (a)/GCD((a),(b))*(b)

const int INF = 1e9;

// code
// ------------------------------------------------
int main() {

  int d;
  cin >> d;

  if(d == 25)
    cout << "Christmas";
  else if ( d == 24)
    cout << "Christmas Eve";
  else if ( d == 23)
    cout << "Christmas Eve Eve";
  else
  {
    cout << "Christmas Eve Eve Eve";
  }
  

  return 0;
}

// funcの実体
// ------------------------------------------------
int CalcSumOfDigit(int n)
{
  int s = 0;
  while(n)
  {
    s += n % 10;
    n = n / 10;
  }
  return s;
}

string upper(string str)
{
  for(auto itr = str.begin();itr != str.end() ; itr++)
  {
    if(97 <= *itr && *itr <= 122)
    {
      *itr = *itr - 32;
    }
  }
  return str;
}

string lower(string str)
{
  for(auto itr = str.begin();itr != str.end() ; itr++)
  {
    if(65 <= *itr && *itr <= 90)
    {
      *itr = *itr + 32;
    }
  }
  return str;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
void ABC130(void);
void ABC131(void);
void ABC132(void);
void ABC133(void);
void ABC134(void);
void ABC135(void);
void ABC136(void);
void ABC137(void);
void ABC138(void);
void ABC139(void);

int main(void){
    ABC134();
}

void ABC134(){
    int r;
    cin>>r;
    cout<<3*r*r<<endl;
}

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

int main() {
    int N, K;
    cin >> N >> K;
    vector<int> v(26, 0);
    for(int i=0; i<N; ++i) {
        string p;
        cin >> p;
        v[p[0] - 'A']++;
    }
    int ret = 0;
    for(int i=0; i<N; i+=K) {
        sort(v.begin(), v.end(), greater<int>());
        int cnt = 0;
        for(int j=0; j<v.size(); ++j) {
            if(v[j] != 0) {
                v[j]--;
                cnt++;
            }
            if(cnt == K) {
                ret++;
                break;
            }
        }
        if(cnt < K) {
            break;
        }
    }
    cout << ret << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <map>
#include <set>
#include <stack>
#include <queue>
 
using namespace std;
 
#define pb(n)	push_back(n)
#define mp(n,m) make_pair(n,m)
#define fi 	first
#define se 	second
#define all(r) (r).begin(),(r).end()

#define rep(i,n) for(int i=0; i<(n); i++)
#define repc(i,a,b) for(int i=(a); i<(b); i++)

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
 
const int IMAX=((1<<30)-1)*2+1;
const double EPS=1e-10;
//int mod=1000000007

int h,w;
string s[110];

vector<vi> v(110,vi(110,0));
int ans;

int dx[4]={1,-1,0,0};
int dy[4]={0,0,-1,1};

void init(){
	rep(i,h)rep(j,w)v[i][j]=0;
	ans=0;
}

void calc(int y,int x,char c){
	if(y>=h||x>=w||y<0||x<0)return;
	if(v[y][x]==1)return;
	if(c!='?'&&s[y][x]!=c)return;
	v[y][x]=1;
	if(c=='?')ans++;
	rep(i,4){
		calc(y+dy[i],x+dx[i],s[y][x]);
	}
}


int main(){
	while(cin>>h>>w && h>0 && w>0){
		rep(i,h)cin>>s[i];
		init();
		rep(i,h){
			rep(j,w)calc(i,j,'?');
		}
		cout<<ans<<endl;
	}
}

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

int hi,fu,mi;

int main(){

	cin>>hi>>fu>>mi;
    if((hi==5&&fu==5&&mi==7)||(hi==5&&fu==7&&mi==5)||(hi==7&&fu==5&&mi==5))cout<<"YES"<<endl;
	else	cout<< "NO"<<endl;
	}


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

int main() {
	int n;
	while (cin >> n, n) {
		vector<pair<int, int>> b;
		for (int i = 0; i < n; i++) {
			int v, l;
			cin >> v >> l;
			b.emplace_back(l, v);
		}
		sort(b.begin(), b.end());

		cout << [&b] () {
			int s = 0;
			for (auto& p : b) {
				s += p.second;
				if (s > p.first) {
					return "No";
				}
			}
			return "Yes";
		}() << endl;
	}
	return 0;
}

Measured memory_bytes: 1192
#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <string>
using namespace std;
typedef long long int ll;
#define rep(i, n) for (int(i) = 0; (i) < (n); (i)++)

int main(){
    int n;
    string s;
    cin >> n >> s;
    if(n%2!=0){
        cout << "No" <<endl;
        return 0;
    }
    string t;
    rep(i,n/2){
        t[i] = s[i];
        t[(n/2)+i]=s[i];
    }
    rep(i,n){
        if(s[i]!=t[i]){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" <<endl; 

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>

using namespace std;

int main()
{
    int n;
    int a[10000];
    scanf("%d",&n);
    for(int i=0;i<n;i++)
        scanf("%d",&a[i]);
    int cnt;
    cnt=0;
    for(int i=0;i<n;i++)
    {
        if(a[i]%2!=0) continue;
        else
        {

          while(a[i]%2==0) {cnt++;a[i]/=2;}
        }
    }
    printf("%d\n",cnt);
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
 
int main(void) {
    unsigned long long n;
    unsigned long long kake;
    unsigned long long kosuu;
    unsigned long long i;
    unsigned long long kakeru;
    while(1) {
        scanf("%llu",&n);
        if(n==0)break;
        kosuu=0;kake=1;
        for(i=1;i<=n;i++) {
            kakeru=i;
            while(kakeru%10==0) {
                kakeru/=10;
                kosuu++;
            }
            kake*=kakeru;
            kake=kake%1000000000000000LL;
            while(kake%10==0) {
                kake/=10;
                kosuu++;
            }
        }
        printf("%llu\n",kosuu);
    }
    return 0;
}

Measured memory_bytes: 608
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace atcoder;
using namespace std;
using ll = long long; using P = pair<int,int>;
using vl = vector<ll>; using vvl = vector<vl>;
#define mp make_pair
#define pb push_back
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define rrep(i,n) for (int i=(n-1);i >= 0;i--)
#define all(v) v.begin(),v.end()
#define sz(v) (int)((v).size())
#define MAX(v) *max_element(all(v))
#define MIN(v) *min_element(all(v))
#define Sort(v) sort(all(v))
#define Rev(v) reverse(all(v))
#define vec(type,name,...) vector<type> name(__VA_ARGS__)
#define VEC(type,name,size) vector<type> name(size);in(name)
#define vv(type,name,h,...) vector<vector<type>>name(h,vector<type>(__VA_ARGS__))
#define VV(type,name,h,w) vector<vector<type>>name(h,vector<type>(w));in(name)
void debug_out() { cout << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
    cout << H << " ";
    debug_out(T...);
}
#ifdef _DEBUG
#define debug(...) debug_out(__VA_ARGS__)
#else
#define debug(...) 
#endif
template <typename T>
std::ostream& operator<<(std::ostream& os, std::vector<T> vec) {
    for (std::size_t i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
    return os;
}
inline void IN(void){return;}
template <typename First, typename... Rest>
void IN(First& first, Rest&... rest){cin >> first;IN(rest...);return;}
template<class T>bool chmax(T &a, const T &b) {if(a<b){a=b; return 1;} return 0;}
template<class T>bool chmin(T &a, const T &b) {if(b<a){a=b; return 1;} return 0;}
const ll INF = 1LL << 60;
const ll mod = 1000000007;
const int dx[8] = {1,0,-1,0,1,1,-1,-1}; const int dy[8] = {0,1,0,-1,1,1,-1,-1};

int main(){
    cin.tie(0); ios::sync_with_stdio(false);
    int k; cin >> k;
    string s = "ACL";
    rep(i, k) cout << s;
    cout << endl;
}

Measured memory_bytes: 3676
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
	ll n,d;
	cin>>n>>d;
	int c=0;
	for(int i=0;i<n;i++){
		ll a,b;
		cin>>a>>b;
		if(a*a+b*b<=d*d){
			c+=1;
		}
	}
	cout<<c;
	return 0;
}

Measured memory_bytes: 3636
def input_n
  gets.to_i               # 単一整数
end

def input_s
  gets.chomp              # 文字列。chompを付けないと改行文字がついてくる
end

def input_a
  gets.split.map(&:to_i)  # スペースで区切られた複数の整数
end

def input_o(num)
  num.times.map { gets.to_i }  # 縦に並んだ複数の整数。たまにある
end

def output_f(num)
  puts sprintf("%.12f", num)
end

H, W = input_a
h, w = input_a

puts (H - h) * (W - w)


Measured memory_bytes: 1788
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {

    Scanner sc = new Scanner(System.in);

    int n = sc.nextInt();
    int k = sc.nextInt();

    if (k == 1) {
      System.out.println(0);
    } else {
      System.out.println(n - k);
    }

  }
}

Measured memory_bytes: 35708
#include <stdio.h>

int main(void)
{
	int n,i,cntR=0,cntB=0;
	char s[100];
	
	scanf("%d",&n);
	scanf("%s",s);
	
	i=0;
	while(s[i] != '\0'){
		//printf("%c\n",s[i]);
		if(s[i] == 'R'){
			cntR++;
		}else if(s[i] == 'B'){
			cntB++;
		}
		i++;
	}
	if(cntR > cntB){
		printf("Yes\n");
	}else{
		printf("No\n");
	}
		
	return 0;
}


Measured memory_bytes: 128
#include <iostream>

using namespace std;

static const int MAX_L = 1000000;
static const int MAX_M = 100000;
static const int MAX_N = 100000;

int main(int argc, char** argv)
{
	int L, M, N;
	int c, save;
	bool is_ok;

	while( 1 )
	{
		cin >> L;
		if(L==0) break;
		
		save = 0;
		c = 0;
		is_ok = false;
		for(int i=0; i<12; i++)
		{
			cin >> M;
			cin >> N;
			save += M - N;

			if(save >= L)
			{
				if(!is_ok) c = i+1;
				is_ok = true;
			}
		}

		if(is_ok) cout << c << endl;
		else cout << "NA" << endl;
	}

	return 0;
}

Measured memory_bytes: 0
n = int(input())
F = [list(map(int, input().split())) for _ in range(n)]
P = [list(map(int, input().split())) for _ in range(n)]

def score(_bin, F, P):
    score = 0
    for j, f in enumerate(F):
        hit_counter = 0
        for i in range(10):
            if _bin>>i & 1 and f[i] == 1:
                hit_counter += 1
        score += P[j][hit_counter]
    return score

max_score = -1<<30
for i in range(1,1<<10):
    max_score = max(max_score, score(i, F, P))

print(max_score)


Measured memory_bytes: 3064
#include <stdio.h>
#include <string.h>
int main(void){   
    char str1[100],str2[100];
    char buf[4096];
    scanf("%s",str1);   
    scanf("%s",str2);   
    if(strlen(str1)+strlen(str1)<=200){
        sprintf(buf,"%s%s", str1, str1);
        if(strstr(buf,str2)==NULL){           
            printf("No\n");       
        }       
        else{           
            printf("Yes\n");       
        }   
    }   
    return 0;
}


Measured memory_bytes: 2140
h,w=map(int,input().split())
A=[list(input()) for i in range(h)]
B=[]
C=[]
for i in range(h):
    if (set(A[i]))!={'.'}:
        B.append(A[i])
B=list(map(list, zip(*B)))
h_=len(B)
for i in range(h_):
    if set(B[i])!={'.'}:
        C.append(B[i])
C=list(map(list, zip(*C)))
h__=len(C)
for i in range(h__):
    print(''.join(map(str,C[i])))

Measured memory_bytes: 3316
#include <string>
#include <vector>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <queue>
#include <map>
#include <set>
#include <iostream>
#include <sstream>
#include <cstring>
#include <numeric>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define F0(i,n) for (int i = 0; i < n; i++)
#define F1(i,n) for (int i = 1; i <= n; i++)
#define CL(a,x) memset(x, a, sizeof(x));
#define SZ(x) ((int)x.size())
const double eps = 1e-10;
const int MOD = 1000000007;
int i, j, k, m, n, l;
ll ans;

double solve(double a, double b, double c) {
	double alpa = acos((b*b + c*c - a*a) / (2 * b*c));
	double beta = acos((a*a + c*c - b*b) / (2 * a*c));
	return c / (2 + 1 / tan(alpa / 2) + 1 / tan(beta / 2));
}

int main() {
	//freopen("x.in", "r", stdin);

	double x1, y1, x2, y2, x3, y3;
	cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;

	double a = hypot(x1 - x2, y1 - y2), b = hypot(x1 - x3, y1 - y3), c = hypot(x2 - x3, y2 - y3);

	double r1 = solve(a, b, c);
	double r2 = solve(b, c, a);
	double r3 = solve(c, a, b);

	double r = max(r1, r2);
	r = max(r, r3);
	printf("%.10lf\n", r);

	return 0;
}


Measured memory_bytes: 384
#include "bits/stdc++.h"
#include <math.h>
#include <time.h>
using namespace std;
void solve(){
    int n;
    string s;
    cin >> n;
    cin >> s;
    bool ck100;
    int size = s.size();
    int ans = 0;
    for(int i = 0; i < 10; i++){//100の位が0-9のそれぞれについて判定
        ck100 = false;
        vector<bool>tencount(10);//0-9
        vector<bool>onecount(100);//0-99
        for(int j = 0; j < size; j++){
            if(!ck100){
                if(s.at(j) - '0' == i){
                    ck100 = true;//もしiを見つけたらtrueにする
                }
            }
            else{
                    for(int k = 0; k < 10; k++){
                        if(tencount.at(k)){//10の位のカウントがつけられているものに対して
                            onecount.at(k * 10 + s.at(j) - '0') = true;
                        }
                    }
                if(!tencount.at(s.at(j) - '0')){//初出なら10の位カウントをつける
                    tencount.at(s.at(j) - '0') = true;
                }
            }
        }
        for(int l = 0; l < 100; l++){
            if(onecount.at(l)){
                ans++;
            }
        }
    }
    cout << ans << endl;

}
int main(){
    solve();
    return 0;
}


Measured memory_bytes: 256
/*CODED BY

|||||||THE LNM INSTITUTE OF INFORMATION TECHNOLOGY||||||||||||


  *****                   <<<<<<<<<<*>>>>>>>>>
  *******                 ********************
  ***   ***                        ***
  ***    ***                       ***
  ***     ***    **************    ***
  ***      ***   *DARSHAN JAIN*    ***
  ***      ***   **************    ***
  ***      ***                     *** 
  ***     ***                      ***  
  ***    ***              ***      ***
  ***   ***      ****      ***     ***       ****
  *******        |19|       ***   ***        |19|
  *****          ****          ***           ****


|||||||THE LNM INSTITUTE OF INFORMATION TECHNOLOGY||||||||||||  

*/



#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define M 1000000007
#define mint INT_MAX;
#define checkloop cout<<"i="<<i<<"     "<<"j="<<j<<endl;
#define checkvalue(qq,ww) cout<<"value1="<<qq<<"     "<<"value2="<<ww<<endl;
#define output(out) cout<<out<<endl;
#define linechange cout<<endl;
#define space cout<<"\t";
#define testoutput(first,out) cout<<first<<"===="<<out<<endl;
ll t,inp,inp1,inp2,n;
ll count=0;
#define ull unsigned long long int
ll dp1[1000000+6];
ll max=0;
int main() 
{
  ll t,n;
  cin>>t>>n;

  if(t<=2*n)
    cout<<"0"<<endl;
  else
    cout<<t-2*n<<endl;
}


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

int main()
{
    int h, w;

    while ((cin >> h >> w), h != 0 || w != 0) {
        for (int x = 0; x < w; ++x) {
            cout << "#";
        }

        cout << endl;

        for (int y = 1; y < h - 1; ++y) {
            cout << "#";

            for (int x = 1; x < w - 1; ++x) {
                cout << ".";
            }

            cout << "#" << endl;
        }

        for (int x = 0; x < w; ++x) {
            cout << "#";
        }

        cout << endl << endl;
    }


    return 0;
}

Measured memory_bytes: 1152
#include <bits/stdc++.h>
#include <cstring>
#include <limits>
using namespace std;
#define ll long long int
#define lli long long int
#define fw(i, s, e) for (ll i = s; i < e; ++i)
#define fe(i, s, e) for (ll i = s; i <= e; ++i)
#define fb(i, e, s) for (ll i = e; i >= s; --i)
#define L(T)  \
    ll T;     \
    cin >> T; \
    while (T--)
#define FASTIO                   \
    ios::sync_with_stdio(false); \
    cin.tie(nullptr);            \
    cout.tie(nullptr);
#define mem(a, i) memset(a, i, sizeof(a))
#define ld long double
#define endl "\n"
#define in(P) \
    ll P;     \
    cin >> P;
int main()
{
    FASTIO
    // L(T)
    {
        char c;
        cin >> c;
        char a = c + 1;
        cout << a << endl;
    }
    return 0;
}

Measured memory_bytes: 3544
#include <bits/stdc++.h>
typedef long long int ll;
typedef long double ld;
#define pb push_back
#define pii pair < int, int >
#define F first
#define S second
#define int  long long int
#define sync ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#pragma GCC optimize ("Ofast")
#pragma GCC optimize ("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
const int N=2e5+100;
int32_t main(){
    ll n;
    cin >> n;
    string s;
    cin >> s;
    if (n%2==1){
        cout << "No" ;
        return 0;
    }
    for (int i=0;i<n/2;i++){
        if (s[i]!=s[i+n/2]){
            //cout << s[i] << " " << s[i+n/2] << endl;
            cout << "No";
            return 0;
        }
    }
    cout << "Yes";
}


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

using namespace std;
 
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}
#define pb push_back;
#define mp make_pair;
#define fi first;
#define se second;
#define all(x) (x).begin(), (x).end()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define forin(i, n) for (auto& i : (n))
#define make_unique(x) sort(all((x))); (x).erase(unique(all((x))), (x).end()

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

const int INF = 1 << 29;
const int MOD = 1e9 + 7;
 
int main() {
  double n;
  cout << setprecision(8);
  cin >> n;
  cout << ceil(n/2.0) / n << '\n';
}


Measured memory_bytes: 256
#pragma GCC optimze("Ofast")
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
using namespace std;
using namespace __gnu_pbds;
#define ll long long
#define pp pair<ll,ll>
#define ppp pair<ll,pp >
#define trace(...) cout<<"Line:"<<__LINE__<<" "; __f(#__VA_ARGS__, __VA_ARGS__)
template<typename Arg1>
void __f(const char* name, Arg1&& arg1) {
	cout<<name<<" : "<<arg1<<endl;
}
template<typename Arg1, typename ... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
	const char* comma=strchr(names+1,',');
	cout.write(names,comma-names)<<" : "<<arg1<<" | ";
	__f(comma+1,args...);
}
typedef tree<pp,null_type,less<pp>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
#define ld long double
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define rep(i,a,b) for(ll i=a;i<b;i+=1)
#define sz(v) (ll)(v.size())
#define hell (ll)1000000007
#define slld(x) scanf("%lld",&x)
ll t=1, tt;
const ll inf=1e18, N=3005;
inline ll mult(ll x,ll y){x%=hell;y%=hell;return (1LL*x*y)%hell;}
inline ll add(ll x,ll y){x+=y;return x%hell;}
inline ll powMod(ll base,ll expo){
	if(base==0)return 0;
	ll ans=1;
	while(expo){
		if(expo&1)ans=mult(ans,base);
		base=mult(base,base); 
		expo>>=1;
	}
	return ans;
}
void solve(){
	ll n, cost, m, ans=inf, k;
	cin>>n>>m>>k;
	vector<vector<ll> > v;
	rep(i,0,n){
		cin>>cost;
		vector<ll> tmp(m);
		for(auto &x : tmp)cin>>x;
		tmp.pb(cost);
		v.pb(tmp);
	}
	rep(i,0,(1<<n)){
		ll cur=0;
		vector<ll> tmp(m,0);
		rep(j,0,n){
			if((i>>j)&1){
				rep(u,0,m)tmp[u]+=v[j][u];
				cur+=v[j][m];
			}
		}
		ll f=1;
		rep(j,0,m)
			if(tmp[j]<k)f=0;
		if(f)ans=min(ans,cur);
	}
	ans<inf?cout<<ans:cout<<"-1";
}
signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
   	//cin>>t;
   	tt=t;
    while(t--){
        solve();
        if(t)cout<<"\n";
    }
    return 0 ;
}


Measured memory_bytes: 3664
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <cmath>
#include <queue>
#include <set>

using namespace std;
typedef long long ll;
#define INF int(1e9)
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define REPR(i, n) for(int i = n - 1; i >= 0; i--)
#define REPONE(i, n) for(int i = 1; i <= (int)(n); i++)
#define EACH(i, mp) for(auto i:mp)
#define FOR(i, m, n) for(int i = m;i < n;i++)

int main() {
    int N;
    cin >> N;
    int ans = 111;
    for (int i = 111; i < 1000; i += 111) {
        ans = i;
        if (i >= N) break;
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N, a, b, c, d;
  cin >>N;
 
a=N/1000;
b=N%1000/100;
c=N%1000%100/10;
d=N%1000%100%10;  

  if ((a==b && b==c) ||( b==c && c==d)){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
  string str;
  cin>>str;
  vector<int> v;
  int res=0;
  for(int i=0;i<3;i++)
  {
    if(str[i]=='R')
      res++;
   else
     res=0;
    v.push_back(res);
   }
  cout<<*max_element(v.begin(),v.end());
  return 0;
}

Measured memory_bytes: 3624
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		solve0500();
	}

	public static void solve0500() {
		Scanner sc = new Scanner(System.in);

		while (true) {
			int n = sc.nextInt();
			if (0 == n) {
				break;
			}

			int scoreA = 0;
			int scoreB = 0;

			for (int i = 0; i < n; i++) {
				int cardA = sc.nextInt();
				int cardB = sc.nextInt();
				if (cardA == cardB) {
					scoreA += cardA;
					scoreB += cardB;
				} else if (cardA > cardB) {
					scoreA += cardA + cardB;
				} else {
					scoreB += cardA + cardB;
				}
			}
			System.out.println(scoreA + " " + scoreB);
		}

		sc.close();
	}

}



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

ans1 = 0
ans2 = 0
a1 = a[:]
a2 = a[:]
num1 = 0
num2 = 0

for i in range(n):
    if i % 2 == 0:
        if num1 + a1[i] > 0:
            num1 += a1[i]

        else:
            ans1 += abs(a1[i] - (1 - num1))
            a1[i] = 1 - num1
            num1 = 1

        if num2 + a2[i] < 0:
            num2 += a2[i]

        else:
            ans2 += abs(a2[i] + 1 + num2)
            a2[i] = -1 -num2
            num2 = -1

    else:
        if num1 + a1[i] < 0:
            num1 += a1[i]

        else:
            ans1 += abs(a1[i] + 1 + num1)
            a1[i] = -1 -num1
            num1 = -1

        if num2 + a2[i]  > 0:
            num2 += a2[i]
        else:
            ans2 += abs(a2[i] -1 + num2)
            a2[i] = 1 - num2
            num2 = 1

print(min(ans1, ans2))

Measured memory_bytes: 14468
a,b,k = map(int,input().split())
List =[]

ans = []

for i in range(a,min(a+k,b+1)):
    ans.append(i)
for i in range(b,max(b-k,a),-1):
    ans.append(i)

ans = list(set(ans))
ans.sort()
for i in ans:
    print(i)



Measured memory_bytes: 3060
//#pragma comment(linker, "/STACK:1024000000,1024000000")
#include<bits/stdc++.h>
using namespace std;
function<void(void)> ____ = [](){ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);};
int x,y;
typedef long long int LL;
const LL mod = 1e9+7;
LL qpow(LL a, LL b){
    LL res = 1;
    while(b){
        if(b&1) res = res*a%mod;
        b >>= 1;
        a = a*a%mod;
    }
    return res;
}
LL C(LL n, LL m){
    LL ans = 1;
    m = max(m,n-m);
    for(int i=1; i<=m; i++) ans = ans*((n+i-m)*qpow(i, mod-2)%mod)%mod;
    return ans;
}
int main(){
    cin >> x >> y;
    int t = (x+y)/3;
    if((x+y)%3!=0) return cout << 0 << endl,0;
    int q = 2 * t - x; //杨辉三角第t层第q+1个数 C(t,q) //t!/(q!*(t-q)!)
    cout << C(t,q) << endl;
    //cout << fact(t)*qpow(fact(q)*fact(t-q)%mod,mod-2)%mod << endl;
    return 0;
}

Measured memory_bytes: 764
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;

public class Main {
	static String s, s2;
	static int[][] memo;
	static BufferedReader br;
	static PrintWriter out;
	static final int uncal = -1;
	public static void main(String[] args)throws Exception {
		// TODO Auto-generated method stub
		br = new BufferedReader(new InputStreamReader(System.in));
		out = new PrintWriter(System.out);
		s = br.readLine();
		s2 = br.readLine();
		int i = s.length();int j = s2.length();
		memo = new int[i][j];
		for(int[]a:memo)
			Arrays.fill(a, uncal);
		findLCS(0, 0);
		trace(0, 0);
		out.close();
	}
	static int findLCS(int i,int j) {
		if(i == s.length() || j == s2.length())
			return 0;
		if(memo[i][j] != uncal)
			return memo[i][j];
		if(s.charAt(i) == s2.charAt(j))
		{
			return memo[i][j] = 1 + findLCS(i+1, j+1);
		}
		int choice1 = findLCS(i+1, j);
		int choice2 = findLCS(i, j+1);
		return memo[i][j] = Math.max(choice1, choice2);
	}
	static void trace(int i,int j) {
		if(i == s.length() || j == s2.length()) return;
		int opt = findLCS(i, j);
		if(s.charAt(i) == s2.charAt(j) && findLCS(i+1, j+1) == opt-1) {
			out.print(s.charAt(i));
			trace(i+1, j+1);
			return;
		}
		if(findLCS(i+1, j) == opt) {
			trace(i+1, j);
			return;
		}
		if(findLCS(i, j+1) == opt)
			trace(i, j+1);
	}
}


Measured memory_bytes: 84732
import java.util.Scanner;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N=sc.nextInt();
    int array[]=new int[N];
    int count=0;
    for(int i=0;i<N;i++) array[i]=sc.nextInt();
    while(true){
      int check=0;
      for(int i=0;i<N-1;i++){
        if(array[i]>array[i+1]){
          check+=1;
          int c=array[i];
          array[i]=array[i+1];
          array[i+1]=c;
          count+=1;
        }
      }
      if(check==0) break;
    }
    for(int i=0;i<N-1;i++) System.out.print(array[i]+" ");
    System.out.println(array[N-1]+"\n"+count);
    sc.close();
  }
}


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

const int MAX = 1e5 + 5;
int dp[MAX];

int main() {

  int n;
  int h[MAX];

  cin >> n;

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

  dp[0] = 1e9;

  // 必ず"足場1"から始まるためi=2に設定(場合によって"足場2"から始まってしまう場合があるから)
  for ( int i = 2; i <= n; ++i ) {
    // absは絶対値
    // 
    dp[i] = min ( dp[i-2] + abs(h[i-2] - h[i]), 
                  dp[i-1] + abs(h[i-1] - h[i]) );
  }

  cout << dp[n] << endl;

  return 0;

}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
long long inf=(long long)1E17;
#define i_7 (long long)(1E9+7)
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
using namespace std;
bool prime(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}

long long gcd(long long a, long long b){
  if(a<b){
    swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd(b,a%b);
  }
}
 
long long lcm(long long x, long long y){
  return (x/gcd(x,y))*y;
}
 
class UnionFind {
    public:
    //各頂点の親の番号を格納する。その頂点自身が親だった場合は-(その集合のサイズ)を入れる。
    vector<int> Parent;
    
    //クラスを作るときは、Parentの値を全て-1にする。
    //以下のようにすると全てバラバラの頂点として解釈できる。
    UnionFind(int N) {
        Parent = vector<int>(N, -1);
    }
    
    //Aがどのグループに属しているか調べる
    int root(int A) {
        if (Parent[A] < 0) return A;
        return Parent[A] = root(Parent[A]);
    }
    
    //自分のいるグループの頂点数を調べる
    int size(int A) {
        return -Parent[root(A)];//先祖をrootで取っておきたい。
    }
    
    //AとBをくっ付ける
    bool connect(int A, int B) {
        //AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
        A = root(A);
        B = root(B);
        if (A == B) {
            //すでにくっついてるからくっ付けない
            return false;
        }
        
        //大きい方(A)に小さいほう(B)をくっ付けたい
        //大小が逆だったらAとBをひっくり返す。
        if (size(A) < size(B)) swap(A, B);
        
        //Aのサイズを更新する
        Parent[A] += Parent[B];
        //Bの親をAに変更する
        Parent[B] = A;
        
        return true;
    }
};

int main(){
  int n,l;
  cin>>n>>l;
  vector<string> ss(n);
  REP(i,n){
    cin>>ss[i];
  }
  sort(ss.begin(),ss.end());
  string ans="";
  REP(i,n){
    ans += ss[i];
  }
  cout<<ans<<endl;
  return 0;
}



Measured memory_bytes: 256
#include <stdio.h>

int main (void)
{
  long double x[100000],tmp;
  int i,j,y;
  long double s,sum;
  sum = 1;
  scanf("%d", &y);
  for(i = 0; i < y; i++) {
    scanf("%Lf",&x[i]);
    if(x[i] == 0) {
      printf("0");
      return 0;
    }
  }

  for(i=0; i<y; i++) {
    sum = sum * x[i];
    if(sum > 1000000000000000000) {
      printf("-1\n");
      return 0;
    }
  }
  printf("%.0Lf\n",sum);
   return 0;
}

Measured memory_bytes: 3296
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, from, to) for (int i = from; i < (to); ++i)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define pb push_back
using ll = long long;
using vin=vector<int>;
using vll=vector<ll>;
using vst=vector<string>;
using P = pair<int, int>;
const int inf=1e9+7;
const ll INF=1e18;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };


int main(){cout<<fixed<<setprecision(10);
		   int n;
           cin>>n;
           rep(i,0,n+1000){
            if(i*i>n){
             i--;
              cout<<i*i<<endl;
              return 0;
            }
           }
}

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

AC=[0]*(N+1)
WA=[0]*(N+1)
ans=0
for _ in range(M):
    p,s=input().split()
    p=int(p)
    if AC[p]==0:
       if s=='AC':
            AC[p]=1
            ans+=WA[p]
       else:
            WA[p]+=1
print(sum(AC),ans)

Measured memory_bytes: 10276
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define ll long long 
#define ret return
#define PB push_back
#define lc 2 * v
#define rc 2 * v + 1
#define mid (s + e) / 2
#define pll pair <long long ,  long long>
#define FAST ios::sync_with_stdio(false);cin.tie(0);

const int maxn = 2e5;
vector <int> vec;
int ans[maxn];

int main() {
    int n , x;
    cin >> n >> x;
    if((x == 1) || (x == 2 * n - 1)) {
        cout << "No" << endl;
        return 0;
    }
    cout << "Yes" << endl;
    for (int i = 1; i <= 2 * n - 1; ++i) {
        if((i != x) && (i != x - 1) && (i != x + 1)) {
            vec.PB(i);
        }
    }
    ans[n] = x; ans[n - 1] = x - 1; ans[n + 1] = x + 1;
    int p = 0;
    for (int i = 1; i <= 2 * n - 1; ++i) {
        if((i == n - 1) || (i == n) || (i == n + 1)) {continue;}
        ans[i] = vec[p];
        p++;
    }
    for (int i = 1; i <= 2 * n - 1; ++i) {cout << ans[i] << endl;}
}

Measured memory_bytes: 3188
#include <bits/stdc++.h>
 
using namespace std;
 
#define SZ(x) ((int)(x).size())
using namespace std;
typedef pair<int,int> PII;
#define FF first
#define SS second
#define MP make_pair
#define PB push_back
#define REP(i,n) for (int i = 0; i < n; ++i)
#define FOR(i,a,b) for (int i = a; i <= b; ++i)
#define M 1000000007
#define MM 998244353
#define SZ(a) int((a).size())
#define all(v) (v).begin(), (v).end()
#define uni(v) sort(all(v)), (v).erase(unique(all(v)), (v).end())
#define mod 1000000007
using ll = long long;

//a and b are assumed to be taken modulo p
inline ll add(ll a, ll b, ll p = mod){ ll c = a + b; if(c >= p) c -= p; return c; }
inline ll sub(ll a, ll b, ll p = mod){ ll c = a - b; if(c < 0) c += p; return c; }
inline ll mul(ll a, ll b, ll p = mod){ return (a * 1ll * b) % p; }
 
using VI = vector<int>;
using PII = pair<int, int>;
using PLL = pair<ll, ll>;
using VLL = vector<ll>;
using ld = long double;
int gcd(int a, int b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
      
}
ll power(ll x, ll y, ll p)
{
    ll res = 1;     // Initialize result
  
    x = x % p; // Update x if it is more than or
                // equal to p
  
    while (y > 0)
    {
        // If y is odd, multiply x with result
        if (y & 1)
            res = (res*x) % p;
  
        // y must be even now
        y = y>>1; // y = y/2
        x = (x*1ll*x) % p;
    }
    return res;
}
const int MX = 2e4+10;
const int MX2 = 1e6+5;

ll INF= 4 * (ll)1e18;
int mx = 2 * (ll)1e9 + 10;

string v[MX];
vector<vector<string> > dp(3,vector<string>(MX,"|"));
int A[MX];
int main(int argc, const char * argv[]) {

    ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0); // insert code here...
    int N;
    cin >> N;
    REP(i,N) cin >> A[i];
    int cost = 2e9;
    FOR(i,-100,100) {
        int indCost = 0;
        REP(j,N) {
            indCost += (A[j] - i) * (A[j] - i);
        }
        cost = min(cost,indCost);
    }
    cout << cost << endl;
    return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<ll, ll>;
#define rep(i, n) for(int i=0;i<(int)n;i++)
#define PI acos(-1)
#define fast_io ios_base::sync_with_stdio(false) ; cin.tie(0); cout.tie(0);
ll mod=1e9+7;

int main(){
    
    int n;
    cin>>n;
    vector<ll> X(n);
    rep(i,n) cin>>X[i];
    vector<ll> res = X;
    sort(X.begin(), X.end());
    ll mid = X[n/2];
    rep(i,n){
        if(res[i]<mid){
            cout<<mid<<endl;
        }else{
            cout<<X[n/2-1]<<endl;
        }
    }
    

    return 0;
}


Measured memory_bytes: 6252
n, m = [int(_) for _ in input().split()]
a = [int(_) for _ in input().split()]; a.sort()
s = [[int(_) for _ in input().split()] for __ in range(m)]; s.sort(key=lambda x: x[1], reverse=True)
ci = 0
for i in range(m):
    tmp = s[i][0]
    for j in range(ci, n):
        if a[j] < s[i][1]:
            if tmp == 0 : break
            a[j] = s[i][1]
            tmp -= 1
            ci += 1
        else:
            break
print(sum(a))

Measured memory_bytes: 27000
import sys
input = sys.stdin.readline
# int(input()) # 入力が1つ
n, k = map(int, input().split()) # 入力が複数
# [int(i) for i in input().split()] # 配列で数字
mod = 10 ** 9 + 7 # (modの値をすごく大きくすれば（5乗とか）、普通のnCrとして使える)
MAX = 2 * 10 ** 5 + 1 # これは変動するので注意。せいぜい10 ** 6くらいまでがTLEの限界

def com_init(MAX, mod):
    fac = [0] * MAX
    finv = [0] * MAX
    inv = [0] * MAX
    fac[0] = fac[1] = 1
    finv[0] = finv[1] = 1
    inv[1] = 1
    for i in range(2, MAX):
        fac[i] = fac[i - 1] * i % mod
        inv[i] = mod - inv[mod % i] * (mod // i) % mod
        finv[i] = finv[i - 1] * inv[i] % mod
    return fac, finv

fac, finv = com_init(MAX, mod)

def nCr(n, r):
    if n < r:
        return 0
    elif n < 0 or r < 0:
        return 0
    return fac[n] * (finv[r] * finv[n - r] % mod) % mod

def nHk(n, k):
    '''
    Duplicated Combination
    '''
    return nCr(n - 1 + k, n - 1)

ans = 0
for i in range(min(n, k + 1)):
    ans += nCr(n, i) * nCr(n - 1, n - i - 1) % mod
    # ans += nCr(n, i) * nHk(n, i) % mod
    ans %= mod
print(ans % mod)

Measured memory_bytes: 44272
N=gets.to_i
a=gets.split.map &:to_i
b=[0]*N
N.downto(1){|i|
  s=0
	i.step(N,i){|j|s+=b[j-1]}
	b[i-1]=(a[i-1]+s)%2
}
puts b.count(1),(1..N).select{|i|b[i-1]>0}.join(" ")

Measured memory_bytes: 22148
#include <stdio.h>

int main(void){

  int w,h,x,y,r;

  scanf("%d %d %d %d %d",&w,&h,&x,&y,&r);

  if((x+r)>w || (y+r)>h || x<0 || y<0){
    puts("No");
  }else{
    puts("Yes");
  }

  return 0;
}

Measured memory_bytes: 584
import java.util.*;
import java.io.PrintWriter;
public class Main{
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		int k=sc.nextInt();
		double[] p=new double[n+1];
		for(int i=0;i<n; i++){
			p[i+1]=sc.nextInt();
		}
		double sum=0;
		for(int i=0; i<k-1; i++){
			sum+=p[i+1];
		}
		int r=0;
		double max=0;
		for(int i=k-1; i<n; i++){
			sum+=p[i+1]-p[i+1-k];
			if(max<sum){
				max=sum;
				r=i+1;
			}
		}
		double ans=0;
		for(int i=r; i>r-k; i--){
			ans+=(p[i]+1)/2;
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 81604
#include<stdio.h>
#include<cstdio>
#include<stdlib.h>
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<string>
#include<string.h>
#include<cmath>
#include<vector>
#include<stack>
#include<queue>
#include<time.h>
#include<set>
#include<map>
#include <iomanip>
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a,b) for(int i=a;i>b;i--)
#define vint vector<int> 
#define vvint vector<vint>
#define CST(x) cout<<fixed<<setprecision(x)//小数点以下の桁数指定
#define ct(a) cout<<a<<endl
static const double pi = 3.141592653589793;
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
#define NIL  -1


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

long long Pow(long long a, long long n) {
	long long res = 1;
	while (n > 0) {
		if (n & 1) res = res * a % MOD;
		a = a * a % MOD;
		n >>= 1;
	}
	return res;
}

ll A[200005];
ll ans;
int main() {
	cin.tie(0);
	cout.tie(0);

	
	ios::sync_with_stdio(false);
	

	int N,K;
	cin >> N>>K;

	A[1] = N + 1;
	FOR(i, 2, N+2) {
		A[i] = A[i - 1] - 2 * (i-1)+N;
	}

	FOR(i, K, N + 2) {
		ans = (ans + A[i]) % MOD;
	}
	cout << ans << endl;

	
	return 0;
}


Measured memory_bytes: 5164