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

#define LL long long
#define pii pair<LL, LL>
#define mp make_pair

const int maxN = 2e5 + 10, mod = 1e9 + 7;

int n, pw[maxN + 1];

map<pii, int> f;

inline LL gcd(LL x, LL y)
{
	LL r = x % y;
	while(r) { x = y; y = r; r = x % y; }
	return y;
}

int main()
{
	scanf("%d", &n);

	pw[0] = 1;
	for(int i = 1; i <= n; i++) pw[i] = 2ll * pw[i - 1] % mod;
	
	int ans = 1, res = 0;
	for(int i = 1; i <= n; i++)
	{
		LL x, y;
		scanf("%lld %lld", &x, &y);
		if(!x && !y) { res ++; continue; }
		if(!x) { f[ mp(0, 1) ] ++; continue; }
		if(!y) { f[ mp(1, 0) ] ++; continue; }
		LL g = gcd(abs(x), abs(y));
		x /= g; y /= g;
		if(x < 0) x = -x, y = -y;
		f[ mp(x, y) ] ++;
	}

	for(map<pii, int>::iterator it = f.begin(); it != f.end(); it++)
	{
		LL x = (it -> first).first, y = (it -> first).second;
		if((it -> second) == -1) continue;
		LL nx = -y, ny = x;
		if(nx < 0) nx = -nx, ny = -ny;
		int t = (1ll * pw[it -> second] + pw[ f[ mp(nx, ny) ] ] - 1) % mod;
		ans = 1ll * ans * t % mod;
		it -> second = f[ mp(nx, ny) ] = -1;
	}

	ans = ((ans + res - 1) % mod + mod) % mod;
	printf("%d\n", ans);
	return 0;
}


Measured memory_bytes: 29600
import math
a,b,x=map(int,input().split())
s=(a**2)*b/2
b_=0
a_=0
if x==s:
  print(math.degrees(math.atan(b/a)))
elif x>=s:
  b_=(x-s)*2/(a**2)
  b=b-b_
  print(math.degrees(math.atan(b/a)))
else:
  a_=x*2/(a*b)
  print(math.degrees(math.atan(b/a_)))


Measured memory_bytes: 38384
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <assert.h>
#include <queue>
#include <functional>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define pb push_back
#define fi first
#define sc second
#define mp make_pair
typedef pair<int,int> P;
typedef pair<int,P> Q;
typedef pair<double,Q> R;

double dist[32][32][32];
int n,m;
int s,g;
int x[1095],y[1095],d[1095],c[1095];
vector<Q>vec[32];

int main(){
	while(1){
		cin>>n>>m;if(n==0) return 0;
		cin>>s>>g;
		for(int i=1;i<=n;i++) vec[i].clear();
		rep(i,m){
			cin>>x[i]>>y[i]>>d[i]>>c[i];
			vec[x[i]].push_back(mp(y[i],mp(d[i],c[i])));
			vec[y[i]].push_back(mp(x[i],mp(d[i],c[i])));
		}
		rep(i,32)rep(j,32)rep(k,32) dist[i][j][k] = 1e9;
		
		priority_queue<R,vector<R>,greater<R> >que;
		for(int i=0;i<vec[s].size();i++){
			double D = (double)(vec[s][i].sc.fi);
			dist[s][vec[s][i].fi][1] = D;
			que.push(mp(D,mp(s,mp(vec[s][i].fi,1))));
		}
		while(!que.empty()){
			R r = que.top(); que.pop();
			int pre = r.sc.fi;
			int cur = r.sc.sc.fi;
			int v = r.sc.sc.sc;
			if(r.fi > dist[pre][cur][v]+1e-12) continue;
			for(int x=max(1,v-1);x<=v+1;x++){
				for(int i=0;i<vec[cur].size();i++){
					if(vec[cur][i].fi == pre) continue;
					if(vec[cur][i].sc.sc < x) continue;
					double need = (double)(vec[cur][i].sc.fi)/(double)(x);
					if(dist[cur][vec[cur][i].fi][x] > dist[pre][cur][v]+need+1e-12){
						dist[cur][vec[cur][i].fi][x] = dist[pre][cur][v]+need;
						que.push(mp(dist[cur][vec[cur][i].fi][x],mp(cur,mp(vec[cur][i].fi,x))));
						
						
					}
				}
			}
		}
		double ans = 1e9;
		for(int i=1;i<=n;i++) for(int j=0;j<32;j++) ans = min(ans,dist[i][g][1]);
		if(ans > 5e8) puts("unreachable");
		else {printf("%.12f",ans);puts("");}


	}
}



Measured memory_bytes: 3804
#include <iostream>
#include <vector>
#include <algorithm>
#include <climits>
#include <cmath>



using namespace std;



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

  if(e-a>k){
    cout << ":(" << endl;
  }else{
    cout << "Yay!" << endl;
  }


  return 0;
}


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

ans = 0
x_min = max(0, s - k - k) 
x_max = min(k, s)
for x in range(x_min, x_max + 1):
    y_min = max(0, s - x - k)
    y_max = min(k, s - x)
    ans += y_max - y_min + 1
print(ans)


Measured memory_bytes: 9172
import java.io.*;
import java.util.*;
public class Main{
 public static void main(String args[]){
  BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
  String str;
  try{
   while((str=br.readLine())!=null){;
    StringTokenizer st=new StringTokenizer(str);
    Double a=Double.parseDouble(st.nextToken());
    Double b=Double.parseDouble(st.nextToken());
    Double c=Double.parseDouble(st.nextToken());
    Double d=Double.parseDouble(st.nextToken());
    Double e=Double.parseDouble(st.nextToken());
    Double f=Double.parseDouble(st.nextToken());
    Double x;
    Double y;
    x=((c*e)-(b*f))/((a*e)-(b*d));
    y=((c*d)-(a*f))/((b*d)-(a*e));
    if(x==0){
     x=Math.abs(x);
    }
    if(y==0){
     y=Math.abs(y);
    }
    System.out.printf("%4.3f %4.3f\n",x,y);
   }
  }catch(Exception e){
  }
 }
}

Measured memory_bytes: 17036
# include <bits/stdc++.h>
# define rep(i, n) for(ll i = 0; i < (n); ++i)
# define reps(i, n) for(ll i=1, i##_len=(n); i<=i##_len; ++i)
# define rrep(i, n) for(ll i=((int)(n)-1); i>=0; --i)
# define rreps(i, n) for(ll i=((int)(n)); i>0; --i)
# define ll long long
# define ALL(x) (x).begin(), (x).end()
# define SZ(x) ((int)(x).size())
# define pb push_back
# define optimize_cin() cin.tie(0); ios::sync_with_stdio(false)
# define P pair<int, int>
# define mp make_pair
# define x first
# define y second
using namespace std;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int main() {
  int n; cin >> n;
  vector<int> v(n);
  rep(i, n) cin >> v[i];

  sort(ALL(v));
  int ans = v[n/2] - v[n/2 - 1];
  cout << ans << endl;
}


Measured memory_bytes: 3784
#include <iostream>
#include <bits/stdc++.h>
#include <algorithm>

using namespace std;

char in[120];

pair<pair<string,int>,int> p[110];

int main(){
int a;
cin >> a;
  
for(int i=0;i<a;i++){
  
int t;
  scanf("%s%d",in,&t);
string tmp=in;
p[i]=make_pair(make_pair(in,-t),i);
}
std::sort(p,p+a);
for(int i=0;i<a;i++)printf("%d\n",p[i].second+1);
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define fs first
#define sc second
typedef pair<ll, ll> l_l;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int main(){
  string s;
  cin>>s;
  while(1){
    s.pop_back();
    s.pop_back();
    if(s.substr(0,s.size()/2)==s.substr(s.size()/2)) break;
  }
  cout<<s.size()<<endl;
}

Measured memory_bytes: 384
//#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>

using namespace std;

//vector string deque break continue
#define forn(i, s, f) for (int i = (int)s; i < (int)f; i++)
#define ll long long
#define ull unsigned long long
#define ld long double
#define pii pair <int, int>
#define fs first
#define sc second
#define pf push_front
#define pb push_back
#define pop_f pop_front
#define pop_b pop_back
#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x).size()

#ifdef DEBUG
#else
    #define cerr if (false) cerr
#endif

template <typename T> istream& operator>>(istream& in, vector <T>& a) {for (auto& i : a) in >> i; return in;}
template <typename T> ostream& operator<<(ostream& out, vector <T>& a)  {for (auto& i : a) out << i << " "; return out;}
template <typename T, typename U> void chkmin(T& a, U b) {if (a > b) a = b;}
template <typename T, typename U> void chkmax(T& a, U b) {if (a < b) a = b;}

const int N = 1e2;

int main() {
    ios_base::sync_with_stdio(0), cin.tie(0);
    int n;
    cin >> n;
    vector <int> ans(1e6);
    forn (i, 1, N + 1)
        forn (j, 1, N + 1)
            forn (k, 1, N + 1)
                ans[i * i + j * j + k * k + 
                    i * j + j * k + k * i] += 1;
    forn (i, 1, n + 1)
        cout << ans[i] << "\n";
    return 0;
}

Measured memory_bytes: 7152
#include <bits/stdc++.h>
typedef long long intl;
#define rep(i, n) for(intl i = 0; i < (intl)(n); i++)
#define repd(i, n) for(intl i = (intl)(n) - 1; i >= 0; i--)
#define repi(i, a, b) for(intl i = (intl)(a); i < (intl)(b); i++)
#define max(a, b) ((a) > (b) ? (a) : (b))
#define min(a, b) ((a) < (b) ? (a) : (b))
#define INF = 1e9;
using namespace std;
int main(){
    intl n;
    cin >> n;
    intl a[n];
    rep(i, n){
        cin >> a[i];
    }
    sort(a,a + n);
    bool flag = true;
    rep(i, n-1){
        if(a[i] == a[i+1]){
            flag =false;
            break;
        }
    }
    if(flag)cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}

Measured memory_bytes: 1792
import java.util.Scanner;

class Main{

	public static void main(String[] args){

		Scanner sc =new Scanner(System.in);

		int n=sc.nextInt();
		int R[];
		R=new int[n];

		for(int i=0;i<n;i++) 
			R[i]=sc.nextInt();

		int max=R[1]-R[0];
		int min=R[0];

		for(int i=0;i<n;i++) {
			if(R[i]<min) min=R[i];
			for(int j=i+1;j<n;j++)
				if (min<R[i]) break;
				else if(R[j]-R[i]>max)
					max=R[j]-R[i];
		}

		System.out.println(max);

	}

}


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

using namespace std;

const int maxn = 1e5 + 5;
const int mod = 1e9 + 7;
long long fac[maxn];
long long inv[maxn];
void pre()
{
    fac[0] = 1;
    inv[0] = 1;
    inv[1] = 1;
    fac[1] = 1;
    for(int i=2; i < maxn; i++)
    {
        fac[i] = fac[i - 1] * i % mod;
        inv[i] = mod - (mod / i * inv[mod % i]) % mod;
    }
//    for(int i=2; i< maxn; i++)
//        inv[i] = inv[i - 1] * inv[i] % mod;
}
int a[maxn];
int main()
{
    int n;
    pre();
    scanf("%d",&n);
    long long sum = 0;
    for(int i=1; i <= n; i++)
    {
        int x;
        scanf("%d", a + i);
        sum = sum + a[i];
        if(sum >= mod) sum -= mod;
    }
    long long ans = sum * fac[n] % mod;
    sum = 0;
    for(int i=1; i <= n; i++)
    {
        ans = (ans + sum * a[i]) % mod;
        sum = (sum + fac[n] * inv[i + 1]) % mod;
    }
    sum = 0;
    for(int i=n; i >= 1; i--)
    {
        ans = (ans + sum * a[i]) % mod;
        sum = (sum + fac[n] * inv[n - i + 2]) % mod;
    }
    printf("%lld\n",ans % mod);
    return 0;
}


Measured memory_bytes: 2176
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int D = sc.nextInt();
		int[] c = new int[26];
		int[][] s = new int[D][26];
		for (int i=0;i<D;i++) {
			int max_val = 0;
			int max_ind = 0;
			for (int j=0;j<26;j++) {
				s[i][j] = sc.nextInt();
				if (max_val<s[i][j]) {
					max_val = s[i][j];
					max_ind = j;
				}
			}
			System.out.println(max_ind+1);
		}
	}
}

Measured memory_bytes: 46908
//
//AtCoder Beginner Contest 142
//B - Roller Coaster
//

#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <ctime>
#include <queue>
#include <map>
#include <set>
#include <tuple>
#include <functional>
#include <cassert>

using namespace std;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define SIZE(x) (int)(x).size()
#define SIZEL(x) (ll)(x).size()
#define MSG(a) cout << #a << " " << a << endl;

using ll = long long;
using ld = long double;

const double PI = 3.14159265358979323846;

ll gcd(ll x, ll y) { return (x % y)? gcd(y, x % y): y; }    //最大公約数
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }            //最小公倍数

int main()
{
    int n, k;

    cin >> n >> k;

    vector<int> h(n);
    REP(i, n) cin >> h[i];

    int ans = 0;
    REP(i, n) if (h[i]>=k) ans++;
    cout << ans << endl;
    return 0;
}


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

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  string S;
  cin >> S;
  int res1 = 0;
  // 010101
  for (int i = 0; i < S.size(); i++) {
    if (i % 2 == 0 && S[i] == '1')
      res1++;
    else if (i % 2 == 1 && S[i] == '0')
      res1++;
  }

  int res2 = 0;
  // 101010
  for (int i = 0; i < S.size(); i++) {
    if (i % 2 == 0 && S[i] == '0')
      res2++;
    else if (i % 2 == 1 && S[i] == '1')
      res2++;
  }

  cout << min(res1, res2) << '\n';
  return 0;
}


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

#define For(i, j, k) for (int i = j; i <= k; i++)

using namespace std;

int main() {

	int n, k;
	scanf("%d%d", &n, &k);

	if (!k) {
		printf("%lld\n", 1ll * n * n);
		return 0;
	}

	long long ans = 0;
	
	For(i, k + 1, n) {
		ans += 1ll * (n / i) * (i - k);
		ans += max(0, n % i - (k - 1));
	}
	printf("%lld\n", ans);

	return 0;
}

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

int main() {
    std::string s; std::cin >> s;
    std::vector<char> l;
    for (const auto c :s) {
        if (c == 'B') {
            if (l.size() > 0) {
                l.pop_back();
            }
        } else {
            l.push_back(c);
        }
    }
    for (const auto ll: l) {
        std::cout << ll;
    }
    std::cout << std::endl;

    return 0;
}


Measured memory_bytes: 504
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define INF 100000000
using namespace std;
const int mod = 1000000007;

int main() {

  string N;
  cin>>N;
  if(N[0]=='7'||N[1]=='7'||N[2]=='7')cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
  //vector<int> A(N);
  //for(int i=0; i<N; i++){cin>>A[i];}
  //vector<vector<int>> A(N,vector<int>(M));
  //for(int i=0; i<N; i++){for(int j=0; j<M; j++){cin>>A[i][j];}}
  //sort(A.begin(),A.end());
  //for (int i = 0; i < N; i++) { maximum = max(maximum , A[i]);}
  //for (int i = 0; i < N; i++) { minimum = min(minimum , A[i]);}
  //cout <<  << endl;
}


Measured memory_bytes: 3588
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.Set;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;


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);
        TaskT solver = new TaskT();
        solver.solve(1, in, out);
        out.close();
    }
    
    

    static class TaskT {
    	static int counter = 0;
        public void solve(int testNumber, InputReader in, PrintWriter out) {

        	BigInteger a = BigInteger.valueOf(in.nextInt()); 
        	BigInteger b = BigInteger.valueOf(in.nextInt()); 
        	
        	BigInteger c = BigInteger.valueOf(in.nextInt()); 
        	BigInteger d = BigInteger.valueOf(in.nextInt()); 
        	
        	BigInteger max_product_pair = a.multiply(c);
        	
        	max_product_pair = max_product_pair.max(a.multiply(c));
        	max_product_pair = max_product_pair.max(a.multiply(d));
        	max_product_pair = max_product_pair.max(b.multiply(c));
        	max_product_pair = max_product_pair.max(b.multiply(d));

        	out.print(max_product_pair);
        }
        
     
        
        

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }
        
        public long nextLong() {
            return Long.parseLong(next());
        }
    }
}



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

using namespace std;
typedef long long ll;

#define rep(i , j , n) for(long long i = j ; i <= n ; i++)
const ll N = 123456;

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

    int k , x;
    cin >> k >> x;

    for(int i = x - k + 1 ; i <= x + k - 1 ; i++) {
        cout << i << " ";
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define pw (ll)pow 
#define MAX 1000005
using namespace std;

int main()	
{
	int a[5];
	for(int i=0; i<5; i++)	cin >> a[i];
	for(int i=0; i<5; i++)	if(a[i]==0)	{cout << i+1 << endl; break;}
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
int x,y;string a,b,c;
int main()
{
	cin>>a>>b;scanf("%d %d",&x,&y);
	cin>>c;if(a==c) --x;else --y;
	printf("%d %d\n",x,y);return 0;
}

Measured memory_bytes: 256
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    n, m = list(map(int, readline().split()))
    restriction = [list(map(int, readline().split())) for _ in range(m)]

    # n桁の数字の下限と上限 [begin,end)
    begin = (None, 0, 10, 100)
    end = (None, 10, 100, 1000)

    for num in range(begin[n], end[n]):
        flag = True
        numstr = str(num)
        for i in range(m):
            s_idx = restriction[i][0] - 1  # 左から数えた桁数を-1してインデックスにする
            c_str = str(restriction[i][1])  # 数字
            if numstr[s_idx] != c_str:
                flag = False
        if flag:
            print(num)
            sys.exit()

    print(-1)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func Scanner() string {
	sc.Scan()
	return sc.Text()
}

func intScanner() int {
	n, _ := strconv.Atoi(Scanner())
	return n
}

func floatScanner() float64 {
	n, _ := strconv.ParseFloat(Scanner(), 64)
	return n
}
func stringToInt(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}
func stringSliceScanner(n int) []string {
	a := make([]string, n)
	for i := 0; i < n; i++ {
		a[i] = Scanner()
	}
	return a
}
func intSliceScanner(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = intScanner()
	}
	return a
}
func larger(a, b int) int {
	if a < b {
		return b
	} else {
		return a
	}
}
func smaller(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}
func max(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x < a[i] {
			x = a[i]
		}
	}
	return x
}
func min(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x > a[i] {
			x = a[i]
		}
	}
	return x
}
func abs(x int) int {
	if x < 0 {
		x = -x
	}
	return x
}

var mod int
var t float64

func main() {
	mod = 1000000007
	buf := make([]byte, 0)
	sc.Buffer(buf, mod)
	sc.Split(bufio.ScanWords)
	n := intScanner()
	m := intScanner()
	uf := newUnionFind(n + m)
	for i := 0; i < n; i++ {
		k := intScanner()
		for j := 0; j < k; j++ {
			l := intScanner() - 1
			uf.unite(l+n, i)
		}
	}
	c := 0
	for i := n; i < n+m; i++ {
		if uf.root(i) == i {
			c++
		}
	}
	if uf.size(0)+c == n+m {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}

type UnionFind struct {
	par []int
}

func newUnionFind(N int) *UnionFind {
	u := new(UnionFind)
	u.par = make([]int, N)
	for i := range u.par {
		u.par[i] = -1
	}
	return u
}
func (u UnionFind) root(x int) int {
	if u.par[x] < 0 {
		return x
	}
	u.par[x] = u.root(u.par[x])
	return u.par[x]
}
func (u UnionFind) unite(x, y int) {
	xr := u.root(x)
	yr := u.root(y)
	if xr == yr {
		return
	}
	u.par[yr] += u.par[xr]
	u.par[xr] = yr
}
func (u UnionFind) same(x, y int) bool {
	if u.root(x) == u.root(y) {
		return true
	}
	return false
}
func (u UnionFind) size(x int) int {
	return -u.par[u.root(x)]
}


Measured memory_bytes: 17616
using namespace std;
#include<bits/stdc++.h>
// #include<iostream>
// #include<string>
// #include<vector>
// #include<set>
// #include<map>
// #include<algorithm>
#define BEGIN ios_base::sync_with_stdio(0);cin.tie(0)
#define END return EXIT_SUCCESS
#define FOR(I,A,B) for((I)=(A);(I)<(B);(I)++)
#define REP(I,N) FOR((I),0,(N))
#define UP(I,A,B) for((I)=(A);(I)<=(B);(I)++)
#define DW(I,A,B) for((I)=(A);(I)>=(B);(I)--)
#define IN(P) cin>>(P)
#define IN2(P1,P2) cin>>(P1)>>(P2)
#define IN3(P1,P2,P3) cin>>(P1)>>(P2)>>(P3)
#define IN4(P1,P2,P3,P4) cin>>(P1)>>(P2)>>(P3)>>(P4)
#define INS(I,N,V) REP((I),(N))cin>>(V[I])
#define INS2(I,N,V1,V2) REP((I),(N))cin>>(V1[I])>>(V2[I]);
#define INS3(I,N,V1,V2,V3) REP((I),(N))cin>>(V1[I])>>(V2[I])>>(V3[I]);
#define OUT(P) cout<<(P)<<endl
#define OUT2(P1,P2) cout<<(P1)<<" "<<(P2)<<endl
#define OUT3(P1,P2,P3) cout<<(P1)<<" "<<(P2)<<" "<<(P3)<<endl
#define OUT4(P1,P2,P3,P4) cout<<(P1)<<" "<<(P2)<<" "<<(P3)<<" "<<(P4)<<endl
#define OUTS(I,N,V) REP((I),(N))cout<<(V[i])<<endl
#define ALL(C) (C).begin(),(C).end()
#define RALL(C) (C).rbegin(),(C).rend()
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
template<class T>inline bool chmax(T& a,T b){if(a<b){a=b;return true;}return false;}
template<class T>inline bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;}

int N,M,C,i,j,B[20],A,sum,cnt;
inline void solve(void){
  IN3(N,M,C);
  INS(i,M,B);
  REP(i,N){
    sum=C;
    REP(j,M){
      IN(A);
      sum+=A*B[j];
    }
    if(sum>0)cnt++;
  }
  OUT(cnt);
}

int main(int argc,char**argv){
  BEGIN;
  solve();
  END;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,...) for(int i = (a)*(strlen(#__VA_ARGS__)!=0);i<(int)(strlen(#__VA_ARGS__)?__VA_ARGS__:(a));++i)
#define per(i,a,...) for(int i = (strlen(#__VA_ARGS__)?__VA_ARGS__:(a))-1;i>=(int)(strlen(#__VA_ARGS__)?(a):0);--i)
#define foreach(i, n) for(auto &i:(n))
#define pii pair<int, int>
#define pll pair<long long, long long>
#define all(x) (x).begin(), (x).end()
#define bit(x) (1ll << (x))
using ll = long long;
//const ll MOD = (ll)1e9+7;
const ll MOD = 998244353;
const int INF = (ll)1e9+7;
const ll INFLL = (ll)1e18;
using namespace std;
template<class t>
using vvector = vector<vector<t>>;
template<class t>
using vvvector = vector<vector<vector<t>>>;
template<class t>
using priority_queuer = priority_queue<t, vector<t>, greater<t>>;
template<class t, class u> bool chmax(t &a, u b){if(a<b){a=b;return true;}return false;}
template<class t, class u> bool chmin(t &a, u b){if(a>b){a=b;return true;}return false;}
#ifdef DEBUG
#define debug(x) cout<<"LINE "<<__LINE__<<": "<<#x<<" = "<<x<<endl;
#else
#define debug(x) (void)0
#endif

ll modpow(ll x, ll b){
    ll res = 1;
    while(b){
        if(b&1)res = res * x % MOD;
        x = x * x % MOD;
        b>>=1;
    }
    return res;
}

ll modinv(ll x){
    return modpow(x, MOD-2);
}

bool was_output = false;
template<class t>
void output(t a){
    if(was_output)cout << " ";
    cout << a;
    was_output = true;
}
void outendl(){
    was_output = false;
    cout << endl;
}
ll in(){
    ll res;
    scanf("%lld", &res);
    return res;
}

template<class t>
istream& operator>>(istream&is, vector<t>&x){
    for(auto &i:x)is >> i;
    return is;
}

template<class t, class u>
istream& operator>>(istream&is, pair<t, u>&x){
    is >> x.first >> x.second;
    return is;
}

int main(){
    ll n = in();
    ll T = in();
    vector<pll> line(n);
    cin >> line;

    vector<ll> zeros;
    foreach(i,line)if(i.first==0)zeros.push_back(i.second);
    sort(all(zeros));

    {
        vector<pll> next;
        foreach(i,line)if(i.first!=0)next.push_back(i);
        line = next;
    }

    sort(all(line),[](pll a,pll b){
            return a.first * (1+b.second) > b.first * (1+a.second);});

    n = line.size();
    vvector<ll> dp(n+1,vector<ll>(40,T+1));
    dp[0][0] = 0;
    rep(i,n){
        rep(j,39){
            chmin(dp[i+1][j+1],dp[i][j]+1+(dp[i][j]+1)*line[i].first+line[i].second);
            chmin(dp[i+1][j],dp[i][j]);
        }
    }

    ll ans = 0;
    rep(i,40){
        ll rem = T - dp[n][i];
        if(rem<0)continue;
        int sum = i;
        foreach(j,zeros){
            if(rem>=j+1){
                rem -= j+1;
                ++sum;
            }
        }
        chmax(ans,sum);
    }

    cout << ans << endl;
    return 0;

}


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

int main(){
    int n;
    cin >> n;
    vector<string> s(n);
    vector<pair<int,string>> a;
    rep(i, n){
        cin >> s[i];
    }
    sort(s.begin(), s.end());

    s.push_back(" ");

    int cnt = 1, cntmax = 1;
    rep(i, n){
        if (s[i] == s[i + 1]) cnt++;
        else {
            pair<int, string> p = make_pair(cnt, s[i]);
            a.push_back(p);
            cntmax = max(cnt, cntmax);
            cnt = 1;
        }
    }
    sort(a.begin(), a.end());
    rep(i, a.size()){
        if (a[i].first == cntmax) cout << a[i].second << endl;
    }
}


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

int main() {
	ll n;
	cin >> n;

	string ans;
	while (n >= 1) {
		char c;
		int r = (n % 26);
		if (r == 0) {
			c = 'z';
			n -= 1LL;
		} else {
			c = r + 'a' - 1;
		}
		ans = c + ans;
		n /= 26LL;
	}

	cout << ans;
	
	return 0;
}
	

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

int main() {
  int r;
  cin >> r;
  cout << r * r << endl;
  return 0;
}

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

constexpr long long MOD = 1'000'000'007;

class binomial_coefficients {
	long long MAX_VAL;
	vector<long long> fac, mmi;

public:

	binomial_coefficients(){
	}
	
	binomial_coefficients(long long num){
		init(num);
	}
	
	~binomial_coefficients(){
		
	}
	
	void init(long long num){
		MAX_VAL = num+1; 
		fac.resize(MAX_VAL);
		mmi.resize(MAX_VAL);
		
		factorial_mod();
		modular_multiplicatibe_inverse();
	}
	
	void factorial_mod(){
		 fac[0] = 1;
		for(long long i = 1; i < MAX_VAL; fac[i] %= MOD, i++)
			fac[i] = fac[i - 1] * (i % MOD);
	}
	
	long long power(long long x, long long n){
		long long ans = 1;
		for(;n;n >>= 1, x *= x, ans %= MOD, x %= MOD)
			if(n&1)ans*=x;
		return ans % MOD;
	}
	
	void exgcd(long long a, long long b, long long &x, long long &y){
		if(b == 0){
			x = 1;
			y = 0;
			return ;
		}
		exgcd(b, a % b, y, x);
		y -= a / b * x;
	}
	
	void modular_multiplicatibe_inverse(){
		long long x, y;  
		exgcd(fac[MAX_VAL - 1], MOD, x, y);
		mmi[MAX_VAL-1] = (x % MOD + MOD) % MOD;
		// mmi[MAX_VAL-1] = power(fac[MAX_VAL-1], MOD-2);
		for(long long i = MAX_VAL - 2; i >= 0; mmi[i]%=MOD, i--)
			mmi[i] = mmi[i + 1] * ((i + 1) % MOD);
	}
	
	long long combination(long long n, long long r){
		return n < r ? 0 :fac[n] * (mmi[r] * mmi[n-r] % MOD) % MOD;
	}
};


int main(){
	
	long long n, k;
	long long ans = 0;
	binomial_coefficients bc;
	
	cin>>n>>k;
	
	bc.init(n+k);
	
	
	ans = bc.combination(k, n);
	
	cout<<ans<<endl;
}


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

int main(){
	int N;
	cin >> N;
	int i, a[N];
	for(i=0; i<N; i++){
		cin >> a[i];
	}
	
	int j, tmp;
	for(i=0; i<N-1; i++){
		for(j=0; j<N-1; j++){
			if(a[j]<a[j+1]){
				tmp = a[j];
				a[j] = a[j+1];
				a[j+1] = tmp;
			}
		}
	}
	
	int ans=0;
	for(i=0; i<N; i++){
		if(i%2==0)	ans += a[i];
		else		ans -= a[i];
	}
	
	cout << ans << endl;
	return 0;
}



Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import sys
from collections import deque, defaultdict
from math import sqrt, factorial, gcd, ceil
# def input(): return sys.stdin.readline()[:-1] # warning not \n
# def input(): return sys.stdin.buffer.readline().strip() # warning bytes
# def input(): return sys.stdin.buffer.readline().decode('utf-8')
import string
# string.ascii_lowercase
from bisect import bisect_left
MOD = int(1e9)+7
INF = float('inf')


def solve():
    # n, m = [int(x) for x in input().split()]
    n, m, k = [int(x) for x in input().split()]
    s = set()
    for i in range(n+1):
        for j in range(m+1):
            x = m * i + n * j - 2 * (i * j)
            s.add(x)

    if k in s:
        print("Yes")
    else:
        print("No")


t = 1
# t = int(input())
for case in range(1,t+1):
    ans = solve()


"""

azyxwvutsrqponmlkjihgfedcb

"""


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

#define abs(x) (0<=(x)?(x):-(x))

int main() {

  int N, X, Y;
  cin >> N >> X >> Y;

  int count[N] = {0};
  int i, j, dis;
  
  for(i=1; i < N; ++i) {
    for(j=i+1; j <= N; ++j) {
      dis = min(min(j-i, abs(X-i) + 1 + abs(j-Y)), abs(Y-i) + 1 + abs(j-X));
      ++count[dis];
    }
  }
  
  for(i=1; i < N; ++i)
    cout << count[i] << endl;
  
  
  return 0;
}


Measured memory_bytes: 256
/*
#include <iostream>
#include <fstream>
#include <stdio.h>
#include <math.h>
#include <time.h>
#include <string>
#include <tuple>
#include <vector>
#include <map>
#include <list>
#include <set>
#include <stack>
#include <queue>
#include <cstdlib>
#include <algorithm>
#include <random>
#include <cassert>
using namespace std;
#define LL long long
#undef INT_MIN
#undef INT_MAX
#define INT_MIN -2147483648
#define INT_MAX 2147483647
#define LL_MIN -9223372036854775808
#define LL_MAX 9223372036854775807
#define segment_size 65536
#define ROOP() while (true)

int main(){
    
    
    
    return 0;
}
*/

#include <iostream>
#include <fstream>
#include <stdio.h>
#include <math.h>
#include <time.h>
#include <string>
#include <tuple>
#include <vector>
#include <map>
#include <list>
#include <set>
#include <stack>
#include <queue>
#include <cstdlib>
#include <algorithm>
#include <random>
#include <cassert>
using namespace std;
#define LL long long
#undef INT_MIN
#undef INT_MAX
#define INT_MIN -2147483648
#define INT_MAX 2147483647
#define LL_MIN -9223372036854775808
#define LL_MAX 9223372036854775807
#define segment_size 65536
#define ROOP() while (true)

int main(){
    
    int A,B,X;
    cin >> A >> B >> X;

    int ans = INT_MAX;
    for(int i=0; i<100; i++){
        for(int j=0; j<100; j++){
            if(1000*i + 500*j >= X) ans = min(ans, A*i+B*j);
        }
    }

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


Measured memory_bytes: 3100
fn main() {
    let s = {
        let mut s = String::new();
        std::io::stdin().read_line(&mut s).unwrap();
        s.trim_right().to_owned()
    };

    let(t, x) = {
        let mut ws = s.split_whitespace();
        let t: i32 = ws.next().unwrap().parse().unwrap();
        let x: i32 = ws.next().unwrap().parse().unwrap();
        (t, x)
    };

    let t_f: f64 = t as f64;
    let x_f: f64 = x as f64;

    println!("{}", t_f / x_f);
}

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

A = [int(i) for i in input().split()]

ans = 0
A_min = 10 ** 10
if len([a for a in A if a < 0]) % 2 == 0:
    for a in A:
        ans += abs(a)
    print(ans)
else:
    for a in A:
        ans += abs(a)
        A_min = min(abs(a), A_min)
    print(ans - 2 * A_min)

Measured memory_bytes: 14284
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using pint = pair<int,  int>;
using pll = pair<ll, ll>;
using edge = pair<int, ll>;
using Graph = vector<vector<int>>; 
using WeightedGraph = vector<vector<edge>>;
const ll INF = 1LL << 60;
const int INF32 = 1 << 29;
const ll MOD = 1000000007;

int main(){
  int n; cin >> n;
  vector<int> a(n), p(n), q(n);
  iota(a.begin(),a.end(),1);
  for(int i = 0; i < n; ++i) cin >> p[i];
  for(int i = 0; i < n; ++i) cin >> q[i];
  int t1, t2;
  int cnt = 0;
  do{
    if(a==p)t1 = cnt;
    if(a==q)t2 = cnt;
    ++cnt;
  }while(next_permutation(a.begin(), a.end()) );
  cout << abs(t1-t2) << endl;
}


Measured memory_bytes: 256
n, k = list(map(int, input().split()))
cnt = 0

for i in range(k, n + 2):
    minimum = (i - 1) * i // 2
    maximum = (2 * n - i + 1) * i // 2
    cnt += maximum - minimum + 1
    cnt %= 10 ** 9 + 7

print(cnt)

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

int main() {
	int N, H, ans = 1, tmp;
	cin >> N >> tmp;
	for (int i = 1; i < N; ++i) {
		cin >> H;
		if (H >= tmp) ++ans;
		tmp = max(H, tmp);
	}
	cout << ans;
}

Measured memory_bytes: 256
//start of sethsahin' template
#include <bits/stdc++.h>

#define LL long long
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x) (x).begin(), (x).end()
#define REP(i,a,b) for (int i = a; i <= b; i++)
#define SQ(a) a*a

using namespace std;

inline int nxt(){
  int x;
  scanf("%d",&x);
  return x;
}
//end of sethsahin template

int main(){                   
	
	ios::sync_with_stdio(0);	
	cin.tie(0);
	string s;
	cin >> s;
	int n = s.size();
	int cnt = 0;
	for(int i = 1; i < n - 1 ; i++){
		cnt++;
	}

	cout << s[0] <<cnt << s[n-1] <<endl;
		
	return 0;
}












Measured memory_bytes: 256
import math


def f(b: int, n: int) -> int:
    if b > n:
        return n
    return f(b, n // b) + (n % b)


def digit_sum(n: int, s: int) -> int:
    if n == s:
        return n + 1

    sqrt = math.sqrt(n)
    sqrt = math.ceil(sqrt)

    for b in range(2, sqrt + 1):
        if f(b, n) == s:
            return b

    for p in range(sqrt, 0, -1):
        if (n - s) % p:
            continue

        b = (n - s) // p + 1

        if b < 2:
            continue

        if f(b, n) == s:
            return b

    return -1


if __name__ == "__main__":
    n = int(input())
    s = int(input())
    ans = digit_sum(n, s)
    print(ans)


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/hash_policy.hpp>
#define __gnu_pbds::gp_hash_table unordered_map;
#define int long long int
#define pb push_back
int gcd(int a, int b) 
{ 
    if (b == 0) 
        return a; 
    return gcd(b, a % b);  
      
} 
   
signed main(){
ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

int a,b;
cin>>a>>b;
int c=(a*b)/gcd(a,b);
cout<<c;


}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#define MAX 1000000

typedef struct{
  char name[10];
  int time;
}Queue;
Queue new[MAX];

int main(){
  int n, q, count=0;
  int i, front, rear;
  Queue temp;

  scanf("%d %d",&n, &q);
  for(i = 0 ; i < n ; i++){
    scanf("%s %d",temp.name, &temp.time);
    new[i] = temp;
  }
  front = 0;
  rear = n;
  while(front != rear){
    temp = new[front];
    front++;
    if(temp.time <= q){
      count += temp.time;
      printf("%s %d\n",temp.name, count);
    }else{
      count += q;
      temp.time -= q;
      new[rear] = temp;
      rear ++;
    }
  }
return 0;
}

Measured memory_bytes: 4660
#include"bits/stdc++.h"
using namespace std;
#pragma warning(disable:4996)



int main() {
	int N;cin>>N;
	vector<vector<int>>oks(N,vector<int>(N));
	for (int i = 0; i < N; ++i) {
		for (int j = 0; j < N; ++j) {
			if (i == j) {
				oks[i][j]=false;
			}
			else {
				if (N % 2 == 0) {
					if(i+j==N-1)oks[i][j]=false;
					else oks[i][j]=true;
				}
				else {
					if(i+j==N-2)oks[i][j]=false;
					else oks[i][j]=true;
				}
			}
		}
	}


	vector<pair<int,int>>ps;
	for (int i = 0; i < N; ++i) {
		for (int j = i+1; j < N; ++j) {
			if (oks[i][j]) {
				assert(oks[j][i]);
				ps.emplace_back(i,j);
			}
		}
	}
	set<int>aset;
	for (int i = 0; i < N; ++i) {
		int sum=0;
		for (int j = 0; j < N; ++j) {
			if(oks[i][j])sum+=j+1;
		}
		aset.emplace(sum);
	}
	assert(aset.size()==1);
	cout<<ps.size()<<endl;
	for (int i = 0; i < ps.size(); ++i) {
		cout<<ps[i].first+1<<" "<<ps[i].second+1<<endl;
	}

	return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define GET_MACRO(_1,_2,_3,_4,_5,_6,_7,_8,NAME,...) NAME
#define pr(...) cerr<< GET_MACRO(__VA_ARGS__,pr8,pr7,pr6,pr5,pr4,pr3,pr2,pr1)(__VA_ARGS__) <<endl
#define pr1(a) (#a)<<"="<<(a)<<" "
#define pr2(a,b) pr1(a)<<pr1(b)
#define pr3(a,b,c) pr1(a)<<pr2(b,c)
#define pr4(a,b,c,d) pr1(a)<<pr3(b,c,d)
#define pr5(a,b,c,d,e) pr1(a)<<pr4(b,c,d,e)
#define pr6(a,b,c,d,e,f) pr1(a)<<pr5(b,c,d,e,f)
#define pr7(a,b,c,d,e,f,g) pr1(a)<<pr6(b,c,d,e,f,g)
#define pr8(a,b,c,d,e,f,g,h) pr1(a)<<pr7(b,c,d,e,f,g,h)
#define prArr(a) {cerr<<(#a)<<"={";int i=0;for(auto t:(a))cerr<<(i++?", ":"")<<t;cerr<<"}"<<endl;}
using namespace std;
using Int = long long;
using _int = int;
using ll = long long;
using Double = long double;
const Int INF = (1LL<<60)+1e9; // ~ 1.15 * 1e18
const Int mod = (1e9)+7;
const Double EPS = 1e-8;
const Double PI = 6.0 * asin((Double)0.5);
using P = pair<Int,Int>;
template<class T> T Max(T &a,T b){return a=max(a,b);}
template<class T> T Min(T &a,T b){return a=min(a,b);}
template<class T1, class T2> ostream& operator<<(ostream& o,pair<T1,T2> p){return o<<"("<<p.first<<","<<p.second<<")";}
template<class T1, class T2, class T3> ostream& operator<<(ostream& o,tuple<T1,T2,T3> t){
  return o<<"("<<get<0>(t)<<","<<get<1>(t)<<","<<get<2>(t)<<")";}
template<class T1, class T2> istream& operator>>(istream& i,pair<T1,T2> &p){return i>>p.first>>p.second;}
template<class T> ostream& operator<<(ostream& o,vector<T> a){Int i=0;for(T t:a)o<<(i++?" ":"")<<t;return o;}
template<class T> istream& operator>>(istream& i,vector<T> &a){for(T &t:a)i>>t;return i;}
//INSERT ABOVE HERE

signed main(){
  srand((unsigned)time(NULL));
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  int M, D;
  cin>>M>>D;

  auto check=[&](int m, int d){
    string str = to_string(d);
    if(str.size() == 1) return false;
    int d1 = str[0] - '0';
    int d10 = str[1] - '0';
    return d1 >= 2 && d10 >= 2 && d1 * d10 == m;

  };

  int ans = 0;
  for(int m=1;m<=M;m++){
    for(int d=1;d<=D;d++){
      ans += check(m, d);
    }
  }
  cout<<ans<<endl;

  return 0;
}


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

int main() {
  int A, B, C, D;
  cin >> A >> B >> C >> D;
  while (true) {
    C -= B;
    if (C <= 0) {
      cout << "Yes" << endl;
      return 0;
    }
    A -= D;
    if (A <= 0) {
      cout << "No" << endl;
      return 0;
    }
  }
}

Measured memory_bytes: 3624
N, M=map(int, input().split())
w=[list(map(int, input().split())) for i in range(M)]
R_min=10**6
L_max=0
cnt=0

for i in range(M):
    if w[i][1]<=R_min:
        R_min=w[i][1]

for i in range(M):
    if w[i][0]>=L_max:
        L_max=w[i][0]

for num in range(1, N+1):
    if L_max<= num <= R_min:
        cnt+=1
print(cnt)

Measured memory_bytes: 27328
#include <iostream>
#include <algorithm>
using namespace std;
#define int long long

signed main() {
  int n;
  cin >> n;
  int a[2 * n];
  for (int i = 0; i < 2 * n; i++) {
    cin >> a[i];
  }
  sort(a, a + n * 2);
  int count = 0;
  for (int i = 0; i < 2 * n; i += 2) {
    count += a[i];
  }
  cout << count << endl;
  return 0;
}


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

int main() {
  int N;
  string S;
  cin >> N;

  map<string, int> mp;

  rep(i, N) {
    cin >> S;
    mp[S]++;
  }
  cout << "AC x " << mp["AC"] << endl;
  cout << "WA x " << mp["WA"] << endl;
  cout << "TLE x " << mp["TLE"] << endl;
  cout << "RE x " << mp["RE"] << endl;
  return 0;
}

Measured memory_bytes: 3616
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
int upll(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);}

int main(){
	ll a,b;
	scanf("%lld%lld",&a,&b);
	printf("%lld",--a*--b);
}

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

{
	int t=1;
	//cin >> t;
	while(t--)
	{
		int n;
		cin>> n;
		string s;
		cin>> s;
		int ans=0;
		for(int i=0;i<s.length()-2;i++)
		{
			if(s[i]=='A' && s[i+1]=='B'&& s[i+2]=='C')
			{
				ans++;
			}
		}
		cout<< ans<< endl;

	}
	return 0;
}


Measured memory_bytes: 3584
import heapq
import sys
sys.setrecursionlimit(10**7)
n = int(input())
g = [[] for _ in range(n)]
for i in range(n-1):
    a,b = map(int,input().split())
    g[a-1].append(b-1)
    g[b-1].append(a-1)
c = [-i for i in list(map(int,input().split()))]
heapq.heapify(c)
print(-sum(c)+min(c))

for i in range(n):
    if len(g[i]) == 1:
        start = i
        break

ans = [-1]*n
ans[start] = -heapq.heappop(c)
q = [start]

while q:
    now = q.pop(-1)
    for i in g[now]:
        if ans[i] == -1:
            ans[i] = -heapq.heappop(c)
            q.append(i)

for i in ans:
    print(i)

Measured memory_bytes: 11780
#include <iostream>
using namespace std;
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define endl "\n"
#define mod 1000000007
typedef map<ll, ll> mpll;
typedef map<vector<ll>, ll> mpvl;
int main()
{
  
 int a,b,c,d;
 cin>>a>>b>>c>>d;
 while(true)
 {
     c=c-b;
     if(c<=0)
     {
         break;
     }
     a=a-d;
     if(a<=0)
     {
         break;
     }


 }
 if(c<=0)
 {
     cout<<"Yes";
 }
 else
 {
     cout<<"No";
 }
 



}

Measured memory_bytes: 3592
#include<bits/stdc++.h>
using namespace std;
 
#define pb push_back
#define ll long long
#define maxn 1000005
#define fr(i,j,k) for(int i=j;i<k;i++)
#define f(n) fr(i,0,n)
#define f1(n) fr(i,1,n+1)
#define ms(i) memset(i,0,sizeof(i));
#define ms1(i) memset(i,-1,sizeof(i));
#define F first
#define S second
#define all(x) x.begin(), x.end()
const int mod = 998244353;

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin >> n;
    int ans = 0;
    f1(n) {
        fr(j,1,n+1) {
            fr(k,1,n+1) {
                ans += __gcd(k,__gcd(i,j));
            }
        }
    }
    cout << ans << '\n';
}


Measured memory_bytes: 3608
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
  int j[200005];
  int b[200005];

int main(){
  int n; cin>>n;
  rep(i,n-1){
    cin>>j[i+2];
  }
  

  for(int i=2;i<n+1;i++){
    b[j[i]]++;
  }
  rep(i,n){
    cout<<b[i+1]<<endl;
  }
}


Measured memory_bytes: 5112
package main

import (
	"bufio"
	"fmt"
	"log"
	"os"
	"strconv"
)

func main() {
	scanner := NewScanner()
	n := scanner.NextInt64()
	if n == 1 {
		fmt.Println(0)
		return
	}
	r := 1
	for ; int64(r*r) <= n; r++ {
	}
	ms := make([]bool, r)
	pf := make(map[int64]int)
	for i := 2; i < len(ms); i++ {
		if ms[i] {
			continue
		}
		for j := 1; i*j < len(ms); j++ {
			ms[i*j] = true
		}
		k := int64(i)
		for j := 1; n%k == 0; j++ {
			n /= k
			pf[k] += 1
		}
	}
	if n > 1 {
		pf[n] = 1
	}
	count := 0
	for _, v := range pf {
		for i := 1; i <= v; i++ {
			v -= i
			count++
		}
	}
	fmt.Println(count)
}

type Scanner struct {
	scanner *bufio.Scanner
}

func NewScanner() *Scanner {
	s := bufio.NewScanner(os.Stdin)
	s.Split(bufio.ScanWords)
	return &Scanner{s}
}

func (s *Scanner) NextWord() string {
	if !s.scanner.Scan() {
		log.Fatal("failed to find the next word")
	}
	return s.scanner.Text()
}

func (s *Scanner) NextInt() int {
	str := s.NextWord()
	i, err := strconv.Atoi(str)
	if err != nil {
		log.Fatalf("failed to parse %s to int", str)
	}
	return i
}

func (s *Scanner) NextInt64() int64 {
	str := s.NextWord()
	i, err := strconv.ParseInt(str, 10, 64)
	if err != nil {
		log.Fatalf("failed to parse %s to int64", str)
	}
	return i
}


Measured memory_bytes: 2852
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
typedef long long ll;
typedef pair<int, int> P;
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
ll sum(ll l, ll r)
{
  return (l + r) * (r - l + 1) / 2;
}
int main()
{
  int N, K;
  cin >> N >> K;
  ll sm = 0;
  for (int i = K; i <= N + 1; i++)
  {

    sm += sum(N - i + 1, N) + 1 - sum(0, i - 1);
    sm %= MOD;
  }

  cout << sm << endl;
}

Measured memory_bytes: 3636
#include "bits/stdc++.h"

using namespace std;
#define rep(i, n) for (int64_t i = 0; i < n; i++)

const double PI = 3.14159265358979323846;


vector<vector<int64_t>> a;
int64_t n;

void make_a(vector<int64_t> a_l,  int64_t m)
{
	if (a_l.size() == n - 1)
	{
		for (int64_t i = a_l.back(); i <= m; i++)
		{
			a.push_back(vector<int64_t>(a_l));
			a.back().push_back(i);
		}
	}
	else
	{
		for (int64_t i = a_l.back(); i <= m; i++)
		{
			auto temp = vector<int64_t>(a_l);
			temp.push_back(i);
			make_a(temp, m);
		}
	}
	
}

int main()
{
	int64_t m, q, max_pt = 0, count_c = 0, counter = 0;
	
	cin >> n >> m >> q;
	auto b = vector<vector<int64_t>>(q, vector<int64_t>(4, 0));
	for (int64_t i = 0; i < q; i++)
	{
		cin >> b[i][0] >> b[i][1] >> b[i][2] >> b[i][3];
	}

	a = vector<vector<int64_t>>(0);
	auto a_l = vector<int64_t>(1, 1);

	make_a(a_l, m);
	
	for(int64_t j = 0; j < a.size(); j++)
	{
		int64_t now_pt = 0;
		for (int64_t i = 0; i < q; i++)
		{
			if (a[j][b[i][1] - 1] - a[j][b[i][0] - 1] == b[i][2])
			{
				now_pt += b[i][3];
			}
		}
		max_pt = max(now_pt, max_pt);
	}

	cout << max_pt << endl;
	
	return 0;
	
}

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

int main(){
    string s;
    cin >> s;
    string ans = "";
    rep(i,s.size()) if(i % 2 == 0) ans += s[i];
    cout << ans << endl;
}

Measured memory_bytes: 3692
import java.util.Scanner;
import java.util.Arrays;

public class Main{
    public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
	int l=0,s=0,tmp=0;
	String n="";
	int[] nint = new int[4];
	int count = 0;

	while(sc.hasNext()){
	    n = sc.next();
	    if(n.equals("0000")) break;

	    count = 0;l = 0;s = 0;

	    for(int i = 0;i<nint.length;i++) nint[i] = Integer.parseInt(String.valueOf(n.charAt(i)));
	    
	    boolean check = true;
	    for(int i = 0;i<nint.length;i++){
		for(int j = 0;j<nint.length;j++){
		    if(nint[i]!=nint[j]) check = false; 
		}
	    }
	    if(check){ System.out.println("NA"); continue; }

	    while(l-s!=6174 && !n.equals("6174")){
		Arrays.sort(nint);
		l = 0;s = 0;
		
		l += nint[0] * 1;
		l += nint[1] * 10;
		l += nint[2] * 100;
		l += nint[3] * 1000;
		
		s += nint[3] * 1;
		s += nint[2] * 10;
		s += nint[1] * 100;
		s += nint[0] * 1000;

		tmp = l-s;
		nint[0] = tmp%10; tmp /= 10;
		nint[1] = tmp%10; tmp /= 10;
		nint[2] = tmp%10; tmp /= 10;
		nint[3] = tmp%10; tmp /= 10; 
	    
		count++;
	    }

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

Measured memory_bytes: 32188
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define rep(i, a, b) for(int i = (a); i < (b); ++i)
#define per(i, a, b) for(int i = (b) - 1; i >= (a); --i)
#define sz(x) (int)x.size()
#define de(a) cout << #a << " = " << a << endl
#define dd(a) cout << #a << " = " << a << " "
#define all(a) a.begin(), a.end()
#define pw(a) (1ll<<(a))
#define endl "\n"
typedef long long ll;
typedef double db;
typedef pair<int, int> pii;
typedef vector<int> vi;
/*并查集
 * int f[];
 * int Find(int x){x==f[x]?return f[x]:f[x]=Find(f[x]);}
 * int join(int x,int y){if(Find(x)!=Find(y))f[Find(x)]=Find(y);}
 * 快速幂*/
int qpow(ll a,ll b,ll m){ll c=1;while(b){if(b&1)c=c*a%m;b>>=1;a=a*a%m;}return c;}
int vis[105];
int main(){
	ios::sync_with_stdio(false);
	int n,k;
	cin>>n>>k;
	rep(i,0,k){
		int b;
		cin>>b;
		rep(j,0,b){
			int a;
			cin>>a;
			vis[a]=1;
		}
	}
	int sum=0;
	rep(i,1,n+1){
		if(vis[i]==0)sum++;
	}
	cout<<sum;
	return 0;
}


Measured memory_bytes: 3648