akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>

#ifdef DEBUG
#include <util.h>
#else
#define Dump(x)
#endif

using namespace std;

using ll_t = long long;
using ull_t = unsigned long long;
using ld_t = long double;

bool judge(long A, long B, long V, long W, long T)
{
    if (V <= W)
        return false;
    long d = abs(A - B);
    long v = abs(V - W);
    for (int i = 0; i < T; ++i)
    {
        if (d <= 0)
            break;
        d -= v;
    }
    return (d <= 0);
}

int main()
{
    long A, B, V, W, T;
    cin >> A >> V >> B >> W >> T;

    bool f = judge(A, B, V, W, T);

    cout << (f ? "YES" : "NO") << endl;
}


Measured memory_bytes: 3636
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <map>

#define MAX_INT 2147483647
#define PI 3.141592653589793238462643383279502884L

static const int MAX = 100000000;
using std::vector;
using std::map;
using std::string;
using std::pair;
using std::cin;
using std::cout;
using std::cerr;

// @author: pashka

int main() {
    std::ios::sync_with_stdio(false);

    int x1, y1, x2, y2, n;

    cin >> x1 >> y1 >> x2 >> y2 >> n;

    vector<pair<int, int>> c(n);
    for (int i = 0; i < n; i++) {
        int x, y;
        cin >> x >> y;
        c[i] = {x, y};
    }

    if (x1 > x2) {
        x1 = MAX - x1;
        x2 = MAX - x2;
        for (auto &item : c) {
            item.first = MAX - item.first;
        }
    }
    if (y1 > y2) {
        y1 = MAX - y1;
        y2 = MAX - y2;
        for (auto &item : c) {
            item.second = MAX - item.second;
        }
    }

    vector<pair<int, int>> good;
    for (auto item : c) {
        if (item.first >= x1 && item.first <= x2 && item.second >= y1 && item.second <= y2) {
            good.push_back(item);
        }
    }

    sort(good.begin(), good.end());
    int max = 0;
    vector<int> p(good.size() + 1, MAX_INT);

    for (auto item : good) {
        int l = -1;
        int r = p.size();
        while (r > l + 1) {
            int m = (l + r) / 2;
            if (p[m] > item.second) {
                r = m;
            } else {
                l = m;
            }
        }
        p[r] = item.second;
        max = std::max(max, r + 1);
    }

//    cerr << max << "\n";

    long double res = 100.0L * (x2 - x1 + y2 - y1);
    if (max == std::min(x2 - x1 + 1, y2 - y1 + 1)) {
        res += 10.0L * (max - 1) * (PI / 2 - 2);
        res += 10.0L * (PI - 2);
    } else {
        res += 10.0L * max * (PI / 2 - 2);
    }

    cout << std::setprecision(20);
    cout << res << "\n";

    return 0;
}

Measured memory_bytes: 4208
#include <stdio.h>

int check(char str[]){
	int i=0, n, m, count=0, flag=0;
	while(str[i]) i++;
	
	n=3; m=i;
	for(i=n-1;i<=m-2;i++){
		if(str[i]=='C') count++;
		else if(str[i]<0x61||str[i]>0x7A) flag=1;
	}
	if(str[1]<0x61||str[1]>0x7A) return 1;//大文字
	else if(str[m-1]<0x61||str[m-1]>0x7A) return 1;//大文字
	else if(count!=1 || flag) return 1;
	else return 0;
}

int main(){
	char str[11];
	scanf("%s", str);
	
	if(str[0]!='A' || check(str)) printf("WA");
	else printf("AC");
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
long long rand_seed()
{
	long long a = rng();
    return a;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n, k;
    cin >> n >> k;
    cout << n - k + 1;
    return 0;
}


Measured memory_bytes: 256
#define _USE_NATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
#include <random>
#include <tuple>


using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
#define EPS 1e-9
const int INF = 1050000000;
const long long LINF = 1LL << 60;
const ll MOD = 1e9 + 7;
const int MINF = -1050000000;

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


int main() {
	int n, m;
	cin >> n;
	map<string, int> s, t;
	rep(i, n) {
		string x;
		cin >> x;
		s[x]++;
	}
	cin >> m;
	rep(i, m) {
		string x;
		cin >> x;
		t[x]++;
	}
	int res = 0, tmp;
	for (auto x : s) {
		tmp = x.second;
		for (auto y : t) {
			if (x.first == y.first) {
				tmp = x.second - y.second;
			}
		}
		res = max(res, tmp);
	}
	cout << res << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
 
using namespace std;
 
int main(){
  	int a,b,c,d;
  cin >> a  >> b >> c >> d;
  int x = max(a,c), y = min(b,d);
  if(x <= y){
    cout << (y-x) << endl;
  }
  else{
  	cout << 0 << endl;
  }
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
#include<limits>
#include<sstream> 
#include<unordered_map>      

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef int itn;

const int inf = numeric_limits<int>::max() >> 2;
const ll linf = numeric_limits<ll>::max() >> 2;
const ull ulinf = numeric_limits<ull>::max() >> 2;
const double pi = acos(-1);
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const int dx8[8]={-1,0,1,-1,1,-1,0,1};
const int dy8[8]={-1,-1,-1,0,0,1,1,1};

#define p_queue(i) priority_queue<i> 
#define rp_queue(i) priority_queue<i, vector<i>, greater<i>> 
#define umap(i,j) unordered_map<i,j>
#define P(p) cout<<(p)<<endl
#define PS(p) cout<<(p)<< " "
#define PN cout << endl
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define rrep(i,m,n) for(int i = (n-1); i >= (int)(m); i--)
#define inrep(n,a) for(int i = 0; i < (int)(n); i++)cin >> a[i];
#define mod(i) ((i)%(ll)(1e9 + 7))
#define divm(a,b) (mod(a * modpow((ll)b,(ll)(1e9+5))))
#define rsort(a,b,c) sort(a, b, greater<c>())
#define vsort(v) sort(v.begin(), v.end())
#define rvsort(v,c) sort(v.begin(), v.end(), greater<c>()) 
#define ft first
#define sd second
#define pb push_back
#define it insert
#define sz(x) ((int)(x).size())
#define lb(a,n,k) (lower_bound(a,a+n,k) - (a)) 
#define vlb(a,k)  (lower_bound(a.begin(),a.end(),k) - a.begin())
#define ub(a,n,k) (upper_bound(a,a+n,k) - (a)) 
#define vub(a,k)  (upper_bound(a.begin(),a.end(),k) - a.begin())
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return

/*
ll modpow(ll i,ll j){ ll tmp=1; while(j){ if(j%2)tmp=mod(tmp*i);i=mod(i*i);j/=2;}return tmp;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
*/

/*
vector<string> split(const string &str, char sep){
    vector<string> v;
    stringstream ss(str);
    string buffer;
    while( getline(ss, buffer, sep) ) {
        v.push_back(buffer);
    }
    return v;
}
*/

/*
ll ncr[100][100];
ll nCr(int n, int r){if(n==r) ret ncr[n][r] = 1; if(r==0) ret ncr[n][r] = 1; if(r==1) ret ncr[n][r] = n;if(ncr[n][r]) ret ncr[n][r]; ret ncr[n][r] = nCr(n-1,r) + nCr(n-1,r-1);}

ll npr[100][100]={};
ll nPr(int n,int r){if(npr[n][r])ret npr[n][r];if(r==0)ret npr[n][r] = 1;if(r==1)ret npr[n][r] = n;ret npr[n][r] = n * nPr(n-1,r-1);}

ll nHr(int n,int r){ret nCr(n+r-1,r);}
*/

///////////////////////////////////////////////////////////////////////////



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

    rep(i,0,k)PS(s);
    if(s < 1000000000){
	rep(i,k,n)PS(s+1);
    }else rep(i,k,n)PS(s- 1);
    PN;
    
    return  0;
}


Measured memory_bytes: 1280
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
using namespace std;
 
int dx[] = {0, -1, -1, 0, 1, 1};
int dy[] = {-1, -1, 0, 1, 1, 0};

typedef pair<int, int> P; 

int main(){
  int n;
  cin >> n;
  cin.ignore();
  string s1, s2, tmp;
  for(int i = 0 ; i < n ; i++){
    getline(cin, s1);
    getline(cin, s2);
    getline(cin, tmp);
 
    vector<int> m1, m2;
    for(int i = 0 ; i < (int)s1.size() ; i++) m1.push_back(s1[i]-'a');
    for(int i = 0 ; i < (int)s2.size() ; i++) m2.push_back(s2[i]-'a');
    
    vector<P> path1;
    int x1 = 0, y1 = 0;    
    int mx1 = 0, my1 = 0;
    path1.push_back(P(0, 0));
    for(int i = 0 ; i < (int)m1.size() ; i++){
      x1 += dx[ m1[i] ];
      y1 += dy[ m1[i] ];
      path1.push_back(P(x1, y1));
      mx1 = min(mx1, x1);
      my1 = min(my1, y1);      
    }
    for(int i = 0 ; i < path1.size() ; i++){
      path1[i].first -= mx1;
      path1[i].second -= my1;
    }
    sort(path1.begin(), path1.end());    
    
    bool flag = false;   
    for(int i = 0 ; i < 6 ; i++){
      int x2 = 0, y2 = 0;
      int mx2 = 0, my2 = 0;
      vector<P> path2;
      path2.push_back(P(0, 0));
      for(int j = 0 ; j < (int)m2.size() ; j++){
	x2 += dx[ (m2[j]+i)%6 ];
	y2 += dy[ (m2[j]+i)%6 ];
	path2.push_back(P(x2, y2));
	mx2 = min(mx2, x2);
	my2 = min(my2, y2);
      }
      for(int j = 0 ; j < path2.size() ; j++){
	path2[j].first -= mx2;
	path2[j].second -= my2;
      }
      sort(path2.begin(), path2.end());
      if(path1 == path2){
	flag = true;
	goto END;
      }
    }
  END:;
    if(flag) cout << "true" << endl;
    else cout << "false" << endl;
  }
  return 0;
}

Measured memory_bytes: 1228
#include "bits/stdc++.h"
using namespace std;

int main() {
	string S;
	cin >> S; 
	if ("Sunny"==S) {
		cout << "Cloudy" << endl;
	}
	else if("Cloudy"==S){
		cout << "Rainy" << endl;
	}
	else{
		cout << "Sunny" << endl;
	}
	return 0;
}

Measured memory_bytes: 3564
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,(n)-1,0)
#define all(v) v.begin(), v.end()
#define endk '\n'
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;
const ld eps = 1e-10;
template<typename T1, typename T2> inline void chmin(T1 &a, T2 b){if(a>b) a=b;}
template<typename T1, typename T2> inline void chmax(T1 &a, T2 b){if(a<b) a=b;}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n; cin >> n;
  ll k; cin >> k;
  vector<int> P(n); rep(i, n) { cin >> P[i]; P[i]--; }
  vector<ll> C(n); rep(i, n) cin >> C[i];
  vector<int> path;
  ll ans = -longinf;
  auto dfs = [&](auto dfs, int cur, int s) -> void {
    path.push_back(cur);
    if(P[cur] == s) {
      int m = path.size();
      vector<ll> sum(m+1);
      rep(i, m) sum[i+1] = sum[i] + C[path[i]];
      if(k < m || sum[m] < 0) {
        ll mx = -longinf;
        rep(i, min((int)k, m)) chmax(mx, sum[i+1]);
        chmax(ans, mx);
      } else {
        ll tmp = sum[m] * (k/m-1);
        ll mx = -longinf;
        rep(i, m+1) chmax(mx, tmp+sum[i]);
        tmp += sum[m];
        rep(i, k%m) chmax(mx, tmp+sum[i+1]);
        chmax(ans, mx);
      }
      return;
    }
    dfs(dfs, P[cur], s);
  };
  rep(i, n) {
    path.clear();
    dfs(dfs, i, i);
  }
  cout << ans << endk;
  return 0;
}


Measured memory_bytes: 4240
#include<bits/stdc++.h>
#include<string.h>
#define ll long long
#define pf printf
#define sf scanf
#define ff first
#define ss second
#define clr clear()
#define sz size()
#define pb push_back
#define mk make_pair
#define pi acos(-1)
#define inf 2000000000000000000
#define mod 1000000007
#define ull unsigned long long int
#define f(i,k,n) for(i=k;i<n;i++)
#define fr(i,n,k) for(i=n;i>=k;i--)
#define ent(a) scanf("%lld",&a)
#define ent2(a,b) scanf("%lld%lld",&a,&b)
#define ent3(a,b,c) scanf("%lld%lld%lld",&a,&b,&c)
#define mem(a) memset(a,0,sizeof(a))
#define vec(v,s) vector<ll>v[s]
#define arr(a,s) ll a[s];
/*#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")*/
//knight and king//
int dr[]= {2,2,-2,-2,1,-1,1,-1};
int dc[]= {1,-1,1,-1,2,2,-2,-2};
int dr1[]= {0,0,1,1,1,-1,-1,-1};
int dc1[]= {1,-1,1,0,-1,0,1,-1};
int dr2[]= {0,0,1,-1};
int dc2[]= {1,-1,0,0};
////////////////////////////
using namespace std;
#define ma 2000005
ll fr[ma];

ll bigmod(ll n,ll p)
{
    if(p==0)return 1;
    ll x=bigmod(n,p/2);
    x=(x*x)%mod;
    if(p%2)x=(x*n)%mod;
    return x;
}

ll ncr(ll n,ll r)
{
    ll r1=(fr[n-r]*fr[r])%mod;
    r1=bigmod(r1,mod-2);
    return (fr[n]*r1)%mod;
}
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    ll n,i,j,u,v,k,x,m;
    fr[0]=1;
    for(i=1;i<ma;i++)fr[i]=(fr[i-1]*i)%mod;
    while(cin>>n)
    {
        ll xo=0;
       for(i=1;i<=n;i++)
       {
           cin>>fr[i];
           xo^=fr[i];
       }
       for(i=1;i<=n;i++)
       {
           cout<<(xo^fr[i])<<" ";
       }
       cout<<endl;
    }
    return 0;
}


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

// 型定義
typedef long long ll;
typedef pair<ll, ll> P;

// forループ
#define REP(i,n) for(ll i=0; i<(ll)(n); ++i)

// 定数宣言
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

// グラフ表現
using Graph = vector<vector<int>>;

// グラフの辺表現
using Edge = map<pair<int,int>,int>;

// n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

// 最大公約数
ll gcd(ll a,ll b){
   if (a%b == 0) return(b);
   else return(gcd(b, a%b));
}

// 最小公倍数
ll lcm(ll a, ll b){
    return a*b/gcd(a, b);
}

int main()
{
    cout << fixed << setprecision(15);
    ll N, K;
    cin >> N >> K;

    vector<ll> A(N);

    REP(i, N){
        cin >> A[i];
    }

    K = min(K, 50LL);
    REP(k, K){
        vector<ll> next(N, 0);
        REP(i, N){
            ll minx = max(0LL, i - A[i]);
            ll maxx = min(N-1, i+A[i]);
            next[minx]++;
            if(maxx+1 <= N-1){
                next[maxx+1]--;
            }
        }

        REP(i, N){
            if(i==0){
                A[i] = next[i];
                continue;
            }
            A[i] = A[i-1] + next[i]; 
        }
    }

    REP(i, N){
        if(i==N-1){
            cout << A[i] << endl;
            return 0;
        }
        cout << A[i] << " ";
    }
    
    return 0;
}

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

#define pb push_back
#define ff first
#define ss second
const int MAXN=1e6+1;
int spf[MAXN];
void sieve() 
{ 
    spf[1] = 1; 
    for (int i=2; i<MAXN; i++) 
        spf[i] = i; 
  
    for (int i=4; i<MAXN; i+=2) 
        spf[i] = 2; 
  
    for (int i=3; i*i<MAXN; i++) 
    { 
        if (spf[i] == i) 
        { 
            for (int j=i*i; j<MAXN; j+=i) 
  
                if (spf[j]==j) 
                    spf[j] = i; 
        } 
    } 
} 
int32_t main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    //sieve();
    int n;
    cin>>n;
    
    unordered_map<int,int> m;
    
    int a[n];
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
        m[a[i]]++;
    }
    
    if(m[1]>0)
    {
        if(m[1]==1)
            cout<<1;
        else
            cout<<0;
        return 0;
    }
    
    int res=0;
    for(int i=0;i<n;i++)
    {
        if(m[a[i]]==1)
        {
            int j=2;
                int str=a[i];
            for(j=2;j<=sqrt(str);j++)
            {   
                if(str%j==0)
                {
                    if(m[j]>0 || m[str/j]>0)
                        break;
                }
            }
            if(j==(int)(sqrt(str)+1))
               res++;
        }
    }
    cout<<res;
}
        
                 
                 

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

int main(){
  string s;
  int caunt = 0;
  cin >> s;
  if(s[0] == '1') caunt++;
  if(s[1] == '1') caunt++;
  if(s[2] == '1') caunt++;
  cout << caunt << flush;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vb = vector<bool>;
using vc = vector<char>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using pii = pair<int, int>;
#define rep(i,n) for(int i=0; i<(int)(n);i++)

int main(){
  int a,b,c,d,e;
  cin >> a >> b >> c >> d >> e;
  vi amari(5);
  amari.at(0) = a%10;
  amari.at(1) = b%10;
  amari.at(2) = c%10;
  amari.at(3) = d%10;
  amari.at(4) = e%10;
  sort(amari.begin(),amari.end());
  int mini = 0;
  rep(i,4){
    if(amari.at(i) == 0) continue;
    mini = amari.at(i);
    break;
  }
  if(mini == 0){
    cout << a+b+c+d+e << endl;
    return 0;
  }
  a = ((a+9)/10)*10;
  b = ((b+9)/10)*10;
  c = ((c+9)/10)*10;
  d = ((d+9)/10)*10;
  e = ((e+9)/10)*10;
  cout << a+b+c+d+e-10+mini << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define SORT(x) sort((x).begin(),(x).end())
#define ALL(x) (x).begin(),(x).end()
#define rep(i, n) for(ll i = 0; i < n; i++)
#define reps(i, m, n) for(int i = m; i < n; i++)
#define repr(i, m, n) for(int i = m; i >= n; i--)
template<class T>bool maxi(T &a,const T &b){if(a<b){ a=b; return 1;} return 0;}
template<class T>bool mini(T &a,const T &b){if(b<a){ a=b; return 1;} return 0;}
#define y0 y3487465 //j0
#define y1 y1347829 //j1
#define INF2 4000000000000000037
#define INF 1000000007
#define PI (acos(-1))
#define MOD 1000000007
using namespace std;
typedef long long ll;

ll dp[41][1 << 17];

ll modpow(ll a, ll n, ll mod){ // a^n mod の計算
  ll res = 1;
  while (n>0){
    if(n & 1) res = res * a % mod;
    a = a * a  % mod;
    n >>= 1;
  }
  return res;
}

void Main(){

  int N,X,Y,Z; cin>>N>>X>>Y>>Z;

  ll max16=(ll)1<<17; //直近16bitの区切りを記録

  //ll dp[N+1][max16]={};
  //ll dp[41][1 << 18];

  dp[0][1]=1;

  rep(i,N){
    rep(j,max16){
      reps(k,1,11){
        if(dp[i][j]==0) continue;
        ll now=(j<<k)+1;
        //cout<< i <<" "<<j<<"\n";
        if(now>>Z &1 == 1 and now>>(Z+Y) &1 ==1 and now>>(Z+Y+X) &1 ==1) {
          //cout<< "!"<<"\n";
          continue;
        }
        if(now & ((1<<17)-1) >= max16) continue;
        dp[i+1][now & ((1<<17)-1)]+=dp[i][j];
        dp[i+1][now & ((1<<17)-1)]%=MOD;
      }
    }
  }

  ll ans=((ll)1<<17)*MOD;


  rep(j,max16){
    if(dp[N][j]==0) continue;
    ans-=dp[N][j];
    //cout<< ans<<"\n";
  }


  ans=(ans+modpow(10,N,MOD))%MOD;

  cout<< ans <<"\n";

}

//-----------------------------------
int main(){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  Main();
}
//-----------------------------------


Measured memory_bytes: 40192
N,M = map(int, input().split())
if N%2 == 1:
    for i in range(M):
        print(i+1,N-1-i)
else:
    if (N//2)//2 >= M:
        for i in range(M):
            print(i+1,(N//2)-i)
    else:
        for i in range((N//2)//2):
            print(i+1,(N//2)-i)
        for i in range(M-(N//2)//2):
            print((N//2)+1+i,N-1-i)

Measured memory_bytes: 9268
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <deque>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>

#define ll long long
#define ull unsigned long long

using namespace std;

int main() {
    ull n, k;
    cin >> n >> k;
    cout << min(n%k, k-n%k);
    return 0;
}


Measured memory_bytes: 256
s = input()
n = len(s)
if s == s[::-1] and \
    s[:int((n-1)/2):] == s[int((n-1)/2-1)::-1] and \
    s[int((n+3)/2-1):] == s[:int((n+1)/2-1):-1]:
    print("Yes")
else:
    print("No")

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

int main() {
    ll a;
    string s;
    cin >> a >> s;
    if (a<3200) cout << "red" << endl;
    else cout << s << endl;
    return 0;
}


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

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  long long n;
  cin>>n;
  long long ans = 0;
  vector<long long> v;
  for(long long i = 1; i*i <= n; i++) {
    if(n % i == 0) {
      v.push_back(i);
      if(i != n / i) {
        v.push_back(n/i);
      }
    }
  }
  sort(v.begin(), v.end());
  for(long long x : v) {
    if(n / x - 1 > x) {
      ans += n / x - 1;
    }
  }
  cout<<ans;
  return 0;
}


Measured memory_bytes: 384
import math
ans = []
while True:
    ufo = []
    n = raw_input().split()
    if n == ["0", "0"]:
        for an in ans:
            print an
        break
    else:
        R = int(n[0])
        for i in range(int(n[1])):
            m = [int(f) for f in raw_input().split()]
            l = math.sqrt(m[0] ** 2 + m[1] ** 2)
            ufo.append([l, l, (m[0], m[1]), m[2], m[3]])
        a = 0
        while len(ufo) > 0:
            flag = True
            for xs in ufo: xs[0] -= xs[4]
            ufo.sort()
            for xs in ufo[:]:
                if xs[0] <= R:
                    a += 1
                    ufo.remove(xs)
                    continue
                elif flag:
                    r = xs[1]
                    pos = xs[2]
                    ufo.remove(xs)
                    flag = False
                    continue
                else:
                    d = xs[0] / xs[1] * abs(pos[0] * xs[2][1] - pos[1] * xs[2][0]) / r
                    if d <= xs[3]:
                        if xs[0] * math.cos(math.atan2(xs[2][1], xs[2][0]) - math.atan2(pos[1], pos[0])) + math.sqrt(xs[3] ** 2 - d ** 2) > R:
                            ufo.remove(xs)
        else:
            ans.append(a)

Measured memory_bytes: 4544
#include<bits/stdc++.h>
#define pb  push_back
#define mxn 100005
#define fst first
#define snd second
typedef long long ll;
using namespace std;
// Debuging
template<class Debug>
Debug debug (string x,Debug y){
	cout <<"[" << x <<" : "<< y <<"] ";
}
int main()
{
	int n;
	double k;
	cin >> n >> k;
	int ans=0;
	while(n--)
	{
		double x,y,dis;
		cin >> x >> y;
		x=abs(x),y=abs(y);
		dis=(x*x)+(y*y);
		dis=sqrt(dis);
		if (dis<=k)
			++ans;
	}
	cout << ans <<"\n";
	


 return 0;
}



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

using namespace std;

int main()
{
//    freopen("in.txt","r",stdin);
    int n;
    int s[15];
    int h[15];
    int c[15];
    int d[15];
    memset(s,1,sizeof(s));
    memset(h,1,sizeof(h));
    memset(c,1,sizeof(c));
    memset(d,1,sizeof(d));
    cin>>n;

    char ch;
    int in;
    for(int i=0; i<n; i++)
    {

        cin>>ch>>in;
        if(ch=='S')
            s[in]=0;
        if(ch=='H')
            h[in]=0;
        if(ch=='C')
            c[in]=0;
        if(ch=='D')
            d[in]=0;

    }
    for(int i=1; i<=13; i++)
    {
        if(s[i])
            cout<<"S "<<i<<endl;
    }
    for(int i=1; i<=13; i++)
    {
        if(h[i])
            cout<<"H "<<i<<endl;
    }
    for(int i=1; i<=13; i++)
    {
        if(c[i])
            cout<<"C "<<i<<endl;
    }
    for(int i=1; i<=13; i++)
    {
        if(d[i])
            cout<<"D "<<i<<endl;
    }



}



Measured memory_bytes: 3116
S = gets.chomp
T = gets.chomp

s2t = {}
t2s = {}
ans = "Yes"

S.length.times{|x|
    if (s2t[S[x]] != nil) and (s2t[S[x]] != T[x]) then
        ans = "No"
        break;
    end
    if (t2s[T[x]] != nil) and (t2s[T[x]] != S[x]) then
        ans = "No"
        break;
    end
    s2t[S[x]] = T[x]
    t2s[T[x]] = S[x]
}
#p s2t
#p t2s

puts ans


Measured memory_bytes: 2632
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;


int main()
{
    double r; cin >> r;
    cout << r * 2 * M_PI << endl;
    return 0;
}

Measured memory_bytes: 3776
#include<stdio.h>
int main(){
int a[13],i,j,b;
for(i=0;i<12;i++){
scanf("%d",&a[i]);
}
for(i=0;i<12;i++){
for(j=11;j>i;j--){
if(a[j-1]>a[j]){
b=a[j-1];
a[j-1]=a[j];
a[j]=b;
}
}
}
if(a[0]==a[3] && a[4]==a[7] && a[8]==a[11]){
printf("yes\n");
}
else{
printf("no\n");
}
return 0;
}


Measured memory_bytes: 2108
#include<bits/stdc++.h>
using namespace std;
int n,a[15],b[15],ans=0;
void solve(int i,long long mul=1) {
	if (i==n) {
		if (mul&1) return;
		ans++;return;
	}
	b[i]=a[i]-1;
	solve(i+1,mul*b[i]);
	b[i]=a[i];
	solve(i+1,mul*b[i]);
	b[i]=a[i]+1;
	solve(i+1,mul*b[i]);
}
int main() {
	scanf("%d",&n);
	for(int i=0;i<n;i++) scanf("%d",a+i);
	solve(0);
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const string YES = "Yes";
const string NO = "No";
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n - 1; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i <= n; i++)
#define FORR(i, m, n) for(int i = m; i >= n; i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define VSORTR(v) sort(v.rbegin(), v.rend());
#define ALL(v) (v).begin(),(v).end()
 
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll, ll>;


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

    string s; cin >> s;
    cout << ((s== "AAA" || s=="BBB") ? NO:YES) << endl;
}



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

int main() {
    int N;
    int i;
    int sum = 0;

    cin >> N;

    for (i = 0;i < N; i++) {
        int l, r;
        cin >> l >> r;

        sum += r - l + 1;
    }

    cout << sum << endl;
}

Measured memory_bytes: 3604
#include<bits/stdc++.h>
int i,j,k,l,n,s,t;
main(){while(true){std::cin>>n;s=0;t=sqrt(n)+1;if(!n){break;}for(i=0;i<t;i++){for(j=i;j<t;j++){for(k=j;k<t;k++){for(l=k;l<t;l++){if(i*i+j*j+k*k+l*l==n){s++;}}}}}printf("%d\n",s);}}

Measured memory_bytes: 1144
N=2**20-1
R=range
(n,q),c,*z=[[*map(int,t.split())]for t in open(0)]
t,*o=B=[0]*N
A=[[n]for _ in B]
for i in R(n):A[c[~i]]+=~i+n,
def P(a,x):
	i=a[-1]+1
	while i<=n:B[i]+=x;i+=i&-i
for i in A:P(i,1)
for x in sorted(i|z[i][0]<<40|z[i][1]<<20for i in R(q)):
	l,r,i=(x>>40)-1,x>>20&N,x&N
	while t<l:b=A[c[t]];P(b,-1);b.pop();P(b,1);t+=1
	while r:o[i]+=B[r];r-=r&-r
	while l:o[i]-=B[l];l-=l&-l
print(*o[:q])

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

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

    int ab = 0;
    int ba = 0;
    int result = 0;
    
    // ab
    rep(i, b){
      ab += a * pow(10, i);
    }

    rep(i, a){
      ba += b * pow(10, i);
    }

    if(a<=b){
      result = ab;
    } else {
      result = ba;
    }
    
    cout << result << endl; 

}


Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
int main(void)
{
    int n,a=0, b=0, c=0, d=0;
    scanf("%d",&n);
    char s[5];
    char s1[4]="AC";
    char s2[4]="WA";
    char s3[4]="TLE";
    char s4[4]="RE";
    for(int i=0;i<n;i++)
    {
        scanf("%s",&s);
        if(strcmp(s,s1)==0)
        {a++;}
       else if(strcmp(s,s2)==0)
        {b++;}
        else if(strcmp(s,s3)==0)
        {c++;}
       else if(strcmp(s,s4)==0)
        {d++;}
            }
    printf("AC x %d\nWA x %d\nTLE x %d\nRE x %d\n",a,b,c,d);
    return 0;
}

Measured memory_bytes: 1732
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 1000000000000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;



#define SIZE 13

int N,M,X;
int POW[SIZE],C[SIZE];
int table[SIZE][SIZE],work[SIZE];


int main(){

	POW[0] = 1;
	for(int i = 1; i < SIZE; i++){

		POW[i] = POW[i-1]*2;
	}

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

	for(int i = 0; i < N; i++){

		scanf("%d",&C[i]);

		for(int k = 0; k < M; k++){

			scanf("%d",&table[i][k]);
		}
	}

	int ans = BIG_NUM;
	bool FLG;

	for(int state = 0; state < POW[N]; state++){

		for(int i = 0; i < M; i++){

			work[i] = 0;
		}

		int sum = 0;

		for(int loop = 0; loop < N; loop++){
			if(state & POW[loop]){

				sum += C[loop];

				for(int k = 0; k < M; k++){

					work[k] += table[loop][k];
				}
			}
		}

		FLG = true;
		for(int i = 0; i < M; i++){
			if(work[i] < X){
				FLG = false;
				break;
			}
		}
		if(FLG){

			ans = min(ans,sum);
		}
	}

	if(ans == BIG_NUM){

		printf("-1\n");

	}else{

		printf("%d\n",ans);
	}

	return 0;
}


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

using namespace std;
#define sint(a) scanf("%d",&a)
#define sint2(a,b) scanf("%d %d",&a,&b)
#define sll(a) scanf("%lld",&a)
#define sll2(a,b) scanf("%lld %lld",&a,&b)
#define pb push_back
#define ll long long
const int maxn=2e6+10;
const int mod=1e9+7;
const double pi=-acos(-1);

int xx[maxn];
int main()
{
    int n,x,y;
    cin>>n>>x>>y;
    for(int i=1;i<n;i++)
    {
        for(int j=i+1;j<=n;j++)
        {
            int k=min(j-i,abs(x-i)+abs(y-j)+1);
            xx[k]++;
        }
    }
    for(int i=1;i<n;i++)
        printf("%d\n",xx[i]);
    return 0;
}


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

using namespace std;
using ll = long long int;
using P = pair<int, int>;

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

int main(void){

    string a, b;
    cin >> a >> b;

    b.pop_back();

    if(a == b) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}


Measured memory_bytes: 3636
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <map>

using namespace std;

int main() {
	int A, B, C, D;
	cin >> A >> B >> C >> D;
	int L, R;
	L = A + B;
	R = C + D;
	if (L > R) cout << "Left" << endl;
	else if (L == R) cout << "Balanced" << endl;
	else if (L < R) cout << "Right" << endl;
	return 0;
}

Measured memory_bytes: 3552
#include<iostream>
#include<string>
#include<list>
using namespace std;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    list<int> L;
    int n;
    cin >> n;
    for (int i = 0; i < n; i++) {
        string s;
        cin >> s;
        if (s == "deleteFirst") {
            L.pop_front();
            continue;
        }
        if (s == "deleteLast") {
            L.pop_back();
            continue;
        }
        int num;
        cin >> num;
        if (s == "insert") {
            L.push_front(num);
            continue;
        }
        if (s == "delete") {
            for (list<int>::iterator it = L.begin(); it != L.end(); it++) {
                if (*it == num) {
                    L.erase(it);
                    break;
                }
            }
        }
    }

    for (list<int>::iterator it = L.begin(); it != L.end();) {
        cout << *it;
        if (++it != L.end()) {
            cout << " ";
        } else {
            cout << endl;
        }
    }

    return 0;
}

Measured memory_bytes: 34472
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <cmath>
#define eps 1e-8
#define zero(x) (((x)>0?(x):-(x))<eps)

#define pause cout << " press ansy key to continue...",  cin >> chh
#define file_r(x) freopen(x,  "r",  stdin)
#define file_w(x) freopen(x,  "w",  stdout)
#define lowbit(x) ((x) & (-x))
#define repit(i, c) for (__typeof__((c).begin()) i = (c).begin(); i != (c).end(); i++)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repe(i, u) for (int i = head[u]; i != -1; i = nxt[i])
#define repd(i, n) for (int i = (n - 1); i >= 0; i--)
#define FOR(i, n, m) for (int i = (n); i <= (m); i++)
#define FORD(i, n, m) for (int i = (n); i >= (m); i--)
#define pb push_back
#define X first
#define Y second
#define ins insert
#define rb rbegin
#define be begin
#define er erase
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define SZ(c) (c).size()
#define ALL(c) (c).begin(), (c).end()
#define sqr(r) ((LL) (r) * (r))
#define dis(x1, y1, x2, y2) (((x1) - (x2)) * ((x1) - (x2)) + ((y1) - (y2)) * ((y1) - (y2)))
#define FASTIO ios::sync_with_stdio(false);cin.tie(0)

#define sc(x) cout << #x" = " << x << endl, system("pause")
#define sc2(x, y) cout << #x" = " << x << " " << #y" = " << y << endl, system("pause")
#define sc3(x, y, z) cout << #x" = " << x << " " << #y" = " << y << " " << #z" = " << z << endl, system("pause")
#define sc4(x, y, z, w) cout << #x" = " << x << " " << #y" = " << y << " " << #z" = " << z << " " << #w" = " << w << endl, system("pause")

#define in(n) scanf("%d", &n)
#define in2(n, m) scanf("%d %d", &n, &m)
#define in3(x, y, z) scanf("%d %d %d", &x, &y, &z)

using namespace std;
int chh;

typedef vector<int> vi;
typedef set<int> si;
typedef map<int, int> mii;
typedef pair<int, int> pii;
typedef pair<int, pii> pi3;
typedef vector< pair<int, int> > vpii;
typedef long long LL;

const int N = 105;

int n, m;
int dp[N][N], f[N][N];
char g[N][N];
int dx[2] = {0, 1};
int dy[2] = {1, 0};

void solve() {
    queue<pii> q;
    memset(dp, 127, sizeof(dp));
    memset(f, 0, sizeof(f));
    dp[0][0] = (g[0][0] != '.');
    q.push(mp(0, 0));
    while (!q.empty()) {
        int x = q.front().X, y = q.front().Y;
        q.pop(), f[x][y] = 0;
        rep (k, 2) {
            int u = x + dx[k], v = y + dy[k];
            if (u < 0 || u == n || v < 0 || v == m) continue;
            int w = dp[x][y] + (g[x][y] == '.' &&  g[u][v] == '#');
            if (dp[u][v] > w) {
                dp[u][v] = w;
                if (!f[u][v]) f[u][v] = 1, q.push(mp(u, v));
            }
        }
    }

}

int main() {
    while (~in2(n, m)) {
        rep (i, n) scanf("%s", g[i]);
        solve();
        printf("%d\n", dp[n - 1][m - 1]);
    }
    return 0;
}


Measured memory_bytes: 384
fun main() {
    val input = readLine()!!.split(" ").map { it.toInt() }
    val n = input[0]
    val k = input[1]
    val a = readLine()!!.split(" ").map { it.toInt() }.sorted()

    val sortedMap = a.groupingBy { it }.eachCount().toList().sortedBy { it.second }.toMap()

    var reduce = sortedMap.entries.size - k
    if (reduce <= 0) {
        print(0)
        return
    }

    var result = 0

    for (x in sortedMap) {
        result += x.value
        reduce -= 1

        if (reduce == 0) {
            print(result)
            return
        }
    }
}


Measured memory_bytes: 87336
#include <bits/stdc++.h>
//#include <iostream>
using namespace std;
int main() {
    int n;
    cin >> n;
    int ans=-1;

    for(int i=0;i<50000;i++){
        if((int)floor(i*1.08)==n) ans=i;
    }
    if(ans!=-1) cout << ans << endl;
    else cout << ":(" << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define sz(x) ((int)(x).size())
#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 debug(x) cout << #x << " => " << x << endl
using namespace std;

#define fi first
#define se second
#define mp make_pair
typedef pair<int,int> pii;

#define pb push_back
typedef vector<int> vi;

typedef long long ll;
typedef long double ld;

const int MAX_N = 7 + 100;
///----------------------------------------------
string str[MAX_N]; 
int main() {

	///read
	int n,l; cin>>n>>l;
	rep(i,0,n) cin>>str[i];

	///prework
	sort(str, str+n);

	///print
	rep(i,0,n) cout << str[i];

}


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

using namespace std;

#define int long long
#define ll long long
typedef pair<int, int> P;
#define mod 1000000007
#define INF (1LL<<60)

#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define YES cout << "YES" << endl;
#define Yes cout << "Yes" << endl;
#define NO cout << "NO" << endl;
#define No cout << "No" << endl;


signed main(){

	int A, B;
	cin >> A >> B;
	if (B%A == 0) cout << A + B << endl;
	else cout << B - A << endl;
//	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 764
#include<bits/stdc++.h>
using namespace std;
#define MAXN 100000

int N, counter[MAXN + 3], ans;

int main() {
    scanf("%d", &N);
    memset(counter, 0, sizeof(counter));

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

    ans = 0;
    for (int i = 0; i <= MAXN; i++) {
        int lower = (i == 0 ? 0 : counter[i - 1]);
        int same = counter[i];
        int higher = counter[i + 1];

        ans = max(ans, lower + same + higher);
    }

    printf("%d\n", ans);
}


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

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

    int N;
    cin >> N;
    string S;
    cin >> S;

    int x = 0;
    int res = 0;

    for (int i = 0; i < N; ++i){
        
        if(S[i] == 'I') x++;
        else x--;

        if(x > res) res = x;
    }

    cout << res << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N, K, x, l = 0;
  cin >> N >> K;  
  for(int i = 0; i < N; i++){
    cin >> x;
    if ( x > (K - x)) {
      l += (K - x) * 2;
    } else {
      l += x * 2;
    }
  }
  cout << l << endl;

}

Measured memory_bytes: 384
N, M = map(int, input().split())
if N == M == 1:
    print(1)
elif N == 1 or M == 1:
    print(N * M - 2)
else:
    # print(N * M - (2 * N + 2 * M - 4))
    print((N - 2) * (M - 2))


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

#define MAXN 100005
#define int long long
#define LL long long
#define pii pair<int, int>
#define fi first
#define se second
#define fastio ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);

using namespace std;

int n, m;
int d[MAXN];
int dp[MAXN];
vector<int> g[MAXN];
queue<int> q;

signed main() {
    cin >> n >> m;
    for (int i = 1; i <= m; i++) {
        int u, v;
        cin >> u >> v;
        g[u].push_back(v);
        d[v]++;
    }
    for (int i = 1; i <= n; i++) {
        if (d[i] == 0) q.push(i), dp[i] = 1;
    }
    int maxi = 0;
    while (!q.empty()) {
        int v = move(q.front());
        maxi = max(maxi, dp[v]);
        q.pop();
        for (int u: g[v]) {
            d[u]--;
            dp[u] = max(dp[u], dp[v]+1);
            if (d[u] == 0) q.push(u);
        }
    }
    cout << maxi-1 << endl;
    return 0;
}

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

int main(int argc,char* argv[])
{
    int n;
    cin>>n;
    if(n==1)cout<<"Hello World\n",exit(0);
    int a,b;
    cin>>a>>b;
    cout<<a+b<<endl;

    return 0;
}


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

def solve(A: int, B: int, N: int):
    x = min(N, B - 1)
    print(math.floor(A*x/B)-A*math.floor(x/B))
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    N = int(next(tokens))  # type: int
    solve(A, B, N)

if __name__ == '__main__':
    main()


Measured memory_bytes: 62164
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b) - 1;i>=(a);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)

#define PB push_back
#define INF INT_MAX/3
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define CLR(a) memset(a,0,sizeof(a))

typedef long long int ll;

using namespace std;

int main(){
    int d,c;
    cin >> d >> c;
    cout << d*c << endl;
    return 0;
}

Measured memory_bytes: 1160
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <climits>

#define rep(i, m, n) for(int i=int(m);i<int(n);i++)
#define EACH(i, c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s, e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())

//#define LOCAL 0
//#ifdef LOCAL
//#define DEBUG(s) cout << (s) << endl
//#define dump(x)  cerr << #x << " = " << (x) << endl
//#define BR cout << endl;
//#else
//#define DEBUG(s) do{}while(0)
//#define dump(x) do{}while(0)
//#define BR
//#endif


//改造
typedef long long int ll;
using namespace std;
#define INF (1 << 20)
#define INFl (ll)5e15
#define DEBUG 0 //デバッグする時1にしてね
#define dump(x)  cerr << #x << " = " << (x) << endl

//ここから編集する


int main() {
    int N;
    ll A,B;
    cin >> N >> A >> B;
    vector<ll> v(N);
    rep(i,0,N){
        cin >> v[i];
    }
    ll ans = 0LL;
    rep(i,0,N-1){
        if((v[i+1] - v[i]) * A > B){
            ans += 1LL*B;
        }else{
            ans += 1LL*(v[i+1] - v[i]) * A;
        }
//        ans += ((v[i+1]-v[i])*A,B);
    }

    cout << ans << endl;

}


Measured memory_bytes: 1024
import java.util.*;
import java.io.*;


public class Main{
	public static void main(String[] args) {
		Scanner sc= new Scanner(System.in);
		int a = Integer.parseInt(sc.next());
		int b = Integer.parseInt(sc.next());
		System.out.println((int)Math.ceil((a+b)/2.0));
		
	}
}



Measured memory_bytes: 21712
#include<iostream>
#include<vector>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<cstring>
#include<cctype>
#include<algorithm>
#include<queue>
#include<string>
#include<stack>
using namespace std;
typedef long long int llint;
int main(){
	llint N;
	cin >> N;
	cout << N/3 <<endl;
	return 0;
}

Measured memory_bytes: 256
s = input()
s = s[:len(s) - 1]
if len(s) % 2 != 0:
	s = s[:len(s) - 1]

while True:
	mid = int(len(s) / 2)
	if s[:mid] == s[mid:]:
		print(len(s))
		break
	else:
		s = s[:len(s) - 1]

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a,b,c,d;
	int min(int a,int b);
	scanf("%d%d%d%d",&a,&b,&c,&d);
	a=min(a,b);
	c=min(c,d);
	printf("%d\n",a+c);
	return 0;
}
int min(int a,int b)
{
	if(a<b)
		return a;
	else
		return b;
}


Measured memory_bytes: 256
macro_rules! get {
    ($t:ty) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t:ty),*) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            (
                $(iter.next().unwrap().parse::<$t>().unwrap(),)*
            )
        }
    };
    ($t:ty; $n:expr) => {
        (0..$n).map(|_|
                    get!($t)
        ).collect::<Vec<_>>()
    };
    ($($t:ty),*; $n:expr) => {
        (0..$n).map(|_|
                    get!($($t),*)
        ).collect::<Vec<_>>()
    };
    ($t:ty |) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.split_whitespace()
                .map(|t| t.parse::<$t>().unwrap())
                .collect::<Vec<_>>()
        }
    };
    ($t:ty | $n:expr) => {
        (0..$n).map(|_| get!($t |)).collect::<Vec<_>>()
    };
}

fn main() {
    let N = get!(usize);
    let As = get!(u64 |);
    let A0 = As[0];
    if As.iter().skip(1).fold(A0, |p, c| p ^ c) == 0 {
        println!("Yes");
        return;
    }
    println!("No");
}


Measured memory_bytes: 6396
s = input()
t = input()
n = len(s)
m = len(t)
ans = []
for i in range(n-m+1):
    flag = True
    for j in range(m):
        if s[i+j]!="?" and s[i+j]!=t[j]:
            flag = False
            break
    if flag:
        tmp = (s[:i] + t + s[(i+m):])
        a = []
        for j in range(n):
            if tmp[j]=="?":
                a.append("a")
            else:
                a.append(tmp[j])
        tmp = "".join(a)
        ans.append(tmp)

ans.sort()

if len(ans)>0:
    print(ans[0])
else:
    print("UNRESTORABLE")

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

public class Main{
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int n = input.nextInt();
        int[] array = new int[n];
        for (int i = 0; i < n; i++) {
            array[i] = input.nextInt();
        }

        Arrays.sort(array);
        int numOfQuestion = input.nextInt();
        //int[] question = new int[numOfQuestion];
        int count = 0;
        for (int i = 0; i < numOfQuestion; i++) {
            int question = input.nextInt();
            if(BinarySearch(array,question)){
                count++;
            }
        }
        System.out.println(count);
    }

    public static boolean BinarySearch(int[] array, int num){
        int low = 0;
        int height = array.length - 1;
        while (low <= height){
        	 int mid = (low+height)/2;
            if(num == array[mid]){
                return true;
            }else if(num > array[mid]){
                low = mid + 1;
            }else {
                height = mid - 1;
            }
        }
        return false;
    }
}



Measured memory_bytes: 67484
#include <iostream>
#include <algorithm>

using namespace std;

typedef long long ll;

int main() {
    ll n;   cin >> n;
    ll *a = new ll[n];
    for (int i = 0; i < n; i++)
        cin >> a[i];

    sort(a, a+n, greater<int>());

    ll i = 0;
    
    while (i+1 < n && a[i] != a[i+1])
        i++;
    
    ll j = i+2;
    while (j+1 < n && a[j] != a[j+1])
        j++;

    if (j >= n-1)
        cout << 0 << endl;

    else 
        cout << a[i] * a[j] << endl;

    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
int a[100005];
int main(){
int n,t;
scanf("%d",&n);
for(int i=0;i<n;++i){
 scanf("%d",&t);
++a[t];
}
int ans=0;
for(int i=0;i<100005;++i){
   if(a[i])   ans=max(ans,a[i-1]+a[i]+a[i+1]);
}
printf("%d\n",ans);
}
     

Measured memory_bytes: 640
S = gets.chomp
K = gets.to_i

def go(a, s, acc)
  return acc if acc.size == K
  if i = a.index{|c| S.include?(s + c)}
    acc << (s += a[i])
    a.delete_at(i)
  else
    a = S.split(//).sort
    s = a.find{|c| c > s[0]}
    acc << s
    a.delete(a.index(s))
  end
  go(a, s, acc)
end

puts go(S.split(//).sort, '', []).last

Measured memory_bytes: 2296
#include<stdio.h>
int main()
{
  int n,i,j, a[110],temp,cnt,mini;
    while(scanf("%d",&n)==1)
    {
      cnt=0;
        for(i=0;i<n;i++)
        {
            scanf("%d",&a[i]);
        }
        for(i=0;i<n;i++)
        {
            mini=i;
            for(j=i;j<n;j++)
            if(a[j]<a[mini])
            {
                mini=j;
            }
                if(i!=mini)
                {
                 temp=a[i];
                a[i]=a[mini];
                a[mini]=temp;
                cnt++;
                }
        }
        for(i=0;i<n;i++)
           {
             printf("%d",a[i]);
             if(i<n-1)
                printf(" ");
           }
           printf("\n%d\n",cnt);
    }
    return 0;
    }

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

using namespace  std;

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

	string  s;
	cin >> s;

	if (n == 1) {
		cout << 0 << endl;
	}

	else {
		int cnt_1 = 1;
		int cnt_2 = 0;
		char d = s.at(0);

		for (int i = 1; i < n; i++) {
			if (s.at(i) != d) {
				cnt_1 += 1;
				d = s.at(i);
			}

			else {
				cnt_2 += 1;
			}
		}

		if (cnt_1 % 2 == 0) {
			if ((cnt_1 - 2) / 2 >= k) {
				cout << cnt_2 + k * 2 << endl;
			}
			else{
				cout << n - 1 << endl;
			}
		}

		else {
			if ((cnt_1 - 1) / 2 >= k) {
				cout << cnt_2 + k * 2 << endl;
			}
			else {
				cout << n - 1 << endl;
			}
		}
	}
}

Measured memory_bytes: 512
S = input()
N = 3


def add(n, s):
    if n == 0:
        #print(s)
        if eval(s) == 7:
            results.append(s)
        return 1
    else:
        sp = s[:n] + '+' + s[n:]
        sm = s[:n] + '-' + s[n:]
        return add(n-1, sp) + add(n-1, sm)

results = []
_ = add(N, S)
print(results[0]+'=7')

Measured memory_bytes: 3060