akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC86
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] str = Console.ReadLine().Split(' ');
            int a = int.Parse(str[0]);
            int b = int.Parse(str[1]);
            if((a * b) % 2 == 0)
            {
                Console.WriteLine("Even");
       
            }
            else{
                Console.WriteLine("Odd");
            }
        }
    }
}


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

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

const int N=2e5+100;
const int mod=1e9+7;
const int inf=0x3f3f3f3f;

ll qpow(ll x,ll n)
{
    if(x==0&&n==0) return 1;
    ll sum=1;
    while(n){
        if(n&1) {
            sum=sum*x%mod;
        }
        x=x*x%mod;
        n>>=1;
    }
    return sum;
}
ll A[2000010];
ll C(int x,int y)
{
    if(y>x) return 0;
    if(y<0) return 0;
    //if(y==0) return 1;
    return A[x]*qpow(A[y],mod-2)%mod*qpow(A[x-y],mod-2)%mod;
}

void init()
{
    A[0]=1;
    for(int i=1;i<=2e6;i++)
        A[i]=A[i-1]*i%mod;
}
int main()
{
    init();
    int x,y;
    cin>>x>>y;
    if((x+y)%3!=0) {
        cout<<0<<endl;
    }
    else{
        cout<<C((x+y)/3,(2*y-x)/3)<<endl;
    }
}



Measured memory_bytes: 19212
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
//template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
 
/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
*/

int main(){
    string s; cin >> s;
    int ans = 10000;

    string tmp, nxt;

    for(char c='a'; c<='z'; c++){
        tmp = s;
        int turn = 0;
        while(true){
            bool flg = true;
            for(int i=0; i<tmp.size(); i++) if(tmp[i] != c) flg = false;
            if(flg){
                ans = min(ans, turn);
                break;
            }

            if(tmp.size() <= 1) break;
            nxt = "";
            for(int i=0; i<tmp.size()-1; i++){
                if(tmp[i] == c || tmp[i+1] == c) nxt += c;
                else nxt += tmp[i];
            }

            turn++;
            tmp = nxt;
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
using System;
using System.IO;
using System.Linq;

namespace Contest
{
    class Program
    {
        public void Solve()
        {
            var sc = new Scanner();
            int N = sc.NextInt();
            int K = sc.NextInt();
            string S = sc.Next();
            var c = S.ToArray();
            c[K - 1] =(char)(c[K-1] -'A' + 'a');
            Console.WriteLine(new string(c));
        }

        static void Main() => new Program().Solve();
    }
}

class Scanner
{
    public Scanner()
    {
        _stream = new StreamReader(Console.OpenStandardInput());
        _pos = 0;
        _line = new string[0];
        _separator = ' ';
    }
    private char _separator;
    private StreamReader _stream;
    private int _pos;
    private string[] _line;
    #region get a element
    public string Next()
    {
        if (_pos >= _line.Length)
        {
            _line = _stream.ReadLine().Split(_separator);
            _pos = 0;
        }
        return _line[_pos++];
    }
    public int NextInt()
    {
        return int.Parse(Next());
    }
    public long NextLong()
    {
        return long.Parse(Next());
    }
    public double NextDouble()
    {
        return double.Parse(Next());
    }
    #endregion
    #region convert array
    private int[] ToIntArray(string[] array)
    {
        var result = new int[array.Length];
        for (int i = 0; i < array.Length; i++)
        {
            result[i] = int.Parse(array[i]);
        }

        return result;
    }
    private long[] ToLongArray(string[] array)
    {
        var result = new long[array.Length];
        for (int i = 0; i < array.Length; i++)
        {
            result[i] = long.Parse(array[i]);
        }

        return result;
    }
    private double[] ToDoubleArray(string[] array)
    {
        var result = new double[array.Length];
        for (int i = 0; i < array.Length; i++)
        {
            result[i] = double.Parse(array[i]);
        }

        return result;
    }
    #endregion
    #region get array
    public string[] Array()
    {
        if (_pos >= _line.Length)
            _line = _stream.ReadLine().Split(_separator);
        _pos = _line.Length;
        return _line;
    }
    public int[] IntArray()
    {
        return ToIntArray(Array());
    }
    public long[] LongArray()
    {
        return ToLongArray(Array());
    }
    public double[] DoubleArray()
    {
        return ToDoubleArray(Array());
    }
    #endregion
}

Measured memory_bytes: 13268
import fractions

N,X=map(int,input().split())
L=list(map(int,input().split()))
ans = abs(L[0] - X)
for i in range(N-1):
  z = abs(L[i+1] - X)
  if ans > z:
    if ans % z != 0:
      ans = fractions.gcd(ans, ans % z)
    else:
      ans = z
  else:
    if z % ans != 0:
      ans = fractions.gcd(z, z % ans)

print(ans)


Measured memory_bytes: 16296
/* ファイル名：ITP1_4_B.c	*/
/* 内容：半径 r の円の面積と円周の長さを求める	*/

/* include	*/
#include <stdio.h>

/* 外部変数宣言	*/

/* 定数宣言	*/
#define PAI 3.141592653589

/* プロトタイプ宣言	*/

/* 関数名:main	*/
/* 処理内容:半径 r の円の面積と円周の長さを求める	*/
int main( void )
{
	/* 内部変数定義	*/
	/* 入力	*/
	double r;	/* 円の半径	*/
	/* 出力	*/
	double are;		/* 円の面積	*/
	double circ;	/* 円の円周	*/
	
	scanf("%lf", &r);/* 半径を取得	*/
	
	/* 演算	*/
	are = (r * r) * PAI;	/* 面積を算出	*/
	
	circ = (r * 2) * PAI;	/* 面積を算出	*/
	
	
	printf("%f %f\n", are, circ);
	
	return 0;
}



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

long long max(long long a,long long b)
{
	return a>b?a:b;
}

queue <long long> P;
int K;
int num;

int main ()
{
	for (int i = 1; i < 10; i ++) P.push (i);
	scanf("%d",&K);
	while (1)
	{
		long long x = P.front (); P.pop (); K--;
		if(K==0) { printf ("%lld\n",x); break;}
		for (long long y = (x % 10) - 1; y <= (x % 10) + 1; y ++) {	if (y < 0 || y > 9) continue; P.push (x * 10 + y); }
	}
	return 0;
}

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

int main() {
	// your code goes here
	int n;
	cin>>n;
	long long maxm = 0, ans = 0;
	for(int i=0;i<n;++i) {
		long long x;
		cin>>x;
		maxm = max(x, maxm);
		ans += (maxm-x);
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 3564
#include <stdio.h>

int main(void)
{
	int a,b,r1,r2,r3,max;
	
	scanf("%d %d",&a,&b);
	
	r1=a+b;
	r2=a-b;
	r3=a*b;
	
	if(r1>=r2&&r1>=r3){
		max=r1;
	}else if(r2>=r3){
		max=r2;
	}else{
		max=r3;
	}
	
	printf("%d\n",max);
	
	return 0;
}
	

Measured memory_bytes: 128
#include<cstdio>
#include<vector>

using namespace std;

int main(){
	int n;
	long long ans = 0;
	scanf("%d", &n);
	vector<int> a(n + 1);
	for(int i = 0; i < n; i++){
		scanf("%d", &a[i]);
	}
	for(int i = 0; i < n; i++){
		ans += (long long)a[i] / 2;
		if((a[i] % 2) && (a[i + 1] > 0)){
			ans++;
			a[i + 1]--;
		}
	}
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 640
#k = int(input())
#s = input()
#a, b = map(int, input().split())
#s, t = map(str, input().split())
#l = list(map(int, input().split()))
#l = [list(map(int,input().split())) for i in range(n)]

n = int(input())
c = input()

ans = 0
r = 0
#Rの総数を数える
for i in range(n):
    if c[i] == 'R':
        r+=1

if (r == n or r== 0):
    print(0)
    exit()

for i in range(n):
    if c[i] == 'W':
        r -= 1
        ans+=1
    else:
        r -= 1
    if (r == 0):
        break
print(ans)



Measured memory_bytes: 9436
#include <iostream>
#include <cstring>
//#include <cmath>
//#include <cstdlib>
//#include <algorithm>
using namespace std;

int main(){
    //ios::sync_with_stdio(false);
    char test[12];
    while(scanf("%s",&test)!=EOF){
    	if(test[0]!='A' || test[1]=='C' || test[strlen(test)-1]=='C'){
    		printf("WA\n");
    		continue;
		}
		int i,flg=0;
		int num_c=0;
		for(i=1;test[i]!='\0';i++){
			if(test[i]=='C'){
				num_c++;
				continue;
			}
			if(test[i]>'z' || test[i]<'a'){
				flg=1;
				printf("WA\n");
				break;
			}
		}
		if(flg)continue;
		if(num_c!=1){
			printf("WA\n");
			continue;
		}
		printf("AC\n");
	}
	return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <vector>
#include <string>
#include <array>
#include <queue>
#include <deque>
#include <set>
#include <list>
#include <map>
#include <stack>
#include <utility>
#include <algorithm>
#include <numeric>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <cstring>
#include <climits>
#include <bitset>
#include <random>
#include <functional>
#include <sstream>
#include <iomanip>

using namespace std;

#define rep(i, n) for(int i=0; i<(n); i++)
#define FOR(i, m, n) for(int i=(m);i<(n);i++)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define SORT(x) sort((x).begin(),(x).end())
#define REVE(x) reverse((x).begin(),(x).end())
#define mp make_pair
#define pb push_back

typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<vector<int>> VVI;
typedef pair<int, int> PII;
typedef long long LL;

LL gcd(LL n, LL m) {
	if (m == 0)return n;
	return gcd(m, n%m);
}

int main() {
	int n; cin >> n;
	VI a(n); rep(i, n)cin >> a[i];

	LL ans = gcd(a[0], a[1]);
	FOR(i, 2, n) {
		ans = gcd(ans, a[i]);
	}
	cout << ans << endl;
}

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

int main()
{
  int a,b,c;
  cin>>a>>b>>c;
  if((a==b)&&(b==c))
  {cout<<"No";
return 0;}
  else if(a==b||a==c||b==c)
{cout<<"Yes";
return 0;}
else cout<<"No";}


Measured memory_bytes: 256
<?php
  	$n = fgets(STDIN);
	$a = explode(' ', fgets(STDIN));
	$b = explode(' ', fgets(STDIN));
	$c = explode(' ', fgets(STDIN));
	$total = array_sum($b);

	for($i = 0;$i < $n-1;$i ++){
      if($a[$i+1]-$a[$i] == 1){
        $total += $c[$a[$i]-1];
      }
    }
	echo($total);

Measured memory_bytes: 3576
#include<iostream>
#include<string>

using namespace std;

int main(int argc, char* argv[])
{
  string input, ring, target;
  string::size_type flag;
  cin >> input >> target;
  ring = input + input;
  flag = ring.find(target);
  if(flag==string::npos) cout << "No" << endl;
  else cout << "Yes" << endl;
}

Measured memory_bytes: 3220
#include<cstdio>
 int main()
 {
 	 int x,y;
 	 int n = 0;
 	 scanf("%d%d",&x,&y);
 	 int a[7] = {1,3,5,7,8,10,12};
 	 int b[7] = {4,6,9,11,0,0,0};
 	 int c[7] = {2,0,0,0,0,0};
 	 for ( int i = 0; i < 7;  i++)
	 {
	 	 if ( a[i] == x) n++;
	 	 if ( a[i] == y) n++;
		 if ( b[i] == x) n+=3;
		 if ( b[i] == y) n+=3;
	 }
	 if ( n == 2 || n == 6) printf("Yes\n");
	 else printf("No\n");
	 return 0;
 }

Measured memory_bytes: 128
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int acCnt = 0;
		int waCnt = 0;
		int tleCnt = 0;
		int reCnt = 0;
		for (int i = 0; i < n; i++) {
			sc.nextLine();
			switch (sc.next()) {
				case "AC" :
					acCnt++;
					break;
				case "WA" :
					waCnt++;
					break;
				case "TLE" :
					tleCnt++;
					break;
				case "RE" :
					reCnt++;
					break;
			}
		}
		System.out.println("AC x " + acCnt);
		System.out.println("WA x " + waCnt);
		System.out.println("TLE x " + tleCnt);
		System.out.println("RE x " + reCnt);
		
	}
}


Measured memory_bytes: 61328
#include <iostream>
#include <cstdlib>

#include <algorithm>
#include <string>
using namespace std;

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


    for (int i = 0; i < s.size(); i++){
        // cout << s[i];
        if (i+1 == k){
            char b = s[i]+ 0x20;
            cout << b;
        }else{
            cout << s[i];
        }
    }

    cout << endl;

	return 0;
}

Measured memory_bytes: 256
pub 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()
}

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

pub fn read_vec2<T: std::str::FromStr>(n: usize) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}

pub fn read_col<T: std::str::FromStr>(n: usize) -> Vec<T> {
    (0..n).map(|_| read()).collect()
}

fn main() {
    let s: String = read();
    let t: String = read();
    let sv: Vec<char> = s.chars().collect();
    let tv: Vec<char> = t.chars().collect();
    let ls = sv.len();
    let lt = tv.len();

    let mut ans: String =
        String::from("zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz");

    for i in 0..(ls - lt + 1) {
        let mut b = true;
        let mut tmp = sv.clone();
        for j in 0..lt {
            if sv[i + j] != '?' && sv[i + j] != tv[j] {
                b = false;
                break;
            } else {
                tmp[i + j] = tv[j];
            }
        }
        if b {
            for i in 0..ls {
                if tmp[i] == '?' {
                    tmp[i] = 'a';
                }
            }
            let hoge: String = tmp.into_iter().collect();
            if hoge < ans {
                ans = hoge;
            }
        }
    }

    if ans.len() > 50 {
        println!("UNRESTORABLE");
    } else {
        println!("{}", ans);
    }
}


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

int main() {

  int n,i,d,g;
  i = 1;
  g = 0;
  d = 0;
  cin >> n;
  
  int a[n];
  
  while(i < n + 1){
    cin >> a[i];
    
    if(a[i] % 2 == 0){
      g = g + 1;
      if(a[i] % 3 == 0 || a[i] % 5 == 0){
        d = d + 1;
      }
    }
    
    i = i + 1;
  }
  
  if(d == g){
    cout << "APPROVED";
  }else{
    cout << "DENIED";
  }
  
    
  
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int N;
  int th,h,te,o;
  cin >> N;
  th=N/1000;
  h=(N%1000)/100;
  te=((N%1000)%100)/10;
  o=N-1000*th-100*h-10*te;
  if(th==h && th==te && th==o)
    cout << "Yes" << endl;
  else if(th==h && th==te)
    cout << "Yes" << endl;
  else if(h==te && h==o)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}


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


namespace Test1 {

    


    class ClassMain {


        public static void Main(String[] args) {
            string line;
            while ((line = Console.ReadLine()) != null) {
                if (line.Equals("0")) { break; }
                int[] ints = line.Split(' ').Select(int.Parse).ToArray();
                int cardN = ints.Length;
                int score=0;
                int _1kazu = 0;
                for (int i = 0; i < cardN; i++) {
                    if (ints[i] >= 10) { score += 10; }
                    else if (ints[i] > 1) { score += ints[i]; }
                    else { score += 1; _1kazu++; }
                    if (score > 21) { break; }
                }
                if (score > 21) { score = 0; }
                else {
                    for (int i = 0; i < _1kazu; i++) {
                        if (score + 10 <= 21) { score += 10; }
                        else { break; }
                    }
                }

                
                Console.WriteLine(score);
            }
        }
    
    }



    
}

Measured memory_bytes: 5924
import java.util.Scanner;

public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		int x = scan.nextInt();
		int count = 1;

		while(x != 0){
			System.out.println("Case " + count + ": " + x);
			x = scan.nextInt();
			count++;
		}
	}
}

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

int main(){
 bool is_prime[1000000]; //?´???°???????????¨

 is_prime[0] = is_prime[1] = false;
 
 for(int i=2; i<1000000; i++){
  is_prime[i] = true;
 }
 
 for(int i=2; i*i<1000000; i++){
  if(is_prime[i]){
   for(int j=i*i; j<1000000; j+=i){
    is_prime[j] = false;
   }
  }
 }

 while(true){
  int n;
  int count = 0;
  cin >> n;

  if(n==0) break;
  
  for(int i=2; i<=n/2; i++){
   if(is_prime[i]){
    if(is_prime[n-i]) count++;
   }
  }
  cout << count << endl;
 }
 

 return 0;
}

Measured memory_bytes: 4044
n, m = map(int, input().split())
A = list(map(int, input().split()))
c = [0, 2, 5, 5, 4, 5, 6, 3, 7, 6]

dp = [-1]*(n+1)
dp[0] = 0

for i in range(n+1):
    for j in A:
        if i - c[j] >= 0:
            dp[i] = max(dp[i], dp[i - c[j]] * 10 + j)
print(dp[n])

Measured memory_bytes: 14388
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> mp;
ll inf =  1e9;


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


Measured memory_bytes: 256
import sys
#from collections import defaultdict, deque, Counter
#import bisect
#import heapq
import math
#from itertools import accumulate
#from itertools import permutations as perm
#from itertools import combinations as comb
#from itertools import combinations_with_replacement as combr
#from fractions import gcd
#import numpy as np

stdin = sys.stdin
sys.setrecursionlimit(10 ** 7)
MIN = -10 ** 9
MOD = 10 ** 9 + 7
INF = float("inf")
IINF = 10 ** 18

def main():
    n = int(stdin.readline().rstrip())
    a = int(stdin.readline().rstrip())
    b = int(stdin.readline().rstrip())
    c = int(stdin.readline().rstrip())
    d = int(stdin.readline().rstrip())
    e = int(stdin.readline().rstrip())
    m = min(a,b,c,d,e)
    u = math.ceil(n/m)
    print(4 + u)

main()


Measured memory_bytes: 3064
#include<stdio.h>
int main(void)
{
    int e,y;
	scanf("%d",&e);
	scanf("%d",&y);
	if(e==0 && y<=1911){
	  printf("M%d\n",y-1867);
	 }
	else if(e==0 && y<=1925){
	  printf("T%d\n",y-1911);
	 }
	else if(e==0 && y<=1988){
	  printf("S%d\n",y-1925);
	 }
	else if(e==0 && y<=2016){
	  printf("H%d\n",y-1988);
	 }
	if(e==1 && y<=44){
	  printf("%d\n",y+1867);
	 }
	if(e==2 && y<=14){
	  printf("%d\n",y+1911);
	 }
	if(e==3 && y<=63){
	  printf("%d\n",y+1925);
	 }
	if(e==4 && y<=28){
	  printf("%d\n",y+1988);
	 }
	return 0;
}


Measured memory_bytes: 2104
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define MOD 1000000007
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
  
int main()
{
  string S;
  cin >> S;
  
  vector<ll> A(S.size()+1);
  
  vector<ll> B;
  ll cnt = 1;
  REP(i,S.size()-1){
    if(S.at(i)!=S.at(i+1)){
      B.push_back(cnt);
      cnt = 1;
      continue;
    }
    cnt++;
  }
  B.push_back(cnt);
  // REP(i,B.size()){
  //   cout << B.at(i);
  // }
  if(S.at(0) == '<'){
    if(B.size()%2==0){
      ll sum = 0;
      REP(i,B.size()/2){
        ll x = min(B.at(i*2),B.at(i*2+1));
        ll y = max(B.at(i*2),B.at(i*2+1));
        sum+=(x-1)*x/2+y*(y+1)/2;
      }
      cout << sum << endl;
    }else{
      ll sum = 0;
      REP(i,(B.size()-1)/2){
        ll x = min(B.at(i*2),B.at(i*2+1));
        ll y = max(B.at(i*2),B.at(i*2+1));
        sum+=(x-1)*x/2+y*(y+1)/2;
      }
      cout << sum + B.at(B.size()-1)*(B.at(B.size()-1)+1)/2 << endl;
    }
  }else{
    if(B.size()%2==0){
      ll sum = 0;
      FOR(i,1,B.size()/2){
        ll x = min(B.at(i*2-1),B.at(i*2));
        ll y = max(B.at(i*2-1),B.at(i*2));
        sum+=(x-1)*x/2+y*(y+1)/2;
      }
      cout << sum + B.at(0)*(B.at(0)+1)/2 + B.at(B.size()-1)*(B.at(B.size()-1)+1)/2 << endl;
    }else{
      ll sum = 0;
      FOR(i,1,(B.size()-1)/2+1){
        ll x = min(B.at(i*2-1),B.at(i*2));
        ll y = max(B.at(i*2-1),B.at(i*2));
        sum+=(x-1)*x/2+y*(y+1)/2;
      }
      cout << sum + B.at(0)*(B.at(0)+1)/2 << endl;
    }
  }
}

Measured memory_bytes: 6908
a = input()
if a == "SUN":
  print(7)
elif a == "MON":
  print(6)
elif a == "TUE":
  print(5)
elif a == "WED":
  print(4)
elif a == "THU":
  print(3)
elif a == "FRI":
  print(2)
elif a == "SAT":
  print(1)

Measured memory_bytes: 9124
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
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 ll = long long;
using P = pair<int,int>;
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;}

// UnionFind
// coding: https://youtu.be/TdR816rqc3s?t=726
// comment: https://youtu.be/TdR816rqc3s?t=6822
struct UnionFind {
  vector<int> d;
  UnionFind(int n=0): d(n,-1) {}
  int find(int x) {
    if (d[x] < 0) return x;
    return d[x] = find(d[x]);
  }
  bool unite(int x, int y) {
    x = find(x); y = find(y);
    if (x == y) return false;
    if (d[x] > d[y]) swap(x,y);
    d[x] += d[y];
    d[y] = x;
    return true;
  }
  bool same(int x, int y) { return find(x) == find(y);}
  int size(int x) { return -d[find(x)];}
};

int deg[100005];
vector<int> to[100005];

int main()
{
    int N,M,K;
    cin >> N >> M >> K;
    UnionFind uf(N);
    rep(i,M){
        int a,b;
        cin >> a >> b;
        a--; b--;
        deg[a]++;
        deg[b]++;
        uf.unite(a,b);
    }
    rep(i,K){
      int a,b;
      cin >> a >> b;
      a--; b--;
      to[a].push_back(b);
      to[b].push_back(a);
    }
    rep(i,N){
        int ans = uf.size(i) - 1 - deg[i];
        for(int u : to[i]){
          if(uf.same(i,u)) ans--;
        }
        printf("%d%c", ans, i==N-1?'\n':' ');
    }

    return 0;
}
//Ctrl+Shift+Bでコンパイルと実行を行ってデバッグすること

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

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

const long long INF = 1LL << 60;

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

  int sum = 0;
  if(n > 1) sum += (n*(n-1))/2;
  if(m > 1) sum += (m*(m-1))/2;

  cout << sum << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REP1(i,n) for(int i = 1; i < n+1 ;i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
#define SZ(x) ((int)(x).size())
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))
using namespace std;
typedef long long ll;
using p = pair<int, int>;
using P = pair<ll, ll>;
using V = vector<int>;
using VV = vector<vector<int>>;
using VVV = vector<vector<vector<int>>>;
using VL = vector<ll>;
using VVL = vector<vector<ll>>;
using VVVL = vector<vector<vector<ll>>>;
using Graph = VV;


int main(){
    ios::sync_with_stdio(false); cin.tie(0);
    int n;
    cin >> n;
    map<string,int>mp;
    REP(i,n){
        string s;
        cin >> s ;
        mp[s]++;
    }
    cout << mp.size() << endl;
    return 0;

}
 

Measured memory_bytes: 19236
import numpy as np
n=int(input())
ABC=[list(map(int,input().split())) for _ in range(n)]

dp=np.zeros((n,3),int)
for i in range(3):
  dp[0][i]=ABC[0][i]
for i in range(n-1):
  for j in range(3):
    dp[i+1][j]=max(dp[i][(j+1)%3]+ABC[i+1][j], dp[i][(j+2)%3]+ABC[i+1][j])
print(max(dp[-1]))

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

#define REP(i, x, n) for (int i = x; i < (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x.size())
#define popcount(x) __builtin_popcount(x)
#define popcountll(x) __builtin_popcountll(x)
#define uniq(x) x.erase(unique(x.begin(), x.end()), x.end())
#define F first
#define S second
#define mp make_pair
#define eb emplace_back
#define pii pair<int, int>
#define pll pair<ll, ll>

using namespace std;

typedef long long ll;

/* --- INFの値が適切か確認する --- */
// const int INF = 1 << 30;
// const ll INF = 1LL << 60;
// const int MOD = 1000000007;

int main() {
  int n;
  cin >> n;
  cout << n * n * n << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, a, b) for(int i = a; i < b; i++)
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  FastIO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
typedef long long ll;
using P = pair<int,int>;
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; }

int main(){
    int n;
    cin >> n;
    vector<int> p(n);
    rep(i,n) cin >> p[i];
    int ans = 0;
    for(int i = 1; i < n-1; i++){
        vector<int> pp;
        for(int j = i-1; j <= i+1; j++) pp.push_back(p[j]);
        sort(all(pp));
        if (pp[1] == p[i]) ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3564
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String {
            bytes
                .by_ref()
                .map(|r| r.unwrap() as char)
                .skip_while(|c| c.is_whitespace())
                .take_while(|c| !c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

use std::cmp::max;

fn main() {
    input!{
        n: usize,
        k: usize,
        v: [usize; n]
    }
    let d = 1000000007;
    let mut tab: Vec<Vec<usize>> = vec![vec![0; k + 1]; n + 1];
    tab[0][0] = 1;
    for i in 1..n + 1 {
        let mut ps: Vec<usize> = tab[i - 1].iter().clone().scan(0, |ac, x| {*ac = (*ac + x) % d; Some(*ac)}).collect();
        ps.insert(0,0);
        for j in 0..k + 1 {
            tab[i][j] = (ps[j + 1] + d - ps[max(0, j as i64 - v[i - 1] as i64) as usize]) % d;
        }
    }
    println!("{}", tab[n][k]);
}


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

using namespace std;
using ll = long long;
vector<ll> E[100050];
int a[100010],b[100010];
template<int n>class UF{
    public:
    vector<int> rank,par,cnt;
    UF():rank(n,0),par(n,0),cnt(n,1){for(int i=0;i<n;++i)par[i] = i;}
    int operator[](int x){return (par[x] ==x)?x:par[x] = operator[](par[x]);}
    int count(int x){return cnt[operator[](x)];}
    int operator()(int a,int b){
        if((a = operator[](a)) == (b = operator[](b))) return a;
        cnt[a] = cnt[b] = cnt[a] + cnt[b];
        if(rank[a] > rank[b]) return par[a] = b;
        rank[a] += rank[a] == rank[b];return par[b] = a;
    }
};
UF<100010> uf;
ll ret[100010];
int main(){
    std::ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll n,m;
    cin>>n>>m;
    ll cur = 1LL*n*(n-1)/2;
    for(int i=0;i<m;++i){
        cin>>a[i]>>b[i];
    }
    for(int i=m-1;i>=0;i--){
        ret[i] = cur;
        if(uf[a[i]] != uf[b[i]]){
            cur -= 1LL * uf.count(a[i]) * uf.count(b[i]);
            uf(a[i],b[i]);
        }
    }
    for(int i=0;i<m;++i)cout << ret[i] << endl;
    return 0;
}



Measured memory_bytes: 6400
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<string>
#include<iostream>
#include<cctype>
#include<cstdio>
#include<vector>
#include<stack>
#include<queue>
#include <algorithm>
#include<math.h>
#include<set>
#include<map>
#include<iomanip>

//#include<bits/stdc++.h>


using namespace std;


int main() {
	
	string p;
	int x;
	cin >> p >> x;

	for (int i = 0; i < p.size(); i++) {
		int y = 'z'-p[i]+1;
		if (p[i] == 'a')continue;
		if (x >= y) {
			x -= y; p[i] = 'a';
		}

	}
	x %= 26;
	p[p.size() - 1] += x;
	cout << p << endl;
	
	return 0;

}


Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <tuple>
#include <deque>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
using namespace std;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)

typedef long long ll;
typedef pair<int, int> P;
typedef pair<int, double> Pid;
typedef pair<double, int> Pdi;
const double PI = 3.1415926535897932;   // acos(-1)
const double EPS = 1e-15;
const int INF = 1001001001;
const ll mod = 1e+9 + 7;

#define chadd(x, y) x = (x + y) % mod

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

    int n, k, s;
    cin >> n >> k >> s;
    if(s != (int)1e+9){
        for(int i = 0; i < k; ++i){
            cout << s << " ";
        }
        for(int i = k; i < n; ++i){
            cout << s + 1 << " ";
        }
        cout << endl;
    }
    else{
        for(int i = 0; i < k; ++i){
            cout << s << " ";
        }
        for(int i = k; i < n; ++i){
            cout << 1 << " ";
        }
        cout << endl;
    }
}

Measured memory_bytes: 1280
#include<bits/stdc++.h>
using namespace std;
#define ll long long
string s,t;

int main()
{
    int a,b,c,k,ans;
    cin>>a>>b>>c>>k;
    ans=min(a,k);
    k-=ans;
    if(k==0)printf("%d\n",ans);
    else
    {
        a=min(k,b),k-=a;
        if(k==0)printf("%d\n",ans);
        else
        {
            a=min(k,c),ans-=a;
            printf("%d\n",ans);
        }
    }
    return 0;
}


Measured memory_bytes: 3740
#include<bits/stdc++.h>
using namespace std;
int main(){
  int d;
  cin>>d;
  vector<int> c(26);
  for(int i=0;i<26;i++)
    cin>>c.at(i);
  vector<vector<int>> s(d,vector<int>(26));
  for(int i=0;i<d;i++)
    for(int j=0;j<26;j++)
      cin>>s.at(i).at(j);
  vector<set<int>> l(26);
  for(int i=0;i<26;i++)
    l.at(i).insert(0);
  vector<int> t(d);
  int64_t p;
  for(int i=1;i<=d;i++){
    vector<int> x(26,0);
    int m=0;
    for(int j=0;j<26;j++){
      int64_t pi=s.at(i-1).at(j);
      for(int k=0;k<26;k++)
        pi-=c.at(k)*(k==j?0:i-*rbegin(l.at(k)));
      x.at(j)=pi;
      if(x.at(j)>x.at(m))
        m=j;
    }
    t.at(i-1)=m;
    p=x.at(m);
    l.at(m).insert(i);
  }
  for(int i=0;i<26;i++)
    l.at(i).insert(d+1);
  for(int i=0;i<d;i++)
    cout<<t.at(i)+1<<endl;
  for(int i=0;i<100000;i++){
    int pn=p;
    int di=rand()%d+1;
    int qn=rand()%26;
    int qo=t.at(di-1);
    l.at(qo).erase(di);
    auto io=lower_bound(l.at(qo).begin(),l.at(qo).end(),di);
    auto in=lower_bound(l.at(qn).begin(),l.at(qn).end(),di);
    pn+=s.at(di-1).at(qn)-s.at(di-1).at(qo);
    pn+=(di-*prev(in,1))*(*in-di)*c.at(qn)-(di-*prev(io,1))*(*io-di)*c.at(qo);
    if(pn>p){
      l.at(qn).insert(di);
      t.at(di-1)=qn;
    }else
      l.at(qo).insert(di);
  }
}

Measured memory_bytes: 3676
#include <iostream>	
#include <string>
#include <algorithm>
#include <vector>
#include <list>
using namespace std;
typedef unsigned long long LL;
//
//int com(int n, int r) {
//	if (n == r || n == 0)return 0;
//}
//
//
//int main()
//{
//	string s;
//	int k;
//
//	
//
//	int a['z'] = { 0 };
//	for (int i = 0; i < s.length; i++)
//	{
//		a[s[i]] ++;
//	}
//	int count = 0;
//	for (int i = 'a'; i <'z' ; i++)
//	{
//		if (a[i] != 0)count++;
//	}
//	if (count < s.length > k) {
//		cout << "0"<<endl;
//		return 0;
//	}
//
//
//}
 
//LL visit(int x, int y) {
//	static int count = 0;
//	if (x == 0 && y == 0) {		
//		count++;
//		return count;
//	}
//if (x != 0)visit(x - 1, y);
//	if (y != 0)visit(x, y - 1);
//
//}
//
//int main() {
//	int N1,N2;
//	cin >> N1>>N2;
//	cout << visit(N1, N2) << endl;
//}
 
int main() {
	int x, y;
	cin >>x >>y;
	if (x == 2||y==2) {
		cout << "No" << endl;
		return 0;
	}
	bool boolx, booly;
	boolx = (x == 4 || x == 6 || x == 9 || x == 11);
	booly = (y == 4 || y == 6 || y == 9 || y == 11);
 
	if (booly == boolx)cout << "Yes";
	else cout << "No";
	cout << endl;
}

Measured memory_bytes: 256
n, x = map(int, input().split())
a = list(map(lambda x: int(x), input().split()))
#in1 = '5 9'
#in2 = '3 1 4 1 5'
#n, x = map(int, in1.split())
#a = list(map(lambda x: int(x), in2.split()))

RC = 0
if a[0] > x:
    RC += a[0] - x
    a[0] = x

for idx1 in range(1, len(a)):
    if a[idx1 - 1] + a[idx1] > x:
        RC += a[idx1 - 1] + a[idx1] - x
        a[idx1] = x - a[idx1 - 1]

print(RC)


Measured memory_bytes: 14252
#include<iostream>
#include<cstdio>
#include<string>
#include<cstring>
using namespace std;
int main()
{
	int n,a[200][3];
	int ans[200];
	cin >> n;
	for(int i=0;i<n;i++)ans[i]=0;
	for(int i=0;i<n;i++){
		cin >> a[i][0] >> a[i][1] >> a[i][2];
	}
	bool b[200];
	for(int k=0;k<3;k++){
		for(int i=0;i<n;i++)b[i]=true;
		for(int i=0;i<n;i++){
			for(int j=i+1;j<n;j++){
				if(a[i][k]==a[j][k]){
					b[i]=false;
					b[j]=false;
				}
			}
		}
		for(int i=0;i<n;i++){
			if(b[i])ans[i]+=a[i][k];
		}
	}
	for(int i=0;i<n;i++)cout << ans[i] << "\n";
	return 0;
}

Measured memory_bytes: 1164
A = int(input())
B = int(input())
if (A == 1 and B == 2) or (B == 1 and A == 2):
    print(3)
elif (A == 1 and B == 3) or (B == 1 and A == 3):
    print(2)
elif (A == 2 and B == 3) or (B == 2 and A == 3):
    print(1)

Measured memory_bytes: 3064
import java.util.Scanner;

public class Main {
	public static void main(String arg[]) {

		Scanner sc = new Scanner(System.in);

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

		System.out.println(n * a > b ? b : n * a);

	}
}


Measured memory_bytes: 22868
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
const int INF = (1<<30);
const ll INFLL = (1ll<<60);
const ll MOD = (ll)(1e9+7);

#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	a = (a<MOD)?a:(a-MOD);
	b = (b<MOD)?b:(b-MOD);
	a += b;
	a = (a<MOD)?a:(a-MOD);
}

bool check(int x){
	return (1<=x && x<=12);
}

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


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

int main(){
  int A,B,K;
  cin>>A>>B>>K;
  if(A+K-1>=B-K+1){
    for(int i=A;i<B+1;i++)
      cout<<i<<endl;
  }
  else{
  for(int i=0;i<K;i++)
  	cout<<A+i<<endl;
  for(int i=K-1;i>-1;i--)
    cout<<B-i<<endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define _LIBCPP_DEBUG 0

using namespace std;
#define ll long long
#define rep(i,n) for (int i = 0; i < n; i++)
#define MOD (1000000007)
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int, int>
#define all(a)  (a).begin(),(a).end()

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

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

const ll INF = 1LL << 60;

int main(){
  int n; cin >> n;
  string s; cin >> s;
  vector<ll> count(26);
  rep(i, n){
    count[s[i] - 'a']++;
  }
  ll ans = 1;
  for (int i = 0; i < 26; i++) {
    ans = (ans*(count[i] + 1))%MOD;
  }

  std::cout << ans-1 << '\n';
}


Measured memory_bytes: 512
import java.util.*;
import java.io.*;
import java.awt.geom.*;
import java.math.*;

public class Main {

	static final Scanner in = new Scanner(System.in);
	static final PrintWriter out = new PrintWriter(System.out,false);
	static boolean debug = false;

	static void solve() {
		long a = in.nextLong();
		long b = in.nextLong();
		long c = in.nextLong();
		out.println(Math.min(a*b*(c - c/2) - a*b*(c/2), Math.min(a*(b - b/2)*c - a*(b/2)*c, (a - a/2)*b*c - (a/2)*b*c)));
	}

	public static void main(String[] args) {
		debug = args.length > 0;
		long start = System.nanoTime();

		solve();
		out.flush();

		long end = System.nanoTime();
		dump((end - start) / 1000000 + " ms");
		in.close();
		out.close();
	}

	static void dump(Object... o) { if (debug) System.err.println(Arrays.deepToString(o)); }
}

Measured memory_bytes: 9556
#include<iostream>
using namespace std;
int main() {
  int d;
  cin >> d;
  if(d == 22){
    cout << "Christmas Eve Eve Eve" << endl;
  }else if(d == 23){
    cout << "Christmas Eve Eve" << endl;
  }else if(d == 24){
    cout << "Christmas Eve" << endl;
  }else{
    cout << "Christmas" << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <list>
#include <queue>
#include <algorithm>
#define rep(i, n) for(i = 0; i < (n); i++)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define MOD 1000000007
#define PI 3.14159265358979323846
#define INF 1 << 30

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

ll Ans(ll a, ll b, ll c, ll num) {
	ll ans = min(a, num);
	num -= a + b;
	if (num <= 0)
		return ans;
	return ans - num;
}

int main(void) {
	ll a, b, c, num, ans;
	cin >> a >> b >> c >> num;
	cout << Ans(a, b, c, num) << "\n";
	return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main() {
    string s,t;
    cin>>s>>t;
    ll a,b;
    cin>>a>>b;
    string u;
    cin>>u;
    if(s.compare(u)==0)
    {
        cout<<a-1<<" "<<b;
    }
    else
    {
        cout<<a<<" "<<b-1;
    }
}

Measured memory_bytes: 256
# 2020/02/22
# AtCoder Beginner Contest 156 - B

def chg_ks(x, n):
    if (x // n != 0):
        return chg_ks(x // n, n) + str(x % n)
    else:
        return str(x % n)
    
# Input
n, k = map(int,input().split())

# Calc
ans = len(chg_ks(n, k))

# Output
print(ans)

Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vll = vector<ll>;
using vs = vector<string>;
using vvs = vector<vs>;
using pli = pair<long long, int>;
using vpli = vector<pli>;

int main() {
  ll X, cnt = 0, div = 0;
  cin >> X;

  cnt = X / 100;
  div = X % 100;
  
  if (div <= cnt * 5) cout << 1 << endl;
  else cout << 0 << endl;
    
}

Measured memory_bytes: 256
# Aizu Problem 00149: Eye Test
#
import sys, math, os, copy

# read input:
PYDEV = os.environ.get('PYDEV')
if PYDEV=="True":
    sys.stdin = open("sample-input.txt", "rt")


def get_judgement(x):
    if x >= 1.1:
        return "A"
    elif x >= .6:
        return "B"
    elif x >= .2:
        return "C"
    else:
        return "D"

    
count = {char: {"left": 0, "right": 0} for char in ['A', 'B', 'C', 'D']}
for line in sys.stdin:
    left, right = [float(_) for _ in line.split()]
    count[get_judgement(left)]["left"] += 1
    count[get_judgement(right)]["right"] += 1


for char in ['A', 'B', 'C', 'D']:
    print(count[char]["left"], count[char]["right"])

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

int main(){

int N;
cin >> N;
double sum = 0.0;

for(int i = 0; i < N; i++){
  int in;
  cin >> in;
  double re = 1.0 / in;
  sum += re;
}

cout << 1.0 / sum << endl;


}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef long double ld;
int main()
{
  ll x,y;
  cin >> x >> y;
  ll cnt = 1;
  while(true){
    x *= 2;
    if(x<=y) cnt++;
    else break;
  }
  cout << cnt << endl;
  return 0;
}


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

//Function Macros:
#define rep(i, n) for(int(i) = 0; (i) < (n); (i)++)
#define all(v) (v).begin(), (v).end()
#define setpre(n) cout << fixed << setprecision(n)

//Type Definitions:
typedef long long ll;
typedef unsigned long long ull;

//Constants:
const int INF = 2e9;
const int MOD = 1e9 + 7;

//Global Variables:

//Prototype Declarations:
int gcd(int, int);

//================ Main Loop ================
int main() {
    int a, b, c;
    cin >> a >> b >> c;
    if(a == b && b != c) {
        cout << "Yes" << endl;
    } else if(b == c && c != a) {
        cout << "Yes" << endl;
    } else if(c == a && a != b) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}
//===========================================

//Functions:
int gcd(int a, int b) {
    return b ? gcd(b, a % b) : a;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define rep(i,n) for (int i = (0); i < (n); ++i)
#define rng(x) (x).begin(),(x).end()
#define rrng(x) (x).rbegin(),(x).rend()
#define show(x) cout << #x << " = " << (x) << endl;
#define show2(x,y) cout << #x << " = " << (x) << ", " << #y << " = " << (y) << endl;
#define show3(x,y,z) cout << #x << " = " << (x) << ", " << #y << " = " << (y) <<  ", " << #z << " = " << (z) << endl;
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define uni(x) x.erase(unique(rng(x)),x.end())
#define SP << " " <<
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
const int mod = 1000000007;
const double EPS = 1e-9;
const int INF = 1<<30;
const ll INFLL = 1LL<<60;
//cout << fixed << setprecision(10);

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

int main () {
  string s, t;
  cin >> s >> t;
  cout << t << s << endl;
  return 0;
}

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

int main(void) {
  string S;
  cin >> S;

  bool ok = true;
  if (S.front() != 'A') {
    ok = false;
  }
  int count = 0;
  for (int i = 2; i < S.size() - 1; ++i) {
    if (S[i] == 'C') {
      count++;
    }
  }
  if (count != 1) {
    ok = false;
  }
  for (int i = 1; i < S.size(); ++i) {
    if (isupper(S[i]) && S[i] != 'C') {
      ok = false;
    }
  }

  if (ok) {
    cout << "AC" << endl;
  } else {
    cout << "WA" << endl;
  }
  
  return 0;
}

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

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

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

const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int INF = 1<<30;
const ll mod = 1000000007LL;

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

int main(){
    string S;
    int K;
    cin>>S>>K;
    set<string> s;
    int N = S.size();
    rep(i,5){
        rep(j,N-i){
            string t;
            for(int k = j; k < j+i+1; k++){
                t+=S[k];
            }
            s.insert(t);
        }
    }
    auto ite = s.begin();
    rep(i,K-1) ite++;
    cout<<*ite<<endl;
}

Measured memory_bytes: 4784
#include <stdio.h>
#include<string.h>

int main(void) {
  int N;
  int i, j;
  int t;
  char str[11];

  scanf("%d", &N);
  char name[N+1][11];
  int point[N+1],list[N+1];

  for(i=1; i<=N; i++){
    scanf("%s %d", name[i], &point[i]);
  }

  for(i=1; i<=N; i++){
    list[i]=i;
  }

  //入れ替え
  for(i=1; i<=N; i++){
    for(j=1; j<=N-1; j++){

      if(strcmp(name[j], name[j+1])==0){
        // printf("i=%d j=%d name[j]=name[j+1]=%s\n", i, j,name[j]);
        if(point[j+1]>point[j]){
          t=list[j];
          list[j]=list[j+1];
          list[j+1]=t;
          t=point[j];
          point[j]=point[j+1];
          point[j+1]=t;
          // printf("list[j]=%d list[j+1]=%d\n", list[j], list[j+1]);
          // printf("list[%d]=%d list[%d]=%d\n", j,j+1, list[j], list[j+1]);
        }
      }else if(strcmp(name[j], name[j+1])>0){
        // printf("i=%d j=%d name[j]=%s name[j+1]=%s\n", i, j,name[j], name[j+1]);
        t=list[j];
        list[j]=list[j+1];
        list[j+1]=t;
        t=point[j];
        point[j]=point[j+1];
        point[j+1]=t;
        strcpy(str, name[j]);
        // printf("str=%s name[%d]=%s\n", str, j,name[j]);
        strcpy(name[j], name[j+1]);
        // printf("name[%d]=%s name[%d]=%s\n", j,name[j], j+1,name[j+1]);
        strcpy(name[j+1], str);
        // printf("name[%d]=%s str=%s\n", j,name[j], ,str);
        // printf("違う文字list[%d]=%d list[%d]=%d\n", j,j+1, list[j], list[j+1]);
        // printf("name[j]=%s name[j+1]=%s\n", name[j],name[j+1]);
      }
    }
  }

  for(i=1; i<=N; i++){
    printf("%d\n", list[i]);
  }
  return 0;
}


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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

vector<string> ans;

void f(string now) {
    ans.push_back(now);
    ll last = now.back() - '0';
    if (now.size() >= 1e4) return;
    if (last == 1) {
        string x = to_string(last + 1);
        f(now + x);
    } else {
        string x = to_string(last + 1);
        string x2 = to_string(last - 1);
        f(now + x);
        f(now + x2);
    }
}

void Main() {
    ll K;
    cin >> K;
    vector<string> ans;
    rep2(i, 1, 10) {
        ans.push_back(to_string(i));
    }
    while (ans.size() <= 1e6) {
        auto x = ans;
        rep(i, x.size()) {
            string now = ans[i];
            ll d = now.back() - '0';
            if (d == 0) {
                ans.push_back(ans[i] + to_string(d));
                ans.push_back(ans[i] + to_string(d + 1));
            } else if (d == 9) {
                ans.push_back(ans[i] + to_string(d));
                ans.push_back(ans[i] + to_string(d - 1));
            } else {
                ans.push_back(ans[i] + to_string(d));
                ans.push_back(ans[i] + to_string(d + 1));
                ans.push_back(ans[i] + to_string(d - 1));
            }
        }
    }
    set<ll> t;
    rep(i, ans.size()) {
        t.insert(stoll(ans[i]));
    }
    int idx = 0;
    for (auto a : t) {
        idx++;
        if (idx == K) {
            cout << a << '\n';
            return;
        }
    }
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 113560
n = int(input())
s = str(input())
ans = s.count("R")*s.count("G")*s.count("B")

for i in range(n-2):
    for j in range(i+1, n-1):
        k = int(2*j -i)
        if k <= n-1:
            if s[i] != s[j] and s[k] != s[i] and s[j] != s[k]:
                ans -= 1

print(ans)

Measured memory_bytes: 73288