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

#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define RFOR(i, a, b) for(int i=(a); i>=(b); i--)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) RFOR(i, n, 0)
#define dump(x)  cout << #x << " = " << (x) << endl;

typedef long long ll;
typedef pair<int, int> ii;
const int mod = 1e9+7;
const ll INF = 1e18;
const int inf = 1e9;

void solve()
{
  ll a,b,x;
  cin>>a>>b>>x;
  ll ans = 0;
  if (a==0) ans = b/x + 1;
  else ans = b/x - (a-1)/x;
  cout << ans << endl;
}

int main()
{
  solve();
  return 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main {
	Scanner sc = new Scanner(System.in);
	int b,c,d,e,f,k,l,m,n,x,y,z;
	int[] a;
	int[] ans;

	Main(){
		// 整数の入力
		n = sc.nextInt();
		a = new int[n+1];
		ans = new int[n+1];
		for(int i=1;i<=n;i++){
			a[i] = sc.nextInt();
		}

		for(int s=n;s>0;s--){
			for(int t=s*2;t<=n;t+=s){
				ans[s] += ans[t];
			}
			ans[s] = ans[s]%2==a[s]?0:1;
		}

		// 出力
		for(int i=1;i<=n;i++)
			m+=ans[i];

		System.out.println(m);
		for(int i=1;i<=n;i++)
			if(ans[i]==1)System.out.print(i+" ");
	}

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

Measured memory_bytes: 90124
#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <stack>
#include <algorithm>

using namespace std;


#define REP(i,k,n) for(int i=k;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define all(v) v.begin(),v.end()
#define INF 1<<30
#define mp make_pair
#define pb push_back

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;
typedef vector<pair<int, int> > vp;

typedef long long ll;

int main(){
    int n;
    int h,w;
    cin>>h>>w>>n;
    vp a;
    rep(i,n){
        int x1,x2,y1,y2;
        cin>>x1>>y1>>x2>>y2;
        if((x1==0||x1==h||y1==0||y1==w)&&(x2==0||x2==h||y2==0||y2==w)){
            if(x1==0)       a.pb(mp(y1,i+1));
            else if(y1==w)  a.pb(mp(w+x1,i+1));
            else if(x1==h)  a.pb(mp(2*w+h-y1,i+1));
            else            a.pb(mp(2*(w+h)-x1,i+1));
            if(x2==0)       a.pb(mp(y2,i+1));
            else if(y2==w)  a.pb(mp(w+x2,i+1));
            else if(x2==h)  a.pb(mp(2*w+h-y2,i+1));
            else            a.pb(mp(2*(w+h)-x2,i+1));
        }
    }

    sort(all(a));

    stack<int> st;
    st.push(0);
    rep(i,a.size()){
        if(st.top()==a[i].second){
            st.pop();
        }
        else{
            st.push(a[i].second);
        }
    }
    st.pop();
    if(st.empty()) cout<<"YES"<<endl;
    else cout<<"NO"<<endl;

    return 0;
}


Measured memory_bytes: 2420
#include <stdio.h>

void BubbleSort(char a[][3], int n)
{
	int i, j;
	char temp[5];
	int cnt = 0;

	for (i = 0; i < n - 1; i++) {
		for (j = n - 1; j > i; j--) {
			if (a[j][1] < a[j - 1][1]) {
				strcpy(temp, a[j - 1]);
				strcpy(a[j - 1], a[j]);
				strcpy(a[j], temp);
			}
		}
	}
}

void SelectionSort(char a[][3], int n)
{
	int i, j, minj;
	char temp[5];
	int cnt = 0;

	for (i = 0; i < n - 1; i++) {
		minj = i;
		for (j = i; j < n; j++) {
			if (a[j][1] < a[minj][1]) {
				minj = j;
			}
		}
		if (minj != i) {
			strcpy(temp, a[minj]);
			strcpy(a[minj], a[i]);
			strcpy(a[i], temp);
		}
	}
}

int main(void) {
	int n;
	char line[36][3], line_copy[36][3];
	int i;
	int stable = 0;

	scanf("%d", &n);

	for (i = 0; i < n; i++) {
		scanf("%s", &line[i]);
	}

	for (i = 0; i < n; i++) {
		strcpy(line_copy[i], line[i]);
	}

	BubbleSort(line, n);
	SelectionSort(line_copy, n);

	for (i = 0; i < n; i++) {
		printf("%s", line[i]);
		if (i < n - 1) {
			printf(" ");
		}
	}
	printf("\n");
	printf("Stable\n");

	for (i = 0; i < n; i++) {
		printf("%s", line_copy[i]);
		if (i < n - 1) {
			printf(" ");
		}
	}
	printf("\n");

	for (i = 0;i < n;i++) {
		if(strcmp(line_copy[i], line[i]) != 0){
			stable = 1;
			}
	}
	if (stable != 0) {
		printf("Not stable\n");
	}
	else {
		printf("Stable\n");
	}

	return 0;
}


Measured memory_bytes: 2048
// 2011/09/21 Tazoe

#include <iostream>
using namespace std;

void floyd(int C[101][101], int n)
{
	for(int k=1; k<=n; k++)
		for(int i=1; i<=n; i++)
			for(int j=1; j<=n; j++)
				if(C[i][k]!=-1&&C[k][j]!=-1&&(C[i][j]==-1||C[i][j]>C[i][k]+C[k][j]))
					C[i][j] = C[i][k]+C[k][j];
}

int main()
{
	while(true){
		int n, k;
		cin >> n >> k;
		if(n==0&&k==0)
			break;

		int C[101][101];
		for(int i=1; i<=n; i++)
			for(int j=1; j<=n; j++)
				if(i==j)
					C[i][j] = 0;
				else
					C[i][j] = -1;

		bool flg = false;
		for(int i=0; i<k; i++){
			int m;
			cin >> m;

			if(m==0){
				if(flg){
					floyd(C, n);
					flg = false;
				}

				int a, b;
				cin >> a >> b;

				cout << C[a][b] << endl;
			}
			else{
				int c, d, e;
				cin >> c >> d >> e;

				if(C[c][d]==-1||C[c][d]>e){
					C[c][d] = C[d][c] = e;
					flg = true;
				}
			}
		}
	}

	return 0;
}

Measured memory_bytes: 904
#define _USE_MATH_DEFINES
#include <math.h>
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <algorithm>
#include <numeric>
#include <stdio.h>
#include <vector>
#include <map>
#include <queue>

using namespace std;
typedef long long ll;
using Graph = vector<vector<ll>>;

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

int main() {
    string S;
    cin >> S;
    ll X = 0;
    ll Y = 753;
    ll out = Y;
    rep(i,S.length()-2){
        X = stoi(S.substr(i,3));
        out = min(out,abs(X-Y));
    }
    cout << out << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    char c;
    cin >> c;
    if(c>='A'&&c<='Z')
    {
        cout << "A" << endl;
    }
    else if(c>='a'&&c<='z')
    {
        cout << "a" << endl;
    }
    return 0;
}

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

int main(void)
{

    int N;
    
    cin >> N;
    
    if( (N-9)%10 == 0 ){
        cout << "Yes" << endl;
    }
    else if( 10*N - 900 >= 0 ){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }

}

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

public class Main
{

  public static void main(String[] args) throws NumberFormatException, IOException
  {
    BufferedReader input = new BufferedReader(new InputStreamReader(System.in));

    while (input.ready())
    {
      final String[] PARAM_STR = input.readLine().split(" ");

      final double a = Double.valueOf(PARAM_STR[0]);
      final double b = Double.valueOf(PARAM_STR[1]);
      final double c = Double.valueOf(PARAM_STR[2]);
      final double d = Double.valueOf(PARAM_STR[3]);
      final double e = Double.valueOf(PARAM_STR[4]);
      final double f = Double.valueOf(PARAM_STR[5]);

      solver(a, b, c, d, e, f);
    }

  }

  private static void solver(double a, double b, double c, double d, double e, double f)
  {
    double det = 1 / ((a * e) - (b * d));
    double x = det * ((e * c) + (-b * f));
    double y = det * ((-d * c) + (a * f));

    if (x == -0)
      x = 0;
    if (y == -0)
      y = 0;

    System.out.printf("%.3f %.3f\n", x, y);

  }

}



Measured memory_bytes: 24800
#include<bits/stdc++.h>
using namespace std;
int main(){
     char a[19];
     for(int i=0;i<19;i++){
     	
		 cin>>a[i];
		 a[5]=' ';
		 a[13]=' ';
	 }
	 cout<<a;
	 
     
	return 0;
}

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

#define stirng string
#define vvi vector<vector<int>>
#define vi vector<int>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;

const int inf = 1e9 + 7;

int main() {
  set<char> a;
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    char tmp;
    cin >> tmp;
    a.insert(tmp);
  }
  if (a.size() == 3) {
    cout << "Three" << endl;
  } else {
    cout << "Four" << endl;
  }

  return 0;
}


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

signed main() {
  int N;
  cin >> N;
  vector<int> a(N);
  
  int saidai = 0;
  int chisai = 10000000000;
  for( int i = 0; i < N; i++ ){
    cin >> a.at(i);
    if( saidai < a.at(i) ) saidai = a.at(i);
    if( chisai > a.at(i) ) chisai = a.at(i);
  }
  
  cout << saidai - chisai << endl;
  
}

Measured memory_bytes: 256
N, M = map(int,input().split())
bridges = []
for _ in range(M):
    bridges.append(list(map(int,input().split())))
bridges = sorted(bridges, key=lambda x: x[1])
MAX = 0
ans = 0
for a, b in bridges:
    if a > MAX:
        ans += 1
        MAX = b-1
print(ans)

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

#define MP make_pair
#define PB push_back
#define ALL(x)      (x).begin(),(x).end()
#define REP(i,n)    for(int i=0;i<(n);i++)
#define REP1(i,n)   for(int i=1;i<(n);i++)
#define REP2(i,d,n) for(int i=(d);i<(n);i++)
#define RREP(i,n)   for(int i=(n);i>=0;i--)
#define CLR(a)      memset((a),0,sizeof(a))
#define MCLR(a)     memset((a),-1,sizeof(a))
#define RANGE(x,y,maxX,maxY) (0 <= (x) && 0 <= (y) && (x) < (maxX) && (y) < (maxY))
 
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI > VVI;
typedef vector<string> VS;
typedef vector<LL> VLL;
typedef pair<int,int> PII;
 
const int INF = 0x3f3f3f3f;
const LL INFL = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-9;
 
const int DX[]={1,0,-1,0},DY[]={0,-1,0,1};


void solve(long long n){
    cout << (n / 100 == 1 ? "9" : "1") << (n / 10 % 10 == 1 ? "9" : "1") << (n % 10 == 1 ? "9" : "1") << endl;
}

int main(){
    long long n;
    scanf("%lld",&n);
    solve(n);
    return 0;
}


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

using namespace std;

int A[100005];
int N,L;

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

	int pos = -1;

	cin >> N >> L;
	for(int i=1;i<=N;i++)
	{
		cin >> A[i];
	}

	for(int i=N-1;i>=1;i--)
	{
		if(A[i] + A[i+1] >= L)
		{
			pos = i;
			break;
		}
	}

	if(pos==-1)
	{
		cout << "Impossible" << '\n';
		return 0;
	}

	cout << "Possible" << '\n';
	for(int i=1;i<pos;i++)
	{
		cout << i << '\n';
	}
	for(int i=N-1;i>pos;i--)
	{
		cout << i << '\n';
	}
	cout << pos << '\n';

	return 0;
}

Measured memory_bytes: 3968
using namespace std;
#include <iostream>
#include <string>
#include <set>
#include <functional>
#include <vector>
#include <algorithm>
#include <stdio.h>
int CtoI(char c){
	if(c=='I')return 1;
	else if(c=='V')return 5;
	else if(c=='X')return 10;
	else if(c=='L')return 50;
	else if(c=='C')return 100;
	else if(c=='D')return 500;
	else if(c=='M')return 1000;
}
int main()
{
	string s;
	while(getline(cin,s)){
		int ans=0;
		for(int i=1;i<(int)s.length();i++){
			int x=CtoI(s[i-1]);
			if(x<CtoI(s[i]))ans-=x;
			else ans+=x;
		}
		ans+=CtoI(s[(int)s.length()-1]);
		cout<<ans<<endl;
	}
    return 0;
}

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

using namespace std;

#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(a) (int)(a.size())
#define ALL(a) a.begin(),a.end()
#define SET(a,b) memset(a,b,sizeof(a))

#define SI(n) scanf("%d",&n)
#define PI(n) printf("%d\n",n)
#define SL(n) scanf("%lld",&n)
#define PL(n) printf("%lld\n",n)
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL)

#define TRACE

#ifdef TRACE
#define TR(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define TR(...)
#endif

//FILE *fin = freopen("in","r",stdin);
//FILE *fout = freopen("out","w",stdout);
typedef long long int 	LL;
typedef long double 	LD;
typedef pair<int,int>   II;
typedef vector<int>     VI;
const int MOD = 1e9 + 7;
const int N = 100011;
int h, w;
LL func(LL h, LL w) {
    LL l = h - h/2;
    LL r = h - l;
    LL ans = 1e15;
    LL v1 = h/3;
    LL v2 = (h + 1)/3;
    LL v3 = h - v1 - v2;
        multiset<LL> s1;
        s1.insert(v1*w);
        s1.insert(v2*w);
        s1.insert(v3*w);
        ans = min(ans, abs(*s1.begin() - *s1.rbegin()));
    for(LL i = 0;i <= w; ++i) {
        multiset<LL> s;
        s.insert(i*l);
        s.insert(i*r);
        s.insert((w - i)*h);
        ans = min(ans, abs(*s.begin() - *s.rbegin()));
    }
    return ans;
}


int main() {
    int h, w;
    cin>>h>>w;
    cout<<min(func(h, w), func(w, h))<<"\n";
    return 0;
}

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

int main() {
  ll n;
  cin >> n;
  vector<pair<ll,ll>> a(n);
  vector<ll> time(n);
  rep(i,n){
    ll t,x,y;
    cin >> t >> x >> y;
    time[i] = t;
    a[i] = make_pair(x,y);
  }
  
  ll cur=0;
  pair<ll,ll> now = make_pair(0,0);
  rep(i,n){
    ll nx,ny;
    tie(nx,ny) = now;
    ll x,y;
    tie(x,y) = a[i];
    ll dist = abs(nx-x) + abs(ny-y);
    if(dist > time[i] - cur){
      cout << "No" << endl;
      return(0);
    }else if(abs(dist - (time[i]-cur)) % 2 != 0){
      cout << "No" << endl;
      return(0);
    }
    cur = time[i];
    now = a[i];
  }
  
  cout << "Yes" << endl;
  return(0);
}

Measured memory_bytes: 5504
import sys
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def dp2(ini, i, j): return [[ini]*i for i2 in range(j)]
def dp3(ini, i, j, k): return [[[ini]*i for i2 in range(j)] for i3 in range(k)]

def bunkai(x):
    for i in reversed(range(1, int(x**0.5//1)+1)):
        #print(i)
        if x%i == 0:
            return list((i, x//i))
    return list((1, S))


S = ii()
lim = 10**9
'''
#print(bunkai(S))
a, b = bunkai(S)[0], bunkai(S)[1]
if a==b:
    print(0, 0, bunkai(S)[0], 0, 0, bunkai(S)[1])
    exit()
for i in range(1, 10**18-S):
    if bunkai(i)[0]<=lim and bunkai(i)[1]<=lim and bunkai(S+i)[0]<=lim and bunkai(S+i)[1]<=lim:
        print(0, 0, bunkai(i)[0], bunkai(S+1)[1], bunkai(S+1)[0], bunkai(i)[1])
        exit()
'''
s12 = S**0.5
a = int(s12)
keta = len(str(a))
b = 10**keta
if float(a)==s12:
    print(0, 0, a, 0, 0, a)
    exit()
#for i in range(a+1, b+1):
    #ii = i**2
    #if bunkai(ii)[0]<=lim and bunkai(ii)[1]<=lim and bunkai(ii-S)[0]<=lim and bunkai(ii-S)[1]<=lim:
print(0, 0, a+1, bunkai((a+1)**2-S)[1], bunkai((a+1)**2-S)[0], a+1)
exit()

Measured memory_bytes: 3188
// #pragma GCC target("avx2")  // CPU 処理並列化
// #pragma GCC optimize("O3")  // CPU 処理並列化
// #pragma GCC optimize("unroll-loops")  // 条件処理の呼び出しを減らす
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
#include<numeric>
using namespace std;
const long long mod=998244353;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const double EPS=1e-10;
const double INF=1e+10;
const double PI=acos(-1.0);
const int C_SIZE = 3121000;
long long fact[C_SIZE];
long long finv[C_SIZE];
long long inv[C_SIZE];
long long Comb(int a,int b){
 	if(a<b||b<0)return 0;
 	return fact[a]*finv[b]%mod*finv[a-b]%mod;
}
void init_C(int n){
	fact[0]=finv[0]=inv[1]=1;
	for(int i=2;i<n;i++){
		inv[i]=(mod-(mod/i)*inv[mod%i]%mod)%mod;
	}
	for(int i=1;i<n;i++){
		fact[i]=fact[i-1]*i%mod;
		finv[i]=finv[i-1]*inv[i]%mod;
	}
}
long long pw(long long a,long long b){
	if(a<0LL)return 0;
	if(b<0LL)return 0;
	long long ret=1;
	while(b){
		if(b%2)ret=ret*a%mod;
		a=a*a%mod;
		b/=2;
	}
	return ret;
}
int ABS(int a){return max(a,-a);}
long long ABS(long long a){return max(a,-a);}
double ABS(double a){return max(a,-a);}
int sig(double r) { return (r < -EPS) ? -1 : (r > +EPS) ? +1 : 0; }
// ここから編集しろ
int p[110000];

pair<int,int>q[110000];
int bit[210000];
int sum(int a,int b){
	if(a)return sum(0,b)-sum(0,a-1);
	int ret=0;
	for(;b>=0;b=(b&(b+1))-1)ret+=bit[b];
	return ret;
}
void add(int a,int b){
	for(;a<210000;a|=a+1)bit[a]+=b;
}
int main(){
	int a;scanf("%d",&a);
	for(int i=0;i<a;i++)scanf("%d",p+i);
	for(int i=0;i<a;i++)q[i]=make_pair(p[i],i);
	std::sort(q,q+a);
	int left=-1;
	int right=a;
	while(left+1<right){
		int M=(left+right)/2;
		long long cnt=0;
		for(int i=0;i<210000;i++)bit[i]=0;
		int at=100000;
		add(at,1);
		for(int i=0;i<a;i++){
			if(make_pair(p[i],i)>=q[M]){
				at++;
			}else at--;
			cnt+=sum(0,at);
			add(at,1);
		}
	//	printf("%d %d: %lld\n",q[M].first,q[M].second,cnt);
		if(cnt<((long long)a*(a+1)/2+1)/2)right=M;
		else left=M;
	}
	printf("%d\n",q[left].first);
}

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

int main(){
  ll n,a,b;
  cin >> n >> a >> b;
  ll k = n/(a+b);
  ll l = k*a;
  n = n - k*(a+b);
  if(n >= a+1) n=a;
  
  cout << l+n << endl;
  
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
	int a,b,c,ans;
	scanf("%d %d %d",&a,&b,&c);
	if(a==1 && b==0 && c==0){
		printf("Close\n");
	}
	else if(a==0 && b==1 && c==0){
		printf("Close\n");
	}
	else if(a==1 && b==1 && c==0){
		printf("Open\n");
	}
	else if(a==0 && b==0 && c==1){
		printf("Open\n");
	}
	else if(a==0 && b==0 && c==0){
		printf("Close\n");
	}
	return 0;
}


Measured memory_bytes: 2068
#include <iostream>

 

 

 

using namespace std;

 

 

 

int main() 

 

{
    int i, a, b, c;
    for (i = 1; i<=3000; i++)
    {
    cin >> a >> b;
    if(a== 0 && b== 0 )
        break;
         
         
    if (a>b)
    {
        c = a;
        a = b;
        b = c;
    }
   
    cout << a << " " << b << endl;
    }

 

}


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

int main()
{
  int64_t N, K;
  string S;
  cin >> N >> S >> K;
  for (int i = 0; i < N; i++)
    cout << (S.at(i) == S.at(K - 1) ? S.at(i) : '*');
  cout << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <string>
#include <cstring>
#include <map>
#include <math.h>
#include <queue>
#include <set>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pl;
typedef pair<int, int> pi;
#define rep(i,n) for (int i = 0; i < n; i++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF = 1<<30;

int n, m;
vector<int> G[100010];
int dp[100010];

int DFS(int v){
	if(dp[v] != -1) return dp[v];
	int ret = 0;
	rep(i,G[v].size()){
		chmax(ret, DFS(G[v][i]) + 1);
	}
	return dp[v] = ret;
}

int main(){
	cin >> n >> m;
	for (int i = 0; i < m; i++) {
		int x, y;
		cin >> x >> y;
		x--; y--;
		G[x].push_back(y);
	}
	rep(i,n) dp[i] = -1;
	int ans = 0;
	rep(i,n) chmax(ans, DFS(i));
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 8192
#include <bits/stdc++.h>
#include <algorithm>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<(n);++i)
#define all(x) (x).begin(), (x).end()
#define PB(x) push_back(x)
#define MP(x,y) make_pair(x,y)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

 
int main() {

    ll n;
    cin >> n;
    n++;
    ll ans= 0;
    rep(i,n) {
        if(i%3==0||i%5==0) ;
        else    ans+=i;
    }

    cout<< ans << endl;

 return 0;
}

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

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

ll lcm(ll a, ll b){
    ll ret = a / gcd(a,b) * b;
    return ret;
}

int main(){
    ll n;
    cin >> n;
    vector<ll> a(n), left(n), right(n);
    rep(i, 0, n) cin >> a[i];
    left[0] = a[0]; right[n-1] = a[n-1];
    rep(i, 1, n) left[i] = gcd(a[i], left[i-1]);
    for(ll i = n-2; i >= 0; i--) right[i] = gcd(a[i], right[i+1]);
    ll ans = right[1];
    rep(i, 1, n-1) ans = max(ans, gcd(left[i-1], right[i+1]));
    ans = max(ans, left[n-2]);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 5604
while True:
    n, r = map(int, input().split())
    if n + r < 1:
        break
    mountain = list(range(n, 0, -1))
    for i in range(r):
        p, c = map(int, input().split())
        mountain = mountain[p-1:p-1+c] + mountain[0:p-1] + mountain[p-1+c:]
    print(mountain[0])

Measured memory_bytes: 7588
n = int(input())
listA = list(map(int, input().split()))
i=0
count =0
while i < n:
    minj =i
    j=i
    while j < n:
        if listA[j] < listA[minj]:
            minj=j
        j+=1
    if i!=minj:
        count+=1
    listA[i], listA[minj] = listA[minj], listA[i]
    i+=1

print(" ".join(map(str, listA)))
print(count)


Measured memory_bytes: 5600
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while (true) {
			int a = sc.nextInt();
			int b = sc.nextInt();
			if (a == 0 && b == 0)
				break;
			for (int i = 1; i <= a; i++) {
				for (int c = 1; c <= b; c++) {
				     if ( i == 1 || i == a || c == 1 | c == b ) {
				    	 System.out.printf("#");
				     } else {
				    	 System.out.printf(".");
				     }
				}
				 System.out.println();
			}
		    System.out.println();
		}
     }
}


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

//#define int long long
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<n;++i)
#define exrep(i, a, b) for(ll i = a; i < b; i++)
#define out(x) cout << x << endl
#define EPS (1e-7)
#define gearup ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<bool> > vvb;
typedef vector<vector<double> > vvd;
typedef vector<vector<string> > vvs;
typedef vector<ll> vl;
typedef vector<vector<ll> > vvl;
typedef vector<vector<vector<ll> > > vvvl;
ll MOD = 1000000007;
const long long L_INF = 1LL << 60;
const int INF = 2147483647; // 2^31-1
const double PI = acos(-1);
//cout<<fixed<<setprecision(10);

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;}
template<class T> void debug(T v){rep(i,v.size()) cout<<v[i]<<" ";cout<<endl;}
const ll dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};

signed main()
{   
    gearup;
    ll a,b,c,d;cin>>a>>b>>c>>d;
    ll st = max(a,c);
    ll en = min(d,b);
    if(en >= st)out(en-st);
    else out(0);
}


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

void fnBubbleSort(vector<string> &argvsSortBbl)
{
  int ixSorting = 0;
  bool bSorting = true;

  while (bSorting)
  {
    bSorting = false;
    for (int j = argvsSortBbl.size() - 1; j > ixSorting; j--)
    {
      if (argvsSortBbl[j].at(1) < argvsSortBbl[j - 1].at(1))
      {
        swap(argvsSortBbl[j], argvsSortBbl[j - 1]);
        bSorting = true;
      }
    }
    ixSorting++;
  }
}

void fnOutputBbl(const vector<string> &argvsSortBbl)
{
  for (int i = 0; i < argvsSortBbl.size(); i++)
  {
    if (i) cout << " ";
    cout << argvsSortBbl[i];
  }
  cout << endl;
  cout << "Stable" << endl;
}

void fnSelectionSort(vector<string> &argvsSortSel)
{
  for (int ixSorting = 0; ixSorting < argvsSortSel.size() - 1; ixSorting++)
  {
    int ixMinimum = ixSorting;
    bool bSorting = false;
    for (int j = ixSorting + 1; j < argvsSortSel.size(); j++)
    {
      if (argvsSortSel[j].at(1) < argvsSortSel[ixMinimum].at(1))
      {
        ixMinimum = j;
        bSorting = true;
      }
    }
    if (bSorting == true)
    {
      swap(argvsSortSel[ixSorting], argvsSortSel[ixMinimum]);
    }
  }
}

void fnOutputSel(const vector<string> &argvsSortSel, const vector<string> &argvsSortBbl)
{
  string sSortEnd = "Stable";

  for (int i = 0; i < argvsSortSel.size(); i++)
  {
    if (i) cout << " ";
    cout << argvsSortSel[i];
    
    if (argvsSortSel[i] != argvsSortBbl[i]) sSortEnd = "Not stable";
  }
  cout << endl;
  cout << sSortEnd << endl;
}

int main()
{
  vector<string> vsSortBbl, vsSortSel;
  int iMaxSize;
  
  cin >> iMaxSize;
  for (int i = 0; i < iMaxSize; i++)
  {
    string sCard;
    cin >> sCard;
    vsSortBbl.push_back(sCard);
    vsSortSel.push_back(sCard);
  }

  fnBubbleSort(vsSortBbl);
  fnOutputBbl(vsSortBbl); 

  fnSelectionSort(vsSortSel);
  fnOutputSel(vsSortSel, vsSortBbl);

  return 0;
}

Measured memory_bytes: 1220
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int m = Integer.parseInt(sc.next());
        sc.close();
        int MOD = 1_000_000_007;
        if (Math.abs(n - m) > 1) {
            System.out.println(0);
        } else if (n == m) {
            System.out.println((((nPk(n, n, MOD) * nPk(m, m, MOD)) % MOD) * 2) % MOD);
        } else {
            System.out.println((nPk(n, n, MOD) * nPk(m, m, MOD)) % MOD);
        }
    }

    static long nPk(int n, int k, int MOD) {
        long r = 1;
        while (k > 0) {
            r *= n;
            r %= MOD;
            n -= 1;
            k -= 1;
        }
        return r;
    }
}

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

int main(){
    string w;
    int alp[27]={0};
    cin >> w;
    
    rep(i, w.length()){
        alp[w[i]-'a']++;
    }
    rep(i, sizeof(alp)/sizeof(int)){
        if(alp[i]%2!=0){
            cout << "No" << endl;
            goto END;
        }else{}
    }
    cout << "Yes" << endl;
END:
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <climits>
#include <utility>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <iomanip>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
//setbase - cout << setbase (16); cout << 100 << endl; Prints 64
//setfill -   cout << setfill ('x') << setw (5); cout << 77 << endl; prints xxx77
//setprecision - cout << setprecision (14) << f << endl; Prints x.xxxx
//cout.precision(x)  cout<<fixed<<val;  // prints x digits after decimal in val
using namespace std;
using namespace __gnu_pbds;

#define sp << " " <<
#define mod 1000000007
#define PI 3.14159265358979323
#define y second
#define x first
#define pb push_back
#define mp make_pair
#define sz(a) a.size()
#define pqueue priority_queue< ll >
//#define pdqueue priority_queue< ll,vector<ll> ,greater< ll > >
#define codejamDebug(x) cout<<"Case #"<<x<<": ";
#define debug(x) cout<<#x<<" :"<<x<<endl;
#define rep(i,n) for(long long i=0;i<n;i++)
#define f(i,a,b) for(long long i = a; i < b; i++)
#define fd(i,a,b) for(long long i = a; i >=b; i--)
#define sync ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
typedef long long int           ll;
typedef long double             ld;
typedef unsigned long long int ull;
typedef vector <int>            vi;
typedef vector <ll>            vll;
typedef pair <int, int>        pii;
typedef pair <ll, ll>          pll;
typedef vector < pii >        vpii;
typedef vector < pll >        vpll;
typedef vector <string>         vs;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

//Handle:cyber_rajat

int main(int argc, char const *argv[])
{
	sync;
	/*#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	#endif*/
	ll k,n;
	cin>>k>>n;
	ll a[n+5];
	ll tmp=0;
	rep(i,n)
	{
		cin>>a[i];
	}
	int ans = 0;
	if (n==1){
		cout << 0;
		return 0;
	}
	for (int i = 1; i < n; i++){
		tmp = max(tmp, a[i]-a[i-1]);
	}
	tmp = max(tmp, k - a[n-1] + a[0]);
	cout << k - tmp;;
	return 0;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
#define ll long long
#define N 300005
#define P 998244353
using namespace std;
ll n,a,b;ll k,inv[N],fac[N],ifac[N];
int main()
{
	scanf("%lld%lld%lld%lld",&n,&a,&b,&k);
	inv[1]=fac[1]=ifac[1]=fac[0]=ifac[0]=1;
	for (int i=2;i<=n;i++)
	{
		inv[i]=(-P/i)*inv[P%i]%P;
		fac[i]=fac[i-1]*i%P;
		ifac[i]=ifac[i-1]*inv[i]%P;
	}
	ll Ans=0;
	for (int i=0;i<=n;i++)
	{
		if (((k-a*i)%b==0)&&(k>=a*i))
		{
			//i (k-a*i)/b
			ll j=(k-a*i)/b;
			if (j>n) continue;
			Ans=(Ans+fac[n]*ifac[i]%P*ifac[n-i]%P*fac[n]%P*ifac[j]%P*ifac[n-j])%P;
		}
	}
	printf("%lld\n",(Ans+P)%P);
}

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

int main(){
    int a,b,c;
    cin>>a>>b>>c;
    if(a==b+c||b==a+c||c==a+b)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 256
N = int(input())
S1 = input()
S2 = input()
mod = 10**9+7

ans = 1
pre = None
i = 0
while i < N:
    if pre is None:
        if S1[i] == S2[i]:
            ans = ans*3 % mod
            pre = 'x'
            i += 1
        else:
            ans = ans*6 % mod
            pre = 'y'
            i += 2
    elif pre == 'x':
        if S1[i] == S2[i]:
            ans = ans*2 % mod
            pre = 'x'
            i += 1
        else:
            ans = ans*2 % mod
            pre = 'y'
            i += 2
    elif pre == 'y':
        if S1[i] == S2[i]:
            ans = ans*1 % mod
            pre = 'x'
            i += 1
        else:
            ans = ans*3 % mod
            pre = 'y'
            i += 2

print(ans % mod)

Measured memory_bytes: 38256
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import calendar as cal

i = input().split(' ')
a = int(i[0])
b = int(i[1])

if a >= b:
    l = a
    s = b
else:
    l = b
    s = a

d = l - s

e = 16 - s*2

if e/2 >= d:
    print("Yay!")
else:
    print(":(")


Measured memory_bytes: 4592
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author tatsumack
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>

#define int long long
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define FOR(i, a, b) for (int i = (a), i##_len = (b); i <= i##_len; ++i)
#define REV(i, a, b) for (int i = (a); i >= (b); --i)
#define CLR(a, b) memset((a), (b), sizeof(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define INF 1001001001001001001ll
#define fcout cout << fixed << setprecision(12)

using namespace std;

typedef pair<int, int> P;

class DChatInACircle {
public:
    void solve(std::istream& cin, std::ostream& cout) {
        int N;
        cin >> N;
        vector<int> A(N);
        REP(i, N) cin >> A[i];
        sort(A.rbegin(), A.rend());

        int num = 1;
        int res = A[0];
        FOR(i, 1, A.size() - 1) {
            if (num == A.size() - 1) break;
            if (num + 2 < A.size()) {
                res += A[i] * 2;
                num += 2;
            } else if (num + 1 < A.size()) {
                res += A[i];
                num += 1;
            }
        }
        cout << res << endl;
    }
};


signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    std::istream& in(std::cin);
    std::ostream& out(std::cout);

    DChatInACircle solver;
    solver.solve(in, out);
    return 0;
}


Measured memory_bytes: 4784
def func(n, a, b, c, l):
    # 連結後に増加させても、連結前に増加させてもコストは変わらない
    # 全通り試す（各l[i]をa,b,c,非使用で4分割し
    # そのあといくらコストがかかるか計算）
    def search(now, cost):
        if len(now) == len(l):
            _a = []
            _b = []
            _c = []
            for i in range(len(now)):
                if now[i] == 0:
                    _a.append(l[i])
                elif now[i] == 1:
                    _b.append(l[i])
                elif now[i] == 2:
                    _c.append(l[i])
            if not _a or not _b or not _c:
                return 10**10
            _cost = abs(a - sum(_a)) + abs(b - sum(_b)) + abs(c - sum(_c))
            _cost += (len(_a) - 1 + len(_b) - 1 + len(_c) - 1) * 10
            return _cost
        else:  # まだ分類していないl[i]がある場合
            for i in range(4):
                cost = min(cost, search(now+[i], cost))
            return cost
    cost = search([], 10**10)
    return cost

n, a, b, c = [int(i) for i in input().split()]
a, b, c = sorted([a, b, c])
l = []
for i in range(n):
    l.append(int(input()))
# print("a:{} b:{} c:{}".format(a, b, c))
# print("{}, {}, {}, {}, {}".format(n, a, b, c, sorted(l)))
print(func(n, a, b, c, l))
"""
print(func(5, 80, 90, 100, [21, 30, 40, 80, 98]))
print(func(8, 80, 90, 100, [80, 80, 80, 90, 90, 90, 100, 100]))
print(func(5, 100, 800, 1000, [300, 333, 400, 444, 500, 555, 600, 666]))
"""

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#ifdef _DEBUG
#define _GLIBCXX_DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

//#define int long long
// typedef __int128_t Int;
#define DBG 1
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define rrep(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define loop(n) rep(loop, (0), (n))
#define all(c) begin(c), end(c)
const int INF =
    sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
const double PI = acos(-1);
const double EPS = 1e-9;
template <class T> bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T> bool chmin(T &a, const T &b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}

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

  vector<vector<int>> c(3, vector<int>(3));
  rep(i, 0, 3) rep(j, 0, 3) { cin >> c[i][j]; }

  vector<int> p{0, 1, 2}, sum;
  do {
    int tmp = 0, tmp2 = 0;
    rep(i, 0, 3) {
      tmp += c[i][p[i]];
      tmp2 += c[p[i]][i];
    }
    sum.push_back(tmp);
    sum.push_back(tmp2);
  } while (next_permutation(all(p)));

  bool f = true;
  rep(i, 0, sum.size()) {
    if (sum[i] != sum[0])
      f = false;
  }

  cout << (f ? "Yes" : "No") << endl;

  return 0;
}


Measured memory_bytes: 256
function main(input) {
const N  = input.split(/\n|\s/g)[0]
let number = 0;
for(let i=1;i<=N;i++){
  if(i%2===0){continue;}
  let count = 0;
  for(let j=1;j<=i;j++){
    if(i%j===0){count++;}
  }
  if(count===8){number++;}
}
console.log(number)
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 7500
import java.io.BufferedReader;
import java.io.InputStreamReader;
public class Main {

	public static void main(String[] args) throws Exception{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int num = Integer.parseInt(br.readLine());

		long counter = 0;
		int amari = 0;
		for(int i = 0; i < num; i++){
			int A = Integer.parseInt(br.readLine());
			if(amari > 0 && A > 0){
				A += 1;
			}
			counter += A / 2;
			amari = A % 2;
		}
		System.out.println(counter);
	}
}

Measured memory_bytes: 31956
#include <iostream>
#include <algorithm>
using namespace std;
int main(void){
    // Your code here!
    long long N;
    long long max = 0;
    cin >> N;
    string s[N];
    long long count[N];
    for (long long i=0;i<N;i++){
        cin >> s[i];
        count[i] = 1;
        
        
    }
    sort(s,s+N);
    for(long long j=0;j<N-1;j++){
        if(s[j] == s[j+1]){
            count[j+1] = count[j] +1;
        }
        
    }
    for(long long l=0;l<N;l++){
        if(max < count[l]){
            max = count[l];
        }
    }
    for(long long k=0;k<N;k++){
        if(max == count[k]){
           
            cout << s[k] <<endl;
            
        }
      
    }
    
}


Measured memory_bytes: 15872
def train_ticket(A: int, B: int, C: int, D: int) -> str:
    # 演算子の組み合わせは高々 2^3 = 8 通りしかないので
    # 全探索で OK
    nums = [B, C, D]
    for i in range(1 << 3):
        s = A
        ans = str(A)
        for j in range(3):
            if i & 1 == 1:
                s += nums[j]
                ans += '+' + str(nums[j])
            else:
                s -= nums[j]
                ans += '-' + str(nums[j])
            i >>= 1

        if s == 7:
            return ans + '=7'
    return 'invalid test case'


if __name__ == "__main__":
    A, B, C, D = map(int, input())
    ans = train_ticket(A, B, C, D)
    print(ans)


Measured memory_bytes: 3064
#include "bits/stdc++.h"
// Begin Header {{{
#define all(x)          (x).begin(), (x).end()
#define rep(i, n)       for (i64 i = 0, i##_limit = (n); i < i##_limit; ++i)
#define reps(i, s, t)   for (i64 i = (s), i##_limit = (t); i <= i##_limit; ++i)
#define repr(i, s, t)   for (i64 i = (s), i##_limit = (t); i >= i##_limit; --i)
#ifndef DBG
#define trace(...)
#endif
using namespace std;
using i64 = int_fast64_t;
using pii = pair<i64, i64>;
template <class T, class U> inline bool chmax(T &a, const U &b) { return b > a && (a = b, true); }
template <class T, class U> inline bool chmin(T &a, const U &b) { return b < a && (a = b, true); }
constexpr int INF  = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;

template <class T>
inline vector<T> make_v(const T &initValue, size_t sz) {
    return vector<T>(sz, initValue);
}

template <class T, class... Args>
inline auto make_v(const T &initValue, size_t sz, Args... args) {
    return vector<decltype(make_v<T>(initValue, args...))>(sz, make_v<T>(initValue, args...));
}

inline void read() {}

template <class Head, class... Tail>
inline void read(Head &head, Tail&... tail) { cin >> head; read(tail...); }

inline void print() { cout << "\n"; }

template <class Head, class... Tail>
inline void print(Head &&head, Tail&&... tail) {
    cout << head;
    if (sizeof...(tail)) cout << ' ';
    print(forward<Tail>(tail)...);
}

template <class T>
inline ostream& operator<< (ostream &out, const vector<T> &vec) {
    static constexpr const char *delim[] = { " ", "" };
    for (const auto &e : vec) out << e << delim[&e == &vec.back()];
    return out;
}
// }}} End Header

signed main() {
    ios_base::sync_with_stdio(false); cin.tie(nullptr);

    int N, K;
    read(N, K);
    vector<i64> h(N);

    rep(i, N) {
        read(h[i]);
    }

    sort(all(h));
    trace(h);

    i64 ans = LINF;
    rep(i, N-K+1) {
        chmin(ans, h[i+K-1] - h[i]);
    }

    print(ans);

    return 0;
}


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

int main(){
    int a,b,c,d;
    while(cin>>a>>b>>c){

        if( a<=c && b<=c){
            d=a+b;
        }
        if( b<=a && c<=a){
            d=c+b;
        }
        if( a<=b && c<=b){
            d=a+c;
        }
        cout<<d<<endl;
    }


return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<math.h>
#include<vector>
#define rep(i,N) for(int i=0; i<N; i++)
using namespace std;

int main(){
    int D, T, S;
    cin >> D >> T >> S;
    if(D<=T*S){
        cout<<"Yes"<<endl;
    }else{
        cout << "No"<<endl;
    }
    
}

Measured memory_bytes: 3620
import bisect
n=int(input())
a=sorted([int(i) for i in input().split()])
b=sorted([int(i) for i in input().split()])
c=sorted([int(i) for i in input().split()])
ans=0
for i in range(n):
    small=bisect.bisect_left(a,b[i])
    big=n-bisect.bisect_right(c,b[i])
    ans+=small*big
print(ans)

Measured memory_bytes: 23156
#include <stdio.h>
#include <iostream>
#include <map>
using namespace std;

typedef pair<double, double> P;
bool isIn(P a, P b, P c, P p)
{
	P s1(b.first - a.first, b.second - a.second);
	P s2(c.first - b.first, c.second - b.second);
	P s3(a.first - c.first, a.second - c.second);
	P p1(p.first - a.first, p.second - a.second);
	P p2(p.first - b.first, p.second - b.second);
	P p3(p.first - c.first, p.second - c.second);
	double x = (s1.first * p1.second) - (s1.second * p1.first);
	double y = (s2.first * p2.second) - (s2.second * p2.first);
	double z = (s3.first * p3.second) - (s3.second * p3.first);

	if (x >= 0 && y >= 0 && z >= 0) return true;
	if (x <= 0 && y <= 0 && z <= 0) return true;
	return false;
}

int main()
{
	P pos[4];
	while (true)
	{
		for (int i = 0; i < 4; i++)
		{
			if (!(cin >> pos[i].first >> pos[i].second)) return 0;
		}
		if (isIn(pos[0], pos[1], pos[2], pos[3])) cout << "YES" << endl;
		else cout << "NO" << endl;
	}

	/*int n;
	int count = 0;
	P pos[100];*/

	/*while (true)
	{
		count = 0;
		scanf("%d", &n);
		if (n == 0) break;

		for (int i = 0; i < n; i++)
		{
			scanf("%lf,%lf", &(pos[i].first), &(pos[i].second));
		}
		for (int p = 0; p < n; p++)
		{
			bool flag = false;
			for (int a = 0; a < n; a++)
			{
				for (int b = 0; b < n; b++)
				{
					for (int c = 0; c < n; c++)
					{
						if (a == b || b == c || c == p) continue;
						if (isIn(pos[a], pos[b], pos[c], pos[p]))
						{
							count++;
							flag = true;
							break;
						}
					}
					if (flag) break;
				}
				if (flag) break;
			}
	}

		printf("%d\n", count);
	}*/
	return 0;
}

Measured memory_bytes: 1216
def main():
    n = int(input())
    a = list(map(int, input().split()))
    b = list(map(int, input().split()))
    ab = sorted([[a[i], b[i]] for i in range(n)], key=lambda x: x[1])

    base=[a for a,b in ab]
    #ini：上限（下限）,base：元の配列,monoid：モノイド,tree：セグ木,depth：treeの深さ,
    #basesize：baseの要素数,treesize：treeの要素数,num：treesize-basesize
    # 初期値（上限とか下限）を決定
    ini=10**9+1
    #セグ木の要素数（num）および深さ（depth）を計算
    basesize=len(base)
    num,depth=1,1
    while num<basesize:
        num*=2
        depth+=1
    num-=1
    #関数（モノイド、今回はmin）を設定
    monoid=min
    #セグ木を構築
    treesize=num*2+1
    tree=[None]*treesize
    #segtree[m]以降に代入したい配列を入力していく
    for i in range(num,num+basesize):tree[i]=base[i-num]
    for i in range(num+basesize, treesize):tree[i]=ini
    #segtree[m]以降の情報を使って、0に向かってセグ木を構築していく
    for i in range(num-1,-1,-1):
        tree[i]=monoid(tree[2*i+1],tree[2*i+2])
    
    #条件を満たす(サンプルの条件はs以下になること)最大のインデックスを返す関数
    def max_index(index_func):
        #探していく
        i=0
        while i<num:
            k=2*i+1
            if index_func(tree[k+1]):
                i=k+1
                continue
            if index_func(tree[k]):
                i=k
                continue
            return -1
        return i-num

    #条件を満たす(サンプルの条件はs以下になること)最小のインデックスを返す関数
    def min_index(index_func):
        #探していく
        i=0
        while i<num:
            k=2*i+1
            if index_func(tree[k]):
                i=k
                continue
            if index_func(tree[k+1]):
                i=k+1
                continue
            return -1
        return i-num

    #半開区間[lower,upper)の最小値（とか）を探す関数
    def search(lower,upper):
        #返り値を初期化
        ret=ini
        l=lower+num
        r=upper+num
        while l<r:
            if r%2==0:
                r-=1
                ret=monoid(ret,tree[r])
            if l%2==0:
                ret=monoid(ret,tree[l])
                l+=1
            l//=2
            r//=2
        return ret

    #base[i]をsに更新したときにセグ木全体を更新する関数
    def update(index,new_value):
        i=index+num
        tree[i]=new_value
        while i!=0:
            i=(i-1)//2
            temp=monoid(tree[2*i+1],tree[2*i+2])
            if tree[i]!=temp:
                tree[i]=temp
                continue
            break
    
    cnt = 0
    for i in range(n):
        a,b=ab[i][0],ab[i][1]
        if a > b:
            t = max_index(lambda x:x<=b)
            if t <= i:
                print("No")
                return 0
            update(i, a)
            update(t, a)
            ab[i][0], ab[t][0] = ab[t][0], a
            cnt+=1
    if cnt <= n - 2:
        print("Yes")
    else:
        print("No")
main()

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

int main(){
  long long N,K,Q;
  cin >> N >> K >> Q;
  vector<long long> vec(N);
  for(int j=0;j<Q;j++){
    long long X;
    cin >> X;
    vec[X-1]++;
  }
  for(int k=0;k<N;k++){
    if(vec[k]+K>Q)
      cout << "Yes" << endl;
    else
      cout << "No" << endl;
  }
}

Measured memory_bytes: 1536
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
d = LIST()

d.sort()
print(d[N//2]-d[N//2-1])


Measured memory_bytes: 15956
// オイラーのφ関数
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<stack>
#include<algorithm>
#include<iostream>
#include<cmath>
#include<cassert>

#include<vector>
#include<queue>
#include<set>

using namespace std;

// 指数形式を表現するための構造体
typedef struct Exp
{
   int radix;   // 基数
   int exp; // 指数
}E_NORATION;

int EulerPhiFunction(int n);
bool isPrime(int x);
void PrimeFactorization(int num, vector<E_NORATION> &v_pFactor);

int main(void)
{
    int n;

    cin >> n;

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

    return 0;
 }

// -----------------------------------------------------
// http://www.mathlion.jp/article/ar042.html を参考に作成
// -----------------------------------------------------

// オイラーのφ関数を実行する関数
// n : ターゲットとなる数
int EulerPhiFunction(int n)
{
    vector<E_NORATION> v_primeF;
    int result = 1;
    double d_radix, d_exp;

	if( isPrime(n) == true )
	{
		// n 自体が素数なのかを調べる
		// n が素数なら, 素となるものの個数は, n - 1個になる
		return n - 1;
	}

    // 素因数分解を実施する
    PrimeFactorization(n, v_primeF);

    for(int i = 0; i < v_primeF.size(); i++)
    {
        d_radix = (double)v_primeF[i].radix;
        d_exp = (double)v_primeF[i].exp;
 		// n と互いに素なものの個数を求める
        result *= pow(d_radix, d_exp) -  pow(d_radix, d_exp - 1);
    }

    return result;
}

// 素因数分解を実施する関数
// num       : 素因数分解の対象
// v_pFactor : 素因数分解の結果を格納するvector
void PrimeFactorization(int num, vector<E_NORATION> &v_primeF)
{
    int quotient, count;
    E_NORATION factor;

    quotient = num;

    for(int i = 2; i <= num; i++)
    {
        count = 0;

        if( isPrime(quotient) == true )
        {
            // ----------------------------------
            // 素因数分解をした結果が素数になっている時
            // ----------------------------------

            factor.radix = quotient;
            factor.exp = 1;
            v_primeF.push_back(factor);

            quotient = 1;
        }
        else
        {
            // ------------------------------
            // 素因数分解をした結果が素数でない時
            // ------------------------------

            if( isPrime(i) == true )
            {
                // 素数が見つかったら, 可能な限り割り算をする
                while( quotient % i == 0 )
                {
                    quotient = quotient / i;
                    count++;
                }

                if( count > 0 )
                {
                    // 素因数が見つかったら格納する
                    factor.radix = i;
                    factor.exp = count;
                    v_primeF.push_back(factor);
                }
            }
        }

        if( quotient == 1 )
        {
            // 割り切れたら処理を終了する
            break;
        }
    }

    return;
}

 // x が素数かを判定する関数
 // x  : 判定する数
 bool isPrime(int x)
 {

    int i;

    if( x < 2 )
    {
        return false;
    }
    else if( x == 2 )
    {
        // 2は素数
        return true;
    }
    else if( x % 2  == 0 )
    {
        // 偶数は素数で無い
        return false;
    }

    // 素数を求める範囲は、xの平方根の範囲までで十分
    // 奇数のみ探索する
    for( i = 3; i * i <= x; i = i + 2 )
    {
        if( x % i == 0 )
        {
            // 割れる数が見つかれば素数では無い
            return false;
        }
    }

    return true;
 }



Measured memory_bytes: 3416