akhauriyash/Code-Regression huggingface dataset:
package main

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

var (
	N      int
	answer = 1234567890123456
)

func readVariables() {
	N = nextInt()
}

func main() {
	readVariables()
	for i := 0; i < N; i++ {
		s := nextInt() + nextInt()
		answer = MinInt(s, answer)
	}
	fmt.Println(answer)
}

/* Template */

var scanner *bufio.Scanner

func init() {
	Max := 1001001
	scanner = bufio.NewScanner(os.Stdin)
	scanner.Buffer(make([]byte, 0, Max), Max)
	scanner.Split(bufio.ScanWords)
}

//nextInt converts next token from stdin and returns integer value.
//nextInt panics when conversion into an integer fails.
func nextInt() int {
	if !scanner.Scan() {
		panic("No more token.")
	}
	num, err := strconv.Atoi(scanner.Text())
	if err != nil {
		panic("nextInt(): cannot convert to int: " + scanner.Text())
	}
	return num
}

func nextStr() string {
	if !scanner.Scan() {
		panic("No more token.")
	}
	return scanner.Text()
}

// MinInt returns minimum argument
func MinInt(x, y int) int {
	if x < y {
		return x
	} else {
		return y
	}
}

//MaxInt returns maximum argument
func MaxInt(x, y int) int {
	if x < y {
		return y
	} else {
		return x
	}
}

//AbsInt returns |x| for x
func AbsInt(x int) int {
	if x < 0 {
		return -x
	}
	return x
}

//ModPow calculates integer power with modulo operation
//if modulo <= 1, it powers w/o module operation
//if base < 0, return value might be negative too.
func ModPow(base, exponent, modulo int) (result int) {
	result = 1
	for exponent > 0 {
		if exponent%2 == 1 {
			result *= base
			if modulo > 1 {
				result %= modulo
			}
		}
		base *= base
		if modulo > 1 {
			base %= modulo
		}
		exponent /= 2
	}
	return
}

//Gcd
func Gcd(vals ...int) (result int) {
	if len(vals) == 0 {
		return
	}
	result = vals[0]
	for i := 1; i < len(vals); i++ {
		result = gcd(result, vals[i])
	}
	return
}

func gcd(x, y int) int {
	x, y = AbsInt(x), AbsInt(y)
	for y > 0 {
		x, y = y, x%y
	}
	return x
}

//Lcm
func Lcm(vals ...int) (result int) {
	if len(vals) == 0 {
		return
	}
	result = vals[0]
	for i := 1; i < len(vals); i++ {
		result = lcm(result, vals[i])
	}
	return
}

func lcm(x, y int) int {
	return x * y / gcd(x, y)
}


Measured memory_bytes: 4992
#include <bits/stdc++.h>
using namespace std;
#define maxn 100010
int q[maxn],top=0;
int Max=0,cnt=0;
int n,a[maxn];
int main()
{
    int t,T;
    t=1;
    while (t--)
    {
        scanf("%d %d",&n,&T);
        for (int i=0;i<n;i++) scanf("%d",&a[i]);
        q[0]=a[0],top=0;
        Max=-1;
        for (int i=1;i<n;i++)
        {
            if (a[i]>q[top]) q[++top]=a[i];
            else if (a[i]<q[top])
            {
                if (q[top]-q[0]>Max) Max=q[top]-q[0],cnt=1;
                else if (q[top]-q[0]==Max) cnt++;
                while (top>=0&&a[i]<q[top]) top--;
                q[++top]=a[i];
            }
        }
        if (q[top]-q[0]>Max) Max=q[top]-q[0],cnt=1;
        else if (q[top]-q[0]==Max) cnt++;
        printf("%d\n",cnt);
    }
    return 0;
}


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

#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef complex<double> point;
#define xx real()
#define yy imag()

#define REP(i, a, b) for(int i = (a); i < (int)(b); i++)
#define REPN(i, a, b) for(int i = (a); i <= (int)(b); i++)
#define FA(it, x) for(__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++)
#define SZ(x) (int)(x).size()
#define BE(x) (x).begin(), (x).end()
#define SORT(x) sort(BE(x))
#define _1 first
#define _2 second

#define x1 gray_cat_x1
#define y1 gray_cat_y1

template<class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }

#define file "I1"

const double EPS = 1e-9;
const double PI = acos(-1.);
const int INF = 1e9;
const ll MOD = 1e9 + 7;

const int MAXN = 1e5 + 5;

int cnt[2];

void solve(){
	ll ans = 1ll;
	int n, p;
	cin >> n >> p;
	REP(i, 0, n){
		int a;
		cin >> a;
		cnt[a % 2]++;
	}
	if (cnt[1] == 0 && p == 1){
		printf("0\n");
		return;
	}
	REP(i, 0, n){
		ans *= 2ll;
	}
	if (cnt[1] != 0){
		ans /= 2ll;
	}
	
	/*REP(i, 0, cnt[0]){
		ans *= 2ll;
	}
	REP(i, 0, cnt[1] / 2){
		ans *= 2ll;
	}*/
	cout << ans << endl;
}   

int main(){

    //freopen(file".in", "r", stdin); freopen(file".out", "w", stdout);
    int t = 1;
    //cin >> t;
    while(t--){
        solve();    
    }
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#define MAXBUF 21

int main( void ) {
	char format[ MAXBUF ], str[ MAXBUF ];
	int i, len;

	sprintf( format, "%%%ds", MAXBUF );
	scanf( format, str );
	
	len = (int)strlen( str );

	for ( i = len - 1; i >= 0; i-- )
		printf( "%c", (int)str[ i ] );
	putchar( '\n' );

	return 0;
}

Measured memory_bytes: 544
/*
 * FileName:     bit_operation_2
 * CreatedDate:  2020-07-25 14:03:58 +0900
 * LastModified: 2020-07-25 14:27:56 +0900
 */

#include <stdio.h>

void flag_operation(long long int x, int order){
    for(int i=31;i>=0;i--){
        if(1&x>>i){
            if(order == 0){
                printf("1");
            }
            else if(order == 1){
                printf("0");
            }
        }
        else{
            if(order == 0){
                printf("0");
            }
            else if(order == 1){
                printf("1");
            }
        }
    }
}

void flag_transform(long long int x, int order){
    if(order==0){
        x = x<<1;
    }
    else if(order==1){
        x = x>>1;
    }
    for(int i=31; i>=0; i--){
        if(1&x>>i){
            printf("1");
        }
        else{
            printf("0");
        }
    }
}

int main(void){
    long long int x;scanf("%lld", &x);
    flag_operation(x, 0);
    printf("\n");
    flag_operation(x, 1);
    printf("\n");
    flag_transform(x, 0);
    printf("\n");
    flag_transform(x, 1);
    printf("\n");
    return 0;
}



Measured memory_bytes: 2120
#include <stdio.h>
void swap(int *a,int *b){
	int tmp;
	tmp=*a;*a=*b;*b=tmp;
	return;
}

int main(){
	int w,n,a,b,num[31],i;
	for(i=0;i<31;i++) num[i]= i;
	scanf("%d",&w);
	scanf("%d",&n);
	while(n--){
		scanf("%d,%d",&a,&b);
		swap(&num[a],&num[b]);
	}
	for(i=1;i<w+1;i++) printf("%d\n",num[i]);
	return 0;
}

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

#define ff first
#define ss second
#define PI acos(-1)
#define pb push_back
#define int long long
#define ld long double
#define sp fixed<<setprecision
#define bp __builtin_popcountll
#define all(x) x.begin(),x.end()
#define pii pair<long long,long long>
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

const int M = (1e9)+7;
const int N = 1e6+5;

signed main()
{
    FAST
    int tc=1;
    //cin>>tc;
    for(int ti=1;ti<=tc;ti++)
    {
        int n;
        cin>>n;
        int a[n],ans=0;
        for(int i=0;i<n;i++)cin>>a[i];
        for(int i=0;i<n;i++)for(int j=i+1;j<n;j++)for(int k=j+1;k<n;k++)
        {
            vector<int> v = {a[i],a[j],a[k]};
            sort(all(v));
            ans += (v[0]+v[1] > v[2] && v[0]!=v[1] && v[1]!=v[2]);
        }
        cout<<ans<<endl;
    }
    return 0;
}


Measured memory_bytes: 3660
#include <bits/stdc++.h>
#define ll long long
using namespace std;
ifstream f ("test.in"); ofstream g ("test.out");
ll n,m,dp[1005][1005];
ll mod=(1e9)+7;
bool v[1005][1005];
int main()
{   ios_base::sync_with_stdio(0);
    cin.tie(0);
    cin>>n>>m;
    for(int i=1;i<=n;i++)
    {   for(int j=1;j<=m;j++)
        {   char  x;
            cin>>x;
            v[i][j]=(x!='.');
        }
    }
    for(int i=0;i<=n;i++)
    {   if(v[i][1]) break;
        dp[i][1]=1;
    }
    for(int i=0;i<=m;i++)
    {   if(v[1][i]) break;
        dp[1][i]=1;
    }
    for(int i=2;i<=n;i++)
        for(int j=2;j<=m;j++)
            if(v[i][j]) dp[i][j]=0;
            else dp[i][j]=(dp[i-1][j]%mod+dp[i][j-1]%mod)%mod;
    cout<<dp[n][m];
    return 0;
}


Measured memory_bytes: 9088
from sys import stdin
import numpy as np
# import math
# import random
# import fractions
# import sys
# sys.setrecursionlimit(100000)
# N = int(stdin.readline().rstrip().split()[0])
# A = [int(x) for x in stdin.readline().rstrip().split()]
# N, X = [int(x) for x in stdin.readline().rstrip().split()]
# S = stdin.readline().rstrip().split()[0]
A, B = [int(x) for x in stdin.readline().rstrip().split()]

if A>12:
  print(B)
elif A>5:
  print(int(B/2))
else:
  print(0)

Measured memory_bytes: 22036
#include<iostream>
using namespace std;
typedef long long ll;

int main() {
    int N, P, A;
    ll ans = 1;
    cin >> N >> P;
    for (int i = 0; i < N; i++) {
        cin >> A;
        if (A % 2 != 0) {
            for (int i = 0; i < N - 1; i++) ans *= 2;
            cout << ans << endl;
            return 0;
        }
    }
    if (P == 0) {
        for (int i = 0; i < N; i++) ans *= 2;
    }
    else {
        ans = 0;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <stdlib.h>
#include <cmath>
#include <algorithm>
#include <numeric>

using namespace std;

int main()
{
  int N;
  int K;
  vector<uint64_t> H;

  cin >> N >> K;

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

  if (N <= K) {
    cout << 0;
    return 0;
  }

  sort(H.begin(), H.end(), greater<uint64_t>());

  cout << accumulate(H.begin() + K, H.end(), (uint64_t)0);

  return 0;
}


Measured memory_bytes: 1792
#include <stdio.h>

int digitsum(int n)
{
	int res = 0;
	while (n >= 1){
		res += n % 10;
		n /= 10;
	}
	return res;
}

int main(void)
{
	int n, a, b;
	scanf("%d%d%d", &n, &a, &b);
	int i, tmp, total=0;
	for (i = 1; i <= n; i++){
		tmp = digitsum(i);
		if (tmp >= a&&tmp <= b) total += i;
	}
	printf("%d\n", total);
	return 0;
}

Measured memory_bytes: 128
object Main {
  val mod: Int = 1e9.toInt + 7
  def pow(a: Int, b: Int): Int = {
    var bit = 1
    var pow = a.toLong
    var ans = 1L
    while (bit <= b) {
      if ((b & bit) != 0) ans = ans * pow % mod
      pow = pow * pow % mod
      bit *= 2
    }
    ans.toInt
  }
  def inv(a: Int): Int = pow(a, mod - 2)

  def main(args: Array[String]): Unit = {
    val n = io.Source.stdin.bufferedReader().readLine().toInt
    val fact = Range(1, n).iterator.scanLeft(1)((x, y) => (x.toLong * y % mod).toInt).toArray
    val ifact = fact.map(inv)
    val f = Range(0, n).iterator.map { k =>
      if (2 * k - n < 0) 0
      else (fact(k-1).toLong * fact(k) % mod * ifact(2*k - n) % mod).toInt
    }.toArray
    val answer = Range(1, n).iterator
      .map(i => (f(i) - f(i - 1) + mod).toLong * i % mod)
      .reduce((x, y) => (x + y) % mod)
    println(answer)
  }
}


Measured memory_bytes: 109480
using System;
using System.Linq;
using System.Collections.Generic;
class Hello
{
    static public IEnumerable<bool> Check(int[] t)
    {
        for (int i = 0; i < t.Length; i++)
        {
            if (t[i] == (i + 1))
            {
                yield return true;
            }
            else
            {
                yield return false;
            }
        }
    }

    public static void Main()
    {
        var n = int.Parse(Console.ReadLine());
        var p = Console.ReadLine().Split().Select(int.Parse).ToArray();

        int counter = 0;
        var checkedP = Check(p).ToArray();
        for (int i = 0; i < n; i++)
        {
            if (!checkedP[i]) continue;
            var bs = new List<bool> { checkedP[i] };
            int j = i + 1;
            if (j < n)
            {
                bs.Add(checkedP[j]);
            }
            if (bs.Any(e => e))
            {
                counter++;
            }
            i++;
        }
        Console.WriteLine(counter);
    }

}

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

public class AtCoderA
{
    static void Main()
    {
        var sc = new Scanner();

        string s = sc.Next();

        int answer = 0;
        for (int i = 0; i < 3; i++)
        {
            if (s[i].ToString() == "o")
            {
                answer++;
            }
        }

        Console.WriteLine(answer * 100 + 700);
    }

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            while (_index >= _line.Length)
            {
                _line = Console.ReadLine().Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            _line = Console.ReadLine().Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}

Measured memory_bytes: 11092
#include <bits/stdc++.h>
#define rep3(i, s, n, a) for (int i = (s); i < (int)(n); i += a)
#define rep2(i, s, n) rep3(i, s, n, 1)
#define rep(i, n) rep2(i, 0, n)

using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<int, int>;

int main(){
    int n;
    cin >> n;
    vector<P> ab(n);
    rep(i, n){
        int a, b;
        cin >> a >> b;
        ab[i] = make_pair(b, a);
    }
    sort(ab.begin(), ab.end());
    ll time=0;
    string ans="Yes";
    rep(i, n){
        time += ab[i].second;
        if(time>ab[i].first){
            ans = "No";
            break;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4816
#include <bits/stdc++.h>
using namespace std;
int n;
long double dp[3009][3009],pos[3009];
long double bt(int h,int id)
{
    if(dp[id][h]!=-1)return dp[id][h];
    if(id==n)
    {
        if(h>(n-h))return 1.0;
        else return 0.0;
    }
    dp[id][h]=bt(h+1,id+1)*pos[id]+bt(h,id+1)*(1.0-pos[id]);
    return dp[id][h];
}
int main()
{
    //memset(dp,-1,sizeof(dp));
    cin>>n;
    for(int i=0;i<3009;i++)
    {
        for(int j=0;j<3009;j++)dp[i][j]=-1.0;
    }
    for(int i=0;i<n;i++)cin>>pos[i];
    cout<<setprecision(10)<<fixed<<bt(0,0);
}


Measured memory_bytes: 141952
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <map>
#include <queue>
#include <deque>
#include <string>
#include <stack>
#include <vector>
#include <set>
#include <tuple>
#include <utility>
#include <functional>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
const int INF = 1000000000;
const int MOD = 1000000007;
int main(){
	string s,t;
	cin >> s >> t;

	int ans = 2000;
	for(int i = 0;i < s.size();i++){
		if(i + t.size() - 1 < s.size()){
			int cnt = 0;
			for(int j = i;j < i + t.size();j++){
				if(t[j - i] != s[j]){
					cnt++;
				}
			}
			ans = min(ans,cnt);
		}
	}

	cout << ans << endl;
}


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

public class Main {
  private static String solve(String s) {
    int n1 = Integer.parseInt(s.substring(0, 2));
    int n2 = Integer.parseInt(s.substring(2));
    boolean withIn1 = 0 < n1 && n1 <= 12;
    boolean withIn2 = 0 < n2 && n2 <= 12;
    if (withIn1 && withIn2) {
      return "AMBIGUOUS";
    } else if (withIn1) {
      return "MMYY";
    } else if (withIn2) {
      return "YYMM";
    } else {
      return "NA";
    }
  }
  
  private static void execute(ContestReader reader, PrintWriter out) {
    String s = reader.next();
    out.println(solve(s));
  }
  
  public static void main(String[] args) {
    ContestReader reader = new ContestReader(System.in);
    PrintWriter out = new PrintWriter(System.out);
    execute(reader, out);
    out.flush();
  }
}

class ContestReader {
  private BufferedReader reader;
  private StringTokenizer tokenizer;
  
  ContestReader(InputStream in) {
    reader = new BufferedReader(new InputStreamReader(in));
  }
  
  public String next() {
    while (tokenizer == null || !tokenizer.hasMoreTokens()) {
      try {
        tokenizer = new java.util.StringTokenizer(reader.readLine());
      } catch (Exception e) {
        throw new RuntimeException(e);
      }
    }
    return tokenizer.nextToken();
  }
  
  public int nextInt() {
    return Integer.parseInt(next());
  }
  
  public long nextLong() {
    return Long.parseLong(next());
  }
  
  public double nextDouble() {
    return Double.parseDouble(next());
  }
  
  public int[] nextIntArray(int n) {
    int[] array = new int[n];
    for (int i = 0; i < n; i++) {
      array[i] = nextInt();
    }
    return array;
  }
  
  public long[] nextLongArray(int n) {
    long[] array = new long[n];
    for (int i = 0; i < n; i++) {
      array[i] = nextLong();
    }
    return array;
  }
}

class Algorithm {
  private static void swap(Object[] list, int a, int b) {
    Object tmp = list[a];
    list[a] = list[b];
    list[b] = tmp;
  }
  
  public static <T extends Comparable<? super T>> boolean nextPermutation(T[] ts) {
    int rightMostAscendingOrderIndex = ts.length - 2;
    while (rightMostAscendingOrderIndex >= 0 &&
        ts[rightMostAscendingOrderIndex].compareTo(ts[rightMostAscendingOrderIndex + 1]) >= 0) {
      rightMostAscendingOrderIndex--;
    }
    if (rightMostAscendingOrderIndex < 0) {
      return false;
    }
    
    int rightMostGreatorIndex = ts.length - 1;
    while (ts[rightMostAscendingOrderIndex].compareTo(ts[rightMostGreatorIndex]) >= 0) {
      rightMostGreatorIndex--;
    }
    
    swap(ts, rightMostAscendingOrderIndex, rightMostGreatorIndex);
    for (int i = 0; i < (ts.length - rightMostAscendingOrderIndex - 1) / 2; i++) {
      swap(ts, rightMostAscendingOrderIndex + 1 + i, ts.length - 1 - i);
    }
    return true;
  }
}



Measured memory_bytes: 21204
import java.util.Scanner

object Main {
  def isPrime(p: Int) = if (p == 1) {
    false
  } else {
    (2 to math.sqrt(p).toInt).forall(p % _ != 0)
  }

  def main(args: Array[String]): Unit = {
    val sc: Scanner = new Scanner(System.in)
    while (sc.hasNext()) {
      val n: Int = sc.nextInt
      var ans = 0
      for (i <- 1 to n) {
        if (isPrime(i) && isPrime(n - i + 1)) {
          ans += 1
        }
      }
      println(ans)
    }
  }
}

Measured memory_bytes: 183216
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using static MyIO;


public class C
{
	public static void Main()	
	{
		int n = GetInt();
		long[] a = new long[n];
		for(int i = 0; i < n; i++)
			a[i] = GetLong();

		long ans = long.MaxValue;
		for(int j = 0; j <= 1; j++)
		{
			long tmp = 0;
			long sum = 0;
			for(int i = 0; i < n; i++)
			{
				sum += a[i];
				if(i % 2 == j)
				{
					if(sum < 1)
					{
						tmp += 1 - sum;
						sum = 1; 
					}
				}
				else
				{
					if(sum > -1)
					{
						tmp += sum + 1;
						sum = -1;
					}
				}
			}
			ans = Math.Min(ans, tmp);
		}

		Console.WriteLine(ans);
	}
}


public static class MyIO
{
	private static string[] args = null;
	private static int num = -1;
	private static int used = -1;

	private static string getArg()
	{
		if(used == num)
		{
			args = Console.ReadLine().Split(' ');
			num = args.Length;
			used = 0;
		}
		return args[used++];
	}

	public static int GetInt(){ return int.Parse(getArg()); }
	public static long GetLong(){ return long.Parse(getArg()); }
	public static double GetDouble(){ return double.Parse(getArg()); }
	public static string GetString(){ return getArg(); }
}


Measured memory_bytes: 27356
#include<stdio.h>
int main()
{
  int i,n,flag=1,count=0;
  scanf("%d",&n);
  int a[n];
  for(i=0; i<n; i++)
    scanf("%d",&a[i]);
  while(1){
    for(i=0; i<n; i++)
      if(a[i]%2!=0)
        flag=0;
    if(flag==0)
      break;
    else{
      for(i=0; i<n; i++)
        a[i]=a[i]/2;
    }
    count++;
  }
  printf("%d\n",count);
  return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <cctype>
#include <cmath>
#include <map>
#include <set>
#define rep(i, m, n) for (int i = m; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define srep(i) for (int i = 0; i < s.size(); i++)
#define ll long long
#define ull unsigned long long
#define push(a) push_back(a)
#define pop(a) pop_back(a)
#define debug(x) cout << #x << ": " << x << endl
#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define INF 999999999
#define PI 3.14159265358979
    using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

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

int n, w;
int weight[105] = {}, value[105] = {};

int dp[105][10005] = {};

int main()
{
    int n,x,m[105]={};
    ll sum=0,ans=0;
    cin>>n>>x;
    rep(i,0,n){
        cin>>m[i];
        sum+=m[i];
    }
    sort(m,m+n);
    ans = (x-sum)/m[0] + n;
    cout<<ans<<endl;
}

Measured memory_bytes: 256
function Main(input) {
var list = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51];
  input = parseInt(input);
  if(1 <= input && input <= 32)
  {
      console.log(list[input - 1]);
  } else {
  console.log(0);
  }
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

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

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

void shellSort(int *a, int n)
{
  int cnt = 0;
  vector<int> g = {1};
  const int maxg = n;
  while (true)
  {
    int next = 3 * g.back() + 1;
    if (next > maxg)
      break;
    g.push_back(next);
  }
  cout << g.size() << "\n";

  for (int i = g.size() - 1; i >= 0; i--)
  {
    cout << g[i] << " ";
    cnt += insertionSort(a, n, g[i]);
  }
  cout << "\n";
  cout << cnt << "\n";
}

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

  shellSort(a, n);

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


Measured memory_bytes: 7044
#include<iostream>//树状数组
#include<iomanip> 
#include<map>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
using namespace std;
#define debug(x) cerr<<#x<<"="<<x<<endl;
#define m(a,b) memset(a,b,sizeof(a))
typedef long long ll;
const int maxn=1e5+100;

int n,m;
string s1[105],s2[105];
map<string,int> mp;

int main(){
	cin>>n;
	int ans=0;
	for(int i=1;i<=n;i++){
		cin>>s1[i];
		mp[s1[i]]++;
	}
	cin>>m;
	for(int i=1;i<=m;i++){
		cin>>s2[i];
		mp[s2[i]]--;
	}
	for(int i=1;i<=n;i++){
		if (ans<mp[s1[i]])
			ans=mp[s1[i]];
	}
	if (ans<0) ans=0;
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 3000;
int n, mod;
int a[N], res[N];
ll qp(ll a, ll b) {
    ll ans = 1;
    while(b) {
        if(b & 1) ans = ans * a % mod;
        a = a * a % mod;
        b >>= 1;
    }
    return ans;
}
int inv[N], inv2[N];
int dp[N][N];
int add(int x, int y) {
    x += y;
    if(x >= mod) x -= mod;
    return x;
}
int sub(int x, int y) {
    x -= y;
    if(x < 0) x += mod;
    return x;
}
int mul(ll x, ll y) {
    x = x * y % mod;
    if(x < 0) x += mod;
    return x;
}
void pre() {
    for(int i = 1; i <= n; i++) inv[i] = qp(i, mod - 2);
    for(int i = 1; i <= n; i++) inv2[i] = qp(mod - i, mod - 2);
    dp[0][1] = 1;
    for(int i = 1; i < n; i++) {
        for(int j = 0; j <= i + 1; j++) {
            dp[i][j] = mul(dp[i - 1][j], mod - i);
            if(j) dp[i][j] = add(dp[i][j], dp[i - 1][j - 1]);
//            cout << i << ' ' << j << ' ' << dp[i][j] << '\n';
        }
    }
}
int main() {
    ios::sync_with_stdio(false); cin.tie(0);
    cin >> n; mod = n;
    for(int i = 0; i < n; i++) cin >> a[i];
    pre();
    for(int i = 0; i < n; i++) if(a[i]) {
        int ans = 1;
        for(int j = 0; j < n; j++) {
            if(i > j) ans = mul(ans, inv[i - j]);
            if(i < j) ans = mul(ans, inv2[j - i]);
        }
        int tmp = 0;
        if(i == 0) tmp = dp[n - 1][1];
        res[0] = add(res[0], mul(ans, tmp));
        for(int j = 1; j < n; j++) {
            tmp = mul(sub(dp[n - 1][j], tmp), inv2[i]);
            if(i == 0) tmp = dp[n - 1][j + 1];
            res[j] = add(res[j], mul(ans, tmp));
        }
    }
    for(int i = 0; i < n; i++) cout << res[i] << " \n"[i == n - 1];
    return 0;
}


Measured memory_bytes: 34304
/* ****revpro**** */
// #pragma GCC target ("avx2")
// #pragma GCC optimization ("O3")
// #pragma GCC optimization ("unroll-loops")
#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define endl     '\n'
#define pii         pair<ll,ll>
#define vi          vector<ll>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll)x.size()
#define hell        1000000007
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define repr(i,a,b) for(ll i=b-1;i>=a;i--)    
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define present(c,x) ((c).find(x) != (c).end())
#define cpresent(c,x) (find(all(c),x) != (c).end())
#define mii      map<ll,ll>
using namespace std;

#define TIME        cerr << "\nTime elapsed: " << setprecision(5) <<1000.0 * clock() / CLOCKS_PER_SEC << "ms\n";
#define FAST ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define N  100005
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;  
#define ordered_set tree<double, null_type,less<double>, rb_tree_tag,tree_order_statistics_node_update> 
const int LOG_A=60;
ll base[LOG_A],sz;
bool checkXor(ll mask) {
  for (ll i = 0; i < LOG_A; i++) {
    if ((mask & (1ll) << i) == 0) continue;
 
    if (!base[i]) return false;
 
    mask ^= base[i];
  }
 
  return true;
}

void insertVector(ll mask) {
  for (ll i = 0; i < LOG_A; i++) {
    if ((mask & ((1ll) << i)) == 0) continue;
 
    if (!base[i]) {
      base[i] = mask;
      sz++;
 
      return;
    }
 
    mask ^= base[i];
  }
}
void solve()
{
  sz=0;
  rep(i,0,2) rep(j,0,LOG_A)base[j]=0;
  ll n;
  cin>>n;
  ll a[n];
  string s;
  rep(i,0,n) cin>>a[i];
  cin>>s;
  if(s[n-1]=='1') {
    cout<<1<<endl;
    return ;
  }
  repr(i,0,n){
    if(s[i]=='0')
    {
      insertVector(a[i]);
    }
    else{
      vi v;
      rep(j,0,LOG_A)
      {
        if(base[j]&&checkXor(base[j]^a[i]))
          v.pb(base[j]);
      }
      sz=0;
      rep(j,0,LOG_A) base[j]=0;
      for(auto j:v) insertVector(j);
      if(sz==0){
        cout<<1<<endl;
        return;
      }
    }
  }
  if(sz) cout<<0<<endl;
  else cout<<1<<endl;
}
signed main()
{
  
    /***********************************/
    unsigned seed = std::chrono::system_clock::now().time_since_epoch().count();
    mt19937_64 generator (seed);
    /***********************************/
 
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ll TESTS=1;
 cin>>TESTS;
  while(TESTS--)
  {
    solve();
    
  }
  TIME
  return 0;
}

Measured memory_bytes: 3780
#include <bits/stdc++.h>
#define rep(i,n) for(int i=(0);i<(n);i++)

using namespace std;

typedef long long ll;

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 (a>b) { a=b; return 1; } return 0; }

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

	int m = 26;
	int d;
	cin >> d;

	vector<ll> c(m);
	rep(i, m) cin >> c[i];

	vector<vector<ll>> s(d, vector<ll>(m));
	rep(i, d) rep(j, m) cin >> s[i][j];

	vector<ll> pen(m, 0);
	rep(i, d){
		rep(j, m) pen[j] += c[j];

		ll mx = 0;
		ll ar = -1;
		rep(j, m) {
			if(mx < s[i][j] + pen[j]){
				chmax(mx, s[i][j] + pen[j]);
				ar = j;
			}
		}

		cout << ar + 1 << endl;
		pen[ar] = 0;
	}
}


Measured memory_bytes: 3732
n=int(input())
a=list(map(int,input().split()))
sum1=0
mini=a[0]
for i in range(len(a)-1):
    s=a[i+1]
    if mini<s:
        mini=s
        continue
    elif mini>=s:
        sum1+=abs(mini-s)

print(sum1)

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

using namespace std;

void solve()
{
  int n;
  cin >> n;
  int f = 0;
  while (n)
  {
    if (n % 10 == 7)
    {
      cout << "Yes\n";
      return;
    }
    n = n / 10;
  }
  cout << "No\n";
}

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


Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
#define  ll long long int
#define mx 100005
ll a[mx],b[mx],c[mx];
ll dp[mx][4];
int main()
{
    ll n,k;
    cin>>n;

    for(int i=1;i<=n;i++){
        cin>>a[i]>>b[i]>>c[i];
    }
    dp[1][1]=a[1];dp[1][2]=b[1];dp[1][3]=c[1];
    for(int i=2;i<=n;i++){
        dp[i][1]=max(dp[i-1][2],dp[i-1][3])+a[i];
        dp[i][2]=max(dp[i-1][1],dp[i-1][3])+b[i];
        dp[i][3]=max(dp[i-1][2],dp[i-1][1])+c[i];
    }
    cout<<max({dp[n][1],dp[n][2],dp[n][3]})<<endl;
}


Measured memory_bytes: 9040
def main():
    N = int(input())
    A = list(map(int, input().split()))
    A.sort(reverse=True)
    if N % 2 == 0:
        ans = A[0] + 2*sum(A[1:N // 2])
    else:
        ans = A[0] + 2*sum(A[1:N // 2]) + A[N // 2]
    print(ans)
    return


if __name__ == "__main__":
    main()


Measured memory_bytes: 105184
#include <iostream>
 
using namespace std;
 
int main(){
    int A;
    //高橋くんの年齢
    int B;
    //観覧車の料金
    cin >> A >> B;
    if (A >= 13){
        cout << B << endl;
        //年齢が13歳以上の場合の結果を出力する処理
    } else if (A >= 6 && A <= 12){
        cout << B / 2 << endl;
        //年齢が6歳以上かつ12歳以下の場合の結果を出力する処理 
    } else if (0 <= 5){
        cout << 0 << endl;
        //年齢が5歳以下の場合の結果を出力する処理
    }
}

Measured memory_bytes: 256
nt = list(map(int, input().split()))
n = nt[0]
t = nt[1]
min_cost = 2000
for i in range(n):
    ct = list(map(int, input().split()))
    c = ct[0]
    t_i = ct[1]
    if t_i <= t and c < min_cost:
        min_cost = c
if min_cost == 2000:
    print("TLE")
else:
    print(min_cost)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
const long long LINF = 1e18;
#define dump(x)  cout << 'x' << ' = ' << (x) << ` `;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOREACH(x,a) for(auto& (x) : (a) )
typedef long long ll;
using namespace std;
typedef pair<ll, ll> P;

template<typename T>
void print(const vector<T> &x) {
    int n = x.size();
    rep(i,n) {
        cout << x[i];
        if (i!=n-1) cout<<" ";
        else cout << endl;
    }
}

template<typename T>
void print(const vector<vector<T>> &x) {
    int n = x.size();
    rep(i,n) {
        rep(j,x[i].size()) {
            cout << x[i][j] << " ";
        }
        cout << endl;
    }
}

template<typename T>
void print(const vector<T> &x, int n) {
    rep(i,n) {
        cout << x[i];
        if (i!=n-1) cout<<" ";
        else cout << endl;
    }
}

template<typename T>
void print(const vector<vector<T>> &x, int n, int m) {
    rep(i,n) {
        rep(j,m) {
            cout << x[i][j] << " ";
        }
        cout << endl;
    }
}

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

void input_init() {
    cin.tie(0); ios::sync_with_stdio(false);
}


template<typename T>
T gcd(T a, T b) {
    if (a % b == 0) return b;
    return gcd(b, a%b);
}

template<typename U>
U gcd_multi(vector<U> A) {
    int n = A.size();
    if (n == 1) return A[0];
    U G = gcd(A[0], A[1]);
    if (n == 2) return G;
    for (int i = 2; i < n; ++i) G = gcd(G, A[i]);
    return G;
}

int main(int argc, char const *argv[]) {
    int n; cin>>n;
    vector<ll> a(n);
    rep(i,n) cin>>a[i];

    cout << gcd_multi(a) << '\n';

    return 0;
}

Measured memory_bytes: 4864
#include<iostream>
#include<cmath>
using namespace std;
int main(){
  int n,m,out,man;
  cin >> n >> m;
  int a[n],b[n],c[m],d[m];
  for (int i=0;i<n;i++){
    cin >> a[i] >> b[i];
  }
  for (int i=0;i<m;i++){
    cin >> c[i] >> d[i];
  }
  for (int i=0;i<n;i++){
    man = abs(a[i]-c[0])+abs(b[i]-d[0]);
    out = 1;
    for (int l=0;l<m;l++){
      if(abs(a[i]-c[l])+abs(b[i]-d[l]) < man){
        man = abs(a[i]-c[l])+abs(b[i]-d[l]);
        out = l+1;
      }
    }
    cout << out << endl;
  }
}


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

int main()
{
	int n, m;
	cin >> n >> m;
	for(int a = n / 2, b = a + 1, c = 1; c <= m; a--, b++, c++)
	{
		if(n % 2 == 0 && (b - a == n / 2 || b - a == n / 2 + 1))
		{
			b++;
		}
		cout << a << ' ' << b << endl;
	}
	return 0;
}

Measured memory_bytes: 3600
#include <bits/stdc++.h>
using namespace std;
#define ll                      long long
#define pb                      push_back
#define rep(i,a,b,c)            for(ll i=(a);i<=(b);i+=(c))
#define repb(i,a,b,c)           for(ll i=(a);i>=(b);i-=(c))
#define MOD                     1000000007
#define inf                     3e18
#define ld                      long double
#define mp                      make_pair
#define vpll                    vector<pair<ll,ll> >
#define vll                     vector<ll>
#define vld                     vector<ld>
#define vvll                    vector<vector<ll>>
#define vvld                    vector<vector<ld>>
#define pll                     pair<ll,ll>
#define vvpll                   vector<vector<pair<ll,ll>>>
#define pqll                    priority_queue<ll>
#define mll                     map<ll,ll>
#define mlc                     map<ll,char>
#define um                      unordered_map
#define umll                    um<ll,ll>
#define umlc                    um<ll,char>
#define all(x)                  x.begin(),x.end()
#define fi                      first
#define se                      second
#define ln                      cout<<"\n";
#define endl                    "\n"
#define test                    ll T;cin>>T;while(T--)
#define isvowel(a)              (a == 'a' || a == 'e' || a == 'i' || a == 'o' || a == 'u')
#define fastIO                  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define show(w,size)            for(ll i=0;i<size;i++) cout<<w[i]<<" ";
#define prll(a)                 cout<<a<<"\n";
#define mset(dp,no)             memset(dp,no,sizeof(dp))
#define input(a,n)              rep(i,0,n-1,1) cin>>a[i];
#define countbit                __builtin_popcount                                           //Number of setbits in decimal notation
#define lb(v,cur)               lower_bound(all(v),cur)-v.begin()
#define ub(v,cur)               upper_bound(all(v),cur)-v.begin()
#define db(...)                 __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) { cerr << name << " : " << arg1 <<'\n'; }
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
    const char* comma = strchr(names + 1, ',');
    cout.write(names, comma - names) << " : " << arg1 << " | "; __f(comma + 1, args...);
}
long long pows(long long a, long long b) {
  long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}
ll powm(ll x,ll y,ll m=MOD){x=x%m;ll res=1;while(y){if(y&1)res=res*x;res%=m;y=y>>1;x=x*x;x%=m;}return res;}
ll modInverse(ll a, ll m=MOD){if(m == 1)return 0;ll m0=m,y=0,x=1;while(a>1){ll q=a/m,t=m;m=a%m,a=t;t=y;y=x-q*y;x=t;}if(x<0) x+=m0;return x;}
int main()
{
fastIO
ll n,m,i,j;
cin>>n;
ll ar[n];
vvll v(n+1);
for(i=1;i<n;i++)
{
  cin>>ar[i];
  v[ar[i]].pb(i);
}
for(i=1;i<=n;i++)
{
  cout<<v[i].size()<<"\n";
}
}


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

unsigned long long a[100010][790],tt;
int x[100010],y[100010],n,m,T,nw[50010],Ans,nxt[100010];
char ans[100010];
bool bo[100010],bb[4][4];

int main()
{
	scanf("%d%d%d",&n,&m,&T);
	if (T==1)
	{
		tt=(1ull<<63)-1;
		tt=(tt<<1)+1;
		memset(nw,0,sizeof(nw));
		for (int i=1; i<=m; i++)
		{
			scanf("%d%d",&x[i],&y[i]);
			if (!nw[x[i]]) a[i][x[i]>>6]|=(1ull<<(x[i]&63)); else 
			for (int j=0; j<=(n>>6); j++) a[i][j]|=a[nw[x[i]]][j];
			if (!nw[y[i]]) a[i][y[i]>>6]|=(1ull<<(y[i]&63)); else
			for (int j=0; j<=(n>>6); j++) a[i][j]|=a[nw[y[i]]][j];
			nw[x[i]]=nw[y[i]]=i;
		}
		Ans=0;
		for (int i=1; i<=n; i++)
		{
			bool bo=((a[nw[i]][n>>6]>>1)==(1ull<<(n&63))-1);
			if (n>>6) bo&=(a[nw[i]][n>>6]&1);
			for (int j=0; j<(n>>6); j++) bo&=(a[nw[i]][j]==(tt-(j==0)));
			if (bo) {Ans=i; break;}
		}
		if (!Ans) return puts("-1"),0;
		memset(bo,0,sizeof(bo)),bo[Ans]=1;
		for (int i=m; i; i--)
			if (bo[x[i]]) ans[i]='^',bo[y[i]]=1; else ans[i]='v',bo[x[i]]=bo[y[i]];
		for (int i=1; i<=m; i++) putchar(ans[i]);
		return puts(""),0;
	}
	if (n==2) return puts("-1"),0;
	memset(bb,0,sizeof(bb));
	for (int i=1; i<=m; i++) 
	{
		scanf("%d%d",&x[i],&y[i]);
		if (y[i]<=3) bb[x[i]][y[i]]=1;
	}
	for (int p1=1; p1<=3; p1++)
		for (int p2=p1+1; p2<=3; p2++) if (!bb[p1][p2])
		{
			for (int i=1; i<=m; i++)
				if (x[i]==p1||x[i]==p2) putchar('^'); else putchar('v');
			return puts(""),0;
		}
	int la=-1;
	for (int i=m; i; i--)
		if (y[i]<=3) 
		{
			nxt[i]=la;
			if (x[i]==2) la=1; else
			if (y[i]==2) la=3; else la=2;
		}
	memset(bo,0,sizeof(bo));
	bo[la]=bo[1+(la==1)]=1;
	for (int i=1; i<=m; i++)
		if (y[i]<=3)
		{
			if (x[i]==nxt[i]) putchar('^'),bo[x[i]]=1,bo[y[i]]=0; else
			putchar('v'),bo[y[i]]=1,bo[x[i]]=0;
		} else
		if (x[i]<=3) putchar('^'); else putchar('v');
	return 0;
}

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

#define faster      ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pi          acos(-1.0)
#define nl          '\n'

///Library
#define mem(a,b)    memset(a,b,sizeof(a))
#define all(a)      a.begin(),a.end()
#define Sort(x)     sort(x.begin(),x.end())
#define Reverse(x)  reverse(x.begin(),x.end())
#define SortA(ar,s) sort(ar,ar+s)
#define SortD(ar,s) sort(ar,ar+s,greater<int>())
#define gcd(a,b)    __gcd(a,b)
#define lcm(a,b)    (a*(b/gcd(a,b)))
#define sq(x)       (x)*(x)

#define min3(a,b,c)        min(a,min(b,c))
#define min4(a,b,c,d)      min(a,min(b,min(c,d)))
#define max3(a,b,c)        max(a,max(b,c))
#define max4(a,b,c,d)      max(a,max(b,max(c,d)))
#define ABS(x)             ((x)<0?-(x):(x))
#define pb                 push_back
#define mod                1000000007
#define end                printf("\n")
#define yes                printf("YES\n")
#define no                 printf("NO\n")

///data type
typedef long long int ll;
typedef unsigned long long int  llu;

int main()
{
    faster
    string s,a;
    int i,j,ans,mx=0,l,k;
    cin>>s>>a;
    int x=a.size();
    int y=s.size();
    for(i=0; i<y-x+1; i++)
    {
        k=i;
        ans=0;
        for(j=0; j<a.size(); j++)
        {
            if(a[j]==s[k])ans++;
            k++;
        }
        //cout<<ans<<nl;
        mx=max(mx,ans);
    }
    cout<<x-mx<<nl;
    return 0;
}


Measured memory_bytes: 3632
#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
using namespace std;
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void POSS(T condition){ if(condition) cout << "POSSIBLE" << endl; else cout << "IMPOSSIBLE" << endl; }
template<class T> inline void Poss(T condition){ if(condition) cout << "Possible" << endl; else cout << "Impossible" << endl; }
template<class T> inline void First(T condition){ if(condition) cout << "First" << endl; else cout << "Second" << endl; }
int character_count(string text, char character){ int ans = 0; for(int i = 0; i < text.size(); i++){ ans += (text[i] == character); } return ans; }
long power(long base, long exponent, long module){ if(exponent % 2){ return power(base, exponent - 1, module) * base % module; }else if(exponent){ long root_ans = power(base, exponent / 2, module); return root_ans * root_ans % module; }else{ return 1; }}
struct position{ int y, x; }; position move_pattern[4] = {{-1, 0}, {0, 1}, {1, 0}, {0, -1}}; // double euclidean(position first, position second){ return sqrt((second.x - first.x) * (second.x - first.x) + (second.y - first.y) * (second.y - first.y)); }
template<class T, class U> string to_string(pair<T, U> x){ return to_string(x.first) + "," + to_string(x.second); }
template<class itr> void array_output(itr start, itr goal){ string ans; for(auto i = start; i != goal; i++){ ans += to_string(*i) + " "; } ans.pop_back(); cout << ans << endl; }
template<class T> T gcd(T a, T b){ if(a && b){ return gcd(min(a, b), max(a, b) % min(a, b)); }else{ return a; }} template<class T> T lcm(T a, T b){ return a / gcd(a, b) * b; }
#define mod long(1e9 + 7)
#define all(x) (x).begin(), (x).end()
#define bitcount(n) __builtin_popcountl(long(n))
#define coutf cout << fixed << setprecision(10)

int main(){
    double n, m, d;
    cin >> n >> m >> d;
    if(d){
        coutf << (m - 1) * 2 * (n - d) / (n * n) << endl;
    }else{
        coutf << (m - 1) / n << endl;
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h> //Andrei Alexandru a.k.a Sho10
#define ll long long int
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#define all(a) (a).begin(), (a).end()
#define sz size
#define f first
#define s second
#define pb push_back
#define er erase
#define in insert
#define mp make_pair
#define pi pair
#define rc(s) return cout<<s,0
#define endl '\n'
#define mod 1000000007
#define PI 3.14159265359
#define CODE_START  ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
ll n;
string s;
map<string,ll>cnt;
int32_t main(){
CODE_START;
cin>>n;
for(ll i=1;i<=n;i++)
{
    cin>>s;
    cnt[s]++;
}
cout<<"AC x "<<cnt["AC"]<<endl;
cout<<"WA x "<<cnt["WA"]<<endl;
cout<<"TLE x "<<cnt["TLE"]<<endl;
cout<<"RE x "<<cnt["RE"]<<endl;
}


Measured memory_bytes: 3664
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(v) (v).begin(),(v).end()
#define int long long
using namespace std;
typedef vector<int>   vint;
typedef pair<int,int> pint;

signed main()
{
    int N,Y; cin>>N>>Y;
    for(int i=0;i<=N;i++){
        for(int j=0;i+j<=N;j++){
            int k=N-(i+j);
            if(10000*i+5000*j+1000*k==Y){
                cout<<i<<' '<<j<<' '<<k<<endl;
                return 0;
            }
        }
    }
    cout<<-1<<' '<<-1<<' '<<-1<<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 a = Integer.parseInt(sc.next());
		int b = Integer.parseInt(sc.next());

		if (a * b % 2 == 1){
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
}

Measured memory_bytes: 20820
#include <bits/stdc++.h>
using namespace std;
#define sz(v) ((int)(v).size())
const int MAXN = 10000005;
const int mod = 998244353;
using lint = long long;
lint ipow(lint x, lint p){
	lint ret = 1, piv = x;
	while(p){
		if(p & 1) ret = ret * piv % mod;
		piv = piv * piv % mod;
		p >>= 1;
	}
	return ret;
}

lint fact[MAXN], invf[MAXN];

lint binom(int x, int y){
	return fact[x] * (invf[y] * invf[x-y] % mod) % mod;
}

int main() { 
	int n; cin >> n;
	fact[0] = 1;
	for(int i=1; i<=n; i++){
		fact[i] = fact[i-1] * i % mod;
	}
	invf[n] = ipow(fact[n], mod - 2);
	for(int i=n-1; i>=0; i--){
		invf[i] = invf[i + 1] * (i + 1) % mod;
	}
	lint ans = 0;
	for(int i=0; i<n/2; i++){
		ans += ipow(2, i + 1) * binom(n, i) % mod;
	}
	ans %= mod;
	ans = ipow(3, n) - ans + mod;
	cout << ans % mod << endl;
}


Measured memory_bytes: 156544
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)


int main()
{
	long long a, b, n;
	cin >> a >> b >> n;

	if(b == 1){
		cout << 0;
		return 0;
	}

	long long  x;
	x = min(b-1, n);

	long long  y;
	y = (a * x) / b;
	cout << y;
	
}


Measured memory_bytes: 3608
n, m = map(int, input().split())
Island = []
for i in range(m):
    Island.append(list(map(int, input().split())))
Island.sort(key=lambda x: x[0])

g_bridge_start = 0
g_bridge_end = 0
total = 0

for i in range(m):
    bridge_start = Island[i][0]
    bridge_end = Island[i][1] - 1
    #print(bridge_start, bridge_end, g_bridge_start, g_bridge_end)
    if bridge_start <= g_bridge_end:
        g_bridge_start = max(g_bridge_start, bridge_start)
        g_bridge_end = min(g_bridge_end, bridge_end)
    else:
        g_bridge_start = bridge_start
        g_bridge_end = bridge_end
        total += 1
print(total)

Measured memory_bytes: 65240
N = int(input())
A = list(map(int, input().split()))
Q = int(input())
B = [0] * Q
C = [0] * Q
dic = {}
for q in range(Q):
  B[q], C[q] = map(int, input().split())
for k in range(N):
  # import pdb;pdb.set_trace()
  if A[k] in dic:
    dic[A[k]] += 1
  else:
    dic[A[k]] = 1
sumA = sum(A)
for q in range(Q):
  if B[q] in dic:
    sumA += (C[q]-B[q]) * dic[B[q]]
  else:
    print(sumA)
    continue
  if C[q] in dic:
    dic[C[q]] += dic[B[q]]
  else:
    dic[C[q]] = dic[B[q]]
  dic[B[q]] = 0
  print(sumA)

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

s = list(map(int, input().split()))

s.sort()

v = 0

if n == 1:
  print(s[0])
  exit()
elif n == 2:
  print((s[0]+s[1])/2)
  exit()

c = (s[0]+s[1])/2

del s[0]
del s[0]

for i in range(n-2):
  c = (c + s[0])/2
  del s[0]
  
  
print(c)

Measured memory_bytes: 9180
n, m = (int(_) for _ in input().split())
l = [list(int(_) for _ in input().split()) for i in range(n)]

res = 0
for i in range(n):
    for ii in range(i+1,n):
        if (sum([(l[i][x]-l[ii][x])**2 for x in range(m)])**(1/2))%1==0:
            res += 1

print(res)

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

using namespace std;

int main(){
    int M,D,ans=0;
    cin >> M >> D;
    for(int i=1;i<=M;i++){
        for(int j=1;j<=D;j++){
            if(2<=j/10 && 2<=j%10 && i==(j/10)*(j%10)){
                ans++;
            }
        }
    }

    cout << ans << endl;
}

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

bool field[30][30];

int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
string compass = "NESW";

int main() {
  int n, m;

  while(cin >> n, n) {
    int nx = 10, ny = 10;
    int ans = 0;

    for(int i = 0; i < 30; i++) {
      for(int j = 0; j < 30; j++) {
	field[i][j] = false;
      }
    }

    for(int i = 0; i < n; i++) {
      int x, y;
      cin >> x >> y;
      field[x][y] = true;
    }

    cin >> m;
    for(int i = 0; i < m; i++) {
      string s; int d;
      cin >> s >> d;
      int pos;
      for(int j = 0; j < 4; j++) {
	if(compass.substr(j, 1) == s) pos = j;
      }

      for(int j = 1; j <= d; j++) {
	int tx = nx+dx[pos]*j, ty = ny+dy[pos]*j;
	if(field[ty][tx]) {
	  ans++;
	  field[ty][tx] = false;
	}
      }
      nx += dx[pos]*d, ny += dy[pos]*d;
    }
    
    if(ans == n) cout << "Yes" << endl;
    else cout << "No" << endl;
  }
}
 

Measured memory_bytes: 1204