akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;

int main(){
  string n;
  cin>>n;
  bool a=true;
  for(int i=0;i<3;i++){
    if(n.at(i)=='7'){
      a=false;
    }
  }
  if(a){
    cout<<"No"<<endl;
  }
  else{
    cout<<"Yes"<<endl;
  }
}
  

Measured memory_bytes: 3592
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<sstream>
#include<set>
#include<map>
#include<cmath>
#include<iomanip>
#include<cstring>
#include<utility>
#include<queue>
#include<fstream>
using namespace std;
#define PI 3.14159265
long long gcd(long long a, long long b) 
{ 
    if (a == 0) 
        return b; 
    return gcd(b % a, a); 
}
int main(){
	int n;
	cin>>n;
	cout<<pow(n, 3);
}

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

using namespace std;

using ll = long long;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<ll> sum_cnt(n), diff_cnt(n);
  for (int i = 0; i < n; i++) {
    int a;
    cin >> a;
    if (i + 1 + a < n) sum_cnt[i + 1 + a]++;
    if (i + 1 - a > 1) diff_cnt[i + 1 - a]++;
  }
  ll ans = 0;
  for (int i = 2; i < n; i++) {
    ans += sum_cnt[i] * diff_cnt[i];
  }
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 6340
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
int main(){
  string S,T;
  cin>>S>>T;
  for(int i=0;i<S.size();i++){
    if(S.at(i)!=T.at(i)){
      cout<<"No"<<endl;
    return 0;
    }
  }
  cout<<"Yes"<<endl;
}

Measured memory_bytes: 3632
n=int(input())
a=[[[0 for i in range(10)] for j in range(3)] for k in range(4)]
for l in range(n):
    b,f,r,v=map(int,input().split())
    a[b-1][f-1][r-1]+=v
for i in range(4):
    for j in range(3):
        for k in range(10):
            print(" "+str(a[i][j][k]), end="")
        print()
    if i!=3:
        print("####################")


Measured memory_bytes: 5624
L = list(map(int, input().split()))
L.sort()

# まずは1ずつ、次に2を足す、最後に1で調整
ans = 0
ans += L[2] - L[1]
L[0]+=ans
while L[2] > L[0]:
	L[0]+=2
	ans+=1

if L[2] == L[0]:
	print(ans)
else:
	print(ans+1)

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

const int mod = 1e9 + 7;
const int N = 102;
const int MAXV = 1e5 + 2;
long long dp[N][MAXV], pref[MAXV];
// dp[i][j] = no. of ways to distribut total j candies until child i

signed main(){
  int n, k;
  cin >> n >> k;
  vector<int> a(n + 1);
  
  for(int i = 1; i <= n; i++){
    cin >> a[i];
  }
  
  dp[0][0] = 1;
  
  for(int i = 1; i <= n; i++){
    for(int j = 0; j <= k; j++){
        pref[j + 1] = (pref[j] + dp[i - 1][j]) % mod;
    }
    
    for(int j = 0; j <= k; j++){
        dp[i][j] = (pref[j + 1] - pref[max(0, j - a[i])] + mod) % mod;
    }
  }
  
  cout << dp[n][k];
  
  return 0;
}

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

using namespace std;

int main() {
    int N, W; cin >> N >> W;
    vector<pair<long long, long long>> v;
    for (int i = 0; i < N; i++) {
        long long w, vv; cin >> vv >> w;
        v.emplace_back(vv, w);
    }
    sort(v.begin(), v.end(), [](auto a, auto b) {
        return a.first * b.second > a.second * b.first;
    });
    double res = 0;
    for (int i = 0; i < N && W > 0; i++) {
        int w = min(v[i].second, (long long) W);
        res += (double) v[i].first * w / v[i].second;
		
        W -= w;
    }
    cout << fixed << setprecision(12) << res << endl;
}


Measured memory_bytes: 4904
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x ,n) for(int i = x; i < n; i++)
#define repr(i, n) for(int i = n; i >= 0; i--)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main(){
    int a,b,c,x,ans=0;
    cin >> a >> b >> c >> x;
    rep(i,a+1){
        rep(j,b+1){
            rep(k,c+1){
                if(500*i+100*j+50*k==x)ans++;
            }
        }
    }
    
    
    cout << ans;
    
	return 0;
}

Measured memory_bytes: 3556
#include <iostream>

#define REP(i, a, b) for ( int i = (a); i < (b); i++ )
#define REVREP(i, a, b) for ( int i = (a); i >= (b); i--)
#define DEBUG_INT(var) printf("the value of "#var" is %d\n", var)
#define PRINT_ARRAY(name, i) printf("the value of "#name"[%d] is %d\n", (i), name[(i)])
#define DEBUG_ARRAY(name, begin, end) REP(i, begin, end) PRINT_ARRAY(name, i)

#define INF 1000000

using namespace std;

int N, T;
int ans = INF;

int main(void) {
    scanf("%d %d", &N, &T);
    
    
    
    REP(i, 0, N) {
      int c, t;
      scanf("%d %d", &c, &t);
      if (t<=T) ans = min(ans, c);
      
    }
   
    if (ans == INF) puts("TLE");
    else printf("%d\n", ans);

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b;
  cin>>a>>b;
  if(a-1>=b){
  cout<<2*a-1<<endl;
  }
  else if(b-1>=a)
  {cout<<2*b-1<<endl;}
  else {cout<<a+b<<endl;}
}


Measured memory_bytes: 3528
#include<stdio.h>
#include<stdlib.h>
#include<stdbool.h>

long long llmax(long long a,long long b){if(a>b){return a;}return b;}
long long llmin(long long a,long long b){if(a<b){return a;}return b;}
long long llzt(long long a,long long b){return llmax(a,b)-llmin(a,b);}
long long llgcd(long long a,long long b){long long c;while(b!=0){c=a%b;a=b;b=c;}return a;}
int llsortfncsj(const void *a,const void *b){if(*(long long *)a>*(long long *)b){return 1;}if(*(long long *)a==*(long long *)b){return 0;}return -1;}

bool isprime(long long x){
  long long i;
  if(x==1){return false;}
  if(x==2){return true;}
  if(x%2==0){return false;}
  for(i=3;i*i<=x;i+=2){
    if(x%i==0){return false;}
  }
  return true;
}

long long calcmod(long long x,long long m){
  if(x>=0){return x%m;}
  return (m-((-x)%m))%m;
}

long long n,a[16384];

bool judge(long long p){
  if(p==1 || p==0){return false;}
  //printf("try:%lld\n",p);
  if(calcmod(a[0],p)!=0){return false;}
  if(!isprime(p)){return false;}
  long long i,b[16384],t=-1;
  for(i=0;i<=n;i++){
    b[i]=calcmod(a[i],p);
    if(b[i]!=0){t=i;}
  }
  if(t==-1){return true;}
  if(p>t){return false;}
  for(i=n;i>=p;i--){
    b[i-(p-1)]+=b[i];
    b[i-(p-1)]%=p;
  }
  for(i=p-1;i>=0;i--){
    if((b[i]%p)!=0){return false;}
  }
  return true;
}

int main(){
  long long i,g;
  long long res[16384],rp=0,t;
  scanf("%lld",&n);
  for(i=n;i>=0;i--){scanf("%lld",&a[i]);}
  g=llzt(0,a[n]);
  for(i=n-1;i>=0;i--){
    g=llgcd(g,llzt(0,a[i]));
  }
  for(i=2;i*i<=g;i++){
    if((g%i)!=0){continue;}
    if(judge(i)){res[rp]=i;rp++;}
    while((g%i)==0){g/=i;}
  }
  if(judge(g)){res[rp]=g;rp++;}
  for(i=2;i<=n;i++){
    if(judge(i)){res[rp]=i;rp++;}
  }
  qsort(res,rp,sizeof(long long),llsortfncsj);
  res[rp]=-1;
  for(i=0;i<rp;i++){
    if(res[i]==res[i+1]){continue;}
    printf("%lld\n",res[i]);
  }
  return 0;
}


Measured memory_bytes: 384
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

	// 標準入力からデータを読み込む準備
	try (Scanner sc = new Scanner(System.in)) {

		while (true) {

			int n = sc.nextInt();
			if (n == 0) { break; }
			int[] scores = new int[n];
			for (int i = 0; i < scores.length; i++) {
				scores[i] = sc.nextInt(); 
			}
			double average = 0, variance = 0;
			// ... 平均値averageと，分散varianceを計算しよう ... 	
			for(int i = 0; i < scores.length; i++) {
				average += scores[i]; 
			}
			average = average/n;
			for(int i = 0; i < scores.length; i++) {
				variance += Math.pow(scores[i]-average, 2); 
			}
			variance = Math.pow(variance/n, 0.5); 
			
			System.out.println(variance);
		}
	}

	}
}


Measured memory_bytes: 31300
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define endl '\n'
typedef pair<int, int> P;
typedef long long ll;
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll x;
    cin >> x;
    for (ll a = -2000; a <= 2000; a++)
    {
        for (ll b = -2000; b <= 2000; b++)
        {
            ll val = a * a * a * a * a - b * b * b * b * b;
            if (val == x)
            {
                cout << a << ' ' << b << endl;
                return 0;
            }
        }
    }
}

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

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	long long n, m;
	cin>>n>>m;
	if(n <= m)
	cout<<n<<endl;
	else
	cout<<n-1<<endl;
	
	return 0;
}


Measured memory_bytes: 256
N,W=map(int,input().split())
table=[]
for i in range(N):
    w,v=map(int,input().split())
    table.append((w,v))
dp=[[0]*(W+1) for i in range(N+1)]
for i in range(1,N+1):
    w,v=table[i-1]
    for j in range(W+1):
        if j-w>=0:
            dp[i][j]=max(dp[i-1][j-w]+v,dp[i-1][j])
        else:
            dp[i][j]=dp[i-1][j]
ans=-1
for j in range(W+1):
    ans=max(ans,dp[N][j])
print(ans)

Measured memory_bytes: 119916
package main

import (
  "fmt"
)

func main() {
  var N, A, B, count, sum int
  fmt.Scan(&N, &A, &B)
  for i := 1; i <= N; i++ {
    n := i
    c1 := n / 10000
    n -= 10000 * c1
    c2 := n / 1000
    n -= 1000 * c2
    c3 := n / 100
    n -= 100 * c3
    c4 := n / 10
    n -= 10 * c4
    c5 := n
    sum = c1 + c2 + c3 + c4 + c5
    if sum >= A && sum <= B {
      count += i
    }
  }
  fmt.Println(count)
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
int main(){
	int a,b;
	cin>>a>>b;
	int ans1=0,ans2=0,a1=a,b1=b;
	int i=1;
	while(b1!=0){
		ans1+=a*i;
		i*=10;
		b1--;
	}
	i=1;
	while(a1!=0){
		ans2+=b*i;
		i*=10;
		a1--;
	}
	if(ans1>=ans2) cout<<ans1;
	else cout<<ans2;
	return 0;
}

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

class Program
{
    static void Main(string[] args)
    {
        var N = ReadInt();
        var H = ReadInts();

        var cnt = Count(H);

        Console.WriteLine(cnt);
    }

    static int Count(int[] h)
    {
        var cnt = 0;
        while (h != null && h.Length != 0 && h.Any(_ => _ != 0))
        {
            if (h.Contains(0))
            {
                var idx = Array.IndexOf(h, 0);
                if (idx != 0) cnt += Count(h.Take(idx).ToArray());
                if (idx != h.Length - 1) cnt += Count(h.Skip(idx + 1).ToArray());
                break;
            }

            var min = h.Min();
            cnt += min;
            for (var i = 0; i < h.Length; i++)
            {
                h[i] -= min;
            }
        }
        return cnt;

    }

    public static string Read() { return Console.ReadLine(); }
    public static int ReadInt() { return int.Parse(Read()); }
    public static long ReadLong() { return long.Parse(Read()); }
    public static double ReadDouble() { return double.Parse(Read()); }

    public static string[] Reads() { return Console.ReadLine().Split(' '); }
    public static int[] ReadInts() { return Reads().Select(_ => int.Parse(_)).ToArray(); }
    public static long[] ReadLongs() { return Reads().Select(_ => long.Parse(_)).ToArray(); }
    public static double[] ReadDoubles() { return Reads().Select(_ => double.Parse(_)).ToArray(); }
}



Measured memory_bytes: 13396
use std::str::FromStr;
use std::fmt::Debug;
use std::cmp;

#[allow(dead_code)]
fn read_as_vec<T>() -> Vec<T>
where T: FromStr, <T as FromStr>::Err : Debug{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().split_whitespace().map(|c| T::from_str(c).unwrap()).collect()

}

#[allow(dead_code)]
fn read_as_string() -> String{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

fn gcd(a: u64, b: u64) -> u64{

    if b == 0{
        return a;
    }

    return gcd(b, a%b);
}


fn main(){
    let line: Vec<u64> = read_as_vec();

    let (a, b) = (line[0], line[1]);

    println!("{}", a*b/gcd(a, b));
}


Measured memory_bytes: 4352
import java.util.*;
import java.util.Map.Entry;

import javax.swing.text.Segment;
import javax.xml.ws.WebEndpoint;

import java.io.*;
import java.lang.reflect.Array;
import java.math.BigInteger;

import static java.lang.Math.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;

public class Main implements Runnable
{
//    static int dx[]={-1,0,1,0};
//    static int dy[]={0,-1,0,1};
    static long mod=1000000007;
    
    public static void main(String[] args) {        
        new Thread(null, new Main(), "", 200 * 1024 * 1024).start();        
    }

    public void run() {
        Reader sc = new Reader(System.in);
        PrintWriter out=new PrintWriter(System.out);

        int n=sc.nextInt();
        int x[]=sc.nextIntArray(n);
        int d=0,dd=0,r=0,rr=0;
        for (int i = 0; i < x.length; i++) {
			d+=x[i];
		}
        d/=n;
        dd=d+1;
        for (int i = 0; i < x.length; i++) {
			r+=(d-x[i])*(d-x[i]);
		}
        for (int i = 0; i < x.length; i++) {
			rr+=(dd-x[i])*(dd-x[i]);
		}
        r=min(r,rr);
        out.println(r);
     	out.flush();
    }
   
    static void ret(String ans) {
    	System.out.println(ans);
    	System.exit(0);
    }

    static void ret(long ans) {
    	System.out.println(ans);
    	System.exit(0);
    }
    
    static boolean validpos(int x,int y,int r, int c){
        return x<r && 0<=x && y<c && 0<=y;
    }

    static void db(Object... os){
        System.err.println(Arrays.deepToString(os));
    }
}

//class P {
//	int x,y; double d;
//	P(int  x, int y, double d) {
//	  this.x=x;
//	  this.y=y;
//	  this.d=d;
//	}
//}


class P implements Comparable<P>{
    int p,h,f; long m;
    P(int p,int h, int f, long m) {
    	this.p=p;
    	this.h=h;
    	this.f=f;
    	this.m=m;
    }

    public int compareTo(P p){
    	if(this.p==p.p) {
    		if(this.f==-1) return 1;
    		return -1;
    	}
        return this.p-p.p;
    }
}

class Reader
{ 
    private BufferedReader x;
    private StringTokenizer st;
    
    public Reader(InputStream in)
    {
        x = new BufferedReader(new InputStreamReader(in));
        st = null;
    }
    public String nextString()
    {
        while( st==null || !st.hasMoreTokens() )
			try {
				st = new StringTokenizer(x.readLine());
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
        return st.nextToken();
    }
    public int nextInt()
    {
        return Integer.parseInt(nextString());
    }
    public int[] nextIntArray(int size) {
        int r[] = new int[size];
        for (int i = 0; i < size; i++) {
            r[i] = this.nextInt(); 
        }
        return r;
    }
    public long[] nextLongArray(int size) {
        long r[] = new long[size];
        for (int i = 0; i < size; i++) {
            r[i] = this.nextLong(); 
        }
        return r;
    }
    public char[] getCharSet() {
        return this.nextString().toCharArray();
    }    
    public long nextLong()
    {
        return Long.parseLong(nextString());
    }
    public double nextDouble() throws IOException
    {
        return Double.parseDouble(nextString());
    }
}


Measured memory_bytes: 23252
#include<bits/stdc++.h>
 
#define rep(i,n) for(ll i = 0;i < n;++i)
#define all(v) v.begin(),v.end()
using namespace std;
using ll = long long;
typedef pair<int,int> P;
 
const int INF = 1001001001;

 int g[15][15];

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

    int r;
    cin >> r;
    cout << r*r << endl;

    cout << endl;
    return 0;
}


Measured memory_bytes: 256
use std::io::*;
use std::str::FromStr;

pub fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}


fn main() {
    let n: usize = read();
    let a: usize = read();
    let b: usize = read();
    if n * a < b {
        println!("{}", n * a);
    } else {
        println!("{}", b);
    }
}


Measured memory_bytes: 4352
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**13
mod = 10**9+9
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    rr = []

    def f(n,s,w,q):
        g = s
        a = []
        for i in range(n):
            a.append(g // 7 % 10)
            if g % 2 == 1:
                g = (g // 2) ^ w
            else:
                g //= 2
        if q % 2 == 0 or q % 5 == 0:
            r = 0
            t = 0
            for c in a:
                if c > 0:
                    t += 1
                if c % q == 0:
                    r += t
            return r
        b = [0] * (n+1)
        k = 1
        for i in range(n-1,-1,-1):
            b[i] = (b[i+1] + a[i] * k) % q
            k = k * 10 % q
        d = collections.defaultdict(int)
        r = 0
        for i in range(n):
            if a[i] > 0:
                d[b[i]] += 1
            r += d[b[i+1]]

        return r

    while 1:
        n,m,l,o = LI()
        if n == 0:
            break
        rr.append(f(n,m,l,o))

    return '\n'.join(map(str, rr))


print(main())



Measured memory_bytes: 23756
#include <cstring>
#include <iostream>
#include <bits/stdc++.h>
#include <algorithm>
#include <vector>
#include <math.h>

using namespace std;
typedef long long ll;

void dfs(int i, const int size, const int end, const int start, vector<int> &A, vector<int> a, vector<int> b, vector<int> c, vector<int> d, int &max) {
    if(i == size) {
        int sum = 0;

        for(int k=1; k<a.size(); k++) {
            if(A[b[k]-1] - A[a[k]-1] == c[k]) {
                sum += d[k];
            }
        }

        if(max < sum) {
            max = sum;
        }
    } else {
        for(int j=start; j<=end; j++) {
            A[i] = j;
            dfs(i+1, size, end, j, A, a, b, c, d, max);
        }
    }
}


int main() {
    int N, M, Q;

    cin >> N >> M >> Q;

    vector<int> a(Q+1), b(Q+1), c(Q+1), d(Q+1);

    for(int i=1; i<=Q; i++) {
        cin >> a[i] >> b[i] >> c[i] >> d[i];
    }

    vector<int> A(N);

    int start = 1;
    int end = M;
    int size = N;
    int max = -1;

    dfs(0, size, end, start, A, a, b, c, d, max);

    cout << max << endl;

    return 0;


}

Measured memory_bytes: 3648
// Ver19.03
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define INF 1 << 29
#define LLINF 4545454545454545454
#define MOD 1000000007
#define ll long long
#define ull unsigned long long
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
int upll(const void *a, const void *b) { return *(ll *)a < *(ll *)b ? -1 : *(ll *)a > *(ll *)b ? 1 : 0; }
int downll(const void *a, const void *b) { return *(ll *)a < *(ll *)b ? 1 : *(ll *)a > *(ll *)b ? -1 : 0; }
void sortup(ll *a, int n) { qsort(a, n, sizeof(ll), upll); }
void sortdown(ll *a, int n) { qsort(a, n, sizeof(ll), downll); }

int main()
{
  ll n, mochi[110], ans = 1;
  scanf("%lld", &n);
  for (int i = 0; i < n; i++)
  {
    scanf("%lld", &mochi[i]);
  }
  sortdown(mochi, n);
  for (int i = 0; i < n - 1; i++)
  {
    if (mochi[i] > mochi[i + 1])
      ans++;
  }
  printf("%lld\n", ans);
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
int main() {
    int n;
    string s;
    cin>>n>>s;
    for (int i=0;i<s.size();i++){
        s[i]+=n;
        if (s[i]>'Z') s[i]-=26;
    }
    cout<<s;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
struct UnionFind {
  vector<int> parent;
  vector<int> per_size;
  
  UnionFind(int n): parent(n, -1), per_size(n, 1) {}

  int root(int x){
    return (parent[x] < 0 ? x : parent[x] = root(parent[x]));
    //if(parent[x] < 0) return x;
    //else parent[x] = root(parent[x]);
  }

  void unite(int x, int y){
    int rx = root(x);
    int ry = root(y);
    if(rx == ry) return;
    if(per_size[rx] < per_size[ry]) swap(rx, ry);
    per_size[rx] += per_size[ry];
    parent[ry] = rx;
    //for(int i = 0; i < per_size.size(); ++i) cout << i << ": " << per_size[i] << endl;
  }

  bool is_same(int x, int y){
    return root(x) == root(y);
  }

  int get_size(int x){
    return per_size[root(x)];
  }

};

int main(){
  int n, m, k;
  cin >> n >> m >> k;
  UnionFind relation(n);
  //int friends[100001];
  //vector<int> block[100001];
  vector<int> friends(n, 0);
  vector<int> block[n];
  for(int i = 0, x, y; i < m; ++i){
    cin >> x >> y;
    x--;
    y--;
    friends[x]++;
    friends[y]++;
    relation.unite(x, y);
  }
  for(int i = 0, x, y; i < k; ++i){
    cin >> x >> y;
    x--;
    y--;
    block[x].push_back(y);
    block[y].push_back(x);
  }
  int ans;
  for(int i = 0; i < n; ++i){
    ans = relation.get_size(i) - friends[i] - 1;
    for(auto tgt: block[i]){
      if(relation.is_same(tgt,i)) ans--;
    }
   cout << (i ? " " : "") << ans;
  }
  cout << endl;
}


Measured memory_bytes: 7168
n = int(input())
a = list(map(int,input().split()))
m = 1000
temp = 0
for i in range(n-1):
    if a[i+1] < a[i]:
        m+=temp*a[i]
        temp = 0
    else:
        temp += m//a[i]
        m%=a[i]
m+=temp*a[-1]
print(m)

Measured memory_bytes: 9172
#include <iostream>
using namespace std;
int main(){
	int a,b;
	cin>>a>>b;
	int ans=0;
	for(int i=1;i<=b;i++){
		int temp;
		cin>>temp;
		ans+=temp;
	}
	cout<<(ans>=a?"Yes":"No")<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h> 
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<ll> vl;
typedef pair<ll,ll> pll;
#define MOD 1000000007
#define INF 1000000000
#define mp make_pair
#define pb push_back
#define ss second
#define ff first
#define endl '\n'
#define pl cout<<endl;
void fast() { ios_base::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL); }
const long long INFll=1ll*INF*INF;
const long double PI=3.141592653589793238462643383279502884197169399375105820974944;
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define gcd(a,b) __gcd((a),(b))
#define lcm(a,b) ((a)*(b))/gcd((a),(b))
#define debug(x) cout << x << endl;
#define sz(a) int((a).size())
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }
 
    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
long long genrand(long long L,long long R)
{
	return uniform_int_distribution<long long>(L, R)(rng);
}
//use brackets before operations if taking MOD
//use map only when necessary
//give long long to arrays and variables properly
int mul(int a, int b,int mod = MOD) {
	return int(a * 1ll * b % mod);
}
int norm(int a,int mod = MOD) {
	while(a >= mod) a -= mod;
	while(a < 0) a += mod;
	//a = (a%mod+mod)%mod;
	return a;
}
int powmod(int x,int y,int mod = MOD){
	int res = 1;
	while(y>0)
	{
		if(y&1)
			res = mul(res,x,mod);
		x = mul(x,x,mod);
		y=y>>1;
	}
	return res;
}
int inv(int a,int mod = MOD) {
	return powmod(a, mod - 2);
}
int main() {
	fast();

	int x; cin>>x;
	int q = x/500;
	x-=q*500;
	int ans = 2*q*500;
	ans += x/5 * 5;
	cout<<ans<<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;
typedef long long ll;

struct Edge { int to, id;};


int main() {
  int n;
  cin >> n;
  vector<vector<Edge>> g(n);
  vector<int> ans(n-1);
  rep(i,n-1) {
    int a, b;
    cin >> a >> b;
    --a; --b;
    g[a].push_back((Edge){b,i});
    g[b].push_back((Edge){a,i});
  }

  queue<int> q;
  vector<int> used(n);
  q.push(0);
  used[0] = 1;
  while (!q.empty()) {
    int v = q.front(); q.pop();
    int c = -1;
    rep(i,g[v].size()) {
      int u = g[v][i].to, ei = g[v][i].id;
      if (used[u]) c = ans[ei];
    }
    int k = 1;
    rep(i,g[v].size()) {
      int u = g[v][i].to, ei = g[v][i].id;
      if (used[u]) continue;
      if (k == c) ++k;
      ans[ei] = k; ++k;
      q.push(u);
      used[u] = 1;
    }
  }

  int mx = 0;
  rep(i,n) mx = max(mx, int(g[i].size()));
  cout << mx << endl;
  rep(i,n-1) {
    cout << ans[i] << endl;
  }
  return 0;
}


Measured memory_bytes: 7424
#include<bits/stdc++.h>
#define rep(i,n) for(int i = 0;i<n;i++)
using namespace std;
int main(){
  int n;
  cin>>n;
  int h[n];
  rep(i,n)cin>>h[i];
  int ans=0;
  for(int i=0;i<n;i++){
    bool f=true;
    for(int j=0;j<i;j++){
    
    if(h[i]<h[j])f=false;
    
      
  }
    if(f)ans++;
  }
  cout << ans <<endl;
}


Measured memory_bytes: 256
/****Author: Barish Namazov****/
#include <bits/stdc++.h>

using namespace std;

/***TEMPLATE***/
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()

#define F first
#define S second
#define pb push_back

#define endl '\n'

const int max4 = 10004;
const int maxx = 100005;
const int max6 = 1000006;
const int lg5 = 17;

const int INF = 2 * 1000000007;
const long long INFLL = 4LL * 1000000000 * 1000000000;

/***************/

int powmod (int a, int b, int mod) {
    int res = 1; a %= mod;
    for (; b; b >>= 1) {
        if (b & 1) {
            res = 1LL * res * a % mod;
        }
        a = 1LL * a * a % mod;
    }
    return res;
}

int gcd (int a, int b) {
    while (b > 0) {
        int t = a % b;
        a = b, b = t;
    }
    return a;
}

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

int is_prime (int n) {
    if (n <= 1 || n > 3 && (n % 2 == 0 || n % 3 == 0))
        return 0;
    for (int i = 5, t = 2; i * i <= n; i += t, t = 6 - t)
        if (n % i == 0)
            return 0;
    return 1;
}

/******Don't forget to use long long when needed!!******/

int dp[505][505];
int main() {
    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
    ios_base :: sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    int n, m, q;
    cin >> n >> m >> q;
    for (int i = 1; i <= m; i++) {
        int a, b; cin >> a >> b;
        dp[a][b]++;
    }
    for (int i = n; i >= 1; i--) {
        for (int j = 1; j <= n; j++) {
            dp[i][j] += dp[i + 1][j] + dp[i][j - 1] - dp[i + 1][j - 1];
        }
    }
    while (q --) {
        int a, b; cin >> a >> b;
        cout << dp[a][b] << endl;
    }
    return 0;
}


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

int main() {
    int H, N;
    cin >> H >> N;
    vector<int> A(N);
    for (int i = 0; i < A.size(); i++) {
        cin >> A.at(i);
    }
    sort(A.begin(), A.end());
    reverse(A.begin(), A.end());

    for (int i = 0; i < A.size(); i++) {
        H = H - A.at(i);
    }
    
    if (H <= 0) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 640
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <unordered_map>
using namespace std;

#define REP(i, s) for (int i = 0; i < s; ++i)
#define ALL(v) (v.begin(), v.end())
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)

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; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }


int main() {
    string S;
    while (cin >> S) {
        long long n = S.size();
        long long res = 0;
        long long num = 0;
        for (long long i = 0; i < n; ++i) {
            if (S[i] == 'W') {
                res += num;
            }
            else {
                ++num;
            }
        }
        cout << res << endl;
    }
}






























Measured memory_bytes: 640
#include<iostream>

using namespace std;

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

int main() {
  int a, b;
  while (cin >> a >> b) {
    a += b;
    if (a == 0) {
      cout << 1 << endl;
      continue;
    }
    b = 0;
    while (a > 0) {
      a /= 10;
      ++b;
    }
    cout << b << endl;
  }
  return 0;
}

Measured memory_bytes: 1160
import java.util.*;

class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int m = sc.nextInt();
    
    int big = n;
    int small = m;
    
    if (n<m) {
      big = m;
      small = n;
    }
    
    String result = "";
    for (int i = 0; i<big; i++) {
      result += String.valueOf(small);
    }
    
    System.out.println(result);
    
  }
}

Measured memory_bytes: 21460
#include<bits/stdc++.h>
using namespace std;
int main(){
    int d;
    cin >> d;
    if(d==25){
        cout << "Christmas" << endl;
    }else if(d==24){
        cout << "Christmas Eve" << endl;   
    }else if(d==23){
        cout << "Christmas Eve Eve" << endl;
    }else if(d==22){
        cout << "Christmas Eve Eve Eve" << endl;
    }
}

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

#define MAX 10000
int main(void) {
    int sieve[MAX+1]={0},i,j,num;
    for (i=2; i<=sqrt(MAX); i++) {
        if (sieve[i]==0) {
            for (j=i*2; j<=MAX; j+=i) sieve[j]=1;
        }
    }
    while (scanf("%d",&num)!=EOF&&num!=0) {
        if (num%2==0) num--;
        while (sieve[num]!=0||sieve[num-2]!=0) {
            num-=2;
        }
        printf("%d %d\n",num-2,num);
    }
    return 0;
}

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

using namespace std;
typedef long long ll;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using vd = vector<double>;
using vvd = vector<vd>;

#define out(a) cout << a << endl
#define out1(a) cout << a
#define in(a) cin >> a
#define in2(a, b) cin >> a >> b
#define in3(a, b, c) cin >> a >> b >> c
#define rep(i, N) for (ll i = 0; i < (ll)N; i++)
#define rep1(i, N) for (ll i = 1; i <= (ll)N; i++)
#define repi(i, j, N) for (ll j = (ll)i + 1; j < (ll)N; j++)
#define all(v) v.begin(), v.end()

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;
}

constexpr int inf = 1e9;
constexpr ll linf = 1e18;
constexpr ll mod = 1e9 + 7;

void solve();

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

void solve()
{
    int x;
    in(x);
    int ans = 1;
    for (int i = 2; i < 1000; i++)
    {
        int k = i;
        while (k * i <= x)
        {
            k *= i;
        }
        if (k != i)
        {
            chmax(ans, k);
        }
    }
    out(ans);
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <cmath>
#include <algorithm>
#include <random>
#include <chrono>
#include <iomanip>
#define lint unsigned long long int
#define FOR(x, to) for(int x=0; x<(int)(to); x++)
#define DUMP(ar) for(auto itd=begin(ar); itd != end(ar); itd++) cout << "["s << itd - begin(ar) << "]:"s << *itd << endl
#define DUMPL(ar) for(auto itd=begin(ar); itd != end(ar); itd++) { cout << *itd; if(end(ar)-itd > 1) cout << ' '; } cout << endl
#define COUT(x) cout << (x) << endl
#define VCIN(ar) for(auto &vcin: (ar)) cin >> vcin
#define ALL(ar) ar.begin(), ar.end()
#define LOOPD(i) cout << "ループ["s << i << "]回目---------------"s << endl
using namespace std;
// lint:64ビット 10^19

struct happiness{
    int sea;
    int mountain;
    int home;
};

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

    int n;
    cin >> n;
    vector<happiness> h(n);
    for(int i=0; i<n; i++){
        cin >> h[i].sea >> h[i].mountain >> h[i].home;
    }

    vector<vector<int>> max_any_case(n, vector<int>(3, 0));
    max_any_case[0][0] = h[0].sea;
    max_any_case[0][1] = h[0].mountain;
    max_any_case[0][2] = h[0].home;
    for(int i=1; i<n; i++){
        max_any_case[i][0] = max(max_any_case[i-1][1], max_any_case[i-1][2]) + h[i].sea;
        max_any_case[i][1] = max(max_any_case[i-1][0], max_any_case[i-1][2]) + h[i].mountain;
        max_any_case[i][2] = max(max_any_case[i-1][0], max_any_case[i-1][1]) + h[i].home;
    }

    COUT(*max_element(ALL(max_any_case.back())));

    return 0;
}

Measured memory_bytes: 6912
#include <iostream>
#include <vector>
#include <algorithm>
#include <climits>

using namespace std;

int main(void){
    int N, T;
    vector <int> c, t;
    int sub;
    int ans = INT_MAX;
    bool judge = false;
    
    cin >> N >> T;
    for(int i = 0; i < N; i++){
        cin >> sub;
        c.push_back(sub);
        cin >> sub;
        t.push_back(sub);
    }
    
    for(int i = 0; i < N; i++){
        if(t[i] <= T){
            judge = true;
        }
    }
    
    if(!judge){
        cout << "TLE\n";
    }
    else{
        for(int i = 0; i < N; i++){
            if(t[i] <= T){
                ans = min(ans, c[i]);
            }
        }
        
        cout << ans << endl;
    }
}

Measured memory_bytes: 888
class BiCoeff(object):
    def __init__(self, MAX, m):
        super(BiCoeff, self).__init__()
        fac = [0]*MAX
        finv = [0]*MAX
        inv = [0]*MAX

        fac[0] = 1
        fac[1] = 1
        finv[0] = 1
        finv[1] = 1
        inv[1] = 1
        for i in range(2,MAX):
            fac[i] = (fac[i-1]*i)%m
            inv[i] = m - (inv[m%i] * (m//i))%m
            finv[i] = (finv[i-1] * inv[i])%m

        self.MAX = MAX
        self.m = m
        self.fac = fac
        self.finv = finv
        self.inv = inv

    def calc(self,n,k):
        if n<k:
            return 0
        if n<0 or k<0:
            return 0
        return (self.fac[n] * (self.finv[k]*self.finv[n-k])%self.m)%self.m

mod = 10**9 + 7
k = int(input())
s = input()
n = len(s)

b = BiCoeff(n+k+10,mod)
res = 0
for i in range(n,k+n+1):
    res += b.calc(n+k,i)*pow(25,n+k-i,mod)
    res %= mod
print(res)

Measured memory_bytes: 148596
#include <iostream>
#include <utility>
#include <map>
#include <vector>
#include <algorithm>
#include <queue>
#include <math.h>
#include <stack>
#include <set>
#include <deque>
#include <cmath>
#include <cassert>

using namespace std;
typedef long long ll;
ll mod = 1e9+7;
#define rep(i,n) for(int i = 0; i < (n); ++i)

int main(){
    int h1, m1, h2, m2, k;
    cin >> h1 >> m1 >> h2 >> m2 >> k;
    m1 += h1 * 60;
    m2 += h2 * 60;
    cout << m2 - m1 - k << endl;
    return 0;
}


Measured memory_bytes: 3632
N, M = map(int, input().split())


class UnionFind:
    def __init__(self, n):
        self.par = [i for i in range(n)]
        self.rank = [0] * n
        self.size = [1] * n

    # 検索
    def find(self, x):
        if self.par[x] == x:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]

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

        if x == y:
            return

        if self.rank[x] < self.rank[y]:
            self.par[x] = y
            self.size[y] += self.size[x]
            self.size[x] = 0
        else:
            self.par[y] = x
            self.size[x] += self.size[y]
            self.size[y] = 0
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1

    # 同じ集合に属するか判定
    def same(self, x, y):
        return self.find(x) == self.find(y)

    # すべての頂点に対して親を検索する
    def all_find(self):
        for n in range(len(self.par)):
            self.find(n)


UF = UnionFind(N)

for i in range(M):
    X, Y, Z = map(int, input().split())
    X, Y = X - 1, Y - 1
    UF.union(X, Y)
UF.all_find()

print(len(set(UF.par)))


Measured memory_bytes: 14752
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {

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

	public void solve() throws IOException {
		FastScanner fs = new FastScanner();
		long a = fs.nextLong();
		long b = fs.nextLong();
		long n = fs.nextLong();
		
		if(n < b) {
			System.out.println(a*n/b);
			return;
		}
		
		if(a % b == 0) {
			if(n < 2 * b) {
				System.out.println(Math.max(a*n/b - (a*(n/b)), (a/b)*(b-1)));
				return;
			}
			System.out.println(((a/b)*(b-1)));
			return;
		}
		
		if(n < 2 * b) {
			System.out.println(Math.max(a*n/b - (a*(n/b)), a-(a/b+1)));
			return;
		}
		System.out.println(a-(a/b+1));
		return;
	}

	

	public class FastScanner {

		BufferedReader reader;
		private StringTokenizer st;

		public FastScanner() {
			st = null;
			reader = new BufferedReader(new InputStreamReader(System.in));
		}

		public String next() throws IOException {
			if (st == null || !st.hasMoreElements()) {
				st = new StringTokenizer(reader.readLine());
			}
			return st.nextToken();
		}

		public String nextLine() throws IOException {
			st = null;
			String readLine = null;
			readLine = reader.readLine();
			return readLine;
		}

		public int nextInt() throws NumberFormatException, IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws NumberFormatException, IOException {
			return Long.parseLong(next());
		}

		public int[] nextIntArr(int n) throws NumberFormatException, IOException {
			int[] retArr = new int[n];
			for (int i = 0; i < n; i++) {
				retArr[i] = nextInt();
			}
			return retArr;
		}

		public long[] nextLongArr(int n) throws NumberFormatException, IOException {
			long[] retArr = new long[n];
			for (int i = 0; i < n; i++) {
				retArr[i] = nextLong();
			}
			return retArr;
		}

		public void close() throws IOException {
			reader.close();
		}
	}

}


Measured memory_bytes: 32632
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
typedef vector<ll> VI;
typedef vector<VI> VVI;
const ll MOD = 1000000007;
const ll INF = 2147483647;
const ll LINF = 9223372036854775807;
#define REP(i, n) for (int i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()

	//x+y
	ll add(ll x, ll y) {
		return (x + y) % MOD;
	}

	//x-y
	ll sub(ll x, ll y) {
		return (x + MOD - (y % MOD)) % MOD;
	}

	//x*y
	ll mul(ll x, ll y) {
		return ((x % MOD) * (y % MOD)) % MOD;
	}

	//x^y
	ll power(ll x, ll y) {
		if (y == 0) {
			return 1;
		}
		else if (y == 1) {
			return x % MOD;
		}
		else if (y % 2 == 0) {
			ll pow = power(x, y / 2);
			return (pow * pow) % MOD;
		}
		else {
			ll pow = power(x, y / 2);
			return (((pow * pow) % MOD) * x) % MOD;
		}
	}

	//x/y
	ll divi(ll x, ll y) {
		return mul(x, power(y, MOD - 2));
	}

int main() {
	int n; cin >> n;
    VI a(n); REP(i,n) cin >> a[i];
    VI p(1114514,0);
    REP(i,n){
        int k=a[i];
        for(int j=2;j<=sqrt(k);j++){
            ll m=0;
            while(k%j==0){
                k/=j;
                m++;
            }
            p[j]=max(p[j],m);
            if(k==0){
                break;
            }
        }
        if(k!=0){
            p[k]=max(p[k],(ll)1);
        }
    }
    ll gc=1;
    REP(i,1000000) gc=(gc*power(i,p[i]))%MOD;
    ll ans=0;
    REP(i,n) ans=(ans+divi(gc,a[i]))%MOD;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 9088
#include<bits/stdc++.h>
#pragma GCC optimize("O3")
#define mod 1000000007
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
long long rand_seed()
{
	long long a = rng();
    return a;
}
int n, k;
long long dp[102][100002], prf[102][100002];
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> n >> k;
    dp[0][0] = 1;
    for(int i = 1; i <= n; ++i)
    {
        for(int j = 0; j <= k; ++j)
        {
            prf[i - 1][j] = dp[i - 1][j];
            if(j)
                prf[i - 1][j] += prf[i - 1][j-1];
            prf[i - 1][j] %= mod;
        }
        int xx;
        cin >> xx;
        for(int j = 0; j <= k; ++j)
        {
            dp[i][j] = prf[i-1][j] + mod;
            if(j > xx)
                dp[i][j] -= prf[i-1][j - xx - 1];
            dp[i][j] %= mod;
        }
    }
    cout << dp[n][k];
    return 0;
}



Measured memory_bytes: 158848
#include <stdio.h>

int main() {
	int n, AC = 0, WA = 0, TLE = 0, RE = 0;
	char Si[110];
	
	scanf("%d", &n);
	while(n--){
		scanf("%s", Si);
		if(Si[0] == 'A'){
			AC++;
		}else if(Si[0] == 'W'){
			WA++;
		}else if(Si[0] == 'T'){
			TLE++;
		}else if(Si[0] == 'R'){
			RE++;
	}
}
	printf("AC x %d\n", AC);
	printf("WA x %d\n", WA);
	printf("TLE x %d\n", TLE);
	printf("RE x %d\n", RE);
	
	return 0;

}

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

template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void POSS(T condition){ if(condition) cout << "POSSIBLE" << endl; else cout << "IMPOSSIBLE" << endl; }
template<class T> inline void Poss(T condition){ if(condition) cout << "Possible" << endl; else cout << "Impossible" << endl; }
template<class T> inline void First(T condition){ if(condition) cout << "First" << endl; else cout << "Second" << endl; }
int character_count(string text, char character){ int ans = 0; for(int i = 0; i < text.size(); i++){ ans += (text[i] == character); } return ans; }
long power(long base, long exponent, long module){ if(exponent % 2){ return power(base, exponent - 1, module) * base % module; }else if(exponent){ long root_ans = power(base, exponent / 2, module); return root_ans * root_ans % module; }else{ return 1; }}
struct position{ int y, x; }; position move_pattern[4] = {{-1, 0}, {0, 1}, {1, 0}, {0, -1}}; // double euclidean(position first, position second){ return sqrt((second.x - first.x) * (second.x - first.x) + (second.y - first.y) * (second.y - first.y)); }
template<class itr> void array_output(itr start, itr goal){ string ans; for(auto i = start; i != goal; i++){ ans += to_string(*i) + " "; } ans.pop_back(); cout << ans << endl; }
template<class T> T gcd(T a, T b){ if(a && b){ return gcd(min(a, b), max(a, b) % min(a, b)); }else{ return a; }}
#define mod long(1e9 + 7)
#define all(x) (x).begin(), (x).end()
#define bitcount(n) __builtin_popcountl(long(n))

int main(){
    int N;
    cin >> N;
    long A[N];
    map<long, long> slopes_size;
    for(long i = 0; i < N; i++){
        cin >> A[i];
        if(A[i] > i){
            cout << -1 << endl;
            return 0;
        }
        slopes_size[A[i] - i] = max(slopes_size[A[i] - i], A[i]);
    }
    for(int i = 0; i < N - 1; i++){
        if(A[i + 1] - A[i] > 1){
            cout << -1 << endl;
            return 0;
        }
    }
    long ans = 0;
    for(auto i: slopes_size){
        ans += i.second;
    }
    cout << ans << endl;
}


Measured memory_bytes: 14336
#include<iostream>
#include<algorithm>
#include<iomanip>

using namespace std;

int N;
int t[103], v[103];
int C[20005];
int v_ref[20005];

int main(void) {

	cin >> N;
	int tmp;
	for (int i = 1; i <= N; i++) {
		cin >> tmp; t[i] = tmp;
	}
	for (int i = 1; i <= N; i++) {
		cin >> tmp; v[i] = tmp;
	}
	//===================================
	int sum_t = 0;
	for (int i = 1; i <= N; i++) {
		for (int j = 1; j <= t[i]; j++) {
			C[sum_t + j] = v[i]; v_ref[sum_t + j] = v[i];
		}
		sum_t += t[i];
	}
	//======================================

	int t0, v0;
	for (int i = 0; i <= N; i++) {
		t0 = 0; for (int k = 1; k <= i; k++) { t0 += t[k]; }
		v0 = v[i]; //cout << "t0= " << t0 << "  v0= " << v0 << endl;
		for (int j = 0; j <= 100; j++) {
			C[t0 + j] = min(C[t0 + j], v0 + j);
		}
	}
	//=====================================
	for (int i = 1; i <= N+1; i++) {
		t0 = 0; for (int k = 1; k <= i; k++) { t0 += t[k]; }
		v0 = v[i+1]; 
		for (int j = 0; j <= 100; j++) {
			if (t0 - j < 0) { break; }
			C[t0 - j] = min(C[t0 - j], v0 + j);
		}
	}
    //===============================

	/*for (int i = 0; i <= sum_t; i++) {
		cout << i << "   " << C[i] << endl;
	}*/




	long double ans = 0.0;

	for (int i = 1; i <= sum_t; i++) {
		ans += (long double) 0.5*(C[i - 1] + C[i]);
		if (C[i - 1] == C[i] && C[i] < v_ref[i]) { ans += 0.25; }
	}

	cout <<fixed<<setprecision(12)<< ans << endl;

	//system("pause");
	return 0;
}

Measured memory_bytes: 384
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	//java11

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		int[] count = new int[N+1];
		Arrays.fill(count, 0);
		for(int x=1; x<=200; x++) {
			for(int y=1; y<=200; y++) {
				for(int z=1; z<=200; z++) {
					int n = x*x+y*y+z*z+x*y+y*z+z*x;
					if(n <=N) {
						count[n]++;
					}
				}
			}
		}

		PrintWriter pw = new PrintWriter(System.out);
		for(int i=1; i<=N; i++) {
			pw.println(count[i]);
		}
		pw.flush();

	}

}


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

int main() {
	int e[3];
	for (int i = 0; i < 3; i++) {
		cin >> e[i];
	}

	int f = 0;
	int s = 0;
	for (int i = 0; i < 3; i++) {
		if (e[i] == 5) {
			f++;
		} else if (e[i] == 7) {
			s++;
		}
	}
	string ans = "NO";
	if (f == 2 && s == 1) {
		ans = "YES";
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int a, b;
	char op;
	
	while (1)
	{
		scanf("%d %c %d", &a, &op, &b);

		if (op == '+')
		{
			printf("%d\n", a + b);
		}
		else
		{
			if (op == '-')
			{
				printf("%d\n", a - b);
			}
			else
			{
				if (op == '*')
				{
					printf("%d\n", a*b);
				}
				else
				{
					if (op == '/')
					{
						printf("%d\n", a / b);
					}
					else
					{
						break;
					}
				}
			}
		}
	}

	return 0;
	
}


Measured memory_bytes: 2036
#define Y(V,N)V+D[d][N]*z[j]
#define X(V,N)(0<=Y(V,N)&&Y(V,N)<n)
D[13][3]={{1,0,0},{0,1,0},{0,0,1},{1,1,0},{1,0,1},{0,1,1},{1,-1,0},{1,0,-1},{0,1,-1},{1,1,1},{-1,1,1},{1,-1,1},{1,1,-1}};
M[7][7][7],z[2];main(n,m,p,I,x,y,i,j,c,d){for(;scanf("%d%d%d",&n,&m,&p),n;){
	for(memset(M,0,sizeof(M)),c=1,I=0;I<p;c*=-1){
		scanf("%d%d",&x,&y),x--,y--,I++;
		for(i=0;;i++)if(!M[x][y][i]){M[x][y][i]=c;break;}
		for(d=0;d<13;d++){
			for(j=0;j<2;j++)for(z[j]=0;z[j]<m;z[j]+=2*j-1)if(!X(x,0)||!X(y,1)||!X(i,2)||M[Y(x,0)][Y(y,1)][Y(i,2)]!=c)break;
			if(z[1]-z[0]-1>=m){printf("%s %d\n",c==1?"Black":"White",I);goto next;}
		}
	}
	puts("Draw");
next:
	for(;I<p;I++)scanf("%d%d",&x,&y);
}exit(0);}

Measured memory_bytes: 612
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,m,i,j,k,l;
  bool f;
  cin>>n>>m;
  vector<string> a(n),b(m);
  for(i=0;i<n;i++) cin>>a.at(i);
  for(i=0;i<m;i++) cin>>b.at(i);
  for(k=0;k<=n-m;k++){
    for(l=0;l<=n-m;l++){
      f=true;
      for(i=0;i<m;i++){
        for(j=0;j<m;j++){
          if(a.at(i+k).at(j+l)!=b.at(i).at(j)){
            f=false;
            break;
          }
        }
        if(f==false) break;
      }
      if(f==true){
        cout<<"Yes"<<endl;
        return 0;
      }
    }
  }
  cout<<"No"<<endl;
    
}

Measured memory_bytes: 3616