akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
int dp[81][81][6400 * 2 + 1];
// because max distance that we can travel is to first go form start, go to last column in first row and then in last column, go till last
// row till we reach our destination, all other path distance will be less as they kind of form diagnal path.
int find_it(int dif_sum , int i , int j , int &n , int &m , vector<vector<pair<int , int>>> & matrix){
    if(i == n - 1 && j == m - 1){
        return min(abs(dif_sum + matrix[i][j].first - matrix[i][j].second) , abs(dif_sum + matrix[i][j].second - matrix[i][j].first));
    }
    if(dp[i][j][dif_sum] != -1){
        return dp[i][j][dif_sum];
    }
    int minvalue = INT_MAX;
    int ff = abs(dif_sum + matrix[i][j].first - matrix[i][j].second);
    int ss = abs(dif_sum + matrix[i][j].second - matrix[i][j].first);
    // abs because suppose till i & j , we have got k sum and -k sum possible, what is the meaning of keeping of both k and -k as from now on 
    // they both are going to have same all possible path till n - 1 & m - 1, so so reduce time , we can just use one value that is k
    // and as problem mentions we only care about dif , so it means absolute
    if(i + 1 < n){
        minvalue = min(minvalue , find_it(ff , i + 1 , j , n , m , matrix));
        minvalue = min(minvalue , find_it(ss , i + 1 , j , n , m , matrix));

    }
    if(j + 1 < m){
        minvalue = min(minvalue , find_it(ff , i , j + 1 , n , m , matrix));
        minvalue = min(minvalue , find_it(ss , i , j + 1 , n , m , matrix));
    }
    return dp[i][j][dif_sum] = minvalue;

}
int main(){

	ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int n , m;
    cin >> n >> m;
    vector<vector<pair<int , int> > > matrix(n , vector<pair<int , int>> (m));

    for(int i = 0; i < n; ++i){
        for(int j = 0; j < m; ++j){
            cin >> matrix[i][j].first;
        }
    }
    for(int i = 0; i < n; ++i){
        for(int j = 0; j < m; ++j){
            cin >> matrix[i][j].second;
        }
    }
    memset(dp , -1 , sizeof(dp));
    cout << find_it(0 , 0 , 0 , n , m , matrix);


return 0;
}


Measured memory_bytes: 328448
#include <iostream>
#include <vector>

int main() {
  using i64 = long long;
  
  int n;
  i64 k;
  std::cin >> n >> k;
  std::vector<int> a(n + 1);
  for (int i = 1; i <= n; ++i)
    std::cin >> a[i];

  int p = 1;
  while (k != 0) {
    if (k % 2 != 0)
      p = a[p];
    std::vector<int> b(n + 1);
    for (int i = 1; i <= n; ++i)
      b[i] = a[a[i]];
    a = b;
    k /= 2;
  }

  std::cout << p << std::endl;
}


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

int main(){
  string s,t="CODEFESTIVAL2016";
  cin>>s;
  int ans = 0;
  for(int i=0;i<16;i++){
    if(s[i]!=t[i])ans++;
  }
  
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define rep(i, j, n) for(int i=j;i<n;++i)
#define all(i) i.begin(),i.end()
#define rall(i) i.rbegin(),i.rend()
#define INF 1e9
#define LINF 1e18
const int mod = 1e9 + 7;
 
typedef long long i64;
typedef pair<int, int> pi;
 
template <class T> using vt = vector<T>;
template <class T> using vvt = vector<vector<T>>;

i64 gcd(i64 n, i64 m) {return (m == 0? n : gcd(m, n % m));}
i64 lcm(i64 n, i64 m) {return (n / gcd(n, m) * m);}

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

  int n;
  cin >> n;
  vt<int> s(n);
  rep(i, 0, n) cin >> s[i];

  vt<bool> dp(15000, false);
  dp[0] = true;
  rep(i, 0, n) {
    auto vec = dp;
    rep(j, 0, vec.size() + 1) {
      if(j >= s[i]) vec[j] = vec[j] || dp[j - s[i]];
    }
    swap(vec, dp);
  }

  int ans = 0;
  rep(i, 0, dp.size()) {
    if(dp[i] && i % 10) ans = i;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<cstdlib>
#include<tuple>
#include<iomanip>
#include<map>
#define int long 
using namespace std;

signed main() {
	int N;
	cin >> N;
	vector<int> vec(N);
	for(int i = 0;i < N;i++) {
		cin >> vec.at(i);
	}
	int answer = 0;
	int answer2 = 0;
	for(int i = 0;i < N;i++) {
		if(answer < vec.at(i)) {
			answer2 = answer;
			answer = vec.at(i);
		}
		else if(answer2 < vec.at(i)) {
			answer2 = vec.at(i);
		}
	}
	int count = 0;
	for(int i = 0;i < N;i++) {
		if(vec.at(i) == answer) {
			count++;
		}
	}
	if(count > 1) {
		for(int i = 0;i < N;i++) {
			cout << answer << endl;
		}
	}
	else {
		for(int i = 0;i < N;i++) {
			if(vec.at(i) == answer) {
				cout << answer2 << endl;
			}
			else {
				cout << answer << endl;
			}
		}
	}
}


Measured memory_bytes: 3200
#include <bits/stdc++.h>
    #include <ext/pb_ds/tree_policy.hpp>
    #include <ext/pb_ds/assoc_container.hpp>
     
    using namespace std;
    using namespace __gnu_pbds;
     
    typedef long long ll;
    typedef long double ld;
    typedef complex<ld> cd;
     
    typedef pair<int, int> pi;
    typedef pair<ll,ll> pl;
    typedef pair<ld,ld> pd;
     
    typedef vector<int> vi;
    typedef vector<ld> vd;
    typedef vector<ll> vl;
    typedef vector<pi> vpi;
    typedef vector<pl> vpl;
    typedef vector<cd> vcd;
     
    template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;
     
    #define FOR(i, a, b) for (int i=a; i<(b); i++)
    #define F0R(i, a) for (int i=0; i<(a); i++)
    #define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
    #define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
     
    #define sz(x) (int)(x).size()
    #define mp make_pair
    #define pb push_back
    #define f first
    #define s second
    #define lb lower_bound
    #define ub upper_bound
    #define all(x) x.begin(), x.end()
     
    const int MOD = 1000000007;
    const ll INF = 1e18;
    const int MX = 100001; //check the limits, dummy
     
    int main() {
        ios_base::sync_with_stdio(0); cin.tie(0);
     
        int N; cin >> N;
        int M; cin >> M;
        vector<vi> graph(3*N);
        F0R(i, M) {
            int A, B; cin >> A >> B; A--; B--;
            graph[A].pb(B+N); graph[A+N].pb(B+2*N); graph[A+2*N].pb(B);
        }
     
        int S, T; cin >> S >> T; S--; T--;
     
        queue<int> Q;
        int dist[3*N]; F0R(i, 3*N) dist[i] = -1;
     
        dist[S] = 0;
        Q.push(S);
        while (!Q.empty()) {
            int cur = Q.front(); Q.pop();
            F0R(i, sz(graph[cur])) {
                int nxt = graph[cur][i];
                if (dist[nxt] == -1) {
                    dist[nxt] = dist[cur] + 1;
                    Q.push(nxt);
                }
            }
        }
     
        if (dist[T] == -1) {
            cout << -1 << endl;
            return 0;
        }
     
        cout << dist[T] / 3 << endl;
     
        return 0;
    }
     
    // read the question correctly (ll vs int)
    // template by bqi343

Measured memory_bytes: 17792
#include<iostream>
using namespace std;
int main() {
	int N, K, P, a;
	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> K >> P;
		if(K<P){a=K;}
		else{
		a = K%P;
		if (a == 0) { a = P; }
		}
		cout << a << endl;
	}
	return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef pair<int,int> pa;
int mod=1e9+7;
unordered_map <int,int> mp;
const int N=2e5+100;
int a[N];
int main()
{
    //ios::sync_with_stdio(0);cin.tie(0);
    int n;scanf("%d",&n);
    int x;
    for(int i=1;i<=n;i++){
        scanf("%d",&a[i]);
        mp[a[i]]++;
    }
    int f=0;
    ll ans=0;
    for(int i=1;i<=n;i++){
            f=0;
        for(int j=1;j*j<=a[i];j++){
            if(a[i]%j==0){
               mp[a[i]]--;
               if(mp[j]||mp[a[i]/j]){
                ans++;
                f=1;
               }
               mp[a[i]]++;
               if(f) break;
            }
        }
    }

    printf("%lld\n",n-ans);
    return 0;
}



Measured memory_bytes: 32528
N=int(input())
h=list(map(int,input().split()))
cnt=[]
l=0

if N==1:
	print(0)
	exit()

for n in range(1,N):
	if h[n-1]>=h[n]:
		l+=1
		if n==N-1:
			cnt.append(l)
			break
		continue
	elif h[n-1]<h[n]:
		cnt.append(l)
		l=0
		continue
print(max(cnt))

Measured memory_bytes: 14252
from math import factorial

def a(n,k):
  return factorial(n)//factorial(k)//factorial(abs(n-k))

n,k = map(int,input().split())
mod = 10**9 + 7

for i in range(k):
  print(a(n-k+1,i+1)*a(k-1,i)%mod)

Measured memory_bytes: 3316
#include<bits/stdc++.h>
using namespace std;
#define V vector
#define L long long
#define W V<L>
#define R(n) for(L i=0;i<n;i++)
W S(V<W>&p,L E){if(!E){return{1,0};}V<V<W>>T(2);for(W x:p){T[x[1]&1].push_back({x[0]/2,x[1]/2});if(x[0]&1){T[(x[1]+1)&1].push_back({x[0]/2,(x[1]+1)/2});}}R(2){int c=0;for(W x:T[!i]){L Q=(2*x[0]+x[1])%3;c^=(Q+1);}if(!c){W ans=S(T[i],E-1);ans[0]*=2;ans[1]*=2;ans[1]+=i;return ans;}}for(W&v:p){v[0]++;}W A=S(p,E);A[0]--;return A;}
int main(){L M=2e17;L n;cin>>n;V<W>p(n);R(n){L a,b;cin>>a>>b;p[i]={a+M,b+M};}W Q=S(p,70);cout<<Q[0]-M<<" "<<Q[1]-M;}


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

int dp[1'000'000+1][2];

void solve(string N) {
}

signed main() {
  string N;
  cin >> N;

  int ans = 0;

  dp[N.size()-1][0] = (N[N.size()-1]-'0');
  dp[N.size()-1][1] = 10 - (N[N.size()-1]-'0');

  for(int i=N.size()-2; i>=0; i--) {
    int d = N[i] - '0';
    dp[i][0] = min(dp[i+1][0]+d     , dp[i+1][1]+(d+1)     );
    dp[i][1] = min(dp[i+1][0]+(10-d), dp[i+1][1]+(10-(d+1)));
  }
  cout << min(dp[0][0], dp[0][1]+1) << endl;
}


Measured memory_bytes: 17028
#include<iostream>
#include<algorithm>
#include<vector>
#include<numeric>
#include<string>
#include<cmath>
#include<set>
#include<queue>
#include<deque>
#include<bitset>
#include<iomanip>
#include<cctype>
#include<map>
#include<cstring>
#include<bitset>
#include<cassert>

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep2(i,a,b) for (int (i)=a;(i)<(b);(i)++)
#define all(x) (x).begin(),(x).end()

using namespace std;
using ll = long long int;

const int inf = 1001001000;
const long long int Inf = 1001001001001001000;



void print(vector<vector<int>> a){
	for (int i = 0; i < a.size(); i++)
	{
		for (int j=0;j<a[i].size();j++){
			cout << a[i][j] << " ";
		}
		cout << endl;
	}
}

void print(vector<vector<long long int>> a){
	for (int i=0;i<a.size();i++){
		for (int j=0;j<a[i].size();j++){
			cout << a[i][j] << " ";
		}
		cout << endl;
	}
}

void print(vector<int> a){
    int n = a.size();
    for (int j=0;j<n;j++) {
        if (j != n-1) cout << a[j] << " ";
        else cout << a[j] << endl;
    }
}

void print(vector<long long int> a){
    int n = a.size();
    for (int j=0;j<n;j++) {
        if (j != n-1) cout << a[j] << " ";
        else cout << a[j] << endl;
    }
}

void print(set<int> a){
	for (auto x:a)
		cout << x << " ";
	cout << endl;
}


int main(){
	int n, d;
	cin >> n >> d;
	vector<vector<int>> x(n);
	int ans = 0;
	rep(i, n)
	{
		vector<int> a(d);
		rep(j, d) cin >> a[j];
		x[i] = a;
	}
	rep(i,n-1)
	{
		rep2(j,i+1,n){
			int dist = 0;
			rep(k,d){
				dist += (x[i][k] - x[j][k]) * (x[i][k] - x[j][k]);
			}
			for (int k = 1; k * k <= dist; k++)
			{
				if(k*k==dist){
					ans++;
					break;
				}
			}
		}
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
function main () { 
  var x = input[0].split(' ')[0];
  var y = input[0].split(' ')[1];
  console.log(x * y + ' ' + (x * 2 + y * 2));
}
 
 
var
input = '';
 
process.stdin.resume();
process.stdin.setEncoding('utf8');
process.stdin.on('data', function(chunk) {
  input += chunk;
});
process.stdin.on('end', function() {
  input = input.split('\n');
  main();
});

Measured memory_bytes: 7644
#include<iostream>
#include<iomanip>
#include<string>
#include<queue>
#include<vector>
#include<algorithm>
#include<tuple>
#include<numeric>
#include<map>
#include<cmath>
#define ll long long
#define rep(i,n) for(int i=0;i<(int) (n);i++)
using namespace std;
int main(){
  int a,b,anser;
  cin>>a>>b;
  if(a+b<a-b){
    if(a-b>a*b)cout<<a-b;
    else cout<<a*b;
  }else{
    if(a+b>a*b)cout<<a+b;
    else cout<<a*b;
  }

}


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

int main() {
  int n,k;
  cin >> n >> k;
  int64_t ans = k;
  for (int i = 0; i < n-1; i++) {
    ans = ans * (k-1);
  }
  cout << ans;
}

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;

int main() {
	int n;
	cin >> n;
	int t[N];
	int t_sum = 0;
	rep(i, n) {
		cin >> t[i];
		t_sum += t[i];
	}
	int m;
	cin >> m;
	int p[105], x[105];
	rep(i, m) cin >> p[i] >> x[i];
	rep(i, m) {
		cout << t_sum - (t[p[i]-1] - x[i]) << endl;
	}
}


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

typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
#define pb(x) push_back(x)
#define SORT(ls) sort(ls.begin(), ls.end())
#define DESC(ls) sort(ls.rbegin(), ls.rend()) 
#define mp(x, y) make_pair(x, y)
#define INF 1000000000
#define MOD 1000000007
#define F(i, a, n) for(i=a;i<n;i++)
#define TI(x, y, z) cin>>x>>y>>z
#define FASTER ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)



int main(void)
{
    FASTER;
    int i, j, n;
    cin >> n;
    int arr[n][3];
    F(i, 0, n)
        TI(arr[i][0], arr[i][1], arr[i][2]);
    int dp[n][3];
    F(i, 0, 3)
        dp[0][i] = arr[0][i];
    F(i, 1, n)
    {
        dp[i][0] = max(dp[i - 1][1], dp[i - 1][2]) + arr[i][0];
        dp[i][1] = max(dp[i - 1][0], dp[i - 1][2]) + arr[i][1];
        dp[i][2] = max(dp[i - 1][0], dp[i - 1][1]) + arr[i][2];
    }
    cout << max({dp[n - 1][0], dp[n - 1][1], dp[n - 1][2]}) << endl;
    return 0;
}

Measured memory_bytes: 2560
from collections import deque
graph = []
n = int(input())
dist = [[int(c),-1] for c in range(1,n+1)]
process_q = deque()
for i in range(n):
    graph.append([c-1 for c in list(map(int,input().split()))][2:])

def bfs():
    while len(process_q) > 0:
        parent = process_q.popleft()
        for child in graph[parent]:
            if dist[child][1] != -1:
                continue
            process_q.append(child)
            dist[child][1] = dist[parent][1] + 1

process_q.append(0)
dist[0][1] = 0
bfs()

for element in dist:
    print(*element)



Measured memory_bytes: 6036
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007

int main() {
	ll a,b,x;
	cin>>a>>b>>x;
	cout << (x+max(a,b)-1)/max(a,b);
	// your code goes here
	return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
	static long MODULO = 1_000_000_000 + 7;

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		boolean[] isPrime = new boolean[N + 1];
		Arrays.fill(isPrime, true);
		isPrime[0] = false;
		isPrime[1] = false;
		int size = 0;
		for (int i = 2; i <= N; ++i) {
			if (isPrime[i]) {
				++size;
				for (int j = 2 * i; j <= N; j += i) {
					isPrime[j] = false;
				}
			}
		}
		int[] count = new int[size];
		int pos = 0;
		for (int i = 0; i <= N; ++i) {
			if (!isPrime[i])
				continue;
			int c = 0;
			for (int j = i; j <= N; j *= i) {
				c += N / j;
			}
			count[pos++] = c;
		}
		long ans = 1;
		for (int i = 0; i < pos; ++i) {
			ans = (ans * (count[i] + 1)) % MODULO;
		}
		System.out.println(ans);
	}

	static void tr(Object... o) {
		System.out.println(Arrays.deepToString(o));
	}
}


Measured memory_bytes: 10320
fun main(args: Array<String>) {
    val (H, W) = readLine()!!.split(" ").map { it.toInt() }
    val a = (1..H).map { readLine()!!.split(" ").map { it.toInt() }.toMutableList() }
    val result = mutableListOf<String>()

    for (i in 0 until H) for (j in 0 until W - 1) {
        val c = a[i][j]
        if (c % 2 != 0) {
            a[i][j + 1] += 1
            result.add("${i + 1} ${j + 1} ${i + 1} ${j + 2}")
        }
    }

    for (k in 0 until H - 1) {
        val c = a[k][W - 1]
        if (c % 2 != 0) {
            a[k + 1][W - 1] += 1
            result.add("${k + 1} $W ${k + 2} $W")
        }
    }

    println(result.size)
    result.forEach(::println)
}

Measured memory_bytes: 69752
#include<stdio.h>
int main(){
  int a, b, c, i, tmp;
  scanf("%d %d",&a,&b);
 
  if( a > b ){
    tmp=a;
    a=b;
    b=tmp;
  }
 
  scanf("%d",&c);
 
  if(b > c){
    tmp=b;
    b=c;
    c=tmp;
  }
 
  if(a > b){
    tmp=a;
    a=b;
    b=tmp;
  }
 
  printf("%d %d %d\n",a,b,c);
  return 0;
}

Measured memory_bytes: 596
#include<bits/stdc++.h>
using namespace std;
const long long mod=1e9+7;
const long double PI=acos(-1);
typedef long long int ll;
typedef unsigned long long ull;
#define pb push_back
#define mp make_pair
#define all(x) x.begin(),x.end()
#define fo(i,n) for(int i=0;i<(int)n;i++)
#define fo1(i,n) for(int i=1;i<=(int)n;i++)
#define deb(x) cout<<#x<<"="<<x<<endl

int main()
{
	ios_base::sync_with_stdio(false); 
	cin.tie(NULL);int tc=1;
	vector<int> x;
	int c=0;
	fo1(i,100)
	{
		fo1(j,100)
		{
			fo1(k,100)
			{
				c=(i*i+j*j+k*k+i*j+i*k+j*k);
				if(c<=10000) x.push_back(c);
			}
		}
	}
	cin>>tc;
	fo1(t,tc)cout<<count(all(x),t)<<"\n";
	return 0;
}

Measured memory_bytes: 4200
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; ++i)
#define REPR(i, n) for (int i = n - 1; i >= 0; --i)
#define FOR(i, a, b) for (int i = a; i < b; ++i)
#define FORR(i, a, b) for (int i = b - 1; i >= a; --i)
#define SORT(v) sort(v.begin(), v.end())
#define SORTR(v) sort(v.rbegin(), v.rend())
#define REV(v) reverse(v.begin(), v.end())
#define ITER(itr, v) for (auto itr = v.begin(); itr != v.end(); ++itr)
#define LB(v, x) (lower_bound(v.begin(), v.end(), x) - v.begin())
#define UB(v, x) (upper_bound(v.begin(), v.end(), x) - v.begin())
#define SZ(v) (int)v.size()
using namespace std;
using ll = long long;
using P = pair<int, int>;

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

    int X;
    cin >> X;
    if (X >= 30) {
        cout << "Yes\n";
    } else {
        cout << "No\n";
    }

    return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i=0; i<(int)(n); i++)
#define all(x) x.begin(), x.end()
#define mod 1000000007
typedef long long ll;

bool isKaibun(string str, int front, int back){
    rep(i, (back-front+1)/2){
        if(str[front+i] != str[back-i]) return false;
    }
    return true;
}

int main() {
    string str;
    cin >> str;
    int n = str.length();
    if(isKaibun(str, 0, n-1) && isKaibun(str, 0, ((n-1)/2)-1) && isKaibun(str, ((n+3)/2)-1, n-1)){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
const int mod=1e9+7;
int n,tong[30],ans=1;
string s;
int main()
{
	cin>>n>>s;
	for(int i=1;i<=n;i++) tong[s[i-1]-'a']++;
	for(int i=1;i<=26;i++) ans=1ll*ans*(tong[i-1]+1)%mod;
	cout<<(ans+mod-1)%mod<<endl;
}

Measured memory_bytes: 1020
// B.

#include <iostream>
#include <sstream>
#include <algorithm>

using namespace std;

int main(int argc, char *argv[]) {
	string s, t;
	cin >> s >> t;
	sort(s.begin(), s.end());
	sort(t.rbegin(), t.rend());
	string ans = s < t ? "Yes" : "No";
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
#include <algorithm>
#include <iostream>
#include <string.h>

using namespace std;

int main()
{
   int n, a[1000], i, z=0, m=0;
   scanf("%d",&n);
   for(i=0;i<n;i++)
   {
       scanf("%d",&a[i]);
       if(a[i]>=m)
       {
           z++;
           m=a[i];
       }
   }
   printf("%d\n",z);
   return 0;
}


Measured memory_bytes: 256
def _main():
    N = int(input())
    A, B, C = input(), input(), input()

    count = 0
    for i in range(N):
        if A[i] == B[i]:
            if A[i] == C[i]:
                pass
            else:
                count += 1
        else:
            if A[i] == C[i]:
                count += 1
            elif B[i] == C[i]:
                count += 1
            else:
                count += 2

    print(count)


if __name__ == '__main__':
    _main()


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

using namespace std;
typedef long long ll;

ll N;

int main(){
    cin >> N;
    if(N%2==1){
        cout << 0 << endl;
        return 0;
    }
    ll c = 0;
    ll t = 5;
    N /= 2;
    while(N >= t){
        c += N/t;
        t*=5;
    }
    cout << c << endl;
    return 0;
}

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

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

using namespace std;
using ll = long long;
int mod = 1000000007;

int num[3] = {0, 0, 0};
void add(){
    if(num[2] == 9 && num[1] == 9){
        num[0] += 1; num[1] = 0; num[2] = 0;
    }
    else if(num[2] == 9){
        num[1] += 1; num[2] = 0;
    }
    else num[2] += 1;
}

int main(void){
    int N; cin >> N;
    string S; cin >> S;
    //for(int i = 0; i < 30000; i++) S += "1";
    int cnt = 0;
    for(int i = 0; i < 1000; i++){
        int idx = 0;
        for(int j = 0; j < N; j++){
            if(S[j] - '0' == num[idx]){
                idx++;
                if(idx == 3) break;
            }
        }
        if(idx == 3) cnt++;
        add();
    }
    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 256
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <numeric>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <functional>
#define _USE_MATH_DEFINES
#include <cmath>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cfloat>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <cassert>
using namespace std;

#define EPS 1e-12
#define ull unsigned long long
#define ll long long
#define VI vector<ll>
#define PII pair<ll, ll> 
#define VVI vector<vector<ll> >
#define REP(i,n) for(int i=0,_n=(n);(i)<(int)_n;++i)
#define RANGE(i,a,b) for(int i=(int)a,_b=(int)(b);(i)<_b;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define ALLR(c) (c).rbegin(), (c).rend()
#define PB push_back
#define MP(a, b) make_pair(a, b)
#define POPCOUNT __builtin_popcount
#define POPCOUNTLL __builtin_popcountll
#define CLEAR(table, v) memset(table, v, sizeof(table));
#define PRINT1(table, D0) REP(d0, D0) cout<<table[d0]<<" "; cout<<"\n";
#define PRINT2(table, D0, D1) REP(d0, D0) { REP(d1, D1) cout<<table[d0][d1]<<" "; cout<<"\n"; }
#define PRINT3(table, D0, D1, D2) REP(d0, D0) { REP(d1, D1) { REP(d2, D2) cout<<table[d0][d1][d2]<<" "; cout<<"\n"; } cout<<"\n"; }
#define UNIFORM_DOUBLE(a, b) (((b-a)*(double)rand()/RAND_MAX)+a) // [a, b) 
#define UNIFORM_LL(a, b) (ll)UNIFORM_DOUBLE(a, b) // [a, b) 
#define IN(v, lo, hi) ((lo)<=(v) && (v)<(hi))
#define DD(v) cout<<#v<<": "<<v<<endl
template <typename T0, typename T1> std::ostream& operator<<(std::ostream& os, const map<T0, T1>& v) { for( typename map<T0, T1>::const_iterator p = v.begin(); p!=v.end(); p++ ){os << p->first << ": " << p->second << " ";} return os; }
template <typename T0, typename T1> std::ostream& operator<<(std::ostream& os, const pair<T0, T1>& v) { os << v.first << ": " << v.second << " "; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const vector<T>& v) { for( int i = 0; i < (int)v.size(); i++ ) { os << v[i] << " "; } return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const vector<vector<T> >& v) { for( int i = 0; i < (int)v.size(); i++ ) { os << v[i] << endl; } return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const set<T>& v) { vector<T> tmp(v.begin(), v.end()); os << tmp; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const deque<T>& v) { vector<T> tmp(v.begin(), v.end()); os << tmp; return os; }

#define MOD 1000000007LL
#define INF (1LL<<60)

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll N,M;
	while(cin>>N>>M) {
		VI X(M);
		REP(i, M) cin>>X[i];
		sort(ALL(X));
//		DD(X);
		vector<PII> L(M-1);
		REP(i, M-1) L[i] = MP(X[i+1]-X[i], i);
		sort(ALLR(L));
//		DD(L);
		VI cut(M-1);
		REP(i, min(N-1, M-1)) {
			cut[L[i].second] = 1;
		}
//		DD(cut);
		ll ans = 0;
		ll l = 0;
		REP(i, M-1) {
			if(cut[i]) {
				ans += l;
				l = 0;
			} else {
				l += X[i+1]-X[i];
			}
		}
		ans += l;
		
		cout<<ans<<endl;
	}
	
	return 0;
}


Measured memory_bytes: 3456
#include<bits/stdc++.h>
using namespace std;
#define inf INT_MAX
#define INF LLONG_MAX
#define ll long long
#define ull unsigned long long
#define M (int)(1e9+7)
#define P pair<int,int>
#define FOR(i,m,n) for(int i=(int)m;i<(int)n;i++)
#define RFOR(i,m,n) for(int i=(int)m;i>=(int)n;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,n,0)
#define all(a) a.begin(),a.end()
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};
#define F first
#define S second
#define PB push_back
#define EB emplace_back
#define int ll
#define vi vector<int>
#define IP pair<int,P>
#define PI pair<P,int>
#define PP pair<P,P>
#define Yes(f){cout<<(f?"Yes":"No")<<endl;}
#define YES(f){cout<<(f?"YES":"NO")<<endl;}
int Madd(int x,int y) {return (x+y)%M;}
int Msub(int x,int y) {return (x-y+M)%M;}
int Mmul(int x,int y) {return (x*y)%M;}



template< typename T >
struct edge {
  int src, to;
  T cost;

  edge(int to, T cost) : src(-1), to(to), cost(cost) {}

  edge(int src, int to, T cost) : src(src), to(to), cost(cost) {}

  edge &operator=(const int &x) {
    to = x;
    return *this;
  }

  operator int() const { return to; }
};

template< typename T >
using Edges = vector< edge< T > >;
template< typename T >
using WG = vector< Edges< T > >;
using UG = vector< vector< int > >;
template< typename T >
using Matrix = vector< vector< T > >;

template< typename T >
void tsort_dfs(int u,vector<int> &graph,vector<bool> &visited,WG<T> &g){

  if(visited[u]) return;
  visited[u] = true;
  for(int i=0;i<g[u].size();i++){
    tsort_dfs(g[u][i].to,graph,visited,g);
  }
  graph.PB(u);
}

template< typename T>
vector<int> tsort(WG<T> &g){
  vector<int> graph;
  vector<bool> visited(g.size(),false);
  for(int i=0;i<g.size();i++){
    tsort_dfs(i,graph,visited,g);
  }
  reverse(all(graph));
  return graph;
}

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

  int n,m;
  cin>>n>>m;
  WG<int> es(n);
  rep(i,m){
    int a,b;
    cin>>a>>b;
    es[a].PB(edge<int>(b,0));
  }

  vi res=tsort(es);
  for(auto x:res){
    cout<<x<<endl;
  }


}


Measured memory_bytes: 4856
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		// スペース区切りの整数の入力
		int b = sc.nextInt();
		// 出力

		if ((a >= 1 && a <= 9) && (b >= 1 && b <= 9)) {
			System.out.println(a * b);
		} else {
			System.out.println(-1);
		}

	}

}

Measured memory_bytes: 25044
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

typedef long long ll;

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

    vector<int> arr(n);
    for (int& e : arr)
        cin >> e;

    sort(begin(arr), end(arr));

    int minima = 1e9;
    for (int i = 0; i < n; i ++) {
        int other = (i + n - 1) % n;
        int d = (arr[other] - arr[i]);
        if (d < 0)
            d += k;

        minima = min(minima, d);
    }

    cout << minima << endl;
    
    return 0;
}

Measured memory_bytes: 1280
using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using System.Text;


class Program
{
    static void Main(string[] args)
    {
        // 入力
        //var s = Console.ReadLine();
        //var n = int.Parse(Console.ReadLine());
        long[] nm = Console.ReadLine().Split().Select(long.Parse).ToArray();
        var n = nm[0];
        var m = nm[1];

        long[] a = Console.ReadLine().Split().Select(long.Parse).ToArray();

        long ans = -1;
        if (a.Sum() <= n)
        {
            ans = n- a.Sum();
        }

        // 出力
        Console.WriteLine(ans);
    }
}

Measured memory_bytes: 29288
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);++i)
#define ALL(v)   (v).begin(),(v).end()
#define INF      (int)1e9
#define MOD      ((int)1e9+7)
using namespace std;
typedef long long     llong;
typedef pair<int,int> pii;
typedef vector<int>   vi;
typedef vector<vi >   vvi;
typedef vector<vvi >  vvvi;
template<class Type> void join(const Type& a){for(auto elem:a)cout<<elem<<' ';cout<<endl;}

int main(){
	int n;
	cin>>n;
	
	vi a(n);
	REP(i,n) cin>>a[i];
	
	int cnt=0;
	int ans=0;
	REP(i,n-1){
		if(a[i]>=a[i+1]) cnt++;
		else{
			ans=max(ans,cnt);
			cnt=0;
		}
	}
	ans=max(ans,cnt);
	
	cout<<ans<<endl;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define forn(i,a,b) for(int i =a;i<b;i++)
#define fi first
#define se second
#define fast ios_base::sync_with_stdio(false);
using namespace std;

//for debugging 
/*
g++ -D_GLIBCXX_ASSERTIONS -DDEBUG -ggdb3 -std=c++14 
*/
int recur_depth = 0;
#ifdef DEBUG
#define dbg(x) {++recur_depth; auto x_=x; --recur_depth; cerr<<string(recur_depth, '\t')<<"\e[91m"<<__func__<<":"<<__LINE__<<"\t"<<#x<<" = "<<x_<<"\e[39m"<<endl;}
#else
#define dbg(x)
#endif
template<typename Ostream, typename Cont>
typename enable_if<is_same<Ostream,ostream>::value, Ostream&>::type operator<<(Ostream& os,  const Cont& v){
	os<<"[";
	for(auto& x:v){os<<x<<", ";}
	return os<<"]";
}
template<typename Ostream, typename ...Ts>
Ostream& operator<<(Ostream& os,  const pair<Ts...>& p){
	return os<<"{"<<p.first<<", "<<p.second<<"}";
}
// debugging ends here

typedef long long int ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
// const int mxn = 2e5+99;
const int mxn = 2e5+100;
vi adj[mxn];
int vis[mxn];
int comp_size[mxn];


void dfs(int u,int comp, int p=-1){
	comp_size[comp]+=1;
	vis[u] = 1;
	for(auto v:adj[u]){
		if(!vis[v]){
			dfs(v,comp,u);
		}
	}
}

void solve(){
		
	int n,m;
	cin >> n >> m;
	for(int i =0;i<m;i++){
		int u,v;
		cin >> u >> v;
		--u, --v;
		adj[u].pb(v);
		adj[v].pb(u);
	}
	int ans = 0;
	int comp = 0;
	for(int i=0;i<n;i++){
		if(!vis[i]){
			dfs(i,comp);
			ans = max(ans,comp_size[comp]);
			comp++;
		}
	}
	cout << ans << endl;
}

int main(){
	fast;
	#ifndef ONLINE_JUDGE
		freopen("input.txt","r",stdin);
		freopen("output.txt","w",stdout);
	#endif

	// int t;cin >> t;while(t--)
		solve();
}


Measured memory_bytes: 24708
while gets
    g=$_.chomp.to_i
    h=Array.new
    loop do
        break if(g==0)
        h<<g%2
        g=g/2
    end
    ans=[]
    h.each_with_index{|item,num| ans<<item*2**num if(item*2**num!=0)}
    puts ans.join(" ")
end

Measured memory_bytes: 6104
N,K=map(int,input().split())
A=list(map(int,input().split()))
A=[0]+A
for i in range(N):
    A[i+1]+=A[i]
B=[]
for i in range(1,N+1):
    for j in range(N-i+1):
        B.append(A[i+j]-A[j])
B.sort(reverse=True)
m=40
x=0
for t in range(m,0,-1):
    res=0
    for a in B:
        if ((x+2**(t-1))&a)==(x+2**(t-1)):
            res+=1
        if res>=K:
            x+=2**(t-1)
            break
print(x)


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


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



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define  ft  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define  ll  long long
#define  pi  pair<int,int>
#define  pb  push_back
#define  F   first
#define  S   second
const int N=2e5+2;
string s,p;
set<char>ss;
int main()
{
    ft
    int t,i,j,n,m,l,r,z;
    cin>>s;
    for(char c:s)
    {
        ss.insert(c);
    }
    l=ss.size();
    r=s.size();
    if(l==r)
    {
        cout<<"yes\n";
    }
    else
    {
        cout<<"no\n";
    }
    return 0;
}



Measured memory_bytes: 256
import java.util.Scanner;
 
public class Main {
	public static void main(String[] args) {
      Scanner sc = new Scanner(System.in);
      int K =sc.nextInt();
      int X =sc.nextInt();
      
      for(int i=(X-K)+1; i<=(X+K)-1; i++){
      System.out.print(i+" ");
      }
    }
}

Measured memory_bytes: 22740
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        #[cfg(debug_assertions)]
        writeln!(&mut std::io::stderr(), concat!("[DEBUG] ", $(stringify!($a), "={:?} "),*), $($a),*);
    }
}

#[allow(unused_imports)]
use std::cmp::{min, max};
#[allow(unused_imports)]
use std::io::{stdout, stdin, BufWriter, Write};

fn main() {
    let out = std::io::stdout();
    let mut out = BufWriter::new(out.lock());
    macro_rules! puts {
        ($($format:tt)*) => (write!(out,$($format)*).unwrap());
    }

    input!{
      n: usize,
      aa: [i64;n],
      bb: [i64;n],
    }

    let mut diffs: Vec<_> = (0..n).map(|i| bb[i] - aa[i]).collect();
    diffs.sort();

    let mut temp = 0;
    for d in diffs {
        if d >= 0 {
            temp += d/2;
        } else {
            temp += d;
        }
    }
    if temp >= 0 {
        puts!("{}\n", "Yes");
    } else {
        puts!("{}\n", "No");
    }
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define REP(i, n) FOR(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define bit(x) (1L << (x))
using ll = long long;
using namespace std;

template<typename T>
vector<T> make_v(size_t a,T b){return vector<T>(a,b);}
 
template<typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v(ts...))>(a,make_v(ts...));
}

int main() {
  ll h, w; cin >> h >> w;

  function<ll(ll, ll)> calc = [](ll h, ll w){
    ll ret = numeric_limits<ll>::max();

    // border
    ll b = (h % 3 == 0)? 0: w;
    ret = min(ret, b);
  
    // t
    REP(i, h){
      vector<ll> s;
      s.push_back(i * w);
      s.push_back((h - i) * (w / 2));
      s.push_back((h - i) * (w - w / 2));

      ll res = *max_element(s.begin(), s.end()) - *min_element(s.begin(), s.end());
      ret = min(ret, res);
    }

    return ret;
  };

  cout << min(calc(h, w), calc(w, h)) << endl;

  return 0;
}


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

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

using namespace std;

typedef long long ll;

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

  int n; cin >> n;

  string s, t;
  cin >> s >> t;

  for (int i = n; i > 0; i--) {
    if (s.substr(n-i, n) == t.substr(0, i)) {
      cout << 2*n-i << endl;
      return 0;
    }
  }
  cout << 2*n << endl;

  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>

#define MAX_N (100000)

using namespace std;

int main(int argc, char *argv[]) {
  // read inputs
  int N, K, as[MAX_N];
  scanf("%d %d", &N, &K);
  for (int i = 0; i < N; i++) {
    scanf("%d", &as[i]);
  }

  // calculate accumulated sums
  long accs[MAX_N + 1], acc_poss[MAX_N + 1];
  accs[0] = 0;
  acc_poss[0] = 0;
  for (int i = 0; i < N; i++) {
    accs[i + 1] = accs[i] + as[i];
    acc_poss[i + 1] = acc_poss[i] + max(as[i], 0);
  }

  // solve
  long ans = 0;
  for (int k = 0; k < N - K + 1; k++) {  // [k, k + K) will be the same color
    const long sum_before = acc_poss[k] - acc_poss[0];
    const long sum_after = acc_poss[N] - acc_poss[k + K];
    const long sum_continuous = accs[k + K] - accs[k];
    ans = max(ans, sum_before + sum_after + max(sum_continuous, 0L));
  }
  printf("%ld\n", ans);
  
  return 0;
}


Measured memory_bytes: 2176
#include <bits/stdc++.h>
using namespace std;
#define all(c) (c).begin(),(c).end()
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define iter(c) __typeof((c).begin())
#define tr(it,c) for(iter(c) it=(c).begin(); it!=(c).end(); it++)
#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)
#define pr(a) cout << (a) << endl
#define F first
#define S second
typedef long long ll;
typedef pair<int,int> P;
const int MAX=1000000001;
int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

int main() {
  int n;
  cin >> n;
  P a[100005];
  memset(a,0,sizeof(a));
  rep(i,n) {
    int x,y;
    cin >> x >> y;
    a[x].F++;
    a[y].S++;
  }
  int ans=0,p=1;
  for(int i=1; i<100005; i++) {
    p+=a[i].F;
    p-=a[i-1].S;
    if(p>=i) ans=i-1;
  }
  pr(ans);
  return 0;
}


Measured memory_bytes: 1948
#include <bits/stdc++.h>
using intl = long long;
using ld = long double;
using namespace std;
#define rep(i, n) for(intl i = 0; i < (intl)(n); i++)
#define repd(i, n) for(intl i = (intl)(n); i >= 0; i--)
#define repi(i, a, b) for(intl i = (intl)(a); i < (intl)(b); i++)
#define repid(i, a, b) for(intl i = (intl)(a); i >= (intl)(b); i--)
#define max(a, b) ((a) > (b) ? (a) : (b))
#define min(a, b) ((a) < (b) ? (a) : (b))
#define all(x) (x).begin,(x).end()
#define m0(x) memset(x,0,sizeof(x))
#define fill(x,y) memset(x,y,sizeof(x))
#define length(a) (sizeof(a) / sizeof(a[0]))
#define cin(i, a) rep(i, length(a))cin >> a[i]
#define ccin(i, j, a) rep(i, length(a))rep(j, length(a[i]))cin >> a[i][j]
#define debug(x) cout << #x << ":" << x << endl
#define sqrtl sqrt
#define pb push_back
#define mp make_pair
const intl INF = 1e9;
const intl MOD = 1e9+7;
const ld eps = 1.0e-14;//-9
void fp(bool flag){
    if(flag)cout << "Yes" << endl;
    else cout << "No" << endl;
}
int main(){
    intl a,b,c,d;
    cin >> a >> b >> c >> d;
    cout << max(a * b, c * d) << endl;
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Console;
using static System.Math;

namespace AtTest.ABC_153
{
    class D
    {
        static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(OpenStandardOutput()) { AutoFlush = false };
            SetOut(sw);

            Method(args);

            Out.Flush();
        }

        static void Method(string[] args)
        {
            long h = ReadLong();
            long res = 0;
            long tmp = h;
            long now = 1;
            while (tmp > 0)
            {
                res += now;
                tmp /= 2;
                now *= 2;
            }
            WriteLine(res);
        }

        private static string Read() { return ReadLine(); }
        private static char[] ReadChars() { return Array.ConvertAll(Read().Split(), a => a[0]); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
    }
}


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

int main(){
    ll n,k; cin>>n>>k;
    vector<int> h(n);
    rep(i,n) cin>>h[i];
    sort(h.rbegin(),h.rend());
    ll ans=0;
    for(int i=k;i<n;i++) ans+=h[i];
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 1024
N = int(input())

dic = {}
for i in range(N):
    s = sorted(input())
    ss = "".join(s)
    if ss in dic:
        dic[ss] += 1
    else:
        dic[ss] = 1

res = 0
for d in dic.values():
    res += d * (d - 1) // 2

print(res)


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

int main(){
  int x,y,z;
  cin >> x >> y >> z;
  int out = 0;
  x-=z;
  while(x>=0){
    x-=(y+z);
    out++;
  }
  out--;
  cout << out << endl;

  return 0;
}

Measured memory_bytes: 256
#include<cstdio>

using namespace std;

void bubble_ask(int x[]);

int card[5];
int main(void){
	int i,cnt=0,st=0,pair=0;

	while(scanf("%d,%d,%d,%d,%d",&card[0],&card[1],&card[2],&card[3],&card[4])!=EOF){
		//昇順にソート
		bubble_ask(card);
		
		for(i=0;i<4;i++){
			if(card[i]+1==card[i+1])	st++;
			if(card[i]==1 && card[4]==13 && card[1]!=2)	st++;
			if(i!=3){
				if(card[i]==card[i+1] && card[i+1]==card[i+2] && cnt!=4)	cnt=3;
			}
			if(i!=3 && i!=2){
				if(card[i]==card[i+1] && card[i+1]==card[i+2] && card[i+2]==card[i+3])	cnt=4;
			}
			if(card[i]==card[i+1]) pair++;
		}

		//four card
		if(cnt==4)	printf("four card\n");
		//full house
		else if(cnt==3 && pair==3)	printf("full house\n");
		//straight
		else if(st==4)	printf("straight\n");
		//three card
		else if(cnt==3)	printf("three card\n");
		//two pair
		else if(pair==2)	printf("two pair\n");
		//one pair
		else if(pair==1)	printf("one pair\n");
		//null
		else	printf("null\n");

		cnt=st=pair=0;
	}

	return 0;
}

void bubble_ask(int card[]){
	int i,j,data;
	for(i=0;i<4;i++){
		for(j=i+1;j<5;j++){
			if(card[i] > card[j]){
				data=card[i];
				card[i]=card[j];
				card[j]=data;
			}
		}
	}
}

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

using namespace std;
using int64 = long long int;

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

	unordered_map<string, int> C;
	int maxCount = 0;
	for (int i = 0; i < n; i++)
	{
		string s;
		cin >> s;
		int count = ++C[s];
		maxCount = max(maxCount, count);
	}

	vector<string> result;
	for (auto &pair : C)
	{
		if (pair.second == maxCount)
		{
			result.push_back(pair.first);
		}
	}

	sort(result.begin(), result.end());
	for (auto &str : result)
	{
		cout << str << endl;
	}
}

Measured memory_bytes: 26692
program pr3
  implicit none
  character(len=4) :: charn
  character(len=1) :: charop(3)
  integer :: a(4), i, b(4), n
  
  read(*,*) charn
  do i = 1, 4
     read(charn(i:i),*) a(i)
  end do
  b(1) = 1
  do i = 0, 7
     call dectoopr(i,b(2:4))
     if ( dot_product(a,b) == 7 ) then
        call opr(b(2:4),charop)
        write(*,'(i1,a,i1,a,i1,a,i1,a)') a(1),charop(1),a(2),charop(2),a(3),charop(3),a(4),'=7'
        exit
     end if
  end do
  
  stop
contains
  subroutine dectoopr(n,b)
    implicit none
    integer :: n, b(3)
    select case(n)
    case(0)
       b = (/-1,-1,-1/)
    case(1)
       b = (/-1,-1,1/)
    case(2)
       b = (/-1,1,-1/)
    case(3)
       b = (/-1,1,1/)
    case(4)
       b = (/1,-1,-1/)
    case(5)
       b = (/1,-1,1/)
    case(6)
       b = (/1,1,-1/)
    case(7)
       b = (/1,1,1/)
    case default
       stop
    end select
    return
  end subroutine dectoopr


  subroutine opr(b,charop)
    implicit none
    integer :: b(3)
    character(len=1) :: charop(3)
    integer :: i
    do i = 1, 3
       if ( b(i) == 1 ) then
          charop(i) = '+'
       else
          charop(i) = '-'
       end if
    end do
    return
  end subroutine opr
end program pr3


Measured memory_bytes: 2900
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    rr = []

    def f(n):
        r = 0
        t = 0
        for c in n:
            if c == 'R':
                t += 1
                if t == 4:
                    r += 1
                    t = 0
            else:
                t -= 1
                if t == -4:
                    t = 0
        return r

    while 1:
        n = S()
        if n == 0:
            break
        rr.append(f(n))
        break

    return '\n'.join(map(str, rr))


print(main())



Measured memory_bytes: 9024
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define ll long long
#define imfor(i, n) for(int i = 0; i < n; i++)
using namespace std;
ll MOD = 1000000007;

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

int main() {
    ll a, b, c, d;
    cin >> a >> b >> c >> d;
    ll v1 = b / c;
    ll v2 = (a - 1) / c;
    ll v3 = b / d;
    ll v4 = (a - 1) / d;
    ll v5 = b / ((c * d) / gcd(c, d));
    ll v6 = (a - 1) / ((c * d) / gcd(c, d));
    cout << (b - a + 1) - (v1 - v2 + v3 - v4 - v5 + v6) << endl;
}

Measured memory_bytes: 256
n = int(input())
t_ = 0
x_ = 0
y_ = 0
for i in range(n):
    t, x, y = map(int, input().split())
    if abs(x-x_)+abs(y-y_) > t-t_:
        print('No')
        exit()
    else:
        r = (t-t_) - abs(x-x_)-abs(y-y_)
        if r%2 == 0:
            t_ = t
            x_ = x
            y_ = y
        else:
            print('No')
            exit()
else:
    print('Yes')

Measured memory_bytes: 3064