akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;

const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define ALL(v) (v.begin(),v.end())
#define COUT(x) cout<<(x)<<endl

int main(){
    string s;
    cin >> s;
    for(int i=0;i<(1<<3);++i){
        string ans = "";
        int count = s[0]-'0';
        for(int j=0;j<3;++j){
            ans += s[j];
            if(i&(1<<j)){
                ans += "+";
                count += (s[j+1]-'0');
            }
            else{
                ans += "-";
                count -= (s[j+1]-'0');
            }
        }
        if(count==7){
            ans += s[3];
            ans += "=7";
            cout << ans << endl;
            return 0;
        }
    }
    return 0;
} 

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
    int n;
    cin>>n;
    int mat[n][3];
    for(int i=0;i<n;i++)
        cin>>mat[i][0]>>mat[i][1]>>mat[i][2];
    for(int i=1;i<n;i++){
        mat[i][0] = max(mat[i-1][1],mat[i-1][2])+mat[i][0];
        mat[i][1] = max(mat[i-1][0],mat[i-1][2])+mat[i][1];
        mat[i][2] = max(mat[i-1][1],mat[i-1][0])+mat[i][2];
        
    }
    cout<<*max_element(mat[n-1],mat[n-1]+3)<<endl;
}

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

int main() {
    int n, q;
    std::cin >> n >> q;

    std::vector<std::vector<int>> vecs{};
    vecs.resize(n);
    for (int time = 0; time < q; ++time) {
        int kind;
        std::cin >> kind;

        int t;
        switch (kind) {
            case 0:
                int x;
                std::cin >> t >> x;
                vecs[t].push_back(x);
                break;
            case 1:
                std::cin >> t;
                for (auto i = vecs[t].begin(); i != vecs[t].end(); ++i) {
                    std::cout << *i;
                    if (i != vecs[t].end() - 1) std::cout << ' ';
                }
                std::cout << std::endl;
                break;
            case 2:
                std::cin >> t;
                if (vecs[t].size() != 0) vecs[t].clear();
                break;
            default:
                std::cerr << "strange kind" << std::endl;
        }
    }
}


Measured memory_bytes: 5744
#include<iostream>
using namespace ::std;
#include<math.h>
int main(){
	
	int n,ans,m,fans;
	m=0;
	fans=0;
	ans=0;
	cin>>n;
	for(int c=1;c<=n;c++){
		
		m=sqrt(n-c);
		
		for(int a=1;a<=m;a++){
			
			if(((n-c)%a==0)&&(n-c)/a!=a){
				ans+=2;
			}
			else if((n-c)%a==0){
				ans++;
			}
			
		}
		
	}
cout<<ans;
return 0;
}

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

int main() {
	int N, A, X[50], x, MAX;
	static long long DP[60][5000] = {};
	cin >> N >> A;
	MAX = A;
	for (int i = 0; i < N; i++) {
		cin >> x;
		X[i] = x - A;
		MAX = max(MAX, abs(X[i]));
	}
	DP[0][N * MAX] = 1;
	for (int i = 0; i < N; i++) {
		for (int j = 0; j <= 2 * N * MAX; j++) {
			if (j - X[i] < 0 || j - X[i] > 2 * N * MAX) DP[i + 1][j] = DP[i][j];
			else DP[i + 1][j] = DP[i][j] + DP[i][j - X[i]];
		}
	}
	cout << DP[N][N * MAX] - 1;
}

Measured memory_bytes: 2176
#include<cstdio>
#include<algorithm>
#include<iostream>
#include<cmath>
#include<cstring>
#include<string>
using namespace std;
int n,cnt=0,l[100010];
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	    scanf("%d",&l[i]);
	sort(l+1,l+n+1);
	for(int i=1;i<=n;i++)
	    for(int j=1;j<i;j++){
	    	int left=i+1,right=n,mid,ans=-1;
	    	while(left<=right){
	    		mid=(left+right)/2;
	    		if(l[mid]<l[i]+l[j]&&(mid==n||l[mid+1]>=l[i]+l[j])){ans=mid;break;}
				else if(l[mid]>=l[i]+l[j]) right=mid-1;
				else left=mid+1;
			}
			if(ans==-1) continue;
			else cnt+=(ans-i);
		}
	cout<<cnt<<endl;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] s = br.readLine().split(" ");
        int x = Integer.parseInt(s[0]);
        int y = Integer.parseInt(s[1]);
        int x_ = Integer.parseInt(s[2]);
        int y_ = Integer.parseInt(s[3]);

        int ver = y_ - y;
        int hor = x_ - x;

        for(int i=0; i<ver; i++) System.out.print("U");
        for(int i=0; i<hor; i++) System.out.print("R");

        for(int i=0; i<ver; i++) System.out.print("D");
        for(int i=0; i<hor; i++) System.out.print("L");

        System.out.print("L");
        for(int i=0; i<ver+1; i++) System.out.print("U");
        for(int i=0; i<hor+1; i++) System.out.print("R");
        System.out.print("D");

        System.out.print("R");
        for(int i=0; i<ver+1; i++) System.out.print("D");
        for(int i=0; i<hor+1; i++) System.out.print("L");
        System.out.println("U");
    }
}

Measured memory_bytes: 24788
#include<cstdio>
#include<algorithm>
#define fo(i,a,b) for(i=a;i<=b;i++)
using namespace std;
const int maxn=3000+10;
int h[maxn],go[maxn*2],nxt[maxn*2],a[maxn];
int i,j,k,l,t,n,m,tot;
void add(int x,int y){
	go[++tot]=y;
	nxt[tot]=h[x];
	h[x]=tot;
}
int dfs(int x,int y){
	int t=h[x];
	bool czy=0;
	while (t){
		if (go[t]!=y){
			if (a[x]>a[go[t]]&&!dfs(go[t],x)) czy=1;
		}
		t=nxt[t];
	}
	return czy;
}
int main(){
	scanf("%d",&n);
	fo(i,1,n) scanf("%d",&a[i]);
	fo(i,1,n-1){
		scanf("%d%d",&j,&k);
		add(j,k);add(k,j);
	}
	fo(i,1,n)
		if (dfs(i,0)) printf("%d ",i);
}

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

int main()
{
    int n,w;
    int a,b;
    int yoko_1[100],yoko_2[100];
    int ans[100];
    char ch;
    
    cin>>w>>n;
    
    for (int i=0; i<n; i++) {
        cin>>a>>ch>>b;
        yoko_1[i]=a;
        yoko_2[i]=b;
    }
    
    int i=0,yoko=1,count=1;
    
    while (1) {
        if (yoko_1[i] == yoko) {
            yoko = yoko_2[i];
            i++;
        }
        else if(yoko_2[i] == yoko){
            yoko = yoko_1[i];
            i++;
        }
        else{
            i++;
        }
        if (w==i) {
            ans[yoko-1]=count;
            i=0;
            count++;
            yoko=count;
        }
        if(count>w){
            break;
        }
    }
    for (int i=0; i<w; i++) {
        cout<<ans[i]<<endl;
    }
    return 0;
}

Measured memory_bytes: 1160
N, M = map(int, input().split())
dp = [0] * (N + 1)
dp[0] = 1
kaidan = [True] * (N + 1)
MOD = 10 ** 9 + 7
for _ in range(M):
    kaidan[int(input())] = False
for i in range(N):
    if kaidan[i]:
        dp[i+1] += dp[i]
    if i > 0 and kaidan[i-1]:
        dp[i+1] += dp[i-1]
    dp[i+1] %= MOD
print(dp[-1])


Measured memory_bytes: 7776
#include <bits/stdc++.h>
using namespace std;
 
using ll = long long;
using ld = long double;
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define FORR(i, m, n) for (int i = (m); i >= (n); i--)
#define REP(i, n) FOR(i, 0, (n))
#define REPR(i, n) FORR(i, (n) - 1, 0)
#define REP1(i, n) FOR(i, 1, (n) + 1)
#define REPS(c, s) for (char c : s)
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define REV(c) reverse(ALL(c))
#define sz(v) (int)v.size()
#define endl '\n';
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;}
const int MOD = 1000000007;
const int INF = 1000000001;
const ll LINF = 1000000001000000001LL;
 
void solve();
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(numeric_limits<double>::max_digits10);
    solve();
    return 0;
}

void solve() {
    string s;
    cin >> s;
    int ans = 0;
    int sc = 0;
    REPS(c, s) {
        if (c == 'S') {
            sc++;
        } else {
            if (sc > 0) {
                sc--;
                ans++;
            }
        }
    }
    cout << sz(s) - ans * 2<< endl;
}



Measured memory_bytes: 720
import math
import sys
import collections
import bisect
readline = sys.stdin.readline


def main():
    x, y, a, b, c = map(int, input().split())
    print(sum(sorted((sorted(list(map(int, input().split())), reverse=True)[0:x] + sorted(list(map(int, input(
    ).split())), reverse=True)[0:y] + sorted(list(map(int, input().split())), reverse=True)), reverse=True)[0:(x + y)]))


if __name__ == '__main__':
    main()


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

using namespace std;

const int maxn=1e5+5;

typedef long long ll;

const ll mod=1e9+7;

int main(){
	int n,m;
	cin>>n>>m;
	if(n<m){
		for(int i=0;i<m;i++){
			cout<<n;
		}
	}
	else{
		for(int i=0;i<n;i++){
			cout<<m;
		}
	}
	return 0;
}

Measured memory_bytes: 256
#include<set>
#include<map>
#include<cmath>
#include<queue>
#include<bitset>
#include<string>
#include<cstdio>
#include<cctype>
#include<cassert>
#include<cstdlib>
#include<cstring>
#include<sstream>
#include<iostream>
#include<algorithm>

#define For(i,x,y) for (int i=x;i<y;i++)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define lf else if

#define dprintf(...) fprintf(stderr,__VA_ARGS__)
using namespace std;

typedef long long ll;
typedef double db;
typedef pair<int,int> pii;
typedef vector<int> Vi;

int IN(){
	int c,f,x;
	while (!isdigit(c=getchar())&&c!='-');c=='-'?(f=1,x=0):(f=0,x=c-'0');
	while (isdigit(c=getchar())) x=(x<<1)+(x<<3)+c-'0';return !f?x:-x;
}

const int N=100000+19;
const int oo=(1<<30)-1;

struct Edge{
	int y,z,nxt;
} E[N*2];
int las[N],sz[N];
int n,cnt,chk,mn,x,y,z,cen;
ll ans;

void Link(int x,int y,int z){
	E[cnt]=(Edge){y,z,las[x]};las[x]=cnt++;
	E[cnt]=(Edge){x,z,las[y]};las[y]=cnt++;
}
int cal(int a,int b){
	if (a==b) return 2*a-1;
	return min(a,b)*2;
}
void dfs(int x,int fa){
	int tmp=0;
	sz[x]=1;
	for (int i=las[x],y;~i;i=E[i].nxt)
		if ((y=E[i].y)!=fa){
			dfs(y,x);
			sz[x]+=sz[y];
			if (sz[y]==n-sz[y]) chk=1;
			tmp=max(tmp,sz[y]);
			ans+=1ll*E[i].z*cal(sz[y],n-sz[y]);
		}
	tmp=max(tmp,n-sz[x]);
	if (tmp<mn) mn=tmp,cen=x;
}

int main(){
	mn=oo;
	memset(las,-1,sizeof(las));
	n=IN();
	For(i,1,n){
		x=IN(),y=IN(),z=IN();
		Link(x,y,z);
	}
	dfs(1,-1);
	if (!chk){
		mn=oo;
		for (int i=las[cen];~i;i=E[i].nxt) mn=min(mn,E[i].z);
		ans-=mn;
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 9984
n = int(input())
c = input()
cw = c
cr = ''.join(list(reversed(c)))

#print(n)
#print(c)
#print(cw)
#print(cr)

ans = 0
w=0
r=0
nn = n

for i in range(n):
  nw = cw.find('W')
  if nw == -1:
    break
  nr = cr.find('R')
  if nr == -1:
    break
  if (nw + nr + 2) > nn:
    break
  nn = nn - (nw + nr + 2)
  cw = cw[(nw+1):]
  cr = cr[(nr+1):]
  ans +=1

  #  print(cw)
  #  print(cr)

print(ans)

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

namespace ConsoleApp5
{

    class Program
    {
        static void Main(string[] args)
        {
            int a = int.Parse(Console.ReadLine());
            String S = Console.ReadLine();

            if(a >= 3200)
            {
                Console.WriteLine(S);
            }
            else
            {
                Console.WriteLine("red");
            }
        }
    }
}

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

int main(){
	const int size = 60000;
	bool prime[size + 1];
	int n;
	
	for(int i = 0; i <= size; i++) prime[i] = false;
	for(int i = 2; i <= size; i++){
		if(!prime[i]){
			for(int j = 2 * i; j <= size; j += i){
				prime[j] = true;
			}
		}
	}
	
	while((scanf("%d", &n)) != EOF){
		for(int i = n - 1; i >= 0; i--){
			if(!prime[i]){
				printf("%d ", i);
				break;
			}
		}
		for(int i = n + 1; i <= size; i++){
			if(!prime[i]){
				printf("%d\n", i);
				break;
			}
		}
	}
	
	return 0;
}

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

class Queue {
public:
	pair<string, int> data[100001];
	int dp, ep;

	Queue(){
		dp = 0;
		ep = 0;
	}

	void enqueue(pair<string, int> proc){
		data[ep++]=proc;
		if(ep>100000) ep=0;
	}
	pair<string, int> dequeue(){
		pair<string, int> tmp = data[dp++];
		if(dp>100000) dp=0;
		return tmp;
	}
	
	int isSize(){
		return ep-dp;
	}
};

int main(){
	int n, q, time=0;
	cin >> n >> q;
	pair<string, int> proc;
	Queue queue;
	while(cin >> proc.first >> proc.second){
		queue.enqueue(proc);
	}
	while(queue.isSize()!=0){
		proc = queue.dequeue();
		if(proc.second-q> 0){
			time+=q;
			proc.second -= q;
			queue.enqueue(proc);
		}else{
			time+=proc.second;
			cout << proc.first << ' ' << time << endl;
		}
	}

}





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

int main(){
  int min,max;
  string str;
  int cnt = 0;
  string left,right;
  
  cin >> min >> max;
  
  for(int i = min; i <= max; i++){
    str = to_string(i);
    left = str.substr(0,2);
    right = str.substr(4,1) + str.substr(3,1);
    if(left == right) cnt++;
  }
  
  cout << cnt;
}

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

	public static void main(String[] args) {
		Scanner scanner=new Scanner(System.in);
		int n[]=new int[10];
		for(int i=0;i<10;i++){
			n[i]=scanner.nextInt();
		}
		Arrays.sort(n);
		for(int i=9;i>=7;i--){
			System.out.printf("%d\n", n[i]);
		}
	}

}

Measured memory_bytes: 12000
#include <bits/stdc++.h>
using namespace std;
#define eb emplace_back
#define emp emplace
#define fi first
#define se second
#define INF 0x3f3f3f3f
typedef long long ll;
typedef pair<int, int> ii;

int dir[4][2] = {{1,0}, {0,1}, {-1, 0}, {0, -1}};
int dist[51][51];
char g[51][51];
int n, m;

void bfs() {
	queue<ii> q;
	q.emp(0,0);
	memset(dist, INF, sizeof dist);
	dist[0][0] = 0;

	while (!q.empty()) {
		int cx = q.front().fi;
		int cy = q.front().se;
		q.pop();

		for (int i = 0; i < 4; i++) {
			int nx = cx+dir[i][0];
			int ny = cy+dir[i][1];

			if (!(nx >= 0 and nx < n and ny >= 0 and ny < m and g[nx][ny] == '.')) continue;

			if (dist[nx][ny] > dist[cx][cy]+1) {
				q.emp(nx, ny);
				dist[nx][ny] = dist[cx][cy]+1;
			}
		}
	}
}

int main(void) {
	ios_base::sync_with_stdio(false);

	cin >> n >> m;

	int h = 0;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < m; j++) {
			cin >> g[i][j];
			if (g[i][j] == '#') h++;
		}
	}

	bfs();

	if (dist[n-1][m-1] == INF) {
		cout << -1 << endl;
		return 0;
	}

	cout << n*m-(dist[n-1][m-1]+1)-h << endl;

	return 0;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>


int main(void)
{
	int H, W, i, j;

	while (1){
		scanf("%d %d", &H, &W);
		if (H == 0 && W == 0){
			break;
		}
		for (i = 1; i <= H; i++){
			for (j = 1; j <= W; j++){
				if (i>1 && i < H){
					if (j>1 && j < W){
						putchar('.');
					}
					else {
						putchar('#');
					}
				}
					if (i == 1 || i == H){
						putchar('#');
					}
			}
			putchar('\n');
		}
		putchar('\n');
	}

	return 0;
}

Measured memory_bytes: 1000
#include <cmath>
#include <iostream>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <bitset>
#include <algorithm>
#include <functional>
#include <utility>
#include <iomanip>

#define int long long int
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )

using namespace std;

typedef pair<int, int> P;

const int INF = 1e15;
const int MOD = 1e9+7;

template <typename T>
using vector2 = vector<vector<T>>;
template <typename T>
vector2<T> initVec2(size_t n0, size_t n1, T e = T()){
    return vector2<T>(n0, vector<T>(n1, e));
}

template <typename T>
using vector3 = vector<vector<vector<T>>>;
template <typename T>
vector3<T> initVec3(size_t n0, size_t n1, size_t n2, T e = T()){
    return vector3<T>(n0, vector2<T>(n1, vector<T>(n2, e)));
}

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

    int n;
    cin >> n;
    vector<int> h(n);
    rep(i, n) cin >> h[i];

    for(int i = n - 1; i > 0; i--){
        if(h[i] < h[i-1]){
            h[i-1]--;
        }
    }

    rep(i, n - 1){
        if(h[i] > h[i+1]){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;

    return 0;
}


Measured memory_bytes: 1024
//Never stop chasing!-MdSourav.
#include <bits/stdc++.h>

#define yes            cout<<"YES"<<endl
#define no             cout<<"NO"<<endl
#define sz(x)          x.size()
#define ll                    long long int
#define ls             long int
#define start          ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define test           int t;cin>>t;while(t--)
#define f(i, a, n)     for(int i=a; i<n;i++)
#define gcd(a,b)       __gcd(a,b)
#define lcd(a,b)       (a*b)/gcd(a,b)
#define pb             push_back
#define mp(x,y)        make_pair(x,y)
#define rsrt(v)        sort(v.begin(),v.end(),greater<int>())
#define srt(v)         sort(v.begin(),v.end())
#define basrt(a,n)     sort(a,a+n,greater<int>())
#define asrt(a,n)      sort(a,a+n)
#define fact(n)        ll x=1;for(ll i=1;i<=n;i++){x=(x*i);}
#define F              first
#define S              second
#define deb(x)         cout << #x << ": " << x << endl;
#define enter(v,n)     for(ll i=0;i<n;i++){ll x;cin>>x;v.pb(x);}
#define INF 	       1000000007
#define unique(v)      v.erase(unique(v.begin(),v.end()),v.end())
using namespace std;

double pi=3.14159265358979323846;
typedef vector<ll> vll ;
typedef vector<int> vii ;

template<typename T>
ostream& operator<<(ostream &os, const vector<T> &v)
{
    os << '{';
    for (const auto &x : v) os << " " << x;
        return os << '}';
}

void solve()
{

	 int n,k;cin>>n>>k;
	 vii v;
	 enter(v,n);
	 srt(v);
	 ll sum=0;
	 for(int i=0;i<k;i++)
	 {
	 	sum+=v[i];
	 }
	 cout << sum;




}
int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);cout.tie(0);
    ll test_case=1;
    //cin>>test_case;
    while(test_case--)
	{
		solve();
	}

	return 0;
}

Measured memory_bytes: 3652
package main

import (
	"fmt"
	"sort"
)

func main() {
	var n int
	fmt.Scan(&n)
	a := make([]int, n)
	for i := range a {
		fmt.Scan(&a[i])
	}

	sort.Sort(sort.Reverse(sort.IntSlice(a)))
	aSum := 0
	bSum := 0
	for i, v := range a {
		if i%2 == 0 {
			aSum += v
		} else {
			bSum += v
		}
	}

	fmt.Println(aSum - bSum)
}


Measured memory_bytes: 512
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int A = 0;
    int B = 0;
    Integer[] array = new Integer[N];
    for(int i=0; i<N; i++){
      array[i] = sc.nextInt();
    }
    Arrays.sort(array,Collections.reverseOrder());
    for(int i=0; i<array.length; i++){
      if(i%2==0){
        A+=array[i];
      }else{
        B+=array[i];
      }
    }
    System.out.println(Math.abs(A - B));
  }
}

Measured memory_bytes: 21844
// This file is a "Hello, world!" in C++ language by GCC for wandbox.
#include <iostream>
#include <cstdlib>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>

int main()
{
    int n,m;
    std::cin >> n;
    std::cin >> m; 
    std::vector<int> a,b;
    for(int i=0;i<m;i++){
        int x,y;
        std::cin >> x;
        std::cin >> y;
        a.push_back(x);
        b.push_back(y);
    }
    std::vector<int> start;
    std::vector<int> goal;
    for(int i=0;i<m;i++){
        if(a[i]==1)start.push_back(b[i]);
        if(b[i]==n)goal.push_back(a[i]);
    }
    if(start.size()==0||goal.size()==0){
        std::cout << "IMPOSSIBLE";
        return 0;
    }
    std::sort(start.begin(),start.end());
    std::sort(goal.begin(),goal.end());    
    int p=0;
    int q=0;
    int ssize = (int)start.size();
    int gsize = (int)goal.size();
        
    while(true){
        if(start[p]<goal[q])p=p+1;
        else if(start[p]>goal[q])q=q+1;
        else{
            std::cout << "POSSIBLE";
            return 0;
        }
        if(p+1>ssize||q+1>gsize){
            break;
        }
    }
    std::cout << "IMPOSSIBLE";
                
}

// GCC reference:
//   https://gcc.gnu.org/

// C++ language references:
//   https://msdn.microsoft.com/library/3bstk3k5.aspx
//   http://www.cplusplus.com/
//   https://isocpp.org/
//   http://www.open-std.org/jtc1/sc22/wg21/

// Boost libraries references:
//   http://www.boost.org/doc/


Measured memory_bytes: 3052
a,b,k = gets.split.map &:to_i
    if a >= k
        a_rest = a - k
        b_rest = b
    end
    
    if a < k && k <= a + b
      b_rest = b -(k - a)    
      a_rest = 0
    end
    
    if a + b < k
      a_rest = 0
      b_rest = 0
    end
  
  print a_rest," ",b_rest

Measured memory_bytes: 1788
n=int(input())
def make_divisors(n):
  divisors=[]
  for i in range(1,int(n**0.5)+1):
    if n%i==0:
      divisors.append(i)
      if i!=n//i:
        divisors.append(n//i)

  divisors.sort()
  return divisors
ans=0
for i in range(1,n+1):
  if i%2==1 and len(make_divisors(i))==8:
    ans+=1
print(ans)


Measured memory_bytes: 3060
#include<iostream>
using namespace std;
int main()
{
    int a,b;
    cin>>a>>b;
    int c=a+b;
    if(c%2==1){
        int s;
        s=c/2+1;
        cout<<s;
    } 
    else cout<<c/2;
    return 0;
}

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

int main() {
    int N; cin >> N;
    int cnt = 0;
    int a,b;
    string ans = "No";
    for (int i = 0; i < N; i++) {
        cin >> a >> b;
        if (a == b) cnt++;
        else cnt = 0;
        if (cnt >= 3) ans = "Yes";
    }
    cout << ans << endl;
}

Measured memory_bytes: 3604
#include<iostream>

using namespace std;

struct FishPoint{
	int fish_1;
	int fish_2;
	int sum;
};

int main() {
	
	FishPoint hiroshi, kenjiro;
	
	hiroshi.sum = 0;
	kenjiro.sum = 0;
	
	int fish1_point, fish2_point;
	int exfish1_point, exfish2_point;
	
	cin >> hiroshi.fish_1 >> hiroshi.fish_2;
	cin >> kenjiro.fish_1 >> kenjiro.fish_2;
	
	cin >> fish1_point >> fish2_point;
	cin >> exfish1_point >> exfish2_point;
	
	if( hiroshi.fish_1 >= 10)
	hiroshi.sum += ( hiroshi.fish_1 * fish1_point + hiroshi.fish_1 / 10 * exfish1_point);
	
	else
	hiroshi.sum += hiroshi.fish_1 * fish1_point;
	
	if( kenjiro.fish_1 >= 10)
	kenjiro.sum += ( kenjiro.fish_1 * fish1_point + kenjiro.fish_1 / 10 * exfish1_point);
	
	else
	kenjiro.sum += kenjiro.fish_1 * fish1_point;
	
	if( hiroshi.fish_2 >= 20)
	hiroshi.sum += ( hiroshi.fish_2 * fish2_point + hiroshi.fish_2 / 20 * exfish2_point);
	
	else
	hiroshi.sum += hiroshi.fish_2 * fish2_point;
	
	if( kenjiro.fish_2 >= 20)
	kenjiro.sum += ( kenjiro.fish_2 * fish2_point + kenjiro.fish_2 / 20 * exfish2_point);
	
	else
	kenjiro.sum += kenjiro.fish_2 * fish2_point;
	
	if( hiroshi.sum > kenjiro.sum )
	cout << "hiroshi\n";
	
	else if( hiroshi.sum < kenjiro.sum )
	cout << "kenjiro\n";
	
	else
	cout << "even\n";
	
	return 0;
}


Measured memory_bytes: 3076
/*????????¢?????¢?????¨??¨?????????*/
#include <stdio.h>
int main(){
  int a, b, l, s;
  scanf("%d %d", &a, &b);
  s = a * b;
  l = 2 *(a + b);
  printf("%d %d\n", s, l);
  return 0;
}

Measured memory_bytes: 596
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <math.h>
#include <queue>
#include <set>
#include <map>
#include <stack>

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

ll K,N,M;
ll ans;
 
 
int main(){
    cin >>K;
    N = 100;
    while(N<K){
        N*=1.01;
        ans++;
    }
    cout << ans << endl;
    
}


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

int main() {
  char b;
  cin >> b;
  
  if( b == 'A' ){
    cout << "T" << endl;
  }else if( b == 'T' ){
    cout << "A" << endl;
  }else if( b == 'C' ){
     cout << "G" << endl;
  }else{
    cout << "C" << endl;
  }
}

Measured memory_bytes: 256
#include<iostream>
#include <string>
using namespace std;
int main() {
	int n;
	std::string str;
	std::string strI = "I";
	int x = 0, max = 0;
	cin >> n;
	cin >> str;
	for(int i=0;i<n;i++){
		if (str[i] == strI[0]) {
			x++;
			if (x > max) {
				max = x;
			}
		}
		else {
			x--;
		}
	}
	cout << max << endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
template<class T> using vt = vector<T>;
template<class T> using vvt = vector<vt<T>>;
template<class T> using ttt = tuple<T,T>;
using tii = tuple<int,int>;
using vi = vector<int>;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define pb push_back
#define mt make_tuple
#define ALL(a) (a).begin(),(a).end()
#define FST first
#define SEC second
#define DEB cerr<<"!"<<endl
#define SHOW(a,b) cerr<<(a)<<" "<<(b)<<endl
#define DIV int(1e9+7)
const int INF = (INT_MAX/2);
const ll LLINF = (LLONG_MAX/2);
const long double eps = 1e-10;
//const double PI = M_PI; 
inline ll pow(ll x,ll n,ll m){ll r=1;while(n>0){if((n&1)==1)r=r*x%m;x=x*x%m;n>>=1;}return r%m;}
inline ll lcm(ll d1, ll d2){return d1 / __gcd(d1, d2) * d2;}

/* Coding Space. */
int main(){
  int n; cin >> n;
  vi in(n);
  rep(i,n) cin >> in[i];
  sort(ALL(in));
  ll ans = 0;
  rep(i,n){
    if(i == n-1) ans += in[i]/2;
    else ans += in[i];
  }
  cout << ans <<endl;
}

Measured memory_bytes: 256
import java.util.*;

class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
      
    for(int i=1;i<10001;i++){
      if(Math.floor(i*0.1)==b){
        if(Math.floor(i*0.08)==a){
          System.out.println(i);
          return;
        }
      }
    }
    System.out.println(-1);
  }
}

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

int main(){
  int n;
  cin >> n;
  n %= 10;
  if( n == 3 ) cout << "bon";
  else if( n == 0 || n == 1 || n == 6 || n == 8 ) cout << "pon";
  else cout << "hon";
  return 0;
}

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

#define REP(i, x, n) for (int i = x; i < (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x.size())
#define popcount(x) __builtin_popcount(x)
#define popcountll(x) __builtin_popcountll(x)
#define uniq(x) x.erase(unique(x.begin(), x.end()), x.end())
#define F first
#define S second
#define mp make_pair
#define eb emplace_back
#define pii pair<int, int>
#define pll pair<ll, ll>

using namespace std;

typedef long long ll;

/* --- INFの値が適切か確認する --- */
// const int INF = 1 << 30;
// const ll INF = 1LL << 60;
// const int MOD = 1000000007;

int main() {
  string s;
  cin >> s;
  int ans = 1000000000;
  rep(i, s.size()) {
    if (i + 2 < s.size()) {
      int a = (s[i] - '0') * 100 + (s[i + 1] - '0') * 10 + (s[i + 2] - '0');
      ans = min(ans, abs(a - 753));
    }
  }
  cout << ans << endl;
}


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

template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
/*template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}*/

int main(){
  int N,K;
  cin >> N >> K;
  vector<int> h(N);
  for(int i = 0; i < N; i++){
  	int a;
    cin >> a;
    h.at(i) = a;
  }
  const long long INF = 1LL << 60;
  long long dp[100010];
  for(int i = 0; i < 100010; i++){
  	dp[i] = INF;
  }
  dp[0] = 0;
  for(int i = 0; i < N; i++){
    for(int j = 1; j <= K; j++){
      if(i >= j){
      	chmin(dp[i], dp[i-j]+ abs(h[i]-h[i-j]));
      }    	
    }

  }
  
  cout << dp[N-1] << endl;
  
}

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

namespace ABC132
{
    class A
    {
        static void Main(string[] args)
        {
            string S = Console.ReadLine();
            Dictionary<char, int> dic = new Dictionary<char, int>();
            for(int i = 0; i < S.Length; i++)
            {
                if (!dic.ContainsKey(S[i])) dic.Add(S[i], 0);
                dic[S[i]]++;
            }
            string r = "No";
            if (dic.Count == 2 && dic.ElementAt(0).Value == 2) r = "Yes";
            Console.WriteLine(r);
        }
    }
}


Measured memory_bytes: 13280
import java.util.Scanner;

public class Main {
    public static void main(String... args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();

        int money = 100000;
        for (int i = 0; i < n; i++) {
            money *= 1.05;
            if (money % 1000 != 0) {
                money += 1000 - money % 1000;
            }
        }

        System.out.println(money);
    }
}


Measured memory_bytes: 26000
#include <iostream>

int c[3][3];
int main()
{
    for (int i = 0; i < 3; ++i)
        for (int j = 0; j < 3; ++j)
            std::cin >> c[i][j];

    for (int i = 0; i < 2; ++i)
    {
        int temp = c[i][0] - c[i + 1][0];
        for (int j = 1; j < 3; ++j)
            if (c[i][j] - c[i + 1][j] != temp)
            {
                std::cout << "No" << std::endl;
                return 0;
            }
    }

    for (int i = 0; i < 2; ++i)
    {
        int temp = c[0][i] - c[0][i + 1];
        for (int j = 1; j < 3; ++j)
            if (c[j][i] - c[j][i + 1] != temp)
            {
                std::cout << "No" << std::endl;
                return 0;
            }
    }
    std::cout << "Yes" << std::endl;
    return 0;
}


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

using namespace std;
#define ll long long
#define rep(i, a, b) for(int i=a;i<=b;i++)
const int N = 3e5 + 500;
int n, m, p[N], ra[N], dir[N], ans[N];

bool cmp(int x, int y) { return p[x] < p[y]; }

ll s;

int main()
{
  scanf("%d%d%I64d", &n, &m, &s);
  rep(i, 0, n - 1) {
    int ch;
    scanf("%d %d", p + i, &ch);
    ra[i] = i;
    dir[i] = ch == 1 ? 1 : -1;
  }
  sort(ra, ra + n, cmp);
  int t = 0;
  rep(i, 0, n - 1) {
    if(dir[i] == 1) t += (p[i] + s) / m % n;
    else t += (p[i] - s - m + 1) / m % n;
    t = (t % n + n) % n;
    p[i] = p[i] + s % m * dir[i];
    p[i] = (p[i] % m + m) % m;
  }
  sort(p, p + n);
  rep(i, 0, n - 1) ans[ra[(i + n - t) % n]] = p[i];
  rep(i, 0, n - 1) printf("%d%c", ans[i], i == n - 1 ? '\n' : ' ');
  return 0;
}

Measured memory_bytes: 3968
#include<iostream>
#include<vector>
#include<unordered_map>
#include<algorithm>


using namespace std;


int nextA(int preA,int L)
{
	vector<int> digitA;
	for (int i = 0; i < L; ++i)
	{
		digitA.emplace_back(preA % 10);
		preA /= 10;
	}
	sort(digitA.begin(), digitA.end());
	int big = 0;
	int small = 0;
	for (int i = 0; i < L; ++i)
	{
		big *= 10;
		small *= 10;
		big += digitA[i];
		small += digitA[L - i - 1];
	}
	return small - big;
}


int main()
{
	while (true)
	{
		int a, L;
		cin >> a >> L;
		if (a == 0 && L == 0)return 0;

		unordered_map<int, int> mp;

		for (int i = 0;; ++i)
		{
			if (mp.count(a))
			{
				cout << mp[a] << " " << a << " " << i - mp[a] << endl;
				break;
			}
			mp[a] = i;
			a = nextA(a, L);
		}
	}
}


Measured memory_bytes: 3092
from fractions import gcd
N = int(input())
A = list(map(int, input().split()))
dp = [0] * (N+1)
dpr = [0]*(N+1)
for i in range(N):
    dp[i+1] = gcd(dp[i], A[i])
    dpr[N-i-1] = gcd(dpr[N-i],A[N-i-1])
ans = 0
for i in range(N):
    tmp = gcd(dp[i],dpr[i+1])
    ans = max(ans, tmp)
print(ans)

Measured memory_bytes: 89580
#include<bits/stdc++.h>
 
#define hell                         1000000007
#define hell2                        998244353
#define lcm(a,b)                     (a*b)/__gcd(a,b)
#define ll                           long long
#define vll                          vector<ll>
#define pll                          vector< pair<ll,ll> >
#define pb                           push_back
#define all(v)                       v.begin(),v.end()
#define F                            first
#define S                            second
#define rep(i,a,b)                   for(ll i=a;i<b;i++)
#define ret(x)                       return cout<<x,0;
#define endl                           '\n'
 
const ll MAX=200005;
const ll SQN=330;
const ll LG=22;
const double PI=atan(1)*4;
using namespace std;

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

    ll x;
    cin >> x;
    for(ll i=-500;i<=500;i++) {
    	for(ll j=-500;j<=500;j++) {
    		ll val=i*i*i*i*i;
    		val-=(j*j*j*j*j);
    		if(val==x) {
    			cout << i << " " << j << endl;
    			return 0;
    		}
    	}
    }

}

Measured memory_bytes: 3656
n, a, b, c, d = list(map(int, input().split()))
s = input()
if d > c:
    for i in range(a, d-1):
        if s[i-1] == s[i] == "#":
            print("No")
            break
    else:
        print("Yes")
else:
    for i in range(a, c):
        if (s[i-1] == "#") & (s[i] == "#"):
            print("No")
            break
    else:
        for j in range(b-1, d):
            if (s[j-1] == ".") & (s[j] == ".") & (s[j+1] == "."):
                print("Yes")
                break
        else:
            print("No")

Measured memory_bytes: 3572
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<queue>
#include<stack>
#include<vector>
#include<map>
using namespace std;
const int maxn = 1e5+10;

int read(){
	int x=0,f=1;
	char c=getchar();
	while(!isdigit(c)){if(c=='-')f=-1;c=getchar();}
	while(isdigit(c)){x=(x<<3)+(x<<1)+c-48;c=getchar();}
	return x*f;
}

int k,m,n;
struct node{
	int x,id;
	bool operator < (node a){
		return x<a.x;
	}
}a[maxn];
int main(){	
	n=read();
	for(register int i=1;i<=n;i++){a[i].x=read();a[i].id=i;}
	sort(a+1,a+n+1);
	for(register int i=1;i<=n;i++)printf("%d ",a[i].id);puts("");
	return 0;
}

Measured memory_bytes: 1536
#include <bits/stdc++.h>
using namespace std;
 
/*** Template Begins ***/
 
typedef long long   ll;
typedef pair<ll,ll> pll;
typedef long double ld; 
#define rep(i,a,b) for(i=a;i<b;i++)
#define pb           push_back
#define F            first
#define S            second
#define ios          ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define hell   1000000007LL
#define all(a)       (a).begin(),(a).end()
ll power(ll x, ll y, ll p){ ll res = 1;x = x % p;while (y > 0) {if (y & 1) res = (res*x) % p;y = y>>1;
  x = (x*x) % p;} return res;} 

const long double PI = acos(-1);
// Debug //
#define trace(x)                 cerr << #x << ": " << x << endl;
#define trace1(x)                cerr << #x << ": " << x << endl;
#define trace2(x, y)             cerr << #x << ": " << x << " | " << #y << ": " << y << endl;
#define trace3(x, y, z)          cerr << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " << z << endl;
#define trace4(a, b, c, d)       cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << endl;
#define trace5(a, b, c, d, e)    cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl;
#define trace6(a, b, c, d, e, f) cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << " | " << #f << ": " << f << endl;
ll euclid(ll x,ll y,ll a,ll b){
  return (a-x)*(a-x)+(b-y)*(b-y);
}
void solve()
{
  ll n;
  cin>>n;
  std::vector<ll> v(n);
  ll sumxor=0;
  ll i;
  rep(i,0,n)
  {
    cin>>v[i];
    sumxor^=v[i];
  }
  rep(i,0,n)
  {
    cout<<(sumxor^v[i])<<" ";
  }
  
}
int main()
{ 
  ios; 
  // freopen("input.txt", "r", stdin);
  // freopen("output.txt", "w", stdout);
  ll t=1,i=1;
  // sieve();
  // cin>>t;
  while(i<=t)
  {
    solve();
    i++;
  }
  return 0;
}


Measured memory_bytes: 4708
#pragma GCC optimize(3,"Ofast","inline")
#include <iostream>
#include <sstream>
#include <iomanip>
#include <vector>
#include <deque>
#include <list>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <bitset>
#include<string>
#include <numeric>
#include <algorithm>
#include <functional>
#include <iterator>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <complex>
#include <ctime>
using namespace std;
int main()
{

      int n;
      cin>>n;
      int a=n%10;
      if(a==2||a==4||a==5||a==7||a==7||a==9) cout<<"hon";
      if(a==0||a==1||a==6||a==8) cout<<"pon";
      if(a==3) cout<<"bon";
 } 

Measured memory_bytes: 3624
// ALDS1_6_A
#include <iostream>
#include <vector>
using namespace std;

void CountingSort(vector<int> &A, vector<int> &B, int k){
	vector<int> C;
	for(int i=0;i<=k;i++)
		C.push_back(0);

	for(int j=1;j<A.size();j++)
		C[A[j]]++;

	for(int i=1;i<=k;i++)
		C[i] += C[i-1];

	for(int j=A.size()-1;j>0;j--){
		B[C[A[j]]] = A[j];
		C[A[j]]--;
	}
}

int main(){
	int n, num, max = 0;
	vector<int> A, B;

	cin>>n;
	B.resize(n+1);
	A.push_back(0);
	for(int i=1;i<=n;i++){
		cin>>num;
		A.push_back(num);

		if(num > max)
			max = num;
	}
	
	CountingSort(A, B, max);
	for(int i=1;i<=n;i++){
		if(i != 1)
			cout<<" ";

		cout<<B[i];
	}
	cout<<endl;

	return 0;
}

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

using namespace std;

int main(){
    int N, M;
    cin >> N >> M;

    vector<int> s(M), c(M);
    for (int i = 0; i < M; i++){
        cin >> s.at(i) >> c.at(i);
    }

    for (int n = 0; n < 1000; n++){ 
        string n_str = to_string(n);
        int len = (int)(n_str.size());
        bool ok = true;
        if (len != N) ok = false;
        for (int i = 0; i < M; i++){
            if (n_str[s[i]-1] != (char)('0'+c[i])) ok = false;
        }
        if (ok){
            cout << n << endl;
            return 0;
        }
    }

    cout << -1 << endl;

    return 0;
}


Measured memory_bytes: 256
#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::cmp::*;
use std::collections::*;
use std::io::Write;

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), std::io::stderr());
            writeln!(err, "{} = {:?}", e, $e).unwrap()
        })*
    };
}

fn main() {
    let _ = read::<usize>();
    let a = read_vec::<u64>();
    let mut map = HashMap::new();
    for num in a {
        *map.entry(num).or_insert(0) += 1;
    }
    let keys = map.keys().cloned().collect::<Vec<_>>();
    for &key in keys.iter() {
        if map[&key] >= 3 {
            if map[&key] % 2 == 1 {
                *map.get_mut(&key).unwrap() = 1;
            } else {
                *map.get_mut(&key).unwrap() = 2;
            }
        }
    }
    let mut one_count = 0;
    let mut two_count = 0;

    for key in keys {
        if map[&key] == 1 {
            one_count += 1;
        } else {
            assert_eq!(map[&key], 2);
            two_count += 1;
        }
    }

    if two_count % 2 == 0 {
        println!("{:?}", one_count + two_count);
    } else {
        println!("{:?}", one_count + two_count - 1);
    }
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}


Measured memory_bytes: 12540
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define rep2(i, s, n) for (ll i = s; i < (ll)(n); i++)
#define repr(i, n) for (ll i = n; i >= 0; i--)
#define pb push_back
#define COUT(x) cout << (x) << endl
#define COUTF(x) cout << setprecision(15) << (x) << endl
#define ENDL cout << endl
#define DF(x) x.erase(x.begin())  // 先頭文字削除
#define ALL(x) x.begin(), x.end()
#define REVERSE(x) reverse(ALL(x))
#ifdef _DEBUG
#define debug(x) cout << "[debug] " << #x << ": " << x << endl
#else
#define debug(x)
#endif
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
constexpr int INF = 0x3f3f3f3f;
constexpr ll INFL = 0x3f3f3f3f3f3f3f3f;
constexpr double PI = 3.141592653589793238462643383279;
ll getDigit(ll x) {
  return x == 0 ? 1 : log10(x) + 1;
}

signed main() {
  ll N;
  cin >> N;

  vector<ll> L;
  rep(i, N) {
    ll l;
    cin >> l;
    L.pb(l);
  }
  sort(ALL(L));

  ll count = 0;
  rep(i, N) {
    rep2(j, i + 1, N) {
      rep2(k, j + 1, N) {
        if (L[j] - L[i] < L[k] && L[k] < L[i] + L[j]) {
          // debug(i);
          // debug(j);
          // debug(k);
          count++;
        }
      }
    }
  }
  COUT(count);
  return 0;
}

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

int main() {
	int W, H, x, y, r;

	cin >> W >> H >> x >> y >> r;

	if (x + r <= W && x - r >= 0 && y + r <= H && y - r >= 0)cout << "Yes" << endl;
	else cout << "No" << endl;

	return 0;
}


Measured memory_bytes: 3072
#include <iostream>
#include <cstdio>

using namespace std;

int main(void){
	int a[100];
	int n;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a[i];
	}

	for(int i=n-1;i>=0;i--){
		cout<<a[i];
		if(i==0)
			break;
		cout<<" ";
	}
	cout<<endl;

  return 0;
}

Measured memory_bytes: 1160
#include<stdio.h>
#include<string.h>
#include<stdlib.h>

int main(void)
{
	int i,count=0;
	char W[10], T[1000];

	scanf("%s", W);

	scanf("%s", T);

	for (i = 0; i < strlen(T); i++)
	{
		if (('A' <= T[i]) && (T[i] <= 'Z'))
			T[i] = T[i] - 'A' + 'a';
	}

	if (strcmp(T, W) == 0)
		count += 1;

	while (1)
	{
		scanf("%s", T);

		if (strcmp(T, "END_OF_TEXT")==0)
			break;

		for (i = 0; i < strlen(T); i++)
		{
			if (('A' <= T[i]) && (T[i] <= 'Z'))
				T[i] = T[i] - 'A' + 'a';
		}

		if (strcmp(T, W) == 0)
			count += 1;
	}
	printf("%d\n", count);
}


Measured memory_bytes: 2052
#include <iostream>
using namespace std;
int main()
{
    int n,lim;
    long long w[105],v[105],dp[105][100005];
    cin >> n >> lim;
    for (int i=1;i<=n;i++)
    {
        cin >> w[i] >> v[i];
    }
    for (int i=1;i<=lim;i++)
    {
        if (i<w[1]) dp[1][i]=0;
        else dp[1][i]=v[1];
    }
    for (int i=2;i<=n;i++)
    {
        for (int j=1;j<=lim;j++)
        {
            if (j<w[i]) dp[i][j]=dp[i-1][j];
            else dp[i][j]=max(dp[i-1][j-w[i]]+v[i],dp[i-1][j]);
        }
    }
    cout << dp[n][lim];
}

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

int main(){
    string s, t, u;
    while(cin >> s, s != "-"){
        cin >> t >> u;
        string res = "";
        int sp = 0, tp = 0, up = 0;
        bool iss = s[0] == u[0];
        for(; up < u.length(); up++){
            if(s[sp] == u[up]){
                sp++;
            }else{
                while(t[tp] != u[up]){
                    if(iss){
                        res += s[sp++];
                        iss = false;
                    }else{
                        res += t[tp++];
                    }
                }
                if(iss){
                    res += s[sp++];
                    iss = false; // convention
                }
                tp++;
                iss = true;
            }
        }
        s = s.substr(sp), t = t.substr(tp);
        //reverse(s.begin(), s.end()), reverse(t.begin(), t.end());
        if(iss){
            res += s;
            res += t;
        }else{
            res += t;
            res += s;
        }
        cout << res << endl;
    }
    return 0;
}


Measured memory_bytes: 3108
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {
	
    public static void main(String[] args) {

		Set<Integer> mochiSizeSet = new HashSet<>();
		Scanner scan = new Scanner(System.in);
		int mochiNum = scan.nextInt();
        for (int i = 0; i < mochiNum; i++) {
			mochiSizeSet.add(scan.nextInt());
        }
        System.out.print(mochiSizeSet.size());
    }
}


Measured memory_bytes: 21332
N, M = map(lambda x: int(x), input().split(" "))
As = list(map(lambda x: int(x), input().split(" ")))

comp = sum(As)/(4*M)

result = 0
for a in As:
    if a >= comp:
        result += 1

if result >= M:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
int main() {
	int n,m;
	string ic[256],out,log[3]={"Opened by ","Closed by ","Unknown "};
	cin>>n;
	for(int i=0;i<n;i++)cin>>ic[i];
	cin>>m;
	for(int i=0,now=0,co=0;i<m;i++){
		cin>>out;
		for(int j=0;j<n&&co<1;j++)if(ic[j]==out)co=1;
		if(co==1)cout<<log[now]+out<<endl;
		else cout<<log[2]+out<<endl;
		now=(now+co)%2;
		co=0;
	}
}

Measured memory_bytes: 1228
#include <bits/stdc++.h>
using namespace std;
#define FIN ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

int main () {FIN
    
    int a, b;
    cin >> a >> b;
    cout << (a / b) << " " << (a % b) << " " << fixed << setprecision(6) << (((double) a) / b) << "\n";
    return 0;
}


Measured memory_bytes: 3304
//Code By CXY07
#include<bits/stdc++.h>
using namespace std;

//#define FILE
//#define int long long
//#define LL long long
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define fst first
#define scd second
#define inv(x) ksm(x,mod - 2)

const int MAXN = 1;
const int INF = 2e9;
const int G = 3;
const double PI = acos(-1);
//const int mod = 1e9 + 7;
//const int mod = 998244353;

int n;

template<typename T> inline void read(T &a) {
	a = 0; char c = getchar(); int f = 1;
	while(c < '0' || c > '9') {if(c == '-') f = -1; c = getchar();}
	while(c >= '0' && c <= '9') {a = a * 10 + (c ^ 48); c = getchar();}
	a *= f;
}

signed main () {
#ifdef FILE
	freopen(".in","r",stdin);
	freopen(".out","w",stdout);
#endif
	read(n);
	if(n >= 30) puts("Yes");
	else puts("No");
	return 0;
}



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

using namespace std;

#define ll long long




void solve() {

	int n;
	cin >> n;
	map<string, int> mp;
	while(n--) {
		string s;
		cin >> s;
		mp[s]++;
	}
	vector<string> v = {"AC", "WA", "TLE", "RE"};
	for(auto x: v) {
		cout << x << " x " << mp[x] << "\n";
	}

	




	
}

int main() {

	ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	solve();

	return 0;
}

Measured memory_bytes: 3660
import std.stdio;
import std.string;
import std.conv;
import std.typecons;
import std.algorithm;
import std.functional;
import std.bigint;
import std.numeric;
import std.array;
import std.math;
import std.range;
import std.container;
import std.ascii;
import std.concurrency;
void times(alias fun)(int n) {
    foreach(i; 0..n) fun();
}
auto rep(alias fun, T = typeof(fun()))(int n) {
    T[] res = new T[n];
    foreach(ref e; res) e = fun();
    return res;
}

long MOD = 10L^^9+7;
void main() {
    readln.chomp.to!long.iota.map!"a+1".fold!(
        (a, b) => a*b%MOD
    )(1L).writeln;
}

// ----------------------------------------------

// fold was added in D 2.071.0
static if (__VERSION__ < 2071) {
    template fold(fun...) if (fun.length >= 1) {
        auto fold(R, S...)(R r, S seed) {
            static if (S.length < 2) {
                return reduce!fun(seed, r);
            } else {
                return reduce!fun(tuple(seed), r);
            }
        }
    }
}

// minElement/maxElement was added in D 2.072.0
static if (__VERSION__ < 2072) {
    auto minElement(alias map, Range)(Range r)
    if (isInputRange!Range && !isInfinite!Range)
    {
        alias mapFun = unaryFun!map;
        auto element = r.front;
        auto minimum = mapFun(element);
        r.popFront;
        foreach(a; r) {
            auto b = mapFun(a);
            if (b < minimum) {
                element = a;
                minimum = b;
            }
        }
        return element;
    }
    auto maxElement(alias map, Range)(Range r)
    if (isInputRange!Range && !isInfinite!Range)
    {
        alias mapFun = unaryFun!map;
        auto element = r.front;
        auto maximum = mapFun(element);
        r.popFront;
        foreach(a; r) {
            auto b = mapFun(a);
            if (b > maximum) {
                element = a;
                maximum = b;
            }
        }
        return element;
    }
}


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

int main(){
  int N,S ;
  cin >> N;
  S = 0;
  
    for(int i = 0; i < N; i++){
	
    int l, r;
    cin >> l >> r;
      
    S += r - l + 1;
    }
  
  cout << S << endl;
}

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


int main(){
    int n;
    cin >> n;
    bool dif = true;
    vector<int> v(n);
    rep(i,n){
        cin >> v.at(i);
    }
    sort(v.begin(),v.end());
    rep(i,n-1){
        if(v.at(i) == v.at(i+1)) dif = false;
    }
    if(dif) cout << "YES" << endl;
    else cout << "NO" << endl;
}

Measured memory_bytes: 1024