akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		try(Scanner sc = new Scanner(System.in)) {
			
			int n = sc.nextInt();
			int m = sc.nextInt();
			int x = sc.nextInt();
			
			int[] costs = new int[n];
			int[][] bookPoints = new int[n][m];
			
			for(int i = 0 ; i < n ; i++ ) {
				costs[i] = sc.nextInt();
				for( int j = 0 ; j < m ; j++ ) {
					bookPoints[i][j] = sc.nextInt(); 
				}
			}
			
			int totalCost = Integer.MAX_VALUE;
						
			//bit n to index
			for(int i = 1 ; i < (int)Math.pow(2, n) ; i++ ) {

				int[] currentPoint = new int[m];
				int currentCost = 0;
//				System.out.println("--- i = " + i);
				for(int j = 0 ; j < n ; j++ ) {
					// calc bit mask
					int p = (i & (int)Math.pow(2,j)) >> j;
					if ( p == 1 ) {
						currentCost += costs[j];
						for(int k = 0 ; k < m ; k++ ) {
							currentPoint[k] += bookPoints[j][k];
						}
					}
				}
				
				//check points
				boolean clear = true;
				for(int k = 0 ; k < m ; k++ ) {
					if ( currentPoint[k] < x ) {
						clear = false;
						break;
					}
				}
				
				if ( clear ) {
					if ( currentCost < totalCost ) {
						totalCost = currentCost;
					}
				}
			}
			
			if ( totalCost == Integer.MAX_VALUE ) {
				System.out.println("-1");
			}
			else {
				System.out.println(totalCost);
			}
		}
	}

}

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

#define ll          long long
#define pb          push_back
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define x           first
#define y           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define hell        1000000007
#define rep(i,a,b)  for(int i=a;i<b;i++)
using namespace std;
int n;
vi v;
void solve(){
    cin>>n;
    rep(i,0,n){
        int x;
        cin>>x;
        v.pb(x);
    }
    sort(all(v));
    cout<<v[n/2]-v[n/2-1]<<endl;
}

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t=1;
    // cin>>t;
    while(t--){
        solve();
    }
    return 0;
}

Measured memory_bytes: 892
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int Y = sc.nextInt();
		boolean t = false;
		for (int x = 0; x <= N && t == false; x++) {
			for (int y = 0; y <= N && t == false; y++) {
				int sum = x * 10000 + y * 5000;
				if (Y - sum >= 0) {
					int z = (Y - sum) % 1000 == 0 ? (Y - sum) / 1000 : 0;
					sum = sum + z * 1000;
					if (x + y + z == N) {
						System.out.println(x + " " + y + " " + z);
						t = true;
					}
				}
			}
		}
		if (t == false) {
			System.out.println("-1 -1 -1");
		}
		sc.close();
	}
}

Measured memory_bytes: 23764
// IO library
#include <cstdio>
#include <iomanip>
#include <ios>
#include <iostream>

// algorithm library
#include <algorithm>
#include <cmath>
#include <numeric>
#include <random>

// contancer library
#include <bitset>
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <vector>

using namespace std;

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

template <class T>
ostream& operator<<(ostream& os, vector<T> v) {
    os << "[";
    for (auto vv : v) os << vv << ",";
    return os << "]";
}

template <class T>
ostream& operator<<(ostream& os, set<T> v) {
    os << "{";
    for (auto vv : v) os << vv << ",";
    return os << "}";
}

template <class L, class R>
ostream& operator<<(ostream& os, pair<L, R> p) {
    return os << "(" << p.first << "," << p.second << ")";
}

template <class K, class T>
ostream& operator<<(ostream& os, map<K, T> v) {
    os << "{";
    for (auto vv : v) os << vv << ",";
    return os << "}";
}

template <class T>
ostream& operator<<(ostream& os, queue<T> q) {
    os << "[";
    while (!q.empty()) {
        os << q.front() << ",";
        q.pop();
    }
    return os << "]";
}

template <class T>
ostream& operator<<(ostream& os, priority_queue<T> q) {
    os << "{";
    while (!q.empty()) {
        os << q.top() << ",";
        q.pop();
    }
    return os << "}";
}

const ll MOD = 1000000007;
// const ll MOD = 998244353;
// const int INF = 1 << 25;
// const ll INF = 1LL << 50;
// const ld PI = acos(-1);
// const ld EPS = 1e-10;
// mt19937 mt(ll(time(0)));

template <class T>
vector<T> Vec(size_t l, T v) { return vector<T>(l, v); }

template <class T, class... Ts>
auto Vec(size_t l, Ts... ts) {
    return vector<decltype(Vec<T>(ts...))>(l, Vec<T>(ts...));
}

template <typename T>
inline T sq(T a) { return a * a; }

template <typename T>
inline T iceil(T n, T d) { return (n + d - 1) / d; }

template <typename T>
T gcd(T a, T b) {
    while (b > 0) {
        a %= b;
        swap(a, b);
    }
    return a;
}

template <typename T, typename U>
T ipow(T b, U n) {
    T ret = 1;
    while (n > 0) {
        if (n & 1) ret *= b;
        n >>= 1;
        b *= b;
    }
    return ret;
}

template <typename T, typename U>
T mpow(T b, U n) {
    T ret = 1;
    while (n > 0) {
        if (n & 1) ret = ret * b % MOD;
        n >>= 1;
        b = b * b % MOD;
    }
    return ret;
}

int main() {
    int A, B, K;
    cin >> A >> B >> K;
    for (int i = A; i > 0; --i) {
        if (A % i == 0 && B % i == 0) {
            --K;
            if (K == 0) {
                cout << i << endl;
                break;
            }
        }
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0; i<(int)(n); ++i)
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using Graph = vector<vi>;  // vi <=> vl
using vb = vector<bool>;
using boolGraph = vector<vb>;
using P = pair<int, int>;  // int <=> ll
const int MOD = 1e9+7;
const int MOD2 = 998244353;
const double EPS = 1e-9;

int main() {
  ll L, A, B, M;
  cin >> L >> A >> B >> M;

  P digit = P(1, 1);
  ll tmp = 10;
  while (A >= tmp) {
    tmp *= 10;
    ++digit.first;
  }

  ll last = A + B * (L-1);
  tmp = 10;
  while (last >= tmp) {
    tmp *= 10;
    ++digit.second;
  }

  ll init = A;
  ll ans = 0;

  for (int k=digit.first; k<=digit.second; ++k) {
    ll pow10 = pow(10, k);

    if (pow10 <= init) continue;

    ll num = (min(pow10 - 1, last) - init) / B + 1;
    
    vl rem(64);
    rem[0] = pow10 % M;
    rep(i,63) {
      rem[i+1] = rem[i] * rem[i] % M;
    }

    vl dp(64);
    dp[0] = 1;
    rep(i,63) {
      dp[i+1] = dp[i] * (1 + rem[i]) % M;
    }

    ll expo = 1, sigma_a = 0;
    for (int i=63; i>=0; --i) {
      if ((num >> i) & 1) {
        (sigma_a += expo * dp[i]) %= M;
        (expo *= rem[i]) %= M;
      }
    }

    vl dp2(64), power(64);
    dp2[0] = 1;
    power[0] = 1;
    rep(i,63) {
      dp2[i+1] = (dp2[i] * (1 + rem[i]) + dp[i] * power[i]) % M;
      power[i+1] = power[i] * 2 % M;
    }

    ll expo2 = 1, sum = 0, sigma_b = 0;
    for (int i=63; i>=0; --i) {
      if (((num - 1) >> i) & 1) {
        (sigma_b += sum * power[i] + expo2 * dp2[i]) %= M;
        (sum += expo2 * dp[i]) %= M;
        (expo2 *= rem[i]) %= M;
      }
    }

    (ans *= expo) %= M;
    (ans += (init % M) * sigma_a + (B % M) * sigma_b) %= M;
    init += B * num;
  }

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


Measured memory_bytes: 256
n, m = map(int, input().split())

A = [[0 for am in range(m)] for an in range(n)]
for xn in range(n):
    Anm = [int(x) for x in input().split()]
    for xm in range(m):
        A[xn][xm] = Anm[xm]

b = list(range(m))
for bm in range(m):
    b[bm] = int(input())

for ansn in range(n):
    ans = 0
    for ansm in range(m):
        ans += A[ansn][ansm] * b[ansm]
    print (ans)



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

int main() {
  string str;
  cin >> str;
  map<char, int> count;
  rep(i, str.size()){
    count[str[i]] += 1;
  }
  
  bool judge = 1;
  for (auto p : count){
    if (p.second % 2 == 1){
      judge = 0;
    }
  }
  
  if (judge) cout << "Yes" << endl;
  else cout << "No" << endl;
    
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main() {
	int n; cin >> n;
	int t = 0, h = 0;
	for (int i = 0; i < n; i++){
		string a, b; cin >> a >> b;
		if (a == b){
			t++;
			h++;
		}
		else if (a > b){
			t += 3;
		}
		else if (a < b) {
			h += 3;
		}
	}
	cout << t << ' ' << h << endl;
	return 0;
}

Measured memory_bytes: 3164
#include<bits/stdc++.h>
using namespace std;
int main(){
int A,B,K,c=0;
cin>>A>>B>>K;
for(int i=min(A,B);i>0;i--){
if(A%i==0&&B%i==0){
c++;
if(c==K){
    cout<<i;
    return 0;
}
}
}

return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

#include <string.h>

 

int main(){

	int x,ac,wa,tle,re;	char c[16];

	ac=wa=tle=re=0;

	scanf("%d",&x);

	for(int i=0; i<x; i++){

		scanf("%s",&c);

		if (strcmp(c,"AC") == 0) ac++;

		else if (strcmp(c,"WA") == 0) wa++;

		else if (strcmp(c,"TLE") == 0) tle++;

		else if (strcmp(c,"RE") == 0) re++;

	}

	printf("AC x %d\n", ac);

	printf("WA x %d\n", wa);

	printf("TLE x %d\n", tle);

	printf("RE x %d\n", re);

 

	return 0;

}

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

int main() {

	string s; cin >> s;
	int ans = 0;
	for (int i = 0; i < 4; i++) {
		if (s[i] == '2') ans++;
	}	
	cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3600
#include<iostream>
#include <stdio.h>
#include <string>
#include <vector>
#include <math.h>
using namespace std;
string p;
	int main(){
		getline(cin,p);
		int f=p.size();
			for(int i=0;i<f;i++){
				*p.begin()=toupper(*p.begin());
				cout<<*p.begin();
			p.erase(p.begin());
			}
		cout<<endl;
		return 0;}


Measured memory_bytes: 1188
#include <iostream>
#include <algorithm>

using namespace std;

char pie[9][4], dat[3][3][4];
bool used[9];
int ans, T;
int dy[4] = {-1, 0, 1, 0};
int dx[4] = {0, 1, 0, -1};

void rec(int y, int x){
  if(y == 3){ ans++; return; }
  for(int i=0;i<9;i++){
    if(used[i]) continue;
    used[i] = true;
    for(int j=0;j<4;j++){
      for(int k=0;k<4;k++) dat[y][x][k] = pie[i][(j+k)%4];
      bool f = true;
      for(int k=0;k<4;k++){
        int ny = y + dy[k];
        int nx = x + dx[k];
        if(min(ny, nx) < 0 || max(ny, nx) >= 3) continue;
        char nc = dat[ny][nx][(k+2)%4];
        char c = dat[y][x][k];
        if('a' <= c && c <= 'z' && !(nc == 'A' + (c - 'a') || nc == '@')) f = false;
        if('A' <= c && c <= 'Z' && !(nc == 'a' + (c - 'A') || nc == '@')) f = false;
      }
      if(f) rec((y*3+x+1)/3, (y*3+x+1)%3);
      for(int k=0;k<4;k++) dat[y][x][k] = '@';
    }
    used[i] = false;
  }
}

main(){
  cin >> T;
  while(T--){
    for(int i=0;i<9;i++) for(int j=0;j<4;j++) cin >> pie[i][j];
    ans = 0;
    fill(dat[0][0], dat[3][0], '@');
    fill(used, used+9, false);
    rec(0, 0);
    cout << ans << endl;
  }
}

Measured memory_bytes: 1160
#include<stdio.h>
#include<algorithm>
#include<iostream>
#include<queue>
#include<cmath>
#include<string.h>
#include<set>
#include<map>
#define LL long long
#define pr pair<int,int>
#define fr first
#define sc second
//#define mp make_pair
using namespace std;
LL read( ){LL sum=0;char c=getchar( );bool f=0;while(c<'0' || c>'9') {if(c=='-') f=1;c=getchar( );}while(c>='0' && c<='9') {sum=sum*10+c-'0';c=getchar( );}if(f) return -sum;return sum;}
void read(int &sum){sum=0;char c=getchar( );bool f=0;while(c<'0' || c>'9') {if(c=='-') f=1;c=getchar( );}while(c>='0' && c<='9') {sum=sum*10+c-'0';c=getchar( );}if(f) sum=-sum;}
void read(LL &sum){sum=0;char c=getchar( );bool f=0;while(c<'0' || c>'9') {if(c=='-') f=1;c=getchar( );}while(c>='0' && c<='9') {sum=sum*10+c-'0';c=getchar( );}if(f) sum=-sum;}
const int N=100005;
int n,K,ans=0;
char S[N];bool rev[N];
struct ex{int l,r,val;}E[N];
bool cmp(ex a,ex b) {return a.val>b.val;}
void DEAL(char A)
{
  int i,j,l,r,t=0;
  for(i=1;i<=n;)
    {
      if(S[i]==A)
	{
	  l=r=i;
	  while(S[r]==A) r++;
	  j=2;if(l==1) j--;if(r>n) j--;
	  E[++t]=(ex){l,r-1,j};
	  i=r;
	}
      else i++;
    }
  sort(E+1,E+t+1,cmp);
  for(i=1;i<=n;i++) rev[i]=0;
  for(i=1;i<=min(K,t);i++)
    for(j=E[i].l;j<=E[i].r;j++) rev[j]=1;
  int a=0;
  for(i=2;i<=n;i++)
    if((S[i]==S[i-1])^rev[i]^rev[i-1]) a++;
  ans=max(a,ans);
}
int main( )
{
  read(n);read(K);
  scanf("%s",S+1);
  DEAL('L');
  DEAL('R');
  printf("%d",ans);
  return 0;
}


Measured memory_bytes: 1024
/* Author : Aaryan Srivastava ^__^ */ 
#include <bits/stdc++.h>
#include <random>
#include <chrono>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
#define pb push_back
#define popb pop_back
#define mt make_tuple 
#define eb emplace_back
#define mp make_pair
#define ff first
#define ss second 
#define ull unsigned long long  
#define pii pair<int, int>
#define piii pair<int,pii>
#define beg begin
#define rep(i,n) for(int (i) = 0 ; i < (n) ; i++)
#define repA(i,x,y) for(int i = (x) ; i <= (y) ; i++)
#define repD(i,x,y) for(int i = (x) ; i >= (y) ; i--)
#define all(c) (c).begin(),(c).end()
#define fill(a,val) memset(a,val,sizeof(a))
#define Randomize mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#define int ll
using ll = long long;
const int N = 3*1e5 +5 ;
const int mod = 1e9 + 7 ;
const int inf = 1e18 ;
const int SZ = 101 ;
const double eps = 1e-9 ;
using namespace __gnu_pbds;
using namespace std;
using ordered_set =  tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ;

#ifdef AaryanS
#define mycout cout
#define mycerr cerr 
#endif

#ifndef AaryanS
#define mycout if(false) cout
#define mycerr if(false) cerr
#endif

int dp[N] , chck[N]; 

void solve()
{
	int n ;
	cin >> n ; 
	int m ;
	cin >> m ;
	rep(i,m){
		int x;
		cin >> x ;
		chck[x] = true ; 
	}
	dp[0] = 1; 
	for(int i = 1 ; i <= n ; ++i){
		if(chck[i]) continue ;
		dp[i] = dp[i-1] ;
		if(i >= 2) dp[i] += dp[i-2] ;
		dp[i] %= mod ; 
	}
	cout << dp[n] << endl ;
}   

     
int32_t main(int32_t argc, char *argv[])
{
    double t1 = clock() ;
    ios::sync_with_stdio(0);    
    cin.tie(0); cout.tie(0);
    int TC = 1, t = 0;
    //cin >> TC ;
    while(t++ < TC)
    {
        //cout << "Case #" << t << ": " ;
        solve();
        //cout << endl ;
    }
    mycerr << "Time : " << 1000 *(clock() - t1)/CLOCKS_PER_SEC << " ms\n" ;
    return 0;
}

Measured memory_bytes: 3072
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
typedef pair<int, int> P;
ll Mod = 1000000007;
int main() {
  int N;
  cin >> N;
  ll a[N];
  ll XOR = 0;
  for (int i = 0; i < N; i++) {
    cin >> a[i];
    XOR ^= a[i];
  }
  bool can = true;
  if (XOR != 0) {
    can = false;
  }
  
  if (can) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
inline int read()
{
	int x;char c;
	while((c=getchar())<'0'||c>'9');
	for(x=c-'0';(c=getchar())>='0'&&c<='9';)x=x*10+c-'0';
	return x;
}
#define MN 200000
struct edge{int nx,t;}e[MN*2+5];
int h[MN+5],en,f[MN+5][2],q[MN+5],qn;
char s[MN+5];
inline void ins(int x,int y)
{
	e[++en]=(edge){h[x],y};h[x]=en;
	e[++en]=(edge){h[y],x};h[y]=en;
}
int main()
{
	int n,m,i,j;
	n=read();m=read();
	scanf("%s",s+1);
	while(m--)ins(read(),read());
	for(i=1;i<=n;++i)for(j=h[i];j;j=e[j].nx)++f[i][s[e[j].t]-'A'];
	for(i=1;i<=n;++i)if(!f[i][0]||!f[i][1])q[++qn]=i;
	for(i=1;i<=qn;++i)for(j=h[q[i]];j;j=e[j].nx)
		if(f[e[j].t][0]&&f[e[j].t][1]&&!--f[e[j].t][s[q[i]]-'A'])q[++qn]=e[j].t;
	puts(qn<n?"Yes":"No");
}

Measured memory_bytes: 6528
#include <bits/stdc++.h>
#include<iostream>
using namespace std;
int main() {
    string S, T;
    cin >> S >> T;
    int len = S.length();
    string answer = "No";
    for (int i=0; i < len; i++) {
        if (S == T) {
            answer = "Yes";
            break;
        }

        rotate(S.rbegin(), S.rbegin() + 1, S.rend());
    }

    cout << answer << endl;
    return 0;
}

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

using namespace std;

#define MOD 1000000007

long long int dizi[10000005]; 

long long int hizlius(long long int a,long long int b)
{
	if(b==0){
		return 1;
	}
	if(b==1){
		return a;
	}
	long long int kl=hizlius(a,b/2);
	if(b%2==0){
		return (kl*kl)%MOD;
	}
	if(b%2==1){
		return (((kl*kl)%MOD)*a)%MOD;
	}
	
}  

long long int com(long long int a,long long int b){
	long long int c=b;
	long long int d=a-b;
	long long int reelc=hizlius(dizi[c],MOD-2);
	long long int reeld=hizlius(dizi[d],MOD-2);
	return (((dizi[a]*reelc)%MOD)*reeld)%MOD;
	
}

int main(){
	long long int a,b;
	cin>>a>>b;
	long long int x,y;
	x=(2*a-b)/3;
	y=(2*b-a)/3;
	long long int ls=max(x+y,b);
	dizi[0]=1;
	for(long long int i =1;i<x+y+2;i++){
		dizi[i]=(dizi[i-1]*i)%MOD;
	}
	if(max(a,b)/2 > min(a,b)){
		cout<<0;
		return 0;
	}
	if((a+b)%3!=0){
		cout<<0<<endl;
		return 0;
	}
	cout<<com(x+y,y);
	//x+y
	// y
	
	
}

Measured memory_bytes: 6400
N = int(input())
A = list(map(int,input().split()))

freqs = {}
for ball in A:
	freqs[ball] = freqs.get(ball, 0) + 1
    
unbanned = 0
for v in freqs.values():
	unbanned += (v * (v - 1)) // 2
    
for ball in A:
	print(unbanned - freqs[ball] + 1)

Measured memory_bytes: 24996
H, W = map(int, input().split())
A = [list(map(int, input().split())) for _ in range(H)]
B = [list(map(int, input().split())) for _ in range(H)]
diffs = [[abs(A[i][j] - B[i][j]) for j in range(W)] for i in range(H)]
max_diff = 0
for diff in diffs:
    max_diff = max(max_diff, max(diff))
r_k = max_diff*(H+W)//2+1
dp = [[[False] * r_k for _ in range(W)] for _ in range(H)]
dp[0][0][0] = True
for i in range(H):
    for j in range(W):
        diff = diffs[i][j]
        dp_ = dp[i][j]
        if j < W-1:
            dpj = dp[i][j + 1]
            for k in range(r_k):
                if dp_[k] == True:
                    dpj[abs(k - diff)] = True
                    if k+diff<r_k:
                        dpj[k + diff] = True
        if i < H - 1:
            dpi = dp[i + 1][j]
            for k in range(r_k):
                if dp_[k] == True:
                    dpi[abs(k-diff)] = True
                    if k+diff < r_k:
                        dpi[k + diff] = True

ans = pow(80, 3)
diff = diffs[H-1][W-1]
for k, flg in enumerate(dp[H - 1][W - 1]):
    if flg:
        ans = min(ans, abs(k-diff), k+diff)
print(ans)


Measured memory_bytes: 396440
# import sys
# input = sys.stdin.readline
k = int(input())
s = input()
n = len(s)
mod = 10**9 + 7
l = 2*10**6 + 3

a25 = [1]
for i in range(l):
    a25.append((a25[-1] * 25) % mod)
a26 = [1]
for i in range(l):
    a26.append((a26[-1] * 26) % mod)


mod = 10**9 + 7


M = [1]  # i!のmod
m = 1
for i in range(1, l):
    m = (m * i) % mod
    M.append(m)

def pow(x, y, mod):  # x**y の mod を返す関数
    ans = 1
    while y > 0:
        if y % 2 == 1:
            ans = (ans * x) % mod
        x = (x**2) % mod
        y //= 2
    return ans

def inv(x, mod):  # x の mod での逆元を返す関数
    return pow(x, mod-2, mod)

# print(inv(8,13))

MI = [0] * (l-1) +[inv(M[l-1], mod)]  # i!の逆元
for i in range(l-2, -1, -1):
    MI[i] = MI[i+1] * (i+1) % mod

def C(x, y):  # コンビネーション
    if y < 0 or y > x:
        return 0
    elif x > l:  # O(min(y, x-y))
        y = min(y, x-y)
        ans = 1
        for i in range(x, x-y, -1):
            ans = (ans * i) % mod
        return (ans * MI[y]) % mod
    else:  # O(1)
        ans = M[x]
        ans = (ans * MI[y]) % mod
        return (ans * MI[x-y]) % mod

ans = 0
for i in range(n-1, n+k):
    ans = (ans + C(i, n-1) * a25[i-(n-1)] * a26[n+k-i-1]) % mod
print(ans)

Measured memory_bytes: 234520
#include <cstdio>
int y, m, d;
int main() {
    while (scanf("%d%d%d",&y,&m,&d)!=EOF) {
        if (y==1868) {
            if (m==9) {
                if (d<8) puts("pre-meiji");
                else printf("meiji 1 %d %d\n",m,d);
            } else if (m < 9) {
                puts("pre-meiji");
            } else {
                printf("meiji 1 %d %d\n",m,d);
            }
        } else if (y < 1868) {
            puts("pre-meiji");
        } else if (y>1868&&y<1912) {
            printf("meiji %d %d %d\n",y-1868+1,m,d);
        } else if (y==1912) {
            if (m==7) {
                if (d<30) printf("meiji %d %d %d\n",y-1868+1,m,d);
                else printf("taisho 1 %d %d\n",m,d);
            } else if (m<7) {
                printf("meiji %d %d %d\n",y-1868+1,m,d);
            } else {
                printf("taisho 1 %d %d\n",m,d);
            }
        } else if (y>1912&&y<1926) {
            printf("taisho %d %d %d\n",y-1912+1,m,d);
        } else if (y==1926) {
            if (m==12) {
                if (d<25) printf("taisho %d %d %d\n",y-1912+1,m,d);
                else printf("showa 1 %d %d\n",m,d);
            } else if (m<12) {
                printf("taisho %d %d %d\n",y-1912+1,m,d);
            } else {
                printf("showa 1 %d %d\n",m,d);
            }
        } else if (y>1926&&y<1989) {
            printf("showa %d %d %d\n",y-1926+1,m,d);
        } else if (y==1989) {
            if (m==1) {
                if (d<8) printf("showa %d %d %d\n",y-1926+1,m,d);
                else printf("heisei 1 %d %d\n",m,d);
            } else {
                printf("heisei 1 %d %d\n",m,d);
            }
        } else {
            printf("heisei %d %d %d\n",y-1989+1,m,d);
        }
    }
}

Measured memory_bytes: 0
import java.util.Scanner;

//Time Card
public class Main{

	void run(){
		Scanner sc = new Scanner(System.in);
		for(int i=0;i<3;i++){
			int h = sc.nextInt();
			int m = sc.nextInt();
			int s = sc.nextInt();
			int e = h*3600+m*60+s;
			h = sc.nextInt();
			m = sc.nextInt();
			s = sc.nextInt();
			int t = h*3600+m*60+s-e;
			System.out.println(t/3600+" "+t%3600/60+" "+t%60);
		}
	}

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

Measured memory_bytes: 0
// AtCode.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。

#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <algorithm>
#include <stdint.h>
#include <queue>
#include <bitset>

using namespace std;


int main() {

    int N;
    cin >> N;

    vector<int> P;
    for (int i = 0; i < N; i++) {
        int tmp;
        cin >> tmp;
        P.push_back(tmp);
    }
    vector<int> Q;
    for (int i = 0; i < N; i++) {
        int tmp;
        cin >> tmp;
        Q.push_back(tmp);
    }

    vector<int> orig;
    orig = P;
    sort(orig.begin(), orig.end());

    int countP = 0;
    int countQ = 0;
    int count = 0;
    do {
        if (P == orig) countP = count;
        if (Q == orig) countQ = count;
        count++;
    } while (next_permutation(orig.begin(), orig.end())); // start is fixed

    cout << abs(countP - countQ) << endl;

    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
    int N;
    cin >> N;
    ll A[N];
    for (int i = 0; i < N; i++) {
        cin >> A[i];
    }
    ll m = 1000;
    ll k = 0;
    for (int i = 0; i < N - 1; i++) {
        if (A[i] < A[i + 1] && m != 0) {
            k += m / A[i];
            m = m - (m / A[i]) * A[i];
        } else if (A[i] >= A[i + 1]) {
            m += A[i] * k;
            k = 0;
        }
    }
    cout << m + A[N - 1] * k << "\n";
    return 0;
}

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

#define MAX 100000

int main() {
	int N, d[MAX];
	cin >> N;
	for (int i = 0; i < N; i++)
		cin >> d[i];
	sort(d, d + N);
	cout << d[N / 2] - d[N / 2 - 1] << endl;
	return 0;
}


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

using namespace std;

typedef long long ll;

#ifdef RED
  mt19937 rnd(228);
#else
  mt19937 rnd(chrono::high_resolution_clock::now().time_since_epoch().count());
#endif

const int N = (int)1e6 + 5;
const ll inf = (ll)1e18 + 7;

int n, W;
ll w[N], v[N];
ll dp[105][100005];

int main() {
#ifdef RED
  freopen("a.in", "r", stdin);
#endif
  ios_base :: sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> W;
  for (int i = 1; i <= n; ++i) {
    cin >> w[i] >> v[i];
  }
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= W; ++j) {
      if (w[i] <= j)
        dp[i][j] = max(dp[i - 1][j], dp[i - 1][j - w[i]] + v[i]);
      else
        dp[i][j] = dp[i - 1][j];
    }
  }
  cout << dp[n][W] << "\n";
  return 0;
}


Measured memory_bytes: 83456
parseInt(x) = parse(Int, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)

function main()
	n,k = readline() |> split |> parseMap
	a = readline() |> split |> parseMap
	b = zeros(Int,n+1)
	c = zeros(Int,n+1)
	for i in 1:n
		b[i+1] = b[i] + a[i]
		c[i+1] = c[i] + max(a[i],0)
	end
	m = 0
	for i in 1:n-k+1
		m = max(m,max(b[i+k]-b[i],0)+c[n+1]-c[i+k]+c[i])
	end
	println(m)
end

main()

Measured memory_bytes: 149212
#include <bits/stdc++.h>
#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 all(x) (x).begin(), (x).end()
#define sz(x) int(x.size())
#define get_unique(x) x.erase(std::unique(all(x)), x.end());
typedef long long ll;
const int INF = 1e9;
const ll MOD = 1e9 + 7;
const ll LINF = 1e18;
const double PI = acos(-1);
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;
}
template <class T>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}

int main() {
    int n;
    ll m;
    cin >> n >> m;
    vector<ll> a(n);
    rep(i, n) cin >> a[i];
    sort(all(a));
    vector<ll> s(n + 1, 0);
    rep(i, n) s[i + 1] = s[i] + a[i];

    map<ll, ll> summ, cntt;
    ll ok = 0, ng = LINF;
    while (ng - ok > 1) {
        ll mid = (ok + ng) / 2;
        ll cnt = 0;
        ll sum = 0;
        rep(i, n) {
            int k = lower_bound(all(a), mid - a[i]) - a.begin();
            sum += s[n] - s[k] + a[i] * (n - k);
            cnt += (ll)n - k;
        }
        (cnt >= m ? ok : ng) = mid;
        summ[mid] = sum;
        cntt[mid] = cnt;
    }
    cout << summ[ok] - ok * (cntt[ok] - m) << endl;
}


Measured memory_bytes: 1792
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 998244353 
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
int n,m;
char s[200005];
int dp[200005];
struct seg{
	int seg[(1<<20)];
	void init(){
		fill(seg,seg+(1<<20),INF);
	}
	void update(int a,int x){
		a += (1<<19)-1; seg[a] = x;
		while(a){
			a = (a-1)/2;
			seg[a] = min(seg[a*2+1],seg[a*2+2]);
		}
	}
	int query(int a,int b,int k,int l,int r){
		if(a > b) return INF;
		a += (1<<19)-1;
		b += (1<<19)-1;
		int ret = INF;
		while(a <= b){
		    if((a&1) == 0) { ret = min(ret,seg[a++]); }
		    if((b&1) == 1) { ret = min(ret,seg[b--]); }
		    if(a > b) break;
		    a = (a-1)>>1;
		    b = (b-1)>>1;
		}
		return ret;
	}
}kaede;
vector<int>X[200005];
int main(){
	scanf("%d%d",&n,&m);
	scanf("%s",&s);
	kaede.init();
	dp[n] = 0;
	kaede.update(n,0);
	for(int i=n-1;i>=0;i--){
		int x = i+1;
		int y = i+m;
		int ans = kaede.query(x,y,0,0,(1<<19)-1)+1;
		if(s[i] == '1') ans = INF;
		dp[i] = ans;
		kaede.update(i,ans);
	}
	if(dp[0] >= INF){
		cout << -1 << endl;
		return 0;
	}
	vector<int>ans;
	for(int i=0;i<=n;i++){
		int v = kaede.query(i,i,0,0,(1<<19)-1);
		if(v > 200000) continue;
		//cout << i << " " << v << endl;
		X[v].pb(i);
	}
	int cur = 0;
	while(dp[cur]){
		int f = dp[cur]-1;
		int k = POSU(X[f],cur); //cout << cur << endl;
		//assert(k);
		int go = X[f][k];
		ans.pb(go-cur);
		cur = go;
		//cout << cur << " " << go << endl;
	}
	assert(cur == n);
	rep(i,ans.size()) cout << ans[i] << '\n' ;
}

Measured memory_bytes: 13308
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define se second
#define fi first
#define ll long long int
#define INF INT_MAX
#define mod
#define chutiyaap ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
using namespace std;
ll MinimumNumIncreasingSubsequences(ll arr[], ll n) 
{ 
    multiset<ll> last;
    for (ll i = 0; i < n; i++) {
        multiset<ll>::iterator it = last.lower_bound(arr[i]);
        if (it == last.begin()) 
            last.insert(arr[i]); 
  
        else { 
            it--; 
            last.erase(it); 
            last.insert(arr[i]);  
        } 
    } 
    return last.size();
} 
int main()
{
	chutiyaap;
	ll n;cin>>n;
	ll a[n+1];for(ll i=0;i<n;i++)cin>>a[i];
	cout<<MinimumNumIncreasingSubsequences(a,n);
}


Measured memory_bytes: 5760
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		double r = sc.nextDouble();
		double area = Math.PI * r * r;
		double circle = 2 * Math.PI * r;
		System.out.printf("%.6f%s%.6f", area," ",circle);
	}
}

Measured memory_bytes: 28008
import java.util.*;
import static java.lang.System.*;
public class Main {
public static void main(String[] args){
Scanner sc = new Scanner(in);
int H=sc.nextInt();
int W=sc.nextInt();
int[][] a=new int[H][W];
for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
        a[i][j]=sc.nextInt();
    }
}
String[] s=new String[W*H];
int c=0;
for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
        if(a[i][j]%2!=0){
            if(i!=H-1){
                s[++c]=String.valueOf(i+1)+" "+String.valueOf(j+1)+" "+String.valueOf(i+2)+" "+String.valueOf(j+1);
                
                a[i][j]--;
                a[i+1][j]++;
            }else if(j!=W-1){
                s[++c]=String.valueOf(i+1)+" "+String.valueOf(j+1)+" "+String.valueOf(i+1)+" "+String.valueOf(j+2);
                
                a[i][j]--;
                a[i][j+1]++;
            }
        }
    }
}
s[0]=String.valueOf(c);
for (int j = 0; j <= c; j++) {
    out.println(s[j]);
}
}
}


Measured memory_bytes: 108624
#include <stdio.h>

void push(int);
int pop(int);

int s[10];
int top = 0;

int main(){
  int  i, x;

  while(scanf("%d",&x) != EOF){
    if(x != 0)
      push(x);
    else { x = pop(x);
      printf("%d\n",x);
    }
  }
  return 0;
}
void push(int x){
  top++;
  s[top] = x;
}

int pop(int x){
  x = s[top];
  top--;
  return x;
}

Measured memory_bytes: 596
import java.util.*;
import java.math.*;
 
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		// 整数の入
		int n = sc.nextInt();
		int m = sc.nextInt();
		int count[] = new int[m+1];
		
		for(int i=0;i<n;i++){
		    int k = sc.nextInt();
	        for(int j=0;j<k;j++){
	            int a = sc.nextInt();
	            count[a] = count[a]+1;
	            
	        }

		}
		int total =0;
        for(int i=0;i<=m;i++){
            int result = count[i];
            if(result ==n){
                total++;
            }
        }

        System.out.println(total);
 
	}
}

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


def read():
    D, T, S = map(int, input().strip().split())
    return D, T, S


def solve(D, T, S):
    if S * T >= D:
        return "Yes"
    return "No"


if __name__ == '__main__':
    inputs = read()
    outputs = solve(*inputs)
    if outputs is not None:
        print("%s" % str(outputs))


Measured memory_bytes: 9160
a,b=map(int,input().split())
if a>0 and b>0:
    print("Positive")
elif a<=0 and b>=0:
    print("Zero")
elif (abs(b-a)+1)%2==0:
    print("Positive")
elif (abs(b-a)+1)%2==1:
    print("Negative")

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define rep(i, a) for (int i = (int)0; i < (int)a; ++i)
#define rrep(i, a) for (int i = (int)a - 1; i >= 0; --i)
#define REP(i, a, b) for (int i = (int)a; i < (int)b; ++i)
#define RREP(i, a, b) for (int i = (int)a - 1; i >= b; --i)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define popcount __builtin_popcount
using ll = long long;
constexpr ll mod = 1e9 + 7;
constexpr ll INF = 1LL << 60;

template <class T>
inline bool chmin(T &a, T b)
{
	if (a > b)
	{
		a = b;
		return true;
	}
	return false;
}
template <class T>
inline bool chmax(T &a, T b)
{
	if (a < b)
	{
		a = b;
		return true;
	}
	return false;
}

ll gcd(ll n, ll m)
{
	ll tmp;
	while (m != 0)
	{
		tmp = n % m;
		n = m;
		m = tmp;
	}
	return n;
}

ll lcm(ll n, ll m)
{
	return abs(n) / gcd(n, m) * abs(m); //gl=xy
}

using namespace std;


void solve()
{
	int n;
	cin>>n;
	vector<ll>a(n);
	rep(i,n)cin>>a[i];
	ll sum=0;
	rep(i,n)sum+=a[i];
	ll left_l=a[0],left_r=a[1],right_l=0,right_r=0;
	int pos_l=1,pos_r=0;
	for(int i=2;i<n;++i){
		right_r+=a[i];
	}
	ll minv=INF;
	ll x,y;
	for(int i=2;i<n-1;++i){
		right_l+=a[i];
		right_r-=a[i];
		if(chmin(minv,abs(right_l-right_r))){
			x=right_l,y=right_r;
			pos_r=i+1;
		}
	}
	right_l=x,right_r=y;
	ll ans=0;
	ans=max({left_l,left_r,right_l,right_r})-min({left_l,left_r,right_l,right_r});
	for(int i=2;i<n-2;++i){
		left_r+=a[i];
		right_l-=a[i];
		ll min_l=abs(left_r-left_l),min_r=abs(right_r-right_l);
		while(pos_l<i&&chmin(min_l,abs((left_r-a[pos_l])-(left_l+a[pos_l])))){
			left_r-=a[pos_l];
			left_l+=a[pos_l];
			++pos_l;
		}
		while(pos_r<n-1&&chmin(min_r,abs((right_r-a[pos_r])-(right_l+a[pos_r])))){
			right_r-=a[pos_r];
			right_l+=a[pos_r];
			++pos_r;
		}
		//cout<<left_l<<" "<<left_r<<" "<<right_l<<" "<<right_r<<"\n";
		chmin(ans,max({left_l,left_r,right_l,right_r})-min({left_l,left_r,right_l,right_r}));
	}
	cout<<ans<<"\n";
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout << fixed << setprecision(15);
	solve();
	return 0;
}


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

int main(){
    int h,w,i,j;
    cin >> h >> w;
    vector<vector<char>> a(h,vector<char>(w)),ans(h+2,vector<char>(w+2));
    for(i=0;i<h;i++){
        for(j=0;j<w;j++){
            cin >> a.at(i).at(j);
        }
    }
    for(i=0;i<h+2;i++){
        for(j=0;j<w+2;j++){
            if(i==0||i==h+1)ans.at(i).at(j)='#';
            else{
                if(j==0||j==w+1)ans.at(i).at(j)='#';
                else ans.at(i).at(j)=a.at(i-1).at(j-1);
            }
        }
    }
    for(i=0;i<h+2;i++){
        for(j=0;j<w+2;j++){
                cout << ans.at(i).at(j);
        }
        cout << endl;
    }
    return 0;
}

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

int main() {
    int a, b, c, t;
    cin >> a >> b >> c;
    t = 0;
    for (int i = a; i <= b; i++){
        if (c % i == 0){
            t++;
        }
    }
    cout << t << endl;
    return 0;
}

Measured memory_bytes: 3096
N = int(input())
s = input()
a = [0]*N
for i in range(1,N):
    if s[i]=="E":
        a[0] += 1 
for i in range(1,N):
    a[i] = a[i-1]
    if s[i]=="E":
        a[i] -= 1
    if s[i-1] == "W":
        a[i] += 1
print(min(a))

Measured memory_bytes: 20928
#include <stdio.h>
int main(void){
	int x,a,b,m,n;
	scanf("%d %d %d",&x,&a,&b);
	if(x>=a){
		m=x-a;
	}
	else{
		m=a-x;
	}
	if(x>=b){
		n=x-b;
	}
	else{
		n=b-x;
	}
	if(m>n){
		printf("B");
	}
	else{
		printf("A");
	}
	return 0;
} 

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;


int main(){
  string s;
  cin >> s;
  for(int i=0 ; i<s.size(); i++){
    //int aaa = s.at(i) - '0';
    //cout << aaa << " " ;
  } //cout << endl;
  int n = s.size();
  
  ll ans = 0;
  for(int i=0; i<(1<<(n-1)); i++){//例: n=3の場合 i<2^2 4回ループする   
    ll num = 0;//addする数字を一時保存する箱
    
    for(int j=n-1; j>=0; j--){//例:s=124なら j=0,1,2の3回ループ
      if(i & (1<<j)){//iを二進表記したときに (右から)j番目が1なら...
        ans += num;//分割('+'を挿入する)と考え，ansにaddする
        //cout << "yah1 i: "<< i <<" ans: " << ans <<  " num: " << num << endl;
        num = 0;
        num = s.at(n-j-1) - '0';
      }
      else{//'+'を挿入しないなら
        num = num * 10;//今の数字を10倍
        num += s.at(n-j-1) - '0'; //右からj番目(左からn-j-1番目)の数字を足す
      }
    }
    ans += num; //最後は+が挿入されないので，
    //cout <<"yah2 i: " << i <<" ans: " << ans << " num: " << num << endl;
  }
    
  cout << ans << endl;
  
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)
 
#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)
 
#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))
 
template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}
 
using namespace std;
using ll=long long;
 
const int limit=3000;
bool isprime[limit+1];
vector<ll> prime;
 
void init(){
	rep(i,limit+1) isprime[i]=true;
	isprime[0]=isprime[1]=false;
	for(ll i=2;i*i<=limit;++i){
		if(isprime[i]){
			prime.push_back(i);
			for(ll j=i*i;j<=limit;j+=i)
				isprime[j]=false;
		}
	}
	return;
}
 
map<ll,int> cnt;
 
int main(void){
	init();
	const int m=prime.size();
 
	int n;
	cin >> n;
	rep(i,n){
		ll cur;
		cin >> cur;
 
		rep(j,m){
			ll cube=1LL*prime[j]*prime[j]*prime[j];
			while(cur%cube==0) cur/=cube;
		}
		cnt[cur]++;
	}
 
	ll ans=0LL;
 
	/*
	for(auto &it:cnt){
		cout << it.first << " " << it.second << " " << comp[it.first] << endl;
	}
	*/
 
	for(auto &it:cnt){
		if(it.first==1)
			ans+=min<ll>(1LL,it.second);
		else{
			ll tar=1LL*it.first*it.first;
			rep(j,m){
				ll cube=1LL*prime[j]*prime[j]*prime[j];
				while(tar%cube==0) tar/=cube;
			}
			ans+=max<ll>(it.second,cnt[tar]);
			it.second=0LL;
			cnt[tar]=0LL;
		}
	}
	cout << ans << endl;
	return 0;	
}

Measured memory_bytes: 21376
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main()
{
    string s;
    cin>>s;
    long int l=s.length(),i=0,c=0;
    while(i!=l)
    {
        if(s[i]=='o')
        {
            c++;
        }
        i++;
    }
    c+=(15-l);
    if(c>=8)
    {
        cout<<"YES\n";
    }
    else
    {
        cout<<"NO\n";
    }
    
        
    return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.PriorityQueue;

public class Main{
	public static void main(String[] args)throws IOException{
		InputStreamReader isr = new InputStreamReader(System.in);
		BufferedReader reader = new BufferedReader(isr);
		
		PriorityQueue<Pair> que = new PriorityQueue<Pair>();
		int INT;
		double DOB;
		for(int i = 0; i < 3; i++){
			PriorityQueue<Pair> hoge = new PriorityQueue<Pair>();
			for(int j = 0; j < 8; j++){
				String str[] = reader.readLine().split(" ");
				INT = Integer.valueOf(str[0]);
				DOB =  Double.valueOf(str[1]);
				hoge.add(new Pair(DOB, INT));
			}
			System.out.println(hoge.peek().INT + " " + hoge.poll().DOB);
			System.out.println(hoge.peek().INT + " " + hoge.poll().DOB);
			
			while(!hoge.isEmpty()){ que.add(hoge.poll()); }
		}
		System.out.println(que.peek().INT + " " + que.poll().DOB);
		System.out.println(que.peek().INT + " " + que.poll().DOB);
		
		reader.close();
	}
}

class Pair implements Comparable<Pair>{
	int INT;
	double DOB;
	Pair(double DOB, int INT){
		this.INT = INT;
		this.DOB = DOB;
	}
	@Override
	public int compareTo(Pair e) {
		return DOB < e.DOB ? -1 : 1;
	}
}

Measured memory_bytes: 24540
#include <bits/stdc++.h>
using namespace std;
#define SORT(a) sort((a).begin(), (a).end())
#define RSORT(a) reverse((a).begin(), (a).end())
#define rep(i, a, b) for (int64_t i = (a); i < (b); ++i)
const int MOD = 1e9 + 7;
typedef long long ll;
const long long INF = 1LL << 60;

int main() {
  int n;
  string s;
  cin >> n >> s;
  vector<int> a(123);
  ll total = 1;
  for (int i = 0; i < n; i++) a[(int)s[i]]++;

  for (int i = 97; i <= 122; i++) {
    total *= a[i] + 1;
    total %= MOD;
  }
  cout << (total + MOD - 1) % MOD << endl;
}

Measured memory_bytes: 512
import java.util.Scanner;

public class Main {
    static Scanner sc = new Scanner(System.in);

    private static double waterBottle(int a, int b, int x) {
        if (2 * x <= a * a * b) {
            return Math.toDegrees(Math.atan((double) a * b * b / (2 * x)));
        } else if (x < a * a * b) {
            return Math.toDegrees(Math.atan((double) (2 * (a * a * b - x)) / (a * a * a)));
        }
        return 0;

    }

    public static void main(String[] args) {
        int a = sc.nextInt();
        int b = sc.nextInt();
        int x = sc.nextInt();
        System.out.println(waterBottle(a, b, x));
    }
}

Measured memory_bytes: 23252
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<set>
#include<queue>
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pb push_back
#define rep(i,n) for(ll i=0;i<n;i++)
#define INF 1e9+7
#define LLINF 1e18
using namespace std;
const ll MOD = 1e9 +7;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,k;
    string s;
    cin>>n>>s>>k;
    rep(i,n){
        if(s[i]!=s[k-1]){
            s[i]='*';
        }
    }
    cout<<s<<endl;
    return 0;
}

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

#define REP(i, a, b) for (int i = int(a); i < int(b); i++)
using namespace std;
typedef long long int ll;

// clang-format off
#ifdef _DEBUG_
#define dump(...) do{ cerr << __LINE__ << ":\t" << #__VA_ARGS__ << " = "; PPPPP(__VA_ARGS__); cerr << endl; } while(false)
template<typename T> void PPPPP(T t) { cerr << t; }
template<typename T, typename... S> void PPPPP(T t, S... s) { cerr << t << ", "; PPPPP(s...); }
#else
#define dump(...)
#endif
template<typename T> vector<T> make_v(size_t a, T b) { return vector<T>(a, b); }
template<typename... Ts> auto make_v(size_t a, Ts... ts) { return vector<decltype(make_v(ts...))>(a, make_v(ts...)); }
template<typename T>
bool chmin(T &a, T b) { if (a > b) {a = b; return true; } return false;}
template<typename T>
bool chmax(T &a, T b) { if (a < b) {a = b; return true; } return false;}
// clang-format on

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    string s, t;
    cin >> s >> t;
    int ans = 0;
    REP(i, 0, 3) {
        ans += (s[i] == t[i]);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <cstdio>

using namespace std;

int main() {
  int n;
  double x1, x2, x3, y1, y2, y3, x, y,
         a1, b1, c1, a2, b2, c2, r;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
    a1 = 2 * (x2 - x1);
    b1 = 2 * (y2 - y1);
    c1 = x1*x1 - x2*x2 + y1*y1 - y2*y2;
    a2 = 2 * (x3 - x1);
    b2 = 2 * (y3 - y1);
    c2 = x1*x1 - x3*x3 + y1*y1 - y3*y3;
    x = (b1*c2 - b2*c1) / (a1*b2 - a2*b1);
    y = (c1*a2 - c2*a1) / (a1*b2 - a2*b1);
    r = sqrt((x - x1) * (x - x1) + (y - y1) * (y - y1));
    printf("%.3lf %.3lf %.3lf\n", x, y, r);
  }

  return 0;
}

Measured memory_bytes: 0
#include<cstdio>
#include<algorithm>
using namespace std;
typedef long long ll;
ll n,sq,u,v;
int main()
{
	sq=1000000000;
	scanf("%lld",&n);
	if(n<=sq)printf("0 0 1 0 0 %lld\n",n);
	else
	{
		u=n/sq;v=n%sq;
		if(v==0)
		{
			printf("0 0 %lld 0 0 %lld\n",sq,u); 
		}
		else
		{
			printf("0 0 %lld 1 %lld %lld",sq,sq-v,u+1);
		}
	}	
	return 0;
 } 

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

int main()
{
    string s;
    cin>>s;
    int x=s.size();
    if(s[x-1]!='s')
        s=s+"s";
    if(s[x-1]=='s')
        s=s+"es";
    cout<<s<<endl;
    return 0;
}


Measured memory_bytes: 3628
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#define ll long long
#define rep(i,n) for(ll i=0;i<(n);i++)
#define max(p,q) ((p)>(q)?(p):(q))
#define min(p,q) ((p)<(q)?(p):(q))
#define chmax(a,b) ((a)=(a)>(b)?(a):(b))
#define chmin(a,b) ((a)=(a)<(b)?(a):(b))
#define abs(p) ((p)>=(0)?(p):(-(p)))
#define MOD 1000000007
ll powll(ll a,ll b){ll r=1;rep(i,b){r*=a;}return r;}
#define swap(a,b) do{ll w=(a);(a)=(b);(b)=w;}while(0)
#define swapd(a,b) do{double w=(a);(a)=(b);(b)=w}while(0)
#define in(a) scanf("%lld", &(a))
#define in2(a,b) scanf("%lld %lld",&(a),&(b))
#define in3(a,b,c) scanf("%lld %lld %lld",&(a),&(b),&(c))
#define ind(a) scanf("%lf", &(a))
#define ins(a) scanf("%s", (a))
#define inc(a) scanf("%c", &(a))
#define put(a) printf("%lld\n", (a))
#define putd(a) printf("%.15f\n", (a))
//      puts(a) printf("%s\n", a) 文字はこっち
//your code here!
int main(void){
    ll alph[26]={0}, i=0;
    char S[30];
    ins(S);
    while(S[i]!='\0'){
        if(alph[S[i]-'a']){
            puts("no");
            return 0;
        }
        alph[S[i++]-'a']++;
    }
    puts("yes");
    return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
using namespace std;

int main(void)
{
	int X;
	int N;
	
	cin >> X >> N;
	
	vector<int> p(N);
	vector<int> forbidden;
	for(int i = 0; i < N; i++)
	{
		cin >> p[i];
	}
	
	for(int data = -101; data <= 101; data++)
	{
		bool hit = false;
		for(int i = 0; i < N; i++)
		{
			if(p[i] == data)
			{
				hit = true;
			}
		}
		
		if(hit == false)
		{
			forbidden.push_back(data);
		}
	}
	
	/*for(int i = 0; i < forbidden.size(); i++)
	{
		cout << forbidden[i] << endl;
	}*/
	
	int nearforbidden_num = 10000;
	int min_forbidden = 10000;
	
	//絶対値を計算
	for(int i = 0; i < forbidden.size(); i++)
	{
		int nearX = abs(X - forbidden[i]);
		//cout << "nearX = " << nearX << endl;
		if(nearX < nearforbidden_num)
		{
			nearforbidden_num = nearX;
			min_forbidden = forbidden[i];
			
			/*
			cout << "nearforbidden_num = " << nearforbidden_num << endl;
			cout << "min_forbidden = " << min_forbidden << endl;
			*/
		}
	}
	
	cout << min_forbidden << endl;
	
	return 0;
}


Measured memory_bytes: 3632
N,D=map(int,input().split())
X=[list(map(int,input().split())) for i in range(N)]
ans=0

def dist(a,b):
    res=0
    for i in range(D):
        res+=(a[i]-b[i])**2
    res=res**0.5
    return res

for i in range(N-1):
    for j in range(i+1,N):
        if dist(X[i],X[j]).is_integer():
            ans+=1
print(ans)

Measured memory_bytes: 3188