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

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define ll long long
#define pii pair<int,int>
#define all(x) begin(x), end(x)
#define loop(i,n) for(int i=0; i<n; i++)
#define rep(i,a,b,c) for(int i=a; i<b; i+=c)
#define brep(i,a,b,c) for(int i=a; i>b; i-=c)
#define tc(t) int t; cin>>t; while(t--)
#define sz(v) int((v).size())
#define pb push_back

const int maxm = 1000000000 + 7;


using namespace std;


int main()
{

#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	ll n;
	cin >> n;

	int ans = sqrt(n);

	for (int i = sqrt(n); i >= 2; i--)
	{
		if (n % i == 0)
		{
			cout << i + (n / i) - 2 << endl;
			return 0;

		}
	}

	cout << n - 1 << endl;


}

Measured memory_bytes: 3632
n = int(input())
ls = list(map(int,input().split()))
di = []
ans = 0 
now = 0
for i in range(n):
    if ls[i] == i+1:
        now += 1
    else:
        if now != 0:
            di.append(now)
            now = 0
if now != 0:
    di.append(now)
for j in di:
    if j % 2 == 0:
        ans += j//2
    else:
        ans += (j//2) + 1
print(ans)


Measured memory_bytes: 20520
n = int(input())

N = 101

p = [0] * N
m = [[0] * N for _ in range(N)]

for i in range(1, n + 1):
	p[i - 1], p[i] = map(int, input().split())

# print(p)

for l in range(2, n + 1):
	for i in range(1, n - l + 2):
		j = i + l - 1
		m[i][j] = float('inf')
		for k in range(i, j):
			m[i][j] = min(m[i][j], m[i][k] + m[k + 1][j] + p[i - 1] * p[k] * p[j])

print(m[1][n])


Measured memory_bytes: 5668
def divisor(n): #約数全列挙
    ans = [n]
    i = 2
    while i**2 <= n:
        if n%i == 0:
            ans.append(i)
            if i**2 < n:
                ans.append(n//i)
        i += 1
    ans.sort()
    return ans

n = int(input())
if n == 2:
    print(1)
    exit()
ans = len(divisor(n-1))
data = divisor(n)
for k in data:
    m = n
    while m%k == 0:
        m //= k
    if (m-1)%k == 0:
        ans += 1

print(ans)

Measured memory_bytes: 39408
def main():

    N = int(input())
    A = list(map(int, input().split()))
    if 0 in A:
        print(0)
        return
    ans = 1
    for i in A:
        ans *= i
        if(ans > 1000000000000000000):
            print(-1)
            return
    print(ans)


main()


Measured memory_bytes: 84660
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define rep(i,l,r) for(int i=(l);i<(r);++i)
//-------
const int N = 1e5 + 7;
int n, pre[N];
vector<int> e[N];
vector<int> nd;
void bfs(int S, int T) {
	rep(i, 1, n + 1) pre[i] = -1;
	queue<int> que;
	pre[S] = 0, que.push(S);	
	while (!que.empty()) {
		int u = que.front();
		que.pop();
		rep(i, 0, sz(e[u])) {
			int v = e[u][i];
			if (~pre[v]) continue;	
			pre[v] = u, que.push(v);
		}
	}
	int p = T;
	while (p > 0) {
		nd.pb(p);
		p = pre[p];
	}
}
bool vis[N];
int dfs(int u) {
	int ret = 1;
	vis[u] = true;
	rep(i, 0, sz(e[u])) {
		int v = e[u][i];
		if (vis[v]) continue;
		ret += dfs(v);
	}
	return ret;
}
int main() {
	scanf("%d", &n);
	rep(i, 1, n) {
		int u, v;
		scanf("%d%d", &u, &v);
		e[u].pb(v), e[v].pb(u);
	}
	bfs(1, n);
	reverse(nd.begin(), nd.end());
	int black = 0, white = 0;
	rep(i, 0, sz(nd)) vis[nd[i]] = true;
	rep(i, 0, (sz(nd) + 1) / 2)
		black += dfs(nd[i]);
	rep(i, (sz(nd) + 1) / 2, sz(nd))
		white += dfs(nd[i]);
	if (black <= white) {
		puts("Snuke");
	} else {
		puts("Fennec");
	}
	return 0;
}

Measured memory_bytes: 6780
#include  <iostream>
#include  <stdio.h>
#include <algorithm>
#include <map>
#include <math.h>

using namespace std;
#include <vector>
#define rep(i,n) for (ll i = 0; i < (n) ; i++)
#define INF 1e9
#define llINF 1e18
#define base10_4 10000      //1e4
#define base10_5 100000     //1e5
#define base10_6 1000000    //1e6
#define base10_7 10000000   //1e7
#define base10_8 100000000  //1e8
#define base10_9 1000000000 //1e9

#define MOD 1000000007
#define pb push_back
#define ll long long
#define ull unsigned long long
#define vint vector<int>
#define vll vector<ll>

//#include <stack>
//#include <queue>

// #include <iomanip>
//  cout << fixed << setprecision(15) << y << endl;

string ans_Yes = "Yes"; 
string ans_No = "No"; 
string ans_yes = "yes"; 
string ans_no = "no"; 

ll A;
ll X;

ll ltmp;
string stmp;
double dtmp;

int main(){

    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    cin >> X;
    cin >> A;
    if(X<A) cout << 0 << endl;
    else cout << 10 << endl;

}

Measured memory_bytes: 3572
instr = input()
for i in range(len(instr)-4):
    if instr[i:i+5] == "apple": instr = instr[:i]+"peach"+instr[i+5:]
    elif instr[i:i+5] == "peach":instr = instr[:i]+"apple"+instr[i+5:]
print(instr)

Measured memory_bytes: 7328
import java.util.*;
import java.io.*;
 
public class Main {
    public static void main(String[] args) throws Exception {
        FastScanner sc = new FastScanner(System.in);
        int n = sc.nextInt();
        ArrayList<Point> li = new ArrayList<Point>();
        for(int i = 0; i < n; i++){
            li.add(new Point(sc.nextDouble(),sc.nextDouble()));
        }
        double total = 0d;
        for(int i = 0; i < n; i++){
            for(int j = 0; j < n; j++){
                if(i == j) continue;
                Point pi = li.get(i);
                Point pj = li.get(j);
                total += Math.sqrt((pi.x-pj.x)*(pi.x-pj.x) + (pi.y-pj.y)*(pi.y-pj.y));
            }
        }
        System.out.println(total/(double)(n));
    }
}

class Point{
    double x,y;
    public Point(double x, double y){
        this.x = x;
        this.y = y;
    }
}
class FastScanner {
    private BufferedReader reader = null;
    private StringTokenizer tokenizer = null;
    public FastScanner(InputStream in) {
        reader = new BufferedReader(new InputStreamReader(in));
        tokenizer = null;
    }

    public String next() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

    public String nextLine() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                return reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken("\n");
    }

    public long nextLong() {
        return Long.parseLong(next());
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

    public double nextDouble() {
         return Double.parseDouble(next());
    }

    public int[] nextIntArray(int n) {
        int[] a = new int[n];
        for (int i = 0; i < n; i++)
            a[i] = nextInt();
        return a;
    }

    public long[] nextLongArray(int n) {
        long[] a = new long[n];
        for (int i = 0; i < n; i++)
            a[i] = nextLong();
        return a;
    } 
}


Measured memory_bytes: 23380
/**
 * @author      : cromarmot (yexiaorain@gmail.com)
 * @license     : GPL
 * @created     : 星期六 9月 28, 2019 20:08:56 CST
 */

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

typedef long long ll;
#define ten5 100000+10
#define MOD 1000000007
#define rep(i,a,n) for (int i=a;i<n;i++)
#define iif(c,t,f) ((c)?(t):(f))
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
const double pi = acos(-1.0);

int n;

vector<pair<int,int>> st;

int main(){
  cin>>n;
  rep(i,1,n+1){
    int c;
    scanf("%d",&c);
    st.pb({c,i});
  }
  sort(st.begin(),st.end());
  rep(i,0,n){
    printf("%d ",st[i].second);
  }
  return 0;
}

/*
 *
 * hash prime
   61,83,113,151,211,281,379,509683,911
   1217,1627,2179,2909,3881,6907,9209
   12281,16381,21841,29123,38833,51787,69061,92083
   122777,163729,218357,291143,388211,517619,690163,999983
   1226959,1635947,2181271,2908361,3877817,5170427,6893911,9191891
   12255871,16341163,21788233,29050993,38734667,51646229,68861641,91815541
   122420729,163227661,217636919,290182597,386910137,515880193,687840301,917120411
   1000000007,1000000009
 * */



Measured memory_bytes: 1780
#include <bits/stdc++.h>
#define ll long long int
#define mod 1000000007
#define pb push_back
//#define mp make_pair
#define eps 1e-9
#define pp pair < pair<ll,ll> , ll> 
#define fo(i,j,k) for(int i=j;i<=k;i++)
#define foll(i,j,k) for(ll i=j;i<=k;i++)
#define clr(a) memset(a,0,sizeof(a))
#define vi vector<int>
#define vll vector<ll>
#define sz(a) a.size()
#define len(a) a.length()
#define all(a) a.begin(),a.end()
#define io_file freopen("Contest/input_file.in", "r", stdin); freopen("Contest/output_file.in", "w", stdout)


const int MAXN = 2e5+5;
using namespace std;
ll power(ll x, ll y)
{
  ll res = 1;
  while(y>0)
  {
    if(y&1)
       {
         res = (res*x)%mod;
        }
     x = (x*x)%mod;
     y = y>>1;
  }
    return res;
}
std::vector<ll> divi[1000004];

void divisor(int n)
{
   for(ll i=1;i<=n;i++)
   {
     for(ll j=i;j<=n;j+=i)
     {
       divi[j].pb(i);
     }
   }
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    
    string s;
    cin>>s;
    ll ans = 0;
    int n = s.length();
    ll cnt=0;
    for(int i=1;i<=n;i++)
    {
    	if(s[i-1]=='W')
    	{
    		ans = ans + cnt;
    	}
    	else{
    		cnt++;
    	}
    }
    cout<<ans<<endl;

    return 0;


}


Measured memory_bytes: 24144
package main

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

const INFINITY = math.MaxInt64/2 - 1

func exec(stdin *Stdin, stdout *Stdout) {
	x := stdin.ReadInt()
	y := stdin.ReadInt()
	a := stdin.ReadInt()
	b := stdin.ReadInt()
	c := stdin.ReadInt()
	p := make([]int, a)
	q := make([]int, b)
	r := make([]int, c)
	for i := 0; i < a; i++ {
		p[i] = stdin.ReadInt()
	}
	for i := 0; i < b; i++ {
		q[i] = stdin.ReadInt()
	}
	for i := 0; i < c; i++ {
		r[i] = stdin.ReadInt()
	}

	sort.Sort(sort.Reverse(sort.IntSlice(p)))
	sort.Sort(sort.Reverse(sort.IntSlice(q)))

	d := []int{}
	d = append(d, p[:x]...)
	d = append(d, q[:y]...)
	d = append(d, r...)
	sort.Sort(sort.Reverse(sort.IntSlice(d)))

	sum := 0
	for _, v := range d[:x+y] {
		sum += v
	}
	stdout.Println(sum)
}

func main() {
	stdout := NewStdout()
	defer stdout.Flush()
	exec(NewStdin(bufio.ScanWords), stdout)
}

type Stdin struct {
	stdin *bufio.Scanner
}

func NewStdin(split bufio.SplitFunc) *Stdin {
	s := Stdin{bufio.NewScanner(os.Stdin)}
	s.stdin.Split(split)
	s.stdin.Buffer(make([]byte, bufio.MaxScanTokenSize), INFINITY)
	return &s
}

func (s *Stdin) Read() string {
	s.stdin.Scan()
	return s.stdin.Text()
}

func (s *Stdin) ReadInt() int {
	n, _ := strconv.Atoi(s.Read())
	return n
}

func (s *Stdin) ReadFloat64() float64 {
	n, _ := strconv.ParseFloat(s.Read(), 64)
	return n
}

type Stdout struct {
	stdout *bufio.Writer
}

func NewStdout() *Stdout {
	return &Stdout{bufio.NewWriter(os.Stdout)}
}

func (s *Stdout) Flush() {
	s.stdout.Flush()
}

func (s *Stdout) Println(a ...interface{}) {
	fmt.Fprintln(s.stdout, a...)
}

func Min(a int, b ...int) int {
	for _, v := range b {
		if v < a {
			a = v
		}
	}
	return a
}

func Max(a int, b ...int) int {
	for _, v := range b {
		if a < v {
			a = v
		}
	}
	return a
}

func Abs(x int) int {
	if x > 0 {
		return x
	} else {
		return x * -1
	}
}

func Pow(x, y int) int {
	z := 1
	for y > 0 {
		if y%2 == 0 {
			x *= x
			y /= 2
		} else {
			z *= x
			y -= 1
		}
	}
	return z
}


Measured memory_bytes: 11520
local DBG = false
local function dbgpr(...)
    if DBG then
        io.write("[dbg]")
        print(...)
    end
end

-- returns (b^n) % m
local function modpow(b, n, m)
    if n == 0 then
        return 1
    elseif n % 2 == 0 then
        return modpow(b * b % m, n//2, m) % m
    else
        return b * modpow(b, n - 1, m) % m
    end
end

---
local MOD = 998244353
local AMAX = 300
local N = io.read("n")
local a = {}
local S = 0
for i=1,N do
    a[i] = io.read("n")
    S = S + a[i]
end

local function fill90000(t, v)
    for i=1,900000 do
        t[i] = v
    end
end

-- ∑A = S/2 and ∑B = S/2 and ∑C = 0
local function getY()
    if S % 2 == 1 then
        return 0
    end
    local cache = {}
    fill90000(cache, 0)
    cache[0] = 1
    local curmax = 0
    for i=1,N do
        local cur = a[i]
        curmax = curmax + cur
        for s=curmax,cur,-1 do
            cache[s] = (cache[s] + cache[s-cur]) % MOD
        end
        --[[
        for s=cur-1,0,-1 do
            cache[s] = cache[s]
        end
        ]]
    end
    return cache[S//2]
end

-- ∑A >= S/2
local function getX()
    local cache = {}
    fill90000(cache, 0)
    cache[0] = 1
    local curmax = 0
    -- math.ceil(S/2), S
    for i=1,N do
        local cur = a[i]
        curmax = curmax + cur
        for s=curmax,cur,-1 do
            cache[s] = (2 * cache[s] + cache[s-cur]) % MOD
        end
        for s=cur-1,0,-1 do
            cache[s] = 2 * cache[s] % MOD
        end
    end
    local sum = 0
    for s = math.ceil(S/2), curmax, 1 do
        sum = sum + cache[s]
    end
    return sum
end

local X, Y = getX(), getY()
local Total = modpow(3, N, MOD)
--dbgpr(Total, X, Y)
local ans = (Total - (3 * X) % MOD + (3 * Y) % MOD) % MOD
local ans = (Total - (3 * X) + (3 * Y)) % MOD
print(ans)


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

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"

using namespace std;
using ll = long long;

const ll MOD = 1000000007LL; // = 10^9 + 7
const double PI = 3.14159265358979;

void solve()
{
  int a, b, t;
  cin >> a >> b >> t;
  cout << b * (t / a);
}

int main()
{
  fastio;
  solve();

  return 0;
}

Measured memory_bytes: 3608
while True:
    try:
        T, D, L = map(int, input().split())
        if T == 0:
            break
        cnt = 0
        flag = 0
        delay = D
        for i in range(T):
            x = int(input())
            if x >= L:
                if flag == 1:
                    cnt += 1
                flag = 1
                delay = D
            else:
                if flag == 1:
                    delay -= 1
                    cnt += 1
                    if delay == 0:
                        flag = 0
        print(cnt)
    except:
        break


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

class position{
public:
  int x,y;
};

int main(){
  int n,a,b,c,d;
  cin>>n>>a>>b>>c>>d;
  position A,B,C,D;
  priority_queue<long long,vector<long long>,greater<long long> > que;
  for(int w=1;w<=n;w++){
    int cnt=0;
    int check=0;
    for(int i=0;i<101;i++){
      for(int j=0;j<w;j++){
	cnt++;
	if(cnt==a){
	  A.x=j;
	  A.y=i;
	  check++;
	}
	if(cnt==b){
	  B.x=j;
	  B.y=i;
	  check++;
	}
	if(cnt==c){
	  C.x=j;
	  C.y=i;
	  check++;
	}
	if(cnt==d){
	  D.x=j;
	  D.y=i;
	  check++;
	}
	if(check==4)break;
      }
      if(check==4)break;
    }
    long long dis=fabs(A.x-B.x)+fabs(A.y-B.y)+fabs(C.x-D.x)+fabs(C.y-D.y);
    que.push(dis);
  }
  cout<<que.top()<<endl;
  return 0;
}

Measured memory_bytes: 1216
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <memory>
#include <complex>
#include <numeric>
#include <cstdio>
#include <iomanip>

#define REP(i,m,n) for(int i=int(m);i<int(n);i++)
#define RREP(i,m,n) for(int i=int(n)-1;i>=int(m);--i)
#define EACH(i,c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())

#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x)  cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) do{}while(0)
#define dump(x) do{}while(0)
#define BR 
#endif
using namespace std;

using UI = unsigned int;
using UL = unsigned long;
using LL = long long int;
using ULL = unsigned long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VVLL = vector<VLL>;
using VS = vector<string>;
using PII = pair<int,int>;
using VP = vector<PII>;

//struct edge {int from, to, cost;};

constexpr double EPS = 1e-10;
//constexpr double PI  = acos(-1.0);
//constexpr int INF = INT_MAX;
constexpr int MOD = 1'000'000'007;
//inline void modAdd(LL &l, LL &r) {l = (l + r) % MOD;}

template<class T> inline T sqr(T x) {return x*x;}

LL gcd(int m, int n) {
    if (m < n) swap(m,n);
    while (n) {
        m %= n;
        swap(m,n);
    }
    return m;
}

LL f(LL n, LL c, LL d) {
    return n - n / c - n / d + n / (c * d / gcd(c,d));
}

void solve() {
    LL a,b,c,d;
    cin >> a >> b >> c >> d;
    cout << f(b,c,d) - f(a-1,c,d) << endl;
}

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

Measured memory_bytes: 256
//#include "stdafx.h"
#include <iostream>
#include <set>
#include <queue>
#include <vector>
#include <algorithm>
#include <math.h>
#include <cmath>
#include <string>
#include <cstring>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
#include <tuple>
#include <numeric>
#include <assert.h>
#include <functional>
#include <unordered_map>
#include <cstdint>

using namespace std;

/*-----------------------------------------------------------------------------
　定義
 -------------------------------------------------------------------------------*/
#define REP(i, n)				for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n)			for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define INF						2e9
#define MOD						(1000 * 1000 * 1000 + 7)
#define Ceil(x, n)				(((((x))+((n)-1))/n))		/* Nの倍数に切り上げ割り算 */
#define CeilN(x, n)				(((((x))+((n)-1))/n)*n)		/* Nの倍数に切り上げ */
#define FloorN(x, n)			((x)-(x)%(n))				/* Nの倍数に切り下げ */
#define IsOdd(x)				(((x)&0x01UL) == 0x01UL)			
#define IsEven(x)				(!IsOdd((x)))						
#define ArrayLength(x)			(sizeof( x ) / sizeof( x[ 0 ]))
#define	MAX_QWORD				((QWORD)0xFFFFFFFFFFFFFFFF)
#define M_PI					3.14159265358979323846
typedef long long				ll;
typedef unsigned long long int	QWORD;
typedef unsigned long long		SQWORD;
typedef pair<ll, ll>			P;

/*-----------------------------------------------------------------------------
　処理
 -------------------------------------------------------------------------------*/
int main()
{
	string S;
	cin >> S;
	REP(i, S.size()) {
		if (S[i] == '1') {
			cout << '9';
		} else {
			cout << '1';
		}
	}
	
	cout << endl;
	return 0;
}


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

#define pb push_back
#define mp make_pair

using namespace std;

const int N = 111111;
const long long oo = 1e17;
const int md = 1e9 + 7;

int n, m, s, t;
long long fs[N], ft[N];
int gs[N], gt[N];
vector<pair<int, int> > e[N];

void dijk(int s, long long f[], int g[]){
	set<pair<long long, int> > S;
	S.insert(mp(0, s));
	for(int i = 1; i <= n; ++i) f[i] = oo;
	f[s] = 0;
	g[s] = 1;
	while (!S.empty()){
		pair<long long, int> cur = *S.begin();
		S.erase(S.begin());
		int u = cur.second;
		for(auto p : e[u]){
			int v = p.first, c = p.second;
			if (f[v] > f[u] + c){
				g[v] = g[u];
				S.erase(mp(f[v], v));
				f[v] = f[u] + c;
				S.insert(mp(f[v], v));
			}
			else if (f[v] == f[u] + c){
				g[v] += g[u];
				g[v] %= md;
			}
		}
	}
}

int main(){
//	freopen("input.inp", "r", stdin);
	scanf("%d%d%d%d", &n, &m, &s, &t);
	for(int i = 1; i <= m; ++i){
		int u, v, c;
		scanf("%d%d%d", &u, &v, &c);
		e[u].pb(mp(v, c));
		e[v].pb(mp(u, c));
	}
	dijk(s, fs, gs);
	dijk(t, ft, gt);
	long long ans = 1ll * gs[t] * gs[t] % md;
	for(int i = 1; i <= n; ++i){
		if (fs[i] == ft[i] && fs[i] + ft[i] == fs[t]){
			ans -= 1ll * gs[i] * gs[i] % md * gt[i] % md * gt[i] % md;
			ans += md;
			ans %= md;
		}
	}
	for(int u = 1; u <= n; ++u){
		for(auto p : e[u]){
			int v = p.first, c = p.second;
			if (max(fs[u], ft[v]) * 2 < fs[t] && fs[u] + c + ft[v] == fs[t]){
				ans -= 1ll * gs[u] * gs[u] % md * gt[v] % md * gt[v] % md;
				ans += md;
				ans %= md;
			}
		}
	}
	printf("%lld", ans);
	return 0;
}

Measured memory_bytes: 17268
while True:
    a,op,b = input().split()
    if op=="+":
        print(int(a)+int(b))
    elif op=="-":
        print(int(a)-int(b))
    elif op=="*":
        print(int(a)*int(b))
    elif op=="/":
        print(int(a)//int(b))
    else:
        break


Measured memory_bytes: 5592
#include<iostream>
#include<iomanip>
#include<string>
#include<array>
#include<cmath>
#include<vector>
#include<utility>
#include<algorithm>
using namespace std;


int main() {
	int n,ans=0;
	array<int, 25> v,c;
	cin >> n;
	for (int i = 1; i <= n;i++) {
		cin >> v[i];
	}
	for (int i = 1; i <= n; i++) {
		cin >> c[i];
	}
	for (int i = 1; i <= n; i++) {
		if (v[i]>c[i]) {
			ans += v[i] - c[i];
		}
	}
	cout << ans;
}


Measured memory_bytes: 256
# Problem - カードゲーム

# input
n = int(input())

# initialization
taro_score = 0
hanako_score = 0

# count
for i in range(n):
    taro, hanako = input().split()
    if taro>hanako:
        taro_score += 3
    elif taro<hanako:
        hanako_score += 3
    else:
        taro_score += 1
        hanako_score += 1

# output
print("%d %d"%(taro_score, hanako_score))



Measured memory_bytes: 5600
use std::cmp::Ordering;
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char) 
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let n: usize = read();
    let v: Vec<isize> = (0..n).map(|_| read()).collect();

    let (sorted, cnt) = bubble_sort((&v).iter().collect());
    let st: String = sorted.iter().map(|i| i.to_string()).collect::<Vec<String>>().join(" ");
    println!("{}\n{}", st, cnt)
}

fn bubble_sort<T: Ord>(v: Vec<&T>) -> (Vec<&T>, usize) {
    match step(v) {
        (p, 0) => (p, 0),
        (p, cnt) => {
            let (p, pcnt) = bubble_sort(p);
            (p, cnt+pcnt)
        },
    }
}

fn step<T: Ord>(v: Vec<&T>) -> (Vec<&T>, usize) {
    match (v.get(0), v.get(1)) {
        (Some(&a), Some(&b)) => {
            let (a, b, cnt) = swap(a, b);
            let (p, pcnt) = step(insert_head(b, v[2..].into()));
            (insert_head(a, p), cnt+pcnt)
        },
        _ => (v, 0),
    }
}

fn swap<'a, T: Ord>(a: &'a T, b: &'a T) -> (&'a T, &'a T, usize) {
    match a.cmp(&b) {
        Ordering::Greater => (b, a, 1),
        _ => (a, b, 0),
    }
}

fn insert_head<'a, T>(a: &'a T, p: Vec<&'a T>) -> Vec<&'a T> {
    [vec![a], p]
        .iter()
        .flat_map(|s| s.iter().map(|&i| i))
        .collect()
}



Measured memory_bytes: 5084
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i) = 0; (i) < (n); ++(i))
#define rrep(i,n) for(int (i) = (n) - 1; (i) >= 0; --(i)) //Reversi rep
#define nfor(i,a,b) for(int (i) = (a); (i) < (b); ++(i)) //Natural for
#define rfor(i,a,b) for(int (i) = (b); (i) >= (a); --(i)) //Reversi for
#define ll long long
#define mod (1000000007)
#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;

int asc(const void *a, const void *b) {
    return *(int *)a - *(int *)b;
}

int desc(const void *a, const void *b) {
    return *(int *)b - *(int *)a;
}

int main()
{
    int n,button = 1;
    cin >> n;
    int a[n];
    rep(i, n)cin >> a[i];
    rep(i, n){
        button = a[button - 1];
        if (button == 2) {
            cout << i+1 << endl;
            return 0;
        }
    }
    cout << -1 << endl;
    return 0;
}


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

public class Main {
  Scanner sc = new Scanner(System.in);

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

  void run() {
    int n = ni();
    int[] a = new int[n];
    for (int i = 0; i < n; ++i) {
      a[i] = ni();
    }
    int max = 1;
    long cnt = a[0] - 1;
    for (int i = 1; i < n; ++i) {
      if (a[i] == max + 1) {
        ++max;
        continue;
      }
      long v = (a[i] - 1) / (max + 1);
      cnt += v;
    }
    System.out.println(cnt);
  }

  int ni() {
    return Integer.parseInt(sc.next());
  }

  void debug(Object... os) {
    System.err.println(Arrays.deepToString(os));
  }
}

Measured memory_bytes: 32276
#include <stdio.h>
#include <iostream>
#include <vector>
#include <assert.h>
#include <set>
#include <map>
#include <cmath>
#include <queue>
#include <stack>
#include <bitset>
#include <string>
#include <sstream>
#include <memory.h>
#include <time.h>
#include <string.h>
#include <stdlib.h>
#include <functional>
#include <algorithm>
using namespace std;
typedef long long ll;
int main()
{
	int n, e;
	scanf("%d%d", &n, &e);
	vector<int> in(n), dp(n);
	vector<vector<int> > g(n);
	for (int i = 0, a, b; i < e; ++i) {
		scanf("%d%d", &a, &b);
		--a; --b;
		g[a].push_back(b);
		++in[b];
	}
	int res = 0;
	queue<int> q;
	for (int i = 0; i < n; ++i)
		if (in[i] == 0)
			q.push(i);
	while (!q.empty()) {
		int u = q.front();
		q.pop();
		res = max(res, dp[u]);
		for (auto &v : g[u]) {
			dp[v] = max(dp[v], dp[u] + 1);
			if (--in[v] == 0)
				q.push(v);
		}
	}
	printf("%d\n", res);
	return 0;
}

Measured memory_bytes: 6528
import java.util.Comparator;
import java.util.List;
import java.util.Scanner;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
import java.util.stream.LongStream;

public class Main {
    public static void main(final String[] args) {
        final Scanner scanner = new Scanner(System.in);
        final int n = scanner.nextInt();
        final List<Child> children = IntStream.rangeClosed(1, n)
                .mapToObj(i -> new Child(scanner.nextLong(), i))
                .sorted(Comparator.comparingLong(child -> -child.value))
                .collect(Collectors.toList());

        final long[][] dpTable = new long[n + 1][n + 1];
        for (int i = 1; i <= n; i++) {
            final Child child = children.get(i - 1);
            dpTable[i][0] = dpTable[i - 1][0] + child.value * (child.position - i);
            dpTable[0][i] = dpTable[0][i - 1] + child.value * (n - i + 1 - child.position);
            for (int j = 1; j < i; j++) {
                final int diff = i - j;
                dpTable[j][diff] = Math.max(dpTable[j - 1][diff] + child.value * (child.position - j), dpTable[j][diff - 1] + child.value * (n - diff + 1 - child.position));
            }
        }

        final long answer = LongStream.range(0, n)
                .map(i -> dpTable[(int) i][n - (int) i])
                .max().orElseThrow();
        System.out.println(answer);
    }

    static class Child {
        final long value;
        final long position;

        public Child(final long value, final long position) {
            this.value = value;
            this.position = position;
        }
    }
}


Measured memory_bytes: 86744
#include <iostream>
#include <cstdio>
#include <iomanip>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <bitset>
#include <stack>
#include <utility>
#include <numeric>
#include <algorithm>
#include <functional>
#include <cctype>
#include <complex>
#include <string>
#include <sstream>

using namespace std;

#define all(c) c.begin(),c.end()
#define rall(c) c.rbegin(),c.rend()
#define mp(a,b) make_pair((a),(b))
#define eq ==

typedef long long ll;
typedef complex<double> point;
typedef pair<int,int> pii;

// →↑←↓
const int dx[] = {1,0,-1,0};
const int dy[] = {0,-1,0,1};


const double EPS = 1e-9;

void cerr_bits(ll nyan){
    for(int i=31;i>=0;i--){
        if(nyan & (1 << i)) cout << 1;
        else cout << 0;
    }
    cout << endl;
}

int main(){
    int S;
    cin >> S;
    cin >> hex;
    cout << hex;

    for(int t_case=0;t_case<S;t_case++){
        vector<ll> nyan(8);
        for(int i=0;i<8;i++){
            cin >> nyan[i];
        }
        ll checksum;
        cin >> checksum;

        ll key = 0;

        for(int i=0;i<32;i++){
            ll sum = 0;
            for(int j=0;j<8;j++){
                sum += nyan[j] ^ key;
            }
            if((sum & (1ll << i)) != (checksum & (1ll << i))){
                key = key | (1ll << i);
            }
        }

        cout << key << endl;
    }
    return 0;
}

Measured memory_bytes: 1196
import java.lang.reflect.Array;
import java.util.*;
import java.io.*;
import java.lang.*;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);

        int a = sc.nextInt();
        int b = sc.nextInt();

        if (b>=a)
            System.out.println("unsafe");
        else
            System.out.println("safe");
    }
}


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

#define sz size
#define pb push_back

const int N = 1e5 + 123;

int n, m, ans, usd[N], was[N];
int main() {
	//freopen("input.txt", "r", stdin);
	cin >> n >> m;
	for(int i = 1; i <= n; ++i) usd[i] = 1;
	was[1] = 1;
	for(int i = 1; i <= m; ++i) {
		int x, y;
		cin >> x >> y;
		++usd[y];
		--usd[x];
		if(was[x]) {
			was[y] = 1;
			if(!usd[x]) was[x] = 0;
		}
	}
	for(int i = 1; i <= n; ++i) {
		if(was[i]) ++ans;
	}
	cout << ans;
}

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

class Program
{
	static int[] AN;
	static int counter = 0;

	static void Checker(){
			int length = AN.Length;
			bool allEven = true;
			for(int i=0; i<length; i++){
					if(AN[i] % 2 != 0){
							allEven = false;
							break;
						}
					}

			if(allEven){
					counter += 1;
					for(int i=0; i<length; i++){
							AN[i] /= 2;
							}
					Checker();
			}
		}

	static void Main(string[] args)
	{
		//読み込む
		int N = int.Parse(Console.ReadLine());
		AN = Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray();

		//関数を実行
		Checker();

		//出力
		Console.WriteLine(counter);
	}
}


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


def main():
    a, b, c = map(int, input().split())
    max_number = max(a, b, c)

    while True:
        diff = 3 * max_number - sum([a, b, c])

        if diff % 2 == 0:
            print(diff // 2)
            exit()
        else:
            max_number += 1


if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#include <stdio.h>
void swap(int *a,int *b){
	int t;
	t=*a;
	*a=*b;
	*b=t;
}
//void swap(int &a,int &b);
int main(){
	int i,j,data[10];
	for(i=0;i<10;i++) scanf("%d",&data[i]);
	for(i=0;i<3;i++){
		for(j=i+1;j<10;j++) if(data[j]>=data[i]) swap(&data[i],&data[j]);
	}
	printf("%d\n%d\n%d\n",data[0],data[1],data[2]);
	return 0;
}

Measured memory_bytes: 600
n = int(input())

class Node():
    def __init__(self,id):
        self.id = id
        self.child = []
        self.parent = -1

    def addChild(self,child):
        self.child = child

    def setParent(self,parent):
        self.parent = parent

nodes = {}
for i in range(n):
    line = list(input().split(" "))
    id = int(line[0])
    if not id in nodes:
        nodes[id] = Node(id)
    child = []
    for j in range(1,3):
        if not int(line[j]) == -1:
            child.append(int(line[j]))
    nodes[id].addChild(child)

    for ele in child:
        if not ele in nodes:
            nodes[ele] = Node(ele)
        nodes[ele].setParent(id)

def culcHeight(nodes,id,counter):
    objNode = nodes[id]
    children = objNode.child
    if children == []:
        return counter
    else:
        counter += 1
        results = []
        for chili in children:
            a = culcHeight(nodes,chili,counter)
            results.append(a)
        return max(results)

for i in sorted(nodes):
    node = nodes[i]
    ans = ''
    ans += 'node ' + str(i) + ': parent = '
    ans += str(node.parent) + ', sibling = '


    if node.parent == -1:
        ans += str(-1)
        children = []
    else:
        children = nodes[node.parent].child
        if children == [node.id]:
            ans += str(-1)
        else:
            for k in children:
                if not k == i:
                    ans += str(k)



    ans += ', degree = ' + str(len(node.child))


    ans += ', depth = '


    startnode = node
    count = 0
    while not startnode.parent == -1:
        startnode = nodes[startnode.parent]
        count += 1
    ans += str(count)


    ans += ', height = '
    ans += str(culcHeight(nodes,i,0))
    ans += ', '
    if node.parent == -1:
        type = 'root'
    else:
        if node.child == []:
            type = 'leaf'
        else:
            type = 'internal node'
    ans += type
    print(ans)



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

using namespace std;

int main(){

   // freopen ("input.txt", "r", stdin);

    int n;

    cin >> n;

    long long int total = 0;

    for(int i=1; i<=n; i++){

        if (i % 15 == 0 || i % 3 == 0 || i % 5 == 0)
            continue;
        else
        {
            total += i;
        }

    }

    cout << total << endl;


    return 0;
}

Measured memory_bytes: 3588
#include <iostream>
#include <bits/stdc++.h>
#include <vector>
#include <string>
#include <string.h>

using namespace std;
#define ll long long int

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

	ll n;
	cin>>n;
	if(n%2==0){
		cout<<"-1"<<endl;
		return 0;
	}
	ll count=1, num=7;
	while(num%n){
		num%=n;
		num*=10;
		num+=7;
		count++;
		if(count>n){
			cout<<"-1"<<endl;
			return 0;
		}
		// cout<<num<<endl;
	}
	cout<<count<<endl;
	return 0;
}


Measured memory_bytes: 3636
#include <algorithm>
#include <cassert>
#include <climits>
#include <cstdio>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <utility>
#include <vector>

using namespace std;

template <class T>
bool chmax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}

const int INF = 1e9;
const long long LINF = 1e18;

int main() {
    int N;
    cin >> N;
    vector<int> L(N);

    for (int i = 0; i < N; i++) {
        cin >> L[i];
    }

    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 ((L[i] < L[j] + L[k]) && (L[j] < L[i] + L[k]) && (L[k] < L[i] + L[j])) {
                    ans++;
                }
            }
        }
    }

    cout << ans << endl;

    return 0;
}


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

int main(){
    int n;
    cin>>n;
    int mn = INT_MAX;
    int mx = 0;
    for(int i = 0; i < n; i++){
        int t;cin>>t;
        mn = min(mn,t);
        mx = max(mx,t);
    }
    cout<<abs(mx-mn);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep2(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define ll long long
#define ld long double
#define all(a) (a).begin(),(a).end()

int main() {
  int n;
  cin>>n;
  vector<ll> lucas(86);
  lucas[0]++;
  lucas[1]+=3;
  rep2(i,2,n) lucas[i]+=lucas[i-1]+lucas[i-2];
  cout<<lucas[n-1]<<endl;
return 0;
}


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


def pm(n):
    return 1 if n % 2 == 0 else -1


for i in range(8):
    tmp = sorted([pm(i // 4) * x + pm(i // 2) * y + pm(i) * z for x, y, z in cakes], reverse=True)
    res.append(sum(tmp[:M]))
print(max(res))


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

int main() {
  char x;
  cin >> x;
  if (x=='a'||x=='i'||x=='u'||x=='e'||x=='o') {
    cout << "vowel" << endl;
  }
  else {
    cout << "consonant" << endl;
  }
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
using namespace std;
char S[400010],T[200010];
int lasapp[400010][30];
int ls,lt,prt;
long long ans;
int main(){
	scanf(" %s %s",S+1,T+1);
	ls=strlen(S+1);lt=strlen(T+1);
	memset(lasapp,-1,sizeof lasapp);
	for(int i=ls+1;i<=2*ls;i++)	S[i]=S[i-ls];
	for(int i=2*ls;i+1;i--){
		for(int j=0;j<26;j++)	lasapp[i][j]=lasapp[i+1][j];
		if(i!=2*ls)	lasapp[i][S[i+1]-'a']=i+1;
	}
	for(int i=1;i<=lt;i++){
		if(lasapp[prt][T[i]-'a']==-1){
			printf("-1");
			return 0;
		}
		ans+=lasapp[prt][T[i]-'a']-prt;
		prt=lasapp[prt][T[i]-'a']%ls;
	}
	printf("%lld",ans);
	return 0;
}

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

#define FOR(i, a, b) for (int (i) = (a); (i) < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define TRACE(x) cerr << #x << " " << x << endl
#define eb emplace_back
#define _ << " " <<
typedef long long ll;
typedef std::pair<int, int> ii;
#define X first
#define Y second
#define double long double
typedef double db;
using namespace std;

const int MaxN = 300100;
const ll Mod = 998244353;

ll A, B, N, K;
ll fac[MaxN];
ll binom[MaxN];

inline ll mul(ll x, ll y) {
  return x * y % Mod;
}

ll pot(ll b, ll exp) {
  if (exp == 0) return 1;
  if (exp % 2 == 1) return mul(b, pot(b, exp - 1));
  ll t = pot(b, exp/2);
  return mul(t, t);
}

ll inv(ll x) {
  return pot(x, Mod - 2);  
}

ll add(ll x, ll y) {
  return (x + y) % Mod;
}

ll binomN(ll x){
  return mul(fac[N], inv(mul(fac[N-x], fac[x])));
}

void prec() {
  fac[0] = 1;
  FOR(i, 1, N + 5) {
    fac[i] = mul(fac[i-1], i);    
  }
  FOR(i, 0, N + 1) {
    binom[i] = binomN(i);
//    TRACE(i _ binom[i]);
  }
}

void solve() {
  prec();
  ll ret = 0;

  FOR(i, 0, N + 1) {
    if (A * i <= K) {
      ll ost = K - A*i;
      if (ost % B == 0 ) {
        ll j = ost / B;
        if (0 <= j && j <= N)
          ret = add(ret, mul(binom[i], binom[j]));
        
      }
    }
  }

  cout<<ret<<endl;
}

void load() {
  cin>>N>>A>>B>>K;
}

int main(){
//  ios_base::sync_with_stdio(false);
  load();	
  solve();
  return 0;
}




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

#define int long long
#define rep(i, a, n) for (int i = a; i < n; i++)
#define pb push_back
#define eb emplace_back
#define dump(x) cout << #x << " = " << (x) << endl
#define chk() cout << "now" << endl;
#define ALL(x) (x).begin(), (x).end()
#define SORT(c) sort((c).begin(), (c).end())
#define SORTG(c) sort(ALL(c), greater<int>());
#define fi first
#define se second
int INF = 1e9 + 7;

typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<vector<int>> mat;

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 k,x;

void solve() {
  cin>>k>>x;
  int a=x-k+1;
  int b=x+k-1;
  if(a<-1000000) a=-1000000;
  if(b>1000000) b=1000000;
  rep(i,a,b+1) cout<<i<<" ";
  cout<<endl;
}

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

  // cout << fixed << setprecision(10);

  solve();

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <utility>
#include <map>
#include <vector>
#include <algorithm>
#include <queue>
#include <math.h>
#include <stack>
#include <set>
#include <deque>
#include <cmath>

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

int main(){
    int a, b;
    cin >> a >> b;
    for ( int i = 1; i <= 1100; ++i ) {
        if ( i * 8 / 100 == a && i * 10 / 100 == b ) {
            cout << i << endl;
            return 0;
        }
    }
    cout << -1 << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		while (true) {
			int n = scanner.nextInt();
			if (n == 0)
				break;
			int m = scanner.nextInt();
			int[] num = new int[1000001];
			int count = 0;
			for (int i = 1; i <= 1000000; i++) {
				if (slove(i)) {
					count++;

				}
				num[i] = count;
			}
			System.out.println(num[m] - num[n - 1]);
		}
	}

	private static boolean slove(int i) {
		while (true) {
			if (i % 2 == 0) {
				i /= 2;
			} else if (i % 3 == 0) {
				i /= 3;
			} else if (i % 5 == 0) {
				i /= 5;
			} else {
				break;
			}
		}

		return i == 1;
	}
}

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

#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999
#define MOD 1000000007

using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;

int iy[]={0, 0, 1, -1};
int ix[]={1, -1, 0, 0};

long long int n, m;

int main(){
	cin >> n >> m;
	if(n==1&&m==1){
		cout << 1 << endl;
	}else if(n==1){
		cout << m-2 << endl;
	}else if(m==1){
		cout << n-2 << endl;
	}else if(n==2||m==2){
		cout << 0 << endl;
	}else{
		cout << (n-2)*(m-2) <<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cctype>
#include <cmath>
#include <stdio.h>
#include <algorithm>
#include <vector>
#define MAXSIZE 200000
#define PI 3.141592653589
using namespace std;



int main(){
  int n;
  std::cin >> n;
  int x[100];
  for(int i=0;i<n;i++){
    std::cin >> x[i];
  }

  std::vector<int> v;

  for(int i=0;i<n;i++){
    int flag=0;
    for(int j=0;j<v.size();j++){
      if(x[i]==v[j]){
        flag=1;
        break;
      }
    }
    if(flag==0){
      v.push_back(x[i]);
    }
  }

  std::cout << v.size() << '\n';

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define DAU  ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define PLEC return 0;
using namespace std;
int freq[10005], n, p, p10(1), curr;
long long res;
string s;
int main() {
    DAU
    cin >> n >> p >> s;
    if (p == 2 || p == 5) {
        for (int i = 0; i < n; ++i)
            if ((s[i] - '0') % p == 0)
                res += i + 1;
        cout << res;
        PLEC
    }
    reverse(s.begin(), s.end());
    freq[0] = 1;
    for (const char& ch : s) {
        curr = (curr + p10 * (ch - '0')) % p;
        res += freq[curr];
        ++freq[curr];
        p10 = (10 * p10) % p;
    }
    cout << res;
    PLEC
}


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

int main(void)
{
  int buf;
  int a_sum = 0;
  int b_sum = 0;
  for (int i = 0; i < 4; i++)
  {
    cin >> buf;
    a_sum += buf;
  }

  for (int i = 0; i < 4; i++)
  {
    cin >> buf;
    b_sum += buf;
  }

  cout << ( a_sum < b_sum ? b_sum : a_sum) << endl;
  return 0;
}

Measured memory_bytes: 1156
import sys
import heapq, math
from itertools import zip_longest, permutations, combinations, combinations_with_replacement
from itertools import accumulate, dropwhile, takewhile, groupby
from functools import lru_cache
from copy import deepcopy

S = input()
L = len(S)

dp = [0] * (L + 1)
pow = [1] * (L + 1)
cnt = [0] * 2019

ans = 0
for i in range(L):
    pow[i + 1] = pow[i] * 10 % 2019
    dp[i + 1] = (dp[i] + int(S[L - i - 1]) * pow[i]) % 2019
    if dp[i + 1] == 0:
        cnt[dp[i + 1]] += 1
        ans += cnt[dp[i + 1]]
    else:
        ans += cnt[dp[i + 1]]
        cnt[dp[i + 1]] += 1

print(ans)

Measured memory_bytes: 24180
import collections

N = int(input())
A = list(map(int,input().split()))
ans = 0

L = [A[x]+x+1 for x in range(N)]
R = [x+1-A[x] for x in range(N)]

cL = collections.Counter(L)
cR = collections.Counter(R)

cRlist = list(cR.keys())

for i in range(len(cRlist)):
    tmp = cRlist[i]
    ans += cR.get(tmp,0) * cL.get(tmp,0)
    
print(ans)

Measured memory_bytes: 63316
#include<bits/stdc++.h>
using namespace std;
template<class TH> void _dbg(const char *sdbg, TH h){ cerr<<sdbg<<'='<<h<<endl; }
template<class TH, class... TA> void _dbg(const char *sdbg, TH h, TA... a) {
  while(*sdbg!=',')cerr<<*sdbg++;
  cerr<<'='<<h<<','; _dbg(sdbg+1, a...);
}
template<class T> ostream &operator<<(ostream& os, vector<T> V) {
  os << "["; for (auto vv : V) os << vv << ","; return os << "]";
}
template<class L, class R> ostream &operator<<(ostream &os, pair<L,R> P) {
  return os << "(" << P.first << "," << P.second << ")";
}
#define debug(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
typedef long long ll;
const int maxn=1e5+233;

int n,m;
int c[maxn];
bool vis[maxn];
int head[maxn],tot;
struct Edge{
	int v,to,w;
}e[maxn<<2];
inline void addedge(int u,int v,int w){
	e[tot].v=v;e[tot].w=w;
	e[tot].to=head[u];
	head[u]=tot++;
	
	e[tot].v=u;e[tot].w=w;
	e[tot].to=head[v];
	head[v]=tot++;
}
void dfs(int u,int d){
	vis[u]=true;
	for(int i=head[u];i!=-1;i=e[i].to){
		int v=e[i].v;
		if(vis[v])continue;
		d+=e[i].w;
		if(d&1)c[v]=!c[1];
		dfs(v,d);
		d-=e[i].w;
	}
}
int main()
{
	scanf("%d",&n);
	memset(head,-1,sizeof(head)); 
	int u,v,w;
	for(int i=1;i<n;i++){
		scanf("%d %d %d",&u,&v,&w);
		addedge(u,v,w);
	}
	c[1]=0;
	dfs(1,0);
	for(int i=1;i<=n;i++)printf("%d\n",c[i]);
    return 0;
}




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

using i32 = int_fast32_t;
using i64 = int_fast64_t;

int main() {
    i32 n, x, y;
    cin >> n >> x >> y, x--, y--;
    vector<i32> ans(n);
    for (i32 i = 0; i < n; i++) {
        for (i32 j = i+1; j < n; j++) {
            i32 d = min({ abs(j-i), abs(x-i) + 1 + abs(j-y), abs(y-i) + 1 + abs(j-x) });
            ans[d]++;
        }
    }

    for (i32 i = 1; i < n; i++) {
        cout << ans[i] << endl;
    }
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <numeric>
#include <cmath>
#include <vector>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, k, n) for(int i = (k); i < (int)(n); i++)
using namespace std;
using ll = long long;

int main(){
    int N, cnt = 0, ans = 0, tmp = 0;
    vector<int> nums(3);
    rep(i, 3) cin >> nums.at(i);
    sort(nums.begin(), nums.end());
    cout << nums.at(2) * 10 + nums.at(1) + nums.at(0) << endl;
    return 0;
    
}

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

using namespace std;

//FILE *fi=freopen("1.txt","r",stdin);

int n,a[101];

void nhap()
{
    scanf("%d",&n);
    for (int i=1;i<=n;++i)
    {
        scanf("%d",&a[i]);
    }
}

void process()
{
    long long kq=1e18;
    for (int i=1;i<=100;++i)
    {
        long long mi=0;
        for (int j=1;j<=n;++j)
        {
            mi+=abs(a[j]-i)*abs(a[j]-i);
        }
        kq=min(kq,mi);
    }
    cout<<kq;
}

int main()
{
    nhap();
    process();
    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <functional>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <cassert>
#define SIZE 5005

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

char S[SIZE],T[SIZE];
vector <int> vx,vy;
int n;

ll score(int T)
{
	ll ret=0;
	for(int i=0;i<n;i++)
	{
		ret+=abs(vx[i]-vy[i]+2*T);
	}
	return ret;
}
int main()
{
	scanf("%d",&n);
	scanf("%s",&S);
	scanf("%s",&T);
	int now=0;
	for(int i=0;now<n;i++)
	{
		while(now<n&&S[now]-'0'==i%2) vx.push_back(i),now++;
	}
	now=0;
	for(int i=0;now<n;i++)
	{
		while(now<n&&T[now]-'0'==i%2) vy.push_back(i),now++;
	}
	int l=-n,r=n;
	while(r-l>1)
	{
		int d=(l+r+2*n)/2-n;
		if(score(d+1)-score(d)>=0) r=d;
		else l=d;
	}
	printf("%lld\n",min(score(l),score(r)));
	return 0;
}


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

int index(int numToFind, std::vector<int> vectorToFindIn) {int len = vectorToFindIn.size();for (int i = 0; i < len; i++){if (vectorToFindIn[i] == numToFind){return i;}}return -1;}

ll gcd(ll a,ll b)
{
	if (b==0) return a;
	return gcd(b,a%b);
}
string to_upper(string a)
{
	for (int i=0;i<(int)a.size();++i) if (a[i]>='a' && a[i]<='z') a[i]-='a'-'A';
	return a;
}
 
string to_lower(string a)
{
	for (int i=0;i<(int)a.size();++i) if (a[i]>='A' && a[i]<='Z') a[i]+='a'-'A';
	return a;
}

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	int n;
	double k;
	cin>>n;
	int a[n];
	for (int i=0;i<n;++i)
	{
		cin>>a[i];
	}
	sort(a,a+n);
	k=a[0];
	for (int i=1;i<n;++i)
	{
		k+=a[i];
		k/=2;
	}
	cout<<setprecision(10)<<k;
	return 0;
}

Measured memory_bytes: 256