akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = a; i < n; i++)
#define repr(i, a, n) for (int i = n - 1; i >= a; i--)
using namespace std;
using ll = long long;
using P = pair<int, int>;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }

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

  int n;
  cin >> n;
  vector<ll> a(n), acc(n + 1);
  rep(i, 0, n) {
    cin >> a[i];
    acc[i + 1] = acc[i] + a[i];
  }

  ll ans = 1e18;
  rep(i, 1, n) chmin(ans, abs(acc[i] - (acc[n] - acc[i])));

  cout << ans << endl;
}


Measured memory_bytes: 3456
a = int(input())
k = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(k[a-1])

Measured memory_bytes: 3060
#include <iostream>

using namespace std;

int main(){
  long long n, k;
  cin >> n >> k;
  long long t = n/k;
  long long result = t;
  if (t > 1) {
    result += 3 * t * (t-1);
  }
  if (t > 2) {
    result += t * (t-1) * (t-2);
  }
  if (k % 2 == 0) {
    t = n / (k/2) - n/k;
    result += t;
    if (t > 1) {
      result += 3 * t * (t-1);
    }
    if (t > 2) {
      result += t * (t-1) * (t-2);
    }
  }
  cout << result << endl;
  return(0);
}


Measured memory_bytes: 888
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
#define MAXSIZE 100
#define MAXL 100
typedef long long int lli;

void decreament_arr(int n, int height[MAXSIZE], lli *ans);

int main(){
    int n, height[MAXSIZE], notzero = 0;
    cin >> n;
    for(int i = 0; i < n; i++){
        cin >> height[i];
        if(height[i] > 0){
            notzero = 1;
        }
    }
    
    lli ans = 0;
    if(notzero){
        decreament_arr(n, height, &ans);
    }
    cout << ans << endl;
    return 0;
}

void decreament_arr(int n, int height[MAXSIZE], lli *ans){
    //cout << "ans = " << *ans << endl;
    int recur = 0, left = -1, right = -1, all_search_finished = 0, minimum;
    for(int i = 0; i < n; i++){
        if(left < 0){
            if(height[i] > 0){
                left = i;
                minimum = height[i];
            }

            if(i == n - 1){
                all_search_finished = 1;
                if(height[i] > 0){
                    left = i;
                    right = i;
                    minimum = height[i];
                }
            }
        }else{
            if(height[i] > 0){
                minimum = min(minimum, height[i]);
                right = i;
            }else{
                right = i - 1;
                all_search_finished = 1;
            }
        }

        if(left >= 0 && right >= 0 && all_search_finished){
            break;
        }
    }
    
    for(int i = 0; i < n; i++){
        if(left <= i && i <= right){
            height[i] -= minimum;
        }

        if(height[i] > 0){
            recur = 1;
        }

        //cout << "height[" << i << "] = " << height[i] << endl;
    }

    (*ans) += minimum;

    if(recur){
        decreament_arr(n, height, ans);
    }
    return;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){

    int A, B, X;

    cin >> A >> B >> X;

    if(A + B < X){
        cout << "NO" << endl;
    }else if(X < A){
        cout << "NO" << endl;
    }else if(X <= A + B){
        cout << "YES" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int h, w;
    cin >> h >> w;
    for (int i = 0; i <= w + 1; i++) cout <<'#';
    cout << endl;
    for (int i = 0; i < h; i++) {
        string s;
        cin >> s;
        cout << '#' << s << '#' << endl;
    }
    for (int i = 0; i <= w + 1; i++) cout <<'#';
    cout << endl;
}


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

using namespace std;


int main()
{  	
	int n,m;
	int a,b,c;
	cin>>n>>m;
	queue <int> s[n];
	for(int i=1;i<=m;i++)
	{cin>>c;
		if(c==0)
		{
			cin>>a>>b;
			s[a].push(b);
			
		}
		else if(c==1)
				{cin>>a;
				 if (!s[a].empty() )cout<<s[a].front()<<endl;}
		else if(c==2)
				{cin>>a;
				 if (!s[a].empty() )s[a].pop();
				 //cout<<endl;
				 }		 
	}
   
	
	
	
	return 0;
} 


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

m = 10**9+1
minus_count = 0
for i in range(n):
    if a[i] < 0:
        minus_count += 1 
    if m > abs(a[i]):
        m = abs(a[i])
    a[i] = abs(a[i])
if minus_count % 2 == 0:
    print(sum(a))
else:
    print(sum(a) - m*2)


Measured memory_bytes: 14412
<?php
fscanf(STDIN, '%d', $N);
fscanf(STDIN, '%s', $S);
$l = $r = [];
$a = str_split($S);
$l[0] = $a[0] === '#' ? 1 : 0;
$r[$N - 1] = $a[$N - 1] === '.' ? 1 : 0;

for ($i = 1; $i < $N; $i++) {
    $l[$i] = $a[$i] === '#' ? $l[$i - 1] + 1 : $l[$i - 1];
    $r[$N - $i - 1] = $a[$N - $i - 1] === '.' ? $r[$N - $i] + 1 : $r[$N - $i];
}
$ans = $r[0];
for ($i = 1; $i < $N; $i++) {
    $ans = min($ans, $l[$i - 1] + $r[$i]);
}
$ans = min($ans, $l[$N - 1]);
echo $ans;


Measured memory_bytes: 35956
#!/usr/bin/env python3
# n,m = map(int,sys.stdin.readline().split())
# a = tuple(map(int,sys.stdin.readline().split())) # single line with multi param
# a = tuple(sys.stdin.readline() for _ in range(n)) # multi line with single param
# a = tuple(tuple(map(int,sys.stdin.readline().rstrip().split()) for _ in range(N))) # multi line with multi param
# s = sys.stdin.readline().rstrip()
# n = int(sys.stdin.readline())
# INF = float("inf")
import sys,collections
N = int(sys.stdin.readline())
G = tuple(tuple(map(int,sys.stdin.readline().rstrip().split()) for _ in range(N))) # multi line with multi param

INF = float("inf")
W = [INF]*N
A = set(range(N))
T = set()

def add(e):
  T.add(e)
  for i,w in enumerate(G[e]):
    if not i in T and w != -1:
      W[i] = min(W[i],w)
  if not A-T:#W[-1] = -INF
    return -1
  m = min((W[i],i) for i in A-T)
  #print(W,T,m)
  return m[1]

n = add(0)
W[0] = 0
while len(T) < len(G):
  n = add(n)
print(sum(W))


Measured memory_bytes: 6596
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
#define REP(i, limit) for(int i=0; i< limit; ++i)
#define LINT long long

int main(){
  int N;
  cin >> N;
  LINT a[N];
  REP(i, N) cin >> a[i];
  int sum=0;

  REP(i, N)sum += a[i]-1;

  cout << sum << endl;



  return 0;
}


Measured memory_bytes: 256
open Batteries
module EnumL = Enum.Labels
module ListL = List.Labels
module ArrayL = Array.Labels

let dbg0 x = Printf.eprintf "[debug]%s\n" @@ dump x
let dbg1 x = dbg0 x; x

let id = identity

let (++) n m = if n <= m then  List.range n `To m else []
let (++-) n m = if n >= m then List.range n `Downto m else []
let (++^) n m = if n < m then List.range n `To (pred m) else []

module ModOp = struct
  let prime = 1_000_000_007
  let (-) a b = (a + prime - b) mod prime
  let (+) a b = (a + b) mod prime
  let ( * ) a b = (a * b) mod prime

  let rec pow x n =
    if n = 0 then 1
    else if n mod 2 = 0 then pow (x*x) (n/2)
    else x * pow (x*x) (n/2)
end

let scan fmt = Scanf.sscanf (read_line ()) fmt

let scan_lines n fmt f =
  if n = 0 then []
  else List.map (fun _ -> scan fmt f) (1 ++ n)

let scan_list ?sep cnv =
  let line = read_line () in
  (match sep with
   | None -> List.map String.of_char @@ String.to_list line
   | Some sep -> String.split_on_char sep line)
  |> List.map cnv

let scan_array ?sep cnv = Array.of_list @@ scan_list ?sep cnv

let scan_matrix n m e ?sep conv =
  let arr = Array.make_matrix n m e in
  ListL.iter (0 ++^ n)
    ~f:(fun i -> arr.(i) <- Array.of_list @@ scan_list ?sep conv);
  arr

let atoi c = Char.code c - Char.code '0'
let itoa n = Char.chr (n + Char.code '0')

let rec powerset = function
  | [] -> [[]]
  | hd::tl ->
    let pws =  powerset tl in
    pws @ ListL.map pws ~f:(fun pw -> hd::pw)

let permutations l =
  let rec interleave x = function
    | [] -> [[x]]
    | (hd::tl) as l ->
      (x::l) :: (interleave x tl |> ListL.map ~f:(fun l -> hd::l)) in
  let rec aux = function
    | [] -> [[]]
    | a::rest ->
      aux rest |> ListL.map ~f:(interleave a) |> List.concat in
  aux l

let intersection l =
  EnumL.filter ~f:(fun x -> EnumL.exists ~f:((=) x) @@ Enum.clone l)

let zip l m =
  let n = min (List.length l) (List.length m) in
  List.combine (List.take n l) (List.take n m)

let lower_bound n f =
  let rec aux l u =
    if u - l > 1 then
      let m = (l + u) / 2 in
      if f m then aux l m
      else aux m u
    else u in aux (-1) n

let between n x m = n <= x && x < m

let l = scan "%f" id
let () =
  let i = l/.3.0 in
  Printf.printf "%f\n" @@ Float.pow i 3.0


Measured memory_bytes: 5776
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        HashSet<Integer> hs = new HashSet<>();
        int plus = a % b;
        int rem = a % b;
        while(true){
            if(rem == c){
                System.out.println("YES");
                break;
            }else if(hs.contains(rem)){
                System.out.println("NO");
                break;
            }else{
                hs.add(rem);
                rem = (rem + plus)%b;
            }
        }
        
    }
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define ll long long
#define _GLIBCXX_DEBUG
const ll MOD = 1000000007;
const int MAX = 510000;

int N;
string henkan(string s) {
  map<char, int> chars;
  map<char, char> char2char;
  string res = "";
  for (int i=0; i<(int)s.size(); i++) {
    if (chars[s[i]]==0) {
      char bck = char('a'+chars.size()-1);
      res.push_back(bck);
      chars[s[i]]++;
      char2char[s[i]] = bck;
    }
    else res.push_back(char2char[s[i]]);
  }
  return res;
}

map<string, int> maps;
set<string> ans;
void dfs(string s) {
  string x = henkan(s);
  if (maps[x]) return;
  maps[x]++;
  if ((int)x.size()==N) {
    ans.insert(x);
    return;
  }
  for (int i=0; i<N; i++) {
    string nx = x;
    nx.push_back(char(i+'a'));
    dfs(nx);
  }
}

int main() {
  cin.tie(0);
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(20);
  cin >> N;
  dfs("");
  for(auto y: ans) cout << y << endl;
  return 0;
}

Measured memory_bytes: 23756
/// Bismillahir Rahmanir Rahim
/* Mohammad Morsalin
   Dept of ICE, NSTU
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ll long long
#define pb push_back
#define mp make_pair
#define endl "\n"
#define int long long
#define f0(n) for(int i=0;i<n;i++)
#define ms(x) memset(x,0,sizeof(x))
#define ms2d(x,m,n) memset(x, 0, sizeof(x[0][0]) * m * n)
#define uniq(vec) vec.resize(distance(vec.begin(),unique(vec.begin(),vec.end())))
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define pi pair<int,int>
#define tc(t) int t;cin>>t;while(t--)
#define bits(n) __builtin_popcount(n)
#define maxpq priority_queue<int>
#define minpq priority_queue<int, vector<int>, greater<int> >
#define ins insert
#define ALL(v) v.begin(),v.end()
#define highest(x) numeric_limits<x>::max()
#define lowest(x) numeric_limits<x>::min()
#define Inf INFINITY
#define minv(v) *min_element(v.begin(),v.end())
#define maxv(v) *max_element(v.begin(),v.end())
#define fi first
#define se second
#define PI acos(-1)
#define sz(a) (int)a.size();
#define IOS ios::sync_with_stdio(false);
using namespace std;
int gcd(int a, int b) { if (a == 0) return b; return gcd(b % a, a);}
typedef tree<pair<int, int>,null_type,less<pair<int, int>>,rb_tree_tag,tree_order_statistics_node_update> ordered_multiset;
int dx8[] = {0, 0, 1, 1, 1, -1, -1, -1};
int dy8[] = {1,-1, 1, -1, 0, 0, -1, 1};
int dx4[] = {0, 0, 1, -1};
int dy4[] = {1, -1, 0, 0};
const long long MOD = 1000000007;
double sq(double x) {return x*x;}
template<typename T>inline T Bigmod(T base, T power, T MOD){
    T ret=1;
    while(power)
    {
        if(power & 1)ret=(ret*base)%MOD;
        base=(base*base)%MOD;
        power>>=1;
    }
    return ret;
}

bool sortinrev(const pair<int,string> &a,
               const pair<int,string> &b)
{
        if(a.fi==b.fi) return a.se<b.se;
       return (a.first > b.first);
}
signed main()
{
    IOS
    int n;
    cin>>n;
    map<string,int>mm;
    for(int i=0;i<n;i++){
        string s;
        cin>>s;
        mm[s]++;
    }
    vector<pair<int,string> >vp;
    for(auto it=mm.begin();it!=mm.end();it++){
        vp.pb(mp(it->se,it->fi));
    }
    sort(ALL(vp),sortinrev);
    int lv=vp[0].fi;
    for(int i=0;i<(int)vp.size();i++){
        if(vp[i].fi!=lv) break;
        cout << vp[i].se << endl;
    }
    return 0;
}
///Alhamdulillah


Measured memory_bytes: 29412
#include <bits/stdc++.h>
#include <set>
#include <queue>

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++) 
#define reps(i, s, n) for (int i = s; i < (int)(n); i++) 
#define ll long long
#define ld long double
#define repl(i, n) for (ll i = 0; i < (ll)(n); i++) 
#define repsl(i, s, n) for (ll i = s; i < (ll)(n); i++)  
#define outdeb(fir, sec, thr) cout << fir << ":" << sec << ":" << thr << endl
#define readVarll(nam) ll nam; cin >> nam
#define INF 99999999999

ll a[200001];

ll calc(ll n)
{
  ll ans = 0;

  repl(i, n - 1)
  {
    if(a[i] > a[i+1])
    {
      ans += a[i] - a[i+1];
      a[i+1] = a[i];
    }
  }
  return ans;
}

int main()
{
  ll n;
  cin >> n;
  repl(i, n)
  {
    readVarll(tmp);
    a[i] = tmp;
  }

  ll ans = calc(n);

  cout << fixed << ans << endl;

  return 0;
}

Measured memory_bytes: 5184
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int preT = 0;
        int preX = 0;
        int preY = 0;

        for (int i=0; i<N; i++) {
            int postT = sc.nextInt();
            int postX = sc.nextInt();
            int postY = sc.nextInt();

            int dt = postT - preT;
            int dist = Math.abs(postX - preX) + Math.abs(postY - preY);
            if ((dt < dist) || ((dist - dt) % 2 != 0)) {
                System.out.println("No");
                return;
            }
            preT = postT;
            preX = postX;
            preY = postY;
        }
        System.out.println("Yes");
    }

}


Measured memory_bytes: 87272
import java.util.Scanner;
 
public class Main {
	private static Scanner sc = new Scanner(System.in);
	static void p(String ans) {System.out.println(ans);};
	static void p(int ans) {System.out.println(ans);};
	static void p(long ans) {System.out.println(ans);};
	static String eikomoji[]={"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"};
	public static void main(String[] args) {
	int A =sc.nextInt();
	int B =sc.nextInt();
	int ans=0;
	
	double AA=A/0.08;
	double BB=B/0.10;
	double AAA=(A+1)/0.08;
	double BBB=(B+1)/0.10;
	boolean a=true;
	//p("AA"+AA+"BB"+BB+"AAA"+AAA+"BBB"+BBB);
	//AA~AAAの間であり、BB~BBBの間である数を求める
	for(int i=1;i<=2000;i++) {
		if(AA<=i&&AAA>i&&BB<=i&&BBB>i) {
			System.out.println(i);
			a=false;
			break;
		}
	}
	
	if(a) {
		p(-1);
	}
	
	
	}
}

Measured memory_bytes: 22868
#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<cstring>
using namespace std;
char c[10][10];
bool flag;
int h,w,chk[10][10];
int way_x[2] = {1,0};
int way_y[2] = {0,1};//下、右 
bool jud(int i)
{
	for(int i = 1;i <= h;i++)
	{
		for(int j = 1;j <= w;j++)
		{
	//		printf("%d ",chk[i][j]);
			if(c[i][j] == '#' && chk[i][j] == 0)
			return 0;
		}
	//	printf("\n");
	}
	return 1;
} 
void dfs(int x,int y)//下。右 
{
	if(flag == 1)	return;
	if(x == h && y == w)
	{
		if(jud(1) == 1)
		{
			flag = 1;
			printf("Possible");
			return;
		}
	}
	for(int i = 0;i <= 1;i++)
	{
		if(c[x+way_x[i]][y+way_y[i]] != '#')
			continue;
		x += way_x[i];
		y += way_y[i];
		chk[x][y] = 1;
		dfs(x,y);
		chk[x][y] = 0;
		x -= way_x[i];
		y -= way_y[i];
	}
	return;
}
int main(){
	scanf("%d%d",&h,&w);
	for(int i = 1;i <= h;i++)
	{
		getchar();
		for(int j = 1;j <= w;j++)
		{
			scanf("%c",&c[i][j]);
		}
	}
//	for(int i = 1;i <= h;i++)
//	{
//		for(int j = 1;j <= w;j++)
//		{
//			printf("%c ",c[i][j]);
//		}
//		cout<<endl;
//	}
	chk[1][1] = 1;
	dfs(1,1);
	if(flag == 0)
	{
		printf("Impossible");
	}
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define WHOLE(v) (v).begin(), (v).end()
using i64 = int64_t;
using namespace std;
int main() {
    const int D = 3;
    vector<int> p(D), A(D);
    for (int i = 0; i < D; i++) {
        p[i] = i;
        cin >> A[i];
    }
    i64 ans = 1e8;
    do {
        i64 ans_ = 0;
        for(int i = 1; i < D; i++) {
            ans_ += abs(A[p[i]] - A[p[i - 1]]);
        }
        ans = min(ans, ans_);
    } while (next_permutation(WHOLE(p)));
    cout << ans << endl;
    return 0;
}

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

int main()
{
    int a, b;
    char op;

    while (true) {
        cin >> a >> op >> b;
        if (op == '?') break;
        if (op == '+') cout << a + b << endl;
        if (op == '-') cout << a - b << endl;
        if (op == '*') cout << a * b << endl;
        if (op == '/') cout << a / b << endl;
    }
}

Measured memory_bytes: 3024
#include <bits/stdc++.h>
#define rep(i, n) for (lli i = 0; i < (n); i++)
#define rrep(i, n) for (lli i = (n)-1; i >= 0; i--)
using namespace std;
using lli = long long int;
int main()
{
    int a[100005];
    int n;
    cin >> n;
    map<lli, lli> cnt;
    rep(i, n) cin >> a[i];
    rep(i, n) cnt[a[i]]++;
    lli ans = 0;
    rep(i, 100005)
    {
        ans = max(ans, cnt[i - 1] + cnt[i] + cnt[i + 1]);
    }
    cout << ans << endl;
}


Measured memory_bytes: 6912
// #include <bits/stdc++.h>
#include <iostream> // cout, endl, cin
#include <iomanip> // setprecision
#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
#include <cmath> // pow

#define int long long

// loop
#define FOR(i, a, b) for (int i = (a); i < (b); i++) 	// a ~ b-1	(ascending)
#define REP(i, n) FOR(i, 0, n)							// 0 ~ n-1
#define NREP(i, n) FOR(i, 1, n + 1)						// 1 ~ n
#define RFOR(i, a, b) for (int i = (a); i >= (b); i--)	// a ~ b	(descending)
#define RREP(i, n) RFOR(i, n, 0)						// n ~ 0
#define RNREP(i, n) RFOR(i, n, 1)						// n ~ 1
 
// container operation
#define all(v) v.begin(), v.end()
#define EACH(i, c) for (auto i = (c).begin(); i != (c).end(); i++)
#define ASORT(c) std::sort((c).begin(), (c).end())
#define DSORT(c) std::sort((c).begin(), (c).end(), std::greater<decltype(c)::value_type>())
#define SIZE(x) ((int)(x).size())
// union of two containers
template <typename T>
void container_union(T &c1, T &c2, T &c3) {
  std::vector<int> vec;
  std::set_union(c1.begin(), c1.end(),
                 c2.begin(), c2.end(),
                 std::back_inserter(vec));
  T tmp(vec.begin(), vec.end());
  c3 = tmp;
}

// chmax, chmin
template <typename T>
bool chmax(T &a, const T& b) {
  if (a < b) {
    a = b;  // aをbで更新
    return true;
  }
  return false;
}
template <typename T>
bool chmin(T &a, const T& b) {
  if (a > b) {
    a = b;  // aをbで更新
    return true;
  }
  return false;
}

// grid-search
std::vector<int> dx = {1, -1, 0,  0};
std::vector<int> dy = {0,  0, 1, -1};
 
// debug
#define check(x) std::cout << #x << " = " << x << '\n'
 
// print
#define cout(x) std::cout << x << '\n'
 
// type alias
using VI = std::vector<int>;
using VII = std::vector<VI>;
using VB = std::vector<bool>;
using VBB = std::vector<VB>;
using VS = std::vector<std::string>;
using PII = std::pair<int, int>;

// yes/no
std::string yes = "Yes";
std::string no = "No";
std::string YES = "YES";
std::string NO = "NO";

void solve();

signed main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  std::cout << std::fixed << std::setprecision(10);
  solve();
  return 0;
}

void solve() {
  int n, m;
  std::cin >> n >> m;
  std::vector<PII> v(m);
  int a, b;
  REP(i, m) {
    std::cin >> a >> b;
    a--; b--;
    v.at(i).first = b;
    v.at(i).second = a;
  }
  ASORT(v);

  int last = 0;
  int total = 0;
  REP(i, m) {
    // cout(i << " (" << v.at(i).second << ", " << v.at(i).first << ")");
    if (last <= v.at(i).second) {
      // cout(yes);
      last = v.at(i).first;
      total++;
    }
  }
  cout(total);
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define fi first
#define se second
long long mo = 1e9 + 7;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
template<class A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}cout << "\n";}
ld PI=3.14159265358979323846;

int main(){
    ll N,M;
    cin >> N >> M;
    vector<string> A(N), B(M);
    rep(i,N){
        cin >> A[i];
    }
    rep(i,M){
        cin >> B[i];
    }
    rep(i,N-M+1){
        rep(j,N-M+1){
            bool flag = 0;
            rep(h,M){
                rep(w,M){
                    if(B[h][w] == A[h+i][w+j]){
                        continue;
                    }else{
                        flag = 1;
                        goto gt;
                    }
                }
            }
            gt:
            if(!flag){
                cout << "Yes" << endl;
                return 0;
            }
        }
    }
    cout << "No" << endl;
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)
#define VL vector<ll>
#define VS vector<string>
#define VB vector<bool>
#define VP vector<pair<ll,ll>>
#define VVL vector<vector<ll>>
#define VVP vector<vector<pair<ll,ll>>>
#define PL pair<ll,ll>
#define ALL(v) (v).begin(), (v).end()
ll d1[4] = {1, -1, 0, 0};
ll d2[4] = {0, 0, 1, -1};

int main(){
    ll H, N;
    cin >> H >> N;
    VL A(N), B(N);
    rep(i, 0, N) cin >> A[i] >> B[i];

    VVL dp(N+1, VL(H+1, 1e18));
    rep(i, 0, N+1) dp[i][0] = 0;
    rep(i, 0, N){
        rep(j, 0, H+1){
            dp[i+1][j] = min(dp[i+1][j], dp[i][j]);
            if(j + A[i] <= H){
                dp[i+1][j+A[i]] = min(dp[i+1][j+A[i]], dp[i+1][j] + B[i]); 
            }else{
                dp[i+1][H] = min(dp[i+1][H], dp[i+1][j] + B[i]);
            }
        }
    }
    cout << dp[N][H] << endl;
    return 0;
}

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

int main() {
  long n,k,d,a,ans=0;
  set<long> aaa;
  cin >> n >> k;
  for(long i=0;i<k;i++) {
    cin >> d;
    for(long j=0;j<d;j++) {
      cin >> a;
      aaa.insert(a);
    }
  }
  for(long i=1;i<=n;i++) if(!(aaa.count(i))) ans++;
  cout << ans << endl;
}

Measured memory_bytes: 3636
#![allow(dead_code)]
use std::io;

fn main() {
    solve_c();
}

fn solve_c() {
    let mut d1 = String::new();
    io::stdin().read_line(&mut d1).unwrap();
    let mut d1: Vec<_> = d1.trim()
        .split_whitespace()
        .map(|s| s.parse::<u16>().unwrap())
        .collect();

    let mut d2 = String::new();
    io::stdin().read_line(&mut d2).unwrap();
    let d2: Vec<_> = d2.trim()
        .split_whitespace()
        .map(|s| s.parse::<u16>().unwrap())
        .collect();

    let mut ans = "No";
    for d in "HHHH N HHHH N HHHH N W HHHH W HHHH W HHHH W HHHH"
        .replace(" ", "")
        .chars()
    {
        let mut newnum = vec![0_u16; 6];
        if d == 'N' {
            // t 0 => N 4
            newnum[4] = d1[0];
            // s 1 => T 0
            newnum[0] = d1[1];
            // e 2 => e 2
            newnum[2] = d1[2];
            // w 3 => w 3
            newnum[3] = d1[3];
            // n 4 => b 5
            newnum[5] = d1[4];
            // b 5 => s 1
            newnum[1] = d1[5];
        } else if d == 'S' {
            // t 0 => s 1;
            newnum[1] = d1[0];
            // s 1 => b 5;
            newnum[5] = d1[1];
            // n 4 => t 0;
            newnum[0] = d1[4];
            // b 5 => n 4;
            newnum[4] = d1[5];

            newnum[2] = d1[2];
            newnum[3] = d1[3];
        } else if d == 'E' {
            // t 0 => e 2;
            newnum[2] = d1[0];
            // w 3 => t 0;
            newnum[0] = d1[3];
            // b 5 => w 3;
            newnum[3] = d1[5];
            // e 2 => b 5;
            newnum[5] = d1[2];

            newnum[1] = d1[1];
            newnum[4] = d1[4];
        } else if d == 'W' {
            // t 0 => w 3;
            newnum[3] = d1[0];
            // e 2 => t 0;
            newnum[0] = d1[2];
            // b 5 => e 2;
            newnum[2] = d1[5];
            // w 3 => b 5;
            newnum[5] = d1[3];

            newnum[1] = d1[1];
            newnum[4] = d1[4];
        } else {
            // t 0 => t 0;
            newnum[0] = d1[0];
            // b 5 => b 5;
            newnum[5] = d1[5];
            // s 1 => w 3;
            newnum[3] = d1[1];
            // w 3 => n 4;
            newnum[4] = d1[3];
            // n 4 => e 2;
            newnum[2] = d1[4];
            // e 2 => s 1;
            newnum[1] = d1[2];
        }
        d1 = newnum;

        if d1 == d2 {
            ans = "Yes";
            break;
        }
    }
    println!("{}", ans);
}



Measured memory_bytes: 5040
#include<iostream>
#include<cmath>
using namespace std;
int main(){
    int h,n;cin >> h >> n;
    int a;
    int s = 0;
    for(int i = 0; i < n; i++){
        cin >> a;
        s += a;
    }
    cout << ( s >= h ? "Yes" : "No") << "\n";
}

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

using namespace std;
using ll=long long;
using ull=unsigned long long;
using pii=pair<int,int>;

#define INF LONG_MAX
#define MOD 1000000007
#define rng(a) a.begin(),a.end()
#define rrng(a) a.end(),a.begin()
#define rep(i,N) for(int i=0;i<N;i++)

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

  string s;
  cin>>s;
  for(int i=1;i<3;i++){
    if(s[i-1]=='A'&&s[i]=='B'){
      cout<<"Yes"<<endl;
      return 0;
    }
    if(s[i-1]=='B'&&s[i]=='A'){
      cout<<"Yes"<<endl;
      return 0;
    }
  }
  cout<<"No"<<endl;
  return 0;
}


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 pai 3.14159265358979323846
const int INF = 1001001001;
typedef long long ll;
int A[3][3], N;
bool punched[3][3];
bool ok[3][3];
int a[3][3],n;
using Graph = vector<vector<int>>;
vector<vector<int>> field;
vector<bool> seen;

const int MOD = 1000000007;

vector<bool> issafe; // issafe[v] := v が壊れていないかどうか

int main() {
  int n;
  cin >> n;
  int p[n];
  rep (i,n) cin >> p[i];
  int cnt = 0;
  rep (i,n-2) {
    if ((p[i]>p[i+1]&&p[i+1]>p[i+2])||(p[i]<p[i+1]&&p[i+1]<p[i+2])) cnt++;
  }
  cout << cnt << endl;

}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
int main(void){

    long int num;
    scanf("%ld", &num);
    
    //long int cnt = 0;
    long long int ans = 0;
    for(long int i = 1; i <= num; i++){
        for(long int j = i; j <= num; j += i){
            //printf("%ld\n",j);
            ans += j;
        }
    }
    
    printf("%lld\n", ans);

    return 0;
}


Measured memory_bytes: 1720
import Data.Fixed
import Data.Char (digitToInt)
import System.IO
import System.IO.Error


data E100 = E100
instance HasResolution E100 where
      resolution _ =
                10^100
type Tc = Fixed E100

main :: IO ()
main = catchIOError loop (\e -> if isEOFError e
                           then return ()
                           else ioError e)

loop :: IO ()
loop = do
  st <- getLine
  let [a,b,n] = map read (words st)
      s'' = a/b
      s'  = dropWhile (/= '.') (show s'')
      s   = take (tcToInt n) $ map digitToInt (tail s')
  print $ sum s
  loop

tcToInt :: Tc -> Int
tcToInt n = (read ::String -> Int ) $ takeWhile (/='.') (show n)

Measured memory_bytes: 4684
def gcd(a,b):
  while b:
    a,b = b,a%b
  return a

def prime_factorize(n):
  b = 2
  p_fct = []
  while b*b <= n:
    count=0
    while n % b == 0:
      n //= b
      count += 1
      if count == 1:
        p_fct.append(b)
    b += 1
  if n > 1:
    p_fct.append(n)  
  return p_fct


A,B=map(int,input().split())

g=gcd(A,B)

if g == 1:
  print("1")
else:
  print(len(prime_factorize(g))+1)

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

using namespace std;

int mod = (int)1e9 + 7;

void add_self(int& a, int b) {
    a += b;
    if (mod <= a)
        a -= mod;
}

int main() {
    char c;
    int H, W;

    scanf("%d %d\n", &H, &W);
    vector<vector<int>> dp(H, vector<int>(W));

    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            scanf("%c\n", &c);
            if (!i && !j) {
                dp[i][j] = 1;
                continue;
            }
            if (c == '.') {
                if (i)
                    add_self(dp[i][j], dp[i - 1][j]);
                if (j)
                    add_self(dp[i][j], dp[i][j - 1]);
            }
        }
    }

    printf("%d\n", dp[H - 1][W - 1]);

    return 0;
}

Measured memory_bytes: 4224
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define rep(i, a, b) for(int i = (a); i < (b); ++i)
#define per(i, a, b) for(int i = (b) - 1; i >= (a); --i)
#define sz(a) (int)a.size()
#define de(x) cout << #x << " = " << x << endl
#define dd(x) cout << #x << " = " << x << " "
#define endl "\n"
#define all(a) a.begin(), a.end()
#define pw(a) (1ll << (a))
typedef long long ll;
typedef pair<int, int> pii;
typedef double db;
typedef vector<int> vi;

struct P {
	db x, y;
	P() {}
	P(db x, db y) : x(x), y(y) {}
	void read() {
		cin >> x >> y;
	}
	P operator + (const P &c) const {
		return P(x + c.x, y + c.y);
	}
	P operator - (const P &c) const {
		return P(x - c.x, y - c.y);
	}
	P operator * (const db &c) const {
		return P(x * c, y * c);
	}
	P operator / (const db &c) const {
		return P(x / c, y / c);
	}
	db len2() {
		return x * x + y * y;
	}
};
struct L {
	P a, b;
	L() {}
	L(P a, P b) : a(a), b(b) {}
	void read() {
		a.read();
		b.read();
	}
};
db det(P a, P b) {
	return a.x * b.y - a.y * b.x;
}
db dot(P a, P b) {
	return a.x * b.x + a.y * b.y;
}
P isLL(const L &l1, const L &l2) {
	db s1 =  det(l2.b - l2.a, l1.a - l2.a);
	db s2 = -det(l2.b - l2.a, l1.b - l2.a);
	return (l1.a * s2 + l1.b * s1) / (s1 + s2);
}
P proj(const L &l, const P &p) {
	return l.a + (l.b - l.a) * (dot(p - l.a, l.b - l.a) / (l.b - l.a).len2());
}

int main() {
	std::ios::sync_with_stdio(0);
	std::cin.tie(0);
	L l;
	l.read();
	int q;
	cin >> q;
	cout << setiosflags(ios::fixed);
	cout << setprecision(10);
	while(q--) {
		P p;
		p.read();
		P res = proj(l, p);
		cout << res.x << " " << res.y << endl;
	}
	return 0;
}


Measured memory_bytes: 3292
import java.util.*;
public class Main {
    public static void main(String[] args){
      // 入力
      Scanner sc = new Scanner(System.in);
      int N = sc.nextInt();
      int[] A = new int[N];
      for(int i = 0; i < N; i++){
        A[i] = sc.nextInt();
      }
      
      // カウント
      int count = 0;
      for(int i = 0; i < N; i++){
        int index = i+1;
        if(index % 2 == 1 && A[i] % 2 == 1){
          count++;
        }
      }
      
      // 出力
      System.out.println(count);
    }

}

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

public class Main {

     static Scanner scanner;

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

         int N=gi();
         long[] a=new long[N];
         long[] b=new long[N];

         for (int i=0; i<N;i++) {
        	 a[i]=gi();
         }
         Arrays.parallelSort(a);
         b[0]=a[0];
         for (int i=1; i<N;i++) {
        	 b[i]=b[i-1]+a[i];
         }

         int ans=1;
         for (int i=N-1; i>0;i--) {
        	 if (a[i]>b[i-1]*2) {
        		 break;
        	 } else {
        		 ans++;
        	 }
         }

         System.out.println(ans);
     }

     // 文字列として入力を取得
     public static String gs() {
          return scanner.next();
     }

     // intとして入力を取得
     public static int gi() {
          return Integer.parseInt(scanner.next());
     }

     // longとして入力を取得
     public static long gl() {
          return Long.parseLong(scanner.next());
     }

     // doubleとして入力を取得
     public static double gd() {
          return Double.parseDouble(scanner.next());
     }
}

Measured memory_bytes: 61404
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define ll long long
#define _GLIBCXX_DEBUG
const ll MOD = 1000000007;
const int MAX = 510000;

int main() {
  int N;
  cin >> N;
  bool exist = false;
  for (int i=0; i<=N; i++) {
    if (floor(1.08*i)==N) {
      exist = true;
      cout << i << endl;
      break;
    }
  }
  if (!exist) cout << ":(" << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
using namespace std;
int n;
main()
{
	cin>>n;
	for(;n--;)
	{
		int a;cin>>a;
		int cnt=0;
		while(a>=10)
		{
			int nexta=0;
			for(int i=10;i<=a;i*=10)
			{
				int now=a%i*(a/i);
				nexta=max(nexta,now);
			}
			a=nexta;
			cnt++;
		}
		cout<<cnt<<endl;
	}
}


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

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

int n, p;
vector<int> stones_candidates;
int stones_cup;
int current_player;

int game_set()
{
    if (stones_cup > 0) return false;
    bool cond = true;
    for (int i = 0; i < n; i++) {
        if (i != current_player && stones_candidates[i] != 0) {
            cond = false;
        }
    }
    return cond;
}

inline int next_player()
{
    return current_player == n - 1
        ? 0
        : current_player + 1;
}

int main()
{
    while (cin >> n >> p, n && p) {
        stones_candidates = vector<int>(n);
        stones_cup = p;

        current_player = 0;
        while (true) {
            if (stones_cup > 0) {
                stones_cup--;
                stones_candidates[current_player]++;
            } else if (stones_cup == 0) {
                stones_cup += stones_candidates[current_player];
                stones_candidates[current_player] = 0;
            } else {
                throw "Something wrong!";
            }
            
            if (game_set()) {
                break;
            }

            current_player = next_player();
        }

        cout << current_player << endl;
    }
}
    

Measured memory_bytes: 1196
#include <iostream>
#include <algorithm>
#include <string>
#include <queue>
#include <vector>
#include <set>

using namespace std;

int n, l[101], sol;

int main(){
	cin >> n;
	for(int i = 0; i < n; ++i){
		cin >> l[i];
	}
	for(int i = 0; i < n; ++i){
		for(int j = i+1; j < n; ++j){
			for(int k = j+1; k < n; ++k){
				if(l[i] != l[j] and l[i] != l[k] and l[j] != l[k]){
					if(l[i] + l[j] > l[k] and l[k] + l[j] > l[i] and l[k] + l[i] > l[j]){
						sol++;
					}
				}
			}
		}
	}
	cout << sol;

	return 0;
}



Measured memory_bytes: 3628
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <climits>
using namespace std;
#define ll long long

int d = 365;
//int k = 0;
vector<vector<int>> s(d, vector<int>(26, 0));
vector<ll> c(26);

void init() {
    cin >> d;
    for(int i = 0; i < 26; i++) cin >> c[i];
    for(int i = 0; i < d; i++) {
        for(int j = 0; j < 26; j++) {
            cin >> s[i][j];
        }
    }
    return;
}

ll calc(vector<int> out) {
    ll score = 0;
    vector<ll> last(26, 0);
    for(int i = 0; i < out.size(); i++) {
        last[out[i]] = i+1; // タイプ番号
        for(int j = 0; j < 26; j++) {
            score -= c[j]*((i+1)-last[j]);
        }
        score += s[i][out[i]];
        //cout << "score : " << score << endl;
    }

    //int p = min(int(out.size()+k), int(d));
    //cout << p << endl;
    //if(out.size() >= d) return score;
    //cout << k << endl;
    //cout << out.size() << " " << d << endl;
    //int p = min(int(out.size()+k), d);
    //int k = 13;
    //int p = min(int(out.size()+k), d);
    ll q = LLONG_MIN;
    for(int k = 0; k < 26; k++) {
        int p = out.size()+k;
        ll tmp = 0;
        for(int i = out.size(); i < p; i++) {
            for(int j = 0; j < 26; j++) {
                //score -= c[j]*((i)-last[j]);
                tmp -= c[j]*((i)-last[j]);
            }
        }
        if(tmp < q) {
            q = tmp;
        }
    }
    return score-q;
}

/*
vector<int> proc(int k) {
    vector<int> out;
    ll ans = 0;
    //ll tmp = 0;
    ll max_v = -1;
    //for(int k = 0; k < 26; k++) {
    //cout << "k: " << k << endl;
    //vector<int> out;
    for(int i = 0; i < d; i++) {
        //max_v = -100000000000;
        max_v = LLONG_MIN;
        int best = 0;
        for(int j = 0; j < 26; j++) {
            out.push_back(j);
            ll tmp = calc(out);
            if(max_v < tmp) {
                max_v = tmp;
                best = j;
            }
            out.pop_back();
        }
        out.push_back(best);
    }
    //}
    return out;
}
*/

int main() {
    init();
    
    vector<int> out;
    ll ans = 0;
    ll max_v = -1;
    //for(int k = 0; k < 26; k++) {
        //cout << "k: " << k << endl;
        //vector<int> out;
    for(int i = 0; i < d; i++) {
        //max_v = -100000000000;
        max_v = LLONG_MIN;
        int best = 0;
        for(int j = 0; j < 26; j++) {
            out.push_back(j);
            //for(int k = 0; k < 26; k++) {
            ll tmp = calc(out);
            if(max_v < tmp) {
                max_v = tmp;
                best = j;
            }
            //}
            out.pop_back();
        }
        out.push_back(best);
    }
    //}
    
    for(int i = 0; i < d; i++) {
        cout << out[i]+1 << endl;
    }
    //cout << max_v << endl;
    return 0;
}

Measured memory_bytes: 3664
#include<cstdio>
#include<algorithm>
using namespace std;
const int N=205,mo=998244353;
int n,x,i,dn,pw[N],ans;
struct arr{int x,y;}a[N],d[N];
int cross(arr A,arr B){return A.x*B.y-B.x*A.y;}
bool operator < (arr A,arr B){return cross(A,B)>0;}
int main(){
	for (scanf("%d",&n),i=1;i<=n;i++)
		scanf("%d%d",&a[i].x,&a[i].y);
	for (pw[0]=1,i=1;i<=n;i++) pw[i]=pw[i-1]*2%mo;
	ans=pw[n]-1-n;
	for (int x=1;x<=n;x++){
		for (dn=0,i=x+1;i<=n;i++) if (i!=x){
			d[++dn]=(arr){a[i].x-a[x].x,a[i].y-a[x].y};
			if (d[dn].x<0) d[dn].x=-d[dn].x,d[dn].y=-d[dn].y;
			if (d[dn].x==0&&d[dn].y>0) d[dn].y=-d[dn].y;
		}
		sort(d+1,d+dn+1);int k=0;
		for (i=1;i<=dn;i++){
			if (!cross(d[i-1],d[i])) k++;
			else ans=(ans-pw[k]+1)%mo,k=1;
		}
		ans=(ans-pw[k]+1)%mo;
	}
	printf("%d",(ans+mo)%mo);
}

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

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

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


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


#define MOD 1000000007
#define INF 1001001001
#define MIN -1001001001
#define rep(i,k,N) for(int i=k;i<N;i++)
#define MP make_pair
#define MT make_tuple //tie,make_tuple は別物
#define PB push_back
#define PF push_front
#define all(x) (x).begin(),(x).end()


using namespace std;
typedef long long ll;
typedef vector<ll> v;
typedef vector<vector<ll>> vv;

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

int main(){
    ll A,B,C;
    cin>>A>>B>>C;

    cout<<double(A*B)/2;
    return 0;
}

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

using namespace std;

const int M = 2e2;
int n, a[M], ans;

int main () {
  cin >> n;
  for (int i = 1; i < n; i++) cin >> a[i];
  ans += a[1] + a[n-1];
  for (int i = 2; i < n; i++) ans += min (a[i], a[i-1]);
  cout << ans << endl;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
// Custom Header {{{
#define ALL(x)      x.begin(), x.end()
#define rep(i,n)    for (int i = 0; i < (n); ++i)
using namespace std;
using i64 = long long;
using pii = pair<i64, i64>;
template<class A, class B>inline bool chmax(A &a, const B &b){return b>a ? a=b,1 : 0;}
template<class A, class B>inline bool chmin(A &a, const B &b){return b<a ? a=b,1 : 0;}
constexpr int INF  = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;
// }}}

signed main()
{
    // ios::sync_with_stdio(false); cin.tie(nullptr);
    i64 a, b;
    cin >> a >> b;

    if ((a+b) % 2 == 1) {
        cout << "IMPOSSIBLE" << endl;
    } else {
        cout << (a+b) / 2 << endl;
    }

    return 0;
}



Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <algorithm>
using std::__gcd;
using std::sort;
int main(){
	char s[100];
	scanf("%s",s);
	int l = strlen(s);
	for(int i=l-1;i>=0;--i)
		putchar(s[i]);
	putchar('\n');
	return 0;	
}

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

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

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

template <class T>
inline istream& operator>> (istream &is, vector<T> &vec) {
    for (auto &e : vec) is >> e;
    return is;
}

inline void read() {}

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

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

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

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

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

    VAR(i64, N, T);
    i64 sum = 0;
    vector<pii> p(N);
    rep(i, 0, N) {
        VAR(i64, t);
        p[i] = pii(t, t + T);
    }

    sum += T;
    rep(i, 1, N) {
        const i64 last = p[i - 1].second;
        dump(last);
        sum += p[i].second - max(last, p[i].first);
    }

    print(sum);

    return 0;
}


Measured memory_bytes: 3328
#include <cassert>
#include <cstdio>
#include <cmath>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>

const int MOD = 1000000007, INF = 1111111111;
using namespace std;
using lint = long long;

template <typename T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
	for (int i = 0; i < vec.size(); i++) {
		os << vec[i] << (i + 1 == vec.size() ? "" : " ");
	}
	return os;
}

#ifdef _DEBUG
template <class Head>
void dump(const char* str, Head &&h) { cerr << str << " = " << h << "\n"; };
template <class Head, class... Tail>
void dump(const char* str, Head &&h, Tail &&... t) {
	while (*str != ',') cerr << *str++; cerr << " = " << h << "\n";
	dump(str + 1, t...);
}
#define DMP(...) dump(#__VA_ARGS__, __VA_ARGS__)
#else 
#define DMP(...) ((void)0)
#endif

int main() {

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

	int N;
	cin >> N;

	cout << N * N*N << "\n";

	return 0;
}

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

using namespace std;

int n, k, res, rs;
vector<int> adj[2222];

void dfs(int v, int fa, int dist) {
	rs++;
	if (dist == 0) {
		return ;
	}
	for (auto u : adj[v]) {
		if (u == fa) {
			continue ;
		}
		dfs(u, v, dist-1);
	}
}

int main() {
	scanf("%d %d", &n, &k);
	for (int i = 1; i < n; i++) {
		int q, w;
		scanf("%d %d", &q, &w);
		adj[q].push_back(w);
		adj[w].push_back(q);
	}
	if (k&1) {
		for (int i = 1; i <= n; i++) {
			for (auto u : adj[i]) {
				rs = 0;
				dfs(u, i, k/2);
				dfs(i, u, k/2);
				res = max(res, rs);
			}
		}
	} else {
		for (int i = 1; i <= n; i++) {
			rs = 0;
			dfs(i, 0, k/2);
			res = max(res, rs);
		}
	}
	printf("%d\n", n-res);
	
	return 0;
} 


Measured memory_bytes: 384
#include <stdio.h>
#include <stdlib.h>



int main(){
  int *S;
  int n;
  int q;
  int *T;
  int i,j;
  int jg=0;
  int left;
  int right;
  int mid;

  scanf("%d",&n);
  S=(int *)malloc(n*sizeof(int));

  for(i=0;i<n;i++)scanf("%d",&S[i]);
  scanf("%d",&q);
  T=(int *)malloc(q*sizeof(int));

  for(i=0;i<q;i++)scanf("%d",&T[i]);
  
  for(i=0;i<q;i++){
    left=0;
    right=n;
    while(left<right){
      mid=(left+right)/2;
      if(S[mid]==T[i]){
	jg++;
	break;
      }
      else if(T[i]<S[mid])right=mid;
      else left=mid+1;
    }
  }
  printf("%d\n",jg);
  return 0;
}
    
  
      

     
    
      



Measured memory_bytes: 2444
n = input()
a = set(n)
b = ''
d = ''

if len(a) == 1:
    print(n)
else:
    for i in range(len(n)):
        b += n[0]
    if int(n) < int(b):
        print(b)
    else:
        for j in range(len(n)):
            c = int(n[0])+1
            d += str(c)
        print(d)

Measured memory_bytes: 3060
#include <stdio.h>



int main()
{
	
	int A = 2;
	int i, N;
	
	scanf("%d", &N);
	
	if(N % 2 == 0){
		printf("%d", N);
	}
	else {
		printf("%d", N * 2);
	}

	return 0;
}

Measured memory_bytes: 128
import java.util.Arrays;
import java.util.Comparator;
import java.util.PriorityQueue;
import java.util.Scanner;

import javax.print.StreamPrintService;

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

	void run() {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int M = sc.nextInt();
		long[][] X = new long[N][2];
		for (int i = 0; i < N; ++i) {
			X[i][0] = sc.nextInt();
			X[i][1] = sc.nextInt();
		}
		long ans = 0;
		Arrays.sort(X, new Comparator<long[]>() {
			@Override
			public int compare(long[] o1, long[] o2) {
				if (o1[0] != o2[0]) {
					return Long.compare(o1[0], o2[0]);
				} else {
					return -Long.compare(o1[1], o2[1]);
				}
			}
		});
		PriorityQueue<Long> pq = new PriorityQueue<>();
		int p = 0;
		for (int i = 1; i <= M; ++i) {
			while (p < X.length && X[p][0] <= i) {
				pq.add(-X[p][1]);
				++p;
			}
			if (!pq.isEmpty()) {
				ans += -pq.poll();
			}
		}
		System.out.println(ans);
	}

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


Measured memory_bytes: 92644