akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<string>
#include<algorithm>    
#include<cmath>
#include<map>
#include<vector>
#include<math.h>
#include<stdio.h>
#include<stack>
#include<queue>
#include<tuple>
#include<cassert>
#include<set>
#include<functional>
//#include<bits/stdc++.h>
#define rep(i, x) for(ll i = 0; i < x; i++)
#define rep2(i, x) for(ll i = 1; i <= x; i++)
#define all(a) (a).begin(),(a).end()
using ll = long long;
using ld = long double;
using namespace std;
const ll INF = 1000000000000000000;
const ll mod = 1000000007;
const ld pi = 3.141592653589793238;

/*bool IsPrime(ll num) {
	if (num < 2) return false;
	else if (num == 2) return true;
	else if (num % 2 == 0) return false; // 偶数はあらかじめ除く
	double sqrtNum = sqrt(num);
	for (int i = 3; i <= sqrtNum; i += 2) {
		if (num % i == 0) { // 素数ではない
			return false;
		}
	}
	// 素数である
	return true;
}*/
/*ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (a % b == 0)return b;
	return gcd(b, a % b);
}
ll lcm(ll a, ll b) {
	return a / gcd(a, b) * b;
}*/
/*ll keta(ll n) {
	ll res = 0;
	while (n >= 1) {
		res += n % 10; n /= 10;
	}
	return res;
}*/
/*ll modpow(ll x, ll y) {
	ll res = 1;
	while (y) {
		if (y % 2) { res *= x; res %= mod; }
		x = x * x % mod; y /= 2;
	}
	return res;
}*/
/*ll nCk(ll n, ll k) {
	ll a = 1, b = 1;
	for (int h = n - k + 1; h <= n; h++) { a *= h; a %= mod; }
	for (int h = 1; h <= k; h++) { b *= h; b %= mod; }
	return a * modpow(b, mod - 2) % mod;
}*/
//printf("%.10f\n", n);

ll test[12345678];
signed main() {
	string s, t;
	ll n, m, a, b, cnt = 0, ans = 0;
	cin >> n;
	rep(i, n) { cin >> test[i]; }
	rep(h, n) {
		for (int i = h + 1; i < n; i++) {
			for (int j = i + 1; j < n; j++) {
				if (test[h] == test[i]) { continue; }
				if (test[h] == test[j]) { continue; }
				if (test[i] == test[j]) { continue; }
				cnt = test[h] + test[i] + test[j] - max(test[h], max(test[i], test[j]));
				if (cnt > max(test[h], max(test[i], test[j]))) { ans++; }
			}
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
//#include "testlib.h"
#define ff first
#define ss second
#define all(v) v.begin(),v.end()
#define int long long
#define ll long long
#define M 1000000007
#define MM 998244353
#define inputarr(a,n) for(int i=0;i<n;++i) cin>>a[i]
#define GCD(m,n) __gcd(m,n)
#define LCM(m,n) m*(n/GCD(m,n))
#define mii  map<ll ,ll >
#define msi  map<string,ll >
#define rep(a,b)    for(ll i=a;i<b;i++)
#define rep0(n)    for(ll i=0;i<n;i++)
#define repi(i,a,b) for(ll i=a;i<b;i++)
#define pb push_back
#define vi vector<ll>
#define vs vector<string>
#define ppb pop_back
#define endl '\n'
#define asdf ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define r0 return 0;
#define FORD(i, a, b) for (int i = (int) (a); i >= (int) (b); --i)
#define inputoutput freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
#define Set(a, s) (a, s, sizeof (a))
#define FOR repi
#define vii vector<pii>
#define pii pair<int,int>
#define REVERSE(v) reverse(all(v))
#define trav(a, x) for(auto& a : x)
#define display(x) trav(a,x) cout<<a<<" ";cout<<endl
#define debug cerr<<"bhau"<<endl
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    std::cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');std::cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
template<typename T, typename U> static inline void amin(T &x, U y) 
{ 
    if (y < x) 
        x = y; 
}
template<typename T, typename U> static inline void amax(T &x, U y) 
{ 
    if (x < y) 
        x = y; 
}
 
ll max(ll a, ll b) { return (a > b)? a : b;}
int min(int a, int b) { return (a < b)? a : b;} 


int solve(){

    int x,n;cin>>x>>n;
    int vis[n+10000];
    memset(vis,0,sizeof(vis));
    rep0(n){
        int x;cin>>x;
        vis[x]=1;
    }
    int cur=0;
    for(int i=0;i<n+10000;i++){
        if(vis[i]) continue;
        if(abs(cur-x)>abs(x-i)) cur=i;
    }
    cout<<cur<<endl;


    return 0;
}
signed main(){
    asdf
    int t=1;
    // cin>>t;
    while(t--){
        solve();
    }
    return 0;
}
    

Measured memory_bytes: 3720
use std::cmp::*;
fn main() {
    let v = read_vec::<u64>();
    let n = v[0];
    let m = v[1];
    let mut count = 0;
    count += min(n, m / 2);
    let rest_c = m - count * 2;
    count += rest_c / 4;
    println!("{}", count);
}

#[allow(dead_code)]
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()
}
#[allow(dead_code)]
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}
#[allow(dead_code)]
fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}
#[allow(dead_code)]
fn yn(result: bool) {
    if result {
        println!("Yes");
    } else {
        println!("No");
    }
}


Measured memory_bytes: 4352
#include<cstdio>
#include<algorithm>
using namespace std;
int n,k,ans,p;
int map[12][6]=
{
    {4,2,0,9,7},
    {1,10,8,6,4},
    {9,7,5,3,1},
    {6,4,2,0,9},
    {3,1,10,8,6},
    {0,9,7,5,3},
    {8,6,4,2,0},
    {5,3,1,10,8},
    {2,0,9,7,5},
    {10,8,6,4,2},
    {7,5,3,1,10}
	};
int main()
{
    scanf("%d%d",&n,&k);n-=2;
    p=n%11;n/=11;
    ans=n*5;
    for(int i=0;i<p;i++)
    	for(int j=0;j<5;j++)
    		if(map[i][j]==k)ans++;
    			printf("%d\n",ans);
    return 0;
}

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

int main()
{
  string s;
  cin >> s;
  int i;
  int count = 0;
  for(i = 0; i < 3; i++)
  {
    if(s.at(i) == '1') count++;
  }
  cout << count << endl;
}

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

int main(){
    int N;
    cin>>N;
    vector<string> blue;
    vector<int> score;
    string str;
    
    for(int i=0;i<N;i++){
        cin>>str;
        if(i==0){
            blue.push_back(str);
            score.push_back(1);
        }else{
            for(int j=0;j<blue.size();j++){
                if(str==blue[j]){
                    score[j]++;
                    break;
                }
                if(j==blue.size()-1){
                    blue.push_back(str);
                    score.push_back(1);
                    break;
                }
            }
        }
    }
    int M;
    cin>>M;
    for(int i=0;i<M;i++){
        cin>>str;
        for(int j=0;j<blue.size();j++){
            if(str==blue[j]){
                score[j]--;
                break;
            }
        }
    }
    if(*max_element(score.begin(),score.end())>0){
        cout<<*max_element(score.begin(),score.end())<<endl;
    }else{
        cout<<0<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <array>
#include <algorithm>

using namespace std;

int main() {
    int n;
    int a[100000];
    int b[100000];
    int c[100000];

    cin >> n;

    for(int i = 0; i < n; i ++){
        cin >> a[i];
        b[i] = a[i];

    }
    sort(b,b+n);

    for(int i = 0; i < n; i ++){
        c[a[i]] = i;
    }

    for(int i = 0; i < n; i ++){
        cout << c[b[i]]+1 << " ";
    }


    return 0;
}

Measured memory_bytes: 4768
#include <iostream>
#include <string>
#include <vector>

std::string str,s;

std::vector<int> vec;

bool check(){

    int j=0;

    for(char ch : str){
        if(ch!='x'){
            s+=ch;
            vec.emplace_back(j);
        }
        ++j;
    }

    for(int i=0;i<s.size()/2;++i){
        if(s[i]!=s[s.size()-i-1])
            return true;
    }

    return false;
}

int main() {

    std::cin>>str;

    if(check()){
        std::cout<<-1<<std::endl;
        return 0;
    }

    int l=0,r=str.size()-1,ans=0;

    for(int i=0;i<vec.size()/2;++i){
        ans+=abs(vec[i]+vec[vec.size()-i-1]-l-r);
        l=vec[i]+1;
        r=vec[vec.size()-i-1]-1;
    }

    if(vec.size()%2){
        int i=vec.size()/2;
        ans+=abs(vec[i]*2-l-r);
    }

    std::cout<<ans<<std::endl;

    return 0;
}

Measured memory_bytes: 1148
//#include <bits/stdc++.h>
//#include <stdio.h>
#include<iostream>
#include<cstdio>
#include<bitset>
#include<algorithm>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<string>
#include<string.h>
#include<cmath>
#include<utility>
#include<functional>
#include<map>
#include<set>
#include<cctype>
#include<fstream>


#define FOR(i, a, b) for( int i=(a);i<=(b);i++)
#define RFOR(i, a, b) for( int i=(a);i>=(b);i--)
#define LFOR(i, a, b) for( long long int i=(a);i<=(b);i++)
#define LRFOR(i, a, b) for(long long int i=(a);i>=(b);i--)
#define MOD 1000000007
#define INF 1000000000 //2000000000
#define LLINF 1000000000000000000 //9000000000000000000
#define PI 3.14159265358979
#define MAXI 7500000

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

int dy[5] = { 0,0,1,-1,0 };
int dx[5] = { 1,-1,0,0 ,0 };



int main(void) {
	int n;
	int h[101];
	int maxi = 0;
	int count = 1;

	cin >> n;
	FOR(i, 1, n) {
		cin >> h[i];
	}
	maxi = h[1];
	FOR(i, 2, n) {
		if (h[i] >= maxi) {
			count++;
			maxi = h[i];
		}
	}

	cout << count << endl;

	return 0;
}

Measured memory_bytes: 256
import scala.collection.mutable.ListBuffer
import scala.io.StdIn

object Main extends App {

  val n = StdIn.readLine().toInt
  val result = Array.ofDim[Int](n, n)
  (0 until n).foreach { _ =>
    val a = StdIn.readLine().split(' ').map(_.toInt)
    (0 until a(1)).foreach { k =>
      result(a(0) - 1)(a(2 + k) - 1) = 1
    }
  }
  
  //(0 until n).foreach(i => println((i+1) + ": " +result(i).mkString(" ")))
  val color = Array.ofDim[Int](n) // 0: ini, 1: current, 9: finish
  val distance = Array.fill(n)(-1)
  var queue = ListBuffer.empty[Int]

  private val WHITE = 0
  private val GRAY = 1
  private val BLACK = 9

  color(0) = GRAY
  queue += 0 // start node
  distance(0) = 0
  while(queue.nonEmpty){
    val u = queue.head
    queue = queue.drop(1)
    (0 until n).foreach { v =>
      if(result(u)(v) == 1 && color(v) == WHITE){
        color(v) = GRAY
        distance(v) = distance(u) + 1
        queue += (v)
      }
    }
    color(u) = BLACK
  }
    

  val r = (0 until n).map(v => s"${v+1} ${distance(v)}")
  
  println(r.mkString(f"%n"))
  
}


Measured memory_bytes: 44448
import java.io.*; 
import java.math.*;
import java.util.*;
import java.awt.Point;
 
public class Main {
	static final long MOD = 998244353L;
	//static final long INF = -1000000000000000007L;
	//static final long MOD = 1000000007L;
	//static final int INF = 1000000007;
	
	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		PrintWriter pw = new PrintWriter(System.out);
		int m1 = sc.ni();
		int d1 = sc.ni();
		int m2 = sc.ni();
		int d2 = sc.ni();
		if (m1 != m2)
			pw.println(1);
		else
			pw.println(0);
		pw.close();
 	}
    
    public static int[][] sort(int[][] array) {
    	//Sort an array (immune to quicksort TLE)
		Random rgen = new Random();
		for (int i = 0; i < array.length; i++) {
		    int randomPosition = rgen.nextInt(array.length);
		    int[] temp = array[i];
		    array[i] = array[randomPosition];
		    array[randomPosition] = temp;
		}
		Arrays.sort(array, new Comparator<int[]>() {
			  @Override
        	  public int compare(int[] arr1, int[] arr2) {
				  return arr1[0]-arr2[0]; //ascending order
	          }
		});
		return array;
	}
    
    public static long[][] sort(long[][] array) {
    	//Sort an array (immune to quicksort TLE)
		Random rgen = new Random();
		for (int i = 0; i < array.length; i++) {
		    int randomPosition = rgen.nextInt(array.length);
		    long[] temp = array[i];
		    array[i] = array[randomPosition];
		    array[randomPosition] = temp;
		}
		Arrays.sort(array, new Comparator<long[]>() {
			  @Override
			  //Descending order
        	  public int compare(long[] arr1, long[] arr2) {
				  if (arr2[0] < arr1[0])
					  return -1;
				  if (arr2[0] > arr1[0])
					  return 1;
				  return 0;
	          }
		});
		return array;
	}
    
    static class FastScanner { 
        BufferedReader br; 
        StringTokenizer st; 
  
        public FastScanner() { 
            br = new BufferedReader(new InputStreamReader(System.in)); 
        } 
  
        String next() { 
            while (st == null || !st.hasMoreElements()) { 
                try { 
                    st = new StringTokenizer(br.readLine());
                } catch (IOException  e) { 
                    e.printStackTrace(); 
                } 
            } 
            return st.nextToken(); 
        } 
  
        int ni() { 
            return Integer.parseInt(next()); 
        } 
  
        long nl() { 
            return Long.parseLong(next()); 
        } 
  
        double nd() { 
            return Double.parseDouble(next()); 
        } 
  
        String nextLine() { 
            String str = ""; 
            try { 
                str = br.readLine(); 
            } catch (IOException e) {
                e.printStackTrace(); 
            } 
            return str; 
        }
    }
}

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

int main() {
  int N, K;
  string S;
  cin >> N >> K >> S;
  vector<int> array;
  char c_num = S[0];
  int tmp_count = 0;
  for (int i = 0; i < N; i++) {
    if (S[i] == c_num) {
      tmp_count++;
    } else {
	  //cerr << tmp_count << endl;
      array.push_back(tmp_count);
      c_num = S[i];
      tmp_count = 1;
    }
  }
  //cerr << tmp_count << endl;
  array.push_back(tmp_count);
  
  int max_num = 0;
  int num = 0;
  int first = (S[0] == '0' ? 0 : 1);
  int now = first;
  int k = 0;
  for (int i = 0; i < array.size(); i++) {
    if (now == 0) {
      num += array[i];
      if (++k > K) {
        if (first == 0) {
          num -= array[i-2*K];
          first = 1;
        } else {
          //cerr << array[i-2*K] << ' ' <<  array[i-(2*K+1)] << ' ';
          num -= array[i-2*K] + array[i-(2*K+1)];
        }
      }
    } else {
      num += array[i];
    }
    
    //cerr << now << ' ' << num << endl;
    max_num = max(max_num, num);
    now = (now + 1) % 2;
  }
  
  cout << max_num << endl;

  return 0;
}

Measured memory_bytes: 1020
#include<stdio.h>
#include<string.h>
using namespace std;
int main(){
	int n,cnt=0;
	char a[60];
	scanf("%d",&n);
	scanf("%s",a);
	for(int i=0;i<n-2;i++){
		if(a[i]=='A'&&a[i+1]=='B'&&a[i+2]=='C'){
			cnt++;
		}
	}
	printf("%d",cnt);
}

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

int main() {
  int n;
  cin >> n;
  vector<vector<int>> m(10, vector<int>(10));
  for (int i = 1; i <= n; i++) {
    auto s = to_string(i);
    m[s.front() - '0'][s.back() - '0']++;
  }
  int r = 0;
  for (int i = 1; i <= 9; i++) {
    for (int j = 1; j <= 9; j++) {
      r += m[i][j] * m[j][i];
    }
  }
  cout << r << endl;
}


Measured memory_bytes: 256
from string import ascii_lowercase


def calc_name_length(N: int) -> int:
    name_length: int = 0
    total: int = 0

    for i in range(1, 12):
        total += 26 ** i
        if N <= total:
            name_length = i
            break

    return name_length


def calc_name_number(N: int, name_length: int) -> int:
    total: int = 0

    for i in range(1, name_length):
        total += 26 ** i

    N = N - (total + 1)

    return N


def calc_name(name_length: int, name_number: int) -> str:
    name: str = ""

    for _ in range(name_length):
        name += ascii_lowercase[name_number % 26]
        name_number //= 26

    return name


def main():
    N: int = int(input())

    name_length: int = calc_name_length(N)
    name_number: int = calc_name_number(N, name_length)
    name: str = calc_name(name_length, name_number)

    print(name[::-1])


if __name__ == "__main__":
    main()


Measured memory_bytes: 9936
def main():
    S = input()
    T = input()
    N = len(S)
    M = len(T)
    for i in range(N-M+1)[::-1]:
        if all(s == t or s == "?" for s, t in zip(S[i:i+M], T)):
            return print(S[:i].replace("?", "a") + T + S[i+M:].replace("?", "a"))
    print("UNRESTORABLE")


if __name__ == '__main__':
    main()


Measured memory_bytes: 38384
using System;

class main {
  static void Main(){
    string str;
    while(true){
      str = Console.ReadLine();
      if(str == null) break;
      string[] strs = str.Split();
      Console.WriteLine(
        (
          Convert.ToInt32(strs[0]) + Convert.ToInt32(strs[1])
        ).ToString().Length
      );
    }
  }
}


Measured memory_bytes: 13856
n  = int(input())
ans = 0
count = 0
lst = []

for i in range(n):
    num = int(input())
    ans += num
    if num%10!=0:
        lst.append(num)

if lst==[]:
    print(0)
elif ans%10!=0:
    print(ans)
else:
    print(ans-min(lst))


Measured memory_bytes: 3060
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
using static System.Console;
using static System.Math;

namespace CP
{
    class Atria
    {
        static void Main(string[] args)
        {
            WriteLine(
                ReadLine().GroupBy(x => x).Count() == 2  ? "Yes":"No"
                );   
        }
    }
}


Measured memory_bytes: 13280
import java.util.*;
import java.util.stream.Collectors;
import java.io.*;
import java.nio.charset.StandardCharsets;

public class Main {
	int N, K, C;
	char[] S;
	List<Integer> result;

	public static void main(String[] args) throws IOException {
		InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);
		BufferedReader in = new BufferedReader(reader);
		Main ins = new Main(in);
		ins.calc();
		ins.showResult();
	}

	Main(BufferedReader in) throws IOException {
		String[] tokens = in.readLine().split(" ");
		N = Integer.parseInt(tokens[0]);
		K = Integer.parseInt(tokens[1]);
		C = Integer.parseInt(tokens[2]);
		S = in.readLine().toCharArray();
	}

	List<Integer> searchFromTop(int currentIndex, int remainNum) {
		if (S[currentIndex] == 'o') {
			if (remainNum == 1) {
				List<Integer> result = new ArrayList<>(K);
				result.add(currentIndex);
				return result;
			} else {
				List<Integer> result = searchFromTop(currentIndex + C + 1, remainNum - 1);
				result.add(currentIndex);
				return result;
			}
		} else {
			return searchFromTop(currentIndex + 1, remainNum);
		}
	}

	List<Integer> searchFromEnd(int currentIndex, int remainNum) {
		if (S[currentIndex] == 'o') {
			if (remainNum == 1) {
				List<Integer> result = new ArrayList<>(K);
				result.add(currentIndex);
				return result;
			} else {
				List<Integer> result = searchFromEnd(currentIndex - C - 1, remainNum - 1);
				result.add(currentIndex);
				return result;
			}
		} else {
			return searchFromEnd(currentIndex - 1, remainNum);
		}
	}

	void calc() {
		List<Integer> indexes = searchFromTop(0, K);
		List<Integer> indexes2 = searchFromEnd(N - 1, K);
		Collections.reverse(indexes);
		result = new ArrayList<>();
		for (int i = 0; i < indexes.size(); ++i) {
			if (indexes.get(i).equals(indexes2.get(i))) {
				result.add(indexes.get(i));
			}
		}

	}

	void showResult() {
		for (int i = 0; i < result.size(); ++i) {
			System.out.println((result.get(i) + 1));
		}
	}
}

Measured memory_bytes: 77700
#include <iostream>

using namespace std;

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

  return 0;

}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <queue>
#include <vector>
#include <algorithm>
#include <climits>
using namespace std;
typedef long long ll;
const int MAX_N = 14;

int get_Cost(string a, string b)
{ //from a to b
    int res = INT_MAX;
    for (int i = a.size() - 1, st = 0; i >= 0 && st < b.size(); i--, st++)
    {
        string ca = a.substr(i, a.size() - i);
        string cb = b.substr(0, st + 1);
        if (ca == cb)
            res = st + 1;
    }
    return res;
}

bool is_contained(string s, string t)
{

    for (int i = 0; i + (int)s.size() - 1 < (int)t.size(); ++i)
    {
        if (s == t.substr(i, (int)s.size()))
            return true;
    }
    return false;
}
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n;

    while (cin >> n, n)
    {
        vector<string> T;
        for (int i = 0; i < n; ++i)
        {
            string s;
            cin >> s;
            T.push_back(s);
        }

        vector<string> V;
        for (int i = 0; i < n; ++i)
        {
            bool f = false;
            for (int j = 0; j < n; ++j)
            {
                if (i == j)
                    continue;
                if (is_contained(T[i], T[j]))
                    f = true;
            }
            if (!f)
                V.push_back(T[i]);
        }

        n = (int)V.size();
        int dp[(1 << n)][n]; /* どの文字を取ったかの状態 と 最後に取った文字番号 */

        int d[n][n];

        for (int i = 0; i < n; ++i)
        {
            for (int j = 0; j < n; ++j)
            {
                d[i][j] = INT_MAX;
            }
        }

        for (int i = 0; i < n; ++i)
        {
            for (int j = 0; j < n; ++j)
            {
                if (i == j)
                    d[i][j] = V[j].size();
                else
                {
                    int ct = get_Cost(V[i], V[j]);
                    if (ct == INT_MAX)
                        d[i][j] = V[j].size();
                    else
                        d[i][j] = (int)V[j].size() - ct;
                }
            }
        }
        for (int i = 0; i < (1 << n); ++i)
        {
            for (int j = 0; j < n; ++j)
            {
                dp[i][j] = INT_MAX;
            }
        }

        for (int i = 0; i < n; ++i)
        {
            dp[1 << i][i] = (int)V[i].size();
        }

        for (int S = 0; S < (1 << n); S++)
        {
            for (int v = 0; v < n; ++v)
            {
                if (!((S >> v) & 1))
                    continue;
                for (int u = 0; u < n; ++u)
                {
                    if (!(S >> u & 1))
                    {
                        dp[S | (1 << u)][u] = min(dp[S | (1 << u)][u], dp[S][v] + d[v][u]);
                    }
                }
            }
        }

        int minV = 1000000;
        for (int i = 0; i < n; ++i)
        {
            minV = min(minV, dp[(1 << n) - 1][i]);
        }
        cout << minV << endl;
    }

    return 0;
}


Measured memory_bytes: 4068
#include<iostream>
#include<string>
using namespace std;
int main(){
    string s;
    cin>>s;
    if(s=="SUN"){
        cout<<7<<endl;
    }else if(s=="SAT"){
        cout<<1<<endl;
    }else if(s=="FRI"){
        cout<<2<<endl;
    }else if(s=="THU"){
        cout<<3<<endl;
    }else if(s=="WED"){
        cout<<4<<endl;
    }else if(s=="TUE"){
        cout<<5<<endl;
    }else{
        cout<<6<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long int cnt,i,j,k,a,b,c,d,x,y;
    while(~scanf("%lld %lld %lld %lld",&a,&b,&c,&d))
    {
        x = a*c;
        if(x< a*d) x = a*d;
        if(x< b*c) x = b*c;
        if(x< b*d) x = b*d;
        if(x<0 && ((a<=0 && b>=0) || (c<=0 && d>=0))) x =0;
        cout << x << endl;
    }
    return 0;
}



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

typedef long long ll;

// string S = "oxo";
string S;

int main() {
    cin >> S;
    int ajitama = 0;
    for (int i = 0; i < S.size(); i++) {
        if (S[i] == 'o') {
            ajitama++;
        }
    }

    cout << 700 + ajitama * 100 << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

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

		int x = 0;
		String ch1;
		String ch2;

		// 整数の入力
		x = sc.nextInt();

		String st = new String();
		st = String.valueOf(x);

		ch1 = st.substring(0,1);
		ch2 = st.substring(1,2);

		if(ch1.equals("9") || ch2.equals("9")){
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}

		sc.close();
	}

}


Measured memory_bytes: 21844
#include<bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define M 998244353
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	string s,t;
	cin>>s>>t;
  	bool flag=0;
  	for(int i=0;i<s.size();i++)
    {
      if(s[i]!=t[i])
      {
        flag=1;
      }
    }
  	if(flag==0)
    {
      cout<<"Yes";
    }
  else
  {
    cout<<"No";
  }
	return 0;
}

Measured memory_bytes: 3636
function myin(){return require("fs").readFileSync("/dev/stdin", "utf8").trim();}

//0:何もしない  1:数値へ変換  2:半角SPで分割  3:改行で分割  4:半角SPで分割し、数値配列へ
//5:改行で分割し、数値配列へ  6:1文字に分割  7:1文字に分割し、数値配列へ
function myconv(i, no){
  switch(no){
    case 0: return i;
    case 1: return parseInt(i);
    case 2: return i.split(" ");
    case 3: return i.split("\n");
    case 4: return i.split(" ").map((a)=>Number(a));
    case 5: return i.split("\n").map((a)=>Number(a));
    case 6: return i.split("");
    case 7: return i.split("").map((a)=>Number(a));
  }}
function Main(input) {
  S = myconv(input, 0);
  len = S.length
  let ans = 999999999
  for(let i = 0; i < len; i++ ){
    num = parseInt(S.substr(i, 3), 10);
    ans = Math.min(ans, Math.abs(num - 753));
  }
  console.log(ans);

}
Main(myin());

Measured memory_bytes: 30684
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  
  int N, M;
  
  cin >> N;
  vector<string> blue(N);
  for (int i = 0; i < N; i++) {
    cin >> blue.at(i);
  }
  
  cin >> M;
  vector<string> red(M);
  for (int i = 0; i < M; i++) {
    cin >> red.at(i);
  }
  
  int score = 0;
  
  for (int i = 0; i < N; i++) {
    
    int sub_score = 0;
    
    for (int j = 0; j < N; j++) {
      if (blue.at(i) == blue.at(j)) sub_score++;
    }
    
    for (int j = 0; j < M; j++) {
      if (blue.at(i) == red.at(j)) sub_score--;
    }
    
    score = max(score, sub_score);
    
  }
  
  cout << score << endl;
  
}

Measured memory_bytes: 256
N=int(input())
A=sorted(list(map(int,input().split())))[::-1]

i=1
t=1
score=A[0]
while i<=N-1:
    if i+2<=N-1:
        score+=2*A[t]
        i+=2
        t+=1
    elif i+1<=N-1:
        score+=A[t]
        break
    else:
        break
    #print(i,t,score)
print(score)

Measured memory_bytes: 31424
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
template <typename Flow, typename Cost> class PrimalDual {
private:
  Cost INF_COST = std::numeric_limits<Cost>::max();
public:
  struct Edge {
    int to;
    Flow cap;
    Cost cost;
    int rev;
    Edge () {}
    Edge (int t, Flow f, Cost c, int rev) : to(t), cap(f), cost(c), rev(rev) {}
  };
private:
  vector<vector<Edge>> graph;
  vector<Cost> potential, min_cost;
  vector<int> prev_v, prev_e;

public:
  PrimalDual (int n) : graph(n) {}

  void add (int from, int to, Flow cap, Cost cost) {
    graph[from].push_back(Edge(to, cap, cost, (int) graph[to].size()));
    graph[to].push_back(Edge(from, 0, -cost, (int) graph[from].size() - 1));
  }

  Cost get (int start, int goal, Flow f) {
    int n = (int) graph.size();
    Cost res = 0;
    using Pi = pair<Cost, int>;
    priority_queue<Pi, vector<Pi>, greater<Pi>> que;
    potential.assign(n, 0);
    prev_e.assign(n, -1);
    prev_v.assign(n, -1);

    while (f > 0) {
      min_cost.assign(n, INF_COST);
      que.emplace(0, start);
      min_cost[start] = 0;
      while (que.size()) {
        Pi cur = que.top();
        que.pop();
        if (min_cost[cur.second] < cur.first) continue;
        for (int i = 0; i < (int) graph[cur.second].size(); i++) {
          Edge& e = graph[cur.second][i];
          Cost next_cost = min_cost[cur.second] + e.cost + potential[cur.second] - potential[e.to];
          if (e.cap > 0 && min_cost[e.to] > next_cost) {
            min_cost[e.to] = next_cost;
            prev_v[e.to] = cur.second;
            prev_e[e.to] = i;
            que.emplace(min_cost[e.to], e.to);
          }
        }
      }
    
      if (min_cost[goal] == INF_COST) return -1;
      for (int i = 0; i < n; i++) potential[i] += min_cost[i];
      Flow add_flow = f;
      for (int i = goal; i != start; i = prev_v[i]) {
        add_flow = min(add_flow, graph[prev_v[i]][prev_e[i]].cap);
      }
      f -= add_flow;
      res += add_flow * potential[goal];
      for (int i = goal; i != start; i = prev_v[i]) {
        Edge& e = graph[prev_v[i]][prev_e[i]];
        e.cap -= add_flow;
        graph[i][e.rev].cap += add_flow;
      }
    }
    return res;
  }
};
signed main() {
  ios::sync_with_stdio(false); cin.tie(0);
  int n, m, f;
  cin >> n >> m >> f;
  PrimalDual<int, int> pd(n);
  for (int i = 0; i < m; i++) {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    pd.add(a, b, c, d);
  }
  cout << pd.get(0, n - 1, f) << '\n';
  return 0;
}


Measured memory_bytes: 3220
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        
        int animalCnt = sc.nextInt();
        int pon = sc.nextInt();
        
        boolean flg = false;
        for (int turtle = 0; turtle <= animalCnt; turtle++) {
            int n = turtle * 4 + (animalCnt - turtle) * 2;

            if (pon == n) {
                flg = true;
                break;
            }
        }

        System.out.println(flg ? "Yes" : "No");
    }
}

Measured memory_bytes: 27084
def divisors(n: int)->list:
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            yield i
            if i != n // i:
                yield n // i


def preparing_boxes(N: int, A: list)->list:
    B = []
    # C = [0] * N

    for i in range(N, 0, -1):
        # print('=== {} ==='.format(i))
        a = A[i-1]
        if a == 0:
            continue
        B.append(i)
        # C[i-1] = 1

        for div in divisors(i):
            # print(div)
            A[div-1] = 1 - A[div-1]

    # print(''.join(str(i) for i in C))

    return B


if __name__ == "__main__":
    N = int(input())
    A = list(map(int, input().split()))
    ans = preparing_boxes(N, A)
    print(len(ans))
    print(' '.join(str(i) for i in ans))


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

const int MAX = 2e5 + 10;
map<string, int> A;
map<string,int>::iterator it;
string a;

int main() {
	int n;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a;
		A[a]++;
	}
	int maxx = -1;
	for (it = A.begin(); it != A.end(); it++) {
		maxx = max(maxx, it->second);
	}
	for (it = A.begin(); it != A.end(); it++) {
		if(it->second == maxx)
		cout << it->first << endl;
	}
	return 0;
}

Measured memory_bytes: 25216
#define rep(i,a,b) for(int i=a;i<b;++i)
#define repr(i,a,b) for(int i=a,i > b;--i)
#define mm(lamb, tttt) memset(lamb, tttt, sizeof lamb)

#define null NULL
#define eps 0.000000001
#define mod 1000000007

#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second
#define ALL(V) V.begin(), V.end()
#define sz(V) (ll)V.size()
#define _ <<" "<<

#include <iostream>
#include <fstream>
#include <stdio.h>
#include <stack>
#include <queue>
#include <deque>
#include <vector>
#include <iterator>
#include <bitset>
#include <list>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <cstring>
#include <string>
#include <algorithm>
#include <cmath>
#include <cassert>
#include <limits.h>
#include <iomanip>
#include <cctype>
#include <numeric>
#include <complex>

using namespace std;

typedef long long ll;
typedef vector <int> vi;
typedef pair <double, double> ii;
typedef pair<int, pair<int,int> > iii;
typedef vector<pair<int,int> > vii;

using cd = complex<double> ;
const double PI = acos(-1);

const int N=2e5+5;
int n,k,l;
vi adj1[N];
vi adj2[N];
int comp1cntr;
int comp2cntr;
vii comp(N);
vi comp1(N);
vi vis1(N);
vi comp2(N);
vi vis2(N);
// pl then for each vertex i have (a,b) values then i can store them and sor then i guess upper and lower bound will do the trick so this was mainly a DS problem
// hmm is till dont quite get the feeling.but now you think about it each query in logn time you need binary serach and hence sorting after it seems obvious.

void dfs1(int s){
	comp[s].first=comp1cntr;
	comp1[s]=comp1cntr;
	vis1[s]=true;
	for(auto v : adj1[s]){
		if(!vis1[v]) dfs1(v);
	}
}

void dfs2(int s){
	comp[s].se=comp2cntr;
	comp2[s]=comp2cntr;
	vis2[s]=true;
	for(auto v : adj2[s]){
		if(!vis2[v]) dfs2(v);
	}
}

int main(){
	cin>>n>>k>>l;

	for(int i=0;i<k;i++){
		int a,b;
		cin>>a>>b;
		adj1[a].pb(b);
		adj1[b].pb(a);
	}
	for(int i=0;i<l;i++){
		int a,b;
		cin>>a>>b;
		adj2[a].pb(b);
		adj2[b].pb(a);
	}
	for(int i=1;i<=n;i++){
		if(vis1[i]) continue;
		comp1cntr++;
		dfs1(i);
	}
	for(int i=1;i<=n;i++){
		if(vis2[i]) continue;
		comp2cntr++;
	 	dfs2(i);
	}
	//for(int i=1;i<=4;i++) cout<<comp1[i]<<" "<<comp2[i]<<" "<<comp[i].fi<<" "<<comp[i].se<<endl;

	sort(comp.begin(),comp.end());
	for(int i=1;i<=n;i++){
		cout<<upper_bound(comp.begin(),comp.end(),mp(comp1[i],comp2[i]))-lower_bound(comp.begin(),comp.end(),mp(comp1[i],comp2[i]))<<" ";
	}
	cout<<endl;
}





Measured memory_bytes: 21760
#include "bits/stdc++.h"
using namespace std;
#define int long long
#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 FOR(i,s,n) for(int i = s;i < (int)n;i++)
#define RFOR(i,s,n) for(int i = (int)n-1;i >= s;i--)
#define ALL(a) a.begin(),a.end()
template<class T>inline void out(T t){cout<<t<<"\n";}
template<class T,class... Ts>inline void out(T t,Ts... ts){cout<<t<<" ";out(ts...);}
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;}
constexpr long long INF = 1e9;



signed main(){
	int N;
	cin>>N;
	vector<int>a(N);
	REP(i,N)cin>>a[i];
	sort(a.begin(), a.end());
	a.erase(unique(a.begin(), a.end()), a.end());
	if(a.size()==N)cout << "YES" << endl;
	else out("NO");
}


Measured memory_bytes: 1792
/* -------------------------------- Template -------------------------------- */

#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <locale>
#include <iostream>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(x) (x).begin(),(x).end()

using ll = long long;
using ld = long double;

template <typename T> T &chmin(T &a, const T &b) { return a = std::min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = std::max(a, b); }

// template<typename T> constexpr T inf = [](){ assert(false); };
// template<> constexpr int inf<int> = 1e9;
// template<> constexpr ll inf<ll> = 1e18;
// template<> constexpr ld inf<ld> = 1e30;

struct yes_no : std::numpunct<char> {
  string_type do_truename()  const { return "Yes"; }
  string_type do_falsename() const { return "No"; }
};

void solve();

int main() {
  std::locale loc(std::locale(), new yes_no);
  std::cout << std::boolalpha << std::setprecision(12) << std::fixed;
  std::cout.imbue(loc);
  solve();
  return 0;
}

using namespace std;

/* -------------------------------- Library -------------------------------- */

/* ---------------------------------- Main ---------------------------------- */

void solve() {
  int N, T;
  cin >> N >> T;
  vector<int> a(N);
  for (int &i: a) cin >> i;
  int mi = a[0], d = 0, res = 0;
  REP(i,N) {
    chmin(mi, a[i]);
    if (d < a[i] - mi) {
      d = a[i] - mi;
      res = 1;
    }
    else if (d == a[i] - mi) ++res;
  }
  cout << res << endl;
  return;
}


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

int main() {
  string s;
  cin >> s;
  if(s == "SUN") cout << 7 << endl;
  if(s == "MON") cout << 6 << endl;
  if(s == "TUE") cout << 5 << endl;
  if(s == "WED") cout << 4 << endl;
  if(s == "THU") cout << 3 << endl;
  if(s == "FRI") cout << 2 << endl;
  if(s == "SAT") cout << 1 << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<iostream>
#include<cstring>
#include<cmath>
#include<iomanip>
using namespace std;
long long int n,i,j,m,sum[200000],sumend,dr,aa[2006811],ch,v[2006811],c[2006811],s1[2006811],s2[2006811],a,b,c1,k;
bool cmp(int a,int b)
{
	return a>b;
}
int gcd(int a,int b)
{
	if(!b)
		return a;
	return gcd(b,a%b);
}
long long int maxx(int a,int b)
{
    if(a>=b)
        return a;
    return b;
}
long long int lhd(long long int a)
{
	if(a<=0)
		return -a;
	return a;
}
long long int lhdmin(long long int a,long long int b)
{
	if(a<=b)
		return a;
	return b;
}
long long int dcecs(long long int n)
{
	if(n<2)
		return 0;
	if(n==2)
		return 1;
	for(int i=3;i<=sqrt(n);i+=2)
		if(n%i==0)
			return 0;
	return 1;
}
bool gqt(int x,int y)
{
	if(x+y==-2)
		return 1;
	if(x!=-1&&y!=-1&&v[x]==v[y]&&gqt(s2[x],s1[y])&&gqt(s1[x],s2[y]))
		return 1;
	return 0;
}
void xjbs(int n)
{
	c[n]=1;
	if(s1[n]!=-1)
	{
		xjbs(s1[n]);
		c[n]+=c[s1[n]];
	}
	if(s2[n]!=-1)
	{
		xjbs(s2[n]);
		c[n]+=c[s2[n]];
	}	
}
long long int minnn(long long int a,long long int b)
{
    if(a<=b)
        return a;
    return b;
}
long long int gqt(long long int b,long long int p,long long int k)
{
    /*if(p==0)
        return 1;
    if(k==1)
        return 0;
    if(b%2==1)
        return gqt(b,p/2,k)%k*b%k*gqt(b,p/2,k)%k;
    else if(b%2==0)
        return gqt(b,p/2,k)%k*gqt(b,p/2,k)%k;*/
    long long int sum=1;
    while(p!=0)
	{
	    if(p%2==1)
		{
			sum*=b;
			sum%=k;
		}
		b*=b;
		b%=k;	
		p/=2;
	}
	return sum;
}
const int k1=1e9+9;
string a1,a2;
long long int la2,flag[205]={0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1};
//long long int n,m,i,j,sum,sumend,a[71720],b,la,left1[71720],right1[71720],dp[5271720],maxx,minn,sj,x,y,p;
int main()
{
    /*cin>>n>>k;
    for(i=1;i<=n;i++)
        cin>>aa[i];
    for(i=1;i<=n;i++)
        sum[i]=sum[i-1]+aa[i];
    for(i=k;i<=n;i++)
        sumend=maxx(sumend,sum[i]-sum[i-k]);
    cout<<sumend<<endl;*/
    cin>>a1;
    int la=a1.size();
    for(i=0;i<la;i++)
    {
        if(a1[i]=='0')
        {
            a2[la2]='0';
            la2++;
            //break;
        }
        if(a1[i]=='1')
        {
            a2[la2]='1';
            la2++;
            //break;
        }
        if(a1[i]=='B')
            if(la2!=0)
            {
                la2--;
                //break;
            }
                
    }
    for(i=0;i<la2;i++)
        cout<<a2[i];
    cout<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include<numeric>
#include<cmath>
#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 ALL(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using P = pair<int,int>;
using pll = pair<ll,ll>;
using vvii = vector<vector<int> >;
using vvll =  vector<vector<ll> >;

const ll inf = 1LL << 60;

int main(){
    cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	//cout << fixed << setprecision(15);
    char c; cin >>c;
    bool flag = false;
    if(c >= 'a' && c <= 'z')flag = true;
    cout <<(flag ? 'a' : 'A') << endl;
}

Measured memory_bytes: 3648
#include <stdio.h>
#include<stdlib.h>
#define N 100000

struct Shuto{
  char string;
  int num;
  int order;
};

struct Shuto L[N / 2 + 2], R[N / 2 + 2];

int Partition(struct Shuto *, int, int);
void QuickSort(struct Shuto *, int, int);
int judge(int, int);

int main(){
  int i, j, n, v, fc = 0, rs = 1;
  struct Shuto A[N];
  char c[2];

  scanf("%d",&n);
  if(n < 1 || n > N)exit(1);

  for(i = 0 ; i < n ; i++){
    scanf("%s %d", c, &v);
    A[i].string = c[0];
    A[i].num = v;
    A[i].order = i;
  }

  QuickSort(A, 0, n-1);

  for(i = 0 ; i < n ; i++){
    for(j = i + 1 ; j < n ; j++){
      if(A[i].num != A[j].num) break;

      if(A[i].num == A[j].num){
         rs = judge(A[i].order, A[j].order);
         if(rs == 0) fc++;
      }
    }
  }

  if(fc == 0) printf("Stable\n");
  else printf("Not stable\n");

  for(i = 0 ; i < n ; i++){
    printf("%c %d\n", A[i].string, A[i].num);
  }
  return 0;
}

int Partition(struct Shuto *A, int p, int r){
  int i, j;
  struct Shuto t, x;
  x = A[r];
  i = p - 1;
  for(j = p ; j < r ; j++){
    if(A[j].num <= x.num){
      i++;
      t = A[i];
      A[i] = A[j];
      A[j] = t;
    }
  }
  t = A[i+1];
  A[i + 1] = A[r];
  A[r] = t;
  return i+1;
}

void QuickSort(struct Shuto *A, int p, int r){
  int q;
  if(p < r){
    q=Partition(A, p, r);
    QuickSort(A, p, q-1);
    QuickSort(A, q+1, r);
  }
}

int judge(int a, int b){
  if(a < b) return 1;
   else return 0;
}



Measured memory_bytes: 2868
#include <string>
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main()
{

  string S;
  cin >> S;

  int r = 0;
  for (int i = 0; i < 4; ++i) {
    if (S.at(i) == '+') {
      r++;
    }
    else if (S.at(i) == '-') {
      r--;
    }
  }

  cout << r << '\n';
  return 0;

}


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

#define ll int64_t
#define Rep(i, n) for (ll i = 0; i < n; i++)

using namespace std;

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

    cout << fixed << setprecision(20);

    long double pi = acos(-1);
    long double a, b, x;
    cin >> a >> b >> x;
    long double ans;
    if (a*a*b <= 2*x) {
        ans = atan(2*b/a-2*x/a/a/a);
    } else {
        ans = atan(a*b*b/2/x);
    }

    cout << ans / 2 / pi * 360 << endl;
}

Measured memory_bytes: 256
/*
    @uthor: Amit Kumar
    user -->GitHub: drviruses ; CodeChef: dr_virus_ ; Codeforces,AtCoder,Hackerearth,Hakerrank: dr_virus;
*/
#include <bits/stdc++.h>
#include <chrono>
using namespace std;
using namespace std::chrono;
//#include <boost/multiprecision/cpp_int.hpp>
//namespace mp = boost::multiprecision;
//#define ln mp::cpp_int;
#define ll    long long
#define ld    long double
#define ull   unsigned long long
#define all(vec) vec.begin(),vec.end()
#define endl "\n"
ll google_itr = 1;
#define google(x) cout<<"Case #"<<x<<":"
#define pi 3.14159265358979323846264338327950L

const ll mod = 1e9+7;
const ll inf = 1e18;


void virus(){
          ll len;
          cin>>len;
          vector<ld> arr(len);
          map<pair<ll,ll>,ll> cnt;
          for(auto &i:arr){
              cin>>i;
              ll num = llround((i*1e9));
              ll two = 0, five = 0;
              while(num%2 == 0){
                  two += 1; num /= 2;
              }
              while(num%5 == 0){
                  five += 1; num /= 5;
              }
              cnt[{two,five}]++;
          }
          ll ans = 0;
          for(auto i:cnt){
              for(auto j:cnt){
                  if((i.first.first + j.first.first >= 18) and (i.first.second + j.first.second >= 18)){
                      if(i < j) ans += (i.second * j.second);
                      if(i == j) ans += ((i.second*(i.second-1))>>1);
                  } 
              }
          }
          cout<<ans<<endl;
}


int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    
  /*#ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif*/

    ll t = 1;
    //cin>>t;
    while(t--){
           auto start = high_resolution_clock::now();
           virus();
           auto stop = high_resolution_clock::now();
           auto duration = duration_cast<seconds>(stop - start);
           cerr << "\n Time: "<<duration.count()<<endl;
        //your code goes here
    }
    return 0;
}

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

using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;

#define fi first
#define se second

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

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

int N;
vector <int> Graph[int(1e5+5)];
int Dist[int(1e5+5)];

int Calc_Dist(){
  fill(Dist, Dist + N + 1, -1);
  Dist[1] = 0;
  queue <int> que; que.push(1);
  while (!que.empty()){
    int Q = que.front(); que.pop();
    for (int v:Graph[Q]){
      if (Dist[v] != -1) continue;
      Dist[v] = Dist[Q] + 1;
      que.push(v);
    }
  }
  return 0;
}

bool visited[int(1e5+5)], color[int(1e5+5)];
int Solve(){
  vector <int> route;
  queue <int> que; que.push(N);
  while (!que.empty()){
    int Q = que.front(); que.pop();
    route.push_back(Q);
    for (int v:Graph[Q]){
      if (Dist[v] < Dist[Q]) que.push(v);
    }
  }

  for (int v:route){
    visited[v] = true;
    que.push(v);
    if (Dist[v] <= Dist[N] - Dist[v]) color[v] = true;
    else color[v] = false;
  }

  while (!que.empty()){
    int Q = que.front(); que.pop();
    for (int v:Graph[Q]){
      if (visited[v]) continue;
      que.push(v);
      visited[v] = true;
      color[v] = color[Q];
    }
  }

  return 0;
}


int main(){
  cin >> N;
  for (int i = 0; i < N-1; i++){
    int A, B; cin >> A >> B;
    Graph[A].push_back(B);
    Graph[B].push_back(A);
  }
  Calc_Dist();
  Solve();

  int cnt1 = 0, cnt2 = 0;
  for (int i = 1; i <= N; i++){
    if (color[i]) cnt1++;
    else cnt2++;
  }

  if (cnt1 > cnt2) cout << "Fennec" << endl;
  else cout << "Snuke" << endl;

  return 0;
}


Measured memory_bytes: 10160
#include <iostream>

using namespace std;

int main(){

  int N; cin >> N;
  int p[10];

  for(int i = 0;i < N;i++) cin >> p[i];

  int max = p[0];
  int sum = 0;

  for(int i = 0;i < N;i++){
    sum += p[i];
    if(max < p[i]) max = p[i];
  }

  cout << sum - max / 2 << endl;
  
}


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

int n,A[10010];

bool search(int k){
  A[n]=k;
  int i=0;
  while(A[i]!=k){
    i++;
  }
  return (i!=n?1:0);
}

int main(){
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>A[i];
  }
  int k,ans=0;
  cin>>k;
  for(int i=0;i<k;i++){
    int h;
    cin>>h;
    if(search(h)){
      ans++;
    }
  }
  cout <<ans<<endl;
}


Measured memory_bytes: 3096
import java.util.*;
import static java.lang.Math.*;
import java.math.BigInteger;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		// 入力
		int n = sc.nextInt();
		int k = sc.nextInt();
		
		// 計算
		int result = 0;
		while(n > 0){
		    n /= k;
		    result++;
		}
		
		
		// 出力
		System.out.println(result);
	}
}



Measured memory_bytes: 23764
import java.util.Scanner;
public class Main{
  public static void main(String[] args){
    Scanner scan = new Scanner(System.in);
    int d = scan.nextInt();
    int t = scan.nextInt();
    int s = scan.nextInt();
    if (d <= s * t){
      System.out.println("Yes");
    }else{
      System.out.println("No");
    }
  }
}

Measured memory_bytes: 35620