akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/range/adaptor/reversed.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
typedef long long int ll;

#define PI (acos(-1))
#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define dumparr(x) cerr << #x ; for(auto elem: x){cerr << " " << elem;} cerr << endl;
#define dumppairs(x) cerr << #x ; for(auto elem: x){cerr << "(" << elem.first << " " << elem.second << ") ";} cerr << endl;
#define dumpline cerr << "**********************" << endl;
#define dumpwline(x) cerr << "******** " << #x << "=" << (x) << " ********" << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))

int main(void){
    ll n; cin >> n;
    vector <ll> as;
    ll tot = 0;
    REP(i, n){
        ll a; cin >> a;
        as.push_back(a);
        tot += a;
    }
    ll best_diff = 1e18;
    ll subtot = 0;
    REP(i, n){
        subtot += as[i];
        ll diff = abs(subtot*2 - tot);
        if (diff <= best_diff){
            best_diff = diff;
        }
    }
    cout << best_diff << endl;
    return 0;
}

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

int main() {
  int n,a;
  cin>> n >> a;
  int ans;
  ans=n%500;
  if(ans==0){
  cout<<"Yes"<<endl;
  }
  if(ans!=0){
  if(ans<=a){
  cout<<"Yes"<<endl;}
  else{
  cout<<"No"<<endl;}}
}

Measured memory_bytes: 3560
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main(){
	ios_base::sync_with_stdio(0);cin.tie(0);
	ll a,b,n;cin >> a >> b >> n;
	ll x = min(b-1,n);
	ll ans = (a*x/b)-(a*(x/b));
	cout << ans << '\n';
}

Measured memory_bytes: 3632
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define irep(it, stl) for(auto it = stl.begin(); it != stl.end(); it++)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout << (ans) << '\n'
#define STLL(s) strtoll(s.c_str(), NULL, 10)
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int;
#define endl '\n';
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
template <class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;} return 0;}
template <class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;} return 0;}
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);}};
const int INF = INT_MAX;
const ll LLINF = 1LL<<60;
const ll MOD = 1000000007;
const double EPS = 1e-9;




int main() {
    
    int n;
    cin>>n;
    bool ch=true;
    vi t(n+1),x(n+1),y(n+1);
    t[0]=0;x[0]=0;y[0]=0;
    rep(i,n)cin>>t[i+1]>>x[i+1]>>y[i+1];
    rep(i,n){
        int dxy=abs(x[i]-x[i+1])+abs(y[i]-y[i+1]);
        int dt=abs(t[i]-t[i+1]);
        if(dxy>dt)ch=false;
        if(dxy%2!=dt%2)ch=false;
    }
    if(ch)fin("Yes");
    else fin("No");
}


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

#define rep(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define rng(i, a, b) for (int (i) = (a); (i) < (b); (i)++)
#define rbf(i, v) for (auto& (i) : (v))
#define All(x) (x).begin(),(x).end()
#define cAll(x) (x).cbegin(),(x).cend()
#define COL(x) cout << x << endl
#define CO(x) cout << x
//#define int long long

template<typename T> inline constexpr auto sqr(T x) { return (x) * (x); }
void printd(double x) { printf("%.10lf\n", x); }

typedef long long LL;
typedef unsigned long long ULL;
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef vector<PII> VP;

const double PI = 3.141592653589793;
const int MOD = 1000000007;
const int INF = INT_MAX;

signed main()
{
	int H,A;
	cin >> H >> A;

	double num = static_cast<double>(H) / A + 0.99999999;
	int ans = static_cast<int>(num);

	COL(ans);

	return 0;
}

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

string reverse(const string& str) {
	string ret;
	string::const_reverse_iterator it = str.rbegin();
	for (; it != str.rend(); it++) {
		ret.push_back(*it);
	}
	return ret;
}

int main()
{
	int N;
	cin >> N;
	for (int i = 0; i < N; i++) {
		string S1;
		string S2;
		int overflow = 0;
		cin >> S1 >> S2;
		if (S1.size() > 80 || S2.size() > 80) {
			cout << "overflow";
		}
		else {
			S1 = reverse(S1);
			S2 = reverse(S2);
			S1.resize(80, '0');
			S2.resize(80, '0');
			int a = 0;
			for (int i = 0; i < 80; i++) {
				S1[i] += S2[i] - '0';
				if (S1[i] > '9') {
					if (i + 1 > 79) {
						cout << "overflow";
						overflow++;
					}
					S1[i + 1] += 1;
					S1[i] -= 10;
				}
				if (S1[i] != '0')
					a = i;
			}
			S1 = reverse(S1);
			if (overflow == 0)
				for (int i = 79 - a; i < 80; i++) {
					cout << S1[i];
				}
		}
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 3008
#include "bits/stdc++.h"
using namespace std;
#define forn(i, x, n) for (int i = x; i < n; i++)
#define all(a) (a).begin(), (a).end()
#define pii pair<int, int>
#define pll pair<ll, ll>
typedef long double ld;
typedef long long ll;

const int N = 100000;
vector<int> s[N];
int dsu[N];
int k[N];
int p[N];

int find(int x) {
    while (x != k[x]) x = k[x];
    return x;
}

void unite(int a, int b) {
    a = find(a);
    b = find(b);
    if (s[a] < s[b]) swap(a,b);
    dsu[a] += dsu[b];
    k[b] = a;
}

int main() {
    int n, m;
    scanf("%d %d", &n, &m);
    forn(i, 0, n) {
        int x;
        scanf("%d ", &x);
        x--;
        p[i] = x;
        k[i] = i;
        dsu[i] = i;
    }
    forn(i, 0, m) {
        int x, y;
        scanf("%d %d", &x, &y);
        x--; y--;
        s[x].push_back(y);
        s[y].push_back(x);
    }
    forn (i, 0, n) {
        for (int x : s[i]) {
            unite(i, x);
        }
    }
    int ans = 0;
    forn(i, 0, n) {
//        cout << dsu[i] << endl;
        if (find(p[i]) == find(i)) {
            ans++;
        }
    }
    printf("%d\n", ans);
    return 0;
}


Measured memory_bytes: 6912
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {


		Scanner sc = new Scanner(System.in);
		int k = sc.nextInt();
		int s = sc.nextInt();
		int answer = 0;
		for(int x = 0;x <= k;x++) {
			if(x > s) {
				break;
			}
			for(int y = 0;y <= k;y++) {
				if(x + y > s) {
					break;
				}else {
					if(x + y + k >= s) {
						answer++;
					}
				}
			}
		}
		System.out.println(answer);
	}
}

Measured memory_bytes: 23252
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
#define rep(i,n) for(int i = 0; i < ((int)(n)); i++)   // 0-indexed昇順

int main() {
    int X, A;
    cin >> X >> A;
    cout << ((X < A) ? 0 : 10) << endl;
}

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

using namespace std;
const int mx = 1e2+25;
int x, y;
char image[mx][mx];
int main() {
	cin >> x >> y;
	for (int i = 0; i <= x + 1; ++i) {
		image[i][0] = '#';
		image[i][y + 1] = '#';
	}
	for (int i = 0; i <= y + 1; ++i) {
		image[0][i] = '#';
		image[x + 1][i] = '#';
	}
	for (int i = 1; i <= x; ++i) {
		for (int j = 1; j <= y; ++j) {
			cin >> image[i][j];
		}
	}
	for (int i = 0; i <= x + 1; ++i) {
		for (int j = 0; j <= y + 1; ++j) {
			cout << image[i][j];
		}
		cout << endl;
	}
}

Measured memory_bytes: 256
N = int(input())
XL = sorted([list(map(int,input().split())) for _ in range(N)], key=lambda x: x[0]+x[1])
n = 1
S_,T_ = XL[0][0]-XL[0][1], XL[0][0]+XL[0][1]
for i in range(1,N):
  S,T = XL[i][0]-XL[i][1], XL[i][0]+XL[i][1]
  if not (S < T_):
    n += 1
    S_,T_ = S,T
print(n)

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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

void Main() {
   int N;
   cin >> N;
   string S;
   cin >> S;
   int ans = 0;
   rep(i, N) {
       if (i + 2 < N && S[i] == 'A' && S[i + 1] == 'B' && S[i + 2] == 'C') {
           ans ++;
       }
   }
   cout << ans << '\n';
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<math.h>

int main(){
    int n;
    int s,m,mm,h;
    scanf("%d",&n);
    s=n%60;
    mm=n/60;
    m=mm%60;
    h=mm/60;
    printf("%d:%d:%d\n",h,m,s);
    return 0;
}


Measured memory_bytes: 2092
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ul;
typedef signed long long ll;
ul over = 1000000007;

void dfs(string & s, int idx, int pre, string a, string b, unordered_map< string, ul > & m) {
  if (idx * 2 == s.size()) {
    if (pre == 0) {
      reverse(b.begin(), b.end());
    } else {
      reverse(a.begin(), a.end());
    }
    string tgt = a+"+"+b;
    if (m.count(tgt) == 0) {
      m[tgt] = 1;
    } else {
      m[tgt]++;
    }
    return;
  }
  dfs(s, idx+1, pre, a+s[idx+pre], b, m);
  dfs(s, idx+1, pre, a, b+s[idx+pre], m);
}

int main(void)
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed;
  int n;
  string s;
  cin >> n >> s;
  unordered_map< string, ul > one, two;
  dfs(s, 0, 0, "", "", one);
  dfs(s, 0, n, "", "", two);
  ul ans = 0;
  for (auto itr : one) {
    if (two.count(itr.first) > 0) {
      //cout << itr.first << "/" << itr.second << "/" << two[itr.first] << endl;
      ans += itr.second * two[itr.first];
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 69236
#include <cstdio>
#include <vector>
#include <cmath>
#include <algorithm>

using namespace std;

#define reep(i,f,n) for(int i=f; i<int(n); ++i)
#define rep(i,n) reep(i,0,n)

typedef vector<int> vi;

int main()
{
	int n;
	scanf("%d", &n);
	rep(i, n){
		double x1, y1, x2, y2, x3, y3;
		scanf("%lf%lf%lf%lf%lf%lf", &x1, &y1, &x2, &y2, &x3, &y3);
		double a1 = 2.0*(x2-x1);
		double b1 = 2.0*(y2-y1);
		double c1 = x1*x1 - x2*x2 + y1*y1 - y2*y2;
		double a2 = 2.0*(x3-x1);
		double b2 = 2.0*(y3-y1);
		double c2 = x1*x1 - x3*x3 + y1*y1 - y3*y3;

		double px = (b1*c2-b2*c1)/(a1*b2-a2*b1);
		double py = (c1*a2-c2*a1)/(a1*b2-a2*b1);
		printf("%.3f %.3f %.3f\n", px, py, sqrt((px-x1)*(px-x1) + (py-y1)*(py-y1)));
	}

	return 0;
}

Measured memory_bytes: 0
#include <stdio.h>

int main(void){
   int L;
   int R;
   int N;
   int i;
   int j;
   int M;
     
     
   scanf("%d %d", &L, &R);
   if(R%2019==0||L%2019==0){
     i=0;
     printf("%d",i);
   }else if((R/2019)!=(L/2019)){
     i=0;
       printf("%d",i);
   }else{
     L=L%2019;
     R=R%2019;
     N=(L*L)%2019;
     M=2018;
     for(i=L;i<R;i++){
	 for(j=i+1;j<R+1;j++){
	   N=(i*j)%2019;
	 if(M>N){
	   M=N;
	 }
	 }
     }
     printf("%d",M);
   }
}
     
     

Measured memory_bytes: 128
//#include "bits/stdc++.h"
#include <iostream>
#include <vector>
#include <map>
#include <utility>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <stack>
#include <queue>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <numeric>
#include <complex>
#include <bitset>
#include <functional>
#include <stack>
#include <regex>
#include <tuple>

#define int long long
#define REP(i,a,n) for(int i=a;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define REV(i,a,n) for(int i=n;i>=a;--i)
#define all(e) e.begin(),e.end()
#define rall(e) e.rbegin(),e.rend()
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
#define mod 1000000007
#define show(n) cerr<<#n<<" = "<<n<<endl
#define showp(n) cerr<<n.fs<<", "<<n.sc<<endl
#define shows(n) for(auto z:n){cerr<<z<<", ";}cerr<<endl
#define showsp(n) for(auto z:n){cerr<<z.fs<<" "<<z.sc<<", "}cerr<<endl

#define yes printf("Yes\n")
#define no printf("No\n")
#define case(i) printf("Case #%lld: ",i)

using namespace std;

using ull=unsigned long long;
using vi=vector<int>;
using pint=pair<int,int>;

const int INF=1LL<<55;

vector<bool> IsPrime;
vi pn;

int n;

void sieve(size_t max){
    if(max+1 > IsPrime.size()){
        IsPrime.resize(max+1,true);
    } 
    IsPrime[0] = false;
    IsPrime[1] = false;

    for(size_t i=2; i*i<=max; ++i)
        if(IsPrime[i])
            for(size_t j=2; i*j<=max; ++j)
                IsPrime[i*j] = false;
}

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

    sieve(277800);
    REP(i,1,55556) if(IsPrime[i]&&i%5==1) pn.pb(i);

    cin>>n;

    rep(i,n){
        cout<<pn[i];
        if(i+1!=n) cout<<" ";
    }
    cout<<endl;
    return 0;
}


Measured memory_bytes: 384
#include <iostream>
#define _USE_MATH_DEFINES
#include <cmath>
#include <iomanip>
#include <vector>
using namespace std;
typedef vector<int> Dice;
//---------------------------------------
void roll_n(Dice &dice);
void roll_e(Dice &dice);
void roll_s(Dice &dice);
void roll_w(Dice &dice);

//---------------------------------------

int main(void)
{
	Dice dice;
	int num;
	string rolling;
	
	for(int i = 0; i < 6; i++){
		cin >> num;
		dice.push_back(num);
	}
	cin >> rolling;
	
	for(int i = 0; i < rolling.size(); i++){
	
		switch(rolling[i]){
		case 'N' :
			 roll_n(dice);
			 break;
		case 'E' :
			 roll_e(dice);
			 break;
		case 'S' :
			 roll_s(dice);
			 break;
		case 'W' :
			 roll_w(dice);
			 break;
		}
	}
	
	cout << dice[0] << endl;
	
	
	return 0;
	
}
//-------------------------------------
void roll_n(Dice &dice)
{
	Dice copy = dice;
	
	dice[4] = copy[0];
	dice[5] = copy[4];
	dice[1] = copy[5];
	dice[0] = copy[1];
}

//--------------------------------------
void roll_e(Dice &dice)
{
	Dice copy = dice;
	
	dice[0] = copy[3];
	dice[2] = copy[0];
	dice[5] = copy[2];
	dice[3] = copy[5];
}

//--------------------------------------
void roll_s(Dice &dice)
{
	Dice copy = dice;
	
	dice[1] = copy[0];
	dice[5] = copy[1];
	dice[4] = copy[5];
	dice[0] = copy[4];
}

//--------------------------------------
void roll_w(Dice &dice)
{
	Dice copy = dice;
	
	dice[3] = copy[0];
	dice[5] = copy[3];
	dice[2] = copy[5];
	dice[0] = copy[2];
}
/*
Top  [0]
Front [1]
Right [2]
Left [3]
Back [4]
Bottom [5]
*/

Measured memory_bytes: 3136
#include <stdio.h>

int main()
{
  int n;
  int a[1000][1000];
  int next[1000];
  int day=0;
  scanf("%d", &n);
  int i,j;
  for (i = 0; i < n; i++) {
    next[i]=0;
    for (j = 0; j < n-1; j++) {
      scanf("%d", &a[i][j]);
      a[i][j]--;
    }
    a[i][n]=-1;
  }
  int flag=1;
  int finished=1;
  int today[1000];
  int vs;
  while(flag){
    day++;
    for(i=0;i<n;i++) today[i]=0;
    flag=0;
    for(i=0;i<n;i++){
      vs=a[i][next[i]];
      if(vs>=0 && a[vs][next[vs]]==i){
        today[i]=1;
        today[vs]=1;
      }
    }
    for(i=0;i<n;i++){
      if(today[i]){
        next[i]++;
        flag=1;
      }
    }
    if(flag==0){
      day=-1;
    }else{
      finished=1;
      for(i=0;i<n;i++){
        if(next[i]<n-1) finished=0;
      }
      if(finished) flag=0;
    }
  }
  printf("%d\n",day);
  return 0;
}


Measured memory_bytes: 4096
import sys

sys.setrecursionlimit(10**7)

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

k = ni()
a, b = na()
for i in range(1, b//k+2):
    if a <= i*k <= b:
        print('OK')
        exit(0)
print('NG')

Measured memory_bytes: 9192
#include <bits/stdc++.h>
const double PI = acos(-1);
#define rep(i, n) for (int i = 0; i < (int)(n); i++ )
using namespace std;
int findSumOfDigits(int n) {
  int sum = 0;
  while (n > 0) { // n が 0 になるまで
    sum += n % 10;
    n /= 10;
  }
  return sum;
}
int main(){
  string s;
  cin >> s;
  vector<int> num(26);
  vector<int> counter(10000);
  rep(i,26) num.at(i) = 'a' + i;
  rep(i,s.size()) rep(j,26){
    if(s.at(i) == num.at(j)) counter.at(num.at(j))++;
  } 
  for(int i = 0;i<26;i++){
    string ans = "None";
    if(counter.at(num.at(i)) == 0){
      ans = num.at(i);
      cout << ans << endl;
      break;
    }
    if(i == 25) cout << ans << endl;

  }

}

Measured memory_bytes: 3744
def hantei(n, m, l, d ):
    if (n*10000+m*5000+l*1000)==d:
        return True
    return False

osatu,sum = map(int,input().split())

#n　一万円
#m　五千円
#l　千円
n=m=l=0
result=0

while(n <= osatu):
    while(m+n <= osatu):
        l=osatu-n-m
        if n+m+l==osatu:
            if hantei(n,m,l,sum)==True:
                print(n,m,l)
                exit (0)
        m+=1
    m=0
    n+=1


print("-1 -1 -1")




Measured memory_bytes: 3064
//#include <bits/stdc++.h>
#include<vector>
#include<iostream>
#include <iomanip>
 
using namespace std;
 
typedef long long LL;
typedef long double LD;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;
typedef pair<LD, LD> PLDLD;
typedef vector<int> VI;
typedef vector<LL> VLL;
typedef vector<char> VB;
 
#define FOR(i,a,b) for(int i=(a);i<(int)(b);++i)
#define REP(i,n) FOR(i,0,n)
#define CLR(a) memset((a), 0 ,sizeof(a))
#define ALL(a) a.begin(),a.end()
 
const LD eps=1e-10;
const long long INFLL=(LL)(1e9)*(LL)(1e9);
const int INF=1e9;
 
template<class T>
void chmin(T& a, const T b)
{
	if(a>b)
		a=b;
}
template<class T>
void chmax(T& a, const T b)
{
	if(a<b)
		a=b;
}
 
const LL pow(const LL p, const LL q)
{
	LL t=1;
	for(int i=0;i<q;i++)
		t*=p;
	return t;
}

template <typename T>
struct has_iter
{
	private:
		template <typename U>
		static constexpr true_type check(typename U::iterator*);
		template <typename U>
		static constexpr false_type check(...);

	public:
		static constexpr bool value = decltype(check<T>(nullptr))::value;
};


template<typename T, typename U = typename T::iterator>
void print(const T& container)
{
		auto&& first=begin(container), last=end(container);
		auto&& back=prev(last);
		for(auto e=first; e!=last; e=next(e))
			cout<<*e<<" \n"[e==back];
}


extern void* enabler;
template<typename Head, typename enable_if<!has_iter<Head>::value>::type*& = enabler>
void print(const Head& head)
{
	cout<<head<<endl;
}

template<> void print<string>(const string& container)
{
	cout<<container<<endl;
}

template<typename Head, typename... Tail>
void print(const Head& head, const Tail&... tail)
{
	cout<<head<<" ";
	print(tail...);
}

void io_speedup()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
}

template<typename T>
istream& operator >> (istream& is, vector<T>& vec)
{
	for(T& x: vec) is >> x;
	return is;
}


template<typename T, typename U>
ostream& operator << (ostream& os, const pair<T, U>& p)
{
	os<<'('<<p.first<<", "<<p.second<<')';
	return os;
}

template<typename T>
vector<T> read(int n)
{
	vector<T> t(n);
	cin>>t;
	return t;
}

template<typename T>
T read()
{
	T t;
	cin>>t;
	return t;
}


template<unsigned int N> struct IsPrime {
	static const int size=(N>>5) + 1;
	unsigned int is_prime[size];
	constexpr IsPrime() : is_prime() {
		is_prime[0]=0x3;
		for(unsigned int i=2;i<N;i++)
		{
			if((is_prime[i>>5] & (1u<<(i&0x1f))) > 0)  continue;
			for(int j=i+i;j<N;j+=i)
				is_prime[j>>5]|=(1u<<(j&0x1f));
		}
	}
	constexpr bool operator[] (const int p) const
	{
		return (is_prime[p>>5] & (1u<<(p&0x1f))) == 0;
	}
};

template<int N> struct LikelyPrime {
	unsigned short sum[N+1];
	constexpr LikelyPrime(const IsPrime<N> pr) : sum() {
		for(int i=3;i<N;i++)
			sum[i+1]=sum[i]+(unsigned short)((pr[i] && pr[(i+1)/2])?1:0 );
	}
};

int q;
int l,r;
int main()
{
	cin.tie(0);
	cout.tie(0);
	ios::sync_with_stdio(false);

	constexpr IsPrime<100001> pr;
	constexpr LikelyPrime<100001> s(pr);
	cin>>q;
	while(q--)
	{
		cin>>l>>r;
		cout<<s.sum[r+1]-s.sum[l]<<"\n";
	}
}


Measured memory_bytes: 896
#include<bits/stdc++.h>
using namespace std;
int main()
{
long long i,j,k=0,l,n,m;
	cin>>m;
	string s[m];
	for(i=0;i<m;i++)
	{
		cin>>s[i];
		sort(s[i].begin(),s[i].end());
	}
   map<string,long long> mymap;
  	for(i=0;i<m;i++)
	{
    if(mymap.find(s[i]) == mymap.end())
    {
        // initialize it explicitly
        mymap[s[i]]=1;
    }
    else
    {
        // it has a value, now you can use it, increment it, whatever
        mymap[s[i]]++;
    }
   }
   map<string,long long>::iterator itr;
   for(itr=mymap.begin();itr!=mymap.end();itr++)
   {
   	j=itr->second;
   	k=k+((j)*(j-1))/2;
   }
	cout<<k;
	return 0;	
}

Measured memory_bytes: 18176
#include <stdio.h>

int main() {
    int A,B,X,cat;
    scanf("%d %d %d",&A,&B,&X);
    
    cat = X-A ;

    if (cat<0) {
        printf("NO\n");
    } else if (cat <= B) {
        printf("YES\n");
    }else printf("NO\n");

    
    
    
    return 0;
}


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

// iterator
#define REP(i,init, n) for(lli i=init;i<n;i++)
#define REPE(i,init, n) for(lli i=init;i<=n;i++)
#define REPIT(it,container) for(auto it = container.begin(); it != container.end(); it++)
#define REPIT_R(it,container) for(auto it = container.rbegin(); it != container.rend(); it++)

// input
#define cin1(x)             cin >> x
#define cin2(x, y)          cin >> x >> y
#define cin3(x, y, z)       cin >> x >> y >> z
#define ncin1(n, x)         REP(i, 0, n) {cin1(x[i]);}
#define ncin2(n, x, y)      REP(i, 0, n) {cin2(x[i], y[i]);}
#define ncin3(n, x, y, z)   REP(i, 0, n) {cin3(x[i], y[i], z[i]);}

#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))

typedef long long int lli;
typedef pair<lli, lli> P;

lli dp[101][101][301]; // dp[i][j][k]: i 個目まで使える状態で、j 個使って重さ k を満たす最大の価値

int main() {
    lli n, W;
    cin2(n, W);
    lli w[n], v[n];
    REP(i, 0, n) {
        cin >> w[i] >> v[i];
    }
    lli w0 = w[0];
    REP(i, 0, n) {
        w[i] -= w0;
    }

    REPE(i, 1, n) {
        REPE(j, 1, i) {
            REPE(k, 0, 3*n) {
                if (k-w[i-1] < 0) {
                    dp[i][j][k] = dp[i-1][j][k];
                }
                else {
                    dp[i][j][k] = max(dp[i-1][j][k], dp[i-1][j-1][k-w[i-1]] + v[i-1]);
                }
                //cout << "dp[" << i << "][" << j << "][" << k << "]: " << dp[i][j][k]  << endl;
            }
        }
    }
    lli ans = 0;
    REPE(j, 1, n) {
        REPE(k, 0, 3*n) {
            if (j*w0 + k > W)
                continue;
            //cout << "dp[" << n << "][" << j << "][" << k << "]: " << dp[n][j][k]  << endl;
            ans = max(ans, dp[n][j][k]);
        }
    }

    cout << ans << endl;
}


Measured memory_bytes: 22272
def solve():
    can_positive = False
    if len(p) > 0:
        if k<n:
            can_positive = True
        else:
            can_positive = len(m) % 2 == 0
    else:
        can_positive=k%2==0
    if not can_positive:
        m.sort(reverse=True)
        return m[:k]+p
    p.sort()
    m.sort(reverse=True)
    a = [p.pop()] if k % 2 else [1]
    while len(p) >= 2:
        a.append(p.pop()*p.pop())
    while len(m) >= 2:
        a.append(m.pop()*m.pop())
    return a[:1] + sorted(a[1:], reverse=True)[:(k-k%2)//2]

mod = 10**9+7
n, k = list(map(int, input().split()))
m, p = [], []
for i in map(int, input().split()):
    if i < 0:
        m.append(i)
    else:
        p.append(i)
ans = 1
for i in solve():
    ans = ans * i % mod
print(ans)

Measured memory_bytes: 33148
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define watch(x) cout <<(#x)<<" is "<<(x)<<endl
#define debug cout <<"hi"<<endl
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
const int MOD=1e9+7;
const int INF32=1<<30;
const ll INF64=1LL<<60;

int main(){
  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  ll n,w; cin >>n >>w; 
  ll W[n],V[n],dp[n+1][100001];
  for(int i=0; i<=n; i++) for(int j=0; j<=100000; j++) dp[i][j]=INF64;
  for(int i=0; i<n; i++) cin >>W[i] >>V[i]; dp[0][0]=0;
  for(int i=0; i<n; i++) for(int j=0; j<=100000; j++){
    dp[i+1][j]=dp[i][j];
    if(j>=V[i]) dp[i+1][j]=min(dp[i+1][j],dp[i][j-V[i]]+W[i]);
  }
  for(int j=100000; j>=0; j--) if(dp[n][j]<=w){cout <<j; break; }
return 0;}

Measured memory_bytes: 82528
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Console;
using static System.Math;

namespace AtTest.HUPC_day2
{
    class C
    {

        static void Main(string[] args)
        {
            Method(args);
        }

        static void Method(string[] args)
        {
            int[] xyz = ReadInts();
            int x = xyz[0];
            int y = xyz[1];
            int z = xyz[2];

            if((x*y)%2==1|| (y * z) % 2 == 1||(z* x)% 2 == 1)
            {
                WriteLine("Hom");
            }
            else
            {
                WriteLine("Tem");
            }
        }

        private static string Read() { return ReadLine(); }
        private static char[] ReadChars() { return Array.ConvertAll(Read().Split(), a => a[0]); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
    }
}



Measured memory_bytes: 17960
n = int(input())
x = list(map(float, input().split()))
y = list(map(float, input().split()))

def minc_dis(n, x, y, p):
    sum = 0
    for i in range(n):
        sum = sum + (abs(x[i] - y[i])) ** p
    return sum ** (1/p)

def cheb_dis(n, x, y):
    dis = 0
    for i in range(n):
        dif = abs(x[i] - y[i])
        if dis < dif:
            dis = dif
    return dis

for p in range(1 , 4):
    print(minc_dis(n, x, y, p))

print(cheb_dis(n, x, y))


#print(cheb_dis(2, [1, 2, 3], [2, 0, 4]))


Measured memory_bytes: 5664
def extgcd(a, b)
    if b == 0
        {x: 1, y: 0, gcd: a}
    else
        prev = extgcd(b, a % b)
        {
            x: prev[:y],
            y: prev[:x] - (a / b) * prev[:y],
            gcd: prev[:gcd]
        }
    end
end

def inv_mod(num)
    hash = extgcd(num, MOD)
    hash[:x] % MOD
end


N = gets.to_i
A = [0] + gets.split.map(&:to_i)
MOD = 10**9+7

invsum = [0]
(1..N).each do |i|
    invsum[i] = (invsum[i-1] + inv_mod(i)) % MOD
end

ans = 0
(1..N).each do |i|
    ans = (ans + A[i] * (invsum[i] + invsum[N+1-i] - 1)) % MOD
end

(2..N).each do |i|
    ans = ans * i % MOD
end
puts ans

Measured memory_bytes: 28360
s = input()

a=[]
for i in range(len(s)):
 if s[i]=="S":
     a.append("S")
 if s[i]=="T":
     if len(a)==0 or a[-1]=="T":
         a.append("T")
     if a[-1]=="S":
         a.pop()
print (len(a))

Measured memory_bytes: 5096
import java.util.Scanner;
public class Main {
	public static void main(String[] args) throws Exception{
		Scanner stdIn=new Scanner(System.in);
		int H=stdIn.nextInt();
		int W=stdIn.nextInt();
		char a[][]=new char[H+2][W+2];
		String s="";
		int z=0,y=0,fin=0;
		while(z<H){
			s=stdIn.next();
			while(y<W){
				a[z+1][y+1]=s.charAt(y);
				y++;
			}
			y=0;
			z++;
		}z=1;y=1;
		while(z<H+1){
			while(y<W+1){
				if(a[z][y]!=a[z-1][y]&&a[z][y]!=a[z][y-1]&&a[z][y]!=a[z+1][y]&&a[z][y]!=a[z][y+1]&&a[z][y]=='#'){
					fin=1;break;
				}
				y++;
			}y=1;
			if(fin==1)
				break;
			z++;
		}
		if(fin==1)
			System.out.println("No");
		else
			System.out.println("Yes");
	}
}

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

using namespace std;
typedef long long int ll;
typedef pair<int, int> ii;

struct fastio {
    fastio() {
        ios::sync_with_stdio(false);
        cout << setprecision(10) << fixed;
        cin.tie(0);
    }
};

fastio _fast_io;

const int N = 1e5 + 5;
ll m, x, y;
int n, ans;

int main() {
    cin >> n >> m;
    m *= m;
    for (int i = 0; i < n; ++i) {
        cin >> x >> y;
        if (x * x + y * y <= m)
            ++ans;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3624
#include <cstdio>
#include <queue>
#include <algorithm>
#define INF 0xffffffffffffLL
using namespace std;

int n;

struct edge {
	int u, v, d;
} A[90050];
int cnt = 0;
inline bool cmp(const edge &a, const edge &b) {
	return a.d < b.d;
}

int h[330], to[90050], w[90050], nx[90050], e = 1;
inline void adde(int u, int v, int d) {
	to[e] = v; w[e] = d;
	nx[e] = h[u]; h[u] = e++;
}

struct node {
	int p;
	long long d;
	inline bool operator < (const node &a) const {
		return d > a.d;
	}
};
long long dis[330];

long long dijkstra(int s, int t) {
	for (int i = 0; i < n; i++) dis[i] = INF;
	priority_queue<node> q;
	q.push((node){ s, dis[s] = 0 });
	while (!q.empty()) {
		node cur = q.top(); q.pop();
		if (cur.p == t) return dis[t];
		if (cur.d > dis[cur.p]) continue;
		for (int i = h[cur.p]; i; i = nx[i])
			if (dis[to[i]] > cur.d + w[i])
				q.push((node){ to[i], dis[to[i]] = cur.d + w[i] });
	}
	return INF;
}

long long solve() {
	sort(A,A+cnt,cmp);
	long long ans = 0;
	for (int i = 0; i < cnt; i++) {
		long long dis = dijkstra(A[i].u,A[i].v);
		if (A[i].d > dis) return -1;
		if (A[i].d < dis) {
			ans += A[i].d;
			adde(A[i].u,A[i].v,A[i].d);
			adde(A[i].v,A[i].u,A[i].d);
		}
	}
	return ans;
}

int main() {
	scanf("%d",&n);
	int d;
	for (int i = 0; i < n; i++)
		for (int j = 0; j < n; j++) {
			scanf("%d",&d);
			if (d) A[cnt++] = (edge){i,j,d};
		}
	printf("%lld\n",solve());
	return 0;
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(void){
  string S;
  cin >> S;
  int N = S.size();
  int q_b[N+1]; // q_b[i]: i+1文字目までのBの数
  q_b[0]=0;
  ll ans = 0;
  for(int i=0; i<N; i++){
    if(S[i] == 'B') q_b[i+1] = q_b[i] + 1;
    else {
      q_b[i+1] = q_b[i];
      ans += q_b[i+1];
    }
  }
  cout << ans << endl;
  return 0;   
}

Measured memory_bytes: 1412
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

using namespace std;

int main() {
    int n; cin >> n;
    vector<int> A(n); for (int i = 0; i < n; ++ i) cin >> A[i];

    int sum = abs(A[0]);
    for (int i = 1; i < n; i++) {
        sum += abs(A[i] - A[i - 1]);
    }
    sum += abs(A[n - 1]);

    for (int i = 0; i < n; i++) {
        int prev, next;
        if (i == 0) {
            prev = 0;
            next = A[i + 1];
        } else if (i == n - 1) {
            prev = A[i - 1];
            next = 0;
        } else {
            prev = A[i - 1];
            next = A[i + 1];
        }
        int ret = sum - abs(A[i] - prev) - abs(A[i] - next) + abs(next - prev);
        cout << ret << endl;
    }
}


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

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

  int topping = 0;
  if (s.at(0) == 'o') topping += 100;
  if (s.at(1) == 'o') topping += 100;
  if (s.at(2) == 'o') topping += 100;

  int ans = 700 + topping;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
<?php
const MOD = 10 ** 9 + 7;
list($n, $a, $b, $c) = ints();
$a = modDiv($a, 100 - $c);
$b = modDiv($b, 100 - $c);
init($n * 2);
// まず引き分けがないものとして期待値を計算
$sum = 0;
$powan = modPow($a, $n);
$powai = 1;
$powbn = modPow($b, $n);
$powbi = 1;
for ($i = 0; $i < $n; ++$i) {
    // Aがn回勝つ、Bはi回勝つ
    $pa = modProd(
        $powan,
        $powbi
    );
    // Bがn回勝つ、Aはi回勝つ
    $pb = modProd(
        $powbn,
        $powai
    );
    $sum = modAdd($sum, modProd($n + $i, nCr2($n - 1 + $i, $n - 1), modAdd($pa, $pb)));
    $powai = modMul($powai, $a);
    $powbi = modMul($powbi, $b);
}
// 引き分けを含んだ期待値を計算
$sum = modMul($sum, modDiv(100, 100 - $c));
echo $sum;
function ints()
{
    return array_map('intval', explode(' ', trim(fgets(STDIN))));
}
// 足し算
function modAdd($x, $y)
{
    return ($x + $y) % MOD;
}

// SUM
function modSum(...$xs)
{
    $res = 0;
    foreach ($xs as $x) $res = modAdd($res, $x);
    return $res;
}

// 引き算
function modSub($x, $y)
{
    return ($x + MOD - $y) % MOD;
}

// 掛け算
function modMul($x, $y)
{
    return ($x * $y) % MOD;
}

// PRODUCT
function modProd(...$xs)
{
    $res = 1;
    foreach ($xs as $x) $res = modMul($res, $x);
    return $res;
}

// 割り算
function modDiv($x, $y)
{
    return modMul($x, modPow($y, MOD - 2));
}

// 累乗（繰り返し二乗法）
function modPow($n, $x)
{
    if ($x === 0) return 1;
    $res = (modPow($n, $x >> 1) ** 2) % MOD;
    if ($x % 2 === 1) $res = modMul($res, $n);
    return $res;
}

// 階乗
function modFac($n)
{
    if ($n === 0) return 1;
    return modMul($n, modFac($n - 1));
}

// 順列
function nPr($n, $r)
{
    if ($r === 0) return 1;
    return modMul(nPr($n, $r - 1), $n - $r + 1);
}

// 組み合わせ
function nCr($n, $r)
{
    $r = min($r, $n - $r);
    if ($r === 0) return 1;
    return modDiv(nPr($n, $r), modFac($r));
}

// 階乗、逆元を前処理
function init($n)
{
    global $fact, $ifact;
    $fact[0] = 1;
    for ($i = 1; $i <= $n; ++$i) $fact[$i] = modMul($fact[$i - 1], $i);
    $ifact[$n] = modDiv(1, $fact[$n]);
    for ($i = $n; $i >= 1; --$i)
        $ifact[$i - 1] = modMul($ifact[$i], $i);
}

// 順列（前処理）
function nPr2($n, $r)
{
    global $fact, $ifact;
    return modMul($fact[$n], $ifact[$n - $r]);
}

// 組み合わせ（前処理）
function nCr2($n, $r)
{
    global $fact, $ifact;
    return modMul(modMul($fact[$n], $ifact[$r]), $ifact[$n - $r]);
}


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

int main() {
    int A, B, C, X;
    cin >> A >> B >> C >> X;
    int cnt = 0;
    for (int i = 0; i <= A; i++){
        for (int j = 0; j <= B; j++){
            for (int k = 0; k <= C; k++){
                if (500*i + 100*j + 50*k == X){
                    cnt++;
                }
            }
        }
    }
    cout << cnt << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod = 1e9+7;
ll q_pow(ll a, ll b)
{
    ll ans = 1;
    while(b) {

        if(b&1)
            ans = (ans*a)%mod;
        a = (a*a)%mod;
        b >>= 1;
    }
    return ans;
}
struct node
{
    ll x;
    ll l;
    ll rr;
    bool operator < (const node &nex) {
        return rr < nex.rr;
    }
}a[100010];
int main()
{
    int i, j, k;
    int n, t, m;
    int r, c;
    ll s;
    cin >> n >> k >> s;
    for(i = 0; i < n; i++) {
        if(i) printf(" ");
        if(i < k) {
            printf("%I64d", s);
        }
        else {
            if(s == 1e9) {
                printf("%I64d", s-1);
            }
            else printf("%I64d", s+1);
        }
    }
    puts("");
    return 0;
}


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

  
int main(){
  string s;
  cin >> s;
  int mmax=0;
  int osum=0;
  rep(i,s.size()){
    if(s.at(i)=='A' ||s.at(i)=='T'||s.at(i)=='G'||s.at(i)=='C'){
      osum++;
      mmax=max(mmax,osum);
    }
    else osum=0;
  }
    cout << mmax <<endl;  
}
  

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

namespace Atc_0035
{
    class Program
    {
        static void Main(string[] args)
        {
            var s = Console.ReadLine();

            int N = int.Parse(s.Split(' ')[0]);
            int T = int.Parse(s.Split(' ')[1]);

            int idx = 0;

            int result = int.MaxValue;

            while (idx < N)
            {
                idx++;

                s = Console.ReadLine();

                int c = int.Parse(s.Split(' ')[0]);
                int t = int.Parse(s.Split(' ')[1]);

                if (t <= T)
                {
                    if (c <= result)
                    {
                        result = c;
                    }
                }
            }

            if (result == int.MaxValue)
            {
                Console.WriteLine("TLE");
            }
            else
            {
                Console.WriteLine(result);
            }

        }
    }
}


Measured memory_bytes: 27504
#include<bits/stdc++.h>
#include<iomanip>
#include<numeric>

using namespace std;
using ll = long long;
constexpr int mo = 1e9+7;
constexpr int  mod = mo;
constexpr ll inf = 1ll<<62;

int main(){
    int n;
    cin>>n;
    multiset<int> s;
    for(int i=0;i<n;++i){
        int a;cin>>a;
        auto it = s.lower_bound(a);
        if(s.begin() == it){
            s.insert(a);
        }else{
            it--;
            s.erase(it);
            s.insert(a);
        }
    }
    cout << s.size() << endl;
    return 0;
}



Measured memory_bytes: 4992
# -*- coding: utf-8 -*-

def process(data):
	base=700
	if data[0] == "o":
		base=base+100
	if data[1] == "o":
		base=base+100
	if data[2] == "o":
		base=base+100
	return base


if __name__ == '__main__':
	data=input()
	answer=process(data)
	print(answer)

Measured memory_bytes: 3060
import java.util.Scanner;
public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String step = sc.next();
        String[] s = step.split("");
        String answer = "";
        for (int i = 0; i < s.length; i++) {
            if (i % 2 == 0 && s[i].equals("L")) {
                answer = "No";
                break;
            } else if (i % 2 == 1 && s[i].equals("R")) {
                answer = "No";
                break;
            } else {
                answer = "Yes";
            }
        }
        System.out.println(answer);
    }
}

Measured memory_bytes: 23764
#include "bits/stdc++.h"
using namespace std;
 
vector<long long int> G[100002];
vector<long long int> c(1e5+2,-1);
int nib=0;
vector<long long int> co(2,0);
 
int nibu(long long int p,long long int x){
	for(long long int i=0;i<G[p].size();i++){
		if(c[G[p][i]]==-1){
			c[G[p][i]]=abs(x-1);
			co[abs(x-1)]++;
			nibu(G[p][i],abs(x-1));
		}else if(c[G[p][i]]==x){
			nib=1;
		}
	}
	return 0;
}
 
int main(){
	long long int n,m;
	cin>>n>>m;
	for(long long int i=0;i<m;i++){
		long long int a,b;
		cin>>a>>b;
		a--;
		b--;
		G[a].push_back(b);
		G[b].push_back(a);
	}
	
	c[0]=0;
	co[0]++;
	nibu(0,0);
	
	if(nib==0){
		cout<<co[0]*co[1]-m<<endl;
	}else{
		cout<<n*(n-3)/2-m+n<<endl;
	}
	return 0;
}

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

#define ll          long long
#define pb          push_back
#define endl        '\n'
#define mii         map<ll,ll>
#define pii         pair<ll,ll>
#define vi          vector<ll>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll)x.size()
#define hell        1000000007
#define INF         (1ll<<60)
#define rep(i,a,b)  for(ll i=a;i<=b;i++)
#define rrep(i,a,b)  for(ll i=a;i>=b;i--)
#define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define time        cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a % b); }
ll lcm(ll a, ll b) { return a * (b / gcd(a, b)); }
const int N=100005;
void solve(){
    string s,t;
    cin>>s>>t;
    cout<<t<<s;
}
signed main()
{
    ios
    int TESTS=1;
    //cin>>TESTS;
    while(TESTS--){
        solve();
    }
    time
    return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
const ld eps = 1e-9;

//// < "d:\d_download\visual studio 2015\projects\programing_contest_c++\debug\a.txt" > "d:\d_download\visual studio 2015\projects\programing_contest_c++\debug\b.txt"

int fall(vector<vector<int>>&field, vector<vector<int>>&pino,int l) {
	{

	}
	int y = 0;
	for ( y = 0; y < field.size() - pino.size(); ++y) {
		bool ok = true;
		for (int i = 0; i < pino.size(); ++i) {
			for (int j = 0; j < pino[i].size(); ++j) {
				if (pino[i][j]) {
					if (field[y + i+1][l + j])ok = false;
				}
			}
		}
		if (!ok) {
			break;
		}
	}
	for (int i = 0; i < pino.size(); ++i) {
		for (int j = 0; j < pino[i].size(); ++j) {
			if (pino[i][j]) {
				assert(!field[y + i][l + j]);
				field[y + i][l + j] = true;
			}
		}
	}
	int delline = 0;
	for (int i = y + pino.size() - 1; i >= y; --i) {
		while (all_of(field[i].begin(), field[i].end(), [](const int a) {return a == 1; })) {
			transform(field[i].begin(), field[i].end(), field[i].begin(), [](const int a) {return false; });
			for (int j = i- 1; j >= 0; --j) {
				swap(field[j], field[j + 1]);
			}
			delline += 1;
		}
	}
	return delline;
}

int main() {
	while (1) {
		int N; cin >> N;
		if (!N)break;
		int sum = 0;
		vector<vector<int>>field(5*N+10, vector<int>(5));
		for (int i = 0; i < N; ++i) {
			int d, p, q; cin >> d >> p >> q; q--;
			int w = d == 2 ? 1 : p;
			int h = d == 1 ? 1 : p;
			sum += p;
			vector<vector<int>>pino(h, vector<int>(w, 1));
			sum -= fall(field, pino, q) * 5;
		}
		cout << sum << endl;
	}
	
	return 0;
}

Measured memory_bytes: 3244
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const ll MOD=(ll)1e9+7;
//const ll MOD=(ll)998244353;
const ll INF=(ll)1e18+10;
const double PI = 2.0*acos(0);

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 dy[]={-1,1,0,0};
int dx[]={0,0,-1,1};

void solve(int ca){
    int a,b,c,d;
    string s,t,u;
    cin>>a>>b;
    cout<<a*b<<endl;
}

//#define MULTI
int main() {
#ifdef MULTI
    int N; cin>>N;
    for (int i = 0; i < N; ++i) {
        solve(i+1);
    }
#else
    solve(0);
#endif
    return 0;
}


Measured memory_bytes: 3600
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <bitset>
#include <cmath>
#include <string>
#define FI first
#define SE second
#define PF push_front
#define PB push_back
#define PPF pop_front
#define PPB pop_back
#define MA make_pair
#define ll long long
#define PA pair<int,int>
#define VE vector<int>
#define VP vector<PA>
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define ROF(i,a,b) for(int i=b-1;i>=a;i--)
#define YES(i) cout<<(i?"YES":"NO")<<endl
#define Yes(i) cout<<(i?"Yes":"No")<<endl
using namespace std;
//
const int INF=1e9+7;
const int mod=1e9+7;
//
//
struct poi{
  int X;int Y;int Z;
  bool operator<(const poi&R)const{
    return X==R.X ? Y==R.Y ? Z<R.Z : Y<R.Y : X<R.X;
  }
};
//
//
int main(){
	int N,X;
	int M[100];
	cin>>N>>X;
	FOR(i,0,N){
		cin>>M[i];
		X-=M[i];
	}
	sort(M,M+N);
	int S=N;
	S+=X/M[0];
	cout<<S<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
        //#define m ((long long)1e9+7)
        typedef long long ll;
        using namespace std;
         
        int main() {
            ios_base::sync_with_stdio(false);cin.tie(NULL);
        	ll n,w;
        	cin>>n>>w;
        	ll a[n][2],ma=0;
        	for(ll i=0;i<n;i++)
        	{
        	    cin>>a[i][0]>>a[i][1];
        	    ma+=a[i][1];
        	}
        	ll dp[ma+1];
        	    for(ll j=0;j<ma+1;j++)
        	    {
        	       dp[j]=(ll)1e18;
        	    }
        	    dp[0]=0;
        	for(ll i=0;i<n;i++)
        	{
        	    for(ll j=ma;j>=a[i][1];j--)
        	    {
        	        dp[j]=min(dp[j],dp[j-a[i][1]]+a[i][0]);
        	    }
        	}
        	for(int i=ma;i>=0;i--)
        	if(dp[i]<=w)
        	{
        	    cout<<i<<endl;break;
        	}
        	//cout<<endl;
        	return 0;
        }

Measured memory_bytes: 1024
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
/*
//#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
*/

// C++
#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>
/*
//#if __cplusplus >= 201103L
#include <array>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
*/
using namespace std;
#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define mp(a,b) make_pair(a,b)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl

#define uni(x) x.erase(unique(all(x)),x.end())
template<class T,class U>inline void chmin(T &t,U f){if(t>f)t=f;}
template<class T,class U>inline void chmax(T &t,U f){if(t<f)t=f;}
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) > (b) ? (b) : (a))

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> PPI;

#define INF INT_MAX/3
#define MAX_N 1000
#define M_INF 1000000000
int n,m,v,i;
void solve(){
   cin.tie(0);
  ios::sync_with_stdio(false);
  cin>>n;
  cout<<(n-2)*180<<endl;

}

int main(){
  solve();
  return 0;
}


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

int main() {
    int N;
    cin >> N;
    vector<int> data(N);
    for (int i=0; i < N; ++i) cin >> data[i];
    sort(data.begin(), data.end());
    data.erase(unique(data.begin(), data.end()), data.end());
    
    cout << data.size() << endl;
    return 0;
}

Measured memory_bytes: 3588