akhauriyash/Code-Regression huggingface dataset:
#include<cstdio>
#include<vector>
#include<algorithm>
using namespace std;
vector<vector<int>> vt;
int parse[100010];
int de[100010];
int ma[100010];
void dfs(int here, int par, int depth) {
	parse[here] = par;
	de[here] = depth;
	ma[here] = depth;
	for (int i = 0; i < vt[here].size(); i++) {
		int next = vt[here][i];
		if (next == par)continue;
		dfs(next, here, depth + 1);
		ma[here] = max(ma[here], ma[next]);
	}
}
int main()
{
	int n, m, k;
	scanf("%d %d %d", &n, &m, &k);
	vt.resize(n + 1);
	for (int i = 0; i < n - 1; i++) {
		int q, w;
		scanf("%d %d", &q, &w);
		vt[q].push_back(w);
		vt[w].push_back(q);
	}
	dfs(k, -1, 1);
	int WantFinishEarly = 1;
	int WantFinishSlowly = de[m];
	int dap = 0;
	int update = 0;
	while (1) {
		if (update % 2 == 0) {
			if (WantFinishSlowly - WantFinishEarly <= 2)break;
			WantFinishSlowly--;
			m = parse[m];
			update++;
		}
		else {
			WantFinishEarly++;
			dap++;
			update++;
			if (WantFinishSlowly - WantFinishEarly == 1)break;
		}
	}
	while (1) {
		if (update % 2 == 0) {
			if (ma[m] == WantFinishSlowly)
				WantFinishSlowly--;
			else
				WantFinishSlowly++;
		}
		else {
			WantFinishEarly++;
			dap++;
		}
		if (WantFinishEarly == WantFinishSlowly)break;
		update++;
	}
	printf("%d", dap);
}

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

int main() {
    int A, B;
    cin>>A>>B;
    REP(i, 0, 1262){
        int Atax= i* 0.08;
        int Btax= i* 0.1;
        if(Atax == A && Btax == B){
            cout << i << endl;
            return 0;
        }
    }
   cout << -1 << endl;
   return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#include<stdlib.h>

//void push(int,int);
//int pop(void);

//int t = 0;

int main(){
  int t=0,x=0,y=0,sta[1000];
  char st[100];

while( scanf("%s",st) != EOF ){

    if( st[0] == '+' ){
      t--;
      x = sta[t+1];
      t--;
      y = sta[t+1];
      t++;
      sta[t] = x + y;
    }
    else if( st[0] == '-' ){
      t--;
      x = sta[t+1];
      t--;
      y = sta[t+1];
      t++;
      sta[t] = y - x;
    }
    else if( st[0] == '*' ){
      t--;
      x = sta[t+1];
      t--;
      y = sta[t+1];
      t++;
      sta[t] = x * y;
    }
    else{
      t++;
      sta[t] = atoi(st);
    }
  }


  printf("%d\n",sta[t]);

  return 0;
}



Measured memory_bytes: 2108
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <iomanip>
#include <set>
#include <map>
#include <queue>
#include <bitset>
#include <random>
#include <chrono>
//#define DEBUG
//#define RANDOM
typedef long long ll;
typedef long double ld;
using namespace std;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    string s;
    cin >> s;
    if (s.back() != 's')
    {
        s.push_back('s');
    }
    else
    {
        s.push_back('e');
        s.push_back('s');
    }
    cout << s << "\n";
    return 0;
}

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

int main() {
    int n;
    cin >> n;
    vector<long long> a(n), cnt(100100);
    for (int i = 0; i < n; i++) cin >> a[i];

    long long ans = 0;
    for (int i = 0; i < n; i++) {
        if (a[i] <= 100000) cnt[a[i]]++;
        else ans++;
    }

    for (int i = 1; i <= 100000; i++) {
        if (cnt[i] == 0) continue;
        if (cnt[i] != i) {
            if (cnt[i] < i) ans += cnt[i];
            else ans += cnt[i] - i;
        }
    }

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

Measured memory_bytes: 1792
#include<iostream>
using namespace std;
int n,i,A[105],Rez[105],poz,del,Del[105];
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin>>n;
    for(i=1; i<=n; i++)
    {
        cin>>A[i];
        if(A[i]>i)
        {
            cout<<"-1\n";
            return 0;
        }
    }
    poz=n;
    del=0;
    for(i=n; i>=1; i--)
    {
        if(Del[i])
            continue;
        if(A[i]==poz)
        {
            Del[i]=1;
            del++;
            Rez[del]=poz;
            poz=n-del;
            i=n+1;
            continue;
        }
        poz--;
    }
    if(del!=n)
    {
        cout<<"-1\n";
        return 0;
    }
    for(i=n; i>=1; i--)
        cout<<Rez[i]<<"\n";
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <cstdio>
using namespace std;
int n;
struct stu
{
	int k;
	int num;
	bool operator<(const stu &a)const
    {
        return num < a.num;
    }

}a[100010];
int main()
{	
    cin>>n;
    for(int i=1;i<=n;i++)
    {
    	a[i].k = i;
    	cin>>a[i].num;
	}
	sort(a+1, a+n+1);
	for(int i=1;i<=n;i++)
	{
		cout<<a[i].k;
		if(i!=n)	cout<<' ';
		else	cout<<endl;
	}
    return 0;
}


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

using ll = long long int;

const int MAX = (int)(1e5 + 5);
const ll INF = (ll)(1e17 + 5);

const int MAX_N = (int)(2e5 + 5);

int n;
ll a[MAX_N];

int main(void) {
  // Here your code !
  scanf("%d", &n);

  for (int i = 0; i < n; ++i) {
    scanf("%lld", &(a[i]));
  }

  ll whole = 0LL;

  for (int i = 0; i < n; ++i) {
    whole += a[i];
  }

  ll cur = 0LL;

  ll diff = INF;
  int index = -1;

  for (int i = 0; i < n; ++i) {
    cur += a[i];

    ll other = whole - cur;

    if (abs(other - cur) < diff) {
      index = i;
      diff = abs(other - cur);
    }
  }

  ll ans = diff;

  printf("%lld\n", ans);

  return 0;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
#define ll long long
#define rep(i,a,n) for(int i=a;i<=n;i++)
#define per(i,n,a) for(int i=n;i>=a;i--)
#define endl '\n'
#define mem(a,b) memset(a,b,sizeof(a))
#define IO ios::sync_with_stdio(false);cin.tie(0);
using namespace std;
const int INF=0x3f3f3f3f;
const ll inf=0x3f3f3f3f3f3f3f3f;
const int mod=1e9+7;
const int maxn=1e5+5;
int main(){
	string a;cin>>a;
	if(a[1]=='R') cout<<"ABC"<<endl;
	if(a[1]=='B') cout<<"ARC"<<endl;
}


Measured memory_bytes: 3620
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::*;
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
#[allow(unused_imports)]
use std::f64::consts::*;

#[allow(unused)]
const INF: usize = std::usize::MAX / 4;
#[allow(unused)]
const M: usize = 1000000007;

fn main() {
    input! {
        x: usize,
    }
    for y in 1..=360 {
        if x * y % 360 == 0 {
            println!("{}", y);
            return;
        }
    }
}


Measured memory_bytes: 2124
n, m, x, y = gets.split.map(&:to_i)
xs = gets.split.map(&:to_i)
ys = gets.split.map(&:to_i)

war = true
z = y
if xs.max < ys.min
  if ys.min <= y && ys.min > x
    puts "No War"
  else
    puts "War"
  end
else
  puts "War"
end

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






int main() {
  int n;cin>>n;
  vector <int>V(n);
  for(int i=0;i<n;i++){
    cin>>V.at(i);
  }
  int count=0;
  int ans=0;
  for(int i=0;i<n-1;i++){
    if(V.at(i)>=V.at(i+1)){
      count++;
      ans=max(ans,count);
    }
    else{
      count=0;
    }
    ans=max(ans,count);
  } 
  cout<<ans<<endl;
}

Measured memory_bytes: 640
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<math.h>
#include<algorithm>
#include<string>
#include<vector>
#include<set>
#include<map>
#define INF 100001
using namespace std;
inline int read()
{
	register int number_read=0,if_ok_read=1;
	char ch_read=getchar();
	while(ch_read<'0'||ch_read>'9')
	{
		if(ch_read=='-')
			if_ok_read=-1;
		ch_read=getchar();
	}
	while(ch_read>='0'&&ch_read<='9')
	{
		number_read=number_read*10+ch_read-'0';
		ch_read=getchar();
	}
	return number_read*if_ok_read;
}
inline void write(register int x_write)
{
    if(x_write<0)
	{
    	putchar('-');
		x_write=-x_write;
	}
    if(x_write>9)
		write(x_write/10);
    putchar(x_write%10+'0');
    return ;
}
inline int f(int n)
{
	return n*n;
}
int main()
{
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	int n=read(),a[INF]={0},sum=0;
    for(int i=1;i<=n;i++)
    	sum+=(a[i]=read());
    int t=sum/n,ans=0,ans2=0,ans3=0;
    for(int i=1;i<=n;i++)
    {
        ans+=f(a[i]-t);
        ans2+=f(a[i]-t-1);
        ans3+=f(a[i]-t+1);
    }
    int minx=ans<ans2?ans:ans2;
    minx=minx>ans3?ans3:minx;
    write(minx);
	putchar('\n');
	return 0;
}


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

using namespace std;

#define int long long
#define INF 1e9
#define LINF 1e18

const int MOD = 1e9 + 7;
const int dy[]={0, 0, 1, -1};
const int dx[]={1, -1, 0, 0};

typedef pair<int, int> P;
typedef pair<P, int> Pi;
typedef pair<P, P> PP;

template <class T> void chmin(T& a, const T& b) { a = min(a, b); }
template <class T> void chmax(T& a, const T& b) { a = max(a, b); }

int W, H, N;
int maxX[100000], maxY[100000];
int under[100000];

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

    cin >> W >> H >> N;
    int res = W;
    for(int i = 0; i < N; ++i) {
        int x, y;
        cin >> x >> y;
        chmax(maxY[x], y);
    }
    for(int i = W - 2; i >= 0; --i) {
        under[i] = max(under[i + 1], maxY[i + 1]);
    }
    for(int i = 0; i < W; ++i) {
        chmin(res, i + under[i]);
    }
    cout << res << endl;
    return 0;
}


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

using namespace std;

#define DUMP(x) std::cerr << (#x) << " = " << (x) << "\n"
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define REP(i, k, n) for (int i = (k); i < (int)(n); ++i)
#define ALL(r) r.begin(), r.end()
#define YES puts("YES")
#define Yes puts("Yes")
#define NO puts("NO")
#define No puts("No")
#define IMP puts("IMPOSSIBLE")
#define Imp puts("Impossible")
#define imp puts("impossible")
#define M1 puts("-1")
#define pb push_back

template <typename T>
ostream &operator<<(ostream &os, vector<T> &v)
{
    os << "{";
    rep(i, v.size()) os << v[i] << (i == (int)v.size() - 1 ? "" : ", ");
    os << "}";
    return os;
}
template <typename T>
T dup(T x, T y)
{
    return (x + y - 1) / y;
};
template <typename A, size_t N, typename T>
inline void arrayFill(A (&array)[N], const T &val) { std::fill((T *)array, (T *)(array + N), val); }

using ll = int64_t;
using vint = vector<int32_t>;
using vvint = vector<vint>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pint = pair<int32_t, int32_t>;
using pll = pair<ll, ll>;
using setint = set<int32_t>;
using setstr = set<string>;
using qint = queue<int32_t>;
using qpint = queue<pint>;

constexpr std::int32_t INF = 1001001001;
constexpr std::int64_t LINF = 1001001001001001001;

void Main()
{
    ll x, y;
    cin >> x >> y;
    int ans = 1;
    while (1)
    {
        x *= 2;
        if (x <= y)
            ++ans;
        else
            break;
    }
    cout << ans << endl;
}

int main()
{
    std::cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}


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

vector<long long> divisor(long long n) {
    vector<long long> ret;
    for(long long i=1; i*i<=n; i++) {
        if(n%i==0) {
            ret.push_back(i);
            if(i*i != n) ret.push_back(n/i);
        }
    }
    sort(begin(ret), end(ret));
    return ret;
}

int main(void){

    long long n;
    cin >> n;
    
    vector<long long> data = divisor(n);

    long long min = 1E+17;
    for(int i=0; i<data.size()/2; i++) {
        if(min>data[i]+data[data.size()-1-i]) {
            min = data[i]+data[data.size()-1-i];
        }
    }
    if(data.size()%2!=0) {
        if(min>data[(data.size()/2)]*2) {
            min = data[(data.size()/2)]*2;
        }
    }
    
    cout << min - 2 << endl;

    return 0;
}


Measured memory_bytes: 384
object Main {
  def main(args: Array[String]): Unit = {
    val sc = new java.util.Scanner(System.in)
    val n = sc.nextInt
    val k = sc.nextInt
    val s = sc.next
    sc.close()

    val result = s.zipWithIndex.map { case (c, i) => if (i == k - 1) c.toLower else c }
    println(result.mkString(""))
  }
}

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

#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define lg long long
#define db double
#define lb(x) ((x)&-(x))
#define ft first
#define sd second

#define HII cerr<<"HI"<<endl
#define LLLINE cerr<<"@@@@@@@@@@@@@@@@@@@@"<<endl

template <class _T_>
void read(_T_& d){
	d=0;int f=1;char c=getchar();
	for(;c<'0'||c>'9';c=getchar())if(c=='-')f*=-1;
	for(;c>='0'&&c<='9';c=getchar())d=d*10+c-'0';
	d*=f;
}

/************************************************/
#define MN 100005
int n;
int a[MN];
int d[MN];
int s[MN];
vector<int> h[MN];
queue<int> q;
bool cmp(int x,int y){
	return s[x]<s[y];
}
int main(){
	read(n);
	for(int i=2;i<=n;++i)read(a[i]),h[a[i]].pb(i),++d[a[i]];
	for(int i=1;i<=n;++i)if(!d[i])q.push(i);
	while(!q.empty()){
		int x=q.front();q.pop();
		if(!--d[a[x]])q.push(a[x]);
		sort(h[x].begin(),h[x].end(),cmp);
		reverse(h[x].begin(),h[x].end());
		for(int i=0;i<(int)h[x].size();++i){
			s[x]=max(s[h[x][i]]+1+i,s[x]);
		}
	}
	cout<<s[1];
	return 0;
}


Measured memory_bytes: 6912
using System;
using System.Linq;
using System.Numerics;
using System.Collections.Generic;

namespace ForAtcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            long x = long.Parse(Console.ReadLine());
            if (x >= 30) Console.WriteLine("Yes");
            else Console.WriteLine("No");
        }
    }
}

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

void main()
{
    auto N = readln.chomp.to!int;
    auto S = readln.chomp.to!(wchar[]);

    long[immutable(wchar[])][18] omemo;
    long solve(int i, wchar[] rs_, wchar[] bs_) {
        if (i == N) {
            auto rs = rs_.dup;
            reverse(rs);
            auto bs = bs_.dup;
            reverse(bs);
            long[long][long] memo;
            long dp(int i, int j) {
                if (i + j == N) return 1L;
                if (i in memo && j in memo[i]) return memo[i][j];
                long r1, r2;
                if (i < bs.length && S[N+i+j] == bs[i]) r1 = dp(i+1, j);
                if (j < rs.length && S[N+i+j] == rs[j]) r2 = dp(i, j+1);
                return memo[i][j] = r1 + r2;
            }
            auto ret = dp(0, 0);
            return ret;
        } else {
            auto key = (rs_ ~ "|" ~ bs_).idup;
            if (key in omemo[i]) return omemo[i][key];
            return omemo[i][key] = solve(i+1, rs_ ~ S[i], bs_) + solve(i+1, rs_, bs_ ~ S[i]);
        }
    }

    writeln(solve(0, [], []));
}

Measured memory_bytes: 117884
s = raw_input()
k = input()
i = 0
while True:
    if i == len(s)-1:
        # print "equal"
        t = ord(s[i])+k
        if t > ord("z"):
            t -= ord("a")
            t %= (ord("z")-ord("a") + 1)
            t += ord("a")
        s = s[:i] + chr(t)
        print s
        exit()
        # print s, k
    elif s[i] != "a" and ord(s[i]) + k > ord("z"):
        # print "carry"
        k = k - ord("z") + ord(s[i]) -1
        s = s[:i] + "a" + s[i+1:]        
        # print s,k
    i += 1
    

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

int main(){
    int a,b,c,k;  cin>>a>>b>>c>>k;

    int maxN=max(max(a,b),max(b,c));
    int ans=a+b+c-maxN;

    for(int i=0;i<k;i++){
        maxN*=2;
    }
    
    ans+=maxN;

    cout<<ans<<endl;



    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;
typedef long long ll;

int main(){
    ll a,b,c,d,e,k;
    cin >> a >> b >> c >> d >> e >> k;
/*    string flag = "Yay!";

    if(e - a > k){
        flag = ":(";
    }
*/
    cout << (e - a <= k ? "Yay!" : ":(") << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
using namespace std;
int main(){
  string s;
  int ans = 0;
  cin >> s;
  rep(i, 4)
  {
    if (s[i] == '+')
      ans++;
    else
      ans--;
  }
  cout << ans;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    int k,d=0;
    scanf("%d",&k);
    for(int i=1;i<10;i++){
        for(int j=1;j<10;j++){
            if(i*j==k){
              d=1;
            }
        }
    }
    if(d==0) printf("No\n");
    else printf("Yes\n");
    return 0;
}



Measured memory_bytes: 128
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
#include <functional>
 
using namespace std;
typedef long long ll;
const ll INF = 1e18;

# define rep(i, n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
# define reps(i, n) for(ll i=1, i##_len=(n); i<=i##_len; ++i)
# define rrep(i, n) for(ll i=((int)(n)-1); i>=0; --i)
# define rreps(i, n) for(ll i=((int)(n)); i>0; --i)
# define all(x) (x).begin(), (x).end()
# define pb push_back
 
string S;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cin >> S;

    set<char> values;
    
    rep(i,S.length()) {
        values.insert(S[i]);
    }

    for (char c='a'; c<='z'; c++) {
        auto it = values.find(c);
        if (it != values.end()) {
            continue;
        } else {
            cout << c << endl;
            return 0;
        }
    }
    
    
    cout << "None" << endl;
    
    return 0;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
#define inf 0x3f3f3f3f
#define lson root<<1
#define rson root<<1|1
#define Mid int mid=(l+r)>>1;
#define FREI freopen("in.txt","r",stdin)
#define FREO freopen("out.txt","w",stdout)
#define Mem(a,b) memset(a,b,sizeof(a))
#define MAXN 400
#define mod 1000000007
#define ll long long
#define eps 1e-6
using namespace std;
const int N=1e5+10;
bool vis[N];
struct point{
    int v;
    ll cost;
};
vector<point>G[N];
ll deep[N];
void dfs(int u,int father,ll cost){
    vis[u]=1;
    deep[u]=deep[father]+cost;
    for(int i=0;i<G[u].size();i++){
        int v=G[u][i].v;
        ll cost=G[u][i].cost;
        if(vis[v]) continue;
        dfs(v,u,cost);
    }
}
int main()
{
    //FREI;
    int n;
    scanf("%d",&n);
    for(int i=1;i<n;i++){
        ll u,v,cost;
        scanf("%d%d%lld",&u,&v,&cost);
        G[u].push_back({v,cost});
        G[v].push_back({u,cost});
    }
    int q,k;
    Mem(deep,0);
    Mem(vis,0);
    scanf("%d%d",&q,&k);
    dfs(k,0,0);
    while(q--){
        int u,v;
        scanf("%d%d",&u,&v);
        printf("%lld\n",deep[u]+deep[v]);
    }
}


Measured memory_bytes: 14336
#include <iostream>
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <math.h>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <utility>
#include <string>
#include <algorithm>
#include <time.h>
#include <assert.h>

using namespace::std;

int ri()
{
        int x;
        scanf("%d", &x);

        return x;
}

void wi(int x)
{
        printf("%d\n", x);
}

int main()
{
        int N = ri();
        int M = ri();

        int T = 1900 * M + 100 * (N - M);
        int x = 1;
        for (int i = 0; i < M; i++)
                x <<= 1;

        int ans = T * x;
        wi(ans);

        return 0;
}

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

#define int long long
#define ll long long
#define f1(i,a,b) for(i=a;i<b;i++)
#define f2(i,a,b) for(i=a;i>=b;i--)
#define endl '\n'
#define pb push_back
#define gp " "
#define ff first
#define ss second
#define mp make_pair

const int mod=1000000007;
int i,j;
ll temp;

int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin>>n;
    string a;
    cin>>a;
    int k;
    cin>>k;
    f1(i,0,a.size())
    {
        if(a[i]!=a[k-1])
            cout<<'*';
        else
            cout<<a[i];
    }
    return 0;

}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
	int H, W;
	cin >> H >> W;
	while (H && W) {
		for (int i = 0; i < H; i++) {
			for (int j = 0; j < W ; j++)
				cout << "#";
			cout << endl;
		}
		cout << endl;
		cin >> H >> W;
	}
	return 0;
}

Measured memory_bytes: 1152
n = int(input())
ac_count = 0
wa_count = 0
tle_count = 0
re_count = 0
for i in range(n):
    s = input()
    if s == 'AC':
        ac_count += 1
    elif s == 'WA':
        wa_count += 1
    elif s == 'TLE':
        tle_count += 1
    else:
        re_count += 1

print('AC x {}'.format(ac_count))
print('WA x {}'.format(wa_count))
print('TLE x {}'.format(tle_count))
print('RE x {}'.format(re_count))


Measured memory_bytes: 9192
package main

import "fmt"

func main() {
	var N, a int
	fmt.Scan(&N)
	min := 1000
	max := 0
	for i := 0; i < N; i++ {
		fmt.Scan(&a)
		if a < min {
			min = a
		}
		if a > max {
			max = a
		}
	}
	fmt.Println(max - min)
}


Measured memory_bytes: 512
from collections import deque
def bfs(start):
    q=deque([start])
    vis[start]=1
    res=1
    while q:
        v=q.popleft()
        for to in g[v]:
            if not vis[to]:
                vis[to]=1
                q.append(to)
                res+=1
    return res
input=__import__('sys').stdin.readline
n,m=map(int,input().split())
g=[[]for _ in range(n+1)]
vis=[0]*(n+1)
for _ in range(m):
    a,b=map(int,input().split())
    g[a]+=b,
    g[b]+=a,
ans=0
for i in range(1,n+1):
    if not vis[i]:ans=max(ans,bfs(i))
print(ans)

Measured memory_bytes: 44860
n = int(input())
dat_p = list(map(int, input().split()))
res = 0
for i in range(n-2):
    l = [dat_p[i], dat_p[i+1], dat_p[i+2]]
    l.sort()
    if l[1] == dat_p[i+1]:
        res += 1
print(res)

Measured memory_bytes: 38384
from itertools import product

n = int(input())
F = [list(map(int,input().split())) for i in range(n)]
P = [list(map(int,input().split())) for i in range(n)]

ans = []
for p in product([0,1],repeat = 10):
	if sum(p) == 0:
		continue
	res = 0
	for i in range(n):
		cnt = 0
		for j in range(10):
			if p[j]:
				cnt += F[i][j]
		res += P[i][cnt]
	ans.append(res)
print(max(ans))

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define REP(i,a,b) for (int i = a; i <b; i++)
typedef long long ll;
#define int ll
typedef vector<int> vi;
typedef vector<long long> vl;
typedef pair<int,int> pi;
#define trace(x) cout<<#x<<"="<<x<<"\n";
#define llp 1000000007
#define mod 1000000007

template < typename F, typename S >
ostream& operator << ( ostream& os, const pair< F, S > & p ) {
    return os << "(" << p.first << ", " << p.second << ")";
}

template < typename T >
ostream &operator << ( ostream & os, const vector< T > &v ) {
    os << "{";
    typename vector< T > :: const_iterator it;
    for( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << *it;
    }
    return os << "}";
}

template < typename T >
ostream &operator << ( ostream & os, const set< T > &v ) {
    os << "[";
    typename set< T > :: const_iterator it;
    for ( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << *it;
    }
    return os << "]";
}

template < typename F, typename S >
ostream &operator << ( ostream & os, const map< F, S > &v ) {
    os << "[";
    typename map< F , S >::const_iterator it;
    for( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << it -> first << " = " << it -> second ;
    }
    return os << "]";
}

#define deb(x) cerr << #x << " = " << x << endl;

vector<string>a;
int Alast[10005];
int Bfirst[10005];
int32_t main(){
	ios::sync_with_stdio(false);
    memset(Alast,0,sizeof(Alast));
    memset(Bfirst,0,sizeof(Bfirst));
    int n;
    cin>>n;
    a.resize(n);
    int ans=0;
    REP(i,0,n){
        cin>>a[i];
        if(a[i][0]=='B'){
            Bfirst[i]=1;
        }
        if(a[i][a[i].size()-1]=='A'){
            Alast[i]=1;
        }
        for(int j=0;j<a[i].size()-1;j++){

            if(a[i][j]=='A' && a[i][j+1]=='B'){
                ans++;
            }
            
        }
    }
    // deb(ans);
    // for(int i=0;i<n;i++){
    //     deb(i);
    //     deb(Alast[i]);
    //     deb(Bfirst[i]);

    // }
    for(int i=0;i<n;i++){
        if(Alast[i]==1 && Bfirst[i]==1){
            for(int j=0;j<n;j++){
                if(i==j || !Bfirst[j])continue;
                else{
                    ans++;
                    Alast[i]=0;
                    Bfirst[i]=0;
                    Bfirst[j]=1;
                    j=n+1;
                }

            }
        }
    }
    for(int i=0;i<n;i++){
        if(Alast[i]){
            for(int j=0;j<n;j++){
                if(i==j || !Bfirst[j])continue;
                else{
                    ans++;
                    Alast[i]=0;
                    Bfirst[j]=0;
                    j=n+1;
                }

            }
        }
    }
    cout<<ans<<"\n";
    





    return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <cstring>
using namespace std;
int a[10];
int main() {
    long long  k;
    scanf("%lld%lld%lld%lld", &a[1], &a[2], &a[3], &k);
    long long rs = 0;
    rs = a[1] - a[2];
    if (k % 2) {
        rs = -rs;
    }
    cout <<rs <<endl;
    return 0;
}


Measured memory_bytes: 256
# coding: utf-8
H, N = map(int, input().split())
L = []
for i in range(N):
    L.append(list(map(int, input().split())))
dp = [float("inf") for _ in range(H+1)] 
dp[0] = 0
top = 10**9
for i in range(1, H+1):
    for j in range(N):
        a, b = L[j]
        if i <= a:
            dp[i] = min(dp[i], b)
        else:
            dp[i] = min(dp[i], dp[i-a] + b)
    # print(*dp)
print(dp[H])

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

using namespace std;

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

typedef long long ll;


template<class T>
struct RollingHash {
	static const int NN = 2; // the number of hash table
	T base[NN] = {1009, 1007};
	T PMOD[NN] = {1000000007, 1000000009};
	vector<T> hash[NN];
	vector<T> mypow[NN];
	int sz;
	void init(string s) {
		sz = s.size();
		for(int i = 0; i < NN; i++) {
			hash[i].assign(sz + 1, 0);
			mypow[i].assign(sz + 1, 0);
			mypow[i][0] = 1;
		}
		for(int i = 0; i < NN; i++) {
			for(int j = 0; j < sz; j++) {
				hash[i][j + 1] = (hash[i][j] * base[i] + s[j]) % PMOD[i];
				mypow[i][j + 1] = mypow[i][j] * base[i] % PMOD[i];
			}
		}
	}
	RollingHash() {
	}
	// hash[t] value of s[l..r]
	T get(int l, int r, int t) {
		T ret = (hash[t][r + 1] - hash[t][l] * mypow[t][r - l + 1] % PMOD[t] + PMOD[t]) % PMOD[t];
		return ret;
	}
	// compare s[a..b] and s[c..d] O(1)
	bool comp(int a, int b, int c, int d) {
		if(a < 0 || sz <= b || c < 0 || sz <= d) return false;
		for(int i = 0; i < NN; i++) {
			if(get(a, b, i) != get(c, d, i)) return false;
		}
		return true;
	}
	// longest common extension s[l..LCE(l,r)] == s[r..LCE(l,r)] && s[l..LCE(l,r)+1] != s[r..LCE(l,r)+1]
	int LCE(int l,int r){
		tie(l,r)=minmax(l,r);
		if(l==r) return sz-r+1;
		int ll = 0;
		int rr = sz;
		while(rr-ll>1){
			int mid = (ll+rr)>>1;
			if(comp(l,l+mid-1,r,r+mid-1)) ll=mid;
			else rr=mid;
		}
		return ll;
	}
};


int main(){
	string s;
	cin>>s;
	int Q;
	cin>>Q;
	RollingHash<ll> rh;
	rh.init(s);
	rep(_,Q){
		int l, r, t;
		cin>>l>>r>>t;
		l--;
		r--;
		bool ok = false;
		if(r-l+1==t){
			cout<<"Yes"<<endl;
			continue;
		}

		int a = rh.LCE(l,l+t);
		if(l+a>=r+1-t){
			cout<<"Yes"<<endl;
			continue;
		}
		int nl = l+a+1;
		a = rh.LCE(nl, nl+t);
		if(nl+a>=r+1-t){
			cout<<"Yes"<<endl;
			continue;
		}
		if(a==t-1){
			if(s[nl-1]==s[nl+2*t-1]){
				nl += a+1;
				a = rh.LCE(nl, nl+t);
				if(nl+a>=r+1-t){
					cout<<"Yes"<<endl;
					continue;
				}
			}
		}
		cout<<"No"<<endl;
	}
}

Measured memory_bytes: 6404
N = int(input())
a = list(map(int, input().split()))

x = [0]*N

cnt = 1

for i in range(N):
	if a[i] == cnt:
		cnt += 1
		continue
	x[i] = 1
	
n = 0
for i in x:
	n += i
	
if n == N:
	n = -1

print(n)

Measured memory_bytes: 24744
/**
 *      purpose : ABC 119 A
 *      author  : kyomukyomupurin
 *      created : 
**/

// input/output
#include <iostream>
#include <fstream>
#include <sstream>
// container class
#include <array>
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
// math, algorithm
#include <algorithm>
#include <cmath>
#include <complex>
#include <numeric>
// etc
#include <bitset>
#include <cctype>
#include <cstring>
#include <chrono>
#include <iomanip>
#include <random>
#include <utility>
// using-directive
using namespace std;
// alias template
using int64 = int64_t;
using pii = pair<int, int>;
using pll = pair<int64_t, int64_t>;
// text macro replacement
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define print(x) cout << (x) << '\n'
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define fi first
#define se second

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  
  string s; cin >> s;
  if (s <= "2019/04/30") print("Heisei");
  else print("TBD");
  
  return 0;
}

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

int main()
{
    std::string S;
    int Q;
    int reverse = 0;

    std::cin >> S >> Q;

    for (int i=0; i<Q; i++)
    {
        char order;
        std::cin >> order;

        if (order == '1')
        {
            reverse = 1 - reverse;
        }
        else
        {
            std::cin >> order;
            if ((order == '1' && reverse == 0) || (order == '2' && reverse == 1))
            {
                std::cin >> order;
                S = order + S;
            }
            else
            {
                std::cin >> order;
                S += order;
            }
        }
        //std::cout << S << std::endl;
    }

    if (reverse == 1) std::reverse(S.begin(), S.end());
    std::cout << S << std::endl;
}

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

int mod = 1000000007;
int64_t large = 9223372036854775807;
double PI = 3.141592653589793;

int main()
{
    int N, tmp;
    cin >> N;
    vector<int> hist(1000002);
    for (int i = 1; i < N + 1; i++)
        cin >> tmp, hist[tmp]++;
    int ans, count = 0;
    for (int i = 0; i < 1000000; i++)
    {
        tmp = hist[i - 1] + hist[i] + hist[i + 1];
        if (tmp > count)
            ans = i, count = tmp;
    }
    cout << count;
}

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

using namespace std;

int main() {
  int N, X, Y;
  cin >> N >> X >> Y;
  X--;
  Y--;
  vector<int> cnt(N);
  for (int i = 0; i < N; i++) {
    for (int j = i + 1; j < N; j++) {
      int d = min(abs(X - i) + abs(Y - j) + 1, j - i);
      cnt[d]++;
    }
  }
  for (int k = 1; k <= N - 1; k++) {
    cout << cnt[k] << endl;
  }

  return 0;
}
/* vim:set fdm=marker: */


Measured memory_bytes: 256
#coding: utf-8
import math

N, A, B = map(int, input().split())
monster = [int(input()) for i in range(N)]


def enough(T):
    attack = B * T
    diff = A-B
    count = 0
    for i in monster:
        tmp = math.ceil((i - attack)/diff)
        if tmp > 0:
            count += tmp

    if count <= T:
        return True
    else:
        return False

def bs():
    left = 0
    right = 1000000000

    while left < right:
        mid = (left + right) // 2
        if enough(mid):
            right = mid
        else:
            left = mid + 1
    return left

print(bs())


Measured memory_bytes: 7068
n,q = map(int,input().split())
g=[[] for _ in range(n)]
ans = [0]*n
for i in range(n-1):
  a,b=map(int,input().split())
  g[a-1].append(b-1)
  g[b-1].append(a-1)
for j in range(q):
  p,x = list(map(int,input().split()))
  ans[p-1] += x
f=[1]*n
t=[0]
while t:
  v=t.pop()
  f[v]=0
  for k in g[v]:
    if f[k]:
      ans[k]+=ans[v]
      t.append(k)
print(*ans)

Measured memory_bytes: 55828
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
 
mt19937 rnd(1337);
#define rall(x) (x).rbegin(), (x).rend()
#define all(x) (x).begin(), (x).end()
#define pNN pair <Node *, Node *>
#define SZ(x) (int)(x).size()
#define pii pair <int, int>
#define pb push_back
#define rev reverse
#define ins insert
#define ers erase
#define S second
#define F first
const int N = 3e5 + 10, INF = 1e9 + 10;

int a[N];

void solve() {
	int k, n;
	cin >> k >> n;
	for (int i = 0; i < n; ++i) {
		cin >> a[i];
	}
	int mx = 0;
	for (int i = 0; i < n; ++i) {
		mx = max(mx, (a[(i + 1) % n] - a[i] + k * 2) % k);
	}
	cout << k - mx;
}
 
signed main () {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cout.precision(12);
    #ifdef Solenoid555
        freopen("input.txt", "r", stdin);
    #endif
    solve();
    return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip> 
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <bitset>

using namespace std;


int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	int n, m, i, j, k, a, b, c, ans = 0;
	cin >> n >> m;
	vector<vector<int>> d(n + 1, vector<int>(n + 1, 1000000000));
	vector<tuple<int, int, int>> edge;
	for (i = 1; i <= n; i++) d[i][i] = 0;
	for (i = 0; i < m; i++) {
		cin >> a >> b >> c;
		d[a][b] = c;
		d[b][a] = c;
		edge.push_back(make_tuple(a, b, c));
	}

	for (k = 1; k <= n; k++) {
		for (i = 1; i <= n; i++) {
			for (j = 1; j <= n; j++) d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
		}
	}

	ans = 0;
	for (auto p : edge) {
		tie(a, b, c) = p;
		if (d[a][b] < c) ans++;
	}
	cout << ans << "\n";

	return 0;
}



Measured memory_bytes: 384
##昨日やった...
import numpy as np

def prime_factorize(N): #素因数分解
    exponent = 0
    while N%2 == 0:
        exponent += 1
        N //= 2
    if exponent: factorization = [[2,exponent]]
    else: factorization = []
    i=1
    while i*i <=N:
        i += 2
        if N%i: continue
        exponent = 0
        while N%i == 0:
            exponent += 1
            N //= i
        factorization.append([i,exponent])
    if N!= 1: factorization.append([N,1])
    assert N != 0, "zero"
    return factorization

factors = [0]*100
N = int(input())

for i in range(1,N+1):
    for p,n in prime_factorize(i):
        factors[p] += n

factors = np.array(factors)
ov2 = len(factors[factors >= 2])
ov4 = len(factors[factors >= 4])
ov14 = len(factors[factors >= 14])
ov24 = len(factors[factors >= 24])
ov74 = len(factors[factors >= 74])
ans = 0
## 2*4*4
ans += (ov4-2)*(ov4)*(ov4-1)//2 + (ov2-ov4)*(ov4)*(ov4-1)//2

## 14 * 4
ans += (ov4-ov14)*(ov14) + (ov14)*(ov14-1)

## 24 * 2
ans += (ov2-ov24)*ov24 + (ov24)*(ov24-1)

## 74
ans += ov74

print(ans)

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

using namespace std;
typedef vector<int> VI;
typedef long long LL;
typedef pair<int,int> PI; 
typedef pair<LL,LL> PLL;
typedef unsigned long long ULL;
typedef pair<double,double> PD;

#define FOR(x, b, e) for(int x = b; x<= (e); x++)
#define FORD(x, b, e) for(int x = b; x>= (e); x--)
#define REP(x, n) for(int x = 0; x<(n); ++x)
#define ALL(c) (c).begin(), (c).end()
#define SIZE(x) ((int)(x).size())

#define PB push_back
#define IN insert
#define ST first
#define ND second
#define INF 2000000011
#define MOD 1000000007

#define MAXSIZE 100010

int n,k;
int dp[MAXSIZE];
int kam[105];

int main(){
	
	ios::sync_with_stdio(0); cin.tie(0);
	
	cin>>n>>k;
	
	REP(I,n)
		cin>>kam[I];
	
	
	FOR(i,1,k){
		REP(j,n){
			if(i-kam[j]>=0){
				if(dp[i-kam[j]]==0)
					dp[i]=1;
			}
			else 
				break;
		}
	}
	
	cout<<((dp[k])?"First":"Second");
	
	return 0;
}


Measured memory_bytes: 640
import sys


def main():
  readline = sys.stdin.readline
  
  n = int(readline().rstrip())
  a = [int(a_i) for a_i in readline().rstrip().split()]
  
  if 0 in a:
    print(0)
    return
  
  pr = 1
  for a_i in a:
    pr *= a_i
    
    if pr > 10 ** 18:
      print(-1)
      return
    
  print(pr)
  
  
if __name__ == "__main__":
  main()


Measured memory_bytes: 21596
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define yesno(flg) if(flg){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define MAX_N 1002
#define i197 1000000007

using namespace std;

typedef long long ll;
typedef pair<ll,ll> P1;
typedef pair<int,int> Pi;
typedef pair<double,Pi> Pdi;
typedef pair<ll,int>Pli;
typedef pair<P1,ll> P2;
const ll INF=100000000000000001;
struct edge{int to,cost;};
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
struct Road{double cost;int a,b;};


int main() {

	int h,w;
	char a[101][101];
	int c[101][101]={};
	int o=0;

	cin>>h>>w;
	rep(i,h){
		rep(j,w){
			cin>>a[j][i];
		}
	}
	rep(i,h){
		o=0;
		rep(j,w){
			if(a[j][i]=='.'){
				o++;
			}
			if(o==w){
				rep(k,w){
					c[k][i]=1;

				}
			}
		}
	}
	rep(j,w){
		o=0;
		rep(i,h){
			if(a[j][i]=='.'){
				o++;
			}
			if(o==h){
				rep(k,h){
					c[j][k]=1;
				}
			}
		}
	}

	int f=0;
	rep(i,h){
		f=0;
		rep(j,w){
			if(c[j][i]==0){
				cout<<a[j][i];
				f=1;
			}
		}
		if(f==1){
			cout<<endl;
		}
	}
	return 0;
}


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

int main(){
  int a,b,c;
  cin >> a >> b >> c;
  cout << min(b/a,c) << endl;
  return 0;
}

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

using namespace std;

const int maxn = 100005;

bool prime[maxn];
vector < int > p;

void sieve()
{
    prime[0] = prime[1] = 1;

    for(int i = 4; i <= maxn; i += 2) prime[i] = 1;

    for(int i = 3; i * i <= maxn; i += 2){
        if(prime[i]) continue;

        for(int j = i * i; j <= maxn; j += (2 * i)) prime[j] = 1;
    }

    p.push_back(2);

    for(int i = 3; i <= maxn; i += 2){
        if(!prime[i]) p.push_back(i);
    }
}

int main()
{
    sieve();

    int n;

    cin >> n;

    int l = lower_bound(p.begin(), p.end(), n) - p.begin();

    cout << p[l] << endl;

    return 0;
}


Measured memory_bytes: 512
N,k = list(map(int,input().split()))
d = list(map(int, input().split()))

while True:
    m = list(str(N))
    f = 0
    for i in d:
        if str(i) in m:
            f += 1
    if f == 0:
        print(N)
        break
    N += 1

Measured memory_bytes: 3060
#include<stdio.h>

int main()
{
    char num[4];

    scanf("%s",num);

    if(num[0]==num[1]||num[1]==num[2]||num[2]==num[3])
    {
        printf("Bad\n");
    }
    else
    {
        printf("Good\n");
    }


    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#include<math.h>
#include <iostream>
#include <vector>
#include <queue>

using namespace std;

int main() {
  string a,b,c;
  cin>>a>>b>>c; 
  if(a.at(a.size()-1)==b.at(0)&&b.at(b.size()-1)==c.at(0)){
    cout<<"YES"<<endl;
  }
  else{
    cout<<"NO"<<endl;
  }
  
 
}





Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#define fo(i,a,b) for(register int i=a;i<=b;++i)
#define fod(i,a,b) for(register int i=a;i>=b;--i)
using namespace std;
const int N=22,mo=1e9+7;
int read(int &n)
{
	char ch=' ';int q=0,w=1;
	for(;(ch!='-')&&((ch<'0')||(ch>'9'));ch=getchar());
	if(ch=='-')w=-1,ch=getchar();
	for(;ch>='0' && ch<='9';ch=getchar())q=q*10+ch-48;n=q*w;return n;
}
int m,n,m1,ans;
int a[N][N];
int f[2][N][1<<20];
int er[N+10];
int zx[1<<21][22];
int main()
{
	int q,w,e;
	er[1]=1;fo(i,2,22)er[i]=er[i-1]<<1;
	read(n),read(m),read(m1);--n;
	fo(i,1,m1)read(q),read(w),a[q][w]=1+read(e);
	fo(i,0,er[n+1]-1)
	{
		q=0;
		fod(j,n,1)if(er[j]&i)q=j;
		else zx[i][j-1]=q;
	}
	f[0][n][0]=1;
	fo(i,1,m)
	{
		register int I=i&1,q;
		fo(j,0,er[n+1]-1)f[I][0][j]=f[!I][n][j],f[!I][n][j]=0;
		fo(j,0,n-1)
		{
			fo(k,0,er[n+1]-1)if(f[I][j][k])
			{
				if(!a[i][j+1]||a[i][j+1]-1==((k&er[j+1])>>j))((f[I][j+1][k]+=f[I][j][k])>=mo?f[I][j+1][k]-=mo:0);
				if(!(k&er[j+1])&&a[i][j+1]!=1)
				{
					q=k+er[j+1]-er[zx[k][j]];
					((f[I][j+1][q]+=f[I][j][k])>=mo?f[I][j+1][q]-=mo:0);
				}
				f[I][j][k]=0;
			}
		}
	}
	fo(i,0,er[n+1]-1)((ans+=f[m&1][n][i])>=mo?ans-=mo:0);
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 211072
import java.util.Scanner;

class Main {
	public static void main(String args[]) {
		Scanner scan = new Scanner(System.in);
		
		String st;
		int r, g, b, ans;
		double min, db;
		
		String[] color = {"black", "blue", "lime", "aqua", "red", "fuchsia", "yellow", "white"};		
		int[][] code = {{0, 0, 0},
						{0, 0, 255},
						{0, 255, 0},
						{0, 255, 255},
						{255, 0, 0},
						{255, 0, 255},
						{255, 255, 0},
						{255, 255, 255}						
						};
		
		while(true) {
			st = scan.next();
			
			if(st.equals("0")) break;

			min = Integer.MAX_VALUE;
			ans = 0;
			
			r = Integer.parseInt(st.substring(1,3), 16);
			g = Integer.parseInt(st.substring(3,5), 16);
			b = Integer.parseInt(st.substring(5,7), 16);
			
			for(int i = 0; i < 8; i++) {
				db = Math.sqrt(Math.pow(r - code[i][0], 2) + Math.pow(g - code[i][1], 2) + Math.pow(b - code[i][2], 2));
				
				if(db < min) {
					ans = i;
					min = db;
				}
			}
			System.out.println(color[ans]);
		}
		
		scan.close();
	}
}

Measured memory_bytes: 31716
#include <iostream>
#include <string>
#include <cstdlib>
#include <vector>
#include <array>
#include <map>
#include <algorithm>
#include <queue>

using namespace std;
typedef long long int ll;

int main(int argc, char const *argv[])
{
    ll N, a, b;
    cin >> N >> a >> b;


    cout << (a < b ? a : b) << " " << ((-N+a+b)<0?0:(-N+a+b)) << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define MODV 1000000007
#define INFLL LLONG_MAX // 9223372036854775807
#define EPS 1e-9
#define rep(i, n) for(ll i=0, i##_len=(ll)(n); i<i##_len; i++)
#define repf(i, n) for(ll i=1, i##_len=(ll)(n+1); i<i##_len; i++)
#define all(v) v.begin(), v.end()
#define endl "\n"
#define vi vector<ll>
#define vvi vector<vector<ll>>
#define Yes() cout << "Yes" << endl
#define YES() cout << "YES" << endl
#define No() cout << "No" << endl
#define NO() cout << "NO" << endl
#define Init() std::ios::sync_with_stdio(false); std::cin.tie(0); std::cout<<fixed<<setprecision(15);
template<class T>bool chmax(T &a, const T &b){ if(a<b){ a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b){ if(b<a){ a=b; return 1; } return 0; }
using namespace std;

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

    vi rsum(n, 0);
    for(ll i=1; i<n; i++){
        rsum[i] = a[i-1] + rsum[i-1];
        rsum[i] %= MODV;
    }

    ll ans = 0;
    for(ll i=1; i<n; i++){
        ans += (a[i]*rsum[i])%MODV;
        ans %= MODV;
    }
    cout << ans%MODV << endl;
}

Measured memory_bytes: 6368
import heapq
n, m = map(int, input().split())
a = list(map(lambda x: int(x) * -1, input().split()))
heapq.heapify(a)
for _ in range(m):
    tmp = (heapq.heappop(a) * (-1)) // 2
    heapq.heappush(a, -tmp)
print(sum(a) * -1)


Measured memory_bytes: 14180
N = int(input())

l = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

print(l[N-1])

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for (int i = a; i < (int)(b); i++)
#define all(v) v.begin(), v.end()
const int MOD = 1e9 + 7;
const int INF = 1e9;
//'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122



int main() {
    int n, m;
    cin >> n >> m;
    int s[m], c[m];
    rep(i, 0, m) {
        cin >> s[i] >> c[i];
        s[i]--;
    }
    rep(i, 0, 1000) {
        string x = to_string(i);
        if ((int)x.size() != n) continue;
        bool ok = true;
        rep(i, 0, m) {
            if (x[s[i]] - '0' != c[i]) ok = false;
        }
        if (ok) {
            cout << x << endl;
            return 0;
        }
    }
    cout << -1 << endl;
    return 0;
}


Measured memory_bytes: 3668
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
int main()
{
    string com;//Register
    cin>>com;
    if(com.length()==2)
    	cout<<com<<endl;
	else

	   {
	   	reverse(com.begin(),com.end());
	   	cout<<com<<endl;
	   	
	   }
	   	
 
    return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
import itertools
import numpy as np

n = int(input())
v = list(map(int, input().split()))
c = list(map(int, input().split()))

v = np.array(v)
c = np.array(c)

ans = np.sum((v-c)*((v-c) >= 0))

print(ans)


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

using namespace std;

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


int main(){
 long h,w,n;
  cin >> h >> w >> n;
 vector<long> a(n);
  rep(i,n) cin >> a[i];
 vector<vector<long>> c(h,vector<long>(w));
  
  long num=0;
  rep(i,n){
    rep(j,a[i]) {
      c[num/w][num%w]=i+1;
      num++;
    }
    }
  
  for(int i=1;i<h;i+=2) reverse(c[i].begin(),c[i].end());
  
  rep(i,h){ 
    rep(j,w-1) cout << c[i][j] << " ";
    cout << c[i][w-1] << endl;
  }
  }

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

int main() {
  int X;
  cin >> X;

  if (30 <= X) cout << "Yes" << endl;
  else cout << "No" << endl;

  return 0;
}


Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1LL << 50;

int main(void)
{
    int N, M;
    cin >> N >> M;
    const int NMAX = 1000;
    const int MMAX = 2000;
    int a[MMAX], b[MMAX];
    ll c[MMAX];

    for (int i = 0; i < M; ++i)
    {
        cin >> a[i] >> b[i] >> c[i];
        c[i] = -c[i];
    }

    ll dist[NMAX];

    for (int i = 0; i < N; ++i)
    {
        dist[i] = INF;
    }

    dist[0] = 0;


    for (int loop = 0; loop < N - 1; ++ loop)
    {
        for (int i = 0; i < M; ++i)
        {

            if (dist[a[i] - 1] == INF) continue;

            if (dist[b[i] - 1] > dist[a[i] - 1] + c[i])
            {
                dist[b[i] - 1] = dist[a[i] - 1] + c[i];
            }
        }
    }

    ll ans = dist[N - 1];


    bool negative[NMAX];

    for (int i = 0; i < N; ++i)
    {
        negative[i] = false;
    }

    for (int loop = 0; loop < N ; ++ loop)
    {
        for (int i = 0; i < M; ++i)
        {
            if (dist[a[i] - 1] == INF) continue;

            if (dist[b[i] - 1] > dist[a[i] - 1] + c[i])
            {
                dist[b[i] - 1] = dist[a[i] - 1] + c[i];
                negative[b[i] - 1] = true;
            }

            if (negative[a[i] - 1] == true)
            {
                negative[b[i] - 1] = true;
            }
        }
    }


    if (negative[N - 1])
        cout << "inf" << endl;
    else
        cout << -ans << endl;

    return 0;
}


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

using namespace std;

vector<pair<int,int> > items;
int lim,n;
int off;

int memo[100][1000][100];

int solve(int ind, int tezina,int br)
{	
	
	if(long(tezina)+long(br)*long(off) > lim) return -1e9;
	if(ind == n) return 0;
	
	if(memo[ind][tezina][br] != 0)
		return memo[ind][tezina][br];

	int w = items[ind].first;
	int v = items[ind].second;
	int ret =  max(solve(ind+1,tezina, br), solve(ind+1, tezina+w, br+1) + v);
	memo[ind][tezina][br] = ret;
	return ret;
}


int main()
{
	int a,b;
	cin >> n >> lim;
	for(int i = 0;i < n;i++)
	{
		cin >> a >> b;
		if(i != 0)
			a -= off;
		else
		{
			off = a;
			a = 0;
		}
	
		items.push_back(make_pair(a,b));
	}

	cout << solve(0,0,0) << endl;
	return 0;
}

Measured memory_bytes: 37120
#include <iostream>
#include <string>

using namespace std;

int main() {
    string s[] = {"SUN","MON","TUE","WED","THU","FRI","SAT"};
    string t;   cin >> t;

    for (int i = 0; i < 7; i++) {
        if (t == s[0]) {
            cout << 7 << endl;
            return 0;
        }
        if (t == s[i]) {
            cout << 7-i << endl;
            return 0;
        }
    }
    
}

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

int main() {
  int r;
  double s;
  cin >> r;
  s = 2 * M_PI * r; 
  printf("%.3f\n", s);
  return 0;
}

Measured memory_bytes: 3736