akhauriyash/Code-Regression huggingface dataset:
/* 
	Author: ankrypt
*/

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;
template<class T> using oset=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define MOD 1000000007
#define ll long long int
#define u64 unsigned long long int
#define ff first
#define ss second
#define all(x) x.begin(), x.end() 
#define ub upper_bound
#define lb lower_bound
#define MAX_INT 100005
#define fi(a, b, c, d) for(int a = b; a < c; a += d)
#define fl(a, b, c, d) for(ll a = b; a < c; a += d)
#define fei(a, b, c, d) for(int a = b; a <= c; a += d)
#define fel(a, b, c, d) for(ll a = b; a <= c; a += d)
#define quit exit(0)

ll N, M, A, B, C;
ll arr[MAX_INT], arr1[MAX_INT], data1[MAX_INT], freq[MAX_INT];
vector<ll> V;

ll modSum(ll A, ll B) {
	return (A + B) % MOD;
}
ll modSub(ll A, ll B) {
	return (A - B + MOD) % MOD;
} 
ll modMul(ll A, ll B) {
	return (A * B) % MOD;
}

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

int main() {
	scanf("%lld %lld", &M, &N);
	fei(i, 1, N, 1) {
		fei(j, i, N, i) {
			if(j % i == 0) {
				data1[i]++;
			} 
		}
	}
	
	ll finalAns = 0;
	for(int i = N; i>= 1; i--) {
		ll ans = 0;
		ans = modSum(ans, modPow(data1[i], M));
		// cout << ans << " " << i << " \n";
		freq[i] += ans;
		fei(j, 1, sqrt(i), 1) {
			if(i != j && (i % j) == 0) {
				freq[j] = (freq[j] - freq[i]);
				if(j != i / j && i != i / j) {
					freq[i / j] = (freq[i / j] - freq[i]);
				}
			} 
		}
		// cout << freq[1] << " " << freq[2] << " " << freq[3] << " " << freq[4] << "\n";
		// cout << ans << " ";
		// ans = modSub(ans, modSub(data1[i], 1ll));
		// cout << ans << " \n";
		// finalAns = modSum(finalAns, modMul(ans, i));
	}
	fei(i, 1, N, 1) {
		finalAns = modSum(finalAns, modMul(i, freq[i]));
	}
	printf("%lld\n", finalAns);
	return 0;
}
/*
	Powered by Buggy Plugin
*/




Measured memory_bytes: 5280
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
typedef long long ll;
int n,a[1000005];
ll l,r;
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
		scanf("%d",&a[i]);
	l=2,r=3;
	for(int i=n;i>0;i--)
	{
		l=(l+a[i]-1)/a[i]*a[i];
		r=(r+a[i]-1)/a[i]*a[i];
		if(l==r)
		{
			printf("-1\n");
			return 0;
		}
	}
	printf("%lld %lld\n",l,r-1);
	return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using P = pair<ll,ll>;
const ll mod = 1e9+7;
#define ALL(x) (x).begin(),(x).end()
#define pow(x,y) modpow(x,y)
#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)

template <class T = int>T in(){
    T x;
    cin >> x;
    return (x);
}

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<fixed<<setprecision(10);
    ll N = in<ll>();
    int sqrta = sqrt(N);
    ll mini = 10000000000000;
    REP(i,sqrta+1){
        if(N%(i+1) == 0)mini = min(mini,i+N/(i+1)-1);
    }
    cout << mini << "\n";
}

Measured memory_bytes: 256
n = int(input())
hh = list(map(int, input().split()))
hh.insert(0, 0)

cnt = 0
for i in range(1, len(hh)):
    for j in range(0, i):
        if hh[i] < hh[j]:
            break
    else:
        cnt += 1

print(cnt)


Measured memory_bytes: 3060
using System; 
using System.Text;
using System.Collections.Generic; 
using System.Linq; 
using E = System.Linq.Enumerable; 


class Program {
    static void Main(string[] args) {
        
        var NW = Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToArray();
        var N = NW[0];
        var W = NW[1];
        
        Console.WriteLine((N+W)%24);
     }
}

Measured memory_bytes: 13268
import std.stdio;
import std.string;
import std.conv;
import std.algorithm;
import std.math;
import std.array;

void show_clock(int time) {
  for(int i = 2; i >= 0; i--) {
    write(format("%02d%s", time / (pow(60, i)), i ? ":" : ""));
    time %= pow(60, i);
  }
  writeln;
}

void main() {
  while(true) {
    int[] line = readln.chomp.split(" ").map!(to!(int)).array;
    if (line.filter!((x) => x == -1).array.length == 3) break;
    int time = (line[0] * 3600 + line[1] * 60 + line[2]);
    show_clock(7200 - time);
    show_clock((7200 - time) * 3);
  }
}

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

int main() {
  int N, Sum=0;
  cin >> N;
  vector<int> A(N+1), B(N+1), C(N);
  for (int i=1; i<=N; i++) cin >> A.at(i);
  for (int i=1; i<=N; i++) cin >> B.at(i);
  for (int i=1; i<=N-1; i++) cin >> C.at(i);

  for (int i=1; i<=N; i++){
    Sum=Sum+B.at(A.at(i));
    if (i<=N-1 && A.at(i)==A.at(i+1)-1){
      Sum=Sum+C.at(A.at(i));
    }
  }
  cout << Sum << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
#include <cstring>
#include <deque>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, 0, sizeof(mat))
typedef long long ll;
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  string s; cin >> s;
  s[3] = '8';
  cout << s << endl;
  return 0;
}

Measured memory_bytes: 256
package main

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

var sc = bufio.NewScanner(os.Stdin)

func main() {
	data := []int{}
	for sc.Scan() {
		i, _ := strconv.Atoi(sc.Text())
		data = append(data, i)
	}
	a, e, k := data[0], data[4], data[5]
	if (e - a) > k {
		fmt.Println(":(")
		return
	}
	fmt.Println("Yay!")
}


Measured memory_bytes: 640
import math
def jud(s):
    for i in range(2,int(math.sqrt(s))+1):
            if s%i == 0:
                return 0
    return 1

n = int(input())
a = [0]*n
cnt = 0

for i in range(n):
    a[i] = int(input())
    han = jud(a[i])
    if han == 1:
        cnt += 1

print(cnt)


Measured memory_bytes: 5992
#include <bits/stdc++.h>
#define ALL(a)  (a).begin(),(a).end()
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
int main(){
  int N;
  cin >> N;
  vector<int> A(N), B(N-1);
  for(int i = 0; i < N-1; i++){
    cin >> B.at(i);
  }
  int sum = 0;
  for(int i = 0; i < N; i++){
    if(i == 0) A.at(i) = B.at(i);
    else if(i == N-1) A.at(i) = B.at(i - 1);
    else A.at(i) = min(B.at(i - 1), B.at(i));
    sum += A.at(i);
  }
  cout << sum << endl;
}

Measured memory_bytes: 256
unittest
{
	assert( [ "5 2" ].solve == 18 );
	assert( [ "3 -1" ].solve == 0 );
	assert( [ "30 -50" ].solve == -1044 );
}



import std.conv;
import std.format;
import std.math;
import std.range;
import std.stdio;

void main()
{
	stdin.byLineCopy.solve.writeln;
}

auto solve( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto n = 0L;
	auto l = 0L;
	input.front.formattedRead!"%s %s"( n, l );
	
	auto t = 0L;
	auto m = long.max;
	foreach( i; 0L .. n )
	{
		auto x = l + i.signed;
		t += x;
		if( x.abs < m.abs ) m = x;
	}
	return t - m;
}


Measured memory_bytes: 2880
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <queue>
#include <map>
#include <numeric>
#include<iomanip>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using namespace std;
int d,g;
int res=1001;
int p[10];
int c[10];
void dfs(int depth,int flag)
{
  if(depth==d)
  {

    int num=0,score=0;
    rep(i,d)
    {
      if((flag>>i) &1)
      {
        score+=p[i]*(i+1)*100+c[i];
        num+=p[i];
      }
    }
    for(int i=d-1;i>=0;i--)
    {
      if((flag>>i) &1)continue;
      if(g<=score)break;
      if(g-score<=(p[i]-1)*(i+1)*100)
      {
        num+=(g-score-1)/((i+1)*100)+1;
        score+=((g-score-1)/((i+1)*100)+1)*(i+1)*100;
        break;
      }
      else
      {
        num+=p[i]-1;
        score+=(p[i]-1)*(i+1)*100;
      }

    }
    if(g>score)return;
    res=min(res,num);return;
  }
  dfs(depth+1,flag);
  dfs(depth+1,flag+(1<<depth));
}
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin>>d>>g;
  rep(i,d)cin>>p[i]>>c[i];
  dfs(0,0);
  cout<<res;
  return 0;

}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
int main(){
  char S[101],s;
  while(1){
    scanf("%s %c",S,&s);
    if(s=='X') break;
    else if(s=='L' || s=='U'){
      for(int i=0,l=strlen(S);i<l;i++){
	if(s=='L'&&i==0&&S[i]>='A'&&S[i]<='Z'){
	  printf("%c",S[i]-('A'-'a'));
	}else if(S[i]=='_' ||(s=='U'&&i==0&&S[i]>='a'&&S[i]<='z')){
	  if(i!=0)i++;
	  printf("%c",S[i]+ ('A'-'a'));
	}else  printf("%c",S[i]);
      }
    }else if(s=='D'){
      if(S[0]>='A'&&S[0]<='Z')printf("%c",S[0]-('A'-'a'));
      else printf("%c",S[0]);
      for(int i=1,l=strlen(S);i<l;i++){
	if(S[i]>='A'&&S[i]<='Z'){
	  printf("_%c",S[i]-('A'-'a'));
	}else{
	  printf("%c",S[i]);
	}
      }
    }
    puts("");
  }
}

Measured memory_bytes: 1148
#pragma GCC optimize ("Ofast")
#pragma GCC target ("avx2")
//#include<bits/stdc++.h>
#include<cstdio>
#include<cstring>

using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

const int CM = 120000, CL = 12;
char cn[CM + CL], * ci = cn + CM + CL, * owa = cn + CM, ct;
const ll ma0 = 1157442765409226768;
const ll ma1 = 1085102592571150095;
const ll ma2 = 71777214294589695;
const ll ma3 = 281470681808895;
const ll ma4 = 4294967295;
inline int getint() {
	if (ci - owa > 0) {
		memcpy(cn, owa, CL);
		ci -= CM;
		fread(cn + CL, 1, CM, stdin);
	}
	ll tmp = *(ll*)ci;
	int dig = ((tmp & ma0) ^ ma0) ? 68 - __builtin_ctzll((tmp & ma0) ^ ma0) : 0;
	tmp = tmp << dig & ma1;
	tmp = tmp * 10 + (tmp >> 8) & ma2;
	tmp = tmp * 100 + (tmp >> 16) & ma3;
	tmp = tmp * 10000 + (tmp >> 32) & ma4;
	ci += (64 - dig >> 3);
	while ((ct = *ci++) >= '0') tmp = tmp * 10 + ct - '0';
	return tmp;
}

bool NG[100001];
int main() {
	//cin.tie(0);
	//ios::sync_with_stdio(false);


	int N = getint(), M = getint();
	int H[100001];
	rep1(i, N) H[i] = getint();
	rep(i, M) {
		int a = getint(), b = getint();
		if (H[a] >= H[b]) NG[b] = 1;
		if (H[a] <= H[b]) NG[a] = 1;
	}
	int kotae = N;
	rep1(i, N) kotae -= NG[i];

	printf("%d", kotae);

	Would you please return 0;
}

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

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
  int n,k;
  cin>>n>>k;
  vector<int>v;
  int x;
  for(int i=0;i<n;i++){
    cin>>x;
  v.push_back(x);
  }
  sort(v.begin(),v.end());
  long long sum=0;
  for(int i=0;i<k;i++)
    sum+=v[i];
  cout<<sum;
  
}


Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setpercision(x)
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
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 ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9;
const ll INF=4e18;
const ll dy[4]={1,0,-1,0};
const ll dx[4]={0,-1,0,1};
int main(){
    int A,B;cin>>A>>B;
    cout<<(A+B-1)/B<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int n, m, a[1000000], x, y, ans;
bool u[1000000];
int main()
{
    cin >> n >> m;
    u[1] = 1;
    for(int i = 1;i <= n; ++ i){
        a[i] = 1;
    }
    for(int i = 1;i <= m; ++ i){
        cin >> x >> y;
        u[y] |= u[x];
        --a[x];
        ++a[y];
        if(!a[x])u[x] = 0;
    }
    for(int i = 1; i <= n; ++ i)ans += u[i];
    cout << ans;
    return 0;
}


Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;


int main()	
{
	int n,m,a,dp[100005]={},MOD=1000000007;
	cin>>n>>m;
	for(int i=0;i<m;i++)
	{
		cin>>a;
		dp[a]=-1;
	}
	dp[0]=1;
	if(dp[1]!=-1)dp[1]=1;
	for(int i=2;i<=n;i++)
	{
		if(dp[i]==-1)continue;
		if(dp[i-1]!=-1&&dp[i-2]!=-1)dp[i]=dp[i-1]%MOD+dp[i-2]%MOD;
		else if(dp[i-1]!=-1&&dp[i-2]==-1)dp[i]=dp[i-1]%MOD;
		else if(dp[i-1]==-1&&dp[i-2]!=-1)dp[i]=dp[i-2]%MOD;
		else dp[i]=0;
		dp[i]%=MOD;
	}
	cout<<dp[n]<<endl;
	return 0;
}

Measured memory_bytes: 640
x=int(input())
import numpy as np
root=int(np.sqrt(x))
for i in range(x,2*x):
  c=0
  for j in range(2,root):
    if i % j == 0:
      c=1
      break
    else:
      continue
  if c==0:
    print(i)
    exit()

Measured memory_bytes: 20740
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <climits>
#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 <queue>
#include <random>
#include <complex>
#include <regex>

using namespace std;

#define SHOW_VECTOR(v) {std::cerr << #v << "\t:";for(const auto& xxx : v){std::cerr << xxx << " ";}std::cerr << "\n";}
#define SHOW_MAP(v){std::cerr << #v << endl; for(const auto& xxx: v){std::cerr << xxx.first << " " << xxx.second << "\n";}}

int main() {

    string S, T;
    cin >> S >> T;

    vector<int> s(26, -1);
    vector<int> t(26, -1);

    bool good = true;

    for (int i = 0; i < S.size(); i++) {
        int ss = S[i] - 'a';
        int tt = T[i] - 'a';
        if (s[ss] != -1 || t[tt] != -1) {
            if (s[ss] != -1 && s[ss] != tt) good = false;
            if (t[tt] != -1 && t[tt] != ss) good = false;
        } else {
            s[ss] = tt;
            t[tt] = ss;
        }
    }

    if (good) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}











































































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

#define DEBUG(x) cerr << #x << ": " << x << endl;
#define MOD 1000000007;

int main() {
    int n;
    cin >> n;
    vector<int> numCount(n, 0);
    for (int i = 0; i < n; i++) {
        int x;
        cin >> x;
        numCount[x]++;
    }

    int ans = 1;
    if (n % 2 == 0) { // 要素数が偶数の時
        for (int i = 1; i < n; i+=2) {
            if (numCount[i] != 2) {
                cout << "0" << endl;
                return 0;
            }
            ans = (ans * 2) % MOD;
        }
    } else { // 要素数が奇数
        if (numCount[0] != 1) {
            cout << "0" << endl;
            return 0;
        }
        for (int i = 2; i < n; i+=2) {
            if (numCount[i] != 2) {
                cout << "0" << endl;
                return 0;
            }
            ans = (ans * 2) % MOD;
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
#define watch(x) cout << (#x) << " is " << (x) << endl
#define endl "\n"
typedef long long ll;
using namespace std;
int static fast = [](){
  ios::sync_with_stdio(false);
  cin.tie(0); cout.tie(0); return 0;
}();
// freopen("input.txt", "r", stdin);

int get_cnt(ll x) {
    int ans = 0;
    while(x > 0) {
        int b = __builtin_popcount(x);
        x %= b;
        ans += 1;
    }
    return ans;
}

int main() {
    int n;
    string x;
    cin >> n >> x;
    vector<int> ans(n, 0);
    ll cnt_1 = 0;
    for(int i = 0; i < n; i++) {
        if (x[i] == '1') {
            cnt_1 += 1;
        } 
    }
    if (cnt_1 == 1) {
        for(int i = 0; i < n; i++) {
            if (x[i] == '1') {
                cout << 0 << endl;
            } else {
                if (x.back() == '1' || i == n-1) {
                    cout << 2 << endl;
                } else {
                    cout << 1 << endl;
                }
            }
        }
        return 0;
    } else if (cnt_1 == 0) {
        for(int i = 0; i < n; i++)
            cout << 1 << endl;
        return 0;
    }
    ll cur_sub = 0;
    ll cur_add = 0;
    ll mod_sub = cnt_1 - 1;
    ll mod_add = cnt_1 + 1;
    reverse(x.begin(), x.end());
    ll fac_sub = 1 % mod_sub;
    ll fac_add = 1 % mod_add;
    for(int i = 0; i < n; i++) {
        if (x[i] == '1') {
            cur_sub += fac_sub;
            cur_sub %= mod_sub;
            cur_add += fac_add;
            cur_add %= mod_add;
        }
        fac_sub *= 2;
        fac_sub %= mod_sub;
        fac_add *= 2;
        fac_add %= mod_add;    
    }
    fac_sub = 1 % mod_sub;
    fac_add = 1 % mod_add;
    vector<int> tmp(n, 0);
    //cout << cnt_1 << endl;
    //cout << cur_sub << " " << cur_add <<endl;
    for(int i = 0; i < n; i++) {
        if (x[i] == '0') {
            tmp[i] = cur_add + fac_add;
            tmp[i] %= mod_add;
        } else {
            tmp[i] = cur_sub - fac_sub;
            tmp[i] = (tmp[i] + (mod_sub*100)) % mod_sub;
        }
        //cout << tmp[i] << " ";
        if (tmp[i] == 0) {
            ans[i] = 1;
        } else {
            ans[i] = get_cnt(tmp[i]) + 1;
        }
        fac_sub *= 2;
        fac_sub %= (cnt_1-1);
        fac_add *= 2;
        fac_add %= (cnt_1+1);
    }
    reverse(ans.begin(), ans.end());
    for(auto& val: ans)
        cout << val << endl;
    return 0;
}


Measured memory_bytes: 5144
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
#define ALL(c) (c).begin(), (c).end()
#define SUM(x) std::accumulate(ALL(x), 0LL)
#define MIN(v) *std::min_element(v.begin(), v.end())
#define MAX(v) *std::max_element(v.begin(), v.end())
#define EXIST(v, x) (std::find(v.begin(), v.end(), x) != v.end())

using namespace std;
using ll = long long;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
constexpr int INF = 1001001001;
constexpr long long INFL = (1LL<<60);
constexpr double eps = (1e-9);

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

  int x;
  cin >> x;
  if (30 <= x) puts("Yes");
  else puts("No");

  return 0;
}


Measured memory_bytes: 3632
import random as rng
import itertools as it
import collections as col
import heapq as hq
import sys
import copy as cp
sys.setrecursionlimit(10**9)


def dump_impl(*objects):
    print(*objects, file=sys.stderr)


def dump_dummy(*objects):
    pass


dump = dump_impl if "DEBUG" in sys.argv else dump_dummy

H, W, K = map(int, input().split())
dump(H, W, K)
c = []
for i in range(H):
    c.append(input())
dump(c)
ans = 0
for rows, columns in it.product(it.product({True, False}, repeat=H), it.product({True, False}, repeat=W)):
    rIdx = {i for i, ri in enumerate(rows) if ri}
    cIdx = {j for j, cj in enumerate(columns) if cj}
    dump(rIdx, cIdx)
    cnt = 0
    for i in range(H):
        for j in range(W):
            if (i not in rIdx) and (j not in cIdx) and (c[i][j] == '#'):
                cnt += 1
    dump(cnt)
    if cnt == K:
        ans += 1
print(ans)


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

//#define int long long
#define reps(i,s,n) for(ll (i)=(s);(i)<(ll)(n);++(i))
#define rep(i,n) reps(i,0,n)
#define rept(i,n) reps(i,0,n+1)
#define repst(i,s,n) reps(i,s,n+1)
#define reprt(i,n,t) for(ll (i)=(n);(i)>=t;--(i))
#define repr(i,n) reprt(i,n,0)
#define each(itr,v) for(auto (itr):(v))
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define mp(x,y) make_pair((x),(y))
#define fi first
#define se second
#define tmax(x,y,z) max(x,max(y,z))
#define tmin(x,y,z) min(x,min(y,z))
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define ln '\n'
#define dbg(x) cout<<#x" = "<<(x)<<ln
#define dbga(x,n) {cout<<#x" : ";for(int (i)=0;i<n;++i){cout<<x[i]<<(i==n-1?'\n':' ');}}

typedef long double ld;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<bool> vb;
typedef vector<ld> vld;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vector<int> > mat;

const ll inf = (ll)1e9+10;
const ll linf = (ll)1e18+10;
const ll mod = (ll)(1e9+7);
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};
const double eps = 1e-10;

struct oreno_initializer {
	oreno_initializer() {
		cin.tie(0);
		ios::sync_with_stdio(0);
	}
} oreno_initializer;

// ━━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…
// .｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋
// ・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・

// dp[i][j]: 頂点iを根とする部分木をj==0?白:黒で塗るときの1-jの頂点に書いてきた数字の総和の最小値

int n, p, x[1010], dp[1010][2];
vi c[1010];
bitset<5050> b;

void rec(int v) {
	// 葉はとりあえず1で塗っとく
	if (c[v].empty()) {
		dp[v][1] = x[v];
		return;
	}
	// 子の0の数字の和、1の数字の和
	int s0 = 0, s1 = 0;
	each(i,c[v]) {
		rec(i);
		s0 += dp[i][0], s1 += dp[i][1];
	}
	// 0の和がx[v]を超えているならそれはもうどうしようもない
	if (s0>x[v]) {
		cout << "IMPOSSIBLE" << ln;
		exit(0);
	}
	// 部分和DP
	b = 1;
	each(i,c[v]) b |= (b << (dp[i][1]-dp[i][0]));
	int l = x[v]-s0;
	while (l>=0 && !b[l]) l--;
	dp[v][0] = x[v], dp[v][1] = s1-l;
	// 今まで塗ってきた黒と白は入れ替えても問題ない 便宜上黒の方が和が大きいようにしておく
	if (dp[v][0]>dp[v][1]) swap(dp[v][0],dp[v][1]);
}

signed main() {
	cin >> n;
	reps(i,1,n) {
		cin >> p;
		c[p-1].pb(i);
	}
	rep(i,n) cin >> x[i];
	rec(0);
	cout << "POSSIBLE" << ln;
}

Measured memory_bytes: 896
prim=[True]*1000000
prim[0]=prim[1]=False
for i in range(2,350):
    if prim[i]:
        for j in range(i*2,110000,i):
            prim[j]=False
prime=[i for i,j in enumerate(prim) if j==True]

while True:
    n=int(input())
    if n==0:
        break
    print(sum(prime[:n]))

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

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

    long long H, W, N;
    cin >> H >> W >> N;
    vector<pair<int, int>> ab(N);
    for(int i=0; i<N; i++) {
        int a, b;
        cin >> a >> b;
        a--; b--;
        ab[i] = pair<int, int>(a, b);
    }
    map<pair<int, int>, bool> mp;
    for(int i=0; i<N; i++) mp[ab[i]] = true;
    long long ans[10];
    fill_n(ans, 10, 0);

    for(int n=0; n<N; n++){
        for(int i=ab[n].first-1; i<=ab[n].first+1; i++){
            for(int j=ab[n].second-1; j<=ab[n].second+1; j++){
                long long tmp = 0;
                bool flag = true;
                for(int k=i-1; k<=i+1; k++){
                    if(k<0||H<=k) {
                        flag = false;
                        break;
                    }
                    for(int l=j-1; l<=j+1; l++){
                        if(l<0||W<=l){
                            flag = false;
                            break;
                        }
                        if(mp[pair<int, int>(k, l)]) tmp++;
                    }
                }
                if(flag) ans[tmp]++;
            }
        }
    }
    long long sum = 0;
    for(int i=1; i<10; i++) {
        ans[i] /= i;
        sum += ans[i];
    }
    ans[0] = (H-2)*(W-2) - sum;

    for(int i=0; i<10; i++)
        cout << ans[i] << endl;

	return 0;
}


Measured memory_bytes: 157312
#include <bits/stdc++.h>
using namespace std;
typedef long long lint;
typedef pair<int, int> pi;

int n, m;
char str[11][11];

int main(){
	cin >> n >> m;
	for(int i=0; i<n; i++){
		cin >> str[i];
	}
	for(int i=0; i<n; i++){
		for(int j=0; j<m; j++){
			for(int k=0; k<i; k++){
				for(int l=j+1; l<m; l++){
					if(str[k][l] == '#' && str[i][j] == '#'){
						puts("Impossible");
						return 0;
					}
				}
			}
		}
	}
	puts("Possible");
}


Measured memory_bytes: 764
///
// File:  2745.cpp
// Author: ymiyamoto
//
// Created on Sat Nov 11 01:28:25 2017
//

#include <cstdint>
#include <iostream>

using namespace std;

int32_t main()
{
  while (true) {
    double R0, W0, C, R;
    cin >> R0 >> W0 >> C >> R;
    if (R0 == 0) break;

    int64_t X = 0;
    for (; X <= INT32_MAX; X++) {
      double Y = (R0 + X * R - C * W0) / C;
      if (-10e-6 < Y) {
        break;
      }
    }
    cout << X << endl;
  }

  return 0;
}

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

typedef long long LL;

LL a,b;

void Init() {
	scanf("%lld%lld",&a,&b);
}

void Solve() {
	if (a==b) { printf("1\n"); return ; }
	for (int i=59;i>=0;--i) {
		if (a>=(1ll<<i) && b>=(1ll<<i)) a-=1ll<<i,b-=1ll<<i;
		if (a<(1ll<<i) && (1ll<<i)<=b) {
			LL tp=1ll<<i;
			for (int j=i;j>=0;--j) if (tp+(1ll<<j)<=b) { tp+=1ll<<(j+1); break; }
			if (tp==(1ll<<i)) tp++;
			if (tp>=a+(1ll<<i)) printf("%lld\n",(1ll<<i+1)-a);
			else printf("%lld\n",tp-a+(1ll<<i)-a); 
			break;
		}
	}
}

int main() {
	Init();
	Solve(); 
	return 0;
} 

Measured memory_bytes: 256
//Code by Anshuman Das Gupta

#include<bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define int long long
#define MOD 1000000007
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define loop(I,N) for(int i=I;i<N;i++)
#define sortvec(V) sort(V.begin(),V.end())
#define vec vector<int>
#define endl "\n"
using namespace std;
#define PI 3.14159265359
int fast_power(int base, int power) {
    int result = 1;
    while (power > 0) {

        if (power & 1) {
            result = (result * base) % MOD;
        }
        base = (base * base) % MOD;
        power = power >> 1;
    }
    return result % MOD;
}

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

int binsearch(int a[], int f, int r, int x) {
    while (f <= r) {
        int mid = (f + r) / 2;
        if (a[mid] == x)
            return mid;
        else if (a[mid] > x) {
            r = mid - 1;
        }
        else {
            f = mid + 1;
        }
    }
    return -1;
}
void sieve(int a[], int n) {
    a[0] = 0;
    a[1] = 0;
    for (int i = 2; i <= n; i++) {
        if (a[i] == 1) {
            for (int j = i + i; j <= n; j += i) {
                a[j] = 0;
            }
        }
    }
}
int32_t main() {
#ifndef ONLINE_JUDGE
    //for getting input from input.txt
    freopen("input.txt", "r", stdin);
    //for writing output to output.txt
    freopen("out.txt", "w", stdout);
#endif
    int t = 1;
    //cin >> t;
    while (t--) {
        int a,b,c;
        cin>>a>>b>>c;
        cout<<c<<" "<<a<<" "<<b<<endl;
    }
    return 0;
}


Measured memory_bytes: 3684
a=list(input())
b=list(input())
c=list(input())

x = "a"
ans = "k"

while ans =="k":
  
  if x =="a":
    if len(a) == 0:
      print("A")
      exit()
    x=str(a[0])
    del a[0]
    continue
  if x =="b":
    if len(b) == 0:
      print("B")
      exit()
    x=str(b[0])
    del b[0]
    continue
  if x =="c":
    if len(c) == 0:
      print("C")
      exit()
    x=str(c[0])
    del c[0]
    continue

Measured memory_bytes: 3064
#include<iostream>
#include<algorithm>
#include<vector>
#include<numeric>
#include<string>
#include<cmath>
#include<set>
#include<queue>
#include<deque>
#include<bitset>
#include<iomanip>
#include<cctype>
#include<map>
#include<cstring>
#include<bitset>
#include<cassert>

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep2(i,a,b) for (int (i)=a;(i)<(b);(i)++)
#define all(x) (x).begin(),(x).end()

using namespace std;
using ll = long long int;

const int inf = 1001001000;
const long long int Inf = 1001001001001001000;



void print(vector<vector<int>> a){
	for (int i = 0; i < a.size(); i++)
	{
		for (int j=0;j<a[i].size();j++){
			cout << a[i][j] << " ";
		}
		cout << endl;
	}
}

void print(vector<vector<long long int>> a){
	for (int i=0;i<a.size();i++){
		for (int j=0;j<a[i].size();j++){
			cout << a[i][j] << " ";
		}
		cout << endl;
	}
}

void print(vector<int> a){
    int n = a.size();
    for (int j=0;j<n;j++) {
        if (j != n-1) cout << a[j] << " ";
        else cout << a[j] << endl;
    }
}

void print(vector<long long int> a){
    int n = a.size();
    for (int j=0;j<n;j++) {
        if (j != n-1) cout << a[j] << " ";
        else cout << a[j] << endl;
    }
}

void print(set<int> a){
	for (auto x:a)
		cout << x << " ";
	cout << endl;
}

//ベルマンフォード法.負閉路があれば1を返し，なければ0を返す.最短距離はdistに格納される.
//edgesは{from,to,wight}の順に入った辺のvector.distはinfで初期化された要素数が頂点数のvector.sは始点.
//O(VE)
int BF(vector<vector<int>> &edges, vector<int> &dist, int s){
	int inf = dist[0];
	dist[s] = 0;
	int v = dist.size();
	int e = edges.size();
	for (int i = 0; i < v; i++){
		for (int j = 0; j < e; j++){
			int l = dist[edges[j][1]];
			int r = dist[edges[j][0]] == inf ? inf : dist[edges[j][0]] + edges[j][2];			
			if (l > r){
				dist[edges[j][1]] = r;
				if(i == v - 1){
					return 1;
				}
			}
		}
	}
	return 0;
}

int main(){
	int v, e, p;
	cin >> v >> e >> p;
	vector<vector<int>> edge(e);
	rep(i,e){
		int a, b, c;
		cin >> a >> b >> c;
		edge[i] = {a, b, c};
	}
	vector<int> dist(v, inf);
	int f = BF(edge, dist, p);
	if(f)
		puts("NEGATIVE CYCLE");
	else {
		rep(i, v) {
			if (dist[i] > inf - 2000000)
				puts("INF");
			else
				cout << dist[i] << endl;
		}
	}
	return 0;
}


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

long a, b, c, d, e, ans;

long gcd(long u, long v){
	long r;
	while (v != 0){
		r = u % v;
		u = v;
		v = r;
	}
	return u;
}

long lcm(long u, long v){
	return u*v/gcd(u, v);
}

int main(){
	cin >> a >> b >> c >> d;
	e = lcm(c, d);
	ans = b - a + 1;
	ans -= b/c - a/c + (a%c == 0);
	ans -= b/d - a/d + (a%d == 0);
	ans += b/e - a/e + (a%e == 0);
	cout << ans;
}

Measured memory_bytes: 256
n, k = map(int, input().split())
a = list(map(int, input().split()))
mod = 10 ** 9 + 7

mia = sorted([i for i in a if i < 0], reverse=True)
pla = sorted([i for i in a if i >= 0])
ans, num = 1, []

if len(pla) == 0 and k % 2 == 1:
    for i in mia[:k]:
        ans = ans * i % mod
    print(ans)
    exit()

for _ in range(k):
    if len(mia) > 0 and len(pla) > 0:
        if abs(mia[-1]) <= pla[-1]:
            tmp = pla.pop()
        elif abs(mia[-1]) > pla[-1]:
            tmp = mia.pop()
    elif len(mia) == 0:
        tmp = pla.pop()
    elif len(pla) == 0:
        tmp = mia.pop()
    num.append(tmp)

cnt = sum(i < 0 for i in num)
for i in num:
    ans = ans * i % mod

if cnt % 2 == 1:
    p, q, r, s = 1, 0, -1, 0
    if len(mia) > 0 and cnt != k:
        p, q = min(i for i in num if i >= 0), mia[-1]
    if len(pla) > 0:
        r, s = max(i for i in num if i < 0), pla[-1]
    if len(mia) > 0 or (len(pla) > 0 and cnt != k):
        if q * r >= p * s:
            ans *= q * pow(p, mod - 2, mod)
        if q * r < p * s:
            ans *= s * pow(r, mod - 2, mod)
    ans %= mod
print(ans)


Measured memory_bytes: 33176
import java.util.HashMap;
import java.util.Scanner;


public class Main {


//	final int MOD = 1000000007;

//	public static int max = 0;

	public static void main(String[] args) {

		int ans = 0;
		Scanner sc = new Scanner(System.in);
		boolean f = false;

		int n = sc.nextInt();
		int m = sc.nextInt();
//		String string = sc.next();

//		int[] ans = new int[n];
		long[] h = new long[n];
		int[] a = new int[m];
		int[] b = new int[m];

		HashMap<Integer, Integer> map = new HashMap<Integer, Integer>();

		for(int i = 0; i < n; i++) {
			h[i] = sc.nextLong();
			map.put(i+1, 1);
		}

		for (int i = 0; i < m; i++) {
			a[i]= sc.nextInt();
			b[i]= sc.nextInt();
		}


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

		for(int i = 0; i < m; i++) {
			if(h[a[i]-1] > h[b[i]-1]) {
				if(map.containsKey(b[i])) {
					map.remove(b[i]);
				}
			} else if(h[a[i]-1] < h[b[i]-1]) {
				if(map.containsKey(a[i])) {
					map.remove(a[i]);
				}
			} else if(h[a[i]-1] == h[b[i]-1]) {
				if(map.containsKey(a[i])) {
					map.remove(a[i]);
				}
				if(map.containsKey(b[i])) {
					map.remove(b[i]);
				}
			}
		}

		ans = map.size();
		//-------------------------------------------------------------------------------------

//		for(int i = 0; i < n; i++) {
//			System.out.println(ans[i]);
//		}

//		if(f) {
//			System.out.println("Yes");
//		} else {
//			System.out.println("No");
//		}

		System.out.println(ans);

		sc.close();
	}
}

Measured memory_bytes: 69392
n,k,*a=map(int,open(0).read().split())
b=[[]for _ in range(max(a)+1)]
l=[]
for i,v in enumerate(a):
  b[v]+=i,
  l+=len(b[v]),
s=a[0]
i=c=0
while 1:
  t=b[s]
  m=len(t)
  j=l[i]
  c+=j==m
  i=t[j%m]+1
  if i==n:break
  s=a[i]
k%=c+1
s=a[0]
i=c=0
r=[]
while c<k-1or i<n:
  t=b[s]
  m=len(t)
  j=l[i]
  f=j==m
  if c>k-2and f:
    r+=s,
    i+=1
  else:i=t[j%m]+1
  c+=f
  s=a[i%n]
print(*r)

Measured memory_bytes: 49148
#include<iostream>
#include<algorithm>
using namespace std;
static const int Max=200000;
int main()
{
	int n;
	cin>>n;
	
	int a[Max];
	for(int k=0;k<n;k++)
	{
		cin>>a[k];
	}
	int maxv=-2000000000;
	int minv=a[0];
	for(int i=1;i<n;i++)
	{
		maxv=max(maxv,a[i]-minv);
		minv=min(minv,a[i]);
	}
	cout<<maxv<<endl;
	return 0;
}


Measured memory_bytes: 3888
/**
 * @author torith
 * @date 2018-10-30
 */

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

int main(){

    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N; cin >> N;

    vector<int> div = {};            // 約数のリスト

    for (int i = 1; i < sqrt(N) + 1; i ++) {
        if (N % i == 0){
            div.push_back(i);
        }
    }

    int ans = to_string(N).size();
    for (auto & i : div){
        ans = min(ans, max((int)to_string(i).size(), (int)to_string(N/i).size()));
    }

    cout << ans << "\n";

    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <fstream>
#include <sstream>
#include <iomanip>
#define ll long long

using namespace std;

long long MOD = 1000000007;

int main(){
    int N;
    cin >> N;
    vector<ll> vec(N+1,1);

    ll ans=1;
    for(ll i=2; i<=N; i++){
        for(ll j=1; i*j<=N; j++){
            vec[i*j]++;
        }
        ans+=i*vec[i];
    }
    cout << ans << endl;
}

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

void rep(int& x, int& y){
    int temp;
    temp = x;
    x = y;
    y = temp;
}

int main(){
    int a,b,c;
    cin >> a >> b >> c;
    
    if(a > b)
        rep(a,b);
    if(a > c)
        rep(a,c);
    if(b > c)
        rep(b,c);
        
    cout << a << " " << b << " " << c << endl;
    return 0;
}

Measured memory_bytes: 1164
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Convert;
using static System.Math;
using Pair = System.Tuple<int, int>;
using Edge = System.Tuple<int, int, long>;
//using Debug;
//using static System.Globalization.CultureInfo;

class Program
{
    static void Main(string[] args)
    {
        Solve();
        //WriteLine(Solve());
    }
    static void Solve()
    {
        var abc = Input.ar;
        WriteLine(Min(abc[0], abc[1]) < abc[2] && abc[2] < Max(abc[0], abc[1]) ? "Yes" : "No");
    }
}

public class Input
{
    public static string read => ReadLine();
    public  static int[] ar => Array.ConvertAll(read.Split(' '), int.Parse);
    public  static int num => ToInt32(read);
    public static long[] arL => Array.ConvertAll(read.Split(' '), long.Parse);
    public  static long numL => ToInt64(read);
    public static char[][] gred(int h) 
        => Enumerable.Repeat(0, h).Select(v => read.ToCharArray()).ToArray();
    public static int[][] ar2D(int num)
        => Enumerable.Repeat(0, num).Select(v => ar).ToArray();
    public static long[][] arL2D(int num)
        => Enumerable.Repeat(0, num).Select(v => arL).ToArray();
    public const long Inf = (long)1e18;
    public const double eps = 1e-6;
    public  const string Alfa = "abcdefghijklmnopqrstuvwxyz";
    public  const int MOD = 1000000007;
}


Measured memory_bytes: 11092
N = int(input())
res=[0 for _ in range(10050)]
for x in range(1,105):
    for y in range(1,105):
        for z in range(1,105):
            k=x*x+y*y+z*z+x*y+y*z+z*x
            if k<10050:
                res[k]+=1
for i in range(N):
    print(res[i+1])


Measured memory_bytes: 9196
import java.io.PrintWriter

fun main() {
    PrintWriter(System.out).use { out ->
        solve(out)
        out.flush()
    }
}

fun solve(out: PrintWriter) {
    val n = readLine()!!
    if (n.contains("7")) {
        println("Yes")
    } else {
        println("No")
    }
}

fun readInteger() = readLine()!!.toInt()
fun readLong() = readLine()!!.toLong()
fun readStringList() = readLine()!!.split(" ")
fun readIntegerList() = readStringList().map(String::toInt)
fun readLongList() = readStringList().map(String::toLong)
fun readDoubleList() = readStringList().map(String::toDouble)


Measured memory_bytes: 35736
#define _USE_MATH_DEFINES
#include <iomanip>
#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <tuple>
#include <climits>
#include <algorithm>
#include <cmath>
using namespace std;

typedef long long LL;
typedef vector<int> VI;
typedef vector<double> VD;
typedef vector<LL> VLL;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef vector<vector<int>> VVI;
typedef vector<vector<long long>> VVLL;
typedef vector<vector<bool>> VVB;
typedef vector<vector<double>> VVD;

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define all(a) (a).begin(),(a).end()

const int MOD = 1000000007;

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

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

void debug(VI &arr){
	int n=arr.size();
	rep(i,n){
		cout<<arr.at(i)<<endl;
	}
}

void debug(VVI &board){
	int h = board.size();
	int w = board.at(0).size();
	rep(i,h){
		rep(j,w){
			cout << board.at(i).at(j) << " ";
		}
		cout<<endl;
	}
}

void debug(VVLL &board){
	int h = board.size();
	int w = board.at(0).size();
	rep(i,h){
		rep(j,w){
			cout<<board.at(i).at(j)<<" ";
		}
		cout<<endl;
	}
}

void debug(VS &board){
	int h = board.size();
	rep(i,h){
		cout<<board.at(i)<<endl;
	}
	return;
}

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

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

int main(){
	//cout<<fixed;
	//cout<<setprecision(9)<<...
	int n;
	cin>>n;
	map<string,int> mp;
	rep(i,n){
		string s;
		cin>>s;
		mp[s]++;
	}
	cout<<"AC x "<<mp["AC"]<<endl;
	cout<<"WA x "<<mp["WA"]<<endl;
	cout<<"TLE x "<<mp["TLE"]<<endl;
	cout<<"RE x "<<mp["RE"]<<endl;

	return 0;
}


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

//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)
//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();}

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

typedef long long LL;
const LL mod=1000000007;
#define MAX 10000
#define NIL -1
const double PI  = acos(-1.0);
const int INF = 1e9 + 7;
//-------------------------------------------

int x[MAX];
int y[MAX];
int xd,yd;
int d;

int main(){

    cin.tie(0);
    ios::sync_with_stdio(false);

    cin >> x[1] >> y[1] >> x[2] >> y[2] ;


    xd = abs(x[2] - x[1]);
    yd = abs(y[2] - y[1]);
    //d = pow(xd*xd+ yd*yd, 0.5);
    if( x[2] >= x[1] && y[2] >= y[1]){
        x[3] = x[2] - yd;
        y[3] = y[2] + xd;
        x[4] = x[1] - yd;
        y[4] = y[1] + xd;

    }else if( x[2] >= x[1] && y[2] < y[1]){

        x[3] = x[2] + yd;
        y[3] = y[2] + xd;
        x[4] = x[1] + yd;
        y[4] = y[1] + xd;

    }else if( x[2] < x[1] && y[2] >= y[1]){

        x[3] = x[2] - yd;
        y[3] = y[2] - xd;
        x[4] = x[1] - yd;
        y[4] = y[1] - xd;

    }else if( x[2] < x[1] && y[2] < y[1]){
        x[3] = x[2] + yd;
        y[3] = y[2] - xd;
        x[4] = x[1] + yd;
        y[4] = y[1] - xd;
    }






    cout << x[3] <<" " << y[3] <<" " << x[4] << " "<< y[4];




    return 0;
}


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

using namespace std;

#define llong long long int
#define ldouble long double
#define rep(i, n) for (size_t i = 0; i < n; ++i)
#define all(x) x.begin(), x.end()
#define allr(x) x.rbegin(), x.rend()
#define stl_rep(itr, x) for (auto itr = x.begin(); itr != x.end(); ++itr)

const static int MOD = 1000000000 + 7;
const static llong INF = 1LL << 60;
const static int dy[] = {0, 1, 0, -1};
const static int dx[] = {1, 0, -1, 0};


const static int MAX = 200;
llong d[MAX + 1][MAX + 1];

int main (int argc, char *argv[]) {
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n;
    cin >> n;
    ldouble sum_BTC = 0, sum_yen = 0;
    rep(i, n) {
        ldouble x;
        string u;
        cin >> x >> u;
        if (u == "BTC") sum_BTC += x;
        else sum_yen += x;
    }

    ldouble ans = 380000 * sum_BTC + sum_yen;

    cout << fixed << setprecision(5) << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
inline int read() {
    int x = 0, fh = 1;
    char c = getchar();
    while (c < '0' || c > '9') {
        if (c == '-')
            fh = -1;
        c = getchar();
    }
    while (c >= '0' && c <= '9') {
        x = (x << 1) + (x << 3) + c - '0';
        c = getchar();
    }
    return x * fh;
}
int x;
int main() {
	x = read();
	cout << (x == 1 ? 0 : 1) << '\n';
	return 0;
}

Measured memory_bytes: 3540
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;


public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt(), m = sc.nextInt();
		Map<Integer, Integer> map = new HashMap<Integer, Integer>();
		while(m-- > 0) {
			int i = sc.nextInt(), j = sc.nextInt();
			
			if(!map.containsKey(i))	map.put(i, 1);
			else	map.put(i, map.get(i)+1);
			
			if(!map.containsKey(j))	map.put(j, 1);
			else	map.put(j, map.get(j)+1);
		}
		
		boolean f = true;
		for(int i : map.keySet())
			if(map.get(i) % 2 != 0) {
				f = false;
				break;
			}
		
		if(f)	System.out.println("YES");
		else	System.out.println("NO");
	}
}


Measured memory_bytes: 92112
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define FORD(i,a,b) for(int i=a;i>=b;i--)
#define FORL(i,x) for(int i=head[x];i;i=nxt[i])
#define ALL(a)  (a).begin(),(a).end()
#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())
#define PB push_back
#define MP make_pair
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; }



int main() {
    int a,b;
    cin >> a >> b;
    int sum_tap = 1;
    int ans = 0;
    while(sum_tap<b){
        --sum_tap;
        sum_tap += a;
        ++ans;
    }
    cout << ans << endl;
}



Measured memory_bytes: 256
#include<cstdio>
#include<queue>
#include<cstring>
#define RI register int
#define CI const int&
using namespace std;
const int N=500005;
queue <int> q; int n,val[N]; char s[N]; long long ans;
int main()
{
	RI i,H=0,T=0; scanf("%s",s+1); n=strlen(s+1)+1;
	for (i=1;i<=n;++i) if ((s[i-1]!='<')&&(s[i]!='>')) q.push(i);
	while (!q.empty())
	{
		int now=q.front(); q.pop();
		if (now>1&&s[now-1]=='>'&&val[now-1]<val[now]+1) val[now-1]=val[now]+1,q.push(now-1);
		if (now<n&&s[now]=='<'&&val[now+1]<val[now]+1) val[now+1]=val[now]+1,q.push(now+1);
	}
	for (i=1;i<=n;++i) ans+=val[i]; return printf("%lld",ans),0;
}

Measured memory_bytes: 3584
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <queue>
#include <bitset>     //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>        //do setprecision
#include <ctime>
#include <complex>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)

#define ST first
#define ND second
#define PB push_back
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double

const double pi = 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342;
const int mod=1000000007;

int main(){

    int k;

    cin >> k;

    cout << k/2 * ((k+1)/2);

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define ms(s, n) memset(s, n, sizeof(s))
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define FORd(i, a, b) for (int i = (a); i >= (b); --i)
#define sz(a) int((a).size())
#define pconent(t, x) (t.find(x) != t.end())
#define all(a) (a).begin(), (a).end()
#define uni(a) (a).erase(unique(all(a)), (a).end())
#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second
#define prec(n) fixed<<setprecision(n)
#define bit(n, i) (((n) >> (i)) & 1)
#define bitcount(n) __builtin_popcountll(n)
typedef long long ll;
typedef long double ld;
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> ost;
const ll MOD =  1e9+7;
const ll LINF = (ll) 1e18;
const ld PI = acos((ld) -1);
const ld EPS = 1e-9;
inline ll gcd(ll a, ll b) {ll r; while (b) {r = a % b; a = b; b = r;} return a;}
inline ll lcm(ll a, ll b) {return a / gcd(a, b) * b;}
inline ll fpow(ll n, ll k, int p = MOD) {ll r = 1; for (; k; k >>= 1) {if (k & 1) r = r * n % p; n = n * n % p;} return r;}
inline ll isqrt(ll k) {ll r = sqrt(k) + 1; while (r * r > k) r--; return r;}
inline ll icbrt(ll k) {ll r = cbrt(k) + 1; while (r * r * r > k) r--; return r;}
inline int inv(int a, int p = MOD) {return fpow(a, p - 2, p);}
inline int sign(ld x) {return x < -EPS ? -1 : x > +EPS;}
inline int sign(ld x, ld y) {return sign(x - y);}
#define db(v) (cout<<#v<<" = "<<v<<endl)
#define endln (cout<<endl)
template <class T> inline void dbv(T a) {  for(auto x : a){ cout<<x<<", " ;} cout<<endl;}
vector<vector<pair<ll,ll> > >g;

void output(ll tx)
{
    ll n;
    cin>>n;
    vector<ll> a(n);
    FOR(i,0,n)
    {
        cin>>a[i];
    }
    ll c = 0;
    ll ans = 0;
    FOR(i,1,n)
    {
        if(a[i]==a[i-1] && c==0)
        {
            ans++;
            c = 1;
        }
        else if(c==1)
        {
            c=0;
        }
    }
    cout<<ans<<endl;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll t =1;
    // cin>>t;
    FOR(i,0,t)
    {
        output(i+1) ;
    }
    return 0 ;
}

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

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

    int x;
    cin >> x;
    int alpha=x/500;
    x=x-(500*alpha);
    int beta=x/5;
    cout << (alpha*1000)+(beta*5) << endl;

    return 0;
}


Measured memory_bytes: 256