akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
#define MAX 100000
#define NIL -1

typedef struct{
  int p,l,r;
}Node;
Node T[MAX];
int n,D[MAX];

void print(int u){
  int i,c;
  printf("node %d: ",u);
  printf("parent = %d, ",T[u].p);
  printf("depth = %d, ",D[u]);
  if(T[u].p == NIL)printf("root, ");
  else if(T[u].l == NIL)printf("leaf, ");
  else printf("internal node, ");

  printf("[");
  for(i=0,c=T[u].l;c!=NIL;i++,c=T[c].r){
    if(i)printf(", ");
    printf("%d",c);
  }
  printf("]\n");
}

void setDepth(u,p){
  D[u] = p;
  if(T[u].r != NIL)setDepth(T[u].r, p);
  if(T[u].l != NIL)setDepth(T[u].l, p+1);
}

int main(){
  int i,j,d,v,c,l,r;
  scanf("%d",&n);
  for(i=0;i<n;i++)T[i].p = T[i].l = T[i].r = NIL;
  for(i=0;i<n;i++){
    scanf("%d",&v);
    scanf("%d",&d);
    for(j=0;j<d;j++){
      scanf("%d",&c);
      if(j==0)T[v].l=c;
      else T[l].r=c;
      l = c;
      T[c].p = v;
    }
  }
  for(i=0;i<n;i++){
    if(T[i].p==NIL)r = i;
  }

  setDepth(r,0);

  for(i=0;i<n;i++)print(i);

  return 0;
}

Measured memory_bytes: 5296
import sys
from math import ceil, floor
from collections import deque, Counter, defaultdict
from fractions import gcd
input = lambda: sys.stdin.readline().rstrip()

def eprint(s):
    sys.stderr.write('DEBUG: {}'.format(s))
    return

def main():
    n,m = map(int, input().split())
    As = list(map(int, input().split()))
    sm = sum(As)

    if (n-sm < 0):
        print(-1)
    else:
        print(n-sm)
    
    return

if __name__ == '__main__':
    main()

Measured memory_bytes: 11296
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		int C = sc.nextInt();
		int X = sc.nextInt();
		int count=0;
		
		for(int a = 0;a<=A;a++) {
			if(500 * a>X) {
				break;
			}
			for(int b = 0;b<=B;b++) {
				if((500 * a)+(100 * b) > X) {
					break;
				}
				for(int c = 0;c<=C;c++) {
					if((500 * a)+(100 * b)+(50 * c)>X) {
						break;
					}
					int sum =(500 * a)+(100 * b)+(50 * c);
					if(sum==X) {
						count++;
					}
				}
			}
		}
		System.out.println(count);
		
	}
}

Measured memory_bytes: 21972
N = int(input())
dp = [float('inf')]*(N+1)
dp[0] = 0
for i in range(1, N+1):
    dp[i] = 1 + dp[i-1]
    j, k = 1, 1
    while pow(6, j) <= i:
        dp[i] = min(dp[i], 1 + dp[i - pow(6, j)])
        j += 1
    while pow(9, k) <= i:
        dp[i] = min(dp[i], 1 + dp[i - pow(9, k)])
        k += 1
print(dp[-1])

Measured memory_bytes: 68656
#include<bits/stdc++.h>
#define FOR0(i,n) for(int i=0;i<n;i++)
#define FOR1(i,n) for(int i=1;i<=n;i++)
#define FORl(i,l,n) for(int i=l;i<n;i++)
using namespace std;
#define pi pair<ll,ll>
#define pb push_back
#define ll long long
#define ld long double
#define ff first
#define ss second
#define mp make_pair
#define mst0(x) memset(x,0,sizeof(x));
#define vi vector<ll>
#define sync ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl '\n'
#define sp <<" "<<
#define intmax 1e14

ll power(ll num,ll g,ll mod){
  if(g==0)return 1;
  if(g%2==1)return (num*power((num*num)%mod,g/2,mod))%mod;
  return power((num*num)%mod,g/2,mod);
}

int main() {
    int n;
    cin >> n;
    if (n >= 30){
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
}


Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,cnt = 0,cmax = 0;
  cin >> n;
  vector<int> a(n);
  for(int i = 0;i<n;i++){
    cin >> a.at(i);
  }
  for(int i = 0;i<n-1;i++){
    if(a.at(i+1)<=a.at(i)){  
      cnt++;
    }else{
      if(cmax<cnt)cmax = cnt;
      cnt = 0;
    }
  }
  if(cmax<cnt)cmax = cnt;
  cout << cmax << endl;
}

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

#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

#define bug( x ) cerr << #x << '=' << x << '\n' ;


int n ,i;



int main(){

	//IOS

	cin >> n ;

	for ( i = 1; i <=50000; ++i)
	{
		if( (int)(i*1.08) ==n){
			cout<<i;
			break;
		}
		//bug(i*1.08)
	}

	if(i==50001)cout<<":(";

	
 
}

Measured memory_bytes: 256
#include<bits/stdc++.h>;
using namespace std;
//#define LOCAL
typedef long long ll;
#define fastIO ios::sync_with_stdio(0), cin.tie(0)
int a[5];
int main(){
#ifdef LOCAL
     freopen("in.txt", "r", stdin);
     //freopen("out.txt", "w", stdout);
#else
 fastIO;
#endif
//***************************//**************************//******************************

int x,y;
cin>>x>>y;
bool ans=0;
for(int i=0;i<x+1;i++){
    int b = x-i;
    if(i*2 + b*4 ==y){
        ans=1;
        break;
    }
}
if(ans){
    cout<<"Yes"<<endl;
}else{
cout<<"No"<<endl;}
}


Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
int main()
{
	string s;
	cin>>s; int h=0;
	string::iterator ptr,qtr;
	for(ptr=s.begin(),qtr=s.end()-1;ptr<=qtr;ptr++,qtr--)
	{
		if(*ptr!=*qtr)
		h++;
	}
	cout<<h;
	return 0;
}


Measured memory_bytes: 256
//専用ライブラリ
#include <iostream>
#include <iomanip>
#include <istream>
#include <ostream>
#include <sstream>
#include <iterator>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <utility>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <ctime>
#include <cctype>
#include <cstdlib>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll>P;
#define INF 10e16
#define MOD 1000000007
#define rep(i, a, n) for (ll i = a; i < (ll)(n); i++)
#define fi first
#define se second
#define mmax(x,y)(x>y?x:y)
#define mmin(x,y)(x<y?x:y)
#define PI acos(-1.0)
long long GCD(long long a, long long b) { return b ? GCD(b, a%b) : a; }
long long LCM(long long a, long long b)  {return a/GCD(a,b)*b;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
int cmp(P a,P b){
        if(a.fi!=b.fi)
        return a.fi>b.fi;
        else
        return a.se<b.se;
}
//---------------------------------------------------------------------------

//---------------------------------------------------------------------------
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    //-------------------------------
    string s;
    cin>>s;
    ll x=0;
    ll y=0;
    ll sum=0;
    ll i=0;
    ll n=s.size();
    if(s[0]=='>')
    {
        while(s[i]=='>'&&i<n)
        {i++;
            }
       // i--;
        sum+=(i+1)*i/2;
    }
    while(i<n)
    {
        
        
        if((i==0&&s[i]=='<')||(s[i]=='<'&&s[i-1]=='>'&&i>0))
        {
            x++;
            i++;
            while(!(s[i]=='<'&&s[i-1]=='>')&&i<n)
            {
                if(s[i]=='<')
                    x++;
                else
                    y++;
                i++;
            }
            if(x>y)
            {   y--;
                sum+=(x+1)*x/2;
                sum+=(y+1)*y/2;
            }
            else
            {
                    x--;
                sum+=(x+1)*x/2;
                sum+=(y+1)*y/2;
            }
           x=0;
            y=0;
        }
    
    }
    cout<<sum<<endl;
    //-------------------------------
    return 0;
}
//---------------------------------------------------------------------------


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

using namespace std;

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

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define CHMIN(a,b) a=min((a),(b))
#define CHMAX(a,b) a=max((a),(b))

// mod
const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

// floating
typedef double Real;
const Real EPS = 1e-11;
#define EQ0(x) (abs(x)<EPS)
#define EQ(a,b) (abs(a-b)<EPS)
typedef complex<Real> P;

int main(){
  int n;
  cin>>n;
  cout<<(n*800 - (n/15)*200)<<endl;
  return 0;
}


Measured memory_bytes: 256
// #define _GLIBCXX_DEBUG // for STL debug (optional)
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;
using ll = long long int;
using int64 = long long int;
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const int INF = 1LL << 29;
const ll LONGINF = 1LL << 60;
const ll MOD = 1000000007LL;

pair<int, int> dp[35][35][35][35];
bool checked[35][35][35][35];

int solve_testcase() {
    int H, W, S; scanf("%d%d%d", &H, &W, &S);
    if(H == 0 and W == 0 and S == 0) return 1;

    int U[35][35] = {}, sum = 0;
    for(int i=0; i<H; i++) {
        for(int j=0; j<W; j++) {
            scanf("%d", &U[i+1][j+1]);
            sum += U[i+1][j+1];
            U[i+1][j+1] += U[i][j+1] + U[i+1][j] - U[i][j];
        }
    }

    const pair<int, int> NIL(-1, -1);
    fill(dp[0][0][0], dp[H][0][0], NIL);
    fill(checked[0][0][0], checked[H][0][0], false);
    auto dfs = [&](auto &&self, int lx, int rx, int ly, int ry)
        -> pair<int, int> {
        if(checked[lx][rx][ly][ry]) return dp[lx][rx][ly][ry];
        checked[lx][rx][ly][ry] = true;
        
        pair<int, int> res = NIL;
        int rect_sum = U[rx][ry] - U[lx][ry] - U[rx][ly] + U[lx][ly];
        if(sum - rect_sum <= S) {
            res = make_pair(1, rect_sum);
        }
        for(int x=lx+1; x<rx; x++) {
            auto z0 = self(self, lx, x, ly, ry);
            auto z1 = self(self, x, rx, ly, ry);
            if(z0 == NIL or z1 == NIL) continue;
            pair<int, int> cand(z0.first + z1.first, min(z0.second, z1.second));
            chmax(res, cand);
        }
        for(int y=ly+1; y<ry; y++) {
            auto z0 = self(self, lx, rx, ly, y);
            auto z1 = self(self, lx, rx, y, ry);
            if(z0 == NIL or z1 == NIL) continue;
            pair<int, int> cand(z0.first + z1.first, min(z0.second, z1.second));
            chmax(res, cand);
        }
        return dp[lx][rx][ly][ry] = res;
    };

    auto ans = dfs(dfs, 0, H, 0, W);
    printf("%d %d\n", ans.first, S - (sum - ans.second));
    return 0;
}

int main() {
    while(!solve_testcase());
    return 0;
}



Measured memory_bytes: 15260
#include <cstdlib>
#include <cmath>
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <cstring>
#include <string>
#include <map>
#include <list>
#define MOD 1000000007
#define INF 1000000000
typedef long long ll;
using namespace std;
typedef pair<int,int> P;

int main(void){
    int n;
    cin>>n;
    int alpha[26]={};
    string s;
    cin>>s;
    for(int i=0;i<s.size();i++){
        alpha[s[i]-'a']++;
    }
 for(int i=1;i<n;i++){
     int tmp[26]={};
     string s;
     cin>>s;
     for(int j=0;j<s.size();j++){
         tmp[s[j]-'a']++;
     }
     for(int j=0;j<26;j++){
         alpha[j]=min(alpha[j],tmp[j]);
     }
 }
    string ans="";
    for(int i=0;i<26;i++){
        for(int j=0;j<alpha[i];j++){
            ans+=('a'+i);
        }
    }
    cout<<ans<<endl;
    return 0;
}

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

int main(){
    int N;
    vector<int> A;
    cin >> N;
    for (int i = 0; i < N; ++i){
        int a;
        cin >> a;
        A.push_back(a);
    }
    int M = A[0];
    int m = A[0];
    for (int i = 0; i < N; ++i)
    {
        if(A[i] > M){
            M = A[i];
        }
        if(A[i] < m){
            m = A[i];
        }
    }
    cout << M - m << endl;
}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
#define int long long
#define fi first
#define se second
using namespace std;

int32_t main() {
  ios::sync_with_stdio(0); cin.tie(0);
  int n, d, a;
  cin >> n >> d >> a;
  vector<pair<int, int>> mons(n);
  for(int i = 0; i < n; ++i) {
    cin >> mons[i].fi >> mons[i].se;
  }
  sort(mons.begin(), mons.end());
  vector<pair<int, int>> bombs;
  int ans = 0;
  for(auto e : mons) {
    int x = e.fi, h = e.se;
    int needed = (h + a - 1) / a;
    int j = lower_bound(bombs.begin(), bombs.end(), make_pair(x - 2 * d, 0ll))
          - bombs.begin();    
    int already = 0;
    if(j < bombs.size()) {
      if(j == 0) already += bombs.back().se;
      else already += bombs.back().se - bombs[j - 1].se;
    }
    needed -= already;
    if(needed > 0) {
      ans += needed;
      bombs.push_back({x, needed + (bombs.size() ? bombs.back().se : 0)});
    }
  }
  cout << ans << '\n';
}

Measured memory_bytes: 8304
s=str(input())

def solve(s):
  temp=''
  ans=0
  f=0
  for i in range(len(s)):
    if f==1:
      f=0
      continue
    if temp==s[i]:
      if(i==len(s)-1):
        break
      temp=s[i]+s[i+1]
      f=1
    else:
      temp=s[i]
    ans+=1
  return ans
  
print(solve(s))

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

int main() {
    int N;
    cin >> N;
    set<int> values;
    for(int i = 0; i < N; i++) {
        int temp;
        cin >> temp;
        values.insert(temp);
    }
    cout << values.size() << endl;
    return 0;
}

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

int main(){
  vector<int> P={2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97};
//素数は25個  
  vector<int> count(25, 0);
  int N;
  cin >> N;
  for(int i=0; i<25; i++){
    for(int j=1; j<=N; j++){
      int n=j;
      int p=P.at(i);
      while(n%p==0){
        n=n/p;
        count.at(i)++;
      }
    }
  }
  vector<int> C(75, 0);
  for(int i:{2, 4, 14, 24, 74}){
    for(int j=0; j<25; j++){
      if(count.at(j)>=i){
        C.at(i)++;
      }
    }
  }
  int Ans=0;
  Ans+=C.at(74);
  Ans+=C.at(24)*(C.at(2)-1);
  Ans+=C.at(14)*(C.at(4)-1);
  Ans+=(C.at(4)*(C.at(4)-1)/2)*(C.at(2)-2);
  cout << Ans << endl;
}


Measured memory_bytes: 256
#include<stdio.h>

void swap(int* n1,int* n2);

int main()
{
    int a,b,c;
    scanf("%d %d %d",&a,&b,&c);
    swap(&a,&b);
    swap(&a,&c);
    printf("%d %d %d",a,b,c);
}

void swap(int* n1,int* n2)
{
    int temp;
    temp = *n1;
    *n1 = *n2;
    *n2 = temp;
}


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

using namespace std;
using ll = long long;

#define REP(i, n) for (ll i = 0; i < n; i++)
#define INF 9223372036854775807
#define all(x) (x).begin(), (x).end()

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

  ll n;
  string s;
  cin >> n >> s;

  ll R = 0, G = 0, B = 0;
  REP(i, n) {
    if (s[i] == 'R') {
      R++;
    } else if (s[i] == 'G') {
      G++;
    } else {
      B++;
    }
  }

  ll RGB = 0;

  for (int j = 1; j <= n / 2; j++) {
    for (int i = 0; i + (2 * j) < n; i++) {
      if (s[i] != s[i + j] && s[i] != s[i + (2 * j)] &&
          s[i + j] != s[i + (2 * j)])

        RGB++;
    }
  }
  cout << R * G * B - RGB << "\n";
}

Measured memory_bytes: 3672
#include <stdio.h>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <string>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cassert>

using namespace std;
typedef long long LL;
typedef pair<int,int> pii;

const int MAXN = 1e5+1;
const int MOD = 1e9 + 7;
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define FAILNO {cout << "NO\n"; return 0;}
#define FAIL1 {cout << "-1\n"; return 0;}

char S[5];

int main() {
#ifdef OJ
	freopen("input.txt", "rt", stdin);
	//freopen("output.txt", "wt", stdout);
#endif

	cin >> S;
	sort(S,S+4);
	if (S[0] == S[1] && S[2] == S[3] && S[0] != S[2]) cout << "Yes\n";
	else cout << "No\n";

	return 0;
}



Measured memory_bytes: 256
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
input = sys.stdin.readline
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
	return list(map(int,input().split()))
def m(): #複数文字
	return map(int,input().split())
def onem(): #Nとかの取得
	return int(input())
def s(x): #圧縮
	a = []
	if len(x) == 0:
		return []
	aa = x[0]
	su = 1
	for i in range(len(x)-1):
		if aa != x[i+1]:
			a.append([aa,su])
			aa = x[i+1]
			su = 1
		else:
			su += 1
	a.append([aa,su])
	return a
def jo(x): #listをスペースごとに分ける
	return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
	return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False

def pow_k(x, n):
    ans = 1
    while n:
        if n % 2:
            ans *= x
        x *= x
        n >>= 1
    return ans

"""
def nibu(x,n,r):
	ll = 0
	rr = r
	while True:
		mid = (ll+rr)//2

	if rr == mid:
		return ll
	if (ここに評価入れる):
		rr = mid
	else:
		ll = mid+1
"""
mod = 10**9+7 #出力の制限
N = 10**6*2
def cmb(n, r):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod
def p(n,r):
    if ( r<0 or r>n ):
        return 0
    return g1[n] * g2[n-r] % mod

g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )
# a = cmb(n,r)

k = onem()

s = input()[:-1]

ans = 0
ss = len(s)
for i in range(ss,ss+k+1):
	ans += cmb(ss+k-(ss+k-i)-1,ss-1) * pow(25,i-ss,mod) * pow(26,(ss+k-i),mod)
	ans %= mod
print(ans)



Measured memory_bytes: 186324
#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>
using namespace std;

#define ll         long long
#define PI         acos(-1.0)
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)

//素数で割っていく
ll MOD = pow(10,9) + 7;
bool isPrime[1001];

void prime(){
    FOR(i, 0, 1001) isPrime[i] = true;
    FOR(x, 2, 1001){
        if(!isPrime[x]) continue;
        for(int i=x*2; i<1001; i+=x){
            isPrime[i] = false;
        }
    }
}

ll llpow(int x, int y){
    int n = y;
    int ret = 0;
    while(x>=n && x%n==0){
        n *= y;
        ret++;
    }
    return ret;
}

int main(void){
    prime();
    int N;
    cin>>N;
    ll num[N+1];
    FOR(i, 0, N+1) num[i] = i;
    ll ans = 1;
    FOR(i, 2, N+1){
        if(!isPrime[i]) continue;
        ll ruijo = 0;
        FOR(j, 2, N+1){
            if(num[j]%i==0){
                //何乗か
                ll rui = llpow(num[j], i);
                ruijo += rui;
                num[j] /= pow(i, rui);
            }
        }
        ans *= (ruijo+1) % MOD;
        ans = ans % MOD;
    }

    cout << ans << endl;
}

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

using ld = long double;
using point = complex<ld>;
#define f(i,a,b) for (int i = a; i < b; i++)
#define Max(a,b) a=max(a,b)
#define pb push_back
#define x real()
#define y imag()

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
#ifdef LOCAL
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	clock_t start = clock();
#endif

	int n; cin >> n;
	point p[n];
	f(i,0,n) {
		ld a,b; cin>>a>>b;
		p[i] = point(a,b);
	}
	f(i,0,n) {
		vector<ld> angles;
		f(j,0,n) if (i != j)
			angles.pb(arg(p[j]-p[i]));
		f(j,0,angles.size())
			if (angles[j] < 0) angles[j] += 2*M_PI;
		sort(begin(angles),end(angles));
		int m = angles.size();
		ld ans = 0;
		f(j,0,m-1) {
			ld v = angles[j+1] - angles[j]; 
			Max(ans,v-M_PI);	
		}
		Max(ans,angles[0]-angles[m-1]+M_PI);
		ans /= 2*M_PI;
		cout << setprecision(20) << ans << endl;
	}

#ifdef LOCAL
	cout << setprecision(12) << (long double)(clock()-start) / CLOCKS_PER_SEC << endl;
#endif
	
	return 0;
}



Measured memory_bytes: 384
#include <bits/stdc++.h>
 
using namespace std;
 
using i64 = long long;
#define forn(a, e) for (i64 a = 0; a < (i64)(e); a++)
#define forr(a, s, e) for (i64 a = s; a < (i64)(e); a++)
#define fore(e, a) for (auto& e : a)
 
#ifdef LOCAL
#define logv(a) {cerr << #a << " = "; fore(e, a) {cerr << e << " ";} cerr << "\n";}
#define logvp(a) {cerr << #a << " = "; fore(e, a) {cerr << "(" << e.first << ", " << e.second << ") ";} cerr << "\n";}
#define logvv(a) {cerr << #a << " = \n"; fore(r, a) { fore(e, r) {cerr << e << " ";} cerr << "\n";} }
#define logvf(a, field) {cerr << #a"."#field << " = \n"; fore(e, a) { cerr << e.field << " ";} cerr << "\n"; }
#define logvff(a, f1, f2) {cerr << #a".{"#f1 << ", "#f2 << "} = \n"; fore(e, a) { cerr << "(" << e.f1 <<", " << e.f2 << ") ";} cerr << "\n"; }
#define logs(a) cerr << #a << " = " << (a) << "\n";
#define logss(a, b) cerr << #a << " = " << (a) << ", " << #b << " = " << (b) << "\n";
#define logp(a) cerr << #a << " = " << "(" << a.first << ", " << a.second << ")" << "\n";
#define cond(pred, stmt) if (pred) { stmt }
#else
#define logv(a)
#define logvp(a)
#define logvv(a)
#define logvf(a, field)
#define logvff(a, f1, f2)
#define logs(a)
#define logss(a, b)
#define logp(a)
#define cond(pred, stmt)
#endif
 
using iip = pair<int, int>;
using llp = pair<i64, i64>;
using ivec = vector<int>;
using llvec = vector<i64>;
using svec = vector<string>;
template<typename T> using vec = vector<T>;
 
template<typename T, typename Dim>
auto make_vec(T value, Dim dim) { return vector<T>(dim, value); }
template<typename T, typename Dim1, typename... Dim>
auto make_vec(T value, Dim1 dim1, Dim... dims) { return make_vec(make_vec(value, dims...), dim1); }
 
template<typename T>
bool uax(T& v, const T& newv) { if (v < newv) { v = newv; return true; } else return false; }
template<typename T>
bool uin(T& v, const T& newv) { if (v > newv) { v = newv; return true; } else return false; }
 
template<typename T>
istream& operator>>(istream& is, vector<T>& c) { for (auto& e : c) is >> e; return is; }
template<typename T, size_t N>
istream& operator>>(istream& is, array<T, N>& c) { for (auto& e : c) is >> e; return is; }
 
template<typename ...T>
istream& read(T&... args) { return (cin >> ... >> args); }
 
static mt19937 rande(123123);
template<typename T>
T rand_int(T from, T to) { uniform_int_distribution<T> distr(from, to); return distr(rande); }
 
constexpr i64 INF = 1e18;
// constexpr int MXB = 4;
constexpr int MXB = 9;
using bin = bitset<MXB>;
constexpr i64 M = 1e9 + 7;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    rande.seed(chrono::steady_clock::now().time_since_epoch().count());

    i64 n;
    while (read(n)) {
        ivec a(n);
        read(a);
        auto dp = make_vec(-INF, n, 2);

        dp[0][0] = a[0];
        forr(i, 1, n) {
            ivec aa = {a[i - 1], -a[i - 1]};
            forn(j, 2) if (dp[i - 1][j] != -INF) {
                uax(dp[i][0], dp[i - 1][j] + a[i]);
                uax(dp[i][1], dp[i - 1][j] - 2 * aa[j] - a[i]);
            }
        }

        cout << max(dp[n - 1][0], dp[n - 1][1]) << endl;
    }
}


Measured memory_bytes: 9004
package main

import (
	"fmt"
	"math"
)

func main() {
	var (
		s string
		k int
	)
	fmt.Scan(&s, &k)

	ans := ""
	for i := 0; k > 0; i++ {
		k -= int(math.Pow(float64(s[i]-'0'), 5000000000000000))
		ans = string(s[i])
	}

	fmt.Println(ans)
}


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

int main(void){
 
  	int num;
  
  	cin >> num;
  
  	int array[num];
  
  	for(int i = 0; i < num; i++){
      cin >> array[i];
    }
  
  	bool flg = true;
  
  	for(int i = 0; i < num; i++){
      if(array[i] % 2 != 0){
        flg = false;
      }
    }
  
	int count = 0;  
  
  	while(flg){
      for(int i = 0; i < num; i++){
        array[i] /= 2;
        if(array[i] % 2 != 0){
          flg = false;
        }
      }
      count++;
    }
  
  	cout << count << endl;	
  
	return 0; 
}


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

using namespace std;

int main()
{
   int n,t=0,f=0,s=0;
   cin>>n;
   long long a[n];
   for(int i=0;i<n;i++)
        cin>>a[i];
   for(int i=0;i<n;i++)
   {
       if(a[i]%4==0)
       {
           f+=1;
       }
       else if(a[i]%2==0)
       {
           t+=1;
       }
       else
       {
           s+=1;
       }
   }

    if(t==0&&f>=s-1)
        cout<<"Yes"<<endl;

     else if(t>0&&f>=s)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b,cnt=0;
  string s;
  cin>>a>>b>>s;
  for(int i=0;i<s.size();i++){
    if(s[i]=='-') cnt++;
    if(cnt>=2){ cout<<"No"; return 0; }
  }
  if(s[a]=='-' && s.size()==a+b+1) cout<<"Yes";
  else cout<<"No";
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (ll i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef vector<vector<ll> > Graph;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const ll INF = 1e16;




int main(){
    int n,m;
    cin >> n >> m;
    if(n%2==1){
        rep(i,min(m,n/2)){
            cout << i+1 << ' ' << n-i-1 << endl;
        }
    }
    else{
        rep(i,min(m,n/4)){
            cout << i+1 << ' ' << n-i << endl;
        }
        rep(i,(m-n/4)){
            cout << i+n/4+1 << ' ' << n-n/4-i-1 << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<long long, long long>;
const long long INF = 1001001001;
const long long MOD = 1000000007;
const double EPS = 1e-10;
struct Edge { int from, to; long long cost; };
using Graph = vector<vector<Edge>>;

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

    int h,w,k;
    cin>>h>>w>>k;
    string s[h];
    int cnt=0;
    for(int i=0;i<h;i++){
        cin>>s[i];
        for(int j=0;j<w;j++){
            if(s[i][j]=='#')cnt++;
        }
    }
    int ans=0;
    for(int bit_x=0;bit_x<(1<<h)-1;bit_x++){
        for(int bit_y=0;bit_y<(1<<w)-1;bit_y++){
            int tmp=cnt;
            for(int i=0;i<h;i++){
                for(int j=0;j<w;j++){
                    if(bit_x>>i&1||bit_y>>j&1){
                        if(s[i][j]=='#')tmp--;
                    }
                }
            }
            if(tmp==k)ans++;
        }
    }
    cout<<ans<<endl;
}

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

using namespace std;
using ll = long long;

int main(){
	ios_base::sync_with_stdio(false);
	int m;
	cin >> m;
	vector<ll> a(m);
	for(int i = 0; i < m; ++i){ cin >> a[i]; }
	ll lo = 2, hi = 2;
	for(int i = m - 1; i >= 0; --i){
		if(lo % a[i] != 0 && lo / a[i] == hi / a[i]){
			cout << -1 << endl;
			return 0;
		}
		lo = (lo + a[i] - 1) / a[i] * a[i];
		hi = (hi / a[i] * a[i]) + a[i] - 1;
	}
	cout << lo << " " << hi << endl;
	return 0;
}



Measured memory_bytes: 1024
import sys
input=sys.stdin.readline
n=int(input())
x,y=[],[]
for i in range(n):
  x_,y_=map(int,input().split())
  x.append((x_,i))
  y.append((y_,i))
x.sort()
y.sort()
edges=[]
for i in range(n-1):
  edges.append((abs(x[i][0]-x[i+1][0]),x[i][1],x[i+1][1]))
  edges.append((abs(y[i][0]-y[i+1][0]),y[i][1],y[i+1][1]))
edges.sort()
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)
def kruskal(n, edges):#edges: wでソート済み
    uf = UnionFind(n)
    res = 0
    for e in edges:
        w, s, t = e
        if not uf.same(s, t):
            res+=w
            uf.union(s, t)
    return res
print(kruskal(n, edges))

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

class Program
{
    static void Main(string[] args)
    {
        int num = int.Parse(Console.ReadLine());
        int[] input = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();

        int count = 0;

        for (; ; count++)
        {
            bool finFLG = false;

            for (int i = 0; i < num; i++)
            {
                if (input[i] % 2 == 0)
                {
                    input[i] /= 2;
                }
                else
                {
                    finFLG = true;
                    break;
                }
            }

            if (finFLG)
            {
                break;
            }

        }

        Console.WriteLine(count.ToString());
    }
}

Measured memory_bytes: 11348
#include <iostream>
#include <vector>
using namespace std;
typedef long long ll;
#define rep(i,s,k) for(int i=(s);i<(k);i++) 

ll max(ll a,ll b){
    if(a>b)return a;
    else return b;
}
int main(){
    int N,W;
    cin >> N >> W;
    int w[100100];
    int v[100100];
    for(int i=0;i<N;i++){
        cin >> w[i] >> v[i];
        
    }
    ll dp[110][100100] ={0};
    for(int i=0;i<=W;i++){
        if(w[0]<=i){
            dp[0][i] = v[0];
        }
    }
    for(int j=1;j<N;j++){
        for(int i=0;i<=W;i++){
            dp[j][i] =max(dp[j-1][i],dp[j][i]);
            if(i>=w[j])dp[j][i] = max(dp[j][i],dp[j-1][i-w[j]]+v[j]);
        }
    }
    
        cout << dp[N-1][W] << endl;
   
    
    return 0;
}

Measured memory_bytes: 86656
#include <iostream>
#include <string>
#include <algorithm>
#include <map>
#include <cmath>
#include <iomanip>
#include <vector>
#include <queue>
#include <functional>
#include <random>
#include <ctime>

using namespace std;
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define REP(i, n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
typedef long long int ll;
typedef pair<ll, ll> P;

int main() {
    int a, b;
    cin >> a >> b;
    string ans = max(a, b) <= 8 ? "Yay!" : ":(";
    cout << ans;
    return 0;
}

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

int main() {
   int N, K;
   cin >> N >> K;
   map<int, int> mp;
   while (N--) {
      int a;
      cin >> a;
      mp[a]++;
   }
   vector<int> v;
   for (auto x : mp) {
      v.push_back(x.second);
   }
   sort(v.begin(), v.end());

   int cnt = max(0, (int)mp.size()-K);
   cout << accumulate(v.begin(), v.begin()+cnt, 0) << endl;

   return 0;
}


Measured memory_bytes: 10748
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
using namespace std;
using ll = long long;


int main(){
    ll n,cnt=0,sum=0;
    cin >> n;
    vector<ll> a(n);
    for(ll i=0;i<n;i++){
      cin >> a[i];
      if(a[i]<0)    cnt++;
      a[i] = abs(a[i]);
      sum+=a[i];
    }
    sort(a.begin(),a.end());
    if(cnt%2==0)    cout << sum;
    else    cout << sum-(2*a[0]);
    return 0;
}

Measured memory_bytes: 1024
import itertools
import math
N = int(input())
S = input()
l = len(S)


#oxooxoxoox
#s → 1 w→-1
temp = []
for c in S:
    if c == "o":
        temp.append(1)
    else:
        temp.append(-1)

S = temp

flag = False
for i in [1,-1]: # 1匹目
    for j in [1,-1]: #2匹目
        nums = [i,j]
        temp = i * j
        for k in range(1,N-1):
            nums.append(temp * S[k])
            temp = nums[k] * nums[k  + 1]
        if temp * nums[0] == S[-1]  and nums[-1] * nums[0] * nums[1] == S[0]:
            flag = True
            break
    if flag:
        break

if flag:
    for num in nums:
        if num == -1:
            print("W",end="")
        else:
            print("S", end="")

else:
    print(-1)



Measured memory_bytes: 6240
from math import factorial

mod = 10**9+7
n = int(input())
x = list(map(int, input().split()))

prev=-1
nx = []
for i in x:
    j = min(prev+2, i)
    prev = j
    nx.append(j)

prev = -1
cnt = 0
ans = 1
r = 0
for i in range(n):
    if r and nx[i]-prev>=3:
        nx[i] -= 1
    else:
        r = 0
    if prev+1<nx[i]:
        cnt += 1
        prev = nx[i]
    else:
        ans *= cnt+1
        r=1
        ans %= mod

ans *= factorial(cnt)
ans %= mod

print(ans)

Measured memory_bytes: 14716
N = int(input())
people = [int(i) for i in input().split()]

is_True = True
for p in people:
    if p % 2 == 0:
        if p % 3 != 0 and p % 5 != 0:
            is_True = False
            break

if is_True:
    print("APPROVED")
else:
    print("DENIED")

Measured memory_bytes: 2940
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <vector>
#include <set>
#include <queue>
#include <map>
#include <string>

#define rep(i, a, b) for ( int i = (a); i < (b); i++ )
#define per(i, a, b) for ( int i = (b)-1; i >= (a); i--)
#define pb push_back
#define mp make_pair
#define bg begin()
#define en end()
#define all(v) (v).begin(), (v).end()
#define sz(v) (int)(v).size()

using namespace std;

typedef long long ll;
typedef long double ld;

using P = pair<int, int>;

static const long long MOD = 1000000007;
static const long long LINF = (ll)(1e18+99);
static const int INF = 1e9+99;

int ans;
int indeg[1000005]; //入次数
int d[1000005];
vector<int> g[1000005];
map<P, int> m;
int num = 1;
int days = 0;

bool topological_sort(int _n, vector<int>& topo) {
    queue<int> q;

    for (int i=1; i<=_n; i++) {
        if (indeg[i]==0) {
            q.push(i);
            d[i] = 1;
        } else {
            d[i] = -1;
        }
    }
    while(!q.empty()) {
        int u = q.front(); q.pop();
        topo.push_back(u);
        for (int v : g[u]) {
            indeg[v]--;
            if (indeg[v]==0) {
                q.push(v);
                d[v] = d[u] + 1;
            }
        }
    }
    return (int)topo.size() == _n;
}



int main(void) {
    int n;
    cin >> n;
    for (int i=1; i<=n; i++) {
        int s, u, v;
        cin >> s;
        P p = mp(i, s);
        if (s<i) swap(p.first, p.second);
        if (m.count(p)==0) m[p] = num++;
        u = m[p];

        for (int j=2; j<=n-1; j++) {
            int t;
            cin >> t;
            P q = mp(i, t);

            if (t<i) swap(q.first, q.second);
            if (m.count(q)==0) m[q] = num++;
            v = m[q];
            g[u].push_back(v);
            indeg[v]++;
            u = v;
        }

    }

    vector<int> v;
    bool dag = topological_sort(num-1, v);

    if (dag) {
        rep(i, 1, num) {
            ans = max(ans, d[i]);
        }
    } else {
        ans = -1;
    }

    cout << ans << endl;

    return 0;
}



Measured memory_bytes: 79988
/*-- ILSH  --*/
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef double ld;

#define pb push_back 
#define pop pop_back
#define mp make_pair
#define vii vector < ll > 
#define pii pair< ll, ll > 
#define len length 
#define fi first
#define se second
#define dt cout<<"HEre\n";
#define sz size
const ll inf=1e18+1e17;
const ll mod = 1e9+7;


ll modInverse(ll a,ll m){ll m0=m;ll y=0,x=1;if(m == 1)return 0;while(a> 1){ll q=a/m;ll t=m;m=a%m,a=t;t=y;y=x-q*y;x=t;}if(x<0)x+=m0;return x;}  
ll powm(ll a,ll b){a=a%mod;ll res=1;while(b){if(b&1)res=(res*a)%mod;a=(a*a)%mod;b>>=1;}return (res%mod);}
const ll N = ( 1<<18);
void solve() {
	int n;
	cin>>n;
	if ( n> 29 ) 
		cout<<"Yes\n";
	else
		cout<<"No\n";



}


int main(){
	ios_base::sync_with_stdio(false);
	cin.tie( NULL);
	cout.tie(NULL);
	#ifndef ONLINE_JUDGE
		freopen ("INPUT.txt" , "r" , stdin);
		freopen ("OUTPUT.txt", "w" , stdout);
	#endif
	ll t=1;
//	cin>>t;
	for ( ll i=1;i<=t;i++){
	//	cout<<"Case #"<<i<<": ";
    	solve();
    }
    //	cout << clock() / double(CLOCKS_PER_SEC) << endl;
}

Measured memory_bytes: 3616
import math

N, K = map(int, input().split())
p = 0
if N >= K:
    for i in range(1, K):
        n = math.ceil(math.log2(K / i))
        p += 1 / ((2 ** n) * N)
    p += (N - K + 1)/ N
else:
    for i in range(1,N+1):
        n = math.ceil(math.log2(K/i))
        p += 1/((2 ** n) * N)
print(p)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#define int long long

main(){
    int n;
    cin>>n;
    int arr[n];
    map<int,int> m;
    for(int i=0;i<n;i++){
        cin>>arr[i];
        m[arr[i]]++;
    }
    int tot=0;
    for(auto i:m){
        if(i.second>=2)
            tot+=(i.second)*(i.second-1)/2;
    }
    for(int k=0;k<n;k++){
        int ans=tot;
        if(m[arr[k]]>2){
            ans-=(m[arr[k]])*(m[arr[k]]-1)/2;
            ans+=(m[arr[k]]-1)*(m[arr[k]]-2)/2;
            cout<<ans<<endl;
        }
        else if(m[arr[k]]==2){
            ans-=(m[arr[k]])*(m[arr[k]]-1)/2;
            cout<<ans<<endl;
        }
        else
            cout<<ans<<endl;
    }
}

Measured memory_bytes: 11008
def main():
    import sys
    from fractions import gcd
    input = sys.stdin.readline
    #配列’init_val’で初期化
    def init(init_val):
        #set_val
        for i in range(n):
            seg[i+num-1]=init_val[i]    
        #built
        for i in range(num-2,-1,-1) :
            seg[i]=gcd(seg[2*i+1],seg[2*i+2]) 
    #init_val[k]をxに変更
    def update(k,x):
        k += num-1
        seg[k] = x
        while k:
            k = (k-1)//2
            seg[k] = gcd(seg[k*2+1],seg[k*2+2])
    #[p,q)について"segfunc"したものを返す   
    def query(p,q):
        if q<=p:
            return ide_ele
        p += num-1
        q += num-2
        res=ide_ele
        while q-p>1:
            if p&1 == 0:
                res = gcd(res,seg[p])
            if q&1 == 1:
                res = gcd(res,seg[q])
                q -= 1
            p = p//2
            q = (q-1)//2
        if p == q:
            res = gcd(res,seg[p])
        else:
            res = gcd(gcd(res,seg[p]),seg[q])
        return res
    n = int(input())
    a = list(map(int,input().split()))
    #単位元
    #最小値のセグ木　float('inf')
    #和 or gcdのセグ木　0
    #積のセグ木　1
    ide_ele = 0
    #num:n以上の最小の2のべき乗
    num =2**(n-1).bit_length()
    seg=[ide_ele]*2*num
    init(a)

    ans = -1
    for i in range(n):
        ans = max(ans,gcd(query(0,i),query(i+1,n)))
    print(ans)

if __name__ == '__main__':
    main()

Measured memory_bytes: 85856
import kotlin.math.*
import java.util.*

const val MOD = 1_000_000_007L

fun readI() = readLine()!!.toInt()
fun readL() = readLine()!!.toLong()
fun readD() = readLine()!!.toDouble()
fun readIs() = readLine()!!.split(' ').map(String::toInt)
fun readLs() = readLine()!!.split(' ').map(String::toLong)
fun readDs() = readLine()!!.split(' ').map(String::toDouble)

fun main() {
    println(if (readLine()!!.map { it - '0' }.sum() % 9 == 0) "Yes" else "No")
}





Measured memory_bytes: 41588
using namespace std;
#define M_PI 3.1415926535897932384626433832795
#include<bits/stdc++.h>
#define _USE_MATH_DEFINES
#include<math.h>
#include <iostream>

int main() {
	string s;
cin>>s;
map<char,int> m;
for (int i = 0; i < s.length(); ++i) {
	m[s[i]]++;
}
for (int i = 0; i <s.length() ; ++i) {
	if(m[s[i]]%2!=0){
		cout<<"No"<<endl;
		return 0;
	}
}
cout<<"Yes"<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep_1(i, n) for (int(i) = 0; (i) <= (n); (i)++)
#define rep_2(i, a, b) for (int(i) = (a); (i) < (b); (i)++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;

int main() {
  string a, b;
  cin >> a >> b;
  bool ans = a.size() > 1 || b.size() > 1;
  cout << (ans ? -1 : stoi(a) * stoi(b)) << endl;
  return 0;
}

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

int main() {

    int N;
    cin >> N;
    string S;

    int acCount, waCount, tleCount, reCount;
    acCount = 0;
    waCount = 0;
    tleCount = 0;
    reCount = 0;

    for (int i = 0; i < N; i++) {
        cin >> S;
        if (S == "AC") {
            acCount++;
        } else if (S == "WA") {
            waCount++;
        } else if (S == "TLE") {
            tleCount++;
        } else if (S == "RE") {
            reCount++;
        }
    }

    cout << "AC" " x " << acCount << endl;
    cout << "WA" " x " << waCount << endl;
    cout << "TLE" " x " << tleCount << endl;
    cout << "RE" " x " << reCount << endl;
}

Measured memory_bytes: 3616
import itertools
import numpy as np

h, w, k = map(int, input().split())
c = [input() for _ in range(h)]

count = 0
for ph in itertools.product([0, 1], repeat=h):
    for pw in itertools.product([0, 1], repeat=w):
        squares = np.array([[1 if cell == '#' else -1 for cell in row] for row in c])
        squares[np.array(ph) == True, :] *= 0
        squares[:, np.array(pw) == True] *= 0
        if np.count_nonzero(squares == 1) == k:
            count += 1

print(count)


Measured memory_bytes: 27272
import java.util.Scanner;

public class Main {

    private void solve() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int M = sc.nextInt();
        int C = sc.nextInt();

        int[] B = new int[M];
        for (int i = 0; i < M; i++) {
            B[i] = sc.nextInt();
        }

        int[][] A = new int[N][M];
        for (int i = 0; i < N; i++) {
            for (int j = 0; j < M; j++) {
                A[i][j] = sc.nextInt();
            }
        }
        int ans = 0;
        for (int i = 0; i < N; i++) {
            int work = 0;
            for (int j = 0; j < M; j++) {
                work += A[i][j] * B[j];
            }
            work += C;
            if (work > 0) {
                ans++;
            }
        }
        System.out.println(ans);
    }

    // Main
    public static void main(String[] args) {
        new Main().solve();
    }

}


Measured memory_bytes: 21844
#define _USE_MATH_DEFINES
#pragma region include
#include <iostream>
#include <iomanip>
#include <stdio.h>

#include <sstream>
#include <algorithm>
#include <iterator>
#include <cmath>
#include <complex>

#include <string>
#include <cstring>
#include <vector>
#include <bitset>

#include <queue>
#include <set>
#include <map>
#include <stack>
#include <list>

#include <ctime>
#pragma endregion //#include
/////////

#pragma region typedef
typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;
#pragma endregion //typedef
////定数
const int INF = (int)1e9;
const LL MOD = (LL)1e9+7;
const LL LINF = (LL)4e18+20;
const LD PI = acos(-1.0);
const double EPS = 1e-9;
/////////
using namespace::std;

void solve(){
	string str;
	cin >> str;
	int size = str.size();
	int ans = 0;
	int nowSum = 0;
	for(int i=0;i<size;++i){
		int ter = str[i]-'0';
		if( ter ){
			int res = nowSum+ter-1+(size-1-i)*9;
			ans = max(ans,res);
		}
		nowSum += ter;
	}
	ans = max(ans,nowSum);
	cout << ans << endl;
}
#pragma region main
signed main(void){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	std::cout << std::fixed;//小数を10進数表示
	cout << setprecision(16);//小数点以下の桁数を指定//coutとcerrで別	

	solve();
}
#pragma endregion //main()

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

#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define RFOR(i,b,a) for (int i = (b) - 1; i >= (a); i--)
#define ITER(it,a) for (__typeof(a.begin()) it = a.begin(); it != a.end(); it++)
#define FILL(a,value) memset(a, value, sizeof(a))

#define SZ(a) (int)a.size()
#define ALL(a) a.begin(), a.end()
#define PB push_back
#define MP make_pair

typedef long long LL;
typedef vector<int> VI;
typedef pair<int, int> PII;

const double PI = acos(-1.0);
const int INF = 1000 * 1000 * 1000 + 7;
const LL LINF = INF * (LL) INF;

const int MAX = 111;

int A[MAX];

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

	int n;
	scanf("%d", &n);
	PII mx = MP(-INF, -INF);
	PII mn = MP(INF, INF);
	FOR (i, 0, n)
	{
		scanf("%d", &A[i]);
		mx = max(mx, MP(A[i], i));
		mn = min(mn, MP(A[i], i));
	}

	vector<PII> res;

	if (abs(mx.first) > abs(mn.first))
	{
		FOR (i, 0, n)
		{
			if (A[i] < 0)
			{
				A[i] += A[mx.second];
				res.PB(MP(mx.second, i));
			}
		}

		FOR (i, 1, n)
		{
			A[i] += A[i-1];
			res.PB(MP(i-1, i));
		}
	}
	else
	{
		FOR (i, 0, n)
		{
			if (A[i] > 0)
			{
				A[i] += A[mn.second];
				res.PB(MP(mn.second, i));
			}
		}

		RFOR(i, n-1, 0)
		{
			A[i] += A[i+1];
			res.PB(MP(i+1, i));
		}
	}

	printf("%d\n", SZ(res));
	FOR (i, 0, SZ(res))
	{
		printf("%d %d\n", res[i].first + 1, res[i].second + 1);
	}

	// FOR (i, 0, n)
	// {
	// 	cout<<A[i]<<' ';
	// }
	// cout<<endl;



}


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

int main()
{
  int A, B, C, D;
  cin >> A >> B >> C >> D;
  
  int low = max(A,C);
  int high = min(B,D);
  
  cout << max(0, high-low) << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned ll
#define uint unsigned
#define pii pair<int,int>
#define pll pair<ll,ll>
#define PB push_back
#define fi first
#define se second
#define For(i,j,k) for (int i=(int)(j);i<=(int)(k);i++)
#define Rep(i,j,k) for (int i=(int)(j);i>=(int)(k);i--)
#define CLR(a,v) memset(a,v,sizeof(a));
#define CPY(a,b) memcpy(a,b,sizeof(a));
using namespace std;
const int N=505;
int n,mo,A[N],B[N];
int v[N],id[N],f[2][N][N];
int main(){
	scanf("%d%d",&n,&mo);
	for (int i=0,j=2*n-1;i<2*n;i++){
		for (;i*i+j*j>4*n*n;--j);
		B[i]=v[i]=j+1; id[i]=i;
	}
	for (int i=0,j=n;i<n;i++){
		for (;i*i+j*j>=n*n;--j);
		A[i]=v[i]=j+1;
	}
	For(i,0,2*n-1)
		For(j,i+1,2*n-1)
			if (v[id[i]]>v[id[j]]||v[id[i]]==v[id[j]]&&B[id[i]]>B[id[j]])
				swap(id[i],id[j]);
	int S1=0,S2=0;
	For(i,0,n) f[0][0][n-i]=1;
	For(i,0,2*n-1)
		if (id[i]>=n){
			For(j,0,S2) For(k,0,n-S2)
				f[0][j][k]=1ll*f[0][j][k]*(B[id[i]]-(S1+j))%mo;
			++S1;
		}
		else{
			For(j,0,S2) For(k,0,n-S2){
				f[1][j+1][k]=(f[1][j+1][k]+mo-1ll*f[0][j][k]*(A[id[i]]-(S1+j))%mo)%mo;
				if (k) f[1][j][k-1]=(f[1][j][k-1]+1ll*f[0][j][k]*(B[id[i]]-(2*n-k)))%mo;
			}
			++S2;
			For(j,0,S2) For(k,0,n-S2)
				f[0][j][k]=f[1][j][k],f[1][j][k]=0;
		}
	int ans=0;
	For(i,0,n)
		ans=(ans+f[0][i][0])%mo;
	printf("%d\n",ans);
}

Measured memory_bytes: 1280