akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <set>
using namespace std;

int main() {
    string s;
    cin >> s;
    pair<int, int> result {-1, -1};
    for (char c : set<char>(begin(s), end(s))) {
        int count = 0, start = 0;
        for (int i = 0; i < s.size(); i++) {
            if (s[i] == c) {
                count++;
            } else {
                count--;
                if (count < 0) {
                    count = 0;
                    start = i + 1;
                }
            }
            if (i - start >= 1 && count > 0) {
                result = {start + 1, i + 1};
            }
        }
    }
    cout << result.first << ' ' << result.second;
    return 0;
}


Measured memory_bytes: 512
#include<iostream>
#include<cmath>


using namespace std;

int main(){
    float a,b,alow,ahigh,blow,bhigh;
    cin>>a>>b;
    alow = a/0.08;
    ahigh = (a+1)/0.08;
    blow = b/0.1;
    bhigh = (b+1)/0.1;
    if(ahigh < blow || bhigh < alow){
        cout<<-1<<endl;
    }
    else if(floor(blow) == floor(ahigh) || floor(bhigh) == floor(alow)){
        cout<<-1<<endl;
    }
    else{
        cout<<ceil(max(alow,blow));
    }
}

Measured memory_bytes: 256
// The moment you think of giving up you have already lost the battle
#include <iostream>
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
typedef long long int ll;
typedef long double dl;
#define PI  3.14159265358979323846
#define Mod 1000000007
ll fast(ll n,ll a,ll m)
{
    if(n==0)
        return 1;
    else if(n==1)
        return a;
    else
    {
        ll r=fast(n/2,a,m);
        if(n%2==0)
        {
            return (((r%m)*(r%m))%m);
        }
        else
        {
            return (((((r%m)*a)%m)*r)%m);
        }
    }
}

int main()
{
  ll n,i;
  cin>>n;
  ll A[n];
  for(i=0;i<n;i++)
  {
      cin>>A[i];
  }
  ll ans=0;

  map<ll,ll> cnt;
  for(i=1;i<=n;i++)
  {
      ans+=cnt[A[i-1]-i];
      cnt[-(A[i-1]+i)]++;

  }
  cout<<ans;
}


Measured memory_bytes: 27880
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
const int INF = (1<<30)-1;
const long long LINF = (1LL<<62)-1;
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, 1, 0, -1};
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, m;
  cin >> n >> m;
  vector<vector<int>> to(n);
  rep(i, m) {
    int s, t;
    cin >> s >> t;
    --s, --t;
    to[s].push_back(t);
  }
  vector<double> dp1(n);
  for (int now = n-2; now >= 0; now--) {
    for (auto next : to[now])
      dp1[now] += (dp1[next]+1)/to[now].size();
  }
  double ans = dp1[0];
  rep(i, n-1) {
    double mx = 0;
    int idx = 0;
    rep(j, to[i].size()) {
      if (chmax(mx, dp1[to[i][j]]))
        idx = j;
    }
    vector<double> dp2(n);
    bool flag = true;
    for (int now = n-2; now >= 0; now--) {
      int sz = (int)to[now].size()-(now == i);
      if (!sz) {
        flag = false;
        break;
      }
      rep(j, to[now].size()) {
        if (now == i && j == idx)
          continue;
        int next = to[now][j];
        dp2[now] += (dp2[next]+1)/sz;
      }
    }
    if (flag)
      chmin(ans, dp2[0]);
  }
  cout << fixed << setprecision(9) << ans << endl;
  return 0;
}

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

#define REP(i,num) for(int i=0;i<(num);++i)
#define LOOP(i) while(i--)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto pitr=c.begin();pitr!=c.end();++pitr){cout<<*pitr;if(next(pitr,1)!=c.end())cout<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

vector<ll> enum_div(ll n){
	vector<ll> ret;
	for(ll i=1;i*i<=n;++i){
		if(n%i==0){
			ret.push_back(i);
			if(i*i!=n){
				ret.push_back(n/i);
			}
		}
	}
	return ret;
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);

	ll N=in<ll>();
	auto D=enum_div(N);
	sort(ALL(D),greater<ll>());

	ll S=0;
	int M=D.size();
	REP(i,M-1){
		ll V=D[i]-1LL;
		if(N/V==N%V) S+=V;
	}

	out(S);
	return 0;
}


Measured memory_bytes: 384
program ABC162_A
  character(3)::N
  read(5,*)N
  if(N(1:1)=='7') then
     write(6,*)'Yes'
  else if(N(2:2)=='7' .or. N(3:3)=='7') then
     write(6,*) 'Yes'
  else
     write(6,*)'No'
  end if
end program ABC162_A

Measured memory_bytes: 2788
#include<stdio.h>

int min(int a, int b){
  return (a < b) ? a : b;
}

int main(){
  int n, m, k, i, j, a, b, cost, time, p, q, r, Time[100][100], Cost\
[100][100];

  while(scanf("%d%d", &n, &m), n+m){
    for(i=0; i<100; i++){
      for(j=0; j<100; j++){
        if(i!=j){
          Time[i][j] = 100000;
          Cost[i][j] = 100000;
        }else{
          Time[i][j] = 0;
          Cost[i][j] = 0;
        }
      }
    }
    for(i=0; i<n; i++){
      scanf("%d%d%d%d", &a, &b, &cost, &time);
      Cost[a-1][b-1] = cost;
      Cost[b-1][a-1] = cost;
      Time[a-1][b-1] = time;
      Time[b-1][a-1] = time;
    }
    for(k=0; k<m; k++){
      for(i=0; i<m; i++){
        for(j=0; j<m; j++){
          Cost[i][j] = min(Cost[i][j], Cost[i][k]+Cost[k][j]);
          Time[i][j] = min(Time[i][j], Time[i][k]+Time[k][j]);
        }
      }
    }
    scanf("%d", &k);
    for(i=0; i<k; i++){
      scanf("%d%d%d", &p, &q, &r);
      if(r==0){
        printf("%d\n", Cost[p-1][q-1]);
      }else{
        printf("%d\n", Time[p-1][q-1]);
      }
    }
  }
  return 0;
}

Measured memory_bytes: 676
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <numeric>
#include <cmath>
using namespace std;
int main() {
  vector<int> a(3);
  cin >> a[0] >> a[1] >> a[2];
  cout << max(a[0], max(a[1], a[2])) - min(a[0], min(a[1], a[2])) << endl;
}

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

int main()
{
	int n;
	cin >> n;
	vector<int> a(n);
	for(int i = 0;i<n;i++)
	{
		cin >> a[i];
	}
	a.push_back(0);
	int ans = 0;
	for(int i = 0;i<100;i++)
	{
		//bool flag = false;
		for(int j = 0;j<n;j++)
		{
			if(a[j]>0&&a[j+1]<=0)ans++;
			a[j]--;
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cstdio>
#include <queue>
#include <algorithm>
#include <functional>
#include <string>
#include <queue>
#include <cmath>
#include <iomanip>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <random>
#include <unordered_map>
#include <unordered_set>
#define ll long long
#define fr(i,k,N) for(ll i=k; i<N;i++)
#define rep(i,N) for(ll i=0; i<N;i++)
#define alll(v) v.begin(),v.end()
using namespace std;
template <class X> void pr(X test){cout<<test<<endl;}
template <class X> void prr(X test){for(auto it:test){cout<<it;}cout<<endl;}


int main() {
    ll n,c;
    cin>>n>>c;
    ll d[c+1][c+1];
    ll m[n+1][n+1];
    rep(i, c) rep(j, c){
        cin >> d[i+1][j+1];
    }
    rep(i, n) rep(j, n){
        cin >> m[i+1][j+1];
    }
    vector<pair<int, int>> v[3];
    rep(i, n) rep(j, n){
        auto tt = (i+1+j+1)%3;
        v[tt].push_back(make_pair(i+1, j+1));
    }
    ll sum = LONG_MAX;
    
    vector<pair<ll, ll>> nice_color[3];
    rep(k,3){
        rep(i, c){
            ll tmpsum = 0;
            for(auto it:v[k]) tmpsum+=d[ m[it.first][it.second] ][ i+1];
            nice_color[k].push_back(make_pair(tmpsum, i+1));
        }
    }
    sort(alll(nice_color[0]));
    sort(alll(nice_color[1]));
    sort(alll(nice_color[2]));
    rep(i, 3)    rep(j, 3)    rep(k, 3){
        if(nice_color[0][i].second != nice_color[1][j].second &&
           nice_color[0][i].second != nice_color[2][k].second &&
           nice_color[1][j].second != nice_color[2][k].second ){
            sum = min(sum,nice_color[0][i].first + nice_color[1][j].first + nice_color[2][k].first);
        }
    }
    pr(sum);
}



Measured memory_bytes: 4528
#### import ####
import sys
sys.setrecursionlimit(10**7)
import math
from collections import defaultdict

#### 定数 ####
mod = 10**9 + 7

#### 読み込み ####
def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N):
  read_all = [tuple(map(int, input().split())) for _ in range(N)]
  return map(list,zip(*read_all))

#################

import math

S = I()
print(0,0,10**9,1,10**9*math.ceil(S/10**9)-S,math.ceil(S/10**9))

Measured memory_bytes: 38384
#include<cstdio>
#include<cmath>
#include<vector>

using namespace std;

void add(vector<long long> &num, bool used3, bool used5, bool used7, long long cur, long long toadd, int left)
{
	if (toadd == 3)
	{
		used3 = true;
	}

	else if (toadd == 5)
	{
		used5 = true;
	}

	else
	{
		used7 = true;
	}

	if (left==1)
	{
		if (used3&&used5&&used7)
		{
			num.push_back(cur * 10 + toadd);
		}
	}

	else
	{
		add(num, used3, used5, used7, cur * 10 + toadd, 3, left - 1);
		add(num, used3, used5, used7, cur * 10 + toadd, 5, left - 1);
		add(num, used3, used5, used7, cur * 10 + toadd, 7, left - 1);
	}
}

long long binsearch(vector<long long> & arr, long long lb, long long ub, long long target)
{
	long long next;

	if (ub - lb < 2)
	{
		return lb;
	}

	next = (lb + ub) / 2;

	if (arr[next] == target)
	{
		return next;
	}

	else if (target < arr[next])
	{
		return binsearch(arr, lb, next, target);
	}

	return binsearch(arr, next, ub, target);
}

int main()
{
	int i, j, k;
	long long n;
	vector<long long> num;
	long long kon[3] = { 3,5,7 };
	bool used;

	scanf("%lld", &n);

	if (n < 357)
	{
		printf("0\n");

		return 0;
	}

	for (i = 3; i <= 9; i++)
	{
		add(num, false, false, false, 0, 3, i);
		add(num, false, false, false, 0, 5, i);
		add(num, false, false, false, 0, 7, i);
	}

	printf("%lld\n", binsearch(num, 0, num.size(), n) + 1);

	return 0;
}

Measured memory_bytes: 640
#!/usr/bin/env python3
import sys


def solve(N):
    N -= 1

    result = []
    while True:
        div = N // 26
        mod = N % 26

        result.append(mod)
        if div == 0:
            break
        N = div - 1
    result = result[::-1]
    result = [chr(x + ord('a')) for x in result]
    print(''.join(result))




# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    solve(N)

if __name__ == '__main__':
    main()


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

int main() {
    int k;
    cin >> k;

    string s;
    cin >> s;
    if (k < s.size()) {
        for (int i = 0; i < k; i++) {
            cout << s.at(i);
        }
        cout << "..." << endl;
    }
    else {
        cout << s << endl;
    }
}

Measured memory_bytes: 3580
K, S = map(int, input().split())
ans = 0

for i in range(K + 1):
    if i > S:
        break
    for j in range(K + 1):
        s = i + j
        if s > S:
            break
        Z = S - s
        if 0 <= Z <= K:
            ans += 1

print(ans)

Measured memory_bytes: 3060
#include<algorithm>
#include<bitset>
#include<cmath>
#include<complex>
#include<cstdlib>
#include<iomanip>
#include<iostream>
#include<map>
#include<queue>
#include<set>
#include<string>
#include<utility>
#include<vector>

using namespace std;

#define ll long long
#define pal pair<ll,ll>
#define pad pair<double,double>
#define PB push_back
#define MP make_pair
#define F first
#define S second

const ll MOD = 1e9+7;
const ll INF = 1e18;
const double EPS = 1e-8;

long long MODPOW(long long x, long long n) {
    long long ret = 1;
    while (n > 0) {
        if (n & 1) ret = ret * x % MOD;
        x = x * x % MOD;
        n >>= 1;
    }
    return ret;
}

template<typename T,typename U>
bool chmax(T& max, const U& x){
	if(max<x){
		max = x;
		return true;
	}
	return false;
}

template<typename T,typename U>
bool chmin(T& min, const U& x){
	if(min>x){
		min = x;
		return true;
	}
	return false;
}


int main(){
	ll k;
	cin >> k;
	ll tmp=7;
	for(ll i=1;i<=k;i++){
		if(tmp%k==0){
			cout << i << endl;
			return 0;
		}
		tmp = (tmp*10)%k + 7;
		tmp%=k;
	}
	cout << -1 << endl;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define ALL(a)  (a).begin(),(a).end()
using namespace std;
int main(){
    int prc[5];
    int time=0 , min=100;
    bool allTen = true;

    for(int i = 0; i < 5; ++i){
        cin >> prc[i];
        if(prc[i]%10 == 0){
            time += prc[i];
        }else{
            allTen = false;
            time += (prc[i]/10) * 10 + 10;
            if(prc[i]%10 < min){
                min = prc[i]%10;
            }
        }
    }
    
    if(!allTen){
        time -= (10 - min);
    }

    cout << time << endl;



}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;

typedef pair<int,int> P;

int m,n;
vector<P> dat[100];
vector<int> xind;
vector<int> yind;
int field[280][280];
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
int pickl[4];
int picklx[4];
int pickly[4];

int main(void){
	scanf("%d %d",&n,&m);
	memset(field,0,sizeof(field));
	for(int i=0;i<n;i++){
		string str;
		cin >> str;
		for(int j=0;j<m;j++){
			if(str[j]>='A' && str[j]<='Z'){
				dat[str[j]-'A'+1].push_back(P(j,i));
				if(j-1>=0)xind.push_back(j-1);
				xind.push_back(j);
				if(j+1<m)xind.push_back(j+1);
				if(i-1>=0)yind.push_back(i-1);
				yind.push_back(i);
				if(i+1<n)yind.push_back(i+1);
			}
		}
	}
	sort(xind.begin(),xind.end());
	xind.erase(unique(xind.begin(),xind.end()),xind.end());
	sort(yind.begin(),yind.end());
	yind.erase(unique(yind.begin(),yind.end()),yind.end());
	for(int i=1;i<=26;i++){
		for(int j=0;j<dat[i].size();j++){
			dat[i][j].first=lower_bound(xind.begin(),xind.end(),dat[i][j].first)-xind.begin();
			dat[i][j].second=lower_bound(yind.begin(),yind.end(),dat[i][j].second)-yind.begin();
			field[dat[i][j].first][dat[i][j].second]=i;
		}
	}
	bool flag=true;
	int score2=0;
	while(flag){
		flag=false;
		for(int i=0;i<yind.size();i++){
			for(int j=0;j<xind.size();j++){
				if(field[j][i]==0){
					memset(pickl,0,sizeof(pickl));
					for(int k=0;k<4;k++){
						int xx=j,yy=i;
						int xi=xind.size(),yi=yind.size();
						while(xx>=0 && xx<=xi && yy>=0 && yy<=yi){
							if(field[xx][yy]!=0){
								pickl[k]=field[xx][yy];
								picklx[k]=xx;
								pickly[k]=yy;
								break;
							}
							xx+=dx[k];
							yy+=dy[k];
						}
					}
					for(int k=0;k<4;k++){
						for(int l=k+1;l<4;l++){
							if(pickl[k]==pickl[l] && pickl[k]!=0){
								score2+=2;
								field[picklx[k]][pickly[k]]=0;
								field[picklx[l]][pickly[l]]=0;
								flag=true;
							}
						}
					}
				}
			}
		}
	}
	printf("%d\n",score2);
	return 0;
}

Measured memory_bytes: 1576
import math

def lcm(x,y):
    return (x*y)//math.gcd(x,y)

A,B,C,D=map(int,input().split())

l=lcm(C,D)

temp=l-(l//C+l//D-1)

a=(A-1)%l
b=B%l

aa=(A-1)//l
bb=B//l

tempA=a-(a//C+a//D-1)
tempB=b-(b//C+b//D-1)
            

ans=temp*bb+tempB-(temp*aa+tempA)


print(ans)


Measured memory_bytes: 9188
#include<bits/stdc++.h>
using namespace std;
const int N=3e5+1;
long long n,m,x,y,z,f[N],l=1,r=1,w,A[N],B[N],C[N],t;
int main()
{
    scanf("%lld %lld",&n,&m);
   for(int i=1;i<=n;i++)
   {
       scanf("%lld",&A[i]);
       t+=A[i];
   }
   for(int i=1;i<=n;i++)
   {
    z=A[i]*4*m;
    if(z>=t)
        y++;
   }
   if(y>=m)
    printf("Yes\n");
   else
    printf("No\n");
}



Measured memory_bytes: 2304
#include <bits/stdc++.h>
 
using namespace std;
 
#define lli long long int
#define REP(i,s,l) for(lli i=s;i<l;i++)
#define DEBUG 0
#define INF (1LL<<50)
#define MOD 1000000007


signed main(){

	lli n;
	cin>>n;

	string s;

	char data[1000][1000]={0};

	REP(i,0,n){
		cin>>s;
		REP(j,0,n){
			data[i][j] = s.at(j);
			data[i][j+n] = s.at(j);
			data[i+n][j] = s.at(j);
			data[i+n][j+n] = s.at(j);
		}
	}

	lli cnt=0;
	for(lli a=0;a<n;a++){
		lli b=0;
		if(DEBUG)cout<<"a="<<a<<" b="<<b<<endl;
		/*judge*/
		lli flag=0;
		for(lli y=0;y<n;y++){
			for(lli x=0;x<n;x++){
				lli nextI = y+b;
				lli nextJ = x+a;
				lli targetI = x+b;
				lli targetJ = y+a;
				if(DEBUG){
					cout<<"nextI="<<nextI<<" nextJ="<<nextJ<<endl;
					cout<<"data[i][j]="<<data[nextI][nextJ]<<" data[j][i]="<<data[targetI][targetJ]<<endl;
				}
				if(data[nextI][nextJ]!=data[targetI][targetJ]){
					flag=1;
					break;
				}
			}
			if(flag)break;
		}
		if(flag==0)cnt+=n;
	}
	
	cout<<cnt<<endl;

	return 0;
}

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

int main() { 
  int K, A, B;
  cin >> K >> A >> B;
  if(A%K ==  0){
    cout << "OK" << endl;
  }
  else if(K*(A/K + 1) <= B){
    cout << "OK" << endl;
  }
  else{
    cout << "NG" << endl;
  }
}

Measured memory_bytes: 3624
N = int(input())
sArray = input()

flag = True
if N % 2 == 0:
    n2 = N // 2
    for i in range(N//2):
        if sArray[i] != sArray[i+n2]:
            flag = False
            break
else:
    flag = False

if flag:
    print("Yes")
else:
    print("No")


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

using namespace std;

int main()
{
    int h, w, z, dis[10][10], ans=0, c[10][10];
    cin>>h>>w;
    for (int i=0; i<10; i++) for (int j=0; j<10; j++) { cin>>c[i][j]; dis[i][j]=c[i][j]; }
    for (int i=0; i<10; i++) for (int j=0; j<10; j++) for (int k=0; k<10; k++) dis[j][k]=min(dis[j][k], dis[j][i]+dis[i][k]);
    for (int i=0; i<h; i++) for (int j=0; j<w; j++) { cin>>z; if (z!=-1) ans+=dis[z][1]; }
    cout<<ans<<'\n';
    return 0;
}


Measured memory_bytes: 256
n = int(input())
a = [0]*n
c = []

for i in range(0,n):
  a[i] = int(input())
c = a
m1 = max(a)
m1_ = a.index(m1)
del c[m1_]
m2 = max(c)
m2_ = c.index(m2)

for i in range(0,n):
  if(i == m1_):
    print(m2)
  else:
    print(m1)

Measured memory_bytes: 56792
using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static string InputPattern = "InputX";

    static List<string> GetInputList()
    {
        var WillReturn = new List<string>();

        if (InputPattern == "Input1") {
            WillReturn.Add("1 6 3");
            //5
        }
        else if (InputPattern == "Input2") {
            WillReturn.Add("11 5 5");
            //6
        }
        else if (InputPattern == "Input3") {
            WillReturn.Add("100 100 100");
            //0
        }
        else {
            string wkStr;
            while ((wkStr = Console.ReadLine()) != null) WillReturn.Add(wkStr);
        }
        return WillReturn;
    }

    static void Main()
    {
        List<string> InputList = GetInputList();
        int[] wkArr = InputList[0].Split(' ').Select(X => int.Parse(X)).ToArray();

        Array.Sort(wkArr);
        int Answer = 0;
        Answer += wkArr[1] - wkArr[0];
        Answer += wkArr[2] - wkArr[1];
        Console.WriteLine(Answer);
    }
}


Measured memory_bytes: 13396
#include <iostream>
#include <stdio.h>
#include <math.h>
#include <vector>
#include <algorithm>
#include <string.h>
#include <string>
using namespace std;
int ara[1001];
int check(int n) {
    int a,b;
    while(n!=0 && n/10!=0) {
        a = n%10;
        n/=10;
        b=n%10;
        if(a != b+1) {
            return 0;
        }
    }
    return 1;
}
int main()
{
    int n,x,maxi = 0;
    cin >> n;
    for(int i=0;i<n;i++) {
        cin >> ara[i];
    }
    sort(ara,ara+n);
    for(int i=n-1;i>=1;i--) {
        for(int j=i-1;j>=0;j--) {
            x = ara[i]*ara[j];
            if(maxi < x && check(x)) {
                maxi = x;
                break;
            }
        }
    }
    if(maxi == 0) {
        cout << "-1" << endl;
    }
    else
        cout << maxi << endl;
    return 0;
}

Measured memory_bytes: 3148
#include <algorithm>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <iostream>
#include <iterator>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

#define FOR(i,k,n) for(int(i)=(k);(i)<(n);++(i))
#define rep(i,n) FOR(i,0,n)
#define all(v) begin(v),end(v)
#define debug(x) std::cerr<<#x<<": "<<x<<"\n"
#define debug2(x,y) std::cerr<<#x<<": "<<x<<", "<<#y<<": "<<y<<"\n"
#define debug3(x,y,z) std::cerr<<#x<<": "<<x<<", "<<#y<<": "<<y<<", "<<#z<<": "<<z<<"\n"

using ll=long long;
using vi=std::vector<int>;
using vvi=std::vector<vi>;
using vll=std::vector<ll>;
using vvll=std::vector<vll>;
template<typename T> using vvec=std::vector<std::vector<T>>;
template<typename T>
auto make_v(size_t sz){return std::vector<T>(sz);}
template<typename T,typename... Ts>
auto make_v(size_t sz,Ts...ts){return std::vector<decltype(make_v<T>(ts...))>(sz,make_v<T>(ts...));}
template<typename T>
void fill_v(T&var,const T&x){var=x;}
template<typename V,typename T>
void fill_v(V&v,const T&x){for(auto&& w:v){fill_v(w,x);}}

template<typename T> std::ostream& operator<<(std::ostream&s,const std::vector<T>&v){
  int sz=v.size();s<<"\n";rep(i,sz){s<<v[i];if(i<sz-1){s<<"\t";}}s<<"\n";return s;}
template<typename T> std::ostream& operator<<(std::ostream&s,const std::vector<std::vector<T>>&v){
  for(auto&& w:v){s<<w;}return s;}
template<typename T> std::ostream& operator<<(std::ostream&s,const std::deque<T>&v){
  int sz=v.size();s<<"\n";rep(i,sz){s<<v[i];if(i<sz-1){s<<"\t";}}s<<"\n";return s;}
template<typename T> std::ostream& operator<<(std::ostream&s,const std::deque<std::deque<T>>&v){
  for(auto&& w:v){s<<w;}return s;}
template<typename T> std::ostream& operator<<(std::ostream&s, const std::set<T>&v){
  s<<"\n";for(auto&& elm:v){s<<elm<<"\t";}s<<"\n";return s;}

inline void scan(int&a){scanf("%d",&a);}
inline void scan(ll&a){scanf("%lld",&a);}
inline void scan(char&a){scanf(" %c",&a);}
inline void scan(double&a){scanf("%lf",&a);}
template<typename T>
inline void scan(std::vector<T>&v){for(auto&& sv:v){scan(sv);}}
template<typename First,typename...Args>
inline void scan(First&f,Args&...args){scan(f);scan(args...);}
inline void scan(std::string&s){char BUF[3000000];scanf(" %s",BUF);s=std::string(BUF);}
inline void print(int a){printf("%d\n",a);}
inline void print(ll a){printf("%lld\n",a);}
inline void print(double a){printf("%.12f\n",a);}
inline void print(std::string s){std::cout<<s<<"\n";}

using namespace std;

int main() {
  int a, b;
  scan(a, b);
  rep (i, 1001) {
    int a_ = i * 0.08;
    int b_ = i * 0.1;
    if (a_ == a && b_ == b) {
      print(i);
      return 0;
    }
  }
  print(-1);
  return 0;
}


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

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



Measured memory_bytes: 3108
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SI(): return sys.stdin.readline()[:-1]

def main():
    inf=10**9
    n,*abc=MI()
    abc.sort()
    a,b,c=abc
    dp={(0,0,0):0}
    for _ in range(n):
        l=II()
        ndp={}
        for xyz,s in dp.items():
            ndp.setdefault(xyz,inf)
            ndp[xyz]=min(ndp[xyz],s)
            for i in range(3):
                nx=list(xyz)
                ns=s+10 if nx[i] else s
                nx[i]+=l
                t=tuple(sorted(nx))
                ndp.setdefault(t,inf)
                ndp[t]=min(ndp[t],ns)
            dp=ndp

    ans=inf
    for (x,y,z),s in dp.items():
        if x*y*z==0:continue
        cur=abs(x-a)+abs(y-b)+abs(z-c)+s
        ans=min(ans,cur)

    print(ans)

main()

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

int main() {
  int Z8, Z10, H, He, z; 
  cin >> Z8 >> Z10;

  H = Z10 *10;
  He = (Z10+1) *10;
  while(1) {
    z = H * 0.08 ;
    if( z == Z8 ) {
      cout << H << endl;
      break;
    }
    H++;
    if ( H >= He){
      cout << -1 << endl;
      break;
    }
  }
}

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

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

 vector<int64_t>S(N);

 for(int i = 0; i < N; i++){
     cin >> S.at(i);
     }

 int sum = 0;

 bool M = true;
 while(M){

    for(int j = 0; j < N; j++){
         if(S.at (j) % 2 != 0){
             M = false;
             break;
             }
         if(S.at(j) % 2 == 0){
             S.at(j) = S.at(j) / 2;
             }

    }
    
    sum++;
 }

 cout << sum -1 << endl;

}

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

int main() {
  
  string n;
  
  cin >>n;
  
  for(int i=0; i<3; i++) {
    
    if(n.at(i) == '1') {
      
      n.at(i) = '9';
      
    } else {
      
      n.at(i) = '1';
      
    }
    
  }
  
  cout << n << endl;
  
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
  int a;
  cin >> a;
  if (a < 1200){
    cout << "ABC";
  }
  else if ((a >= 1200)&&(a < 2800)){
  	cout << "ARC";
  }
  else if ((a >= 2800)&&(a <= 4208)){
  	cout << "AGC";
  }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define maxn (int)(2e5)
#define i64 long long
#define pii pair<i64,i64>
#define all(x) x.begin(),x.end()
#define LB(x,v) lower_bound(all(x), v) - x.begin()
#define fread() freopen("in.txt", "r", stdin);
using namespace std;

struct problem{
    bool AC = false;
    int penalty;
}prob[maxn+2];

unordered_map<int,bool>tried;

void init(int n){
    tried.clear();
    for(int i=0;i<n;i++){
        prob[i].AC = false;
        prob[i].penalty = 0;
    }
}

int main() {
    /*BEFORE SUBMIT, CHECK
    sample i/o format
    statements for debugging are removed/comment out
    global values / stl containers are initialized/cleared for each test (if needed)
    all array size are sufficient
    loop variable or output value doesn't cross min/max limit of input
    */
    
    int T,n,m, pid;
    string status;
    while(scanf("%d %d",&n, &m)==2){
        init(n);
        
        for(int i = 0;i < m; i++) {
            cin>>pid >> status;
            tried[pid] = true;
            if(status == "WA") {
                if(!prob[pid].AC) prob[pid].penalty++;
                //if(!prob[pid].AC) totalPenalty++;
            }
            else prob[pid].AC = true;
        }

        int cntAC = 0, totalPenalty = 0;
        for(auto problem : tried){
            int id = problem.first;
            if(prob[id].AC) {
                cntAC++;
                totalPenalty+=prob[id].penalty;
            }
        }
        
        printf("%d %d\n", cntAC, totalPenalty);  
    }   
    return 0;
}

Measured memory_bytes: 5924
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <cstring>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <bitset>
#include <stack>
#include <cmath>
#define ll long long
#define LINF 0x3f3f3f3f3f3f3f3f
#define INF 0x3f3f3f3f
#define PI 3.14159265
using namespace std;
const int MAX = 1e5 + 10;
const ll MOD = 1e9 + 7;
int N, M, Q;
ll K;
ll A[60];

int main()
{
	int j, k;
	scanf("%lld", &K);
	ll limit = 1e16 + 1000;
	ll least, n;
	if (K > 50) {
		n = 50;
		least = K / n;
		for (int i = 1; i <= n; ++i) A[i] = least + n - i;
		for (int i = 1; i <= K % n; ++i) A[i]++;
		printf("50\n");
		for (int i = 1; i <= n; ++i) printf("%lld ", A[i]);
		return 0;
	}
	else if (K == 1) {
		printf("2\n2 0");
		return 0;
	}
	vector<ll> divs;
	for (ll num = 2; num <= 50; ++num) {
		if (K%num == 0) divs.push_back(num);
	}
	for (int i = divs.size()-1; i >= 0; --i) {
		n = divs[i];
		least = K / n;
		if (least + n - 1LL > limit) continue;
		break;
	}
	printf("%lld\n", n);
	for (ll i = 0; i < n; ++i) {
		printf("%lld ", least + n - 1 - i);
	}

}


Measured memory_bytes: 256
#[allow(unused_imports)]
use proconio::{fastout, input};

#[fastout]
fn main() {
    input!(n: usize, mut y: [usize; n]);
    y.sort();
    let mut buff = y[0] as f64;
    for i in 1..y.len() {
        buff = (buff + y[i] as f64) / 2_f64;
    }
    println!("{}", buff);
}


Measured memory_bytes: 2216
#include <stdio.h>

int main()
{
        int a,b,i,flag = 1;
        scanf("%d %d",&a,&b);
        char S[100];
        scanf("%s",S);
        for(i = 0;i<a;i++){
                if(S[i]<'0'||S[i]>'9')        flag = 0;
        }
        if(S[a] != '-') flag = 0;
        for(i = b+1;i<a+b+1;i++){
                if(S[i]<'0'||S[i]>'9')        flag = 0;
        }
        if(flag == 1)   printf("Yes");
        else            printf("No");
        return 0;
}


Measured memory_bytes: 128
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.NoSuchElementException;
public class Main {
	public static void main(String[] args)throws Exception{
		PrintWriter out = new PrintWriter(System.out);
		int X=nextInt();
		if(400<=X&&X<600)
			System.out.println(8);
		if(600<=X&&X<800)
			System.out.println(7);
		if(800<=X&&X<1000)
			System.out.println(6);
		if(1000<=X&&X<1200)
			System.out.println(5);
		if(1200<=X&&X<1400)
			System.out.println(4);
		if(1400<=X&&X<1600)
			System.out.println(3);
		if(1600<=X&&X<1800)
			System.out.println(2);
		if(1800<=X&&X<2000)
			System.out.println(1);
	}
	static boolean isOK(int index,String key,String[]a){
		if (a[index].compareTo(key)>=0) return true;
	    else return false;
	}
	static int binary_search(String key,String[] a) {
	    int ng = -1; //「index = 0」が条件を満たすこともあるので、初期値は -1
	    int ok = (int)a.length; // 「index = a.size()-1」が条件を満たさないこともあるので、初期値は a.size()
	    while (Math.abs(ok - ng) > 1) {
	        int mid = (ok + ng) / 2;
	        if (isOK(mid,key,a)) ok = mid;
	        else ng = mid;
	    }
	    return ok;
	}
	//FastScanner
	static InputStream in = System.in;
	static  byte[] buffer = new byte[1024];
	static int length = 0, p = 0;
	public static boolean hasNextByte () {
		if (p < length) return true;
		else {
			p = 0;
			try {length = in.read(buffer);}
			catch (Exception e) {e.printStackTrace();}
			if (length == 0) return false;
		}
		return true;
	}
	public static int readByte () {
		if (hasNextByte() == true) return buffer[p++];
		return -1;
	}
	public static boolean isPrintable (int n) {return 33<=n&&n<=126;}
	public static void skip () {
		while (hasNextByte() && !isPrintable(buffer[p])) p++;
	}
	public static boolean hasNext () {skip(); return hasNextByte();}
	public static String next () {
		if (!hasNext()) throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int temp = readByte();
		while (isPrintable(temp)) {
			sb.appendCodePoint(temp);
			temp = readByte();
		}
		return sb.toString();
	}
	public static int nextInt () {return Math.toIntExact(nextLong());}
	public static int[] nextInts (int n) {
		int[] ar = new int[n];
		for (int i=0; i<n; i++) ar[i] = nextInt();
		return ar;
	}
	public static long nextLong () {
		if (!hasNext()) throw new NoSuchElementException();
		boolean minus = false;
		int temp = readByte();
		if (temp == '-') {
			minus = true;
			temp = readByte();
		}
		if (temp<'0' || '9'<temp) throw new NumberFormatException();
		long n = 0;
		while (isPrintable(temp)) {
			if ('0'<=temp && temp<='9') {
				n *= 10;
				n += temp - '0';
			}
			temp = readByte();
		}
		return minus? -n : n;
	}
}



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


struct BiconectedGraph{
  typedef pair<int,int> P;
  int n;
  vector<vector<int> > G,C,T;
  vector<int> ord,low,belong;
  vector<P> B;
  BiconectedGraph(){}
  BiconectedGraph(int sz):n(sz),G(sz),C(sz),T(sz){}
  
  void add_edge(int u,int v){
    G[u].push_back(v);
    G[v].push_back(u);
  }

  void input(int m,int offset=0){
    int a,b;
    for(int i=0;i<m;i++){
      cin>>a>>b;
      add_edge(a+offset,b+offset);
    }
  }
  
  bool is_bridge(int u,int v){
    if(ord[u]>ord[v]) swap(u,v);
    return ord[u]<low[v];
  }
  
  void dfs(int u,int p,int &k){
    ord[u]=low[u]=k;
    ++k;
    for(int v:G[u]){
      if(v==p) continue;
      if(ord[v]>=0){
	low[u]=min(low[u],ord[v]);
      }else{
	dfs(v,u,k);
	low[u]=min(low[u],low[v]);
      }
      if(is_bridge(u,v)) B.push_back(P(u,v));
    }
  }
  
  void fill_component(int c,int u){
    C[c].push_back(u);
    belong[u]=c;
    for(int v:G[u]){
      if(belong[v]>=0||is_bridge(u,v)) continue;
      fill_component(c,v);
    }
  }
  
  void add_component(int u,int &k){
    if(belong[u]>=0) return;
    fill_component(k++,u);
  }
  
  int build(){
    int k=0;
    ord.resize(n);
    low.resize(n);
    belong.resize(n);
    fill(ord.begin(),ord.end(),-1);
    fill(belong.begin(),belong.end(),-1);
    for(int u=0;u<n;u++){
      if(ord[u]>=0) continue;
      dfs(u,-1,k);
    }
    k=0;
    for(int i=0;i<(int)B.size();i++){
      add_component(B[i].first,k);
      add_component(B[i].second,k);
    }
    for(int u=0;u<n;u++) add_component(u,k);
    for(int i=0;i<(int)B.size();i++){
      int u=belong[B[i].first],v=belong[B[i].second];
      T[u].push_back(v);
      T[v].push_back(u);
    }
    return k;
  }
};


signed main(){
  int n,m;
  cin>>n>>m;
  BiconectedGraph bg(n);
  bg.input(m,0);
  int k=bg.build();
  auto& G=bg.T;
  vector<int> c(k);
  for(int i=0;i<k;i++) c[i]=bg.C[i].size();
  vector<vector<int> > dp(2,vector<int>(k,0));
  vector<int> used(k,0);
  function<void(int,int)> dfs=[&](int v,int p){
    if(used[v]) return;
    used[v]=1;
    dp[0][v]=0;
    dp[1][v]=c[v];
    for(int u:G[v]){
      if(u==p) continue;
      dfs(u,v);
      dp[0][v]+=max(dp[0][u],dp[1][u]);
      dp[1][v]+=dp[0][u];
    }
    return;
  };
  int ans=0;
  for(int i=0;i<k;i++){
    if(used[i]) continue;
    dfs(i,-1);
    ans+=max(dp[0][i],dp[1][i]);
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 22844
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
 /*#include <boost/multiprecision/cpp_int.hpp>
    using namespace boost::multiprecision;*/
     
    #define ll long long int
    #define ld long double
    #define bigint int64_t
    #define vll vector<ll>
    #define vpll vector<pair<ll,ll>>
    #define mp make_pair
    #define pb push_back
    #define MOD 1000000007
    #define flash ios_base::sync_with_stdio(false);cin.tie(NULL);
    #define test ll t;read(t);while(t--)
    #define all(v) v.begin(),v.end()
    #define pll pair<ll,ll>
     
    /*#include <ext/pb_ds/assoc_container.hpp> // Policy_based_Data_Structure 
    #include <ext/pb_ds/graph_policy.hpp> 
    using namespace __gnu_pbds;*/ 
     
    #define forn(i,n) for(ll (i) = 0 ; (i) < (n) ; ++(i))
    #define for1(i,n) for(ll (i) = 1 ; (i) <= (n) ; ++(i))
    #define forr(i,n) for(ll (i) = (n)-1 ; (i)>=0 ; --(i))
    #define forab(i,a,b,c) for(ll (i) = a ; (i) <= (b) ; (i)+=(c))
    ll power(ll a, ll b, ll m = MOD) {
        a%=m;
        ll res = 1;
        while (b > 0) {
            if (b & 1)
                res = res * a %m;
            a = a * a %m;
            b >>= 1;
        }
        return res;
    }
     
int main()
{
    int n;
    cin>>n;
    long long int arr[n+1];
    for(int i=1;i<=n;i++ )
    {
        cin>>arr[i];
    }
    ll zero[64]={};
    ll one[64]={};
    for(int i=1;i<=n;i++ )
    {   int k=0;
        ll y=arr[i];
        while( y>0)
        {
            if( y & 1)
            {
                one[k]++;
            }else
            {
                 zero[k]++;
            }
            y= y>>1;
            k++;
            
        }
        for(int j=k;j<64;j++)
        {
            zero[j]++;
        }       
    }
    ll ans=0;
    for(int i=0;i<64;i++)
    {
        if(one[i]!=0&&zero[i]!=0)
        {
                ll s = (one[i]%MOD*zero[i]%MOD)%MOD;
                s = (s%MOD*power(2,i,MOD)%MOD)%MOD;
                ans = (ans%MOD+s%MOD)%MOD;            

        }
    }
    cout<<ans;
    return 0;}
     
    /*for(int i=0;i< count;i++)
    {
        int zo=0,x1=0;
        for(int j=1;j<=n;j++)
        {
            if((arr[j] >> i) & 1)
            {
                x1++;
            }else
            {
                 zo++;
            }
        }
        //cout<<zo<<" "<<x1<<endl;
        long long int s=power(2,i);
        ans=(ans+(((x1%MOD *zo%MOD)%1000000007)*( s % 1000000007))%MOD)%MOD;
         
        //cout<<ans<<endl;

    }
     */







Measured memory_bytes: 2560
/*
このコード、と～おれ!
Be accepted!
∧＿∧　
（｡･ω･｡)つ━☆・*。
⊂　　 ノ 　　　・゜+.
　しーＪ　　　°。+ *´¨)
 　　　　　　　　　.· ´¸.·*´¨) ¸.·*¨)
		  　　　　　　　　　　(¸.·´ (¸.·'* ☆
*/

#include <cstdio>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstring>
#include <vector>
#include <numeric>
#include <iostream>
#include <random>
#include <map>
#include <unordered_map>
#include <queue>
#include <regex>
#include <functional>
#include <complex>
#include <list>
#include <cassert>
#include <iomanip>
#include <set>
#include <stack>
/*多倍長整数/cpp_intで宣言
#include <boost/multiprecision/cpp_int.hpp>
using namespace boost::multiprecision;
*/

//#pragma gcc target ("avx2")
//#pragma gcc optimization ("o3")
//#pragma gcc optimization ("unroll-loops")
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define rep1(i, n) for(int i = 1; i <= (n); ++i)
#define rep2(i, n) for(int i = 2; i < (n); ++i)
#define repr(i, n) for(int i = n; i >= 0; --i)
#define reprm(i, n) for(int i = n - 1; i >= 0; --i)
#define printynl(a) printf(a ? "yes\n" : "no\n")
#define printyn(a) printf(a ? "Yes\n" : "No\n")
#define printYN(a) printf(a ? "YES\n" : "NO\n")
#define printim(a) printf(a ? "possible\n" : "imposible\n")
#define printdb(a) printf("%.50lf\n", a) //少数出力
#define printLdb(a) printf("%.50Lf\n", a) //少数出力
#define printdbd(a) printf("%.16lf\n", a) //少数出力(桁少なめ)
#define prints(s) printf("%s\n", s.c_str()) //string出力
#define all(x) (x).begin(), (x).end()
#define allsum(a, b, c) ((a + b) * c / 2LL) //等差数列の和、初項,末項,項数
#define pb push_back
#define priq priority_queue
#define rpriq priq<int, vector<int>, greater<int>>
#define deg_to_rad(deg) (((deg)/360.0L)*2.0L*PI)
#define rad_to_deg(rad) (((rad)/2.0L/PI)*360.0L)
#define Please return
#define AC 0
#define manhattan_dist(a, b, c, d) (abs(a - c) + abs(b - d)) /*(a, b) から (c, d) のマンハッタン距離 */


using ll = long long;

constexpr int INF = 1073741823;
constexpr int MINF = -1073741823;
constexpr ll LINF = ll(4661686018427387903);
constexpr ll MOD = 1000000007;
const long double PI = acosl(-1.0L);

using namespace std;

void scans(string& str) {
	char c;
	str = "";
	scanf("%c", &c);
	if (c == '\n')scanf("%c", &c);
	while (c != '\n' && c != -1 && c != ' ') {
		str += c;
		scanf("%c", &c);
	}
}

void scanc(char& str) {
	char c;
	scanf("%c", &c);
	if (c == -1)return;
	while (c == '\n') {
		scanf("%c", &c);
	}
	str = c;
}

double acot(double x) {
	return PI / 2 - atan(x);
}

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

ll lcm(ll number1, ll number2) {
	return number1 / gcd(number1, number2) * number2;
}

ll LSB(ll n) { return (n & (-n)); }

/*-----------------------------------------ここからコード-----------------------------------------*/



int main() {

	int n, m;
	scanf("%d%d", &n, &m);
	vector<int> a(n);
	rep(i, n)scanf("%d", &a[i]);
	int cnt = 0, sum = accumulate(all(a), 0);
	double s = (double)sum / (double)(4 * m);
	rep(i, n) {
		if (a[i] >= s)++cnt;
	}
	printyn(cnt >= m);

	Please AC;
}


Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;
import java.util.stream.IntStream;

public class Main {

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			int n = scanner.nextInt(), m = scanner.nextInt(), k = scanner.nextInt();
			long[] a = new long[n + 1], b = new long[m + 1];
			a[0] = b[0] = 0L;
			IntStream.rangeClosed(1, n).forEach(i -> a[i] = a[i - 1] + scanner.nextLong());
			IntStream.rangeClosed(1, m).forEach(i -> b[i] = b[i - 1] + scanner.nextLong());
			int answer = 0;
			for (int i = 0; i <= n; i++) {
				if (a[i] > k) {
					break;
				}
				int index = Arrays.binarySearch(b, k - a[i]);
				if (index < 0) {
					index = -index - 2;
				}
				answer = Math.max(answer, i + index);
			}
			System.out.println(answer);
		}
	}
}


Measured memory_bytes: 64480
import numpy as np

def main():
    num, weigh = map(int, input().split())
    dp = np.zeros((num + 1, weigh + 1), dtype=int)

    for i in range(1, num + 1):
        now_weigh, now_value = map(int, input().split())
        dp[i, :now_weigh] = dp[i - 1, :now_weigh]
        dp[i, now_weigh:] = np.maximum(dp[i - 1, :weigh - now_weigh + 1] + now_value, dp[i - 1, now_weigh:])

    print(dp[-1][-1])


if __name__ == '__main__':
    main()



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

int main(){
    using namespace std;
    int N, Q; cin >> N >> Q;
    string s; cin >> s;

    vector<int> v(N+1, 0);
    for (int i = 0; i < N; i++)
    {
        if(s[i]=='A' && s[i+1]=='C') v[i+1] = v[i] + 1;
        else v[i+1] = v[i];
    }

    for (int i = 1; i < Q+1; i++)
    {
        int l, r; cin >> l >> r;
        cout << v[r-1] - v[l-1] << endl;
    }
}


Measured memory_bytes: 1408
#include<set>
#include<map>
#include<cmath>
#include<ctime>
#include<queue>
#include<cstdio>
#include<string>
#include<vector>
#include<cstdlib>
#include<cstring>
#include<iomanip>
#include<iostream>
#include<algorithm>
#define fi first
#define se second
#define pb push_back
#define lowbit(x) x&(-x)
#define PII  pair<int, int> 
#define FAST ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
typedef long long ll;
const int inf = 0x3f3f3f3f;
const int mod = (int)1e9 + 7;
const int maxn = (int)1e5 + 5;
using namespace std;

ll dp[maxn][5];

string T = "ABC";

void f(int i, int j, char c){
	dp[i+1][j] += dp[i][j];
	dp[i+1][j] %= mod;
	if(j < 3 && T[j] == c){
		dp[i+1][j+1] += dp[i][j];
		dp[i+1][j+1] %= mod;
	}
}

int main()
{
	FAST;
	string s; cin >> s;
	int len = s.size();
	dp[0][0] = 1;
	for(int i = 0; i < len; i++){
		for(int j = 0; j <= 3; j++){
			if(s[i] != '?') f(i, j, s[i]);
			else {
				for(char ch = 'A'; ch <= 'C'; ch++){
					f(i, j, ch);
				}
			}
		}
	}
	printf("%lld\n", dp[len][3] % mod);
	return 0;
}

Measured memory_bytes: 4432
import java.util.Scanner;


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

			Scanner sc = new Scanner(System.in);
			
			double a = sc.nextDouble();
			double b = sc.nextDouble();
			double x = sc.nextDouble();
			
			if((a*a*b)/2.0<x) {
				double tan = (2.0*(a*a*b-x))/(a*a*a);
				
				double ret = Math.atan(tan);
				ret = ret*(180.0/Math.PI);
				
				System.out.println(ret);
				return;
			}else {
				double tan = (a*b*b)/(2.0*x);
				double ret = Math.atan(tan);
				ret = ret*(180.0/Math.PI);
				
				System.out.println(ret);
				return;
				
			}
			
			
			
	    }
		
	}
	


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

int main() {
    int n;
    cin >> n;
    vector<ll> l(n+1);
    l[0] = 2;
    l[1] = 1;
    for(int i=2; i<=n; i++){
        l[i] = l[i-1] + l[i-2];
    }
    cout << l[n] << endl;
    return 0;
}

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

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

    int N; cin >> N;
    if (N == 1) cout << "Hello World\n";
    else {
        int A, B; cin >> A >> B;
        cout << A + B << "\n";
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i <= n; i++)
#define rep3(i, x, n) for(int i = x; i >= n; i--)
#define elif else if
#define sp(x) fixed << setprecision(x)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const int inf = (1<<30)-1;
const ll INF = (1LL<<60)-1;
const ld EPS = 1e-10;
template<typename T> bool chmax(T &x, const T &y) {return (x < y)? (x = y, true) : false;};
template<typename T> bool chmin(T &x, const T &y) {return (x > y)? (x = y, true) : false;};

template<typename T>
struct Max_Flow{
    struct edge{
        int to; T cap; int rev;
        edge(int to, T cap, int rev) : to(to), cap(cap), rev(rev) {}
    };

    vector<vector<edge>> es;
    vector<bool> used;
    const T INF_T;

    Max_Flow(int n) : INF_T(numeric_limits<T>::max()){
        es.resize(n), used.resize(n);
    }

    void add_edge(int from, int to, T cap, bool directed = true){
        es[from].eb(to, cap, sz(es[to]));
        es[to].eb(from, directed? 0 : cap, sz(es[from])-1);
    }

    T dfs(int now, int t, T flow){
        if(now == t) return flow;
        used[now] = true;
        for(auto &e: es[now]){
            if(!used[e.to] && e.cap > 0){
                T f = dfs(e.to, t, min(flow, e.cap));
                if(f > 0){
                    e.cap -= f;
                    es[e.to][e.rev].cap += f;
                    return f;
                }
            }
        }
        return 0;
    }

    T max_flow(int s, int t){
        T flow = 0;
        for(;;){
            fill(all(used), false);
            T f = dfs(s, t, INF_T);
            if(f == 0) return flow;
            flow += f;
        }
    }
};

int main(){
    int H, W;
    cin >> H >> W;
    Max_Flow<int> G(H+W+2);
    int s = H+W, t = H+W+1;
    string S[H];
    rep(i, H){
        cin >> S[i];
        rep(j, W){
            if(S[i][j] == 'S') G.add_edge(s, i, inf), G.add_edge(s, H+j, inf);
            if(S[i][j] == 'T') G.add_edge(i, t, inf), G.add_edge(H+j, t, inf);
            if(S[i][j] == 'o') G.add_edge(i, H+j, 1, false);
        }
    }
    int ans = G.max_flow(s, t);
    cout << (ans < inf? ans : -1) << endl;
}

Measured memory_bytes: 3856
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <string.h>
#include <vector>
#include <math.h>
#include <map>
#include <queue>
#include <set>
#define INF 0x3f3f3f3f3f
using namespace std;
typedef long long ll;
const int maxn=1e6+10;
const int c=1e9+7;
long long pow_mod(ll a, ll b)
{
    long long sum = 1;
    while (b) {
        if (b & 1) {
            sum = (sum * a) %c;
            b--;
        }
        b /= 2;
        a = a * a % c;
    }
    return sum%c;
}
int main()
{
    //cout<<pow_mod(1,100);
    ll n;
    cin>>n;
    cout<<(((pow_mod(10,n)-pow_mod(9,n)*2)%c+c)%c+pow_mod(8,n))%c;
    return 0;
}


Measured memory_bytes: 3636
X, N = map(int, input().split())
P = sorted(list(map(int, input().split())))

res, diff = 0, float("inf")
for i in range(0, 110):
    if i in P:
        continue
    if diff > abs(X - i):
        res = i
        diff = abs(X - i)

print(res)


Measured memory_bytes: 9180
S = list(input())

flg = True
for i in range(len(S)):
    if (i+1)%2 == 1 and S[i] == 'L':
        flg = False
        break
    elif (i+1)%2 == 0 and S[i] == 'R':
        flg = False
        break
if flg:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3060
#include <iostream>
#include <stdio.h>
using namespace std;
int main(void){
    // Your code here!
    int x,y;
    scanf("%d %d",&x,&y);
    if(((4*x)-y)>=0 && ((4*x)-y)%2==0 && ((4*x)-y)/2<=x){
        printf("Yes");
    }else{
        printf("No");
    }
}

Measured memory_bytes: 3716