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

using namespace std; 
#define REP(i, n) for (int i = 0; i < (n); i++)
// #define mod 1000000007
#define MOD (int)1e9+7
typedef long long ll;

ll modPow(ll a, int p) {// a^p (mod mod)
    if (p == 0) return 1;
    if (p%2 == 0) {
        int halfP = p/2;
        ll half = modPow(a, halfP);
        return half * half % (MOD);
    }
    else {
        ll ans = a * modPow(a, p - 1);
        return ans % (MOD);
    }
}

ll calcComb(int n, int r) {
    r = min(r, n-r);
    ll mulMod = 1;
    ll divMod = 1;
    for (int i = 0; i < r; i++) {
        mulMod *= (n - i);
        divMod *= (i + 1);
        mulMod %= (MOD);
        divMod %= (MOD);
    }
    ll ans = mulMod * modPow(divMod, MOD -2);
    return  ans % (MOD);
}

int main(int argc, char const *argv[])
{
    cin.tie(0);
   	ios::sync_with_stdio(false);
    int N, M; cin >> N >> M;
    int restM = M;
    ll res = 1;
    for (int i = 2; i * i < M; i++) {
        if (restM % i == 0) {
            int cnt = 1;
            restM /= i;
            while (restM % i == 0) {
                cnt++; restM /= i;
            }
            res *= calcComb(cnt + N - 1,N-1);
            res %= (MOD);
        }
    }
    if (restM != 1) {
        res *= calcComb(1 + N - 1,N-1);
        res %= (MOD);
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        
        Scanner sc = new Scanner(System.in);
        long a = Long.parseLong(sc.next());
        long b = Long.parseLong(sc.next());
        long g = getGCD(a, b);
        Map<Long,Integer> map = prime_factor(g);
        map.put(1L,1);
        sc.close();
        System.out.println(map.size());

    }
    public static long getGCD(long a,long b){
        if(b==0){
            return a;
        }else{
            return getGCD(b,a%b);
        }
    }
    public static Map<Long,Integer> prime_factor(long l){

        Map<Long,Integer> map = new HashMap<>();
        long num = l;
        int count;
        for(long i=2;i*i<=num;i++){
            count = 0;
            while(l%i==0){
                count++;
                l/=i;
            }
            if(count>0)map.put(i,count);
        }
        if(l!=1)map.put(l,1);
        return map;
    }
}

Measured memory_bytes: 23636
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Scanner;

class Main {

  private static void reverse(long[] arr) {
    for (int i = 0; i < arr.length / 2; i++) {
      long tmp = arr[i];
      arr[i] = arr[arr.length - i - 1];
      arr[arr.length - i - 1] = tmp;
    }
  }

  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    int X = Integer.parseInt(scanner.next());
    int Y = Integer.parseInt(scanner.next());
    int Z = Integer.parseInt(scanner.next());
    int K = Integer.parseInt(scanner.next());
    long[] A = new long[X];
    long[] B = new long[Y];
    long[] C = new long[Z];
    for (int i = 0; i < X; i++) {
      A[i] = Long.parseLong(scanner.next());
    }
    for (int i = 0; i < Y; i++) {
      B[i] = Long.parseLong(scanner.next());
    }
    for (int i = 0; i < Z; i++) {
      C[i] = Long.parseLong(scanner.next());
    }
    Arrays.sort(A);
    Arrays.sort(B);
    Arrays.sort(C);
    reverse(A);
    reverse(B);
    reverse(C);
    ArrayList<Long> ABC = new ArrayList<Long>();
    for (int a = 0; a < X; a++) {
      for (int b = 0; b < Y; b++) {
        if ((a + 1) * (b + 1) > K) {
          break;
        }
        for (int c = 0; c < Z; c++) {
          if ((a + 1) * (b + 1) * (c + 1) > K) {
            break;
          }
          ABC.add(A[a] + B[b] + C[c]);
        }
      }
    }
    Collections.sort(ABC, Collections.reverseOrder());
    for (int i = 0; i < K; i++) {
      System.out.println(ABC.get(i));
    }
  }

}


Measured memory_bytes: 33836
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
using namespace std;
#ifndef FAST_IO
 #define IOS ios_base::sync_with_stdio(false);cin.tie(nullptr);
#endif

#define FILE_IO freopen("input.txt","r",stdin)
#define int long long
#define f first
#define s second
#define endl '\n'
#define all(c) c.begin(),c.end()
#define debug(x) cerr << #x << " = " << x << endl;

const int MOD = 1e9 + 7;
const int INF = 1<<29;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template<typename T>void print(T t){for(auto &it:t)cout<<it<<" ";}
inline int powerexp(int a,int b,int m = MOD){int res=1;while(b){if(b&1)res=res*a%m;a=a*a%m,b>>=1;}return res%m;}
inline int modinv(int a){return powerexp(a,MOD-2,MOD);}
inline int lcm(int a,int b){int g=__gcd(a,b);return a/g*b;}

//-------------------< start here >-------------------------// 
void solve(){
   int n;
   cin >> n;
   map<int,int> m;
   if ( n == 1){
	      cout << 1 << endl;
	      return; 
	  }
   for(int i = 1; i <= n; i++){
	      int ret = i,cnt=0;
	      if ( ret % 2 == 0){
			  while ( ret % 2 == 0){
				   ret /= 2;
				   cnt++; 
				 } 
			 }
		m[i] = cnt;
	  }
	int ret , mx = 0;
  for(auto it : m) {
	  if( it.s > mx){
		    mx = it.s;
		    ret = it.f; 
		 }
  }
  cout << ret << endl; 	
}
//-----------------------------
//comment from here for TOPCODER 
int32_t main(){
   IOS;
   solve();
   //find();
   #ifdef LOCAL_DEFINE
   cerr<<"time elapsed "<<(double)clock()/CLOCKS_PER_SEC<<endl;
   #endif
}


Measured memory_bytes: 384
#!/usr/bin/env python3
import sys


def solve(N: int, M: int):
    print(abs(N - 2) * abs(M - 2))


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    solve(N, M)


if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
#include<stdio.h>

int main()
{
  int n,k;
  char s[10];
  scanf("%d",&n);
  (void)getchar();
  scanf("%s",s);
  (void)getchar();
  scanf("%d",&k);

  for ( int i = 0; i < n; i++ ) {
    if ( s[i] != s[k-1] ) {
      printf("*");
    } else {
      printf("%c",s[i]);
    }
  }
  printf("\n");
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define srep(i,s,t) for(int i = s; i < t; ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
#define yn {puts("Yes");}else{puts("No");}
#define MAX_N 200005

int main() {
    int n, x, t;
    cin >> n >> x >> t;
   if(x*t>=n)yn;
    return 0;
}




Measured memory_bytes: 3624
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>

template <long long Modulus = 1000000007>
struct MInt
{
    long long x;
    static const long long mod = Modulus;
    
    MInt(long long a = 0) : x((a % mod + mod) % mod) {}

    // operator
    MInt& operator = (const MInt& a)
    {
        x = a.x;
        return *this;
    }
    MInt& operator = (const long long& a)
    {
        *this = MInt(a);
        return *this;
    }

    MInt operator -() const
    { 
        return MInt(-x);
    };

    MInt& operator +=(const MInt& a)
    {
        if ((x += a.x) >= mod)
            x -= mod;
        return *this;
    }

    MInt& operator -=(const MInt& a)
    {
        if ((x += mod - a.x) > mod)
            x -= mod;
        return *this;
    }

    MInt& operator *=(const MInt& a)
    {
        x *= a.x;
        x = x % mod;
        return *this;
    }

    MInt operator+(const MInt& a) const
    {
        MInt res(*this);
        return res += a;
    }

    MInt operator-(const MInt& a) const
    {
        MInt res(*this);
        return res -= a;
    }

    MInt operator*(const MInt& a) const
    {
        MInt res(*this);
        return res *= a;
    }

    MInt pow(long long t) const
    {
        if (t == 0)
            return 1;
        MInt a = pow(t >> 1);
        a *= a;
        if (t & 1)
            a *= *this;
        return a;
    }

    // only for prime mod
    MInt Inv() const
    {
        return pow(mod - 2);
    }
    // only for prime mod
    MInt& operator/=(const MInt& a)
    {
        return (*this) *= a.Inv();
    }
    MInt operator/(const MInt& a) const
    {
        MInt res(*this);
        return res /= a;
    }
};
using modint = MInt<>;
using namespace std;
int main()
{
    constexpr long long mod = 1e+9 + 7;
    int n;
    long long k;
    cin >> n >> k;
    vector<int> a(n);
    for (int i = 0; i < n; ++i) cin >> a[i];
    long long invcnt = 0;
    for (int i = 0; i < n; ++i)
    {
        for (int j = i + 1; j < n; ++j)
        {
            if (a[i] > a[j]) ++invcnt;
        }
    }
    long long invb = 0;
    for (int i = 0; i < n; ++i)
    {
        for (int j = 0; j < n; ++j)
        {
            if (a[i] > a[j]) ++invb;
        }
    }
    
    modint ans0 = 1;
    ans0 *= invcnt;
    ans0 *= k;

    modint ans1 = 1;
    ans1 *= invb;
    ans1 *= ((k - 1) * k ) / 2;
    
    modint ans = ans0 + ans1;
    cout << ans.x << endl;
    return 0;
}


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



int main()
{
	 #ifndef ONLINE_JUDGE
     freopen("input1.txt","r",stdin);
     freopen("output1.txt","w",stdout);
   #endif
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	
	int t,n;
	string lefts,rights;
	// cin>>t;
	// while(t--)
	// {


	// }
	cin>>lefts>>rights;
	int sum=0;
	for (int i = 0; i < lefts.length(); ++i)
	{
		if(lefts[i]!=rights[i])
			sum++;
		/* code */
	}
	cout<<sum;
	
	return 0;
}


Measured memory_bytes: 3808
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.stream.IntStream;
import java.io.UncheckedIOException;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author mikit
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        LightScanner in = new LightScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        BSmallAndLargeIntegers solver = new BSmallAndLargeIntegers();
        solver.solve(1, in, out);
        out.close();
    }

    static class BSmallAndLargeIntegers {
        public void solve(int testNumber, LightScanner in, PrintWriter out) {
            int a = in.ints(), b = in.ints(), k = in.ints();
            IntStream.rangeClosed(a, b).filter(i -> i - a < k || b - i < k).forEach(out::println);
        }

    }

    static class LightScanner {
        private BufferedReader reader = null;
        private StringTokenizer tokenizer = null;

        public LightScanner(InputStream in) {
            reader = new BufferedReader(new InputStreamReader(in));
        }

        public String string() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new UncheckedIOException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int ints() {
            return Integer.parseInt(string());
        }

    }
}



Measured memory_bytes: 28116
#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;

void solve();

int main(void){
    int N, M; cin >> N >> M;
    int cnt[N+1] = {};
    rep(i, M){
        int a, b;
        cin >> a >> b;
        cnt[a]++; cnt[b]++;
    }
    rep(i, N+1){
        if(cnt[i] % 2 == 1){
            cout << "NO" << endl;
            return 0;
        }
    }
    cout << "YES" << endl;
    return 0;
}

void solve(){}

Measured memory_bytes: 640
import std;

void main(){ 
	int n,m;
	scanf("%d %d\n", &n, &m);
	auto hs = readln.chomp.split.to!(int[]);
	auto as = new int[m];
	auto bs = new int[m];
	auto mem = new bool[n];
	foreach(ref x; mem) {
		x = true;
	}
	foreach(i; 0..m) {
		int a,b;
		scanf("%d %d\n", &a, &b);
		if (hs[a-1] <= hs[b-1]) {
			mem[a-1] &= false;
		}
		if (hs[b-1] <= hs[a-1]) {
			mem[b-1] &= false;
		}
	}
	mem.count!"a".writeln;
}


Measured memory_bytes: 7684
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll inf = 1e18;
int main(int argc,char ** argv){
	//cout << "start" << endl;
	string s1 , s2; 
    cin >> s1; 
    cin >> s2; 
    int sz1 = s1.size(), sz2 = s2.size(); 
    vector< vector<ll> > dp(sz1 + 1 , vector< ll > (sz2 + 1 , 0));

    for(int i = 1 ; i  <= sz1 ; i++){
    	for(int j = 1; j <= sz2 ; j++){
    		if(s1[i - 1] == s2[j - 1])
    			dp[i][j] = dp[i - 1][j - 1] + 1;
    		else{
    			dp[i][j] = max(dp[i - 1][j] , dp[i][j - 1]);

    		}
    		
    	}
    }
  /*  for(int i = 1 ; i  <= sz1 ; i++){
    	for(int j = 1; j <= sz2 ; j++){
    		cout << dp[i][j] << " " ;
    		
    	}
    	cout << endl;
    }*/
  	//cout << dp[sz1][sz2] << endl;
   	string ans;
   	int i = sz1 , j = sz2;
    while(i > 0 && j > 0){
    	//cout << "yes" << endl;
    	if(s1[i - 1] == s2[j - 1]){
    		//cout << "yes2" << endl;
    		ans += (s1[i - 1]);
    		//cout << s1[i] << endl;
    		i--;
    		j--;
    	}
    	else if(dp[i - 1][j] > dp[i ][j - 1])
    		i--;
    	else
    		j--;
    }
    reverse(ans.begin(), ans.end());
    cout << ans << endl;
    return 0;
    return 0;
}


Measured memory_bytes: 70784
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
// typedef pair<ll,ll> Pair;
// ll mod=1000000007;
int main(){
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL);
    ll t,c,i,j,k,temp,temp2,n,m,sum=0;
    cin >> t >> n;
    vector <ll> a(n);
    for(i=0;i<n;i++){
        cin >> a[i];
    }
    ll ans = LONG_LONG_MAX;
    for(i=0;i<n-1;i++){
        ans = min(ans,t-a[i+1]+a[i]);
    }
    ans = min(ans,a[n-1]-a[0]);
    cout << ans;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
// #pragma GCC optimize("Ofast")
// #pragma GCC target("avx,avx2,fma")
// #pragma GCC optimize("unroll-loops")
using namespace std;
typedef long long ll;

namespace Math {
    ll modpow(ll b, ll p, ll m) {
        ll r = 1;
        for (; p; p >>= 1, b = b * b % m)
            if (p & 1)
                r = r * b % m;
        return r;
    }

    ll modinv(ll b, ll m) { return modpow(b, m - 2, m); }

    // Least significant bit.
    ll lsb(ll x) { return x & (-x); }

    template <class T> const T inf() { return 0; }
    template <> const ll inf<ll>() { return 0x3f3f3f3f3f3f3f3fll; }
    template <> const int inf<int>() { return 0x3f3f3f3f; }

    template <class T> T gcd(T a, T b) { return abs(__gcd(a, b)); }
    template <class T> T clamp(T n, T l, T r) { return n < l ? l : n > r ? r : n; }
    template <class T> T lcm(T a, T b) { return abs(a / gcd(a, b) * b); }
    template <class T> T sgn(T n) { return n == 0 ? 0 : n > 0 ? 1 : -1; }

    // Generic modular integer.
    template<int MOD, typename IntType = int>
    struct GModint {
        IntType val;

        GModint() : val(0) {}

        GModint(int v, bool safe = false) { val = safe ? v : ((v % MOD) + MOD) % MOD; }

        GModint(ll v, bool safe = false) { val = safe ? v : ((v % MOD) + MOD) % MOD; }

        explicit operator bool() const { return val != 0; }

        const bool operator==(const GModint &g) const { return val == g.val; }

        const bool operator!=(const GModint &g) const { return val != g.val; }

        const GModint operator+=(const GModint &g) { return *this = *this + g; }

        const GModint operator-=(const GModint &g) { return *this = *this - g; }

        const GModint operator*=(const GModint &g) { return *this = *this * g; }

        const GModint operator/=(const GModint &g) { return *this = *this / g; }

        const GModint operator^=(const GModint &g) { return *this = *this ^ g; }

        const GModint operator-() const { return GModint(val == 0 ? 0 : MOD - val, true); }

        const GModint operator+(const GModint &g) const {
            ll newval = val + g.val;
            if (newval >= MOD)
                newval -= MOD;
            return GModint(newval, true);
        }

        const GModint operator-(const GModint &g) const { return *this + (-g); }

        const GModint operator*(const GModint &g) const { return GModint(1ll * val * g.val); }

        const GModint operator/(const GModint &g) const { return *this * g.inv(); }

        template<class T>
        const GModint operator^(const T t) const { return GModint(modpow(val, t, MOD)); }

        const GModint inv() const { return GModint(modinv(val, MOD)); }
    };

    using Modint = GModint<1000000007>;
}

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

    int n, m; cin >> n >> m;
    for (int i = 1; i <= ((1 << n) - 1); i++) {
        for (int j = 1; j <= ((1 << m) - 1); j++) {
            int li = i & -i;
            int lj = j & -j;
            cout << (li == lj ? 1 : 0) << "";
        }
        cout << endl;
    }
}


Measured memory_bytes: 1280
#include <cstdio>
#include <cmath>
using namespace std;

int main(){
    int n, d, out=0;
    double x, y;

    scanf("%d %d", &n, &d);
    for(int i=0; i<n; i++){
        scanf("%lf %lf", &x, &y);
        if( sqrt(x*x+y*y) <= (double)d){
            out++;
        }
    }

    printf("%d\n", out);
    return 0;
}


Measured memory_bytes: 2216
#pragma GCC optimize("O3", "unroll-loops")
#pragma GCC target("avx2")

#include <stdio.h>

constexpr int MAX_INPUT_SIZE = 2000'000; //'
char Input[MAX_INPUT_SIZE];
char* input = Input;

inline int getint(void){
    int res = 0, c; while((c = *input++ - '0') >= 0) res = 10 * res + c;
    return res;
}

struct coordinate{
    int x, y;
};

constexpr int MAX_N = 500;
coordinate Q[MAX_N * MAX_N];
int dist[MAX_N][MAX_N];
bool vacant[MAX_N][MAX_N];

int main(void){
    fread_unlocked(Input, 1, MAX_INPUT_SIZE, stdin);
    const int n = getint();
    {
        // initial distance
        const int p = n - 1;
        for(int i = 0; i < n; ++i){
            const int d1 = (i > p - i) ? p - i : i;
            for(int j = 0; j < n; ++j){
                const int d2 = (j > p - j) ? p - j : j;
                dist[i][j] = (d1 > d2) ? d2 : d1;
            }
        }
    }
    int res = 0;
    for(int _ = n * n; _--;){
        const int p = getint() - 1;
        {
            const int px = p / n, py = p % n;
            res += dist[px][py];
            vacant[px][py] = true;
            Q[0] = {px, py};
        }
        int head = 0, tail = 1;
        while(head != tail){
            const int x = Q[head].x, y = Q[head].y; ++head;
            const int nd = (vacant[x][y]) ? dist[x][y] : dist[x][y] + 1;
            if(x - 1 >= 0 and dist[x - 1][y] > nd){ dist[x - 1][y] = nd; Q[tail++] = {x - 1, y}; }
            if(y - 1 >= 0 and dist[x][y - 1] > nd){ dist[x][y - 1] = nd; Q[tail++] = {x, y - 1}; }
            if(y + 1 <  n and dist[x][y + 1] > nd){ dist[x][y + 1] = nd; Q[tail++] = {x, y + 1}; }
            if(x + 1 <  n and dist[x + 1][y] > nd){ dist[x + 1][y] = nd; Q[tail++] = {x + 1, y}; }
        }
    }
    printf("%d\n", res);
    return 0;
}

Measured memory_bytes: 6280
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <complex>
#include <string>
#include <algorithm>
#include <numeric>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <bitset>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#ifndef LOCAL
#define debug(x) ;
#else
#define debug(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl;

template <typename T1, typename T2>
ostream &operator<<(ostream &out, const pair<T1, T2> &p) {
  out << "{" << p.first << ", " << p.second << "}";
  return out;
}

template <typename T>
ostream &operator<<(ostream &out, const vector<T> &v) {
  out << '{';
  for (const T &item : v) out << item << ", ";
  out << "\b\b}";
  return out;
}
#endif

#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 200010

// 160 + 160 - 280


bitset<25601> dp[81][81];

int main() {
  int H, W;
  int A[100][100], B[100][100];

  cin >> H >> W;

  for (int i=0; i<H; i++)
    for (int j=0; j<W; j++)
      cin >> A[i][j];

  for (int i=0; i<H; i++) {
    for (int j=0; j<W; j++) {
      cin >> B[i][j];
      A[i][j] = abs(A[i][j] - B[i][j]);
    }
  }

  const int V = 80 * 160;

  dp[0][0][V] = 1;

  for (int i=0; i<H; i++) {
    for (int j=0; j<W; j++) {
      if (i+1 < H)
        dp[i+1][j] |= dp[i][j] << A[i][j];

      if (j+1 < W)
        dp[i][j+1] |= dp[i][j] << A[i][j];

      if (i+1 < H)
        dp[i+1][j] |= dp[i][j] >> A[i][j];

      if (j+1 < W)
        dp[i][j+1] |= dp[i][j] >> A[i][j];
    }
  }

  int ans = V;

  if (A[H-1][W-1] >= 0)
    dp[H-1][W-1] = dp[H-1][W-1] << A[H-1][W-1];
  else
    dp[H-1][W-1] = dp[H-1][W-1] >> (-A[H-1][W-1]);


  for (int i=0; i<=V*2; i++) {
    if (dp[H-1][W-1][i]) {
      ans = min(ans, abs(V - i));
    }
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 20864
h, w = map(int, input().split())
if h == 1:
    print(1)
    exit()
if w == 1:
    print(1)
    exit()

if h%2 == 0:
    print((h*w)//2)
else:
    print(((h-1)*w)//2+(w+1)//2)


Measured memory_bytes: 2940
#include <bits/stdc++.h>
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
typedef long long ll;
const int MOD = 1000000007;
const int INF = 1010000000;
const double EPS = 1e-10;
using namespace std;

int main() {
  int a[3],k;
  cin >> a[0] >> a[1] >> a[2] >> k;
  sort(a,a+3);
  rep(i,k){
    a[2] *= 2;
  }
  cout << a[0]+a[1]+a[2] << endl;
}


Measured memory_bytes: 256
# Q1
import bisect,collections,copy,heapq,itertools,math,numpy,string
import sys
from functools import lru_cache

def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())

N, X, T = LI()
ans, r = divmod(N, X)
if r > 0:
    ans += 1
print(int(T * ans))

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

using namespace std;

long long inf=1000000007;

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

	while(a!=b){
		if(a==c){
			cout<<"Yes"<<endl;
			return 0;
		}

		if(a<b) a++;
		else a--;
	}

	cout<<"No"<<endl;

	return 0;
}


Measured memory_bytes: 3600
#include<stdio.h>
int main(void){
    int m,f,r;
    while(1){
        scanf("%d %d %d",&m,&f,&r);
        if(m==-1&&f==-1&&r==-1)break;
        if(m==-1||f==-1){
            printf("F\n");
        }else if(m+f>=80){
            printf("A\n");
        }else if(m+f<80&&m+f>=65){
            printf("B\n");
        }else if(m+f<65&&m+f>=50){
            printf("C\n");
        }else if(m+f<50&&m+f>=30){
            if(r>=50){
                printf("C\n");
            }else{
                printf("D\n");
            }}else{
                printf("F\n");
            }
        }
return 0;
}

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

using ll = long long;
#define ALL(c) (c).begin(), (c).end()
const int MOD = 1000000007;

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

    int t = 0;
    int b = n;
    int l, r;
    for (int i = 0; i < m; i++) {
        cin >> l >> r;
        t = max(t, l);
        b = min(b, r);
    }

    cout << max(0, b - t + 1) << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <numeric>
#include <cmath>
#include <limits>
#include <stdio.h>
#include <iomanip>
#include <cstdlib>
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;
using ll = long long;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
ll Max(ll(a), ll(b), ll(c)) {
	return max(max(a, b), c);
}
ll Min(ll(a), ll(b), ll(c)) {
	return min(min(a, b), c);
}





int main() {

	map <string, ll> S;
	ll N, M;
	cin >> N;
	rep(i, N) {
		string s;
		cin >> s;
		if (S.count(s)) {
			S.at(s)++;
		}
		else {
			S[s]=1;
		}
	}
	cin >> M;
	rep(i, M) {
		string s;
		cin >> s;
		if (S.count(s)) {
			S.at(s)--;
		}
		else {
			S[s] = -1;
		}
	}
	ll an=0;
	for (auto p : S) {
		auto v = p.second;
		an = max(an, v);
	}
	cout << an << endl;

}

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

int main() {
  int n; cin >> n;
  vector<int> a(n + 1); for (int i = 1; i <= n; i++) cin >> a[i];
  vector<int> a1; a1 = a;
  long long int sum1 = 0, ans1 = 0;
  for (int i = 1; i <= n; i++) {
    sum1 += a1[i];
    if (i % 2 == 1 && sum1 <= 0) {
      int plus = 1 - sum1;
      sum1 = 1;
      ans1 += plus;
      continue;
    } if (i % 2 == 0 && sum1 >= 0) {
      int minus = 1 + sum1;
      sum1 = -1;
      ans1 += minus;
    }
  }

  vector<int> a2; a2 = a;
  long long int sum2 = 0, ans2 = 0;
  for (int i = 1; i <= n; i++) {
    sum2 += a2[i];
    if (i % 2 == 1 && sum2 >= 0) {
      int minus = 1 + sum2;
      sum2 = -1;
      ans2 += minus;
      continue;
    } else if (i % 2 == 0 && sum2 <= 0) {
      int plus = 1 - sum2;
      sum2 = 1;
      ans2 += plus;
    }
  }

  cout << min(ans1, ans2) << endl;

  return 0;
}

Measured memory_bytes: 1408
import java.util.*;
import java.math.*;

public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int s = sc.nextInt();
    int w = sc.nextInt();

    if (s <= w) {
      System.out.println("unsafe");
    } else {
      System.out.println("safe");
    }

  }

}


Measured memory_bytes: 35800
import java.util.Arrays;
import java.util.Scanner;

public class Main {
  Scanner sc;

  void run() {
    for(;;){
      long a, d, n;
      a = ni();
      d = ni();
      n = ni();
      
      if((a|d|n)==0) break;
      
      int cnt = 0;
      for(long ite = a;;ite += d) {
        boolean f = true;
        f = 2 <= ite;
        for(int j = 2; j*j <= ite; ++j) {
          f &= ite % j != 0;
        }
        if(f) {
          if(++cnt == n) {
            System.out.println(ite);
            break;
          }
        }
      }
    }
  }

  Main() {
    sc = new Scanner( System.in );
  }

  int ni() {
    return sc.nextInt();
  }

  String ns() {
    return sc.next();
  }

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

  void debug(Object... os) {
    System.err.println( Arrays.deepToString( os ) );
  }
}

Measured memory_bytes: 20408
#include <iostream>
using namespace std;
int main(){
  int n;
  int a[100000];
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>a[i];
  }
  int ans=0;
  for(int i=0;i<n;i++){
    ans+=a[i]-1;
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;

namespace CSharpSample01
{
    
    
    class Program
    {

        const int INF = 1000000009;

        static int Prim(int V, int[,] g)
        {
            int[] d = new int[V];
            for (int i = 0; i < V; i++) d[i] = INF;
            d[0] = 0;
            bool[] visit = new bool[V];

            while (true)
            {
                int from = -1;
                int mincost = INF;

                for(int i = 0; i < V; i++)
                {
                    if(!visit[i])
                    {
                        if(d[i] < mincost)
                        {
                            mincost = d[i];
                            from = i;
                        }
                    }
                }

                if (from == -1) break;
                visit[from] = true;

                for(int to = 0; to < V; to++)
                {
                    if(g[from, to] != -1 && !visit[to])
                    {
                        if (g[from, to] < d[to]) d[to] = g[from, to];
                    }
                }
                
            }

            int sum = 0;

            for(int i = 0; i < V; i++)
            {
                sum += d[i];
            }

            return sum;
        }
        
        
        //重み付き無向グラフ
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            int V = int.Parse(input[0]);
            int E = int.Parse(input[1]);

            int[,] g = new int[V, V];

            for(int i = 0; i < V; i++)
            {
                for(int j = 0; j < V; j++)
                {
                    g[i, j] = -1;
                }
            }

            for(int i = 0; i < E; i++)
            {
                input = Console.ReadLine().Split(' ');
                int a = int.Parse(input[0]);
                int b = int.Parse(input[1]);
                int w = int.Parse(input[2]);
                g[a, b] = w;
                g[b, a] = w;
            }

            Console.WriteLine(Prim(V, g));
        }
    }
}


Measured memory_bytes: 412244
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please

int P[100001];

int Find(int A) {
	if (P[A] < 0) return A;
	return P[A] = Find(P[A]);
}

bool Unite(int A, int B) {
	int a = Find(A);
	int b = Find(B);
	if (a == b) return false;
	if (P[a] > P[b]) swap(a, b);
	P[a] += P[b];
	P[b] = a;
	return true;
}

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


	int N, M;
	cin >> N >> M;

	int A[100000], B[100000];
	rep(i, M) cin >> A[i] >> B[i];

	ll sum = (ll)N * (N - 1) / 2;
	ll kotae[100001];
	kotae[M] = sum;

	rep1(i, N) P[i] = -1;

	for (int i = M - 1; i > 0; i--) {
		int ap = Find(A[i]);
		int bp = Find(B[i]);
		if (ap != bp) {
			sum -= (ll)P[ap] * P[bp];
			if (P[ap] > P[bp]) swap(ap, bp);
			P[ap] += P[bp];
			P[bp] = ap;
		}
		kotae[i] = sum;
	}
	
	rep1(i, M) co(kotae[i]);

	Would you please return 0;
}

Measured memory_bytes: 3328
#include <cstdlib>
#include <iostream>
#include <queue>
#include <vector>
#include <cmath>
#include <string>
using namespace std;
typedef unsigned long long u64;
typedef signed long long l64;

int main(void)
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  u64 sum=0;
  u64 t[n], x[n];
  for (int i = 0; i < n; ++i) {
    cin >> t[i];
    sum += t[i];
  }
  int m, p;
  u64 xi;
  cin >> m;
  for (int i = 0; i < m; ++i) {
    cin >> p >> xi;
    cout << sum - t[p-1] + xi << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=500008,p=998244353;
int read(){
    int f=1,g=0;char ch=getchar();
    for (;!isdigit(ch);ch=getchar()) if (ch=='-') f=-1;
    for (;isdigit(ch);ch=getchar()) g=g*10+ch-'0';
    return f*g;
}
int qpow(int x,int k){
	int t=1;
	for (;k;k>>=1){
		if (k&1) t=(ll)t*x%p;
		x=(ll)x*x%p;
	}
	return t;
}
int n,m,L,ans,po[N],inv[N],fa[N],fb[N];
void check(int &x,int y){if ((x+=y)>=p) x-=p;}
int main(){
	n=read();m=read();L=max(n,m);
	po[0]=fa[0]=fb[0]=1;
	for (int i=1;i<=L;i++){
		po[i]=(ll)po[i-1]*i%p;
		fa[i]=(ll)fa[i-1]*(n+1)%p;
		fb[i]=(ll)fb[i-1]*(m+1)%p;
	}
	inv[L]=qpow(po[L],p-2);
	for (int i=L;i;i--) inv[i-1]=(ll)inv[i]*i%p;
	ans=0;
	for (int k=0;k<=min(n,m);k++){
		int t=(ll)po[n]*po[m]%p*inv[n-k]%p*inv[m-k]%p*inv[k]%p*fa[m-k]%p*fb[n-k]%p;
		check(ans,(k&1) ? (p-t) : t);
	}
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 8064
H, W = map(int, input().split())
A = [None]*H
for i in range(H):
    A[i] = list(map(int, input().split()))
B = [None]*H
for i in range(H):
    B[i] = list(map(int, input().split()))

C = [[None]*W for _ in range(H)]
for i in range(H):
    for j in range(W):
        C[i][j] = abs(A[i][j]-B[i][j])

K = 80*(H+W-1)//2 + 1
dp = [[[0]*(K+1) for _ in range(W)] for _ in range(H)]# 答えから80*(H+W-1)を引く
dp[0][0][C[0][0]] = 1

for i in range(H):
    for j in range(W):
        for k in range(K+1):
            if i and dp[i-1][j][k]:
                if k+C[i][j] < K:
                    dp[i][j][k+C[i][j]] = 1
                dp[i][j][abs(k-C[i][j])] = 1
            if j and dp[i][j-1][k]:
                if k+C[i][j] < K:
                    dp[i][j][k+C[i][j]] = 1
                dp[i][j][abs(k-C[i][j])] = 1

for k in range(K+1):
    res = dp[H-1][W-1][k]
    if res:
        print(k)
        break


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

using namespace std;

int main()
{
  string othello;
  cin>>othello;
  int sizes = othello.size() - 1;

  char fi = othello.at(0);
  char en = othello.at(sizes);

  if(fi == en){
    cout<<fi<<endl;
  }
  else{
    cout<<'o'<<endl;
  }
  
  return 0;
}


Measured memory_bytes: 3188
#include<algorithm>
#include<climits>
#include<cmath>
#include<iomanip>
#include<iostream>
#include<list>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<utility>
#include<vector>

#define lint long long
#define REP(i, x, n) for(int i = x ; i < n ; i++)
#define rep(i, n) REP(i, 0, n)
#define repr(i, n) for(int i = n - 1 ; i >= 0 ; i--)
#define SORT(c) sort((c).begin(), (c).end())
#define SORT_INV(c) sort((c).begin(), (c).end(), greater<int>())
#define IINF INT_MAX
#define LLINF LLONG_MAX

using namespace std;

int main(){
    int n;
    cin >> n;
    rep(i, n){
        vector<int> b, c;
        b.push_back(-1);
        c.push_back(-1);
        bool flag = true;
        rep(j, 10){
            int a;
            cin >> a;
            if(flag){
                if(b[b.size()-1] < c[c.size()-1]){
                    if(c[c.size()-1] < a){
                        c.push_back(a);
                    }else if(b[b.size()-1] < a){
                        b.push_back(a);
                    }else{
                        flag = false;
                    }
                }else{
                    if(b[b.size()-1] < a){
                        b.push_back(a);
                    }else if(c[c.size()-1] < a){
                        c.push_back(a);
                    }else{
                        flag = false;
                    }
                }
            }
        }
        if(flag){
            cout << "YES" << endl;
        }else{
            cout << "NO" << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 3076
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int numberOfCoins = scanner.nextInt();
        int sum = scanner.nextInt();
        if (numberOfCoins * 500 >= sum) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}

Measured memory_bytes: 21076
n = int(input())
vL = list(map(int,input().split()))
vL_sort = sorted(vL)
vL_sum = (vL_sort[0] + vL_sort[1])/2
if n >= 2:
    for i in range(2,n):
        vL_sum = (vL_sum+vL_sort[i])/2
print(vL_sum)

Measured memory_bytes: 38384
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;

int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};

int main() {
llong s;
llong i;
cin>>s;
vector<llong> a(1000000);
 a[s-1]=1;
 for(i=0; ; i++)
 {
     if(s%2==1)  s=3*s+1;
else s/=2;
if(a[s-1]==1) break;
else a[s-1] =1;
 }
 cout<<i+2<<endl;
}


Measured memory_bytes: 8064
#include<iostream>
#include<vector>
#include<cmath>
using namespace std;

int main(){
  long n, maxw;
  cin >> n >> maxw;
  
  vector<long> v(n+1);
  vector<long> w(n+1);
  
  for(long i=0; i<n; i++){
    cin >> w.at(i) >> v.at(i);
  }

  vector<vector<long>> dp(n+2, vector<long>(maxw+2));
  dp[0][0] = 0;
  long value = 0;
  
  for(long i=0; i<n; i++){
    for(long j=0; j<=maxw; j++){
      if(j+w[i]<=maxw){
        dp[i+1][j+w[i]] = max(dp[i][j+w[i]], dp[i][j]+v[i]);
        value = max(value, dp[i+1][j+w[i]]);
      }
      dp[i+1][j] = max(dp[i+1][j], dp[i][j]);
      value = max(value, dp[i+1][j]);
    }
  }
  
  cout << value << endl;
  
  return 0;
}


Measured memory_bytes: 81024
let () =
  Scanf.scanf "%d %f %f" @@ fun n t a ->
  let hs = Array.init n (fun i -> i+1, Scanf.scanf " %f" @@ fun x -> x) in
  Array.fold_left (fun (u, v) (i, h) ->
    let b = abs_float (t -. h *. 0.006 -. a) in
    if b < v then (i, b) else (u, v)) (-1, 1010101010.0) hs
  |> fst |> Printf.printf "%d\n"


Measured memory_bytes: 768
#pragma GCC optimize("O2,unroll-loops")
#pragma GCC target("avx,popcnt")
#include<bits/stdc++.h>
#define all(x) x.begin(), x.end()
#define pb push_back
using namespace std;
using ll = long long;
using ld = long double;
const int maxn = 1505, mod = 1e9 + 7, i2 = (mod+1)/2;
bool prime(ll x) {
	for(ll a = 2; a < x; a++) if(x%a == 0) return false;
	return true;
}
int main() {
	cin.tie(0)->sync_with_stdio(0);
	ll n, ans = 1;
	cin >> n;
	for(ll t = 2; t <= n; t++) if(prime(t)) {
		ll u = 1, x = n;
		while(x) x /= t, u += x;
		ans = ans*u%mod;
	}
	cout << ans;
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

/* https://ncode.syosetu.com/n2267be/ */
#define RIZERO return 0

int N, M;
int p[114514];
int x[114514], y[114514];

int miyukichi[114514];
int emirinn[114514];

void yukinnko(void) {
	int i;
	for (i = 0; i <= N; i++) {
		miyukichi[i] = i;
		emirinn[i] = 1;
	}
}

int tomatu(int sumipe) {
	return miyukichi[sumipe] == sumipe ? sumipe : (miyukichi[sumipe] = tomatu(miyukichi[sumipe]));
}

void hayaminn(int asumi, int iguti) {
	int kana = tomatu(asumi);
	int yuka = tomatu(iguti);
	if (kana != yuka) {
		if (emirinn[kana] >= emirinn[yuka]) {
			miyukichi[yuka] = kana;
			emirinn[kana] += emirinn[yuka];
		} else {
			miyukichi[kana] = yuka;
			emirinn[yuka] += emirinn[kana];
		}
	}
}

int main(void) {
	int i;
	int mizuhasu = 0;

	if (scanf("%d%d", &N, &M) != 2) return 1;
	for (i = 1; i <= N; i++) {
		if (scanf("%d", &p[i]) != 1) return 1;
	}
	for (i = 0; i < M; i++) {
		if (scanf("%d%d", &x[i], &y[i]) != 2) return 1;
	}

	yukinnko();
	for (i = 0; i < M; i++) {
		hayaminn(x[i], y[i]);
	}
	for (i = 1; i <= N; i++) {
		if (tomatu(i) == tomatu(p[i])) mizuhasu++;
	}
	printf("%d\n", mizuhasu);

	RIZERO ;
}


Measured memory_bytes: 2176
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>

using namespace std;

int main(){
int N,A,B;
cin>>N>>A>>B;
int total;

if(A*N<B){
    total=A*N;
}
else{
    total=B;
}
cout<<total;
//system("pause");
return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int M1, M2, D1, D2;
using ll = long long;
ll N;
vector<int> A;

int check(vector<double> color, int count);

int main()
{
    cin >> N;
    A = vector<int>(N);
    for(int i = 0; i<N; i++){
        cin >> A.at(i);
    }
    vector<double> color = vector<double>(3, -1);
    ll result = check(color, 0);
    cout << result << endl;

}

int check(vector<double> color, int count)
{
    // cout << count << endl;
    if(count == N){
        // for (int j = 0; j < 3; j++){
        //     cout << color.at(j);
        // }
        // cout << endl;
            return 1;
    }
    int i = count;
    ll result = 0;
    bool ff = true;
    int cc = 0;
    for (int j = 0; j < 3; j++)
    {
        if (color.at(j) == A.at(i) - 1)
        {
            if(ff){
                ff = false;
                color.at(j)++;
                result += check(color, i + 1);
                color.at(j)--;
            }
            cc++;
            
        }
    }
    return (result * cc) % 1000000007;

}


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

int main(){
  int N,Y;
  cin>>N>>Y;
  vector<int> maisu(3,-1);
for(int i=0;i<N+1;i++){
 for(int j=0;j<N+1-i;j++){
 for(int k=0;k<N+1-i-j;k++){
  if(10000*i+5000*j+k*1000==Y&&i+j+k==N){
    maisu[0]=i;
    maisu[1]=j;
    maisu[2]=k;
    goto ends;
  }
	}
		} 
			} 
  ends:
  cout<<maisu[0]<<" "<<maisu[1]<<" "<<maisu[2]<<endl;
}

Measured memory_bytes: 256
#![allow(bare_trait_objects)]
#![allow(unused_imports)]
#![allow(dead_code)]

use std::collections::{HashMap, HashSet};
use std::fmt::Debug;
use std::io::BufRead;
use std::io::Stdin;
use std::io::StdinLock;
use std::str::FromStr;

pub struct Scanner<'a> {
    // stdin: Stdin,
    buf_read: Box<BufRead + 'a>,
    tokens: Vec<String>,
}

impl<'a> Scanner<'a> {
    pub fn new(buf_read: StdinLock<'a>) -> Self {
        Scanner {
            buf_read: Box::new(buf_read),
            tokens: Vec::new(),
        }
    }

    // pub fn from_stdin() -> Self {
    //     let stdin = Box::leak(Box::new(std::io::stdin()));
    //     Self {
    //         buf_read: Box::new(stdin.lock()),
    //         tokens: Vec::new(),
    //     }
    // }

    pub fn next(&mut self) -> String {
        while self.tokens.is_empty() {
            let mut s = String::new();
            if self.buf_read.read_line(&mut s).is_err() {
                panic!()
            }
            self.tokens = s
                .split_whitespace()
                .filter(|s| !s.is_empty())
                .rev()
                .map(str::to_string)
                .collect();
        }
        self.tokens.pop().unwrap()
    }

    pub fn next_g<T: FromStr>(&mut self) -> T
    where
        T::Err: Debug,
    {
        self.next().parse().unwrap()
    }

    pub fn usize(&mut self) -> usize {
        self.next_g()
    }

    pub fn i64(&mut self) -> i64 {
        self.next_g()
    }
}

fn main() {
    let stdin = std::io::stdin();
    let mut sc = Scanner::new(stdin.lock());

    let mut s: Vec<_> = sc.next().chars().collect();
    let mut t: Vec<_> = sc.next().chars().collect();

    s.sort();
    t.sort();
    t.reverse();

    if s < t {
        println!("Yes");
    } else {
        println!("No");
    }
}


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

using namespace std;

long long inf=1000000007;

int main(){
	long long n;
	cin>>n;
	bool flag=true;

	for(long long i=0;i<n;i++){
		long long hoge;
		cin>>hoge;
		if(hoge%2==1) flag=false;
	}

	if(!flag) cout<<"first"<<endl;
	else cout<<"second"<<endl;

	return 0;
}


Measured memory_bytes: 256
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
import java.util.TreeMap;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int c = sc.nextInt();
		Obj[] arr = new Obj[n];
		for (int i = 0; i < n; i++) {
			Obj o = new Obj();
			o.s = sc.nextInt();
			o.t = sc.nextInt();
			o.c = sc.nextInt();
			arr[i] = o;
		}
		sc.close();

		Arrays.sort(arr, (o1, o2) -> o1.t - o2.t);
		TreeMap<Integer, Map<Integer, Obj>> map = new TreeMap<>();
		for (Obj o : arr) {
			Integer key = map.floorKey(o.s);
			if (key != null) {
				if (key == o.s && map.get(key).containsKey(o.c)) {
					map.get(key).remove(o.c);
					if (map.get(key).isEmpty()) {
						map.remove(key);
					}
					if (!map.containsKey(o.t)) {
						map.put(o.t, new HashMap<>());
					}
					map.get(o.t).put(o.c, o);
					continue;
				}
			}

			key = map.lowerKey(o.s);
			if (key != null) {
				Integer key2 = map.get(key).keySet().iterator().next();
				map.get(key).remove(key2);
				if (map.get(key).isEmpty()) {
					map.remove(key);
				}
			}
			if (!map.containsKey(o.t)) {
				map.put(o.t, new HashMap<>());
			}
			map.get(o.t).put(o.c, o);
		}

		int ans = 0;
		for (Map<Integer, Obj> map2 : map.values()) {
			ans += map2.size();
		}
		System.out.println(ans);
	}

	static class Obj {
		int s, t, c;
	}
}


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

using namespace std;

typedef long long ll;

#define pb push_back
#define mp make_pair
#define F first
#define S second

typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define fast_cin() ios_base::sync_with_stdio(false)

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

int main()
{
	int N;
	cin >> N;
	ll K;
	cin >> K;
	ll maxA = 0;
	ll A;
	ll G = 0;
	for(int i = 0; i < N; i++)
	{
		cin >> A;
		maxA = max(maxA, A);
		G = gcd(A, G);
	}
	// cout << maxA << " " << G << endl;
	if(K > maxA)
	{
		cout << "IMPOSSIBLE" << endl;
		return 0;
	}
	else
	{
		if(K % G == 0)
		{
			cout << "POSSIBLE" << endl;
		}
		else
		{
			cout << "IMPOSSIBLE" << endl;
		}
	}
	return 0;
}

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

namespace AOJ
{
	class Program
	{
		static void Main(string[] args)
		{
			int count = 0;
			var s = "";
			while ((s = Console.ReadLine()) != null)
			{
				if (s.Take(s.Length / 2).SequenceEqual(s.Skip((s.Length / 2) + (s.Length % 2)).Reverse()))
					count++;
			}
			Console.WriteLine(count);
		}
	}
}

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

using namespace std;
using int64 = long long;

constexpr int DEBUG = 0;

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

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

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

  int n;
  cin >> n;
  string s;
  cin >> s;
  vector<int> rs_cs(n + 1);
  for (int i = 0; i < n; i++) {
    rs_cs[i + 1] = rs_cs[i];
    if (s[i] == 'R') {
      rs_cs[i + 1]++;
    }
  }

  int r_sum = rs_cs[n];

  int ans = n;
  for (int k = 0; k <= n; k++) {
    int c = k - rs_cs[k] + max(r_sum - k, 0);
    UpdateMin(ans, c);
  }
  cout << ans << endl;
}

Measured memory_bytes: 4400
#include<bits/stdc++.h>
#define ll long long
#define rep(i, n) for(int i=0; i<n; i++)
#define REP(i, n) for(int i=0; i<=n; i++)
#define repr(i, n) for(int i=n; i>0; i--)
#define REPR(i, n) for(int i=n; i>=0; i--)
const ll INF = 1e18;
const int INT_INF = 1e9;
const ll MOD = 1e9+7;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using namespace std;

int N;
vector<int> p;

bool check(vector<int> a) {
    bool flg = true;
    for (int i = 0; i < N; i++) {
        if (a[i] != i + 1) {
            flg = false;
            break;
        }
    }
    return flg;
}

int main() {
    cin >> N;
    p.resize(N);
    rep(i, N) cin >> p[i];

    for (int i = 0; i < N - 1; i++) {
        for (int j = i; j < N; j++) {
            vector<int> c = p;
            swap(c[i], c[j]);

            // 判定
            if (check(c)) {
                cout << "YES" << endl;
                return 0;
            }
        }
    }
    cout << "NO" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) FOR(i,0,n)
#define repr(i,n) for(int i=(n)-1;0<=i;--i)
#define each(e,v) for(auto&& e:(v))
#define all(v) begin(v),end(v)
#define dump(x) cerr<<#x<<": "<<(x)<<endl
#define INF 100000000
#define IINF 9999999999999;
using vint = std::vector<int>;
using ll = long long;
using vll = std::vector<ll>;
template <class T> void chmin(T& a, const T& b) { a = std::min(a, b); }
template <class T> void chmax(T& a, const T& b) { a = std::max(a, b); }
#define output(x) cout << x << endl;

int main() {
    int N, K;
    cin >> N >> K;
    int a[100000];
    for (int i = 0; i < N; i++) {
        cin >> a[i];
    }

    int ans = (int)1e10;
    int P, M;
    for (int i = 0; i < N - K + 1; i++) {
        int P = abs(a[i]) + abs(a[i] - a[i + K - 1]);
        int M = abs(a[i + K - 1]) + abs(a[i] - a[i + K - 1]);

        ans = min(min(ans, P), M);
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 640