akhauriyash/Code-Regression huggingface dataset:
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <deque>
#include <stack>
#include <queue>
#include <bitset>
#include <cstdio>
#include <string>
#include <vector>
#include <random>
#include <chrono>
#include <utility>
#include <numeric>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <sstream>
#include <assert.h>
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <unordered_map>
using namespace std;

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(bool x) {cerr << (x ? "true" : "false");}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}

template<typename T, typename V> void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i : x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";} void _print() {cerr << "]\n";}
template <typename T, typename... V>void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifdef HOME
#warning CHECK int:ll::INT_MAX:LLONG_MAX
#define maxn 20
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define maxn 2000006
#define gcd __gcd
#define debug(x...)
#endif

#define ff first
#define endl '\n'
#define ss second
#define inf 0x3f3f3f3f
#define MOD 1000000007
#define PI 3.14159265358979323846264338327950L
#define f(i,x,n) for(int i=x;i<=n;i++)
#define fr(i,x,n) for(int i=x;i>=n;i--)
struct _ { ios_base::Init i; _() { ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL); } } _;

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


int main() {

	string s; cin >> s;

	deque<char> ss;
	for (auto i : s) ss.push_back(i);

	bool is_rev = false;

	int q; cin >> q;
	while (q--) {
		int t; cin >> t;
		if (t == 1) { //reverse
			is_rev = !is_rev;
		}
		else { //edit
			int f;
			char c;
			cin >> f >> c;
			if (f == 1) { //push_front
				if (is_rev == false) ss.push_front(c);
				else ss.push_back(c);
			}
			else { //push_back
				if (is_rev == false) ss.push_back(c);
				else ss.push_front(c);
			}
		}
	}

	string ans;
	for (auto i : ss) ans.push_back(i);

	if (is_rev) reverse(ans.begin(), ans.end());

	cout << ans;


	return 0;
}

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

  int N , M , o , p;
  cin >> N >> M  >> o >> p;
  if( N == o) cout << 0 <<endl ;
  else cout << 1 <<endl ;
  
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int K,arr[1000001],i=1,sisa;
int main() {
	cin>>K;
	sisa=7%K;
	while(arr[sisa]==0) {
		arr[sisa]+=1;
		if(sisa==0) {
			cout<<i;
			return 0;
		}
		sisa*=10;
		sisa%=K;
		sisa+=7;
		sisa%=K;
		i++;
	}
	cout<<"-1";
}


Measured memory_bytes: 7400
#include <stdio.h>
#include <string.h>


int main(void){

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


  int counts[4]={0};
  int i=0;
  while(i <N){
    char c;
    scanf("%c", &c);

    if( c == ' ' || c == '\n'){
      continue;
    }
    
    /* printf("%c,%d ", c, i); */
    
    
    if( c == 'P'){
      counts[0]++;
    }else if( c == 'W'){
      counts[1]++;
    }else if( c == 'G'){
      counts[2]++;
    }else if( c == 'Y'){
      counts[3]++;

    }
    i++;
    
  }

    if( counts[0]!= 0 && counts[1]!= 0 && counts[2]!= 0 && counts[3]!= 0 ){
      printf("Four");
    }else if ( counts[0]!= 0 && counts[1]!= 0 && counts[2]!= 0 ) {
      printf("Three");
    }

}


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

int power(int x) {
  int i = 0;
  while (x % 2 == 0) {
    x = x/2;
    i++;
  }
  return i;
}

int main() {
  int N;
  cin >> N;
  vector<int> v(N);
  vector<int> p(N);
  
  for (int i = 0; i < N; i++) {
    cin >> v.at(i);
    p.at(i) = power(v.at(i));
  }
  
  int m = 36;
  
  for (int i = 0; i < N; i++) {
    if (p.at(i) < m) {
      m = p.at(i);
    }
  }
  
  cout << m << endl;
  
}

Measured memory_bytes: 256
/*
ID: computerbox --> Huseyn Hajiyev
LANG: C++
TASK: AC_mode_on
*/
#include <bits/stdc++.h>
//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#define _CRT_SECURE_NO_WARNINGS
//#include <boost/multiprecision/cpp_int.hpp>
//using boost::multiprecision::cpp_int;
#define FAST_READ ios_base::sync_with_stdio(0);cin.tie(0);
#define in freopen("input.txt", "r", stdin);
#define out freopen("output.txt", "w", stdout);
#define ll long long
#define debt(x,y)cout<<"#x = "<<(x)<<" and "<<"#y = "<<(y)<<endl;
#define deb(x)cout<<"#x = "<<(x)<<endl;
#define COUT(n, a) cout<< fixed << setprecision(a) << n<<endl
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define endl "\n"
#define arr(a,n) for(ll i=1;i<=n;i++) cout<<a[i]<<" "; cout << "\n";
#define vecc(a,n) for(ll i=0;i<n;i++) cout<<a[i]<<" "; cout << "\n";
#define CURTIME() cerr << clock() * 1.0 / CLOCKS_PER_SEC << endl
#define DTIME(ccc) __begin = clock(); ccc; cerr<<"Time of work = "<<(clock()-__begin)/CLOCKS_PER_SEC<<endl;
#define MAXN 51000

using namespace std;

#define debug(args...)(Debugger()) , args
class Debugger
{
  public:
  Debugger(const std::string& _separator=", ") :
  first(true),separator(_separator){}
  template<typename ObjectType>
  Debugger& operator,(const ObjectType& v)
  {
        if(!first)cerr<<separator;
        cerr<<v;
        first=false;
        return *this;
  }
  ~Debugger() {cerr<<endl;}
  private:
    bool first;
    string separator;
};

template <typename T1, typename T2>
inline ostream& operator<<(std::ostream& os, const std::pair<T1, T2>& p)
{
   return os<<"("<<p.first<<", "<<p.second<<")";
}
template<typename T>
inline ostream &operator<<(ostream & os,const vector<T>& v)
{
    bool first=true;
    os<<"[";
    for(unsigned ll i=0;i<v.size();i++)
    {
        if(!first)os<<", ";
        os<<v[i];
        first=false;
    }
        return os<<"]";
}
template<typename T>
inline ostream &operator<<(ostream & os,const set<T>&v)
{
    bool first=true;
    os<<"[";
    for(typename set<T>::const_iterator ii=v.begin();ii!=v.end();++ii)
    {
        if(!first)os<<", ";
        os<<*ii;
        first=false;
    }
    return os<<"]";
}
template<typename T1, typename T2>
inline ostream &operator<<(ostream & os,const map<T1, T2>&v)
{
        bool first=true;
        os<<"[";
        for(typename map<T1,T2>::const_iterator ii=v.begin(); ii!=v.end();++ii)
        {
            if(!first)os<<", ";
            os<<*ii;
            first=false;
        }
        return os<<"]";
}

unsigned ll lcm(unsigned ll a,unsigned ll b)
{
  return (a*b)/__gcd(a,b);
}
ll n;
int main(){
FAST_READ;
cin>>n;
ll x;

ll sum=0;
for(ll i=1;i<=n;i++)
{
  cin>>x;
  sum=sum+(x-1);
}

cout<<sum<<endl;
return 0;
}


Measured memory_bytes: 256
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <sstream>
#include <algorithm>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <list>
#include <cstdio>
#include <iostream>
#include <cmath>
#include <climits>
#include <bitset>
#include <functional>
#include <numeric>
#include <ctime>
#include <cassert>
#include <cstring>
#include <fstream>

#define FOR(i, a, b) for(int (i)=(a); (i)<(b); (i)++)
#define IFOR(i, a, b) for(int (i)=(a);(i)<=(b);(i)++)
#define RFOR(i, a, b) for(int (i)=(a);(i)>=(b);(i)--)

using namespace std;

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

	if (a <= 0 && b >= 0) {
		cout << "Zero" << endl;
	}
	else {

		int num = b - a + 1;
		string str[] = { "Positive", "Negative" };
		cout << (b < 0 ? str[num % 2] : str[0]) << endl;
	}

	return 0;
}

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

const int N = 2005;

vector<int> G[N];
int dp[N], sub[N], dsum[N];
string s;
int n;

void dfs(int u, int p, int d) {
    sub[u] = (s[u] == '1');
    dsum[u] = (s[u] == '1' ? d : 0);
    int all_sum = 0;
    vector<pair<int,int>> bottom;
    for(int v : G[u]) {
        if(v == p) continue;
        dfs(v, u, d+1);
        sub[u] += sub[v];
        dsum[u] += dsum[v];
        if(sub[v]) {
            bottom.push_back({sub[v]+dp[v], v});
            all_sum += sub[v]+dp[v];
        }
    }
    sort(bottom.begin(), bottom.end());
    if(bottom.empty()) dp[u] = 0;
    else {
        if(bottom.size() == 1) dp[u] = bottom[0].first;
        else {
            int most = 0;
            for(int i = 0; i+1 < bottom.size(); i++) {
                int v = bottom[i].second;
                most += dsum[v] - d * sub[v];
            }
            dp[u] = max(bottom.back().first - most, all_sum&1);
        }
    }
}

int main() {
    // freopen("in.txt", "r", stdin);
    ios::sync_with_stdio(0);
    cin.tie(0);
    cin >> n >> s;
    s = "?" + s;
    for(int i = 1; i < n; i++) {
        int a, b;
        cin >> a >> b;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    int ans = 1e9;
    for(int i = 1; i <= n; i++) {
        dfs(i, -1, 0);
        if(dp[i] == 0) {
            assert(dsum[i]%2 == 0);
            ans = min(ans, dsum[i]/2);
        }
    }
    if(ans == 1e9) ans = -1;
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <unordered_set>
#include <unordered_map>
#include <set>
#include <map>
#include <list>
#include <algorithm>
#include <iterator>
#include <utility>
#include <string>
using namespace std;

int main(){

    string s;
    cin>>s;
    long long sum = 0;
    for(int i = 0;i<s.size();i++){
        sum+=(s[i] - '0');
    }    
    if(sum%9==0){
        cout<<"Yes";
    }else{
        cout<<"No";
    }
	return 0;
}


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

struct Card{
  char suit;
  char value;
};

void bubble_sort(struct Card A[], int N){
  Card temp;
  for(int i=0; i<N; i++){
    for(int j = 0; j < N - i -1; j++){
      if(A[j].value > A[j+1].value){
        temp = A[j];
        A[j] = A[j+1];
        A[j+1] = temp;
      }
    }
  }
}

void selection_sort(struct Card A[], int N){
  int minj;
  for(int i = 0; i< N-1; i++){
    minj = i;
    for(int j = i; j < N; j++){
      if (A[j].value < A[minj].value) {
        minj = j;
      }
    }
    Card t = A[i];
    A[i] = A[minj];
    A[minj] = t;
  }
}

void print(struct Card A[], int N){
  for(int i=0; i<N; i++){
    if (i) {
      cout << " ";
    }
    cout << A[i].suit << A[i].value ;
  }
  cout << endl;
}

bool isStable(struct Card A[], struct Card B[], int N){
  for(int i=0; i<N; i++){
    if(A[i].suit != B[i].suit)
      return false;
  }
  return true;
}


int main(int argc, char const *argv[]) {
  Card A[100], B[100];
  int N;
  char ch;

  cin >> N;
  for(int i=0; i<N; i++){
    cin >> A[i].suit >> A[i].value;
  }

  for(int i=0; i<N; i++)
    B[i] = A[i];

  bubble_sort(A, N);
  selection_sort(B, N);

  print(A, N);
  cout << "Stable" << endl;
  print(B, N);
  if (isStable(A, B, N)) {
    cout << "Stable" << endl;
  }else{
    cout << "Not stable" << endl;
  }

  return 0;
}

Measured memory_bytes: 3084
#include <bits/stdc++.h>
#include <iomanip>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define fi first
#define se second
#define mp make_pair
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;

ll N,M,H,W,K,Q,A,B,L,R;
string S,T;
const ll MOD = (1e+9) + 7;
const ll INF = 1LL << 60;
typedef pair<ll,ll> P;

typedef vector<P> vp;
typedef vector<vp> matP;

int main(){
    cin>>N;
    vec a(N);
    rep(i,N) cin>>a[i];
    sort(a.begin(), a.end());
    reverse(a.begin(), a.end());
    vec score(2,0);
    rep(i,N) score[i&1] += a[i];
    cout<<score[0] - score[1]<<endl;
}

Measured memory_bytes: 256
<?php 
fscanf(STDIN, "%d", $n);
for ($i=1; $i < $n+1; $i++) {
  fscanf(STDIN, "%d %d %d", ${"t".$i}, ${"x".$i}, ${"y".$i});
}
$t0 = 0;
$x0 = 0;
$y0 = 0;
$flag = 0;
for ($i=0; $i < $n ; $i++) {
  $j = $i+1;
  $tdiff = ${"t".$j} - ${"t".$i};
  $xdiff = abs(${"x".$j} - ${"x".$i});
  $ydiff = abs(${"y".$j} - ${"y".$i});
  if($tdiff == $xdiff + $ydiff){
    $flag = "0";
  }elseif ($tdiff < $xdiff + $ydiff) {
    $flag = "1";
    echo "No";
    break;
  }elseif ($tdiff > $xdiff + $ydiff) {
    if($tdiff % 2 == ($xdiff + $ydiff) % 2){
      $flag = "0";
    }else {
      $flag = "2";
      echo "No";
      break;
    }
  }
}
if($flag == 0){
  echo "Yes";
}

 ?>


Measured memory_bytes: 50548
N = int(input())
a = list(map(int, input().split()))
c = [0] * 8
s = 0
for i in a:
    if i >= 3200:
        s += 1
    else:
        c[i // 400] = 1
sum_c = sum(c)
if sum_c:
    print('{} {}'.format(sum_c, sum_c + s))
else:
    print('{} {}'.format(min(1, s), s))


Measured memory_bytes: 3060
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

func out(x ...interface{}) {
	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

func getInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func getInts(N int) []int {
	ret := make([]int, N)
	for i := 0; i < N; i++ {
		ret[i] = getInt()
	}
	return ret
}

func getString() string {
	sc.Scan()
	return sc.Text()
}

// min, max, asub, absなど基本関数
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func asub(a, b int) int {
	if a > b {
		return a - b
	}
	return b - a
}

func abs(a int) int {
	if a >= 0 {
		return a
	}
	return -a
}

func lowerBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] >= x
	})
	return idx
}

func upperBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] > x
	})
	return idx
}

func main() {
	sc.Split(bufio.ScanWords)
	a, b := getInt(), getInt()

	x := 1
	for i := 2; x < 499500; i++ {
		y := x + i
		// out(x, y)
		if a-b == x-y {
			out(x - a)
			break
		}
		x = y
	}
}


Measured memory_bytes: 1772
<?php
	$n = fgets(STDIN);

	for ($i = 1; $i <= $n; $i++) {
		$x = $i;
		if ($x % 3 == 0) {
			echo " $i";
			continue;
		}

		while ($x) {
			if ($x % 10 == 3) {
				echo " $i";
				break;
			}

			$x /= 10;
		}
	}

	echo "\n";

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

int main(){
	int n,k ; cin >> n >> k ;
	vector<int> h(n) ;
	for(int i=0;i<n;i++) cin >> h.at(i) ;
	sort(h.begin(),h.end()) ;
	int mn = 1000000010 ;
	for(int i=k-1;i<n;i++){
		if(mn>h.at(i)-h.at(i-k+1)) mn = h.at(i)-h.at(i-k+1) ;
	}
	cout << mn << endl ;
}


Measured memory_bytes: 640
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
#define double long double
typedef vector<int> VI;
typedef pair<int, int> pii;
typedef vector<pii> VP;
typedef vector<string> VS;
typedef priority_queue<int> PQ;
template<class T>bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
#define fore(i,a) for(auto &i:a)
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
#define eps 1e-12 
//priority_queue<int,vector<int>, greater<int> > q2;

int solve(int N) {
	VI P(N), J(N - 1);
	REP(i, N)cin >> P[i];
	REP(i, N - 1)cin >> J[i];
	rSORT(J);
	int res = -1;
	int sum = 0;
	REP(i, N)sum += P[i];
	VI S(N, 0);
	REP(i, N - 1) S[i + 1] = S[i] + J[i];;
	eREP(i, N - 1) {
		int cnt = sum + S[i];
		cnt *= (N - i);
		chmax(res, cnt);
	}


	return res;
}

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

	int N = 1;
	while (N) {
		cin >> N;
		if (!N)return 0;
		cout << solve(N) << endl;
	}
	return 0;
}




Measured memory_bytes: 4336
n = input()
lis = []
bot = 0
for i in xrange(n):
    com = raw_input()
    if   com[0] == 'i':
        lis.append(com[7:])
    elif com[6] == ' ':
        try:
            lis.pop(~lis[::-1].index(com[7:]))
        except:
            pass
    elif com[6] == 'F':
        lis.pop()
    else:
        bot += 1

print ' '.join( map(str, reversed(lis[bot:])) )

Measured memory_bytes: 61628
#include <iostream>
using namespace std;
long long digits(long long n){
  int mon=0;
  while(n){
    mon+=n%10;
    n/=10;
  }
  return mon;
}
int main(){
  int n;
  cin>>n;
  long long a=0,b=1;
  for(int i=0;i<n;++i){
    if((a+b)*digits(a+b*10)>(a+b*10)*digits(a+b)) b*=10;
    a+=b;
    cout<<a<<endl;
  }
}


Measured memory_bytes: 256
void main() {
	auto N = ri;
	auto A = readAs!(BigInt[]).sort().array;

	ulong k = 0;
	BigInt c = BigInt(1);
	while(k < N) {
		c *= A[k];
		debug c.writeln;
		if(c > BigInt(1000000000000000000)) {
			writeln(-1);
			return;
		}
		k++;
	}
	if(c <= BigInt(1000000000000000000)) {
		writeln(c);
	} else writeln(-1);
}

// ===================================

import std.stdio;
import std.string;
import std.functional;
import std.algorithm;
import std.range;
import std.traits;
import std.math;
import std.container;
import std.bigint;
import std.numeric;
import std.conv;
import std.typecons;
import std.uni;
import std.ascii;
import std.bitmanip;
import core.bitop;

T readAs(T)() if (isBasicType!T) {
	return readln.chomp.to!T;
}
T readAs(T)() if (isArray!T) {
	return readln.split.to!T;
}

T[][] readMatrix(T)(uint height, uint width) if (!isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		res[i] = readAs!(T[]);
	}
	return res;
}

T[][] readMatrix(T)(uint height, uint width) if (isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		auto s = rs;
		foreach(j; 0..width) res[i][j] = s[j].to!T;
	}
	return res;
}

int ri() {
	return readAs!int;
}

long rl() {
	return readAs!long;
}

double rd() {
	return readAs!double;
}

string rs() {
	return readln.chomp;
}

Measured memory_bytes: 20320
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <bitset>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;
const ll MOD = 1000000007LL;

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

    string s;
    cin >> s;

    int x = 0; // 010101...
    int y = 0; // 101010...
    for (int i = 0; i < s.size(); i++) {
        if (s[i] == '0') {
            if (i % 2 == 0) {
                y++;
            } else {
                x++;
            }
        } else {
            if (i % 2 == 0) {
                x++;
            } else {
                y++;
            }
        }
    }

    cout << min(x, y) << "\n";
    return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
ll GetDigit(ll num){ return log10(num)+1; } //numの桁数を求める

int main()
{
    int a,b;
    cin >> a >> b;
    if(a <= b) cout << "unsafe" << endl;
    else cout << "safe" << endl;
    return 0;
}

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

#define ll long long
#define fi first
#define se second
#define pb push_back

using namespace std;

ll n, a, b, x, ans;

int main()
{
    cin >> n >> a >> b;
    x=n/(a+b);
    ans=x*a;
    if (n%(a+b)) ans+=min(n%(a+b), a);
    cout << ans;
}


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

char change(char ch) {
	ch -= 65;
	ch = (ch + 23) % 26;

	return ch + 65;
}

int main() {
	char str[1010];
	fill(str, str + 1010, 0);

	scanf("%s", str);
	for (int i = 0;i < 1010 && str[i] != 0;i++) {
		printf("%c", change(str[i]));
	}
	printf("\n");

	return 0;
}

Measured memory_bytes: 932
N=int(input())
S=input()

r,g,b=0,0,0
for s in S:
    if s=='R': r+=1
    elif s=='G': g+=1
    else: b+=1


ng=0
for i in range(N):
    for j in range(i+1,N):
        k=j+(j-i)
        if k>=N: continue
        if S[i]!=S[j] and S[j]!=S[k] and S[i]!=S[k]:
            ng+=1

ans=r*g*b
print(ans-ng)


Measured memory_bytes: 79852
import collections

N=int(input())
a=list(map(int,input().split()))
a.sort()

cnt=0

c=collections.Counter(a)
#print(c)

for item in c:
  t=c[item]
  if t>item:
    cnt+=t-item
  elif t==item:
    pass
  else:
    cnt+=t

#while len(a)>0:
#  item=a[0]
#  t=(item)
#  #print(item,t,a)
#  if t>item:
#    cnt+=t-item
#  elif t==item:
#    pass
#  else:
#    cnt+=t
#  del a[0:t]
#  #print("after",a)
  
print(cnt)

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

#define INF 100000000000000

int main() {


  int64_t n,k;
  cin>>n>>k;

  vector<int64_t> h(n+1);
  for(int i=1;i<=n;i++){
    cin>>h.at(i);
  }

  vector<int64_t> cost(n+1,INF);
  cost.at(1)=0;
  for(int i=2;i<=n;i++){
    int64_t cost_min = INF;
    for(int j=1;j<=k && i>=j;j++){
        cost_min = min(cost_min, cost.at(i-j)+abs(h.at(i)-h.at(i-j)));
    }
    cost.at(i)=cost_min;
  }
  cout<<cost.at(n)<<endl;


  return 0;
}


Measured memory_bytes: 4836
#include<iostream>
#include<algorithm>
#include<string>
#include<map>
#include<vector>
#include<utility>
#include <numeric>
 
using namespace std;
typedef long long ll;
 
int main(){
ll a[3],b[3];
for(ll i=0 ;i<3;i++){
cin>>a[i]>>b[i];
}
ll count[4];
for(ll i=0 ;i<4;i++){
count[i]=0;
}
for(ll i=0 ;i<3;i++){
count[a[i]-1]++;
count[b[i]-1]++;
}
ll x=0;
ll y=0;
for(ll i=0 ;i<4;i++){

if(count[i]==1)
x++;
else if(count[i]==2)
y++;

}
for(ll i=0 ;i<4;i++){
}
if(x==2&&y==2){
cout<<"YES";
}
else
cout<<"NO";
  return 0;
 
}
 

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    long int N,D,i,x,y,a = 0;
    cin >> N >> D;
    for(i = 0;i < N;i++){
        cin >> x >> y;
        if(sqrt(x * x + y * y) <= D){
            a++;
        }
    }
    cout << a << endl;
}

Measured memory_bytes: 3592
#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
	int a,b;
	cin>>a>>b;
	int c=a+b;
	if(a%3==0)
	{
		cout<<"Possible"<<endl;
		return 0; 
	}
	if(b%3==0)
	{
		cout<<"Possible"<<endl;
		return 0; 
	}
	if(c%3==0)
	{
		cout<<"Possible"<<endl;
		return 0; 
	}
	cout<<"Impossible"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(x) (x).begin(), (x).end()
#define dbg(x) cerr << #x << ": " << x << endl
int gcd(int a, int b) {
  if(b == 0) return a;
  return gcd(b, a % b);
}
int main() {
  int n, x;
  cin >> n >> x;
  vector<int> X(n);
  rep(i, n) {
    int nx;
    cin >> nx;
    X[i] = abs(nx - x);
  }
  int g = X[0];
  rep(i, n) g = gcd(g, X[i]);
  cout << g << endl;
  return 0;
}

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

using namespace std;

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

  string s;
  cin >> s;

  string ans = "AC";

  if (s[0] != 'A') {
    ans = "WA";
  } else {
    bool ok = false;
    for (unsigned int i = 1; i < s.size(); ++i) {
      if (s[i] < 'a' || s[i] > 'z') {
        if (ok || s[i] != 'C' || i == 1 || i == s.size() - 1) {
          ans = "WA";
          break;
        }
        ok = true;
      }
    }
    if (!ok) {
      ans = "WA";
    }
  }

  cout << ans << '\n';

  return 0;
}


Measured memory_bytes: 3644
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i <(n); ++i)
#define REP2(i,x,n) for (int i = x; i <(n); ++i)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
using namespace std;
using ll = long long;
using P = pair<int,int>;
static const double PI = acos(-1);



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

  bool ok = true;

  if(s[0] != 'A') ok = false;
  else s[0] += 32;

  int cnt = 0;
  for(int i = 2; i < s.size() -1 ; i++){
    if(s[i] == 'C') {
    ++cnt;
    s[i] += 32;
    }

  }
  if(cnt != 1) ok = false;

  REP(i, s.size()){
    if(isupper(s[i])) ok = false;
  }

  if(ok) cout << "AC" << endl;
  else cout << "WA" << endl;


  return 0;
}


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

int main() {
    int n, k;
    string s;
    cin >> n >> k >> s;
    int ans = 0;
    rep(i, n - 1) {
        if(s[i] == s[i + 1]) ans++;
    }
    ans = min(ans + 2 * k, n - 1);
    cout << ans << endl;
}


Measured memory_bytes: 512
#E_Manhattan
n = int(input())
a, b = [],[]
for i in range(n):
    x, y = map(int, input().split())
    a.append(x+y)
    b.append(x-y)
a.sort()
b.sort()
ans = max(a[-1]-a[0], b[-1]-b[0])
print(ans)

Measured memory_bytes: 104708
#include <bits/stdc++.h>
using namespace std;
typedef vector<string> V;
typedef pair<int, int> P;
typedef queue<P> Q;
int main() {
	int w, h, x, y;
	cin >> w >> h;
	if (w == 0 && h == 0) {
		return 0;
	}
	V map = V(h);
	for (int i = 0; i < h; i++) {
		cin >> map[i];
		for (int j = 0; j < w; j++) {
			if (map[i][j] == '@') {
				x = j;
				y = i;
			}
		}
	}
	int n = 0;
	Q q;
	q.push(P(y, x));
	while (q.size()) {
		P p = q.front();
		q.pop();
		if (p.first < 0 || h <= p.first || p.second < 0 || w <= p.second || map[p.first][p.second] == '#') {
			continue;
		}
		//cout << p.second << " " << p.first << " " << map[p.first][p.second] <<endl;
		map[p.first][p.second] = '#';
		n++;
		q.push(P(p.first - 1, p.second));
		q.push(P(p.first + 1, p.second));
		q.push(P(p.first, p.second - 1));
		q.push(P(p.first, p.second + 1));
	}
	cout << n << endl;
	return main();
}

Measured memory_bytes: 1884
#include <iostream>
#include <stdio.h>
#include <string>
#include <math.h>

using namespace std;

int main() {
  int N, i, j;
  int *x, *y;
  double res, tmp; 
  
  cin >> N;

  x = new int[N];
  y = new int[N];
  
  for(i = 0 ; i < N; i++){
    cin >> x[i];
    cin >> y[i];    
  }

  res = 0;
  
  for( i = 0; i < N-1; i++){
    tmp = 0; 
    for( j = i+1; j < N; j++){
      tmp += sqrt((x[i]-x[j])*(x[i]-x[j])+(y[i]-y[j])*(y[i]-y[j]));
    }
    res += (tmp/N); 
  }
  res *= 2;
  
  printf("%.10f\n",res);
  
  return 0;
}


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

int main() {
  string s;
  cin >> s;
  int answer = 0, count = 0;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] == 'A' || count != 0) {
      count++;
    }
    if (s[i] == 'Z') {
      answer = count;
    }
  }
  cout << answer << endl;
}


Measured memory_bytes: 640
import numpy as np

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

digit = len(bin(max(A+[K])))-2  # 桁数

binA = np.array([list(bin(a)[2:].rjust(digit, '0')) for a in A]).astype(int)
d_sum = binA.sum(axis=0)  # 1になってる数
max_size = binA.shape[0]


def max_sum(u_sum, d):
    if K-u_sum >= 2**(digit-1-d):
        if d == digit-1:
            return get_free_sum([d_sum[-1]], max_size)
        else:
            return max(max_sum(u_sum+2**(digit-1-d), d+1)+(max_size-d_sum[d])*2**(digit-1-d),
                       get_free_sum(d_sum[d+1:], max_size)+d_sum[d]*2**(digit-1-d))
    else:
        if d == digit-1:
            return d_sum[-1]
        else:
            return max_sum(u_sum, d+1)+d_sum[d]*2**(digit-1-d)


def get_free_sum(ones_list, nums):
    return sum([max(ones, nums-ones)*2**i for i, ones in enumerate(ones_list[::-1])])


print(max_sum(0, 0))


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


void solve(){
    long long n, d, x, y;
    int ans = 0;
    cin >> n >> d;
    for(int i = 0; i < n; i++){
        cin >> x >> y;
        if(x*x+y*y <= d*d) ans++;
    }
    cout << ans << "\n";

}


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

    bool multitest = false;
   // multitest = true;
    if(multitest){
        int t; cin >> t;
        while(t--)
            solve();
    }
    else
        solve();
}






Measured memory_bytes: 3652
x=int(input())
if 400<=x<=599:
    print(8)
elif x<=799:
    print(7)
elif x<=999:
    print(6)
elif x<=1199:
    print(5)
elif x<=1399:
    print(4)
elif x<=1599:
    print(3)
elif x<=1799:
    print(2)
elif x<=1999:
    print(1)

Measured memory_bytes: 9184
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
	ll p1[2000001],p3[2000001],a[2000001];
	char s[2000001];
int main() {
	cin.tie(NULL);
	cout.tie(NULL);
	ll cnt=0;
	ll n;
	cin>>n;
	cin>>s;
	ll c=0;
	for(ll i=0;i<n;i++)
	{
		if(s[i]=='1')
		c++;
	}
	if(c>1)
    p1[0]=1%(c-1);  
    p3[0]=1%(c+1);  
    for (int i = 1; i < n; i++)  
    {  
    	if(c>1)
        p1[i] = p1[i - 1]*(2%(c-1));
		if(c>1)
        p1[i] %=(c-1);
		p3[i] = p3[i - 1]*(2%(c+1));  
        p3[i] %=(c+1);  
    }  
    ll r1=0,r2=0,r3=0;  
    int i = 0, j = n - 1;  
    while (i < n)  
    {  
        if (s[j] == '1')  
        {
        	if(c>1)
            r1 += (p1[i]);
			if(c>1)  
            r1 %= (c-1);  
			r3 += (p3[i]);  
            r3 %= (c+1);
        }  
        i++;  
        j--;  
    }  
	for(ll i=0;i<n;i++)
	{
		if(s[i]=='0')
		{
			ll aa=(r3+p3[n-i-1])%(c+1);
			int cn=1;
			while(aa>0)
			{
				ll bb=__builtin_popcount(aa);
				aa%=bb;
				cn++;
			}
			a[i]=cn;
		}
		else
		{
			
			ll aa;
			int cn=1;
			if(c>1)
			aa=(r1-p1[n-i-1]+c-1)%(c-1);
			else{
			cn=0;
			aa=0;}
			while(aa>0)
			{
				ll bb=__builtin_popcount(aa);
				aa%=bb;
				cn++;
			}
			a[i]=cn;
		}
		
	}
	for(int i=0;i<n;i++)
	cout<<a[i]<<endl;
	return 0;
}


Measured memory_bytes: 8436
my ($n,$k) = split(/ /,<STDIN>);
my $h;my $counter1=0;my @h;
while ($counter1<$n){$h=<STDIN>;chomp$h;push(@h,$h);$counter1++;}
my @sorted=sort{$b<=>$a}(@h);$counter2=0;my @diff;my $diff;
while($counter2<$n-$k+1){$diff=$sorted[$counter2]-$sorted[$counter2+$k-1];push(@diff,$diff);
$counter2++;}
@diffsorted=sort{$a<=>$b}(@diff);
print $diffsorted[0],"\n";

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

// #include <atcoder/all>

#include <boost/operators.hpp>

class modint : private boost::operators<modint>, private boost::equivalent<modint> {
  modint(const long long x, const bool y)
      : x(x) {}

 public:
  static long long M;
  long long x;
  modint(const long long x = 0)
      : x((x % M + M) % M) {}
  modint operator-() const { return modint(x ? M - x : 0, true); }
  modint& operator+=(const modint& b) { return ((x += b.x) >= M ? x -= M : 0), *this; }
  modint& operator++() { return (++x >= M ? x -= M : 0), *this; }
  modint& operator-=(const modint& b) { return ((x -= b.x) < 0 ? x += M : 0), *this; }
  modint& operator--() { return (--x < 0 ? x += M : 0), *this; }
  modint& operator*=(const modint& b) { return x = x * b.x % M, *this; }
  modint& operator/=(const modint& b) { return *this *= b.pow(-1); }
  modint pow(long long b) const {
    long long r = 1, a = x;
    b = (b % (M - 1) + (M - 1)) % (M - 1);
    while (b) {
      if (b & 1) r = r * a % M;
      b = b >> 1;
      a = a * a % M;
    }
    return modint(r, true);
  }
  friend bool operator<(const modint& a, const modint& b) { return a.x < b.x; }
  friend std::istream& operator>>(std::istream& s, modint& a) { return s >> a.x, a = a.x, s; }
  friend std::ostream& operator<<(std::ostream& s, const modint& a) { return s << a.x; }
};
long long modint::M = 1e9 + 7;

// #LIB#

using namespace std;
// using namespace atcoder;
using ll = long long;
#define double long double
#define rep(i, n) for (long long i = 0; i < (n); ++i)
#define repr(i, a, b) for (auto i = (a); i < (b); ++i)
#define itr(x, c) for (auto&& x : (c))
#define updatemax(t, v) ((t) = std::max((t), (v)))
#define updatemin(t, v) ((t) = std::min((t), (v)))
#ifdef ONLINE_JUDGE
#define endl _endl
const char _endl = (cin.tie(0), cout.tie(0), ios::sync_with_stdio(0), cout.precision(16), '\n');
#endif

modint dp[1000100][2][2];
int main() {
  ll n;
  cin >> n;
  dp[0][0][0] = 1;
  rep(i, n) rep(j, 2) rep(k, 2) rep(x, 10) {
    dp[i + 1][j || x == 0][k || x == 9] += dp[i][j][k];
  }
  cout << dp[n][1][1] << endl;
}


Measured memory_bytes: 34908
import java.util.Scanner;

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

    int N = scanner.nextInt();
    long A = scanner.nextLong();
    long B = scanner.nextLong();
    int[] X = new int[N];
    for (int i = 0; i < N; i++) X[i] = scanner.nextInt();

    long cost = 0;
    for (int i = 1; i < N; i++) cost += Math.min(A * (X[i] - X[i - 1]), B);
    System.out.println(cost);
  }
}


Measured memory_bytes: 52740
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define erep(i,a,n) for(int i = a;i<=n;i++)
typedef long long ll;
#define int long long
#define vint vector<int>
#define vvint vector<vector<int>>
#define vstring vector<string>
#define vdouble vector<double>
#define vll vector<ll>:
#define vbool vector<bool>
#define INF 1101010101010101010
#define MOD 1000000007
#define P = pair<int,int>;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }

signed main(){
  int n;
  cin >> n;
  vint A(n);
  rep(i,0,n) cin >> A[i];
  int ans = 0;
  bool flag = true;
  rrep(i,n-1,0){
    if(A[i] > i){
      flag = false;
    }
    else{
      if(i == n-1){
        ans += A[i];
      }
      else{
        if(A[i+1] <= A[i]){
          ans += A[i];
        }
        else if(A[i+1] - A[i] >= 2){
          flag = false;
        }
      }
    }
  }
  if(flag) cout << ans << endl;
  else cout << -1 << endl;
}

Measured memory_bytes: 1792
#include <iostream>
#include <iomanip> //! for setprecision(10)
#include <math.h>
#include <algorithm>
#include <functional> 
#include <string>
#include <vector>

#include <cstring>
#include <set>
#include <map>
#include <queue>
#include <utility>

using namespace std;

typedef long long LL;

#define dump(c) { for (auto it = c.begin(); it != c.end(); ++it) if (it == c.begin()) cout << *it; else cout << ' ' << *it; cout << endl; } 
#define rep(i,n) for (int i = 0; i < (n); ++i)

const int MOD = 1000000007;

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

    vector<int> A(N);
    vector<int> F(N);
    rep(i, N) {
        cin >> A[i];
    }
    rep(i, N) {
        cin >> F[i];
    }
    sort(A.begin(), A.end());
    sort(F.begin(), F.end(), greater<int>());
    LL r = 0;
    rep(i, N) {
        r = max(r, (LL)A[i]*F[i]);
    }
    LL l = -1;

    //! Find the range (l, r] that we can accomplish by training
    while (l+1 < r) {
        LL m = (l + r) / 2;
        LL training = 0;
        rep(i, N) {
            training += max(0LL, A[i] - m/F[i]);
        }
        if (training <= K) {
            r = m;
        } else {
            l = m;
        }
    }

    cout << r << endl;

    return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <numeric>
#include <map>
#include <iomanip>

using namespace std;    
typedef long long ll;
typedef pair<ll, ll> pll;
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
const bool DEBAG = true;

int main(){

    ll N, L;
    cin >> N >> L;

    vector<ll> taste(N);
    for(ll i = 0; i < N; i++){
        taste[i] = L + i ;
    } 

    ll allT = accumulate(all(taste), 0ll);
    ll Diff = abs(allT);
    ll t = Diff;
    for(ll i = 0; i < N; i++){
        ll temp = allT - taste[i];
        ll diff = abs(allT - temp);
        if(diff < Diff){
            Diff = diff;
            t = temp;
        }
    }
    cout << t << endl;
}

Measured memory_bytes: 256
def examB():
    N = I()
    A = LI()
    ans = max(A)-min(A)
    print(ans)


import sys,copy,bisect,itertools,heapq,math
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

examB()


Measured memory_bytes: 3444
#include<bits/stdc++.h>
#define debug(x) cerr<<"\tDEBUG: "<<#x<<" = "<<(x)<<endl
#define debug2(a,x) cerr<<#a<<"\tDEBUG: "<<#x<<" = "<<(x)<<endl
using namespace std;
const int maxn=1e5+100;
int n,A[maxn];
int ans[maxn];
int main(){
	cin>>n;
	long long sum=0;
	for(int i=1;i<=n;i++){
		scanf("%d",&A[i]);
		sum+=A[i];
	}
	for(int i=1;i<n;i+=2){
		sum-=A[i]*2;
	}
	ans[n]=sum;
	ans[1]=A[n]*2-ans[n];
	for(int i=2;i<n;i++){
		ans[i]=A[i-1]*2-ans[i-1];
	}
	for(int i=1;i<=n;i++)
		printf("%d%c",ans[i],i==n?'\n':' ');
    return 0;
}

Measured memory_bytes: 2048
#include <atcoder/all>
int n, q, u, v;
main() {
    std::cin >> n >> q;
    atcoder::dsu d(n);
    while(q--) {
        std::cin >> n >> u >> v;
        if(n)
            std::cout << d.same(u, v) << std::endl;
        else
            d.merge(u, v);
    }
}

Measured memory_bytes: 3900
#include<iostream>
#include<map>
using namespace std;
map<int,int> a;
int main(void)
{
    int n,t,ans=0;
    cin >> n;
    for(int i=1;i<=n;i++)
    {
        cin >> t;
        a[t]=1-a[t];
        if(a[t]==0) ans--;
        else ans++;
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 4992
A, B, C, X, Y = map(int, input().split())
pair = min(A + B, 2 * C) 
ans = 0
remained_X = X!=0
remained_Y = Y!=0

while X != 0 and Y != 0:
    ans += pair
    X -= 1
    Y -= 1

price_A = min(A, 2 * C)
price_B = min(B, 2 * C)
ans += price_A * X + price_B * Y

print(ans)

Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>

using namespace std;

#define REP(i,n) for (int i=0;i<(n);++i)
#define REP2(i,n) for (int i=0;i<=(n);++i)
#define REP3(i,n) for (int i=1;i<=(n);++i)

static const int MAXN = 1001;
static const int MAXM = 1001;
static const int INF = 1e5;

int main() {

	int a,b;
	cin >> a >> b;
	
	if (a + b == 15) {
		cout << "+" << endl;
	}
	else if (a*b == 15) {
		cout << "*" << endl;
	}
	else {
		cout << "x" << endl;
	}



	//cout << "out" << endl;

	//int end;
	//cin >> end;

	return 0;
}

Measured memory_bytes: 256
use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {
        n: usize,
        a: [usize; n-1]
    }

    let mut ans = vec![0; n + 1];

    for i in 0..n - 1 {
        ans[a[i]] += 1;
    }

    for i in 1..n + 1 {
        println!("{}", ans[i]);
    }
}


Measured memory_bytes: 5552
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>

template <class T>
inline void read(T &x) {
    x = 0;
    int f = 0;
    char ch = getchar();
    while (!isdigit(ch))    { f |= ch == '-'; ch = getchar(); }
    while (isdigit(ch))     { x = (x << 1) + (x << 3) + (ch ^ 48); ch = getchar(); }
    x = f ? -x : x;
    return;
}

int x, y, z;

int main() {
    read(x), read(y), read(z);
    std::swap(x, y);
    std::swap(x, z);
    printf("%d %d %d\n", x, y, z);
    return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES  

#include <algorithm>
#include <iostream>
#include <string>
#include <cmath>
#include <vector>


int main(){
    std::string s;
    std::getline(std::cin, s);

    for(int i = 0; i < s.size(); ++i){
        char buf = s.at(i);
        if(65 <= buf && buf <= 95){
            buf += 32;
        }else if(97 <= buf && buf <= 122){
            buf -= 32;
        }

        std::cout << buf;
    }
    std::cout << std::endl;

    return 0;
}


Measured memory_bytes: 3200
import java.util.*;
public class Main {
    public static void main(String args[]){
        Scanner in=new Scanner(System.in);
		 int n=in.nextInt();
		 ArrayList<Long>[] g=new ArrayList[20001];
		 for (int i=0;i<20001;++i)
		     g[i]=new ArrayList<Long>();
		 for (int i=0;i<n;++i) {
		     int w=in.nextInt();
			 int s=in.nextInt();
			 long v=in.nextLong();
			 g[w+s].add(v*20000+s);
		 }
		 long[] dp=new long[20001];
		 for (int i=0;i<20001;++i) {
		     for (int j=0;j<g[i].size();++j) {
			 	 long tmp=g[i].get(j);
				 long v=tmp/20000;
				 int s=(int)(tmp%20000);
				 int w=i-s;
				 for (int k=s;k>=0;--k)
				     dp[k+w]=Math.max(dp[k+w],dp[k]+v);
			 }
		 }
		 long res=0;
		 for (int i=0;i<20001;++i)
		     res=Math.max(res,dp[i]);
	     System.out.println(res);
    }
}


Measured memory_bytes: 29772
// Wed Jul 29 19:48:22 IST 2020    
#include <bits/stdc++.h>        
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#define forn(ii,a,b)        for(int ii = (int)a ; ii < (int)b  ; ii++ )
#define debug(x)           cerr << #x << " " << x << " -- \n"
#define I__O               ios::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define int64              long long   
#define all(x)             (x).begin(),(x).end() 
#define precise(x)         cout << fixed << setprecision(12) << x << '\n'; 
using namespace std ;    
// policy based   
using namespace __gnu_pbds;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> indexed_set ; 
 
const int MOD = 1e9+7;
const double pi = 3.141592653589793238;
const int N = 2e5+7; 
const int INF = INT_MAX;

vector <vector <int>> g;
vector <int> people,happy,sum;
int n,m;
int dfs(int node,int parent){
    sum[node] = people[node];
    for(auto & child : g[node])
        if(child != parent)
            sum[node] += dfs(child,node); 
    return sum[node];
}
vector <int> bad,good;
bool check (int node, int parent, int bound){
    
    int childs_good = 0;
    bool ok = good[node] <= sum[node];
    for(auto &child : g[node])
        if(child != parent)    
            childs_good += good[child];
    ok &= childs_good <= good[node];
    return ok;
}
int tests(){ 
    int X;
    cin >> X;
    cout << (X >= 30 ? "Yes": "No") << '\n';
    return 0;
}   
int32_t main(){
    I__O ;     
    int cases = 1 ;  
    // cin >> cases ;
    for(int test = 1 ; test <= cases ; ++test){ 
        // cout << "Case #" << test << ":" << '\n';
        tests();
    }    
    return 0 ; 
}


Measured memory_bytes: 3652
N=int(input())
P=[int(i)-1 for i in input().split()]
isN=[k==i for k,i in enumerate(P)]
isN.append(False)
onelength=[]
flag=0
streak=0
for i in isN:
    if streak and not i:
        onelength.append(streak)
        streak=0
    if i:
        streak+=1
print(sum([(i+1)//2 for i in onelength]))

Measured memory_bytes: 13880
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll,ll> pll;
const ll mod=1e9+7;
//const ll mod=998244353;
const ll inf=1LL<<61;

ll mpow(ll x, ll n) {
  ll ans=1;
  while(n>0) {
    if(n&1) {
      ans=ans*x%mod;
    }
    x=x*x%mod;
    n>>=1;
  }
  return ans;
}

ll gcd(ll a,ll b) {
  if(b==0) {
    return a;
  }
  else {
    return gcd(b,a%b);
  }
}

int main() {
  ll n;
  cin >> n;
  vector<ll> a(n),b(n);
  for(ll i=0;i<n;i++) cin >> a[i] >> b[i];
  map<pll,ll> cnta,cntb;
  ll sum=n;
  ll ans=0;
  ll z=0;
  ll za=0;
  ll zb=0;
  for(ll i=0;i<n;i++) {
    if(a[i]*b[i]!=0) {
      ll tmp=gcd(abs(a[i]),abs(b[i]));
      a[i]/=tmp;
      b[i]/=tmp;
      if(a[i]*b[i]>0) {
        a[i]=abs(a[i]);
        b[i]=abs(b[i]);
      }
      else {
        a[i]=-abs(a[i]);
        b[i]=abs(b[i]);
      }
      cnta[{a[i],b[i]}]++;
      if(a[i]<0) {
        a[i]*=-1;
      }
      else {
        b[i]*=-1;
      }
      cntb[{b[i],a[i]}]++;
    }
    else if(a[i]==0&&b[i]==0) {
      sum--;
      z++;
    }
    else if(a[i]==0) {
      za++;
    }
    else if(b[i]==0) {
      zb++;
    }
  }
  vector<pll> cnt;
  set<pll> al;
  for(auto p:cnta) {
    ll f=p.first.first;
    ll s=p.first.second;
    if(f<0) f*=-1;
    else s*=-1;
    al.insert(pll{s,f});
    if(al.count(p.first))continue;
    if(cntb[p.first]) cnt.push_back({p.second,cntb[p.first]});
  }
  if(za*zb!=0) cnt.push_back({za,zb});
  for(auto p:cnt) {
    sum-=p.first+p.second;
  }
  ans=mpow(2,sum);
  for(auto p:cnt) {
    ans=(ans*(mpow(2,p.first)+mpow(2,p.second)-1+mod)%mod);
  }
  ans=(ans+z)%mod;
  cout << (ans-1+mod)%mod << endl;
}

Measured memory_bytes: 56248
#define _CRT_SECURE_NO_WARNINGS
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <array>
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
#include <bitset>
#include <utility>
#include <assert.h>
#include <regex>
#include <numeric>
#include <functional>
using namespace std;

typedef unsigned long long ull;
typedef signed long long ll;
#define INF (1LL << 48)

struct PT { ll x; ll y; };
string to_s(ull x) { return to_string(x); }
string to_s(ll x) { return to_string(x); }
ll to_ll(const string& x) { return stoll(x); }
ull to_ull(const string& x) { return stoull(x); }




int main(int argc, char* argv[])
{
	for (;;) {
		int N, M;

		cin >> N >> M;
		if (cin.fail()) break;

		map<int, int> V;
		for (int i = 0; i < N; i++) {
			int a;
			cin >> a;
			V[a]++;
		}
		for (int i = 0; i < M; i++) {
			int b, c;
			cin >> b >> c;
			V[c] += b;
		}
		ll res = 0;
		ll cnt = N;
		for (auto it = V.rbegin(); cnt > 0 && it != V.rend(); it++) {
			ll n = min((ll) it->second, cnt);
			res += it->first * n;
			cnt -= n;
		}
		cout << res << endl;
	}

	return 0;
}


Measured memory_bytes: 9600
#include <stdio.h>

int main(){
	long long int i,T=1,N,A[100001];
	scanf ("%lld",&N);
	for (i=0;i<N;i++){
		scanf ("%lld",&A[i]);
		if (A[i]==0){
			printf("0\n");
			return 0;
		}
	}
	for (i=0;i<N;i++){
		if (A[i] <= 1000000000000000000/T){
			T *= A[i];
		}
		else{
			printf ("-1\n");
			return 0;
		}
	}
	printf ("%lld\n",T);
	return 0;
}

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

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vint;
#define FOR(i,a,b) for(int i=(a);i<(int)(b);i++)
#define rep(i,n) FOR(i,0,n)
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define SZ(x) (int)(x).size()
#define ZERO(a) memset(a,0,sizeof(a))
#define dbg(x) cout<<#x<<": "<<(x)<<"\n"
#define pb push_back
#define eb emplace_back
#define mp make_pair

int n,k,x,y;

int main() {
    cin>>n>>k>>x>>y;
    int ans = 0;
    FOR(i,1,n+1) {
        if(i<=k) ans += x;
        else ans += y;
    }
    cout<<ans<<"\n";

    return 0;
}


Measured memory_bytes: 256
A, B, C, K = list(map(int, input().split()))

cards = 0
ans = 0

if A >= K:
    ans = K
else:
    ans += A
    cards += A
    if cards + B >= K:
        pass
    else:
        cards += B
        ans +=  -1 * (K - cards)

print(ans)

Measured memory_bytes: 9160
#include <iostream>
#include <vector>
#include <cmath>

using namespace std;

int main()
{
    ios_base::sync_with_stdio(0);
    int x, n;
    cin >> x >> n;
    vector<bool> jest(102, false);
    for (int i = 0; i < n; ++i)
    {
        int x;
        cin >> x;
        jest[x] = true;
    }
    int wb = 200, odp;
    for (int i = 0; i < 102; ++i)
    {
        if (!jest[i])
        {
            if (abs(x - i) < wb)
            {
                wb = abs(x - i);
                odp = i;
            }
        }
    }
    cout << odp;
    return 0;
}


Measured memory_bytes: 3648
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>

int main(void){
    int N;
    unsigned long long int res=0;
    std::cin >> N;

    for(int i=1;i<=N;i++){
        if(i%3!=0&&i%5!=0) res+=i;
    }
    std::cout << res << std::endl;

    return 0;
}

Measured memory_bytes: 3608
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <iostream>

using namespace std;

const int maxn = 200000 + 5;

int k,n;
int cnt[maxn];
int a[maxn],tot;

int main(){
	cin >> n >> k;
	tot = 0;
	for(int i = 1;i <= n;i++){
		int a;
		scanf("%d",&a);
		cnt[a]++;
	}
	for(int i = 1;i <= n;i++){
		if(cnt[i] > 0){
			a[++tot] = cnt[i];
		}
	}
	sort(a + 1,a + 1 + tot);
	int ans = 0;
	for(int i = 1;i <= tot - k;i++){
		ans += a[i];
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 1792