akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define ll long long
#define llu unsigned long long

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

}
double ttake() {
    double n;
    scanf("%lf",&n);
    return n;
}
ll takes() {
    ll n;
    scanf("%lld",&n);
    return n;

}

#define Int take()
#define Dnt ttake()
#define LL takes()
#define done {return 0;}
#define fr(n) for(int i=1;i<=n;i++)
#define FR(a,b,x) for(int i=(a);i<=(b);i+=(x))
#define rfr(n) for(int i=n;i>=1;i--)
int cas;
#define print printf("Case %d:",++cas)
#define vi vector<int>
#define vl vector<ll>
#define pb push_back
#define pii pair<int,int>
#define vii vector<pii>
#define pll pair<ll,ll>
#define pil pair<int,ll>
#define pli pair<ll,int>
#define mk  make_pair
#define fill(x,v) memset(x,v,sizeof x)

using namespace std;

bool approximatelyEqual(float a, float b, float epsilon) {
    return fabs(a - b) <= ( (fabs(a) < fabs(b) ? fabs(b) : fabs(a)) * epsilon);
}

bool essentiallyEqual(float a, float b, float epsilon) {
    return fabs(a - b) <= ( (fabs(a) > fabs(b) ? fabs(b) : fabs(a)) * epsilon);
}

bool definitelyGreaterThan(float a, float b, float epsilon) {
    return (a - b) > ( (fabs(a) < fabs(b) ? fabs(b) : fabs(a)) * epsilon);
}

bool definitelyLessThan(float a, float b, float epsilon) {
    return (b - a) > ( (fabs(a) < fabs(b) ? fabs(b) : fabs(a)) * epsilon);
}
#define STR {struct info}
#define debug(x) {cout<<"ekhane"<<x<<endl;}
#define  SS second
#define  FF first
#define PQ priority_queue
#define great greatest
#define less lesser
#define mii map<int,int>
#define mil map<int,ll>
#define mll map<ll,ll>
#define msb map<string,bool>
#define M 100005
//////////////////////////////////////////


int main(){
    int n=Int;

    int a[n+1],b[n+1],c[n+1];
    fr(n-1){
        a[i]=Int,b[i]=Int,c[i]=Int;
    }

    for(int i=1;i<n;i++){
        ll ans=0;
        for(int k=i;k<n;k++){
            if(i==k) ans=b[k];
            else if(ans<=b[k]) ans=b[k] ;
            else{
                int d=(c[k]-(ans%c[k]))%c[k];
                ans+=d;
            }
            ans+=a[k];
        }
        printf("%lld\n",ans);
    }

    printf("0\n");

    done;
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = 1001001001;
const ll LINF = 1LL << 60;
const int MOD = 1'000'000'007;

template <typename T>
void print(const T &v)
{
    for (int i = 0; i < v.size(); i++)
    {
        if (i)
            cout << ' ';
        cout << v[i];
    }
    cout << endl;
}

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

int main()
{
    int n;
    cin >> n;
    vector<ll> a(n);
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
    }
    sort(a.begin(), a.end());
    vector<ll> sums(n + 1);
    for (int i = 0; i < n; i++)
    {
        sums[i + 1] = sums[i] + a[i];
    }
    int start_idx = 0;
    for (int i = 0; i < n - 1; i++)
    {
        if (sums[i + 1] * 2 < a[i + 1])
        {
            start_idx = i + 1;
        }
    }
    cout << n - start_idx << endl;
    return 0;
}


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

using namespace std;
#define MOD 1000000007
#define pi 3.1415926535897932384626433832795028841971693993751058209749445923078164062
#define ll long long
#define pb push_back
#define pf push_front
#define mp make_pair
#define mt make_tuple
#define ub upper_bound
#define lb lower_bound
#define popb pop_back()
#define popf pop_front()
#define ff first
#define ss second
#define vl vector<ll>
#define vi vector<int>
#define vs vector<string>
#define vll vector< pair<ll,ll> >
#define vii vector< pair<int,int> >
#define viii vector< tuple <int,int,int> >
#define vlll vector< tuple <ll,ll,ll> >
#define vvl vector<vector<ll>>
#define vv vector<vector<int>>
#define all(v) v.begin(),v.end()
#define sqrt sqrtl
#define cbrt cbrtl
#define pll pair<ll,ll>
#define pii pair<int,int>
#define mapcl map<char,ll>
#define mapci map<char,int>
#define mapll map<ll,ll>
#define mapii map<int,int>
#define seti set<int>
ifstream fin("input.txt");
ofstream fout("output.txt");
#define FOR(i, l, r) for (int i = int(l); i < int(r); ++i)

int gcd(int a,int b){while (a&&b)a>b?a%=b:b%=a;return a+b;}
ll pows(int a , int b){ll res=1;for(int i=0; i<b; ++i){res*=a;}return res;}
ll logx(ll base, ll num){int cnt=0;while(num!=1){num/=base; ++cnt;}return cnt;}

vi vis(100001,0);
vi adj[100001];

int main()
{	
    std::ios::sync_with_stdio(false);
    //srand(time(0));
    //cin.tie(NULL);
    //cout.tie(NULL);
    ll a,b,c,d,e;
    cin>>a>>b>>c>>d;
    ll cx,dx,ex;
    e=(c*d)/gcd(c,d);
    if(a%c==0)
    	cx=(b/c)-(a/c)+1;
    else
    	cx=(b/c)-(a/c);
    if(a%d==0)
    	dx=(b/d)-(a/d)+1;
    else
    	dx=(b/d)-(a/d);
    if(a%e==0)
    	ex=(b/e)-(a/e)+1;
    else
    	ex=(b/e)-(a/e);
    //cout<<cx<<" "<<dx<<" "<<ex<<"\n";
    cout<<(b-a+1)-(cx+dx-ex)<<"\n";

}

Measured memory_bytes: 2944
#include <algorithm>
#include <cstring>
#include <iostream>

bool valid(int a, int b, int c) {
    return a <= b + c && b <= c + a + 1 && c <= a + b + 1;
}

void calc(int rear, int front, int west, int east, int north, int south, int limit, char* buffer) {
    bool same = true;
    for (int i = 0; i < limit; i++) {
        int a = rear + front;
        int b = west + east;
        int c = north + south;
        char y;
 
        int temp = rear;
        if (east > 0 && valid(b - 1, c, a)) {
            rear = east - 1;
            east = front;
            front = west;
            west = temp;
            y = 'E';
        } else if (north > 0 && valid(c - 1, a, b)) {
            rear = north - 1;
            north = front;
            front = south;
            south = temp;
            y = 'N';
        } else if (south > 0 && valid(c - 1, a, b)) {
            rear = south - 1;
            south = front;
            front = north;
            north = temp;
            y = 'S';
        } else {
            rear = west - 1;
            west = front;
            front = east;
            east = temp;
            y = 'W';
        }

        if (same) {
            char x = buffer[i];
            if (x < y) {
                return;
            }
            if (x > y) {
                same = false;
            }
        }
        buffer[i] = y;
    }
}

char* find(int target[6], int limit) {
    char* buffer = new char[limit + 1];
    std::memset(buffer, 'Z', limit);
    buffer[limit] = '\0';

    std::sort(target, target + 6);
    do {
        if (valid(target[0] + target[1], target[2] + target[3], target[4] + target[5])) {
            calc(target[0], target[1], target[2], target[3], target[4], target[5], limit, buffer);
        }
    } while (std::next_permutation(target, target + 6));

    return buffer;
}

int main() {
    int target[6];
    while (true) {
        bool nonzero = false;
        for (int i = 0; i < 6; i++) {
            std::cin >> target[i];
            nonzero = nonzero || target[i];
        }
        if (!nonzero) {
            break;
        }

        int p, q;
        std::cin >> p >> q;

        char* result = find(target, q);
        if (result[0] == 'Z') {
            std::cout << "impossible" << std::endl;
        } else {
            std::cout << &result[p - 1] << std::endl;
        }
        delete[] result;
    }
    return 0;
}

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

def f(v):
        v0 = v.pop(0)
        v1 = v.pop(0)
        v.append((v0+v1)/2)
        v.sort()
        # print(v)
        if len(v) == 1:
                print(v[0])
                exit()
        else:
                f(v)

n = int(input())
v = list(map(int, input().split()))
print(f(sorted(v)))


Measured memory_bytes: 38512
n,m= map(int,input().split())
a = [list(map(int,input().split()))for i in range(n)]
b = [int(input()) for j in range (m)]
for i in range (n):
         c = 0
         for j in range(m):
                  c += a[i][j] * b[j]
         print(c)




Measured memory_bytes: 6016
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll A,B;
int n,m;
const int N=500010;
int a[N];
int ans=1e9+7;
int nn;
inline int check(int L){
	int ret=0;
	for(int i=1;i<=L;i++){
		if(a[i]+a[L-i+1]>=m){
			return -1;
		}
		ret=max(ret,a[i]+a[L-i+1]);
	}
	for(int i=L+1;i<=n;i++){
		int rr=i-L;rr=n-rr+1;
		if(a[i]+a[rr]<m)return -2;
		ret=max(ret,(a[i]+a[rr])%m);
	}
	ans = ret;
	return 1;
}

int main()
{
	cin>>nn>>m;
	n=nn*2;
	for(int i=1;i<=n;i++)scanf("%d",&a[i]);
	sort(a+1,a+n+1);
	int l=0,r=nn;
	while(l<r){
		int mid=(l+r)>>1;
		if(check(mid*2)==-2) l=mid+1;
		else r=mid;
	}
	check(l*2);
	cout<<ans<<endl;
}


Measured memory_bytes: 1152
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin>>N;
  int a=0,n=N;
  while(N){
    a+=N%10;
    N/=10;
  }
  cout<<(n%a==0?"Yes":"No")<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <stack>
#include <list>
#include <queue>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <math.h>

using namespace std;

int Pythagoras(int a, int b = 0){
	return a * a + b * b;
}

int main(){
	int edge1 = 0, edge2 = 0, diagonal = 0;
	int diamond = 0, rect = 0;
	
	while(scanf("%d,%d,%d",&edge1, &edge2, &diagonal) != EOF){
		if(edge1 == edge2){
			diamond++;
		}
		else if(Pythagoras(edge1, edge2) ==  Pythagoras(diagonal)){
			rect++;
		}
	}

	cout << rect << endl << diamond << endl;
	return 0;
}

Measured memory_bytes: 1208
#include<bits/stdc++.h>
using namespace std;
#define ios ios_base::sync_with_stdio(0);cin.tie(0)
#define scn(n) scanf("%d",&n)
#define lscn(n) scanf("%lld",&n)
typedef long long ll;
#define pri(n) printf("%d\n",n)
#define lpri(n) printf("%lld\n",n)
#define rep(i,st,ed) for(int i=st;i<ed;i++)
#define var(n) int n; scn(n)
#define F first
#define S second 
#define pb(n) push_back(n)
#define pii pair<int,int> 
#define all(x) (x).begin(),(x).end()
const int N=1e5+5;
const ll M=1e9+7;
const ll inf=1e18+5;

vector<int> g[N];

int main()
{
	var(n);var(m);
	rep(i,0,m)
	{
		var(x);var(y);
		if(x>y)
			swap(x,y);
		g[x].push_back(y);
	}	
	for(int i=0;i<N;i++)
	{
		sort(all(g[i]));		
	}
	// for(int i = 0;i<=n;i++)
	// {
	// 	if(!g[i].empty())
	// 		printf("%d %d\n",i,g[i][0]);
	// }
	
	vector<pair<int,int>> vp;
	int l = -1,r = -1;
	
	for(int i = 1;i<n;i++)
	{
		if(!g[i].empty())
		{
			int new_l = i;
			int new_r = g[i][0];

			if(l== -1)
			{
				l = new_l;
				r = new_r;
			}
			else
			{
				if(r > new_l)
				{
					l = max(l,new_l);
					r = min(r,new_r);
				}
				else
				{
					vp.push_back({l,r});
					l = new_l;
					r = new_r;
				}
			}
		}
	}
	vp.push_back({l,r});
	pri((int)vp.size());
	// for(auto it:vp)
	// {
	// 	printf("%d %d\n",it.F,it.S);
	// }
}

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

using i64 = int64_t;

const i64 MOD = 1e9+7;

const i64 INF = 1e18+7;

signed main(){
	int n;
	cin >> n;
	vector<int> p(n, -1);
	vector<vector<int>> c(n);
	for(int i = 1; i < n; ++i){
		cin >> p[i];
		c[--p[i]].emplace_back(i);
	}
	vector<int> a(n);
	for(auto& x : a)
		cin >> x;


	vector<int> dp(n, -1);

	for(int i = 0; i < n; ++i)
		if(c[i].empty())
			dp[i] = 0;

	function<bool(int)> f = [&](int x){
		bitset<5007> bs;
		bs.set(0);
		int sum = 0;
		for(auto& y : c[x]){
			if(!f(y))
				return false;
			sum += a[y];
			sum += dp[y];
			bitset<5007> nex;
			nex |= bs << a[y];
			nex |= bs << dp[y];
			bs = move(nex);
		}
		int ret = MOD;
		// 制約を満たす範囲で片側を調べる
		for(int i = 0; i <= a[x]; ++i)
			if(bs[i]){
				// もう片側の値
				int j = sum - i;
				if(j < 0)
					continue;
				if(i <= a[x])
					ret = min(ret, j);
				if(j <= a[x])
					ret = min(ret, i);
			}
		dp[x] = ret;
		return ret != MOD;
	};

	cout << (f(0) ? "" : "IM") << "POSSIBLE" << endl;
}


Measured memory_bytes: 1408
import sys

def r(n, a, b):
    both_max = min(a, b)
    if 0 < a + b - n:
        both_min = a + b - n
    else:
        both_min = 0

    print(both_max, both_min)


def main():
    input = sys.stdin.readline
    n, a, b = list(map(int, input().split()))
    r(n, a, b)


if __name__ == '__main__':
    main()


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

int main() {
    int n;
    cin >> n;
    vector<int> p(n);
    for (int i = 0; i < n; i++)
        cin >> p[i];
    
    int ans = 0;
    for (int i = 1; i < n-1; i++) {
        vector<int> three = {p[i-1], p[i], p[i+1]};
        sort(three.begin(), three.end());
        if(three[1] == p[i])
            ans++;
    }

    cout << ans << endl;
}

Measured memory_bytes: 3632
N,D=map(int,input().split())
X=[]
Y=[]
for i in range(N):
    x,y=input().split()
    X.append(int(x))
    Y.append(int(y))

import math
def get_distance(x,y):
    d=math.sqrt(((x)**2+(y)**2))
    return d

a=0
for i in range(N):
    distance=get_distance(x=X[i],y=Y[i])
    if distance<=D:
        a+=1
print(a)
    

Measured memory_bytes: 24848
#include<iostream>
using ll = long long int;
using namespace std;
int main(){
 int n;
 cin>>n;
 ll ans=0;
 ll *arr = new ll[n];
 for(int i=0;i<n;i++){
   cin>>arr[i];
 }
 for(int i=0;i<n-1;i++){
   if(arr[i]>arr[i+1]){
    ll diff = arr[i] - arr[i+1];
    ans +=diff;
    arr[i+1] +=diff;
   }
 }
 cout<<ans<<endl;
 delete []arr;
 return 0;
}


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

#define rep(i, n) for (int i = 0; i < n; ++i)
#define ALL(a) (a).begin(), (a).end()
#define rALL(a) (a).rbegin(), (a).rend()
#define SZ(x) ((int)(x).size())
using ll = long long;
using P = pair<ll, ll>;
using llP = pair<ll, ll>;
using DoP = pair<double, double>;
const int di[] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dj[] = {1, 0, -1, 0, 1, -1, 1, -1};
const int INF = 1 << 29;
const ll INF64 = 1ll << 62;
const int mod = 1000000007;
//const int mod = 998244353;

template <class T>inline bool chmin(T &a, const T b)
{
  if (a > b)
  {
    a = b;
    return true;
  }
  return false;
}
template <class T>inline bool chmax(T &a, const T b)
{
  if (a < b)
  {
    a = b;
    return true;
  }
  return false;
}
template <class T>inline void line_out(const vector<T> vec) {
  int n = SZ(vec);
  rep(i, n) {
    cout << vec[i];
    if(i < n-1) cout << " ";
  }
  cout << endl;
  return;
}

struct mint
{
  ll x; // typedef long long ll;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint operator-() const { return mint(-x); }
  mint &operator+=(const mint a)
  {
    if ((x += a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator-=(const mint a)
  {
    if ((x += mod - a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator*=(const mint a)
  {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const
  {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const
  {
    mint res(*this);
    return res -= a;
  }
  mint &operator++()
  {
    if ((x += 1) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator--()
  {
    if ((x += mod - 1) >= mod)
      x -= mod;
    return *this;
  }
  mint operator*(const mint a) const
  {
    mint res(*this);
    return res *= a;
  }
  mint pow(ll t) const
  {
    if (!t)
      return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1)
      a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const
  {
    return pow(mod - 2);
  }
  mint &operator/=(const mint a)
  {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const
  {
    mint res(*this);
    return res /= a;
  }
};


int main()
{
  int n, k;
  cin >> n >> k;
  vector<pair<ll, ll>> p(n);
  rep(i, n) cin >> p[i].first >> p[i].second;
  sort(ALL(p));
  ll ans = INF64;
  for(int i = 0; i < n; ++i) {
    for(int j = i+1; j < n; ++j) {
      ll l = p[i].first, r = p[j].first;
      vector<ll> ys;
      for(int t = i; t <= j; ++t) ys.push_back(p[t].second);
      sort(ALL(ys));
      for(int a = 0; a < ys.size(); ++a) {
        for(int b = a+1; b < ys.size(); ++b) {
          ll d = ys[a], u = ys[b];
          int c = 0;
          rep(t, n) if(l <= p[t].first && p[t].first <= r && d <= p[t].second && p[t].second <= u) ++c;
          if(c >= k) chmin(ans, (r-l)*(u-d));
        }
      }
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#define mod 1000000007
using namespace std;
int x[100001];
int y[100001];
int main(){
    
    int n,m;
    
    scanf("%d %d",&n,&m);
    
    for(int i=1;i<=n;i++){
        scanf("%d",&x[i]);
    }
    
    for(int j=1;j<=m;j++){
        scanf("%d",&y[j]);
    }
    
    long long xx = 0;
    long long yy = 0;
    for(int i=1;i<=n;i++){
        xx += 1LL*(i-1)*x[i] - 1LL*(n-i)*x[i];
        xx%=mod;
    }
    for(int i=1;i<=m;i++){
        yy += 1LL*(i-1)*y[i] - 1LL*(m-i)*y[i];
        yy%=mod;
    }
    
    printf("%lld\n", (xx*yy)%mod);
    
    return 0;
}

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

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define endl '\n';
#define FASTER ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
const ll POSITIVE_INFINITY = 9223372036854775807;
const ll NEGATIVE_INFINITY = -9223372036854775807;
const ll MOD = 1000000007;
const ld PI = acos(-1.0);

template <typename T> inline T bigMod(T A,T B,T M = MOD){A %= M;T ret = 1;while(B){if(B & 1) ret = (ret * A) % M;A = (A * A) % M;B = B >> 1;}return ret;}
template <typename T> inline T invMod (T A,T M = MOD){return bigMod(A,M-2,M);}

const int N = 200005;

int main(){
  FASTER;
  int n;
  cin >> n;
  vector<ll>ar(n);
  for (int i = 1; i < n; i++){
    cin >> ar[i];
  }
  ar[0] = ar[1];
  for (int i = 0; i < n - 1; i++){
    ar[i] = min(ar[i], ar[i + 1]);
  }
  ll sum = 0;
  for (int i = 0; i < n; i++){
    sum += ar[i];
  }
  cout << sum << '\n';
  return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Atcoder
{
    class Atcoderrrrrr
    {
        static void Main(string[] args)
        {
            string s = Console.ReadLine();
            if(s == "5 5 7" || s == "5 7 5"|| s == "7 5 5")
            {
                Console.WriteLine("YES");
            }
            else
            {
                Console.WriteLine("NO");
            }
        }
    }
}

Measured memory_bytes: 11092
#include <stdio.h>

int main()
{
	int N, k, c;
	scanf("%d", &N);
  
  char s[N];
  
  scanf("%s", s);
  
  for(k=0; k<N; k++){
    if(s[k]=='R') c++;
  }
  
  if(c*2 > N) printf("Yes");
  else printf("No");

	return 0;
} 


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int h[100000],dp[100000];
int main(){
	int n,k;
	cin>>n>>k;
	for(int i=0;i<n;i++)
		cin>>h[i];
	fill(dp,dp+n,1e9);
	dp[0]=0;
	for(int j=1;j<n;j++)
		for(int i=max(0,j-k);i<j;i++)
			dp[j]=min(dp[j],dp[i]+abs(h[j]-h[i]));
	cout<<dp[n-1]<<endl;
}


Measured memory_bytes: 1024
n,x=map(int,input().split())

def solve(a,b):
  mi=min(a,b)
  ma=max(a,b)
  if ma%mi==0:
    return (ma//mi*2-1)*mi
  else:
    return (ma//mi*2)*mi+solve(mi,ma%mi)

ans=n+solve(n-x,x)
print(ans)


Measured memory_bytes: 3060
package main

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

func main() {
	sc := NewScanner()
	A, B, C := sc.NextInt(), sc.NextInt(), sc.NextInt()
	if A <= C && C <= B {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}

type Scanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func NewScanner() *Scanner {
	rdr := bufio.NewReaderSize(os.Stdin, 1000)
	return &Scanner{r: rdr}
}
func (s *Scanner) Next() string {
	s.pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	result := string(s.buf[start:s.p])
	s.p++
	return result
}
func (s *Scanner) NextLine() string {
	s.pre()
	start := s.p
	s.p = len(s.buf)
	return string(s.buf[start:])
}
func (s *Scanner) NextInt() int {
	v, _ := strconv.Atoi(s.Next())
	return v
}
func (s *Scanner) NextInt64() int64 {
	v, _ := strconv.ParseInt(s.Next(), 10, 64)
	return v
}

func (s *Scanner) NextIntArray() []int {
	s.pre()
	start := s.p
	result := []int{}
	for ; s.p < len(s.buf)+1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 0)
			result = append(result, int(v))
			start = s.p + 1
		}
	}

	return result
}
func (s *Scanner) NextInt64Array() []int64 {
	s.pre()
	start := s.p
	result := []int64{}
	for ; s.p < len(s.buf)+1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 64)
			result = append(result, v)
			start = s.p + 1
		}
	}
	return result
}

func (s *Scanner) NextMap() map[int]bool {
	s.pre()
	start := s.p
	mp := map[int]bool{}
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			v, _ := strconv.Atoi(string(s.buf[start:s.p]))
			mp[v] = true
			start = s.p + 1
		}
	}
	v, _ := strconv.Atoi(string(s.buf[start:s.p]))
	mp[v] = true

	return mp
}

func (s *Scanner) pre() {
	if s.p >= len(s.buf) {
		s.readLine()
		s.p = 0
	}
}
func (s *Scanner) readLine() {
	s.buf = make([]byte, 0)
	for {
		l, p, e := s.r.ReadLine()
		if e != nil {
			panic(e)
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}


Measured memory_bytes: 640
#include<iostream>
#include<cstring>
#define rep(i,a) for(i=0;i<=a;++i)
using namespace std;

int main(){
    int n,i,j,k,l,cnt;
    while(cin>>n){
        cnt = 0;
        rep(i,9)rep(j,9)rep(k,9){
            l=n-(i+j+k);
            if(l>=0 && l<=9)cnt++;
        }
        cout<<cnt<<endl;
    }
    return 0;
}

Measured memory_bytes: 1160
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <deque>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <algorithm>
#include <numeric>
#include <complex>
#include <functional>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cctype>

using namespace std;

#define dump(n) cout<<"# "<<#n<<"="<<(n)<<endl
#define debug(n) cout<<__FILE__<<","<<__LINE__<<": # "<<#n<<"="<<(n)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,n) repi(i,0,n)
#define iter(c) __typeof((c).begin())
#define tr(c,i) for(iter(c) i=(c).begin();i!=(c).end();i++)
#define allof(c) (c).begin(),(c).end()
#define mp make_pair

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int,int> pii;

int main()
{
	for(double x1,y1,x2,y2,xq,yq;cin>>x1;){
		scanf(",%lf,%lf,%lf,%lf,%lf",&y1,&x2,&y2,&xq,&yq);
		x2-=x1; y2-=y1;
		xq-=x1; yq-=y1;
		double rad=arg(complex<double>(xq,yq))-arg(complex<double>(x2,y2));
		double x=xq*cos(2*rad)+yq*sin(2*rad);
		double y=-xq*sin(2*rad)+yq*cos(2*rad);
		printf("%f %f\n",x1+x,y1+y);
	}
	
	return 0;
}

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

int main(){
    int N, M;
    cin >> N >> M;
    vector<int> city(N);
    
    int a, b;
    rep(i, M){
        cin >> a >> b;
        city.at(a - 1) += 1;
        city.at(b - 1) += 1;
    }

    rep(i, N){
        cout << city.at(i) << endl;
    }
}

Measured memory_bytes: 3628
#include<stdio.h>
int main(void)
{
    long long int n,a[200001],i,sum = 0;
    scanf("%lld",&n);
    for(i = 1 ; i <= n ; i++)
    {
        scanf("%lld",&a[i]);
    }
    for(i = 1 ; i < n ;i++)
    {
        if(a[i] > a[i + 1])
        {
            sum += a[i] - a[i + 1];
            a[i + 1] = a[i];
        }
    }
    printf("%lld\n",sum);
    return 0;
}

Measured memory_bytes: 3296
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;


using namespace std;

#define debug(x) cout << '>' << #x << ':' << x << endl;
#define loop(i,n) for(int i=0;i<(int)(n);i++)
#define foi(i,k,n) for(int i=(k); i<(int)(n); i+=1)
#define fod(i,n,k) for(int i=k; i>=(int)n; i-=1)
#define fast_io ios_base::sync_with_stdio(false) , cin.tie(NULL);
#define all(x) x.begin(), x.end()
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define endl "\n"

#define int long long
#define INF 0x3f3f3f3f
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007

#define fir first
#define sec second
#define pb push_back
#define mp make_pair

typedef long long llint;
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<llint> VL;
typedef vector<string> VS;
typedef vector<PII> VII;
typedef vector<VI> VVI;
typedef map<int,int> MII;
typedef set<int> SI;
string tostr(int n) {stringstream rr;rr<<n;return rr.str();}
llint toint(string s) {stringstream ss(s); llint x; ss >> x; return x;}
//typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
//gp_hash_table<string, llint> table;


//int mpow(llint base, llint exp) {
  //base %= MOD;
  //llint result = 1;
  //while (exp > 0) {
    //if (exp & 1) result = ((llint)result * base) % MOD;
    //base = ((llint)base * base) % MOD;
    //exp >>= 1;
  //}
  //return result;
//}


//void makegraph(int n, int m){
	//int i, u, v;
	//while(m--){
		//cin>>u>>v;
		//u--, v--;
		//g[u].pb(v);
		//g[v].pb(u);
	//}
//}

//void dfs(int u, int par){
	//for(int v:g[u]){
		//if (v == par) continue;
		//dfs(v, u);
	//}
//}


// ------------------------------------------------------------------ILB----------------------------------------------------------------  //

const int MX = 2e5 + 100;



void solve(){
	int h, w, m;
	cin >> h >> w >> m;
	
	VI r(h + 1), c(w + 1); 
	set <PII> bomb;
	
	loop(i, m){
		int x, y;
		cin >> x >> y;
		bomb.insert({x, y});
		r[x]++;
		c[y]++;
	}
	
	VII rr, cc;
	
	loop(i, h + 1){
		if(r[i]) rr.pb({r[i], i});
	}
	
	loop(i, w + 1){
		if(c[i]) cc.pb({c[i], i});
	}
	
	sort(all(rr), greater <PII>());
	sort(all(cc), greater <PII>());
	
	int mx = rr[0].fir + cc[0].fir - bomb.count({rr[0].sec, cc[0].sec});
	int op = 0;
	
	for(int i = 0; i < rr.size(); ++i){
		if(op > 10000000) break;
		for(int j = 0; j < cc.size(); ++j){
			op++;
			if(op > 10000000) break;
			if(mx != rr[i].fir + cc[j].fir - (int)bomb.count({rr[i].sec, cc[j].sec})){
				mx = max(mx, rr[i].fir + cc[j].fir - (int)bomb.count({rr[i].sec, cc[j].sec}));
				//cout << mx;
				break;
			}
		}
	}
	
	cout << mx;
}




int32_t main() {
	fast_io;
    int t = 1;
    //cin >> t;
    //int xx = 0
    while(t--) {
		//xx++;
		//cout << "Case ";
      solve();
    }
    return 0;
}



Measured memory_bytes: 43708
import bisect,collections,copy,heapq,itertools,math,string
import sys
def S(): return sys.stdin.readline().rstrip()
def M(): return map(int,sys.stdin.readline().rstrip().split())
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())
s = S()
t = S()
ans = 'No'
for _ in range(101):
    if s == t:
        ans = 'Yes'
        break
    else:
        t = t[1:] + t[0]
print(ans)

Measured memory_bytes: 74468
import java.util.*;
public class Main{
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    int n = s.length();
    char[] S = new char[n];
    int i;
    int leng = 0;
    int max = 0;
    for(i=0;i<n;i++){
      S[i] = s.charAt(i);
    }
    for(i=0;i<n;i++){
      if(S[i]=='A'||S[i]=='C'||S[i]=='G'||S[i]=='T'){
        leng = leng + 1;
      }else{
        if(max<leng){
          max = leng;
          leng = 0;
        }else{
          leng = 0;
        }
      }
    }
    if(leng>max){
      max = leng;
    }
    System.out.println(max);    
 }
}

Measured memory_bytes: 21712
/*  -*- coding: utf-8 -*-
 *
 * e.cc: E - Sum Equals Xor
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int MAX_N = 100001;
const int MOD = 1000000007;

/* typedef */

typedef long long ll;

/* global variables */

char s[MAX_N + 4];
int ts[MAX_N + 1];

/* subroutines */

/* main */

int main() {
  scanf("%s", s);
  int n = strlen(s);

  ts[0] = 1;
  for (int i = 0; i < n; i++)
    ts[i + 1] = (ll)ts[i] * 3 % MOD;

  int sum = 0, d = 1;
  for (int i = 0, j = n - 1; j >= 0; i++, j--)
    if (s[i] == '1') {
      sum = (sum + (ll)d * ts[j] % MOD) % MOD;
      d = 2 * d % MOD;
    }

  printf("%d\n", (sum + d) % MOD);
  return 0;
}


Measured memory_bytes: 768
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

using namespace __gnu_pbds;
using namespace std;

typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;

#define mp make_pair
#define pb push_back
#define pf push_front
#define ss second
#define ff first
#define sz(x) (int)x.size()
#define newl "\n"
#define vi vector<int>
#define pii pair<int, int>
#define vii vector<pii>
#define vl vector<ll>
#define pll pair<ll, ll>
#define vll vector<pll>
#define mem(x, val) memset(x, val, sizeof(x))
#define fastio                        \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);
#define all(v) (v).begin(), (v).end()

const ld pi = 3.14159265359;
ll INF = 1e18 + 10;
ll MOD = 998244353;
ll mod = 1e9 + 7;

inline ll add(ll a, ll b, ll m)
{
    if ((a + b) >= m)
        return (a + b) % m;
    return a + b;
}

inline ll mul(ll a, ll b, ll m)
{
    if ((a * b) < m)
        return a * b;
    return (a * b) % m;
}

ll power(ll x, ll y, ll m)
{
    ll res = 1;
    x = x % m;
    if (x == 0)
        return 0;
    while (y > 0)
    {
        if (y & 1)
            res = (res * x) % m;
        y = y >> 1;
        x = (x * x) % m;
    }
    return res;
}

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

void solve()
{
    int k;
    string s;
    cin>>k>>s;
    int l = sz(s);
    if(l<=k) {
        cout<<s;
    }
    else {
        string x="";
        for(int i=0;i<k;i++) {
            x.append(1,s[i]);
        }
        x.append("...");
        cout<<x;
    }
}

int main()
{
    fastio;
    int t;

    t = 1;
    //cin >> t;
    //int test=t;
    while (t-- > 0)
    {
        //cout<<"Case #"<<(test-t)<<": ";
        solve();
        cout << newl;
    }

    return 0;
}

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

//repetition
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//infinity
#define INTINF 2000000000
#define LONGINF 2000000000

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

int main(){
	int N;
	cin >> N;
	vector<int> v;

	int sum = 0;
	v.push_back(0);
	FOR(i, 1, N+1){
		int a;
		cin >> a;
		v.push_back(a);
		sum += abs( v[i] - v[i-1] );
	}
	v.push_back(0);
	sum += abs(v[N]);

	FOR(i, 1, N+1){
		int before = abs(v[i] - v[i-1]) + abs(v[i+1] - v[i]);
		int after = abs(v[i+1] - v[i-1]);
		cout << sum + (after - before) << endl;
	}

	return 0;
}


Measured memory_bytes: 1784
from collections import deque

n, q = map(int, input().split())
G = [[] for yy in range(n)]
count = [0]*n
flag=[False]*n
stack = deque([0])

for _ in range(n-1):
  a, b = map(int, input().split())
  G[a-1].append(b-1)
  G[b-1].append(a-1)
  
for _ in range(q):
  p, x = map(int, input().split())
  count[p-1] += x

stack.append(0)
while stack:
  v = stack.pop()
  flag[v] = True
  for e in G[v]:
    if flag[e]:
      continue
    count[e] += count[v]
    stack.append(e)

print(*count)

Measured memory_bytes: 56184
#include <bits/stdc++.h>
using namespace std;
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define reprrev(i,a,b) for(int i=b-1;i>=a;i--)
#define reprev(i,n) reprrev(i,0,n)
typedef long long ll;
typedef unsigned long long ull;
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; }
 
/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
    sizeは(int)とキャストしよう
    ごちゃごちゃ場合分けを考える前に全探索は考えましたか？
*/

const ll mod = 1e9+7;

void chmod(ll &M){
    if(M >= mod) M %= mod;
    else if(M < 0){
        M += (abs(M)/mod + 1)*mod;
        M %= mod;
    }
}

ll modpow(ll x, ll n){
    if(n == 0) return 1;

    ll res = modpow(x, n/2);
    if(n%2 == 0) return res*res%mod;
    else return res*res%mod*x%mod;
}

ll power(ll x, ll n){
    if(n == 0) return 1;

    ll res = power(x, n/2);
    if(n%2 == 0) return res*res;
    else return res*res*x;
}

int getl(int i, int N) { return i==0? N-1:i-1; };
int getr(int i, int N) { return i==N-1? 0:i+1; };

/* <--------------------------------------------> */

typedef tuple<ll, ll, ll> T;
// get<K>(tuple型の変数)

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

ll gcd(ll a, ll b){
    if(a<b) swap(a, b);
    while(b!=0){
        ll t=a;
        a=b;
        b=t%b;
    }
    return a;
}

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

    ll a, b; cin >> a >> b;
    ll g=gcd(a,b);
    vector<ll> cd;
    for(ll i=1; i*i<=g; ++i){
        if(g%i==0){
            cd.push_back(i);
            if(i!=g/i) cd.push_back(g/i);
        }
    }
    
    ll ans=0;
    for(auto e:cd){
        if(e==1 || isprime(e)) ++ans; 
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 384
#include<iostream>
#include<stdio.h>
#include<string>
#include <algorithm>
#include<cstring>
#include <math.h>
#include <iomanip>
using namespace std;


int main()
{
  string s,t;

  cin>>s>>t;
  cout<<t<<s<<endl;
  return 0;
}


Measured memory_bytes: 256
#![allow(unused_variables)]
#![allow(unused_imports)]
#![allow(dead_code)]
use std::io;
use std::str::FromStr;
use std::iter::FromIterator;
use std::cmp::{max, min, Ordering};
use std::collections::*;
use std::mem::{replace, swap};


// abcde
fn read_string() -> String {
    let mut line = String::new();
    io::stdin().read_line(&mut line).unwrap();
    line
}


fn read_as_primitive<T: FromStr>() -> T {
    let s = read_string();
    s.trim().parse().ok().expect("failed to parse input")
}


fn integerdigits(n: i64) -> Vec<i64> {
    let s = n.to_string();
    assert!(s.chars().next().unwrap() != '-');
    s.chars().map(|c| c.to_digit(10).unwrap() as i64).collect()
}

fn dfs(x: i64, n: i64) -> i64 {
    if x > n {
        return 0;
    }
    let digits = integerdigits(x);
    let mut ret = if digits.contains(&3) && digits.contains(&5) && digits.contains(&7) {1} else {0};
    for c in &[7, 5, 3] {
        ret += dfs(10 * x + c, n);
    }
    ret
}
    
fn main() {
    let n: i64 = read_as_primitive();
    println!("{}", dfs(0, n));
}

Measured memory_bytes: 4352
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>

using namespace std;

int main(){
	
	int A,B,C;
	int flag5=0,flag7=0;

	cin>>A>>B>>C;

	if(A==5) flag5++;
	else if(A==7) flag7++;

	if(B==5) flag5++;
	else if(B==7) flag7++;

	if(C==5) flag5++;
	else if(C==7) flag7++;

	if(flag5==2 && flag7==1) cout<<"YES"<<endl;
	else cout<<"NO"<<endl;

	return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    long[][] a = new long[n][2];
    for(int i = 0; i < n; i++) {
      a[i][0] = (long)(i + 1);
      a[i][1] = sc.nextLong();
    }
    Arrays.sort(a, new Comparator<long[]>(){
      @Override
      public int compare(long[] o1, long[] o2) {
        return (int)(o2[1] - o1[1]);
      }
    });
    long[][] dp = new long[n + 1][n + 1];
    dp[1][0] = a[0][1] * (long)(a[0][0] - 1);
    dp[0][1] = a[0][1] * (long)(n - a[0][0]);
    for(int k = 2; k <= n; k++) {
      for(int i = 0; i <= k; i++) {
        // dp[i][k - i]の更新
        // k人目が(i - pi)のパターン
        if(i > 0) dp[i][k - i] = dp[i - 1][k - i] + (a[k - 1][1] * (long)(a[k - 1][0] - i));      

        // k人目が(pi - i)のパターン
        if(k > i) dp[i][k - i] = Math.max(dp[i][k - i], dp[i][k - i - 1] + (a[k - 1][1] * (long)(n - k + i + 1 - a[k - 1][0]))); 
      }
    }
    long ans = 0;
    for(int i = 0; i <= n; i++) {
      ans = Math.max(ans, dp[i][n - i]);
    }
    System.out.println(ans);
  }
}

Measured memory_bytes: 86100
#include <bits/stdc++.h>
#define rep(i,n)for(long long i=0;i<(n);i++)
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
const ll INF=1e18;
const int MOD=1e9+7;
const double pi=acos(-1);

int main(){
  ll k,n;
  cin >> k >> n;
  vector<ll>a(n);
  rep(i,n) cin >> a[i];
  ll ans=a[n-1]-a[0];
  rep(i,n-1){
    ans=min(ans,k-a[i+1]+a[i]);
  }
  cout << ans << endl;
 
}


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

using namespace std;

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

  string answer = "";
  while (N) {
    N--;
    int k = N % 26;
    answer += 'a' + k;
    N /= 26;
  }
  reverse(answer.begin(), answer.end());
  cout << answer << endl;
  
  return 0;
}


Measured memory_bytes: 3596
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <functional>

using namespace std;

struct edge {
	long long int to, cost;
};

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

#define INF 1000000000000000
#define MAX_V 100010

long long int V;
vector<edge> G[MAX_V];
long long int d[MAX_V];

void dijkstra(long long int s) {
	priority_queue<P, vector<P>, greater<P> > que;
	fill(d, d + V, INF);
	d[s] = 0;
	que.push(P(0, s));

	while (!que.empty()) {
		P p = que.top();
		que.pop();
		long long int v = p.second;
		if (d[v] < p.first) continue;
		for (long long int i = 0; i < G[v].size(); i++) {
			edge e = G[v][i];
			if (d[e.to] > d[v] + e.cost) {
				d[e.to] = d[v] + e.cost;
				que.push(P(d[e.to], e.to));
			}
		}
	}
}

int main() {
	long long int n;
	cin >> n;
	V = n+1;
	long long int a, b, c;

	

	for (long long int i = 0; i < n-1; i++) {
		cin >> a >> b >> c;
		edge e;
		e.to = a;
		e.cost = c;
		G[b].push_back(e);
		e.to = b;
		G[a].push_back(e);
	}
	long long int q, k;
	cin >> q >> k;
	dijkstra(k);
	long long int x, y;

//	cout << d[3] << ' ' << d[2] << endl;

	for (long long int i = 0; i < q; i++) {
		cin >> x >> y;
		cout << d[x] + d[y] << endl;
	}

	return 0;
}

Measured memory_bytes: 11120
#include<stdio.h>
int main(){
  int n,i,j;
  int max,cmax=0,count=0;
  scanf("%d",&n);
  max=n;
  for(i=n;i>0;i--){
    j=i;
    count=0;
    while(j%2==0){
    count++;
    j=j/2;
    }
  if(cmax<=count){
    cmax=count;
  max=i;
  }
  if(j==1)
    break;
  }
  printf("%d",max);
  return 0;
}

Measured memory_bytes: 128
#coding:utf-8
import math

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

w_list = []
for i in range(math.ceil(F / (100 * A)) + 1):
    for j in range(math.ceil(F / (100 * B)) + 1):
        if i == 0 and j == 0:
            continue
        water = 100 * A * i + 100 * B * j
        if water <= F:
            w_list.append(water)

s_list = []
for i in range(math.ceil(F / C) + 1):
    for j in range(math.ceil(F / D) + 1):
        sugar = C * i + D * j
        if sugar <= F:
            s_list.append(sugar)

max_c = 0
max_w = 100 * A
max_s = 0
for w in set(w_list):
    for s in set(s_list):
        if w + s > F:
            continue
        if s > int(E * w / 100):
            continue
        c = 100 * s / (w + s)
        if c > max_c:
            max_c = c
            max_w = w
            max_s = s

print(max_w + max_s, max_s, end = " ")


Measured memory_bytes: 12568
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

int main(){
  int n,d;
  int count = 0;
  double dist;
  scanf("%d %d", &n, &d);
  int **array;
  int *base_array;
  base_array = (int *)malloc(sizeof(int) * n * d);
  array = (int **)malloc(sizeof(int *) * n);
  for(int i = 0; i < n; i++){
    array[i] = base_array + i * d;
  }
  for(int i = 0; i < n; i++){
    for(int j = 0; j < d; j++){
      scanf("%d", &array[i][j]);
    }
  }
  for(int i = 0; i < n; i++){
    for(int j = i + 1; j < n; j++){
      dist = 0;
      for(int k = 0; k < d; k++){
	dist += pow(array[i][k] - array[j][k], 2);
      }
      dist = sqrt(dist);
      if(ceil(dist) == floor(dist)){
	count++;
      }
    }
  }
  printf("%d", count);
  return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;
using vc = vector<char>;
using vvc = vector<vc>;
using pll = pair<ll, ll>;
using stkll = vector<pll>;
const ll INF = 1LL << 60;
const ll MOD = 1e9 + 7;
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define debug(x) cerr << #x << ": " << x << endl;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

vector<pair<long long, long long> > prime_factorize(long long n) {
    vector<pair<long long, long long> > res;
    for (long long p = 2; p * p <= n; ++p) {
        if (n % p != 0) continue;
        int num = 0;
        while (n % p == 0) { ++num; n /= p; }
        res.push_back(make_pair(p, num));
    }
    if (n != 1) res.push_back(make_pair(n, 1));
    return res;
}

vector<long long> calc_divisor(long long n) {
    vector<long long> res;
    for (long long i = 1LL; i*i <= n; ++i) {
        if (n % i == 0) {
            res.push_back(i);
            long long j = n / i;
            if (j != i) res.push_back(j);
        }
    }
    sort(res.begin(), res.end());
    return res;
}

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

    auto res = prime_factorize(n-1);
    ll ans = 1;
    for(auto p: res) ans *= p.second + 1;

    vll div = calc_divisor(n);
    for(auto d: div) {
        if (d == 1 || d == n) continue;

        ll m = n;
        while(m % d == 0) {
            m /= d;
        }
        if(m % d == 1) {
            ans++;
        }
    }

    cout << ans << endl;
}


Measured memory_bytes: 384
use std::io;

fn next_vec() -> Vec<i64> {
    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    buf.split_whitespace().map(|n| n.parse().unwrap()).collect()
}

fn main() {
    let v = next_vec();
    let a = v[0];
    let b = v[1];
    let c = v[2];

    let ans = if a % 2 != 0 && b % 2 != 0 && c % 2 != 0 {
        std::cmp::min(a*b, std::cmp::min(b*c, c*a))
    } else {
        0
    };

    println!("{:?}", ans);
}


Measured memory_bytes: 4352
#include<math.h>
#include<limits.h>
#include<iostream>
#include<string>
#include<vector>
#include<stdio.h>
#include<sstream>
#include<list>
#include<queue>
#include<algorithm>
#include<functional>
#include<initializer_list>
#include<map>
#include<set>
#include<utility>
#include<tuple>
using namespace std;
#define ull unsigned long long
#define llong long long
#define rep(i, n) for(int i=0;i<(int)(n);i++)
#define all(t) t.begin(), t.end()


int main() {
	string s;
	cin >> s;
	int n = s.length();
	string s2 = s;
	auto it = remove(all(s2), 'A');

	string s3(s2.begin(), it);
	if (s3 == "KIHBR") {
		rep(i, n - 1) {
			if (s[i] == s[i + 1]) {
				cout << "NO" << endl;
				return 0;
			}
		}
		size_t pos = s.find("KIH");
		if (pos == string::npos) {
			cout << "NO" << endl;
			return 0;
		}
		cout << "YES" << endl;
		return 0;
	}
	else {
		cout << "NO" << endl;
	}
	return 0;
}





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

int main() { 
 int  A;
 int  B;
 cin >> A;
 cin >> B;
 int osszeadas=A+B;
 int szorzas=A*B;
 int kivonas=A-B;
 if(osszeadas>kivonas&&osszeadas>szorzas){
   cout << osszeadas;
 }else if(kivonas>szorzas){
   cout << kivonas;
 }else{
   cout << szorzas;
 }
	return 0;
}


Measured memory_bytes: 3600
#include <bits/stdc++.h>
#define int long long
//#define double long double
#define endre getchar();getchar();return 0
#define moder (int)(1e9+7)
#define inf (int)(3e18+7)
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define P pair<int,int>
#define all(v) v.begin(),v.end()
#define prique(T) priority_queue<T,vector<T>,greater<T>>
#define vecunique(vec) sort(vec.begin(), vec.end());decltype(vec)::iterator result = std::unique(vec.begin(), vec.end());vec.erase(result, vec.end())
using namespace std;

int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x * y / gcd(x, y);
}
int kai(int x) {
	if (x == 0)return 1;
	return kai(x - 1)*x;
}
int mod_pow(int x, int y, int mod) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x%mod;
		}
		x = x * x%mod;
		y >>= 1;
	}
	return res;
}
int comb(int x, int y) {
	return kai(x)*mod_pow(kai(x - y), moder - 2, moder) % moder*mod_pow(kai(y), moder - 2, moder) % moder;
}
/*--------Library Zone!--------*/

int n, a[314514];
signed main() {
	cin >> n;
	rep(i, 3 * n)cin >> a[i];
	sort(a, a + 3 * n);
	reverse(a, a + 3 * n);
	int ans = 0;
	rep(i, n) {
		ans += a[1 + 2 * i];
	}
	cout << ans << endl;
	endre;
}

Measured memory_bytes: 2560
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String a = sc.next();
		String b = new StringBuffer(sc.next()).reverse().toString();

		System.out.println(a.equals(b) ? "YES" : "NO");

		sc.close();

	}

}


Measured memory_bytes: 26996
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main(void){
    int n,k;
    cin>>n>>k;
    vector<int> parts(n);
    for(int i = 0;i<n;i++){
        cin>>parts[i];
    }
    sort(parts.begin(),parts.end());
    int sum = 0;
    for(int i = 0;i<k;i++){
        sum += parts[n-i-1];
    }
    cout<<sum<<endl;
}

Measured memory_bytes: 256
H, W = map(int, input().split())
XY = [[] for _ in range(H)]
for h in range(H):
    XY[h] = [s for s in input()]


for h in range(H):
    ans = ""
    for w in range(W):
        if XY[h][w] == "#":
            ans += "#"
            continue
        cnt = 0
        for h_diff in [-1, 0, 1]:
            for w_diff in [-1, 0, 1]:
                if h + h_diff < 0 or w + w_diff < 0:
                    continue
                elif h + h_diff >= H or w + w_diff >= W:
                    continue
                else:
                    if XY[h + h_diff][w + w_diff] == "#":
                        cnt += 1
        ans += str(cnt)
    print(ans)


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

int main() {
  int n,ans=0; cin>>n;
  vector<int> a(n); vector<int> b(n);
  rep(i,n) {
    cin>>a[i]; b[i]=a[i];
  }
  sort(b.begin(),b.end());
  rep(i,n) {
      if(b[n-1]==a[i]) cout<<b[n-2]<<endl;
      else cout<<b[n-1]<<endl;
    }
    return 0;
}

Measured memory_bytes: 3200
//submitted by HimJ
#include<bits/stdc++.h>
#define ll long long
#define mod 1000000007
#define pb push_back
#define fi first
#define se second
#define fr(i,s,e) for(i=s;i<e;i++)
#define ms(arr,val) memset(arr,val,sizeof(arr))
using namespace std;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
  int t=1;
  //cin>>t;
    while(t--){
            int x,y;
    cin>>x>>y;
    int ans=x;
    if(x==y||x%y==0)
    ans=-1;
    cout<<ans;

  }
  return 0;
  }



Measured memory_bytes: 892
a, v = map(int, input().split())
b, w = map(int, input().split())
t = int(input())
dis = abs(a - b)
sb = v - w
if sb <= 0:
    print("NO")
    exit()
time = dis / sb
if time > t:
    print("NO")
else:
    print("YES")

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

int main() {
    int n, cnt = 0, ans = 0;
    cin >> n;
    if (n < 105) {
        cout << 0 << endl;
        return 0;
    }
    for (int i = 105; i <= n; i += 2) {
        cnt = 0;
        for (int j = 1; j <= i; ++j) {
            if (i % j == 0) {
                cnt++;
            }
        }
        if (cnt == 8)
            ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3604