akhauriyash/Code-Regression huggingface dataset:
//84104971101048411497 - Can you guess what does this mean?
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef complex<double> point;
#define mapii map<int, int>
#define debug(a) cout << #a << ": " << a << endl
#define debuga1(a, l, r) fto(i, l, r) cout << a[i] << " "; cout << endl
#define fdto(i, r, l) for(int i = (r); i >= (l); --i)
#define fto(i, l, r) for(int i = (l); i <= (r); ++i)
#define forit(it, var) for(__typeof(var.begin()) it = var.begin(); it != var.end(); it++)
#define forrit(rit, var) for(__typeof(var.rbegin()) rit = var.rbegin(); rit != var.rend(); rit++)
#define ii pair<int, int>
#define iii pair<int, ii>
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define maxN 100005
#define MOD 1000000007
#define sz(a) (int)a.size()

const double PI = acos(-1.0);

double fRand(double fMin, double fMax)
{
    double f = (double)rand() / RAND_MAX;
    return fMin + f * (fMax - fMin);
}

template <class T>
T min(T a, T b, T c) {
    return min(a, min(b, c));
}

template <class T>
T max(T a, T b, T c) {
    return max(a, max(b, c));
}

int n, a[maxN], pos[maxN], x, y;
ll fact[maxN], invFact[maxN];

ll power(ll x, int n) {
    if (n == 0) return 1;
    if (n&1) return (x*power(x, n-1))%MOD;
    ll p = power(x, n/2);
    return (p*p)%MOD;
}

ll C(int n, int k) {
    if (k > n) return 0;
    return ((invFact[k]*invFact[n-k])%MOD * fact[n])%MOD;
}

int main () {
    scanf("%d", &n);
    fto(i, 1, n+1) scanf("%d", &a[i]);

    fto(i, 1, n+1) {
        if (pos[a[i]] != 0) {
            x = pos[a[i]]; y = i;
            break;
        } else pos[a[i]] = i;
    }

//    printf("%d %d\n", x, y);

    fact[0] = invFact[0] = 1;
    fto(i, 1, n+1) {
        fact[i] = (fact[i-1]*i)%MOD;
        invFact[i] = power(fact[i], MOD-2);
    }

    fto(k, 1, n+1) {
        ll ans = (C(n+1, k)-C(n-(y-x), k-1)+MOD)%MOD;
        printf("%lld\n", ans);
    }


    return 0;
}


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

int main() {

  int H, W;
  cin >> H >> W;

  int count = 0;
  for (int i = 0; i < H; i++){
    string A;
    cin >> A;
    for (int j = 0; j < W; j++) {
      if (A[j] == '#') {
        count++;
      }
    }
  }

  if (count == H + W - 1) {
    cout << "Possible" << endl;
  } else {
    cout << "Impossible" << endl;
  }

  return 0;

}

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

using namespace std;

int main(void) {
    int n; cin >> n;
    bool alleven = true;
    for(int i = 0; i < n; i++) {
        int a; cin >> a;
        alleven &= a % 2 == 0;
    }

    cout << (alleven ? "second" : "first") << endl;

    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
char str[33];
int lmax=0;
char mword[33];
typedef struct{
	char word[33];
	int time;
}data;
data d[1000];
int cd=0;
int i;
int main(){
	while(scanf("%s",str)!=EOF){
		if(strlen(str)>lmax){
			lmax=strlen(str);
			strcpy(mword,str);
		}
		for(i=0;i<cd;i++)if(strcmp(d[i].word,str)==0){
			d[i].time++;
			break;
		}
		if(i==cd){
			strcpy(d[cd].word,str);
			d[cd++].time=1;
		}
	}
	int fm=0;
	for(i=0;i<cd;i++)if(d[i].time>d[fm].time)fm=i;
	printf("%s %s\n",d[fm].word,mword);
}
		

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

using namespace std;
//vector<long long> factors;
#define ll long long

#define pii pair<int,int>
#define pll pair<ll,ll>
#define _ <<'\n'
#define __ << ' '
#define all(x) (x).begin(), (x).end()
#define gcd __gcd
int IT_MAX = 1 << 17;
int MOD = 1000'000'007;
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x0f3f3f3f3f3f3f3f;
const double PI = acos(-1);
const double ERR = 1e-10;
#define szz(x) (int)(x).size()
#define IOS ios_base::sync_with_stdio(false); cout.tie(0);cin.tie(0);
#define flush fflush(stdout)

ll mod(ll a, ll m) { return (a + (abs(a) / m) * m + m) % m; }

//****************************don't use int!!!!!!!****************************//
//***************************code starts here!!!!!****************************//


int main() {
	IOS

	ll n;
	cin >> n;
	vector<ll> p(n);
	for(int i = 0; i < n; ++i){
		cin >> p[i];
	}

	for(int i = 0;i < n; ++i){
		for(int j = 0; j < n; ++j){
			swap(p[i],p[j]);
			if(is_sorted(all(p))){
				cout << "YES\n";
				return 0;
			}
			swap(p[i],p[j]);
		}
	}
	cout << "NO\n";
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>

using namespace std;

int main(void){
  int N,X;
  int i;
  int val = 0, count = 1;

  scanf("%d %d", &N, &X);

  int L[N] = {0};
  
  for(int i=0; i<N; i++) scanf("%d", &L[i]);

  for (i=0; i<N; i++) {
    if (val > X) {
      break;
    }
    val = val + L[i];
    if (val <= X) count++;
  }

  printf("%d", count);

  return 0;
}

Measured memory_bytes: 128
from collections import defaultdict
d = defaultdict(list)
N,M = list(map(int,input().split()))
for i in range(M):
  p,S = input().split()
  p = int(p)
  d[p].append(S)
AC = 0
penalty = 0
for key,value in d.items():
  if "AC" in value:
    AC+=1
    penalty += value.index("AC")
print(AC,penalty)

Measured memory_bytes: 29828
#include<iostream>
#include<cstdlib>
#include<cstring>
#include<cstdio>
#include<string>
#include<algorithm>
#include<stack>
#include<queue>
#include<bits/stdc++.h>
#define ll long long
#define inf 0x3f3f3f3f
using namespace std;

int main ()
{
   int a, b;
   cin >>a>>b;
   if(a<b){
    a =a^b;
    b =b^a;
    a =a^b;
   }
   for(int i=0;i<a;i++){
    cout<<b;
   }
   cout<<endl;
    return 0;

}


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

using i64 = int64_t;

string s;
vector<pair<char, char>> v;

int check(int idx){
    for(auto e: v){
        if(s[idx] == e.first){
            if(e.second == 'R')idx++;
            else idx--;
        }
        if(idx < 0)return -1;
        else if(idx >= s.size())return 1;
    }
    return 0;
}

int bsearch(bool left){
    int ok = (left ? -1 : s.size()), ng = (left ? s.size() : -1);
    while(abs(ok-ng) > 1){
        int mid = (ok+ng) / 2;
        if(left){
            if(check(mid) == -1)ok = mid;
            else ng = mid;
        }else{
            if(check(mid) == 1)ok = mid;
            else ng = mid;
        }
    }
    return ok;
}

int main(){
    int n, q;
    cin >> n >> q;
    cin >> s;
    for(int i=0;i<q;++i){
        char t, d;
        cin >> t >> d;
        v.emplace_back(t, d);
    }
    int left = bsearch(true), right = bsearch(false);

    cout << n - (left+1) - (n-right) << endl;

    return 0;
}


Measured memory_bytes: 1024
#include<iostream>
using namespace std;
int main()
{
    string A;
    cin >> A;
    int c = 0;
    for(int i = 0; i < A.size(); i++){
        if(A[i] == '0'){
            c += 0;
        }
        else if(A[i] == '1'){
            c += 1;
        }
        else if(A[i] == '2'){
            c += 2;
        }
        else if(A[i] == '3'){
            c += 3;
        }
        else if(A[i] == '4'){
            c += 4;
        }
        else if(A[i] == '5'){
            c += 5;
        }
        else if(A[i] == '6'){
            c += 6;
        }
        else if(A[i] == '7'){
            c += 7;
        }
        else if(A[i] == '8'){
            c += 8;
        }
        else if(A[i] == '9'){
            c += 9;
        }
    }
    int a;
    a = c % 9;
    if(a == 0){
        cout << "Yes";
    }
    else{
        cout << "No";
    }
}

Measured memory_bytes: 3728
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#include <limits.h>
#include <stdbool.h>

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

//qsort(str, n, sizeof(int), up_comp);
int up_comp(const void *a, const void *b){return *(int*)a - *(int*)b;}
int down_comp(const void *a, const void *b){return *(int*)b - *(int*)a;}
int int_sort( const void * a , const void * b ) {return strcmp(( char * )a , ( char * )b );}
int count_digit(int a){int i=0;while(a!=0){a=a/10;i++;}return i;}
int euclid( int a, int b ){int temp;if(a<b){temp=a;a=b;b=temp;}if(b<1)return -1;if(a%b==0) return b;return euclid(b,a%b);}

int main(void){
 
    int n, y;
    
    scanf("%d", &n);
    
    printf("%d", n+n*n+n*n*n);
    
    return 0;
}



Measured memory_bytes: 1728
import java.util.Scanner;

class Main {
    public static void main(String [] args){
    	
        Scanner scan = new Scanner(System.in);
        
        int n        = scan.nextInt();
        int [] a     = new int[100];
        
        for(int i = 0; i < n; ++i){
        	
            a[i] = scan.nextInt();
        }
        
        for(int i = n - 1; i >= 0; --i){
        	
            System.out.print(a[i]);
            
            if(i > 0){
                System.out.print(' ');
            }
        }
        
        System.out.println();
    }
}

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

using namespace std;

typedef long long ll ;
typedef double db;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef vector< pair<int,int> > vii;
const double pi = 2*acos(0) ;

#define pf		  	 printf
#define sf			 scanf
#define pb(a)        push_back(a)
#define mp			 make_pair
#define ff			 first
#define ss			 second
#define for0(i,n)    for(int i=0;i<n;i++)
#define for1(i,n)    for(int i=1;i<=n;i++)
#define forab(i,a,b) for(int i=a;i<=b;i++)
#define lcm(a, b)    ((a)*((b)/gcd(a,b)))
#define sq(a)		 (a)*(a)
#define endl		     "\n"
#define abs(x)		 fabs(x)
#define all(v) 		 v.begin(),v.end()
#define pcase(z,x)   cout<<"Case "<<z<<": "<<x<<"\n"
#define mod          1000000007
#define N   1000007
#define WakandaForever     ios_base::sync_with_stdio(0); cin.tie(0);
bool p[1000007];
void sieve(){
	for(ll j=1 ; j<=N ; j++) p[j] = 1;
	for(ll x=2 ; x*x<=N ; x++){
		for(ll i=x*x ; i<=N ; i+=x){
			p[i] = 0;
			}
		}
	}
ll nod(ll n){
	ll c,total=1;
	c=0;
	while(n%2==0){
		c++;
		n/=2;
		}
	total *= (c+1);
	for(ll i=3 ; i*i<=n ; i+=2){
		if(p[i] && n%i==0){
			c=0;
			while(n%i==0){
				c++;
				n/=i;
				}
			total *= (c+1);
			}
		}
	if(n>2) total *= 2;
	return total; 
	}
int main()
{
    WakandaForever
    sieve();
    ll n,cnt=0;
    cin>>n;
    ll c=1;
    while(n-c>0){
        ll k = n-c;
        ll x = nod(k);
        cnt += x;
        c++;
    }
    cout<<cnt<<endl;
    return 0;
}

Measured memory_bytes: 4600
import java.util.*;
import java.io.*;
import static java.lang.Math.*;

public class Main {
    public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		
		// 入力
		String s = sc.next();
		
		// 計算
		int result = 0;
		int indexA = 0;
		int indexZ = 0;
		boolean flg = true;
		for(int i = 0; i < s.length(); i++){
		    if(flg && s.charAt(i) == 'A'){
		        indexA = i;
		        flg = false;
		    }
		    if(!flg && s.charAt(i) == 'Z') indexZ = i;
		}
		result = indexZ - indexA + 1;
		
		// 出力
		System.out.println(result);
	}
	
	public static class Scanner {
		private BufferedReader br; private StringTokenizer tok;
		public Scanner(InputStream is) throws IOException { br = new BufferedReader(new InputStreamReader(is));}
		private void getLine() throws IOException { while(!hasNext()) tok = new StringTokenizer(br.readLine());}
		private boolean hasNext() { return tok != null && tok.hasMoreTokens();}
		public String next() throws IOException { getLine(); return tok.nextToken();}
		public int nextInt() throws IOException { return Integer.parseInt(next());}
		public long nextLong() throws IOException { return Long.parseLong(next());}
		public double nextDouble() throws IOException { return Double.parseDouble(next());}
	}
}


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

#define ll long long int
#define endl '\n'
#define inf 1e18

void testCase()
{
    
    //ll t; cin>>t; while(t--)
    {
       ll n;
       cin>>n;
       ll ar[n];
       for(int i=0;i<n;i++)
       cin>>ar[i];

       ll ans=0;
       ll res=0;
       for(int i=0;i<n;i++)
       {
           ans=max(ans,ar[i]);
           res+=(ans-ar[i]);
       }
       cout<<res;
    }       
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    testCase();
    return 0;
}

Measured memory_bytes: 5172
#include <bits/stdc++.h>
#define pb push_back
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,n,s) for(int i=(s);i<(n);i++)
#define rrep(i,n) for(int i=(n-1);i>=0;i--)
#define rreps(i,n,s) for(int i=s;i>=n;i--)
#define MOD 1000000007
using ll = long long;
using namespace std;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

int main(){
cin.tie(0);
ios::sync_with_stdio(false);
int n,k;
cin>>n>>k;
ll ans=0;
reps(b,n+1,1){
    ans+=(n/b)*max(0,b-k);
    ans+=max(0,n%b-k+1);
}
if(k==0){
    ans-=n;
}
cout<<ans<<endl;
//system("pause");
return 0;
}

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

using namespace std;

int main()
{
	int n, y;
	cin >> n >> y;
	y /= 1000;
	int m = y - n;
	int a = (m * 2 + 8) / 9;
	int b = m / 4;
	int c = min(b, y / 5);
	if (m<0 || a > c) cout << "-1 -1 -1" << endl;
	else cout << m - a * 4 << ' ' << a * 9 - m * 2 << ' ' << y - a * 5 << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(long long i=0; i<n; i++)
#define repr(i,n,m) for(long long i=m; i<n; i++)
#define mod 1000000007
#define sorti(x) sort(x.begin(), x.end())
#define sortd(x) sort(x.begin(), x.end(), std::greater<long long>())
#define debug(x) std::cerr << (x) << std::endl;
#define roll(x) for (auto&& itr : x) { cerr << (itr) << " "; }

template <class T> inline void chmax(T &ans, T t) { if (t > ans) ans = t;}
template <class T> inline void chmin(T &ans, T t) { if (t < ans) ans = t;}

template <class T>
T inf = numeric_limits<T>::max();

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

  int N;
  cin >> N;
  if (N % 1000 == 0) {
    cout << 0 << endl;
    return 0;
  }
  int c = N / 1000;
  cout << (c+1) * 1000 - N << endl;
}


Measured memory_bytes: 3648
#include<bits/stdc++.h>
#include<math.h>
using namespace std;
int main()
{
    long long int a=1,b,n,i,j,sum=0;

    cin>>n;
    long long int x[n+1];
    for( i=0;i<n;i++)
    {
        cin>>x[i];
    }
    for( i=0;i<n-1;i++)
    {
        for( j=i+1;j<n;j++)
        {
            sum+=(x[i]*x[j]);
            //cout<<sum;
        }

    }
  cout<<sum;
    return 0;
}


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

using namespace std;

typedef long long ll;
typedef pair<int,int> P;
typedef vector<int> VI;
typedef vector<VI> VVI;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = numeric_limits<int>::max() / 2;
const int MOD=1e9+7;

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

  int n,m;cin>>n>>m;
  std::vector<int> v[n];
  for(int i=0;i<m;i++){
      int a,b;cin>>a>>b;
      a--;b--;
      v[a].push_back(b);
      v[b].push_back(a);
  }
  bool visited[n];
  for(int i=0;i<n;i++) visited[i]=false;
  for(int i=0;i<n;i++)sort(v[i].begin(),v[i].end());
  visited[0]=true;
  int pre=0;
  std::vector<int> ans;
  ans.push_back(1);
  while(true){
      bool flag=true;
      for(int i=0;i<(int)v[pre].size();i++){
          int idx=v[pre][i];
          if(!visited[idx]){
              visited[idx]=true;
              ans.push_back(idx+1);
              flag=false;
              pre=idx;
          }
      }
      if(flag) break;
  }
  std::vector<int> ans2;
  pre=0;
  while(true){
      bool flag=true;
      for(int i=0;i<(int)v[pre].size();i++){
          int idx=v[pre][i];
          if(!visited[idx]){
              visited[idx]=true;
              ans2.push_back(idx+1);
              flag=false;
              pre=idx;
          }
      }
      if(flag) break;
  }
  cout<<ans.size()+ans2.size()<<endl;
  for(int i=(int)ans2.size()-1;0<=i;i--){
      cout<<ans2[i]<<" ";
  }
  for(int i=0;i<(int)ans.size();i++){
      if(i!=(int)ans.size()-1) cout<<ans[i]<<" ";
      else cout<<ans[i]<<endl;
  }
  return 0;
  //cout<<fixed<<setprecision(10)<<endl;
  //VVI v(n,vector<int>(n));
}


Measured memory_bytes: 6776
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <stack>
#include <math.h>
#include <map>
#include<cmath>
#include<queue>

typedef long long ll;
using namespace std;
#define mod 10007
#define rep(i,n) for(ll i=0;i<n;i++)
#define out(s) cout << s << endl

ll n,Q;
vector<vector<ll>> edge;
vector<ll>cost(n,0);
vector<bool>check(n);
void dfs(ll current){
    check[current]=true;
    for(ll next:edge[current]){
        if(check[next])continue;
        cost[next]+=cost[current];
        
        dfs(next);
    }
}


int main(){
    cin >> n >> Q;
    ll a,b,p,x;
    cost.resize(n);
    edge.resize(n);
    rep(i,n-1){
        cin >> a >> b;
        edge[a-1].push_back(b-1);
        edge[b-1].push_back(a-1);
    }
    rep(i,Q){
        cin >> p >> x;
        cost[p-1]+=x;
    }
    check.resize(n);
    dfs(0);
    rep(i,n){
        cout << cost[i] << " ";
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 24320
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<unordered_map>
#include<stdio.h>
using namespace std;

int main() {
	char s[100000];
	cin >> s;
	for (int i = 0; s[i] != '\0'; i++) {
		if (i % 2 == 0) {
			cout << s[i];
		}
	}
	cout << endl;
}

Measured memory_bytes: 384
using System;
class Program
{
    static void Main(string[] args)
    {
        string[] rc = Console.ReadLine().Split(' ');
        int r = int.Parse(rc[0]);
        int c = int.Parse(rc[1]);
        int[] rsum = new int[c + 1];
        for (int i = 0; i < r; i++)
        {
            string line = Console.ReadLine();
            string[] data = line.Split(' ');
            int csum = 0;
            for (int j = 0; j < c; j++)
            {
                rsum[j] += int.Parse(data[j]);
                csum += int.Parse(data[j]);
            }
            rsum[c] += csum;
            Console.WriteLine(line + " " + csum);
        }
        string sumline = rsum[0].ToString();
        for (int i = 1; i <= c; i++)
        {
            sumline = sumline + " " + rsum[i].ToString();
        }
        Console.WriteLine(sumline);
    }
}

Measured memory_bytes: 7640
/*
        _            _                  _            _       _     _         _   _          _          _             _        
       / /\         / /\               / /\         / /\    / /\  /\ \      /\_\/\_\ _     /\ \       /\ \     _    /\ \      
      / /  \       / /  \             / /  \       / / /   / / /  \ \ \    / / / / //\_\   \ \ \     /  \ \   /\_\ /  \ \     
     / / /\ \__   / / /\ \           / / /\ \__   / /_/   / / /   /\ \_\  /\ \/ \ \/ / /   /\ \_\   / /\ \ \_/ / // /\ \_\    
    / / /\ \___\ / / /\ \ \         / / /\ \___\ / /\ \__/ / /   / /\/_/ /  \____\__/ /   / /\/_/  / / /\ \___/ // / /\/_/    
    \ \ \ \/___// / /  \ \ \        \ \ \ \/___// /\ \___\/ /   / / /   / /\/________/   / / /    / / /  \/____// / / ______  
     \ \ \     / / /___/ /\ \        \ \ \     / / /\/___/ /   / / /   / / /\/_// / /   / / /    / / /    / / // / / /\_____\ 
 _    \ \ \   / / /_____/ /\ \   _    \ \ \   / / /   / / /   / / /   / / /    / / /   / / /    / / /    / / // / /  \/____ / 
/_/\__/ / /  / /_________/\ \ \ /_/\__/ / /  / / /   / / /___/ / /__ / / /    / / /___/ / /__  / / /    / / // / /_____/ / /  
\ \/___/ /  / / /_       __\ \_\\ \/___/ /  / / /   / / //\__\/_/___\\/_/    / / //\__\/_/___\/ / /    / / // / /______\/ /   
 \_____\/   \_\___\     /____/_/ \_____\/   \/_/    \/_/ \/_________/        \/_/ \/_________/\/_/     \/_/ \/___________/    
                                                                                                                              
*/
#include<bits/stdc++.h>
using namespace std;
#define ALL(obj) (obj).begin(), (obj).end()
#define REP(i, n) for(int i = 0;i < (n);++i)

#define endl '\n'
#define pb emplace_back
#define mkp make_pair
#define p_q priority_queue
#define INF 1000000000
#define PI 3.1415926
#define coutdb cout << fixed << setprecision(10)

const int dx[]={1,0,-1,0}, dy[]={0,-1,0,1};
const int dx_8[]={1,1,0,-1,-1,-1,0,1}, dy_8[]={0,-1,-1,-1,0,1,1,1};
const long long MOD = 1e9+7;

// typedef long long ll;
#define int long long

template <typename T> inline T GCD(T a,T b){T c;while(b!=0){c=a%b;a=b;b=c;}return a;}
template <typename T> inline T LCM(T a,T b){T c=GCD(a,b);a/=c;return a*b;}
template <typename T> inline T nCr(T a,T b){T i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
template <typename T> inline T nHr(T a,T b){return nCr(a+b-1,b);}

bool dp[5010][5010];

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

  int A, B; cin >> A >> B;
  if((A+B) % 2 == 0){
    cout << (A+B) / 2 << endl;
  } else cout << "IMPOSSIBLE" << endl;
}

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

typedef long long ll;
typedef vector<int> vi;            typedef vector<vi> vii;
typedef vector<ll> vl;             typedef vector<vl> vll;
typedef pair<int,int> pi;          typedef pair<pi,int> pii;
typedef pair<ll,ll> pl;            typedef pair<pl,ll> pll;
typedef pair<int,bool> pib;        typedef pair<ll,bool> plb;

#define F first
#define S second
#define mp make_pair
#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define in insert
#define er erase
//returns (a^n mod p)---------------------------------------------------------------------------------------------------------------
ll power(ll a,ll n,ll p)
{
	if(n == 0)
	{
		return 1;
	}
	else if(n%2 == 0)
	{
		ll ans = power(a,n/2,p);
		return (ans*ans)%p;
	}
	else 
	{
		ll ans = power(a,n-1,p);
		return (ans*a)%p;
	}
}

//returns (a^-1 mod p)(if p is prime)----------------------------------------------------------------------------------------------
ll inverse(ll a,ll p)
{
   return power(a,p-2,p);
}
//----------------------------------------------------------------------------------------------------------------------------------


void solve()
{
   int n;
   cin>>n;
   int x = ceil(n/1000.0);
   cout<<1000*x-n<<endl;
}


int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
#ifdef PAVANSAI006
    freopen("inp.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
    freopen("err.txt", "w", stderr);
#endif
    ll t = 1;
    //cin>>t;
    while(t--)
    {
    	solve();
    }
    
}

Measured memory_bytes: 3628
import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;
import java.util.PriorityQueue;

public class Main {
	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		int N = sc.nextInt();
		String S = sc.next();
		int ans = 1;
		char now = S.charAt(0);
		int i = 1;
		while (i < N) {
			char t = S.charAt(i);
			if (now != t) {
				now = t;
				ans++;
			}
			i++;
		}
		System.out.println(ans);
	}
	
	public static long gcd(long a, long b) {
		long remainder = a % b;
		if (remainder == 0) {
			return b;
		} else {
			return gcd(b, remainder);
		}
	}
}

class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        } else {
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }

    private int readByte() {
        if (hasNextByte())
            return buffer[ptr++];
        else
            return -1;
    }

    private static boolean isPrintableChar(int c) {
        return 33 <= c && c <= 126;
    }

    public boolean hasNext() {
        while (hasNextByte() && !isPrintableChar(buffer[ptr]))
            ptr++;
        return hasNextByte();
    }

    public String next() {
        if (!hasNext())
            throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while (isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }

    public long nextLong() {
        if (!hasNext())
            throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while (true) {
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            } else if (b == -1 || !isPrintableChar(b)) {
                return minus ? -n : n;
            } else {
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }

    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
            throw new NumberFormatException();
        return (int) nl;
    }

    public double nextDouble() {
        return Double.parseDouble(next());
    }
}


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

int main() {
  int a=0;
  int b=0;
  int x=0;
  float sum =0.0;
  cin >> a >> b;
  sum = (a+b)/2.0 +0.6; 
  x= sum;
  cout << x << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long int
#define F(i,j,k,in) for(int i=j;i<k;i+=in)
#define DF(i,j,k,in) for(int i=j;i>=k;i-=in)
#define feach(it,l) for (auto it = l.begin(); it != l.end(); ++it)
#define fitr(it,it1,itr2) for(auto it=itr1;it!=itr2;++it)
#define fall(a) a.begin(),a.end()
#define pb push_back
#define ub upper_bound
#define lb lower_bound
#define eq equal_range
#define fs first
#define ss second
#define ins insert
#define mkp make_pair
#define endl "\n"
using namespace std;
typedef vector<ll> vll;
typedef vector<int> vin;
typedef vector<char> vch;
typedef vector<string> vst;
typedef vector<vector<ll>> vvll;
typedef vector<vector<int,int>> vvin;
typedef vector<pair<ll,ll>> vpll;
typedef vector<pair<int,int>> vpin;
typedef set<ll> sll;
typedef set<int> sint;
typedef set<char> sch;
typedef set<string> sst;
typedef queue<ll> qll;
typedef priority_queue<ll> pqll;
typedef queue<int> qin;
typedef priority_queue<int> pqin;
typedef map<ll,ll> mpll;
typedef map<int,int> mpin;
typedef pair<ll,ll> pll;
typedef pair<int,int> pin;
const ll MOD=1000000007;
const long double PI=3.1415926535897932384626433832795;
ll pwr(ll b,ll p){ll res=1;while(p){if(p&1) {res*=b; p--;}else{b*=b; p>>=1;}}return res;}
const int maxn=1e5+1, maxn1 = 101;
ll dp[maxn][maxn1];
int main()
{
ios_base::sync_with_stdio(false) , cin.tie(NULL) , cout.tie(NULL);
int n,w;
cin>>n>>w;
vpin A(n+1);
F (i,1,n+1,1) {
  int a,b; cin>>a>>b;
  A[i]=mkp(a,b);
}
F (i,0,n+1,1) dp[0][i]=0;
F (i,1,w+1,1) dp[i][0]=0;
F (i,1,n+1,1) {
  F (j,1,w+1,1) {
    dp[j][i] = dp[j][i-1];
    if (j>=A[i].fs) dp[j][i] = max(dp[j][i],dp[j-A[i].fs][i-1]+A[i].ss);

  }
}
cout<<dp[w][n];

return 0;
}



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

const int nmax = 8;
bool graph[nmax][nmax];

int dfs(int v, int N, bool visited[nmax]){
  bool all_visited = true;
  
  for( int i=0;i<N;++i){
    if(visited[i]==false)
      all_visited=false;
  }
  
  if(all_visited){
    return 1;
  }
  
  int ret = 0;
  
  for(int i=0;i<N;++i){
    if(graph[v][i] == false) continue;
    if(visited[i]) continue;
    
    visited[i] = true;
    ret+=dfs(i,N,visited);
    visited[i] = false;
  }
  
  return ret;
}

int main(void){
  int N,M;
  cin >> N >> M;
  
  for(int i=0;i<M;++i){
    int A,B;
    cin >> A >> B;
    graph[A-1][B-1] =graph[B-1][A-1] = true;
  }
  
  bool visited[nmax];
  for(int i=0;i<N;++i){
    visited[i]=false;
  }
  
  visited[0]=true;
  cout << dfs(0,N,visited) << endl;
  return 0;
}

Measured memory_bytes: 256
# リストの宣言
A = []

# 入力の最初の行に、数列の長さを表す整数 N が与えられます。
# 2 行目に、N 個の整数が空白区切りで与えられます。
NUM =int(input())
A = input().split()

print(" ".join(map(str,A)))

NUMLIST = range (1, NUM)

# for i = 1 to A.length-1
for i in NUMLIST:
#    key = A[i]
  key = A[i]
  j = i - 1
  while j >= 0 and int(A[j]) > int(key):
    A[j+1] = A[j]
    j-=1
  A[j+1] = key
  print(" ".join(map(str, A)))




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

#define ll long long
#define an "\n"
#define pb push_back
#define pob pop_back

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	int a;
	cin >> a;
	cout << a+pow(a, 2)+pow(a, 3);
}




Measured memory_bytes: 4164
def f(_b, _n):
    ret = 0
    while _n > 0:
        ret += _n % _b
        _n = _n // _b
    return ret
INF = 10 ** 12

n = int(input())
s = int(input())

ans = INF
if n >= s:
    max_digits = len(str(bin(n))) - 2
    # 3桁まで
    for k in range(max_digits, 2, -1):
        min_b = max(2, -(int(- (n ** (1 / k)))))
        max_b = int((n - s + 1) ** (1 / (k - 1)))
        for b in range(min_b, max_b + 1, 1):
            if f(b, n) == s:
                ans = b
                break
        if ans != INF:
            break

    if ans == INF:
        # 2桁
        for a1 in range(1, s + 1):
            if (n - s) < (a1 - 1) * a1:
                break
            if (n - s) % a1 == 0:
                a0 = s - a1
                b = (n - a0) // a1
                if a0 < b and a1 < b and (b * a1) == (n - a0) and b < ans:
                    ans = b

    if ans == INF:
        # 1桁
        if n == s:
            ans = n + 1
if ans == INF:
    ans = -1

print(ans)


Measured memory_bytes: 3188
import java.util.Random;
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int p = sc.nextInt();
        int q = sc.nextInt();
        if(p == 0){
            if(q <= 1911){
                System.out.println("M" + (q - 1867));
            }
            else if(q <= 1925){
                System.out.println("T" + (q - 1911));
            }
            else if(q <= 1988){
                System.out.println("S" + (q - 1925));
            }
            else{
                System.out.println("H" + (q - 1988));
            }
        }
        else if(p == 1){
            System.out.println(1867 + q);
        }
        else if(p == 2){
            System.out.println(1911 + q);
        }
        else if(p == 3){
            System.out.println(1925 + q);
        }
        else System.out.println(1988 + q);
    }



}



Measured memory_bytes: 26224
a,b,h,m = gets.chomp.split.map(&:to_i)

r2 = (m.to_f * 360 * Math::PI) / (180 * 60)
r1 = (h.to_f * 360 * Math::PI) / (180 * 12) + r2.to_f / 12

x1 = a * Math.sin(r1)
y1 = a * Math.cos(r1)

x2 = b * Math.sin(r2)
y2 = b * Math.cos(r2)

p Math.sqrt((x1 - x2) ** 2 + (y1 - y2) ** 2)



Measured memory_bytes: 14780
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const int MOD = 1000000007;
 
int main()
{
    int n, k;
    cin >> n >> k;
    vector<char> D;
    rep(i, k)
    {
        char a;
        cin >> a;
        D.push_back(a);
    }
 
    ll ans = n;
    while (1)
    {
        string s = to_string(ans);
        int flag = 1;
        rep(i, s.length())
        {
            for (auto d : D)
            {
                if (d == s[i])
                    flag = 0;
            }
        }
        if (flag)
        {
            cout << ans << endl;
            return 0;
        }
        ans++;
    }
}
#include <bits/stdc++.h>
using namespace std;

Measured memory_bytes: 256
/*input
6 2
4 2
*/
#include <stdio.h>
#include <algorithm>
using namespace std;
const int N = 101;
int k,n;
int as;
int main(){
	scanf("%d%d", &k , &n);
	for(int i=1;i<=n;++i){
		int lv; scanf("%d", &lv);
		as = max (as,lv);
	}
	if ((k+1)/2 >= as) printf("%d\n", 0);
	else printf("%d", 2*as - (k+1)); 
}

Measured memory_bytes: 128
import sys, re
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees#, log2
from collections import deque, defaultdict, Counter
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop, heapify
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7
 
N = INT()
uvw = [LIST() for _ in range(N-1)]

graph = [[] for _ in range(N)]

for u, v, w in uvw:
	graph[u-1].append([v-1, w])
	graph[v-1].append([u-1, w])

#print(graph)

step = [-1]*N
step[0] = 0

def DFS(n):
	for x, w in graph[n]:
		#print(x, w)
		if step[x] == -1:
			if (w+step[n])%2:
				step[x] = 1
			else:
				step[x] = 0
			#print(step)
			DFS(x)

DFS(0)

for ans in step:
	print(ans)
	


Measured memory_bytes: 164884
#include<bits/stdc++.h> 
//#define <- プログラムの文字列を置換する
//typedef <- 新しい型に名前を付けるためのキーワード

using namespace std;

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

const long long MOD = 1e9 + 7;
const long long INF = 1e15;
const int INF_INT = 1e9;

template<class T> inline bool chmin(T& a, T b){
    if(a > b){
        a = b;
        return true;
    }
    return false;
}

template<class T> inline bool chmax(T& a, T b){
    if(a < b){
        a = b;
        return true;
    }
    return false;
}

template<class TYPE>
struct edge{
    TYPE to,cost; 
    edge(TYPE t,TYPE c){
        to = t;
        cost = c;
    }
};

int main(){
    int N,D;
    cin >> N >> D;
    int count = 0;
    for(int i = 0; i < N; i++){
        ll x,y;
        cin >> x >> y;
        if(sqrt(x*x + y*y) <= D) count++;
    }
    cout << count << endl;
    return 0;
}


Measured memory_bytes: 3652
#include<bits/stdc++.h>
#define int long long
#define P pair<int,int>
#define PP pair<P,int>
#define F first
#define S second
#define f(i,n) for(int i=0;i<(n);i++)
#define INF LLONG_MAX/3
#define eps LDBL_EPSILON
#define mod (int)(1000000007)
#define pie 3.141592653589793238462643383279
#define Bpri priority_queue
#define Spri priority_queue<P,vector<P>,greater<P>>
using namespace std;
int x[100000];
P p[100000];
signed main(){
	int a,b,ans=0;
	cin>>a>>b;
	f(i,a)cin>>x[i];
	f(i,b)cin>>p[i].S>>p[i].F;
	sort(x,x+a);
	sort(p,p+b);
	int i=0;
	for(int j=b-1;j>=0&&i<a;j--){
		for(int k=i;i<k+p[j].S&&i<a;i++){
			if(x[i]>=p[j].F)goto loop;
			x[i]=p[j].F;
		}
	}
	loop:;
	f(i,a){
		ans+=x[i];
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 2560
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        List<Integer> list = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            int a = sc.nextInt();
            list.add(a);
        }

        Collections.sort(list, Comparator.reverseOrder());

        int alice = 0, bob = 0;
        for (int i = 0; i < n; i++) {
            if (i%2 == 0) {
                alice += list.get(i);
            } else {
                bob += list.get(i);
            }
        }

        System.out.println(alice - bob);
    }
}

Measured memory_bytes: 21844
#include <vector>
#include <queue>
#include <algorithm>
#include <iostream>
#include <string>
#include <tuple>
#include <set>
#include <map>
#include <complex>
#include <iomanip>
#include <cmath>
using namespace std;
typedef long long ll;

int main()
{
  string str;
  cin >> str;
  ll i = str.size();
  string ans = "YES";
  while(i > 0) {
    if (str[i - 5] == 'd' && str[i - 4] == 'r' && str[i - 3] == 'e' && str[i - 2] == 'a' && str[i - 1] == 'm') i -= 5;
    else if (str[i - 5] == 'e' && str[i - 4] == 'r' && str[i - 3] == 'a' && str[i - 2] == 's' && str[i - 1] == 'e') i -= 5;
    else if (str[i - 6] == 'e' && str[i - 5] == 'r' && str[i - 4] == 'a' && str[i - 3] == 's' && str[i - 2] == 'e' && str[i - 1] == 'r') i -= 6;
    else if (str[i - 7] == 'd' && str[i - 6] == 'r' && str[i - 5] == 'e' && str[i - 4] == 'a' && str[i - 3] == 'm' && str[i - 2] == 'e' && str[i - 1] == 'r') i -= 7;
    else {
      ans = "NO";
      break;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 512
#include <stdio.h>          // printf(), scanf()
#define MAX_N 500000
 
typedef struct node_tbl
{
    int key;
    int parent;
    int left;
    int right;
} node;
 
const int nil = -1;
node t[MAX_N + 1];
int root;
int room;
int ix;
 
int
tree_minimum(int u)
{
    while (t[u].left != nil)
        u = t[u].left;
 
    return u;
}
 
int
find(int u, int k)
{
    while (u != nil && k != t[u].key)
    {
        if (k < t[u].key)
            u = t[u].left;
        else
            u = t[u].right;
    }
 
    return u;
}
 
int
tree_successor(int u)
{
    if (t[u].right != nil)
        return tree_minimum(t[u].right);
 
    int y = t[u].parent;
    while (y != nil && u == t[y].right)
    {
        u = y;
        y = t[y].parent;
    }
 
    return y;
}
 
void
delete(int z)
{
    int y; /* ????????????????±? */
    int x; /* y?????? */
 
    /* ??????????????????????±??????? */
    if (t[z].left == nil || t[z].right == nil)
        y = z;
    else
        y = tree_successor(z);
 
    /* y??????x????±??????? */
    if (t[y].left != nil)
        x = t[y].left;
    else
        x = t[y].right;
 
    if (x != nil)
        t[x].parent = t[y].parent;
 
    if (t[y].parent == nil)
        root = x;
    else
    {
        if (y == t[t[y].parent].left)
            t[t[y].parent].left = x;
        else
            t[t[y].parent].right = x;
    }
 
    if (y != z)
        t[z].key = t[y].key;
 
    t[y].right = room;
    room = y;
}
 
void
insert(int k)
{
    int z;
 
    int y = nil;
    int x = root;
    if (room == nil)
        z = ix++;
    else
    {
        z = room;
        room = t[room].right;
    }
 
    t[z].key = k;
    t[z].left = nil;
    t[z].right = nil;
 
    while (x != nil)
    {
        y = x;
        if (t[z].key < t[x].key)
            x = t[x].left;
        else
            x = t[x].right;
    }
 
    t[z].parent = y;
    if (y == nil)
        root = z;
    else
    {
        if (t[z].key < t[y].key)
            t[y].left = z;
        else
            t[y].right = z;
    }
}
 
void
inorder(int u)
{
    if (u == nil)
        return;
 
    inorder(t[u].left);
    printf(" %d", t[u].key);
    inorder(t[u].right);
}
 
void
preorder(int u)
{
    if (u == nil)
        return;
 
    printf(" %d", t[u].key);
    preorder(t[u].left);
    preorder(t[u].right);
}
 
int
main(int argc, char** argv)
{
    char command[8];
    int n;
    int x;
    int i;
 
    root = nil;
    room = -1;
    ix = 0;
    scanf("%d", &n);
    for (i = 0; i < n; ++i)
    {
        scanf("%s", command);
        switch (command[0])
        {
        case 'd':
            scanf("%d", &x);
            delete(find(root, x));
            break;
 
        case 'f':
            scanf("%d", &x);
            printf("%s\n", find(root, x) != nil ? "yes" : "no");
            break;
 
        case 'i':
            scanf("%d", &x);
            insert(x);
            break;
 
        case 'p':
        default:
            inorder(root);
            printf("\n");
 
            preorder(root);
            printf("\n");
            break;
        }
    }
 
    return 0;
}



Measured memory_bytes: 8048
#include<stdio.h>
int main(void){
   int a,b,c,d,e,f;
   scanf("%d %d %d",&a,&b,&c);
      if(a<b){
         if(b<c){
            d=a;e=b;f=c;}
         else if(c<a){
            d=c;e=a;f=b;}
         else{
            d=a;e=c;f=b;}}
      else if(b<a){
         if(c<b){
            d=c;e=b;f=a;}
         else if(a<c){
            d=b;e=a;f=c;}
         else{
            d=b;e=c;f=a;}}
            

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

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

using namespace std;

#define INF 100000000
#define YJ 1145141919
#define INF_INT_MAX 2147483647
#define INF_LL 9223372036854775
#define INF_LL_MAX 9223372036854775807
#define EPS 1e-10
#define MOD 1000000007
#define MOD9 998244353
#define Pi acos(-1)
#define LL long long
#define ULL unsigned long long
#define LD long double

#define int long long

using II = pair<int, int>;

int gcd(int a, int b) { return b != 0 ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a * b / gcd(a, b); }
int extgcd(int a, int b, int &x, int &y) { int g = a; x = 1; y = 0; if (b != 0) g = extgcd(b, a % b, y, x), y -= (a / b) * x; return g; }

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(a)  begin((a)), end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())

int cnt[30];

signed main()
{
  string S;
  cin >> S;
  REP(n,S.size()) {
    cnt[S[n]-'A']++;
  }

  REP(n,30) {
    if(cnt[n] != 0 && cnt[n] != 2) {
      cout << "No" << endl;
      return 0;
    }
  }

  cout << "Yes" << endl;

  return 0;
}


Measured memory_bytes: 256
//Created by Kira

#include<bits/stdc++.h>
using namespace std;

#define IOS cin.sync_with_stdio(0);cin.tie(0); cout.tie(0);
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
#define pii pair<int,int> 
#define pb push_back
#define vi vector<int> 
using ll = long long;

const int mod = 1e9 + 7;

ll pwr(ll a, ll b);
    



int main(){
   IOS

   string s; cin>>s;

   if(s=="AAA"||s=="BBB")
        cout<<"No\n";
    else cout<<"Yes\n";




   

}

ll pwr(ll a, ll b){
   a %= mod;	//Remove mod if not required
   ll res = 1;
   while(b > 0){
    if(b&1)
        res = res * a % mod;
        a = a * a % mod;
    b >>= 1;
    }

    return res;
}



Measured memory_bytes: 256
n,m = map(int,input().split())
voyage = [set() for i in range(n+1)]
for i in range(m):
  a,b = map(int,input().split())
  voyage[a].add(b)
  voyage[b].add(a)
ans = 0
for v in voyage[1]:
  if v in voyage[n]:
    ans = 1
print('POSSIBLE' if ans else 'IMPOSSIBLE')

Measured memory_bytes: 73660
#include<iostream>
#include<iomanip>
#include<string>
#include<set>
#include<vector>
#include<utility>
#include<algorithm>
using namespace std;
#define LL long long



int main() {
	int a, b, c;
	cin >> a >> b;
	cout << max(max(a + b, a - b), a*b) << endl;

	return 0;
}

Measured memory_bytes: 256
// 基本テンプレート

#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
using namespace std;

#define rep(i,a,n) for(int (i)=(a); (i)<(n); (i)++)
#define repq(i,a,n) for(int (i)=(a); (i)<=(n); (i)++)
#define repr(i,a,n) for(int (i)=(a); (i)>=(n); (i)--)
#define int long long int

template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}

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

int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
constexpr ll INF = 1001001001001001LL;
constexpr ll MOD = 1000000007LL;

signed main() {
    int N, K; cin >> N >> K;
    map<int, int> mp;
    rep(i,0,N) {
        int p; cin >> p;
        mp[p]++;
    }

    vector<pii> vs;
    for(auto x : mp) vs.push_back(make_pair(x.second, x.first));

    int ans = 0;
    sort(vs.begin(), vs.end());
    rep(i,0,(int)vs.size() - K) {
        // printf("fr = %lld, se = %lld\n", vs[i].first, vs[i].second);
        ans += vs[i].first;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 17264
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <set>
#include <map>
#include <cassert>
#include <queue>
#include <vector>
#define CL(a) memset(a,0,sizeof(a))
#define cl(a,b) memset(a,(b),sizeof(a))
#define For(i,a,b) for(int i=a;i<=b;i++)
#define _for(i,a,b) for(int i=a;i<b;i++)
#define LL long long 
using namespace std;
const int maxn = 1e5 + 100;
struct Point{
	int t,x,y;
	bool operator < (const Point& p)const
	{
		return t<p.t;
	}
}a[maxn]; 
int main()
{
	//freopen("in.txt","r",stdin);
    int n;
	scanf("%d",&n);
	a[0].t = a[0].x = a[0].y = 0;
	for(int i=1;i<=n;i++)
	{
		scanf("%d%d%d",&a[i].t,&a[i].x,&a[i].y);	
	}   
	sort(a,a+n+1);
	int flag = true;
	for(int i=1;i<=n&&flag;i++)
	{
		int tt = a[i].t - a[i-1].t;
		int dis = abs(a[i].x-a[i-1].x)+abs(a[i].y-a[i-1].y);
		if(dis>tt) flag = 0;
		if((tt-dis)%2) flag = 0;
	}
	if(flag) printf("Yes\n");
	else printf("No\n");




        

	return 0;
}

Measured memory_bytes: 1408
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define rep2(i,s,n) for (int i = s; i < n; ++i)
#define all(a) a.begin(),a.end()
using namespace std;

int main() {
    int w,h,n;
    cin >> w >> h >> n;
    vector<bool> X(w, false);
    vector<bool> Y(h,false);
    rep(i,n) {
        int x,y,a;
        cin >> x >> y >> a;
        if(a == 1) {
            rep(j,x) X[j] = true;
        } else if(a == 2) {
            for(int j = w-1; j >= x; j--) X[j] = true;
        } else if(a == 3) {
            rep(j,y) Y[j] = true;
        } else {
            for(int j = h-1; j >= y; j--) Y[j] = true;
        }
    }
    int yoko = 0;
    int tate = 0;
    rep(i,w) {
        if(!X[i]) yoko++;
    }
    rep(i,h) {
        if(!Y[i]) tate++;
    }
    cout << yoko*tate << endl;
}

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

using namespace std;

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

    vector<string> words(N);
    for(int i = 0; i < N; i++){
        cin >> words[i];
    }

    vector<string> saied;
    char beforeLastWord = '@';
    bool isSuccess = true;
    for(int i = 0; i < N; i++){
        if(i > 0 && (words[i][0] != beforeLastWord || find(saied.begin(), saied.end(), words[i]) != saied.end())){
            isSuccess = false;
        }

        saied.push_back(words[i]);
        beforeLastWord = words[i][words[i].size()-1];
    }

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

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdio>
#include <string>

using namespace std;

const int N=200;

int main()
{
    char s1[N],s2[N];

    while(cin>>s1>>s2)
    {
        int lens1=strlen(s1);
        int lens2=strlen(s2);
        string a;
        string b;
        string::iterator *it;

        if(lens1!=lens2)
        {
            cout<<"No"<<endl;
        }
        else
        {
            a="";
            b="";
            int n=lens1;
            for(int i=0; i<n; i++)
            {
                a+=s1[i];
                b+=s2[i];
            }
            a+=a;
            int ans=a.find(b);
            if(ans>=0)
            {
                cout<<"Yes"<<endl;
            }
            else
            {
                cout<<"No"<<endl;
            }
        }
        memset(s1,'\0',sizeof(s1));
        memset(s2,'\0',sizeof(s2));
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int a,b;
    cin>>a>>b;
    if(a==b)
        cout<<"Draw"<<endl;
    else if(a==1)
        cout<<"Alice"<<endl;
    else if(b==1)
        cout<<"Bob"<<endl;
    else if(a>b)
        cout<<"Alice"<<endl;
    else if(b>a)
        cout<<"Bob"<<endl;


    return 0;
}



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

int main(){
    int n;
    cin >> n;
    vector <pair <int, int>> vp(n);
    for (int i = 0; i < n; ++i){
        cin >> vp[i].first;
        vp[i].second = i;
    }

    sort(vp.begin(), vp.end());
    for (int i = 0; i < n; ++i){
        //cout << vp[i].first << " " << vp[i].second << endl;
        cout <<  vp[i].second + 1;
        if (i<n-1){
            cout << " ";
        }else{
            cout << endl;
        }
    }
}

Measured memory_bytes: 1664