akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define repz(i, z, n) for (decltype(n) i = (z); i < (n); i++)
#define rep(i, n) for (decltype(n) i = 0; i < (n); i++)

#define REPZ(i, z, n) for (decltype(n) i = (z); i <= (n); i++)
#define REP(i, n) for (decltype(n) i = 0; i <= (n); i++)
#define ALL(v) v.begin(), v.end()
#define SIZE(v) ((ll)(v).size())
#define MAX(v) (*max_element(ALL(v)))
#define MIN(v) (*min_element(ALL(v)))
#define INF 1000000000000  // 1E+12

// 略
#define PB push_back
#define F first
#define S second
#define MP make_pair
#define READ cin >>
#define PRINT cout <<
#define PYES cout << "Yes" << endl;
#define POK cout << "OK" << endl;
#define PNO cout << "No" << endl;
#define PNG cout << "NG" << endl;

using namespace std;

// デバッグ用
void debug_out() { cout << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cout << H << " ";
  debug_out(T...);
}

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

#ifdef _DEBUG
#define debug(...) debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif

// typedef
typedef long long ll;
typedef unsigned long long ul;
typedef long double ld;
typedef pair<ll, ll> pl;

// const
// 円周率
const ld pi = acos(-1);
// mod用
// 1E+9 +7
const ll mod = (int)1e+9 + 7;
// 1s間で可能なループ回数2E+8回
// int        最大値2147483647         〜2E+9
// long long  最大値9223372036854775807〜9E+18
// 総和accumulate
// 単純リストvector<type> push_back
// 連想配列map<key,value> insert,
// 集合set<type>
// pair キーとバリューを格納 firstとsecondでアクセス
// 小数点指定 cout << fixed << setprecision(15) << endl;
// to_string<->stoi
// stoll(longlong)
// stod(double)
// deep copy v1->v2 copy(v1.begin(), v1.end(), back_inserter(v2) );
// 大文字65-90(-32)
// 小文字97-122(+32)
//  priority_queue<pair<ll, ll>, vector<pair<ll, ll>>, greater<pair<ll, ll>>>
//  ba;
signed main() {
  // faster
  // C言語流の入出力は使用できない
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  int n; cin >> n;
  vector<int> a(n);
  rep(i,n) cin >> a[i];
  ld sum =0;
  rep(i,n) sum+=(ld)1/(ld)a[i];
  cout << fixed << setprecision(15) << 1/sum << endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<cmath>
#include<algorithm>
#include<cstring>
using namespace std;
int x,s,t;
int main()
{
    string a;
    cin>>a;
	x=a.size();
    for(int i=0;i<=x;++i)
    {
        if(a[i]=='C')
        {
            for(int k=i+1;k<=x-1;++k)
            {
                if(a[k]=='F')
                {
                    cout<<"Yes";
                    return 0;
                }
            }
            cout<<"No";
            return 0;
        }
    }
    cout<<"No";
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <limits.h>

int main(void)
{
	int a, b, c;
	scanf("%d %d %d", &a, &b, &c);
	printf("%d %d %d", c, a, b);
	return 0;
}


Measured memory_bytes: 128
#define _USE_MATH_DEFINES
#include <iostream>
#include <complex>
#include <algorithm>
#include <vector>
#include <stack>
#include <string>
#include <queue>
#include <cmath>
#include <math.h>
#include <numeric>
#include <list>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <climits>
#include <set>
#include <memory.h>
#include <memory>
#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cassert>
#include <map>
#include <cassert>
#include <time.h>
#include <ctime>

using namespace std;

typedef complex<double> xy_t;
typedef pair<xy_t, xy_t> line;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<int , P> PP;
typedef pair<int, string> Ps;
typedef vector<int> vec;
typedef vector<vec> mat;
const int INF= 1 << 28;
const double EPS = 1e-9;
const double PI = 3.1415926535897932384626433832795;
const int CLK = CLOCKS_PER_SEC;

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

double cross(const xy_t &a, const xy_t &b){
	return imag(conj(a) * b);
}

double dot(const xy_t &a, const xy_t &b){
	return real(conj(a) * b);
}

xy_t projection(const line &l, const xy_t &p){
	double t = dot(p - l.first, l.first - l.second) / norm(l.first - l.second);
	return l.first + t * (l.first - l.second);
}

int ccw(xy_t a, xy_t b, xy_t c){
	b -= a;
	c -= a;
	if(cross(b, c) > 0) return 1;
	if(cross(b, c) < 0) return -1;
	if(dot(b, c) < 0) return 2;
	if(norm(b) < norm(c)) return -2;
	return 0;
}

bool intersectSP(const line &l, const xy_t &p){
	return abs(l.first- p) + abs(l.second - p) - abs(l.first - l.second) < EPS;
}

bool intersectSS(const line &s, const line &t){
	return ccw(s.first, s.second, t.first) * ccw(s.first, s.second, t.second) <= 0 &&
		ccw(t.first, t.second, s.first) * ccw(t.first, t.second, s.second) <= 0;
}

double distanceSP(line s, xy_t p){
	const xy_t r = projection(s, p);
	if(intersectSP(s, r)) return abs(r - p);
	return min(abs(s.first - p), abs(s.second - p));
}

int g[101][101];

int main(){
	int n, p;
	int s, d, v;
	while(cin >> n && n){
		fill(&g[0][0], &g[100][100] + 1, INF);
		rep(i, 101) g[i][i] = 0;
		rep(i, n){
			int a, b, k;
			cin >> a >> k;
			rep(j, k){
				cin >> b;
				g[a][b] = 1;
			}
		}
		rep(k, 101){
			rep(i, 101){
				rep(j, 101){
					g[i][j] = min(g[i][j], g[i][k] + g[k][j]);
				}
			}
		}
		cin >> p;
		rep(i, p){
			cin >> s >> d >> v;
			int cost = g[s][d];
			if(cost < v){
				cout << cost + 1 << endl;
			}else{
				cout << "NA" << endl;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n,p[22],a=0; cin>>n,p[0]=1,p[1]=2;
  for(int i=0;i<n;i++) cin>>p[i];
  for(int i=1;i<n-1;i++) if((p[i-1]<p[i]&&p[i]<p[i+1])||(p[i-1]>p[i]&&p[i]>p[i+1])) a++;
  cout<<a;
}

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

int main(){
  int n,k;
  int hikaku;
  int cnt = 0;
  cin >> n >> k;
  
  vector<int> vec(n,0);
  
  int ninzu;
  int tmp;
  for(int i = 0; i < k; i++){
    cin >> ninzu;
    for(int j = 0; j < ninzu; j++){
      cin >> tmp;
      vec.at(tmp-1)+= 1;
    }
  }
  
  for(int i = 0; i < n; i++){
    if(vec.at(i) == 0) cnt++;
  }
  
  cout << cnt;
}


Measured memory_bytes: 3632
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.next());
		int[] p = new int[n + 1];
		for (int i = 1; i <= n; i++)
			p[Integer.parseInt(sc.next())] = i;
		int max = 1;
		int tem = 1;
		for (int i = 2; i <= n; i++) {
			if (p[i] < p[i - 1])
				tem = 1;
			else
				tem++;
			max = Math.max(max, tem);
		}
		System.out.println(n - max);
	}
}

Measured memory_bytes: 54116
#include<stdio.h>
#include<ctype.h>
#include<string.h>
#include <math.h>
int main(void){
	int a,d[6],i,j,k,n;
	char c;

	for(i=0;i<6;i++){
		scanf("%d%*c",&d[i] );
	}
	while(1){
		scanf("%c",&c );
		if(c=='\n')break;
		if(c=='E'){
			n=d[5];
			d[5]=d[2];
			d[2]=d[0];
			d[0]=d[3];
			d[3]=n;
		}else if(c=='W'){
			n=d[5];
			d[5]=d[3];
			d[3]=d[0];
			d[0]=d[2];
			d[2]=n;
		}else if(c=='S'){
			n=d[5];
			d[5]=d[1];
			d[1]=d[0];
			d[0]=d[4];
			d[4]=n;
		}else if(c=='N'){
			n=d[5];
			d[5]=d[4];
			d[4]=d[0];
			d[0]=d[1];
			d[1]=n;
		}
	}printf("%d\n",d[0]);

	return 0;
}

Measured memory_bytes: 596
#include <iostream> // cin, cout, cerr, clog
#include <algorithm> // minmax, sort, swap
#include <numeric> // iota, accumulate, inner_product
#include <cstdio> // printf, scanf
#include <climits> // INT_MIN, LLONG_MIN
#include <cmath> // long, trig, pow
#include <string> // string, stoi, to_string
#include <vector> // vector
#include <queue> // queue, priority_queue
#include <deque> // deque
#include <stack> // stack
#include <map> // key-value pairs sorted by keys
#include <set> // set
#include <unordered_map> // hashed by keys
#include <unordered_set> // hashed by keys
#include <iomanip> // cout<<setprecision(n)
#include <functional> // std::function<void(int)>

#define rep(i,n) for(int i = 0; i < (n); i++)
#define ENDL '\n'
#define print(i) std::cout << (i) << '\n'

#define int long long // at least int64 > 9*10^18
#define all(v) (v).begin(), (v).end()
/* libraries */

/* modint */

constexpr int MOD = 1e9+7;
struct mint
{
	int v;
	mint():v(0){}
	mint(int v):v((v+MOD)%MOD){}
	mint operator-()const{ return mint(0) - *this;}
	mint& operator+=(const mint& a){ if((v+=a.v)>=MOD) v-=MOD; return *this;}
	mint& operator-=(const mint& a){ if((v+=MOD-a.v)>=MOD) v-=MOD; return *this;}
	mint& operator*=(const mint& a){ (v*=a.v)%=MOD; return *this;}
	mint& operator/=(const mint& a){ (*this) *= a.inv(); return *this;}
	mint operator+(const mint& a)const{ return mint(*this) += a;}
	mint operator-(const mint& a)const{ return mint(*this) -= a;}
	mint operator*(const mint& a)const{ return mint(*this) *= a;}
	mint operator/(const mint& a)const{ return mint(*this) /= a;}
	bool operator<(const mint& a)const{ return v < a.v;}
	bool operator==(const mint& a)const{ return v == a.v;}
	mint pow(int k)const{mint r(1),t(v);while(k){if(k&1)r*=t;t*=t;k>>=1;} return r;}
	mint inv()const{ return pow(MOD-2);}
	static mint comb(int n, int k){
		if(n-k<k) k=n-k;
		mint num(1), dom(1);
		for(int i=0;i<k;i++) { num*=n-i; dom*=i+1; }
		return num/dom;
	}
};
std::istream& operator>>(std::istream&i,mint&a){int t;i>>t;a=mint(t);return i;}
std::ostream& operator<<(std::ostream&o,const mint&a){o<<a.v;return o;}

/* modint */

/* prime_factorize */

void prime_factorize(int n, std::map<int,int>& prime_factors) {
	for(int i=2;i*i<=n;i++) {
		while(n%i==0) {
			prime_factors[i]++;
			n/=i;
		}
	}
	if(n!=1) prime_factors[n]++;
}

/* prime_factorize */

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

	std::map<int,int> pfactors;
	prime_factorize(m,pfactors);

	mint count = 1;
	for(auto i:pfactors) {
		count *= mint::comb(i.second+n-1,n-1);
	}
	
	print(count);

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
	int n;
	cin>>n;
	n%=10;
	if(n==3)cout<<"bon";
	else if(n==0||n==1||n==6||n==8)cout<<"pon";
	else cout<<"hon";
	return 0;
}

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

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

    string res = "";
    while(n) {
        n--;
        res += (char)('a' + (n % 26));

        n /= 26;
    }
    reverse(res.begin(), res.end());
    cout << res << endl;
    
}

Measured memory_bytes: 3600
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#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++)
using namespace std;
typedef long long ll;

int N, M;
ll K;
ll A[200010];
ll B[200010];

int main(){
  cin >> N >> M >> K;
  // 0インデックスには何も読まない0という初期値をそのまま入れておく
  rep(i, N) cin >> A[i+1];
  rep(i, M) cin >> B[i+1];

  rep(i, N) A[i+1] += A[i];
  rep(i, M) B[i+1] += B[i];

  int ans = 0;
  int cnt_b = M;
  rep(cnt_a, N+1){
    if (A[cnt_a] > K) continue;
    while (A[cnt_a] + B[cnt_b] > K){
      cnt_b--;
    }
    // cout << ans << endl;
    ans = max(ans, cnt_a + cnt_b);
  }
  cout << ans << endl;
}

Measured memory_bytes: 6740
#include <iostream>
#include <complex>
#include <cmath>
using namespace std;
typedef complex<double> xy_t;
double cross_product(xy_t a, xy_t b) { return (conj(a)*b).imag(); }
const double eps = 1e-11;

double x[4], y[4];
int N;
int main() {
cin >> N; // 問題数
for (int t=0; t<N; ++t) {
  for (int i=0; i<4; ++i)
    cin >> x[i] >> y[i]; // x0,y0..x3,y3
    xy_t a[2] = {
        xy_t(x[0],y[0]) - xy_t(x[1],y[1]),
        xy_t(x[2],y[2]) - xy_t(x[3],y[3])
    };
    bool p = abs(cross_product(a[0],a[1])/2) < eps;
    cout << (p ? "YES" : "NO") << endl;

} }



Measured memory_bytes: 3156
package main

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

func main() {
	sc := NewScanner()
	s := sc.Next()
	A := []string{"SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"}
	for i := 0; i < 7; i++ {
		if A[i] == s {
			fmt.Println(7 - i)
		}
	}

}

type Scanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func NewScanner() *Scanner {
	rdr := bufio.NewReaderSize(os.Stdin, 1000)
	return &Scanner{r: rdr}
}
func (s *Scanner) Next() string {
	s.pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	result := string(s.buf[start:s.p])
	s.p++
	return result
}
func (s *Scanner) NextLine() string {
	s.pre()
	start := s.p
	s.p = len(s.buf)
	return string(s.buf[start:])
}
func (s *Scanner) NextInt() int {
	v, _ := strconv.Atoi(s.Next())
	return v
}
func (s *Scanner) NextInt64() int64 {
	v, _ := strconv.ParseInt(s.Next(), 10, 64)
	return v
}

func (s *Scanner) NextFloat() float64 {
	v, _ := strconv.ParseFloat(s.Next(), 64)
	return v
}

func (s *Scanner) NextIntArray() []int {
	s.pre()
	start := s.p
	result := []int{}
	for ; s.p < len(s.buf)+1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 0)
			result = append(result, int(v))
			start = s.p + 1
		}
	}

	return result
}
func (s *Scanner) NextInt64Array() []int64 {
	s.pre()
	start := s.p
	result := []int64{}
	for ; s.p < len(s.buf)+1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 64)
			result = append(result, v)
			start = s.p + 1
		}
	}
	return result
}

func (s *Scanner) NextMap() map[int]bool {
	s.pre()
	start := s.p
	mp := map[int]bool{}
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			v, _ := strconv.Atoi(string(s.buf[start:s.p]))
			mp[v] = true
			start = s.p + 1
		}
	}
	v, _ := strconv.Atoi(string(s.buf[start:s.p]))
	mp[v] = true

	return mp
}

func (s *Scanner) pre() {
	if s.p >= len(s.buf) {
		s.readLine()
		s.p = 0
	}
}
func (s *Scanner) readLine() {
	s.buf = make([]byte, 0)
	for {
		l, p, e := s.r.ReadLine()
		if e != nil {
			panic(e)
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}


Measured memory_bytes: 640
def m_i(l):
    stack = 1
    ans = 0
    l = list(l)
    for i in l :
        if i == 'm' :
            ans += stack * 1000
            stack = 1
        elif i == 'c' :
            ans += stack * 100
            stack = 1
        elif i == 'x' :
            ans += stack * 10
            stack = 1
        elif i == 'i' :
            ans += stack
            stack = 1
        else :
            stack = int(i)
    return ans
    
def i_m(l):
    ans = []
    a = l // 1000
    if a == 1 :
        ans.append('m')
    elif a != 0 :
        ans.append(str(a))
        ans.append('m')
    l -= a * 1000
    a = l // 100
    if a == 1 :
        ans.append('c')
    elif a != 0 :
        ans.append(str(a))
        ans.append('c')
    l -= a * 100
    a = l // 10
    if a == 1 :
        ans.append('x')
    elif a != 0 :
        ans.append(str(a))
        ans.append('x')
    a = l - a * 10
    if a == 1 :
        ans.append('i')
    elif a != 0 :
        ans.append(str(a))
        ans.append('i')
    ans = ''.join(ans)
    return ans

n = int(input())
for i in range(n) :
    a, b = input().split()
    ans = m_i(a) + m_i(b)
    print(i_m(ans))
    


Measured memory_bytes: 5628
#include<bits/stdc++.h>
using namespace std;
char c;
int a,b;
int main(){
	scanf("%d ",&a);
	cin>>c;
	cin>>b;
	if(c=='+')cout<<a+b;
	else if(c=='-')cout<<a-b;
	else cout<<a*b;
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(void){
  int A,B,C,D,i=1;

  scanf("%d %d %d %d",&A,&B,&C,&D);
  while(i!=0){
    C=C-B;
    if(C<=0)
      i=0;
    A=A-D;
    if(A<=0)
      i=0;
  }
  if(C<=0)
    printf("Yes\n");
  else if(A<=0)
    printf("No\n");
  else
    printf("error\n");
  
  return 0;
}


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

#define fi first
#define se second

const int N = 1e5+5;
int n, v[N];
map<int, int> even, odd;

int main() {
	odd.clear();
	even.clear();
	
	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		scanf("%d", &v[i]);
		if (i&1) odd[v[i]]++;
		else even[v[i]]++;	
	}
	
	int maxodd = -1, maxeven = -1, maxodd2 = -1, maxeven2 = -1;
	for (map<int, int>::iterator it = odd.begin(); it != odd.end(); ++it) {
		if (maxodd == -1) {
			maxodd = it->fi;
		}
		else if (maxodd2 == -1) {
			maxodd2 = it->fi;	
		}
		else if (it->se >= odd[maxodd]) {
			maxodd2 = maxodd;
			maxodd = it->fi;
		}
		else if (it->se > odd[maxodd2]) {
			maxodd2 = it->fi;	
		}
	}
	for (map<int, int>::iterator it = even.begin(); it != even.end(); ++it) {
		if (maxeven == -1) {
			maxeven = it->fi;
		}
		else if (maxeven2 == -1) {
			maxeven2 = it->fi;
		}
		else if (it->se >= even[maxeven]) {
			maxeven2 = maxeven;
			maxeven = it->fi;	
		}
		else if (it->se > even[maxeven2]) {
			maxeven2 = it->fi;	
		}
	}
	
	int ans = 0;
	if (maxodd != maxeven) ans = n-odd[maxodd]-even[maxeven];
	else {
		ans = n;
		ans = min(ans, n-odd[maxodd]-even[maxeven2]);
		ans = min(ans, n-odd[maxodd2]-even[maxeven]);
	}
	printf("%d\n", ans);
	
	return 0;	
}

Measured memory_bytes: 5376
<?php

$count = fgets(STDIN);//カードの枚数
$cards = explode(" ",trim(fgets(STDIN)));//カードの数字
rsort($cards);
// var_dump($cards);

for($i=0; $i<$count; $i++){
    if($i %2 == 0){
        $a[] = $cards[$i];
    }else{
        $b[] = $cards[$i];
    }
}
$a = array_sum($a);
$b = array_sum($b);

echo $a-$b;











Measured memory_bytes: 3828
#include <stdio.h>
#include <iostream>

using namespace std;

void update();

int A[100000];
int N, T;
int tmax, tmin;
int maxdiff = 0, tmpdiff;
int count = 1;
void core() {
	cin >> N >> T;
	T >>= 1;
	//
	for (int i = 0; i < N; i++) {
		scanf("%d", &A[i]);
	}
	tmax = A[0];
	tmin = A[0];
	//
	for (int i = 1; i < N; i++) {
		if (tmax < A[i]) {
			tmax = A[i];
			update();
		} else if (A[i] < tmin) {
			tmin = A[i];
			tmax = A[i];
		}
	}
	//
	cout << count << endl;
}

void update() {
	tmpdiff = tmax - tmin;
	if (tmpdiff > maxdiff) {
		maxdiff = tmpdiff;
		count = 1;
	} else if (tmpdiff == maxdiff) {
		count++;
	}
}

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


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define pb push_back
#define mp make_pair
#define deb(x) cout<< #x << " " << x << "\n";
const ll mod=1e9+7;


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

    double ans;
    ll n;
    cin>>n;
    ans=2*3.14159*n;
    cout<<ans;


    return 0;
}

Measured memory_bytes: 3792
# -*- coding: utf-8 -*-
from sys import stdin

d_in = lambda: int(stdin.readline())  # N = d_in()

cand = [0, 3, 5, 7]
N = d_in()


def check_count(count):
    if count[3] > 0 and count[5] > 0 and count[7] > 0:
        return True
    else:
        return False


def search(flag, nonzero, str_n, count):
    """
    flag : 現在の値がNと等しいか小さいか

    nonzero : 現在の値が0か否か

    str_n : 現在より小さい方の各桁を文字列として持つリスト

    count : {7: flag1, 5: flag2, 3: flag3}
    """
    if len(str_n) == 0:
        if check_count(count):
            return 1
        else:
            return 0
    elif check_count(count) and (not flag):
        return 3**(len(str_n))
    elif not flag:
        ans = 0
        for i in cand:
            if nonzero and i == 0:
                continue
            next_count = count.copy()
            next_count[i] += 1
            zeroflag = nonzero or (i != 0)
            ans += search(False, zeroflag, str_n[1:], next_count)
        return ans
    else:
        next_n = int(str_n[0])
        ans = 0
        for i in cand:
            if nonzero and i == 0:
                continue
            next_count = count.copy()
            if i > next_n:
                break
            elif i == 0:
                zeroflag = nonzero
                ans += search(False, zeroflag, str_n[1:], next_count)
            elif i == next_n:
                next_count[i] += 1
                ans += search(True, True, str_n[1:], next_count)
            else:
                next_count[i] += 1
                ans += search(False, True, str_n[1:], next_count)
        return ans


str_N = list(str(N))
cand_count = {0: 0, 3: 0, 5: 0, 7: 0}
print(search(True, False, str_N, cand_count))


Measured memory_bytes: 3064
#include<iostream>
#include<cmath>
#include<vector>
#include<set>
#include<algorithm>
#include<tuple>
#include<utility>
#include<cctype>
#include<climits>
#include<map>
#include<queue>
#include<functional>

using namespace std;
template<class T> void chmax(T& a, T b) {if(a < b){a=b;}}
template<class T> void chmin(T& a, T b) {if(a > b){a=b;}}

#define REP(i,a,n) for(int i=a;i<n;++i)
#define RUP(a,b) ((a+b-1)/(b))
#define ENT "\n"
#define REV(v) reverse(v.begin(),v.end())
#define SRT(v) sort(v.begin(),v.end())
#define MOD 1000000007

typedef long long ll;
typedef tuple<int,int,bool> Tb;


int abc104_c(){
    //入力
    int n;
    cin >> n;
    double x[n];
    string u[n];
    REP(i,0,n){
        cin >> x[i] >> u[i];
    }
    double ans = 0;

    //処理
    REP(i,0,n){
        if(u[i]=="JPY") ans += x[i];
        else ans += x[i]*380000;
    }
    
    //出力
    cout << ans << ENT;
    return 0;
}

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


Measured memory_bytes: 256
from collections import defaultdict
import sys,heapq,bisect,math,itertools,string,queue,datetime
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
AtoZ = [chr(i) for i in range(65,65+26)]
atoz = [chr(i) for i in range(97,97+26)]

def inpl(): return list(map(int, input().split()))
def inpl_str(): return list(input().split())

def Find(x):	#xの根を返す
	global table

	if table[x] == x:
		return x
	else:
		table[x] = Find(table[x])	#親の更新(根を直接親にして参照距離を短く)
		return table[x]

def Union(x,y):	#xとyを繋げる
	x = Find(x)
	y = Find(y)

	if x == y:
		return

	if rank[x] > rank[y]:
		table[y] = x
	else:
		table[x] = y
		if rank[x] == rank[y]:
			rank[y] += 1

def Check(x,y):
	if Find(x) == Find(y):
		return True
	else:
		return False

N,M = inpl()

table = [i for i in range(N)]	#木の親 table[x] == x なら根
rank  = [1 for i in range(N)]	#木の長さ

pp = inpl()

for i in range(M):
	x,y = inpl()
	x -= 1
	y -= 1
	Union(x,y)

ans = 0
for i in range(N):
	if Check(pp[i]-1,i):
		ans += 1

print(ans)

Measured memory_bytes: 20396
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <cmath>
#include <cstring>
#include <map>
#define pb push_back
#define mod 1000000007
using namespace std;
typedef long long int ll;

/* エラトステネスの篩 */
#define MAXN 300000
int prime[MAXN];/* i番目の素数 */
bool is_prime[MAXN]; /*iは素数か？*/
int num_prime[MAXN]; /* i番目までの素数の数 */
int sieve(int n){
  int p=0;
  for(int i=0;i<=n;i++) is_prime[i]=true;
  is_prime[0]=is_prime[1]=false;
  for(int i=2;i<=n;i++){
    if(is_prime[i]){
      prime[p++]=i;
      for(int j=2*i;j<=n;j+=i) is_prime[j]=false;
    }
  }
  for(int i=1;i<MAXN;i++){
    num_prime[i]=num_prime[i-1]+is_prime[i];
  }
  return p;
}
int hako[111111];
int main(void){
  sieve(111111);
  int q;
  cin>>q;

  int tmp=0;

  for(int i=1;i<111111;i+=2){
    if(is_prime[i] && is_prime[(i+1)/2]) tmp++;
    hako[i]=tmp;
  }
  
  int l,r;
  for(int i=0;i<q;i++){
    cin>>l>>r;
    cout<<hako[r]-hako[max(l-2,0)]<<endl;
  }
  return 0;
}


Measured memory_bytes: 2432
#include <stdio.h>

int main(void)
{
	int a, b;
	int d, r;
	double f;
	
	scanf("%d %d", &a, &b);
	
	printf("%d %d %f\n", a / b, a % b, (double)a / (double)b);
	
	return (0);
}

Measured memory_bytes: 636
#include <bits/stdc++.h>
using namespace std;
#define modulo 998244353
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 10000000000000000



int main(){
	
	int N;
	cin>>N;
	
	vector<int> A(N+2,0);
	for(int i=1;i<=N;i++){
		cin>>A[i];
	}
	
	int sum = 0;
	for(int i=0;i<A.size()-1;i++){
		sum += abs(A[i]-A[i+1]);
	}
	
	for(int i=1;i<=N;i++){
		int a = abs(A[i-1]-A[i])+abs(A[i]-A[i+1]);
		int b = abs(A[i-1]-A[i+1]);
		cout<<sum-a+b<<endl;
	}
		
    return 0;
}


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

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

fn main() {
    let v: Vec<u64> = read_vec();
    let n = v[0];
    let m = v[1];

    let ret: u64;
    if 2 * n > m {
        ret = m / 2;
    } else {
        ret = n + (m - 2 * n) / 4;
    }
    println!("{}", ret);
}


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

int main() {
    int r;
    cin >> r;
    cout << r*r << endl;
    return 0;
}

Measured memory_bytes: 256
// #pragma GCC target("avx")  // CPU 処理並列化
// #pragma GCC optimize("O3")  // CPU 処理並列化
// #pragma GCC optimize("unroll-loops")  // 条件処理の呼び出しを減らす
// #define BEGIN_STACK_EXTEND(size) void * stack_extend_memory_ = malloc(size);void * stack_extend_origin_memory_;char * stack_extend_dummy_memory_ = (char*)alloca((1+(int)(((long long)stack_extend_memory_)&127))*16);*stack_extend_dummy_memory_ = 0;asm volatile("mov %%rsp, %%rbx\nmov %%rax, %%rsp":"=b"(stack_extend_origin_memory_):"a"((char*)stack_extend_memory_+(size)-1024));
// #define END_STACK_EXTEND asm volatile("mov %%rax, %%rsp"::"a"(stack_extend_origin_memory_));free(stack_extend_memory_);

#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
#include<numeric>
#include<unordered_set>
#include<unordered_map>
#include<complex>
using namespace std;
const long long mod=998244353;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const double EPS=1e-11;
const double INF=1e+10;
const double PI=acos(-1.0);
const int C_SIZE = 11100000;
const int UF_SIZE = 3100000;
namespace{
	long long fact[C_SIZE];
	long long finv[C_SIZE];
	long long inv[C_SIZE];
	inline long long Comb(int a,int b){
	 	if(a<b||b<0)return 0;
	 	return fact[a]*finv[b]%mod*finv[a-b]%mod;
	}
	void init_C(int n){
		fact[0]=finv[0]=inv[1]=1;
		for(int i=2;i<n;i++){
			inv[i]=(mod-(mod/i)*inv[mod%i]%mod)%mod;
		}
		for(int i=1;i<n;i++){
			fact[i]=fact[i-1]*i%mod;
			finv[i]=finv[i-1]*inv[i]%mod;
		}
	}
	long long pw(long long a,long long b){
		if(a<0LL)return 0;
		if(b<0LL)return 0;
		long long ret=1;
		while(b){
			if(b%2)ret=ret*a%mod;
			a=a*a%mod;
			b/=2;
		}
		return ret;
	}
	long long pw_mod(long long a,long long b,long long M){
		if(a<0LL)return 0;
		if(b<0LL)return 0;
		long long ret=1;
		while(b){
			if(b%2)ret=ret*a%M;
			a=a*a%M;
			b/=2;
		}
		return ret;
	}
	int pw_mod_int(int a,int b,int M){
		if(a<0)return 0;
		if(b<0)return 0;
		int ret=1;
		while(b){
			if(b%2)ret=(long long)ret*a%M;
			a=(long long)a*a%M;
			b/=2;
		}
		return ret;
	}
	int ABS(int a){return max(a,-a);}
	long long ABS(long long a){return max(a,-a);}
	double ABS(double a){return max(a,-a);}
	int sig(double r) { return (r < -EPS) ? -1 : (r > +EPS) ? +1 : 0; }
	int UF[UF_SIZE];
	void init_UF(int n){
		for(int i=0;i<n;i++)UF[i]=-1;
	}
	int FIND(int a){
		if(UF[a]<0)return a;
		return UF[a]=FIND(UF[a]);
	}
	void UNION(int a,int b){
		a=FIND(a);b=FIND(b);if(a==b)return;
		if(UF[a]>UF[b])swap(a,b);
		UF[a]+=UF[b];UF[b]=a;
	}
}
// ここから編集しろ
int p[210000];
int t[1010000];
int main(){
	int a;scanf("%d",&a);
	for(int i=0;i<a;i++)scanf("%d",p+i);
	for(int i=0;i<a;i++){
		t[p[i]]++;
	}
	int ret=0;
	for(int i=0;i<a;i++){
		bool ok=true;
		for(int j=1;j*j<=p[i];j++){
			if(p[i]%j)continue;
			if(p[i]!=1&&t[j]){ok=false;break;}
			if(j>1&&t[p[i]/j]){ok=false;break;}
			if(t[p[i]/j]>1){ok=false;break;}
		}
		if(ok)ret++;
	}
	printf("%d\n",ret);
}

Measured memory_bytes: 6404
eval"X,Y,*A=#"+`tr ' ' ,`
b=X+Y-a=A.inject(0,:^)
r=b/2
50.downto(0){X<s=r|a&1<<_1 or r=s}
p r<1||r>X||b&a*2+1>0?-1:X-r

Measured memory_bytes: 14432
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for (int i = 0; i< (n); ++i)
const long long INF = 1LL<<58;

// aを常に小さい値にする　大きい値にする
template<class T> bool chmin(T &a, T b){ if(a>b) a = b; }
template<class T> void chmax(T &a, T b){ if(a<b) a = b; }

// 二分探索 前方のindexを返すもの（自分自身を含む） 前方: -INF側のこと
template<class T> int former(const vector<T> &v, T x){
    return upper_bound(v.begin(), v.end(), x) - v.begin() -1; // upper_bound : keyより大きい要素の内の一番左側のイテレータを返す
}
// 二分探索 後方のindexを返すもの（自分自身を含む）後方: INF側のこと
template<class T> int latter(const vector<T> &v, T x){
    return lower_bound(v.begin(), v.end(), x) - v.begin(); // lower_bound : key以上の要素の内の一番左側のイテレータを返す
}

// 最大公約数を求める GCD
int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }


/*
 * 一対一対応の置換　⇒　map を使う
 * 
 * 10^5なので O(N^2)では間に合わないO(N)である必要がある。
 * 
 *
 * */


int main() {

    string S, T;
    cin >> S >> T;
    bool ok = true;
    map<char,char> ma, ima;
    for (int i = 0; i < S.size(); ++i) {
        char s = S[i], t = T[i];

        if (ma.count(s)) { // map.count(key) で keyがあれば1, なければ0を返す
                           // 条件：変換リストに登録されていて
            if (ma[s] != t) { //  一対一対応の変換リストに登録されているのと違う変換だったらダメ
                ok = false;
            }
        }
        if (ima.count(t)) {
            if (ima[t] != s) {
                ok = false;
            }
        }

        ma[s] = t; ima[t] = s; // 一対一の変換リストへの登録
    }
    if (ok) puts("Yes");
    else puts("No");

}

Measured memory_bytes: 776
import java.util.*;
class Main{
	public static void main(String[] args){
		Scanner s=new Scanner(System.in);
		int a,b;
		while(true){
			a=s.nextInt();
			b=s.nextInt();
			if(a+b==0)System.exit(0);
			boolean ok[]=new boolean[a];
			int at=0;
			int out=0;
			for(int i=0;i<b;i++){
				String str=s.next();
				if(out+1==a)continue;
				String ans="";
				if((i+1)%3==0)ans+="Fizz";
				if((i+1)%5==0)ans+="Buzz";
				if((i+1)%3>0&&(i+1)%5>0)ans=ans+(i+1);
				if(!str.equals(ans)){
					ok[at%a]=true;
					out++;
				}
				while(true){
					at++;
					if(!ok[at%a])break;
				}
			}
			boolean p=false;
			for(int i=0;i<a;i++){
				if(!ok[i]){
					if(p)System.out.print(" ");
					System.out.print(i+1);
					p=true;
				}
			}
			System.out.println();
		}
	}
}

Measured memory_bytes: 12000
open System

[<EntryPoint>]
let main args =
    let N  = Console.ReadLine () |> int

    let Ai = Console.ReadLine ()
             |> fun s -> s.Split(' ')
             |> Seq.map int

    let M1 = Ai
             |> Seq.zip (seq { 0 .. N })
             |> Seq.sumBy (fun (i, e) -> e * (if i % 2 = 0 then 1 else -1))

    let Mi = Ai
             |> Seq.scan (fun Mb a -> 2 * a - Mb) M1
             |> Seq.take N
    
    Mi
    |> Seq.map string
    |> String.concat " "
    |> printfn "%s"

    0


Measured memory_bytes: 40984
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <cstring>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <bitset>
#include <stack>
#include <cmath>
#include <time.h>
#include <unordered_set>
#include <unordered_map>
#define ll long long
#define LINF 0x3f3f3f3f3f3f3f3f
#define INF 0x3f3f3f3f
#define PI 3.14159265
#define RAND (rand()*rand())
#define MAX(x, y) ((x) > (y) ? (x):(y)) 
#define MIN(x, y) ((x) > (y) ? (y):(x))
#define ABS(x) ((x) > 0 ? (x) : -(x))
#define CEIL(x, y) (((x) + (y) - 1)/(y))
using namespace std;
const int MAXN = 1e5 + 5;
const ll MOD = 1e9 + 7;
const double eps = 1e-7;
int N, M, K, Q, T;
ll gcd(ll a, ll b) {
	if (b == 0LL) return a;
	return gcd(b, a % b);
}
vector<int> graph[MAXN];
bool vis[MAXN];

void dfs(int u) {
	vis[u] = true;
	for (int i = 0; i < graph[u].size(); ++i) {
		int v = graph[u][i];
		if (vis[v]) continue;
		dfs(v);
;	}
}

int main()
{
	int i, j;
	int u, v;
	scanf("%d%d", &N, &M);
	for (i = 1; i <= M; ++i) {
		scanf("%d%d", &u, &v);
		graph[u].push_back(v);
		graph[v].push_back(u);
	}
	int cnt = 0;
	for (i = 1; i <= N; ++i) {
		if (vis[i]) continue;
		cnt++;
		dfs(i);
	}
	printf("%d", cnt - 1);
	return 0;
}

Measured memory_bytes: 9896
import java.util.Scanner;

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

        long x, y, r, temp;

        x = stdIn.nextLong();
        y = stdIn.nextLong();

        if (x < y) {
            temp = x;
            x = y;
            y = temp;
        }

        while((r = x % y) != 0) {
            x = y;
            y = r;
        }
        System.out.println(y);
    }
}




Measured memory_bytes: 26220
#include<iostream>
using namespace std;
typedef long long ll;
ll N,M;

int main(){
    cin>>N>>M;                                                   
    if(N>M)
        swap(N,M);
    if(N==1&M==1)
        cout<<1<<"\n";
    else if(N==1&M>1)
        cout<<M-2<<"\n";
    else
        cout<<(N-2)*(M-2)<<"\n";
    return 0;    
        
     
}

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

#define ff               first
#define ss               second
#define mp               make_pair
#define pb               push_back
#define pii              pair<int,int>
#define vi               vector<int> 
#define mii              map<int,int>
#define setbits(x)       __builtin_popcountll(x)
#define zerobits(x)      __builtin_ctzll(x)
#define mod              1000000007
#define inf              1e18
#define endl             "\n"

void h_code()
{
 #ifndef ONLINE_JUDGE
     freopen("input.txt", "r", stdin);
     freopen("output.txt", "w", stdout);
 #endif
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
}

void l_code()
{
 #ifndef ONLINE_JUDGE
     cout<<"\nTime Elapsed: " << 1.0*clock() / CLOCKS_PER_SEC << " sec\n";
 #endif
}
const int N=100005;

int main() {
   // h_code();
    int t=1;
    // cin>>t;
    while(t--)
    {
              int n,m;
              cin>>n>>m;
              if(n==m)  
                cout<<"Yes";
              else 
                cout<<"No";
    }

   // l_code();
}

Measured memory_bytes: 256
#python 3.7.1

a, b, c, d=map(int, input().split())

k=d

if(a-k>0):

  print(k)

else:

  k=d-a

  if(b-k>0):

    print(a)

    

  else:

    k=d-a-b

    print(a-k)

    

    

    

  

  



Measured memory_bytes: 9184
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        char[] s = sc.next().toCharArray();
        int ans = 1;
        char prev = s[0];
        for(int i = 1; i < s.length; i++){
            if(prev != s[i]){
                ans++;
                prev = s[i];
            }
        }
        System.out.println(ans-1);
    }
}

Measured memory_bytes: 26276
#include<stdio.h>
int main(void){
    int n,c;
    scanf("%d %d",&n,&c);
    int all=0;
    for(int i=0;i<c;i++){
        int bring;
        scanf("%d",&bring);
        all+=bring;
    }
    n+=1;
    int ans=all/n;
    if(all%n==0){
        printf("%d\n",ans);
    }else{
        printf("%d\n",ans+1);
    }
    return 0;
}


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

namespace Algorithm
{
    class Program
    {
        static void Main(string[] args)
        {
            var l = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int N = l[0], W = l[1];

            var dp = new long[N + 1, W + 1];
            for (var i = 0; i < N; i++)
            {
                var wv = Console.ReadLine().Split().Select(int.Parse).ToArray();
                for (var j = 0; j <= W; j++)
                {
                    if (j - wv[0] >= 0)
                    {
                        dp[i + 1, j] = Math.Max(dp[i, j], dp[i, j - wv[0]] + wv[1]);
                    }
                    else
                    {
                        dp[i + 1, j] = dp[i, j];
                    }
                }
            }

            Console.WriteLine(dp[N, W]);
        }
    }
}


Measured memory_bytes: 91232
#include<bits/stdc++.h>
using namespace std;
int main()
{
	string a,b;
	int i;
	cin >> a;
	cin >> b;
	int x = a.size();
	int y = b.size();
	if(y != x + 1)
	{
		cout << "No";
		return 0;
	}
	else
	{
		for(i=0;i<x;i++)
		{
			if(a[i] == b[i])
			{
				continue;
			}
			else
			{
				cout << "No";
				return 0;
			}
		}
		cout << "Yes";
		return 0;
	}
}


Measured memory_bytes: 3620
#include <cstdio>
#include <vector>
#include <algorithm>
#include <cassert>

using namespace std;

int B, r;
vector<int> g[100001];

int f(int x, int y) {
	vector<int> v;
	for (auto t : g[x]) if (t != y) {
		int z = f(t, x) + 1;
		if (!z) return -1;
		if (z == B) r++;
		else v.push_back(z);
	}
	int i, j, t = 0;
	sort(v.begin(), v.end());
	for (i = 0, j = (int)v.size() - 1; i < j; j--) {
		if (v[i] + v[j] <= B) r++, i++;
		else {
			if (t) r++;
			t = v[j];
		}
	}
	if (i == j) {
		if (t) r++;
		for (j++; j < v.size() && v[i] + v[j] <= B; i--, j++);
		assert(i >= 0);
		return v[i];
	}
	return t;
}

int main() {
	int L, R;
	int i, j, k, n, t, tr;
	scanf("%d", &n);
	for (i = 1; i < n; i++) {
		scanf("%d%d", &j, &k);
		g[j].push_back(k);
		g[k].push_back(j);
	}
	tr = 1;
	for (i = 1; i <= n; i++) tr += (g[i].size() - 1) / 2;
	B = n;
	t = f(1, 1);
	if (t) r++;
	assert(r == tr);
	L = 1;
	R = n;
	while (L < R) {
		B = (L + R) / 2;
		r = 0;
		t = f(1, 1);
		if (t) r++;
		if (r == tr) R = B;
		else L = B + 1;
	}
	printf("%d %d\n", tr, L);
	return 0;
}


Measured memory_bytes: 13696
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a;
	string s;
	cin>>a>>s;
	int b=s.size();
	if(a>=b)
	{
		cout<<s;
		return 0;
	}
	else
	{
		for(int i=0;i<a;i++)
		{
			cout<<s[i];
		}
		cout<<"...";
	}
 } 

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

int main(){
    
    int N,M;
    cin >> N >> M;
    vector<pair<long long,long long>> vec(N);
    long long A;
    for(int i = 0; i < N;i++){
        cin >> A;
        vec[i] = make_pair(A,0);
    }
    sort(vec.begin(),vec.end());
    
    long long B,C;
    vector<pair<long long,long long>> change(M);    
    for(int i = 0; i < M;i++){
        cin >> B >> C;
        change[i] = make_pair(C,B);
    }
    
    sort(change.begin(),change.end(),greater<pair<long long,long long>>());
    
    int index = 0;
    for(int i = 0; i < M;i++){
        
        while(change[i].first > vec[index].first&&change[i].second>0){
            vec[index].first = change[i].first;
            index++;
            change[i].second--;
        }
        
        
    }
    
    long long ans = 0;
    for(int i = 0; i < N;i++){
        ans += vec[i].first;
    }
    
    cout << ans << endl;
}



Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll n;
    cin>>n;
    ll a[n],i,j,k,x,y,z,cnt=0;
    for(i=0;i<n;i++)
    {
        cin>>a[i];
    }
    for(i=0;i<n;i++)
    {
        for(j=i+1;j<n;j++)
        {
            for(k=j+1;k<n;k++)
            {
                x=a[i],y=a[j],z=a[k];
                if(x+y>z&&y+z>x&&x+z>y&&x!=y&&y!=z&&z!=x)
                    cnt++;
            }
        }
    }
    cout<<cnt;
}

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

int main() {
	ll a;
	double b;
	cin >> a >> b;
	int ib = (b * 100 + 0.5);
	ll ans = (a * ib) / 100;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3676
/*
AizuOnline A0063
Palindrome
*/
#include <stdio.h>
#include <string.h>

int ispalin(char * s,int len)
{  
  if(len < 2)
    return(-1);
  else if(len ==2)
    return(s[0]==s[1]?(-1):0);
  else if(s[0]==s[len-1] )
    return(ispalin(s+1,len-2));
  else
    return(0);
}



main()
{
  char s[101];
  int  cnt=0;
  
  while(EOF != scanf("%s",s))
    {
      if(ispalin(s,strlen(s)))
        {
          cnt++;
          /*printf("palin\n");*/
        }
    }
  printf("%d\n",cnt);

return(0);
}

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

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

    if(s + t[t.length() - 1] == t)
    {
        cout << "Yes";
    }
    else
    {
        cout << "No";
    }
    

    return 0;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < int(n); ++i)
#define rrep(i,n) for (int i = int(n)-1; i >= 0; i--)
#define rep2(i,s,n) for (int i = int(s); i < int(n); ++i)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define pb push_back
#define eb emplace_back
#define vi vector<int>
#define vvi vector<vector<int>>
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vd vector<double>
#define vs vector<string>
#define vc vector<char>
#define vb vector<bool>
#define vp vector<P>
using namespace std;
using ll = long long;
using P = pair<int,int>;
using LP = pair<ll,ll>;
template<class S,class T> istream& operator>>(istream &is,pair<S,T> &p) { return is >> p.first >> p.second; }
template<class S,class T> ostream& operator<<(ostream &os,const pair<S,T> &p) { return os<<'{'<<p.first<<","<<p.second<<'}'; }
template<class T> istream& operator>>(istream &is,vector<T> &v) { for(T &t:v){is>>t;} return is; }
template<class T> ostream& operator<<(ostream &os,const vector<T> &v) { os<<'[';rep(i,v.size())os<<v[i]<<(i==v.size()-1?']':','); return os; }
void Yes(bool b) { cout << (b ? "Yes" : "No") << endl; }
void YES(bool b) { cout << (b ? "YES" : "NO") << endl; }
template<class T> bool chmin(T& a,T b) {if(a > b){a = b; return true;} return false;}
template<class T> bool chmax(T& a,T b) {if(a < b){a = b; return true;} return false;}
const int inf = 1001001001;
const ll linf = 1001001001001001001;

int w[3],v[3];
ll dp[4][25000010];

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr); cout.tie(nullptr);
    ll n;
    cin >> n;
    rep(i,3) cin >> w[i];
    rep(i,3) cin >> v[i];
    rep(_,2) {
        rep(i,4) rep(j,n+1) dp[i][j] = -inf;
        dp[0][0] = 0;
        rep(i,3) rep(j,n+1) {
            dp[i+1][j] = dp[i][j];
            if(j >= w[i]) chmax(dp[i+1][j],dp[i+1][j-w[i]]+v[i]);
        }
        ll mx = 0;
        rep(i,n+1) chmax(mx,dp[3][i]+n-i);
        n = mx;
        swap(w,v);
    }
    cout << n << endl;
}

Measured memory_bytes: 784668
fn get_line() -> String {
    let mut line = String::new();
    std::io::stdin().read_line(&mut line).unwrap();
    line.trim().to_string()
}

fn main() {
    let target = get_line().to_lowercase();
    let mut count = 0;
    loop {
        let line = get_line();
        if line == "END_OF_TEXT" { break; }
        for word in line.to_lowercase().split_whitespace() {
            if target == word {
                count += 1;
            }
        }
    }
    println!("{}", count);
}



Measured memory_bytes: 5048
N = int(input())
A = list(map(int,input().split()))
A.sort()

ans = 1

for i in range(N):
  if A[i] == 0:
    ans = 0
    break
  ans = ans * A[i]
  if ans > 1e+18:
    ans = -1
    break

print(ans)

Measured memory_bytes: 21648
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
 
typedef long long ll;
typedef long double ld;
 
#define REP(i,a,n) for(int (i)=(a); (i)<(int)(n); (i)++)
#define rep(i,n) REP(i,0,n)
#define sqrt(d) pow((long double) (d), 0.50)

const ll INF = 2e9;
const ll large_P = 1e9 + 7;


int main(){
  ll N; cin >> N;
  string S; cin >> S;
  
  vector<ll> Rs;
  vector<ll> Gs;
  vector<ll> Bs;
  
  for(int i = 0; i < N; i++){
    if(S.at(i) == 'R') Rs.push_back(i);
    else if(S.at(i) == 'G') Gs.push_back(i);
    else Bs.push_back(i);
  }
  
  ll NR = Rs.size();
  ll NG = Gs.size();
  ll NB = Bs.size();
  
  ll res = NR*NG*NB;
  
   for(int i = 0; i < NR; i++){
     for(int j = 0; j < NG; j++){
       int temp = 2*Rs.at(i) - Gs.at(j);
       if(temp >= 0 && temp < N && S.at(temp) == 'B') res--;
       temp = 2*Gs.at(j) - Rs.at(i);
       if(temp >= 0 && temp < N && S.at(temp) == 'B') res--;
       temp = Rs.at(i) - Gs.at(j);
       if(temp%2 == 0 && S.at((Rs.at(i) + Gs.at(j))/2) == 'B') res--;
    }
  }
  
  cout << res << endl;
  //cout << S << endl;
  
}

Measured memory_bytes: 3660
s=list(input())
t=list(input())
if len(t)>len(s):
    print("UNRESTORABLE")
    exit()
n=len(s)
m=len(t)
ans=[]
for i in range(n-m+1):
    x=s.copy()
    f=0
    for j in range(m):
        if x[i+j]==t[j]:
            f+=1
        elif x[i+j]=="?":
            x[i+j]=t[j]
            f+=1
    if f==m:
        for j in range(n):
            if x[j]=="?":
                x[j]="a"
        ans.append("".join(x))
if len(ans)==0:
    print("UNRESTORABLE")
else:
    ans=sorted(ans)
    print(ans[0])


Measured memory_bytes: 63316
#include <cstdio>
#define F(i,x,y) for(int i=x;i<=y;++i)
using namespace std;
int main(){
	int n,m;
	scanf("%d%d",&n,&m);
	printf("%d\n",(n*(n-1)+m*(m-1))/2);
	return 0;
}


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

using namespace std;
typedef long long ll;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using vd = vector<double>;
using vvd = vector<vd>;

#define out(a) cout << a << endl
#define out1(a) cout << a
#define in(a) cin >> a
#define in2(a, b) cin >> a >> b
#define in3(a, b, c) cin >> a >> b >> c
#define rep(i, N) for (ll i = 0; i < (ll)N; i++)
#define rep1(i, N) for (ll i = 1; i <= (ll)N; i++)
#define repi(i, j, N) for (ll j = (ll)i + 1; j < (ll)N; j++)
#define all(v) v.begin(), v.end()
#define pb(a) push_back(a)
#define Yes(a) cout << (a ? "Yes" : "No") << endl
#define yes(a) cout << (a ? "yes" : "no") << endl
#define YES(a) cout << (a ? "YES" : "NO") << endl

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

constexpr int inf = 1e9;
constexpr ll linf = 1e18;
constexpr ll mod = 1e9 + 7;
constexpr int MAX = 200020;

void solve()
{
    ll h, w;
    in2(h, w);
    if (h == 1 || w == 1)
    {
        out(1);
    }
    else
    {
        out((h * w + 1) / 2);
    }
}

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

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

int main() {
  int N;
  cin >> N;
  int T, A;
  cin >> T >> A;
  int H[N];
  cin >> H[0];
  int index = 0;
  double temp = fabs(A - (T - H[0] * 0.006));
  for (int i = 1; i < N; ++i) {
    cin >> H[i];
    double temptemp = fabs(A - (T - H[i] * 0.006));
    if (temp > temptemp) {
      index = i;
      temp = temptemp;
    }
  }
  cout << index + 1 << '\n';
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <queue>
#include <algorithm>

using namespace std;
using LL = long long;
using PLL = pair<LL, LL>;
vector<LL> v;

void bfs()
{
	queue<LL> q;

	for (int i = 1; i <= 9; ++i)
		q.push(i);

	while (!q.empty())
	{
		LL t = q.front();
		v.push_back(t);
		if (v.size() >= 150005)
			break;
		q.pop();
		if (t % 10 != 0)
			q.push(t * 10 + t % 10 - 1);
		q.push(t * 10 + t % 10);
		if (t % 10 != 9)
			q.push(10 * t + t % 10 + 1);
	}
}


int main()
{
	bfs();
	sort(v.begin(), v.end());	
	unique(v.begin(), v.end());
	int k;
	scanf("%d", &k);
	cout << v[k - 1] << endl;


	return 0;
}

Measured memory_bytes: 4340
import java.io.*;
import java.util.*;


public class Main {
    static long mod = 1000000000+7;
    static long n,a,b,k;
    public static void main(String[] args) throws Exception{
        Scanner sc = new Scanner(System.in);
        //BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        //String[] buf = reader.readLine().split(" ");
        n = sc.nextLong();
        HashSet<Long> div = new HashSet<>();
        for(long i=1;i*i<=n;i++){
            if(n%i==0){
                div.add(i);div.add(n/i);
            }
        }
        long ans= 0;
        HashSet<Long> res = new HashSet<>();
        for(long w:div){
            if(w==1) continue;
            long m = w-1;
            if(w*(n%m)==n) res.add(m);
        }
        for(long w:res) ans += w;
        System.out.println(ans);
    }
}



Measured memory_bytes: 24020