akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

#define MOD 1000000007
#define MOD2 998244353
#define int long long
//#define PI 3.14159265358979

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

using namespace std;

template < typename T >
ostream &operator<<(ostream &os, const vector< T > &A) {
	for (int i = 0; i < A.size(); i++)
		os << A[i] << " ";
	os << endl;
	return os;
}
template <>
ostream &operator<<(ostream &os, const vector< vector< int > > &A) {
	int N = A.size();
	int M;
	if (N > 0)
		M = A[0].size();
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < M; j++)
			os << A[i][j] << " ";
		os << endl;
	}
	return os;
}

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

struct edge {
	int from, to, d, c;
	edge(int _from = 0, int _to = 0, int _d = 0, int _c = 0) {
		from = _from;
		to = _to;
		d = _d;
		c = _c;
	}
	bool operator<(const edge &rhs) const {
		return (d == rhs.d) ? (c < rhs.c) : (d < rhs.d);
	}
};
struct aabb {
	int x1, y1, x2, y2;
	aabb(int x1, int y1, int x2, int y2) : x1(x1), y1(y1), x2(x2), y2(y2) {}
};

typedef vector< edge > edges;
typedef vector< edges > graph;
struct flow {
	int to, cap, rev, cost;
	flow(int to = 0, int cap = 0, int rev = 0, int cost = 0) : to(to), cap(cap), rev(rev), cost(cost) {}
};
typedef vector< vector< flow > > flows;

const int di[4] = {0, -1, 0, 1};
const int dj[4] = {-1, 0, 1, 0};
const int ci[5] = {0, 0, -1, 0, 1};
const int cj[5] = {0, -1, 0, 1, 0};
const ll LINF = LLONG_MAX / 2;
const int INF = INT_MAX / 2;
const double PI = acos(-1);

int pow2(int n) { return 1 << n; }
template < typename T, typename U >
bool chmin(T &x, const U &y) {
	if (x > y) {
		x = y;
		return true;
	}
	return false;
}
template < typename T, typename U >
bool chmax(T &x, const U &y) {
	if (x < y) {
		x = y;
		return true;
	}
	return false;
}

struct initializer {
	initializer() {
		cout << fixed << setprecision(11);
	}
};
initializer _____;

int N, M, K, T, Q, H, W;
signed main() {
	cin >> N;
	vector< string > S(N);
	rep(i, N) cin >> S[i];
	int ans = 0;
	vector< int > num(N, 0);
	rep(i, N) {
		rep(j, N) {
			if (S[i][j] == '.')
				num[i]++;
		}
	}
	bool f = true;
	rep(i, N) rep(j, N) if (S[i][j] == '#') f = false;
	if (f) {
		cout << -1 << endl;
		return 0;
	}
	vector< bool > black(N, false);
	rep(j, N) rep(i, N) if (S[i][j] == '#') black[j] = true;
	int minm = LINF, minj = -1;
	rep(i, N) {
		if (black[i]) {
			chmin(minm, num[i]);
		} else {
			chmin(minm, num[i] + 1);
		}
	}
	if (minm == LINF) {
		cout << -1 << endl;
		return 0;
	}
	ans += minm;
	rep(j, N) {
		rep(i, N) {
			if (S[i][j] == '.') {
				ans++;
				break;
			}
		}
	}
	cout << ans << endl;
	return 0;
}

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

int main(){
	int n,a[5001];
	int ans;
	a[0]=0;
	while(cin>>n&&n){
		ans = INT_MIN;
		for(int i=1;i<=n;i++){
			cin>>a[i];
			a[i] += a[i-1];
		}
		for(int i=1;i<=n;i++){
			for(int j=i;j<=n;j++){
				ans = max(ans,a[j]-a[i-1]);
			}
		}
		cout<<ans<<endl;
	}
	return 0;
}

Measured memory_bytes: 1176
import sys
input = sys.stdin.readline

def main():
    s = input().strip()

    for c in s:
        if "a" <= c and c <= "z":
            tmp = c.upper()
        elif "A" <= c and c <= "Z":
            tmp = c.lower()
        else:
            tmp = c
        print(tmp, end="")
    print()


if __name__ == "__main__":
    main()


Measured memory_bytes: 5720
#include<cstdio>
#include<cstring>
#include<cctype>
#include<algorithm>
#include<vector>
#define pb push_back
#define mp make_pair
#define xx first
#define yy second
#define rep(i,a,b) for(int i=(a),i##_end_=(b);i<=i##_end_;i++)
#define dwn(i,a,b) for(int i=(a),i##_end_=(b);i>=i##_end_;i--)
using namespace std;
inline int read() {
    int x=0,f=1;char c=getchar();
    for(;!isdigit(c);c=getchar()) if(c=='-') f=-1;
    for(;isdigit(c);c=getchar()) x=x*10+c-'0';
    return x*f;
}
typedef long long ll;
typedef pair<int,int> pii;
int main() {
	char s[110];
	scanf("%s",s);
	int n=strlen(s);
	rep(i,1,n) putchar('x');
	return 0;
}


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

typedef long long ll;

int main(){

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

    ll n;
    cin >> n;
    
    ll ans = 0;
    for(int i=1; i<=n; i++){

        ll k = n/i;
        ans+=(k*(k+1)/2)*i;
    }

    cout<<ans<<'\n';
    return 0;
}


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

using namespace std;
using ll=long long;

void solve() {
    int n, K;
    cin >> n >> K;
    vector<int> a(n);
    for (auto& x: a) {
        cin >> x;
    }
    vector<ll> s; s.reserve(n*(n+1)/2);
    for (int i = 0; i < n; i++) {
        ll sum = 0;
        for (int j = i; j < n; j++) {
            sum += a[j];
            s.emplace_back(sum);
        }
    }

    ll res = 0;
    const int L = 40;
    for (int j = L; j >= 0; j--) {
        ll k = 1ll<<j;
        ll tar = res|k;
        int cnt = 0;
        for (auto& x: s) {
            if ((x&tar) == tar) cnt++;
        }
        if (cnt >= K) res = tar;
    }
    cout << res;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    solve();
    cout << endl;
}


Measured memory_bytes: 4224
import java.util.*;
import java.io.*;

class Main {

	void solve () {

		int a = in.nextInt(), b = in.nextInt();
		int[] ar = {a+a-1, b+b-1, a+b};
		Arrays.sort(ar);
		out.println(ar[2]);
		
	}
	
	public static Scanner in = new Scanner(System.in);
	public static PrintWriter out = new PrintWriter(System.out);
	public static void main(String[] args) {
		new Main().solve();
		out.flush();
	}

}

Measured memory_bytes: 23636
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]
dy8, dx8 = [0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def ceil(a, b):
    return (a + b - 1) // b


# 初項s, 交差dのn個の数列の和
def sum_of_arithmetic_progression(s, d, n):
    return n * (2 * s + (n - 1) * d) // 2


# aとbの最大公約数
def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)


# aとbの最小公倍数
def lcm(a, b):
    g = gcd(a, b)
    return a / g * b


def main():
    N = input()
    print(N.count("2"))


if __name__ == '__main__':
    main()


Measured memory_bytes: 4068
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<int,int> Pi;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define fi first
#define se second
#define PI (acos(-1))

template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}
template<class T>
inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}
template<typename T> ostream& operator<<(ostream& s,const complex<T>& d) {return s<<"("<<d.real()<<", "<<d.imag()<< ")";}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const pair<T1,T2>& d) {return s<<"("<<d.first<<", "<<d.second<<")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& d){
	int len=d.size();
	rep(i,len){
		s<<d[i];if(i<len-1) s<<" ";
	}
	return s;
}
template<typename T> ostream& operator<<(ostream& s,const vector<vector<T>>& d){
	int len=d.size();
	rep(i,len){
		s<<d[i]<<endl;
	}
	return s;
}
template<typename T> ostream& operator<<(ostream& s,const set<T>& v){
	s<<"{ ";
	for(auto itr=v.begin();itr!=v.end();++itr) {
		if (itr!=v.begin()) {s<< ", ";}
		s<<(*itr);
	}
	s<<" }";
	return s;
}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const map<T1,T2>& m){
	s<<"{"<<endl;
	for(auto itr=m.begin();itr!=m.end();++itr){
		s<<" "<<(*itr).first<<" : "<<(*itr).second<<endl;
	}
	s<<"}"<<endl;
	return s;
}

const ll mod=1e9+7;
const ll inf=1e15;

struct edge{
  ll from,to,cost;
};

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n,m,p;
  cin>>n>>m>>p;
  vector<edge> g(m);
  rep(i,m){
    ll a,b,c;
    cin>>a>>b>>c;
    a--,b--;
    g[i]={a,b,p-c};
  }
  vector<ll> dist(n,inf);
  dist[0]=0;
  rep(i,n-1){
    rep(j,m){
      ll u=g[j].from,v=g[j].to,c=g[j].cost;
      if(dist[u]!=inf){
        chmin(dist[v],dist[u]+c);
      }
    }
  }
  vector<bool> flag(n,false);
  ll ans=max(0ll,-dist[n-1]);
  rep(i,n){
    rep(j,m){
      edge e=g[j];
      if(dist[e.to]!=inf && dist[e.to]>dist[e.from]+e.cost){
        dist[e.to]=dist[e.from]+e.cost;
        flag[e.to]=true;
      }
      if(flag[e.from]) flag[e.to]=true;
    }
  }
  if(flag[n-1]) cout<<-1<<endl;
  else cout<<ans<<endl;
}

Measured memory_bytes: 384
N=int(input())
A = list(map(int,input().split()))
lis = [0]*200000
ans=1
num_zero=0
mod = 1000000007
for i in A:
  lis[i]+=1
  if i!=0:
    ans*=lis[i-1]
    lis[i-1]-=1
    ans%=mod
    if lis[i-1]<0:
      ans=0
      break
    
  else:
    num_zero+=1

if (num_zero==2)or(num_zero==3):
  mul = 6
  
elif num_zero==1:
  mul = 3

else:
  mul = 0
  
print((ans*mul)%mod)

Measured memory_bytes: 14020
/*~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=
*$* WRITER:kakitamasziru/OxOmisosiru *$*
~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=*/
#ifdef LOCAL_JUDGE
#define _GLIBCXX_DEBUG //FOR THE DEBUG! COMMENT OUT THIS WHEN SUBMITTING!
#endif
/* I REALLY HOPE MY WISH REACH YOU , ATCODER'S ONLINE JUDGE */
#define WOULD
#define YOU
#define PLEASE
#define ACCEPT
#define MY
#define SUBMISSION
/* I REALLY HOPE MY WISH REACH YOU , ATCODER'S ONLINE JUDGE */
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <iomanip>
#include <limits>//setprecision
//#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <math.h>//pow,,,
#include <cmath>//abs,,,
#include <bitset> // bitset
//It is so troublesome that I include bits/stdc++.h !
using namespace std;

template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
const long long INF = 100100100100;
const long long MOD = 1000000007;
typedef pair<int,int> P;

//Solve N^M. This, mod_pow use Iterative Square Method.
long long mod_pow(long long N, long long M) {
    if (M == 0) return 1;
    long long res = mod_pow((N * N) % MOD, M / 2);
    //最下位ビット(*N)が1の時は単独でNをかける
    if (M & 1) res = (res * N) % MOD;

    return res %= MOD;
}

long long gcd(long long a, long long b) {
    if (b == 0) return a;
    else return gcd(b, a % b);
}
long long lcm(long long a, long long b) {
    return a * b / gcd(a, b);
}

int main() {
    int N;cin >> N;
    int all = pow(3,N);
    int hosyugou = 1;
    for(int i = 0;i<N;i++){
        int a;cin >> a;
        if(a%2 == 0) hosyugou *= 2; 
    }
    cout << all - hosyugou << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
using namespace std;
bool prime[10000000];
ll N=10000000;
void seive()
{
    int sqrtn,i,j;
    prime[0]=1,prime[1]=1,prime[2]=0;
    for(i=4;i<=N;i++)
    {
        prime[i]=0;
        if(i%2==0)
            prime[i]=1;
    }
    sqrtn=((int)sqrt((double)N));
    for(i=3;i<=sqrtn;i+=2)
    {
        if(prime[i]==0)
        {
            for(j=i*i;j<=N;j+=i+i)
            {
                prime[j]=1;
            }
        }
    }
}
int main()
{
    seive();
    vector<ll>v;
    //cout<<n<<endl;
    for(int i=2;i<N;i++)
    {
        if(i>=55555)
            break;
        if(prime[i]==0&&(i%5)==1){
            v.push_back(i);
        }

    }
    ll k,pos=0,tmp=0;
    scanf("%lld",&k);
    for(int i=0;i<k;i++)
        printf("%lld ",v[i]);

    //cout<<v.size()<<endl;
    return 0;
}


Measured memory_bytes: 9984
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD=1e9+7;
const int INF=1e9;

int main(){
    int n,m,r;
    cin>>n>>m>>r;
    int perm[r];
    for(int i=0;i<r;i++){
        cin>>perm[i];
    }
    sort(perm,perm+r);
    int dp[n][n];
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            dp[i][j]=(i==j?0:INF);
        }
    }
    for(int i=0;i<m;i++){
        int a,b,c;
        cin>>a>>b>>c;
        dp[a-1][b-1]=dp[b-1][a-1]=c;
    }
    for(int k=0;k<n;k++){
        for(int i=0;i<n;i++){
            if(dp[i][k]==INF)continue;
            for(int j=0;j<n;j++){
                if(dp[k][j]==INF)continue;
                dp[i][j]=min(dp[i][j],dp[i][k]+dp[k][j]);
            }
        }
    }
    int ans=INF;
    do{
        int sum=0;
        for(int i=1;i<r;i++){
            sum+=dp[perm[i-1]-1][perm[i]-1];
        }
        ans=min(ans,sum);
    }while(next_permutation(perm,perm+r));
    cout<<ans<<endl;
}


Measured memory_bytes: 384
using System.Collections.Generic;
using System.Linq;
using System;

public class Hello
{
    public static void Main()
    {
        var d = new Dictionary<char, long>();
        var s = Console.ReadLine().Trim();
        var sL =(long) s.Length;
        for (int i = 0; i < sL; i++)
            if (d.ContainsKey(s[i])) d[s[i]]++;
            else d[s[i]] = 1;
        var count = 0L;
        foreach (var x in d.Where(y => y.Value >= 2))
            count +=(long)( x.Value* (x.Value - 1)) / 2;
        var res =(long)( sL * (sL - 1) / 2) - count + 1;
        Console.WriteLine(res);
    }
}



Measured memory_bytes: 14048
#include <iostream>
#include <stdlib.h>
using namespace std;

int top;
int stack[256];

int pop() {
    --top;
    return stack[top + 1];
}

void push(int i) {
    ++top;
    stack[top] = i;
}

int main() {

    int a, b;
    a = 0;
    b = 0;
    top = 0;
    string str = "";

    while (cin >> str) {
        if (str == "+") {
            a = pop();
            b = pop();
            push(a + b);
        } else if (str == "-") {
            a = pop();
            b = pop();
            push(b - a);
        } else if (str == "*") {
            a = pop();
            b = pop();
            push(a * b);
        } else {
            push(atoi(str.c_str()));
        }
    }

    cout << pop() << endl;

    return 0;
}

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

#define REP(i, m, n) for (int i = (m); i < (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define rrep(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb push_back
#define mp make_pair
typedef long long ll;
const ll INF = 1LL << 60;
const ll mod = 1e9 + 7;
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;
}

ll modpow(ll a, ll p)
{
    if (p == 0)
        return 1;
    if (!(p % 2))
    {
        ll halfP = p / 2;
        ll half = modpow(a, halfP);
        return half * half % mod;
    }
    else
    {
        return a * modpow(a, p - 1) % mod;
    }
}

ll comb(int a, int b)
{
    if (b > a - b)
        return comb(a, a - b);
    ll ansMul = 1;
    ll ansDiv = 1;
    for (int i = 0; i < b; i++)
    {
        ansMul *= a - i;
        ansDiv *= i + 1;
        ansMul %= mod;
        ansDiv %= mod;
    }
    ll ans = ansMul * modpow(ansDiv, mod - 2) % mod;
    return ans;
}

/*
int num = 200010;
vector<ll> fact(num), ifact(num);
fact[0] = 1;
fact[1] = 1;
for (int i = 2; i < num; i++) {
    fact[i] = fact[i-1] * i;
    fact[i] %= mod;
}
for (int i = 0; i < num; i++) {
    ifact[i] = modpow(ifact[i], mod-2);
    ifact[i] %= mod;
}
*/

int main() {
    int N; cin >> N;
    string s; cin >> s;
    vector<string> pos{
        "SS", "SW", "WS", "WW"
    };
    rep(k, 4) {
        string t = pos[k];
        rep(i, N) {
            if (i == N-1) s += s[0];
            if (t[i+1] == 'S') {
                if (t[i] == 'S' && s[i+1] == 'o') t = move(t)+'S';
                if (t[i] == 'S' && s[i+1] == 'x') t = move(t)+'W';
                if (t[i] == 'W' && s[i+1] == 'o') t = move(t)+'W';
                if (t[i] == 'W' && s[i+1] == 'x') t = move(t)+'S';
            }
            else if (t[i+1] == 'W') {
                if (t[i] == 'S' && s[i+1] == 'o') t = move(t)+'W';
                if (t[i] == 'S' && s[i+1] == 'x') t = move(t)+'S';
                if (t[i] == 'W' && s[i+1] == 'o') t = move(t)+'S';
                if (t[i] == 'W' && s[i+1] == 'x') t = move(t)+'W';
            }
        }
        if (t[N] == t[0] && t[N+1] == t[1]) {
            cout << t.substr(0, N) << endl;
            return 0;
        }
    }

    cout << -1 << endl;
    return 0;
}


Measured memory_bytes: 776
#include <iostream>
#include <array>
#include <cstdio>
using namespace std;

int main(int argc, char *argv[]){
  int i,j = 1;
  for(;;){
    cin >> i;
    if(i == 0)break;
    cout << "Case "<< j << ": " << i << endl;
    j++;
  }
  return 0;
}

Measured memory_bytes: 1160
#include<cstdio>
#include<cmath>
#include<string>
#include<iostream>
#include<algorithm>
#include<utility>
#include<vector>
#include<map>
#include<set>
#include<limits>
#include<bitset>
#include<array>
#include<numeric>
#include<iomanip>
#include<functional>

using namespace std;
typedef long long int ll;

ll n,m,a,b,c,x,y,aa[100010],ba[100010];
bool r,br,ar;
string s;
char ca,cb;


int main(){
    cin>>a>>b;
    if(b<10)a=a*10;
    else if (b<100)a=a*100;
    else a=a*1000;
    a+=b;
    r=false;
    x=1;
    while(x*x<=100100){
        x++;
        if(a==x*x)r=true;
    }
    cout<<(r ? "Yes":"No")<<endl;
    
}


Measured memory_bytes: 256
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author Kein Yukiyoshi
 */

#include "bits/stdc++.h"
#define int long long
#define rep(i, n)           for (int i = 0; i < (int)(n); i++)
#define REP(i, a, b)        for (int i = (int)(a); i < (int)(b); i++)
#define FOR(i, a)           for (auto &i : a)
#define ALL(obj)            begin(obj), end(obj)
#define MAX(x)              *max_element(ALL(x))
#define MIN(x)              *min_element(ALL(x))
#define sum(x)              accumulate(ALL(x), 0LL)
#define LOWER_BOUND(A, key) distance(A.begin(), lower_bound(ALL(A), key))
#define UPPER_BOUND(A, key) distance(A.begin(), upper_bound(ALL(A), key))

using namespace std;
const int MOD    = (int)(1e9 + 7);
const int INF    = (int)(1e13 + 7);
const double EPS = 1e-14;
const double PI  = acos(-1);

int CEIL(int a, int b) { return (a >= 0 ? (a + (b - 1)) / b : (a - (b - 1)) / b); } //ceil() for int
int mod(int a, int b) { return a >= 0 ? a % b : a - (b * CEIL(a, b)); }             //always return positive num
int bpm(int a, int b) {                                                             //return x^y in order(log(y))
  int res = 1;
  for (a %= MOD; b; a = a * a % MOD, b >>= 1)
    if (b & 1) res = res * a % MOD;
  return res;
}

class AFiveVariables {
public:
  static void solve(istream &cin, ostream &cout) {
    int x1, x2, x3, x4, x5;
    cin >> x1 >> x2 >> x3 >> x4 >> x5;
    if (x1 == 0) {
      cout << 1 << endl;
    } else if (x2 == 0) {
      cout << 2 << endl;
    } else if (x3 == 0) {
      cout << 3 << endl;
    } else if (x4 == 0) {
      cout << 4 << endl;
    } else if (x5 == 0) {
      cout << 5 << endl;
    }
  }
};


signed main() {
  cin.tie(0);
  cout.tie(0);
  ios_base::sync_with_stdio(false);
  cout<<fixed<<setprecision(15);
  AFiveVariables solver;
  std::istream& in(std::cin);
  std::ostream& out(std::cout);
  solver.solve(in, out);
  return 0;
}


Measured memory_bytes: 3608
#include <bits/stdc++.h> 
using namespace std;
const long INF=1000000000000000;
const long MOD=1000000007;

int main(){
    long N;
    cin>>N;
    string s;
    cin>>s;
    
    vector<bool> start(2*N);
    start.at(0)=true;
    bool nowb=true;
    for(int i=1;i<2*N;i++){
        //cout<<nowb<<" "<<s.at(i)<<endl;
        if((nowb&& s.at(i)=='W')||((!nowb)&& s.at(i)=='B')){
            
            start.at(i)=true;
        }else{
            start.at(i)=false;
        }
        nowb=(!nowb);
    }
    
    long ans=1,count=1;
    
    for(int i=1;i<2*N;i++){
        if(start.at(i)){
            //cout<<"#"<<endl;
            count++;
        }else if(count<=0){
            cout<<0<<endl;
            return 0;
        }else{
            //cout<<"&"<<endl;
            ans*=count;
            ans%=MOD;
            count--;
        }
    }
    
    //cout<<count<<endl;
    
    if(count>0){
        cout<<0<<endl;
        return 0;
    }
    
    long kaizyo=1;
    for(long i=1;i<=N;i++) kaizyo=(kaizyo*i)%MOD;
    
    cout<<(ans*kaizyo)%MOD<<endl;
}

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

int main()
{   
    int x[8];
    int y[8];
    int n;
    scanf("%d",&n);
    for (int i = 0; i < n; i++)
        scanf("%d%d",&x[i],&y[i]);
    double ans=0.0;
    for (int i = 0; i < n; i++)
        for (int j = i; j < n; j++){
            ans += sqrt((x[i] - x[j]) * (x[i] - x[j]) + (y[i] - y[j]) * (y[i] - y[j]));

        }
    printf("%f\n", ans*2/n );

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i,a,b) for(ut i=(a);i<(ut)(b);i++)
#define REP(i,b) FOR(i,0,b)
#define ALL(c) c.begin(),c.end()
#define PB push_back
#define cat //cout << __LINE__ << endl;
using namespace std;
typedef long long LL;
typedef double ld;
typedef int ut;
typedef complex<int> cli;
typedef vector<ut> VI;
typedef pair<ut,ut> pr;
typedef pair<ut,pr> ppr;
typedef vector<pr> Vpr;
typedef vector<ppr> Vppr;
typedef priority_queue<pr,Vpr> PQ;
string s;
int N,A,B;
bool solve(int i,int now,int abroad){
	if(s[i]=='a' && now<A+B) return true;
	if(s[i]=='b' && now<A+B){
		if(abroad<B) return true;	
	} 
	return false;
}
int main(){
	cin >> N >>A >> B;
	cin >> s;
	int now=0,abroad=0;
	REP(i,N){
		if(solve(i,now,abroad)){
			cout <<"Yes" << endl;
			now++;
			if(s[i]=='b') abroad++;
		}
		else cout << "No" << endl; 
	}
	return 0;
}

Measured memory_bytes: 896
#https://atcoder.jp/contests/abc110/tasks/abc110_b

n,m,X,Y = map(int,input().split())
x = [int(i) for i in input().split()]
y = [int(i) for i in input().split()]

x.sort(reverse = True)
y.sort()

flag = 'War'
if x[0] < y[0]:
    zmin = x[0] + 1
    zmax = y[0]
    for i in range(zmin, zmax + 1):
        if X < i and i <= Y:
            flag = 'No War'
            break

print(flag)

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

int main(void){
    string s;
    cin >> s;
    if(s[0]==s[1]){
        cout << "1 2" <<endl;
        return 0;
    }
    for(int i=0;i<s.size()-2;++i){
        char a = s[i], b = s[i+1], c = s[i+2];
        if(a==b){
            cout << i+1 << " " << i+2 << endl;
            return 0;
        }else if(a==c){
            cout << i+1 << " " << i+3 << endl;
            return 0;
        }else if(b==c){
            cout << i+2 << " " << i+3 << endl;
            return 0;
        }
    }
    cout << "-1 -1" << endl;
}

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

int main(){
		map<long long, int > fivep;
		for (int i=-500; i<=500; ++i){
			fivep.insert(pair<long long, int>( (long long) pow(i,5),i) );
		}
		int x;
		scanf("%d", &x);
		for(auto& r: fivep){
			if(fivep.count(r.first - (long long) x) > 0){
					printf("%d %d\n", r.second, fivep[r.first - x]);
					return 0;
			}
		}
		for (auto& r: fivep){
			printf("%lld %d\n",r.first, r.second);
		}
        return 0;
}


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

using namespace std;

#define ALL(x) (x).begin(), (x).end()
#define ALLTRUE(xs) all_of(ALL(xs),[](bool x){return x;})
#define AND(x,y,z) set_intersection((x).begin(),(x).end(),(y).begin(),(y).end(),inserter((z),(z).end()))
#define ANYTRUE(xs) any_of(ALL(xs),[](bool x){return x;})
#define CONCAT(x,y) (x).insert((x).end(),(y).begin(),(y).end())
#define DUMP(xs) for (auto x:xs) cout<<x<<' ';cout<<endl
#define FOR(i,a,b) for (int i=(int)(a);i<(int)(b);++i)
#define OR(x,y,z) set_union((x).begin(),(x).end(),(y).begin(),(y).end(),inserter((z),(z).end()))
#define OUT(x) cout<<x<<endl
#define REP(i,n) FOR(i,0,n)

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

vector<int> dividers(ll n) {
  set<int> tmp;
  vector<int> res;
  FOR(i,1,(int)sqrt(n)+1) {
    if (n%i == 0) {
      tmp.insert(i);
      tmp.insert(n/i);
    }
  }
  for (int t:tmp) res.push_back(t);
  sort(ALL(res));
  return res;
}

int main() {
  ll N,M;cin>>N>>M;

  // 先ずはMの約数を出す
  vector<int> ds = dividers(M);

  // 大きい方から順に判定していって、最初にN以上に分けられるものを判定
  reverse(ALL(ds));
  for (int d:ds) {
    if (d*N<=M) {
      OUT(d);
      return 0;
    }
  }

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>
// *テンプレート*
#define int long long
#define rep(i, n) for (int i = 0; i < (n); i++)
#define P pair<int, int>
#define sz(x) x.size()
// aよりbの方が小さかったら、aの値をbの値に置き換える。(swapではない！)
template<class T> inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
// aよりbの方が大きかったら、aの値をbの値に置き換える。
template<class T> inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}

using namespace std;
typedef long long ll;
using Graph = vector<vector<int>>;
//最大公約数
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	return gcd(b, a % b);
}
//最小公倍数
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
// 素数かどうか判定
bool prime(int n) {
	for (int i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}

const long long MOD = 1000000007;
const long long INF = 1LL << 60;
// *テンプレートここまで*

// pair -> vector<pair<int,int>> 
//		   AandB.push_back(make_pair(a[i],b[i]))

int h, w;
char s[410][410];
vector<P>vec;
bool used1[410][410], used2[410][410];
int f[] = { 0,1,0,-1,0,-1,0,1 };
int g[] = { 1,0,-1,0,1,0,-1,0 };

void init() {
	memset(used1, false, sizeof(used1));
}

int bl, wh;

void dfs(int x, int y) {
	init();
	used1[x][y] = true;
	used2[x][y] = true;
	if (s[x][y] == '#')bl++;
	else wh++;

	rep(i, 8) {
		if (x + f[i] < 0 || x + f[i] >= h || y + g[i] < 0 || y + g[i] >= w) {
			continue;
		}
		if (s[x][y] != s[x + f[i]][y + g[i]] && !used2[x + f[i]][y + g[i]]) {
			dfs(x + f[i], y + g[i]);
		}
	}
}

signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cin >> h >> w;
	rep(i, h) {
		rep(j, w) {
			cin >> s[i][j];
			if (s[i][j] == '#') {
				vec.push_back({ i,j });
			}
		}
	}
	int ans = 0;
	for (P i : vec) {
		if (used2[i.first][i.second]) {
			continue;
		}
		bl = 0, wh = 0;
		dfs(i.first, i.second);
		ans += bl * wh;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 9584
import copy
H,N=map(int,input().split())
A=[]
B=[]
for _ in range(N):
    a,b=map(int,input().split())
    A.append(copy.copy(a))
    B.append(copy.copy(b))


inf=float('inf')
component=[0]
for i in range(H):
    component.append(inf)
DP=[]
for j in range(N+1):
    DP.append(copy.copy(component))#DPは(N+1)×(H+1)


for k in range(1,N+1):#k番目の魔法
    for l in range(1,H+1):#体力H
        DP[k][l]=min(DP[k-1][l],DP[k][max(0,l-A[k-1])]+B[k-1])

print(DP[N][H])










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

using namespace std;

int main(){
  int N,alice=0,bob=0;
  cin >> N;
  vector<int> input(N);

  for (int i=0; i<N; i++){
    cin >> input.at(i);
  }
  
  sort(input.begin(),input.end());
  reverse(input.begin(),input.end());
  
  for (int i=0; i<N; i++){
    if(i % 2 == 0){
      alice +=input.at(i);
    }else{
      bob +=input.at(i);
    }
  }
  cout << alice - bob << endl;
}


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

const int maxn = 100000 + 10;
const int mod = 1000000007;

int n, a[maxn], id1, id2;
long long f[maxn], rf[maxn];

long long qp(long long a, long long b)
{
	long long p = 1, q = a;
	while (b)
	{
		if (b & 1)
			p = p * q % mod;
		b >>= 1;
		q = q * q % mod;
	}
	return p;
}

long long c(int n, int m)
{
	return n < m ? 0 : f[n] * rf[m] % mod * rf[n - m] % mod;
}

int main()
{
	scanf("%d", &n);
	unordered_map<int, int> m;
	for (int i = 0; i <= n; i++)
	{
		scanf("%d", &a[i]);
		if (m.count(a[i]))
			id1 = m[a[i]], id2 = i;
		m.insert({a[i], i});
	}

	f[0] = 1, rf[0] = 1;
	for (int i = 1; i <= n; i++)
	{
		f[i] = f[i - 1] * i % mod;
		rf[i] = qp(f[i], mod - 2);
	}

	for (int k = 1; k <= n + 1; k++)
	{
		long long ans = 0;
		if (k == 1)
			ans = n;
		else
		{
			ans = (c(n - 1, k - 2) + c(n - 1, k) + 2 * c(n - 1, k - 1)) % mod;
			ans = (ans - c(n - id2 + id1, k - 1) + mod) % mod;
		}
		printf("%lld\n", ans);
	}	

	return 0;
}

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

int main(){
  int a,b,c,d;
  cin >> a >> b >> c >> d;
  if (a+b > c+d) cout << "Left" << endl;
  else if (a+b == c+d) cout << "Balanced" << endl;
  else cout << "Right" << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cassert>
#include <algorithm>
#include <functional>
#include <string>

using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
	int n, m;
	cin >> n >> m;
	vector<long long> H(n);
	int sum = 0;
	for (int i = 0; i < n; i++) {
		cin >> H[i];
	}
	vector<int> a(m);
	vector<int> b(m);
	vector<int> ABcount(n);
	for (int i = 0; i < m; i++) {
		cin >> a[i] >> b[i];
		ABcount[a[i] - 1]++;
		ABcount[b[i] - 1]++;
	}
	int ABcountsub[100001] = {};
	for (int i = 0; i < m; i++) {
		if (H[a[i]-1] > H[b[i]-1]) {
			ABcountsub[a[i]-1]++;
		}
		else if (H[a[i] - 1] < H[b[i] - 1]){
			ABcountsub[b[i]-1]++;
		}
	}

	for (int i = 0; i < n; i++) {
		if (ABcount[i] == ABcountsub[i]) {
			sum++;
		}
	}
	cout << sum;
	

	return 0;
}

Measured memory_bytes: 5636
# http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_10_B&lang=ja
# http://algorithms.blog55.fc2.com/blog-entry-66.html
# https://www.geeksforgeeks.org/python-program-for-matrix-chain-multiplication-dp-8/
import sys

sys.setrecursionlimit(10 ** 6)
n = int(input())
r = []
for i in range(n):
    a, b = map(int, input().split())
    if i == 0:
        r.append(a)
        r.append(b)
    else:
        r.append(b)

dp = [[float('inf')] * (n + 1) for _ in range(n + 1)]


# dp[i][j] MiMi+1...Mjを計算する最適なコスト
# M[1][2] = M[1][1] + M[2][2] +
def chain_order(i, j):
    if i == j:
        return 0
    if dp[i][j] != float('inf'):
        return dp[i][j]
    for k in range(i, j):
        dp[i][j] = min(dp[i][j], chain_order(i, k) + chain_order(k + 1, j) + r[i - 1] * r[k] * r[j])
    return dp[i][j]


# print(r)
print(chain_order(1, len(r)-1))



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

using namespace std;
using ll = long long;
using ld = long double;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define reps(i,s,n) for(int i=(int)(s);i<(int)(n);i++)
const ll mod = ll(1e9) + 7;
const int INF = int(1e9);

int main() {
	cin.sync_with_stdio(false);
	string s;
	cin >> s;
	int ans = 0;
	rep(i, 3)if (s[i] == '1')ans++;
	cout << ans << endl;
	return 0;
}


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


int main() {

    int a, b, c;
    cin >> a >> b >> c;
    if (b/a >= c) cout << c << endl;
    else cout << b/a << 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 n;
    cin >> n;
    vector<int> a(n);   
    rep(i, n) cin >> a[i];

    ll ans = 0;
    map<int, int> mp;
    rep(i, n){
        int J = i - a[i];
        int I = i + a[i];
        mp[I] += 1;
        ans += mp[J];
    }
    cout << ans << endl;
    return 0;
}

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

//	string s;
//	getline(cin, s);
//	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);

int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	string t;
	cin >> t;
  	if (t == "ABC")
    {
      cout << "ARC";
    }
  	else
      cout << "ABC";
	
	
// Type Your Body of Code Here
return 0;
}


Measured memory_bytes: 3652
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <queue>
#include <numeric>
#include <string>
#include <string.h>
#include <map>
#include <set>
#include <functional>
#include <complex>
#include <stack>
#include <tuple>
#include <array>
#include <ctype.h> // isdigit
#include <cassert>
using namespace std;

#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define ALL(u) begin(u),end(u)
#define PB push_back
#define LE(n,m) ((n) < (m) + EPS * (abs(n) + abs(m)))
#define GE(n,m) ((n) + EPS * (abs(n) + abs(m)) > (m))
#define LT(n,m) ((n) + EPS * (abs(n) + abs(m)) < (m))
#define GT(n,m) ((n) > (m) + EPS * (abs(n) + abs(m)))
#define EQ(n,m) (abs((n)-(m)) < EPS * (abs(n) + abs(m)))

typedef long long int ll;
const int INF = (1<<30) - 1;
const double EPS = 1e-9;
const int MOD = 1000000007;

//g++ -std=c++0x -msse4.2 -O3
//#include <bits/stdc++.h>
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.precision(16);
    cout.setf(ios::fixed);
    
    int N; cin >> N;
    vector<int> ds(N);
    for(auto &d: ds)
        cin >> d;
    
    vector<double> centers;
    centers.push_back(ds[0]);
    
    for(int i=1; i<N; i++){
        double c = ds[i];
        for(int j=0; j<i; j++)
            c = max(c, centers[j] + sqrt((ds[j]+ds[i])*(ds[j]+ds[i]) - (ds[j]-ds[i])*(ds[j]-ds[i])));
        centers.push_back(c);
    }
    double ans = 0;
    for(int i=0; i<N; i++)
        ans = max(ans, centers[i]+ds[i]);
    
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3276
#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>;
//#########################################
const int INF = 1e18;
vector<int> ki[220000];
signed main(){
    int n,m;cin >> n >> m;
    rep(i,m){
        int a,b;cin >> a >> b;
        a--;b--;
        ki[a].push_back(b);
        ki[b].push_back(a);
    }
    vector<int> dist(n,INF);
    vector<int> vis(n);
    dist[0] = 0;
    queue<int> q;
    q.push(0);
    while(q.size()){
        auto now = q.front(); q.pop();
        for(auto next:ki[now]){
            if(vis[next])continue;
            vis[next] = 1;
            dist[next] = dist[now] + 1;
            q.push(next);
        }
    }
    if(dist[n-1] <= 2)cout << "POSSIBLE" << endl;
    else cout << "IMPOSSIBLE" << endl;
    return 0;
}

Measured memory_bytes: 20124
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod=1e9+7;
ll qpow(ll x,ll n) 
{
    ll res = 1;
    x%=mod;
    while (n) 
	{
        if(n&1) res = res*x%mod;
        x = x*x %mod;
        n >>=1;
    }
    return res;
}
ll C(ll n,ll m) 
{
    if(n < m) return 0;
    ll res = 1;
    for(int i=1; i<=m; i++) 
	{
        ll a = (n+i-m)%mod;
        ll b = i%mod;
        res = res*(a*qpow(b,mod-2)%mod)%mod;
    }
    return res;
}
ll Lucas(ll n,ll m) 
{
    return C(n%mod, m%mod) * Lucas(n/mod,m/mod)%mod;
}
int main()
{
	ll n,a,b;
	cin>>n>>a>>b;
    ll ans=qpow(2,n)-1;
    ans=ans-C(n,a)-C(n,b);
	while(ans<0)ans=ans+mod;
	cout<<ans%mod<<endl;
}

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

int main ()
{
  int n;
   cin>>n;
   int a[n];
   unordered_map<int,int> m;
   for(int i=0;i<n;i++)
   {
       m[cin>>a[i],a[i]]++;
   }
   int ans=0;
   sort(a,a+n);
   if(m[1]>0)
   {
       if(m[1]==1)
       cout<<1<<endl;
       else
        cout<<0<<endl;
   }
   else
    {
        for(int i=0;i<n;i++)
       {
            int f=0;
            if(m[a[i]]>1)
            {
                f=1;
                continue;
            }
            else
            {
                for(int k=2;k<=sqrt(a[i]);k++)
                {
                    if(a[i]%k==0)
                    {
                        if((m[a[i]/k])||m[k])
                        {
                            f=1;
                            break;
                        }
                    }
                }
            }
            if(!f)
                ans++;
       }
       cout<<ans<<endl;
   }
}


Measured memory_bytes: 32372
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Globalization;
using System.Linq;
using System.Text;

class Program
{


    static void Main(string[] args)
	{
        string s = Console.ReadLine();

        // 最終文字取得

        char c = s[s.Length - 1];

        if (c == 's')
        {
            Console.WriteLine(s + "es");
        }
        else
        {
            Console.WriteLine(s + "s");
        }


    }
}


Measured memory_bytes: 17340
import Foundation

let N = Int(readLine()!)!
var AC = 0
var WA = 0
var TLE = 0
var RE = 0

for i in 1...N {
    let judge = readLine()!
    
    if judge == "AC" {
        AC += 1
    }else if judge == "WA" {
        WA += 1
    }else if judge == "TLE" {
        TLE += 1
    }else if judge == "RE" {
        RE += 1
    }
    
}

print("AC" + " x " + String(AC))
print("WA" + " x " + String(WA))
print("TLE" + " x " + String(TLE))
print("RE" + " x " + String(RE))

Measured memory_bytes: 13268
#include <iostream>
#include <cmath>
#include <algorithm>
#include <bitset>
#include <iomanip>
#include <cstdio>
#include <new>
#include <vector>
#include <cstdlib>
#include <string>
#include <set>
#include <tuple>
#include<map>

using namespace std;
int main() {
	string s;

	cin >> s;

	if (s.at(0) == '9' || s.at(1) == '9') {
		cout << "Yes" << endl;
	}
	else cout << "No" << endl;
}

Measured memory_bytes: 3580
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string S,T;
  int min=1000;
  int answer=0;
  cin >> S >> T;
  for(long unsigned int i=0; i<S.size()-T.size()+1; i++){
    for(long unsigned int j=0; j<T.size(); j++){
      if(!(T.at(j)==S.at(i+j))){
        answer++;
      }
    }
    if(answer<min){
      min=answer;
    }
    answer=0;
  }
  cout << min <<endl;
}

Measured memory_bytes: 3600
x, y = map(int, input().split())
kame = (y - 2 * x) // 2
turu = x - kame
if kame < 0 or turu < 0:
    print("No")
else:
    if turu * 2 + kame * 4 == y:
        print("Yes")
    else:
        print("No")


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

using namespace std;

int main(void) {
  int N; cin >> N;
  vector<int> A;

  for (int i = 0; i < N; i++) {
    int a; cin >> a;
    A.push_back(a);
  }
  
  sort(A.begin(), A.end());

  for (int i = 1; i < N; i++) {
    if (A[i-1] == A[i]) {
      cout << "NO" << endl;
      return 0;
    }
  }
  cout << "YES" << endl;
  return 0;
}

Measured memory_bytes: 1400
N, M = map(int, input().split())
s = [list(map(int, input().split())) for i in range(M)]
p = list(map(int, input().split()))
total = 0
flag = 1
for i in range(2 ** N):
  now = format(i, "0{}b".format(N))
  for k in range(M):
    tmp = 0
    for l in range(s[k][0]):
      if now[s[k][l+1]-1] == '1':
        tmp += 1
    if tmp % 2 == p[k]:
      continue
    else:
      flag = 0
      break
  if flag == 1:
    total += 1
  flag = 1
print(total)


Measured memory_bytes: 3188
#include <bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(); cout.tie();
    int n, k = 0;
    cin >> n;
    for (int i = 1; i <= n; i++)
        if (i % 2)
            k++;
    double ans = (double)k / n;
    cout << fixed << setprecision(10) << ans << endl;

    return 0;
}


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


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

    vector<int> cost(N + 1);
    cost[1] = 0;
    cost[2] = abs(h[2] - h[1]);

    for (int i = 3; i <= N; i++) {
        cost[i] = min(cost[i - 2] + abs(h[i] - h[i -2]), cost[i - 1] + abs(h[i] - h[i - 1]));
    }

    cout << cost[N] << endl;
}

Measured memory_bytes: 4052
a,b,c = map(int,input().split())
x = 0
for i in range(c):
    if (int(i) + 2) % 2 == 0:
        if (a + 1) % 2 == 0:
            a = a - 1
            x = int(a / 2)
            b = b + x
            a = a - x
        else:
            x = int(a / 2)
            b = b + x
            a = a - x
    else:
        if (b + 1) % 2 == 0:
            b = b - 1
            x = int(b / 2)
            a = a + x
            b = b - x
        else:
            x = int(b / 2)
            a = a + x
            b = b - x
print(a,b)

Measured memory_bytes: 9188
#include <iostream>
#include <algorithm>
#include <cmath>
#include <map>
#include <string>
#include <vector>
#include <atcoder/all>

using namespace std;
using ll = long long;
using P = pair<int, int>;

template <class T1, class T2>
ostream& operator<<(ostream& os, const pair<T1, T2>& v) {
    os << "(" << v.first << ", " << v.second << ")";
    return os;
}

template <class T>
ostream& operator<<(ostream& os, const vector<T>& v) {
    os << "{";
    for (int i = 0; i < v.size(); i++) {
        if (i) os << ", ";
        os << v[i];
    }
    os << "}";
    return os;
}

int main()
{
    int n, q;
    cin >> n >> q;

    atcoder::dsu d(n);

    for (int i = 0; i < q; i++) {
        int t, u, v;
        cin >> t >> u >> v;
        if (t == 0) {
            d.merge(u, v);
        } else {
            cout << d.same(u, v) << endl;
        }
    }

    return 0;
}

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

bool check(string s, int n){
    int i = 0;
    int j = n-1;
    while (i < j){
        if (s[i] != s[j]){
            return 0;
        }
        i++;
        j--;
    }
    return 1;
}

int main(){
    string s;
    cin>>s;
    int n = (int) s.length();
    int a = (n - 1)/2;
    int b = (n + 3)/2;
    string s1 = "";
    string s2 = "";
    for (int i = 0; i<a; i++){
        s1+=s[i];
    }
    for (int i = b-1; i<n; i++){
        s2+=s[i];
    }
    if (check(s, n) && check(s1, a) && check(s2, n-b+1)){
        cout<<"Yes";
    }
    else{
        cout<<"No";
    }
    return 0;
}


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

using namespace std;

int main(int argc, const char * argv[]) {
    int H = 0, W = 0;
    cin >> H >> W;
    int h = 0, w = 0;
    cin >> h >> w;
    
    int rh = H - h;
    int rw = W - w;
    
    cout << (rh * rw) << endl;
    
    return 0;
}


Measured memory_bytes: 256
n = gets.to_i
as = gets.split.map(&:to_i)
q = gets.to_i
bcs = []
q.times do
  bcs << gets.split.map(&:to_i)
end

s = as.sum
h = {}
as.each do |a|
  h[a] ||= 0
  h[a] += 1
end

bcs.each do |bc|
  b, c = bc
  d = h[b] || 0
  s = s - b*d + c*d
  h[b] = 0
  h[c] ||= 0
  h[c] += d
  puts s
end

Measured memory_bytes: 33000
#include<cstdio>
#include<iostream>
#include<string>
#include<cstring>
#include<sstream>

using namespace std;
typedef long long ll;
typedef long double ld;
int n;
ll k;
string num;

void et(){
	int res1=0;
	ld res2=0.0,res3;
	int bit=0;
	int pp=1;
	bool f=false;
	ld k2=1;
	for(int i=0;i<8;i++){
		if(num[i]>='0' && num[i]<='9')bit=num[i]-'0';
		if(num[i]>='a' && num[i]<='f')bit=num[i]-'a'+10;
		for(int j=0;j<4;j++){
			if(i==0 && j==0){
				if((bit >> (3-j)) & 1)pp=-1;
				else pp=1;
			}else{
				if((bit >> (3-j)) & 1){
					if(i<=5 || (i==6 && j==0)){
						res1+=k*pp;
					}
					else{
						res2+=k2;
					}
				}
			}
			if(k>0)k/=2;
			if(i>=6)k2/=2;
		}
	}
	if(res1==0 && pp==-1)cout << "-";
	cout << res1 << ".";
	if(res2==0.0)cout << "0";
	else{
		bool f=false;
		while(1){
			res2*=10;
			int res22=(int)res2/1;
			if(res2==0.0)break;
			if(res22!=0)f=true;
			cout << res22;
			res2=(ld)res2-res22;
		}
	}
	cout << endl;
}

int main(void){
	cin >> n;
	for(int i=0;i<n;i++){
		cin >> num;
		k=1;
		for(int j=0;j<24;j++)k*=2;
		et();
	}
	return 0;
}

Measured memory_bytes: 1204
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
    int n, c=0, b=0;
    cin >> n;
    vector <int> a(n);
    for(int i=0; i<n; i++)
        cin >> a[i];
    sort(a.begin(),a.end(),greater<int>());
    for(int i=0; i<n; i++)
    {
        if(i%2==0)
            c+=a[i];
        else
            b+=a[i];
    }
    cout << c-b << '\n';
}

Measured memory_bytes: 256