akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const ll mod=1e9+7;
const int Max_digit=9;
ll N;
ll ans=0;
int numlist[]={3,5,7};

bool useallnumbers(ll x){
  bool check[3]={0};
  while(x>0){
    int tmp=x%10;
    switch (tmp)
    {
    case 3:
      check[0]=true;
      break;
    case 5:
      check[1]=true;
      break;
    case 7:
      check[2]=true;
      break;
    default:
      break;
    }
    x/=10;
  }
  if(check[0]&&check[1]&&check[2]) return 1;
  else return 0;
}

void dfs(ll x,ll digit){
  for(int i=0;i<3;i++){
    if(x+numlist[i]*pow(10,digit)<=N){
      if(useallnumbers(x+numlist[i]*pow(10,digit))) ans++;
      dfs(x+numlist[i]*pow(10,digit),digit+1);
    }
  }
}

int main(){
  cin>>N;
  
  dfs(0,0);

  cout<<ans<<endl;
  return 0;
}



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

using namespace std;

const int MAX_N = 10000000;
int par[MAX_N];
int rk[MAX_N];

void init(int n){
    for(int i=0; i<n; i++){
        par[i] = i;
        rk[i] = 0;
    }
    return;
}

int find(int x){
    if(par[x] == x){
        return x;
    }else{
        return par[x] = find(par[x]);
    }
}

void unite(int x, int y){
    x = find(x);
    y = find(y);

    if(x == y) return;

    if(rk[x] < rk[y]){
        par[x] = y;
    }else{
        par[y] = x;
        if(rk[x] == rk[y]) rk[x]++;
    }
}

bool same(int x, int y){
    return find(x) == find(y);
}

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

    init(n);

    vector<int> ans;
    for(int i=0; i<q; i++){
        int com, x, y;
        cin >> com >> x >> y;

        if(com == 0) unite(x, y);
        else ans.push_back(same(x, y));
    }

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

    return 0;
}


Measured memory_bytes: 3344
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  int a[100009];
  cin>>n;
  int last=0;
  for(int i=0;i<n;i++)cin>>a[i];
  long long ans=0;
  for(int i=0;i<n-1;i++){
    if(a[i+1]!=0){
      a[i+1]+=a[i]%2;
    }
    ans+=a[i]/2;
  }
  ans+=a[n-1]/2;
  cout<<ans<<endl;
  return(0);
}


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

typedef long long ll;
typedef long double ld;

#define pb push_back
#define sort(s) sort(s.begin(),s.end())
#define reverse(s) reverse(s.begin(),s.end())
#define rep(i,n) for(ll (i)=0;(i)<(n);(i)++)

const ll mod = 1e9+7;

//最大公約数
ll gcd(ll a, ll b) {
    return b ? gcd(b, a%b) : a;
}

//最小公倍数
ll lcm(ll a, ll b) {
    return a / gcd(a, b) * b;
}

//素数判定
bool isPrime(ll x){
    ll i;
    if(x < 2)return 0;
    else if(x == 2) return 1;
    if(x%2 == 0) return 0;
    for(i = 3; i*i <= x; i += 2) if(x%i == 0) return 0;
    return 1;
}

//桁和
int digsum(ll n) {
    int res = 0;
    while(n > 0) {
        res += n%10;
        n /= 10;
    }
    return res;
}

//桁数
int dignum(ll n) {
    int res = 0;
    while(n > 0) {
        res++;
        n /= 10;
    }
    return res;
}

//文字列中の特定の文字カウント
ll stringcount(string s,char c){
    return count(s.cbegin(),s.cend(),c);
}

//階乗
ll ka(ll i){
    ll res=1;
    while(i>0){
        res=res*i;
        i--;
    }
    return res;
}
 
//ncr
ll ncr(ll x,ll y){
    ll a = x;
    ll b = 1;
    if(y>(x/2)){
        y=x-y;
    }
    for(ll i=1;i<y;i++){
        a*=x-i;
        b*=i+1;
    }
    return a/b;
}

//フィボナッチ数列
ll f(ll x){
    ll dp[x+1];
    dp[1]=1;
    dp[2]=1;
    for(ll i=3;i<=x;i++){
        dp[i]=dp[i-1]+dp[i-2];
    }
    return dp[x];
}

//char->int
int ctoi(char c){
    return c-'0';
}



int main(){
    string s,t;
    cin >> s >> t;
    int count = 0;

    for(int i=0;i<s.size();i++){
        if(s[i]!=t[i]){
            count++;
        }
    }

    cout << count << endl;
}


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

int main(){
  int n;cin>>n;
  vector<ll> a(n);
  rep(i,n)cin>>a[i];
  vector<ll> sum(n+1);
  rep(i,n)sum[i+1]=sum[i]+a[i];
  map<ll,ll> mp;
  rep(i,n+1)mp[sum[i]]++;
  ll ans=0;
  for(auto x:mp){
    ans+=x.second*(x.second-1)/2;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 18668
#include <bits/stdc++.h>
#include <string>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define repp(i,n,m) for (int i = m; i < (n); ++i)
#define repl(i,n) for (long long i = 0; i < (n); ++i)
#define reppl(i,n,m) for (int i = m; i < (n); ++i)
using namespace std;
using ll = long long;

int main(){
    int n, x, y;
    cin >> n >> x >> y;
    vector<vector<int>> cs(n, vector<int>(n));
    rep(i,n){
        cs[i][i] = 0;
    }
    rep(i,n-1){
        cs[i][i+1] = 1;
    }
    cs[x-1][y-1] = 1;
    repp(j,y-1,x-1){
        repp(k,y,j+1){
            cs[j][k] = min(k-j, y-x+1-k+j);
        }
    }
    rep(i,x-1){
        repp(j,n,i+1){
            if (j <= x-1){
                cs[i][j] = j - i;
            }
            else if (j <= y-1){
                cs[i][j] = x-1 - i + cs[x-1][j];
            }
            else{
                cs[i][j] = x-1 - i + 1 + j - y+1;
            }
        }
    }
    repp(i,n-1,y){
        repp(j,n,i+1){
            cs[i][j] = j - i;
        }
    }
    repp(i,y,x-1){
        repp(j,n,y){
            cs[i][j] = cs[i][y-1] + j -y+1;
        }
    }
    vector<int> ko(n);
    rep(i,n){
        rep(j,n){
            ko[cs[i][j]]++;
        }
    }
    repp(i,n,1){
        cout << ko[i] << endl;
    }
}

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

ll A,B,C;
ll X;
ll ans;
int main(){

cin.tie(0);
ios::sync_with_stdio(false);
cin>>A>>B>>C>>X;

forn(i,A+1){
 forn(j,B+1){
  forn(k,C+1){
  	ll a=i*500;
  	ll b=j*100;
  	ll c=k*50;
  	if(a+b+c==X){
  		ans++;
  	}
  }
 }
}

cout<<ans<<endl;

}



Measured memory_bytes: 256
using System;
using System.Collections.Generic;
class P
{
    static void Main()
    {
        int n = int.Parse(Console.ReadLine());
        int k = 0;
        bool f = Judge(ref k, n);
        Console.WriteLine(f ? "Yes" : "No");
        if (!f)
            return;
        Console.WriteLine(k);
        List<List<int>> ans = new List<List<int>>();
        for (int i = 0; i < k; i++)
            ans.Add(new List<int>());
        int c = 1;
        for (int i = 0; i < k; i++)
        {
            for (int j = i + 1; j < k; j++)
            {
                ans[i].Add(c);
                ans[j].Add(c);
                c++;
            }
        }
        foreach (var l in ans)
        {
            Console.Write(k - 1);
            foreach (var i in l)
                Console.Write(" {0}", i);
            Console.WriteLine();
        }
    }
    static bool Judge(ref int k, int n)
    {
        int m = (int)Math.Pow(1 + 8 * n, 0.5);
        if (m * m != 1 + 8 * n)
            return false;
        else if (m % 2 == 0)
            return false;
        k = (1 + m) / 2;
        return true;
    }
}

Measured memory_bytes: 19396
#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;
//ll mod = 998244353;
#define rep(i,n) for(int i = 0; i < (n); ++i)

int main() {
    int n;
    cin >> n;
    string s, t;
    cin >> s >> t;
    rep(i, n) {
        bool ok = true;
        rep(j, n-i) {
            //cout << i << " " << s[j+i] << " " << t[j] << endl;
            if (s[j+i] != t[j]) {
                ok = false;
                break;
            }
        }
        if (ok) {
            cout << n + i << endl;
            return 0;
        }
    }
    cout << n * 2 << endl;
    return 0;
}


Measured memory_bytes: 3592
#include<stdio.h>
#define MAX 100

int selectionSort(int *,int);

int main()
{
  int n,i,a[MAX],count;

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

  count = selectionSort(a,n);

  for(i=0;i<n-1;i++){
    printf("%d ",a[i]);
  }
  printf("%d\n",a[n-1]);
  printf("%d\n",count);

  return 0;
}

int selectionSort(int *A,int N)
{
  int i,j,x,min,count=0;

  for(i=0;i<N-1;i++){
    min = i;
    
    for(j=i;j<N;j++){
      if(A[j] < A[min]) min = j;
    }
    
    x = A[i];
    A[i] = A[min];
    A[min] = x;
    if(min != i) count++;
  }
  return count;
}

  
  

  



Measured memory_bytes: 2128
from collections import deque
a=int(input())
list1=deque([1,2,3,4,5,6,7,8,9])
i=1
while(i<=a) :
  #print (list1)
  if i!=a :
    k=list1.popleft()
    k=str(k)
    if int(k[-1])==0 :
      list1.append(int(str(k)+'0'))
      list1.append(int(str(k)+'1'))
      i+=1
    elif int(k[-1])==9 :
      list1.append(int(str(k)+'8'))
      list1.append(int(str(k)+'9'))
      i+=1
    else :
      list1.append(int(str(k)+str(int(k[-1])-1)))
      list1.append(int(str(k)+str(int(k[-1]))))
      list1.append(int(str(k)+str(int(k[-1])+1)))
      i+=1
  else :
    print(list1[0])
    break


Measured memory_bytes: 50264
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<iostream>
#include<queue>
#include<vector>
using namespace std;
#define MAX 120

int a[MAX];

int main(){
  int n;
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>a[i];
  }
  sort(a,a+n);
  int odd,even;

  for(int i=0;i<n;i++){
    if(i%2==0) even+=a[i];
    else odd+=a[i];
  }

  int ans=even-odd;
  if(ans<0) ans=-1*ans;
  cout<<ans<<endl;
}


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

using namespace std;
#define int long long
#define rep(i, n) for(int i=0;i<(n);++i)
#define INF (1ll<<60)

namespace mod_int {
    const int mod = 1000000007;
    const int size = 100100;
    int fact[size];
    int inv[size];
    bool fact_evaluated;
    bool inv_evaluated;

    void evaluate_fact() {
        fact[0] = 1;
        for (int i = 1; i < size; ++i) {
            fact[i] = fact[i - 1] * i % mod;
        }
    }

    int mod_pow(int a, int b) {
        int res = 1;
        while (b > 0) {
            if (b & 1)res *= a;
            a *= a;
            a %= mod;
            res %= mod;
            b >>= 1;
        }
        return res;
    }

    void evaluate_inv() {
        inv[0] = 1;
        for (int i = 1; i < size; ++i) {
            inv[i] = inv[i - 1] * mod_pow(i, mod - 2) % mod;
        }
    }

    int combination(int n, int k) {
        if (k > n)return 0;
        if (k < 0)return 0;
        if (!fact_evaluated)evaluate_fact();
        if (!inv_evaluated)evaluate_inv();
        int res = fact[n] * inv[n - k] % mod * inv[k] % mod;
        return res;
    }
};

using namespace mod_int;

signed main() {
    int N, M;
    cin >> N >> M;
    evaluate_fact();
    if (N == M) {
        cout << fact[N] * fact[N] * 2 % mod << endl;
    } else if (N == M + 1) {
        cout << fact[N] * fact[M] % mod << endl;
    } else if (M == N + 1) {
        cout << fact[N] * fact[M] % mod << endl;
    } else {
        cout << 0 << endl;
    }
    return 0;
}


Measured memory_bytes: 1024
import re
a = input()
H = list(a)
n = len(H)
ans  = [0 for i in range(n)]
pattern = 'LR'
a = re.sub(pattern,'L R', a)
a = a.split(" ")
for i in range(n-1):
    if H[i] =="R" and H[i+1] =="L":
        ans[i] =1
        ans[i+1] =1

x =[]
for i in range(len(a)):
    a[i] = list(a[i])
    p = a[i].count('R')
    q = a[i].count('L')
    b = -(-p //2)+q//2
    c = -(-q //2)+p//2
    x.append(b)
    x.append(c)
j = 0
for i in range(n):
    if ans[i] ==1:
        ans[i] = x[j]
        j = j+1

for i in range(n):
    print(ans[i],end=' ')


Measured memory_bytes: 12372
import java.util.*;
public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int H = sc.nextInt();
		int N = sc.nextInt();
		int A[][] = new int[N][2];
		int max_A = 0;
		for(int i = 0; i < N; i++) {
			A[i][0] = sc.nextInt();
			A[i][1] = sc.nextInt();
			max_A = Math.max(max_A, A[i][0]);
		}
		
		int dp[][] = new int[N + 1][H + max_A + 1];
		for(int i = 0; i < N + 1; i++) {
			Arrays.fill(dp[i], Integer.MAX_VALUE / 2);
		}
		dp[0][0] = 0;
		
		for(int i = 0; i < N; i++) {
			for(int j = 0; j < H + max_A; j++) {
				if(A[i][0] <= j) {
					dp[i + 1][j] = Math.min(dp[i][j], dp[i + 1][j - A[i][0]] + A[i][1]);
				} else {
					dp[i + 1][j] = dp[i][j];
				}
			}
		}
		
		int ans = Integer.MAX_VALUE;
		for(int i = H; i < H + max_A; i++) {
			ans = Math.min(dp[N][i], ans);
		}
		System.out.println(ans);
	}
}


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

int main(void){
    int n = 0; 
    long long int ans = 1;

    scanf("%d", &n);

    for(int i = 1; i <= n; i++){
        ans *= i;
        if(ans >= 1000000007){
            ans = ans % 1000000007;
        }
//        printf("%lld\n", ans);
    }

    printf("%lld\n", ans);

    return 0;

} 


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

int cnt=0;

int insertionsort(int *r, int n, int g){
    int v,i,j;
    for(i=g;i<n;i++){
        v=r[i];
        j=i-g;
        while(j>=0 && v<r[j]){
            r[j+g]=r[j];
            j= j-g;
            cnt++;
        }
        r[j+g]=v;
    }
    return 0;
}

int shellsort(int *r, int n){
    
    int g[1000];
    int h[1000];
    int y;
    g[0]=1;
    for(int i=1;;i++){
        g[i]=3*g[i-1]+1;
        y=i;
        if(g[i]>n) break;
    }
    cout<<y<<endl;

    for(int i=0;i<y;i++){
        h[i]=g[y-1-i];
        if(i!=y-1)printf("%d ",h[i]);
        else printf("%d\n", h[i]);
    }

    for(int j=0;j<y;j++) insertionsort(r, n, h[j]);
    return 0;
}


int main(){
    int n;
    int r[10000000];
    cin>>n;
    for(int i=0;i<n;i++){
        scanf("%d", &r[i]);
    }

    shellsort(r, n);
    cout<<cnt<<endl;

    for(int j=0;j<n;j++) printf("%d\n", r[j]);

}


Measured memory_bytes: 7236
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ll;
typedef long long ull;
typedef long double ld;
#define in_arr(name,size) for(int i = 0;i<size;i++)\
cin >> name[i];
#define QUICK ios_base::sync_with_stdio(0);cout << fixed;
#define MOD 1e9+7

int main(){
    QUICK

    int maks = 0;
    int a,b;
    cin >> a >> b;
    vector<int>num(b);
    for(int i = 0;i<b;i++)
        cin >> num[i];
    sort(num.begin(),num.end());

for(int i = 0;i<b-1;i++)
{
    maks = max(maks,num[i+1]-num[i]);
}

    maks = max(maks, a-num[b-1]+num[0]);
    cout << a-maks;

   return 0;
}


Measured memory_bytes: 3932
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//cout << fixed << setprecision(17) << res << endl;
 
int main() {
    ll n;
    cin >> n;
    if (n < 1000) {
        cout << "ABC" << endl;
    } else {
        cout << "ABD" << endl;
    }
}


Measured memory_bytes: 256
open System

[<AutoOpen>]
module Cin =
    let readInt() = stdin.ReadLine() |> int
    let readLong() = stdin.ReadLine() |> int64
    let readLongArr() = stdin.ReadLine().Split(' ') |> Array.map int64
    let readString() = stdin.ReadLine()

let n = readInt()
let mutable ans = "No"

for a in 1 .. 9 do
    for b in 1 .. 9 do
        if a * b = n then ans <- "Yes"

printfn "%s" ans


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

bool isKaibun(string s)
{
  string t = s;
  reverse(s.begin(), s.end());

  return t == s;
}

void fail()
{
  cout << "No\n";
  exit(0);
}

void success()
{
  cout << "Yes\n";
  exit(0);
}

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

  string s;
  cin >> s;

  int n = s.length();

  if (!isKaibun(s)) fail();
  if (!isKaibun(s.substr(0, (n-1)/2))) fail();
  if (!isKaibun(s.substr((n+3)/2-1))) fail();

  success();

  return (0);
}


Measured memory_bytes: 3584
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s;cin>>s;
  if(s.at(0)=='A'){
    int p=0;
    for(int i=2;i<s.size()-1;i++){
      if(s.at(i)=='C')p++;
    }
    if(p==1){
      if(s.at(1)>='a'&&s.at(1)<='z'){
        int q=0;
        for(int i=2;i<s.size()-1;i++){
          if(s.at(i)!='C'&&s.at(i)>='A'&&s.at(i)<='Z')q++;
        }
        if(q==0){
          if(s.at(s.size()-1)>='a'&&s.at(s.size()-1)<='z')cout<<"AC"<<endl;
          else cout<<"WA"<<endl;
        }
        else cout<<"WA"<<endl;
      }
      else cout<<"WA"<<endl;
    }
    else cout<<"WA"<<endl;
  }
  else cout<<"WA"<<endl;
}
        


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

#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define IOS ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define F first
#define S second
#define int long long

int32_t main() {
	int n, m;
	cin >> n >> m;
	cout << ((n * n) + (m * m) - n - m) / 2;
	return 0;
}


Measured memory_bytes: 256
from itertools import *
from bisect import *
from math import *
from collections import *
from heapq import *
from random import *
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def MI1(): return map(int1, sys.stdin.readline().split())
def MF(): return map(float, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LI1(): return list(map(int1, sys.stdin.readline().split()))
def LF(): return list(map(float, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
dij = [(1, 0), (0, 1), (-1, 0), (0, -1)]

def main():
    m,n=MI()
    aa=LI()
    ans=0
    if m==2:
        for i,a in enumerate(aa):
            if i%2+1==a:ans+=1
        ans=min(ans,n-ans)
    else:
        cnt=1
        for a0,a1 in zip(aa,aa[1:]):
            if a0==a1:cnt+=1
            else:
                ans+=cnt//2
                cnt=1
        ans+=cnt//2
    print(ans)

main()



Measured memory_bytes: 19908
#[allow(unused_imports)]
use std::cmp::{min,max};
#[allow(unused_imports)]
use std::collections::BTreeMap;
#[allow(unused_imports)]
use std::ops::*;
#[allow(unused_imports)]
use std::collections::BinaryHeap;

fn main() {
    let n = read_i64();
    println!("{}", if n <= 999 { "ABC" } else { "ABD" });
}

#[allow(dead_code)]
fn read_line() -> String {
    let mut ret = String::new();
    std::io::stdin().read_line(&mut ret).ok();
    ret.pop();
    return ret;
}

#[allow(dead_code)]
fn read_i64() -> i64 {
    let ss = read_line();
    return ss.parse::<i64>().unwrap();
}

#[allow(dead_code)]
fn read_vec_i64() -> Vec<i64> {
    let mut res = vec![];
    let ss = read_line();
    for ts in ss.split_whitespace() {
        let x = ts.parse::<i64>().unwrap();
        res.push(x);
    }
    return res;
}

use std::fmt::Display;
#[allow(dead_code)]
fn write_vec<T: Display>(xs: &Vec<T>) {
    if xs.len() == 0 {
        println!("");
        return;
    }
    print!("{}", xs[0]);
    for i in 1..xs.len() {
        print!(" {}", xs[i]);
    }
    println!("");
}


Measured memory_bytes: 4352
N = int(input())
Llist = list(map(int,input().split()))

n =0
#print(Llist)
for i in range(N-2):
  for j in range(N-1):
    for k in range(N):
      if i<j and j<k and Llist[i]!=Llist[j] and Llist[j]!=Llist[k] and Llist[i]!=Llist[k] and Llist[i]+Llist[j]>Llist[k] and Llist[j]+Llist[k]>Llist[i] and Llist[i]+Llist[k]>Llist[j]:
        #print ('{}{}{}'.format(Llist[i], Llist[j], Llist[k]))
        #print ('{}{}{}'.format(i, j, k))
        n+=1
print(n)

Measured memory_bytes: 9184
import Foundation

#if swift(>=4.0)
extension String {
    func split(by separator: String) -> [String] {
        return self.components(separatedBy: separator)
    }
    func toArray() -> [String] {
        return self.map{String($0)}
    }
}
#else
extension String {
    func split(by separator: String) -> [String] {
        return self.componentsSeparatedByString(separator)
    }
    func count() -> Int {
        return self.characters.count
    }
    func toArray() -> [String] {
        return self.characters.map{String($0)}
    }
}
extension Array where Element: Comparable {
    func max() -> Element! {
        return self.maxElement()
    }
    func min() -> Element! {
        return self.minElement()
    }
    func sorted() -> Array {
        return self.sort()
    }
    func reversed() -> Array {
        return self.reverse()
    }
    mutating func sort() {
        self.sortInPlace()
    }
}
extension Array {
    init(repeating: Element, count: Int) {
        self.init(count: count, repeatedValue: repeating)
    }
}
func stride<T: Strideable>(from start: T, to end: T, by stride: T.Stride) -> StrideTo<T> {
    return start.stride(to: end, by: stride)
}
#endif
func readInt() -> Int? {
    return Int(readLine()!)
}
func readStringSplit(by separator: String) -> [String] {
    return readLine()!.split(by: separator)
}
func readIntSplit(by separator: String) -> [Int] {
    return readLine()!.split(by: separator).map{Int($0)!}
}

/*************** テストスペース ***************/



/*************** メインプログラム ***************/

let i = readIntSplit(by: " ")
print(i[0] + i[1]/2)


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

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define eb emplace_back

typedef long long ll;
typedef pair<int, int> pi;

const int maxn = 2e5 + 5;
vector<int> G[maxn];
int n;
int dep[maxn];

void dfs(int u, int fa, int d){
    dep[u] = d;
    for(auto v : G[u]){
        if(v == fa)
            continue;
        dfs(v, u, d + 1);
    }
}

bool win[maxn];

int main(){
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    cin >> n;
    for(int i = 1;i < n;i++){
        int u, v;
        cin >> u >> v;
        G[u].push_back(v);
        G[v].push_back(u);
    }
    dfs(1, 1, 0);
    int mx = 1;
    for(int i = 1;i <= n;i++){
        if(dep[i] > dep[mx]){
            mx = i;
        }
    }
    dfs(mx, mx, 0);
    for(int i = 1;i <= n;i++){
        if(dep[i] > dep[mx]){
            mx = i;
        }
    }
    int D = dep[mx] + 1;
    win[1] = true;
    win[2] = false;
    for(int i = 3;i < maxn;i++){
        if(win[i - 2] and win[i - 1]){
            win[i] = false;
        }else{
            win[i] = true;
        }
    }
    if(win[D]){
        cout << "First" << endl;
    }else{
        cout << "Second" << endl;
    }
    return 0;
}


Measured memory_bytes: 21504
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <cstdlib>  // abs() for integer
#include <math.h>     // math.h をインクルードする！
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

bool find_prime(int n) {
    for(int i = 2; i * i < n; i++) {
        //if(i == n) return false;  
        if (n % i == 0) return true;
    }
    return false;

}

int main() {
    int x;
    cin >> x;
    while(find_prime(x)) x++;
    cout << x << endl;
}

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

typedef long long ll;
typedef pair<ll,ll> pi;
typedef vector <ll> vi;
typedef vector <pi> vpi;
#define f first
#define s second
#define FOR(i,s,e) for(ll i=s;i<=ll(e);++i)
#define DEC(i,s,e) for(ll i=s;i>=ll(e);--i)
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define lbd(x, y) lower_bound(all(x), y)
#define ubd(x, y) upper_bound(all(x), y)
#define aFOR(i,x) for (auto i: x)
#define mem(x,i) memset(x,i,sizeof x)
#define fast ios_base::sync_with_stdio(false),cin.tie(0)

ll A,B,C,K;

int main(){
	fast;
	
	cin>>A>>B>>C>>K;
	
	ll ans = 0;
	
	ans += min(A,K);
	K -= min(A,K);
	
	K -= min(B,K);
	
	ans -= K;
	
	cout<<ans;
}



Measured memory_bytes: 3664
#include<algorithm>
#include<cmath>
#include<iostream>
using namespace std;
#define ll long long

struct node
{
    double x, y;
} p[10];
int main()
{
    int n;
    cin >> n;
    for (int i = 0; i < n; i++)
    {
        cin >> p[i].x >> p[i].y;
    }
    double sum = 0;
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < n; j++)
            sum += sqrt((p[i].x - p[j].x) * (p[i].x - p[j].x) + (p[i].y - p[j].y) * (p[i].y - p[j].y));
    }
    printf("%.10f\n", sum / n);

    return 0;
}

Measured memory_bytes: 632
#include <iostream>
#include <algorithm>

int main ( void ) {

	int n, m;
	std::cin >> n >> m;

	std::vector < std::string > data( n );
	for ( std::string& str : data ) {
		std::cin >> str;
	}

	sort ( data.begin(), data.end() );
	for ( const std::string& str : data ) {
		std::cout << str;
	}
	std::cout << std::endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
#define MOD (1000000007)
#define INF (1e9)
#define INFL (1e18)

typedef long long ll;
typedef unsigned int ui;
typedef unsigned long long ull;
template<class T>using arr=vector<vector<T>>;
template<class T>int popcount(T &a){int c=0; rep(i, 8*(int)sizeof(a)){if((a>>i)&1) c++;} return c;}
template<class T>void pr(T x){cout << x << endl;}
template<class T>void prvec(vector<T>& a){rep(i, a.size()-1){cout << a[i] << " ";} pr(a[a.size()-1]);}
template<class T>void prarr(arr<T>& a){rep(i, a.size()) if(a[i].empty()) pr(""); else prvec(a[i]);}
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; }

int main()
{
    ll l, r; cin >> l >> r;
    ll ans;
    if(r-l>=2018){
        ans = 0;
    }else{
        ans = INFL;
        l %= 2019;
        r %= 2019;
        if(l>=r) r += 2019;
        for(ll i=l; i<r; i++) for(ll j=i+1; j<r+1; j++) chmin(ans, (i*j)%2019);
    }
    pr(ans);
    return 0;}

Measured memory_bytes: 3644
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <vector>
using namespace std;
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    //freopen("test.inp","r",stdin);
    //freopen("test.out","w",stdout);
    long long n, W;
    cin>>n>>W;
    long long f[n+1][W+1], w[n], v[n];
    for (int i=1;i<=n;i++) cin>>w[i]>>v[i];
    for (long long i=0;i<=W;i++) f[0][i]=0;
    for (long long i=0;i<=n;i++) f[i][0]=0;
    for (long long i=1;i<=n;i++)
    {
        for (long long j=1;j<=W;j++)
        {
            if (w[i]>j) f[i][j]=f[i-1][j];
            else
                f[i][j]=max(f[i-1][j-w[i]]+v[i],f[i-1][j]);
        }
    }
    cout<<f[n][W];
    return 0;
}

Measured memory_bytes: 79232
def solve():
    n, m = map(int, input().split())
    ka = [list(map(int, input().split())) for _ in range(n)]
    common = set([i for i in range(1, m + 1)])
    for i in range(len(ka)):
        common = set(set(ka[i][1:]) & common)
    return len(common)


if __name__ == "__main__":
    print(solve())


Measured memory_bytes: 38256
mod = 1000000007

def pow_mod(x, y):
    res = 1
    while y > 0:
        if y % 2:
            res *= x
            res %= mod
        x *= x
        x %= mod
        y //= 2
    return res

def divs(x):
    res = []
    for i in range(1, x+1):
        if i * i > x:
            break
        if x % i != 0:
            continue
        res.append(i)
        if i != x // i:
            res.append(x // i)
    return res

N, K = list(map(int, input().split()))

num = [0] * 100010
for g in range(1, K+1):
    num[g] = pow_mod(K // g, N)


for x in range(K, 0, -1):
    div = divs(x)
    for i in div:
        if i == x:
            continue
        num[i] += mod - num[x]
        num[i] %= mod

ans = 0
for g in range(1, K+1):
    ans += g * num[g] % mod
    ans %= mod
print(ans)


Measured memory_bytes: 75128
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector> 
#include<limits>
#include<numeric>
#include<type_traits>
#include<math.h>
#include<fstream>
#include<set>
#include<queue>
using namespace std;
typedef long long ll;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i = (int)(a); i < (int)(b); i++)
#define out(str) cout << str << endl
#define ALL(a) (a).begin(),(a).end()
#define INF (1<<29)

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; }

string S;
int ans=0,N;

int main(){
    cin>>N>>S;
    rep(i,S.length()-2){
        if(S[i]=='A'&&S[i+1]=='B'&&S[i+2]=='C')ans++;
    }
    out(ans);
    
}


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

int main() {

	char c;
	cin >> c;
	if (islower(c)) cout << "a" << endl;
	else cout << "A" << endl;

	return 0;
}


Measured memory_bytes: 3576
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <tuple>
# include <unordered_map>
# include <numeric>
# include <complex>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
constexpr int INF = 2000000000;
constexpr int HINF = INF / 2;
constexpr double DINF = 100000000000000000.0;
constexpr long long LINF = 9223372036854775807;
constexpr long long HLINF = 4500000000000000000;
const double PI = acos(-1);
int dx[4] = { 0,1,0,-1 }, dy[4] = { 1,0,-1,0 };
# define ALL(x)    (x).begin(),(x).end()
# define UNIQ(c)   (c).erase(unique(ALL((c))), end((c)))
# define mp        make_pair
# define eb        emplace_back
# define REP(i, a) for (int i = 0; i < (a); i++)
# define INIT      std::ios::sync_with_stdio(false);std::cin.tie(0);



int main() {
	int n, m, d;
	cin >> n >> m >> d;
	vector<string> map;
	string s;
	for (int i = 0; i < n; i++) {
		cin >> s;
		map.emplace_back(s);
	}
	int ans = 0;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j <= m - d + 1; j++) {
			int count = 0;
			for (int o = 0; o < d; o++) {
				if (map[i][j + o] == '.')count++;
			}
			if (count == d)ans++;
		}
	}
	for (int j = 0; j < m; j++) {
		for (int i = 0; i < n - d + 1; i++) {
			int count = 0;
			for (int o = 0; o < d; o++) {
				if (map[i + o][j] == '.')count++;
			}
			if (count == d)ans++;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 3180
#include<iostream>
#include<vector>
#include<cstring>
using namespace std;
typedef long long ll;
#define ip(arr, n) for(int i=0; i<n; i++) cin>>arr[i];
#define op(arr, n) for(int i=0; i<n; i++) cout<<arr[i]<<" ";
#define fstIO ios_base::sync_with_stdio(false); cin.tie(NULL);

string lcs(string s, string t){
    int n=s.length(), m=t.length();
    int dp[n+1][m+1];

    memset(dp, 0, sizeof(dp));

    for(int i=0; i<=n; i++){
        for(int j=0; j<=m; j++){
            if(i==0||j==0) dp[i][j]=0;
            else if(s[i-1] == t[j-1]){
                dp[i][j] = dp[i-1][j-1]+1;
            }
            else dp[i][j] = max(dp[i-1][j], dp[i][j-1]);
        }
    }
    string ans="";
    int len=dp[n][m]-1;
    int i=n, j=m;
    while(i>0 && j>0){
        if(s[i-1] == t[j-1]){
            ans += s[i-1];
            i--;
            j--;
        }
        else if(dp[i-1][j] > dp[i][j-1])i--;
        else j--;
    }

    int start=0;
    while(start<len){
        swap(ans[start], ans[len]);
        start++;
        len--;
    }
    return ans;
}
int main(){
    string s,t;
    cin>>s>>t;
    cout<<lcs(s, t)<<endl;
    return 0;
}

Measured memory_bytes: 35456
using System;
using static System.Console;
using static System.Math;
using System.IO;
using System.Collections.Generic;
namespace I_am_the_green_coder{
    class Inonoa{
        static void Main(){
            char[] s = IChars();

            bool odd = true;

            for(int i=0;i<s.Length;i++){
                if(odd){
                    if(s[i]!='R' && s[i]!='U' && s[i]!='D'){
                        WriteLine("No");
                        return;
                    }
                }else{
                    if(s[i]!='L' && s[i]!='U' && s[i]!='D'){
                        WriteLine("No");
                        return;
                    }
                }
                odd = !odd;
            }
            WriteLine("Yes");
        }

        static readonly long MOD = 1000000007;

        ///<summary>a_1, a_2, a_3, ...みたいなの</summary>
        static long[] ILongs(){
            string[] s = ReadLine().Split();
            long[] re = new long[s.Length];
            for(long i=0;i<s.Length;i++){
                re[i] = long.Parse(s[i]);
            }
            return re;
        }

        ///<summary>xooxoxoxxoxo...みたいなの</summary>
        static char[] IChars(){
            return ReadLine().ToCharArray();
        }

        ///<summary>n m とかをちょっとはやくかくだけ</summary>
        static string[] IStrings(){
            return ReadLine().Split();
        }

        ///<summary>n行の入力を取ったり</summary>
        static long[][] ILongLongs(long n){
            long[][] re = new long[n][];
            for(long i=0;i<n;i++){
                string[] s = ReadLine().Split();
                re[i] = new long[s.Length];
                for(long j=0;j<s.Length;j++){
                    re[i][j] = long.Parse(s[j]);
                }
            }
            return re;
        }

        ///<summary>n行の文字列を取ったり</summary>
        static char[][] ICharsChars(long n){
            char[][] re = new char[n][];
            for(long i=0;i<n;i++){
                re[i] = ReadLine().ToCharArray();
            }
            return re;
        }
    }
}

Measured memory_bytes: 13140
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <algorithm>
#include <map>
#include <cmath>
#include <numeric>
#include <list>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>

#define rep(i, n) for (int i = 0; i < n; i++)
#define rep1(i, n) for (int i = 1; i <= n; i++)
#define show(a, n) rep(i,n) {cout<<a[i]<<' ';} cout<<endl;

using namespace std;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef long long ll;
typedef pair<long long, long long> pll;

const int INF = 1 << 30;
const long long INFL = 1LL << 62;
const int MOD = 1000000007;
const int MAX = 100000;
const int N = 100000;

ll nearest_left(ll x, ll s[], int a) {
	if (x < s[0]) {
		return -1;
	}
	int left = 0;
	int right = a - 1;
	int ans = 0;
	while(left <= right) {
		int mid = (left + right) / 2;
		if (s[mid] <= x) {
			ans = max(mid, ans);
			left = mid + 1;
		}
		else {
			right = mid - 1;
		}
	}
	return s[ans];
}

ll nearest_right(ll x, ll s[], int a) {
	if (x > s[a - 1]) {
		return -1;
	}
	int left = 0;
	int right = a - 1;
	int ans = a - 1;
	while(left <= right) {
		int mid = (left + right) / 2;
		if(s[mid] >= x) {
			ans = min(mid, ans);
			right = mid - 1;
		}
		else {
			left = mid + 1;
		}
	}
	return s[ans];
}	

int main() {
	int a, b, q;
	cin >> a >> b >> q;
	ll s[N], t[N], x[N];
	rep(i, a) cin >> s[i];
	rep(i, b) cin >> t[i];
	rep(i, q) cin >> x[i];

	rep(i, q) {
		ll sl = nearest_left(x[i], s, a);
		ll sr = nearest_right(x[i], s, a);
		ll tl = nearest_left(x[i], t, b);
		ll tr = nearest_right(x[i], t, b);
//		cout << i << ' ' << x[i] << ' ' << sl << ' ' << sr << ' ' << tl << ' ' << tr << endl;
		ll ans = INFL;
		if(sl != -1 && tl != -1) {
			ans = min(max(x[i] - sl, x[i] - tl), ans);
		}
		if(sr != -1 && tr != -1) {
			ans = min(max(sr - x[i], tr - x[i]), ans);
		}
		if(sl != -1 && tr != -1) {
			ll tmp_min = min(tr - x[i], x[i] - sl);
			ll tmp_max = max(tr - x[i], x[i] - sl);
			ans = min(2 * tmp_min + tmp_max, ans);
		}
		if(sr != -1 && tl != -1) {
			ll tmp_min = min(sr - x[i], x[i] - tl);
			ll tmp_max = max(sr - x[i], x[i] - tl);
			ans = min(2 * tmp_min + tmp_max, ans);
		}
		cout << ans << endl;
	}
}


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

template<typename T>
void fin(T a){
  cout<<a<<endl;
  exit(0);
}

signed main(){
  int n;cin>>n;
  vector<int> v(n);
  for(int i=0;i<n;i++)cin>>v[i];
  sort(v.begin(),v.end());
  int migi=0;bool mfw=!(n&1);
  for(int i=0;i<n;i++){
    int z=n-1-i,m=v[i]-1;
    if(!(i&&v[i]==v[i-1])){
      if(m>=z){
        if(m==z)fin("Second");
        if(migi==z&&mfw)fin("First");
        if((m+z)&1)fin("First");
        fin("Second");
      }
      mfw=(m+z)&1;
      migi=m;
    }
    else if(m==z)fin(mfw?"First":"Second");
  }
  fin(mfw?"First":"Second");
}


Measured memory_bytes: 640
#include<iostream>
using namespace std;
int main()
{
    int N, x, y, b, p;
    cin >> N;
    for (int i = 0; i < N; i++)
    {
        cin >> x >> y >> b >> p;
        if (b >= 5 && p >= 2)
        {
            int a = x*b + y*p;
            cout << a*0.8 << endl;
        }
        else if (b >= 5 && p < 2)
        {
            int a = x*b + y*p;
            int c = 0.8*(x*b + y * 2);
            if (a < c)cout << a << endl;
            else cout << c << endl;
        }
        else if (b < 5 && p >= 2)
        {
            int a = x*b + y*p;
            int c = 0.8*(x * 5 + y*p);
            if (a < c)cout << a << endl;
            else cout << c << endl;
        }
        else if (b < 5 && p < 2)
        {
            int a = x*b + y*p;
            int c = 0.8*(x * 5 + y*2);
            if (a < c)cout << a << endl;
            else cout << c << endl;
        }
    }
   
    return 0;
}

Measured memory_bytes: 1236
#include <bits/stdc++.h>
using namespace std;
struct ios_accelerate { ios_accelerate() { ios::sync_with_stdio(false); cin.tie(nullptr); } } CALL;

#define REP(i, n) for(auto (i) = (n)*0; (i) < (n); (i)++)
#define RNG(i, a, b) for(auto (i) = (a); (i) < (b); (i)++)
#define RBF(i, v) for(auto& (i) : (v))
#define ALL(x) (x).begin(), (x).end()

using LL = long long;
using UL = unsigned long;
using ULL = unsigned long long;
template<typename T> using V = vector<T>;
template<typename T> using VV = vector<vector<T>>;
template<typename T> using P = pair<T, T>;

const double PI = 3.141592653589793;
const int MOD = 1000000007;
const LL INF64 = static_cast<LL>(1e18) + 2;
const int INF = static_cast<int>(1e9) + 2;

template<typename T> inline void upsort(vector<T>& x) { sort(x.begin(), x.end()); }
template<typename T> inline void downsort(vector<T>& x) { sort(x.begin(), x.end(), greater<T>()); }
template<typename T> inline void col(T x) { cout << x << '\n'; }
template<> inline void col(double x) { cout << fixed << setprecision(12) << x << '\n'; }

signed main() {	
	int n, k;
	cin >> n >> k;
	V<int> a(n);
	RBF(ai, a) {
		cin >> ai;
	}

	RNG(i, k, n) {
		if (a[i] > a[i - k]) {
			col("Yes");
		}
		else {
			col("No");
		}
	}

	return 0;
}

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

typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<string> vs;

#define rep(i,n) for(int i=0;i<(n);i++)
#define all(x) (x).begin(),(x).end()
constexpr auto INF = 200000000000000;
constexpr auto MOD = 1000000007;


int main() {
	string s;
	cin >> s;

	int d;
	if (s == "SUN")d = 7;
	if (s == "MON")d = 6;
	if (s == "TUE")d = 5;
	if (s == "WED")d = 4;
	if (s == "THU")d = 3;
	if (s == "FRI")d = 2;
	if (s == "SAT")d = 1;

	cout << d << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <iomanip>
#include <vector>
#include <cstring>
#include <queue>
#include <map>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
const int INF = 1e6;
using namespace std;
const int dx[4] = {0,1,0,-1};
const int dy[4] = {1,0,-1,0};
template<class T> inline bool chmax(T &a,T& b){if(a < b){a = b; return true;} else return false;}
template<class T> inline bool chmin(T &a,T& b){if(a > b){a = b; return true;} else return false;}
bool nabeatsu(int n){
    bool ans = false;
    if(n%3==0) ans = true;
    while(n != 0){
        if(n%10==3) ans = true;
        n /= 10;
    }
    return ans;
}
int main(){
    int n;
    cin >> n;
    rep1(i,n){
        bool check = false;
        if(nabeatsu(i)) cout << ' ' << i;
    }
    cout << endl;
}


Measured memory_bytes: 3088
w,h,n = gets.split.map(&:to_i)
minx = miny = 0
maxx = w
maxy = h
n.times do
  x,y,a = gets.split.map(&:to_i)
  case a
  when 1
    minx = [x,minx].max
  when 2
    maxx = [x,maxx].min
  when 3
    miny = [y,miny].max
  when 4
    maxy = [y,maxy].min
  end
end

if minx >= maxx || miny >= maxy
    puts 0
else
    puts (maxx-minx)*(maxy-miny)
end

Measured memory_bytes: 1788
import sys
from collections import defaultdict, Counter, namedtuple, deque
import itertools
import functools
import bisect
import heapq
import math
import copy
# from fractions import gcd

MOD = 10 ** 9 + 7
# MOD = 998244353
# sys.setrecursionlimit(10**8)

n = int(input())
A = list(map(int, input().split()))

count = 0
for i in range(n):
    for j in range(i+1, n):
        for k in range(j+1, n):
            if A[i] < A[j]+A[k] and A[j] < A[i]+A[k] and A[k] < A[j]+A[i] and A[i] != A[j] and A[i] != A[k] and A[j] != A[k]:
                count += 1

print(count)


Measured memory_bytes: 69168
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define int ll
typedef pair<int,int> pii;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a) (a).begin(),(a).end()
#define pb emplace_back
#define INF (1LL<<60)

//verified AOJ GRL_1
#define MAX_V 100000
struct edge{int to,cost;};

void dijkstra(int s, vector<int> &d, vector<edge> G[MAX_V]){
    priority_queue< pii,vector<pii>,greater<pii> > que;
    rep( i,d.size() )d[i]=INF;
    d[s] = 0;
    que.push( pii(0,s) );
    
    while( que.size() ){
        pii p=que.top();
        que.pop();
        
        int v=p.second;
        if(d[v]<p.first)continue;
        
        rep(i,G[v].size()){
            edge e=G[v][i];
            if(d[e.to]>d[v]+e.cost){
                d[e.to]=d[v]+e.cost;
                que.push(pii(d[e.to],e.to));
            }
        }
    }
}

signed main(){
    
    vector<edge> G[MAX_V];
    int v;
    cin>>v;
    rep(i,v-1){
        int s,t,c;
        cin>>s>>t>>c;
        s--,t--;
        G[s].pb(edge{t,c});
        G[t].pb(edge{s,c});
    }
    
    int q,k;
    cin>>q>>k;
    k--;
    
    vector<int> d(v);
    dijkstra(k,d,G);
    
    rep(i,q){
        int s,t;
        cin>>s>>t;
        s--,t--;
        cout<<d[s]+d[t]<<endl;
    }
}

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

int main() {
    int n, k; cin >> n >> k;
    vector<int> a(n);
    for(int i=0; i<n; i++) cin >> a[i];
    int l = 0; int r = 1e9;

    while(r-l > 1){
        int x = (l+r)/2;
        auto f = [&](int x){
            long long now = 0;
            for(int i=0; i<n; i++) now += (a[i]-1)/x;
            return now <= k;
        };
        if(f(x)) r = x; else l = x;
    }
    cout << r << endl;
    return 0;
}

Measured memory_bytes: 4020
import java.util.*;

public class Main {
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		while(true){
			int n = sc.nextInt();
			if(n==-1)break;
			int sum = 3130;
			if(n<=10){
				System.out.println(sum);
			}else{
				if(n<=20){
					System.out.println(sum-125*(n-10));
				}else{
					sum-=1250;
					if(n<=30){
						System.out.println(sum-140*(n-20));
					}else{
						sum-=1400;
						System.out.println(sum-160*(n-30));	
					}
				}
			}
		}
	
	}	
}

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

int main() {
  int x, y;
  cin >> x >> y;
  int num_min = x*2;
  int num_max = x*4;
  if (num_min <= y && y <= num_max && y%2 == 0) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 3604
def examA():
    S = SI()
    if S=="ARC":
        ans = "ABC"
    else:
        ans = "ARC"
    print(ans)
    return

def examB():
    N, K = LI()
    snuke = set(range(1,N+1))
    for _ in range(K):
        d = I()
        A = LI()
        for a in A:
            snuke.discard(a)
    ans = len(snuke)
    print(ans)
    return

def examC():
    ans = 0
    print(ans)
    return

def examD():
    ans = 0
    print(ans)
    return

def examE():
    ans = 0
    print(ans)
    return

def examF():
    ans = 0
    print(ans)
    return

import sys,bisect,itertools,heapq,math,random
from copy import deepcopy
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def I(): return int(readline())
def LI(): return list(map(int,readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet,_ep
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
_ep = 10**(-12)
alphabet = [chr(ord('a') + i) for i in range(26)]

sys.setrecursionlimit(10**7)

if __name__ == '__main__':
    examB()

"""
142
12 9 1445 0 1
asd dfg hj o o
aidn
"""

Measured memory_bytes: 10104
S = gets.chomp

def cal(c, a)
  return a if c.empty?

  p = c.shift
  if a.empty?
    return cal(c, [[p]])
  end

  new_a = []
  a.each do |x|
    new_a << x + [p]
    new_a << x + ['+', p]
  end

  cal(c, new_a)
end

pattern = cal(S.chars, [])
ans = pattern.reduce(0) do |r, arr|
  r + eval(arr.join)
end

print ans

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

ll x = 1e9 + 7; 
const int INF = 1001001001;

int main() {
    int n, r;
    cin >> n >> r;
    if (n >= 10) cout << r << endl;
    else cout << r + 100*(10-n) << endl;
    return 0;
}

Measured memory_bytes: 3604
#include<bits/stdc++.h>
using namespace std;
using lint = long int;
#define pb push_back

lint N, M, K;
lint res = 0;
vector<lint> A(200010);
vector<lint> B(200010);
vector<lint> Dia(200010, 0);
vector<lint> Dib(200010, 0);


lint my_max(lint a, lint b){
  if(a > b) return a;
  else return b;
}


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

    for(int i = 1; i <= N; i++) cin >> A[i];
    for(int i = 1; i <= M; i++) cin >> B[i];

    Dia[1] = A[1]; Dib[1] = B[1];
    for(int i = 2; i <= N; i++) Dia[i] = Dia[i-1]+A[i];  //累積和
    for(int i = 2; i <= M; i++) Dib[i] = Dib[i-1]+B[i];

    lint i = 0, j = 0;
    while(i < N && Dia[i+1] <= K) ++i;  //Aだけで最大何冊?
    while(i >= 0){
        while(j < M && Dia[i]+Dib[j+1] <= K) ++j;
      	//cout << "i = " << i << ", j = " << j << endl;
        res = my_max(res, i+j);
        --i;
    }

    cout << res << endl;
    return 0;


}



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

int main() {
  int A,B;
  cin >> A >> B;
  string S;
  cin >> S;
  if(S.at(A) != '-' || S.size() != A + B + 1) {
    cout << "No" << endl;
  }
  else {
    int count = 0;
    for(int i = 0;i < S.size();i++) {
      if(S.at(i) == '-') {
        count = count + 1;
      }
    }
    if(count == 1) {
      cout << "Yes" << endl;
    }
    else {
      cout << "No" << endl;
    }
  }
}

Measured memory_bytes: 256
a,v = map(int,input().split())
b,w = map(int,input().split())
t = int(input())
dum1 = abs(a-b)
dum2 = v-w
if dum2 <= 0:
    print("NO")
    exit()
if dum2 * t >= dum1:
    print("YES")
else:
    print("NO")

Measured memory_bytes: 9184