akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
const int inf=INT_MAX;
#define mp make_pair
#define it iterator
#define mod 1e9+7
#define PI acos(-1)
#define INF 0x3f3f3f
#define ll long long
#define pb push_back
#define C(a) cout<<a<<endl;
#define CY cout<<"YES"<<endl;
#define CN cout<<"NO"<<endl;
#define Cy cout<<"Yes"<<endl;
#define Cn cout<<"No"<<endl;
#define ull unsigned long long
#define ffr(a) for(int i=0;i<a;i++)
#define frr(a) for(int i=1-1;i>=0;i--)
#define me(a) memset(a,0,sizeof(a));
#define my(a,b) memcpy(a,b,sizeof(b));
#define cio ios::sync_with_stdio(false);
ll gcd(ll a,ll b){return (a%b==0) ? b : gcd(b,a%b);}
int s[100010];
int k = 0;
int jud(ll x)
{
	if(x==1) return 0;
	for(ll i = 2; i <= sqrt(x); i++){
		if(x%i==0)  return 0;
	}
	return 1;
}
ll fj(ll x)
{
	ll gg = sqrt(x);
	ll flag = 1; 
	for(ll i = 2; i <= gg;i++)
	{
		if(x%i==0)
		{
			flag=0;
			if(fj(i))
			{
				s[k++] = i;
			}
			if(fj(x/i))
			{
				s[k++] = x/i;
			}
			break;
		} 
	}
	return flag;
}
int main()
{
	ll n;
	cin >> n;
	if(jud(n)==1){
		C(1);
		return 0;
	}
	fj(n);
	map<ll,int>q;
	int cnt = 0;
	for(int i = 0; i < k; i++) q[s[i]]++;
	for(map<ll,int>::it p = q.begin(); p != q.end(); p++){
		int num = p->second;
		int x = 1;
		while(num>=x){
			num -= x;
			x++;
			cnt++;
		}
	}
	C(cnt);
	return 0;
}

Measured memory_bytes: 3752
#include <iostream>
#include <math.h>
#include <string>    // useful for reading and writing
#include <fstream>   // ifstream, ofstream
#include <sstream>   // istringstream

using namespace std;

int main()
{
    while(1)
    {
    int h, w;
    std::cin >> h >> w;
    if(h==0&&w==0){break;}
        for(int i = 0; i < h; i++)
        {
            for(int j = 0; j < w; j++)
            {
                std::cout<<"#";
            }
            std::cout<<"\n";
        }
        std::cout<<"\n";
    }
    return 0;
}


Measured memory_bytes: 3084
#include <iostream>
using namespace std;
int main()
{
    int n;
    cin>>n;
    int a,b,c,d;
    a=n/1000;
    b=n/100-a*10;
    c=n/10-a*100-b*10;
    d=n%10;
    if((a==b&&b==c)||(a==b&&b==c&&c==d)||(b==c&&c==d))
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<queue>
#include<set>
#include<map>
#include<stack>
using namespace std;
typedef long long LL;
const int N=2e5;
int gi() {
	int w=0;bool q=1;char c=getchar();
	while ((c<'0'||c>'9') && c!='-') c=getchar();
	if (c=='-') q=0,c=getchar();
	while (c>='0'&&c <= '9') w=w*10+c-'0',c=getchar();
	return q? w:-w;
}
int head[N],nxt[N],to[N],st[N];
int fa[N];inline int find(int x) { return fa[x]==x?x:fa[x]=find(fa[x]); }
LL ans,sum[N],siz[N];
bool vis[N];
inline int dfs(int k) {
	int t;
	for (int i=head[k];i;i=nxt[i])
		if (!vis[to[i]]) {
			vis[to[i]]=true;
			t=dfs(to[i]);
			ans+=abs(t);
			siz[k]-=t;
		}
	return siz[k];
}
inline void get(int k) {
	for (int i=head[k];i;i=nxt[i])
		if (to[i]!=fa[k])
			fa[to[i]]=k,get(to[i]);
}
int main()
{
	int n=gi(),m=gi(),i,tot=0,a,b,A,B,top=0,t,k;
	for (i=1;i<=n;i++) fa[i]=i,siz[i]=1;
	for (i=1;i<=m;i++) {
		a=gi(),b=gi();
		if (find(a)==find(b)) A=a,B=b;
		else {
			fa[fa[a]]=b;
			to[++tot]=b,nxt[tot]=head[a],head[a]=tot;
			to[++tot]=a,nxt[tot]=head[b],head[b]=tot;
		}
	}
	if (m==n-1)
		vis[1]=true,printf("%lld\n",dfs(1)?-1:ans);
	else {
		for (i=1;i<=n;i++) fa[i]=0;
		get(A);
		for (k=B;k;k=fa[k]) st[++top]=k;
		if (top&1) {
			vis[A]=true;t=dfs(A);
			for (i=1;i<=n;i++) vis[i]=false,siz[i]=1;
			if (t%2) return puts("-1"),0;
			siz[A]-=t/2,siz[B]-=t/2;
			ans=abs(t/2);
			vis[A]=true;dfs(A);
		} else {
			for (i=1;i<=top;i++) vis[st[i]]=true;
			for (i=1;i<=top;i++) sum[i]=sum[i-1]+(i&1?-1:1)*dfs(st[i]);
			if (sum[top]) return puts("-1"),0;
			sort(sum+1,sum+1+top);
			for (i=1;i<=top;i++) ans+=abs(sum[top/2]-sum[i]);
		}
		printf("%lld\n",ans);
	}
	return 0;
}


Measured memory_bytes: 8448
#include<functional>
#include<algorithm>
#include<iostream>
#include<iomanip>
#include<string>
#include<math.h>
#include<vector>
#include<cmath>
#include<stack>
#include<queue>
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,x,n) for(int i=x;i<n;i++)
using namespace std;
const double INF=100000000;

int main(){
  int n,m;
  cin>>n>>m;
  int dp[n][n];

  rep(i,n){
    rep(j,n){
      dp[i][j]=i==j?0:INF;
    }
  }
  rep(i,m){
    int a,b,c,d;
    char e;
    cin>>a>>e>>b>>e>>c>>e>>d;
    dp[a-1][b-1]=c;
    dp[b-1][a-1]=d;
  }
  int s,g,V,P;
  char e;
  cin>>s>>e>>g>>e>>V>>e>>P;

  rep(k,n){
    rep(i,n){
      rep(j,n){
	dp[i][j]=min(dp[i][j],dp[i][k]+dp[k][j]);
      }
    }
  }
  
  
  cout<<V-P-dp[s-1][g-1]-dp[g-1][s-1]<<endl;
  
  
  return 0;
}
     

Measured memory_bytes: 3084
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef pair<int, int> P;
template<class T> inline bool chmin(T& a, T b) {
  if (a > b) { 
    a = b;
    return true;
  } 
  return false;
}
int INF = 100100100;

int main() {
  int h, n, a, b, count = 0;
  scanf("%d %d", &h, &n);
  vector<P> ps;
  int max = 0;
  rep(i, n) {
    scanf("%d %d", &a, &b);
    ps.push_back({a,b});
    max = max >= a ? max : a;
  }
  max += h + 1;
  vector<int> dp(max, INF);
  dp[0] = 0;
  for (int i = 0; i < h+1; ++i) {
    for (int j = 0; j < ps.size(); ++j) {
      chmin(dp[(i + ps[j].first)], dp[i] + ps[j].second);
    }
  }
  int min = INF;
  for (int i = h; i < max; ++i) chmin(min, dp[i]); 
  printf("%d\n", min);
  return 0;
}


Measured memory_bytes: 256
#include<algorithm>
#include<stack>
#include<ctime>
#include<cstring>
#include<cmath>
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<queue>
#include<map>
using namespace std;
inline int read(){
	int num=0,f=1;char x=getchar();
	while(x<'0'||x>'9'){if(x=='-')f=-1;x=getchar();}
	while(x>='0'&&x<='9'){num=num*10+x-'0';x=getchar();}
	return num*f;
}
const int maxn=300005;
map<int,bool> p[maxn];
int h,w,m;
int r[maxn],c[maxn];
int rmax,cmax;
vector<int> er,ec;
int main(){
	h=read();w=read();m=read();
	for(int i=1,x,y;i<=m;++i){
		x=read();y=read();
		p[x][y]=true;
		++r[x];++c[y];
		rmax=max(r[x],rmax);
		cmax=max(c[y],cmax);
	}
	for(int i=1;i<=h;++i)
		if(r[i]==rmax) er.push_back(i);
	for(int i=1;i<=w;++i)
		if(c[i]==cmax) ec.push_back(i);
	for(auto x:er)
		for(auto y:ec)
			if(!p[x][y]){
				printf("%d\n",rmax+cmax);
				return 0;
			}
	printf("%d\n",rmax+cmax-1);
	return 0;
}


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

int main() {
  long long int x = 0;
  long long int ans = 0;
  cin >> x;
  if (!(x % 11)) {
    ans = (x / 11) * 2;
  } else {
    if (x % 11 <= 6) {
      ans = (x / 11) * 2 + 1;
    } else if (x % 11 > 6) {
      ans = (x / 11) * 2 + 2;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
n = int(input())
a = []

for i in range(n):
    d = list(map(int, input().split()))
    if d[0] == 0:
        a.append(d[1])
    elif d[0] == 1:
        print(a[d[1]])
    elif d[0] == 2:
        a.pop()




Measured memory_bytes: 13364
#https://atcoder.jp/contests/abc071/tasks/abc071_b
import string
S = list(input())
alf = [False]*26
for s in S:
    alf[ord(s)-ord("a")] = True

for a in range(len(alf)):
    if not alf[a]:
        print(chr(a+97))
        break
        
    elif a == len(alf)-1:
        print("None")

Measured memory_bytes: 4600
import java.util.*;

class Main {
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    int X = scanner.nextInt();
    int t = X / 100;
    int p = X % 100;
    p = p / 5 + (p % 5 != 0 ? 1 : 0);
    if (p <= t) System.out.println(1);
    else System.out.println(0);
  }
}


Measured memory_bytes: 23252
from collections import deque

def topological_sort(V, to):
    cnt = [0]*V
    for i in range(V):
        for j in to[i]:
            cnt[j] += 1
    Q = deque(i for i in range(V) if cnt[i]==0)
    res = []
    while Q:
        i = Q.popleft()
        res.append(i)
        for k in to[i]:
            cnt[k] -= 1
            if cnt[k] == 0:
                Q.append(k)
    return res

N,M = map(int,input().split())
to = [[] for i in range(N)]
From = [[] for i in range(N)]
for i in range(N-1+M):
    x, y = list(map(int,input().split()))
    to[x-1].append(y-1)
    From[y-1].append(x-1)
s = topological_sort(N, to)
s = [(s[i],i) for i in range(N)]
s.sort()
for i in range(N):
    k = -1
    I = -1
    for j in From[i]:
        if k < s[j][1]:
            k = s[j][1]
            I = j
    print(I+1)

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



int MyRandom(int n, int m){
	string str = "";
	int num = 0;
	n *= n;

	while(1){
		str.insert( str.begin() , (n%10) + '0' );
		n /= 10;
		if( str.size() == 2*m ) break;
	}
	str = str.substr( m/2 , m );

	for(int i=0 ; i<str.size() ; i++){
		num *= 10;
		num += str[i] - '0';
	}

	return num;
}

int main(){
	int n, a, r;
	const int m = 4;

	cin >> n;
	for(int i=0 ; i<n ; i++){
		cin >> r;
		cout << "Case " << (i+1) << ":" << endl;
		for(int j=0 ; j<10 ; j++){
			if( j != 0 ){
				r = MyRandom( r , m );
			}
			cout << MyRandom( r , m ) << endl;
		}
	}
}

Measured memory_bytes: 0
package main

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

var sc = bufio.NewScanner(os.Stdin)
var out = bufio.NewWriter(os.Stdout)

func solve(n int64, p []int64) (ret int64) {

	for i := int64(1); i < n-1; i++ {
		if p[i-1] < p[i] && p[i] < p[i+1] {
			ret++
			continue
		}
		if p[i-1] > p[i] && p[i] > p[i+1] {
			ret++
		}
	}
	return
}

func main() {
	sc.Split(bufio.ScanWords)
	defer out.Flush()

	n := nextInt()
	p := nextInts(n)
	res := solve(n, p)
	fmt.Fprintln(out, res)
}

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

func nextInt() int64 {
	a, _ := strconv.ParseInt(next(), 10, 64)
	return a
}

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

func nextInts(n int64) []int64 {
	ret := make([]int64, n)
	for i := int64(0); i < n; i++ {
		ret[i] = nextInt()
	}
	return ret
}
func nextFloats(n int64) []float64 {
	ret := make([]float64, n)
	for i := int64(0); i < n; i++ {
		ret[i] = nextFloat()
	}
	return ret
}
func nextStrings(n int64) []string {
	ret := make([]string, n)
	for i := int64(0); i < n; i++ {
		ret[i] = next()
	}
	return ret
}

func containStr(arr []string, target string) bool {
	for _, v := range arr {
		if v == target {
			return true
		}
	}
	return false
}

func PrintOut(src interface{}, joinner string) {
	switch reflect.TypeOf(src).Kind() {
	case reflect.Slice:
		s := reflect.ValueOf(src)
		for idx := 0; idx < s.Len(); idx++ {
			fmt.Fprintf(out, "%v", s.Index(idx))
			if idx < s.Len()-1 {
				fmt.Fprintf(out, "%s", joinner)
			} else {
				fmt.Fprintln(out)
			}
		}
	default:
		fmt.Fprintln(out, "orz")
	}
}

// mapからkeysとvaluesを返す
func splitKeyValue(m map[interface{}]interface{}) (keys, values []interface{}) {
	switch reflect.TypeOf(m).Kind() {
	case reflect.Map:
		s := reflect.ValueOf(m)
		for _, v := range s.MapKeys() {
			keys = append(keys, v)
			values = append(values, s.MapIndex(v))
		}
	default:
		fmt.Fprintln(out, "orz")
	}
	return
}


Measured memory_bytes: 640
#include "bits/stdc++.h"
using namespace std;
int b[500000], p = 1, cnt = 0;
int main() {
	int n;
	cin >> n;
	for (int i = 0; i < n; i++) {
		int x;
		cin >> x;
		if (b[0] == 1 || x < p - 1) {
			cout << "No" << endl;
			continue;
		}
		if (p - 1 == x && cnt > x) {
			cout << "No" << endl;
			continue;
		}
		cnt++;
		cout << "Yes" << endl;
		if (x >= n) continue;
		b[x]++;
		while (x > 0 && b[x] >= 2) b[x] -= 2, b[x - 1]++, x--, cnt--;
		while (p < n && b[p] == 1) p++;
	}
}


Measured memory_bytes: 4756
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);
		int N = Integer.parseInt(input.nextLine());
		LinkedList<String> words = new LinkedList<String>();
		words.add(input.nextLine());
		boolean valid = true;
		for (int i = 1; i < N; i++) {
			String x = input.nextLine();
			String prev = words.get(i-1);
			if (words.contains(x)||x.charAt(0)!=prev.charAt(prev.length()-1)) {
				valid = false;
				break;
			}
			words.add(x);
		}
		System.out.println(valid? "Yes":"No");
	}
}

Measured memory_bytes: 23636
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main(){
    int n,l;
    cin >> n >> l;
    string a[n];
    rep(i,n){
       cin >> a[i];
    }
    sort(a,a+n);
   string t;
   rep(i,n) t += a[i];
   cout << t << endl;
}


Measured memory_bytes: 3668
import java.util.*;

public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    boolean value = true;
    List<Integer> list = new ArrayList<Integer>();

    while(value){
      int a = Integer.parseInt(sc.next());
      String s = sc.next();
      int b = Integer.parseInt(sc.next());

      switch(s){
        case("+"):
          list.add(a+b);
          break;
        case("-"):
          list.add(a-b);
          break;
        case("*"):
          list.add(a*b);
          break;
        case("/"):
          list.add(a/b);
          break;
        default:
          value = false;
          break;
      }
    }

    for(int i=0; i<list.size(); i++)
    {
      System.out.println(list.get(i));
    }
  }
}


Measured memory_bytes: 26224
/**
 *  author: said_v15
 *  created with web_programmer
**/
#include <bits/stdc++.h>
using namespace std;
int main()
{
  string s;
  cin>>s;
  int n=s.length();
  int ans=0;
  for(int i=0;i<n;i++)
  {
     if(i!=n-1) if(s[i]==s[i+1])
     {
         if(s[i]=='1') s[i+1]='0';
         if(s[i]=='0') s[i+1]='1';
         ans++;
         
     }
  }
  cout<<ans<<"\n";
  return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define ll          long long
#define mp	    make_pair
#define pb          push_back
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define x           first
#define y           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define MOD        1000000007
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define gcd(a,b)    __gcd((a),(b))
#define lcm(a,b)    ((a)*(b)) / gcd((a),(b))
#define rep(i,a,b)  for(int i=a;i<b;i++)
#define N	 100
ll L[N];
ll Lii(int n){
	if(L[n] != -1)
		return L[n];
	L[0] = 2;
	L[1] = 1;
	rep(i,2,n+1) L[i] = L[i-1]+L[i-2];
	return L[n];
}
void solve(){
	int n;
	cin>>n;
	memset(L, -1, sizeof(L));
	cout<<Lii(n)<<endl;
	
}
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t;
    t =1;
//     cin>>t;
    while(t--){
        solve();
    }
    return 0;
}



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

signed main()
{
   while(true){
      int N,M; cin>>N>>M;
      if(N==0 and M==0) break;
      vector<int> a(N+1);
      for(int i=0;i<N;i++){
         cin>>a[i];
      }
      a[N]=0; N++;
      vector<int> b;
      for(int i=0;i<N;i++){
         for(int j=i;j<N;j++){
            b.push_back(a[i]+a[j]);
         }
      }
      sort(b.begin(),b.end());

      int ans=0;
      for(int i=0;i<b.size();i++){
         int j=upper_bound(b.begin(),b.end(),M-b[i])-b.begin();
         if(j>0){
            ans=max(ans,b[i]+b[j-1]);
         }
      }
      cout<<ans<<endl;
   }
}



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

using namespace std;

void aa(int x)
{
	if(x==1) cout<<'+';
	else if(x==2)cout<<'-'; 
}

int dd(int a,int b){
	if(a==1)
	{
		return b;
	}
	else return -b;
}

int sum;

int main(){
	char e[100];	
	int a,b,c,d;
	cin>>e;
	a=e[0]-'0';
	b=e[1]-'0';
	c=e[2]-'0';
	d=e[3]-'0';
	sum=a;
	for(int i=1;i<=2;i++)
	 for(int j=1;j<=2;j++)
	  for(int k=1;k<=2;k++)
	  {
	  	sum+=dd(i,b);
	  	sum+=dd(j,c);
	  	sum+=dd(k,d);
	  	if(sum==7)
	  	{
	  		cout<<a;
			aa(i);
			cout<<b;
			aa(j);
			cout<<c;
			aa(k);
			cout<<d<<"=7";
			return 0;	
		}
	  	sum=a;
	}	 
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using Graph = vector<vector<int>>;
const int INF = 1e9 + 1;
const ll LLINF = 1e18;
const int MOD = 1e9 + 7;

int main() {
    int N, ans = 0;
    cin >> N;
    vector<int> b(100005);
    for(int i = 0; i < N; ++i) {
        int a;
        cin >> a;
        a++;
        b[a - 1]++, b[a]++, b[a + 1]++;
    }
    for(int i = 0; i <= 100005; ++i)
        ans = max(ans, b[i]);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <utility>
#include <algorithm>
#include <map>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <queue>
#include <stack>

using namespace std;

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = n;i >= m;i--)
#define REPO(i, n) for(int i = 1;i <= n;i++)
#define ll long long
#define INF 1999999999
#define MINF -1999999999
#define ALL(n) n.begin(),n.end()

int main() {
	int a;
	cin >> a;
	cout << "ABC" << a << endl;
}

Measured memory_bytes: 256
n, m = gets.chomp.split.map(&:to_i)
road = Array.new(n, 0)
m.times do
	a, b = gets.chomp.split.map(&:to_i)
        #puts a, b
	road[b - 1] =road[b - 1] + 1
        road[a - 1] =road[a - 1] + 1
end
puts road

Measured memory_bytes: 1788
/******************************************************************************

                              Online C++ Compiler.
               Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

#include <iostream>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;



int main()
{
    ll n,i,j,m,t,sum=0,zeroj=-1,tt=0;
    string s;
    float mm;
    cin>>n>>m;
    mm=m*1.0;
    float a[n];
    for(i=0;i<n;i++)
    {cin>>a[i];sum+=a[i];}
    sort(a, a+n,greater<int>());
    
    //cout<<a[m-1];
    float k=a[m-1]/sum;
    float c=1/(4*mm);
    //cout<<"k="<<k<<" "<<c;
    if(k>=c)
    cout<<"Yes";
    else
    cout<<"No";

    return 0;
}





Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))

typedef struct piar{ll st,len,i;}P;

ll R,C;
int hikaku(const void*p,const void*q){
	P pp=*(P*)p,qq=*(P*)q;
	if(pp.st<qq.st)return -1;
	if(pp.st>qq.st)return 1;
	if(pp.len<qq.len)return -1;
	if(pp.len>qq.len)return 1;
	return 0;
}

P p[200010];
ll cnt;
void set(int x,int y,int i){
	p[cnt].i=i;
	if(x==0){
		p[cnt].st=0;
		p[cnt].len=y;
	}else if(y==C){
		p[cnt].st=1;
		p[cnt].len=x;
	}else if(x==R){
		p[cnt].st=2;
		p[cnt].len=C-y;
	}else if(y==0){
		p[cnt].st=3;
		p[cnt].len=R-x;
	}
	cnt++;
}


ll que[200010];
ll qcnt;
int main(){
	int n;
	scanf("%lld%lld%d",&R,&C,&n);
	rep(i,0,n){
		int a,b,c,d;
		scanf("%d%d%d%d",&a,&b,&c,&d);
		if((a==0||a==R||b==0||b==C)&&(c==0||c==R||d==0||d==C)){
			set(a,b,i);
			set(c,d,i);
		}
	}
	qsort(p,cnt,sizeof(P),hikaku);
	
	rep(i,0,cnt){
		if(qcnt==0||que[qcnt-1]!=p[i].i)que[qcnt++]=p[i].i;
		else qcnt--;
	}
	puts(qcnt?"NO":"YES");
	return 0;
}

Measured memory_bytes: 11004
// * refernce
//   * https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8

use std::io;
use std::str;

fn main () {

    // STEP.01
    // create a new `String` instance to store the test data from standard input
    let mut buffer_stdin = String::new();

    // STEP.02
    // read a line from the standard input to get test data
    std::io::stdin().read_line(&mut buffer_stdin).unwrap();

    // STEP.03
    // split the stdin by spaces
    let mut test_data = buffer_stdin.split_whitespace();

    // STEP.04
    // read out the test data from the iterator
    let a1: u8 = test_data.next().unwrap().parse().unwrap();
    let a2: u8 = test_data.next().unwrap().parse().unwrap();
    let a3: u8 = test_data.next().unwrap().parse().unwrap();

    println!( "{}", abc147_a_answerer(a1, a2, a3) );

}

fn abc147_a_answerer (a1: u8, a2: u8, a3: u8) -> String {

    return
        if   abc147_a_judge (a1, a2, a3) { String::from("win")  }
        else                             { String::from("bust") }

}

fn abc147_a_judge (a1: u8, a2: u8, a3: u8) -> bool {

    return a1 + a2 + a3 <= 21

}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
int main(){
  string a,b;
  cin>>a>>b;
  string ans="EQUAL";
  if(a.size()>b.size()) ans="GREATER";
  else if(a.size()<b.size()) ans="LESS";
  else{
    for(int i=0;i<a.size();i++){
      if(a[i]-b[i]>0){
        ans="GREATER";
        break;
      }
      else if(a[i]-b[i]<0){
        ans="LESS";
        break;
      }
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 3592
#include<iostream>
#include<string>
#include<math.h>
#include<vector>
#include<algorithm>
#include<iomanip>

#define ll long long
#define vl vector<ll>
#define vvl vector< vector<ll> >
using namespace std;


int main(){
	ll n; cin >> n;
	vl ngo(5);
	for (int i = 0; i < 5; ++i) cin >> ngo[i];
	ll mini = min({ ngo[0],ngo[1],ngo[2],ngo[3],ngo[4] });
	ll ans = 4 + ceil((double)n / mini);
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <bitset>
#include<vector>
#include<utility>
#include<fstream>
#include<queue>
#include <iomanip>
#include<numeric>
#include<set>
#include<map>
#include<functional>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
#define rep(i,n) for(int i=0;i<n;i++)
char ca;
const int MOD = 1000000007;
ll  c = 0, d = 0, e = 0, f = 0,g=0, n, m,i, j, k, h, w, o, a[100005], b[10000] = {};
queue<ll> q;
string s;
pair<ll, ll> p[20][20];
vector<vector<ll>> v;
const int MAX = 2005;
long long fac[MAX], finv[MAX], inv[MAX];

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

	return 0;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
//#pragma GCC optimize("Ofast")
#define rep(i,n) for(long long i=0;i<(long long)(n);i++)
#define REP(i,k,n) for(long long i=k;i<(long long)(n);i++)
#define all(a) a.begin(),a.end()
#define eb emplace_back
#define lb(v,k) (lower_bound(all(v),k)-v.begin())
#define ub(v,k) (upper_bound(all(v),k)-v.begin())
#define fi first
#define se second
#define pi M_PI
#define PQ(T) priority_queue<T>
#define SPQ(T) priority_queue<T,vector<T>,greater<T>>
using ll=long long;
using P=pair<ll,ll>;
using PP=tuple<ll,ll,ll>;
using S=multiset<ll>;
using vi=vector<ll>;
using vvi=vector<vi>;
using vvvi=vector<vvi>;
const ll inf=1001001001001001;
const int INF=1001001001;
const int mod=998244353;
const double eps=1e-10;
template<class T> bool chmin(T&a,T b){if(a>b){a=b;return true;}return false;}
template<class T> bool chmax(T&a,T b){if(a<b){a=b;return true;}return false;}
template<class T> void out(T a){cout<<a<<'\n';}
template<class T> void outp(T a){cout<<'('<<a.fi<<','<<a.se<<')'<<'\n';}
template<class T> void outvp(T v){rep(i,v.size())cout<<'('<<v[i].fi<<','<<v[i].se<<')';cout<<'\n';}
template<class T> void outv(T v){rep(i,v.size()){if(i)cout<<' ';cout<<v[i];}cout<<'\n';}
template<class T> void outvv(T v){rep(i,v.size())outv(v[i]);}
template<class T> bool isin(T x,T l,T r){return (l)<=(x)&&(x)<=(r);}
template<class T> void YesNo(T b){if(b)out("Yes");else out("No");}
void decimal(int x){cout<<fixed<<setprecision(x);}
//ll GCD(ll a,ll b){if(b==0) return a; return GCD(b,a%b);}
//ll LCM(ll a,ll b){return(a/GCD(a,b))*(b/GCD(a,b))*GCD(a,b);}
ll POW(ll a,ll b){a%=mod;if(b==0)return 1;if(b&1)return a*POW(a,b-1)%mod;ll k=POW(a,b/2);return k*k%mod;}
vi calc(ll x){vi res;while(x>0){res.eb(x%10);x/=10;}reverse(all(res));return res;}

const ll max_n=200005;
vi fac(max_n),finv(max_n),inv(max_n);
// テーブルを作る前処理 O(max_n)
void init(){
  fac[0]=fac[1]=1;
  finv[0]=finv[1]=1;
  inv[1]=1;
  REP(i,2,max_n){
    fac[i]=fac[i-1]*i%mod;
    inv[i]=mod-inv[mod%i]*(mod/i)%mod;
    finv[i]=finv[i-1]*inv[i]%mod;
  }
}
// 二項係数計算 O(1)
ll COM(int n,int k){
  if(n<k) return 0;
  if(n<0||k<0) return 0;
  return fac[n]*(finv[k]*finv[n-k]%mod)%mod;
}
ll base(ll n,ll m){
  return m*POW(m-1,n-1)%mod;
}
void solve() {
  init();
  ll n,m,k;
  cin>>n>>m>>k;
  ll ans=0;
  rep(i,k+1){
    ans=(ans+COM(n-1,i)*base(n-i,m))%mod;
  }
  out(ans);
}

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


Measured memory_bytes: 7824
#include <stdio.h>
int main(int argc, const char * argv[]) {
    int R[200000];
    int i=0;
    int a;
    
    int maxv,min;
    scanf("%d",&a);
    while(i<a){
        scanf("%d",&R[i]);
        i++;
    }
    min=R[0];
    maxv=R[1]-R[0];
    for(i=1;i<a;i++){
        
        if((R[i]-min)>maxv){
            maxv=R[i]-min;
        }
        if(R[i]<min){
            min=R[i];
        }
                 }
    
    
    printf("%d\n",maxv);
    return 0;
}

Measured memory_bytes: 1376
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
template<class T> using vc = vector<T>;
template<class T> using vvc = vector<vector<T>>;

#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define repr(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repe(i, l, r) for (ll i = (l); i < (r); i++)
#define reper(i, l, r) for (ll i = (r)-1; i >= (l); i--)
#define repa(i,n) for (auto& i: n)

template<class T> inline bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> inline bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
void init() {cin.tie(0);ios::sync_with_stdio(false);cout << fixed << setprecision(15);}

#ifdef DEBUG
template <class T, class N> void verr(const T& a, const N& n) { rep(i, n) cerr << a[i] << " "; cerr << "\n" << flush; }
ll dbgt = 1; void err() { cerr << "passed " << dbgt++ << "\n" << flush; }
template<class H, class... T> void err(H&& h,T&&... t){ cerr<< h << (sizeof...(t)?" ":"\n") << flush; if(sizeof...(t)>0) err(forward<T>(t)...); }
#endif

const ll INF = 5e18;
const ld EPS = 1e-11;
const ld PI = acos(-1.0L);
const ll MOD = 1e9 + 7;
// const ll MOD = 998244353;
//--------------------------------------------------------------------------------//

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

Measured memory_bytes: 3612
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n
        
    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]
    
    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        
        if x == y:
            return
        
        if self.parents[x] > self.parents[y]:
            x, y = y, x
        
        self.parents[x] += self.parents[y]
        self.parents[y] = x
    
    def size(self, x):
        return -self.parents[self.find(x)]
        
    def same(self, x, y):
        return self.find(x) == self.find(y)
    
    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]
    
    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())
    
    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}
    
    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())


class UnionFindLabel(UnionFind):
    def __init__(self, labels):
        assert len(labels) == len(set(labels))
        
        self.n = len(labels)
        self.parents = [-1] * self.n
        self.d = {x: i for i, x in enumerate(labels)}
        self.d_inv = {i: x for i, x in enumerate(labels)}
    
    def find_label(self, x):
        return self.d_inv[super().find(self.d[x])]
    
    def union(self, x, y):
        super().union(self.d[x], self.d[y])
    
    def size(self, x):
        return super().size(self.d[x])
    
    def same(self, x, y):
        return super().same(self.d[x], self.d[y])
    
    def members(self, x):
        root = self.find(self.d[x])
        return [self.d_inv[i] for i in range(self.n) if self.find(i) == root]
    
    def roots(self):
        return [self.d_inv[i] for i, x in enumerate(self.parents) if x < 0]

def main():
    N, M = map(int, input().split())
    l = []
    for _ in range(M):
        a, b = map(int, input().split())
        l.append((a-1, b-1))
    t = N * (N - 1) // 2
    f = [t]
    s = 0
    uf = UnionFind(N)
    for a, b in l[::-1]:
        if not uf.same(a, b):
            s += uf.size(a) * uf.size(b)
        if t - s < 0:
            break
        f.append(t - s)
        uf.union(a, b)
    f.extend([0] * M)
    for i in reversed(f[:M]):
        print(i)
main()


Measured memory_bytes: 24116
#include<iostream>
using namespace std;
const long long INIT = -1;
const long long MOD = 998244353;
long long dp[3001][3001];
int _array[3005];
long long fact[3005];
long long dfs(int n,int value);
int main(){
  int n;
  int sum;
  cin>>n>>sum;
  fact[0]=1;
  for(int i=1;i<=n;i++){
    cin>>_array[i];
    fact[i]=fact[i-1]*i;
  }
  
  for(int i=0;i<=n;i++){
    for(int j=0;j<=sum;j++){
      dp[i][j]=INIT;
    }
  }
  
  cout<<dfs(n,sum)<<endl;
  return(0);
}

long long dfs(int n,int value){
  if(n==0){
    if(value==0){
      return(1);
    }else{
      return(0);
    }
  }
  if(dp[n][value]!=INIT){
    return(dp[n][value]);
  }
  
  long long s=dfs(n-1,value)*2%MOD;
  if(value>=_array[n]){
    s=(s+dfs(n-1,value-_array[n]%MOD))%MOD;
  }
  //  cout<<"n:"<<n<<endl;
  //  cout<<"s:"<<s<<endl<<endl;
  return(dp[n][value]=s);
}

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

int gcd(int a,int b){
  int c=a,d=b,s;
  while(1){
    if(c%d==0)return d;
    s=c%d;
    c=d;
    d=s;
  }
}

int main(){
  int a,b,c;
  cin>>a>>b>>c;
  if(c%gcd(a,b)==0)cout<<"YES";
  else cout<<"NO";
}

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

right = left = 0
xor_sum = 0
total = 0
while right < N:
    if xor_sum ^ A[right] == xor_sum + A[right]:
        xor_sum += A[right]
        right += 1
        total += right - left
    elif right == left:
        right += 1
        left += 1
    else:
        xor_sum -= A[left]
        left += 1
print(total)


Measured memory_bytes: 24840
def resolve():
	n, m = map(int, input().split())
	v = [[] for i in range(n+1)]
	for i in range(m):
		a, b = list(map(int, input().split()))
		v[a].append(b)
	ans = 'IMPOSSIBLE'
	for i in range(len(v[1])):
		if n in v[v[1][i]]:
			ans = 'POSSIBLE'
			break
	print(ans)
resolve()

Measured memory_bytes: 67148
#include<iostream>
#include<stdio.h>
#include<string.h>
using namespace std;
int main(){
	long n,UENINIGERUDE,SEISU[10000],GOKEI=0,SAISYO;
	cin>>n;
	SAISYO=n-1;
	for(int i=0;i<n;i++){
		cin>>SEISU[i];
		}
	for(int i=0;i<=n;i++){
		for(int j=i+1;j<n;j++){
			if(SEISU[i]<SEISU[j]){
				UENINIGERUDE=SEISU[i];
				SEISU[i]=SEISU[j];
				SEISU[j]=UENINIGERUDE;
				}
			}
		}
	for(int i=0;i<n;i++){
		GOKEI+=SEISU[i];
		}
	cout<<SEISU[SAISYO]<<" "<<SEISU[0]<<" "<<GOKEI<<endl;
	return 0;
}

Measured memory_bytes: 1240
#include <cstring>
#include <algorithm>
#define REP(i,n) for(int i=0; i<(int)(n); i++)

#define FOR(i,c) for(__typeof((c).begin()) i=(c).begin(); i!=(c).end(); i++)

#include <cstdio>
#include <iostream>
#include <queue>
#include <map>
#include <set>

inline int getInt(){ int s; scanf("%d", &s); return s; }


using namespace std;

struct Node{
  int id;
  map<char, Node *> next;
  Node(){
    id = -1;
  }
};

vector<string> s;
char buff[100000 + 10];

Node *getNext(Node *node, char c){
  if(node->next[c] == NULL)
    node->next[c] = new Node();
  return node->next[c];
}

vector<int> rng;
vector<int> r;

void dfs(Node *node){
  const int id = node->id;
  if(id != -1){
    r.push_back(id);
    FOR(it, node->next)
      dfs(it->second);
    rng[id] = r.size();
  }else{
    FOR(it, node->next)
      dfs(it->second);
  }
}

int main(){
  const int n = getInt();
  rng = vector<int>(n);

  Node *root = new Node();

  REP(i,n){
    scanf("%s", buff);
    const int len = strlen(buff);

    Node *node = root;
    REP(i,len){
      const char c = buff[i];
      node = getNext(node, c);
    }
    node->id = i;
  }

  dfs(root);

  // REP(i,n) printf("%d ", r[i]); puts("");
  // REP(i,n) printf("%d ", rng[i]); puts("");

  vector<int> memo(n);
  REP(i,n) memo[r[i]] = i;

  const int q = getInt();
  set<int> in;
  REP(_,q){
    const int k = getInt();
    const int id = getInt() - 1;

    if(k == 1){
      in.insert(memo[id]);
    }else if(k == 2){
      in.erase(memo[id]);
    }else{
      set<int>::iterator it = in.lower_bound(memo[id]);
      if(it != in.end()){
        const int idx = *it;
        if(idx < rng[id]){
          printf("%d\n", r[idx] + 1);
        }else{
          puts("-1");
        }
      }else{
        puts("-1");
      }
    }

  }


  return 0;
}


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

#define rep(i, n) for (int i = 0; i < (n); i++)
#define repeat(i, a, b) for (int i = (a); i < (b); i++)
#define INF 2e8
#define all(a) a.begin(), a.end()
#define pb push_back
#define maxer max_element
#define miner min_element

// 90度回転
void Rot(vector<int> &p) {
  vector<int> q(2);
  q[0] = -p[1];
  q[1] = p[0];
  p = q;
}

int main() {
  vector<int> p1(2), p2(2), v(2);
  cin >> p1[0] >> p1[1] >> p2[0] >> p2[1];
  v[0] = p2[0] - p1[0];
  v[1] = p2[1] - p1[1];

  vector<int> p3(2), p4(2);

  Rot(v);
  p3[0] = p2[0] + v[0];
  p3[1] = p2[1] + v[1];

  Rot(v);
  p4[0] = p3[0] + v[0];
  p4[1] = p3[1] + v[1];

  cout << p3[0] << " " << p3[1] << " " << p4[0] << " " << p4[1] << endl;
}


Measured memory_bytes: 256
/*
 AUTHOR : ANSHU BABU RAJPUT
 
    JAI MAA SARASWATI
    OM NAMAH SHIVAY
    JAI SHRI KRISHNA
    JAI SHRI RAM
    BHARAT MATA KI JAI

    #PKMKB	
    #CKMKB
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

#define int  long long 
#define endl    ("\n")
#define ff       first
#define ss      second
#define pb   push_back
#define pf  push_front
#define ppb   pop_back
#define ppf  pop_front
#define mp   make_pair
#define mod 1000000007

#define L(x)    x.length()
#define B(x)     x.begin()
#define E(x)       x.end()
#define F(x)     x.front()
#define SZ(x)     x.size()
#define CLR(x)   x.clear()

#define all(x)                      x.begin(),x.end()
#define sortD(x) sort(x.begin(),x.end(),greater<int>)
#define rev(x)             reverse(x.begin(),x.end())

#define intV vector<int>

#define PI          (3.141592653589)
#define PMAX     priority_queue<int>
#define PMIN             priority_queue<int,vi,greater<int>>
#define setbits(x)                   __builtin_popcountll(x)
#define zrobits(x)                        __builtin_ctzll(x)

#define KING(i, n) for (int(i) = 0; (i) < n; (i)++)
#define MAHAKAL(i, n) for (int(i) = n-1; (i) >= 0; (i)--)

#define Anshu        int t; cin>>t; while(t--)
#define SITARAM(n,type) type* input=new type[n]

mt19937                          rng(chrono::steady_clock::now().time_since_epoch().count());
 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;


void ViLiFY_KiNG()
{
    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);
    freopen("error.txt","w",stderr);
#endif
}
bool isPalindrome(string str) {
    // bool temp = true;
    int i=0;
    int j=str.length()-1;

    while(i<=j) {
        if(str[i] != str[j]) {
            return false;
        }
        i++;
        j--;
    }
    return true;
}
int32_t main()
{
    ViLiFY_KiNG();
    string str;
    cin>>str;


    if(L(str)%2 == 0) {
        cout<<"No"<<endl;
      	return 0;
    }

    if(isPalindrome(str)) {
        if(isPalindrome(str.substr(0,(L(str)-1)/2))) {
            cout<<"Yes"<<endl;
            // cout<<str.substr(0,(L(str)-1)/2)<<endl;
        } else {
            cout<<"No"<<endl;
            // cout<<str.substr(0,(L(str)-1)/2)<<endl;
        }
    } else {
        cout<<"No"<<endl;
        // cout<<str.substr(0,(L(str)-1)/2)<<endl;
    }
    return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int a,b;
    cin>>a>>b;
    if(a>0)
        cout<<"Positive";
    else if(a==0||(a<0&&b>0))
        cout<<"Zero";
    else if((abs(b)-abs(a))%2!=0)
        cout<<"Positive";
    else 
        cout<<"Negative";
    return 0;
}

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

int main(void){
   
 string s;
 vector<char>ans;
 
 cin >> s;
 int len = s.size();
 
 for(int i=0;i<len;i++){
     if(s[i] == '0'){
         ans.push_back('0');
     }
     else if(s[i] == '1'){
         ans.push_back('1');
     }
     else{
         if(ans.size() > 0) ans.pop_back();
     }
 }
 int ans_size = ans.size();
 for(int i=0;i<ans_size;i++) cout << ans[i];
 cout << endl;
}

Measured memory_bytes: 3600
#include<bits/stdc++.h>
#define rep(i,a) for(int i=(int)0;i<(int)a;++i)
#define rrep(i,a) for(int i=(int)a-1;i>=0;--i)
#define REP(i,a,b) for(int i=(int)a;i<(int)b;++i)
#define RREP(i,a,b) for(int i=(int)a-1;i>=b;--i)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
using ll=long long;
constexpr ll mod = 1e9 + 7;
constexpr ll INF = 1LL << 60;
 
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}


ll gcd(ll n, ll m) {
    ll tmp;
    while (m!=0) {
        tmp = n % m;
        n = m;
        m = tmp;
    }
    return n;
}
 
ll lcm(ll n, ll m) {
    return abs(n) / gcd(n, m)*abs(m);//gl=xy
}

using namespace std;

void solve()
{
	int n;
	cin>>n;
	vector<ll>a(n);
	rep(i,n)cin>>a[i];
	rep(i,n){
		if(a[i]==0){
			cout<<0;
			return;
		}
	}
	const ll m=1000000000000000000;
	ll mul=1;
	rep(i,n){
		if(mul>m/a[i]){
			cout<<-1;
			return;
		}
		mul*=a[i];
		if(mul>m){
			cout<<-1;
			return;
		}
	}
	cout<<mul;
}

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


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

int main() {
  int N, A, B;
  cin >> N;
  if(N == 1) {
    cout << "Hello World" << endl;
  }
  else if(N == 2) {
    cin >> A >> B;
    cout << A + B << endl;
  }
}

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

#define int long long
#define DEBUG(x) cerr <<#x<<":"<<x<<endl;
#define DEBUG2(x, y) cerr <<#x<<":"<<x<<" "<<#y<<":"<<y<<endl;
#define DEBUG3(x, y, z) cerr <<#x<<":"<<x<<" "<<#y<<":"<<y<<" "<<#z<<":"<<z<<endl;
#define DEBUGVC(x) cerr <<#x<<": "; for(auto a:x) cerr << a <<" "; cerr << endl;
#define DEBUGMP(x) cerr <<#x<<":"<<endl; for(auto a:x) cerr << a.first <<" "<< a.second << endl;
#define MAX_N (2000006)
#define INF (1LL << 60)
const int MOD = (int)1e9 + 7;

const int MAX = 510000;

int fac[MAX], finv[MAX], inv[MAX]; // a!(fac[a]), (a!)^{-1}(finv[a]), a^{-1}(inv[a])

// テーブルを作る前処理
void comb_init(){
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for(int i=2; i<MAX; i++){
        fac[i] = fac[i-1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i-1] * inv[i] % MOD;
    }
}

int comb(int n, int k){
    if(n < k) return 0;
    if(n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n-k] % MOD) % MOD;
}

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

    comb_init();

    for(int i=1; i<=K; i++){
        cout << (comb(N-K+1,i) * comb(K-1,i-1))%MOD << endl;
    }
}

Measured memory_bytes: 12160
d = list(map(int, input().split()))
q = int(input())
for i in range(q):
    right = 0
    top, front = map(int, input().split())

    if top == d[0]:
        if front == d[1]:
            print(d[2])
        elif front == d[2]:
            print(d[4])
        elif front == d[3]:
            print(d[1])
        elif front == d[4]:
            print(d[3])
    elif top == d[1]:
        if front == d[0]:
            print(d[3])
        elif front == d[2]:
            print(d[0])
        elif front == d[3]:
            print(d[5])
        elif front == d[5]:
            print(d[2])
    elif top == d[2]:
        if front == d[0]:
            print(d[1])
        elif front == d[1]:
            print(d[5])
        elif front == d[4]:
            print(d[0])
        elif front == d[5]:
            print(d[4])
    elif top == d[3]:
        if front == d[0]:
            print(d[4])
        elif front == d[1]:
            print(d[0])
        elif front == d[4]:
            print(d[5])
        elif front == d[5]:
            print(d[1])
    elif top == d[4]:
        if front == d[0]:
            print(d[2])
        elif front == d[2]:
            print(d[5])
        elif front == d[3]:
            print(d[0])
        elif front == d[5]:
            print(d[3])
    elif top == d[5]:
        if front == d[1]:
            print(d[3])
        elif front == d[2]:
            print(d[1])
        elif front == d[3]:
            print(d[4])
        elif front == d[4]:
            print(d[2])
    else:
        break


Measured memory_bytes: 5612
sx,sy,tx,ty=map(int,input().split())
x1,y1=tx-sx,ty-sy
x2,y2=x1+2,y1+2

s="U"*y1
s+="R"*x1
s+="D"*y1
s+="L"*x1

s+="L"
s+="U"*(y2-1)
s+="R"*(x2-1)
s+="D"

s+="R"
s+="D"*(y2-1)
s+="L"*(x2-1)
s+="U"

print(s)

Measured memory_bytes: 9072
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <complex>
#include <stdio.h>
#include <time.h>
#include <numeric>
#include <unordered_map>
#include <unordered_set>
# define ll int64_t
# define rep(i,n) for(ll i=0;i<n;i++)
# define rrep(i,n) for(ll i=1;i<=n;i++)
# define ALL(x) (x).begin(), (x).end()
# define SZ(x) ((int)(x).size())
# define pb push_back
# define mod 1000000007
# define PI 3.141592653589793
# define vec vector
#define dump(x) cerr<<#x<<"="<<x<<endl
using namespace std;

bool compare_by_b(pair<string,ll> a,pair<string,ll> b){
    if(a.second != b.second) return a.second<b.second;
    else return a.first<b.first;
}

bool my_compare(pair<string,ll> a,pair<string,ll> b){
    if(a.first != b.first) return a.first<b.first;
    if(a.second != b.second) return a.second>b.second;
    else return true;
}

ll factorial(ll n){
    ll x=1;
    rrep(i,n) (x*=i)%=mod;
    return x;
}

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

ll lcm(ll a,ll b){
   return a/gcd(a,b)*b;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    
    double n,sum=0;
    cin>>n;
    vec<double> t(n);
    rep(i,n){
        double a;
        cin>>a;
        t[i]=a;
        sum+=a;
    }
    double ave=sum/n;
    double ans=0,mini=abs(ave-t[0]);
    rrep(i,n-1){
        if(mini>abs(ave-t[i])){
            ans=i;
            mini=abs(ave-t[i]);
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<n;i++)
int main() {
  int n,x,t;
  cin>>n>>x>>t;
  int times=(n+x-1)/x;
  int ans=times*t;
  cout<<ans<<endl;
}

Measured memory_bytes: 3628
n = int(input())
a = []
b = []
for _ in range(n):
  _a, _b = map(int, input().split())
  a.append(_a)
  b.append(_b)
  
if n % 2 != 0:
  import numpy as np
  a_med = int(np.median(a))
  b_med = int(np.median(b))
  print(b_med - a_med + 1)
elif n == 2:
  print(sum(b) - sum(a) + 1)
else:
  a = sorted(a)[n//2-1:n//2+1]
  b = sorted(b)[n//2-1:n//2+1]
  print(sum(b) - sum(a) + 1)

Measured memory_bytes: 45612
#include <algorithm>
#include <bitset>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

typedef long long ll;

#define rep(i, n) for (ll i = 0; i < (ll)n; ++i)
#define repd(i, n) for (ll i = (n)-1; i >= 0; --i)
#define INF 10e12
#define MOD 1000000000 + 7
#define MAX 51000
#define all(x) (x).begin(), (x).end()
#define MX(x) *max_element(all(x))
#define MN(x) *min_element(all(x))

using namespace std;

int main(void)
{
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    int a, b;
    cin >> a >> b;
    int ans = max(a + b, max(a - b, a * b));
    cout << ans << endl;
}

Measured memory_bytes: 3592
#include <stdio.h>

int
main(int argc, char *argv[])
{
  int n;
  scanf("%d", &n);
  int p[100000];
  int ans = 0, l;
  for(int i = 0; i < n; i++){
    scanf("%d", &p[i]);
    if(p[i] == i + 1) l++;
    else{
      ans += l / 2 + l % 2;
      l = 0;
    }
  }
  ans += l / 2 + l % 2;
  printf("%d\n", ans);

  return 0;
}


Measured memory_bytes: 512
import java.util.*;

public class Main {
  public static void main(String[] args ) throws Exception {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int M= sc.nextInt();
    int coin=0;
    int Max=Math.max(N,M);
    int Min=Math.min(N,M);
    coin=Max;
    if(Max-1>Min){
      coin+=Max-1;
    }else{
      coin+=Min;
    }
    System.out.println(coin);
  }}

Measured memory_bytes: 22612
#include <iostream>
using namespace std;
#define MAX_N 999999

int prime[MAX_N];
bool is_prime[MAX_N];

int sieve(int n)
{
	int p = 0;
	for(int i = 0; i<=n; i++)
		is_prime[i] = true;
	
	is_prime[0] = is_prime[1] = false;
	
	for(int i=2; i<=n; i++)
	{
		if(is_prime[i])
		{
			prime[p++] = i;
			for(int j = 2*i; j<=n; j+=i)
				is_prime[j] = false;
		}
	}
	return p;
}

int main()
{
	int s;
	while( cin >> s )
	{
		cout << sieve(s) << endl;
	}
	
		
	return 0;	
} 



Measured memory_bytes: 4368