akhauriyash/Code-Regression huggingface dataset:
/*
a^5 - b^5 = x
-64^5 , .... ,-32, -1, 0, 1, 32, 243, ....., 64^5

*/

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

int main(){
	ll x;
	cin>>x;
	bool flag = false;
	for(ull i=1000;i>0;i--){
		for(ull j=i-1;j>0;j--){
			ull a = i*i*i*i*i;
			ull b = j*j*j*j*j;
			if(a-b == x){
				cout<<i<<" "<<j<<"\n";
				flag = true;
				break;
			}
		}
		if(flag)
			break;
	}
	if(!flag){
		for(ll i=63;i>=-63;i--){
			for(ll j=i-1;j>=-63;j--){
				ll a = i*i*i*i*i;
				ll b = j*j*j*j*j;
				if(a-b == x){
					cout<<i<<" "<<j<<"\n";
					flag = true;
					break;
				}
			}
			if(flag)
				break;
		}
	}
	return 0;
}

Measured memory_bytes: 3612
#include <bits/stdc++.h>
#define INF 1e18
#define MOD 1000000007
#define PI M_PI
#define ll long long
#define vi vector<int>
#define all(v) v.begin(), v.end()
#define FOR(i, a, b) for (int i=a; i<b; i++)
#define REP(i, n) for (int i=0; i<n; i++)
#define REPD(i, n) for (int i=n-1; i>=0; i--)
#define print(x) cout << x << endl;
#define debug(x) cout << #x << " = " << endl;

using namespace std;

void solve()
{
    int N;
    cin >> N;
    string S;
    cin >> S;

    char now = '-';
    int ans = 0;
    for (int i=0; i<S.length(); ++i) {
        if (S[i] == now) {
            continue;
        } else {
            now = S[i];
            ans += 1;
        }
    }
    print(ans);
}

int main()
{
    solve();

    return 0;
}


Measured memory_bytes: 512
//Keep pluggin',this is your only outlet.
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<cctype>
#include<queue>
#include<map>
#define MM(x,y) memset(x,y,sizeof(x))
#define MCPY(a,b) memcpy(a,b,sizeof(b))
#define pb push_back
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define per(i,b,a) for(int i=b;i>=a;i--)
#define fi first
#define mp make_pair
#define se second
using namespace std;
#define int long long

inline int quickpow(int m,int n,int p){int b=1;while(n){if(n&1)b=b*m%p;n=n>>1;m=m*m%p;}return b;}
inline int quickmul(int x,int y,int mod){return (x*y-(int)((long double)x/mod*y)*mod+mod)%mod;}
inline int getinv(int x,int p){return quickpow(x,p-2,p);}
inline int read(void){
    int x=0,f=1;char ch=getchar();
    while(!isdigit(ch)){f=ch=='-'?-1:1;ch=getchar();}
    while(isdigit(ch)){x=(x<<3)+(x<<1)+ch-'0';ch=getchar();}
    return x * f;
}
#define GG return puts("-1"),0
const int MAXN = 1e5 + 100;
struct Node{
    int x,y;
    bool operator < (const Node &b) const {
        return x > b.x;
    }
}a[MAXN];
struct Edges{
    int u,to,nxt;
}E[MAXN<<1];
int head[MAXN],cnt = 0,n,dep[MAXN],fa[MAXN],sz[MAXN],dis[MAXN];
map<int,int>id;
inline void addedge(int u,int v){
    E[++cnt].to = v; E[cnt].u = u;E[cnt].nxt = head[u]; head[u] = cnt;
}

inline void dfs1(int u,int fa,int root){
    dis[root] += dep[u];
    for (int i = head[u]; i; i = E[i].nxt) {
        int v = E[i].to;
        if (v == fa) continue;
        dep[v] = dep[u] + 1;
        dfs1(v,u,root);
    }
}

inline void dfs2(int u,int fa){
    for (int i = head[u]; i; i = E[i].nxt) {
        int v = E[i].to;
        if (v == fa) continue;
        dis[v] = dis[u] - (sz[v] << 1) + n;
        dfs2(v,u);
    }
}

///------------------head------------------
signed main(signed argc, char *argv[]){
    n = read();
    for (int i = 1; i <= n; ++i) {
        a[i].x = read(); sz[i] = 1;
        a[i].y = i; id[a[i].x] = i;
    }
    sort(a+1,a+n+1);
    for (int i = 1; i < n; ++i) {
        int u = a[i].y,tofind = a[i].x + 2 * sz[a[i].y] - n;
        if (!id.count(tofind)) GG;
        if (n <= 2 * sz[u]) GG;
        fa[u] = id[tofind];
        sz[fa[u]] += sz[u];
        addedge(u,fa[u]);
        addedge(fa[u],u);
    }
    dep[a[n].y] = 0;
    dfs1(a[n].y,0,a[n].y);
    dfs2(a[n].y,0);
    for (int i = 1; i <= n; ++i) if (a[i].x != dis[a[i].y]) GG;
    for (int i = 1; i <= cnt; ++i) {
        if (E[i].u < E[i].to) printf("%lld %lld\n",E[i].u,E[i].to);
    }
    return 0;
}

/* Examples: */
/*

*/

/*

*/


Measured memory_bytes: 18816
n = int(input())
a = [int(i) for i in input().split()]
q = int(input())
m = [int(i) for i in input().split()]


def f2(l, x):
    r = []
    for li in l:
        r.append(li + x)
        r.append(li)
    return r


r = [0]
for ai in a:
    r = f2(r, ai)

for mi in m:
    if mi in r:
        print("yes")
    else:
        print("no")



Measured memory_bytes: 50624
#include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <ctime>
#include <cstdlib>
#include <map>
#include <set>
#include <stack>
#include <queue>
 
using namespace std;
 
#define pb(n)	push_back(n)
#define mp(n,m) make_pair(n,m)
#define fi 	first
#define se 	second
#define all(r) (r).begin(),(r).end()
 
#define REP(i,s,e)	for(int i=(s); i<(e); i++)
#define rep(i,n)	REP(i,0,n)
#define REPE(i,s,e)	for(int i=s; i>e; i--)
#define repe(i,n)	REPE(i,n,-1)


typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
 
typedef vector<vi> vvi;
 
const int IMAX=((1<<30)-1)*2+1;
const int INF=100000000;
const double EPS=1e-10;
//int mod=1000000007



int main(){
	int n;
	vi v (2001,0);
	for(int i = 0; i<=1000; i++){
		for(int j = 0; j <= 1000; j++){
			v[i + j]++;
		}
	}
	while(cin >> n){
		int ans = 0;
		for(int i = 0; i <=2000; i++){
			for(int j = 0; j <= 2000; j++){
				if(i + j == n) ans += (v[i] * v[j]);
			}
		}
		cout<<ans<<endl;
	}
}

Measured memory_bytes: 1204
import java.util.*;
import java.math.*;

public class Main {
    static final int MOD = 1_000_000_007; // 10^9+7
    // static final int MAX = 2_147_483_646; // intの最大値
    static final int INF = 1_000_000_000; // 10^9
    static final int MAX = 10_000_000;
    static long[] fact = new long[100];

    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        n %=10;
        String ans = "hon";
        if(n == 3)ans = "bon";
        if(n == 0||n==1||n==6||n==8)ans="pon";
        System.out.println(ans);
    }
}


Measured memory_bytes: 35796
import java.lang.*;
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int animal = scan.nextInt();
        int leg = scan.nextInt();

        int sum = 0;

        for (int i = 0; i <= animal; i++) {
            if ((i * 2 + (animal - i) * 4) == leg) {
                System.out.println("Yes");
                return;
            }
        }
        System.out.println("No");

    }
}


Measured memory_bytes: 35820
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()

inline int toInt(string s) {
  int v;
  istringstream sin(s);
  sin >> v;
  return v;
}

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vector<int> > Mat;
typedef tuple<int, int, int, int> T;

const int MOD = (int)1e9 + 7;
const int INF = (int)1e9;
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};

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

  ll Q, H, S, D, N;
  cin >> Q >> H >> S >> D >> N;
  Q *= 4;
  H *= 2;

  if (N == 1) {
    cout << min({Q, H, S}) << endl;
  } else {
    ll res = 0;
    if (N % 2) {
      res += min({Q, H, S});
      N--;
    }
    Q *= 2;
    H *= 2;
    S *= 2;
    res += min({Q, H, S, D}) * N / 2;
    cout << res << endl;
  }

  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const long long mod=1e9+7,INF=1e18;
#define ll long long
#define pll pair<ll,ll>
#define pii pair<int,int>
#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll t=1;
    vector<vector<ll> > power(420);
    for(ll i=0;i<=410;i++)
    {
        power[i].push_back(1);
        for(ll j=1;j<=410;j++)
        power[i].push_back((power[i][j-1]*i)%mod);
    }
    // cin>>t;
    while(t--)
    {
        ll n,c;
        cin>>n>>c;
        vector<ll> a(n),b(n),count(420,0);
        vector<vector<ll> > s(420);
        for(int i=0;i<410;i++)
        for(int j=0;j<410;j++)
        s[i].push_back(0);
        for(int i=0;i<n;i++)
        cin>>a[i];
        for(int i=0;i<n;i++)
        cin>>b[i];
        s[0][0]=1;
        for(int i=0;i<n;i++)
        {
            for(int j=0;j<=c;j++)
            {
                count[j]=0;
                for(int k=a[i];k<=b[i];k++)
                {
                    count[j]=(count[j]+power[k][j])%mod;
                }
            }
            for(int j=0;j<=c;j++)
            {
                if(s[i][j])
                for(int k=0;j+k<=c;k++)
                {
                    s[i+1][j+k]=(s[i+1][j+k]+s[i][j]*count[k])%mod;
                }
            }
        }
        cout<<s[n][c]<<"\n";
    }
    return 0;
}

Measured memory_bytes: 6544
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string s;
    cin>>s;

    for(int i=0;i<s.size();i++)
    {
        if(s[s.size()-1]=='s')
        {
            cout<<s<<"es";
            break;
        }
        else
        {
            cout<<s<<"s";
            break;
        }

    }
    return 0;
}


Measured memory_bytes: 3624
#include <iostream>

using namespace std;

int main()
{
  int a[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
  int n;
  
  for(int i=0; i<4; i++)
  {
    cin >> n;
  	a[n] = 1;
  }
  if(a[1] == 1 && a[9] == 1 && a[7] == 1 && a[4] == 1)
    cout << "YES\n";
  else
    cout << "NO\n";
  
  return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
int a[100];
 int main() {
	 int ans = 0;
	 int N;
	 cin >> N;
	 for (int i = 0; i < N; i++) cin >> a[i];
	 for (int i = 0; i < N; i++) {
		 for (int j = i + 1; j < N; j++) {
			 ans = max(ans, abs(a[i] - a[j]));
		 }
	 }
	 cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <cstdlib>
#include <cmath>
#include <algorithm>
using namespace std;
using ll = long long;
using P = pair<int,int>;
using Graph= vector<vector<int>>; 
#define rep(i,n) for (ll i=0; i < (n); ++i)
#define rep2(i,n,m) for(ll i=n;i<=m;i++)
#define rep3(i,n,m) for(ll i=n;i>=m;i--)
#define pb push_back
#define eb emplace_back
#define ppb pop_back
const ll INF=1e18 ;
inline void chmax(ll& a,ll b){a=max(a,b);}
inline void chmin(ll& a,ll b){a=min(a,b);}
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}
int main(){
  ll a,b ;cin>>a>>b ;
  ll n=gcd(a,b) ;
 map<ll,int> ord;  //素因数とオーダーをマップで管理
    for(ll i=2;i*i<n;i++){
        if(n%i==0){
            int res=0;
            while(n%i==0){
                n/=i;
                res++;
            }
            ord[i]=res;
        }
    }
if(n!=1) ord[n]++;
  ll ans=0 ;
  for(auto pr:ord){
  ans++ ;
  }

  cout<<ans+1<<endl ;
     return 0;
  }

Measured memory_bytes: 256
import java.util.*;
import java.lang.*;
import java.math.*;
import java.io.*;

import static java.lang.Math.*;
import static java.util.Arrays.*;

public class Main{

	Scanner sc;

	static final int INF=1<<28;
	static final double EPS=1e-9;

	void run(){
		sc=new Scanner(System.in);
		for(;;){
			if(!sc.hasNext())
				break;
			int a=sc.nextInt();
			int b=sc.nextInt();
			println(""+(int)ceil(log10(a+b+1)));
		}
		sc.close();
	}

	void print(String s){
		System.out.print(s);
	}

	void println(String s){
		System.out.println(s);
	}

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

Measured memory_bytes: 12000
A, B, C, D, E, F = map(int, input().split())

water = set()
for i in range(F//(100*A) + 1):
    for j in range(F // (100*B) + 1):
        if 100*A * i + 100*j*B <= F:
            water |= {100*A * i + 100*j*B}
        else:
            break

sugar = set()
for i in range(F//C + 1):
    for j in range(F // D + 1):
        if C * i + D*j <= F:
            sugar |= {C * i + D*j}
        else:
            break
ans = [100*A, 0]
for x in water:
    if x == 0:
        continue
    for y in sugar:
        if x + y <= F and y <= (x/100)*E:
            if ans[1]/ans[0] < y / (x+y):
                ans = [x+y, y]

print(ans[0], ans[1])


Measured memory_bytes: 3316
using System;
using System.Collections.Generic;
using System.IO;

class MainClass
{
  static public void Main(string[] args)
  {
    var N = Convert.ToInt64(Console.ReadLine());
    long res = 0;
    for (long i = 1; i <= N; i++) {
      var n = N / i;
      res += (i * n * (n + 1)) / 2;
    }
    Console.WriteLine(res);
  }
}


Measured memory_bytes: 27500
package main

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

const (
	initialBufSize = 10000
	maxBufSize     = 1000000
	mod            = 1e9 + 7
)

var (
	sc *bufio.Scanner = func() *bufio.Scanner {
		sc := bufio.NewScanner(os.Stdin)
		buf := make([]byte, initialBufSize)
		sc.Buffer(buf, maxBufSize)
		sc.Split(bufio.ScanWords)
		return sc
	}()
)

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

	costs := make([]int, N)
	costs[0] = 0
	for i := 1; i < N; i++ {
		if i == 1 {
			costs[i] = costs[i-1] + abs(H[i-1] - H[i])
		} else {
			costs[i] = min(costs[i-1] + abs(H[i-1] - H[i]), costs[i-2] + abs(H[i-2] - H[i]))
		}
	}

	fmt.Println(costs[N-1])
}

type Graph struct {
	n     int
	edges [][]int
}

func NewGraph(n int) *Graph {
	g := &Graph{
		n:     n,
		edges: make([][]int, n),
	}
	return g
}

func (g *Graph) AddEdge(u, v int) {
	g.edges[v] = append(g.edges[v], u)
	g.edges[u] = append(g.edges[u], v)
}

func dfs(c int, edges [][]int, visited map[int]struct{}) {
	visited[c] = struct{}{}

	for _, v := range edges[c] {
		_, flag := visited[v]
		if flag {
			continue
		}
		dfs(v, edges, visited)
	}
}

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

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

func abs(a int) int {
	return int(math.Abs(float64(a)))
}

func pow(p, q int) int {
	return int(math.Pow(float64(p), float64(q)))
}

func powMod(n, p int) int {
	if p == 0 {
		return 1
	} else if p%2 == 0 {
		t := powMod(n, p/2)
		return calcMod(t * t)
	} else {
		return n * powMod(n, p-1)
	}
}

func min(nums ...int) int {
	if len(nums) == 0 {
		panic("funciton min() requires at least one argument.")
	}
	res := nums[0]
	for i := 0; i < len(nums); i++ {
		res = int(math.Min(float64(res), float64(nums[i])))
	}
	return res
}

func max(nums ...int) int {
	if len(nums) == 0 {
		panic("funciton max() requires at least one argument.")
	}
	res := nums[0]
	for i := 0; i < len(nums); i++ {
		res = int(math.Max(float64(res), float64(nums[i])))
	}
	return res
}

func strSearch(a []string, b string) bool {
	for i := 0; i < len(a); i++ {
		if a[i] == b {
			return true
		}
	}
	return false
}

func printIntArray(array []int) {
	strArray := fmt.Sprint(array)
	fmt.Println(strArray[1 : len(strArray)-1])
}

func calcMod(x int) int {
	return x % mod
}


Measured memory_bytes: 2688
#include <iostream>

using namespace std;

int main()
{
    int a;
    int A,B,C,D;
    cin >> a;
    A=a/1000;
    D=a%10;
    C=a/10%10;
    B=a/100%10;
    if(A+B+C+D==7)
        cout << A << "+" << B << "+" << C << "+" << D << "=7" << endl;
    else if(A+B+C-D==7)
        cout << A << "+" << B << "+" << C << "-" << D << "=7" << endl;
    else if(A+B-C+D==7)
        cout << A << "+" << B << "-" << C << "+" << D << "=7" << endl;
    else if(A+B-C-D==7)
        cout << A << "+" << B << "-" << C << "-" << D << "=7" << endl;
    else if(A-B-C-D==7)
        cout << A << "-" << B << "-" << C << "-" << D << "=7" << endl;
    else if(A-B+C+D==7)
        cout << A << "-" << B << "+" << C << "+" << D << "=7" << endl;
    else if(A-B+C-D==7)
        cout << A << "-" << B << "+" << C << "-" << D << "=7" << endl;
    else if(A-B-C+D==7)
        cout << A << "-" << B << "-" << C << "+" << D << "=7" << endl;

    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <algorithm>

using namespace std;

typedef long long ll;

struct Edge {
  int t,next;
  Edge() {}
  Edge(int a,int b):t(a),next(b) {}
};

Edge e[400005];
int head[200005];

bool vis[100005],col[100005];
int cnt;
bool can;

void dfs(int x,int c) {
  vis[x]=1;cnt++;
  col[x]=c;
  for(int i=head[x];i;i=e[i].next)
    if (!vis[e[i].t]) dfs(e[i].t,c^1);
    else if (!(col[x]^col[e[i].t])) can=0;
}

int main() {
  int n,m;
  scanf("%d%d",&n,&m);
  for(int i=1;i<=m;i++) {
  	int x,y;
  	scanf("%d%d",&x,&y);
  	e[2*i-1]=Edge(y,head[x]);
  	head[x]=2*i-1;
  	e[2*i]=Edge(x,head[y]);
  	head[y]=2*i;
  }
  int s1=0,s2=0,s3=0;
  for(int i=1;i<=n;i++)
    if (!vis[i]) {
    	cnt=0;can=1;
    	dfs(i,0);
    	if (cnt==1) s3++;
    	else if (can) s1++;
    	else s2++;
	}
  ll ans=(ll)n*n-(ll)(n-s3)*(n-s3);
  ans+=(ll)(s1+s2)*(s1+s2)+(ll)s1*s1;
  printf("%lld\n",ans);
  return 0;
}

Measured memory_bytes: 5760
n = int(input())
xs = list(map(int, input().split()))
xs = [0] + xs + [0]

total = 0

for i in range(1,n+2):
    total += abs(xs[i]-xs[i-1])

for j in range(1,n+1):
    print(total-abs(xs[j]-xs[j-1])-abs(xs[j]-xs[j+1])+abs(xs[j-1]-xs[j+1]))


Measured memory_bytes: 64876
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <string>

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = (n) - 1; i >= 0; i--)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (a); i > (b); i--)
#define ALL(a) (a).begin(), (a).end()

int main() {
    int N, L[100];
    cin >> N;
    REP(i, N) cin >> L[i];
    int ans = 0;
    REP(i, N - 2) FOR(j, i + 1, N - 1) FOR(k, j + 1, N) {
        if (L[i] + L[j] > L[k] &&
            L[j] + L[k] > L[i] &&
            L[k] + L[i] > L[j] &&
            L[i] != L[j] &&
            L[j] != L[k] &&
            L[k] != L[i]) {
                ans++;
            }
    }
    cout << ans << endl;
    return 0;
}

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

using namespace std;
typedef  long long ll;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
#define  MP make_pair
#define  PB push_back
#define inf  1000000007
#define rep(i,n) for(int i=0;i<(int)(n);++i)

int main(){
	int n;
	cin >> n;
	vector<ll>a(n); 
	rep(i,n){
		cin >> a[i];
	}
	ll ma=2,mi=2;
	reverse(a.begin(),a.end());
	bool flag =0;
	rep(i,n){
		if((ma/a[i])*a[i]<mi){
			flag = 1;
			break;
		}
		ll x,y;
		x = (ma/a[i])*a[i]+a[i]-1;
		y = ((mi+a[i]-1)/a[i])*a[i];
		ma = x;
		mi = y;
		if(ma<mi){
			flag = 1;
			break;
		}
	}
	if(flag){
		cout << -1 << endl;
	}else{
		cout << mi << " " << ma << endl;
	}
	return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a[4]={6000,4000,3000,2000},b,c;
    for(int i=0;i<4;i++){
        cin>>b>>c;
        cout<<c*a[b-1]<<endl;
    }
    return 0;
}

Measured memory_bytes: 3092
#include <bits/stdc++.h>
#define lli long long int
#define pb push_back
#define mod2 998244353
#pragma GCC optimize("-O2")
#define mod3 127
#define mod 1000000007
#define MAXN 1000000000
#define v32 vector<int>
#define v64 vector<lli>
#define v1024 vector<vector<int>>
#define v4096 vector<vector<lli>>
#define vt vector
#define f(x, y, z) for (lli x = y; x < z; x++)
#define fd(x, y, z) for (lli x = y; x > z; x--)
#define lb lower_bound
#define ld long double
#define m64 map<lli, lli>
#define m32 map<int, int>
#define m64it map<lli, lli>::iterator
#define m32it map<int, int>::iterator
#define fastio                    \
ios_base::sync_with_stdio(0); \
cin.tie(0);                   \
cout.tie(0)
#define ist insert
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
#define p_q priority_queue
#define min_p_q priority_queue<int, vt<int>, greater<int>>
using namespace std;
using namespace __gnu_pbds;
lli tmod(lli x, lli y)
{
    return (x % y + y) % y;
}
template <typename T>
void DEBUG_ARR(vt<T> a)
{
    f(i, 0, a.size()) cout << a[i] << " ";
    cout << "\n";
}
lli power(lli x, lli y) 
{
    lli res = 1;  
    while (y > 0) 
    { 
        if (y & 1) 
            res = (res*x)%mod; 
        y = y>>1; 
        x = (x*x)%mod;
    }
    if(res<0)res+=mod;
    return res; 
}

int main()
{
    fastio;
    int n,m;
    cin>>n>>m;
    if(n==m)cout<<"Yes";
    else cout<<"No";
    return 0;
}


Measured memory_bytes: 256
N, M = map(int, input().split())

left = []
right= []

for i in range(M):
    L, R = map(int, input().split())
    left.append(L)
    right.append(R)

l = max(left)
r = min(right)

if l <= r:
    print(r-l+1)
else:
    print(0) 

Measured memory_bytes: 10980
package main

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

var L float64

func main() {
	readVariables()
	a := L / 3
	fmt.Println(a * a * a)
}

func readVariables() {
	L = float64(nextInt())
}

/* Template */

var scanner *bufio.Scanner

func init() {
	Max := 1001001
	scanner = bufio.NewScanner(os.Stdin)
	scanner.Buffer(make([]byte, 0, Max), Max)
	scanner.Split(bufio.ScanWords)
}

//nextInt converts next token from stdin and returns integer value.
//nextInt panics when conversion into an integer fails.
func nextInt() int {
	if !scanner.Scan() {
		panic("No more token.")
	}
	num, err := strconv.Atoi(scanner.Text())
	if err != nil {
		panic("nextInt(): cannot convert to int: " + scanner.Text())
	}
	return num
}

func nextStr() string {
	if !scanner.Scan() {
		panic("No more token.")
	}
	return scanner.Text()
}

// MinInt returns minimum argument
func MinInt(x, y int) int {
	if x < y {
		return x
	} else {
		return y
	}
}

//MaxInt returns maximum argument
func MaxInt(x, y int) int {
	if x < y {
		return y
	} else {
		return x
	}
}

//AbsInt returns |x| for x
func AbsInt(x int) int {
	if x < 0 {
		return -x
	}
	return x
}

//ModPow calculates integer power with modulo operation
//if modulo <= 1, it powers w/o module operation
//if base < 0, return value might be negative too.
func ModPow(base, exponent, modulo int) (result int) {
	result = 1
	for exponent > 0 {
		if exponent%2 == 1 {
			result *= base
			if modulo > 1 {
				result %= modulo
			}
		}
		base *= base
		if modulo > 1 {
			base %= modulo
		}
		exponent /= 2
	}
	return
}

//Gcd
func Gcd(vals ...int) (result int) {
	if len(vals) == 0 {
		return
	}
	result = vals[0]
	for i := 1; i < len(vals); i++ {
		result = gcd(result, vals[i])
	}
	return
}

func gcd(x, y int) int {
	x, y = AbsInt(x), AbsInt(y)
	for y > 0 {
		x, y = y, x%y
	}
	return x
}

//Lcm
func Lcm(vals ...int) (result int) {
	if len(vals) == 0 {
		return
	}
	result = vals[0]
	for i := 1; i < len(vals); i++ {
		result = lcm(result, vals[i])
	}
	return
}

func lcm(x, y int) int {
	return x * y / gcd(x, y)
}


Measured memory_bytes: 640
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cmath>
#include <functional>
#include <numeric>
#include <iomanip>
#define fi first
#define se second
#define fcout(n) cout<<fixed<<setprecision((n))
#define cinl(str) getline(cin,(str))
using namespace std;
bool value(int y,int x,int R,int C){return 0<=y&&y<R&&0<=x&&x<C;}
typedef pair<int,int> pii;
typedef pair<pair<string,int>,int> psi;
typedef long long ll;
typedef vector<int> vi;
typedef vector<long long > vll;
typedef vector< vi > vvi;
double pie=acos(-1);
int INF=1000000007;
int dx[4] = { 0,-1,0,1 };
int dy[4] = { -1,0,1,0 };


int main() {
	int n;
	string s;
	int p;
	psi ps[110];
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>s>>p;
		ps[i]=make_pair(make_pair(s,-p),i);
	}
	sort(ps,ps+n);
	for(int i=0;i<n;i++){
		cout<<ps[i].second+1<<endl;
	}

}

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

int main()
{
	string fir, sec;
	map<string, string> cpp;

	int q;
	cin >> q;
	while (q--)
	{
		cin >> fir >> sec;
		if (fir[0] == 'i')cpp[sec] = "yes";
		else if (fir[0] == 'f')
		{
			if (cpp.find(sec) != cpp.end())cout << "yes" << endl;
			else cout << "no" << endl;
		}
	}
	return 0;
}


Measured memory_bytes: 49788
#include<bits/stdc++.h>
using namespace std;
int main()
{
map<char,int>m,n;
int a,b,i,j;
string s,ss;
cin>>a;
ss="abcdefghijklmnopqrstuvwxyz";
for(j=1;j<=a;j++)
{
  cin>>s;
  for(i=0;i<s.size();i++)
  m[s[i]]++;
  if(j==1)n=m;
  else
   {
  for(i=0;i<ss.size();i++)
   {
   n[ss[i]]=min(n[ss[i]],m[ss[i]]);
   }
   }
  m.clear();
 
}
for(i=0;i<ss.size();i++)
{
 b=n[ss[i]];
for(j=1;j<=b;j++)cout<<ss[i];
}
}

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

using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
typedef long long ll;

int main(){
  int n;
  cin >> n;
  int ans = 0;
  for(int i=1;i<=n;i+=2){
    int count = 0;
    rep1(j,i){
      if(i%j==0)count++;
    }
    if(count==8)ans++;
  }
  cout << ans << endl;
}



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

int n,m,q;
vector<int> a,b,c,d;
int ans;

void dfs(vector<int> A){
    if(A.size() == n+1){
        int now=0;
        for(int i=0;i<q;i++){
            if(A[b[i]]-A[a[i]]==c[i])now+=d[i];
        }
        ans=max(ans,now);
        return;
    }

    A.push_back(A.back());
    while(A.back()<=m){
        dfs(A);
        A.back()++;
    }
}

int main(){
    cin>>n>>m>>q;
    a=b=c=d=vector<int> (q);
    for(int i=0;i<q;i++)cin>>a[i]>>b[i]>>c[i]>>d[i];
    dfs(vector<int> (1,1));
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3596
import java.util.*;
public class Main{
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    int c = sc.nextInt();
    int count = 0;

    if(a==b&&b==c){
      System.out.println(1);
    }else{
      if(a!=b){
        count++;
      }
      if(b!=c){
        count++;
      }
      if(c!=a){
        count++;
      }
      System.out.println(count);
    }
  }
}


Measured memory_bytes: 21972
import math

def count(n, k, b):
    if k >= b:
        return 0
    n_blocks = math.floor((n+1) / b)
    ans = (b-k) * n_blocks

    remainder = (n+1) - n_blocks * b
    if remainder > k:
        ans += remainder - k

    #print(f'b={b}, ans={ans}, n_blocks={n_blocks}, remainder={remainder}')
    return ans

n, k = map(int, input().split())

if k == 0:
    print(n*n)
    exit(0)

ans = 0
for b in range(1, n+1):
    cnt = count(n, k, b)
    ans += cnt
    #print(f'b={b}, cnt={cnt}, n={n}, k={k}')
print(ans)


Measured memory_bytes: 3064
#include <stdio.h>
#include <stdlib.h>
#define MAX 2000001
#define VMAX 10000

int main(){
  unsigned short *A, *B;
  int C[VMAX+1];
  int n, i, j;

  scanf("%d", &n);

  A = malloc(sizeof(short)*n+1);
  B = malloc(sizeof(short)*n+1);

  for(i=0;i<VMAX;i++){
    C[i]=0;
  }
  
  for(i=0;i<n;i++){
    scanf("%d",&A[i+1]); 
    C[A[i+1]]++;
  }

  for(i=1;i<=VMAX;i++){
    C[i]=C[i]+C[i-1];
  }

  for(j=1;j<=n;j++){
    B[C[A[j]]]=A[j];
    C[A[j]]--;
  }

  for(i=1;i<=n;i++){
    if(i>1){
      printf(" ");
    }
      printf("%d",B[i]);
  }
  printf("\n");

  return 0;
}



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

using namespace std;

int k, n;
int l[55];

int main(void)
{
	cin >> n >> k;
	for(int i = 0; i < n; i++) cin >> l[i];
	sort(l, l+n);
	reverse(l, l+n);
	
	int sum = 0;
	for(int i = 0; i < k; i++) sum += l[i];
	cout << sum << endl;
	return 0;
}

Measured memory_bytes: 256
N,Ma,Mb = map(int, input().split())
arr=[list(map(int,input().split())) for _ in range(N)]
dp=[[[5000]*401 for _ in range(401)] for _ in range(41)]
dp[0][0][0] = 0
for i in range(N):
    a,b,c=arr[i]
    for j in range(10*N+1):
        for k in range(10*N+1):
            if dp[i][j][k] == 5000:
                continue
            dp[i+1][j][k]=min(dp[i+1][j][k],dp[i][j][k])
            dp[i+1][j+a][k+b]=min(dp[i+1][j+a][k+b],dp[i][j][k]+c)

ans=5000
for i in range(1,401):
        if i*Ma>400 or i*Mb>400:
            break
        ans = min(ans, dp[N][i*Ma][i*Mb])
if ans == 5000:
    print(-1)
else:
    print(ans)

Measured memory_bytes: 59504
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
# define inf 0x3f3f3f3f
const int maxn = 1e5+100;
int main()
{
	ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    while(a>0&&c>0){
    	c-=b;
    	if(c<=0){
    		break;
		}
		a-=d;
	}
	if(a<=0)
	cout<<"No";
	else cout<<"Yes";
    return 0;
}

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

using namespace std;
using ll = long long;
using cll = const long long;
using vec = vector<ll>;

ll pow(ll b, ll p, ll mod){
    ll ret = 1LL;
    ll cum = b;
    while (p){
        if (p & 1) ret = ret * cum % mod;
        cum = cum * cum % mod;
        p >>= 1;
    }
    return ret;
};

class ModuloMath{
    static constexpr ll mod = 1e9+7;
public:
    ModuloMath(ll n) : maxN(n){
        inv.resize(maxN + 1, 1);
        fac.resize(maxN + 1, 1);
        invfac.resize(maxN + 1, 1);
        for (ll i = 2; i <= maxN; ++i) inv[i] = mod - (mod / i) * inv[mod % i] % mod;
        for (ll i = 2; i <= maxN; ++i) fac[i] = fac[i - 1] * i % mod;
        invfac[maxN] = pow(fac[maxN], mod - 2, mod);
        for (ll i = maxN - 1; i != 0; --i) invfac[i] = invfac[i + 1] * (i + 1LL) % mod;
    }
    ll nCr(ll n, ll r){return fac[n] * invfac[r] % mod * invfac[n - r] % mod;}
    ll nPr(ll n, ll r){return fac[n] * invfac[n - r] % mod;}
    ll nHr(ll n, ll r){return nCr(n + r - 1, r);}
    // nHr 重複組み合わせ。n種類のものから重複を許してr個選ぶ場合の数。n種類の玉をr個（n < rで良い）選ぶときのパターンの数など。

private:
    ll maxN;
    vec inv;
    vec fac;
    vec invfac;
};

int main() {
    ll mod = 1e9+7;
    ll H, W, A, B;
    cin >> H >> W >> A >> B;
    ModuloMath mm(H + W + 1);
    ll total = mm.nCr(H + W - 2, H - 1);
    long long w = W - B;
    for (long long h = A; h != 0; --h){
        ll tmp = mm.nCr(h + w - 2, h - 1) * mm.nCr(H - h + 1 + B - 2, H - h + 1 - 1) % mod;
        total = (mod + total - tmp) % mod;
    }
    cout << total << endl;
    return 0;
}

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

using namespace std;

int main(){
	int N;
	int A;
	int B;
	cin >> N >> A >> B;

	int ansmax;
	int ansmin;

	if (A >= B){
		ansmax = B;
	}
	else{
		ansmax = A;
	}

	if (A + B - N < 0){
		ansmin = 0;
	}
	else{
		ansmin = A + B - N;
	}

	cout << ansmax << " " << ansmin << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<deque>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<iterator>
#include<complex>
#include<stack>
#include "stdio.h"
using namespace std;

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

using ll = long long;
using Pii = pair<int, int>;

const int inf = 1e9 + 7;
const ll longinf = 1LL << 60;
const long long mod_const = 1e9+7;

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

using MIte = multimap<ll, ll, greater<ll> >::iterator;


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

	// long long?
	ll N;
	cin >> N;

	double ans = 0.0;
	if (N % 2 == 0) {
		ans = 0.5;
	}
	else {
		ans = (double)(N + 1) / (double)N / 2;
	}

	cout << fixed << setprecision(10) << ans << endl;
	return 0;
}

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

int main() {
    int A, B, C;
    cin >> A >> B >> C;
    if ((A == B && A != C) || (A == C && A != B) || (B == C && B != A)) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}

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

int min(int x, int y){
  if(x > y) return y;
  else return x;
}

int main(void){
  int A, B, C, D;
  cin >> A >> B >> C >> D;
  cout << (min(A, B) + min(C, D)) << endl;
  return 0;
}

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

void permute(string a, int l, int r)  
{  
    // Base case  
    if (l == r)  
        arr.push_back(a);
    else
    {  
        // Permutations made  
        for (int i = l; i <= r; i++)  
        {  
  
            // Swapping done  
            swap(a[l], a[i]);  
  
            // Recursion called  
            permute(a, l+1, r);  
  
            //backtrack  
            swap(a[l], a[i]);  
        }  
    }  
}  

// Driver code 
int main() 
{ 

	int n,ind1=0,ind2=0;
	string str1,str2,ch;
	cin >> n;
	for(int i=0; i<n;i++)
	{
		cin >> ch;
		str1 += ch;
	}
		
		
	for(int i=0; i<n;i++)
	{
		cin >> ch;
		str2 += ch;
	}

	permute(str1,0, n-1); 
	sort(arr.begin(),arr.end());
	//cout << str1 << " " << str2 << "\n";
	for(int i=0; i<arr.size(); i++)
	{
		//cout << arr[i] << "\n";	
		if(arr[i] == str1 && ind1 == 0)
		{
			ind1 = i+1;
			//cout << "ind1 is: " << ind1 << "\n";
		}
		if(arr[i] == str2 && ind2 == 0)
		{
			ind2 = i+1;
			//cout << "ind1 is: " << ind2 << "\n";
		}
	}
	cout << abs(ind1 - ind2) << "\n";
	
	
	
	/*
	for(int i=0; i<arr.size()-1; i++)
	{
		temp1 = arr[i];
		temp2 = arr[i+1];
		bool flag1 = false,flag2 = false;
		for(int j=0; j<temp1.length(); j++)
		{
			if(temp1[j] == temp2[j])
			{
				
			}
		}
		
	}
	*/
	return 0; 
} 


Measured memory_bytes: 2424
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N,T,A,H[1000];
  cin>>N>>T>>A;
  int ans;
  double min=DBL_MAX;
  for(int i=0;i<N;i++){
    cin>>H[i];
    if(abs((T-H[i]*0.006)-A)<min){
      min=abs((T-H[i]*0.006)-A);
      ans=i;
    }
  }
  cout<<ans+1<<endl;
}

Measured memory_bytes: 256
#if !defined(__clang__) && defined(__GNUC__)
#include <bits/stdc++.h>
#else
#include <cstdlib>
#include <climits>
#include <iostream>
#include <cstdint>
#include <vector>
#include <string>
#include <complex>
#include <bitset>
#include <queue>
#include <deque>
#include <stack>
#include <utility>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <regex>
#endif //  !defined(__clang__) && defined(__GNUG__)
#include <boost/lexical_cast.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/multi_array.hpp>
#include <boost/optional.hpp>
#include <boost/math/common_factor_rt.hpp>

using namespace std;

int main()
{
    int N;
    std::cin >> N;

    std::vector<int> chars(26, 50);

    for (size_t i = 0; i < N; ++i) {
        std::string s;
        std::cin >> s;

        std::vector<int> c(26);
        for (int p = 0; p < s.size(); ++p) {
            c[s[p] - 'a']++;
        }

        for (int p = 0; p < chars.size(); ++p) {
            chars[p] = std::min(chars[p], c[p]);
        }
    }


    for (int i = 0; i < 26; ++i) {
        char c = i + 'a';
        for (int j = 0; j < chars[i]; ++j) {
            std::cout << c;
        }
    }
    std::cout << std::endl;

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main()
{
    int a, b, c;
    int i, cnt;
    scanf("%d %d %d", &a, &b, &c);
    
    cnt = 0;
    for (i=a; i<=b; i++) {
        if(c%i == 0) cnt++;
    }
    printf("%d\n", cnt);
    return 0;
}


Measured memory_bytes: 2108
#include<stdio.h>

int main(){
  int h,a,b,temp,ans=0,i=0;
  scanf(" %d %d %d",&h,&a,&b);
  for(i = a;i<=b;i++){
    
    if(h % i == 0){
      ans++;
    }
  }
  printf("%d\n",ans);
      return 0;
}



Measured memory_bytes: 2752
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;


int main(void){
  vector<string> v(3);
  cin >> v[0] >> v[1] >> v[2];

  int now=0;
  while (1) {
    if (v[now].size()==0) {
      if (now==0) cout << "A" << endl;
      else if (now==1) cout << "B" << endl;
      else cout << "C" << endl;
      return 0;
    }

    int tmp=now;
    if (v[now][0]=='a') {
      now=0;
    } else if (v[now][0]=='b') {
      now=1;
    } else {
      now=2;
    }
    v[tmp].erase(v[tmp].begin());
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <climits>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#include <set>
using namespace std;
 
#define rep(i,n) for(ll (i)=0;(i)<(n);(i)++ )
#define repf(i,m,n) for(ll (i)=m;(i)<n;(i)++)
#define all(v) (v).begin(), (v).end()
#define ll long long
#define vec(name,num) vector<ll> name((num),0);
#define op(i) cout<<(i)<<endl;
#define opf(i) cout<<fixed<<setprecision(10)<<(i)<<endl;
#define ip(i) cin>>(i);
#define opN cout<<"No"<<endl;
#define opY cout<<"Yes"<<endl;
#define opP cout<<"Possible"<<endl;
#define opI cout<<"Impossible"<<endl;
#define mat(name,fnum,snum); vector<vector<ll>> name((fnum),vector<ll>((snum),0));
#define matC(name,fnum,snum); vector<vector<char>> name((fnum),vector<char>((snum),0));
#define debugP int debug_point; cin>>debug_point;
#define FI first
#define SE second
const ll MOD= 1e9 + 7;
 
vector<ll> Plus(200001);
vector<ll> cnt(200001);
vector<ll> vis(200001);
vector<vector<ll>> edges(200001,vector<ll>(0));
 
void dfs(ll now,ll sum){
    vis[now]=1;
    cnt[now]=sum+Plus[now];
    rep(i,edges[now].size()){
        if(vis[edges[now][i]]!=1){
            dfs(edges[now][i],sum+Plus[now]);
        }
    }
    return;   
}
 
//
void solve(long long N, long long Q, std::vector<long long> a, std::vector<long long> b, std::vector<long long> p, std::vector<long long> x){
    vis[0]=1;
    dfs(0,0);
    //cnt[0]+=Plus[0];
    rep(i,N){
        cout<<(cnt[i]);
        if(i<N-1) cout<<" ";
        else cout<<endl;
    }
}
 
// Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
    scanf("%lld",&N);
    cnt.resize(N);
    edges.resize(N-1);
    Plus.resize(N);
    vis.resize(N);
    long long Q;
    scanf("%lld",&Q);
    std::vector<long long> a(N-1);
    std::vector<long long> b(N-1);
    for(int i = 0 ; i < N-1 ; i++){
        scanf("%lld",&a[i]);
        scanf("%lld",&b[i]);
        edges[a[i]-1].push_back(b[i]-1);
        edges[b[i]-1].push_back(a[i]-1);
    }
    std::vector<long long> p(Q);
    std::vector<long long> x(Q);
    for(int i = 0 ; i < Q ; i++){
        scanf("%lld",&p[i]);
        scanf("%lld",&x[i]);
        Plus[p[i]-1]+=x[i];
    }
    solve(N, Q, std::move(a), std::move(b), std::move(p), std::move(x));
    return 0;
}

Measured memory_bytes: 33664
while True:
    table= input().split()
    
    a = int(table[0])
    op = table[1]
    b = int(table[-1])
    
    if op == '?':
        break
        
    if op == '+':
        print(a+b)
    elif op =='-':
        print(a-b)
    elif op =='*':
        print(a*b)
    else:
        print(a//b)
    
    


Measured memory_bytes: 5596
#include<iostream>
#include<unordered_set>

using namespace std;

int main(){

    int n;
    string s;
    cin >> n >> s;
    long long res = 0;
    unordered_set<int> r, g, b;
    for(int i = 0; i < s.size(); i ++){
        if(s[i] == 'R') r.insert(i);
        else if(s[i] == 'G') g.insert(i);
        else b.insert(i);
    }
    for(auto i:r){
        for(auto j:g){
            res += b.size();
            if(b.count(2 * i - j)) res --;
            if(b.count(2 * j - i)) res --;
            if((i + j)%2 == 0 &&  b.count((i + j) / 2)) res --;
        }
    }
    cout <<res;
}

Measured memory_bytes: 3360
#include <bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define test int t;cin>>t;while(t--)
#define REP(i,n) for (int i = 1; i <= n; i++)
#define MOD 1000000007
#define pb push_back
#define ii pair<int,int>
#define vi vector<int>
#define vii vector<ii>
#define ll long long int
#define ff first
#define ss second
#define INF 1000000000
#define HINF 1000000000000000
#define mem(a,b) memset(a,b,sizeof(a))
#define deb(x) cout<<#x<<'='<<x<<endl
const double pi = 3.14159265358979323846;

ll power(ll a, ll b){//a^b
    ll res=1;
    a=a%MOD;
    while(b>0){
        if(b&1){res=(res*a)%MOD;b--;}
        a=(a*a)%MOD;
        b>>=1;
    }
    return res;
}
ll fermat_inv(ll y){return power(y,MOD-2);}
ll gcd(ll a, ll b){return (b==0)?a:gcd(b,a%b);}

int val[100001];

void solve()
{

	ll i=0,j=0,k=0,m,n,p,sum=0,cnt=0;
	cin>>n;
	int arr[n];
	for(i=0;i<n;i++)
	{
	    cin>>arr[i];
	    cnt=cnt^arr[i];
	}
	//deb(cnt);
    for(i=0;i<n;i++)
    {
        cout<<(cnt xor arr[i])<<" ";
    }
}
int main() {
    fast
    //freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w+", stdout);
    //test
    {
        
        solve();
		
		      
    }
    return 0;
}
  

Measured memory_bytes: 4336
from collections import Counter


class UnionFind:
    def __init__(self, n):
        self.root = list(range(n + 1))
        self.size = [1] * (n + 1)

    def __getitem__(self, x):
        root = self.root
        while root[x] != x:
            root[x] = root[root[x]]
            x = root[x]
        return x

    def merge(self, x, y):
        x = self[x]
        y = self[y]
        if x == y:
            return
        sx, sy = self.size[x], self.size[y]
        if sx < sy:
            x, y = y, x
            sx, sy = sy, sx
        self.root[y] = x
        self.size[x] += sy


N, M = map(int, input().split())
A = []
B = []

for i in range(M):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)


res = 0
for i in range(M):
    uni = UnionFind(N)
    for j in range(M):
        if j == i:
            continue
        else:
            uni.merge(A[j], B[j])
    # uniの連結成分を数える
    roots = [uni[x] for x in uni.root[1:]]
    counter = Counter(roots)
    if len(counter) > 1:
        res += 1

print(res)

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

char f[1000][1000];
int d[1000][1000];

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

int main() {
    int H, W, K;
    cin >> H >> W >> K;

    int sx=0, sy=0;
    rep(i, H) {
        rep(j, W) {
            cin >> f[i][j];
            if (f[i][j] == 'S') sy=i, sx=j;
            d[i][j] = inf;
        }
    }

    queue< pair<int, int> > que, pos;
    que.push({ sy, sx });
    d[sy][sx] = 0;

    while (que.size()) {
        pair<int, int> p = que.front();
        que.pop();

        if (d[p.first][p.second] >= K) continue;

        rep(dd, 4) {
            int px = p.second + dx[dd];
            int py = p.first + dy[dd];

            if (0 <= px && px < W && 0 <= py && py < H && f[py][px] == '.' && d[py][px] == inf) {
                que.push({ py, px });
                d[py][px] = d[p.first][p.second] + 1;
            }
        }
    }

    int ans = inf;
    for (int y=0; y<H; ++y) {
        for (int x=0; x<W; ++x) {
            if (d[y][x] != inf) {
                int Y = min(y, H-y-1);
                int X = min(x, W-x-1);
                ans = min(ans, min(Y/K+bool(Y%K), X/K+bool(X%K)));
            }
        }
    }

    cout << ans+1 << endl;

}


Measured memory_bytes: 4992
#include <iostream>
#include <string>
#include <deque>
#define rep(i, n) for(i = 0; i < n; i++)
using namespace std;

string s;
int q;
int t, f; char c;
deque<char> deq;

int main() {
	int i;
	
	cin >> s >> q;
	rep(i, s.length()) deq.push_back(s[i]);
	
	bool rev = false;
	
	rep(i, q) {
		cin >> t;
		if (t == 1) { rev = !rev; }
		else {
			cin >> f >> c;
			if ((f == 1 && rev == false) || (f == 2 && rev == true)) {
				//先頭にcを追加
				deq.push_front(c);
			}
			else {
				//末尾にcを追加
				deq.push_back(c);
			}
		}
	}
	
	string ans;
	while (!deq.empty()) {
		char c = deq.front();
		ans += c;
		deq.pop_front();
	}
	
	rep(i, ans.size()) {
		if (rev) { cout << ans[ans.size() - 1 - i]; }
		else { cout << ans[i]; }
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 1412
n,q=gets.split.map &:to_i
l=[-i=1]+[m=0]*n
q.times{a,v=gets.split.map &:to_i
j=l[a]+=v
v>0?m<j ?(i,m=a,j):m==j&&i>a&&i=a :a==i&&(m=l.max;i=l.index m)
puts [i,m]*" "}

Measured memory_bytes: 21736
#include <bits/stdc++.h>
#define int long long
#define ALL(v) (v).begin(),(v).end()
#define Vi vector<int>
#define pb push_back
#define mp make_pair
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repeq(i,a,b) for(int i=a;i<=b;i++)
#define repr(i,a,b) for(int i=a;i>b;i--)
#define repreq(i,a,b) for(int i=a;i>=b;i--)
#define leng(n) (int)(log10(n)+1)
#define INF 9000000000000000000  //  9.0 * 10^18
#define MOD 1000000007  //  10^9 + 7
#define PAI 3.14159265358979
// ver1.8
using namespace std;

int gcd(int a,int b){return b?gcd(b,a%b):a;}  //  最大公約数gcd
int lcm(int a,int b){return a/gcd(a,b)*b;}  //  最小公倍数lcm

signed main() {
  cout << fixed << setprecision(14);
  string s;
  cin >> s;
  reverse(ALL(s));
  while(s.size()!=0){
    if(s.substr(0,5)=="maerd") {
      rep(i,0,5) s.erase(s.begin());
    }
    else if(s.substr(0,7)=="remaerd") {
      rep(i,0,7) s.erase(s.begin());
    }
    else if(s.substr(0,5)=="esare") {
      rep(i,0,5) s.erase(s.begin());
    }
    else if(s.substr(0,6)=="resare") {
      rep(i,0,6) s.erase(s.begin());
    }
    else {
      cout << "NO" << endl;
      return 0;
    }
  }
  cout << "YES" << endl;
  return 0;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
    ll int n;
    cin>>n;
    ll int a[n];
    
    for(ll int i=0; i<n; i++)
        cin>>a[i];
        
    for(ll int i=n-1; i>=1; i--)
    {
        if(a[i] >= a[i-1])
            continue;
        else
        {
            if(a[i] >= a[i-1]-1)
                a[i-1] = a[i-1]-1;
            else
                return cout<<"No", 0;
        }
    }
    
    cout<<"Yes";
}

Measured memory_bytes: 1024
#include <iostream>
#include <iomanip>
#include <utility>
#include <cmath>
#include <random>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <algorithm>
using namespace std;

#define rep(i,n) for(int i = 0; i<n; ++i)
#define REP(i,n) for(int i = 1; i<=n; ++i)
#define all(x) begin(x),end(x)
#define show(obj) {for(auto x:obj)cout<<x<<' ';cout<<endl;}
#define line "----------"
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll,ll> LP;
const int inf = 1001001000;
const ll INF = 1LL<<60;
const int MOD = (int)1e9 + 7;

int main(){
	int N;
	cin >> N;
	int k = inf;
	for(int i = 2; i * (i - 1) <= 2*N; ++i){
		if(i * (i - 1) / 2 == N){
			k = i; break;
		}
	}
	if(k == inf){cout << "No" << endl; return 0;}
	else cout << "Yes" << endl;
	int num = 1;
	vector<set<int>> ans(k);
	rep(i,k){
		for(int j = i+1; j < k; ++j){
			ans[i].insert(num);
			ans[j].insert(num);
			++num;
		}
	}
	cout << ans.size() << endl;
	for(auto x:ans){
		cout << x.size() << ' ';
		show(x);
	}
	return 0;
}


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

int main()
{
	int h, w;
	int i, j;
	
	while(1){
		cin >> h >> w;
		if(h==0&&w==0)
			break;
		
		for(i=0;i<h;i++){
			for(j=0;j<w;j++){
				if(i==0||i==h-1||j==0||j==w-1)
					cout << '#';
				else
					cout << '.';
			}
			cout << endl;
		}
		cout << endl;
	}
	
	return 0;
}

Measured memory_bytes: 1152
#解説参照
n,m = map(int, input().split( ))
a = list(map(int, input().split( )))
mch = (100,2,5,5,4,5,6,3,7,6)

dp = [-1]*(n+10)
dp[0] = 0
for i in range(n+1):##nまでなので+1
    for aj in a:
        if dp[i-mch[aj]]>=0:##ちょうどn本使う必要がある
            dp[i] = max(dp[i], dp[i-mch[aj]]*10+aj)
print(dp[n])


Measured memory_bytes: 14388
#include <bits/stdc++.h>
#include <string>
#include <iostream>
#include <iomanip>
using namespace std;
#define rep(i, N) for (ll i = 0; i < (N); i++)
typedef long long ll;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N;
    cin >> N;
    string ans = "No";
    ll a, b, c;
    a = N;
    a /= 100;
    b = N % 100;
    c = N % 10;
    b -= c;
    if (a == 7 || b == 70 || c == 7)
    {
        ans = "Yes";
    }
    cout << ans << endl;
}

Measured memory_bytes: 3652