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

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        char[] result = S.toCharArray();
        Arrays.sort(result);
        char comp = 0;
        boolean ans = false;
        boolean but = false;
        for (int i = 97; 123 > i; i++) {
            comp = (char) i;
            ans = false;
            for (int j = 0; S.length() > j; j++) {
                if (comp == result[j]) {
                    ans = true;
                    break;
                }
            }
            if (ans == false) {
                break;
            }
            but = true;
        }
        if (but == true && ans == true) {
            System.out.println("None");
        } else {
            System.out.println(comp);
        }
    }
}


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

public class AtCoderA
{
    static void Main()
    {
        var sc = new Scanner();

        long n = sc.NextLong();
        long a = sc.NextLong();
        long b = sc.NextLong();

        long max = Math.Min(a, b);
        long min = Math.Max(0, a + b - n);

        string answer = max + " " + min;

        Console.WriteLine(answer);
    }

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            while (_index >= _line.Length)
            {
                _line = Console.ReadLine().Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            _line = Console.ReadLine().Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}


Measured memory_bytes: 27456
#include <bits/stdc++.h>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/integer/common_factor.hpp>

#define rep_ui(k,n)      for(ui  i = (k); i < (n); ++i)
#define rep_si(k,n)      for(int i = (k); i < (n); ++i)
#define rep_ul(k,n)      for(ul  i = (k); i < (n); ++i)
#define rep_sl(k,n)      for(ll  i = (k); i < (n); ++i)
#define rep_ui_down(k,n) for(ui  i = (k); i > (n); --i)
#define rep_si_down(k,n) for(int i = (k); i > (n); --i)
#define rep_ul_down(k,n) for(ul  i = (k); i > (n); --i)
#define rep_sl_down(k,n) for(ll  i = (k); i > (n); --i)

#define rep_uj(k,n)      for(ui  j = (k); j < (n); ++j)
#define rep_sj(k,n)      for(int j = (k); j < (n); ++j)
#define rep_uj_down(k,n) for(ui  j = (k); j > (n); --j)
#define rep_sj_down(k,n) for(int j = (k); j > (n); --j)

#define rep(k,n)         rep_ui(k,n)

typedef uintmax_t    ull;
typedef intmax_t     ll;
typedef uint64_t     ul;
typedef uint32_t     ui;
typedef uint8_t      uc;

template<class T>
std::ostream& operator<<(std::ostream& os, const std::vector<T>& vc)
{
#ifdef BOOST_RANGE_ALGORITHM_FOR_EACH_HPP_INCLUDED
  boost::for_each(vc, [&os](T value) {
#else
  std::for_each(vc.begin(), vc.end(), [&os](T value) {
#endif
    os << value << ' ';
    });
  return os;
    }

template<class T1, class T2>
inline
std::ostream & operator<<(std::ostream & os, const std::pair<T1, T2> & p)
{
  return os << p.first << ' ' << p.second;
}

void solve(void)
{
  using std::string;
  using std::vector;
  using std::map;
  using std::pair;
  using std::cin;
  //string S{}; std::cin >> S;
  ui N{}, M{}; cin >> N >> M;
  typedef pair<ui, ull> Pair;
  //vector<Pair> AB(N);
  map<ui, vector<ull>> works;
  rep(0, N)
  {
    Pair p{};
    cin >> p.first >> p.second;
    works[p.first].push_back(p.second);
  }

  std::priority_queue<ull, vector<ull>, std::less<ull>> queue;

  ull ans{};
  rep(1, M + 1)
  {
    boost::for_each(
      works[i], 
      [&queue](auto p) {
        queue.push(p);
      });
    if (queue.empty()) continue;

    ans += queue.top();
    queue.pop();
  }

  using std::cout;
  cout << ans << '\n';
  return;
}

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

  solve();

  return 0;
}


Measured memory_bytes: 10880
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <string>
#include <unordered_map>
#include <queue>
using namespace std;


int main(){
    int n;
    cin >> n;
    vector<pair<int, int> > a(n);
    for (int i = 0; i < n; i++){
        a[i].first = i + 1;
        cin >> a[i].second;
    }
    sort(a.begin(), a.end(), [](const pair<int, int>& x, const pair<int, int>& y){
        return x.second < y.second;
    });

    for (int i = 0; i < n; i++){
        cout << a[i].first << " ";
    }
    cout << endl;
    return 0;
}

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

typedef vector<int> vi;
typedef long long int ll;
typedef pair<int,int> pii;
typedef vector<pii > vii;
typedef vector<vi > vvi;


int m, n;
int main() {
    cin >> n >> m;
    
    cout << (n-1)*(m-1) << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; i++)
#define repo(i, n) for(int i=1; i<=n; i++)
#define INF 1001001001

using namespace std;
using ull = unsigned long long;
using ll = long long;
using P = pair<int, int>;
const int mod = 1000000007;

#include <iostream>
#include <queue>
#include <vector>
using namespace std;


#define MAX_V 100005

struct edge {
    int to;
    int cost;
};



int V;
vector<edge> G[MAX_V];
int d[MAX_V];

void dijkstra(int s) {
    priority_queue<P, vector<P>, greater<P> > que;
    fill(d, d+V, INF);
    d[s] = 0;
    que.push(P(0, s));

    while (!que.empty()) {
        P p = que.top();
        que.pop();
        int v = p.second;
        if (d[v] < p.first) continue;

        for (int i=0; i<G[v].size(); ++i) {
            edge e = G[v][i];
            if (d[e.to] > d[v] + e.cost) {
                d[e.to] = d[v] + e.cost;
                que.push(P(d[e.to], e.to));
            }
        }
    }
}

int main() {
    cin >> V;
    rep(i, V){
      edge e = {(i*10)%V, 0};
      G[i].push_back(e);
      edge e2 = {(i+1)%V, 1};
      G[i].push_back(e2);
    }
    dijkstra(1);
    cout << d[0]+1 << endl;
}


Measured memory_bytes: 6780
#include <iostream>
using namespace std;
int main(){
  int A=0;
  int B=0;
  cin>>A>>B;
  if (A >= 13){
    cout<<B<<endl;
  }else if (A <= 5){
    cout<<"0"<<endl;
  }else{
    cout<<B/2<<endl;
  }
    
  
}
 

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

public class Main {
	
	static final long MAX = 1000000000;
	
	public static void main(String[] args) throws IOException {
		MyScanner sc = new MyScanner();
		PrintWriter out = new PrintWriter(System.out);
		long S = sc.nextLong();
		long x2 = MAX;
		long y3 = (S + MAX - 1) / MAX;
		long y2 = 1;
		long x3 = x2 * y3 - S;
		out.println("0 0 " + x2 + " " + y2 + " " + x3 + " " + y3);
		
		out.flush();
	}
	
	static class MyScanner {
		private BufferedReader br;
		private StringTokenizer tokenizer;
		
		public MyScanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}
		
		public String next() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}
		
		public int nextInt() {
			return Integer.parseInt(next());
		}
		
		public long nextLong() {
			return Long.parseLong(next());
		}
	}
}


Measured memory_bytes: 21204
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse2")
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
#include <ext/pb_ds/detail/standard_policies.hpp>
#define int long long
#define boost() ios_base :: sync_with_stdio(0); cin.tie(); cout.tie(); cout << fixed; cout << setprecision(15); srand(time(NULL))
using namespace std;
using namespace __gnu_pbds;
typedef tree<pair <int, string>, null_type, less<pair <int, string>>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

int n;

signed main () {
  boost();
  cin >> n;
  int curx = 0, cury = 0, curt = 0;
  while (n--) {
    int t, x, y;
    cin >> t >> x >> y;
    int dist = abs(x - curx) + abs(y - cury);
    if (curt + dist > t || (dist & 1) != ((t - curt) & 1)) {
      cout << "No" << endl;
      return 0;
    }
    curt = t;
    curx = x;
    cury = y;
  }
  cout << "Yes" << endl;
  return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <iomanip>
#include <numeric>
#include <tuple>
#define _USE_MATH_DEFINES
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
double pi = 3.141592653589793;
ll mod = 1000000007;
int intmax = 2147483647;
int intmin = -2147483648;
ll llmax = 9223372036854775807;
ll llmin = -9223372036854775807;

struct edge {
    int to, cost;
};

int V;
vector<int> G[1000000];
bool mk[1000000];
vector<int> ans;

int main() {
    int N, M;
    cin >> N >> M;
    V = N;
    fill(mk, mk + V + 10, false);
    for (int i = 0; i < M; i++) {
        int a, b;
        cin >> a >> b;
        G[a - 1].push_back(b - 1);
        G[b - 1].push_back(a - 1);
    }
    int st, ed;
    st = intmax;
    ed = intmax;
    mk[0] = true;
    int now = 0;
    stack<int> sta;
    sta.push(0);
    while (st == intmax) {
        int p = G[now].size();
        bool ok = true;
        for (int i = 0; i < p; i++) {
            int to = G[now][i];
            if (!mk[to]) {
                mk[to] = true;
                now = to;
                sta.push(to);
                ok = false;
                break;
            }
        }
        if (ok) {
            st = now;
        }
    }
    while (sta.size() > 0) {
        int num = sta.top();
        sta.pop();
        ans.push_back(num + 1);
    }
    now = 0;
    while (ed == intmax) {
        int p = G[now].size();
        bool ok = true;
        for (int i = 0; i < p; i++) {
            int to = G[now][i];
            if (!mk[to]) {
                mk[to] = true;
                now = to;
                ans.push_back(to + 1);
                ok = false;
                break;
            }
        }
        if (ok) {
            ed = now;
        }
    }
    int n = ans.size();
    cout << n << endl;
    for (int i = 0; i < n; i++) {
        cout << ans[i] << " ";
    }
    cout << endl;
}


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

#define dbg(x) cerr << #x"=" << x << endl;


int main(){
    //freopen("in.txt", "r", stdin);
    int x,y;
    int in[5] = {0};
    for(int i = 1; i <= 3; ++i){
        cin >> x >> y;
        ++in[x]; ++in[y];
    }
    int cnt = 0;
    for(int i = 1; i <= 4; ++i){
        if(in[i]&1) ++cnt;
    }
    cout << ((cnt == 2) ? "YES" : "NO") << endl;
    return 0;
}


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

namespace AtCoder.A
{
    public class Program
    {
        public static void Main() { var r = GetResult(); Debug.WriteLine(r); Console.Write(r); }

        private static object GetResult()
        {
            var N = ReadText();

            for (int i = 0; i < N.Length / 2; i++)
            {
                if (N[i] != N[N.Length - 1 - i])
                {
                    return "No";
                }
            }

            return "Yes";
        }

        #region Console.Read

        public static string ReadText() { return Console.ReadLine(); }
        public static List<string> ReadTexts() { return Console.ReadLine().Split(' ').ToList(); }
        public static long ReadLong() { return long.Parse(Console.ReadLine()); }
        public static (long, long) Read2Longs() { var ls = ReadLongs(); return (ls[0], ls[1]); }
        public static (long, long, long) Read3Longs() { var ls = ReadLongs(); return (ls[0], ls[1], ls[2]); }
        public static (long, long, long, long) Read4Longs() { var ls = ReadLongs(); return (ls[0], ls[1], ls[2], ls[3]); }
        public static (long, long, long, long, long) Read5Longs() { var ls = ReadLongs(); return (ls[0], ls[1], ls[2], ls[3], ls[4]); }
        public static List<long> ReadLongs() { return Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToList(); }

        #endregion
    }
}


Measured memory_bytes: 25884
import java.util.Scanner;

class Main
{
    public static void main(String[] args)
    {
	Scanner In = new Scanner(System.in);

	int N = In.nextInt();

	int[][]a = new int[N][N];

	for(int i = 0; i < N; i++)
	    {
		for(int j = 0; j < N; j++)
		    {
			a[i][j] = 0;
		    }
	    }

	for(int i = 0; i < N; i++)
	    {
		int l = In.nextInt();
		int m = In.nextInt();
		l--;
		for(int j = 0; j < m; j++)
		    {
			int o = In.nextInt();
			o--;
			a[l][o] = 1;
		    }
	    }

	for(int i = 0; i < N; i++)
	    {
		for(int j = 0; j < N; j++)
		    {
			System.out.print(a[i][j]);
			if(j != N - 1)
			    System.out.print(" ");
		    }
		System.out.println();
	    }

    }

}

Measured memory_bytes: 34316
i = list(map(int, input().split()))

def kcd(A, B, K):
    cd_list = []
    for i in range(1, min(A, B) + 1):
        if A % i == 0 and B % i == 0:
            cd_list.insert(0,i)
    return cd_list[K - 1]

print(kcd(i[0],i[1],i[2]))
      


Measured memory_bytes: 2940
#define _USE_MATH_DEFINES
#include<iostream>
#include<string>
#include<queue>
#include<cmath>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<random>
#include<functional>
#include<algorithm>
#include<stack>
#include<cstdio>
#include<bitset>
#include<unordered_map>
#include<climits>
#include<fstream>
#include<time.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define all(a) (a).begin(),(a).end()
#define EPS (1e-5)
#define bit(n,k) ((n>>k)&1)
const ll Mod = 1000000007;
const ll mod = 998244353;
struct H {
	ll x, y;
	bool operator<(const H& b) const {
		if (x != b.x) return x < b.x;
		return y < b.y;
	}
	bool operator>(const H& b) const {
		if (x != b.x) return x > b.x;
		return y > b.y;
	}
	bool operator==(const H& b) const { return x == b.x && y == b.y; }
	bool operator!=(const H& b) const { return (*this) != b; }
};
struct P {
	ll pos, cost;
	bool operator<(const P& b) const { return cost < b.cost; }
	bool operator>(const P& b) const { return cost > b.cost; }
};
struct B {
	ll to, cost;
};
struct E {
	ll from, to, cost;
	bool operator<(const E& b) const { return cost < b.cost; }
	bool operator>(const E& b) const { return cost > b.cost; }
};
template<typename T, typename U>
void chmin(T& a, U b) {
	if (a > b) a = b;
}
template<typename T, typename U>
void chmax(T& a, U b) {
	if (a < b) a = b;
}
template<typename T>
T max_0(T a) {
	if (a < 0) return 0;
	return a;
}
template<typename T>
T min_0(T a) {
	if (a > 0) return 0;
	return a;
}
ll read() {
	ll u;
	ll k = scanf("%lld", &u);
	return u;
}
ll gcd(ll i, ll j) {
	if (i > j) swap(i, j);
	if (i == 0) return j;
	return gcd(j % i, i);
}
ll mod_pow(ll x, ll n, ll p) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res * x % p;
		x = x * x % p;
		n >>= 1;
	}
	return res;
}//x^n%p
ll bitcount(ll x) {
	int sum = 0;
	for (int i = 0; i < 20; i++) 
		if ((1ll << i) & x) sum++;
	return sum;
}
ll factorial_[1000000];
ll comb(ll x, ll y, ll mod) {
	if (!factorial_[0]) {
		factorial_[0] = 1;
		for (int i = 1; i < 1000000; i++) {
			factorial_[i] = factorial_[i - 1] * i % mod;
		}
	}
	if (x < y) return 0;
	return mod_pow(factorial_[x], mod, mod) *
		mod_pow(factorial_[x - y], mod - 2, mod) % mod *
		mod_pow(factorial_[y], mod - 2, mod) % mod;
}//xCy
const ll Inf = 3023372036854775807;
const int inf = 1500000000;
#define int long long
//----------------------------------------------------
signed main() {
	int n = read();
	cout << (n - 1) / 2 << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int N = 2e5 + 10;
#define fi first
#define se second
#define pb push_back
int n,k;
char a[N];
int b[N];
#define mid (l+r>>1)
#define ls o<<1
#define rs o<<1|1
int t[N<<2];
void build(int o,int l,int r){
    if(l==r){
        t[o]=b[l];
        return ;
    }
    t[o]=0;
    build(ls,l,mid);
    build(rs,mid+1,r);
    t[o]=max(t[ls],t[rs]);
}
const int MAXN=1e9;
int get(int o,int l,int r,int x,int y){
    if(l>y||r<x||l>r)return 0;
    if(l>=x&&r<=y)return t[o];
    int ans=0;
    if(y>mid&&t[rs])ans=max(ans,get(rs,mid+1,r,x,y));
    if(x<=mid&&ans==0&&t[ls])ans=max(ans,get(ls,l,mid,x,y));
    return ans;
}
int f[N];
int main() {
    ios::sync_with_stdio(false);
    cin>>n>>k>>a+1;
    n++;
    for(int i=1;i<=n;i++){
        if(a[i]=='1')b[i]=0;
        else b[i]=i;
    }
    build(1,1,n);
    for(int i=n-1;i>=1;i--){
        if(a[i]=='0'){
            int nex=get(1,1,n,i+1,min(n,i+k));
            if(nex==0){
                f[i]=MAXN;
                continue;
            }
            f[i]=f[nex]+1;
        }else f[i]=MAXN;
    }
    if(f[1]>=MAXN)cout<<-1<<endl;
    else{
        int l=2;
        int pre=1;
        while(l<=n){
            if(n>pre&&n-pre<=k){
                return cout<<n-pre<<' ',0;
            }
            if(a[l]=='1'||f[l]>=f[pre]){
                l++;
                continue;
            }
            cout<<l-pre<<' ';
            pre=l;
            l++;

        }
    }
    return 0;
}


Measured memory_bytes: 4224
/*
ID: leezhen
TASK: practice
LANG: C++11
*/
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <fstream>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<pair<int, int> > vii;
typedef long long ll;
typedef unsigned long long ull;
#define mp make_pair
#define pb push_back
#define inf 1e9
#define REP(i, a, b) for (int i = int(a); i < int(b); i++)

// struct

// data
int n, t;
ii ab[3010];
int mem[3010][3010];

int dp(int id, int tm) {
  if (id == n) return 0;
  if (tm >= t) return 0;
  if (mem[id][tm]) return mem[id][tm];
  int ret = max(dp(id + 1, tm + ab[id].first) + ab[id].second, dp(id + 1, tm));
  return mem[id][tm] = ret;
}

void solve() {
  sort(ab, ab + n);
  printf("%d\n", dp(0, 0));
}

int main() {
  int k, kase = 0;
  // scanf("%d", &k);
  k = 1;
  while (k--) {
    scanf("%d%d", &n, &t);
    REP(i, 0, n) { scanf("%d%d", &ab[i].first, &ab[i].second); }
    solve();
  }

  return 0;
}


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define REP(i, n) for(int i=0; i<(n); ++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 DEBUG(x) cout<<#x<<": "<<x<<'\n'
#define DEBUG_VEC(v) cout<<#v<<":";REP(i, v.size())cout<<' '<<v[i];cout<<'\n'
#define ALL(a) (a).begin(), (a).end()

#define CHMIN(a, b) a=min((a), (b))
#define CHMAX(a, b) a=max((a), (b))

const ll MOD=1000000007ll;
// const ll MOD=998244353ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

const double EPS=1e-11;
#define EQ0(x) (abs((x))<EPS)
#define EQ(a, b) (abs((a)-(b))<EPS)

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int d;
	cin>>d;
	if(d==25){
		cout<<"Christmas"<<'\n';
	}
	if(d==24){
		cout<<"Christmas Eve"<<'\n';
	}
	if(d==23){
		cout<<"Christmas Eve Eve"<<'\n';
	}
	if(d==22){
		cout<<"Christmas Eve Eve Eve"<<'\n';
	}
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
int n, m, t[33], a[103], e1, e2, dp[103][33];
int main() {
	while (cin >> n, n) {
		fill(a, a + 100, 24);
		for (int i = 0; i < n; i++) cin >> t[i];
		cin >> m;
		for (int i = 0; i < m; i++) cin >> e1 >> e2, e1--, a[e1] = min(a[e1], e2);
		fill(dp[1] + 1, dp[1] + n, 99999999);
		for (int i = 2; i <= 100; i++) {
			for (int j = 0; j < n; j++) {
				dp[i][j] = 999999999;
				if (j == 0) dp[i][j] = *min_element(dp[i - 1], dp[i - 1] + n) + 1;
				if (a[i - 1] >= t[j]) dp[i][j] = min(dp[i][j], dp[i - 1][(j + n - 1) % n]);
			}
		}
		int ret = *min_element(dp[100], dp[100] + n);
		cout << ret << endl;
	}
	return 0;
}

Measured memory_bytes: 3036
#include <bits/stdc++.h>    
//#include <ext/pb_ds/assoc_container.hpp> 
//#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
#pragma GCC optimize("O3")
//using namespace __gnu_pbds; 
#define fastio() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define pb  push_back
#define show(x) cout<<(#x)<<" : "<<x<<endl;
#define ll  long long
#define ld  long double
#define fill(a,val) memset(a,val,sizeof(a))
#define mp  make_pair
#define ff  first
#define ss  second
#define pii pair<ll,ll>
#define sq(x) ((x)*(x))
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define endl "\n"
#define int long long 
#define printclock cerr<<"Time : "<<1000*(ld)clock()/(ld)CLOCKS_PER_SEC<<"ms\n";
const ll MOD     = 1000*1000*1000+7;
const ll INF     = 1ll*1000*1000*1000*1000*1000*1000 + 7;
const ll MOD2    = 998244353;
const ll N       = 300*1000+15;
const ll N2      = 70;
const ld PI  = 3.141592653589793;
//typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> tree_set;
ll gcd(ll a, ll b){if(!b)return a;return gcd(b, a % b);} 
ll power(ll x,ll y,ll p ){ll res=1;x%=p;while(y>0){if(y&1)res=(res*x)%p;y=y>>1;x=(x*x)%p;}return res;}
ll lcm(ll a , ll b){return (a*b)/gcd(a,b);}
signed main()
{
    fastio();
    //cout<<fixed<<setprecision(20);
    //CHECK for LONG LONG and LONG DOUBLE
    /*comment for all except cc/cf    
    #ifndef ONLINE_JUDGE    
           freopen("input.txt","r",stdin);
           freopen("output.txt","w",stdout);
    #endif//*/
    int h;
    cin>>h;
    int cur = 1;
    int ans = 0;
    while(h>0)
    {
        ans+=cur;
        h/=2;
        cur*=2;
    }
    cout<<ans;

}

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

using namespace std;

int main()
{
    string s, t;
    cin >> s >> t;

    t.erase(t.size()-1);

    if (s == t) {
        cout << "Yes";
    }
    else {
        cout << "No";
    }

    

    return 0;
}

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

int main()
{
    ll l, r;
    cin >> l >> r;

    ll ans = 2018;
    for (ll i = l; i <= min(r, l + 3 * 2019); i++)
    for (ll j = i + 1; j <= min(r, l + 3 * 2019); j++)
        ans = min(ans, (j * i) % MOD);
    
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<string>
#include<cctype>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
        int n,m;
        scanf("%d %d",&n,&m);
        int ar[n][m];
        int l[m];
        for(int i=0;i<n;i++){
                for(int j=0;j<m;j++){
                        scanf("%d",&ar[i][j]);
                }
        }
        for(int i=0;i<m;i++){
                scanf("%d",&l[i]);
        }
        for(int i=0;i<n;i++){
                int ans=0;
                for(int j=0;j<m;j++){
                        ans+=ar[i][j]*l[j];
                }
                printf("%d\n",ans);
        }
        return 0;
}

Measured memory_bytes: 1208
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
#define MOD (1000000007)
#define INF (1e9)
#define INFL (1e18)

typedef long long ll;
typedef unsigned int ui;
typedef unsigned long long ull;
template<class T>using arr=vector<vector<T>>;
template<class T>int popcount(T &a){int c=0; rep(i, 8*(int)sizeof(a)){if((a>>i)&1) c++;} return c;}
template<class T>void pr(T x){cout << x << endl;}
template<class T>void prvec(vector<T>& a){rep(i, a.size()-1){cout << a[i] << " ";} pr(a[a.size()-1]);}
template<class T>void prarr(arr<T>& a){rep(i, a.size()) if(a[i].empty()) pr(""); else prvec(a[i]);}
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int dsum(ll n){
    int d=1;
    while(1){
        ll k = (ll)powl(10, d);
        if(n/k==0){
            break;
        }
        d++;
    }

    int ans=0;
    rep(i, d){
        ll t = n / (ll)powl(10, i);
        t %= 10;
        ans += t;
    }

    return ans;
}

int main()
{
    ll n; cin >> n;
    int d=1;
    while(1){
        ll k = (ll)powl(10, d);
        if(n/k==0){
            break;
        }
        d++;
    }
    
    // pr(d);
    vector<ll> e(d);
    
    int ans=0;
    rep(i, d){
        ll t = n / (ll)powl(10, i);
        t %= 10;
        e[i] = t;
        ans += t;
    }

    // prvec(e);

    ll m = n;
    ll c = 1;
    rep(i, d-1){
        c += e[i] * (ll)powl(10, i);
        n -= c;
        // pr(n);
        chmax(ans, dsum(n));
        n = m;
    }
    
    pr(ans);
    return 0;}

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

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

    vector<pair<int, int>> red(n), blue(n);
    rep(i, n) {
        int a, b;
        cin >> a >> b;
        red[i] = make_pair(a, b);
    }
    rep(i, n) {
        int a, b;
        cin >> a >> b;
        blue[i] = make_pair(a, b);
    }

    sort(blue.begin(), blue.end());

    vector<bool> used(n, false);
    int cnt = 0;
    rep(i, n) {
        int bx = blue[i].first, by = blue[i].second;

        int near_y = -1000, near_j = -1;
        rep(j, n) {
            if (used[j]) continue;

            int rx = red[j].first, ry = red[j].second;
            if (rx > bx) continue;
            if (ry > by) continue;

            if (ry > near_y) {
                near_j = j;
                near_y = ry;
            }
        }
        if (near_j != -1) {
            cnt++;
            used[near_j] = true;
        }
    }
    cout << cnt << endl;
}

Measured memory_bytes: 3656
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i = a; i < b; ++i)
#define all(c) c.begin(), c.end()
#define gmax(x,y) x=max(x,y)
#define gmin(x,y) x=min(x,y)
#define gadd(x,y) x=add(x,y)
#define gmul(x,y) x=mul(x,y)
using namespace std;

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

const int MOD = 1e9 + 7;

inline int add(int x, int y){
	int res = x + y;	
	while(res >= MOD)res-=MOD;
	return res;
}

inline int mul(int x,int y){
	return (1LL * x * y) % MOD;
}

int modpow(int x,int p){
	int res = 1;
	while(p){
		if(p&1)gmul(res,x);
		gmul(x,x);
		p/=2;
	}
	return res;
}

inline int invert(int x){
	return modpow(x,MOD - 2);
}

const int N = 1e5 + 5;

int dp[N][4];

int main(){
	cin.tie(0);
	cout.tie(0);
	ios_base::sync_with_stdio(0);
	string s;
	cin >> s;
	int n = s.length();
	int cnt = 1;
	vector<int> a(n);
	rep(i,0,n){
		if(i)a[i] = a[i-1];
		if(s[i] == 'A'){
			gadd(a[i],cnt);
		}
		if(s[i] == '?'){
			gmul(a[i],3);	
			gadd(a[i],cnt);
			gmul(cnt,3);
		}
	}
	vector<int> c(n+1,0);
	cnt = 1;
	for(int i = n-1;i>=0;--i){
		if(i < n-1)c[i] = c[i+1];
		if(s[i] == 'C'){
			gadd(c[i],cnt);
		}
		if(s[i] == '?'){
			gmul(c[i],3);	
			gadd(c[i],cnt);
			gmul(cnt,3);
		}
	}
	int ans = 0;
	rep(i,1,n-1){
		if(s[i] == 'B' || s[i] == '?'){
			gadd(ans, mul(a[i-1],c[i+1]));
		}
	}
	cout << ans << '\n';
}


Measured memory_bytes: 1232
#include <iostream>
#include <cmath>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
using namespace std;
const int mod = 1e9 + 7;
int ans[5050];
/*void dfs(int x)
{
	if (x >= 3) {ans = ((ans % mod) + 1) % mod;}
	for (int i = 3; i <= x; ++i)
		dfs(x - i);
}*/
int main()
{
	/*for (int i = 1; i <= 2000; ++i)
	{
		ans = 0;
		dfs(i);
		cout << ans << ", ";
	}*/
	int s;
	cin >> s;
	ans[1] = 0;
	ans[2] = 0;
	ans[3] = 1;
	if (s <= 3) cout << ans[s];
	else
	{
		for (int i = 4; i <= s; ++i)
			ans[i] = (ans[i - 1] + ans[i - 3]) % mod;
		cout << ans[s] << " ";
	}
	return 0;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
template<typename key>
using ordered_set = tree<key, null_type, less<key>, rb_tree_tag, tree_order_statistics_node_update>;
#define F first
#define S second
#define T second.first
//#define C second.second
#define FIO ios_base::sync_with_stdio(0);cin.tie(0);
#define all(v) v.begin(),v.end()
#define OO 0x3f3f3f3fLL
#define INF 0x3f3f3f3f3f3f3f3fLL
#define sz(s) (int)(s.size())
#define RT(s) return cout<<s,0
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pii;
typedef pair<ll,pair<ll,ll>> piii;
const int N = 2e5+5, M= 20, mod = 1000000000;
const double EPS = 1e-10;


int main(){
    FIO
//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);
    int n, m, k;
    cin>>n>>m>>k;

    char A[7][7];
    int cnt[7] = {0}, cnt2[7] = {0};
    int tot = 0;
    for(int i=0; i<n; i++){
        for(int j=0; j<m; j++){
            cin>>A[i][j];
            if(A[i][j] == '#')cnt[i]++, cnt2[j]++, tot++;
        }
    }
    int ans = 0;
    for(int i=0; i<(1<<n); i++){
        vector<int>row;
        for(int j=0; j<n; j++){
            if((i>>j)&1){
                row.push_back(j);
            }
        }

        for(int msk=0; msk<(1<<m); msk++){
            vector<int>col;
            for(int j=0; j<m; j++){
                if((msk>>j)&1){
                    col.push_back(j);
                }
            }
            sort(all(col));
            int sum = 0;
            for(int z: row){
                sum+=cnt[z];
                for(int z2: col){
                    if(A[z][z2] == '#')sum--;
                }
            }
            for(int z: col)sum+=cnt2[z];


            if(tot-sum == k){
                ans++;
            }
        }
    }
    cout<<ans;
}


Measured memory_bytes: 3664
#include "bits/stdc++.h"
#include <stdio.h>
#pragma warning(disable : 4996)

typedef long long ll;
#define all(x) (x).begin(), (x).end()  // sortなどの引数を省略
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define max3(x, y, z) max(x, max(y, z))
#define min3(x, y, z) min(x, min(y, z))

#ifdef _MSC_FULL_VER  //デバッグ出力
#define dout cout
#define debug() if (true)
#define check(x) std::cout << "★" << #x << "の値:" << (x) << endl
#define pass(x) std::cout << "☆" << x << endl
#else
#define dout \
  if (false) cout
#define debug() if (false)
#define check(x) \
  if (false) cout << "★" << #x << "の値:" << (x) << endl
#define pass(x) \
  if (false) cout << "☆" << x << endl
#endif

using namespace std;
//#define int long long;

double dist(double x1, double y1, double x2, double y2) {
	return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
}
ll idist(ll x1, ll y1, ll x2, ll y2) {
	return (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2);
}

signed main() {
	int n, m, a;
	double b = 0;
	int ans = 0;
	cin >> n >> m;
	vector<int> list(n);
	rep(i, n) {
		cin >> a;
		b = b + a;
		list.at(i) = a;
	}
	sort(list.begin(), list.end(), greater<int>());
	rep(i, m) {
		list.at(i);
		if (b / (4 * m) <= list.at(i)) {
			ans++;
		}
	}
	if (ans == m) cout << "Yes" << endl;
	else cout << "No" << endl;
}

Measured memory_bytes: 3724
#pragma GCC target("avx2")
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#include<bits/stdc++.h>

#define f			first
#define sz(a)       ((int)(a).size())
#define s			second
#define all(v)		v.begin(),v.end()
#define pii 		pair<int,int>
#define vpii 		vector<pii>
#define eb			emplace_back
#define pb			push_back
#define fo(i,n)		for(int i=0;i<n;i++)
#define Fo(i,k,n)	for(int i=k;i<n;i++)
#define vi			vector<int>
#define deb(x)		cout << #x << " " << x << endl

using namespace std;
using ll  = long long;
using lld = long double;

const int oo = 0x3f3f3f3f;
const ll MOD = 1000000007;
const int N = 1005;
string ar[N];
int dp[N][N];
signed main(){

#ifndef ONLINE_JUDGE
//	freopen("in.txt" , "r" , stdin);
#endif
	ios_base::sync_with_stdio(0);cin.tie(0);

    
    int n , m;
    cin >> n >> m;
    
    fo(i , n)
        cin >> ar[i];
    

    auto relax = [](int & a ,int b){
        a = (a % MOD + b % MOD) % MOD;
        return;
    };

    dp[0][0] = 1;
    fo(i , n)
        fo(j , m)
            if(ar[i][j] == '.')
                relax(dp[i + 1][j] , dp[i][j]) ,
                relax(dp[i][j + 1] , dp[i][j]);
   
   // fo(i , n) {
   //     fo(j , m) cout << dp[i][j] << " ";
   //     cout << '\n';
   // }
    cout << dp[n - 1][m - 1] << '\n';
    
    return 0;

}



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

int main() {
	// your code goes here
	int a[5];
	for(int i=0;i<5;i++){
	    cin>>a[i];
	    if(a[i]==0){
	        cout<<i+1<<endl;
	    }
	}
	
	return 0;
}


Measured memory_bytes: 3560
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(v) v.begin(),v.end()
using namespace std;
typedef long long ll;
 
int main(){
  string A,B;
  cin>>A>>B;
  if(A.length()>B.length()){
    cout<<"GREATER";
    return 0;
  }
  if(A.length()<B.length()){
    cout<<"LESS";
    return 0;
  }
  if(A.length()==B.length()){
    rep(i,A.length()){
      if(A[i]>B[i]){
        cout<<"GREATER";
        return 0;
      }
      if(A[i]<B[i]){
        cout<<"LESS";
        return 0;
      }
    }
  }
  cout<<"EQUAL"<<endl;
}   

Measured memory_bytes: 3588
#include <iostream>
#include <vector>
#include <list>
#include <set>
#include <queue>
#include <map>
#include <algorithm>
#include <functional>
#include <string>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
using namespace std;

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

using ll = long long int;
using pll = pair<ll, ll>;

ll N, M;

const ll MAXN = 100000;
ll X[MAXN];
ll Y[MAXN];
ll Z[MAXN];

struct UnionFind
{
    vector<int> uf;

    // 親なし(-1)で初期化しておく
    void init(int n) { uf.assign(n, -1); }

    // 親がいないなら自分を返す, 親がいたら経路圧縮して返す(root直下に繋ぐ)
    int find(int x) { return uf[x] < 0 ? x : (uf[x] = this->find(uf[x])); }

    // 繋げようとする(unionは予約語なんですよね, これが)
    bool connect(int a, int b)
    {
        a = this->find(a); // aのルートノード
        b = this->find(b); // bのルートノード
        if (a != b){ uf[b] = a; return true; } // 新しくつなげた
        return false; // もうつながってる
    }

} uf;


int main()
{
    cin >> N >> M;
    // rep (i, M) { cin >> X[i] >> Y[i] >> Z[i]; }

    uf.init(N);

    ll x, y, z;

    rep(i, M)
    {
        cin >> x >> y >> z;
        --x;
        --y;

        uf.connect(x, y);
    }


    ll ans = 0;

    rep(i, N)
    {
        if (uf.uf[i] < 0) { ++ans; }
    }

    cout << ans << endl;

    return 0;
}


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

int main()
{
	string str;
	cin >> str;
	char a = str[2];
	char b = str[4];
	if (str[3] != a || str[5] != b)
	{
		cout << "No\n";
	}
	else
	{
		bool bo = true;
		for (int i = 0; i < str.length(); i++)
		{
			if (i >= 2 && i <= 5)
				continue;
			if (str[i] == a || str[i] == b)
			{
				bo = false;
				cout << "No\n";
			}
		}
		if (bo)
			cout << "Yes\n";

	}





	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define endl ("\n")
using namespace std;

#define deb(x) cout << (#x) << " -> " << (x) << endl;
#define mod (1000000007)

int main()
{
    ios_base::sync_with_stdio(false);
    cout.tie(0);
    cout << fixed;
    cout.precision(10);
    // Those who cannot acknowledge themselves, will invariably fail

    int n, a, b;
    cin >> n >> a >> b;
    cout << min(n*a, b);
    return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Main {
	public static ArrayList<String> s = new ArrayList<String>();
	public static void main(String[] args) throws IOException {
		FastScanner in = new FastScanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		int n= in.nextInt();
		long [] c= new long[n];
		c[0]= in.nextLong();
		for (int i = 1; i < c.length; i++) {
			c[i]= in.nextInt()+c[i-1];
		}
		long best= Long.MAX_VALUE;
		for (int i = 0; i < n-1; i++) {
			long x= c[i];
			long y= c[n-1]- c[i];
			long dif= Math.abs(x-y);
			best= Math.min(best, dif);
		}
		System.out.println(best);
		
	}
	public static void combinations(String suffix,String prefix){
        if(prefix.length()<0)return;
        s.add(suffix);
        for(int i=0;i<prefix.length();i++)
         combinations(suffix+prefix.charAt(i),prefix.substring(i+1,prefix.length()));
    }
	static class FastScanner {
		BufferedReader br;
		StringTokenizer st;

		public FastScanner(InputStream in) {
			br = new BufferedReader(new InputStreamReader(in));
			st = new StringTokenizer("");
		}

		public double nextDouble() throws NumberFormatException, IOException {
			return Double.parseDouble(next());
		}

		public String next() throws IOException {
			if (!st.hasMoreTokens()) {
				st = new StringTokenizer(br.readLine());
				return next();
			}
			return st.nextToken();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}
	}
}



Measured memory_bytes: 45888
def main(hs, K):
    hs.sort()
    print(min(hs[i+K-1] - hs[i] for i in range(len(hs)-K+1)))



#main([10,15,11,14,12], 3)
#main([5,7,5,7,7],3)


if __name__ == "__main__":
    N, K = (int(x) for x in input().split())

    hs = []
    for i in range(N):
        hs.append(int(input()))
    main(hs, K)

Measured memory_bytes: 7384
from functools import lru_cache
from math import gamma

def framod(n, mod, a=1):
    for i in range(1,n+1):
        a=a * i % mod
    return a

def power(n, r, mod):
    if r == 0: return 1
    if r%2 == 0:
        return power(n*n % mod, r//2, mod) % mod
    if r%2 == 1:
        return n * power(n, r-1, mod) % mod

def comb(n, k, mod):
    a=framod(n, mod)
    b=framod(k, mod)
    c=framod(n-k, mod)
    return (a * power(b, mod-2, mod) * power(c, mod-2, mod)) % mod

MOD = 10 ** 9 + 7

s = int(input())

ans = 0
for i in range(s//3):
  ans += comb(s-2*(i+1)-1, i, MOD)

print(ans % MOD)

Measured memory_bytes: 9516
io = STDIN
n,m,x,y=io.gets.split.map(&:to_i)
xar=io.gets.split.map(&:to_i)
yar=io.gets.split.map(&:to_i)
if xar.max < yar.min &&
  x < yar.min &&
  xar.max < y
  puts "No War"
else
  puts "War"
end


Measured memory_bytes: 1788
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    TreeMap<Character, Integer> map = new TreeMap<>();
    for (int i = 0; i < s.length(); i++) {
      char c = s.charAt(i);
      if (map.containsKey(c)) {
        map.put(c, map.get(c) + 1);
      } else {
        map.put(c, 1);
      }
    }
    int ans = 0;
    if (map.size() > 1) {
      int min = Integer.MAX_VALUE;
      for (Character c : map.keySet()) {
        String tmp = s;
        int count = 0;
        while (!check(tmp, c)) {
          String after = tmp.substring(0, tmp.length() - 1);
          for (int i = 1; i < tmp.length(); i++) {
            if (tmp.charAt(i) == c) {
              char[] afterAry = after.toCharArray();
              afterAry[i - 1] = c;
              after = new String(afterAry);
            }
          }
          tmp = after;
          count++;
        }
        if (count < min) {
          min = count;
        }
      }
      ans = min;
    }
    System.out.println(ans);
  }

  public static boolean check(String s, char c) {
    boolean allSame = true;
    for (int i = 0; i < s.length(); i++) {
      if (s.charAt(i) != c) {
        allSame = false;
      }
    }
    return allSame;
  }
}

Measured memory_bytes: 38612
import java.util.*;
public class Main {
    public static void main(String [] args) {
        Scanner sc = new Scanner(System.in);
        String S;
        S = sc.next();
        int num2 =S.length();
        for(int a=0;a<S.length()-1;a++){
            if(S.charAt(a)!=S.charAt(a+1)){
                if(a+1>S.length()-a-1) num2 = Math.min(num2,a+1);
                else num2 = Math.min(num2,S.length()-a-1);
            }
        }
        System.out.println(num2);
    }
}

Measured memory_bytes: 24396
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp2
{
    class Program
    {
        static void Main(string[] args)
        {

            string[] input = Console.ReadLine().Split(' ');

            int A = int.Parse(input[0]);
            int B = int.Parse(input[1]);
            int K;

            K = A + B;

            if (K%2==0)
            {
                Console.WriteLine(K/2);
            }
            else
            {
                Console.WriteLine("IMPOSSIBLE");
            }
            
        }
    }
}

Measured memory_bytes: 11092
#include <iostream>
#include <vector>
#include <climits>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <string>
#include <bitset>
#include <utility>
#include <numeric>
#include <queue>
#include <stack>

using ll = long long;
using namespace std;

constexpr int MOD = 1e9 + 7;
constexpr ll MOD_LL = ll(1e9 + 7);

int main(void) {
	int n, a, b;
	string s;
	cin >> n >> a >> b >> s;
	
	int cur = 0;
	int os = 0;
	for(int i = 0; i < n; ++i) {
		if( cur < a + b && s[i] == 'a' ) {
			cout << "Yes" << endl;
			cur++;
		} else if( cur < a + b && os < b && s[i] == 'b' ) {
			cout << "Yes" << endl;
			cur++; os++;
		} else {
			cout << "No" << endl;
		}
	}
	
	return 0;
}


Measured memory_bytes: 3700
#include<stdio.h>
#include<string.h>
int main(){
    int k;
    char s[100+1];
    scanf("%d",&k);
    scanf("%s",s);
    if(strlen(s)<=k){
        printf("%s",s);
        return 0;
    }else if(k<strlen(s)){
        for(int i=0;i<k;i++){
            printf("%c",s[i]);
        }
    }
    printf("...\n");
}

Measured memory_bytes: 1672
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner keyBoardScanner = new Scanner(System.in);
		int x = keyBoardScanner.nextInt();
		if (1 <= x && x <= 9) {
			if (x == 7 || x == 5 || x == 3) {
				System.out.println("YES");
			} else {
				System.out.println("NO");
			}
		}
	}
}


Measured memory_bytes: 23252
import math

N, K = map(int, input().split())

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

answer = 0

for i in range(1, K+1):
    if N-K+1 < i:
        print(0)
        continue
    answer = combinations_count(K-1, i-1)
    answer *= combinations_count(N-K+1, i)
    answer %= 10**(9) + 7
    print(answer)

Measured memory_bytes: 3316
import java.util.*;
 
public class Main {
 
  public static void main(String args[]) {
   
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    
    String strA = String.valueOf(a);
    String strB = String.valueOf(b);
    String answer = "";
    
    if (a == b || a < b) {

       while (b > 0) {
        answer = answer.concat(strA);
        b--;
      }
      System.out.println(answer);
 
    } else {
      
             while (a > 0) {
          answer = answer.concat(strB);
          a--;
       }

     System.out.println(answer);
    }
 
  }
}

Measured memory_bytes: 35552
import sys
input = sys.stdin.readline

 
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    n, y = MI()
    result = "-1 -1 -1"
    for i in range(n, -1, -1):
        a = i * 10000
        if a <= y:
            for j in range(n-i, -1, -1):
                b = a + j * 5000
                if b <= y:
                    if b + 1000 * (n-i-j) == y:
                        result = str(i)+" "+str(j)+" "+str(n-i-j)
                        print(result)
                        sys.exit()
    print(result)

main()

Measured memory_bytes: 3064
#include <stdio.h>
#include <string.h>
#include <limits.h>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <queue>

#ifndef U_L_LONG
typedef unsigned long long ULLONG;
#endif
#ifndef L_LONG
typedef long long LLONG;
#endif
template <class _T> static _T tp_abs(const _T& a) {
	//	usage:  tp_abs<type name>(a);
	return ((a < 0) ? (a * -1) : a);
}
template <class _T> static _T tp_min(_T a, _T b) {
	return a < b ? a : b;
}
template <class _T> static _T tp_max(_T a, _T b) {
	return a > b ? a : b;
}
template<class _T> static void get1int(_T& a) {
	const char* fmt = " %d";
	if (sizeof(_T) == sizeof(long long)) {
		fmt = " %lld";
	}

	if (scanf(fmt, &a) < 0) {
		printf("g1int Error\n");
	}
}
template<class _T> static void get2int(_T& a, _T& b) {
	const char* fmt = " %d %d";
	if (sizeof(_T) == sizeof(long long)) {
		fmt = " %lld %lld";
	}

	if (scanf(fmt, &a, &b) < 0) {
		printf("g2int Error\n");
	}
}
static void getstring(char* buff) {
	if (scanf(" %s", buff) < 0) {
		printf("getstr error!\n");
	}
}


static void ABC019B_ReverseAndCompare();

#if 1
int main()
{
	ABC019B_ReverseAndCompare();
	
	fflush(stdout);
	return 0;
}
#endif

static void ABC019B_ReverseAndCompare()
{
	auto szA = new char[200001];
	memset(szA, 0, sizeof(char) * 200001);
	getstring(szA);

	LLONG len = strlen(szA);
	
	std::map<char, LLONG> charCnt;
	for (int i = 0; i < len; i++) {
		charCnt[szA[i]]++;
	}

	LLONG pairCnt = 0;
	for (auto it = charCnt.begin(); it != charCnt.end(); it++) {
		pairCnt += (it->second * (it->second - 1LL)) / 2LL;
	}
	LLONG ans = (len * (len - 1)) / 2LL - pairCnt + 1;
	printf("%lld\n", ans);

	delete[] szA;
}


Measured memory_bytes: 384
#include<iostream>
#include<queue>
#include<map>
using namespace std;
string S;
char f(char a,char b)
{
	if(a=='r'&&b=='b')return 'g';
	else if(a=='r'&&b=='g')return 'b';
	else if(a=='b'&&b=='r')return 'g';
	else if(a=='b'&&b=='g')return 'r';
	else if(a=='g'&&b=='r')return 'b';
	else return 'r';
}
main()
{
	while(cin>>S,S!="0")
	{
		queue<pair<int,string> >P;
		P.push(make_pair(0,S));
		map<string,bool>M;
		M[S]=1;
		bool flag=1;
		while(!P.empty())
		{
			int u=P.front().first;
			string s=P.front().second;
			P.pop();
			bool F=0;
			for(int i=0;i<s.size()-1;i++)
			{
				if(s[i]==s[i+1])continue;
				F=1;
				string t=s;
				t[i]=t[i+1]=f(s[i],s[i+1]);
				if(!M[t])
				{
					M[t]=1;
					P.push(make_pair(u+1,t));
				}
			}
			if(!F)
			{
				cout<<u<<endl;
				flag=0;
				break;
			}
		}
		if(flag)cout<<"NA"<<endl;
	}
}



Measured memory_bytes: 4864