akhauriyash/Code-Regression huggingface dataset:
program tax
  implicit none
  integer(8) :: a, b
  integer(8) :: x, i
  read(*,*) a, b

  x = 10 * b
  if (x*0.08 >= a+1) then
     write(*,*) -1
     stop
  end if
  
  do i = x, x + 9
     if (i*0.08 >= a) then
        write(*,*) i
        stop
     end if
  end do
  write(*,*) -1
  stop
end program tax


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

int main(){
  int ans, m, X;
  cin >> X;
  
  for(int i=0; i<5000; i++){
    for(int j=2; j<sqrt(X); j++){
      if(X%j == 0)
        m++;
    }
    if(m == 0){
      cout << X << endl;
      break;
    }
    m=0;
    X++;
  }
}

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

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

int main() {
  ll a,b,c,d;
  cin >> a >> b >> c >> d;
  ll k = max(a*d, a*c);
  ll m = max(k, b*c);
  ll n = max(m, b*d);
  cout << n << endl;
  return 0;

}

Measured memory_bytes: 3580
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TupleSections #-}
{-# LANGUAGE RankNTypes #-}
import qualified Data.ByteString.Lazy.Char8 as B
import Data.Maybe
-- import Data.List
-- import qualified Data.Vector.Unboxed as VU
-- import qualified Data.Vector.Unboxed.Mutable as VUM
-- import Control.Monad
-- import Control.Monad.ST
-- import Debug.Trace
-- trace _ = id

solve :: Int -> Int -> Int -> Int
solve n h w = (n-h+1)*(n-w+1)

readBInt :: B.ByteString -> Int
readBInt = fst . fromJust . B.readInt

tmain :: B.ByteString -> Int
tmain cont =
  let remLines0 = map B.words (B.lines cont)
      [bs_n]:remLines1 = remLines0
      n = readBInt bs_n
      [bs_h]:remLines2 = remLines1
      h = readBInt bs_h
      [bs_w]:remLines3 = remLines2
      w = readBInt bs_w
  in solve n h w

outAnswer :: Int -> IO ()
outAnswer = putStrLn . show

main :: IO ()
main = outAnswer . tmain =<< B.getContents

inp1 = "3\n2\n3\n"
inp2 = "100\n1\n1\n"
inp3 = "5\n4\n2\n"
tv1 = tmain $ B.pack inp1
tv2 = tmain $ B.pack inp2
tv3 = tmain $ B.pack inp3
test1 = tv1 == 2
test2 = tv2 == 10000
test3 = tv3 == 8
alltest = test1 && test2 && test3


Measured memory_bytes: 380
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n; cin >>n;
  vector<long long>a(n),b(n),c(n,0),d(n,0);
  for(int i=0;i<n;i++)cin>>a[i];
  for(int i=0;i<n;i++)cin>>b[i];
  for(int i=0;i<n;i++){
    if(a[i]-b[i]<0)c[i]=a[i]-b[i];
    else if(a[i]-b[i]>0)d[i]=a[i]-b[i];
  }
  sort(c.begin(),c.end());
  sort(d.rbegin(),d.rend());
  long long count=0;
  long long sum=0;
  for(int i=0;i<n;i++){
    if(c[i]==0)break;
    sum+=c[i];
    count++;
  }
  for(int i=0;i<n;i++){
    if(d[i]==0||sum>=0)break;
    sum+=d[i];
    count++;
    if(sum>=0)break;
  }
  if(sum<0){
    cout<<-1<<endl;
  }else{
    cout<<count<<endl;
  }
  return 0;
}
                               

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

double func(int x1, int y1, int x2, int y2){
    int res = pow(x1 - x2, 2) + pow(y1 - y2, 2);
    return sqrt(res);
}

int main(){
    int n;
    cin >> n;
    vector<int> x(n);
    vector<int> y(n);
    vector<int> town(n);
    double sum;
    int z = 1;
    for(int i = 1; i <= n; i++){
        z *= i;
    }//n!を求めておく

    for(int i = 0; i < n; i++){
        cin >> x.at(i) >> y.at(i);
    }

    
    for(int i = 0; i < n; i++){
        town.at(i) = i;
    }
    double tmp;
    do{
        tmp = 0;
        for(int i = 0; i < n - 1; i++){
            tmp += func(x.at(town.at(i)), y.at(town.at(i)), x.at(town.at(i + 1)), y.at(town.at(i + 1)));
            //cout << tmp << endl;
            }
        sum += tmp;
    }while(next_permutation(town.begin(), town.end()));

    sum /= (double)z;
    //cout << sum << setprecision(10) << endl;
    printf("%.10f", sum);
}


Measured memory_bytes: 3672
from collections import defaultdict
import sys
input = sys.stdin.readline

N = int(input())
A = list(map(int, input().split()))
Q = int(input())
BC = [tuple(map(int, input().split())) for _ in range(Q)]
dic = defaultdict(int)
for a in A:
    dic[a] += 1
tot = 0
for k,v in dic.items():
    tot += k*v
ans = []
for b,c in BC:
    tmp = dic[b]
    tot -= b*tmp
    tot += c*tmp
    dic[c] += tmp
    dic[b] = 0
    ans.append(tot)
print(*ans, sep="\n")


Measured memory_bytes: 39224
#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; }

int main() {
  int W, H, N;
  cin >> W >> H >> N;
  int xl = 0;
  int xr = W;
  int yd = 0;
  int yu = H;
  for (int i = 0; i < N; ++i) {
    int x, y, a;
    cin >> x >> y >> a;
    if (a == 1) chmax(xl, x);
    if (a == 2) chmin(xr, x);
    if (a == 3) chmax(yd, y);
    if (a == 4) chmin(yu, y);
  }
  int res = max(xr - xl, 0) * max(yu - yd, 0);
  cout << res << endl;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
    int N;
    cin >> N;
    int x[N],max,min=0;
    cin >> x[0];
    max=x[0];
    min=x[0];
    for(int i=1;i<N;i++){
        cin >> x[i];
        if(min>x[i]){
            min=x[i];
        }
        if(max<x[i]){
            max=x[i];
        }
    }
    if((max-min)%2==0){
        cout << (max-min)/2 << endl;
    }else{
        cout << (max-min)/2+1 << endl;
    }
}


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

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

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcountll

#define INF 1e16
#define mod 1000000007

ll N;
ll S[200010];

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

  cin>>N;
  rep(i,N)cin>>S[i];

  ll res=0;
  repl(d,1,N-1){
    map<ll,bool> used;
    ll sum=0;
    for(ll l=0,r=N-1;l<N&&r>d;l+=d,r-=d){
      if(used[l]||used[r]||l==r)break;
      used[l]=used[r]=true;
      sum+=S[l]+S[r];
      maxch(res,sum);
    }
  }
  cout<<res<<endl;

  return 0;
}


Measured memory_bytes: 8960
#include<bits/stdc++.h>
using namespace std;
int main(){
    int a,b,x,y,z;
    cin>>a>>b;
    x = b-a;
    y = 0;
    for(int i=0;i<x;i++){
        y += i;
    }
    z = y-a;
    cout<<z<<endl;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#pragma comment(linker, "/stack:512000000")
#include<utility>
#include<iostream>
#include<fstream>
#include<vector>
#include<array>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<ctime>
#include<functional>
#include<random>
#include<climits>
#include<queue>
#include<stack>
#include<deque>
#include<bitset>
#include<map>
#include<set>
#include<unordered_map>
#include<unordered_set>
#include<cassert>
#include<ccomplex>

#ifdef ONLINE_JUDGE
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,tune=native")
#pragma GCC optimize("unroll-loops")
#endif

//4Head

#define all(x) x.begin(), x.end()
#define mp make_pair
#define X first
#define Y second

using namespace std;

using ll = long long;
using ull = unsigned long long;
using ld = long double;
mt19937_64 gen(time(nullptr));

ll const mod = 1e9 + 7;

namespace {
	ll mul(ll a, ll b) {
		ll val = a * b - (ll)((ld)a * b / mod) * mod;
		if (val < 0) val += mod;
		if (val >= mod) val -= mod;
		return val;
	}

	ll poww(ll a, ll b) {
		ll val = 1;
		a %= mod;
		while (b > 0) {
			if (b % 2) val = mul(a, val);
			a = mul(a, a);
			b >>= 1;
		}
		return val % mod;
	}

	ll inv(ll a) {
		return poww(a, mod - 2);
	}
}

int const maxn = 3e5 + 5;

signed main() {
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	ll n, m; cin >> n >> m;
	cout << n * (n - 1) / 2 + m * (m - 1) / 2 << endl;


	return 0;
}

/*
5
2 6 15 5 10

4
2 6 15 5

*/

Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
ans = 0
for i in range(n):
    ans += b[a[i] - 1]
    if i > 0 and a[i] == a[i - 1] + 1:
        ans += c[a[i - 1] - 1]
print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define LL long long
#define sigma_size 30
#define max_size (int)(2e5+10)
#define MAX (int)(1e5+7)
int qread()
{
	char c; int s=0,t=1; while ((c=getchar())<'0' || c>'9') (c=='-' && (t=-1));
	do s=s*10+c-'0'; while ((c=getchar())>='0' && c<='9'); return s*t;
}

int n , m , l;
LL dp[305][305] , cnt[305][305];
const LL inf = 1ll << 60;
int ans[max_size] , tot = 0;
int main ()
{
	cin >> n >> m >> l;
	for ( int i = 1 ; i <= n ; i++ )
		for ( int j = 1 ; j <= n ; j++ )
			if ( i == j ) dp[i][j] = 0;
			else dp[i][j] = inf;
	for ( int i = 1 ; i <= m ; i++ ){
		LL a , b , c;
		cin >> a >> b >> c;
		if ( c <= l && c < dp[a][b] )
			dp[a][b] = dp[b][a] = c;
	}
	for ( int k = 1 ; k <= n ; k++ )
		for ( int i = 1 ; i <= n ; i++ )
			for ( int j = 1 ; j <= n ; j++ )
				dp[i][j] = min ( dp[i][j] , dp[i][k] + dp[k][j] );
	for ( int i = 1 ; i <= n ; i++ )
		for ( int j = 1 ; j <= n ; j++ )
			if ( i == j ) continue;
			else
			{
				if ( dp[i][j] <= l ) cnt[i][j] = 1;
				else cnt[i][j] = inf;
			}
	for ( int k = 1 ; k <= n ; k++ )
		for ( int i = 1 ; i <= n ; i++ )
			for ( int j = 1 ; j <= n ; j++ )
				cnt[i][j] = min ( cnt[i][j] , cnt[i][k]+cnt[k][j] );
	int q;
	cin >> q;
	while (q--)
	{
		int s , t;
		cin >> s >> t;
		if ( cnt[s][t] == inf ) ans[tot++] = -1;
		else ans[tot++] = cnt[s][t]-1;
	}
	for ( int i = 0 ; i < tot ; i++ )
		cout << ans[i] << endl;
}

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

int main() {
	int N, ans = 0;
	static int A[200000];
	map<int, int, greater<int> > mp;
	cin >> N;
	for (int i = 0; i < N; i++) cin >> A[i], mp[A[i]]++;
	sort(A, A + N, greater<int>());
	for (int i = 0; i < N; i++) {
		if (mp[A[i]] <= 0) continue;
		int B = pow(2, (int)log2(A[i]) + 1) - A[i];
		if (mp[B] <= 0) continue;
		if (B == A[i] && mp[A[i]] <= 1) continue;
		ans++;
		mp[A[i]]--;
		mp[B]--;
	}
	cout << ans;
}

Measured memory_bytes: 19712
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define dup(x,y) (((x)+(y)-1)/(y))
#define ALL(x) (x).begin(), (x).end()
typedef long long ll;
typedef pair<int, int> pii;
const double EPS = 1e-10;
const int INF = 1e9;
const ll LINF = 1e15;
const int MOD = 1000000007;
const double PI = acos(-1);
int dx[4] = {0,1,0,-1};
int dy[4] = {1,0,-1,0};

typedef pair<ll, ll> pll;

int main() {
    string s, t;
    cin >> s >> t;
    if(s.size() == t.size()){
        int m = 0;
        for (int i=0; i<s.size(); i++){
            if(s[i] != t[i])m++;
        }
        cout << m << endl;
        return 0;
    }
    
    int ans = INF;
    for (int i=0; i<s.size()-t.size(); i++){
        int tmp = 0;
        for (int j=0; j<t.size(); j++){
            if(s[i+j] != t[j]) tmp++;
        }
        ans = min(ans, tmp);
    }
    cout << ans << endl;
}


Measured memory_bytes: 3624
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.NoSuchElementException;

public class Main {

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

	private void solve() throws IOException {
		try {
			solveA();
			//			 solveB();
			//			 solveC();
			//			 solveD();
			//			 solveE();
			//			 solveF();
		} finally {
			if (in != null) {
				in.close();
			}
			if (out != null) {
				out.flush();
				out.close();
			}
		}

	}

	private void solveA() {
		int numA = nextInt();
		int numB = nextInt();

		if (numA % 3 == 0 || numB % 3 == 0 || (numA + numB) % 3 == 0) {
			out.println("Possible");
		} else {
			out.println("Impossible");
		}

	}

	private void solveB() {
		int numN = nextInt();

		out.println("");
	}

	private void solveC() {
		int numN = nextInt();

		out.println("");
	}

	private void solveD() {
		int numN = nextInt();

		out.println("");
	}

	private void solveE() {
		int numN = nextInt();

		out.println("");
	}

	private void solveF() {
		int numN = nextInt();

		out.println("");
	}

	private final PrintWriter out = new PrintWriter(System.out);
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;

	private boolean hasNextByte() {
		if (ptr < buflen) {
			return true;
		} else {
			ptr = 0;
			try {
				buflen = in.read(buffer);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (buflen <= 0) {
				return false;
			}
		}
		return true;
	}

	private int readByte() {
		if (hasNextByte())
			return buffer[ptr++];
		else
			return -1;
	}

	private static boolean isPrintableChar(int c) {
		return 33 <= c && c <= 126;
	}

	private void skipUnprintable() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr]))
			ptr++;
	}

	public boolean hasNext() {
		skipUnprintable();
		return hasNextByte();
	}

	public int nextInt() {
		return Integer.parseInt(next());
	}

	public String next() {
		if (!hasNext())
			throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = readByte();
		while (isPrintableChar(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	public long nextLong() {
		if (!hasNext())
			throw new NoSuchElementException();
		long n = 0;
		boolean minus = false;
		int b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) {
			throw new NumberFormatException();
		}
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}
}

Measured memory_bytes: 21204
using System;
using System.IO;
using System.Linq;
using System.Collections.Generic;
using System.Text;

public class Program
{

    public void Proc()
    {

        int inputCount = int.Parse(Reader.ReadLine());

        List<int> points = Reader.ReadLine().Split(' ').Select(a => int.Parse(a)).ToList();
        points.Add(0);
        points.Insert(0, 0);

        long total = 0;
        for (int i = 1; i < points.Count; i++) {
            total += Math.Abs(points[i - 1] - points[i]);
        }
        int prev = 0;

        StringBuilder ans = new StringBuilder();
        for (int i = 2; i < points.Count; i++) {
            int temp1 = Math.Abs(prev - points[i - 1]) + Math.Abs(points[i-1] - points[i]);
            int temp2 = Math.Abs(prev - points[i]);
            ans.AppendLine((total - (temp1 - temp2)).ToString());
            prev = points[i - 1];
        }
        Console.WriteLine(ans.ToString());

    
    }







    public class Reader
    {
        static StringReader sr;
        public static bool IsDebug = false;
        public static string ReadLine()
        {
            if (IsDebug)
            {
                if (sr == null)
                {
                    sr = new StringReader(InputText.Trim());
                }
                return sr.ReadLine();
            }
            else
            {
                return Console.ReadLine();
            }
        }
        private static string InputText = @"


6
-679 -2409 -3258 3095 -3291 -4462

";
    }

    public static void Main(string[] args)
    {
#if DEBUG
        Reader.IsDebug = true;
#endif
        Program prg = new Program();
        prg.Proc();
    }
}


Measured memory_bytes: 31580
#include <bits/stdc++.h>
#include <string>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define inf 1001001001
typedef pair<int,int> P;
#define mod 1000000007

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

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
int main()
{
	int z=0,flag=0;
	char a[100],b[100];
	scanf("%s",a);
	for(int i=0;i<strlen(a);i++)
	{
		if(a[i]=='C'||a[i]=='F')
		{
			b[z]=a[i];
			z++;
		}
	}
	for(int i=0;i<z;i++)
		{
			for(int j=i+1;j<=z-1;j++)
			{
				if(b[i]=='C'&&b[j]=='F')
					flag=1;
			}
		}
		if(flag==1)
			printf("Yes");
		else
			printf("No");
	
	
	return 0;
}

Measured memory_bytes: 128
k, s = map(int, input().split())

if 3*k == s:
    print(1)
    exit()

count = 0
for i in range(k+1):
    for j in range(k+1):
        if 0 <= s - i - j <= k:
            count += 1
        if i + j > s:
            break

print(count)

Measured memory_bytes: 2940
def is_even(n):
    if n % 2 == 0:
        return True
    else:
        return False

def mainas_number():
    N = int(input())

    k =[]
    if N == 0:
        print(0)
        exit()

    if is_even(N):
        k.append(0)
    else:
        N -= 1
        k.append(1)

    for i in range(1,100):
        if (N // (-2)**i) % 2 == 1:
            N -= (-2)**i
            k.append(1)

        else:
            k.append(0)

        if N == 0:
            break

    ans = ""
    for c in k[::-1]:
        ans += str(c)
    print(ans)
    
if __name__ == "__main__":
    mainas_number()

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

#define endl '\n'
#define ll long long
#define ii pair<int,int>
#define vi vector<int>
#define vii vector<ii>
#define vvi vector<vi>
#define add push_back
#define MAXN 200005

int main(){ios_base::sync_with_stdio(false);

    int n, x;
    cin >> n;
    vi a(n+1);
    
    for(int i=2; i<=n; ++i){
        cin >> x;
        ++a[x];
    }
    
    for(int i=1; i<=n; ++i) cout << a[i] << endl;

    return 0;
}



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

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

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#pragma GCC optimize("Ofast")

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

	long int n, max = 2000000000;
	std::cin >> n;
	for(int i = 0; i < n; i++){
		long int a, b;
		std::cin >> a >> b;
		if(a+b < max) {
			max = a+b;
		}
	}
	std::cout << max  << "\n";
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <cmath>

using namespace std;

int main() {
	int n;
	while (cin >> n) {
		if (n == 0) {
			break;
		}
		map<string, long long int> mp;
		string a;
		long long int b;
		for (int i = 0; i < n; i++) {
			cin >> a >> b;
			mp[a] = b;
		}
		int m;
		cin >> m;
		vector<string> data[105];
		string g;
		for (int i = 0; i < m; i++) {
			cin >> g;
			data[i].push_back(g);
			int w;
			cin >> w;
			for (int j = 0; j < w; j++) {
				cin >> g;
				data[i].push_back(g);
			}
		}
		bool hantei = true;
		while (hantei) {
			hantei = false;
			for (int i = 0; i < m; i++) {
				long long int p = 0;
				for (int j = 1; j < data[i].size(); j++) {
					p += mp[data[i][j]];
				}
				if (mp[data[i][0]] > p) {
					mp[data[i][0]] = p;
					hantei = true;
				}
			}
		}
		string h;
		cin >> h;
		cout << mp[h] << endl;
	}
	return 0;
}

Measured memory_bytes: 1232
#include <iostream>

using namespace std;

main(){
  int N,a,b,r;
  r = 0;
  cin >> N>> a>> b;
  for(int i =0; i<=N;i++){
    int f1 = 0;
    string f2 = to_string(i);
    for(int j = 0; j < f2.size();j++){
      f1 += f2[j] -'0';
    }
    if((a <= f1) && (f1<= b)){
      r += i;
    }
  }
  cout << r<<endl;
  return 0;
}

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

using namespace std;

typedef long long ll;
#define fi first
#define se second
#define pb push_back

pair <int, string> res[4];

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int n;
    cin >> n;
    map <string, int> mp;
    mp["AC"] = 0;
    mp["WA"] = 0;
    mp["TLE"] = 0;
    mp["RE"] = 0;
    
    while (n--) {
        string s;
        cin >> s;
        mp[s]++;
    }
    map <string, int> mp1;
    mp1["AC"] = 0;
    mp1["WA"] = 1;
    mp1["TLE"] = 2;
    mp1["RE"] = 3;
    for (auto x : mp) {
        res[mp1[x.fi]] = {x.se, x.fi};
    }
    for (int i = 0; i < 4; i++) {
        cout << res[i].se << " x " << res[i].fi << '\n';
    }
    return 0;
}


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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define all(obj) (obj).begin(), (obj).end()
#define rall(obj) (obj).rbegin(), (obj).rend()
#define collect(arr, size) rep(i,size) cin >> arr[i];

struct UnionFind {
    vector<int> par;
    vector<int> treesize;
    
    UnionFind(int n){
        rep(i, n) par.push_back(i);
    }
    
    int root(int x){
        if(x == par.at(x)) return x;
        return par.at(x) = root(par.at(x)); //経路圧縮
    }
    
    void unite(int x, int y){
        int rx = root(x);
        int ry = root(y);
        if(rx == ry) return;
        par.at(rx) = ry;
    }
    
    
    bool same(int x, int y){
        return root(x) == root(y);
    }
    
    void update_size(){
        treesize = vector<int>(par.size(),0);
        for(int i=0; i<par.size(); i++){
            treesize[root(i)]++;
        }
    }
    
    int get_size(int x){
        return treesize[root(x)];
    }
};

vector<vector<int>> friend_graph;
vector<vector<int>> blocking_graph;

int main(){
    int n, m, k;
    cin >> n >> m >> k;
    friend_graph = vector<vector<int>>(n);
    blocking_graph = vector<vector<int>>(n);
    auto tree = UnionFind(n);
    rep(i,m){
        int a, b;
        cin >> a >> b;
        a--; b--;
        friend_graph[a].push_back(b);
        friend_graph[b].push_back(a);
        tree.unite(a,b);
    }
    rep(i,k){
        int a, b;
        cin >> a >> b;
        a--; b--;
        blocking_graph[a].push_back(b);
        blocking_graph[b].push_back(a);
    }
    
    tree.update_size();
    rep(i,n){
        int sug = tree.get_size(i)-1;
        for(int blocking : blocking_graph[i]){
            if(tree.same(i, blocking)) sug--;
        }
        sug -= friend_graph[i].size();
        cout << sug;
        if(i!=n-1) cout << " ";
    }
    cout << endl;
}

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

using namespace std;

#define sz(c) ((int)c.size())
#define	pb push_back

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

constexpr int MAX_N = 145'674;
constexpr int SIGMA = 30;
constexpr ll INF = 1'000'000'000LL;
constexpr ll P = 9'982'443'53;
constexpr double PI = 3.14159265359;
constexpr double TO_RAD = PI/180.;
constexpr long double EPS = 1e-6;

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

	int h1, m1, h2, m2, k;
	cin >> h1 >> m1 >> h2 >> m2 >> k;

	int min1 = h1*60 + m1;
	int min2 = h2*60 + m2;
	int total = 0;
	if(min1 < min2){
		total = min2-min1-k;		
	}
	else{
		total = 1439 - min1 + min2 - k;
	}
	cout << total << "\n";
	return 0;
}

Measured memory_bytes: 3648
use std::fmt::Debug;
use std::io::{self, Read};
use std::str;
use std::str::FromStr;

fn main() {
    let mut sc = StdinScanner::new();
    let (a, b) = (sc.next::<u32>(), sc.next::<u32>());
    if a + b >= 10 {
        println!("error");
    } else {
        println!("{}", a + b);
    }
}


struct StdinScanner {
    buf: Vec<u8>,
}

impl StdinScanner {
    fn new() -> Self {
        StdinScanner { buf: Vec::with_capacity(256) }
    }

    fn next<T: FromStr>(&mut self) -> T
        where <T as FromStr>::Err: Debug
    {
        self.buf.clear();
        let stdin = io::stdin();
        let mut stdin = stdin.lock().bytes();
        let mut c = stdin.next().unwrap().unwrap();
        while c == ' ' as u8 || c == '\n' as u8 {
            c = stdin.next().unwrap().unwrap();
        }
        while !(c == ' ' as u8 || c == '\n' as u8) {
            self.buf.push(c);
            c = stdin.next().unwrap().unwrap();
        }
        str::from_utf8(&self.buf).unwrap().parse().unwrap()
    }
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define pt(sth) cout << sth << "\n"
#define chmax(a, b) {if(a<b) a=b;}
#define chmin(a, b) {if(a>b) a=b;}
#define moC(a, s, b) (a)=((a)s(b)+MOD)%MOD
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
static const ll INF=1e18;
static const ll MAX=101010;
static const ll MOD=1e9+7;
static const ll LOGN=55;

ll moP(ll x, ll n) {
  ll res=1;
  while(n>0) {
    if(n&1) moC(res, *, x);
    moC(x, *, x);
    n>>=1;
  }
  return res;
}

ll fa[MAX], rf[MAX];

ll C(ll n, ll k) {
  if(n<k||n<0||k<0) return 0;
  if(k==0) return 1;
  if(n==k) return 1;
  return fa[n]*rf[k]%MOD*rf[n-k]%MOD;
}

int main(void) {
  ll N;
  cin >> N;
  ll a[MAX];
  ll cnt[MAX]={};
  
  ll i;
  
  
  for(i=0; i<=N; i++) {
    cin >> a[i];
    a[i]--;
    cnt[a[i]]++;
  }
  
  ll key=0;
  for(i=0; i<=N; i++) {
    if(cnt[i]==2) key=i;
  }
  
  
  ll l=0, r=0;
  for(i=0; i<=N; i++) {
    if(a[i]==key) break;
    l++;
  }
  
  for(i=N; i>=0; i--) {
    if(a[i]==key) break;
    r++;
  }
  
  
  fa[0]=rf[0]=1;
  for(ll i=1; i<MAX; i++) {
    fa[i]=fa[i-1]*i%MOD;
    rf[i]=moP(fa[i], MOD-2);
  }
  
  
  for(ll k=1; k<=N+1; k++) {
    pt((C(N+1, k)-C(l+r, k-1)+MOD)%MOD);
  }
  
  
}






Measured memory_bytes: 4352
n,ma,mb=map(int,input().split())
subs=[list(map(int,input().split())) for _ in range(n)]
infi=10**18
dp=[[[infi]*401 for _ in range(401)] for _ in range(n+1)]
dp[0][0][0]=0
for i in range(1,n+1):
    a,b,c=subs[i-1]
    for j in range(401):
        for k in range(401):
            if j+a<=400 and k+b<=400:
                dp[i][j+a][k+b]=min(dp[i][j+a][k+b],dp[i-1][j][k]+c)
            dp[i][j][k]=min(dp[i][j][k],dp[i-1][j][k])
ans=infi
for i in range(1,401):
    for j in range(1,401):
        if i%ma==0 and j%mb==0:
            if i//ma==j//mb:
                ans=min(ans,dp[n][i][j])
if ans==infi:
    ans=-1
print(ans)

Measured memory_bytes: 127824
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;
int n;
int num[11];
int Phi_f(int num) {
	int ans = num;
	for (int i = 2; i*i <= n; ++i) {
		if (num%i == 0) {
			ans -= ans / i;
			while (num%i == 0)num /= i;
		}
	}
	if (num > 1) ans -= ans / num;
	return ans;
}
int main() {
	cin >> n; cout << Phi_f(n) << endl;
	return 0;
}


Measured memory_bytes: 3088
from math import ceil
ans = """
a,b = (int(i) for i in input().split())
"""
for a in range(2,21):
    if a == 2:
        ans += "if a == " + str(a) + ":\n"
    else:
        ans += "elif a == " + str(a) + ":\n"
    for b in range(1,21):
        if b == 1:
            ans += "\tif b == " + str(b) + ":\n"
        else:
            ans += "\telif b == " + str(b) + ":\n"
        ans += "\t\tans = "+str(ceil(((b-1)/(a-1)))) + "\n"
ans += "print(ans)"
exec(ans)

Measured memory_bytes: 38512
import numpy as np

def check(mid):
  cnt=0
  if mid>=0:
    cnt+=len(zero)*N
  cnt+=np.searchsorted(A, mid//pos, side="right").sum()
  cnt+=(N-np.searchsorted(A, (-mid-1)//(-neg), side="right")).sum()
  cnt-=np.count_nonzero(A*A<=mid)
  return cnt//2

N,K=map(int,input().split())
A=np.array(sorted(map(int,input().split())))

pos=A[A>0]
zero=A[A==0]
neg=A[A<0]

high=10**18
low=-10**18
while low+1<high:
  mid=(high+low)//2
  if check(mid)>=K:
    high=mid
  else:
    low=mid
print(high)

Measured memory_bytes: 32292
def getint(): return int(input())
def getints(): return list(map(int, input().split()))

a,b,c,x,y=getints()

res = 10 ** 10
for c_count in range(0, max(x,y)*2 + 2, 2):
    x_need = max(0, x - c_count // 2)
    y_need = max(0, y - c_count // 2)
    tmp = x_need * a + y_need * b + c_count * c
    res = min(res, tmp)

print(res)

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

int h , w ;
char Map[110][110];
int move[4][2] = {-1,0,1,0,0,1,0,-1};


void dfs(int x ,int y ,char aim)
{
	Map[x][y] = '!';
	for (int i=0; i<4;i++)
	{
		int X = x + move[i][0];
		int Y = y+ move[i][1];
		if (X <0 || X >=h || Y<0|| Y>=w || Map[X][Y]!=aim) continue;
		dfs(X ,Y , aim);
	}
}

int main ()
{
	while (cin >> h >> w  && !(w==0 && h==0))
	{
		for (int i=0;i<h;i++)
		for (int j=0;j<w ;j++)
			cin >> Map[i][j];
	
		int Count= 0 ;
		for (int i=0;i<h;i++)
			for (int j=0;j<w ;j++)
				if (Map[i][j]!='!')
					{
						dfs(i,j ,Map[i][j]);
						Count ++;
					}
		cout <<Count <<endl;
	}
	
}


Measured memory_bytes: 3588
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <map>

using namespace std;

int main()
{
    int n;
    int b[100010];
    long long int ans = 0;

    cin >> n;

    int a[n] = {};

    for (int i = 0; i < n-1; i++) {
        cin >> b[i];
    }

    a[0] = b[0];

    for (int i = 1; i < n-1; i++) {
        a[i] = min(b[i-1], b[i]);
    }

    a[n-1] = b[n-2];

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

    cout << ans << endl;

}


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

#define rep(i,begin,end) for(int i=begin; i<end; i++)
#define lld long long int

int main(){
    int h, w;
    scanf("%d %d", &h, &w);
    char map[h+2][w+2];
    rep(i, 0, h+2){
        rep(j, 0, w+2){
            map[i][j] = '.';
        }
    }
    rep(i, 1, h+1){
        char s[w+1];
        scanf("%s", s);
        rep(j, 0, w){
            map[i][j+1] = s[j];
        }
    }
    rep(i, 1, h+1){
        rep(j, 1, w+1){
            if(map[i][j] == '#'){
                printf("#");
            }else{
                int x=0;
                rep(k, 0, 3){
                    rep(l, 0, 3){
                        if(map[i-1+k][j-1+l] == '#'){
                            x++;
                        }
                    }
                }
                printf("%d", x);
            }
        }
        printf("\n");
    }

    return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define ll long long int
#define inf 1000000000000
#define MOD 1000000007
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define for0(i, n) for (int i = 0; i < n; i++)
#define tc(t) int t; cin >> t; while (t--)
#define maxpq priority_queue<int>
#define minpq priority_queue<int, vector<int>, greater<int> >
#define vll vector<ll>
#define vi vector<int>
#define pb push_back
#define fi first
#define se second
#define pii pair<int,int>
#define pll pair<ll,ll>
#define mii map<int,int>
#define mll map<ll,ll>
#define S(x) (int)(x).size()
#define L(x) (int)(x).length()
#define ps(x,y)         fixed<<setprecision(y)<<x
using namespace std;
int dp[100001];
int frog_jump(int arr[], int i, int k, int n)
{
	if (i > n)
		return 0;
	if (i == n)
		return 0;
	if (dp[i] != -1)
		return dp[i];
	int res = INT_MAX;
	for (int j = i + 1; j <= k + i && j <= n; j++)
	{
		int curr = abs(arr[i] - arr[j]) + frog_jump(arr, j, k, n);
		res = min(res, curr );

	}
	return dp[i] = res;
}
int main()
{
	IOS
/*#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif*/
	int n, k;
	cin >> n >> k;
	int arr[n];
	for (int i = 0; i < 100001; i++)
		dp[i] = -1;
	for (int i = 0; i < n; i++)
	{
		cin >> arr[i];
	}
	ll res = frog_jump(arr, 0, k, n - 1);
	cout << res << endl;
}

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

typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
#define ALL(v) (v).begin(),(v).end()
#define CLR(t,v) memset(t,(v),sizeof(t))
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< ")";}
template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cout<<(*i)<<" ";cout<<endl;}
template<class T>void chmin(T&a,const T&b){if(a>b)a=b;}
template<class T>void chmax(T&a,const T&b){if(a<b)a=b;}

ll nextLong() { ll x; scanf("%lld", &x); return x;}

struct UnionFind {
  vector<int> data; // 根の場合は集合の大きさ*-1、子の場合は親の番号が入る
  UnionFind(int size) : data(size, -1) { }
  bool link(int x, int y) { //新たな併合を行うとtrue
    x = root(x); y = root(y);
    if (x != y) {
      if (data[y] < data[x]) swap(x, y);
      data[x] += data[y]; data[y] = x;
    }
    return x != y;
  }
  int root(int x) { // 代表元を返す
    return data[x] < 0 ? x : data[x] = root(data[x]);
  }
  int size(int x) { // 要素xが含まれる集合の大きさ
    return -data[root(x)];
  }
  bool same(int x, int y) { // 同じ集合ならtrue
    return root(x) == root(y);
  }
};


int main2() {
  int N = nextLong();
  int M = nextLong();
  UnionFind uf(N);
  REP(_, M) {
    int a = nextLong() - 1;
    int b = nextLong() - 1;
    uf.link(a, b);
  }

  int ans = 0;
  REP(i, N) {
    chmax(ans, uf.size(i));
  }

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

int main() {

#ifdef LOCAL
  for (;!cin.eof();cin>>ws)
#endif
    main2();
  return 0;
}

Measured memory_bytes: 4068
#pragma GCC optimize("O3")
//#pragma GCC optimize ("unroll-loops")
#pragma GCC target ("avx2")
#define io_init cin.tie(0);ios::sync_with_stdio(0);cout<<setprecision(10)
#include <bits/stdc++.h>
constexpr int INF = 2147483647;
constexpr long long int INF_LL = 9223372036854775807;
constexpr int MOD = 1000000007;
constexpr double PI = 3.14159265358979323846;
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;


int main() {
    io_init;
    ll N;
    cin >> N;
    if (N % 2 == 1) {
        cout << 0 << endl;
        return 0;
    }
    else {
        ll ans = 0;
        for (ull k = 5; k <= N; k *= 5) {
            ans += (N / k)/2;
        }
        cout << ans << endl;
    }
    
}


Measured memory_bytes: 3636
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class AtCoderA
{
    static void Main()
    {
        var sc = new Scanner();

        long n = sc.NextLong();
        long d = sc.NextLong();

        long answer = 0;

        for (long i = 0; i < n; i++)
        {
            long x = sc.NextLong();
            long y = sc.NextLong();
            if (x * x + y * y <= d * d)
            {
                answer++;
            }
        }

        Console.WriteLine(answer);
    }

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            while (_index >= _line.Length)
            {
                _line = Console.ReadLine().Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            _line = Console.ReadLine().Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}


Measured memory_bytes: 40600
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
int n;
bool isPrime(int x){
	if(x < 2) return false;
	else if(x == 2) return true;
	if(!(x % 2) ) return false;
	for(int i = 3; i * i <= x; i += 2){
		if(!(x % i)) return false;
	}
	return true;
}
int main(){
	int temp;
	while(~scanf("%d",&n)){
		int cnt = 0;
		while(n--){
			scanf("%d",&temp);
			if(isPrime(temp)) cnt++;
		}
		printf("%d\n", cnt);
	}
	return 0;
}


Measured memory_bytes: 3228
#include<bits/stdc++.h>
using namespace std;
char a[22][22];
int n,m;
struct pos
{
	int x;
	int y;
	int step;
};
pos make_pos(int a,int b,int c)
{
	pos ret;
	ret.x=a;
	ret.y=b;
	ret.step=c;
	return ret;
}
int bfs(int sx,int sy,int ex,int ey)
{
	bool vis[n+2][m+2];
	for(int i=0;i<=n+1;++i)
	for(int j=0;j<=m+1;++j)
	if(a[i][j]=='#')
	vis[i][j]=true;
	else
	vis[i][j]=false;
	queue<pos> q;
	q.push(make_pos(sx,sy,0));
	vis[sx][sy]=true;
	int move[2][4]={{0,0,-1,1},{-1,1,0,0}};
	while(!q.empty())
	{
		pos fr=q.front();
		q.pop();
		if(fr.x==ex&&fr.y==ey)
		return fr.step;
		pos newpo;
		for(int i=0;i<4;++i)
		{
			int nx=fr.x+move[0][i];
			int ny=fr.y+move[1][i];
			if(vis[nx][ny])
			continue;
			vis[nx][ny]=true;
			newpo=make_pos(nx,ny,fr.step+1);
			q.push(newpo);
		}
	}
	return 0;
}
int main()
{
	for(int i=0;i<22;++i)
	for(int j=0;j<22;++j)
	a[i][j]='#';
	cin>>n>>m;
	for(int i=1;i<=n;++i)
	for(int j=1;j<=m;++j)
	cin>>a[i][j];
	int maxv=0;
	for(int i1=1;i1<=n;++i1)
	for(int j1=1;j1<=m;++j1)
	{
		if(a[i1][j1]=='#')
		continue;
		for(int i2=1;i2<=n;++i2)
		for(int j2=1;j2<=m;++j2)
		{
			if(a[i2][j2]=='#')
			continue;
			if(i1==i2&&j1==j2)
			continue;
			maxv=max(maxv,bfs(i1,j1,i2,j2));
		}
	}
	cout<<maxv<<endl;
	return 0;
}

Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.util.InputMismatchException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * 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;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskC solver = new TaskC();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskC {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();

            if (n == 0) {
                out.println(0);
                return;
            }

            StringBuilder ans = new StringBuilder();
            boolean flg = n > 0;
            if (n < 0) n = -n;
            while (n > 0) {
                if (n % 2 == 1) {
                    n += flg ? -1 : 1;
                    ans.append("1");
                } else {
                    ans.append("0");
                }
                flg = !flg;
                n >>= 1;
            }

            out.println(ans.reverse().toString());
        }

    }

    static class InputReader {
        private BufferedReader br;
        private StringTokenizer st;

        public InputReader(InputStream inputStream) {
            br = new BufferedReader(new InputStreamReader(inputStream));
            st = new StringTokenizer("");
        }

        public String nextString() {
            while (!st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine(), " ");
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
            }
            return st.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(nextString());
        }

    }
}



Measured memory_bytes: 23380
#include <stdio.h>

int main(void)
{
    int i,N,color,max,min,sum;
    int gray,brown,green,lightblue,blue,yellow,orange,red,special;
    
    gray=brown=green=lightblue=blue=yellow=orange=red=special=0;

    scanf("%d",&N);
    for(i=0;i<N;i++){
        scanf("%d",&color);
        if(0<color&&color<=399)gray=1;
        else if(400<=color&&color<=799)brown=1;
        else if(800<=color&&color<=1199)green=1;
        else if(1200<=color&&color<=1599)lightblue=1;
        else if(1600<=color&&color<=1999)blue=1;
        else if(2000<=color&&color<=2399)yellow=1;
        else if(2400<=color&&color<=2799)orange=1;
        else if(2800<=color&&color<=3199)red=1;
        else if(3200<=color)special++;
    }
    sum=gray+brown+green+lightblue+blue+yellow+orange+red;
    max=sum+special;
    if(sum==0&&special>0)min=1;
    else min=sum;
    printf("%d %d\n",min, max);
    
    return 0;
}

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

#define debug(s) cout << s << endl
#define debug1(s, t) cout << s << " " << t << endl
#define debug2(s, t, u) cout << s << " " << t << " " << u << endl
#define printvec(v)       \
    for (auto &&i : v)    \
        cout << i << " "; \
    cout << endl
#define rep(n, i) for (int i = 0; i < n; i++)

using namespace std;
using i64 = long long;

int main()
{
    int MAX_ALPHABET = 11;
    vector<i64> basis(MAX_ALPHABET + 1);
    for (int i = 0; i < basis.size(); i++)
    {
        basis[i] = pow(26, i);
    }

    i64 n;
    cin >> n;

    // 26進表記
    vector<int> vec;
    for (int i = basis.size() - 1; i >= 0; i--)
    {
        vec.push_back(n / basis[i]);
        n %= basis[i];
    }

    // 0を含まないように変形
    for (int j = 0; j < vec.size(); j++)
    {
        bool inRealDigit = false;
        for (int i = 0; i < vec.size(); i++)
        {
            if (!inRealDigit)
            {
                inRealDigit = vec[i] != 0;
                continue;
            }

            if (vec[i] == 0)
            {
                vec[i - 1]--;
                vec[i] = 26;
            }
        }
    }

    // 文字列に変換
    string name;
    for (auto &&d : vec)
    {
        if (d != 0)
        {
            name.push_back('a' + d - 1);
        }
    }

    cout << name << endl;

    return 0;
}


Measured memory_bytes: 4044
import sys

# import re
import math
import collections
# import decimal
import bisect
import itertools
import fractions
# import functools
import copy
import heapq
import decimal
# import statistics
import queue
import numpy as np

sys.setrecursionlimit(10000001)
INF = 10 ** 16
MOD = 10 ** 9 + 7

ni = lambda: int(sys.stdin.readline())
ns = lambda: map(int, sys.stdin.readline().split())
na = lambda: list(map(int, sys.stdin.readline().split()))


# ===CODE===


def main():
    x = list(input())
    s_cnt = 0

    ans = len(x)
    for xi in x:
        if xi == "S":
            s_cnt += 1
        else:
            if s_cnt != 0:
                s_cnt -= 1
                ans -= 2

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 23348
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,i;
	cin>>n;
	long long a[n+1];
	long long ans=1;
	for(i=1;i<=n;i++){
		cin>>a[i];
		if(a[i]==0){
			cout<<0;
			return 0;
		}
	}
	for(i=1;i<=n;i++){
		if(a[i]<=1000000000000000000/ans){//防止数据超过长整型范围 
		ans*=a[i];
		}
		else{
			cout<<-1;
			return 0;
		}
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 4400
import java.util.Scanner;


public class Main{

	public static void main(String args[]){

		Scanner sc = new Scanner(System.in);

		int n=sc.nextInt();
		int k=sc.nextInt();
		double ans=0;

		int times=0;
		for(int i=n;i>0;--i){
			while(i*Math.pow(2, times)<k)++times;
			ans=ans+(1/(double)n)*Math.pow(0.5, times);

		}
		System.out.println(ans);
	}
}

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

int vals[10];

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n, aux;
  cin >> n;
  bool ans = true;
  for (int i = 0; i < n; i++) {
    cin >> aux;
    if (ans && aux % 2 == 0) ans = (aux % 3 == 0 || aux % 5 == 0);
  }
  cout << (ans? "APPROVED\n" : "DENIED\n");
  return 0;
} 

Measured memory_bytes: 256
#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 <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <numeric> // next_parmutation
#define ll long long


using namespace std;

int main() {
    string s,t;
    cin >> s >> t;
    int size;
    size = s.size();
    bool flag = true;
    for(int i = 0; i < size; i++){
        if(s.at(i) != t.at(i)){
            flag = false;
        }
    }

    if(flag == true) cout << "Yes" << endl;
    else cout << "No" << endl;

}

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

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

  ll N; cin >> N;
  ll S; cin >> S;
  vector<ll> A(N); for (ll i = 0; i < N; i++) cin >> A[i];

  ll MOD = 998244353;
  vector<vector<ll>> coef(N + 1, vector<ll>(S + 1, 0));
  ll ans = 0;
  for (ll i = 0; i < N; i++) {
    coef[i][0]++;
    for (ll j = 0; j <= S; j++) {
      coef[i + 1][j] += coef[i][j];
      if (j + A[i] <= S) {
        coef[i + 1][j + A[i]] += coef[i][j];
      }
      coef[i + 1][j] %= MOD;
    }
    ans = (ans + coef[i + 1][S]) % MOD;
  }
  cout << ans << '\n';
  return 0;
}

Measured memory_bytes: 70784
rl = []
N = int(input())
for i in range(N):
    x, l = map(int, input().split())
    rl.append((x+l, x-l))
rl.sort()

ans = 0
tmp = rl[0][0]
for i in range(N):
    if i and rl[i][1] < tmp:
        continue
    tmp = rl[i][0]
    ans += 1
print(ans)


Measured memory_bytes: 16988
#include <bits/stdc++.h>
#define rep(i,a,b) for(ll i=ll(a);i<ll(b);i++)
#define irep(i,a,b) for(ll i=ll(a);i>=ll(b);i--)
#define pb push_back
#define mp make_pair
#define pll pair<ll,ll>
#define endl "\n"
using ll=long long;
using ld=long double;
using namespace std;
const ll mod= 1e9+7;
const ll INF = 1LL<<60;
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; }
ll GCD(ll a, ll b) { return b ? GCD(b, a%b) : a; }


ll a[1100],b[1100];
vector<vector<ll>> dp(1100,vector<ll>(11000,INF));
main(){
  ll h,n,ans=0;
  cin>>h>>n;
  rep(i,0,n)cin>>a[i]>>b[i];
  dp[0][0]=0;
  rep(i,0,n){
    rep(j,0,h+1){
      dp[i+1][j]=min(dp[i+1][j],dp[i][j]);
      dp[i+1][min(j+a[i],h)]=min(dp[i+1][min(j+a[i],h)],dp[i+1][j]+b[i]);
    }
  }
  cout<<dp[n][h];
}


Measured memory_bytes: 94976
import qualified Data.Vector.Unboxed as U
import qualified Data.ByteString.Char8 as BS

readInt :: BS.ByteString -> Int
readInt s = case BS.readInt s of
              Just (x, _) -> x

main = do
  n <- readInt <$> BS.getLine
  xs <- U.fromListN n . map readInt . BS.words <$> BS.getLine
  let ls = U.scanl gcd 0 xs
      rs = U.scanr gcd 0 xs
  print $ U.maximum $ U.zipWith gcd ls (U.tail rs)


Measured memory_bytes: 5756
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
using namespace std;
typedef long long ll;
int INF = (1LL << 30) - 1;
int MOD = 1e9+7;
vector<int> graph[100010];
ll dfs(int prev, int now, int color, int dist, int depth){
    if(depth > 2)color++;
    //cout << now << "," << color << endl;
    ll res = color;
    ll rem = 0;
    for(auto next: graph[now]){
        if(next == prev)continue;
        res = res * dfs(now, next, color - rem + dist - 1, rem, depth+1) % MOD;
        rem++;
    }
    //cout << now << ":" << res << endl;
    return res;
    
}
main(){
    int N,K;
    cin >> N >> K;
    rep(i,0,N-1){
        int a,b;
        cin >> a >> b;
        a--,b--;
        graph[a].push_back(b);
        graph[b].push_back(a);
    }
    ll ans = dfs(-1, 0, K, 0, 0);
    cout << ans << endl;
}

Measured memory_bytes: 11520
N = int(input())
A = list(map(int, input().split()))
M = 10**9+7

ruisekiwa = [0]*N
wa = sum(A)%M

result = 0
for i in range(N):
    wa -= A[i]
    result = (result+(A[i]*wa)%M)%M

print(result)

Measured memory_bytes: 31660