akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<algorithm>
#include<queue>
#include<string>
using namespace std;

int main(){
    int n,m;
    cin>>n>>m;
    int sum[55]={};
    int a,b;
    for(int i=0; i<m; i++){
        cin>>a>>b;
        sum[a]++;
        sum[b]++;
    }
    for(int i=1;i<=n;i++){
        cout<<sum[i]<<endl;
    }
    return 0;
}

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

const int dx[4] = { 0, 1, 0, -1 };
const int dy[4] = { 1, 0, -1, 0 };
void bfs(pair<int, int> start, vector<string>& graph,
         vector<vector<int>>& cost) {
    deque<pair<int, int>> q; q.push_front(start);
    cost[start.first][start.second] = 0;
    while(not q.empty()) {
        auto p = q.front(); q.pop_front();
//        cout << p.first << " " << p.second << endl;
        for (auto i = 0; i < 4; i++) {
            int nx = p.first + dx[i], ny = p.second + dy[i];
            if (nx < 0 or ny < 0 or nx >= (int) graph.size() or ny >= (int) graph[p.first].size()) continue;
//            cout << "1:" <<  nx << " " << ny << endl;
            if (graph[nx][ny] == '#') continue;
            if(cost[nx][ny] <= cost[p.first][p.second]) continue;
            q.push_front({nx, ny}); cost[nx][ny] = cost[p.first][p.second];
        }
        for (auto i = -2; i <= 2; i++) {
            for (auto j = -2; j <= 2; j++) {
                if(i == 0 and j == 0) continue;
                int nx = p.first + i, ny = p.second + j;
                if (nx < 0 or ny < 0 or nx >= (int) graph.size() or ny >= (int) graph[p.first].size()) continue;
//                cout << "2:" <<  nx << " " << ny << endl;
                if(graph[nx][ny] == '#') continue;
                if(cost[nx][ny] <= cost[p.first][p.second] + 1) continue;
                q.emplace_back(nx, ny); cost[nx][ny] = cost[p.first][p.second] + 1;
            }
        }
    }
}

int main(){
    int h, w; cin >> h >> w;
    pair<int, int> c, d; cin >> c.first >> c.second >> d.first >> d.second;
    c.first--; c.second--; d.first--; d.second--;
    vector<string> s(h); for (auto i = 0; i < h; i++) cin >> s[i];
    vector<vector<int>> cost(h, vector<int>(w, (1 << 24)));
    bfs(c, s, cost);
    if(cost[d.first][d.second] == (1 << 24)) {cout << -1 << endl; return 0; }
    cout << cost[d.first][d.second] << endl;
    return 0;
}

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

int main(){
  int a,b,c,d,e;
  cin>>a;
  b=a/1000;
  c=(a%1000)/100;
  d=((a%1000)%100)/10;
  e=(((a%1000)%100)%10)/1;
  if(a==b){
    cout<<"Bad"<<endl;
  }
  else if(b==c){
    cout<<"Bad"<<endl;
  }
  else if(c==d){
    cout<<"Bad"<<endl;
  }
  else if(d==e){
    cout<<"Bad"<<endl;
  }
  else{
  cout<<"Good"<<endl;
  }
  return 0;
}

Measured memory_bytes: 256
/**
 * code generated by RHelper
 * More info: https://github.com/mkc1370/RHelper
 * @author 
 */

using System;

using System.IO;
using System.Linq;

public class AStationAndBus
{
    public void Solve(StringReader reader, StringWriter writer)
    {
        var s = reader.ReadLine().Replace("\n", "");
        writer.WriteLine(s.Distinct().Count() == 1 ? "No" : "Yes");
    }
}


public class Output
{
	public static void Main()
	{
		var reader = new System.IO.StringReader(Console.In.ReadToEnd());
		var writer = new System.IO.StringWriter();
		var solver = new AStationAndBus();
		solver.Solve(reader, writer);
        Console.Write(writer.GetStringBuilder().ToString());
	}
}


Measured memory_bytes: 13152
#include<stdio.h>
int main(){
  int a[30000],i,j,n,m,st,max;
  while(1){
    max=0;
      a[0]=0;
    scanf("%d%d",&n,&m);
    if(n==0 && m==0)break;
    for(i=1;i<n+1;i++){
      scanf("%d",&a[i]);
    }
    for(i=0;i<m;i++){
      scanf("%d",&a[i+n+1]);
    }
    for(i=0;i<n+m+1;i++){
      for(j=1;j<n+m+1;j++){
	if(a[j-1]>a[j]){
	  st=a[j-1];
	  a[j-1]=a[j];
	  a[j]=st;
	}
      }
    }
    for(i=1;i<n+m+1;i++){
      if(a[i]-a[i-1]>max)max=a[i]-a[i-1];
    }
    printf("%d\n",max);
  }
  return 0;
}

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

	public static void main(String[] args) {
		
		Scanner src = new Scanner(System.in);
		int a = src.nextInt();
		int b = src.nextInt();
		
		
		if(a < b){
		System.out.println("a < b");
		}
		else if(a > b){
			System.out.println("a > b");
		}
		else if(a == b){
			System.out.println("a == b");
		}
	}

}

Measured memory_bytes: 17160
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <algorithm>

typedef long long ll;
const ll INF = (ll)1e18 + 1;
const ll MOD = 1e9 + 7;

int main()
{
  ll A, B, C, X, Y;
  std::cin >> A >> B >> C >> X >> Y;

  ll ab = (A + B) < C * 2 ? (A + B) : C * 2;
  ll a  = A < C * 2 ? A : C * 2;
  ll b  = B < C * 2 ? B : C * 2;

  ll diff = std::max(X, Y) - std::min(X, Y);
  ll ans = ab * std::min(X, Y);
  if (X > Y) {
    ans += diff * a;
  } else {
    ans += diff * b;
  }

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


Measured memory_bytes: 256
def main():
    mod = 10 ** 9 + 7

    n = int(input())
    *t, = map(int, input().split())
    *a, = map(int, input().split())

    if t[-1] != a[0]:
        # 高橋と青木の見た山の高さの最大値が一致しない
        print(0)
        return

    ret = 1

    # [lo,hi]
    for i in range(n):
        if i == 0:
            lo = hi = t[i]
        else:
            if t[i - 1] < t[i]:
                # 山iの高さは一意に定まる
                lo = hi = t[i]
            elif t[i - 1] == t[i]:
                # [1,t[i]]の範囲で自由に選べる
                lo = 1
                hi = t[i]
            else:
                # t[i - 1] > t[i]:
                print(0)
                return

        if i == n - 1:
            lo = max(lo, a[i])
            hi = min(hi, a[i])
        else:
            if a[i] > a[i + 1]:
                # 山iの高さは一意に定まる
                lo = max(lo, a[i])
                hi = min(hi, a[i])
            elif a[i] == a[i + 1]:
                # [1,a[i]]の範囲で自由に選べる
                lo = max(lo, 1)
                hi = min(hi, a[i])
            else:
                # a[i] < a[i + 1]:
                print(0)
                return

        if lo > hi:
            print(0)
            return

        ret = ret * (hi - lo + 1) % mod

    print(ret)


if __name__ == '__main__':
    main()


Measured memory_bytes: 19012
# -*- coding: utf-8 -*-
# Range
#	Write a program which reads three integers a, b and c, and prints "Yes" if a<b<c, otherwise "No".
#
# Input
#	Three integers a, b and c separated by a single space are given in a line.
#
# Output
#	Print "Yes" or "No" in a line.
#
# Constraints
#	0 ≤ a, b, c ≤ 100
# Sample Input 1
#	1 3 8
# Sample Output 1
#	Yes
# Sample Input 2
#	3 8 1
# Sample Output 2
#	No

a, b, c = (int(x) for x in input().split())

if (a < b) and (b < c):
    print('Yes')
else:
    print('No')



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

// #define int long long
#define rep(i, n) for (long long i = (long long)(0); i < (long long)(n); ++i)
#define reps(i, n) for (long long i = (long long)(1); i <= (long long)(n); ++i)
#define rrep(i, n) for (long long i = ((long long)(n)-1); i >= 0; i--)
#define rreps(i, n) for (long long i = ((long long)(n)); i > 0; i--)
#define irep(i, m, n) for (long long i = (long long)(m); i < (long long)(n); ++i)
#define ireps(i, m, n) for (long long i = (long long)(m); i <= (long long)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) long long(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vs = vector<string>;
using vpll = vector<pair<ll, ll>>;
using vtp = vector<tuple<ll,ll,ll>>;
using vb = vector<bool>;

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 = 1e9;
const ll MOD = 1e9+7;
const ll LINF = 1e18;



signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  ll n,p; cin>>n>>p;
  ll odd=0, even=0;
  rep(i,n){
    ll a; cin>>a;
    if(a%2) odd++;
    else even++;
  }
  
  ll ans=0;
  if(odd==0){
    if(p==0){
      ans=round(pow(2,n));
    }
  }else{
    ans=round(pow(2,odd+even-1));
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<climits>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define scan(arg) cin>>arg
#define prin(arg) cout<<arg<<"\n"
#define prin2(arg1,arg2) cout<<arg1<<" "<<arg2<<"\n"
using namespace std;
typedef long long ll;
const int NMAX=1<<17;
int fast_pow(int x,int n){
  int res=1;
  while(n>0){
    if(n&1) res*=x;
    x*=x;
    n>>=1;
  }
  return res;
}
int n,m;
int main(){
  scan(n);scan(m);
  int res=(100*n+1800*m)*fast_pow(2,m);
  prin(res);
  
  return 0;
}


Measured memory_bytes: 256
while True:
    n, x = [int(i) for i in input().split()]
    if n == x == 0: break

    if 3*(n -1) < x or x < 6:
        print(0)
        continue
    
    way = 0
    for i in range(1, x//3):
        p = x -i
        for j in range(n, p//2, -1):
            if i < p - j < j:
                way += 1
    print(way)


Measured memory_bytes: 5604
#include<bits/stdc++.h>
#define REP(i,a,b) for(int i=(a);i<(int)(b);++i)
#define rep(i,n) REP(i,0,n)
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

using namespace std;
typedef long long ll;

const int MAX_N = 100;

int main() {
    int n;
    string w[MAX_N];
    cin >> n;
    rep(i, n) cin >> w[i];
    rep(i, n) rep(j, n) {
        if (i == j) continue;
        if (w[i] == w[j]) {
            cout << "No" << endl;
            return 0;
        }
    }
    rep(i, n - 1) {
        if (w[i][w[i].length() - 1] != w[i + 1][0]) {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}



Measured memory_bytes: 256
N = int(input())
w = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j']


def dfs(s, i):
    # s:文字列 i:最大のアルファベットのindex
    if len(s) == N:
        print(s)
    else:
        for k in range(i+2):
            if k == i+1:
                dfs(s+w[k], i+1)
            else:
                dfs(s+w[k], i)


x = dfs('a', 0)

Measured memory_bytes: 4412
n = int(input())
t0 = 1
a0 = 1
for i in range(n):
    t, a = map(int, input().split())
    mul = max((t0 - 1) // t + 1, (a0 - 1) // a + 1)
    t0 = t * mul
    a0 = a * mul
print(t0 + a0)

Measured memory_bytes: 3060
#include <stdio.h>
#include <string.h>
#define MAX 100000
int main(){
    char S[MAX];
    char ans[MAX];
    int N=0;
    scanf("%d %s", &N, S);
    int len = strlen(S);
    for (int i = 0; i <len ; ++i) {
        int x=S[i]-'A';
        x=(x+N)%26;
        putchar('A'+x);
    }
    putchar('\n');
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define ALL(A) A.begin(), A.end()

using namespace std;

typedef long long ll;
typedef pair<int, int> P;

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	
	string S; cin >> S;
	set<char> same; same.clear();
	
	bool ok = true;
	rep (i, (int)S.length()){
		if (!same.count(S[i])){
			same.insert(S[i]);
		}else{
			ok = false;
			break;
		} // end if
	} // end rep

	cout << (ok ? "yes" : "no") << endl;

	return 0;
}

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

using namespace std;
int main(){
	int n;
	scanf("%d", &n);
	
	int arr[n];
	int i;
	
	for(i = 0; i < n; i++){
		scanf("%d", &arr[i]);
	}
	
	sort(arr, arr + n); // will sort in ascending order
	 
	for(i = 1; i < n; i+=2){
			if(arr[i] == arr[i - 1] || arr[i] == arr[i + 1]){
				printf("NO");
				return 0;
			}
		
	}	
	printf("YES");
		
}


Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <set>

#define rep(i,j) REP((i), 0, (j))
#define REP(i,j,k) for(int i=(j);(i)<(k);++i)
#define between(a,x,b) ((a)<=(x)&&(x)<=(b))
using namespace std;

int main(){
  int m;
  scanf("%d", &m);
  while(m--){
    string s;
    cin >> s;
    set<string>c;
    for(int i = 1; i < s.size(); i++){
      string s1 = s.substr(0, i);
      string s2 = s.substr(i);
      string rs1 = s1, rs2 = s2;
      reverse(rs1.begin(), rs1.end()); reverse(rs2.begin(), rs2.end());
      c.insert(s1 + s2);
      c.insert(s2 + s1);
      c.insert(s1 + rs2);
      c.insert(rs2 + s1);
      c.insert(rs1 + s2);
      c.insert(s2 + rs1);
      c.insert(rs1 + rs2);
      c.insert(rs2 + rs1);
      //      cout << s1 << ' ' << s2 << endl;
    }
    printf("%d\n", (int)c.size());
  }
  return 0;
}

Measured memory_bytes: 1320
n=int(input())
ans=[0 for _ in range(100050)]
for i in range(1,105):
  for j in range(1,105):
      for k in range(1,105):
        v=i*i+j*j+k*k+i*j+j*k+k*i
        if v<10050:
          ans[v]+=1

for i in range(n):
  print(ans[i+1])

Measured memory_bytes: 9804
#include<bits/stdc++.h>
using namespace std;
int n,k,ans,i,j;
string s;
int main(){
	cin>>n>>k>>s;
	while(j<n){
		while(j<n && s[j]=='1')++j;
		ans=max(ans,j-i);
		while(j<n && s[j]=='0')++j;
		--k;
		if(k<0){
			while(i<n && s[i]=='1')++i;
			while(i<n && s[i]=='0')++i;
		}
		ans=max(ans,j-i);
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 512
n = gets.to_i

print n % 10 == 1 ? "pon" :
      n % 10 == 2 ? "hon" :
      n % 10 == 3 ? "bon" :
      n % 10 == 4 ? "hon" :
      n % 10 == 5 ? "hon" :
      n % 10 == 6 ? "pon" :
      n % 10 == 7 ? "hon" :
      n % 10 == 8 ? "pon" :
      n % 10 == 9 ? "hon" :
      n % 10 == 0 ? "pon" : ""
      


Measured memory_bytes: 14360
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  string n; cin>>n;
  if(n.size()==1){
    cout<<n[0]-'0'<<endl;
    return 0;
  }
  for(int i=1;i<n.size();i++){
    if(n[i]!='9'){
      cout<<(n.size()-1)*9+(n[0]-'0')-1<<endl;
      return 0;
    }
  }
  cout<<n[0]-'0'+9*(n.size()-1)<<endl;
  
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define LOCAL
using namespace std;
template <typename A, typename B>
ostream& operator <<(ostream& out, const pair<A, B>& a) {
out << "(" << a.first << "," << a.second << ")";
return out;
}
template <typename T, size_t N>
ostream& operator <<(ostream& out, const array<T, N>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T>
ostream& operator <<(ostream& out, const vector<T>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T, class Cmp>
ostream& operator <<(ostream& out, const set<T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "}";
return out;
}
template <typename U, typename T, class Cmp>
ostream& operator <<(ostream& out, const map<U, T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& p : a) { out << (first ? "" : ", "); out << p.first << ":" << p.second; first = 0;} out << "}";
return out;
}
#ifdef LOCAL
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#else
#define trace(...) 42
#endif
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
const char* comma = strchr(names + 1, ',');
cerr.write(names, comma - names) << ": " << arg1 << " |";
__f(comma + 1, args...);
}
#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;
#define int long long
using P = pair<int,int>;
//#########################################
int dx[4] = {0,1,0,-1},dy[4] = {1,0,-1,0};
int vis[100][100];
signed main(){
    int h,w;cin >> h >> w;
    vector<string> f(h);
    rep(i,h)cin >> f[i];
    int dist[h][w];
    rep(i,h)rep(j,w)dist[i][j] = -1;
    dist[0][0] = 0;
    queue<P> q;
    q.emplace(0,0);
    vis[0][0] = 1;
    while(q.size()){
        auto p = q.front();q.pop();
        int x = p.first,y = p.second;
        rep(i,4){
            int nx = p.first + dx[i],ny = p.second + dy[i];
            if(nx < 0 || ny < 0 || nx > h-1 || ny > w-1)continue;
            if(f[nx][ny] == '.')continue;
            if(vis[nx][ny])continue;
            dist[nx][ny] = dist[x][y] + 1;
            q.emplace(nx,ny);
            vis[nx][ny] = 1;
        }

    }
    int cnt = 0;
    rep(i,h)rep(j,w)cnt += (f[i][j] == '#');
    if(dist[h-1][w-1] == h+w-2 && cnt == h+w-1)cout << "Possible" << endl;
    else cout << "Impossible" << endl;
    return 0;
}

Measured memory_bytes: 3624
#include <iostream>
#include <algorithm>

#define ll long long

using namespace std;

bool isprime[1000001];
int fact[1000001];
bool isfox[1000001];
int primes[78498];

int factorial(ll arg, int base){
    int ret = 0;
    while(arg % base == 0){
        arg /= base;
        ret++;
    }
    return ret;
}

int main(){
    std::ios_base::sync_with_stdio(false);    
    int cnt=0;
    ll a,b;
    for(int i=2;i<1000001;i++){
        if(!isprime[i]){
            primes[cnt++] = i;
            for(int j=2;i*j<1000001;j++){
                isprime[i*j] = true;
            }
        }
    }
    cin >> a >> b;
    ll len,bias;
    if(a - b < 2){
        bias = 2;
    }else{
        bias = a - b;
    }
    len = a + b - bias + 1;

    fill((int *)fact, (int *)fact+1000001, 1 << 29);

    for(int i=0;i < 78498;i++){
        for(int j=(primes[i] - bias % primes[i])%primes[i];j<len;j+=primes[i]){
            if(isfox[j]) continue;
            int tmp = factorial(j+bias,primes[i]);
            if(tmp != 0){
                if(fact[j] == 1 << 29 || fact[j] >= tmp){
                    fact[j] = tmp;
                }else{
                    isfox[j] = true;
                }
            }
        }
    }
    int res = 0;
    for(int i=0;i<len;i++){
        res += !isfox[i]?1:0;            
    }
    cout << res << endl;
}

Measured memory_bytes: 7044
#include <bits/stdc++.h>
#define rep(i, start, end) for (long long i = start; i < end; ++i)
#define repreverse(i, start, end) for (long long i = start; i >= end; --i)
#define all(x) (x).begin(), (x).end()
#define len(x) ((long long)(x).size())
#define lcm(a, b) ((a) / __gcd((a), (b)) * (b))
using namespace std;
using ll = long long;
using ld = long double;
using vll = vector<ll>;
using vllvll = vector<vll>;
using pll = pair<ll, ll>;
template<class T>void print1d(T x,ll n=-1){if(n==-1)n=x.size();rep(i,0,n){cout<<x[i]<<' ';}cout<<'\n';}
template<class T>void print2d(T x,ll r=-1,ll c=-1){if(r==-1)r=x.size();if(c==-1)c=x[0].size();rep(i,0,r)print1d(x[i],c);}
template<class T, class U>bool haskey(T mp, U key) { return mp.find(key) != mp.end(); }
template<class T, class U>bool isin(T el, U container) { return find(all(container), el) != container.end(); }
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; }
template<class T>ld deg2rad(T deg) { return M_PI * deg / 180.0; }
template<class T>ld rad2deg(T rad) { return 180.0 * rad / M_PI; }
ll intpow(ll a,ll n){ll p=1;while(n){if(n&1)p*=a;a*=a;n>>=1;}return p;}
const long double pi = M_PI;
const long long big = 1LL << 50;
const long long inf = 1LL << 60;
const long long mod = 1e9 + 7;



int main()
{
        ll N;
        cin >> N;
        vllvll F(N, vll(10));
        rep(i, 0, N) rep(j, 0, 10) cin >> F[i][j];

        vllvll P(N, vll(11));
        rep(i, 0, N) rep(j, 0, 11) cin >> P[i][j];

        ll mx = -inf;
        rep(bit, 0, 1<<10) {
                vll choice;
                rep(i, 0, 10) {
                        if (bit & (1<<i)) {
                                choice.push_back(i);
                        }
                } 
                if (len(choice) == 0) continue;

                ll total = 0;

                rep(i, 0, N) {
                        ll cnt = 0;
                        rep(j, 0, len(choice)) {
                                cnt += (F[i][choice[j]] == 1);
                        }
                        total += P[i][cnt];
                }

                chmax(mx, total);
        } 
        cout << mx << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repI(i, d, n) for (int i = (d); i < (n); ++i)
#define reps1(i, n) for (int i = 1; i < (n); ++i)
using namespace std;
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; }

using ll = long long;
using P = pair<int, int>;
using Pl = pair<ll, ll>;
using M = map<int, int>;
using Ml = map<ll, ll>;
ll const INF = 1ll<<61;
double pi = 3.141592653589793238;

int main() {
  ll a, v, b, w, t;
  cin >> a >> v >> b >> w >> t;

  if (abs(a-b) <= t * (v-w)) cout << "YES" << endl;
  else cout <<"NO" << endl;

  return 0;
}


Measured memory_bytes: 3624
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace test
{
    class Program
    {
        static void Main(string[] args)
        {
            var R = int.Parse(Console.ReadLine());
            var ans = "";
            if (R < 1200) ans = "ABC";
            else if (R < 2800) ans = "ARC";
            else ans = "AGC";

            Console.WriteLine(ans);
        }
    }
}

Measured memory_bytes: 11092
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, s, e) for (int i = (int)(s); i <= (int)(e); i++)
#define printYesNo(is_ok) puts(is_ok ? "Yes" : "No");
#define printVector(v) rep(i, v.size()) cout << v[i] << endl;

int main()
{
  int H, W;
  cin >> H >> W;
  vector<string> C(H);
  rep(i, H)
  {
    cin >> C[i];
  }
  rep(i, 2 * H)
  {
    rep(j, W)
    {
      cout << C[i / 2][j];
    }
    cout << endl;
  }
  return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
class Program
{
	static void Main(string[] args)
	{
		string str = Console.ReadLine();
		int N = int.Parse(str);
		string[] str2 = Console.ReadLine().Split();
		int[] X = new int[N];
		int[] X2 = new int[N];
		for(var i=0;i<N;i++){
			X[i] = int.Parse(str2[i]);
			X2[i] = X[i];
		}
		Array.Sort(X);
		for(var i=0;i<N;i++){
			if(X2[i] <= X[N/2-1]){
				Console.WriteLine(X[N/2]);
			} else {
				Console.WriteLine(X[N/2-1]);
			}
		}
	}
}

Measured memory_bytes: 36296
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define rep(i, a, b) for(int i = a; i < b; i++)


int main()
{
  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);     
  ll n;
  cin >> n;
  double ans =2*3.14159*n;
  cout << ans;
} 

Measured memory_bytes: 3780
import java.util.*;

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 = a + b;
      	int d = a - b;
      	int e = a * b;
      	int ans = Math.max(c, d);
      	ans = Math.max(ans, e);
      	System.out.println(ans);
    }
}

Measured memory_bytes: 22100
#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
#include<string>
#include<queue>
#include<set>
#include<map>
using namespace std;
typedef long long int ll;
typedef vector<pair<ll,ll> > Q;
typedef pair<int,int> P;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
const ll inf=1e9+7;

ll a,b,c;
void change(){
  ll aa=a,bb=b,cc=c;
  a=(bb+cc)/2,b=(aa+cc)/2,c=(aa+bb)/2;
}

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

  rep(i,inf){
    if(a==b && b==c && a%2==0){
      cout<<-1<<endl;
      break;
    }

    if(a%2 || b%2 || c%2){
      cout<<i<<endl;
      break;
    }
    change();
  }
}

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

int fib(int n){
    if(n==0 || n==1){
       return 1; 
    } 
    return fib(n-1)+fib(n-2);
}
int main(){
    int x, y;
    cin >> x >> y;
    int x_min = 0;
    int x_max = 1;
    int y_min = 0;
    int y_max = 1;
    int c = 0;
    while(true){ 
        if(x_min<=x && x<x_max && y_min<=y && y<y_max){ 
            cout << c%3+1 << endl;
            return 0; 
        }
        // 東 
        c++; 
        x_min = x_max; 
        x_max = x_min+fib(c); 
        y_min = y_min; 
        y_max = y_min+fib(c);
        if(x_min<=x && x<x_max && y_min<=y && y<y_max){ 
            cout << c%3+1 << endl;
            return 0; 
        }
        
        // 北 
        c++; 
        x_max = x_max; 
        x_min = x_max-fib(c); 
        y_min = y_max; 
        y_max = y_min+fib(c);
        if(x_min<=x && x<x_max && y_min<=y && y<y_max){ 
            cout << c%3+1 << endl;
            return 0; 
        }
        
        // 西 
        c++; 
        x_max = x_min; 
        x_min = x_max-fib(c);
        y_max = y_max; 
        y_min = y_max-fib(c);
        if(x_min<=x && x<x_max && y_min<=y && y<y_max){ 
            cout << c%3+1 << endl;
            return 0; 
        }
        
        // 南 
        c++; 
        x_min = x_min; 
        x_max = x_min+fib(c); 
        y_max = y_min; 
        y_min = y_max-fib(c);
    }
    return 0;
}


Measured memory_bytes: 3124
#include <stdio.h>
#include <string.h>

int abs(int a) {
  return a > 0 ? a : -a;
}

int main(void) {
  int n, i, j, k;
  char s[200];
  for( k = 0; ; ++k ) {
    scanf("%d", &n);
    if(!n) break;
    scanf("%s", s);
    int a[n], b[n];
    for(i = n - 1; i >= 0; --i) {
      scanf("%d%d", &a[i], &b[i]);
      a[i]--;
      b[i]--;
    }
    for(i = 0; i < n; ++i) {
      char t;
      t = s[a[i]], s[a[i]] = s[b[i]], s[b[i]] = t;
      int num = abs(a[i] - b[i]) % 26;
      s[a[i]] += num, s[b[i]] += num;
      if(s[a[i]] > 'z' || s[a[i]] < 'a') s[a[i]] -= 26;
      if(s[b[i]] > 'z' || s[b[i]] < 'a') s[b[i]] -= 26;
    }
    printf("%s\n", s);
  }
  return 0;
}


Measured memory_bytes: 2564
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
using namespace std;
#define MOD @
#define ADD(X,Y) ((X) = ((X) + (Y)%MOD) % MOD)
typedef long long i64; typedef vector<int> ivec; typedef vector<string> svec;

i64 X;

int main()
{
	scanf("%lld", &X);
	i64 ret = 0;
	ret += X / 11 * 2;
	X %= 11;
	if (X >= 7) ++ret;
	if (X >= 1) ++ret;
	printf("%lld\n", ret);

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
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; }

#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ for(auto it : P) { s << "<" << it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ for(auto it : P) { s << "<" << it.first << "->" << it.second << "> "; } return s << endl; }


const int MOD = 998244353;
int main() {
    int N, S;
    cin >> N >> S;
    vector<int> A(N);
    for (int i = 0; i < N; ++i) cin >> A[i];
    vector<vector<long long>> dp(N+1, vector<long long>(S+1, 0));
    dp[0][0] = 1;
    for (int i = 0; i < N; ++i) {
        for (int j = 0; j <= S; ++j) {
            dp[i+1][j] += dp[i][j] * 2 % MOD;
            if (j-A[i] >= 0) dp[i+1][j] += dp[i][j-A[i]];
            dp[i+1][j] %= MOD;
        }
    }
    cout << dp[N][S] << endl;
}

Measured memory_bytes: 73728
#!/usr/bin/env python3
n, *a = map(int, open(0).read().split())
b = [1] * n
i = 0
c = 0
while True:
    if b[i] < 1:
        break
    if i == 1:
        print(c)
        exit()
    b[i] = 0
    i = a[i] - 1
    c += 1
print(-1)


Measured memory_bytes: 20208
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using namespace std;
using ll=long long;
using ld=long double;
//#define int long long
//#define _CRT_SECURE_NO_WARNINGS
#define rep(i, n) for (int i = 0; i < n; i++)
#define _GLIBCXX_DEBUG
const int MOD = 1e9 + 7;
const int INF = 1e18 + 9;
constexpr long double pi = 3.141592653589793238462643383279;
int fact(int i) {
    if (i == 0) return 1;
    return (fact(i - 1)) * i;
}
int gcd(int a, int b) {
    if (b == 0) return a;
    return gcd(b, a % b);
}
int lcm(int a, int b) {
    return a * b / gcd(a, b);
}
int keta(int n) {
    if (n == 0) return 1;
    int count = 0;
    while (n != 0) {
        n /= 10;
        count++;
    }
    return count;
}
int ketasum(int n) {
    int sum = 0;
    while (n != 0) {
        sum += n % 10;
        n /= 10;
    }
    return sum;
}
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

int main(void){
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    if (abs(a - b) <= d && abs(b - c) <= d || abs(a - c) <= d) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

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

#define ll long long

#define fr(i,a,b) for (ll i = (a), _b = (b); i <= _b; i++)
#define frr(i,a,b) for (ll i = (a), _b = (b); i >= _b; i--)
#define rep(i,n) for (ll i = 0, _n = (n); i < _n; i++)
#define repr(i,n) for (ll i = n - 1; i >= 0; i--)
#define fill(ar,val) memset(ar, val, sizeof(ar))
#define fill0(ar) fill((ar), 0)
#define debug(x) cout<<#x<<": "<<x<<endl

#define ld long double
#define pb push_back
#define mp make_pair
#define ff first
#define ss second

typedef pair<int, int> ii;
typedef pair<ii, int> iii;
typedef vector<ii> vii;
typedef vector<int> vi;

#define INF 1000000000000000000
#define PI 3.14159265358979323846L

ll freq[31];

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    ll n,m;
    cin >> n >> m;

    rep(i,n)
    {
    	ll k;
    	cin >> k;

    	rep(j,k)
    	{
    		ll x;
    		cin >> x;
    		freq[x]++;
    	}
    }

    ll ans = 0;
    fr(i,0,30)
    {
    	if(freq[i]==n)
    	{
    		ans++;
    	}
    }

    cout << ans << endl;
}


Measured memory_bytes: 256
from collections import deque

s = deque(list(input()))
q = int(input())
rev = False
for _ in range(q):
    qr = list(map(str, input().split()))
    if qr[0] == '1':
        rev = 1 - rev
    else:
        if qr[1] == '1':
            if rev: s.append(qr[2])
            else  : s.appendleft(qr[2])
        else:
            if rev: s.appendleft(qr[2])
            else  : s.append(qr[2])
if rev:
    s.reverse()
    print(''.join(s))
else:
    print(''.join(s))

Measured memory_bytes: 8804
#include <bits/stdc++.h>
#define ALL(v) v.begin(), v.end()
#define MOD 1000000007
#define INF 1000000011
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep1(i, n) for(int i = 1; i <= (int)(n); i++)
using namespace std;
typedef long long ll;
 
int main(){
  ll n,m;
  cin>>n>>m;
  ll a[m];
  rep(i, m){
    cin>>a[i];}
  
  
  
  ll dp[n+1];
  
  for(int i=0;i<=n;i++){
    dp[i]=0;}
  
  ll ap=0;
  
  if(n==1){
    cout<<1<<endl;
    return 0;}
      
  
  if(a[ap]==1){
    dp[1]=0;
    ap++;}
  else{
    dp[1]=1;}
  
  if(a[ap]==2){
    dp[2]=0;
    ap++;}
  else{
    if(ap==1){
      dp[2]=1;}
    else{
      dp[2]=2;}
  }
  
  for(int i=3;i<=n;i++){
    if(a[ap]==i){
      dp[i]=0;
      ap++;}
  else{
    dp[i]=(dp[i-2]%MOD+dp[i-1]%MOD)%MOD;}
  }
  
  cout<<dp[n]<<endl;
  
  
 
 
}

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

// エイリアス
using  ll = long signed long;
using ull = long unsigned long;
using  ld = long double;
using   P = pair<int, int>;
using llP = pair<ll, ll>;
using DoP = pair<double, double>;

// 汎用マクロ
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define FOREACH(i,q) for (auto &i : q)
#define UNIQUE(v) do { sort((v).begin(), (v).end()); (v).erase(unique((v).begin(), (v).end()), (v).end()); } while (false)
#define SZ(x) ((int)(x).size())
template <class T>inline bool chmin(T &a, const T b) {if (a > b) { a = b; return true;} return false;}
template <class T>inline bool chmax(T &a, const T b) {if (a < b) { a = b; return true;} return false;}
template <class T>inline void line_out(const vector<T> vec) {int n = SZ(vec); rep(i, n) { cout << vec[i]; if(i < n-1) cout << " ";}cout << endl;}
const int di[] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dj[] = {1, 0, -1, 0, 1, -1, 1, -1};
const int INF = 1 << 28;
const ll INF64 = 1ll << 60;
const int mod = 1000000007;
//const int mod = 998244353;
struct mint
{
  ll x; // typedef long long ll;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint operator-() const { return mint(-x); }
  mint &operator+=(const mint a)
  {
    if ((x += a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator-=(const mint a)
  {
    if ((x += mod - a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator*=(const mint a)
  {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const
  {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const
  {
    mint res(*this);
    return res -= a;
  }
  mint &operator++()
  {
    if ((x += 1) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator--()
  {
    if ((x += mod - 1) >= mod)
      x -= mod;
    return *this;
  }
  mint operator*(const mint a) const
  {
    mint res(*this);
    return res *= a;
  }
  mint pow(ll t) const
  {
    if (!t)
      return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1)
      a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const
  {
    return pow(mod - 2);
  }
  mint &operator/=(const mint a)
  {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const
  {
    mint res(*this);
    return res /= a;
  }
};


int main()
{
  int h, w; cin >> h >> w;
  vector<string> a(h);
  rep(i, h) cin >> a[i];

  queue<P> q;
  vector<vector<int>> ans(h, vector<int>(w, -1));

  auto update = [&](P now) {
    int i = now.first, j = now.second;
    rep(k, 4) {
      int ni=i+di[k], nj=j+dj[k];
      if(ni < 0 || ni >= h || nj < 0 || nj >= w) continue;
      if(ans[ni][nj] == -1) {
        ans[ni][nj] = ans[i][j]+1;
        q.push(P(ni, nj));
      }
    }
  };
  rep(i, h) rep(j, w) {
    if(a[i][j] == '#') {
      ans[i][j] = 0;
      q.push(P(i, j));
    }
  }

  while(!q.empty()) {
    P now = q.front(); q.pop();
    update(now);
  }
  int res = 0;
  rep(i, h) rep(j, w) chmax(res, ans[i][j]);
  cout << res << endl;
}

Measured memory_bytes: 17124
#include <bits/stdc++.h>
#define pb push_back
#define IOS                                                                    \
  ios_base::sync_with_stdio(false);                                            \
  cin.tie(0);                                                                  \
  cout.tie(0)
#define ll long long int
#define ld long double
#define el '\n'
#define PI (ld)3.141592653589793238462643383279502884197169399375105820974944
#define inf (ll)1000000000
#define mod (ll)1000000007
#define mod1 (ll)998244353
#define fo(i, n) for (long long i = 0; i < int(n); i++)
#define pll pair<ll, ll>
#define ml map<ll,ll>
#define vli vector<pair<ll,int>>
#define vpl vector<pll>
#define vvl vector<vector<ll> >
#define vvpl vector< vector<pll> >
#define ff first
#define ss second
#define pqueue priority_queue< ll >
#define pdqueue priority_queue< ll,vl ,greater< ll > >
#define mem(a,b) memset(a,b,sizeof(a));
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define sz(a) (ll)a.size()
#define f(i,a,b) for(ll i=a;i<b;i++)
#define fd(i,a,b) for(ll i=a;i>=b;i--)
#define all(a) a.begin(),a.end()
#define vl vector<ll>
//#define x ff
//#define y ss
#define pt(a) for(auto it:a)cout<<it<<" ";cout<<endl;
unsigned seed = std::chrono::system_clock::now().time_since_epoch().count();
using namespace std;

double gcd(double a, double b) { return a < 0.01 ? b : gcd(fmod(b, a), a); }

vector<ll> parent, rak;

void make_set(int f){
    fo(i,f+1)parent.pb(i);
    rak.assign(f+1,1);
}

ll find_set(ll v) {
    if (v == parent[v])
        return v;
    return parent[v] = find_set(parent[v]);
}

ll union_sets(ll a, ll b) {
    a = find_set(a);
    b = find_set(b);
    if (a != b) {
        if (rak[a] < rak[b])
            swap(a, b);
        parent[b] = a;
        rak[a]+=rak[b];
        return (rak[a]-rak[b])*(rak[b]);
    }
    return 0;
}

long long bpow(long long a, long long b, long long m) {
  a %= m;
  long long res = 1;
  while (b > 0) {
    if (b & 1)
      res = res * a % m;
      a = a * a % m;
      b >>= 1;
  }
  return res;
}
ll extend_gcd(ll a,ll b,ll &x,ll &y){
    if(b==0){
        x=1;
        y=0;
        return a;
    }
    ll x1,y1;
    ll ans =extend_gcd(b,a%b,x1,y1);
    x=y1;
    y=x1-(a/b)*y1;

    return ans;
}
ll inverse(ll a,ll m){
    ll x,y;
    extend_gcd(m,a,x,y);
    y%=m;
    y+=m;
    y%=m;
    return y;
}

unsigned long long fhash( vector<ll> p, ll len ) {
    unsigned long long h = 0xcbf29ce484222325ULL;//cout<<0x100000001b3ULL<<endl;
    for ( ll i = 0; i < len; i++ )
      h = ( h ^ p[i] ) * 0x100000001b3ULL;//cout<<h<<endl;

   return h;
}

/*const int N = 1000001;
int lp[N+1];
vector<int> pr;
void s(){
for (int i=2; i<=N; ++i) {
        if (lp[i] == 0) {
            lp[i] = i;
            pr.push_back (i);
        }
        for (int j=0; j<(int)pr.size() && pr[j]<=lp[i] && i*pr[j]<=N; ++j)
            lp[i * pr[j]] = pr[j];
    }
}*/


ll kv;
ll t,n,x,y,h,k,z,p,q,w;
string s,s1,s2;
//vvl v;
//vl vis,d;


int main() {
    IOS;
    cin>>p>>q;
    if(p>=13)cout<<q;
    else if(p>=6)cout<<q/2;
    else cout<<0;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define F first
#define S second
#define vi vector<int>
#define vl vector<long long>
#define pii pair<int, int>
#define pll pair<long long, long long>
#define abu ios_base::sync_with_stdio(0)
#define said cin.tie(0)
using namespace std;
ll const MOD = 1000000007;

void yes(){
    cout<<"YES"<<'\n';
}

void no(){
    cout<<"NO"<<'\n';
}

ll fact(int n){
    ll ans = 1;
    for(int i=2;i<=n;i++){
        ans = (ans*i)%MOD;
    }

    return ans;
}

ll powM(int n, int x){
    if(x==0){
        return 1;
    }
    if(x==1){
        return n%MOD;
    }

    if(x%2==0){
        ll a = powM(n,x/2);
        return (a*a)%MOD;
    }else{
        return (n*powM(n,x-1))%MOD;
    }
}

ll C(int n, int k){
    return (fact(n) * powM((fact(k)*fact(n-k))%MOD,MOD-2))%MOD;
}

ll A(int n, int k){
    return (fact(n) * powM(fact(n-k)%MOD,MOD-2))%MOD;
}

int const N = 302;
double p[N][N][N],ev[N][N][N];
int cnt[4];

void solve(){
    int n;
    cin>>n;
    for(int i=0;i<n;i++){
        int x;
        cin>>x;
        cnt[x]++;
    }
    p[cnt[1]][cnt[2]][cnt[3]] = 1;
    for(int c = n;c>=0;c--){
        for(int b = n;b>=0;b--){
            for(int a = n;a>=0;a--){
                if(a==0 && b==0 && c==0){
                    continue; 
                }
                if((a+b+c)>n){
                    continue;
                }
                double p_waste = (double)(n-(a+b+c))/n;
                double ev_waste = p_waste/(1-p_waste);
                ev[a][b][c] += ev_waste*p[a][b][c];
                if(a!=0){
                    p[a-1][b][c] += p[a][b][c] * (double)a/(a+b+c);
                    ev[a-1][b][c] += ev[a][b][c] *(double) a/(a+b+c);
                }
                if(b!=0){
                    p[a+1][b-1][c] +=p[a][b][c] * (double)b/(a+b+c);
                    ev[a+1][b-1][c] += ev[a][b][c] *(double) b/(a+b+c);
                }
                if(c!=0){
                    p[a][b+1][c-1] +=p[a][b][c] * (double)c/(a+b+c);
                    ev[a][b+1][c-1] +=ev[a][b][c] * (double)c/(a+b+c);
                }

            }
        }
    }
    printf("%.10f\n",ev[0][0][0]+cnt[1]+2*cnt[2]+3*cnt[3]);
}

int main(){
    abu;
    said;
    int t = 1;
    //cin>>t;
    while(t--){
        solve();
    }

    return 0;
}


Measured memory_bytes: 430336
def main():
    md = 998244353
    s = input()
    n = len(s)
    al = True  # allすべて同じ文字
    an = 1  # any連続が存在すると0
    for c0, c1 in zip(s, s[1:]):
        if c0 == c1:
            an = 0
        else:
            al = False
        if an == 0 and not al: break
    if al:
        print(1)
        exit()
    if n == 2:
        print(2)
        exit()
    if n == 3:
        if s[0] == s[-1]:
            print(7)
        elif s[0] == s[1] or s[1] == s[2]:
            print(6)
        else:
            print(3)
        exit()
    #print(n)
    #print(an)
    ord0=ord("a")
    r = sum(ord(c) - ord0 for c in s) % 3
    if n%3==0:
        d=pow(2,n//3-1,md)
        if r==0:
            an-=d*2
        else:
            an+=d
    print((pow(3, n - 1, md) - pow(2, n - 1, md) + an) % md)

main()


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

using namespace std;

int main()
{
  int N; cin >> N;
  vector<int> L(N);
  for (int i = 0; i < N; ++i) {
    cin >> L[i];
  }

  sort(L.begin(), L.end(), greater<int>());

  if (L[0] < accumulate(L.begin() + 1, L.end(), 0)) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include <stdio.h>
using namespace std;
using ll = long long;

int main(void) {
	int X;
	scanf("%d", &X);
	int Y = X * 100 / 108;
	if (Y * 108 / 100 == X) {
		printf("%d\n", Y);
	} else if (++Y * 108 / 100 == X) {
		printf("%d\n", Y);
	} else {
		printf(":(\n");
	}
	return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int MAXN=200010,P=998244353;
struct Po {
	int first,second,id;
}p[MAXN],tp[MAXN];
int n,cnt[MAXN][4];
long long ans;
bool cmp1 (Po a,Po b) {return a.first<b.first;}
long long qpow (int a,int b) {
	if (b<0) {return 0;}
	int res=1;
	while (b) {
		if (b&1) {res=(res*a)%P;}
		a=(a*a)%P;
		b>>=1; 
	}
	return res;
}
void merge (int l,int r) {
	if (l==r) {
		return;
	} else {
		int mid=(l+r)/2,k=l,i=l,j=mid+1;
		merge(l,mid);
		merge(mid+1,r);
		while (i<=mid&&j<=r) {
			if (p[i].second<p[j].second) {cnt[p[i].id][2]+=j-mid-1,cnt[p[i].id][3]+=r-j+1;tp[k++]=p[i++];
			} else {cnt[p[j].id][0]+=i-l,cnt[p[j].id][1]+=mid-i+1;tp[k++]=p[j++];}
		}
		while (i<=mid) {cnt[p[i].id][2]+=j-mid-1;tp[k++]=p[i++];}
		while (j<=r) {cnt[p[j].id][0]+=i-l;tp[k++]=p[j++];}
		for (int ii=l;ii<=r;ii++) {p[ii]=tp[ii];}
	}
	return;
}
long long calc (int x) {
	return ((((((((qpow(2,cnt[x][0])-1)*(qpow(2,cnt[x][3])-1))%P)*qpow(2,cnt[x][1]))%P)*qpow(2,cnt[x][2]))%P)+((((((qpow(2,cnt[x][0])*qpow(2,cnt[x][3]))%P)*(qpow(2,cnt[x][1])-1))%P)*(qpow(2,cnt[x][2])-1))%P)
	        -(((((((qpow(2,cnt[x][0])-1)*(qpow(2,cnt[x][1])-1))%P)*(qpow(2,cnt[x][2])-1))%P)*(qpow(2,cnt[x][3])-1))%P)+P)%P;
}
signed main () {
	scanf("%lld",&n);
	for (int i=1;i<=n;i++) {scanf("%lld%lld",&p[i].first,&p[i].second);p[i].id=i;}
	sort(p+1,p+n+1,cmp1);
	merge(1,n);
	for (int i=1;i<=n;i++) {
		ans=(ans+calc(i)+P)%P;
		ans=(ans+qpow(2,n-1))%P;
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 15872
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MM 1000000000
#define MOD MM+7
#define MAX 301000
#define MAP 110
#define initial_value -1
#define Pair pair<int,int>
#define chmax(a,b) (a<b ? a=b:0)
#define chmin(a,b) (a>b ? a=b:0)
ll INF = 1e18;
int dx[4] = {-1,0,1,0};
int dy[4] = {0,-1,0,1};
int par[100];
int depth[100];
string s, t;
int dp[3030][3030] = {0};
int main(){
    cin >> s >> t;
    for(int i = 0; i < s.size(); i++){
        for(int j = 0; j < t.size(); j++){
            if(s[i] == t[j]) chmax(dp[i+1][j+1], dp[i][j]+1);
            chmax(dp[i+1][j+1], dp[i+1][j]);
            chmax(dp[i+1][j+1], dp[i][j+1]);
        }
    }

    string res = "";
    int i = s.size(); int j = t.size();
    while(i > 0 && j > 0){
        if(dp[i][j] == dp[i-1][j]) --i;
        else if(dp[i][j] == dp[i][j-1]) --j;
        else {
            res = s[i-1] + res;
            i--; j--;
        }
    }
    cout << res << endl;
}

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

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
Scanner sc=new Scanner(System.in);
int x=sc.nextInt();
if(x==0)
{
System.out.println("1");
return;
}
x=sc.nextInt();
if(x==0)
{
System.out.println("2");
return;
}
x=sc.nextInt();
if(x==0)
{
System.out.println("3");
return;
}
x=sc.nextInt();
if(x==0)
{
System.out.println("4");
return;
}
x=sc.nextInt();
if(x==0)
{
System.out.println("5");
return;
}

	}

}


Measured memory_bytes: 35720
import java.util.*;

public class Main {

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

	public void run() {
		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt();
		long t[] = new long[n];
		for(int i=0; i<n; i++) {
			t[i]=sc.nextLong();
		}
		long ans = t[0];
		for(int i=1; i<n; i++) {
			ans = lcm(ans, t[i]);
		}
		System.out.println(ans);

		sc.close();
	}

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

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



}


Measured memory_bytes: 36136
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        APluralForm solver = new APluralForm();
        solver.solve(1, in, out);
        out.close();
    }

    static class APluralForm {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 入力
            String S = in.next();

            // 出力
            if (S.charAt(S.length() - 1) == 's') {
                out.println(S + "es");

            } else {
                out.println(S + "s");

            }

        }

    }
}



Measured memory_bytes: 38396
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <vector>
#include <queue>
#include <algorithm>

using namespace std;

//typedef pair<int,int> P


int main(){
	char s[101],t[101];
	scanf("%s", s);
	scanf("%s", t);

	sort(s,s+strlen(s));
	sort(t,t+strlen(t));
	reverse(t,t+strlen(t));

	if(strcmp(s,t)<0){
		printf("Yes\n");
	}else{
		printf("No\n");
	}


	return 0;
}


Measured memory_bytes: 256