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

public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Scanner cin=new Scanner(System.in);
		for(int T=cin.nextInt();T--!=0;){
			int n=cin.nextInt();
			int[] a=new int[n];
			for(int i=0;i<n;i++){
				a[i]=cin.nextInt();
			}
			int max=0;
			int min=0;
			for(int i=0;i<n-1;i++){
				max=Math.max(max,a[i+1]-a[i]);
				min=Math.min(min,a[i+1]-a[i]);
			}
			
			System.out.println(max+" "+(-min));
		}
	}

}

Measured memory_bytes: 26800
n = int(input())
a = [int(i) for i in input().split()]

ans = 0
bfr = a[0]

for i in range(1,n):
    if bfr > a[i]:
        ans += bfr - a[i]
    else:
        bfr = a[i]
        
    #print(bfr,ans)
        
print(ans)

Measured memory_bytes: 32196
#include <bits/stdc++.h>
using namespace std;
using u64 = uint64_t;
constexpr const u64 MODNUM = 1000000007;

vector<int> prime_list() {
    bitset<1001> nps;
    nps[0] = nps[1] = true;
    for (int i = 2; i <= 1000; i++) {
        if (nps[i]) continue;
        for (int n = i*2; n <= 1000; n += i) {
            nps[n] = true;
        }
    }
    vector<int> primes;
    for (int i = 2; i <= 1000; i++) {
        if (!nps[i]) primes.push_back(i);
    }
    return primes;
}

void add_facts(int n, vector<int> const &primes, vector<u64> &facts) {
    for (int i = 0; n != 1; i++) {
        while (n % primes[i] == 0) {
            n /= primes[i];
            facts[i]++;
        }
    }
}

int main() {
    auto primes = prime_list();

    int N; cin >> N;
    vector<u64> facts(primes.size());
    for (int n = 1; n <= N; n++) {
        add_facts(n, primes, facts);
    }

    u64 num = 1;
    for (int i = 0; i < primes.size(); i++) {
        num *= (facts[i] + 1) % MODNUM;
        num %= MODNUM;
    }
    cout << num << endl;

    return 0;
}


Measured memory_bytes: 256
Inp1 = list(input().split())
Inp1.extend(input().replace(' ',''))
Inp1.extend(input().replace(' ',''))

Inp_dict = {'1':0,'2':0,'3':0,'4':0}
for i in Inp1:
	Inp_dict[i] +=1

ans = list()
for k in Inp_dict.keys():
	if Inp_dict[k] == 2 : ans.extend(k)

if len(ans) == 2: print('YES')
else: print('NO') 

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define Elhabashy ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
void input()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
#endif
}
const int N=23,mod=1e9+7;
typedef long long ll;
int n ,arr[N][N],dp[N][1<<N];
int solve(int i=0,int msk=0){
    if(i==n)return 1;
    int &ret=dp[i][msk];
    if(~ret)return ret;
    ret=0;
    for(int j=0;j<n;j++){
        if(arr[i][j]==1 && !((1<<j)&msk)){
            ret+=solve(i+1,msk|(1<<j));
            ret%=mod;
        }

    }
    return ret;
}
int main()
{
    Elhabashy
    input();
    cin>>n;
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++)cin>>arr[i][j];
    }
    memset(dp,-1,sizeof dp);
    cout<<solve()%mod<<endl;
}


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

#pragma GCC optimize "O3"
#define rep(i,a,n) for(long long i=a; i<n; i++)
typedef long long ll;
typedef pair<int,int> P;
const ll MOD = (int)1e9+7;
const ll INF = MOD*MOD;
const double EPS = 1e-9;
const ll powll = 1LL<<1;

/*
while(!frag && cin >> a >>b, a|b)
*/

int main(void){
    int a; cin >> a;
    int b = 0;
    rep(i,0,3){
        b += pow(a,i+1);
    }
    cout << b << "\n";
}

Measured memory_bytes: 4056
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
using namespace std;
typedef long long ll;
#define rep(i,a,n)	for(int i=a;i<n;i++)
#define rrep(i,a,n) for(int i=(a-1);i>=n;i--)
 
ll gcd(ll a,ll b){
	if(b==0)return a;
	return gcd(b,a%b);
}
ll lcm(ll a,ll b){
	ll g=gcd(a,b);
	return a/g*b;
}
int main(){
	ll n,a,b;
	cin>>n>>a>>b;
	if((b-a)%2==0)cout<<"Alice"<<endl;
	else cout<<"Borys"<<endl;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline
N,M,L = map(int, input().split())
INF = float("inf")
dist1 = [[INF]*N for i in range(N)]
dist2 = [[INF]*N for i in range(N)]

for i in range(M):
  A,B,C = map(int, input().split())
  A -= 1
  B -= 1
  dist1[A][B] = C
  dist1[B][A] = C

for i in range(N):
  dist1[i][i] = 0
  dist2[i][i] = 0
  
for k in range(N):
  for i in range(N):
    for j in range(N):
      d = dist1[i][k]+dist1[k][j]
      if dist1[i][j] <= d:
        continue
      dist1[i][j] = d
for i in range(N):
  for j in range(N):
    if dist1[i][j] > L or i==j:
      continue
    dist2[i][j] = 1
  
for k in range(N):
  for i in range(N):
    for j in range(N):
      d = dist2[i][k]+dist2[k][j]
      if dist2[i][j] <= d:
        continue
      dist2[i][j] = d
Q = int(input())
for i in range(Q):
  s,t = map(int, input().split())
  print(dist2[s-1][t-1]-1 if dist2[s-1][t-1]<=L else -1)

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

using namespace std;

#define IOS ios::sync_with_stdio(0);cin.tie(0);

int main(){
	IOS;
	int n;
	while(cin>>n){
		if(n < 3){
			cout<<"0"<<endl;
		}
		else{
			cout<<n/3<<endl;
		}
	}
	return 0;
}

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

int main(){
	int n; cin >> n;
	int m; cin >> m;
	int matlix[n][m];
	int vec[m][1];
	int result[n][1];

	for(int i=0;i<n;i++){
		for(int j=0;j<m;j++){
			cin >> matlix[i][j];
		}
		result[i][0]=0;
	}
	for(int i=0;i<m;i++){
		cin >> vec[i][0];
	}
	for(int i=0;i<n;i++){
		for(int j=0;j<m;j++){
			result[i][0] = result[i][0] + (matlix[i][j] * vec[j][0]);
		}
		cout << result[i][0] << endl;
	}
	return 0;
}

Measured memory_bytes: 3124
#pragma GCC optimize("Ofast") 
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define mp make_pair
#define all(a) a.begin(),a.end()
#define lb lower_bound
#define ub upper_bound
#define owo ios_base::sync_with_stdio(0);cin.tie(0);
#define MOD (ll)(1e6+3)
#define INF (ll)(1e18)
#define debug(...) fprintf(stderr, __VA_ARGS__),fflush(stderr)
#define time__(d) for(long blockTime = 0; (blockTime == 0 ? (blockTime=clock()) != 0 : false);\
debug("%s time : %.4fs\n", d, (double)(clock() - blockTime) / CLOCKS_PER_SEC))
typedef long long int ll;
typedef long double ld;
typedef pair<ll,ll> PII;
typedef pair<int,int> pii;
typedef vector<vector<int>> vii;
typedef vector<vector<ll>> VII;
int main()
{
	int n;
	cin>>n;
	vii dp(n+1,vector<int>(2));
	vector<int>a(n+1),b(n+1);
	for(int i=1;i<=n;i++)cin>>a[i];
	for(int i=1;i<=n;i++)cin>>b[i];
	for(int i=1;i<=n;i++)dp[i][0] = dp[i-1][0]+a[i];
	for(int i=1;i<=n;i++)dp[i][1] = max(dp[i-1][1],dp[i][0])+b[i];
	cout<<dp[n][1];
}


Measured memory_bytes: 3612
#include<iostream>
using namespace std;
int keta(long);
long nineline(int);
long kinpen(long);
long goukei(long);
long mypow(long, int);
int main() {
	long N;
	cin >> N;
	N = kinpen(N);
	N = goukei(N);
	cout << N;
return 0;
}
long goukei(long a) {
	long ans=0;
	int k = keta(a);
	for (int i=0; i <= k; i++) {
		ans += a % 10;
		a /= 10;
	}
	return ans;
}

int keta(long x) {
	long x1=x;
	int ans=0;
	while (1) {
		x1 /= 10;
		if (x1 == 0) {
			break;
		}
		else {
			ans++;
		}
	}
	return ans;
}
long kinpen(long a) {
	int t = keta(a);
	long tenx = mypow(10, t);
	int kami1 = a / tenx;
	if ((a%tenx) == nineline(t-1)) {
		return a;
	}
	else {
		return ((kami1-1)*tenx) + nineline(t - 1);
	}
}
long nineline(int a) {
	long ans=0;
	for (int i = 0; i <= a; i++) {
		ans += 9 * mypow(10, i);
	}
	return ans;
}
long mypow(long a, int b) {
	long ans=1;
	for (int i = 0; i < b; i++) {
		ans *= a;
	}
	return ans;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#pragma warning(disable : 4996)
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<unordered_map>
#include<unordered_set>
#include<time.h>
#include<random>
#include<array>


using namespace std;

#define REP(i, n) for(int i = 0;i < n;++i)
#define REPR(i, n) for(int i = n-1;i >= 0;--i)
#define FOR(i, m, n) for(int i = m;i < n;++i)
#define FORR(i, m, n) for(int i = m-1;i >= n;--i)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end())
#define ll long long
#define print(x) cout<<(x)<<'\n'
#define pe(x) cout<<(x)<<" "
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define lb(v,n) lower_bound(v.begin(), v.end(), (n))
#define ub(v,n) upper_bound(v.begin(), v.end(), (n))
#define int long long
//#define double long double
#define all(x) (x).begin(), (x).end()
#define print_space(v) REP(i,v.size())cout << v[i] << ((i == v.size() - 1) ? "\n" : " ")
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; }
typedef pair<int, int>P;
typedef array<int, 3> arr3;
std::random_device rd;
std::mt19937 mt(rd());
constexpr ll MOD = 998244353; constexpr int MAX = 2000020;
const double pi = acos(-1); constexpr double EPS = 1e-8;
constexpr ll INF = 1e18;


void solve() {
	int N; cin >> N;
	vector<int>L(N);
	int sum = 0, mx = 0;
	REP(i, N) {
		cin >> L[i];
		sum += L[i];
		chmax(mx,L[i]);
	}
	if (mx < sum - mx)print("Yes");
	else print("No");
}

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	//int q; cin >> q;
	//while (q--)
	solve();
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define ll long long
#define pb push_back
bool isPrime(ll n) 
{ 
    
    if (n <= 1)  return false; 
    if (n <= 3)  return true; 
   
    if (n%2 == 0 || n%3 == 0) return false; 
  
    for (ll i=5; i*i<=n; i=i+6) 
        if (n%i == 0 || n%(i+2) == 0) 
           return false; 
  
    return true; 
} 
ll minthis(ll a, ll b){
if(a < b){
return a;
}
return b;
}
ll maxthis(ll a, ll b){
if(a > b){
return a;
}
return b;
}
int gcd(int a, int b){
    if( a<0 ) a = -a;
    if( b<0 ) b = -b;
    while( b!=0 ){
        a %= b;
        if( a==0 ) return b;
        b %= a;
    }
    return a;
}
 
int findLargestDivisor(int n) 
{ 
	int max = 1;
    for (int i = 2; i < n; i++) {        
        if(n %(i) == 0) { 
            max = i;
        } 
    }
    return max;     
} 
	 
 
ll power(ll x, ll y)  
{  
    ll temp;  
    if(y == 0)  
        return 1;  
    temp = power(x, y / 2);  
    if (y % 2 == 0)  
        return temp * temp;  
    else
    {  
        if(y > 0)  
            return x * temp * temp;  
        else
            return (temp * temp) / x;  
    }  
} 
bool sortbysec(const pair<int, int>& a, 
               const pair<int, int>& b) 
{ 
    return (a.second < b.second); 
} 
map<int,int> mp;
/*
 void printDivisors(int n) 
{ 
    // Note that this loop runs till square root 
    for (int i=1; i<=sqrt(n); i++) 
    { 
        if (n%i == 0) 
        { 
            // If divisors are equal, print only one 
            if (n/i == i) 
                printf("%d ", i); 
  
            else // Otherwise print both 
                printf("%d %d ", i, n/i); 
        } 
    } 
} 
 */
bool check(int n){
	if(n == 1 && mp[1] > 1){
		return false;
	}
	else if(n == 1){
		return true;
	}
	 for (int i=1; i<=sqrt(n); i++){ 
         if (n%i == 0){ 
            if (n/i == i){ 
                if(mp[i]){
		       //cout << 1 << " " << mp[i] << " " << i << " " << i << "\n";	
		return false;}
	    }  
            else if((mp[i] || mp[n/i]) && n/i == n && (mp[n/i] > 1 || mp[i])){
                //cout << 2 << " " << mp[i] << " " << mp[n/i] << " " << i << " " << n/i << "\n"; 
		    return false;
	    }	
		else if((mp[i] || mp[n/i]) && n/i != n){
			
			//cout << 3 << " " << mp[i] << " " << mp[n/i] << " " << i << " " << n/i << "\n";
			return false;
		}
        } 
    }
	return true; 

}
void solve(){
	int n;
	cin >> n;
	vector<int> v;
	int ans = 0;
	for(int i = 0;  i < n ; i++){
		int x;
		cin >> x;
		mp[x]++;
		v.pb(x);
	}
	map<int,int>:: iterator it;
	for(auto x : v){
		if(check(x)) ans++;
	}
	cout << ans << "\n";
	
	
}

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




Measured memory_bytes: 32824
# -*- coding: utf-8 -*-
from math import sqrt
from bisect import bisect

def inpl(): return tuple(map(int, input().split()))

def primes(N):
    P = [2]
    searched = [False]*(N+1)
    for i in range(3, N+1, 2):
        if searched[i]:
            continue
        P.append(i)
        for j in range(i, N+1, i):
            searched[j] = True
    return P

P = primes(10**6)

try:
    while True:
        print(bisect(P, int(input())))
except:
  pass


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

#define fi first
#define se second
#define sc scanf
#define pr printf
#define pb push_back
#define ll long long
#define fin(s) freopen( s, "r", stdin );
#define fout(s) freopen( s, "w", stdout );

const long long N = 100100;
const long long MX = sqrt(N);
const long long H = 17;
const long long MAGIC = 1000;
const long long mod = 1e9 + 7;

using namespace std;

int n;
int m;
int c[N];

void solve()
{
        cin >> n >> m;
        for(int i = 1; i <= m; i++){
                int a, b;
                cin >> a >> b;
                c[a]++; c[b]++;
        }
        for(int i = 1; i <= n; i++){
                if(c[i] % 2){
                        cout << "NO" << "\n";
                        return;
                }
        }
        cout << "YES" << "\n";
}

bool mtest = false; int main()
{
        //fin("input.txt");
        //fout("output.txt");
        //fin("landscape.in");
        //fout("landscape.out");
        ios_base::sync_with_stdio(0);
        int TE = 1;
        if(mtest)
                cin >> TE;
        while(TE--)
                solve();
        return 0;
}


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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> Pll;
typedef pair<int, int> Pii;

const long double EPS = 10e-10;

int main(){
    pair<double, double> p[3];
    for(int i=0;i<3;i++){
        cin >> p[i].first >> p[i].second;
    }

    // もっとも長い辺
    double e[3];
    double longest_edge = 0.0;
    for(int i=0;i<3;i++){
        int j = (i+1)%3;
        pair<double, double> diff;
        diff.first = p[j].first - p[i].first;
        diff.second = p[j].second - p[i].second;
        e[i] = sqrt(
            diff.first*diff.first + diff.second*diff.second
        );
        longest_edge = max(longest_edge, e[i]);
    }

    // 面積
    double s = (e[0]+e[1]+e[2])/2;
    double area = sqrt(s * (s-e[0]) * (s-e[1]) * (s-e[2]));

    // 内接円の半径
    double r = area / s;

    double ok = EPS, ng = 1000.0;
    for(int i=0;i<int(1e6);i++){
        double mid = (ok+ng) / 2.0;

        if(2.0 * mid * r <= longest_edge * (r-mid)){
            ok = mid;
        }else{
            ng = mid;
        }
    }

    printf("%.10lf\n", ok);
}


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();
        int[] a = new int[100000];
        for (int x=1;x<100;x++){
            for (int y=1;y<100;y++){
                for (int z=1;z<100;z++){
                    a[x*x+y*y+z*z+x*y+y*z+z*x]++;
                }
            }
        }
        for (int i=1;i<=n;i++)System.out.println(a[i]);
    }
}


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

using namespace std;

long long mod_pow(long long a,long long b,long long mod){
	long long res=1,c=a;
	while(b){
		if(b&1) res=res*c%mod;
		c=c*c%mod;
		b/=2;
	}
	return res;
}
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	int n;
	cin >> n;
	vector<long long> a(n);
	for(int i=0;i<n;i++) cin >> a[i];
	long long mod=1000000007;
	sort(a.begin(),a.end());
	long long res=0;
	for(int i=0;i<n;i++){
		//1+binom(n-1,1)*2+binom(n-1,2)*3+
		long long coef=mod_pow(2,n-i-1,mod)*(n-i+1)%mod*((mod+1)/2)%mod;
		coef=coef*mod_pow(2,i,mod)%mod;
		res=(res+coef*a[i]%mod)%mod;
	}
	res=res*mod_pow(2,n,mod)%mod;
	cout << res << "\n";
}

Measured memory_bytes: 1792
#include <iostream>
#include <string.h>
#include <vector>
#include <map>
#include <algorithm>
#define rep(i,N) for(int i=0;i<((int)N);i++)
#define mod 1000000007
typedef long long ll;
using namespace std;
int main(void){
    int N;
    cin>>N;
    double num=N;
    double a[N];
    for(int i=0;i<N;i++){
        cin>>a[i];
    }
    double sum=0;
    for(int i=0;i<N;i++){
      sum+=a[i]; 
    }
    sum=sum/num;
    double min=10000000; double ans=-1;
    for(int i=0;i<N;i++){double gap;
      if(a[i]>sum) {gap=a[i]-sum ;}
      else {gap=sum-a[i];}
      if(gap<min){ min=gap; ans=i;}
    }
    cout<<ans;
    return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#pragma GCC optimize ("unroll-loops")
#include<bits/stdc++.h>
using namespace std;

void test_case(){

}

int main(){
	ios_base::sync_with_stdio(false); cin.tie(nullptr);
	
	int a;
	cin >> a;
	cout << a + (a*a) + (a*a*a) << endl;
	
	return 0;
}


Measured memory_bytes: 3536
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.nextLine();
		if (!s.contains("a")) {
			System.out.println("a");
		} else if (!s.contains("b")) {
			System.out.println("b");
		} else if (!s.contains("c")) {
			System.out.println("c");
		} else if (!s.contains("d")) {
			System.out.println("d");
		} else if (!s.contains("e")) {
			System.out.println("e");
		} else if (!s.contains("f")) {
			System.out.println("f");
		} else if (!s.contains("g")) {
			System.out.println("g");
		} else if (!s.contains("h")) {
			System.out.println("h");
		} else if (!s.contains("i")) {
			System.out.println("i");
		} else if (!s.contains("j")) {
			System.out.println("j");
		} else if (!s.contains("k")) {
			System.out.println("k");
		} else if (!s.contains("l")) {
			System.out.println("l");
		} else if (!s.contains("m")) {
			System.out.println("m");
		} else if (!s.contains("n")) {
			System.out.println("n");
		} else if (!s.contains("o")) {
			System.out.println("o");
		} else if (!s.contains("p")) {
			System.out.println("p");
		} else if (!s.contains("q")) {
			System.out.println("q");
		} else if (!s.contains("r")) {
			System.out.println("r");
		} else if (!s.contains("s")) {
			System.out.println("s");
		} else if (!s.contains("t")) {
			System.out.println("t");
		} else if (!s.contains("u")) {
			System.out.println("u");
		} else if (!s.contains("v")) {
			System.out.println("v");
		} else if (!s.contains("w")) {
			System.out.println("w");
		} else if (!s.contains("x")) {
			System.out.println("x");
		} else if (!s.contains("y")) {
			System.out.println("y");
		} else if (!s.contains("z")) {
			System.out.println("z");
		} else {
			System.out.println("None");
		}

	}
}

Measured memory_bytes: 25844
//set many funcs
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#define inf 1145141919
#define llinf 1145141919810364364
#define mod 1000000007

int max(int a,int b){if(a>b){return a;}return b;}
int min(int a,int b){if(a<b){return a;}return b;}
int zt(int a,int b){return max(a,b)-min(a,b);}
int round(int a,int b){if((a%b)*2 >= b){return (a/b)+1;}return a/b;}
int ceil(int a,int b){if(a%b==0){return a/b;}return (a/b)+1;}
int gcd(int a,int b){int c;while(b!=0){c=a%b;a=b;b=c;}return a;}
int lcm(int a,int b){int c=gcd(a,b);a/=c;return a*b;}
int nCr(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
int fact(int a){int i,r=1;for(i=1;i<=a;i++){r*=i;}return r;}
int pow(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}
long long llmax(long long a,long long b){if(a>b){return a;}return b;}
long long llmin(long long a,long long b){if(a<b){return a;}return b;}
long long llround(long long a,long long b){if((a%b)*2 >= b){return (a/b)+1;}return a/b;}
long long llceil(long long a,long long b){if(a%b==0){return a/b;}return (a/b)+1;}
long long llgcd(long long a,long long b){long long c;while(b!=0){c=a%b;a=b;b=c;}return a;}
long long lllcm(long long a,long long b){long long c=llgcd(a,b);a/=c;return a*b;}
long long llnCr(long long a,long long b){long long i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
long long llfact(long long a){long long i,r=1;for(i=1;i<=a;i++){r*=i;}return r;}
long long llpow(long long a,long long b){long long i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}
double dbmax(double a,double b){if(a>b){return a;}return b;}
double dbmin(double a,double b){if(a<b){return a;}return b;}
int sortfncsj(const void *a,const void *b){if(*(int *)a>*(int *)b){return 1;}if(*(int *)a==*(int *)b){return 0;}return -1;}
int sortfnckj(const void *a,const void *b){if(*(int *)a<*(int *)b){return 1;}if(*(int *)a==*(int *)b){return 0;}return -1;}
int llsortfncsj(const void *a,const void *b){if(*(long long *)a>*(long long *)b){return 1;}if(*(long long *)a==*(long long *)b){return 0;}return -1;}
int llsortfnckj(const void *a,const void *b){if(*(long long *)a<*(long long *)b){return 1;}if(*(long long *)a==*(long long *)b){return 0;}return -1;}
int dbsortfncsj(const void *a,const void *b){if(*(double *)a>*(double *)b){return 1;}if(*(double *)a==*(double *)b){return 0;}return -1;}
int dbsortfnckj(const void *a,const void *b){if(*(double *)a<*(double *)b){return 1;}if(*(double *)a==*(double *)b){return 0;}return -1;}

int main(void){
    int dp[512][512],i,j,k,n,ma,mb,ka,kb,a,b,c,r;
    for(i=0;i<=400;i++){
        for(j=0;j<=400;j++){dp[i][j]=inf;}
    }
    dp[0][0]=0;
    scanf("%d%d%d",&n,&ma,&mb);
    for(i=1;i<=n;i++){
        scanf("%d%d%d",&a,&b,&c);
        for(j=400;j>=0;j--){
            for(k=400;k>=0;k--){
                dp[j+a][k+b]=min(dp[j+a][k+b],dp[j][k]+c);
            }
        }
    }
    ka=0;kb=0;r=inf;
    while(1){
        ka+=ma;kb+=mb;
        if(ka>400 || kb>400){break;}
        r=min(r,dp[ka][kb]);
    }
    if(r==inf){printf("-1\n");}else{printf("%d\n",r);}
    return 0;
}

Measured memory_bytes: 1152
#include<iostream>
using namespace std;
int k, s, cnt = 0;
int main()
{
	cin >> k >> s;
	for (int x = 0; x <= k; x++)
	{
		for (int y = 0; y <= k; y++)
		{
			if (s - x - y >= 0 && s - x - y <= k) cnt++;
		}
	}
	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>

int main(){
    int a, b;
    char op;
    while(true){
        scanf("%d %c %d", &a, &op, &b);
        if(op == '?') break;
        if(op == '+'){
            printf("%d\n", a+b);
        } else if(op == '-'){
            printf("%d\n", a-b);
        } else if(op == '*') {
            printf("%d\n", a*b);
        } else if(op == '/') {
            printf("%d\n", a / b);
        }
    }
    return 0;
}


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

int main() {
    int n, m;
    cin >> n >> m;
    vector<vector<int>> button(m, vector<int>(0));
    for (int i = 0; i < m; ++i) {
        int k;
        cin >> k;
        for (int j = 0; j < k; ++j) {
            int x;
            cin >> x;
            --x;
            button[i].push_back(x);
        }
    }
    vector<int> p(m);
    for (int l = 0; l < m; ++l) cin >> p[l];
    int ans = 0;
    for (int i = 0; i < (1 << n); ++i) {
        bitset<10> bs(i);
        bool flag = false;
        for (int j = 0; j < m; ++j) {
            int sum = 0;
            for (int k : button[j]) sum += bs.test(k);
            if (sum % 2 != p[j]) {
                flag = true;
                break;
            }
        }
        if (!flag) ans++;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
	int hyo[1000][1000] = { 0 };
	int r, c;
	cin >> r;
	cin >> c;
	for (int i = 0; i < r; i++){
		for (int i2 = 0; i2 < c; i2++){
			cin >> hyo[i][i2];
		}
	}
	for (int i = 0; i < r; i++){
		for (int i2 = 0; i2 < c; i2++){
			hyo[i][c] += hyo[i][i2];
		}
	}
	for (int i = 0; i < c; i++){
		for (int i2 = 0; i2 < r; i2++){
			hyo[r][i] += hyo[i2][i];
		}
	}
	for (int i = 0; i < r; i++){
		hyo[r][c] += hyo[i][c];
	}
	for (int i = 0; i < r + 1; i++){
		for (int i2 = 0; i2 < c; i2++){
			cout << hyo[i][i2] << " ";
		}
		cout << hyo[i][c] << endl;
	}
	return 0;
}

Measured memory_bytes: 7004
import java.util.*;
class Main {
	public class T{
		int a,b,c;
		T(int a,int b,int c){
			this.a = a;
			this.b = b;
			this.c = c;
		}
	}
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N,M;
		M = sc.nextInt();
		N = sc.nextInt();
		int[][][] need = new int[M][N][2];
		for(int i = 0 ; i < M ; i++){
			for(int j = 0 ; j < N ; j++){
				need[i][j][0] = 0;
				need[i][j][1] = (int)1e9;
			}
		}

		for(int i = 0 ; i < M ; i++){
			int K = sc.nextInt();
			for(int j = 0 ; j < K ; j++){
				int a = sc.nextInt() - 1;
				String b = sc.next();
				int c = sc.nextInt();
				if( b.equals(">=") ){
					need[i][a][0] = Math.max(need[i][a][0],c);
				}else{
					need[i][a][1] = Math.min(need[i][a][1],c);
				}
			}
			// mujun
			for(int j = 0 ; j < N ; j++){
				if( need[i][j][0] > need[i][j][1] ){
					System.out.println("No");
					return;
				}
			}
		}
		//if(1>0)return;
		int[][] wf = new int[M][M];

		for(int i = 0 ; i < M ; i++){
			for(int j = 0 ; j < M ; j++){
				for(int k = 0 ; k < N ; k++){
					if( need[i][k][1] < need[j][k][0] ){
						wf[i][j] = 1;
					}
				}
			}
		}
		for(int i = 0 ; i < M ; i++){
			for(int j = 0 ; j < M ; j++ ){
				for(int k = 0 ; k < M ; k++){
					wf[j][k] |= wf[j][i] & wf[i][k];
				}
			}
		}
		for(int i = 0 ; i < M ; i++)
			if( wf[i][i] > 0 ){
				System.out.println("No");
				return;
			}
		System.out.println("Yes");
		return;
	}
}

Measured memory_bytes: 58540
from sys import stderr, setrecursionlimit
from functools import reduce
from operator import add
from collections import Counter
setrecursionlimit(2147483647)
def f(n=1):
    if n == 1:
        return [int(j) for j in input().split()]
    res = []
    for i in range(n):
        res.append([int(j) for j in input().split()])
    return res
def debug(*x, sep=" ", end="\n"):
    for item in x:
        stderr.write(str(item))
        stderr.write(sep)
    stderr.write(end)

n, k = f()
a = Counter(f())

print(n - sum(map(lambda x:x[1], a.most_common(k))))


Measured memory_bytes: 32496
#include<stdio.h>

int main(void){
int H,W;
int i, j;
    while(1){
    scanf("%d %d",&H,&W);
    if(H==0&&W==0){
        break;
    }
    for ( i = 0; i < H; i++ ){
        for ( j = 0; j < W; j++ ){
            if(i>0&&i<H-1){
                if(j>0&&j<W-1){
                    printf(".");
                }
                else{
                    printf("#");
                }
            }
            else {
            printf("#");
            }
        }
        printf("\n");
    }
    printf("\n");
    }


    return 0;
}

Measured memory_bytes: 572
#include <queue>
#include <cstdio>
#include <vector>
using namespace std;

int main(){
	int n;
	scanf("%d", &n);
	vector<vector<short>> dist(n, vector<short>(n));
	for(int i = 0; i < n; i++){
		for(int j = 0; j < n; j++){
			scanf("%hd", &dist[i][j]);
			dist[i][j] = dist[i][j] < 0 ? 10000 : dist[i][j];
		}
	}
	
	vector<bool> visited(n, false);
	priority_queue<pair<short,int>, vector<pair<short,int>>, greater<pair<short,int>>> q;
	q.push(make_pair(0, 0));
	
	int ans = 0;
	while(q.size()){
		pair<short,int> edge = q.top();
		q.pop();
		if(visited[edge.second]) continue;
		ans += edge.first;
		visited[edge.second] = true;
		for(int i = 0; i < n; i++){
			if(!visited[i]){
				q.push(make_pair(dist[i][edge.second], i));
			}
		}
	}
	
	printf("%d\n", ans);
}

Measured memory_bytes: 2864
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin(),(x).end()
const int mod=1000000007,MAX=100001,INF=1<<30;

int main(){
   
    int N;cin>>N;
    int j=-1;
    for(int i=1;i<=1000;i++){
        if(i*(i+1)/2==N) j=i;
    }
    
    if(j==-1) cout<<"No"<<endl;
    else{
        cout<<"Yes"<<endl;
        cout<<j+1<<endl;
        vector<int> S(j+1,0);
        S[j-1]=1;
        S[j]=1;
        vector<int> T[j+1];
        int now=1;
        
        do{
            for(int i=0;i<j+1;i++){
                if(S[i]) T[i].push_back(now);
            }
            now++;
        }while(next_permutation(all(S)));
        
        for(int i=0;i<j+1;i++){
            cout<<j;
            for(int k=0;k<j;k++){
                cout<<" "<<T[i][k];
            }
            cout<<endl;
        }
    }
}


Measured memory_bytes: 2304
package main

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

func main() {
	sc := bufio.NewScanner(os.Stdin)
	buf := make([]byte, 100)
	sc.Buffer(buf, 1000000)

	sc.Scan()
	length, _ := strconv.Atoi(sc.Text())

	sc.Scan()
	tmp := strings.Split(sc.Text(), " ")
	inputs := make([]int, length)
	for i, v := range tmp {
		inputs[i], _ = strconv.Atoi(v)
	}

	sc.Scan()
	for sc.Scan() {
		q, _ := strconv.Atoi(sc.Text())
		if inputs[len(inputs)-1] < q {
			fmt.Println(length)
			continue
		} else if inputs[0] >= q {
			fmt.Println(0)
			continue
		}
		low := 0
		high := length - 1
		target := 0
		for {
			mid := (low + high) / 2
			midValue := inputs[mid]
			// fmt.Println(q, midValue)
			if q > midValue {
				low = mid + 1
			} else if q < midValue {
				high = mid - 1
			} else {
				target = mid
				break
			}

			if low > high {
				target = high
				break
			}

		}

		for {
			if inputs[target] < q {
				break
			}
			target--
		}

		fmt.Println(target + 1)
	}
}



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

using namespace std;
#define DBG(x)                         \
    (void)(cout << "L" << __LINE__     \
                << ": " << #x << " = " \
                << (x) << '\n')
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
typedef long long ll;
using pii = pair<int, int>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const long double PI = (acos(-1));
const long double EPS = 0.0000000001;
const int INF = 0x3f3f3f3f;
const int maxn = 110000;
int main()
{
    //检查有没有特判0,有没有越界限.
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << setiosflags(ios::fixed) << setprecision(12);
    int n;
    cin >> n;
    vector<int> L(n);
    for (int i = 0; i < n; i++)
    {
        cin >> L[i];
    }
    sort(L.begin(), L.end());
    int ans = 0;
    for (int i = 0; i < n; i++)
    {
        for (int j = i + 1; j < n; j++)
        {
            ans += Lower_bound(L, L[i] + L[j]) - (j + 1);
        }
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 3616
#include<iostream>
#include<math.h>
using namespace std;

int main(){
	
	int a,b,c;
	char d;
	int x=0,y=0;
	double h_a,h_b;
	
	while(1){
		cin >> a;
		if(cin.eof()) break;
		cin >> d >> b;
		cin >> d >> c;
		
		if( c*c == a*a + b*b ) x++;
		else if( a == b ) y++;
		else{
			h_a = sqrt ( a*a - (c*(a+b)/a)*(c*(a+b)/a) ) ;
			h_b = sqrt ( b*b - (c*(a+b)/b)*(c*(a+b)/b) ) ;
			if( h_a == h_b ) y++;
		}
	}
	
	cout << x << endl ;
	cout << y << endl ;
	
return 0;
}

Measured memory_bytes: 1168
#include <stdio.h>


int main(void){
	int S,h=0,m=0,s=0;
	
	scanf("%d",&S);
	
	while(S >= 3600){
		S -= 3600;
		h++;
	}
	
	while(S >= 60){
			S -= 60;
			m++;
		}
	
	s = S;
	
	printf("%d:%d:%d\n",h,m,s);
	
	return 0;
	
}

Measured memory_bytes: 592
i,j,k,s;main(x){char a[99],b[99];for(scanf("%s%d",a,&x);x--;){scanf("%s",b);for(i=0;i<10;i++){if(a[0]==b[i]){for(k=0,j=i;1;){j++;k++;j=j>9?0:j;if(a[k]=='\0'){s++;i=11;break;}if(a[k]!=b[j])break;}}}}printf("%d\n",s);exit(0);}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
const double eps=1e-9;
struct dot{
	double x,y;
	double len(){return sqrt(x*x+y*y);}
	dot(double a=0.0,double b=0.0){x=a,y=b;}
	dot operator +(const dot&b)const {return dot(x+b.x,y+b.y);}
	dot operator -(const dot&b)const {return dot(x-b.x,y-b.y);}
	dot operator *(const double&z)const {return dot(x*z,y*z);}
	bool operator <(const dot&b)const {return (x<b.x)||(x==b.x&&y<b.y);}
	void read(){scanf("%lf%lf",&x,&y);} 
};
struct line{
	dot x1,x2;
	void read(){x1.read();x2.read();};
	dot getdot(){return x2-x1;}
};
double chaji(dot x,dot y){
	return x.x*y.y-x.y*y.x;
}
double neiji(dot x,dot y){
	return x.x*y.x+x.y*y.y;
}
double cos(dot x,dot y){
	if (!x.len()||!y.len())return 0;
	return neiji(x,y)/x.len()/y.len();
}
dot Projection(dot x,line y){//求x关于直线y的投影点（垂足） 
	y.x2=y.x2-y.x1;
	x=x-y.x1;
	double len=cos(x,y.x2)*x.len()/y.x2.len();
	y.x2=y.x2*len;
	return y.x2+y.x1;
}
dot Reflection(dot x,line y){//求x关于直线y的对称点 
	dot z=Projection(x,y);
	return z*2-x;
}
int Counter_Clockwise(dot x,line y){//求两个向量的五种关系 
	x=x-y.x1;y.x2=y.x2-y.x1;
	if (chaji(y.x2,x)!=0){
		if (chaji(y.x2,x)>0)return 1;
		return 2;
	} 
	if (fabs(cos(x,y.x2)+1)<eps)return 3;
	if (x.len()>y.x2.len())return 4;
	return 5;
} 
int Parallel_Orthogonal(line x,line y){//求两个直线是垂直还是平行还是其他 
	dot a=x.getdot(),b=y.getdot();
	if (chaji(a,b)==0)return 2;
	if (neiji(a,b)==0)return 1;
	return 0;
}
int main(){
	int T;
	scanf("%d",&T);
	while (T--){
		line x,y;
		x.read();y.read();
		printf("%d\n",Parallel_Orthogonal(x,y));
	}
	return 0;
}



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

#define ALL(v) v.begin(), v.end()
#define V vector
#define P pair
#define ld long double
#define ll long long

const int MOD =  1000000007;
const int IINF = INT_MAX;
const ll INF = 1LL << 60;


int main() {
    // 複雑に考えすぎた
    // int k, n; cin >> k >> n;
    // V<int> a(n * 2);
    // for(int i = 0; i < n; i++) cin >> a[i];
    // for(int i = 0; i < n; i++){
    //     a[i + n] = a[i] + k;
    // }
    // int ans = IINF;
    // for(int i = 0; i < n; i++){
    //     ans = min(ans, abs(a[i + n - 1] - a[i]));
    // }
    // cout << ans << endl;

    int k, n; cin >> k >> n;
    V<int> a(n + 1);
    for(int i = 0; i < n; i++) cin >> a[i];
    a[n] = k + a[0];

    int maxi = 0;
    for(int i = 0; i < n; i++){
        maxi = max(maxi, a[i + 1] - a[i]);
    }
    cout << k - maxi << endl;

    return 0;
}


Measured memory_bytes: 4008
n, k = map(int, input().split())
p = list(map(int, input().split()))

ansl = 0
ansr = k-1
ans = 0
tmp = sum(p[:k])
# print(tmp)
for i in range(1,n - k+1):
    tmp = tmp - p[i-1] + p[i + k-1]
    # print(i,i+k-1,tmp)
    if tmp > ans:
        ansl = i
        ansr = i + k - 1
        ans = tmp
# print(ansl, ansr)
ans2 = 0
for i in range(ansl, ansr + 1):
    ans2 += (p[i] + 1) / 2
print(ans2)


Measured memory_bytes: 71792
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n ; ++i)
#define REP(i,a,b) for(int i=a; i<b; ++i)
typedef long long ll;
//プロトタイプ宣言
int gcd(int , int);
int GCD(int , int);


int main(){
    ll n,ans=0;
    cin >> n;
    bool flag = false;
    for(ll i=1;i*i<=n;i++){
        if(n%i==0) ans = max(ans , i);
    }
    cout << ans + (n/ans) - 2 << endl;
}








































//以下、ライブラリ
//ユークリッドの互除法
int gcd(int a, int b){
    while(1){
        int remain = a % b;
        if(remain == 0) return b;
        else{
            a = b;
            b = remain;
        }
    }
}

int GCD(int a, int b) {
  return b ? GCD(b, a%b) : a;
}

Measured memory_bytes: 384
n, m = gets.split.map(&:to_i)
as = readlines.map(&:to_i)
array = Array.new(n+1) { nil }
as.each do |a|
  array[a] = 0
end
array[0] = 1
array[1] = 1 if array[1].nil?

array.each_with_index do |a, i|
  if a.nil?
    array[i] = (array[i - 2] + array[i - 1]) % 1000000007
  end
end

# p array
puts array.last

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

using namespace std;

#define MAX 24

int N,x[MAX],y[MAX],r[MAX],c[MAX];

double dist(int a,int b){
    return sqrt((x[a]-x[b])*(x[a]-x[b]) + (y[a]-y[b])*(y[a]-y[b]));
}

bool check(int a,int b){
    double d = dist(a,b);
    return ((abs(r[b]-r[a]) < d && d < (r[b]+r[a]))
            || d <= abs(r[b]-r[a]));
}

int main(){
    while(cin >> N, N){
        for(int i = 0 ; i < N ; i++){
            cin >> x[i] >> y[i] >> r[i] >> c[i];
        }
        int bit[MAX] = {0};
        for(int i = 0 ; i < N ; i++){
            for(int j = 0 ; j < i ; j++){
                if(check(i,j)) bit[i] |= (1<<j);
            }
        }
        vector<bool> dp(1<<N,0);
        dp[(1<<N)-1] = 1;
        int res = 0;
        for(int i = (1<<N)-1 ; i >= 0 ; i--){
            if(dp[i] == 0) continue;
            if(N%2 == 0 && __builtin_popcount(i) % 2 == 1) continue;
            if(N%2 == 1 && __builtin_popcount(i) % 2 == 0) continue;
            for(int j = 0 ; j < N ; j++){
                for(int k = j+1 ; k < N ; k++){
                    if(c[j] != c[k]) continue;
                    if(__builtin_popcount(i&bit[j]) > 0) continue;
                    if(__builtin_popcount(i&bit[k]) > 0) continue;
                    int S = i & ~((1<<j) | (1<<k));
                    dp[S] = 1;
                    res = max(res,N-__builtin_popcount(i));
                }
            }
        }
        cout << res << endl;
    }
    return 0;
}

Measured memory_bytes: 3252
#include <cstdio>
#include <iostream>

using namespace std;

const int MAX_N = 1000000;

int N;

int len;
bool isPrime[MAX_N];
int num[MAX_N];				//the number of prime less than i

void sieve(){
	//init
	fill(isPrime, isPrime + MAX_N, true);
	isPrime[0] = isPrime[1] = false;
	num[0] = num[1] = 0;
	for(int i = 2; i < MAX_N; i ++){
		if(isPrime[i]){
			num[i] = num[i - 1] + 1;
			for(int j = 2 * i; j < MAX_N; j += i)
				isPrime[j] = false;
		}
		else{
			num[i] = num[i - 1];
		}
	}
}

int main(int argc, char const *argv[]){

	sieve();
	while(scanf("%d", &N) != EOF){
		printf("%d\n", num[N]);
	}

	return 0;
}

Measured memory_bytes: 6064
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.IntStream;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int a = scanner.nextInt();
        int b = scanner.nextInt();
        Set<Integer> primeNumberSet = primeNumberSet(Math.max(a, b));
        Map<Integer, Integer> divisorSetA = getDivisorList(a, primeNumberSet);
        Map<Integer, Integer> divisorSetB = getDivisorList(b, primeNumberSet);
        divisorSetB.keySet().forEach(k -> divisorSetA.put(k, Math.max(divisorSetB.get(k), divisorSetA.getOrDefault(k, 0))));
        List<Integer> list = divisorSetA.keySet().stream().map(k -> (int) Math.pow(k, divisorSetA.get(k))).collect(Collectors.toList());
        System.out.println(list.stream().mapToLong(m -> m).reduce(1, (m, n) -> m * n));
    }

    static Map<Integer, Integer> getDivisorList(int n, Set<Integer> primeNumberSet) {
        return primeNumberSet.stream().filter(f -> f <= n).filter(m -> n % m == 0).collect(Collectors.toMap(m -> m, m -> count(n, m)));
    }

    static Set<Integer> primeNumberSet(int n) {
        if (n < 2) return new HashSet<>();
        return IntStream.rangeClosed(2, n).filter(Main::isPrimeNumber).boxed().collect(Collectors.toSet());
    }

    static boolean isPrimeNumber(int n) {
        if (n == 2) return true;
        if (n % 2 == 0) return false;
        for (int i = 3; i <= Math.sqrt(n); i += 2) {
            if (n % i == 0) {
                return false;
            }
        }
        return true;
    }

    static int count(int m, int n) {
        int count = 0;
        while (m % n == 0) {
            m = m / n;
            count++;
        }
        return count;
    }
}


Measured memory_bytes: 29268
/* ex3_3
   kohei_suzuki */

#include <stdio.h>

int main(void){
    int n, m=9 ; //割られる整数nと割る整数m

    scanf("%d",&n); //nを入力

    int l = n / m; //nをmで割った整数l

    while(n % m != 0){ //9から順に1ずつ割っていき、割り切れるまで繰り返す
        m -= 1;
        l = n / m;
    }

    if(l < 10){ //割り切れてかつlが10より小さければyes
        printf("Yes\n");
    }else{ //それ以外ならno
        printf("No\n");
    }

    return 0;
}

Measured memory_bytes: 128
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int x=sc.nextInt();
		int k=x/500;
		int l=(x%500)/5;
		
		
		System.out.println(1000*k+5*l);
	}

}


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

#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i = 0; i < (n); ++i)

int f(int n){
	int sum=0;
	while(n>0){
		sum +=n%10;
		n/=10;
	}
	return sum;
}

int main() {
	int n,a,b;
	cin>>n>>a>>b;
	int ans=0;
	for(int i=1;i<=n;++i){
		int x = f(i);
		if(a<=x&&x<=b) ans+=i;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
#xy = [map(int, input().split()) for _ in range(5)]
#x, y = zip(*xy)

def main():
    nd = list(map(int, input().split()))
    ans = 0
    for i in range(nd[0]):
        xy = list(map(int, input().split()))
        if xy[0] * xy[0] + xy[1] * xy[1] <= nd[1] * nd[1]:
            ans += 1
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 9060
//#include<bits/stdc++.h>
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<string>
#include<numeric>
#include<vector>
#include<set>
#include<map>
#include<unordered_map>
#include<stack>
#include<queue>
#include<list>
using namespace std;

typedef long long ll;

#define MOD 1000000007

class Comb{
private:
  ll *fac,*finv,*inv;
public:
  Comb(){
    fac = new ll[1000000];
    finv = new ll[1000000];
    inv = new ll[1000000];
    fac[0] = 1;
    for(int i=1;i<1000000;i++){
      fac[i] = i*fac[i-1];
      fac[i] %= MOD;
    }
    inv[1] = 1;
    for(int i=2;i<1000000;i++){
      inv[i] = MOD-inv[MOD%i]*(MOD/i)%MOD;
    }
    finv[0] = 1;
    for(int i=1;i<1000000;i++){
      finv[i] = inv[i]*finv[i-1];
      finv[i] %= MOD;
    }
  }
  ll calc(ll n,ll k){
    ll c = fac[n];
    c *= finv[k];c %= MOD;
    c *= finv[n-k];c %= MOD;
    return c;
  }
};

int main(){
  int n;
  cin >> n;
  int p[n];
  for(int i=0;i<n;i++) cin >> p[i];
  sort(p,p+n);
  int ans = 0;
  for(int i=0;i<n;i++){
    ans += p[i];
    if(i == n-1) ans -= p[i]/2;
  }
  cout << ans << endl;
  return 0;
}


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

using namespace std;

const int maxn = 2e5 + 5;
int a[maxn];
bool cmp(int x, int y)
{
    return x > y;
}
map<int, int> mp;
int main() {
    int n, ans=0;
    scanf("%d",&n);
    for(int i=1; i <= n; i++)
    {
        scanf("%d", a + i);
        mp[a[i]]++;
    }
    sort(a + 1, a + 1 + n, cmp);
    for(int i=1; i <= n; i++)
    {
        int num = a[i];
        if(mp[a[i]] == 0) continue;
        mp[a[i]]--;
        int t=1;
        while(num){
            num = num >> 1;
            t = t << 1;
        }
        num = t - a[i];
        if(mp[num]){
            ans++;
            mp[num]--;
        }
    }
    printf("%d\n", ans);
    return 0;
}


Measured memory_bytes: 19712
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;

/*
<url:https://arc081.contest.atcoder.jp/tasks/arc081_b>
問題文============================================================
 2×N のマス目があります． すぬけ君は，このマス目に N 個のドミノを，重ならないように敷き詰めました．
 ここで，ドミノは，1×2 または 2×1 のマス目を覆うことができます．
 
 すぬけ君は，赤色，水色，緑色の 3 色を使って，これらのドミノを塗ることにしました．
 このとき，辺で接しているドミノは異なる色で塗るようにします．
 ここで，必ずしも 3 色すべてを使う必要はありません．
 
 このような塗り方が何通りあるかを mod 1000000007 で求めてください．
 
 ただし，ドミノの敷き詰め方は，文字列 S1,S2 を用いて，次のようにして与えられます．
 
 各ドミノは，それぞれ異なる英小文字または英大文字で表される．
 Si の j 文字目は，マス目の上から i 番目，左から j 番目のマスにどのドミノがあるかを表す．
 
 制約
 1≤N≤52
 |S1|=|S2|=N
 S1,S2 は英小文字または英大文字からなる
 S1,S2 は正しいドミノの敷き詰め方を表している

=================================================================

解説=============================================================

================================================================
*/

const ll MOD = 1e9 + 7;
int main(void) {
	cin.tie(0); ios::sync_with_stdio(false);
    ll N; cin >> N;
    string S1,S2; cin >> S1 >> S2;
    ll ans = 1;
    ll i = 0;
    if(S1[i] == S2[i]){
        /*
         X
         X
         */
        ans *= 3;
        i++;
    }else{
        /*
         X X
         Y Y
         */
        ans *= 6;
        i+=2;
    }
    for(;i<N;){
        if(S1[i] == S2[i]){
            if(S1[i-1] == S2[i-1]){
                /*
                 X Y
                 X Y
                 */
                ans *= 2;
            }else{
                /*
                 YY X
                 ZZ X
                 */
                ans *= 1;
            }
            i++;
        }else{
            if(S1[i-1] == S2[i-1]){
                /*
                 Y XX
                 Y YY
                 */
                ans *= 2;
            }else{
                /*
                 AA XX
                 BB YY
                 */
                ans *= 3;
            }
            i += 2;
        }
        ans%=MOD;
    }
    cout << ans << endl;
	return 0;
}


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

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

#define fi first
#define se second
#define pb push_back

int n, m ;
vector<int> G[111111],rG[111111];
int from[111111];
int visit[111111];
vector<int> S;

void dfs(int v){
    visit[v] = 1;
    for(int i = 0; i < rG[v].size(); i++){
        if(!visit[rG[v][i]]) dfs(rG[v][i]);
    }
    S.pb(v);
}

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

    cin >> n >> m;
    for(int i = 0; i < n+m-1; i++){
        int f,t; cin >> f>>t;

        from[t] = f;
        G[f].pb(t);
        rG[t].pb(f);
    }


    for(int i = 1; i <= n; i++){
        if(!visit[i])dfs(i);
    }



    for(int i = 0; i < n; i++){
        for(int j = 0; j < G[S[i]].size(); j++){
            from[G[S[i]][j]] = S[i];
        }
    }

    for(int i = 1; i <= n; i++) cout << from[i] << endl;

    return 0;
}

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

//int64_t univMod = 1000000007;
//vector<int64_t> modfrac(univmod)

int64_t calcGCD(int64_t a,int64_t b){
	int64_t p = a;
	int64_t q = b;
	int64_t c = a%b;
	while(c != 0){
		p = q;
		q = c;
		c = p%q;
	}
	return q;
}
/*
int64_t calcmodpower(int64_t a,int64_t n;){
	int64_t result = 1;
	while(n != 0){
		if(n&1 == 1){
			result = (result * a)%univMod;
		}
		n = n >> 1;
		a = (a*a)%univMod;
	}
	return result;
}*/

int main(){
  int n;
  cin >> n;
  vector<pair<string,int>> st(n);
  rep(i,n) cin >> st.at(i).first >> st.at(i).second;
  string x;
  cin >> x;
  bool flag = false;
  int64_t sum = 0;
  rep(i,n){
    if(flag){
      sum += st.at(i).second;
    }else if(st.at(i).first == x){
      flag = true;
    }
  }
  cout << sum << endl;
}

Measured memory_bytes: 256