akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const long double EPS=1e-9;
const long double PI=acos(-1.0);
int ABS(int a){return max(a,-a);}
long long ABS(long long a){return max(a,-a);}
long double ABS(long double a){return max(a,-a);}
char in[210000];
int main(){
	int n,a,b,c,d;
	scanf("%d%d%d%d%d",&n,&a,&b,&c,&d);
	a--;b--;c--;d--;
	scanf("%s",in);
	if(a>b){
		swap(a,b);swap(c,d);
	}
	if(c>d){
		bool ok=false;
		for(int i=b;i<=d;i++){
			if(i-1<0||i+1>=n)continue;
			if(in[i]=='.'&&in[i-1]=='.'&&in[i+1]=='.')ok=true;
		}
		if(!ok){printf("No\n");return 0;}
	}
	for(int i=a;i<c;i++){
		if(in[i]=='#'&&in[i+1]=='#'){
			printf("No\n");return 0;
		}
	}
	for(int i=b;i<d;i++){
		if(in[i]=='#'&&in[i+1]=='#'){
			printf("No\n");return 0;
		}
	}
	printf("Yes\n");
}

Measured memory_bytes: 384
#include <iostream>
using namespace std;
int main(void){
    int a; //キャンディーの個数

    while(cin >> a){

        if(a % 39 == 0)
            cout << "3C39" << endl;
        else{
            if(a % 39 < 10)
                cout << "3C0" << a % 39 << endl;
            else
                cout << "3C" << a % 39 << endl;
        }
    }
}


Measured memory_bytes: 3052
package main

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

var sc = bufio.NewScanner(os.Stdin)

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

func nextInt() int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return i
}

func nextFloat64() float64 {
	f, _ := strconv.ParseFloat(next(), 64)
	return f
}

func nextInts(n int) []int {
	slice := make([]int, n)
	for i := 0; i < n; i++ {
		slice[i] = nextInt()
	}
	return slice
}

func main() {
	sc.Split(bufio.ScanWords)
	s := next()
	w := nextInt()
	for i := range s {
		if i%w == 0 {
			fmt.Printf("%c", s[i])
		}
	}
	fmt.Printf("\n")
}


Measured memory_bytes: 640
#include<stack>
#include<cstdio>

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

using namespace std;

const int from[]={0,2,1,1},to[]={1,1,2,0};

stack<int> tray[3];

bool move(int i){
	const int &f=from[i],&t=to[i];
	if(!tray[f].empty() && (tray[t].empty() || tray[f].top()>tray[t].top())){
		tray[t].push(tray[f].top());
		tray[f].pop();
		return true;
	}
	return false;
}

bool over(){
	return tray[1].empty() && (tray[0].empty() || tray[2].empty());
}

int simulate(int prev){
	for(int k=0;;k++){
		if(over()) return k;
		rep(i,4) if(i!=3-prev && move(i)) { prev=i; break; }
	}
}

int main(){
	for(int n,m;scanf("%d%d",&n,&m),n;){
		rep(k,3){
			while(!tray[k].empty()) tray[k].pop();

			int nk; scanf("%d",&nk);
			rep(j,nk){
				int tmp; scanf("%d",&tmp);
				tray[k].push(tmp);
			}
		}

		if(over()){ puts("0"); continue; }

		int ans=(1<<31)-1;
		rep(i,4){
			stack<int> tmp[3];
			copy(tray,tray+3,tmp);
			if(move(i)) ans=min(ans,simulate(i)+1);
			copy(tmp,tmp+3,tray);
		}
		if(ans>m) ans=-1;
		printf("%d\n",ans);
	}

	return 0;
}

Measured memory_bytes: 828
n = int(input())
s = input()
k = int(input())
sa = s[k - 1: k]
sl = len(s)
sli = list(s)
hey = []
for sli in sli:
    if sli == sa:
        hey.append(sli)
    else:
        hey.append("*")
hey = "".join(hey)
print(hey)


Measured memory_bytes: 3060
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author champon
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>
#define se cout << "test ok" << endl;
#define sp << " " <<
#define enl "\n";
using namespace std;
using ll=long long;
using ld=long double;
ll mod = ll(1e9)+7;
ll inf = ll(1e18);
template<typename T1, typename T2> ll ceill(T1 a, T2 b){ return (a+b-1)/b; }
void ans(bool b, ostream& out=cout){ out << (b ? "Yes" : "No") << endl; }
void ans2(bool b, ostream& out=cout){ out << (b ? "YES" : "NO") << endl; }
template<typename T> inline bool chmax(T &a, T b){ if(a<b){a=b; return true;} return false; }
template<typename T> inline bool chmin(T &a, T b){ if(a>b){a=b; return true;} return false; }
template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val){ fill((T*)array, (T*)(array+N), val); }
int dx[] = {1, 0, -1, 0, 1, -1, 1, -1};
int dy[] = {0, 1, 0, -1, 1, -1, -1, 1};

#ifndef INCLUDE_DEBUG_HPP
#define INCLUDE_DEBUG_HPP

#include <iostream>
#include <vector>
#include <map>
using namespace std;

namespace dbg {
    using ll = long long;

    class Debug {
    public:
        Debug(){}
        template<typename T>
        void vd(vector<T> vec);
        template<typename T>
        void vd2(vector<vector<T>> vec);
        template<typename T>
        void ad(T *arr, ll n);
        template<typename T, size_t N>
        void ad2(T (&arr)[N], ll n);
        template<typename T>
        void md(T mp);
    };

    template<typename T>
    void Debug::vd(vector<T> vec) {
        for (auto vv : vec) cout << vv << " ";
        cout << endl;
    }

    template<typename T>
    void Debug::vd2(vector<vector<T>> vec) {
        for (auto vv : vec) for (auto vvv : vv) cout << vvv << " ";
        cout << endl;
    }

    template<typename T>
    void Debug::ad(T *arr, ll n) {
        for (int i = 0; i <= n; i++) cout << arr[i] << " ";
        cout << endl;
    }

    template<typename T, size_t N>
    void Debug::ad2(T (&arr)[N], ll n) {
        for (int i = 0; i <= N; i++) for (int j = 0; j <= n; j++) cout << arr[i][j] << " ";
        cout << endl;
    }

    template<typename T>
    void Debug::md(T mp) {
        cout << "key : value" << endl;
        for (auto const &m : mp) cout << m.first << " : " << m.second << endl;
        cout << endl;
    }

}

#endif //INCLUDE_DEBUG_HPP

using dbg::Debug;
Debug debug;

class CHalfAndHalf {
public:
	void solve(std::istream& in, std::ostream& out) {
	    ll a, b, c, x, y;
	    in >> a >> b >> c >> x >> y;

	    ll res = 0;
	    if(a + b > c*2){
            res += min(x, y) * c * 2;
            if(x > y){
                res += (x-y) * a;
            }else{
                res += (y-x) * b;
            }
            chmin(res, max(x, y)*c*2);
	    }else{
	        res += a*x + b*y;
	    }

	    out << res << enl;
	}
};


int main() {
	CHalfAndHalf solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <vector>
#include <string>
#include <cmath>
#include <set>
#include <stdio.h>
#include <algorithm>
#include <map>
#include <queue>
#include <unordered_map>
#define ll long long
#define pii pair <int, int>
#define pll pair <long long, long long>
#define plxy pair <long long, pll>
#define INT_MAX 1e18
#define Keep_calm_You_are_still_learning ios_base::sync_with_stdio(false);cin.tie(NULL);
using namespace std;
using namespace std;
const int mod=1e9+7;
const int N=1005;
ll n,m;
char a[N][N];
ll dp[N][N];
bool valid(ll i,ll j)
{
    return (i>=0 && i<n && j>=0 & j<m && a[i][j]=='.');
}
int main()
{
    cin>>n>>m;
    memset(dp,0,sizeof(dp));
    dp[0][0]=1;
    for(ll i=0;i<n;i++)
    {
        for(ll j=0;j<m;j++)
            cin>>a[i][j];
    }
    for(ll i=0;i<n;i++)
    {
        for(ll j=0;j<m;j++)
        {
            if(valid(i-1,j))
                dp[i][j]+=dp[i-1][j];
            if(valid(i,j-1))
                dp[i][j]+=dp[i][j-1];
            dp[i][j]%=mod;
        }
    }
    cout<<dp[n-1][m-1];
    return 0;
}


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

int main()
{
	int n;
	cin>>n;
	int a1[n+1],a2[n+1];
	int sum=0;
	int t=1;
	for(int i=1;i<=n;i++)
	{
		cin>>a1[i]>>a2[i];
		if(a1[i]==a2[i]) sum++;
		else sum=0;
		if(sum==3){
			t=0;
		}
	 } 
	 if(t==0) cout<<"Yes"<<endl;
	 else cout<<"No"<<endl;
	 return 0;
}

Measured memory_bytes: 3632
#include <cstdio>
#include <cstring>
#include <cmath>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <stack>
using namespace std;

#define ll long long
#define mst(a) memset(a, 0, sizeof a)

const int mod = 1e9+7;
const int maxn = 1e5+50;
const int inf = 1e9;

char s[maxn];

int main()
{
   // freopen("in", "r", stdin);
    scanf("%s", s);
    int n = strlen(s);
    int ans = n;
    if (n & 1)
    {
        if (s[n/2] == '0')
        {
            for (int i = 0; i < n; ++i) if (s[i] == '1')
                ans = min(ans, max(i, n-i-1));
        }
        else
        {
            for (int i = 0; i < n; ++i) if (s[i] == '0')
                ans = min(ans, max(i, n-i-1));
        }
    }
    else
    {
        if (s[n/2] == s[n/2-1])
        {
            if (s[n/2] == '1')
            {
                for (int i = 0; i < n; ++i) if (s[i] == '0')
                    ans = min(ans, max(i, n-i-1));
            }
            else 
            {
                for (int i = 0; i < n; ++i) if (s[i] == '1')
                    ans = min(ans, max(i, n-i-1));
            }
        }
        else ans = n/2;
    }
    printf("%d\n", ans);
    return 0;
}

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

int main()
{
  string s;
  cin >> s;
  if(s[0] == s[1] || s[1] == s[2] || s[2] == s[3])
    cout << "Bad" << endl;
  else
    cout << "Good" << endl;
  return 0;
}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
#define ff          first
#define ss          second
#define ll         	long long int
#define pb          push_back
#define ar 			array
#define mp 			make_pair
#define f(i,n)   	for(ll i =0;i<n;i++)
#define inf 		INT_MAX
#define pll 		pair<ll,ll>
const ll INF = 1e18;
void init(){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE 
		freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#endif
}
const ll N = 1e5 + 10;
void solve(){

	ll n;
	cin>>n;
	vector<ll> a(n);
	unordered_map<ll , ll> hash; 
	ll n1 = 0;
	for(ll i =0;i<n;i++){
		cin>>a[i];
		hash[a[i]]++;
		if(a[i] == 1){
			n1++;
		}
	}
	if(n1 == 1){
		cout<<"1"<<endl;
		return;
	}
	if(n1 >= 1){
		cout<<"0"<<endl;
		return;
	}
	ll ans = 0;
	for(ll i = 0; i<n; i++){

		ll val = a[i];
		bool ok = true;
		if(hash[val] != 1){
			continue;
		}
		for(ll j = 2; j <= sqrt(val) ;j++){
			
			if(val % j == 0){
				
					if(hash.find(j) != hash.end()){
						ok = false;
						break;
					}
					if(hash.find(val / j) != hash.end()){
						ok = false;
						break;
					}
			}
		}
		if(ok){
			ans++;
		}
	}
	cout<<ans<<endl;

}
int main(){
	
	init();
	ll t = 1;
	//cin>>t;
	for(ll i=1;i<=t;i++){
		//cout<<"Case #"<<i<<": ";
		solve();
	}
}


Measured memory_bytes: 12892
from __future__ import print_function

import sys

import re
import array
import copy
import functools
import operator

import math
import string
import fractions
from fractions import Fraction
from fractions import gcd
# fractions.gcd() を用いること
# math.log2()はatcoderでは対応していない．留意せよ．

import collections
import itertools
import bisect

import random
import time

import heapq
from heapq import heappush
from heapq import heappop
from heapq import heappushpop
from heapq import heapify
from heapq import heapreplace
from queue import PriorityQueue as pq
from queue import Queue

from itertools import accumulate

from collections import deque
from collections import Counter

from operator import mul
from functools import reduce

input = sys.stdin.readline


def eprint(*args, **kwargs):
    print(*args, file=sys.stderr, **kwargs)
    return


def lcm(n, m):
    return int(n * m / gcd(n, m))


def coprimize(p, q):
    common = fractions.gcd(p, q)
    return (p // common, q // common)


def combinations_count(n, r):
    r = min(r, n - r)
    numer = reduce(mul, range(n, n - r, -1), 1)
    denom = reduce(mul, range(1, r + 1), 1)
    return numer // denom


def find_gcd(list_l):
    x = reduce(gcd, list_l)
    return x


def main():
    n = int(input().strip())
    a = list(map(int, input().strip().split()))
    
    print(sum(a)-n)

if __name__ == '__main__':
    main()


Measured memory_bytes: 60524
while True:
    try:
        a,b,c,d,e,f = map(int, input().split())
        X = d/a
        y = (c*X-f)/(b*X-e)
        x = (c-b*y)/a
        print(f'{x:.3f} {y:.3f}')
    except:
        break


Measured memory_bytes: 5620
#pragma GCC optimize ("Ofast")
#include<bits/stdc++.h>
using namespace std;
inline int my_getchar_unlocked(){
  static char buf[1048576];
  static int s = 1048576;
  static int e = 1048576;
  if(s == e && e == 1048576){
    e = fread_unlocked(buf, 1, 1048576, stdin);
    s = 0;
  }
  if(s == e){
    return EOF;
  }
  return buf[s++];
}
inline void rd(int &x){
  int k;
  int m=0;
  x=0;
  for(;;){
    k = my_getchar_unlocked();
    if(k=='-'){
      m=1;
      break;
    }
    if('0'<=k&&k<='9'){
      x=k-'0';
      break;
    }
  }
  for(;;){
    k = my_getchar_unlocked();
    if(k<'0'||k>'9'){
      break;
    }
    x=x*10+k-'0';
  }
  if(m){
    x=-x;
  }
}
struct MY_WRITER{
  char buf[1048576];
  int s;
  int e;
  MY_WRITER(){
    s = 0;
    e = 1048576;
  }
  ~MY_WRITER(){
    if(s){
      fwrite_unlocked(buf, 1, s, stdout);
    }
  }
}
;
MY_WRITER MY_WRITER_VAR;
void my_putchar_unlocked(int a){
  if(MY_WRITER_VAR.s == MY_WRITER_VAR.e){
    fwrite_unlocked(MY_WRITER_VAR.buf, 1, MY_WRITER_VAR.s, stdout);
    MY_WRITER_VAR.s = 0;
  }
  MY_WRITER_VAR.buf[MY_WRITER_VAR.s++] = a;
}
inline void wt_L(char a){
  my_putchar_unlocked(a);
}
inline void wt_L(const char c[]){
  int i=0;
  for(i=0;c[i]!='\0';i++){
    my_putchar_unlocked(c[i]);
  }
}
template<class S, class T> inline S divup_L(S a, T b){
  return (a+b-1)/b;
}
int K;
int A;
int B;
int main(){
  rd(K);
  rd(A);
  rd(B);
  if((divup_L(A,K))<= B/K){
    wt_L("OK");
    wt_L('\n');
  }
  else{
    wt_L("NG");
    wt_L('\n');
  }
  return 0;
}
// cLay varsion 20200419-1

// --- original code ---
// int K, A, B;
// {
//   rd(K,A,B);
//   wt(if[A/+K <= B/K, "OK", "NG"]);
// }


Measured memory_bytes: 3640
#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
const long long LINF = 1e18;
#define dump(x)  cout << 'x' << ' = ' << (x) << ` `;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOREACH(x,a) for(auto& (x) : (a) )
typedef long long ll;
using namespace std;
typedef pair<ll, ll> P;

template<typename T>
void print(const vector<T> &x) {
    int n = x.size();
    rep(i,n) {
        cout << x[i];
        if (i!=n-1) cout<<" ";
        else cout << endl;
    }
}

template<typename T>
void print(const vector<vector<T>> &x) {
    int n = x.size();
    rep(i,n) {
        rep(j,x[i].size()) {
            cout << x[i][j] << " ";
        }
        cout << endl;
    }
}

template<typename T>
void print(const vector<T> &x, int n) {
    rep(i,n) {
        cout << x[i];
        if (i!=n-1) cout<<" ";
        else cout << endl;
    }
}

template<typename T>
void print(const vector<vector<T>> &x, int n, int m) {
    rep(i,n) {
        rep(j,m) {
            cout << x[i][j] << " ";
        }
        cout << endl;
    }
}

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; }

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

typedef tuple<ll,ll,ll> T;

int main(int argc, char const *argv[]) {
    int n,q; cin>>n>>q;
    vector<T> a; a.reserve(2*n);
    rep(i,n) {
        ll s,t,x; cin>>s>>t>>x;
        a.emplace_back(s-x,0,x); a.emplace_back(t-x,1,x);
    }
    
    a.emplace_back(-LINF,0,LINF);
    a.emplace_back(LINF,1,LINF);
    sort(a.begin(), a.end());

    vector<ll> d(q);
    rep(i,q) cin>>d[i];

    multiset<ll> st;
    int idx = 0;

    for (auto &&e: a) {
        ll s,f,x;
        tie(s,f,x) = e;
        while (s > d[idx] && idx < q) {
            if (st.empty() || *st.begin() == LINF) cout << -1 << '\n';
            else cout << *st.begin() << '\n';
            idx++;
        }
        if (f == 0) st.insert(x);
        else {
            auto itr = st.lower_bound(x);
            st.erase(itr);
        }
    }
    return 0;
}

Measured memory_bytes: 21856
#include <iostream>
#include <stdio.h>
using namespace std;

int main()
{
    int n;
    scanf("%d", &n);

    int c = 0;
    char chm = getchar();
    for (int i = 1; i <= n; i++)
    {
        char ch = getchar();
        if (ch != chm) c++;
        chm = ch;
    }

    printf("%d", c);

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i,n) FOR(i,0,n)
#define FOR(i,a,b) for(ll i=a;i<b;i++)
typedef vector<ll> vi;
typedef vector<vector<ll>> vvi;
const ll INF = (1ll << 31)-1;
struct RMQ{
  ll size;
  ll *tree;
  RMQ(ll sz){
    ll i;for(i=0;(1ll<<i)<sz;i++);
    size=(1ll<<i);
    tree=new ll[size*2-1];
    REP(i,size*2-1) tree[i]=INF;
  }
  ll find(ll l,ll r){
    return find(l,r,0,size,0);
  }
  ll find(ll l,ll r,ll a,ll b,ll k){
    if(l==a&&r==b) return tree[k];
    ll mid=(a+b+1)/2;
    if(r<=mid) return find(l,r,a,mid,k*2+1);
    if(mid<=l) return find(l,r,mid,b,k*2+2);
    return min(find(l,mid,a,mid,k*2+1),find(mid,r,mid,b,k*2+2));
  }

  void update(ll i,ll x){
    ll k=i+size-1;
    while(k>=0){
      if(k>=size-1) tree[k]=x;
      else tree[k]=min(tree[k*2+1],tree[k*2+2]);
      if(k==0) break;
      k=(k-1)/2;
    }
  }

};

int main(){
  ll n,q;cin>>n>>q;
  RMQ rmq(n);
  REP(i,q){
    ll com,x,y;cin>>com>>x>>y;
    if(com==0) rmq.update(x,y);
    else cout<<rmq.find(x,y+1)<<endl;
  }
}

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

#define PI 3.14159265358979323846264338327950288419

using namespace std;

int a, b, c;
int ans;

int main(){
	scanf("%d %d %d", &a, &b, &c);
	// stage 1: tasty poison + tasty antidote
	int step = min(b, c);
	b -= step;
	c -= step;
	ans += 2 * step;
	// stage 2: tasty poison + bad antidote
	step = min(a, c);
	a -= step;
	c -= step;
	ans += step;
	// stage 3: maybe sneak in one tasty poison?
	ans += min(1, c);
	// stage 4: eat all tasty antidotes
	ans += b;
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python3

n = input()

if len(n) == 1:
    if n == "2" or n == "4" or n == "5" or n == "7" or n == "9":
        print("hon")
    elif n == "0" or n == "1" or n == "6" or n == "8":
        print("pon")
    else:
        print("bon")
else:
    if n[-1] == "2" or n[-1] == "4" or n[-1] == "5" or n[-1] == "7" or n[-1] == "9":
        print("hon")
    elif n[-1] == "0" or n[-1] == "1" or n[-1] == "6" or n[-1] == "8":
        print("pon")
    else:
        print("bon")

Measured memory_bytes: 9076
#include <bits/stdc++.h>
#define ll long long
using namespace std;


const long long MAXVAL = (long long) 1e18 + 1;
//const long long MOD = 1000000007;
const long long MOD = 998244353ll;
const int INF = 1000000000 + 1;

long long poww(int x, long long pow) {
  if (pow == 0ll ) return 1;
  if (pow == 1ll) return x % MOD;
  long long ans = poww(x, pow >> 1) % MOD;
  ans = (ans * ans) % MOD;
  if ((pow & 1)) {
    ans = (ans * x ) % MOD;
  }
  return ans % MOD;
}

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int q = 1;
  //cin >> q;

  while (q-- >0) {
    int n;
    cin >> n;
    vector<int> a;
    vector<int> b;
    for (int i = 0; i <n ;++i) {
      int aa , bb;
      cin >> aa >> bb;
      a.push_back(aa);
      b.push_back(bb);
    }
    sort(begin(a), end(a));
    sort(begin(b), end(b));
    if (n & 1) {
      int mid = (n - 1) >> 1;
      int low = (a[mid]);
      int high = (b[mid]);
      cout << high - low + 1 << endl;
    } else {
      int mid = (n - 2) >> 1;
      int low = (a[mid] + a[mid + 1]);
      int high = (b[mid] + b[mid + 1]);
      cout << high - low + 1 << endl;
    }
  }
  return 0;
}



Measured memory_bytes: 5144
#include<bits/stdc++.h>
using namespace std;
 
#define ld long double
#define ll long long
#define ALL(a)  (a).begin(),(a).end()
#define spa << " " <<
ll MOD = 1e9+7;
void chmin(ll &a, ll b) { if (a > b) a = b; }
void chmax(ll &a, ll b) { if (a < b) a = b; }
 
int main(){
  ll i, j;
  ll n, k;
  cin >> n >> k;
  ll result = 0;
  ll resulta = 0, resultb = 0;
  if(k % 2 == 1){
    resulta = n / k;
    resulta *= resulta * resulta;
  }
  else{
    resulta = n / k;
    resultb = (n + k / 2) / k;
    resulta *= resulta * resulta;
    resultb *= resultb * resultb;
    
  }
  cout << resulta + resultb << endl;
  
 
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for(int i = n-1; i >= 0; i--)
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  FastIO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define sz(x) ((int)(x).size())
typedef long long ll;
using P = pair<int,int>;
using VI = vector<int>;
using VVI = vector<vector<int>>;
using VL = vector<ll>;
using VVL = vector<vector<ll>>;
using VP = vector<P>;
template<typename T> void view(T e){std::cout << e << std::endl;}
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return true; } return false; }

const int inf = 1 << 30;
const ll INF = 1LL << 60;

int main(){
    int n;
    string s;
    cin >> n >> s;
    int ans = 0;
    for(int i = 1; i < n; i++){
        map<char, int> mp;
        rep(j, i) mp[s[j]]++;
        set<char> st;
        int sum = 0;
        for(int j = i; j < n; j++){
            if (st.find(s[j]) != st.end()) continue;
            if (mp.find(s[j]) != mp.end()) sum++;
            st.insert(s[j]);
        }
        chmax(ans, sum);
    }
    view(ans);

    return 0;
}

Measured memory_bytes: 3632
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main()
{
	int n, m, ac, wa;
	cin >> n >> m;
	ac = wa = 0;
	vector<bool> f;
	f.assign(n, false);
	vector<int> q(m);
	vector<string> a(m);
	for (int i = 0; i < m; i++) {
		cin >> q[i] >> a[i];
		q[i]--;
		if (a[i] == "AC")	f[q[i]] = true;
	}
	for (int i = 0; i < m; i++) {
		if (f[q[i]] == true) {
			if (a[i] == "WA")	wa++;
			else if (a[i] == "AC") {
				ac++;
				f[q[i]] = false;
			}
		}
	}
	cout << ac << " " << wa << endl;
	return 0;
}

Measured memory_bytes: 6144
#![allow(
    non_snake_case,
    unused_variables,
    unused_assignments,
    unused_mut,
    dead_code
)]
//use permutohedron::LexicalPermutation as _;
use proconio::input;
//use proconio::marker::Chars;
//use proconio::marker::Usize1;
//use std::collections::HashSet;
//use std::collections::HashMap;
//use std::collections::BTreeMap;
//use std::cmp::*;
// use std::num;
const MOD: i64 = 1_000_000_007;
fn main() {
    input! {
        n:usize,m:usize
    }
    let mut fact = vec![1i64; m + 1];
    let mut ifact = vec![1i64; m + 1];
    for i in 2..(1 + m) {
        fact[i] = fact[i - 1] * (i as i64) % MOD;
        ifact[i] = modInv(fact[i]);
    }
    let perm = |m, n| fact[m] * ifact[m - n] % MOD;
    let comb = |m, n| perm(m, n) * ifact[n] % MOD;
    //let comb2 = |m| n * (n - 1) * modInv(2) % MOD;
    // Aを固定して、Bを考える。
    // 求めたいパターンは、全てのパターン(0個以上が同じ) - 1個以上が同じ + 2個以上が同じ - ...
    // all = m P n
    // k以上が同じケース。
    let mut ans = 0;
    for i in 0..n + 1 {
        ans += (-1i64).pow((i & 1) as u32) * comb(n, i) * perm(m - i, n - i) % MOD;
    }
    ans = ans % MOD * perm(m, n) % MOD;
    // println!("{},{}", fact[2], modInv(fact[2]));
    // println!("{}", x);
    println!("{}", (ans + MOD) % MOD);
}

fn modPow(a: i64, n: i64) -> i64 {
    let mut res = 1;
    let mut a = a;
    let mut n = n;
    while n > 0 {
        if n % 2 != 0 {
            res = res * a % MOD;
        }
        a = a * a % MOD;
        n = n / 2;
    }
    return res;
}
fn modInv(a: i64) -> i64 {
    modPow(a, MOD - 2)
}


Measured memory_bytes: 9944
using namespace std;
#include<string>
#include<cmath>
#include <map>
#include <unordered_map>
#define ll long long
#define ld long double
#define pb push_back
#define F first
#define S second
#define fio ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL)

#define fr(i,a,b) for(ll i=a;i<b;i++)
#define ffr(i,a,b) for(ll i=a;i>=b;i--)
#include<bits/stdc++.h>
#include<vector>
#define vl vector<ll>
#define PI 3.141592654
const ll N = 1e9 + 1;
#include<iterator>






void solve() {
	ll n, ac = 0, wa = 0, tle = 0, re = 0;
	string s;
	cin >> n;
	fr(i, 0, n) {
		cin >> s;
		if (s == "AC") ac++;
		if (s == "WA") wa++;
		if (s == "TLE") tle++;
		if (s == "RE") re++;
	}
	cout << "AC x " << ac << '\n';
	cout << "WA x " << wa << '\n';
	cout << "TLE x " << tle << '\n';
	cout << "RE x " << re << '\n';
}



int main() {
	fio;
#ifndef ONLINE_JUDGE
	// for getting input
	freopen("input.txt", "r", stdin);
	//for writing output
	freopen("jout.txt", "w", stdout);
#endif

	ll t;
	if (1)
		t = 1;
	else
		cin >> t;
	while (t--) {
		solve();
		cout << '\n';
	}
	return 0;
}

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


class Point {
public:
  double x, y;
  Point(double x = 0, double y = 0) : x(x), y(y) {}
  Point operator +(Point p) { return Point(x+p.x, y+p.y); }
  Point operator -(Point p) { return Point(x-p.x, y-p.y); }
};

typedef Point Vector;

double cross(Vector a, Vector b) {
  return a.x*b.y-a.y*b.x;
}

Point p[50];
int n;
double calcS() {
  double s = 0;
  for(int i = 0; i < n; i++) {
    if(i+1 == n) s += cross(p[n-1], p[0]);
    else         s += cross(p[i], p[i+1]);
  }
  s /= 2.0;
  return abs(s);
}

main() {
  int tc = 1;
  while(1) {
    cin >> n;
    if(n == 0) break;
    for(int i = 0; i < n; i++) {
      cin >> p[i].x >> p[i].y;
    }
    printf("%d %.1f\n", tc, calcS());
    tc++;
  }
}

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

int main(){
	int k,x;	cin>>k>>x;
	for(int i=x-k+1;i<x+k;i++){
		if(i!=x-k+1)cout<<" ";
		cout<<i;
	}cout<<endl;


	return 0;
}


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


using namespace std;

typedef long long ll;

const ll INF = 1ll << 60;
const ll MOD = 1e9 + 7;

bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
	return f.second > s.second;
}

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

//-------------------ここから-----------------------------------


int main(void){
	int d, g;

	cin >> d >> g;

	vector<int> p(d), c(d);

	for (int i = 0; i < d; i++){
		cin >> p[i] >> c[i];
	}

	int ans = 1e9;

	for (int bit = 0; bit < (1 << d); bit++){
		vector<int> l;
		vector<int> r;
		for (int i = 0; i < d; i++){
			if (bit & (1 << i)){
				l.push_back(i);
			} else {
				r.push_back(i);
			}
		}

		int totalscore = 0;
		int num = 0;

		for (int i = 0; i < l.size(); i++){
			totalscore += 100 * (l[i] + 1) * p[l[i]] + c[l[i]];
			num += p[l[i]];
		}


		if (totalscore < g){
			bool fin = false;
			for (int i = r.size() - 1; i >= 0; i--){
				int tmp = 0;
				for (int j = 0; j < p[r[i]]; j++){
					tmp += 100 * (r[i] + 1);
					num++;
					if (totalscore + tmp >= g){
						fin = true;
						break;
					}
				}
				if (fin)break;
			}

			if (fin){
				ans = min(ans, num);
			} else{
				continue;
			}
		} else {
			ans = min(ans, num);
		}
	}

	cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n;
  cin>>n;
  vector<int> a(4,0);
  for(int i=0; i<n; i++){
    string s;
    cin>>s;
    if(s=="AC"){
      a.at(0)++;
    }else if(s=="WA"){
      a.at(1)++;
    }else if(s=="TLE"){
      a.at(2)++;
    }else if(s=="RE"){
      a.at(3)++;
    }
  }
  cout<<"AC x "<<a.at(0)<<endl;
  cout<<"WA x "<<a.at(1)<<endl;
  cout<<"TLE x "<<a.at(2)<<endl;
  cout<<"RE x "<<a.at(3)<<endl;
  return 0;
}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
#define gcd(a,b) __gcd(a,b)
#define ll long long int
#define ld unsigned long long int
#define pi pair<ll,ll>
#define pb push_back
#define pf push_front
#define pu push
#define po pop
#define fi first
#define se second
#define mk make_pair
#define ve vector
#define lr(n) for(ll i=0;i<n;i++)

ll fun(ll n,string c){
		string t="AB";
		ll l=2;
		vector<ll>p(l);
		p[0]=0;
		for(ll i=1,j=0;i<l;i++){
			while(j>0 && t[i]!=t[j]){
				j=p[j-1];
			}
			if(t[i]==t[j])
				j++;
			p[i]=j;
		}
		ll ans=0;
		for(ll i=0,j=0;i<n;i++){
			if(c[i]==t[j]){
				if(j==l-1){
					ans++;
					j=p[j];
					continue;
				}
				j++;
			}
			else if(j>0){
				j=p[j-1];
				i--;
			}
		}
		return ans;
}

	int main(){
		ios_base::sync_with_stdio(0);
		cin.tie(0);
		cout.tie(0);
		ll n;
		cin>>n;
		ve<string >ar(n);
		ll a=0,b=0,c=0;
		ll ans=0;
		lr(n){
			cin>>ar[i];
			ll l=ar[i].length();
			if(ar[i][0]=='B' && ar[i][l-1]=='A')
				c++;
			else if(ar[i][0]=='B')
				b++;
			else if(ar[i][l-1]=='A')
				a++;
			ans+=fun(l,ar[i]);
		}
		if(c>0)
			ans+=c-1;
		if(a>0 && c>0){
			ans+=1;
			a--;
		}
		if(b>0 && c>0){
			ans+=1;
			b--;
		}
		if(a>0 && b>0)
			ans+=min(a,b);
		cout << ans << "\n";
		return 0;
	}

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

int main(){
	int n,t; cin>>n>>t;
	vi v(n),mx(n,0);
	for(auto&i:v)cin>>i;
	mx[n-1]=v[n-1];
	for(int i=n-2;i>=0;i--) mx[i]=max(mx[i+1],v[i]);
	rep(i,n) mx[i]-=v[i];
	cout<<count(all(mx),*max_element(all(mx)))<<endl;
	return 0;
}


Measured memory_bytes: 1024
n=int(input())
import numpy as np
line = np.zeros([5,],dtype=np.int)

minval = 10**15+1
minind = 0
for i in range(0,5):
    line[i] = int(input())
    if minval>line[i]:
        minind = i
        minval=line[i]

rem = n%minval
time = n//minval

count = 4
if rem==0:
    print(count+time)
else:
    print(count+time+1)

Measured memory_bytes: 12484
s = gets.chomp.codepoints
k = gets.to_i
for i in 0..s.size-2
  if s[i]+k > 122 && s[i] != 97
    k -= 123-s[i]
    s[i] = 97
  end
end
s[-1] = 97+(s[-1]-97+k)%26
s.each{|c|print c.chr}

Measured memory_bytes: 3836
#include <bits/stdc++.h>
#define endl "\n"
using namespace std;
typedef long long int lli;
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    lli n;
    cin>>n;
    lli i,ans=0;
    
    for(i=1;i<=n;i++)
    {
        if(i%3!=0 && i%5!=0)
        ans+=i;
    }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 3652
L = list(map(int, input().split()))

L.sort()

cnt = 0
while L[1] != L[2]:
    L[0] += 1
    L[1] += 1
    cnt += 1

if (L[1] - L[0]) % 2 == 1:
    L[1] += 1
    L[2] += 1
    cnt += 1

cnt += (L[1] - L[0])//2

print(cnt)

Measured memory_bytes: 38384
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
const int LIMIT = 1e9 + 7;
#define rep(i, n) for(int i=0; i<(int)n; i++)
#define all(v) (v).begin(), (v).end()

namespace /* debug */{
  #define DEBUG(...) do{cout<<#__VA_ARGS__<<" = ";debug(__VA_ARGS__);}while(0) //変数
  #define ldebug(...) do{cout<<"["<<setw(3)<<__LINE__<<"] ";debug(__VA_ARGS__);}while(0) //行数
  #define lDEBUG(...) do{cout<<"["<<setw(3)<<__LINE__<<"] "<<#__VA_ARGS__<<" = ";debug(__VA_ARGS__);}while(0) //変数, 行数
  template<class T>void show(T&x){cout<<x<<" ";} //出力
  template<class T>void showendl(T&x){cout<<x<<endl;} //出力改行
  template<class P,class Q>void show(pair<P,Q>&x){cout<<"("<<x.first<<", "<<x.second<<") ";} //pair出力
  template<class P,class Q>void showendl(pair<P,Q>&x){cout<<"("<<x.first<<", "<<x.second<<")"<<endl;} //pair出力改行
  template<class H>void debug(H&&h){showendl(h);} //引数1つ
  template<class H,class...Ts>void debug(H&&h,Ts&&...ts){show(h);debug(forward<Ts>(ts)...);} //可変引数
  template<class T>void debug(vector<T>&vt){int i=0;for(auto x:vt)++i!=vt.size()?show(x):showendl(x);} //vector出力
  template<class T>void debug(initializer_list<T>init){int i=0;for(auto x:init)++i!=init.size()?show(x):showendl(x);} //初期化子リスト出力
}

int main(){
	ll X,K,D;cin>>X>>K>>D;
  if(X<0)X *= -1;//正にそろえる

  ll times = min(K, X/D);

  ll minp = X - D*times;//出来るだけ近づく

  ll z = K - times;//余り
  
  if(z%2==1){
    minp = abs(minp - D);
  }

  cout<<minp<<endl;
}

Measured memory_bytes: 3628
/*input
5
*/
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<double,double> pdd;
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define F first
#define S second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define pb push_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define YY cout<<"YES\n"
#define NN cout<<"NO\n"
#define yy cout<<"Yes\n"
#define nn cout<<"No\n"
#ifdef leowang
#define debug(...) do{\
	fprintf(stderr,"%s - %d : (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
	_DO(__VA_ARGS__);\
}while(0)
template<typename I> void _DO(I&&x){cerr<<x<<endl;}
template<typename I,typename...T> void _DO(I&&x,T&&...tail){cerr<<x<<", ";_DO(tail...);}
#else
#define debug(...)
#endif
template<typename T1,typename T2>
ostream& operator<<(ostream& out,pair<T1,T2> P){
	out<<'('<<P.F<<','<<P.S<<')';
	return out;
}

//}}}
const ll maxn=300005;
const ll maxlg=__lg(maxn)+2;
const ll INF64=8000000000000000000LL;
const int INF=0x3f3f3f3f;
const ll MOD=ll(1e9+7);
const double PI=acos(-1);
//const ll p=880301;
//const ll P=31;

ll mypow(ll a,ll b){
	ll res=1LL;
	while(b){
		if(b&1) res=res*a%MOD;
		a=a*a%MOD;
		
		b>>=1;
	}
	return res;
}

int main()
{
	IOS;
	int n;
	cin>>n;
	if(n==3||n==5||n==7) cout<<"YES\n";
	else cout<<"NO\n";	

	return 0;
}


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

using LL = long long;

int N, A;
int x[51];
LL dp[51][51][2501];
LL ans;

int main() {
	for(int i=0;i<51;i++)dp[i][0][0] = 1;
	std::cin >> N >> A;
	for (int i = 1; i <= N; i++) {
		std::cin >> x[i];
	}
	for (int i = 1; i <= N; i++) {
		for (int j = 1; j <= i; j++) {
			for (int k = 0; k <= N * 50; k++) {
				if (x[i] > k) {
					dp[i][j][k] = dp[i - 1][j][k];
					continue;
				}
				if (x[i] <= k) {
					dp[i][j][k] = dp[i - 1][j - 1][k - x[i]] + dp[i - 1][j][k];
					continue;
				}
			}
		}
	}
	for (int i = 1; i <= N; i++) {
		ans += dp[N][i][i*A];
	}
	std::cout << ans << std::endl;
	return 0;
}


Measured memory_bytes: 49024
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <tuple>
#include <cstring>
#include <functional>
using namespace std;
typedef long long ll;
typedef pair<long long, long long> P;
#define rep(i, n) for(long long i=0; i<n; i++)
#define reps(i, s, e) for(long long i=s; i<e; i++)
#define repr(i, n) for(long long i=n-1; i>=0; i--)
#define reprs(i, s, e) for(long long i=e-1; i>=s; i--)

int main(){

    cin.tie(0);
    ios::sync_with_stdio(false);

    ll n, k; cin >> n >> k;

    if((n-1)*(n-2)/2 < k){
        cout << -1 << endl;
        return 0;
    }

    ll rem = (n-1)*(n-2)/2 - k;
    cout << (n-1) + rem << endl;

    reps(i, 1, n){
        cout << 1 << " " << i+1 << endl;
    }

    ll cnt = 0;
    reps(i, 2, n+1){
        reps(j, i+1, n+1){
            if(cnt == rem) return 0;
            
            cout << i << " " << j << endl;

            cnt++;
        }
    }



    return 0;
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.*;
public class Main{
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
      int n = sc.nextInt();
      long k = sc.nextLong();
      long[] h = new long[n];
      for(int i=0;i<n;i++){
        h[i] = sc.nextLong();
      }
      long total = 0;
      Arrays.sort(h);
      if(n<=k){
        total = 0;
      }else{
        for(int i=0;i<n-k;i++){
          total += h[i];
        }
      }
      System.out.println(total);
      

    }
}


Measured memory_bytes: 91132
#include<iostream>
#include<string>
using namespace std;
int main(){
  string str;
  getline(cin,str);   // 一行読み込む
  int i;
  for(i=0;i<str.size();i++){      // str.size() …　読み込んだ一行の文字列における文字数(len)
    if(str[i]>='a'&&str[i]<='z') str[i]-='a'-'A';
    else if(str[i]>='A' && str[i]<='Z') str[i]+='a'-'A';  // C++における論理積andは、&&で表せる。
  }
    cout << str << endl;   // str   は、list構造になっているので
  return 0;
}



Measured memory_bytes: 3232
//inlclude before define 
#define _USE_MATH_DEFINES

//include
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<type_traits>
#include<numeric>
#include<assert.h>
//#include<deque>
#include<iomanip>
#include<set>
#include<tuple>
#include<map>

using namespace std;

//typedef
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<char> VC;
typedef pair<int, int> P1;
typedef long long int ll;

//define
#define INF 1e9
#define NUM 1000000007
#define all(x) begin(x),end(x)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define REP(i,a,b) for(int i=int(a);i<int(b);i++)
#define chmin(a,b) a=min((a),(b))
#define chmax(a,b) a=max((a),(b))


int main() {
	int n;
	cin >> n;
	VI a(n * 2);
	rep(i, n * 2) {
		cin >> a[i];
	}


	sort(all(a));
	int sum = 0;
	for (int i = 0; i < n * 2; i += 2) {
		sum += a[i];
	}

	cout << sum << endl;
}

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

int main() {
  int N;
  cin >> N;
  vector<double> x(N), y(N);
  for(int i=0; i<N; ++i) cin >> x[i] >> y[i];
  
  using P = pair<double, int>;
  vector<P> r(N);
  for(int i=0; i<N; ++i) {
    if(x[i] == 0.0 && y[i] == 0.0) r[i] = P(0,i);
    else r[i] = P(atan2(y[i], x[i]), i);
  }
  sort(begin(r), end(r));
  
  double res = 0.0;
  for(int i=0; i<N; ++i) {
    for(int j=1; j<=N; ++j) {
      double X = 0, Y = 0;
      for(int k=i; k<i+j; ++k) {
        int c = r[k % N].second;
        X += x[c];
        Y += y[c];
      }
      res = max(res, X * X + Y * Y);
    }
  }
  cout << fixed << setprecision(15) << sqrt(res) <<endl;
}


Measured memory_bytes: 256
function main(input) {
  const lines = input.split("\n");
  const N = lines[0];

  const items = {}
  for(let i = 1; i <= N; i++) {
    const name = lines[i];
    items[name] = 1;
  }
  const res = Object.keys(items).length;

  console.log(res);
}

main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 83300
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,c,tmp;
    cin>>a>>b>>c;
    tmp = a;
    a = b;
    b = tmp;
    tmp = a;
    a = c;
    c = tmp;
    cout<<a<<" "<<b<<" "<<c<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
// 大文字小文字によるエラー回避用
#define yes "YES"
#define no "NO"
using namespace std;

// Problem https://atcoder.jp/contests/agc010/tasks/agc010_a

/**
 * 戦略:2回目と変更
 * (要約) 奇数が奇数個ある場合false
 * (理由) もし偶数個あれば奇数は全部偶数に変わり、それらの偶数を足し合わしても偶数が
 * 1こづつ減って最終的には一つに収拾できるが、奇数個あると最終的には奇数一つ偶数一つになるため
 * 
 **/
bool solver(int allNumber,vector<long long int>A){
    bool result;
    int oddCount;
    oddCount = 0;
    result = true;
    /** for(int j=0;j<allNumber;j++){
        cout << A.at(j) << " ";
    }
    cout << endl;
    **/
   for(int j=0;j<allNumber;j++){
       if((A.at(j)%2)==1){
           oddCount = oddCount + 1;
       }
   }
   if ((oddCount%2)==1)
   {
       result=false;// 奇数の数が奇数個の場合のみ最後は2つ残るため結果は×になる
   }
    // それ以外は最初に設定した○のまま結果を返す
       return result;
}

int main(void){
    bool answer;
    int N;
    cin >> N;
    vector<long long int> Ai(N,0);
    for(int j=0;j<N;j++){
        cin >> Ai.at(j);
    }
    answer=solver(N,Ai);
    if(answer){
        cout << yes << endl;
    }
    else{
        cout << no << endl;
    }
}

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

typedef long long ll;

template<typename T>
void out(T x) { cout << x << endl; exit(0); }
#define watch(x) cout << (#x) << " is " << (x) << endl

const int maxn = 1e6 + 5;

int x,y,z,k;
ll a[maxn], b[maxn], c[maxn];
vector<ll> v;

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

  cin>>x>>y>>z>>k;
  for (int i=0; i<x; i++) {
    cin>>a[i];
  }
  for (int i=0; i<y; i++) {
    cin>>b[i];
  }
  for (int i=0; i<z; i++) {
    cin>>c[i];
  }
  sort(a,a+x);
  reverse(a,a+x);

  for (int i=0; i<y; i++) {
    for (int j=0; j<z; j++) {
      v.push_back(b[i]+c[j]);
    }
  }
  sort(v.begin(), v.end());
  reverse(v.begin(), v.end());


  priority_queue<pair<ll,int>> q;
  int N = v.size();
  vector<int> ptr(x, 1);
  for (int i=0; i<x; i++) {
    q.push({a[i]+v[0], i});
  }

  while (k>0) {
    auto cur = q.top(); q.pop();
    cout<<cur.first<<"\n";
    k--;
    int i = cur.second;
    if (ptr[i]==N) continue;
    q.push({a[i]+v[ptr[i]],i});
    ptr[i]++;
  }

  
  

  return 0;
}


Measured memory_bytes: 14572
#include<bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define int long long
#define vec(a,n) vector<int> (a)((n));
#define Vec(a,n) vector<string> (a)((n));
#define twovec(a,n,m) vector<vector<int>> a(n,vector<int>(m,0));
#define Twovec(a,n,m) vector<vector<double>> a(n,vector<double>(m,0));
#define P pair<int,int>
#define All(a) (a).begin(),(a).end()
#define Sort(a) sort(All(a));
#define Reverse(a) reverse(All(a));
#define PQ(n) priority_queue<P,vector<P>,greater<P>> (n)
#define pq(n) priority_queue<int> (n)
#define print(a) cout << (a) << endl;
#define printD(a) cout << setprecision(15) << (a) << endl;
using namespace std;
int max_int = 1000000007;
void Debug(auto a);
int nibul(auto a,auto b);
int nibuu(auto a,auto b);
void input(vector<int>& a,int n);

int n;

signed main(){
    int h,w;
    cin >> h >> w;
    twovec(a,h+1,w+1);
    vec(b,w);
    REP(i,h){
        int tmp=0;
        REP(j,w){
            cin >> a[i][j];
            tmp += a[i][j];
            b[j] += a[i][j];
        }
        a[i][w] = tmp;
    }
    int tmp=0;
    REP(i,w){
        a[h][i] = b[i];
        tmp += b[i];
    }
    a[h][w]=tmp;
    REP(i,h+1){
        REP(j,w+1){
            cout << a[i][j];
            if(j!=w){
                cout << " ";
            }
        }
        cout << endl;
    }

    


    return 0;
}

void Debug(auto a){
    cout << "{ ";
    for(auto b: a){
        cout << b << " ";
    }
    cout << "}" << endl;
}
int nibul(auto a,auto b){
    int x = lower_bound(All(a),b) - a.begin();
    //key以上の初めてのitr
    return x;
}
int nibuu(auto a,auto b){
    int x = upper_bound(All(a),b) - a.begin();
    //key以下の最後のitr
    return x-1;
}

void input(vector<int>& a,int n){
    REP(i,n){
        cin >> a[i];
    }
}



Measured memory_bytes: 3184
import java.util.*;
public class Main{
	public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
      int n = sc.nextInt();
      int[] a = new int[n];
      for(int i = 0;i < n;i++)a[i] = sc.nextInt();
      int count = 0;
      int point = 1;
      for(int i = 0;i <= n*2;i++){
      	point = a[point-1];
        count++;
        if(point == 2){
          System.out.println(count);
          return;
        }
      }
      System.out.println(-1);
    }
}


Measured memory_bytes: 52408
#include <bits/stdc++.h>
#define LL long long
#define maxn 200005
using namespace std;
typedef struct node
{
    LL rank1;
    LL tag;
    friend bool operator <(node n1,node n2)
    {
        if(n1.rank1!=n2.rank1)
            return n1.rank1<n2.rank1;
        else
            return n1.tag>n2.tag;
    }
} node;
int main()
{
    LL  x,y,a,b,c;
    cin>>x>>y>>a>>b>>c;
    priority_queue<node>  q;
    for(int i=0; i<a; i++)
    {
        node tmp;
        cin>>tmp.rank1;
        tmp.tag=1;
        q.push(tmp);
    }
    for(int i=0; i<b; i++)
    {
        node tmp;
        cin>>tmp.rank1;
        tmp.tag=2;
        q.push(tmp);
    }
    for(int i=0; i<c; i++)
    {
        node tmp;
        cin>>tmp.rank1;
        tmp.tag=3;
        q.push(tmp);
    }
    //cout<<q.top().rank1<<"  "<<q.top().tag<<endl;
    LL sum=0;
    LL need=0;
    LL sum2=0;
    while(!q.empty())
    {
        if(x+y<=need)
            break;
        node tmp=q.top();
        q.pop();
        if(tmp.tag==1)
        {
            if(x>=1)
            {
                x--;
                sum+=tmp.rank1;
            }
        }
        else if(tmp.tag==2)
        {
            if(y>=1)
            {
                y--;
                sum+=tmp.rank1;
            }
        }
        else
        {
            need++;
            sum2+=tmp.rank1;
        }
    }
    //cout<<sum2<<endl;
    sum+=sum2;
    cout<<sum;
}


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

#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)

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

template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

int main() {
    int n;
    cin >> n;
    
    int ans = 1 - n;
    cout << ans << endl;
    
    return 0;
}


Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
#define int long long
namespace Fread {
	const int MAXN=1<<20;
	char buf[MAXN],*S,*T;
	inline char getchar() {
		if (S==T) {
			T=(S=buf)+fread(buf,1,MAXN,stdin);
			if (S==T) return EOF;
		}
		return *S++;
	}
}
inline int read() {
	int x(0),neg(1);
	char ch=getchar();
	while(!isdigit(ch)) {
		if (ch=='-') neg=-1;
		ch=getchar();
	}
	while(isdigit(ch)) {
		x=(x<<1)+(x<<3)+(ch-'0');
		ch=getchar();
	}
	return x*neg;
}
#ifdef ONLINE_JUDGE
	#define getchar Fread::getchar
#endif
#define pb push_back
#define mp make_pair
int n,x,y,z;
int dp[45][1<<18];
const int mod=1e9+7;
inline int qpow(int x,int y) {
	int res=1ll;
	while(y) {
		if (y&1) res=res*x%mod;
		x=x*x%mod;
		y>>=1; 
	}
	return res;
} 
//130624
/*
int cnt;
inline void dfs(int sum) {
	if (sum>17) return ;
	++cnt;
	for (int i=1;i<=10;++i) dfs(sum+i);
}
*/
signed main() {
//	freopen(".in","r",stdin);
//	freopen(".out","w",stdout);
/*
	cnt=0;
	dfs(0);
	cout<<cnt<<'\n';
*/
	n=read(),x=read(),y=read(),z=read();
	int pnt=((1<<(x+y+z-1))|(1<<(y+z-1))|(1<<(z-1)));
//	cout<<pnt<<'\n';
	int tot=(1<<(x+y+z))-1;
	int ans=qpow(10,n);
	dp[0][0]=1;
	for (int i=1;i<=n;++i) {
		for (int j=0;j<=tot;++j) {
			if (dp[i-1][j]==0) continue;
			for (int k=1;k<=10;++k) {
				int now=((j<<k)+(1<<k-1))&tot;
				if ((now&pnt)!=pnt) {
					dp[i][now]=(dp[i][now]+dp[i-1][j])%mod;
				}
			}
		}
	}
	for (int i=0;i<=tot;++i) {
		ans=(ans-dp[n][i]+mod)%mod;
	}
	printf("%lld\n",ans); 
	return 0;
}


Measured memory_bytes: 40992
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll inf=1000000010;
const ll maxh=5e4+10;
const ll maxn=1010;
ll a[maxn],b[maxn];
ll dp[maxh];
int main()
{
    ios::sync_with_stdio(false);
    ll h,n;
    while(~scanf("%lld%lld",&h,&n))
    {
        for(ll i=0;i<n;i++)
            scanf("%lld%lld",&a[i],&b[i]);
        memset(dp,inf,sizeof(dp));
        dp[0]=0;
        for(ll i=0;i<n;i++)
            for(ll j=0;j<=h;j++)
        {
            dp[j+a[i]]=min(dp[j+a[i]],dp[j]+b[i]);
        }
        ll minn=inf;
        for(ll i=h;i<maxh;i++)
        {
            minn=min(minn,dp[i]);
        }
        printf("%lld\n",minn);
    }
    return 0;
}


Measured memory_bytes: 640
#include <stdio.h>
#include <math.h>

int main()
{
    long int x, y, n, res=0;
    double dis;
    scanf("%ld %lf",&n,&dis);
    for(int i=0; i<n; i++){
        scanf("%ld %ld",&x,&y);
        if(sqrt(x*x + y*y)<=dis){
            res++;
        }
    }
    printf("%ld\n",res);
    return 0;
}

Measured memory_bytes: 2140