akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define REP(i,b,e) for(int i=(b);i<(e);++i)
#define rep(i,e) for(int i=0;i<(e);++i)

int main() {
  int b;
  while(cin >> b){
    if(b==0) return 0;
    for(long long n=100000; n>0; n--){
      long long t = n*(n-1)/2;
      if((b-t)%n==0 && (b-t)/n>0){
        cout << (b-t)/n << " " << n << endl;
        break;
      }
    }
  }
  return 0;
}


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

int main(){
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	using ll = long long;
	ll n, m, v, p;
	cin >> n >> m >> v >> p;
	ll kv = n - v;
	vector<ll> a(n);
	for(int i = 0; i < n; i++){
		cin >> a[i];
	}
	sort(a.begin(), a.end());
	ll s = -1; // can't
	ll e = n; // can
	while(s + 1 < e){
		ll mid = (s + e) / 2;
		if(mid >= n-p){
			e = mid;
			continue;
		}
		vector<ll> need;
		for(ll i = mid + 1; i <= n-p; i++) need.push_back(a[i] - a[mid]);
		bool works = true;
		reverse(need.begin(), need.end());
		ll cc = 0;
		for(ll i = 0; i < (int)need.size(); i++){
			cc += need[i];
			if(cc > m * min(kv, i+1)) works = false;
		}
		if(works){
			e = mid;
		} else {
			s = mid;
		}
	}
	cout << n - e << '\n';
}

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

using namespace std;
typedef long long ll;

#define rep(i, N) for (int i = 0; i < (int)N; i++)
const ll MOD = pow(10,9)+7;
const ll LLINF = pow(2,61)-1;
const int INF = pow(2,30)-1;


int main() {
  int N; cin >> N;
  double v[N]; rep(i,N) cin >> v[i];
  sort(v,v+N);
  double result = v[0];
  rep(i,N-1) result = (result+v[i+1])/2;
  cout << result << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
using namespace std;
bool good(vector<int> &v, int index){
	int a = (index-1+v.size())%v.size(), b = index, c = (index+1)%v.size();
	return (v[b] > v[a] + v[c]);
}
int ans=0;
void des(vector<int> &v, int index, int border){
	int a = (index-1+v.size())%v.size(), b = index, c = (index+1)%v.size();
	int sum = v[a] + v[c];
	int delta = v[index]-border;
	ans += delta/sum;
	v[b] -= sum * (delta/sum);
}
signed main() {
	#ifdef LOCAL
		freopen("H_input.txt", "r", stdin);
		//freopen("C_output.txt", "w", stdout);
	#endif
    ios_base::sync_with_stdio(0); cin.tie(0);
    int n;
    cin >> n;
    vector<int> a(n), b(n);
    for (int i=0; i < n; i++) cin >> a[i];
    for (int i=0; i < n; i++) cin >> b[i];
    for (int i=0; i < n; i++){
    	if (b[i] < a[i]){
    		cout << -1;
    		return 0;
    	}
    }
   	queue<int> q;
   	for (int i=0; i < n; i++){
   		if (a[i] == b[i]) continue;
   		if (good(b, i)) q.push(i);
   	}
   	while (q.size()){
   		int V = q.front();
   		q.pop();
   		des(b, V, a[V]);
   		if (a[V] > b[V]){
   			cout << -1;
   			return 0;
   		}
   		int T = (V-1+n)%n, Q = (V+1)%n;
   		if (a[T] != b[T] && good(b, T)) q.push(T);
   		if (a[Q] != b[Q] && good(b, Q)) q.push(Q);
   	}
   	for (int i=0; i < n; i++){
   		if (a[i] != b[i]){
   			cout << -1;
   			return 0;
   		}
   	}
   	cout << ans;
}

Measured memory_bytes: 4224
def test(n):
  m = 0
  if n == 3:
    m += 100000
  elif n == 2:
    m += 200000
  elif n == 1:
    m += 300000
  return m

x, y = map(int, input().split())
ans = test(x) + test(y)
if ans == 600000:
  ans += 400000

print(ans)

Measured memory_bytes: 3060
using System;

public class Test
{
	public static void Main()
	{
		// your code goes here
		int i = 1;
		var n = int.Parse(Console.ReadLine());
		
		while(n!= 0){
			Console.WriteLine(string.Format("Case {0}: {1}", i++, n) );
			n = int.Parse(Console.ReadLine());
		}
		
		/*string[] s = Console.ReadLine().Split(' ');
		int[] n = new int[s.Length];
		for(int i = 0; i < s.Length; i++) {
			n[i] = int.Parse(s[i]);
		}
		
		var W = n[0];
		var H = n[1];
		var x = n[2];
		var y = n[3];
		var r = n[4];
		
		if( ( (x-r) >= 0 ) && ( (y-r) >= 0 ) &&
			( (x+r) <= W ) && ( (y+r) <= H ) ){
			Console.WriteLine("Yes");
		} else {
			Console.WriteLine("No");
		}*/

	}
}

Measured memory_bytes: 9320
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		//List<String> list= new ArrayList<String>(Arrays.asList(s.split("")));
		//List<Integer> list=new ArrayList<Integer>();
		//Integer[] array = new Integer[m];
		int n = sc.nextInt();
		String s = sc.next();
		List<String> list_al=new ArrayList<String>();
		list_al.add("A");
		list_al.add("B");
		list_al.add("C");
		list_al.add("D");
		list_al.add("E");
		list_al.add("F");
		list_al.add("G");
		list_al.add("H");
		list_al.add("I");
		list_al.add("J");
		list_al.add("K");
		list_al.add("L");
		list_al.add("M");
		list_al.add("N");
		list_al.add("O");
		list_al.add("P");
		list_al.add("Q");
		list_al.add("R");
		list_al.add("S");
		list_al.add("T");
		list_al.add("U");
		list_al.add("V");
		list_al.add("W");
		list_al.add("X");
		list_al.add("Y");
		list_al.add("Z");
		List<String> list= new ArrayList<String>(Arrays.asList(s.split("")));
		for(int i=0;list.size()>i;i++) {
			int a = list_al.indexOf(list.get(i));
			int go = a+n;
			if(go>25)
				go=go-26;
			list.set(i, list_al.get(go));
		}
		for(int i=0;list.size()>i;i++) {
			System.out.print(list.get(i));
		}

	}
}

Measured memory_bytes: 25192
#include<bits/stdc++.h>
using namespace std;
int main() {
  int N, X; cin >> N >> X;
  vector<int> m(N);
  for(int i = 0; i < N; i++) {
    cin >> m.at(i);
    X -= m.at(i);
  }
  sort(m.begin(), m.end());
  N += (X / m.at(0));
  cout << N << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main () {
  int N;
  cin >> N;
  string S;
  cin >> S;
  vector<int>E(N + 1);
  vector<int>W(N + 1);
  W[0] = 0;
  E[N] = 0;
  for (int i = 0; i < N; i ++) {
    W[i + 1] = W[i];
    E[N - i - 1] = E[N - i];
    if (S[i] == 'W') W[i + 1] ++;
    if (S[N - i - 1] == 'E') E[N - i - 1] ++;
  }
  int ans = N + 5;
  for (int i = 0; i < N; i ++) {
    ans = min(ans, W[i] + E[i + 1]);
  }
  cout << ans << endl;
}


Measured memory_bytes: 3076
#include <bits/stdc++.h>
using namespace std;
int main()
{
	vector<int> arr;
	for(int i=1;i<=10;i++)
	{
		int a;
		cin>>a;
		arr.push_back(a);
	}
	sort(arr.begin(),arr.end());
	cout<<arr[arr.size()-1]<<endl;
	cout<<arr[arr.size()-2]<<endl;
	cout<<arr[arr.size()-3]<<endl;
	return 0;
}


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

using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int h,w;
queue<P> que;
bool flag[200][200];
int cnt[200][200];
int ans;

void func(int ni,int nj){
	if(ni > h+2 || nj > w+2) return;
	flag[ni][nj] = true;
	que.push(P(ni,nj));
	ans += cnt[ni][nj];
	return;
}

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

	cin >> w >> h;

	int s[200][200];

	for (int i = 1;i <= h;i++){
		for (int j = 1;j <= w;j++){
			cin >> s[i][j];
		}
	}

	memset(cnt,0,sizeof(cnt));

	for (int i = 0;i <= h+1;i++){
		for (int j = 0;j <= w+1;j++){
			if(s[i][j] == 0){
				if(i>0 && s[i-1][j] == 1) cnt[i][j]++;
				if(j>0 && s[i][j-1] == 1) cnt[i][j]++;
				if(s[i][j+1] == 1) cnt[i][j]++;
				if(s[i+1][j] == 1) cnt[i][j]++;
				if(i%2 == 1){
					if(i>0 && s[i-1][j+1] == 1) cnt[i][j]++;
					if(s[i+1][j+1] == 1) cnt[i][j]++;
				}else if(j > 0){
					if(i > 0 && s[i-1][j-1] == 1) cnt[i][j]++;
					if(s[i+1][j-1] == 1) cnt[i][j]++;
				}
			}
		}
	}

	memset(flag,0,sizeof(flag));

	que.push(P(0,0));
	flag[0][0] = true;
	ans = 0;

	while(que.size()){
		P p = que.front(); que.pop();
		int i = p.first, j = p.second;
		if(s[i][j] == 0){
			if(i > 0 && s[i-1][j] != 1 && !flag[i-1][j]) func(i-1,j);
			if(j > 0 &&s[i][j-1] != 1 && !flag[i][j-1]) func(i,j-1);
			if(s[i][j+1] != 1 && !flag[i][j+1]) func(i,j+1);
			if(s[i+1][j] != 1 && !flag[i+1][j]) func(i+1,j);
			if(i%2 == 1){
				if(i > 0 && s[i-1][j+1] != 1 && !flag[i-1][j+1]) func(i-1,j+1);
				if(s[i+1][j+1] != 1 && !flag[i+1][j+1]) func(i+1,j+1);
			}else if(j > 0){
				if(i > 0 && s[i-1][j-1] != 1 && !flag[i-1][j-1]) func(i-1,j-1);
				if(s[i+1][j-1] != 1 && !flag[i+1][j-1]) func(i+1,j-1);
			}
		}
	}

	cout << ans << endl;

	return 0;

}



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

	public static void main(String[] args) {
		Scanner scanner=new Scanner(System.in);
		int N=scanner.nextInt();
		int[]arr=new int[N];
		for(int index=0;index<N;index++) {
			arr[index]=scanner.nextInt();
		}
		float sum=0;
		for(int value:arr) {
			sum+=1.0/value;
		}
		System.out.println(1.0*Math.round(100000/sum)/100000);
	}
}

Measured memory_bytes: 21844
#define ll long long
#define ffor(i,a,b) for (int i=(a);i<(b);i++)
#define rfor(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define rep(i,n) for (int i=0;i<(n);i++)
#define rrep(i,n) for (int i=(n)-1;i>=0;i--)
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<cmath>
#include<string>
#include<stack>
#include<queue>
#include<vector>
#include<map>
#define SIZE 100001
#define MOD 1000000007
#define INF 100000000
using namespace std;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int r,g,b;
	cin >> r >> g >> b;

	int ans = r*100+g*10+b;

	if(ans % 4 == 0) cout << "YES" << endl;
	else cout << "NO" << endl;


	return 0;
}

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

using namespace std;
using namespace __gnu_pbds;
 
#define fi first
#define se second
#define mp make_pair
#define pb push_back
 
typedef long long ll;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef unsigned long long ull;
typedef long double ld; 
typedef tree<ii, null_type, less<ii>, rb_tree_tag, tree_order_statistics_node_update> pbds;

int mat[777][777];
int visited[777];
vector<vi> C;
int n,m; 

void dfs(int u, vi &v, int col)
{
	visited[u]=col; v[col]++;
	for(int i=0;i<n;i++)
	{
		if(i==u) continue;
		if(!mat[i][u]) continue;
		if(visited[i]>=0)
		{
			if(visited[i]!=(col^1)){cout<<-1<<'\n'; exit(0);}
		}
		else
		{
			dfs(i,v,col^1);
		}
	}
}

typedef bitset<888> b100;
b100 B;

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	cin>>n>>m; memset(visited,-1,sizeof(visited));
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<n;j++)
		{
			if(i!=j) mat[i][j]=1;
		}
	}
	for(int i=0;i<m;i++)
	{
		int u,v; cin>>u>>v; u--; v--;
		mat[u][v]=mat[v][u]=0;
	}
	for(int i=0;i<n;i++)
	{
		if(visited[i]==-1)
		{
			vi v={0,0};
			dfs(i,v,0);
			C.pb(v);
		}
	}
	B.reset();
	B.set(0,1);
	for(int i=0;i<C.size();i++)
	{
		B=(B<<C[i][0])|(B<<C[i][1]);
	}
	int ans=int(1e9);
	for(int i=0;i<=n;i++)
	{
		if(B[i])
		{
			ans=min(ans,(i*(i-1))/2 + ((n-i)*(n-i-1))/2);
		}
	}
	cout<<ans<<'\n';
}


Measured memory_bytes: 2432
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,i,j,k;
    cin>>n;
    int a[n+2];
    int cnt=0;
    for(i=1;i<=n;i++)
    {
        cin>>a[i];
    }
    for(i=1;i<=n;i+=2)
    {
        if(a[i]%2!=0)
            {j=a[i]*a[i];
        if(j%2!=0)
            cnt++;}
    }
    cout<<cnt<<endl;
}


Measured memory_bytes: 3636
#include <iomanip>
#include <iostream>
#include <vector>

int main()
{
    int n , res{};
    std :: cin >> n;

    std :: vector < int > serial(n , 0) , satPoints(n , 0) , addSatPoints(n - 1 , 0);

    for(int i = 0 ; i < n ; i++)
        std :: cin >> serial.at(i);
    for(int j = 0 ; j < n ; j++)
        std :: cin >> satPoints.at(j);
    for(int i = 0 ; i < n - 1 ; i++)
        std :: cin >> addSatPoints.at(i);

    res += satPoints.at(serial.at(0) - 1);
    for(int i = 1 ; i < n ; i++)
    {
        res += satPoints.at(serial.at(i) - 1);
        if(serial.at(i) - 1 == serial.at(i - 1))
            res += addSatPoints.at(serial.at(i - 1) - 1);
    }

    std :: cout << res << '\n';
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <algorithm>
#include <map>
#include <cmath>
#include <numeric>
#include <list>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <tuple>

#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i <= (n); i++)
#define show(a, n) rep(i,n) {cout<<a[i]<<' ';} cout<<endl;

using namespace std;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef long long ll;
typedef pair<long long, long long> pll;

const int INF = 1 << 30;
const long long INFL = 1LL << 62;
const int MOD = 1000000007;
const int MAX = 100000;
const int N = 100010;

struct BIT {
    int n;
    vi bit;
    BIT(int num):bit(num+1,0){n=num;}
    void add(int i, int w){
        for(int x=i; x<=n; x+=x&-x) {bit[x]+=w; }
    }
    int sum(int i){
        int ret=0;
        for(int x=i; x>0; x-=x&-x) ret+=bit[x];
        return ret;
    }
    int sum(int l, int r){return sum(r)-sum(l);}
};

int main() {
//	cout << fixed << setprecision(15);
	int n;
	cin >> n;
	string s;
	cin >> s;
	int q;
	cin >> q;

	BIT tree[26] = {
		BIT(n + 10), BIT(n + 10), BIT(n + 10), BIT(n + 10), BIT(n + 10), BIT(n + 10), BIT(n + 10), BIT(n + 10), BIT(n + 10), BIT(n + 10), 
		BIT(n + 10), BIT(n + 10), BIT(n + 10), BIT(n + 10), BIT(n + 10), BIT(n + 10), BIT(n + 10), BIT(n + 10), BIT(n + 10), BIT(n + 10), 
		BIT(n + 10), BIT(n + 10), BIT(n + 10), BIT(n + 10), BIT(n + 10), BIT(n + 10)
	};

	rep(i, n) {
		tree[s[i] - 'a'].add(i + 1, 1);
	}

	vi ans;
	rep(i, q) {
		int op;
		cin >> op;
		if(op == 1) {
			int j;
			char c;
			cin >> j >> c;
			tree[s[j - 1] - 'a'].add(j, -1);
			tree[c - 'a'].add(j, 1);
			s[j - 1] = c;
		}
		else if(op == 2) {
			int l, r;
			cin >> l >> r;
			int a = 0;
			rep(j, 26) {
				if(tree[j].sum(l - 1, r) >= 1) a++;
			}
			ans.push_back(a);
		}
	}

	for(int i = 0; i < ans.size(); i++) {
		cout << ans[i] << endl;
	}
	return 0;
}


Measured memory_bytes: 51844
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
        long long int n;
        cin >> n;
       if(n==0) {
                cout << 0<<endl;
                return 0;
        }
        vector <int> v;
        while(1) {
                if(n==0) break;
                if(n%(-2)!=0) {
                        v.push_back(1);
                        if(n%(-2)<0) n--;
                }
                else{
                  v.push_back(0);
                }
                n/=(-2);
        }
        reverse(v.begin(),v.end());
        for(int i=0;i<v.size();i++){
         cout << v[i];
       }
       cout <<endl;
    }


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <string>
#include <utility>
#include <vector>
#include <algorithm>
#include <queue>
using namespace std;
typedef long long int ll;

int main() {
  int N;
  int i = 0;
  cin >> N;
  while (i * 1000 < N) i++;
  cout << i * 1000 - N << endl;
  return 0;
}


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


#define INF 1000000000000


signed main()
 {
string s;
cin>>s;
vector<int>a(2019);
int t=1;
int c=0;
a[c]++;
rep(i,s.size()){
  c=(c+(s[s.size()-i-1]-'0')*t)%2019;
  t=(t*10)%2019;
  a[c]++;
}
int ans=0;
rep(i,2019){ans+=a[i]*(a[i]-1)/2;}
cout<<ans;
}


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

int main() {
  int n,a,b;
  cin >>n>>a>>b;

  if (a*n<b) {
    cout << a*n << endl;
  }
  else if (a*n>b) {
    cout << b << endl;
  }
  else {
    cout << b << endl;
  }
}

Measured memory_bytes: 256
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <map>
#include <set>
using namespace std;

#define INF (1ll<<60)


long long M = 1000000007;


int main(int argc, char const *argv[]) {
    long long n;cin>>n;
    vector<int> b;
    while(n>0){
        b.push_back(n%10);
        n/=10;
    }
    int d = b.size();
    int res = 0;
    for(int i:b)res+=i;
    res = max(res,9*(d-1)+b[d-1]-1);
    cout<<res<<endl;
    return 0;
}

Measured memory_bytes: 256
//includes
#include<iostream>
#include<vector>
#include<set>
#include<tuple>
#include<algorithm>
#include<cmath>
#include<string>
#include<stack>
#include<map>
#include<queue>
#include<iomanip>
#include<numeric>
#include<assert.h>
#include<cstring>
#include<unordered_map>
#include<bitset>

//macros and consts
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define all(a) (a).begin(),(a).end()
#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define FORE(i,a) for(auto &i : a)
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define accm accumulate
#define Fi first
#define Se second
#define INF 1e9
#define llINF (1LL<<60)
#define mINF -1e9
#define mllINF -(1LL<<60)
#define endl "\n"
#define CONT continue
#define BRK break
#define modulo(n, m) (((n)%(m)+(m))%m)

//shorter types
using namespace std;
using ll = long long;
using vi = std::vector<int>;
using vc = std::vector<char>;
using vll = std::vector<long long>;
using vs = std::vector<string>;
using Mi = map<int,int>;
using Mll = map<ll,ll>;
using UMi = unordered_map<int,int>;
using UMll = unordered_map<ll,ll>;
using Pi = pair<int,int>;
using Pll = pair<ll,ll>;
using vPi = vector<Pi>;
using vPll = vector<Pll>;
using vvi = vector<vector<int>>;
using vvll = vector<vector<ll>>;
using vvc = vector<vector<char>>;
using vvs = vector<vector<string>>;
using pqgi = priority_queue<int,vector<int>,greater<int>>;
using pqsi = priority_queue<int,vector<int>,less<int>>;
using pqgll = priority_queue<int,vector<int>,greater<int>>;
using pssll = priority_queue<int,vector<int>,less<int>>;
template<class T>
using vec = vector<T>;
#define int long long

int N,M;
vector<int> A;
bool check(int x){
	int sum = 0;
	for(int i = 0 ; i < N ; i++){
		int over = lower_bound(all(A), x - A[i]) - A.begin();
		sum += (N - over);
	}
	return sum < M;
}
//here begins your code
signed main(){
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  cin >> N >> M;

  A.resize(N);
  for(int i = 0 ; i < N ; i++){
  	cin >> A[i];
  }
  sort(all(A));

  int ng = 0, ok = llINF;
  while(abs(ok - ng) > 1){
  	int mid = (ok + ng) >> 1;
  	if(check(mid)) ok = mid;
  	else ng = mid;
  }
  vector<int> wa(N + 1);
  for(int i = 0 ; i < N ; i++){
 	wa[i + 1] = wa[i] + A[i];
  }
  int ans = 0;
  for(int i = 0 ; i < N ; i++){
  	int pos = upper_bound(A.begin(),A.end(),ng - A[i]) - A.begin();
  	int cnt = N - pos;
  	ans += cnt * A[i] + (wa[N] - wa[pos]);
  	M -= cnt;
  }
  ans += M * ng;
  cout << ans << endl;
  //check types
  //do not eb if you resize
  //resize before you access by idx
  return 0;
} 

Measured memory_bytes: 1920
#include <stdio.h>
#include <math.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <queue>
#include <map>
#include <utility>
#include <iomanip>

using namespace std;

#define ll long long

void solve()
{
    ll N, M;
    cin >> N >> M;
    cout << ((N == M) ? "Yes" : "No") << endl;
}

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


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

#define mp make_pair
#define pb push_back
#define rep(i, n) for(int i = 0; i < n; ++i)
#define repn(i, n) for(int i = 1; i < n; ++i)
#define repm(i, n, m)  for(int i = n; i < m; ++i)
#define Repm(i, n, m)  for(int i = n; i <= m; ++i)
#define mod 1000000000+7

int main(){
    string a, b; cin >> a >> b;
    sort(a.begin(), a.end());
    sort(b.begin(), b.end());
    reverse(b.begin(), b.end());


    if(a < b){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <tuple>
#include <numeric>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 100010;

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

    vl p(n);
    vl rui(n+1);  // rui[i+1] : p[i]までの和
    rep(i, n) {
        cin >> p[i];
        rui[i+1] = rui[i] + p[i];
    }

    ll u = 0;
    rep(i, n-k+1) {
        chmax(u, rui[i+k] - rui[i]);
    }

    double ans = ((double)u + (double)k) / 2.0; 

    exout(ans);
    re0;
}

Measured memory_bytes: 3328
#include<cstdio>
#include<algorithm>
#include<cstring>
#define rep(i,s,t) for(register int i=s;i<=t;++i)
#define _rep(i,s,t) for(register int i=s;i>=t;--i)
using namespace std;
const int N=4003,mod=998244353;
int f[N][N]; 
char s[N];
int a[N],b[N];
int main(){
	scanf("%s",s+1);
	int n=strlen(s+1);
	f[0][0]=1;
	rep(i,1,2*n){
		a[i]=a[i-1],b[i]=b[i-1];
		if(s[i]=='0')a[i]+=2;
		if(s[i]=='1')++a[i],++b[i];
		if(s[i]=='2')b[i]+=2;
		rep(j,0,a[i-1]){
			if(i-j<=b[i])
				f[i][j]=(f[i][j]+f[i-1][j])%mod;
			if(j+1<=a[i])
				f[i][j+1]=(f[i][j+1]+f[i-1][j])%mod;
		}
	}
	printf("%d\n",f[n+n][a[n]]);
	return 0;
}

Measured memory_bytes: 61312
#include <iostream>
#include <algorithm>
#include <string>
#include <math.h>
#include <queue>


using namespace std;

template<class T> inline bool chmin(T& a, T b) {
  //aの方が大きければ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;
}
const int INF = 1e9;



int main(){
  int n,k;
  cin >> n >> k;
  int h[n];
  int i,j;
  for(i=0;i<n;i++) cin >> h[i];

  int dp[1000000];
  for(i=0;i<1000001;i++) dp[i] = INF;

  dp[0] = 0;
  for(i=0;i<n;i++){
    for(j=1;j<k+1;j++){
      chmin(dp[i+j],dp[i]+abs(h[i]-h[i+j]));
    }
  }

  cout  << dp[n-1] << endl;





}


Measured memory_bytes: 4480
#include <iostream>
#include <vector>
#include <queue>
#include <iomanip>

int main()
{
    int countDice = 0;
    std::cin >> countDice;

    int selectCount = 0;
    std::cin >> selectCount;

    std::vector<int> diceMax;
    diceMax.resize(countDice);
    for (auto& val : diceMax)
    {
        std::cin >> val;
        ++val;  // +1すると本来計算したい期待値の/2前の値となる
    }

    int maxExpected = 0;
    int currentExpected = 0;
    std::queue<int> currentElements;
    for (const auto &val : diceMax)
    {
        currentElements.push(val);
        currentExpected += val;
        if (currentElements.size() > selectCount)
        {
            currentExpected -= currentElements.front();
            currentElements.pop();
        }

        if (currentElements.size() == selectCount)
        {
            if (maxExpected < currentExpected)
            {
                maxExpected = currentExpected;
            }
        }

    }

    auto answer = maxExpected / 2.0;
    std::cout << std::setprecision(13) << answer;
    return 0;
}

Measured memory_bytes: 1792
#include<stdio.h>
int main()
{
	int a,b,c;
	while(~scanf("%d%d%d",&a,&b,&c))
	{
		if(a==5&&b==5&&c==7)
		printf("YES\n");
		else if(a==5&&b==7&&c==5)
		printf("YES\n");
		else if(a==7&&b==5&&c==5)
		printf("YES\n");
		else
		printf("NO\n");
	}
	return 0;
}

Measured memory_bytes: 128
import math

a,b = [int(x) for x in input().split()]

ma = int(a//0.08)
mb = int(b//0.1)


fmindi = False
mindi = 9999999999999

for x in range(min(ma,mb),max(ma,mb)+2):
    j = math.floor(x*0.08)
    e = math.floor(x*0.1)
    if j == a and e == b:
        fmindi = True
        mindi = min(mindi,x)

print(mindi if fmindi else -1)


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

int N;
int A[20],x[20][20],y[20][20];

bool kensa(int bit){
    for(int i = 0; i < N; i++) {
        if (!(bit & (1 << i))) continue;
        if (bit & (1 << i)){
            rep(j,A[i]){
                if (y[i][j] == 1 && !(bit & (1 << x[i][j]))) return false;
                if (y[i][j] == 0 && (bit & (1 << x[i][j]))) return false;
            }
        }
    }
    return true;
}

int main(){
    cin >> N;
    rep(i,N){
        cin >> A[i];
        rep(j,A[i]){
            cin >> x[i][j] >> y[i][j];
            x[i][j]--;
        }
    }
    int ans = 0;
    for(int bit = 0; bit < (1 << N); bit++){
        if (kensa(bit)){
            int cnt = 0;
            for(int i = 0; i < N; i++){
                if (bit & (1 << i)) cnt++;
            }
            ans = max(ans,cnt);
        }
    }

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

Measured memory_bytes: 256
// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools

#include <bits/stdc++.h>

using namespace std;

using i64 = long long;

const i64 MOD = 1e9 + 7;
const i64 INF = i64(1e18) + 7;


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

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


void solve(long long n, std::vector<long long> p){
    i64 m = p.front();
    int ans = 0;
    for(int i = 0; i < n; ++i){
        chmin(m, p[i]);
        ans += (p[i] <= m);
    }
    cout << ans << endl;
}


signed main(){
    long long N;
    scanf("%lld",&N);
    std::vector<long long> P(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&P[i]);
    }
    solve(N, std::move(P));
    return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, o, n) for (auto i = (o); (i) < (n); ++(i))
#define FOR1(i, n) FOR(i, 1, n+1)
#define REP(i, n) FOR(i, 0, n)
#define REPR(i, n) for (auto i = (n)-1; (i) >= 0; --i)
#define REPI(itr, v) for (auto itr = v.begin(); itr != v.end(); ++itr)
#define REPIR(itr, v) for (auto itr = v.rbegin(); itr != v.rend(); ++itr)
#define fi first
#define se second
#define ll long long
#define int long long
#define V2(name, h, w) vector<vector<int> > name((h), vector<int>(w));

#define dl(line) cerr << "RUN: until " << (line) << "th line." << endl
#define dv(name, value) cerr << (name) << " is " << (value) << endl
#define da(v)  cerr << "["; REPI(itr, v){cerr << *itr << (itr != --v.end() ? ", " : "");} cerr << "]" << endl

const string YES = "Yes";
const string NO = "No";

void solve(long long K, long long X){
  cout << (K * 500 >= X ? YES : NO) << endl;
}

signed main(){
  long long K;
  scanf("%lld",&K);
  long long X;
  scanf("%lld",&X);
  solve(K, X);
}


Measured memory_bytes: 256
s=input()
l=len(s)

ans='AC'
c=0
cp=0
if s[0]!='A':
  ans='WA'
for i in range(2, l-1):
  if s[i]=='C':
    c+=1
    cp=i
if c!=1:
  ans='WA'
ls = s[1:cp] + s[cp+1:l]

if not ls.islower():
  ans='WA'
print(ans)

Measured memory_bytes: 3064
import copy
N = int(input())
S = input()
stack = []
ans = copy.deepcopy(S)
for s in S:
    if s == ")":
        if len(stack) > 0 and stack[-1] == "(":
            stack.pop()
        else:
            ans = "(" + ans
    elif s == "(":
        stack.append(s)
for _ in range(len(stack)):
    ans = ans + ")"
print(ans)

Measured memory_bytes: 3444
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define endl '\n'
#ifndef FAST_IO
 #define IOS ios_base::sync_with_stdio(false),cin.tie(nullptr);
#endif
#define all(c) c.begin(),c.end()
template<typename T>void print(T t){for(auto &it:t)cout<<it<<" ";cout<<endl;}
void solve(){
  int a,b;
  cin>>a>>b;
  if(a<=8 and b<=8)cout<<"Yay!"<<endl;
  else cout<<":("<<endl;
}
int32_t main(){
  IOS;
  solve();
  #ifdef LOCAL_DEFINE
  cerr<<"time elapsed "<<(double)clock()/LCOKS_PER_SEC<<endl;
  #endif
}

Measured memory_bytes: 256
import java.io.*;
import java.util.*;

class Main{
    public static void main(String[] args){
	BufferedReader sc=new BufferedReader(new InputStreamReader(System.in));
	try {
	    int n = Integer.valueOf(sc.readLine());
	    for(int i=0; i<n; i++){
		char[] c = sc.readLine().toCharArray();
		Arrays.sort(c);
		String st = new String(c);
		int min = Integer.valueOf(st);
		st = new StringBuffer(st).reverse().toString();
		int max = Integer.valueOf(st);
		System.out.println(max-min);
	    }
	}catch(Exception e){
	    System.out.println("Error");
	}
    }
}

Measured memory_bytes: 17068
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define ff first
#define ss second
#define inf 500000000
#define IOS ios_base::sync_with_stdio(0)
#define meM(y,a) memset(y,a,sizeof y)
#define sC(a) scanf("%d",&a)
#define alL(a) a.begin(),a.end()
#define prinT(a,sz)  cout<<a[0];for(int i=1;i<sz;i++)cout<<" "<<a[i];cout<<endl
#define ranD srand(chrono::steady_clock::now().time_since_epoch().count());
typedef pair<int,int>pi;
typedef pair<ll,ll>pll;
//int fx[]={0,0,1,-1};
//int fy[]={1,-1,0,0};
//int gx[]={0,0,1,1,1,-1,-1,-1};
//int gy[]={1,-1,0,1,-1,0,1,-1};
bool check(int n,int p){return (1<<p)&n;}
const int N=30020;
int vis[1010][5];
string s;
int main()
{
    IOS;
    int n;cin>>n;
    cin>>s;
    ll ans=0;
    for(int i=0;i<s.length()-2;i++)
    {
        int num=s[i]-'0';
        if(vis[num][0])continue;
        for(int j=i+1;j<s.length()-1;j++)
        {
            int num1=num*10+s[j]-'0';
            if(vis[num1][1]==1)continue;
            for(int k=j+1;k<s.length();k++)
            {
                int num2=num1*10+s[k]-'0';
                if(vis[num2][2]==0)
                {
//                    cout<<"num = "<<num2<<endl;
                    vis[num2][2]=1;
                    ans++;
                }
            }
            vis[num1][1]=1;
        }
        vis[num][0]=1;
    }
    cout<<ans<<endl;
}








Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
typedef complex<double> P;
double eps=1e-8;
double D,px,py,vx,vy,ans;
P p,v;

void solve(){
  if(abs(imag(p*conj(v))) > 0){
    printf("impossible\n");
    return;
  }
  if( real(p*conj(v)) > 0 ){
    ans=2.0-abs(p);
  }else{
    ans=abs(p);
  }
  if(ans<D+eps)printf("%.10f\n",ans);
  else printf("impossible\n");
}

int main(){
  while(1){
    cin>>D;
    if(D==0.0)break;
    cin>>px>>py>>vx>>vy;
    p=P(px,py),v=P(vx,vy);
    solve();   
  }
  return 0;
}

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

using namespace std;
using ll = long long;
using vi = vector<int>;
using vc = vector<char>;
using vs = vector<string>;
using vl = vector<ll>;
using vb = vector<bool>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;
using vvc = vector<vector<char>>;
using vvs = vector<vector<string>>;
using vvb = vector<vector<bool>>;
#define rep(i, n) for(int i = 0; i < n; i++)
const ll mod = 1000000007;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

int main() {
  int N;
  cin >> N;
  ll count = 0;
  for(int i = 1; i <= N; i++) {
    if( N % i != 0) {
      int b = N / i;
      count += b;
    }
    else {
      count += N / i - 1;
    }
  }
  cout << count << endl;
}

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

using namespace std;

#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl

typedef long long ll;
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
template<class S, class T> pair<S, T> operator+(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first + t.first, s.second + t.second); }
template<class S, class T> pair<S, T> operator-(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first - t.first, s.second - t.second); }
template<class S, class T> ostream& operator<<(ostream& os, pair<S, T> p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
#define X first
#define Y second
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define rep1(i,n) for(ll i=1;i<=(ll)(n);i++)
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define rrep1(i,n) for(ll i=(ll)(n);i>0;i--)
#define REP(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define in(x, a, b) (a <= x && x < b)
#define all(c) c.begin(),c.end()
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a = b; return 1; } return 0; }
#define UNIQUE(v) v.erase(std::unique(v.begin(), v.end()), v.end());
const ll inf = 1000000001;
const ll INF = 1e18;
const ll MOD = 1000000007;
const double pi = 3.14159265358979323846;
#define Sp(p) cout<<setprecision(15)<< fixed<<p<<endl;
int dx[4] = { 1,0, -1,0 }, dy[4] = { 0,1,0,-1 };
int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };
#define fio() cin.tie(0); ios::sync_with_stdio(false);
#define mp make_pair


int main() {
  ll l;
  cin >> l;
  ll n = 1;
  ll seki = 1;
  ll m = 0;
  while (seki * 2 <= l) {
    seki *= 2;
    n++;
  }
  vector<pair<pii, int> > edges;
  rep1 (i, n - 1) {
    edges.push_back(mp(pii(i, i + 1), 0));
    edges.push_back(mp(pii(i, i + 1), pow(2, i - 1)));
    m += 2;
  }
  ll now = n - 1;
  while (now >= 1) {
    if (l - pow(2, n - 1) >= pow(2, now - 1)) {
      edges.push_back(mp(pii(now, n), l - pow(2, now - 1)));
      m++;
      l = l - pow(2, now - 1);
    }
    now--;
  }
  cout << n << " " << m << endl;
  rep (i, m) {
    cout << edges[i].first.first << " " << edges[i].first.second << " " << edges[i].second << endl;
  }
}


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

ans = 0
dp = [[0] * (n+1) for _ in range(n+1)]

li = []
for i in range(n):
    li.append((a[i],i))

li.sort(reverse = True)

for i in range(1,n+1):
    tmp = li[i-1]
    for ii in range(i+1):
        jj = i - ii
        if ii == 0:
            dp[ii][jj] = dp[ii][jj-1] + tmp[0] * abs((n - jj) - tmp[1])
        elif jj == 0:
            dp[ii][jj] = dp[ii-1][jj] + tmp[0] * abs((ii - 1) - tmp[1])
        else:
            dp[ii][jj] = max(dp[ii][jj-1] + tmp[0] * abs((n - jj) - tmp[1]), dp[ii-1][jj] + tmp[0] * abs((ii - 1)- tmp[1]))


for i in range(n+1):
    ans = max(ans, dp[i][n-i])

print(ans)


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

int main()
{
    string hcard, tcard;
    int tscore, hscore, n;

    cin >> n;

    tscore = hscore = 0;
    for (int i = 0; i < n; i++){
        cin >> tcard >> hcard;

        if (tcard > hcard){
            tscore += 3;
        }
        else if (tcard < hcard){
            hscore += 3;
        }
        else {
            tscore++;
            hscore++;
        }
    }

    cout << tscore << " " << hscore << endl;

    return 0;
}

Measured memory_bytes: 3168
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
using namespace std;
typedef long long int lli;
const int inf = 0xfffffff;
const lli llinf = 0xfffffffffffffff;

int main()
{
	int n, t, a;
	cin >> n >> t >> a;
	double ans_v = 1000000.0, ans = 0;
	for (int i = 0; i < n; i++) {
		int b;
		cin >> b;
		double temp = (double)t - (double)b*0.006;
		double c = a - temp;
		if (c < 0) c *= -1;
		if (c < ans_v) {
			ans_v = c;
			ans = i+1;
		}
	}
	cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define inf 1001001001
#define mod 1000000007
#define mod2 998244353
#define pi acos(-1)
#define all(v) v.begin(),v.end()

ll gcd(ll a,ll b){
    if(b>a) swap(a,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;
}
ll rep_jijo(ll n,ll x){
    if(x==0) return 1;
    if(x%2==0){
        ll t=rep_jijo(n,x/2);
        return t*t;
    }
    return n*rep_jijo(n,x-1);
}

int main(){
    ll n;
    ll sum = 0;
    cin >> n;
    vector<ll>a(n);
    map<ll,ll>mp;
    rep(i,n) {
        cin >> a[i];
        sum += a[i];
        mp[a[i]]++;
    }
    ll q;
    cin >> q;
    vector<ll>ans(q);
    rep(i,q){
        ll b,c;
        cin >> b >> c;
        sum = sum - mp[b]*b + mp[b]*c;
        mp[c] += mp[b];
        mp[b] = 0;
        ans[i] = sum;
    }
    rep(i,q){
        cout << ans[i] <<endl;
    }

   return 0;
}

Measured memory_bytes: 10468
#include <bits/stdc++.h>
#define double long double
#define int long long
#define mii map<int,int>
#define low lower_bound
#define upp upper_bound
#define inf 1000000007 //10^9+7
#define rep(i,n) for(int i=0;i<n;i++)
#define all(vec) vec.begin(),vec.end()
#define vsort(vec) sort(all(vec))
#define vrever(vec) reverse(all(vec));
#define vunsort(vec) vsort(vec); vrever(vec);
#define bisea binary_search
#define cend cout<<endl;
#define F first
#define S second
using namespace std;
signed main() {
  int n;
  cin>>n;
  int a[n+1];
  int ans=0;
  a[0]=0;
  rep(i,n) {
    cin>>a[i+1];
    a[i+1]+=a[i];
  }
  sort(a,a+n+1);
  rep(i,n+1) {
    auto b=upp(a,a+n+1,a[i])-low(a,a+n+1,a[i]);
    if(i!=n&&a[i]!=a[i+1]) {
      ans+=b*(b-1)/2;
      ;
    }
  }
  auto b=upp(a,a+n+1,a[n])-low(a,a+n+1,a[n]);
  ans+=b*(b-1)/2;
  cout<<ans<<endl;
}

Measured memory_bytes: 1792
N = input()
_list = input().split(" ")
_list = [int(a) for a in _list]
aspect = [a for a in _list if a % 2==0]
ans = []
for a in aspect:
    if a % 3 == 0 or a % 5 == 0:
        ans.append(True)
if len(aspect) ==len(ans):
    print("APPROVED")
else:
    print("DENIED")

Measured memory_bytes: 3188
cnt = input()
same_val_cnt = 0
ans = "No"
for _ in range(1,int(cnt)+1):
	a, b = input().split(" ")
	if a == b:
		same_val_cnt += 1
	else:
		same_val_cnt = 0

	if same_val_cnt == 3:
		ans = "Yes"
		break

print(ans)

Measured memory_bytes: 9180
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pi pair<int,int>
#define vp vector<pi>
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define For(i,a,b) for(ll i=a;i<b;i++)
#define endl "\n"
#define debug(x) cout<<"DEBUG ------> "<<#x<<" -> "<<x<<endl
#define all(x) x.begin(),x.end()
#define mint map<int,int>
#define mod 1000003
#define ciN cin
////////////////////////////////////////////////////////////////
//Ha Moj Ha///
////////////////////////////////////////////////////////////////

void jabru() {
	int n; cin >> n;
	string s; ciN >> s;
	int r = count(all(s), 'R');
	int w = count(all(s), 'W');
	if (w == 0)
		cout << 0 << endl;
	else {
		ll ans = r;
		ll curr = 0;
		For(i, 0, w) {
			if (s[n - 1 - i] == 'R')
				curr++;
			else {continue;}
		}
		ans = min(ans, curr);
		cout << ans << endl;
	}

}




////////////////////////////////////////////////////////////////
//Bas aabaju nai javanu///
////////////////////////////////////////////////////////////////

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
//	int t; cin >> t;
//	while (t--)
	jabru();

	return 0;
}





///////////////////////////////////////////////////////////////////////////////////////////
//Kai baju bhai???


Measured memory_bytes: 3780
import sys
from collections import defaultdict, deque, Counter
import math

# import copy
from bisect import bisect_left, bisect_right
import heapq

# sys.setrecursionlimit(1000000)

# input aliases
input = sys.stdin.readline

getS = lambda: input().strip()
getN = lambda: int(input())
getList = lambda: list(map(int, input().split()))
getZList = lambda: [int(x) - 1 for x in input().split()]

INF = 10 ** 20
MOD = 10**9 + 7
divide = lambda x: pow(x, MOD-2, MOD)


def nck(n, k, kaijyo):
    return (npk(n, k, kaijyo) * divide(kaijyo[k])) % MOD


def npk(n, k, kaijyo):
    if k == 0 or k == n:
        return n % MOD
    return (kaijyo[n] * divide(kaijyo[n-k])) % MOD


def kaijyo(n):
    ret = [1]
    for i in range(1, n + 1):
        ret.append((ret[-1] * i)% MOD)
    return ret

def solve():
    a,b,x = getList()
    fb = b // x
    fa = (a-1) // x
    print(fb - fa)

def main():
    n = getN()
    for _ in range(n):
        solve()


if __name__ == "__main__":
    # main()
    solve()

Measured memory_bytes: 65460
#include<iostream>
#include<vector>
#include<map>
#include<algorithm>
#include<cmath>
#include<string>
#include <iomanip>
#include<deque>
#include<queue>
#include<stack>
#include<set>
#include<complex>
#include<ctime>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef int itn;
const ll LINF = 1e18;
const int INF = 1e9;

//マクロ定義
#define vvint(vec,n,m,l) vector<vector<int>> vec(n, vector<int>(m,l));	// lで初期化
#define vvll(vec,n,m,l) vector<vector<ll>> vec(n,vector<ll>(m,l));
#define vint vector<int>
#define pint pair<int,int>
#define rep(i,a) for(int i=0;i<(a);i++)
#define all(x) (x).begin(),(x).end()
#define debug system("pause")				//デバッグ用
#define ret return 0

template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }

using Graph = vector<vector<ll>>;

#define ketasitei setprecision(15) //15桁表示

const ll MOD = 1000000007;

int main(void)

{
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << ketasitei;
	
	int n;
	cin >> n;
	if (n % 10 == 7 || (n / 10) % 10 == 7 || (n / 100) % 10 == 7)
		cout << "Yes";
	else
		cout << "No";
	cout << endl;


	return 0;
}

Measured memory_bytes: 3640
import java.util.*;

public class Main {

    static <T extends Comparable<? super T>> boolean nextPermutation(T[] sequence) {
        int first = getFirst(sequence);
        if (first == -1) return false;
        int toSwap = sequence.length - 1;
        while (sequence[first].compareTo(sequence[toSwap]) >= 0) --toSwap;
        swap(sequence, first++, toSwap);
        toSwap = sequence.length - 1;
        while (first < toSwap) swap(sequence, first++, toSwap--);
        return true;
    }

    static <T extends Comparable<? super T>> int getFirst(T[] sequence) {
        for (int i = sequence.length - 2; i >= 0; --i)
            if (sequence[i].compareTo(sequence[i + 1]) < 0) return i;
        return -1;
    }

    static <T extends Comparable<? super T>> void swap(T[] sequence, int i, int j) {
        T tmp = sequence[i];
        sequence[i] = sequence[j];
        sequence[j] = tmp;
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int[][] matrix = new int[n][n];
        for (int i = 0; i < n; ++i) Arrays.fill(matrix[i], 0);
        for (int i = 0; i < m; ++i) {
            int a = sc.nextInt() - 1;
            int b = sc.nextInt() - 1;
            matrix[a][b] = 1;
            matrix[b][a] = 1;
        }

        Integer[] arr = new Integer[n];
        for (int i = 0; i < n; ++i) arr[i] = i;
        int res = 0;
        do {
            if (arr[0] != 0) continue;
            boolean flag = true;
            for (int i = 0; i < n - 1; ++i) {
                if (matrix[arr[i]][arr[i+1]] != 1) flag = false;
            }
            if (flag) ++res;
        } while(nextPermutation(arr));

        System.out.println(res);
    }
}

Measured memory_bytes: 22704
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
    REP(i,v.size()){if(i)os<<" ";os<<v[i];}return os;}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
    REP(i,v.size()){if(i)os<<endl;os<<v[i];}return os;}

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

const int dx4[4] = {1, 0, -1, 0};
const int dy4[4] = {0, 1, 0, -1};

const int dx8[8] = {1,1,0,-1,-1,-1,0,1};
const int dy8[8] = {0,1,1,1,0,-1,-1,-1};

vector< vector<int> > Graph;
vector< int > value;




int main(int argc, const char * argv[]) {
    
    // remove the bottom 3 lines when you submit this code.
    std::ifstream in("sample.txt");
    std::cin.rdbuf(in.rdbuf());

    cin.tie(0);
    ios::sync_with_stdio(false);

    string s; cin >> s;
    int k; cin >> k;
    
    map<string,int> submap{};
    priority_queue<string,vector<string>,greater<string>> que{};
    
    for (int i = 0; i < (int)s.size(); i++) {
        for (int j = 1; j <= (int)s.size() - i; j++) {
            if(s.substr(i,j).size() > 10) continue;
            if(  !submap.count(    s.substr(i,j)   )    ) {
                submap.insert(make_pair(s.substr(i,j), 0));
                que.push(s.substr(i,j));
            }
            
            
            
        }
    }
    
    
    
    rep(i,k){
        if(i==k-1) cout << que.top() << endl;
        que.pop();
    }
    
}



Measured memory_bytes: 6776
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdlib>
#include<map>
#include<iomanip>
#include<sstream>
#include<vector>
#include<stack>
#include<math.h>
#include<queue>
#include<complex>
using namespace std;



int main() {
	complex<long double>cmpmp;
	const long long int mod = 1000000007;
	map<long long int, long long int>mp;
	//cout << fixed << setprecision(10);
	long long int n, m, k, d[200050], t[200050], left = 0, dp[100][3] = {};
	cin >> n;
	dp[0][0] = 1;
	for (int i = 1; i <= n; i++) {
		cin >> d[i];
	}
	for (int i = 1; i <= n; i++) {
		if (d[i] % 2 == 1) {
			dp[i][0] += dp[i - 1][0];
			dp[i][1] += 2*dp[i - 1][0];
			dp[i][1] += 3*dp[i - 1][1];
		}
		else {

			dp[i][0] += 2*dp[i - 1][0];
			dp[i][1] += dp[i - 1][0];
			dp[i][1] += 3*dp[i - 1][1];
		}
	}
	cout << dp[n][1] << endl;
} 


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

int main () {
    string s;
    cin >> s;
    int res = 0;
    for (int i = 0; i < s.size() / 2; i++)
        res += s[i] != s[s.size() - 1 - i];
    cout << res << endl;
}



Measured memory_bytes: 256
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor
from operator import mul
from functools import reduce
import pprint
sys.setrecursionlimit(10 ** 9)


INF = 10 ** 20
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 1000000007

a, b = LI()
for i in range(10000):
    if i * 8 //100 == a and i // 10 == b:
        print(i)
        break
else:
    print(-1)

Measured memory_bytes: 39664
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#define INF 1000000009
#define LINF 1000000000000000009
#define all(a) a.begin(),a.end()
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<ll, P> PP;
template<class T> bool chmax(T &a, const T&b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T&b) { if (a > b) { a = b; return 1; } return 0; }
ll gcd(ll n, ll m) { return (m ? gcd(m, n%m) : n); }
ll lcm(ll n, ll m) { return n / gcd(n, m)*m; }

int main() {
	int k, x;
	cin >> k >> x;
	if (500 * k >= x) cout << "Yes" << endl;
	else cout << "No" << endl;
}

Measured memory_bytes: 256