akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <cmath>
#include <tuple>
#include <cstdio>
#include <bitset>
#include <sstream>
#include <iterator>
#include <numeric>
#include <map>
#include <cstring>
#include <set>
#include <functional>
#include <iomanip>

using namespace std;

#define DEBUG_ //!!提出時にコメントアウト!!
#ifdef DEBUG_
	#define dump(x)  cerr << #x << " = " << (x) << endl;
#else
	#define dump(x)  ;
#endif

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SZ(x) ((int)(x).size())
#define pb push_back
#define eb emplace_back

//#define int long long

typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;

template <typename T>
std::string printVector(const std::vector<T> &data)
{
    std::stringstream ss;
    std::ostream_iterator<T> out_it(ss, ", ");
    ss << "[";
    std::copy(data.begin(), data.end() - 1, out_it);
    ss << data.back() << "]";
    return ss.str();
}

const int MOD = 1e9+7;
const LL LINF = 1001002003004005006ll;
const int INF = 1001001001;

signed main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N; cin >> N;
    VI H(N); REP(i,N) cin >> H[i];
    bool ok = 1;
    H[0]--;
    FOR(i,1,N){
        if(H[i] == H[i-1]){;}
        else if(H[i] > H[i-1]){
            H[i]--;
        }
        else{
            ok = 0;
            break;
        }
    }
    if(ok) cout << "Yes" << endl;
    else cout << "No" << endl;

}


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

using namespace std;
using ll = long long;

#define FOR(i,a,n) for(int i=(a); i<(n); i++)
#define REP(i,n) FOR(i, 0, n)
#define FORD(i,a,n) for(int i=(a); i>=(n); i--)
#define REPD(i,n) FOR(i, n, 0)

#define ALL(o) (o).begin(), (o).end()

template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
template<class T> using PQ = priority_queue<T>;
template<class T> using PQR = priority_queue<T, vector<T>, greater<T> >;

const ll MOD = 1000000007;

int main() {
	int n, x;
	cin >> n;
	long ans = MOD;
	V<int> v;

	REP(i,n) {
		cin >> x;
		v.push_back(x);
	}

	long tmp = 0;
	FOR(i, 1, 101) {
		tmp = 0;
		REP(j, n) {
			// cout << i << " " << j <<  " " << v[j] << endl;
			tmp += ((v[j] - i) * (v[j] - i));
			// int t = ((v[j] - i) * (v[i] - i));
			// cout << t << endl;
			// tmp += t;

		}
		if(ans > tmp) ans = tmp;
	}

	
	cout << ans << endl;
	return 0;

}



Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#define rep(i, n) for(int i = 0; i < (int)(n); ++i)
#define REP(i, n) for(int i = 1; i < (int)(n); ++i)
using namespace std;

int main() {
    int N;
    cin >> N;
    vector<long long> A(N);
    rep(i, N) cin >> A[i];
    
    vector<long long> S(N + 1, 0);
    rep(i, N) S[i + 1] = S[i] + A[i];
    long long ans = 100100100100100100;
    REP(i, N) {
        long long a = S[i];
        long long b = S[N] - S[i];
        ans = min(ans, abs(a - b));
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3328
// Optimise
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

// #define MULTI_TEST
#ifdef LOCAL
#define db(...) ZZ(#__VA_ARGS__, __VA_ARGS__);
#define pc(...) PC(#__VA_ARGS__, __VA_ARGS__);
template <typename T, typename U>
ostream &operator<<(ostream &out, const pair<T, U> &p)
{
    out << '[' << p.first << ", " << p.second << ']';
    return out;
}
template <typename Arg>
void PC(const char *name, Arg &&arg)
{
    while (*name == ',' || *name == ' ')
        name++;
    std::cerr << name << " { ";
    for (const auto &v : arg)
        cerr << v << ' ';
    cerr << " }\n";
}
template <typename Arg1, typename... Args>
void PC(const char *names, Arg1 &&arg1, Args &&... args)
{
    while (*names == ',' || *names == ' ')
        names++;
    const char *comma = strchr(names, ',');
    std::cerr.write(names, comma - names) << " { ";
    for (const auto &v : arg1)
        cerr << v << ' ';
    cerr << " }\n";
    PC(comma, args...);
}
template <typename Arg1>
void ZZ(const char *name, Arg1 &&arg1)
{
    std::cerr << name << " = " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void ZZ(const char *names, Arg1 &&arg1, Args &&... args)
{
    const char *comma = strchr(names + 1, ',');
    std::cerr.write(names, comma - names) << " = " << arg1;
    ZZ(comma, args...);
}
#else
#define db(...)
#define pc(...)
#endif

using ll = long long;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define f first
#define s second
#define pb push_back
#define all(v) v.begin(), v.end()
auto TimeStart = chrono::steady_clock::now();
auto seed = TimeStart.time_since_epoch().count();
std::mt19937 rng(seed);
template <typename T>
using Random = std::uniform_int_distribution<T>;

const int NAX = 2e5 + 5, MOD = 1000000007;

void solveCase()
{
    string str;
    cin >> str;
    int n = str.length();
    map<pair<int, string>, int> dp;
    function<int(int, string)> solve = [&dp, &solve, &n, &str](int pos, string prev) -> int {
        if (pos == n)
            return 0;
        auto it = dp.find({pos, prev});
        if (it != dp.end())
            return it->s;
        string now = "";
        int ans = 0;
        for (int posi = pos; posi < n; posi++)
        {
            now += str[posi];
            if (prev != now)
                ans = max(ans, 1 + solve(posi + 1, now));
            if (now.length() == 3)
                break;
        }
        return dp[{pos, prev}] = ans;
    };
    cout << solve(0, "") << '\n';
}

int32_t main()
{
#ifndef LOCAL
    ios_base::sync_with_stdio(0);
    cin.tie(0);
#endif
    int t = 1;
#ifdef MULTI_TEST
    cin >> t;
#endif
    for (int i = 1; i <= t; ++i)
    {
        solveCase();
#ifdef TIME
        cerr << "Case #" << i << ": Time " << chrono::duration<double>(chrono::steady_clock::now() - TimeStart).count() << " s.\n";
        TimeStart = chrono::steady_clock::now();
#endif
    }
    return 0;
}


Measured memory_bytes: 102292
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
int main(){
    long long n,k,mn;
    cin >> n >> k;
    n%=k;
    mn=n;
    map<long long,long long> mp;
    mp[n]=1;
    while(1){
        n=abs(n-k);
        if(mp.count(n))break;
        else mn=min(mn,n);
    }
    cout << mn << endl;
}


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

#define ll long long
#define str string
#define pii pair<int, int>
#define pll pair<ll, ll>
#define fi first
#define se second

#define vc vector<char>
#define vvc vector<vc>
#define vi vector<int>
#define vll vector<ll>
#define vvi vector<vi>
#define vvll vector<vll>
#define vvvll vector<vvll>
#define vs vector<str>
#define vvs vector<vs>
#define vpii vector<pii>
#define vvpii vector<vpii>
#define vpll vector<pll>
#define vvpll vector<vpll>
#define vb vector<bool>
#define vvb vector<vb>
#define rep(i, a, b) for (int i = (a); i < int(b); i++)
#define repi(i, a, b) for (int i = (a); i <= int(b); i++)


using namespace std;
ll INF = LONG_LONG_MAX;
ll mod = 1000000000 + 7;

template <typename T, typename L>
void read(vector<T> & _data, L & _size, bool _shift) {
    _data.resize(_size + (ll)_shift);
    for (ll i = (ll)_shift; i < _size + (ll)_shift; i++)
        cin >> _data[i];
}

template <typename T, typename L>
void read(vector<vector<T>> & _data, L & _rows, L & _cols, bool _shiftRows, bool _shiftCols) {
    _data.resize(_rows + (ll)_shiftRows);
    for (ll i = 0; i < _rows + (ll)_shiftRows; i++)
        _data[i].resize(_cols + (ll)_shiftCols);
    for (ll i = (ll)_shiftRows; i < _rows + (ll)_shiftRows; i++)
        for (ll j = (ll)_shiftCols; j < _cols + (ll)_shiftCols; j++)
            cin >> _data[i][j];
}

template <typename T>
void write(vector<T> & _data, bool _shift) {
    for (ll i = (ll)_shift; i < _data.size(); i++)
        cout << _data[i] << " ";
    cout << endl;
}


//TODO: SOLUTION

ll n, k;
vll a;

void solve() {
    cin >> n >> k;
    read(a, n, 0);

    sort(a.begin(), a.end(), greater<>());

    ll lo = 1;
    ll hi = *max_element(a.begin(), a.end());
    ll best = hi;

    while (lo <= hi) {
        ll mid = (lo + hi) / 2;
        ll touse = k;
        ll i = 0;

        while (i < n && touse >= 0) {
            ll cuts;
            if (a[i] % mid == 0)
                cuts = a[i] / mid - 1;
            else
                cuts = a[i] / mid;
            touse -= cuts;
            i++;
        }

        if (i == n && touse >= 0) {
            best = mid;
            hi = mid - 1;
        }
        else {
            lo = mid + 1;
        }
    }

    cout << best << endl;
}


int main() {

    // TODO: Set value of this variable manually
    bool _multipleTestCases = false;

    if (_multipleTestCases) {
        ll t; cin >> t;
        while (t--)
            solve();
    }
    else {
        solve();
    }

    return 0;
}

Measured memory_bytes: 4772
S = input()

def judge(S):
    for i in range(len(S)):
        if i % 2 == 0 and S[i] == 'L':
            return 'No'
        elif i % 2 != 0 and S[i] == 'R':
            return 'No'
    return('Yes')

print(judge(S))

Measured memory_bytes: 2940
package main

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

func main() {

	stdin := bufio.NewScanner(os.Stdin)
	stdin.Scan()
	DTS := strings.Split(stdin.Text(), " ")
	D, _ := strconv.ParseFloat(DTS[0], 64)
	T, _ := strconv.ParseFloat(DTS[1], 64)
	S, _ := strconv.ParseFloat(DTS[2], 64)

	if (D / S) <= T {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


Measured memory_bytes: 1740
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <string>

using namespace std;
using ll = long long int;
using vec = vector<int>;

#define rep(i, n) for(int i = 0; i < (n); ++i)
#define Sort(a)   sort(a.begin(), a.end())
const int INF = 2147483647;
const ll  MOD = 1000000007;

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

    cout << (h / a) + ((h % a == 0)? 0 : 1);
}

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

int main(){
    int waste;
    cin >> waste;
    string s;
    cin >> s;
    int x = 0, max = 0;
    for(int i = 0; i < s.size(); ++i){
        if(s[i] == 'I') x++;
        else x--;
        if(max < x) max = x;
    }

    cout << max << endl;
    
    return 0;
}


Measured memory_bytes: 504
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <math.h>
#include <cassert>
#define rep(i,n) for(int i = 0; i < n; ++i )
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main() {
  int n;
  cin >> n;
  map<int,int> p;
  rep(i,n){
    int x = i+1;
    for(int m = 2; m*m<=x; ++m){
      while(x%m==0){
        p[m]++;
        x /= m;
      }
    }
    if(x>1) p[x]++;
  }
  auto f = [&](int n){
    --n;
    int res = 0;
    for(auto i:p){
      if(i.second<n)break;
      ++res;
    } 
    return res;
  };
  int ans = f(75)
          + f(25)*(f(3)-1)
          + f(15)*(f(5)-1)
          + f(5)*(f(5)-1)/2*(f(3)-2);
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define mod 998244353
int f[12001];
int fi[12001];
int n, k;
int m(int a,int b){
	return (a * b)% mod;
}
int fp(int x,int y) {
	int res=1;
	while(y){
		if(y&1) res = res*x%mod;
		x=x*x%mod;
		y>>=1;
	}
	return res;
}
int iv(int x){
	return fp(x, mod - 2);
}
int c(int x, int y){
	// chon x tu y
	return m(f[y],m(fi[x],fi[y - x]));
}
int ck(int x,int y){
	// chia x keo cho y em
	if(x < 0) return 0;
	return c(y - 1 ,x + y - 1);
}

signed main(){
	ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
	f[0] = 1;
	for(int i = 1 ; i <= 10000 ; i ++) f[i] = m(f[i - 1], i);
	fi[10000] = iv(f[10000]);
	for(int i = 9999 ; i >= 0 ; i --) fi[i] = m(fi[i + 1], (i + 1));
	
//	int u,v;
//	while(cin >> u >> v)
//		cout << ck(u,v) << endl;
	cin >> k >> n;
	for(int i = 2 ; i <= k + k ; i ++){
		int p = 0;
		for(int j = 1 ; j <= k ; j ++){
			int _j = i - j;
			if(_j > 0 && _j != j && _j <= k) p ++;
		}
		p/= 2;
//		cout << "#i = " << i << endl;
		if(i % 2 == 1){
			int ans = 0;
			for(int q = 0; q <= p ; q ++){
//				cout << "#q = " << q << endl;
//				cout << "pair = " << c(q,p) << endl;
//				cout << "n - q = " << n - q << endl;
//				cout << "q + k - 2p = " << q + k - 2*p << endl;
//				cout << "ck = " << ck(n - q, q + k - 2*p) << endl;
				ans = (ans + m(m(c(q, p),fp(2,q)),ck(n - q, q + k - 2*p)))%mod;
			}
			cout << ans << endl;
		} else{
			int ans = 0;
			for(int q = 0; q <= p ; q ++)
				ans = (ans + m(m(c(q, p),fp(2,q)), ck(n - q - 1, q + k - 2*p - 1)))%mod;
			for(int q = 0; q <= p ; q ++)
				ans = (ans + m(m(c(q, p),fp(2,q)), ck(n - q , q + k - 2*p - 1)))%mod;
			cout << ans << endl;
		}
	}
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define repr(i,from,to) for(int (i)=(from);(i)<(to);(i)++)
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
// const bool debug=true;
const bool debug=false;
#define DEBUG if(debug==true)
#define vprint(x) for(auto a:(x)) cout << x << endl;
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll MOD = 1000000007;
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) { a = b; return true;}
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) { a = b; return true;}
    return false;
}
int main(void) {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a,b,c;cin>>a>>b>>c;
    cout << c << " " << a << " " << b << endl;
    return 0;
}


Measured memory_bytes: 256
package main

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

var sc = bufio.NewScanner(os.Stdin)

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

func iScan() int {
	n, _ := strconv.Atoi(Scan())
	return n
}

func fScan() float64 {
	n, _ := strconv.ParseFloat(Scan(), 64)
	return n
}
func stringToInt(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}
func SScan(n int) []string {
	a := make([]string, n)
	for i := 0; i < n; i++ {
		a[i] = Scan()
	}
	return a
}
func iSScan(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = iScan()
	}
	return a
}
func abs(x int) int {
	if x < 0 {
		x = -x
	}
	return x
}
func larger(a, b int) int {
	if a < b {
		return b
	} else {
		return a
	}
}
func smaller(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}
func max(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x < a[i] {
			x = a[i]
		}
	}
	return x
}
func min(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x > a[i] {
			x = a[i]
		}
	}
	return x
}
func sum(a []int) int {
	x := 0
	for _, v := range a {
		x += v
	}
	return x
}

var mod int = 1000000007

func main() {
	buf := make([]byte, 0)
	sc.Buffer(buf, mod)
	sc.Split(bufio.ScanWords)
	n := iScan()
	x := 1
	for i := 1; i <= n; i++ {
		x *= i
		x %= mod
	}
	fmt.Println(x)
}


Measured memory_bytes: 1772
#include<bits/stdc++.h>
#define Max(a,b) (a>b?a:b)
#define Min(a,b) (a<b?a:b)
typedef long long ll;
inline int read(){
	int f=1,x=0;char c=getchar();
	while(c<'0'||c>'9'){
		if(c=='-')
			f=-1;
		c=getchar();
	}
	while(c<='9'&&c>='0'){
		x=x*10+c-'0';
		c=getchar();
	}
	return x*f;
}

inline void file(){
	freopen("1.in","r",stdin);
	freopen("1.out","w",stdout);
}

using namespace std;
const int maxn=1e5+10;
ll a[maxn],b[maxn];

int main(){
	//file();
	ll k,n,h;
	//scanf("%lld%lld",&n,&h);
	cin>>n>>h;
	for(register int i=1;i<=n;++i)
		cin>>a[i]>>b[i];

	sort(a+1,a+n+1);
	sort(b+1,b+n+1);
	for(register int i=1;i<=n;++i)
		b[i]=max(b[i],a[n]);

	ll ovo=0;
	for(register int i=n;i>=1;--i){
		ovo+=b[i];
		if(ovo>=h){
			printf("%lld",n-i+1);
			return 0;
		}
	}
	int ans=n;
	ans+=(h-ovo)/a[n];
	if((h-ovo)%a[n])
		++ans;
	cout<<ans;
	return 0;
}




Measured memory_bytes: 1792
#include <iostream>
using namespace std;
int main(void){

    while(true){
        int s, o, i;
        int a, b, c, d, e, f;
        
        cin >> s;
        if(s == 0){
            break;
        }
        
        o = 1000 - s;
        
        a = o / 500;
        b = (o - 500*a ) / 100;
        c = (o - 500*a - 100*b) / 50;
        d = (o - 500*a - 100*b - 50*c) / 10;
        e = (o - 500*a - 100*b - 50*c - 10* d) / 5;
        f = o - 500*a - 100*b - 50*c - 10* d - 5*e;
        
        i = a + b + c + d + e + f;
        
        cout << i << endl;
    }
}



Measured memory_bytes: 3012
#include<bits/stdc++.h>
using namespace std;
int main(){
    long long n;cin>>n;
    long long a1=0;
    long long a2=0;
    for(long long i=1;i*i<=n;i++){
        if(n%i==0){
            a1 = i;
            a2 = n/i;
        }
    }
    if(a1==0&&a2==0){
        a1=1;a2=n;
    }
    cout<<a1+a2-2<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<math.h>
#include<vector>
#include<algorithm>
#include<cstdio>
#include <string>
#include <complex>
#include <functional>
using namespace std;
typedef pair<int,int> P;

int main(){
  int n;
  char c;
  int ans,ace;
 
 while(1){
    ans = 0;
    ace = 0;
 
    while(1){
      c = getchar();
      if(c=='0')goto Loop;
      if(c=='\n')break;
      else if(c!=' '){
    n = c-'0';
    if(n==1){
      c = getchar();
      if(c=='\n'){
        ans += 1;
        ace = 1;
        break;
      }else if(c!=' '){
        ans += 10;
      }else{
        ans += 1;
        ace = 1;
      }
    }else{
      ans += n;
    }
      }
    }
 
    if(ans<12 && ace)ans+=10;
    if(ans>21)ans = 0;
    cout << ans << endl;
  }
 Loop:return 0;
}


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

int main()
{
	int A, B, C, D;
	cin >> A >> B >> C >> D;
	if (A < C)A = C;
	if (B > D)B = D;
	int res;
	res = B - A;
	if (res < 0)res = 0;
	cout << res;
    return 0;
}


Measured memory_bytes: 256
#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
typedef vector<int> VI;
#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
//vector<vector<int> > dp;
//vector<vector<vector<int> > > vvvi;
//dp=vector<vector<int> >(N, vector<int>(M,0));
//vector<pair<int,int> > v;
//v.push_back(make_pair(x,y));



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

	int H, W, N;
	cin >> H >> W >> N;
	int x[9] = { 0,0,0,-1,-1,-1,-2,-2,-2 };
	int y[9] = { 0,-1,-2,0,-1,-2,0,-1,-2 };

	map<pair<int, int>, int>mp;
	map<pair<int, int>, int>::iterator it;
	vector<int> ans(10, 0);
	
	REP(i, N) {
		int a, b;
		cin >> a >> b;
		REP(j, 9) {
			if(1<=a+x[j] && a+x[j]<=H-2 && b+y[j]>=1  && b+y[j]<=W-2)
				mp[make_pair(a + x[j], b + y[j])]++;
		}
	}
	int sum = 0;
	for (it = mp.begin(); it != mp.end(); it++) {
		ans[it->second]++;
		//cout << it->second << endl;
		//cout << it->first.first << " " << it->first.second << " " << it->second << endl;
		sum++;
	}
	




	ans[0] = (H - 2) * (W - 2) -sum;
	REP(i, 10) {
		cout << ans[i] << endl;
	}

	return 0;
}



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

namespace AOJVolume0_0000
{
    class Program
    {
        static void Main(string[] args)
        {
            for (int i = 1; i <= 9; ++i)
            {
                for (int j = 1; j <= 9; ++j)
                {
                    Console.WriteLine(i + "x" + j + "=" + i * j);
                }
            }
        }
    }
}



Measured memory_bytes: 15760
import static java.lang.Integer.parseInt;
import java.util.Scanner;

public class Main {
	
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String[] base = sc.nextLine().split(" "); //[A, B, C, X, Y];
        final int A = parseInt(base[0]);
        final int B = parseInt(base[1]);
        final int C = parseInt(base[2]);
        int X = parseInt(base[3]);
        int Y = parseInt(base[4]);
        
        if (useCpizza(A, B, C)) {
        	int totalCost = 0;
        	
        	while (X > 0 && Y > 0) {
        		totalCost += C * 2;
        		X--;
        		Y--;
        	}
        	
        	if(isBetterThan(A, C)) {
            	while (X > 0) {
            		totalCost += C * 2;
            		X--;
            	}
        	}

        	
        	if (isBetterThan(B, C)) {
            	while (Y > 0) {
            		totalCost += C * 2;
            		Y--;
            	}
        	}

        	System.out.print(totalCost + (A * X) + (B * Y));
        } else {
            System.out.println((X * A) + (Y * B));
        }
        

    }
    
    /**
     * Cピザが利用する価値があるかを判定
     * @param A
     * @param B
     * @param C
     * @return
     */
    public static boolean useCpizza(int A, int B, int C) {
    	return (A + B) > (C * 2);
    }
    
    /**
     * 対象を利用するよりCを利用したほうが安いか判定
     * @param target
     * @param C
     * @return
     */
    public static boolean isBetterThan(int target, int C) {
    	return target > (C * 2);
    }
}

Measured memory_bytes: 21972
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <string>
#include <sstream>
#include <set>
#include <map>
#include <iostream>
#include <utility>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <unordered_set>
#include <unordered_map>
#include <limits.h>
#include <cstring>
#include <tuple>
#include <cassert>
#include <numeric>
using namespace std;
// type alias
typedef long long LL;
typedef vector < int > VI;
typedef unordered_map < int, int > MAPII;
typedef unordered_set < int > SETI;
typedef pair< int , int > II;
typedef tuple< int, int, int > III;
// repetition
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)
#define REPE(i,n)  for(int i=0;i<=(n);++i)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  for(int i=0;i<(n);++i)
#define FORR(x,arr) for(auto& x:arr)
#define SZ(a) int((a).size())
// DP
#define MINUS(dp) memset(dp, -1, sizeof(dp))
#define ZERO(dp) memset(dp, 0, sizeof(dp))
// minmax
#define SMAX(a,b) a = max(a,b)
#define SMIN(a,b) a = min(a,b)
// debug cerr
#define TRACE true
#define dump(x) if(TRACE) { cerr << #x << " = " << (x) << endl; }
#define dump2(x,y) if(TRACE) { cerr << #x << " = " << (x) << ", " << #y << " = " << (y) << endl; }
#define dump3(x,y,z) if(TRACE) { cerr << #x << " = " << (x) << ", " << #y << " = " << (y) << ", " << #z << " = " << (z) << endl; }
#define dump4(x,y,z,a) if(TRACE) { cerr << #x << " = " << (x) << ", " << #y << " = " << (y) << ", " << #z << " = " << (z) << ", " << #a << " = " << (a) << endl; }
#define dumpAR(ar) if(TRACE) { FORR(x,(ar)) { cerr << x << ','; } cerr << endl; }

// $ g++ -std=c++11 -Wall -O2 -D_GLIBCXX_DEBUG x.cpp && ./a.out
int A,B;
const string yes="Yay!",no=":(";
int X[16];
void solve() {
  MINUS(X);
  if(A<B) swap(A,B);
  X[0]=0,--A;
  FOR(i,1,16) {
    if(X[i-1]==0&&B>0) X[i]=1,--B;
    else if(X[i-1]==1&&A>0) X[i]=0,--A;
    else if(X[i-1]==-1&&A>0) X[i]=0,--A;
    else if(X[i-1]==-1&&B>0) X[i]=1,--B;
  }
  dump2(A,B);
  dumpAR(X);
  if(A>0||B>0) cout<<no<<endl;
  else if(X[15]==X[0]) cout<<no<<endl;
  else cout<<yes<<endl;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  
  cin>>A>>B;
  solve();
  return 0;
}


Measured memory_bytes: 256
n,k = map(int,input().split())
l = [0]*(10**5+1)
for i in range(n):
    ai,bi = map(int,input().split())
    l[ai]+=bi
for index,i in enumerate(l):
    if i:
        k-=i
        if k<=0:
            break
print(index)

Measured memory_bytes: 76876
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cmath>
using namespace std;
const int N=100010,Mo=1000000007;
int tp;
int c[N],v[N],a[N],b[N];
inline int gi() {
    int x=0,o=1;
    char ch=getchar();
    while(ch!='-'&&(ch<'0'||ch>'9')) ch=getchar();
    if(ch=='-') o=-1,ch=getchar();
    while(ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar();
    return x*o;
}
struct Dat {
    int x,y;
    inline bool operator < (const Dat &A) const {
	return x==A.x?y>A.y:x<A.x;
    }
} g[N];
inline void add(int x,int y) {
    while(x<=tp) c[x]=(c[x]+y)%Mo,x+=(x&-x);
}
inline int query(int x) {
    int ret=1;
    while(x) ret=(ret+c[x])%Mo,x-=(x&-x);
    return ret;
}
int main() {
    int n,m;
    cin>>n>>m;
    for(int i=1;i<=n;i++) a[i]=gi();
    for(int i=1;i<=m;i++) b[i]=gi();
    for(int i=1,j=0;i<=n;i++) {
	while(j<m&&b[j+1]<a[i]) ++j;
	if(j&&j<m) g[++tp]=(Dat){a[i]-b[j],b[j+1]-a[i]};
    }
    sort(g+1,g+1+tp);
    for(int i=1;i<=tp;i++) v[i]=g[i].y;
    sort(v+1,v+1+tp);
    for(int i=1;i<=tp;i++) {
	if(g[i].x==g[i-1].x&&g[i].y==g[i-1].y) continue;
	int t=lower_bound(v+1,v+1+tp,g[i].y)-v;
	add(t,query(t-1));
    }
    cout<<query(tp);
    return 0;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef long double ld;
#define mod 1000000007
#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)
#define setA0(a) for(ull i =0;i<n;i++){a[i] = 0;}
#define aout(a) for(auto x : a){cout<<x<<' ';} // array output macro 
#define ain(a) for(ull i =0;i<n;i++){cin>>a[i];} //array input macro
#define NofSetBits(x) __builtin_popcount(x);
#define InpGrph(g,e) while(e--){ll x;ll y;cin>>x>>y ;g[x].pub(y);g[y].pub(x);}
#define FastIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);



int main(){
  FastIO;
  ll r;
  cin>>r;
  cout<<r*r;
  return 0;
}


Measured memory_bytes: 3608
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<P,int> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-8;
const ll mod=1e9+7;
const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

int a,b,c,d;

int main(){
	cin>>a>>b>>c>>d;
	cout<<min(a,b)+min(c,d)<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A,B,C,X;
  cin >> A >> B >> C >> X;
  int ans=0;
  for (int i=0;i<A+1;i++){
    for (int j=0;j<B+1;j++){
      int k=(X-500*i-100*j)/50;
      if (0<=k&&k<=C){
        ans++;
      }
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define vi vector<int>
#define vii vector<vi>
#define vs vector<string>
#define vss vector<vs>
#define pii pair<int, int>
#define all(x) x.begin(), x.end()
#define rep(i, a, n) for (ll i = (a); i < (n); ++i)
#define repr(i, a, n) for (ll i = (n); i >= (a); --i)
using namespace std;
const int INF(1 << 30);
const ll LLINF(1LL << 55LL);
const int pi = 3.1415926536;
const int MOD = 1000000007;
const int MAX = 510000;

void Main() {
  int k;
  vi num(3);

  rep(i, 0, 3) cin >> num[i];
  cin >> k;

  sort(all(num));
  cout << num[0] + num[1] + num[2] * (2 << k - 1) << endl;
}

int main() {
  std::cin.tie(nullptr);                  // 標準入出力高速化
  std::ios_base::sync_with_stdio(false);  // CとC++の入出力出力を非同期
  std::cout << std::fixed << std::setprecision(15);  // 小数を10進数表示
  Main();
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define int long long
#define pb push_back
#define sz(i) (int)(i.size())
#define F first
#define S second
#define L long double
#define P pair<int, int>
const int inf = 0x3f3f3f3f3f3f3f3LL;
const int mod = (int)1e9 + 7;
using namespace std;
#if LOCAL
#include "../../tr.h"
#else
#define tr(...)
#define endl '\n'
#endif
template<class T> void smin(T& a, T val) {if (a > val) a = val;}template<class T> void smax(T& a, T val) {if (a < val) a = val;}
const int N = 5*(int)1e5 + 10;

int n, a[N], k;
int32_t main(){_

   cin>>n;

   cin>>k;

   if (k == 1){
      cout<<0;
      exit(0);
   }

   cout<<n-k;
   


   return 0;
}

// Common sense: do smth instead of nothing
// Even a single second counts...
// If other's can do it, even I can do it. It wouldn't be that tough. Let me give it a try.
// Mistakes made in past
// -Ques. ask for max-min => think binary_search, DP, greedy
// -not reading question properly / skipping to read & understand all samples properly & wasting time in wrong direction.
// -Using wrong indexing in nested loops something like a[i], when it is supposed to be a[j](WA)
// -value of const int N is not correct (WA/RTE).
// -Did you memset dp to -1 ?
// -check for small edges cases and work on small test cases manually if WA
// -not deallocating memory to pointers can lead to MLE. Use delete :))
// -not reading problem statements of harder problems E,..., thinking it couldn't be solved, but it isn't the case.
// -Avoid using #define int long long as much as possible when it's dp problem and requires high memory say, O(N^2, N=5000) (MLE)
// -Check Bitwise Operator Precedence 
// -Use pragmas to optimize (by constant factor) when necessary..
// -Think before coding & starting to debug. Have patience to look inside code and actually see how it works   

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

int main() {
  string s;
  cin >> s;
  bool kusa = false;
   for (int i = 0; i < 2; i++){
     if (s.at(i) != s.at(i + 1)){
       kusa = true;
     }
     if (kusa){break;}
   }
  if (kusa){
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
    
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <climits>
#include <string>
#include <bitset>
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<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 drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define fin(ans) cout<<(ans)<<endl
#define STI(s) atoi(s.c_str())
#define mp(p,q) make_pair(p,q)
#define pb(n) push_back(n)
#define Sort(a) sort(a.begin(),a.end())
#define Rort(a) sort(a.rbegin(),a.rend())
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;}
const int P = 1000000007;
const int INF = INT_MAX;
const long long LLINF = 1LL<<60;
//g++ -std=c++1z main.cpp
//.\a.exe

int main(void){ios::sync_with_stdio(false);cin.tie(0);
////////////////////////////////////////////////////////
int n,k,ans=0;
cin >> n >> k;
int x[n];
for(int i=0;i<n;i++){
	cin >> x[i];
}

for(int i=0;i<n;i++){
	if(x[i]<=abs(k-x[i])){
      ans = ans + x[i]*2;
	}
	else{
		ans = ans + abs(k-x[i])*2;
	}
}

cout << ans << endl;
////////////////////////////////////////////////////////
return 0;}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef vector<ll> vl;
typedef pair<ll, ll> PP;
#define rep(i, n) for(ll i = 0; i < ll(n); i++)
#define ITR(x, c) for(__typeof(c.begin()) x = c.begin(); x != c.end(); x++)
#define all(v) v.begin(), v.end()
#define inputv(v, n)                                                           \
    vl v;                                                                      \
    rep(i, n) {                                                                \
        ll x;                                                                  \
        cin >> x;                                                              \
        v.push_back(x);                                                        \
    }
const ll INF = 999999999999999;
const ll MOD = 1000000007;
const ll MAX_N = 500010;
ll a, b, c, d, e, f, p, t, x, y, z, q, m, n, r, h, k, w, l, ans = 0;
vl g[MAX_N];
vl visited(MAX_N, 0), imos(MAX_N, 0), active(MAX_N, 0);
vl iskansetu(MAX_N, 0);
struct union_find {
    ll par[MAX_N];
    ll Size[MAX_N];
    union_find(ll n) {
        for(int i = 0; i < n; i++) {
            par[i] = i;
            Size[i] = 1;
        }
    }
    ll root(ll x) {
        if(par[x] == x)
            return x;
        return par[x] = root(par[x]);
    }
    bool same(ll x, ll y) { return root(x) == root(y); }
    void unite(ll x, ll y) {
        if(same(x, y))
            return;
        Size[root(x)] += Size[root(y)];
        par[root(y)] = root(x);
    }
};
union_find uni(MAX_N);
void dfs(ll x) {
    visited[x] = 1;
    active[x] = 1;
    for(ll i : g[x]) {
        if(visited[i] == 0) {
            dfs(i);
        } else {
            if(!active[i]) {
                imos[x]--;
                imos[i]++;
            }
        }
    }
    active[x] = 0;
}
void dfs2(ll x) {
    visited[x] = 1;
    active[x] = 1;
    vl A;
    for(ll i : g[x]) {
        if(visited[i] == 0) {
            dfs2(i);
            imos[x] += imos[i];
            if(imos[i])
                A.push_back(i);
        }
    }

    for(ll i : g[x]) {
        if(active[i] == 0) {
            if(uni.root(i) == i) {
                if(imos[uni.root(i)] == 0)
                    iskansetu[x] = 1;
            } else {
                imos[uni.root(i)]--;
                if(imos[uni.root(i)] == 0)
                    iskansetu[x] = 1;
            }
        }
    }

    for(ll i : A)
        uni.unite(x, i);

    active[x] = 0;
}

int main() {
    cin >> n >> m;
    rep(i, m) {
        cin >> x >> y;
        g[x].push_back(y);
        g[y].push_back(x);
    }

    rep(i, n) {
        if(!visited[i])
            dfs(i);
    }

    visited = vl(n, 0);

    rep(i, n) {
        if(!visited[i]) {
            dfs2(i);
            iskansetu[i] = 0;
            for(ll j : g[i]) {
                if(!uni.same(g[i][0], j))
                    iskansetu[i] = 1;
            }
        }
    }

    rep(i, n) {
        if(iskansetu[i])
            cout << i << endl;
    }
}


Measured memory_bytes: 39640
N = int(raw_input())
S = raw_input()
slist = []
for i in range(0, N):
	slist.append(S[i])
max = 0
for i in range(0, N):
	xlist = []
	for j in range(0, i):
		if slist[j] not in xlist:
			xlist.append(slist[j])
	ylist = []
	for j in range(i, N):
		if slist[j] not in  ylist:
			ylist.append(slist[j])
	cnt = 0
	for j in range(0, len(xlist)):
		if xlist[j] in ylist:
			cnt = cnt + 1
	if max < cnt:
		max = cnt

print max

Measured memory_bytes: 2692
n = int(input())
ary = list(map(int,input().split()))
a = sorted(ary)
b = (len(ary)+1)//2-1
for i in range(n):
    if a[b] < ary[i]:
        print(a[b])
    elif a[b] >= ary[i]:
        print(a[b+1])

Measured memory_bytes: 25472
#include <iostream>

using namespace std;

int main()
{
	const int Max = 50010;
	bool prime[Max] = {false};
	
	for (int i = 2; i * i < Max; i++){
		for (int j = i * i; j < Max; j += i){
			prime[j] = true;
		}
	}
	
	int n;
	while (cin >> n, n){
		int count = 0;
		for (int i = 2; i <= n / 2; i++){
			if (!prime[i] && !prime[n - i]){
				count++;
			}
		}
		cout << count << endl;
	}
}

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

int main() {
  int N, K, Q;
  cin >> N >> K >> Q;

  vector<int> A(Q);  
  for (int i = 0; i < Q; i++) {
    cin >> A.at(i);
  }

  vector<int> scores(N);
  for (int i = 0; i < N; i++) {
    scores.at(i) = K;
  }

  for (int a : A) {
    scores.at(a - 1)++;
  }

  for (int i = 0; i < N; i++) {
    if ((scores.at(i) - Q) <= 0) {
      cout << "No" << endl;
    }
    else {
      cout << "Yes" << endl;
    }
  }
}


Measured memory_bytes: 1408
#include <algorithm>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#define FOR(i,k,n) for (int (i)=(k); (i)<(n); ++(i))
#define RFOR(i,k,n) for (int (i)=(n)-1; (i)>=(k); --(i))
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define pb push_back
#define mp make_pair
#define fst first
#define snd second
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define debug(x) cerr<< #x <<": "<<x<<endl
#define debug2(x,y) cerr<< #x <<": "<< x <<", "<< #y <<": "<< y <<endl
using namespace std;
int main() {
  int a,b,c,d;
  cin >> a >> b >> c >> d;
  int t = min(c/b, a/d);
  if(a - t * d <= 0 || a - t * b <= 0) t = max(t-1, 0);
  a -= t * d;
  c -= t * b;
  cout << ((a <= 0 || c - b > 0) ? "No" : "Yes") << endl;
  return 0;
}


Measured memory_bytes: 3564
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int count = sc.next().split("").length;

        String result = "";
        for (int i = 0; i < count; i++) result += 'x';
        System.out.println(result);
    }
}

Measured memory_bytes: 21844
#include <iostream>
using namespace std;
 
int main()
{
  int N;
  double X, ans;
  string S;
  
  ans = 0;
  cin >> N;
  
  for(int i = 0; i < N; i++)
  {
    cin >> X >> S;
    
    if (S == "JPY")
    {
      ans += X;
    }
    else
    {
      ans += X * 380000.0;
    }
  }
  cout << ans;
  return(0);
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline

def main():
    N = int(input())
    A = list(map(int, input().split()))
    zero_count = 0
    ok = False
    dic = {}
    for a in A:
        if a == 0:
            zero_count += 1
        else:
            if a in dic:
                dic[a] += 1
            else:
                dic[a] = 1
    # print(dic, zero_count)
    if len(dic) == 3:
        if zero_count == 0:
            tmp = list(dic.values())
            # print(tmp)
            if tmp[0] == tmp[1] and tmp[1] == tmp[2]:
                key = list(dic.keys())
                tmp = key[0]
                tmp ^= key[1]
                tmp ^= key[2]
                if tmp == 0:
                    print("Yes")
                    return
    if len(dic) == 1:
        if N%3 == 0:
            if zero_count == N/3:
                print("Yes")
                return
    if zero_count == N:
        print("Yes")
        return
    print("No")


if __name__ == "__main__":
    main()


Measured memory_bytes: 14212
import re,sys
def chk(t):
    for i in range(10):
        e=re.split("[+=]",re.sub("X",str(i),t))
        if (e[0][0]=="0" and len(e[0])>1) or (e[1][0]=="0" and len(e[1])>1) or (e[2][0]=="0" and len(e[2])>1): continue
        if eval(e[0]+"+"+e[1]) == eval(e[2]):
            return i
    return 10

l=[chk(i.strip()) for i in sys.stdin]
[print(i) if i != 10 else print("NA") for i in l]



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

int main(){
    int a, b;
    cin >> a >> b;
    if(abs(a-b)%2 == 0){
        printf("%d\n", abs(max(a, b) - abs(a-b)/2));
    }else{
        printf("IMPOSSIBLE");
    }
    return 0;
}

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

int main()
{
  int N;
  int w[101];
  int res=INF;
  cin >> N;

  rep(i,N) cin >> w[i];

  int total=0;
  rep(i,N){
    total += w[i];
  }
  
  rep(i,N-1){
    int s1=0;
    rep(j,i+1){
      s1+=w[j];
    }
    int s2 = total-s1;
    int diff;
    diff = s1-s2;
    if(diff<0) diff=-diff;
    res = min(res, diff);
  }
  
  cout << res << endl;
}


Measured memory_bytes: 256
package main

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

var scanner = bufio.NewScanner(os.Stdin)

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

func nextString() string {
	scanner.Scan()
	return scanner.Text()
}

func swap(ints []int, i, j int) {
	ints[i], ints[j] = ints[j], ints[i]
}

func main() {
	w := nextInt()
	// println(w)
	nums := make([]int, w)
	for i := range nums {
		nums[i] = i+1
	}
	n := nextInt()
	// println(n)
	for i := 0; i < n; i++ {
		info := nextString()
		// println(info)
		infos := strings.Split(info, ",")
		a, _ := strconv.Atoi(infos[0])
		b, _ := strconv.Atoi(infos[1])
		swap(nums, a-1, b-1)
	}
	for _, v := range nums {
		fmt.Println(v)
	}
}


Measured memory_bytes: 1080
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long ;
int main(){
    int n;
    cin >> n;
    int AC=0,WA=0,TLE=0,RE=0;
    rep(i,n){
        string s;
        cin >> s;
        if(s == "AC") AC++;
        if(s == "WA") WA++;
        if(s == "TLE") TLE++;
        if(s == "RE") RE++;
    }
    cout << "AC x " << AC << endl;
    cout << "WA x " << WA << endl;
    cout << "TLE x " <<TLE << endl;
    cout << "RE x " << RE << endl;
    
}

Measured memory_bytes: 3624
#include <iostream>
using namespace std;
int main(){
  int y1,m1,d1,y2,m2,d2,cnt,u,r;
  int d[13]={0,32,29,32,31,32,31,32,32,31,32,31,32};
  while(1){
    cin >> y1 >> m1 >> d1 >> y2 >> m2 >> d2;
    if(y1<0||m1<0||d1<0||y2<0||m2<0||d2<0) break;
    cnt=0;
    while(1){
      if(y1==y2&&m1==m2&&d1==d2) break;
      u=0;
      if(y1%400==0) u=1;
      else if(y1%100==0) u=0;
      else if(y1%4==0) u=1;
      if(u==1&&m1==2){
	if(d1==d[m1]+1){
	  m1++;
	  d1=1;
	}else{
	  cnt++;
	  d1++;
	}
      }else{
	if(d1==d[m1]){
	  if(m1==12) m1=1,y1++;
	  else m1++;
	  d1=1;
	}else{
	  cnt++;
	  d1++;
	}
      }
    }
    cout << cnt << endl;
  }
  return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
#define P pair<int,int>
#define PI 3.141592653589793
const int INF = 1001001001;

int main() {
	string s;
	cin >> s;
	if (s == "ABC") cout << "ARC";
	else cout << "ABC";
}


Measured memory_bytes: 3628
#include <iostream>
#include <vector>
#include <utility>
#include <string>
#include <numeric>
#include <cmath>
#include <cassert>
#include <iomanip>
#include <sstream>
#include <algorithm>
#include <cstdint>
#include <unordered_map>
#include <unordered_set>
#include <queue>

using namespace std;

int solve(int x, int y) {
    return x + y / 2;
} 

int main() {
    int x, y;
    cin >> x >> y;

    cout << solve(x, y) << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define LOG(variable) cout << #variable":\t" << (variable) << endl
#define LOGCON(i, container) for(int (i) = 0; (i) < (container).size(); ++(i)) cout << (i) << ":\t" << (container)[(i)] << endl
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPS(i, r, n) for (int i = (r); i < (n); ++i)
#define REPR(i, n) for(int i = (n); i >= 0; --i) // from n to 0
#define REPRS(i, n, r) for(int i = (n); i >= (r); --i) // from n to r
#define REPOBJ(itr, obj) for(auto itr = (obj).begin(); itr != (obj).end() ; ++itr)
#define REPROBJ(itr, obj) for(auto itr = (obj).rbegin(), e = (obj).rend(); itr != e; ++itr)
#define COUTB(x) cout << (x) << "\n"
#define COUTS(x) cout << (x) << " "
#define PB push_back
#define SORT(obj) sort((obj).begin(), (obj).end())
#define SORTR(obj) sort((obj).begin(), (obj).end(), greater<>())
#define ALL(obj) (obj).begin(), (obj).end()
#define MOD 1000000007
#define PI (acos(-1))
#define TMP(arr, index, max_n) for(arr[index] = arr[index-1]; arr[index]<=max_n; ++arr[index])

int in() {int x; cin>>x; return x;}
string stin() {string s; cin>>s; return s;}
/***** MAIN *****/
signed main() {
  int n = in(), m = in(), q = in();
  int nums[15];
  REP(i,n) nums[i] = 1;
  int a[q], b[q], c[q], d[q];
  REP(i,q) {
    cin >> a[i] >> b[i] >> c[i] >> d[i];
    --a[i]; --b[i];
  }
  int ans = 0;
  for(nums[0]=1; nums[0]<=m; ++nums[0]) {
    TMP(nums, 1, m) TMP(nums, 2, m) TMP(nums, 3, m) TMP(nums, 4, m) TMP(nums, 5, m) TMP(nums, 6, m) TMP(nums, 7, m) TMP(nums, 8, m) TMP(nums, 9, m) {
      int tmp_ans = 0;
      REP(i,q) {
        if(nums[b[i]] - nums[a[i]] == c[i]) {
          tmp_ans += d[i];
        }
      }
      ans = max(ans, tmp_ans);
    }
  }
  cout << ans;
  cout << "\n";
  return 0;
}
/***** MAIN *****/


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
template <typename T> void read(T &t) {
	t=0; char ch=getchar(); int f=1;
	while ('0'>ch||ch>'9') { if (ch=='-') f=-1; ch=getchar(); }
	do {(t*=10)+=ch-'0';ch=getchar();} while ('0'<=ch&&ch<='9'); t*=f;
}
typedef long long ll;
int n,m,ans,a[110];
ll sum;
int main() {
	//freopen("1.txt","r",stdin);
	read(n); read(m);
	for (int i=1;i<=n;i++) read(a[i]);
	sort(a+1,a+(n+1));
	for (int i=1;i<=n;i++) {
		sum+=a[i];
		if (sum>m) break;
		ans++;
	}
	if (ans==n&&sum<m) ans--;
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 256
import java.io.PrintWriter;
import java.util.*;

public class Main {
    void run() {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);

        String s = sc.next();

        int count = 0;
        switch (s) {
            case "SSS":
                count = 0;
                break;
            case "SSR":
            case "SRS":
            case "RSS":
            case "RSR":
                count = 1;
                break;
            case "RRS":
            case "SRR":
                count = 2;
                break;
            case "RRR":
                count = 3;
                break;
        }
        System.out.println(count);


        // out.println("Hello World");
        out.flush();
    }

    void debug(Object... os) {
        System.err.println(Arrays.deepToString(os));
    }

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


Measured memory_bytes: 35748
#include<iostream>
#include<iomanip>
#include<math.h>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<string>
#include<complex>
#include<unordered_map>

#define INF 1000000000ll
#define MOD 1000000007ll
#define EPS 1e-8

#define REP(i, m) for(long long i = 0; i < m; ++i)
#define FOR(i, n, m) for(long long i = n; i < m; ++i)
#define ALL(v) v.begin(), v.end()
#define pb push_back

using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef long double ld;

int main() {
	int n;
	cin>>n;
	int a[n];
	REP(i,n) cin>>a[i];
	vector<int> used(n,-1);
	used[0]=0;
	int pos=0;
	while(1) {
		if(used[a[pos]-1]==-1) {
			used[a[pos]-1]=used[pos]+1;
			pos=a[pos]-1;
		} else {
			break;
		}
	}
	cout<<used[1]<<endl;
}


Measured memory_bytes: 1024
import java.util.Scanner;
public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] p = new int[n];
        for(int i = 0 ; i < n ; i++ ){
            p[i] = sc.nextInt();
        }
        sc.close();
        int s = 0;
        for(int i = 0 ; i <= n - 3 ; i++ ){
            if(p[i] < p[i + 1] && p[i + 1] < p[i + 2]){
                s++;
            }else if(p[i + 2] < p[i + 1] && p[i + 1] < p[i]){
                s++;
            }
        }
        System.out.println(s);
    }
}

Measured memory_bytes: 35768