akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;

#define fo(i,n)   for(i=0;i<(n);++i)
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define endl '\n'
#define PI 3.1415926535897932384626433832795
#define all(x) x.begin(), x.end()
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

typedef long long ll;
typedef long double ld;

typedef pair<int, int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;

const ll inf = LONG_MAX;
const ll arr = 1000000; /// 10^6

bool comp(pll a, pll b)
{
    if(a.first==b.first) return a.second<b.second; else return a.first<b.first;
}

string s;

bool check(ll x)
{
    for(int i=0; i<s.size(); i++)
    {
        if(s[i] == '<')
            x++;
        else
            x--;
        if(x < 0)
            return false;
    }
    return true;
}

int main(void)
{
    cin >> s;
    ll n = s.size();

    vector<ll> a(n+2, 0);
    for(int i=-1; i<n; i++)
    {
        ll cnt1 = 0;
        ll cnt2 = 0;

        if(i >= 0 && i < n && s[i] == '<' && s[i+1] == '<')
        {
            a[i+1] = a[i] + 1;
            continue;
        }

        if(i >= 1 && i < n && s[i-1] == '>' && s[i] == '>' && s[i+1] == '>')
        {
            a[i+1] = a[i] - 1;
            continue;
        }


        for(int j=i; j>=0; j--)
        {
            if(s[j] == '<')
                cnt1++;
            else
                break;
        }

        for(int j=i+1; j<n; j++)
        {
            if(s[j] == '>')
                cnt2++;
            else
                break;
        }


        a[i+1] = max(cnt1, cnt2);
    }

    ll sum = 0;
    for(int i=0; i<=n; i++)
    {
        //cout << a[i] << s[i];
        sum += a[i];
    }

    cout << sum << endl;

    return 0;
}


Measured memory_bytes: 4740
package main

import "fmt"

func main() {
	var S string
	fmt.Scan(&S)
	m := map[string]int{}
	for _, v := range S {
		m[string(v)]++
	}
	var cnt int
	for _, v := range m {
		cnt++
		if v != 2 {
			fmt.Println("No")
			return
		}
		if cnt > 2 {
			fmt.Println("No")
			return
		}
	}
	fmt.Println("Yes")
}


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

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
typedef vector<ll> vll;
typedef vector<ld> vld;
typedef vector<pll> vpl;
typedef vector<vll> vvll;

#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define FI first
#define SE second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define REP1(i,n) for(int i=1;i<((int)n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define PB push_back
#define EB emplace_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define yes cout<<"Yes"<<endl
#define YES cout<<"YES"<<endl
#define no cout<<"No"<<endl
#define NO cout<<"NO"<<endl
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL

const int inf = 1e9;
const ll linf = 1LL << 50;
const double eps = 1e-10;
const int MOD = 1e9 + 7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};

map<ll,ll> m;
ll calc(ll bit){
  bit+=(1<<24);

  ll res=24;
  ll p=0;
  REP1(i,25){
    if((bit>>i)&1){
      res=min(res,i-p);
      p=i;
    }
  }

  return res;
}


ll dfs(ll cur, ll bit){
  if(cur==13)
    return calc(bit);

  if(cur==0){
    if(m[cur]>=1)
      return 0;
    bit+=1;
    return dfs(cur+1,bit);
  }


  if(m[cur]>=3)
    return 0;

  if(m[cur]==2){
    if(cur==12)
      return 0;
    return dfs(cur+1,bit+(1<<cur)+(1<<(24-cur)) );
  }

  if(m[cur]==1)
    return max(dfs(cur+1,bit+(1<<cur)), dfs(cur+1,bit+(1<<(24-cur) )));

  return dfs(cur+1,bit);
}

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

  ll n;
  cin>>n;
  vll d(n);
  REP(i,n)cin>>d[i];

  REP(i,n)m[d[i]]+=1;

  ll ans=dfs(0,0);
  cout<<ans<<endl;

}



Measured memory_bytes: 256
N,Q=map(int,input().split())
AB=[list(map(int,input().split())) for i in range(N-1)]
PX=[list(map(int,input().split())) for i in range(Q)]

eda=[[] for i in range(N+1)]

pt= [0 for i in range(N+1)]
for a,b in AB:
    eda[a].append(b)
    eda[b].append(a)
for p,x in PX:
    pt[p]+=x


stack=[[1,eda[1]]]
v=set()
v.add(1)
while stack:
    while stack[-1][1]:
        a=stack[-1][1].pop()
        if not a in v:
            v.add(a)
            pt[a]+=pt[stack[-1][0]]
            stack.append([a,eda[a]])
    stack.pop()
print(" ".join(list(map(str,pt[1:]))))


Measured memory_bytes: 157492
#include <string>
#include <vector>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <map>
#include <list>
#include <set>
#include <numeric>
#include <queue>
#include <stack>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <climits>
#include <cfloat>
#include <ctime>
#include <complex>
#include <cassert>
#include <array>
#include <bitset> 
#include <unordered_map>

using namespace std;
typedef long long LL;
typedef pair<int,int> P;

int main() {
	int a,b,c;
	cin >> a >> b >> c;
	if(a+b+c>=22){
		cout << "bust" << endl;
	}
	else{
		cout << "win" << endl;
	}

	return 0;
}



Measured memory_bytes: 888
package main

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

var (
	readString func() string
	stdout     *bufio.Writer
)

func init() {
	readString = newReadString(os.Stdin)
	stdout = bufio.NewWriter(os.Stdout)
}

func newReadString(ior io.Reader) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}

func readInt() int {
	return int(readInt64())
}

func readInt64() int64 {
	i, err := strconv.ParseInt(readString(), 0, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readIntSlice(n int) []int {
	b := make([]int, n)
	for i := 0; i < n; i++ {
		b[i] = readInt()
	}
	return b
}

func readLengthAndSlice() []int {
	n := readInt()
	return readIntSlice(n)
}

func printf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(stdout, f, args...)
}

func println(args ...interface{}) (int, error) {
	return fmt.Fprintln(stdout, args...)
}

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

func minUint(a, b uint) uint {
	if a < b {
		return a
	}
	return b
}

func minInt64(a, b int64) int64 {
	if a < b {
		return a
	}
	return b
}

func minUint64(a, b uint64) uint64 {
	if a < b {
		return a
	}
	return b
}

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

func maxUint(a, b uint) uint {
	if a < b {
		return b
	}
	return a
}
func maxInt64(a, b int64) int64 {
	if a < b {
		return b
	}
	return a
}

func maxUint64(a, b uint64) uint64 {
	if a < b {
		return b
	}
	return a
}

func absInt(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

func absInt64(a int64) int64 {
	if a < 0 {
		return -a
	}
	return a
}

// readString() string
// readInt() int
// readIntSlice(n int) []int
// readLengthAndSlice() []int
func main() {
	defer stdout.Flush()

	N := readInt()
	s := make([]int, N)
	minp := math.MaxInt32
	var sum int
	for i := range s {
		x := readInt()
		s[i] = x
		sum += x
		if x%10 != 0 && x < minp {
			minp = x
		}
	}
	if sum%10 != 0 {
		println(sum)
	} else {
		if minp == math.MaxInt32 {
			println(0)
		} else {
			println(sum - minp)
		}
	}
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define debug(var) std::cout << #var << " : " << var << std::endl;
using ll = long long;
using ull = unsigned long long;
ll mod = 1e9 + 7;


int main(){


	int s; std::cin >> s;
	int now = s;
	int i = 1;
	std::set<int> set;
	while(1){
		set.insert(now);
		i++;
		if(now % 2 == 0){
			now /= 2;
		}else{
			now *= 3;
			now++;
		}
		if(set.find(now) != set.end()){
			std::cout << i;
			return 0;
		}
	}


	return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-

import sys
import math


debug = False

def log(text):
    if debug:
        print(text)

def parse_input(lines_as_string = None):

    global debug
    lines = []
    if lines_as_string is None:
        debug = False
        # for line in sys.stdin:
        #     lines.append(line)
        lines.append(input())
        lines.append(input())
    else:
        debug = True
        lines = [e for e in lines_as_string.split("\n")][1:-1]

    n = int(lines[0])
    a = [int(e) for e in lines[1].split(" ")]

    return (n, a)


def solve(n, a):

    even = [e for e in a if e % 2 == 0]    

    result = 'APPROVED'
    for i in range(len(even)):
        e = even[i]
        if e % 3 == 0:
            pass 
        elif e % 5 == 0:
            pass
        else:
            result = 'DENIED'
            break


    return result
    


def main():
    # 出力
    result = solve(*parse_input())
    if isinstance(result, list):
        for r in result:
            print("%s" % r, sep='')
    else:
        print("%s" % result, sep='')

if __name__ == '__main__':

    main()

Measured memory_bytes: 3064
#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

//#define int long long
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return true; } return false; }

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int a, b, c; cin >> a >> b >> c;
	int d = 0;
	if (!(a % 2 == b % 2 && b % 2 == c % 2)) {
		d++;
		if (a % 2 == b % 2) {
			a++, b++;
		}
		else if (b % 2 == c % 2) {
			b++, c++;
		}
		else if (c % 2 == a % 2) {
			c++, a++;
		}
	}
	int maxi = max(a, max(b, c));
	d += (maxi - a) / 2;
	d += (maxi - b) / 2;
	d += (maxi - c) / 2;
	cout << d << endl;

	return 0;
}

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

int main(){
    int n;
    while(true){
        cin >> n;
        if(n==0)break;
        int ans=0;int b[n];
        for(int i=0;i<n;i++){
            cin >> b[i];
        }
        sort(b,b+n);
        for(int i=1;i<n-1;i++)ans+=b[i];
        cout << ans/(n-2) << endl;
    }
}


Measured memory_bytes: 3064
#include<iostream>
#include<stack>
#include<cstdio>
using namespace std;

int main(){
  int a;
  char c;
  bool f;
  stack<int> p;

  while(1){
    c = getchar();
    if(c == '.')break;
    f = true;
    while(!p.empty())p.pop();

    do{
      if(c == '(')p.push(1);
      if(c == '[')p.push(2);
      if(c == ')'){
	if(p.empty()){
	  f = false;
	}else{
	  a = p.top();
	  p.pop();
	  if(a!=1)f = false;
	}
      }
      if(c == ']'){
	if(p.empty()){
	  f = false;
	}else{
	  a = p.top();
	  p.pop();
	  if(a!=2)f = false;
	}
      }
      c = getchar(); 
    }while(c != '.');

    if(f && p.empty())cout << "yes" << endl;
    else cout << "no" << endl;

    getchar();
  }

}

Measured memory_bytes: 0
N,K = map(int, input().split())
a = list(map(int, input().split()))
Kbin = bin(K)[2:]
Kbin = Kbin.zfill(43)
s = len(str(K))
sbin = len(Kbin)
bintbl1 = [0 for i in range(sbin)]
bintbl0 = [0 for i in range(sbin)]
for i in range(N):
  abin = bin(a[i])[2:]
  abin = abin.zfill(sbin)
  for j in range(sbin):
    if abin[j] == "1":
      bintbl1[j] += 1
    else:
      bintbl0[j] += 1
DP = [[[0 for i in range(2)] for j in range(2)] for k in range(sbin)]
for i in range(1,sbin):
  if Kbin[i] == "1":
    if sbin-len(bin(K)[2:]) == i:
      DP[i][1][0] = max(DP[i-1][0][0],DP[i-1][1][0]) + bintbl0[i]*2**(sbin-i-1)
      DP[i][0][1] = max(DP[i-1][0][0],DP[i-1][0][1],DP[i-1][1][1],DP[i-1][1][0]) + (bintbl1[i]*2**(sbin-i-1))
    else:
      DP[i][1][0] = max(DP[i-1][0][0],DP[i-1][1][0]) + bintbl0[i]*2**(sbin-i-1)
      DP[i][1][1] = max(DP[i-1][0][1],DP[i-1][1][1]) + bintbl0[i]*2**(sbin-i-1)
      DP[i][0][0] = 0
      DP[i][0][1] = max(DP[i-1][0][0],DP[i-1][0][1],DP[i-1][1][1],DP[i-1][1][0]) + (bintbl1[i]*2**(sbin-i-1))
  if Kbin[i] == "0":
    if sbin-len(bin(K)[2:])>i:
      DP[i][0][0] = max(DP[i-1][0][0],DP[i-1][1][0]) + bintbl1[i]*2**(sbin-i-1)
    else:
      DP[i][1][0] = 0
      DP[i][1][1] = max(DP[i-1][0][1],DP[i-1][1][1]) + bintbl0[i]*2**(sbin-i-1)
      DP[i][0][0] = max(DP[i-1][0][0],DP[i-1][1][0]) + bintbl1[i]*2**(sbin-i-1)
      DP[i][0][1] = max(DP[i-1][0][1],DP[i-1][1][1]) + bintbl1[i]*2**(sbin-i-1)
print(max(DP[sbin-1][0][0],DP[sbin-1][0][1],DP[sbin-1][1][0],DP[sbin-1][1][1]))

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

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {

            int ans = 0;
            
            for(int i =0;i<4;++i)
            {
                var imp = Console.Read();

                if(imp=='+')
                {
                    ans += 1;
                }
                else
                {
                    ans -= 1;
                }


            }
            
            Console.Write(ans);
            
            //System.Threading.Thread.Sleep(1000);
        }
    }
}


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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define CHMIN(a,b) a=min((a),(b))
#define CHMAX(a,b) a=max((a),(b))

// mod
const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

// floating
typedef double Real;
const Real EPS = 1e-11;
#define EQ0(x) (abs(x)<EPS)
#define EQ(a,b) (abs(a-b)<EPS)
typedef complex<Real> P;

// 乱数で摂動して縮退を除去
// 凸包 角度

uint32_t xor64(void) {
  static uint64_t x = 88172645463325252ULL;
  x = x ^ (x << 13); x = x ^ (x >> 7);
  return x = x ^ (x << 17);
}

int n;
P p[125];
pair<P,int> ps[125];

Real cross(P a, P b){return imag(a*conj(b));}
Real dot(P a, P b){return real(a*conj(b));}

int ccw(int aa, int bb, int cc){
  P a = ps[aa].first, b = ps[bb].first, c = ps[cc].first;
  b -= a; c -= a;
  if (cross(b, c) > 0)   return +1;       // counter clockwise
  if (cross(b, c) < 0)   return -1;       // clockwise
  if (dot(b, c) < 0)     return +2;       // c--a--b on line
  if (norm(b) < norm(c)) return -2;       // a--b--c on line
  return 0;
}

double ans[125];

int main(){
  scanf("%d",&n);
  REP(i,n){
    int x,y;
    scanf("%d%d",&x,&y);
    p[i] = P(x,y) + exp(P(0,xor64()))*1e-11;
    // printf("%.5f %.5f\n",p[i].real(), p[i].imag());
  }
  // http://www.prefield.com/algorithm/geometry/convex_hull.html
  REP(i,n)ps[i]=make_pair(p[i], i);
  sort(ps,ps+n,[&](pair<P,int> a,pair<P,int> b){
    P ap = a.first, bp = b.first;
    if(ap.real() != bp.real())return ap.real() < bp.real();
    return ap.imag() < bp.imag();
  });
  vi ch;
  for (int i = 0; i < n; ch.push_back(i++)) // lower-hull
    while (ch.size() >= 2 && ccw(ch[ch.size()-2], ch[ch.size()-1], i) <= 0)ch.pop_back();
  for (int i = n-2, t = ch.size()+1; i >= 0; ch.push_back(i--)) // upper-hull
    while (ch.size() >= t && ccw(ch[ch.size()-2], ch[ch.size()-1], i) <= 0)ch.pop_back();
  ch.pop_back();
  REP(i,ch.size()){
    int a = ch[i];
    int b = ch[(i+1)%ch.size()];
    int c = ch[(i+ch.size()-1)%ch.size()];
    int id = ps[a].second;
    P ap = ps[a].first;
    P bp = ps[b].first;
    P cp = ps[c].first;
    // printf("%d %d %d\n",ps[a].second,ps[b].second,ps[c].second);
    if(ch.size()==1){
      ans[id] = 1.0;
    }else if(ch.size()==2){
      ans[id] = 0.5;
    }else{
      P v1 = (bp-ap)*P(0,1);
      P v2 = (ap-cp)*P(0,1);
      P v = v2 / v1;
      ans[id] = arg(v) / (2.0 * atan(1.0)*4.0);
    }
  }
  REP(i,n)printf("%.9f\n",ans[i]);
  return 0;
}


Measured memory_bytes: 256
//CLMN
//Every cloud has a silver lining
//Hakuna matata

#include <bits/stdc++.h>

using namespace std;

typedef pair<int, int> ii;

#define fi first
#define se second
#define pb push_back
#define sqr(x) ((x) * (x))

const char *fin = "";
const char *fon = "";

#define oo (int) (1e9+7)
#define maxn (int) ()

void inp() {
    int x, a, b;
    cin >> x >> a >> b;
    if (b <= a) cout << "delicious"; else
    if (b - a <= x) cout << "safe"; else cout << "dangerous";
}

int main() {
    ios_base::sync_with_stdio(false); cin.tie(NULL);
   // freopen(fin, "r", stdin); freopen(fon, "w", stdout);
    inp();
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<cstdio>
using namespace std;
int main()
{
	int N;
	cin>>N;
	if(N>9)N=N%10;
	if(N>9)N=N%10;
	switch(N)
	{
		case 3:cout<<"bon";break;
		case 1:case 0:case 6:case 8:cout<<"pon";break;
		case 2:case 4:case 5:case 7:case 9:cout<<"hon";break;
	}
	return 0;
}

Measured memory_bytes: 3604
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
 
int main(){
  int n;
  cin>>n;
  vector<int>p(n),q(n);
  rep(i,n) cin>>p[i];
  rep(i,n) cin>>q[i];
  vector<int>a(n);
  rep(i,n)a[i]=i+1;
  map<vector<int>,int>mp;
  do{
    mp[a]=mp.size();
  }while(next_permutation(a.begin(),a.end()));
  int ans=abs(mp[p]-mp[q]);
  cout<<ans<<endl;
}

Measured memory_bytes: 5248
//*Here I go out to sea again
//*The sunshine fills my hair
//*And dreams hang in the air

#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define mp make_pair
#define pb push_back

int main()
{
   ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string s,ans;
    cin>>s;
    for(int i=0;i<s.size();i++){
      if(s[i]=='1' || s[i]=='0'){
        ans+=s[i];
      }
      if(s[i]=='B' && ans.size()>0){
        ans.erase(ans.size()-1,1);
      }
    }
    cout<<ans<<"\n";
    return 0;
}


Measured memory_bytes: 3608
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template<class T> using oset=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define pb push_back
#define N 200001
#define ll long long
#define int ll 
#define pi pair<int , int>
#define pip pair<pair ,int>
#define mp make_pair 
#define f first
#define s second
#define mod 998244353
ll Mod(ll x, ll y, int 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; 
}
int* getlps(string pattern){
 int len = pattern.length();
 int * lps = new int[len];
 lps[0] = 0;
 int i = 1 , j = 0;
 while(i < len){
  if(pattern[i] == pattern[j]){
	  lps[i] = j+1;
   i++;
   j++;
  }
  else{
		if(j != 0){
		 j = lps[j-1];
		}
		else{
		 lps[i] = 0;
		 i++;
		}
  }
 }
 return lps;
}
class Triplet{
 public:
 int x ;
 int y ;
 int gcd;
};
Triplet extendedEuclid(int a , int b){
 if(b == 0){Triplet ans; ans.gcd = a;ans.x = 1;ans.y = 0;return ans;}
 Triplet smallAns = extendedEuclid(b , a%b);
 Triplet ans;
 ans.gcd = smallAns.gcd;
 ans.x = smallAns.y;
 ans.y = smallAns.x - (a/b)*smallAns.y;
 return ans;
}
int mmInverse(int a , int m){
 Triplet ans = extendedEuclid(a , m);
 return (ans.x+m)%m;
}
int fact[N];
void calfac(int n ){
fact[0] = 1;
for(int i = 1 ; i <= n+2; i++){
 fact[i] = (((fact[i-1]%mod)*(i%mod))%mod + mod)%mod;
}
 }
int calc(int n , int r){
 if(r > n)return 0;
 if(r == n)return 1;
 int ans = 1;
 ans = ((ans%mod)*(fact[n])%mod + mod)%mod;
 ans = ((ans%mod)*(mmInverse(fact[n-r] , mod)%mod) + mod)%mod;
 ans = ((ans%mod)*(mmInverse(fact[r] , mod)%mod) + mod)%mod;
 return (ans+mod)%mod;
}
int32_t main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int x;
cin>>x;
for(int j = -3000 ; j <= 3000 ; j++){
  for(int i = -3000 ; i <= 3000 ; i++){
	  if(i ==j)continue;
     if((j*j*j*j*j) - (i*i*i*i*i) == x){
		  cout<<j<<" "<<i<<endl;
		  return 0;
  }
}
}
}


Measured memory_bytes: 3660
#include <bits/stdc++.h>
#include <typeinfo>
#include <cxxabi.h>
#ifdef LOCAL
  #include "dbgtoki.hpp"
  #define DUMP(i) dump((string)TOSTRING(i), demangle(typeid(i).name()), __LINE__ , i) 
DbgTimer D_t;
  #define TSTART() D_t.start()
  #define TSTOP() D_t.stop()
#else
  #define DUMP(i) 
  #define TSTART()
  #define TSTOP()  
#endif
 
#define TOSTRING(x) #x
#define SZ(x) (int)(x).size()
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define ALL(s) (s).begin(), (s).end()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()) , v.end());
using namespace std;
typedef long long unsigned int llu;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;

const int EPS = 1e-9;



int main (){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int a,b;
  while(cin >> a >> b ){
    TSTART();
    
    int ans = (a+b)%24;
    
    cout << ans << endl;
    TSTOP();
  }
    return 0;
}



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

using namespace std;

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

    int n;cin>>n;

    int a[n+1];

    memset (a , 0 , sizeof a);

    for(int i=0;i<n-1;i++)
    {
        int tmp;cin>>tmp;
        a[tmp]++;
    }

    for(int i=1;i<=n;i++)
     cout<<a[i]<<'\n';

}

Measured memory_bytes: 4368
import math
n = int(input())
l = []
for _ in range(n):
    l.append(list(map(int, input().split())))
sum=0
d=[]
for i in range(n-1):
    for j in range(i+1,n):
        sum+=math.sqrt((l[i][0]-l[j][0])*(l[i][0]-l[j][0])+(l[i][1]-l[j][1])*(l[i][1]-l[j][1]))
print((sum/(n*(n-1)/2))*(n-1))

Measured memory_bytes: 3064
//#include <bits/stdc++.h>
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <stdio.h>
#include <queue>
#include <deque>
#include <set>
#include <stack>
#include <time.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;

#define fi first
#define se second

const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll MOD3 = 1812447359;
const ll INF = 1ll << 62;
const double PI = 2 * asin(1);

void yes() {printf("yes\n");}
void no() {printf("no\n");}
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

int cnt[int(1e5 + 5)];

int Sum(int num){
  int ans = 0;
  while (num > 0) ans += num % 10, num /= 10;
  return ans;
}

int main(){
  int N; cin >> N;
  for (int i = 0; i <= N; i++) cnt[i] = Sum(i);

  int ans = N;
  for (int i = 1; i < N; i++){
    ans = min(ans, cnt[i] + cnt[N - i]);
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 4008
#include<bits/stdc++.h>
#define mod 1000000007
#define fr first
#define se second
#define ll long long
#define PI 3.1415926535
#define pb push_back
#define mpr make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define senky_bansal ios_base::sync_with_stdio(false);
#define IIIT_ALLAHABAD    cin.tie(NULL);cout.tie(NULL);
using namespace std;
signed main()
{
      senky_bansal
      IIIT_ALLAHABAD

       ll n;
       cin>>n;
       ll a[n];
       for(int i=0;i<n;i++)
            cin>>a[i];
       ll ans=0;
       ll co=0;
       for(int i=1;i<n;i++)
       {
           if(a[i]<=a[i-1])
           {
               co++;
           }
           else{
            ans=max(ans,co);
            co=0;
           }

       }
       ans=max(ans,co);
       cout<<ans<<endl;







}




Measured memory_bytes: 1024
/*
        _            _                  _            _       _     _         _   _          _          _             _        
       / /\         / /\               / /\         / /\    / /\  /\ \      /\_\/\_\ _     /\ \       /\ \     _    /\ \      
      / /  \       / /  \             / /  \       / / /   / / /  \ \ \    / / / / //\_\   \ \ \     /  \ \   /\_\ /  \ \     
     / / /\ \__   / / /\ \           / / /\ \__   / /_/   / / /   /\ \_\  /\ \/ \ \/ / /   /\ \_\   / /\ \ \_/ / // /\ \_\    
    / / /\ \___\ / / /\ \ \         / / /\ \___\ / /\ \__/ / /   / /\/_/ /  \____\__/ /   / /\/_/  / / /\ \___/ // / /\/_/    
    \ \ \ \/___// / /  \ \ \        \ \ \ \/___// /\ \___\/ /   / / /   / /\/________/   / / /    / / /  \/____// / / ______  
     \ \ \     / / /___/ /\ \        \ \ \     / / /\/___/ /   / / /   / / /\/_// / /   / / /    / / /    / / // / / /\_____\ 
 _    \ \ \   / / /_____/ /\ \   _    \ \ \   / / /   / / /   / / /   / / /    / / /   / / /    / / /    / / // / /  \/____ / 
/_/\__/ / /  / /_________/\ \ \ /_/\__/ / /  / / /   / / /___/ / /__ / / /    / / /___/ / /__  / / /    / / // / /_____/ / /  
\ \/___/ /  / / /_       __\ \_\\ \/___/ /  / / /   / / //\__\/_/___\\/_/    / / //\__\/_/___\/ / /    / / // / /______\/ /   
 \_____\/   \_\___\     /____/_/ \_____\/   \/_/    \/_/ \/_________/        \/_/ \/_________/\/_/     \/_/ \/___________/    
                                                                                                                              
*/
#include<bits/stdc++.h>
using namespace std;
#define ALL(obj) (obj).begin(), (obj).end()
#define REP(i, n) for(int i = 0;i < (n);++i)

#define endl '\n'
#define pb emplace_back
#define mkp make_pair
#define p_q priority_queue
#define INF 2000000000
#define PI 3.1415926
#define coutdb cout << fixed << setprecision(10)

const int dx[]={1,0,-1,0}, dy[]={0,-1,0,1};
const int dx_8[]={1,1,0,-1,-1,-1,0,1}, dy_8[]={0,-1,-1,-1,0,1,1,1};
const long long MOD = 1e9+7;

// typedef long long ll;
#define int long long

template <typename T> inline T GCD(T a,T b){T c;while(b!=0){c=a%b;a=b;b=c;}return a;}
template <typename T> inline T LCM(T a,T b){T c=GCD(a,b);a/=c;return a*b;}
template <typename T> inline T nCr(T a,T b){T i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
template <typename T> inline T nHr(T a,T b){return nCr(a+b-1,b);}

struct UnionFind {
  vector<int> par;

  UnionFind(int size) : par(size, -1){}
  void init(int n){ par.assign(n, -1); }

  int find(int x){
    if(par[x] < 0) return x;
    else return par[x] = find(par[x]);
  }
  bool same(int x, int y){
    return find(x)==find(y);
  }
  bool unite(int x, int y){
    x = find(x); y = find(y);
    if(x == y) return 0;
    if(par[x] > par[y]) swap(x, y);
    par[x] += par[y];
    par[y] = x;
    return 1;
  }
  int size(int x){
    return -par[find(x)];
  }
};

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

  int N, M, x, y, z;
  cin >> N >> M;
  UnionFind uf(N);
  REP(i, M){
    cin >> x >> y >> z;
    uf.unite(x-1, y-1);
  }
  set<int> st;
  REP(i, N){
    st.insert(uf.find(i));
  }
  cout << st.size() << endl;
}

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

int main(){
    int n, minj, count, tmp;
    cin >> n;
    int a[n];
    for(int i=0; i<n; i++){
        cin >> a[i];
    }
    count = 0;
    for(int i=0; i<n; i++) {
        minj = i;
        for(int j=i; j<n; j++ ){
            if (a[j] < a[minj]) {
                minj = j;
            }
        }
        if (minj != i) {
            count++;
            tmp = a[i];
            a[i] = a[minj];
            a[minj] = tmp;
         }
    }
    for (int i=0; i<n-1; i++) {
        cout << a[i] << " ";
    }
    cout << a[n-1] << endl;
    cout << count << endl;
    return 0;
}


Measured memory_bytes: 3116
import java.util.Arrays;
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {

    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int l = sc.nextInt();
    String[] s = new String[n];

    for (int i = 0; i < n; i++) {
      s[i] = sc.next();
    }

    Arrays.sort(s);
    String ans = "";
    
    for (int i = 0; i < n; i++) {
      ans += s[i];
    }
    
    System.out.println(ans);

  }
}

Measured memory_bytes: 40360
#include<iostream>
#include<algorithm>
#include<functional>
#include<cmath>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<deque>
using namespace std;
#define ll long long
const int mod = 1000000007;
const ll INF = 1000000000000000000;

int A[100010];
int main()
{
	int N;
	cin >> N;
	for (int i = 0; i < N; i++) cin >> A[i];
	sort(A, A + N);
	cout << A[N / 2] - A[N / 2 - 1] << endl;
}

Measured memory_bytes: 4040
#include<iostream>
#include<string>
#include<vector>
using namespace std;
int main()
{
	vector<string> s, t;
	int n, m;
	cin >> n;
	for(int i = 0; i < n; i++){
		string str;
		cin >> str;
		s.push_back(str);
		
	}
	cin >> m;
	for(int i = 0; i < m; i++){
		string str;
		cin >> str;
		t.push_back(str);
	}
	int x = 0;
	for(int i = 0; i < n; i++){
		int imax = 0;
		for(int j = 0; j < n; j++){
			if(s[j] == s[i]) imax += 1;
		}
		for(int j = 0; j < m; j++){
			if(t[j] == s[i]) imax -= 1;
		}
		x = max(x, imax);
	}
	if(x < 0) x = 0;
	cout << x << endl;
	return 0;
}

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

int main()
{
    int n;
    cin >> n;
    int a = n % 100;
    int b = n / 100;
    if(a <= 12 && a != 0){
        if(b <= 12 && b != 0) cout << "AMBIGUOUS" << endl;
        else cout << "YYMM" << endl;
    }
    else{
        if(b <= 12 && b != 0) cout << "MMYY" << endl;
        else cout << "NA" << endl;
    }
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main() {
    long long x, y;
    cin >> x >> y;
    long long ans = 1LL<<60;
    if (x <= y)
        ans = min(ans, y-x);
    if (-x <= y)
        ans = min(ans, y+x+1);
    if (x <= -y)
        ans = min(ans, -y-x+1);
    if (-x <= -y)
        ans = min(ans, -y+x+2);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline

def main():
    S = input().strip()

    white = 0
    black = 0
    for i, v in enumerate(S):
        if i % 2 == 0:
            if v != '0':
                white += 1
            else:
                black += 1
        else:
            if v != '1':
                white += 1
            else:
                black += 1

    print(min(white, black))


if __name__ == '__main__':
    main()



Measured memory_bytes: 3188
r, c = [int(i) for i in input().split()]
sheet = [[int(j) for  j in input().split() + [0]] for i in range(r)]+ [[0]*(c+1)]

for i in range(r):
    for j in range(c):
        sheet[i][c] += sheet[i][j]
        sheet[r][j] += sheet[i][j]
    sheet[r][c] += sheet[i][c]
    l = [str(k) for k in sheet[i]]
    print(' '.join(l))
l = [str(k) for k in sheet[r]]
print(' '.join(l))
    
    
        
    


Measured memory_bytes: 5708
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define lower(s) transform(s.begin(), s.end(), s.begin(), ::tolower)
using namespace std;
using ll = long long;
int INF = 1001001001;

int main()
{
  int a, b;
  cin >> a >> b;
  if ((a + b) % 2 != 0)
    cout << "IMPOSSIBLE" << endl;
  else
    cout << (a + b) / 2 << endl;
  return 0;
}

Measured memory_bytes: 3604
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const float eps=1e-6;
const ll mod=1e8;
int main()
{
    int n,W,i,j;
    cin>>n>>W;
    ll w[n+1]={0},v[n+1]={0},dp[n+1][W+1];
    for(i=1;i<=n;i++)
    {
        cin>>w[i]>>v[i];
    }
    for(i=0;i<=n;i++)
    {
        for(j=0;j<=W;j++)
        {
            if(i==0||j==0) dp[i][j]=0;
            else if((j-w[i])>=0)
                dp[i][j]=max(dp[i-1][j],v[i]+dp[i-1][j-w[i]]);
            else dp[i][j]=dp[i-1][j];
        }
    }
    cout<<dp[n][W]<<endl;
    return 0;
}


Measured memory_bytes: 79104
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <queue>
#include <string>
#define REP(i,a,b) for (int i = a; i < (b); i++)
#define sz(t) int(t.size())
#define INF 1000000000
const int DIV = 1000000000 + 7;
using namespace std;
typedef long long ll;

int main(void) {
    vector<int> ps;
    // vector<int> ps_odd;
    REP(i, 1, 182) {
        int val = i * (i + 1) * (i + 2) / 6;
        ps.push_back(val);
        // if (val % 2 == 1) {
        //     ps_odd.push_back(val);
        // }
    }
    vector<int> dp(1000005, INF);
    vector<int> dp_odd(1000005, INF);

    dp[0] = 0;
    dp_odd[0] = 0;
    REP(i, 0, ps.size()) {
        int p = ps[i];
        REP(j, 0, 1000005) {
            if (j >= p) {
                dp[j] = min(dp[j - p] + 1, dp[j]);
                if (p % 2 == 1) {
                    dp_odd[j] = min(dp_odd[j - p] + 1, dp_odd[j]);
                }
            }
        }
    }

    for (;;) {
        int x;
        cin >> x;
        if (x == 0) {
            break;
        }
        cout << dp[x] << ' ' << dp_odd[x] << endl;
    }
}



Measured memory_bytes: 10568
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <tuple>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <numeric>
#include <string.h>
using namespace std;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1<<29;
const long long INFL = 1e18;
const int MOD = 1000000007;
const int MAX = 210000;

int gcd(int a, int b) {
    return b != 0 ? gcd(b, a % b) : a;
}

//逆元を求める関数
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++) {
      fac[i] = fac[i-1] * i % MOD;
      inv[i] = MOD - inv[MOD%i] * (MOD/i) % MOD;
      finv[i] = finv[i-1] * inv[i] % MOD;
    }
}
//組み合わせ
long long COM (int n, int k) {
    if(n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n-k] % MOD) % MOD;
}

void solve() {
    int n; cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }
    sort(a.begin(), a.end(), greater<>());
    int ans = a[0];
    for (int i = 1; i < n; ++i) {
        if (i % 2 == 1) {
            ans -= a[i];
        } else {
            ans += a[i];
        }
    }
    cout << ans << endl;
    return;
}

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



Measured memory_bytes: 256
def main(num):
    while True:
        tmp_m=[]
        for i in range(1,len(num)):
            tmp_m.append((num[i]+num[i-1])%10)

        if len(tmp_m)==1:
            return tmp_m[0]
            break
        num=tmp_m
    

while True:
    try:
        num=list(map(int, input()))
        print(main(num))
    except EOFError:
        break



Measured memory_bytes: 5600
using System;
class Program
{
	static void Main(string[] args)
	{
		string s = Console.ReadLine();
		string t = Console.ReadLine();
      	char[] sChars = s.ToCharArray();
      	char[] tChars = t.ToCharArray();
        
        Array.Sort(sChars);
      	Array.Sort(tChars);
      	Array.Reverse(tChars);
      
      	string sPrimeStr = new String(sChars);
      	string tPrimeStr = new String(tChars);
      	
      	if(String.Compare(sPrimeStr, tPrimeStr) < 0)
          	Console.WriteLine("Yes");
      	else
          	Console.WriteLine("No");
	}
}

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

int main(void){
    int a,b;
    cin >> a >> b;
    if(a > b)
        cout << "a > b" << endl;
    else if(a < b)
            cout << "a < b" << endl;
    else if(a == b)
            cout << "a == b" << endl;
}


Measured memory_bytes: 3108
#include <bits/stdc++.h>
using namespace std;
 
int main()
{
    int N;
    int sum = 0;
    bitset < 2000005 > bt;
    bt |= 1;
    cin >> N;
    for(int i = 0; i < N; i++) {
        int A;
        cin >> A;
        sum += A;
        bt |= (bt << A);
    }
    for(int i = (sum + 1) / 2; i < 2000005; i++) {
        if(bt[i]) {
            cout << i << endl;
            break;
        }
    }
    return (0);
}

Measured memory_bytes: 1152
class book:
    def __init__(self, C, A):
        self.C = C
        self.A = A
N, M, X = [int(i) for i in input().split()]
P = []
for i in range(N):
    tmp = [int(i) for i in input().split()]
    C = tmp.pop(0)
    P.append(book(C, tmp))

learn = [0 for i in range(M)]
minc = 10**7
flag = 0
for i in range(2 ** N):
    csum = 0
    for j in range(M):
        learn[j] = 0
    for j in range(N):
        if ((i >> j) & 1):
            csum += P[j].C
            for k in range(M):
                learn[k] += P[j].A[k]
    if min(learn) >= X:
        flag = 1
        if minc > csum:
            minc = csum
if flag == 1:
    print(minc)
else:
    print(-1)



Measured memory_bytes: 74400
#include<bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i) 
#define PI acos(-1)

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

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

    string s, t;
    cin>>s>>t;

    vector<vector<int>> dp(s.size() + 1, vector<int>(t.size() + 1));
    int i, j;
    rep(i, s.size()) {
        rep(j, t.size()) {
            if (s[i] == t[j]) {
                dp[i + 1][j + 1] = max(dp[i][j] + 1, max(dp[i + 1][j], dp[i][j + 1]));
            }
            else {
                dp[i + 1][j + 1] = max(dp[i + 1][j], dp[i][j + 1]);
            }
        }
    }
    i = s.size(); j = t.size();
    string ans = "";
    while (i != 0 && j != 0) {
        if (dp[i - 1][j - 1] >= dp[i - 1][j] && dp[i - 1][j - 1] >= dp[i][j - 1]) {
            if (dp[i][j] - 1 == dp[i - 1][j - 1]) {
                ans += s[i - 1];
            }
            i--; j--;
        }
        else if (dp[i - 1][j] > dp[i][j - 1]) i--;
        else j--;
    }
    reverse(ans.begin(), ans.end());
    cout<<ans<<endl;
}

Measured memory_bytes: 35584
#include<stdio.h>

int main(int argc, char* argv[])
{
  char d[1000];
  int i, sum;

  scanf("%s", d);
  while(d[0] != '0'){
    sum = 0;
    for(i = 0; d[i] != '\0'; i++){
      sum = sum + (d[i] - '0');
    }
    printf("%d\n", sum);
    scanf("%s", d);
  }
  return(0);
}

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

namespace _0430_atcoder問題_08
{
    class Program
    {
        static void Main(string[] args)
        {
            int hoge=int.Parse(Console.ReadLine());
            if (hoge == 7 || hoge == 5 || hoge == 3)
            {
                Console.WriteLine("YES");
            }
            else
            {
                Console.WriteLine("NO");
            }
        }
    }
}

Measured memory_bytes: 11092
#include<stdio.h>

main()
{
	int a , b , c ;

	scanf("%d\t%d\t%d", &a , &b , &c);

	if(a == b && a == c)
	{
		printf("1\n");
	}
	else if(a == b || a == c || b == c)
	{
		printf("2\n");
	}
	else
	{
		printf("3\n");
	}

	return 0 ;
}


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

#define int long long
#define rep(i,l,r) for(int i=(int)(l);i<(int)(r);i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
template<class T>bool chmax(T &a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a,T b){if(a>b){a=b;return 1;}return 0;}

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;

const int inf = 1LL<<60;
const int mod = 1e9 + 7;
const double eps = 1e-9;

/*{
}*/

signed main(){
	int n;
	cin >> n;

	vi w(n);
	rep(i, 0, n) cin >> w[i];

	int ans = inf;
	rep(t, 1, n){
		int s1 = 0, s2 = 0;
		rep(j, 0, t) s1 += w[j];
		rep(j, t, n) s2 += w[j];
		chmin(ans, abs(s1-s2));
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);i++)
using namespace std;
int main(){
    int n,d,res;
    cin >> n >> d >> res;
    REP(i,n){
        int a,j = 0;
        cin >> a;
        while(j*a+1 <= d){
            res++;
            j++; 
        }
    }
    cout << res << endl;
    return 0;
}

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

int main(){
    int A,B,C,D,fir,sec;
    cin >> A >> B >> C >> D;
    fir = A * B;
    sec = C * D;
    if(fir>sec){
        cout << fir << endl;
    }else{
        cout << sec << endl;
    }
    return 0;
}

Measured memory_bytes: 764
n,m = map(int,input().split())
l = [1]*(n+1)
#kubaru_dp = [1]*n

for i in range(m):
    a = int(input())
    l[a] = 0

# l = [1,1,1,0,1,1,1]
for i in range(2,n+1):
    if l[i]==0:
        continue
    l[i] = l[i-1]+l[i-2]
else:
    print(l[-1]%(10**9+7))


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

using namespace std;
using ll = long long int;
using ullong = unsigned long long;
#define rep(i,n) for(int i = 0; i < n; i++)
#define FOR(i, a, b)  for(int i = (a); i < (b) ; i++)
#define pb push_back
#define SORT(v,n) sort(v, v+n)
#define ALL(x) (x).begin(),(x).end()
#define debug(x) cerr << #x << ": " << x << '\n'
#define elif else if
//#define int ll
const int INF = 1e9;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
const int dx[8] = { 1, 0, -1, 0, 1, -1, -1, 1 };
const int dy[8] = { 0, 1, 0, -1, 1, 1, -1, -1 };


int h, w;
vector<string> grid(50);
int d[50][50];
typedef pair<int, int> Vec2;

int dfs() {
	rep(i, 50) {
		rep(j, 50) {
			d[i][j] = INF;
		}
	}
	queue<Vec2> Q;
	Q.push({ 0,0 });
	d[0][0] = 0;
	while (!Q.empty()) {
		int x = Q.front().first;
		int y = Q.front().second;
		Q.pop();
		if (x == w-1 and y == h-1) return d[x][y];
		rep(i, 4) {
			int nx = x + dx[i];
			int ny = y + dy[i];
			if (nx >= 0 and nx < w and ny >= 0 and ny < h and grid[ny][nx] == '.') {
				if (d[nx][ny] == INF) {
					d[nx][ny] = d[x][y] + 1;
					Q.push({ nx,ny });
				}
			}
		}
	}
	return -1;
}

signed main() {
	ios::sync_with_stdio(true);
	cin >> h >> w;
	int score = 0;
	rep(i, h)
		cin >> grid[i];
	int dist = dfs();
	if (dist == -1) {
		cout << -1 << endl;
	}
	else {
		int nw = 0;
		rep(i, h) {
			rep(j, w) {
				if (grid[i][j] == '.')
					nw++;
			}
		}
		cout << nw - dist - 1<< endl;
	}
	return 0;
}


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

int main() {
	string A;
	cin >> A;
  
  	bool N = false;
  	bool S = false;
  	bool W = false;
    bool E = false;
  
  for(int i = 0; i < A.size(); i++){
    if ( A.at(i) == 'N' ) N = true;
    else if (A.at(i) == 'S' ) S = true;
    else if ( A.at(i) == 'W' ) W = true;
    else if ( A.at(i) == 'E' ) E = true;
  }
	if( (N ^ S) == 0 && (W ^ E) == 0 ) cout << "Yes" << endl;
  	else cout << "No" << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
#define ll long long
 
int compare(const void *a, const void *b){
  return (*(ll int *)a)- (*(ll int *)b);
}

int main(){
  int n,sum=0;
  scanf("%d",&n);
  ll int a[n][2];
  for(int i=0; i<n; i++){
		scanf("%lld%lld", &a[i][1], &a[i][0]);
  }
  qsort(a,n,sizeof(ll int)*2,compare);
  
  for(int i=0;i<n;i++){
    sum += a[i][1];
    if(sum>a[i][0]){
      printf("No");
      return 0;
    }
  }
  printf("Yes");
  return 0;
}

Measured memory_bytes: 6396
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
int main(){
    ios::sync_with_stdio(false);
    int n,m;
    cin >> n >> m;
    vector<vector<bool>> p(n, vector<bool>(n,false));
    rep(i,m){
        int a,b;
        cin >> a >> b;
        p[a-1][b-1] = true;
        p[b-1][a-1] = true;
    }
    vector<int> one_case;
    rep(i,n-1) one_case.push_back(i+1); // 1~(n-1)
    int cnt = 0;
    do {
        bool ok = true;
        rep(i, n-1){
            int now_node = one_case[i];
            int next_node = one_case[i+1];
            if(!p[now_node][next_node]) {ok=false;break;}
        }
        if(ok) cnt++;
    } while(next_permutation(one_case.begin(), one_case.end()));
    cout << cnt << endl;
}

Measured memory_bytes: 256
N,T = map(int,input().split())
AB = [list(map(int,input().split())) for _ in range(N)]
AB.sort(key=lambda x:x[0])

dp = [[0]*T for i in range(N+1)]
ans = 0
for n in range(N):
    for w in range(T):
        ans = max(ans,dp[n][w]+AB[n][1])
        if w-AB[n][0]>=0:
            dp[n+1][w] = max(dp[n][w],dp[n][w-AB[n][0]]+AB[n][1])
        else:
            dp[n+1][w] = dp[n][w]

print(ans)

Measured memory_bytes: 117336
#include <bits/stdc++.h>
using namespace std;
int a[26];
int main(){

    double base  ;
    double height;
    double volume ;
    cin>>base>>height>>volume;
    double fullVolume=base*base*height;
    double angle,l,longitude ;
    double area = volume/base;

    if(volume *2<fullVolume)
    {
        l = area*2/height;
        longitude = sqrt(height*height+l*l);
        angle = (acos(l/longitude)*180/M_PI);
    }
    else
    {
        volume = fullVolume-volume;
        area = volume/base;
        l = area*2/base;
        longitude = sqrt(base*base+l*l);
        angle = 90-(acos(l/longitude)*180/M_PI);
    }
    cout<< fixed<< setprecision(7)<<angle<<endl;
	return 0;
}


Measured memory_bytes: 384
// inputに入力データ全体が入る
function Main(input) {
	tmp = input.split(" ");
	//文字列から10進数に変換するときはparseIntを使います
	var N = parseInt(tmp[0], 10);
	var M = parseInt(tmp[1], 10);

    //出力
	console.log(N === M ? 'Yes' : 'No');
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 21956
import java.util.*;
import java.awt.geom.*;
import java.io.*;
public class Main{
	
	private void doit(){
		Scanner sc = new Scanner(System.in);
		ArrayList<Double> list = new ArrayList<Double>();
		while(sc.hasNext()){
			list.add(sc.nextDouble());
		}
		Collections.sort(list);
		if(list.size() == 0){
			
		}
		else if(list.size() == 1){
			System.out.println(list.get(0));
		}
		else{
			double res = list.get(list.size() - 1) - list.get(0);
			System.out.println(res);
		}
	}
	public static void main(String [] args){
		new Main().doit();
	}
}

Measured memory_bytes: 12000
#include <iostream>
#include <string>
#include <math.h>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <set>
#include <queue>
#include <map>

#define mod 1000000007
#define ten5 100005
#define PI 3.1415926
using namespace std;

int num[201];

int main()
{
    //int m,n,o=0,i,j,k;
    long long int sum=0,sum2=0,n1=0,n2=0,n3;
    double ans=0.0,half;
    long long int m,n,o,i,j,k=1,now=1;
    long long int a,a1,a2,a3,a4;
    //float f,g,h;
    char c;
    string s,s1;
    //priority_queue<int> pq;
    //map<string,int> mp;
    //map<string,int>::iterator iter;
    cin>>n>>a1>>a2;
    for(i=0;i<n;i++)
    {
        cin>>m;
        num[i]=m;
    }
    for(i=0;i<n;i++)
    {
        sum+=(a1-1)/num[i]+1;
    }
    cout<<sum+a2;
    return 0;
}



Measured memory_bytes: 256