akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
#define MAXN 100009
#define INF 1000000007
#define mp(x,y) make_pair(x,y)
#define all(v) v.begin(),v.end()
#define pb(x) push_back(x)
#define wr cout<<"----------------"<<endl;
#define ppb() pop_back()
#define tr(ii,c) for(__typeof((c).begin()) ii=(c).begin();ii!=(c).end();ii++)
#define ff first
#define ss second
#define my_little_dodge 46
#define debug(x)  cerr<< #x <<" = "<< x<<endl;
using namespace std;

typedef long long ll;
typedef pair<int,int> PII;
template<class T>bool umin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
template<class T>bool umax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
PII arr[MAXN];
set<PII>l,r;
int main(){
    //~ freopen("file.in", "r", stdin);
    int n;
    scanf("%d",&n);
	for(int i=0;i<n;i++){
		int x,y;
		scanf("%d%d",&x,&y);
		arr[i]=mp(x,y);
	}
	for(int i=0;i<n;i++){
		r.insert(mp(arr[i].ss,i));
		l.insert(mp(arr[i].ff,i));
	}
	ll a=0,b=0;
	int now=0;
	for(int i=0;i<n;i++){
		if(i%2==0){
			PII res=*l.rbegin();
			if(now<res.ff){
				a+=res.ff-now;
				now=res.ff;
				l.erase(res);
				r.erase(mp(arr[res.ss].ss,res.ss));
			}
		}
		else{
			PII res=*r.begin();
			if(res.ff<now){
				a+=now-res.ff;
				now=res.ff;
				r.erase(res);
				l.erase(mp(arr[res.ss].ff,res.ss));
			}
		}
	}a+=abs(now);
	now=0;l.clear();r.clear();
	for(int i=0;i<n;i++){
		r.insert(mp(arr[i].ss,i));
		l.insert(mp(arr[i].ff,i));
	}
	for(int i=0;i<n;i++){
		if(i&1){
			PII res=*l.rbegin();
			if(now<res.ff){
				b+=res.ff-now;
				now=res.ff;
				l.erase(res);
				r.erase(mp(arr[res.ss].ss,res.ss));
			}
		}
		else{
			PII res=*r.begin();
			if(res.ff<now){
				b+=now-res.ff;
				now=res.ff;
				r.erase(res);
				l.erase(mp(arr[res.ss].ff,res.ss));
			}
		}
	}b+=abs(now);
	printf("%lld\n",max(a,b));
	return 0;
}


Measured memory_bytes: 10416
/* You lost the game. */
 
#include <list>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <cfloat>
#include <numeric>
#include <cassert>
#include <unordered_set>
#include <unordered_map>
#include <fstream>
#include <vector>
#include <pthread.h>
 
#define fin(i,n) for (int i = (L) 0; i < n; i++)
#define fin2(i,a,b) for (int i = a; i < b; i++)
 
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define mod 1000000007
#define PI 3.1415926535897932384626
 
#define si(n) scanf("%d", &n)
#define sii(n,m) scanf("%d %d", &n, &m)
#define siii(n,m,k) scanf("%d %d %d", &n, &m, &k)
#define sl(n) scanf("%lld", &n)
#define sll(n,m) scanf("%lld %lld", &n, &m)
#define slll(n,m,k) scanf("%lld %lld %lld", &n, &m, &k)
#define sd(n) scanf("%lf", &n)
#define sdd(n,m) scanf("%lf %lf", &n, &m)
#define sddd(n,m,k) scanf("%lf %lf %lf", &n, &m, &k)
#define sc(c) scanf("%c", &c)
#define ss(s) scanf("%s", s)
#define sai(t,n) fin(i,n) { scanf("%d", &t[i]); }
#define sal(t,n) fin(i,n) { scanf("%lld", &t[i]); }
#define sad(t,n) fin(i,n) { scanf("%lf", &t[i]); }
 
#define pc(n) printf("%c\n", n)
#define ps(s) printf("%s\n", s)
#define pi(n) printf("%d\n", n)
#define pii(n,m) printf("%d %d\n", n, m)
#define pl(n) printf("%lld\n", n)
#define pll(n,m) printf("%lld %lld\n", n, m)
#define plll(n,m,k) printf("%lld %lld %lld\n", n, m, k)
#define pd(n) printf("%lf\n", n)
#define pdd(n,m) printf("%lf %lf\n", n, m)
#define pai(t,n) fin(i,n) { printf("%d ", t[i]); } printf("\n")
#define pal(t,n) fin(i,n) { printf("%lld ", t[i]); } printf("\n")
#define pad(t,n) fin(i,n) { printf("%lf ", t[i]); } printf("\n")

#define OK ps("OK")
#define OK1 ps("OK1")
#define OK2 ps("OK2")
 
#define L long long int
#define D double
#define C char
#define PII pair<int, int>
#define VPII vector<PII>
#define VL vector<L>
#define VI vector<int>
#define VVI vector<VI>
#define VD vector<D>
#define VVD vector<VD>
#define VVPII vector<VPII>
#define VC vector<C>
 
using namespace std;

int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int n, m, t;
    map<int, int> tb;
    si(n);
    fin(i, n) { si(t); if (tb.find(t) == tb.end()) { tb[t] = 1; } else { tb[t]++; } }
    si(m);
    fin(i, m) {
        si(t);
        if (tb.find(t) == tb.end()) { ps("NO"); return 0; }
        else if (tb[t] == 0) { ps("NO"); return 0; }
        else { tb[t]--; }
    }
    ps("YES");
    return 0;
}

Measured memory_bytes: 9600
/*** author: yuji9511 ***/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using lpair = pair<ll, ll>;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i=(m);i<(n);i++)
#define rrep(i,m,n) for(ll i=(m);i>=(n);i--)
#define printa(x,n) for(ll i=0;i<n;i++){cout<<(x[i])<<" \n"[i==n-1];};
void print() {}
template <class H,class... T>
void print(H&& h, T&&... t){cout<<h<<" \n"[sizeof...(t)==0];print(forward<T>(t)...);}

void solve(){
    ll N,D;
    cin >> N >> D;
    ll X[200010], Y[200010];
    rep(i,0,N) cin >> X[i] >> Y[i];
    ll ans = 0;
    rep(i,0,N){
        if(X[i] * X[i] + Y[i] * Y[i] <= D * D) ans++;
    }
    print(ans);
    

}

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

Measured memory_bytes: 6776
use proconio::input;

fn main() {
    input!{
        k: usize,
        a: usize,
        b: usize,
    }
    let mut s = "NG";
    for i in a..=b {
        if i % k == 0 {
            s = "OK";
            break;
        }
    }
    println!("{}", s);
}


Measured memory_bytes: 2104
n, m = map(int, input().split())

import math
gs = []
for i in range(1, int(math.sqrt(m))+1):
  if m%i == 0:
    gs.append(i)
    if i != m//i:
      gs.append(m//i)

gs.sort(reverse=True)

#print(gs)
for j in gs:
  if m//j >= n:
    print(j)
    exit()

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

using namespace std;

int main()
{
	int n;
	string s, t;
	cin >> n >> s >> t;
	for(int i = n; i >= 0; i--)
		if (s.substr(n - i) == t.substr(0, i))
			return cout << n*2-i << endl, 0;
	return 0;
}

Measured memory_bytes: 256
N, M, C = map(int, input().split())
B = list(map(int, input().split()))
A = [list(map(int, input().split())) for _ in range(N)]

cnt = 0
for i in range(N):
    tmp = 0
    for j in range(M):
        tmp += A[i][j] * B[j]
    if tmp + C > 0:
        cnt += 1

print(cnt)

Measured memory_bytes: 38256
#include<iostream>
#include<algorithm>
#include<cmath>
#include<map>
#include<string>
#include<set>
#include<vector>
using namespace std;

#define printYesNo(condition) cout << (condition ? "Yes" : "No") << endl

int solve(){
  int n, m; cin >> n >> m;
  printYesNo(n==m);
  return 0;
}

int main(){
  solve();
  return 0;
}


Measured memory_bytes: 256
console.log(function(args){
  const [[N,K],[...p]] = args.trim().split('\n').map( r=>r.split(' ').map( v=>v|0 ) );
  p.sort((a,b)=>a-b);
  return p.slice(0,K).reduce((a,b)=>a+b,0).toString();
}(require('fs').readFileSync('/dev/stdin', 'utf8')));


Measured memory_bytes: 29752
#include "bits/stdc++.h"

// Begin {{{
using namespace std;
#define all(x) x.begin(), x.end()
#define rep(i, n) for (i64 i = 0, i##_limit = (n); i < i##_limit; ++i)
#define reps(i, b, e) for (i64 i = (b), i##_limit = (e); i <= i##_limit; ++i)
#define repr(i, b, e) for (i64 i = (b), i##_limit = (e); i >= i##_limit; --i)
#define var(Type, ...) Type __VA_ARGS__; input(__VA_ARGS__)
using i64 = int_fast64_t;
using pii = pair<i64, i64>;
template <class T>
using MaxHeap = priority_queue<T>;
template <class T>
using MinHeap = priority_queue<T, vector<T>, greater<>>;
template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }
inline i64 sigma(i64 n) { return n * (1 + n) >> 1; }
inline i64 updiv(i64 n, i64 d) { return (n + d - 1) / d; }
constexpr int INF = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int MOD = int(1e9) + 7;
#ifndef DEBUG
#define dump(...)
#endif

inline void input() {}
template <class Head, class... Tail>
inline void input(Head&& head, Tail&&... tail) {
  cin >> head;
  input(forward<Tail>(tail)...);
}

inline void outs() { cout << "\n"; }
template <class Head, class... Tail>
inline void outs(Head&& head, Tail&&... tail) {
  cout << head << (sizeof...(tail) ? " " : "");
  outs(forward<Tail>(tail)...);
}

template <class T>
inline void outs(vector<T> &vec) { for (auto &e : vec) cout << e << " \n"[&e == &vec.back()]; }

template <class T>
inline void outs(vector<vector<T>> &df) { for (auto &vec : df) outs(vec); }

inline void outl() { cout << "\n"; }
template <class Head, class... Tail>
inline void outl(Head&& head, Tail&&... tail) {
  cout << head << (sizeof...(tail) ? "\n" : "");
  outl(forward<Tail>(tail)...);
}

template <class T>
inline void outl(vector<T> &vec) { for (auto &e : vec) cout << e << "\n"; }

inline void outn() {}
template <class Head, class... Tail>
inline void outn(Head&& head, Tail&&... tail) {
  cout << head;
  outn(forward<Tail>(tail)...);
}

template <class T>
inline void outn(vector<T> &vec) { for (auto &e : vec) cout << e; }

template <class T>
inline vector<T> make_v(const T &initvalue, size_t sz) {
  return vector<T>(sz, initvalue);
}

template <class T, class... Args>
inline auto make_v(const T &initvalue, size_t sz, Args... args) {
  return vector<decltype(make_v<T>(initvalue, args...))>(sz, make_v<T>(initvalue, args...));
}
// }}} End

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

  var(string, s);

  rep(i, s.length() - 1) {
    if (s[i] == s[i+1]) {
      outl(i + 1, i + 2);
      return 0;
    }
  }

  rep(i, s.length() - 2) {
    if (s[i] == s[i+2]) {
      outl(i + 1, i + 3);
      return 0;
    }
  }

  outs(-1, -1);

  return 0;
}


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

using namespace std;

#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)
#define unless(p) if(!(p))
#define until(p) while(!(p))

using ll = long long;
using P = std::tuple<int,int>;

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

string S;
int x, y, ax;
vector<int> vx, vy;
bool dp[8010][16020];

bool solve(vector<int> v, int z, int az){
    memset(dp, 0, sizeof(dp));

    dp[0][az+8000] = true;

    int n = v.size();

    for(int i=0;i<n;++i){
        for(int j=-8000;j<=8000;++j){
            if(-8000 <= j + v[i] && j + v[i] <= 8000){
                dp[i+1][j+v[i]+8000] |= dp[i][j+8000];
            }
            if(-8000 <= j - v[i] && j - v[i] <= 8000){
                dp[i+1][j-v[i]+8000] |= dp[i][j+8000];
            }            
        }
    }

    return dp[n][z+8000];
}

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

    std::cin >> S;
    std::cin >> x >> y;

    int N = S.size();

    int i = 0, j;
    while(i < N && S[i] == 'F'){
        ++i;
    }
    ax = i;
    
    j = i;
    
    int direction = 0;
    for(;i<N;i=j){
        int t_cnt = 0;
        while(j < N && S[j] == 'T'){
            ++t_cnt;
            ++j;
        }

        if(t_cnt % 2 == 1){
            direction = !direction;
        }

        i = j;
        while(j < N && S[j] == 'F'){
            ++j;
        }

        int f_cnt = j - i;

        if(direction == 1){
            vy.emplace_back(f_cnt);
        }else{
            vx.emplace_back(f_cnt);
        }
    }

    // for(int x : vx){
    //     std::cout << x << std::endl;
    // }
    // std::cout << "--" << std::endl;
    // for(int y : vy){
    //     std::cout << y << std::endl;
    // }

    bool flag = solve(vx, x, ax);
    flag &= solve(vy, y, 0);
    if(flag){
        std::cout << "Yes" << std::endl;
    }else{
        std::cout << "No" << std::endl;
    }
}


Measured memory_bytes: 125568
using System;
using System.Collections.Generic;
using System.Linq;

namespace ConsoleApp3
{
    class Program
    {
        static void Main(string[] args)
        {
            List<int[]> dice = new List<int[]>();
            string ans = "";
            for (int i = 0; i < 2; i++)
            {
                int[] dice1 = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
                dice.Add(dice1);
            }

            for (int j = 0; j < 6; j++)
            {
                int dir = 0;
                if (dice[0][0] == dice[1][j]) dir = j;
                else if (!(dice[0].Contains(dice[1][j])))
                {
                    ans = "Yes"; break;
                }
                else continue;

                int d = dice[1][5 - dir];
                dice[1][5 - dir] = dice[1][0];
                dice[1][0] = dice[1][dir];
                dice[1][dir] = dice[1][5];
                dice[1][5] = d;

                if (dir == 5)
                {
                    int d2 = dice[1][2];
                    dice[1][2] = dice[1][3];
                    dice[1][3] = d2;
                }

                int[] side = { dice[1][1], dice[1][2], dice[1][4], dice[1][3], dice[1][1], dice[1][2] };
                for (int k = 0; k < 4; k++)
                {
                    if (side[k] == dice[0][1])
                    {
                        if (side[k + 1] == dice[0][2] && side[k + 2] == dice[0][4] && dice[1][5] == dice[0][5])
                        {
                            ans = "Yes"; break;
                        }
                        else
                            ans = "No";
                    }
                    else if (!(side.Contains(dice[0][1])))
                    {
                        ans = "Yes";
                    }
                }
            }
            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 18436
#include <bits/stdc++.h>
using namespace std;
int main() {
 int a, b, c, d;
  cin >> a >> b >> c >> d;
  for(int i=0;i<d;i++){
   if(a>=b) b*=2;
   else c*=2;
  }
  if(c>b&&b>a) cout << "Yes"<< endl;
  else cout << "No" << endl;
}


Measured memory_bytes: 3616
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class MainClass
{
	public static void Main(string[] args)
	{
		string[] input = Console.ReadLine().Split(' ');
		int a = int.Parse(input[0]);
		int b = int.Parse(input[1]);
		Console.WriteLine(Math.Max(a+(a-1),Math.Max(a+b,b+(b-1))));
	}

	public static int Clamp(int val, int max, int min = 0)
	{
		return Math.Min(max, Math.Max(min, val));
	}


}

Measured memory_bytes: 11092
import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def dp2(ini, i, j): return [[ini]*i for i2 in range(j)]
#import bisect #bisect.bisect_left(B, a)
#from collections import defaultdict #d = defaultdict(int) d[key] += value
#from collections import Counter # a = Counter(A).most_common()
#from itertools import accumulate #list(accumulate(A))

N, K = mi()
A = li()


for i in range(K, N):
    if A[i] > A[i-K]:
        print('Yes')
    else:
        print('No')

Measured memory_bytes: 31572
import java.util.Scanner;

public class Main {
	public static void main(String[]args){
		//????????£????????????
		Scanner sc = new  Scanner(System.in);
		//??¨ ?????° ???
		int r = sc.nextInt();
		//??¨ ?????° ???
		int c= sc.nextInt();
		//??¨?????????
		int [][] table = new int [r+1][c+1];
		int i =0;
		int j = 0;
		for(i =0; i<r;i++){
			for(j =0;j<c;j++){
				//??¨?????????????´?
				table[i][j] = sc.nextInt();
			}
		}
		//
		for(i =0;i<r;i++){
			for(j=0;j<c;j++){
				table[i][c] += table[i][j];
				table[r][j] += table[i][j];
				table[r][c]+= table[i][j];
			}
		}
		//??¨?????????
		for(i= 0; i<=r; i++){
			System.out.print(table[i][0]);
			for(j =1;j<=c;j++){
				System.out.print(" " +table[i][j]);
			}
		System.out.println();
		}
	}
}

Measured memory_bytes: 42020
import sys
read=sys.stdin.read
readline=sys.stdin.readline

def isinsums(x,lst):
  s=sum(lst)
  t=(s+x)//2
  if s==0 and x==0:
    return True
  if (s-x)%2 or t<0:
    return False
  t=(s+x)//2
  m1=(1<<(t+1))-1
  m2=1<<t
  sums=0
  for e in lst:
    sums=(sums|(1+sums)<<e)&m1
  sums|=1
  if (sums)&m2>0:
    return True
  return False

s=readline().strip()
x,y=map(int,readline().split())

s=s.replace('TF','T F')
s=s.replace('FT','F T')
bs=s.split()
if bs[0][0]=='F':
  x-=len(bs[0])
  del bs[0]

xy=[[],[]]
f=0
for i,e in enumerate(bs):
  if not i%2:
    l=len(e)
  else:
    f^=l%2
    xy[f].append(len(e))
if isinsums(x,xy[0]) and isinsums(y,xy[1]):
  print('Yes')
else:
  print('No')


Measured memory_bytes: 9448
import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = float('inf')
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def resolve():
    N, M = LI()
    AB = [LI() for _ in range(N)]
    AB.sort()

    ans = 0
    for a, b in AB:
        if M >= b:
            M -= b
            ans += a * b
        else:
            ans += a * M
            break

    print(ans)

if __name__ == '__main__':
    resolve()


Measured memory_bytes: 26924
#include <stdio.h>
int main()
{
 int W,H,x,y,r;
  scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);
  if(0 <= (x-r) && (x+r) <= W && 0 <= (y-r) && (y+r) <= H)
  printf("Yes\n");
  else
  printf("No\n");

  return 0;
}

Measured memory_bytes: 2676
#include<bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); 
#define pi 3.1415926535897
#define ll long long int
#define ld long double
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define mod 1000000007
#define mod1 998244353
#define inf 1000000000000000000
#define inf1 1000000000
#define endl '\n'
ll arr[105];
ll dp[100005];
int main()
{
	fastio;
	#ifdef APNA_IO
		freopen("input.txt" , "rt" ,stdin);
		freopen("output.txt" , "wt" ,stdout);
	#endif
	ll n,k;
	cin>>n>>k;
	for(ll i=0;i<n;i++)
		cin>>arr[i];
	for(ll i=0;i<arr[0];i++)
		dp[i]=2;
	dp[arr[0]]=1;
	for(ll i=arr[0]+1;i<=k;i++)
	{
		bool m=false;
		for(ll j=0;j<n;j++)
		{
			if(i-arr[j]<0)
				break;
			else
			{
				if(dp[i-arr[j]]==2)
					m=true;
			}
		}
		if(m)
			dp[i]=1;
		else
			dp[i]=2;
	}
	if(dp[k]==1)
		cout<<"First"<<endl;
	else
		cout<<"Second"<<endl;
	return 0;
}

Measured memory_bytes: 1024
n = int(input())
a = list(map(int, input().split()))
if min(a) >= 0:
    print(n - 1)
    for i in range(n - 1):
        print(i + 1, i + 2)
elif max(a) <= 0:
    print(n - 1)
    for i in range(n - 1):
        print(n - i, n - i - 1)
else:
    print(2 * n - 1)
    if abs(min(a)) <= abs(max(a)):
        idx = a.index(max(a))
        for i in range(n):
            print(idx + 1, i + 1)
        for i in range(n - 1):
            print(i + 1, i + 2)
    else:
        idx = a.index(min(a))
        for i in range(n):
            print(idx + 1, i + 1)
        for i in range(n - 1):
            print(n - i, n - i - 1)

Measured memory_bytes: 3064
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <numeric> // accumulate(v.begin(), v.end(), 0)

using namespace std;
#define ll long long

ll A[101][101];
bool B[101][101];

int main(){
  int N;
  cin >> N;
  vector<int> X(N), Y(N);
  vector<ll> H(N);
  for(int i=0; i<101; i++)
    for(int j=0; j<101; j++)
      B[i][j] = true;
  for(int n=0; n<N; n++) {
    cin >> X[n] >> Y[n] >> H[n];
  }
  for(int t=0; t<2; t++) {
    for(int n=0; n<N; n++) {
      for(int i=0; i<101; i++) {
	for(int j=0; j<101; j++) {
	  if(B[i][j]) {
	    if(H[n] == 0) {
	      if(A[i][j] != 0 && A[i][j] > H[n] + abs(X[n] - i) + abs(Y[n] - j))
		B[i][j] = false;
	    } else if(A[i][j] == 0)
	      A[i][j] = H[n] + abs(X[n] - i) + abs(Y[n] - j);
	    else if(A[i][j] != H[n] + abs(X[n] - i) + abs(Y[n] - j))
	      B[i][j] = false;
	  }
	}
      }
    }
  }
  bool done = false;
  for(int i=0; i<101; i++) {
    for(int j=0; j<101; j++) {
      if(B[i][j]) {
	cout << i << ' ' << j << ' ' << A[i][j] << endl;
	done = true;
	break;
      }
    }
    if(done) break;
  }
  return 0;
}


Measured memory_bytes: 384
from math import sqrt

n = int(input())

ans = 0
for i in range(1,n+1):
    count = 1
    if i % 2 == 0:
        continue
    for k in range(1,i):
        if i % k == 0:
            count += 1
    if count == 8:
        ans += 1
print(ans)


Measured memory_bytes: 2940
open Batteries
open Printf

let () =
  let n = Scanf.scanf "%d " (fun a -> a) in
  let a_lst = Array.to_list @@ Array.init n (fun _ -> Scanf.scanf "%d " (fun a -> a)) in

  let rev_cumsum l =
    let rec aux last res = function
      | [] -> res
      | hd :: tl -> 
        let last = last + hd in
        aux last (last::res) tl
    in
    aux 0 [] l
  in

  let l = List.rev (rev_cumsum a_lst) in
  let arr = Array.of_list l in

  let rec aux arr i j init last =
    let cur = arr.(i) in
    let next = arr.(i+1) in
    if i < n-2 then
      if abs((last - cur) - (cur - init)) > abs((last - next) - (next - init)) then
        aux arr (i+1) n init last
      else i, (cur - init), (last - cur)
    else i, (cur - init), (last - cur)
  in

  let ans = ref max_int in
  let rec loop i arr left_i right_i =
    let len = Array.length arr in
    if i < len-1 then 
      let left_i,s1,s2 = aux arr left_i i 0 arr.(i-1) in
      let right_i,s3,s4 = aux arr right_i (len-i) arr.(i-1) arr.(len-1) in
      let tmp =
        List.max [s1;s2;s3;s4] - List.min [s1;s2;s3;s4] 
      in
      if !ans < tmp then () else ans := tmp;
      loop (i+1) arr left_i (right_i)
    else ()
  in
  loop 2 arr 0 0;
  printf "%d\n" !ans;


Measured memory_bytes: 16640
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <cstdlib>
#include <ctime>
using namespace std;
typedef long long LL;

string str;
int main()
{
	cin>>str;
	if(str[0]==str[2])
		cout<<"Yes"<<endl;
	else
		cout<<"No"<<endl;
 return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
using namespace std;
//using ll=long long;
const double EPS = 1e-10;
inline bool equals(double a, double b) { return fabs(a - b) < EPS; }
const double PI = 3.141592653589793238;
class Point {
public:
	double x, y;
	Point(double x, double y) :x(x), y(y) {}
	Point() {}
	Point operator +(const Point &p) const{ return Point(x + p.x, y + p.y); };
	Point operator -(const Point &p) const{ return Point(x - p.x, y - p.y); }
	Point operator *(double k) { return Point(x*k, y*k); }
	Point operator /(double k) { return Point(x / k, y / k); }
};

using Vector = Point;
inline double norm(Vector a) {
	return a.x*a.x + a.y*a.y;
}
double absv(Vector a) {
	return sqrt(norm(a));
}
inline double dot(Vector a, Vector b) {
	return a.x*b.x + a.y*b.y;
}
inline double cross(Vector a, Vector b) {
	return a.x*b.y - a.y*b.x;
}
struct Segment {
	Point p1, p2;
};

using Line = Segment;
class Circle {
public:
	Point c;
	double r;
	Circle(Point c = Point(), double r = 0.0) :c(c), r(r) {}
};
using Polygon = vector<Point>; 
Point project(Segment s, Point p) {
	Vector base = s.p2 - s.p1;
	double r = dot(p - s.p1, base) / norm(base);
	return s.p1 + base*r;
}
Point reflect(Segment s, Point p) {
	return p + (project(s, p) - p)*2.0;
}
int main() {
	int x[2], y[2];
	int q, a, b;
	cin >> x[0] >> y[0] >>x[1] >> y[1];
	Segment seg = { Point(x[0],y[0]),Point(x[1],y[1]) };
	cin >> q;
	for (int i = 0; i < q; i++) {
		cin >> a >> b;
		Point p = Point(a, b);
		Point rp = reflect(seg, p);
		printf("%.10lf %.10lf\n", rp.x, rp.y);
	}
}

Measured memory_bytes: 3228
import java.lang.Math.*

fun main(args:Array<String>):Unit {
    while (true){
        val arg = readLine()!!.trim().split(' ').map(String::toInt)
        if (arg.all{it == 0}) return
        val (b, r, g) = arg.take(3)
        val (c, s, t) = arg.takeLast(3)
        println(100 + b * 15 + b * 5 * 16 + r * 15 + r * 3 * 16 + g * 7 + c * 2 + s * 3 - 3 * t)
    }
}



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

#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define REP(i, n)  for(int i=0;i<(n);++i)
#define REPr(i, n) for(int i=(n)-1;i>=0; --i)
#define FORq(i, m, n) for(int i = (m);i <= (n);++i)
#define FORqr(i, m, n) for(int i = (n);i >=(m);--i)
#define PB push_back
#define MP make_pair
#define DEBUG printf("%s\n","debug")
#define fst first
#define snd second
#define SIN(x, S) (S.count(x) != 0)
#define M0(x) memset(x,0,sizeof(x))
#define FILL(x, y) memset(x,y,sizeof(x))
#define MM(x) memset(x,-1,sizeof(x))
#define ALL(x) (x).begin(),(x).end()
using namespace std;
typedef pair<int, int> PII;
typedef pair<long long, long long> PLL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<long long> VL;
typedef long long ll;
typedef long long integer;
///////////////////////////////////////////////
const ll MOD = 1000000007;

ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }

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;
	cin >> N;
	ll count = 0;
	ll ans = 0;
	ll endA = 0;
	ll startB = 0;
	ll AandB = 0;

	static string s[10002] = {};
	REP(i,N){
	    cin >> s[i];
	}

	REP(i,N){
		string nowS = s[i];
		int l = nowS.length();

		REP(j,l-1){
		    if ((nowS[j] == 'A') and (nowS[j+1] == 'B')) count++;
		}

		if ((nowS[0] == 'B') and (nowS[l-1] == 'A')){
			AandB++;
			continue;
		}
		if (nowS[0] == 'B') startB++;
		if (nowS[l-1] == 'A') endA++;

	}

	if (AandB == 0){
		ans = min(endA,startB);
	}else if((endA==0) and (startB==0)){
		ans = AandB - 1;
	}else if ((endA == 0) or (startB == 0)){
		ans = AandB;
	}else{
		ans = AandB + 1 + min(endA - 1,startB - 1);
	}




	cout << ans + count << "\n";
}


Measured memory_bytes: 768
n,m=map(int,input().split())
x = [tuple(map(int, input().split())) for _ in range(n)]
from itertools import *
res = 0
for a in product([-1, 1], [-1, 1], [-1, 1]):
    ts = (sum(i*j for i,j in zip(a,t)) for t in x)
    s = sum(sorted(ts,reverse=True)[:m])
    res = max(res, s)
print(res)


Measured memory_bytes: 3284
#include <stdio.h>

int Pre[40];
int In[40];

void walk(int begin, int end, int *pos) {
	int i;
	if (begin <= end){
		i = begin;
		while (In[i] != Pre[*pos]) i++;
		(*pos)++;
		walk(begin, i - 1, pos);
		(*pos)++;
		walk(i + 1, end, pos);
		printf("%d", In[i]);
		if (In[i] != Pre[0]) printf(" ");
	} else (*pos)--;
}

int main() {
	int i, n, pos;

	scanf("%d", &n);

	for (i = 0; i < n; i++) scanf("%d", &Pre[i]);
	for (i = 0; i < n; i++) scanf("%d", &In[i]);

	pos = 0;
	walk(0, n - 1, &pos);
	printf("\n");

	return 0;
}


Measured memory_bytes: 1852
#include<bits/stdc++.h>
using namespace std;
#define deb(x)   cout<<"> "<<#x<<" : "<<x<<endl;
#define deb2(x,y)cout<<"> "<<#x<<"->"<<x<<"  "<<#y<<"->"<<y<<endl;
#define LINE   cout << "--- LINE NO : " << __LINE__ <<"  ---"<< endl;
#define pnr(a)   for(auto x:a){cout<<x<<" ";}cout<<endl;
#define pnr2(a)  for(auto x:a){cout<<x.first<<" "<<x.second<<endl;}

#define  vt            vector
#define  ff            first
#define  ss            second
#define  int           long long
#define  db            long double
#define  umap          unordered_map
#define  pii           pair<int,int>
#define  Maxpq(x)      priority_queue<x>
#define  Minpq(x)      priority_queue<x,vt<x>,greater<x>>

#define  endl          "\n"
#define  pb            push_back
#define  si(x)         (int)x.size()
#define  all(x)        x.begin(),x.end()
#define  rall(x)       x.rbegin() ,x.rend()
#define  mem(a,x)      memset(a,x,sizeof(a))
#define  FOR(a)        for(auto& x :  a )
#define  forr(i,n)     for(int i=0;i<n;i++)

#define  pi            2*acos(0.0)
#define  inf           (int)1e18
#define  mxn           (int)2e5+5
#define  mod           (int)1e9+7

bool cmp(pii &a , pii &b) {
	if (a.ff < b.ff)return true;
	if (a.ff == b.ff )return a.ss < b.ss;
	return false;
}

int mainx() {
	int n;
	cin >> n;
	int a[n];
	for (int i = 0 ; i < n ; i++)
		cin >> a[i];

	sort(a , a + n);

	int ans = 0;
	for (int i = 0 ; i < n - 2 ; i++)
	{
		for (int j = i + 1 ; j < n - 1 ; j++)
		{
			for (int k = j + 1 ; k < n ; k++)
			{
				if (a[k] < a[i] + a[j]  and a[i] != a[j]  and a[j] != a[k]  and a[i] != a[k])
					ans++;
			}
		}
	}
	cout << ans << endl;

	return 0;
}


inline void INCLUDE() {
#ifndef ONLINE_JUDGE
	freopen("in.txt", "r", stdin);
//freopen("out.txt","w",stdout);
#endif
}
int32_t main() {

	//INCLUDE();

	ios::sync_with_stdio(0);
	cin.tie(NULL); cout.tie(NULL);
	//cout << fixed << setprecision(20);

	int tt = 1;
	//cin>>tt;
	for (int t = 1 ; t <= tt ; t++ )
	{
		// cout<<"Case #"<<t<<": ";
		mainx();
	}
	return 0 ;
}



Measured memory_bytes: 3640
package main

import "fmt"

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func main() {
	var a, b, c, k int
	fmt.Scan(&a, &b, &c, &k)
	var ret int
	if a > k {
		ret = k
	} else if a+b > k {
		ret = a
	} else {
		ret = a - (k - a - b)
	}
	fmt.Println(ret)
}


Measured memory_bytes: 1752
import core.bitop, std.algorithm, std.ascii, std.bigint, std.conv,
    std.functional, std.math, std.numeric, std.range, std.stdio, std.string,
    std.random, std.typecons, std.container;

ulong MAX = 1_000_100, MOD = 1_000_000_007, INF = 1_000_000_000_000;
alias sread = () => readln.chomp();
alias lread(T = long) = () => readln.chomp.to!(T);
alias aryread(T = long) = () => readln.split.to!(T[]);
alias Pair = Tuple!(long, "p", long, "dist");
alias PQueue(T, alias less = "a<b") = BinaryHeap!(Array!T, less);

void main()
{
    real n, p;
    scan(n, p);
    auto factor = factorization(p.floor.to!long);
    // factor.writeln();
    long iter;
    if (n < 100)
    {
        foreach (i, e; factor)
        {
            if (e ^^ n > p)
                break;
            if (p % (e ^^ n) == 0)
                iter = i;
        }
    }
    factor[iter].writeln();
}

// 因数分解を行う。計算量はO(sqrt(n))
auto factorization(long a)
{
    auto factor = new long[](0);
    auto limit = cast(long) sqrt(cast(float) a);
    foreach (i; iota(limit))
    {
        long tmp = i + 1;
        if (a % tmp == 0)
        {
            factor ~= tmp;
            if (tmp != a / tmp)
                factor ~= a / tmp;
        }
    }
    factor.sort();
    return factor;
}

void scan(TList...)(ref TList Args)
{
    auto line = readln.split();
    foreach (i, T; TList)
    {
        T val = line[i].to!(T);
        Args[i] = val;
    }
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		int C = sc.nextInt();
		
		int a = 10*A+B+C;
		int b = 10*B+C+A;
		int c = 10*C+A+B;
		
		System.out.println(Math.max(Math.max(a, b), c));

		sc.close();
	}

}


Measured memory_bytes: 23764
b_1,b_2,b_3=map(int,input().split())
if b_1==1 and b_2==0 and b_3==0:
    print("Close")
elif b_1==0 and b_2==1 and b_3==0:
    print("Close")
elif b_1==1 and b_2==1 and b_3==0:
    print("Open")
elif b_1==0 and b_2==0 and b_3==1:
    print("Open")
elif b_1==0 and b_2==0 and b_3==0:
    print("Close")



Measured memory_bytes: 5596
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <sstream>
#include <iomanip>
using namespace std;
typedef long long int ll;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define yes cout << "yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
#define no cout << "no" << endl

const int INF = 1001001001;
const int mod = 1000000007;
#define PI 3.14159265359;

void P(int x) {cout << x << endl;}
void P(long x) {cout << x << endl;}
void P(double x) {cout << x << endl;}
void P(ll x) {cout << x << endl;}
void P(string x) {cout << x << endl;}
void P(char x) {cout << x << endl;}

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

int main() {
  int n;
  cin >> n;
  int t, x, y;
  int pt, px, py;
  pt = px = py = 0;
  rep (i, n) {
    cin >> t >> x >> y;
    int sum = abs(x - px) + abs(y - py);
    // cout << "t[" << t - pt << "]: " << sum << endl;
    int timeDiff = t - pt;
    if (sum != timeDiff && (sum > timeDiff || (sum + timeDiff) % 2 != 0)) {
      No;
      return 0;
    }
    pt = t;
    px = x;
    py = y;
  }
  Yes;

  return 0;
}



Measured memory_bytes: 256
#include <algorithm>
#include <cstdio>
#define GG puts("Fuck")
const int N=200005, mod=1000000007;
int id[N], l[N], r[N], f[N];
struct node {
	int x, v;
	inline bool operator < (const node &a) const {
		return x < a.x;
	}
}p[N];
bool cmp(int a, int b) {return p[a].v<p[b].v;}
int main() {
	int n;
	scanf("%d", &n);
	for(int i = 1; i <= n; i ++ ) scanf("%d%d", &p[i].x, &p[i].v), id[i] = i;
	std::sort(p+1, p+n+1); std::sort(id+1, id+n+1, cmp);
	for(int i = 1; i <= n; i ++ ) l[id[i]]=r[id[i]]=i;
	for(int i = 2; i <= n; i ++ ) r[i]=std::max(r[i], r[i-1]);
	for(int i = n-1; i; i -- ) l[i]=std::min(l[i], l[i+1]);
	f[0]=1;
	for(int i = 1, j = 0, sum = 1; i <= n; i ++ ) {
		for (;j<l[i]-1;) sum=(sum-f[j++]+mod)%mod;
		(f[r[i]]+=sum)%=mod;
		(sum<<=1)%=mod;
	}
	printf("%d\n", f[n]);
}

Measured memory_bytes: 4864
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES

#include "bits/stdc++.h"
#define REP(i,a,b) for(i=a;i<b;++i)
#define rep(i,n) REP(i,0,n)
#define ll long long
#define ull unsigned ll
typedef long double ld;
#define ALL(a) begin(a),end(a)
#define ifnot(a) if(not a)
#define dump(x)  cerr << #x << " = " << (x) << endl
using namespace std;

// #define int ll
bool test = 0;
int dx[] = { 0,1,0,-1 };
int dy[] = { 1,0,-1,0 };
#define INF (1 << 28)
ull mod = (int)1e9 + 7;
//.....................
#define MAX (int)1e6 + 5

int n;
int a[500005];
int b[3];
signed main(void) {
	int i, j, k, l;
	cin >> n;
	rep(i, n) {
		cin >> a[i];
		a[i] %= 3;
		b[a[i]]++;
	}
	int cnt = 0;
	if (b[1] == 0 && b[2] == 0) {
		puts("1");
		return 0;
	}
	cnt += b[0];
	b[0] = 0;

	int tmp = min(b[1], b[2]);
	cnt += tmp * 2;
	b[1] -= tmp;
	b[2] -= tmp;
	if (b[1] > b[2]) {
		cnt += min(b[1], 3);
	}
	else if (b[1] < b[2]) {
		cnt += min(b[2], 3);
	}

	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 5048
#include<iostream>
#include<string>
#include<stdio.h>
#include<stdlib.h>
#include<set>
#include<map>
#include<vector>
#include<queue>
#include<cstring>
using namespace std;
#define mp(a,b) make_pair(a,b)
#define pb push_back

int main(){
    long long n,k;
    cin>>n>>k;
    int a[200010], b[200010], c[200010];
    int cnt = 0;
    int start = 1;
    int over = 1;
    memset(a,0,sizeof(a));
    memset(b,0,sizeof(b));
    memset(c,-1,sizeof(c));
    for (int i=1;i<=n;i++){
        cin>>a[i];
    }
    b[0] = 1;
    c[1] = 0;
    while (true){
        //cout<<a[b[cnt]]<<" "<<cnt<<" "<<b[cnt]<<endl;
        long long cur = a[b[cnt]];
        if (c[cur] >= 0){
            start = c[cur];
            over  = cnt;
            break;
        }
        cnt++;
        b[cnt] = cur;
        c[cur] = cnt;
    }
    int total = over - start + 1;
    int ex = (k - start +1) % total;
    //cout<<start<<" "<<over<<" "<<ex<<endl;
    if (k <= over){
         cout<<b[k];
    }else{
        if (ex == 0){
            cout<<b[over];
        }else{
            cout<<b[start - 1 + ex];
        }
    }


//    system("pause");
}


Measured memory_bytes: 6016
N,M,C=map(int,input().split())
B=[i for i in map(int,input().split())]
A=[]
for i in range(N):
    A1=[i for i in map(int,input().split())]
    A+=[A1]


count=0
for i in range(N):
    dot=0
    for j in range(M):
        dot+=B[j]*A[i][j]
    dot+=C
    if dot>0:
        count+=1
print(count)

Measured memory_bytes: 3064
while True:
    try:
        num = int(input())
        if num == 0 :
            break
        f = 1
        ans = 0
        for i in range(num,1,-1):
            f *= i
        s = str(f)
        for i in reversed(range(0, len(s))): 
            if s[i] in '0':
                ans += 1
            else :
                break;
        print(ans)
    except EOFError:
        break


Measured memory_bytes: 5724
#include <bits/stdc++.h>
 using namespace std;
  int main (){
      int h,w;
    cin >> h >> w;
    char a[102][102];
    char b[102][102];
     for(int i=0;i<h;i++){
         cin >> a[i]; 
     }
     for(int i=0;i<h+2;i++){
         for(int j=0;j<w+2;j++){
          b[i][j]='#';         
          
         }
     }
      for(int i=0;i<h;i++){
         for(int j=0;j<w;j++){
         b[i+1][j+1]=a[i][j];
         }
      }    
        for(int i=0;i<h+2;i++){
         for(int j=0;j<w+2;j++){
         cout <<  b[i][j];
         }
     cout << endl;

        }    
  return 0;
  }

Measured memory_bytes: 3592
#include <iostream>
#include <string>
#include <algorithm>

// 何文字かを出す(26進数とはちょっと違う:)->桁内の何番目というIDに変換する->IDから文字列を作る 

int main()
{
	long long N;
	std::cin >> N;
	
	std::string ans;
	
	while(N>0)
	{
		N--;
		
		ans += (char)(N % 26 + 'a') ;
		N /= 26;
	}
	std::reverse(ans.begin(), ans.end());
	std::cout << ans << std::endl;

	return 0;
}


Measured memory_bytes: 3132
#include<bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define bg begin()
#define ed end()
#define all(x) x.bg,x.ed
#define pb push_back
#define pf push_front
#define eb emplace_back
using namespace std;
typedef long long ll;
template<class t,class u> void chmax(t&a,u b){if(a<b)a=b;}
template<class t,class u> void chmin(t&a,u b){if(b<a)a=b;}
template<class t> using vc=vector<t>;
template<class t> using vvc=vc<vc<t>>;
using pi=pair<int,int>;
using vi=vc<int>;
void yes(){ cout << "Yes" << endl; }
void no(){ cout << "No" << endl; }
int SIZE(string s){return (int)s.size();}
const long long INF = 1LL << 60;

int main(){
    cout << fixed << setprecision(20);
    ll n,k; cin >> n >> k;
    ll ans = k;
    rep(i,n-1){
        ans *= (k-1);
    }
    cout << ans << endl;
    return 0;
}


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

using namespace std;

typedef long long ll;
const ll INF = 1LL<<60;

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

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 modpow(ll a, ll n, ll mod) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

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

    string S;
    cin >> S;

    bool pre_R = true;
    int pos_RL = 0;
    int pos_LR = 0;
    int N = S.length();
    vector<int> ans(N);
    for(int i = 1; i < N; i++){
        if(pre_R && S[i] == 'L'){
            pos_RL = i;
        }else if(!pre_R && S[i] == 'R'){
            // Rについて
            ans[pos_RL-1] += (pos_RL - pos_LR + 1) / 2;
            ans[pos_RL]   += (pos_RL - pos_LR) / 2;

            // Lについて
            ans[pos_RL]   += (i - pos_RL + 1) / 2;
            ans[pos_RL-1] += (i - pos_RL) / 2;

            pos_LR = i;
        }
        if(S[i] == 'R'){
            pre_R = true;
        }else{
            pre_R = false;
        }
    }

    // 最後はLなので、足して終わり
    ans[pos_RL-1] += (pos_RL - pos_LR + 1) / 2;
    ans[pos_RL]   += (pos_RL - pos_LR) / 2;

    ans[pos_RL]   += (N - pos_RL + 1) / 2;
    ans[pos_RL-1] += (N - pos_RL) / 2;

    for(int i = 0; i < N; i++){
        cout << ans[i] << " ";
    }
    cout << endl;
    
    

    return 0;
}



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

using namespace std;

int main()
{
	int n, s;
	while (cin >> n >> s, n || s) {
		int ans = 0;

		for (int i = 0; i < (1<<10); ++i) {
			int cnt = 0, sum = 0;

			for (int j = 0; j < 10; ++j) {
				if (i >> j & 1) {
					sum += j;
					cnt++;
				}
			}

			if (cnt == n && sum == s) ans++; 
		}

		printf("%d\n", ans);
	}
}

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

int main() 
{
    string s;
    cin>>s;
    if(s=="RRS")
    {
        cout<<"2"<<endl;
    }
    else if(s=="RRR")
    {
        cout<<"3"<<endl;
    }
    else if(s=="SSS")
    {
        cout<<"0"<<endl;
    }
    else if(s=="RSR")
    {
        cout<<"1"<<endl;
    }
    else if(s=="RSS")
    {
        cout<<"1"<<endl;
    }
    else if(s=="SRS")
    {
        cout<<"1"<<endl;
    }
    else if(s=="SSR")
    {
        cout<<"1"<<endl;
    }
    else if(s=="SRR")
    {
        cout<<"2"<<endl;
    }
    
	return 0;
}


Measured memory_bytes: 3552
#include<cstdio>
#include<algorithm>
#include<vector>
#include<string>
#include<iostream>
#include<queue>
#include<map>
#include<set>
#include<complex>
#include<stack>
#include<cmath>

using namespace std;

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

const int PS = 1000000;
int prime[PS];
int set_prime(){
	rep(i,PS)prime[i]=1;
	prime[0]=prime[1]=0;
	rep(i,PS){
		if(prime[i]==0)continue;
		for(int j=i*2;j<PS;j+=i)prime[j]=0;
	}
}



int main(){
	set_prime();
	
	int n;
	while(cin>>n){
		for(int i=n-1;i>=0;i--){
			if(prime[i]==1){
				printf("%d ",i);
				break;
			}
		}
		for(int i=n+1;i<PS;i++){
			if(prime[i]==1){
				printf("%d\n",i);
				break;
			}
		}
	}
}

Measured memory_bytes: 5040
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define REP(i, n) rep(i, 0, n)
#define int long long
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e18;

signed main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	int h, w, n;
	cin >> h >> w >> n;
	int l = max(h, w);
	cout << (n + l - 1) / l << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
signed main() {
  int n; cin >> n;
  int weights[n];
  unordered_map<int, ll> left_mp, right_mp;
  for(int i = 0; i < n; ++i) {
    // cin >> weights[i];
    scanf("%d", weights+i);
    ++left_mp[i - weights[i]];
    ++right_mp[i + weights[i]];
  }
  ll ans = 0;
  for(auto& right : right_mp) ans += right.second * left_mp[right.first];
  cout << ans << "\n";
  return 0;
}


Measured memory_bytes: 27008
#include "bits/stdc++.h"
#define rep(i, j) for (int i = 0; i < j; i++)
using namespace std;
using ll = long long;
using ull = unsigned long long;

int gcd(int x, int y);

const int INF = 1001001001;

//mint�p�̕ϐ� (10��9��)
const int mod = 1000000007;

struct mint {
    ll x; // typedef long long ll;
    mint(ll x = 0) :x((x% mod + mod) % mod) {}
    mint operator-() const { return mint(-x); }
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod - a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this; }
    mint operator+(const mint a) const { return mint(*this) += a; }
    mint operator-(const mint a) const { return mint(*this) -= a; }
    mint operator*(const mint a) const { return mint(*this) *= a; }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t >> 1);
        a *= a;
        if (t & 1) a *= *this;
        return a;
    }

    // for prime mod
    mint inv() const { return pow(mod - 2); }
    mint& operator/=(const mint a) { return *this *= a.inv(); }
    mint operator/(const mint a) const { return mint(*this) /= a; }
};
istream& operator>>(istream & is, const mint & a) { return is >> a.x; }
ostream& operator<<(ostream & os, const mint & a) { return os << a.x; }


int main() {
    int n, m;
    cin >> n >> m;
    vector<vector<int> > rouka(n, vector<int>(0));
    vector<int> flag(n, -1);
    rep(i, m) {
        int num1, num2;
        cin >> num1 >> num2;
        rouka[num1 - 1].emplace_back(num2 - 1);
        rouka[num2 - 1].emplace_back(num1 - 1);
    }
    queue<int> v;
    vector<int> pre(n, -1);
    v.push(0);
    while (!v.empty()) {
        int j = v.front();
        v.pop();
        //i = �ڑ���̕��� v = �T�����ɕ��񂾔z��
        //�͈�for��j�̕����ƂȂ����Ă��镔��������
        //j = ���Ƃ̂ւ�(�O���t�؂ł����e�m�[�h)
        for (int i : rouka[j]) {
            if (flag[i] != -1) continue; //���łɂ݂��Ă���Ȃ��΂�
            flag[i] = flag[j] + 1; //���܂�����}�[�N
            pre[i] = j; //i�Ԗڂ̕�����j�Ԗڂ̕����Ɍ�������1�ɂ�����
            v.push(i); //i���ς�悤�ɂ���
        }
    }

    cout << "Yes" << endl;
    rep(i, n) {
        if (i == 0) continue;
        cout << pre[i] + 1 << endl;
    }
    return 0;
}
/*���C�u�����ő����*/
//���[�O���b�h�̌ݏ��@
int gcd(int x, int y) {
    int num[3];
    num[0] = (x > y) ? x : y;
    num[1] = (x <= y) ? x : y;
    num[2] = num[0] % num[1];

    while (num[2]) {
        num[0] = num[1];
        num[1] = num[2];
        num[2] = num[0] % num[1];
    }

    return num[1];
}

Measured memory_bytes: 10616
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define inf 1001001001001001001
#define mod 1000000007
#define mod2 998244353
#define pi acos(-1)
#define all(v) v.begin(),v.end()

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

}

Measured memory_bytes: 3648