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

#define rep(i, a, b) for(int i = (a); i < int(b); ++i)
#define rrep(i, a, b) for(int i = (a) - 1; i >= int(b); --i)
#define trav(it, v) for(auto &it : (v))
#define all(v) (v).begin(), (v).end()
#define what_is(x) cerr << #x << " is " << x << endl;
#define sz(x) (int)(x).size()

typedef double fl;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;

int main(){
	ios::sync_with_stdio(0);
    int N;
    cin >> N;
    map<int, int> A;
    rep(i,0,N) {
        int a;
        cin >> a;
        A[a]++;
    }
    if (sz(A) > 3) {
        cout << "No" << endl;
        return 0;
    }
    vector<int> as;
    for (auto it : A) {
        if ((it.second*3)%N) {
            cout << "No" << endl;
            return 0;
        }
        for (int j = 0; j < 3*it.second; j += N)
            as.push_back(it.first);
    }
    assert(sz(as) == 3);
    if ((as[0]^as[1]^as[2]) == 0) {
        cout << "Yes" << endl;
        return 0;
    }
    cout << "No" << endl;
    return 0;
}


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

#define DEBUG(x) cout<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cout<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl


typedef long long ll;
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
template<class S, class T> pair<S, T> operator+(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first + t.first, s.second + t.second); }
template<class S, class T> pair<S, T> operator-(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first - t.first, s.second - t.second); }
template<class S, class T> ostream& operator<<(ostream& os, pair<S, T> p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
#define X first
#define Y second
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define rrep1(i,n) for(int i=n;i>0;i--)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define in(x, a, b) (a <= x && x < b)
#define all(v) v.begin(),v.end()
#define UNIQUE(v) v.erase(unique(all(v)), v.end())
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a = b; return 1; } return 0; }
const ll inf = 1000000001;
const ll INF = 1e18;
const ll MOD = 1000000007;
const double pi = 3.14159265358979323846;
#define Sp(p) cout<<setprecision(15)<< fixed<<p<<endl;
int dx[4] = { 1,0, -1,0 }, dy[4] = { 0,1,0,-1 };
int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };
#define fio() cin.tie(0); ios::sync_with_stdio(false);
//#define mp make_pair


int main() {
	vi a(3);
	rep(i, 3) {
		cin >> a[i];
	}
	sort(all(a));
	cout << 10 * a[2] + a[1] + a[0] << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;
using vl = vector<ll>;

/* short */
#define pb push_back
#define mp make_pair
#define Fi first
#define Se second
#define ALL(v) begin(v), end(v)
#define RALL(v) rbegin(v), rend(v)

/* REPmacro */
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define FORR(i, a, b) for(int i = (a); i >= (b); i--)
#define REP(i, n) for(int i = 0; i < (n); i++)
#define FOREACH(x, a) for(auto x : a)

/* exchange */
#define CHMIN(a, b) (a) = min((ll)(a), (ll)(b))
#define CHMAX(a, b) (a) = max((ll)(a), (ll)(b))

/* function */
#define IN(x) cin >> x
#define DEBUG(x) cerr << (x) << " "
#define LN() cerr << "\n"
#define PRINT(x) cout << (x) << endl
#define BR cout << endl

/* const */
const int ARRAY = 100005;
const int INF = 1001001001; // 10^9
const ll LINF = 1001001001001001001; // 10^18
const int MOD = 1e9 + 7;

ll N = 0;
double a, b, x;
ll ret = 0;

void input() {
  IN(a);
  IN(b);
  IN(x);
}

void solve() {
  cout << setprecision(10);
  double s = x / a;
  if (s >= (a*b/2.0)) {
    //半分よりも多い場合
    double air = a*b - s;
    // DEBUG(air);
    double tant = (2.0 * air) / (a * a);
    // DEBUG(tant);
    double t = atan(tant) * 180.0 / M_PI;
    PRINT(t);
  } else {
    //半分よりも少ない場合
    double tant = (b * b) / (2 * s);
    double t = atan(tant) * 180.0 / M_PI;
    PRINT(t);
  }
}

int main(void){
  input();
  solve();
}


Measured memory_bytes: 256
#ifndef LOCAL
#pragma GCC optimize "-O3"
#endif
#include <bits/stdc++.h>

typedef long long ll;
typedef long long llong;
typedef long double ld;
typedef unsigned long long ull;

using namespace std;

const ll MOD = 1e9 + 7;

ll pw(ll a, ll b) {
	ll ans = 1; while (b) {
		while (!(b & 1)) b >>= 1, a = (a * a) % MOD;
		ans = (ans * a) % MOD, --b;
	} return ans;
}
const int MAXN = 5100;

int sz[MAXN];
int n;
vector<int> eds[MAXN];

void dfs1(int v, int p = -1) {
	sz[v] = 1;
	for (int u: eds[v]) {
		if (u == p)
			continue;
		dfs1(u, v);
		sz[v] += sz[u];
	}
}

ll fc[MAXN];
ll bfc[MAXN];
ll dp[MAXN];
ll dp2[MAXN];

void add(ll &a, ll b) {
	a += b;
	a %= MOD;
}

int main() {
	cin >> n;
	fc[0] = 1;
	for (int i = 1; i <= n; ++i)
		fc[i] = (fc[i - 1] * i) % MOD;
	for (int i = 0; i <= n; ++i)
		bfc[i] = pw(fc[i], MOD - 2);
	for (int i = 0; i < n - 1; ++i) {
		int a, b;
		cin >> a >> b;
		--a, --b;
		eds[a].push_back(b);
		eds[b].push_back(a);
	}
	dfs1(0);
	int bst = -1;
	for (int i = 0; i < n; ++i) {
		if (sz[i] * 2 >= n && (bst == -1 || sz[i] < sz[bst]))
			bst = i;
	}
	vector<int> vv;
	for (int u: eds[bst]) {
		if (sz[u] < sz[bst])
			vv.push_back(sz[u]);
		else
			vv.push_back(n - sz[bst]);
	}
	dp[0] = 1;
	for (int i: vv) {
		for (int j = 0; j <= n; ++j)
			dp2[j] = 0;
		for (int j = 0; j <= n; ++j) {
			if (dp[j] == 0)
				continue;
			for (int k = 0; k <= i; ++k)
				add(dp2[j + k], dp[j] * fc[i] % MOD * fc[i] % MOD * bfc[k] % MOD * bfc[i - k] % MOD * bfc[i - k] % MOD);
		}
		for (int j = 0; j <= n; ++j)
			dp[j] = dp2[j];
	}
	ll ans = 0;
	for (int i = 0; i <= n; ++i) {
		if (i % 2 == 0)
			add(ans, dp[i] * fc[n - i] % MOD);
		else
			add(ans, MOD - dp[i] * fc[n - i] % MOD);
	}
	cout << ans << "\n";
	return 0;
}




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

int main(){
	static int n;
	static int a[200010];
	scanf("%d",&n);
	for(int i=0;i<n;i++)scanf("%d",&a[i]);
	
	vector<int> v[2];
	for(int i=0;i<n;i++){
		v[i&1].push_back(a[i]);
	}
	int t=(n-1)&1, t_=1-t;
	reverse(v[t].begin(),v[t].end());
	v[t].insert(v[t].end(),v[t_].begin(),v[t_].end());
	for(int i=0;i<v[t].size();i++){
		printf("%d%c",v[t][i],(i+1==v[t].size())?'\n':' ');
	}
}

Measured memory_bytes: 4332
#include <stdio.h>

int main()
{
   long int n,t;
   int  sum = 0, remainder;

   //printf("Enter an integer\n");
   scanf("%ld", &n);

   t = n;

   while (t != 0)
   {
      remainder = t % 10;
      sum       = sum + remainder;
      t         = t / 10;
   }

   if(n%sum==0)
        printf("Yes\n");
   else
        printf("No\n");
   //printf("%d\n",  sum);

   return 0;
}

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

using namespace std;

#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define REV(i,n) for(ll (i) = (n) - 1;(i) >= 0;--i)
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {REP(WW,n)cerr << v[WW] << ' ';cerr << endl << endl;}
#define SHOW2d(v,WW,HH) {REP(W_,WW){REP(H_,HH)cerr << v[W_][H_] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL
#define MOD 998244353
#define fastcin() cin.tie(0);ios::sync_with_stdio(false)

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

ll n, q, k ,d;
vector<set<P>> s(61);
void build(ll target) {
	//cout << "dfs " << target << endl;
	s[0].insert(MP(target, target + 1));
	REP(i, 60){
		for(auto it = s[i].begin();it != s[i].end();){
			P p= *it;
			it++;
			while(it != s[i].end() && it -> FI <= p.SE){
				p.SE = max(p.SE, it -> SE);
				it++;
			}
			{
				ll l=p.first,r=min(p.second,n/2)-1;
				if(l <= r)s[i+1].insert(P(2*(l%(n/2)),2*(r%(n/2))+2));
			}
			{
				ll l=max(p.first,n/2),r=min(p.second,n)-1;
				if(l <= r)s[i+1].insert(P(2*(l%(n/2)),2*(r%(n/2))+2));
			}
		}
	}
}

int main(){

	cin >> n >> q >> k >> d;
	d--;k--;
	build(d);
	//cout << "out build" << endl;
	vector<int> ans;

	for(int i = q;i > 0;i--){
		//cout << "k " << k << endl;
		if(i > 60){
			if(k % 2)ans.PB(1);
			else ans.PB(0);
			k /= 2;
		}
		else {
			bool ok = false;
			ll a = (k / 2);
			ll b = (k / 2) + n / 2;
			//cout << "ab " << a << " " << b << endl;
			for(auto it = s[i-1].begin();it != s[i-1].end();it++){
				if(it -> FI <= a && a < it -> SE){
					if(k%2)ans.PB(1);
					else ans.PB(0);
					k = a;
					ok = true;
					break;
				}
				if(it -> FI <= b && b < it -> SE){
					if(k%2)ans.PB(0);
					else ans.PB(1);
					k = b;
					ok = true;
					break;
				}
			}
			if(!ok){
				cout << -1 << endl;
				return 0;
			}
		}
	}

	REP(i,q)cout << ans[i] << endl;


	return 0;
}



Measured memory_bytes: 7060
#include <bits/stdc++.h>
using namespace std;
int main() {
    int a,b,c,k;
    cin >> a >> b >> c >> k;
    int ans=0;
    if(k<=a) ans=k;
    if(k>a && k<=a+b) ans=a;
    if(k>a+b) ans=2*a+b-k;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3624
#include <stdio.h>
#include <string.h>
#include <vector>
#include <algorithm>
#include <string>
#include <random>
#include <map>
#include <math.h>
#pragma warning(disable : 4996)

#define MAX_N 8

int N, M;
int Sum = 0;

struct Node {
	int id;
	std::vector<int> connection;
};

Node Nodes[MAX_N + 1];

bool isVisited(std::vector<int> &visited, int next) {
	for (int i = 0; i < visited.size(); ++i) {
		if (visited[i] == next) return true;
	}
	return false;
}

void refunc(Node &node, std::vector<int> visited) {
	visited.push_back(node.id);
	if (visited.size() == N) {
		++Sum;
		return;
	}
	for (int i = 0; i < node.connection.size(); ++i) {
		int next = node.connection[i];
		if (isVisited(visited, next) == false) {
			refunc(Nodes[next], visited);
		}
	}
}

int main(void) {
	scanf("%d %d", &N, &M);
	for (int i = 0; i < N+1; ++i) {
		Nodes[i].id = i;
	}
	for (int i = 0; i < M; ++i) {
		int a, b;
		scanf("%d %d", &a, &b);
		Nodes[a].connection.push_back(b);
		Nodes[b].connection.push_back(a);
	}
	refunc(Nodes[1], std::vector<int>());
	printf("%d", Sum);
	
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n,k;
  cin>>n>>k;
  int a[51];
  for(int i=0;i<n;i++)cin>>a[i];
  
  sort(a,a+n,greater<int>());
  int sum=0;
  for(int i=0;i<k;i++){
    sum=sum+a[i];
  }
  cout<<sum<<endl;
}
    

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

const int MAX_N = 100007;

int N;
ll A[MAX_N];

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

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

  sort(A, A + N, greater<ll>());

  ll ans = 10000000007;

  for (int i = 0; i < N - 1; i++) {
    ans = min(ans, gcd(A[i], A[i + 1]));
  }
  cout << ans << endl;
}


Measured memory_bytes: 1024
import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int rate = sc.nextInt();
		String contest = rate < 1200 ? "ABC" : (rate < 2800 ? "ARC" : "AGC");
		System.out.println(contest);
	}
}


Measured memory_bytes: 23764
// luogu-judger-enable-o2
#include<bits/stdc++.h>
using namespace std;
const int inf=1e9,mod=1e9+7;
typedef long long ll;
int read() {
	int x=0,f=1;
	char c=getchar();
	while(c<'0'||c>'9') f=(c=='-')?-1:1,c=getchar();
	while(c>='0'&&c<='9') x=x*10+c-'0',c=getchar();
	return x*f;
}
using namespace std;
int val[1000001],f[1000001],cnt[20],vis[1000001],js,x,y,z,ans,n,len=(1<<15);
int main() {
	n=read(),len=(1<<15);
	for(int i=1; i<n; i++)
		x=read(),y=read(),z=read(),val[x]^=z,val[y]^=z;
	for(int i=0; i<n; i++)
		cnt[val[i]]++;
	for(int i=1; i<=15; i++)
		ans+=cnt[i]/2,js|=(cnt[i]&1)<<(i-1);
	for(int i=1; i<len; i++)
		f[i]=f[i>>1]+(i&1);
	for(int i=1; i<len; i++)
		f[i]--;
	for(int i=1; i<len; i++)
		for(int j=0; j<15; j++)
			if((i>>j)&1)
				vis[i]^=(j+1);
	for(int i=1; i<len; i++) {
		if(vis[i]) continue;
		for(int k=(i-1)&i; k; k=(k-1)&i)
			if(!vis[k])
				f[i]=min(f[i],f[k]+f[i^k]);
	}
	printf("%d",ans+f[js]);
	return 0;
}//da

Measured memory_bytes: 6528
#include <stdio.h>
int main()
{
  char s[4], t[4];
  scanf("%s%s", s, t);

  int i;
  int j = 0;
  for (i = 0; i <= 2; i++) {
    if (s[i] == t[i]) {
      j++;
    }
    else {}
  }

  printf("%d\n", j);

  return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <cmath>
 
using namespace std;
#define PI 3.1415926535897932384626433832795
#define MOD (1000000007)
#define EPS (1e-15)
int imos[100006];
int main(){
    
    int n , m ; cin >> n >> m ;
    for (int i=0 ; i < m ; i++){
        int l , r ;cin >> l >> r ;
        imos[l] ++;
        imos[r+1] --;
    }
    for (int i=0 ; i < 100003;i++ ){
        imos[i+1] += imos[i];
    }
    int cnt = 0;
    for (int i=0 ; i < 100003 ;i++){
        if(imos[i] == m )cnt ++ ;
    }
    cout << cnt << endl;
}

Measured memory_bytes: 640
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
using namespace std;
long long int m,n,a[100010];
int main()
{
    while(scanf("%lld%lld",&m,&n)!=EOF)
    {
        for(int i=1; i<=m; i++)
            scanf("%lld",&a[i]);
        long long int flag=0;
        for(int i=1; i<=m; i++)
        {
            if(a[i]+a[i-1]>n)
            {
                flag+=(a[i]+a[i-1])-n;
                a[i]=n-a[i-1];
            }
        }
        printf("%lld\n",flag);
    }
    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
constexpr long double EPS = 1e-15;
const long double PI = acos(-1);
constexpr int inf = 2e9;
constexpr ll INF = 2e18;
constexpr ll MOD = 1e9+7;
constexpr ll MOD1 = 998244353;
typedef pair<ll,ll> P;
//#define all(v) (v).begin(), (v).end()
#define rep(i,a,b) for (int i = (a); i < (b); i++)
#define REP(i,n) rep(i,0,n)
#define sz(s) (s).size()
#define pb push_back
#define fi first
#define se second
//#define mp make_pair

void solve() {
    int a,b;
    cin >> a >> b;
    cout << (a + b) % 24 << endl;
}

int main(int argc, char *argv[]){
    // /* Regular */
    // int case_num = 1;
    // if (argc > 1 && stoi(argv[1])) cin >> case_num;
    // REP(case_no, case_num) {
    //   cerr << endl << "case " << case_no + 1 << endl;
    //   solve();
    // }
    /* AOJ */
    solve();
    return 0;
}

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

using namespace std;

int main() {
	int n;
	cin >> n;
	vector<int> a(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	int sum = 0;
	for (int i = 0; i < n; i++) {
		while (a[i] % 2 == 0) {
			a[i] /= 2;
			sum++;
		}
	}
	cout << sum << endl;

	return 0;
}

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

using namespace std;

const int maxn = 10000;
const int dx[] = {1, -1, 0, 0};
const int dy[] = {0, 0, 1, -1};
int n,m,ans;
char s[1111][1111];

struct node
{
    int x,y,step;
};
queue<node> temp;

void bfs()
{
    while(!temp.empty())
    {
        node now = temp.front();
        temp.pop();

        ans = max(ans, now.step);

        for(int i = 0; i < 4; i++)
        {
            node nex = node{now.x + dx[i], now.y + dy[i], now.step + 1};

            if(s[nex.x][nex.y] == '.')
            {
                s[nex.x][nex.y]= '#';
                temp.push(nex);
            }
        }
    }
}

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

    for(int i = 1; i <= n; i++)
        for(int j = 1; j <= m; j++)
        {
            cin>>s[i][j];

            if(s[i][j] == '#')
                temp.push(node{i, j, 0});
        }

    bfs();

    cout<<ans<<endl;

    return 0;
}


Measured memory_bytes: 13456
import java.util.Scanner;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;
import java.util.Objects;
import java.lang.StringBuilder;

public class Main {
  public static void main(String[] args ){

    Scanner sc = new Scanner(System.in);
    int H = sc.nextInt();
    int W = sc.nextInt();
    int h = sc.nextInt();
    int w = sc.nextInt();



    System.out.println(H * W - (h * W + w * H - h * w));

  }
}


Measured memory_bytes: 21844
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>

using namespace std;

int main(){
	int N, K, X, Y;
	cin >> N >> K >> X >> Y;

	int ans = 0;

	for (int i = 1; i <= N; i++){
		if (i <= K){
			ans += X;
		}
		else{
			ans += Y;
		}
	}

	cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main{
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int x = scan.nextInt();
		int y = scan.nextInt();
		//System.out.print(area(x,y)+" ");
		//System.out.print(length(x,y));
		System.out.println(area(x,y) + " " + length(x,y));
		
	}
	public static int area(int a,int b) {
		return a * b;
	}
	public static int length(int a,int b) {
		return ((a*2)+(b*2)) ;
	}
}


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

using namespace std;
long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}

long long  gcd(long long  a, long long b) {
	if (a < b) return gcd(b, a);
	long long  r;
	while ((r = a % b)) {
		a = b;
		b = r;
	}
	return b;
}

int main() {
	int N,Amax=-1,Bmax=-1,Abet=-1,Bbet=-1,Amaxpr=-1,Bmaxpr=-1,Abetpr=-1,Bbetpr=-1;
	cin >> N;
	vector<int> A(100003, 0), B(100003, 0), imput(N);
	for (size_t i = 0; i < N; i++)
	{
		cin >> imput.at(i);
		if (i%2)
		{
			A.at(imput.at(i))++;
		}
		else
		{
			B.at(imput.at(i))++;
		}
	}
	//cout << "d";
	for (size_t i = 0; i < 100003; i++)
	{
		if (A.at(i)>Amaxpr)
		{
			Abetpr = Amaxpr;
			Abet = Amax;
			Amax = i;
			Amaxpr = A.at(i);
		}
		else if (A.at(i)>Abetpr)
		{
			Abet = i;
			Abetpr = A.at(i);
		}
		if (B.at(i) > Bmaxpr)
		{
			Bbetpr = Bmaxpr;
			Bbet = Bmax;
			Bmax = i;
			Bmaxpr = B.at(i);
		}
		else if (B.at(i) > Bbetpr)
		{
			Bbet = i;
			Bbetpr = B.at(i);
		}
	}
	if (Amax!=Bmax)
	{
		cout << N - A.at(Amax) - B.at(Bmax);
	}
	else
	{
		if (Bbet<0&&Abet<0)
		{
			cout << N/2;
		}else if(Bbet<0){
			cout << N - B.at(Bmax) - A.at(Abet);
		}
		else if (Abet < 0) {
			cout << N - B.at(Bbet) - A.at(Amax);
		}else{
			cout << N - max(Amaxpr + Bbetpr, Bmaxpr + Abetpr) << endl;
		}
		
	}
	
}

Measured memory_bytes: 1408
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <string>
using namespace std;
int n,l;
string s[111];
int main(void){
  cin >> n >> l;
  for(int i = 0; i < n; i++){
    cin >> s[i];
  }
  sort(s,s+n);
  for(int i = 0; i < n; i++){
    cout << s[i];
  }
  cout << endl;
}


Measured memory_bytes: 256
import sys

sys.setrecursionlimit(10 ** 6)
input = sys.stdin.readline
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")

def main():
    n=int(input())
    u=list(map(int, input().split()))
    d=list(map(int, input().split()))
    ans=0
    for i in range(n):
        ans=max(ans,sum(u[:i+1])+sum(d[i:]))
    print(ans)

main()

Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>
#include <complex>
#include <functional>
#include <numeric>
#include <iomanip>

// output
#define SPBR(w, n) std::cout<<(w + 1 == n ? '\n' : ' ');
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
// utility
#define ALL(i) (i).begin(), (i).end()
#define FOR(i, a, n) for(int i=(a);i<(n);++i)
#define RFOR(i, a, n) for(int i=(n)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<int(n);++i)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define IN(a, x, b) (a<=x && x<b)
#define OUT(a, x, b) (x<a || b<=x)
template<class T> inline T chmax(T & a, const T b) { return a = (a < b) ? b : a; }
template<class T> inline T chmin(T& a, const T b) { return a = (a > b) ? b : a; }

// type/const
#define int ll
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const int MOD = 1000000007;
/* const int MOD = 998244353; */
const int INF = 1e18;
const double PI = acos(-1);

using namespace std;
struct INIT { 
  INIT(){cin.tie(0); ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
}}INIT;

int comb(int n, int r){
  if(r < 0 || n < r) return 0;
  if(r == 1) return n;
  if(r == 2) return n*(n-1)/2;
  return n*(n-1)*(n-2)/6;
}

signed main() {
  int N; 
  cin >> N;

  vector<int> A(N);
  REP(i, N) cin >> A[i];

  map<int, int> m;
  REP(i, N) m[A[i]]++;

  int sum = 0;
  for(auto p : m){
    sum += comb(p.second, 2);
  }

  REP(i, N){
    cout << sum-comb(m[A[i]], 2)+comb(m[A[i]]-1, 2) << "\n";
  }

  return 0;
}

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

int main()
{
  ll n;
  cin >> n;
  ll t = n;
  int sn = 0;
  while(t)
  {
    sn += t % 10;
    t /= 10;
  }
  if(n%sn==0)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int win[100001];

int main()
{
  int n,k,i,j,start,ar[100];
  memset(win,0,sizeof(win));
  cin>>n>>k;
  for(i=0;i<n;i++)
  {
    cin>>ar[i];
    win[ar[i]]=1;
  }
  for(i=0;i<100001;i++)
  {
    if(win[i]==1)
      {
      	continue;
    }
    for(j=0;j<n;j++)
    {
      if(i-ar[j]<0)
      {
        continue;
      }
      if(win[i-ar[j]]==0)
      {
        win[i]=1;
        break;
      }
    }
  }
  if(win[k]==1)
  {
    cout<<"First";
  }
  else
  {
    cout<<"Second";
  }
  return 0;
}

Measured memory_bytes: 640
#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() {
    int n, m;
    ll k;
    cin >> n >> m >> k;
    vector<ll> arui(n+1);
    vector<ll> brui(m+1);
    for (int i = 1; i <= n; i++) {
      ll a;
      cin >> a;
      arui[i] = arui[i-1] + a;
    }
    for (int i = 1; i <= m; i++) {
      ll b;
      cin >> b;
      brui[i] = brui[i-1] + b;
    }
    int ans = 0;
    for (int i = 0; i <= n; i++) {
      ll bk = k-arui[i];
      if (bk < 0) break;
      auto iter = upper_bound(brui.begin(), brui.end(), bk);
      int j = iter - brui.begin() - 1;
      ans = max(ans,i+j);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 6416
#include<bits/stdc++.h>
using namespace std;int i,j,k,l,n,s,t;
int main(){
while(true){
cin>>n;s=0;t=sqrt(n)+1;
if(!n){break;}
for(i=0;i<t;i++){
for(j=i;j<t;j++){
for(k=j;k<t;k++){
for(l=k;l<t;l++){
if(i*i+j*j+k*k+l*l==n){
s++;
}
}
}
}
}
cout<<s<<endl;
}
}

Measured memory_bytes: 1156
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
typedef pair<int,int>P;//pairをP型にすると個人的にラク
int main(){
  int n;
  vector<P>work;
  cin >> n;
  for(int i = 0; i < n; i++){
    int times, deadline;
    cin >> times >> deadline;
    work.push_back(P(deadline, times));//締め切りを先にする
  }
  
  //締め切りが早い仕事から終わらせるのが最適解
  bool finish = true;
  int sum = 0;
  sort(work.begin(), work.end());
  for(int i = 0; i < n; i++){
    sum += work[i].second;
    if(sum > work[i].first){
      finish = false;
    }
  }
  
  if(finish){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
  return(0);
}

Measured memory_bytes: 2420
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define rep(i,n) for(int i=0, i##_len=(int)(n); i<i##_len; i++)
#define reps(i,n) for(int i=1 , i##_len=(int)(n);i<=i##_len;i++)
#define rrep(i,n) for(int i=((int)(n)-1);i>=0;i--)
#define rreps(i,n) for(int i=((int)(n));i>0;i--)
#define repi(i,x) for(auto i=(x).begin(),i##_fin=(x).end();i!=i##_fin;i++)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define solve(a) ((a)?"Yes":"No")
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef pair<int , int> Pi;
typedef vector<Pi> VPi;
typedef vector<long long> V;
typedef vector<V> VV;
typedef pair<long long , long long> P;
typedef vector<P> VP;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1;} return 0;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1;} return 0;}
const long long INFLL = 1LL<<60;
const int INF = 1<<30;
const double PI=acos(-1);
int main(){
	ll a,b,c;
	ll ans = 0;
	cin >>a>>b>>c;
	if (a % 2 and b % 2 and c % 2) {
		ans = min({a * b, b * c, c * a});
	} else {
		ans = 0LL;
	}
	cout<<ans<<endl;
}

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

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"
#define ALL(a) (a).begin(),(a).end()

using namespace std;
using ll = long long;

const double PI = 3.14159265358979;

void solve()
{
  string s;
  cin >> s;
  int a = (s[0] - '0');
  int b = (s[1] - '0');
  int c = (s[2] - '0');
  int d = (s[3] - '0');
  for(int op1 = -1; op1 <= 1; op1 += 2)
  for(int op2 = -1; op2 <= 1; op2 += 2)
  for(int op3 = -1; op3 <= 1; op3 += 2)
  {
    if (a + b * op1 + c * op2 + d * op3 == 7)
    {
      cout << a;
      cout << (op1 == -1 ? '-' : '+');
      cout << b;
      cout << (op2 == -1 ? '-' : '+');
      cout << c;
      cout << (op3 == -1 ? '-' : '+');
      cout << d;
      cout << "=7";
      return;
    }
  }
}

int main()
{
  fastio;
  solve();

  return 0;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for (int i = a; i < b; i++)
#define all(v) v.begin(), v.end()
const int MOD = 1e9 + 7;
const int INF = 2e9;
//'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122

int main() {
    int n, m;
    cin >> n >> m;
    vector<int> a(n);
    rep(i, 0, n) cin >> a[i];
    vector<pair<int, int>> pr;
    rep(i, 0, m) {
        int b, c;
        cin >> b >> c;
        pr.push_back(make_pair(c, b));
    }

    sort(all(pr));
    reverse(all(pr));

    int cnt = 0;
    rep(i, 0, m) {
        if (cnt == n) break;
        rep(j, 0, pr[i].second) {
            if (cnt == n) break;
            a.push_back(pr[i].first);
            cnt++;
        }
    }

    sort(all(a), greater<int>());

    ll ans = 0;
    rep(i, 0, n) ans += a[i];
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1908
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <algorithm>
#include <iomanip>
#include <string.h>

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()

typedef long long lint;

using namespace std;

int main(){
  int s[4]={0};
  REP(i,6){
    int a;
    cin>>a;
    a--;
    s[a]+=1;
  }
  bool f=true;
  REP(i,4)if(s[i]>2)f=false;
  cout<<(f?"YES":"NO")<<endl;
  return 0;
}


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

using namespace std;

int main()
{
	int N, M;

	cin >> N >> M;

	int *L = new int [M];
	int *R = new int [M];

	for ( int i = 0; i < M; i ++ ) {
		cin >> L[i] >> R[i];
	}

	int l = 0;
	int r = N;
	for ( int i = 0; i < M; i ++ ) {
		if ( l < L[i] ) l = L[i];
		if ( r > R[i] ) r = R[i];
	}

	if ( r < l ) cout << 0 << endl;
	else cout << (r - l + 1) << endl;

	return 0;
}


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

int main()
{
    int k;
    string s;
    cin >> k;
    cin >> s;
    if(s.size() <= k)
        cout << s;
    else
    {
        cout << s.substr(0, k) + "...";
    }
    
    return 0;
}

Measured memory_bytes: 3628
//“Make it work, make it right, make it fast.” – Kent Beck
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double dd;
const int siz = 1e6 + 5;
const int MOD = 1e9 + 7;
#define endl '\n'
#define deb(x) cout << #x << " = " << x << endl;

void solve(){
	int k;
	cin >> k;
	int a, b;
	cin >> a >> b;
	int s = a/k;
	bool flag = false;
	while(s <= b){
		int x = s*k;
		if( x >= a && x <= b){
			flag = true;
			break;
		}
		s++;
	}
	if(flag)
		cout << "OK";
	else
		cout << "NG";
}

int main(){
	#ifndef RAY
		//freopen("input.txt", "r", stdin);
	#endif
		ios::sync_with_stdio(false);
		cin.tie(nullptr);
		int t = 1;
		//cin >> t;
		while(t--){
			solve();
		}
	return 0;
}	


Measured memory_bytes: 3652
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define REP(i,a,b) for(int i=a; i<=int(b); i++)
using namespace std;

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


int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    ll l,r,d;
    cin >> l >> r >> d;
    cout << int(r/d)-int(l/d)+(l%d==0);
    return 0;
}


Measured memory_bytes: 3556
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n;
	cin>>n;
	vector<long long int > a(n);
	for(int i=0;i<n;i++)
	cin>>a[i];
	long long int sum=0,mod=pow(10,9)+7,ans=0;
	for(int i=0;i<a.size();i++){
		ans=(ans%mod+((sum%mod)*(a[i]%mod))%mod)%mod;
		sum=(sum%mod+a[i]%mod)%mod;
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 4836
#include <bits/stdc++.h>
#include <boost/range/irange.hpp>

using namespace std;
using namespace boost;

main() {
    int64_t a, b;
    cin >> a >> b;

    auto k = (a + b) / 2;

    if (abs(a - k) == abs(b - k)) {
        cout << k << endl;
    } else {
        cout << "IMPOSSIBLE" << endl;
    }
}

Measured memory_bytes: 256
#!/usr/bin/env python3

from sys import stdin, setrecursionlimit


def main():
    input = stdin.buffer.readline
    n = int(input())
    a = list(map(int, input().split()))
    ans = 0
    for i in range(n):
        if a[a[i] - 1] == i + 1:
            ans += 1
    print(ans // 2)


if __name__ == "__main__":
    setrecursionlimit(10000)
    main()


Measured memory_bytes: 84352
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s,t;
  cin>>s>>t;
  int dp[s.length()+1][t.length()+1];
  memset(dp,0,sizeof(dp));
  for(int i=1;i<=(int)s.length();i++){
    for(int j=1;j<=(int)t.length();j++){
      if(s[i-1]==t[j-1])dp[i][j]=1+dp[i-1][j-1];
      else dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
    }
  }
  stack<char>st;
  int i=s.length();
  int j=t.length();
  while(i>0&&j>0){
    if(s[i-1]==t[j-1]){
      st.push(s[i-1]);
      i--;
      j--;
    }
    else{
      if(dp[i-1][j]>dp[i][j-1]){
        i=i-1;
      }
      else j--;
    }
  }
  while(!st.empty()){
    cout<<st.top();
    st.pop();
  }

  cout<<endl;
}

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

int main()
{

    int n;
    string s;

    cin >> n >> s;

    for (int i = 0; i < s.length(); i++)
    {
        s[i] -= 'A';
        s[i] = (s[i] + n) % 26;
        s[i] += 'A';
        cout << s[i];
    }
    cout << '\n';
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <functional>
#include <utility>
#include <fstream>

using namespace std;

#define ll long long
#define INF 2000000000
#define LINF 2000000000000000000
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define dum(x) cout<<#x<<'='<<x<<endl
#define dum2(x,y) cout<<#x<<'='<<x<<' '<<#y<<'='<<y<<'\n'<<endl
#define dum3(x,y,z) cout<<#x<<'='<<x<<' '<<#y<<'='<<y<<' '<<#z<<'='<<z<<'\n'<<endl
#define darr(arr,n) rep(i,(n-arr)){cout<<*(arr+i)<<' ';}cout<<endl

//ifstream in("Text.txt");cin.rdbuf(in.rdbuf());
pair<int, int>Rab[110];
pair<int, int>Bcd[110];
bool Rused[110], Bused[110];

int main() {
    int N;
    cin >> N;
    rep(i, N)cin >> Rab[i].second >> Rab[i].first;
    rep(i, N)cin >> Bcd[i].first >> Bcd[i].second;

    sort(Rab, Rab + N, greater<pair<int,int>>());
    sort(Bcd, Bcd + N);

    int cou = 0;
    rep(i, N) {
        rep(j, N) {
            if (Rab[j].second < Bcd[i].first&&
                Rab[j].first < Bcd[i].second&&!Rused[j]&&!Bused[i]) {
                cou++;
                Rused[j] = true;
                Bused[i] = true;
            }
        }
    }
    cout << cou << endl;
}

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

#define dbg(x) cout<<#x<<"="<<x<<'\n'
#define ll long long
#define pr pair<int,int>
#define pb push_back
#define ff first
#define ss second
#define vi vector<int>
#define rep(i,n) for(int i=0;i<(n);++i)
#pragma GCC optimization("Ofast")
#pragma GCC optimization("unroll-loops")
#define fin ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define MOD 1000000007
const int INF=1e9;



void solve(){
  int n;
  cin>>n;
  int h[n];
  for(int &x:h) cin>>x;  
  int dp[n+1];
  //memset(dp,INT_MAX,sizeof(dp));
  for(int i=1;i<=n;i++)dp[i]=1e9;
  dp[1]=0;
  for(int i=1;i<=n;i++){
    if(i+1<=n) dp[i+1]=min(dp[i+1],dp[i]+abs(h[i-1]-h[i]));
    if(i+2<=n) dp[i+2]=min(dp[i+2],dp[i]+abs(h[i-1]-h[i+1]));
    //cout<<dp[i]<<" "<<dp[i+1]<<" "<<dp[i+2]<<endl;
  }
  //for(int x:dp) cout<<x<<" ";
  cout<<dp[n]<<endl; 
}



int main()
{
    fin;
    
      solve();
        //cout<<solve()<<"\n";
    
    return 0;
}

Measured memory_bytes: 4376
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;



int main(){
	int a, b, c;
	cin >> a >> b >> c;
	bool x = a <= c && b >= c;
	bool y = b <= c && a >= c;
	if (x||y)	cout << "Yes" << endl;
	else cout << "No" << endl;


	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
using namespace std;
long long build[200001],AGITO[200001];
int main(){
int i,j,n,q,r,l;
long long s,t,x,COMPLEX=0,cobra,blackholl;
scanf("%d%d%lld%lld",&n,&q,&s,&t);
scanf("%lld",&cobra);
for(i=1;i<=n;i++){
	scanf("%lld",&blackholl);
	AGITO[i]=blackholl-cobra;
	if(AGITO[i]>0){
		build[i]=AGITO[i]*s*-1;
		COMPLEX=COMPLEX+build[i];
	}
	else{
		build[i]=AGITO[i]*t*-1;
		COMPLEX=COMPLEX+build[i];
	}
	cobra=blackholl;
}
for(i=0;i<q;i++){
	scanf("%d%d%lld",&l,&r,&x);
	COMPLEX=COMPLEX-build[l];
	AGITO[l]+=x;
	if(AGITO[l]>0)
		build[l]=AGITO[l]*s*-1;
	else
		build[l]=AGITO[l]*t*-1;
	COMPLEX+=build[l];
	if(r+1<=n){
		COMPLEX-=build[r+1];
		AGITO[r+1]-=x;
		if(AGITO[r+1]<0)
			build[r+1]=AGITO[r+1]*t*-1;
		else
			build[r+1]=AGITO[r+1]*s*-1;
		COMPLEX+=build[r+1];
	}
	printf("%lld\n",COMPLEX);
}
return 0;
}


Measured memory_bytes: 6352
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<functional>
#include<map>
#include<cstdlib>
#include<complex>
#include<numeric>
#include<set>
#include<deque>
#include<queue>

using namespace std;
using Int = long long;
Int INF = 1LL << 60;
const Int MOD = 1000000000 + 7;

int main() {

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

	Int N, M;
	cin >> N >> M;

	vector<vector<Int>> xyz(N, vector<Int>(3));
	Int x, y, z;
	for (Int i = 0; i < N; i++) {
		cin >> x >> y >> z;
		xyz[i][0] = x;
		xyz[i][1] = y;
		xyz[i][2] = z;
	}

	vector<Int> temp(N);
	vector<Int> pm = { 1,-1 };
	Int ans = -INF;
	Int cnt;
	for (Int i = 0; i < 2; i++) {
		for (Int j = 0; j < 2; j++) {
			for (Int k = 0; k < 2; k++) {
				
				for (Int m = 0; m < N; m++) {
					temp[m] = pm[i] * xyz[m][0] + pm[j] * xyz[m][1] + pm[k] * xyz[m][2];
				}

				sort(temp.begin(), temp.end(), greater<Int>());
				cnt = 0;
				for (Int m = 0; m < M; m++) {
					cnt += temp[m];
				}

				ans = max(ans, cnt);

			}
		}
	}
	cout << ans << "\n";
}


Measured memory_bytes: 384
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <unordered_map>
#include <map>
#include <set>
using namespace std;

int main(int argc, char const *argv[]) {
  long long a,b,c,d,e;
  cin>>a>>b>>e>>c>>d>>e>>e;
  long long res = b;
  if(a%2==c%2&&c%2==d%2)res += (a+c+d);
  else if(a==0&&c==1&&d==1);
  else if(a==1&&c==0&&d==1);
  else if(a==1&&c==1&&d==0);
  else res+=(a+c+d-1);
  cout<<res<<endl;
  return 0;
}


Measured memory_bytes: 256
import sys
N, M = map(int, input().split())
P = [[int(v) - 1 for v in sys.stdin.readline().split()] for _ in range(M)]

L = [(1, True)] + ([(1, False)] * (N - 1))

for x, y in P:
    ac, ad = L[x]
    bc, bd = L[y]
    ac -= 1
    bc += 1
    if ad:
        bd = True
    if ac == 0:
        ad = False
    L[x] = (ac, ad)
    L[y] = (bc, bd)

print(sum([f for _, f in L]))


Measured memory_bytes: 28988
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <cassert>
using namespace std;
using ll = long long;
const int INF = 1<<30;
const int MOD = (int)1e9 + 7;
const int MAX_N = (int)1e5 + 5;
#define debug(x) cout << #x << ": " << x << endl
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2>& p) { os << p.first << " " << p.second; return os; }
template<typename T>
ostream &operator<<(ostream &os, const vector<T> &v) { for(int i = 0; i < (int) v.size(); i++) os << v[i] << (i + 1 != v.size() ? " " : ""); return os; }

void solve()
{
    int n, m; cin >> n >> m;
    vector<int> v(n, 0);
    for(int i = 0; i < m; i++)
    {
        int l, r; cin >> l >> r;
        l--, r--;
        v[l]++;
        v[r + 1]--;
    }
    for(int i = 0; i < n - 1; i++)
    {
        v[i + 1] += v[i];
    }

    int ans = 0;
    for(int i = 0; i < n; i++)
    {
        if(v[i] == m) ans++;
    }
    cout << ans << endl;
}

signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    solve();
    return 0;
}

Measured memory_bytes: 640
while line = gets
  serves = line.chomp.split('')
  break if serves[0] == '0'
  scores = [0, 0]
  for i in 1...serves.size
    if serves[i] == 'A'
      scores[0] += 1
    else
      scores[1] += 1
    end
  end
  
  if scores[0] > scores[1]
    scores[0] += 1
  else
    scores[1] += 1
  end
  puts "#{scores[0]} #{scores[1]}"
end

Measured memory_bytes: 8648
#include <iostream>
#include <queue>

using namespace std;
static const int N = 100;
static const int INFTY = (1 << 21);

int n, M[N][N];
int d[N];

void bfs(int s) {
  queue<int> q;
  q.push(s);
  for (int i = 0; i < n; i++) {
    d[i] = INFTY;
  }
  d[s] = 0;
  int u;
  while (!q.empty()) {
    u = q.front(); q.pop();
    for (int v = 0; v < n; v++) {
      if (M[u][v] == 0) continue;
      if (d[v] != INFTY) continue;
      d[v] = d[u] + 1;
      q.push(v);
    }
  }
  for (int i = 0; i < n; i++) {
    cout << i + 1 << " " << ((d[i] == INFTY) ? (-1) : d[i]) << endl;
  }
}

int main() {
  int u, k, v;

  cin >> n;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      M[i][j] = 0;
    }
  }

  for (int i = 0; i < n; i++) {
    cin >> u >> k;
    u--;
    for (int j = 0; j < k; j++) {
      cin >> v;
      v--;
      M[u][v] = 1;
    }
  }

  bfs(0);

  return 0;
}


Measured memory_bytes: 3104
#include <iostream>
#include <vector>
#include <map>
#include <cstdio>
#include <cstring>
#include <math.h>
#include <bitset>
#include <time.h>
#include <set>
#include <algorithm>
#define ll long long
#define MAXN 1000000
#define MODD 1000000007
#define ll long long
using namespace std;

ll times[222222];

int main() {
    int N,T;
    cin>>N>>T;
    for(int i=0;i<N;i++)
        cin>>times[i];
    
    sort(times,times+N);
    ll st=times[0];
    ll en=times[0]+T;
    
    ll ans = 0;
    
    for(int i=1;i<N;i++) {
        if (times[i] > en) {
            ans += en - st;
            st = times[i];
            en = times[i]+T;
        } else {
            en = times[i]+T;
        }
    }
    
    ans += en - st;
    cout << ans << endl;
    
}

Measured memory_bytes: 1792
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <climits>
#include <cstdlib>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define DEBUG 1
using namespace std;
constexpr int kMod = 1000000007;
typedef long long LL;


vector<LL> fact, finv, inv;

void init_nCk(int N) {
  fact.resize(N + 1);
  finv.resize(N + 1);
  inv.resize(N + 1);
  fact[0] = fact[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (int i = 2; i <= N; i++) {
    fact[i] = fact[i - 1] * i % kMod;
    inv[i] = kMod - inv[kMod % i] * (kMod / i) % kMod;
    finv[i] = finv[i - 1] * inv[i] % kMod;
  }
}

LL nCk(int n, int k) {
  if (n < k) return 0;
  if (n < 0 || k < 0) return 0;
  return fact[n] * (finv[k] * finv[n - k] % kMod) % kMod;
}

template<typename T>
std::map<T, int> prime_factorize(T x) {
  std::map<T, int> primes;
  for (T factor = 2; factor * factor <= x; factor++) {
    if (x % factor == 0) {
      T count = 0;
      while (x % factor == 0) {
          count++;
          x /= factor;
      }
      primes[factor] = count;
    }
  }
  if (x != 1) primes[x] = 1;
  return primes;
}

int main() {
  int N, M; cin >> N >> M;
  auto m = prime_factorize(M);

  int vmax = 0;
  for (auto [k, v] : m) {
    vmax = max(vmax, v);
  }
  init_nCk(vmax + N - 1);

  LL cnt = 1;
  for (auto [k, v] : m) {
    LL x = nCk(v + N - 1, N - 1);
    cnt = (cnt * x) % kMod;
  }

  cout << cnt << endl;
}


Measured memory_bytes: 5632
n = int(input())
# A = [0] * n
# B = [0] * n
# for i in range(n):
#     A[i], B[i] = input().split()
# A = list(map(str, A))
# B = list(map(int, B))
sp = []
for i in range(n):
    s, p = input().split()
    p = int(p)
    sptemp = [s, -p, i]
    sp.append(sptemp)
spsorted = sorted(sp)

for temp in spsorted:
    print(temp[2] + 1)

# As = sorted(A)
# Bs = sorted(B)[::-1]
# print(As)
# print(Bs)
# print()

# L = [i for i in range(n)]
# AL = [i for i in range(n)]
# BL = [i for i in range(n)]

# for i in range(n):
#     AL[i] = L[A.index(As[i])] + 1
#     # A.remove(str([A.index(As[i])]))
# print(AL)
# # print(Bs)


Measured memory_bytes: 3060
#include <iostream>
#include <string>
using namespace std;
int main(){
    int N, M;
    cin >> N;
    string s[N];
    int S[100] = {0};
    for(int i = 0; i < N; i++){
        cin >> s[i];
    }
    cin >> M;
    string t[M];
    for(int j = 0; j < M; j++){
        cin >> t[j];
    }
    for(int i = 0; i < N; i++){
        for(int j = 0; j < N; j++){
                if(s[i] == s[j])
                    S[i] = S[i] + 1;
        }
    }
    for(int i = 0; i < N; i++){
        for(int j = 0; j < M; j++){
            if(s[i] == t[j])
                S[i] = S[i] - 1;
        }
    }
    int tmp = 0;
    for(int i = 0; i < 100; i++){
        if(i == 0)
            tmp = S[i];
        if(S[i] > tmp)
            tmp = S[i];
        }
    cout << tmp << 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;


int main() {
  int N, K;
  cin >> N >> K;
  vector<int> P(N);
  for (int i = 0; i < N; i++) cin >> P[i];
  
  vector<ll> cumsum(N + 1, 0);
  for (int i = 1; i < N + 1; i++) cumsum[i] = cumsum[i - 1] + P[i - 1];

  ll maxsum = 0;
  for (int i = 0; i < N - K + 1; i++) {
    maxsum = max(maxsum, cumsum[K + i] - cumsum[i]);
  }

  float ans = float((maxsum + K)) / 2;
  // cout << ans << endl;
  printf("%.10f\n", ans);
  return 0;
}


Measured memory_bytes: 2560
import java.util.Scanner;
import java.util.InputMismatchException;

public class Main
{
	public static void main(String[] args)
	{
		Scanner sc = new Scanner(System.in);;
		int n = sc.nextInt();
		
		for(int i = 1; i <= n; i++)
		{
			//check_num
			int x = i;
			
			if(i % 3 == 0)
			{
				System.out.print(" " + i);
				//end_check_num???
			}
			else
			{
				do
				{
					// INCLUDE3
					if(x % 10 == 3)
					{
						System.out.print(" " + i);
						break;	// end_check_num???
					}
					
					x /= 10;
				} while(x != 0);
			}
		}
			
		System.out.print("\n");
	}
}

Measured memory_bytes: 28548
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
 
public class Main {
	public static void main(String [] args) throws NumberFormatException, IOException {
		BufferedReader br = new BufferedReader (new InputStreamReader(System.in));
		 int n =Integer.valueOf(br.readLine());
		 String [] z =br.readLine().split(" ");
		 String nums1 =z[0];
		 String nums2 =z[1];
		
         for(int i=0;i<n;i++) {
        	 System.out.print(nums1.charAt(i));
        	  System.out.print(nums2.charAt(i));
		 }
    
 
}
}

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

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin >> n;
	vector<int> a(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	int ans = 0;
	while(true) {
		bool flag = true;
		for (int i = 0; i < n; i++) {
			if(a[i] > 0) flag = false;
		}
		if(flag) {
			cout << ans << endl;
			return 0;
		}
		int cnt = 0;
		bool zero = false;
		for (int i = 0; i < n; i++) {
			if(a[i] <= 0) continue;
			int j = i;
			while(j < n && a[j] > 0) {
				j++;
			}
			ans++;
			i = j - 1;
		}
		for (int i = 0; i < n; i++) {
			a[i]--;
		}
	}

	return 0;	
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int digit(int x){
  int ret = 0;
  for (int i = 0; i < 7; i++)
  {
    x /= 10;
    ret++;
    if (x == 0)break;
  }
  return ret;
}


int main(){
  int n;cin >>n;
  int ans;
  if (digit(n) == 6)
  {
    ans = 90909;
  }
  if (digit(n) == 5)
  {
    ans = n - 9999;
    ans += 909;
  }
  else if(digit(n) == 4)
  {
    ans = 909;
  }
  else if (digit(n) == 3)
  {
    ans = n - 99;
    ans += 9;
  }
  else if (digit(n) == 2)
  {
    ans = 9;
  }
  else if (digit(n) == 1)
  {
    ans = n;
  }
  
  cout << ans << endl;
  
}

Measured memory_bytes: 256
using System;
 
class main
{
    public static int n = 1000000;
    static void Main()
    {
        string s;
        int c, q;
        int[] p = new int[n];
        for (int i = 2; i < 1001; ++i)
            for (int j = i * 2; j < n; j += i)
                p[j] = 1;
        while ((s = Console.ReadLine()) != null)
        {
            c = int.Parse(s);
            q = 0;
            for (int i = 2; i <= c; ++i)
                if (p[i] != 1) ++q;
            Console.WriteLine("{0}", q);
        }
    }
}

Measured memory_bytes: 9488
# coding=utf-8
from math import floor, ceil, sqrt, factorial, log, gcd
from itertools import accumulate, permutations, combinations, product, combinations_with_replacement
from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict, deque
from heapq import heappop, heappush, heappushpop, heapify
import copy
import sys
INF = float('inf')
mod = 10**9+7
sys.setrecursionlimit(10 ** 6)


def lcm(a, b): return a * b / gcd(a, b)

# 1 2 3
# a, b, c = LI()


def LI(): return list(map(int, sys.stdin.buffer.readline().split()))

# a = I()


def I(): return int(sys.stdin.buffer.readline())

# abc def
# a, b = LS()


def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()

# a = S()


def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')

# 2
# 1
# 2
# [1, 2]


def IR(n): return [I() for i in range(n)]

# 2
# 1 2 3
# 4 5 6
# [[1,2,3], [4,5,6]]


def LIR(n): return [LI() for i in range(n)]

# 2
# abc
# def
# [abc, def]


def SR(n): return [S() for i in range(n)]

# 2
# abc def
# ghi jkl
# [[abc,def], [ghi,jkl]]


def LSR(n): return [LS() for i in range(n)]

# 2
# abcd
# efgh
# [[a,b,c,d], [e,f,g,h]]


def SRL(n): return [list(S()) for i in range(n)]


n, a, b = map(int, input().split())
MOD = 10**9+7


def comb(n, r):
    p, q = 1, 1
    for i in range(r):
        p = p * (n-i) % MOD
        q = q * (i+1) % MOD
    return p * pow(q, MOD-2, MOD) % MOD


ans = (pow(2, n, MOD)-1) % MOD
ans = (ans+MOD-comb(n, a)) % MOD
ans = (ans+MOD-comb(n, b)) % MOD

print(ans)


Measured memory_bytes: 70736