akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, a, n) for (int i = (a); i < (n); i++)
#define repb(i, n) for (int i = (n - 1); i >= 0; i--)
#define repb2(i, a, n) for (int i = (n - 1); i >= (a); i--)
#define all(x) x.begin(), x.end()
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
inline void fastio() { ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL); }

int main() {
    fastio();

    // 0の個数を数える
    // 差を求めて1の個数を求める
    // 0と１の個数が等しければ、すべてのキューブを取り除いたことになる
    // 等しくなければ、0と1の個数が少ないほうの個数☓２が答え
    string S;
    cin >> S;
    int zero = 0;
    rep(i, S.size()) {
        if (S[i] == '0') {
            zero++;
        }
    }
    int one = S.size() - zero;
    if (zero == one) {
        co(zero * 2);
    } else {
        co((zero < one) ? zero * 2 : one * 2);
    }
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
#define ll long long
using namespace std;
struct aaa{
	double x,y;
}a[10001];
int n;
double ans;
void get(double t1,double t2){
	int i;
	double hh,t,k,x=0,y=0,la=0,sum;
	for(i=1;i<=n;i++){
		hh=0;
		t=x+a[i].x;k=y+a[i].y;
		if(t*t1>0)hh+=t*t;
		 else hh-=t*t;
		if(k*t2>0)hh+=k*k;
		 else hh-=k*k;
		if(hh>la){
			la=hh;x=t;y=k;
		}
		ans=max(ans,la);
	}
}
int main(){
	int i,j;
	scanf("%d",&n);
	for(i=1;i<=n;i++)scanf("%lf%lf",&a[i].x,&a[i].y);
	for(j=1;j<=300000;j++){
		random_shuffle(a+1,a+n+1);
		//for(i=1;i<=n;i++)printf("%.3lf %.3lf\n",a[i].x,a[i].y);
		//puts("");
		get(1,1);get(1,-1);
	    get(-1,1);get(-1,-1);
	}
	printf("%.13lf",sqrt(ans));
}

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

#define FILE                          \
    freopen("input.txt", "r", stdin); \
    freopen("output.txt", "w", stdout);

#define FIO                           \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL)

int main()
{
    //FILE;
    FIO;
    int n, i;
    cin >> n;
    i = n % 10;
    if (i == 2 || i == 4 || i == 5 || i == 7 || i == 9)
        cout << "hon";
    else if (i == 3)
        cout << "bon";
    else
        cout << "pon";
    //system("pause");
    return 0;
}

Measured memory_bytes: 3640
import           Control.Monad
import           Data.Functor
import           Text.Printf   (printf)

main :: IO ()
main = do
    xs <- takeWhile (/= 0) . fmap read . lines <$> getContents :: IO [Int]
    forM_ (zip [1 ..] xs) $ \(i, x) -> do
        printf "Case %d: %d\n" (i :: Int) x



Measured memory_bytes: 5164
from collections import defaultdict as dd
H, W = map(int, input().split())
S = [input() for _ in range(H)]

i = 0
color = []
edge = dd(lambda: dd(int))
for h in range(H):
  for w in range(W):
    color.append(S[h][w])
    if w != 0:
      j = i-1
      if S[h][w-1] != S[h][w]:
        edge[i][j] = 1
        edge[j][i] = 1
    if h != 0:
      j = i-W
      if S[h-1][w] != S[h][w]:
        edge[i][j] = 1
        edge[j][i] = 1
    i += 1

visited = [False] * i
ans = 0
for k in range(i):
  if not visited[k]:
    count = { '#': 0, '.': 0 }
    queue = set([k])
    while queue:
      j = queue.pop()
      count[color[j]] += 1
      visited[j] = True
      for dst in edge[j]:
        if not visited[dst]:
          queue.add(dst)
    ans += count['#'] * count['.']
print(ans)

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

using namespace std;

int main(){
	char c[3][4];

	for (int i = 0; i < 3; i++){
		cin >> c[i];
	}

	for (int i = 0; i < 3; i++){
		cout << c[i][i];
	}
	cout << endl;

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std; 
int main()
{
    int n,m;;
    scanf("%d %d",&n,&m);
char arr[n][n];
char arr1[m][m];
    for(int i=0; i<n; i++)
        scanf("%s",arr[i]);
    for(int i=0; i<m; i++)
        scanf("%s",arr1[i]);
    for(int i=0; i<n; i++)
    {
        for(int j=0; j<n; j++)
        {
            int c=0;
            for(int a=0; a<m; a++)
            {
                for(int b=0; b<m; b++)
                {
                    if(arr1[a][b]==arr[i+a][j+b])
                        c++;
                }
            }
            if(c==(m*m))
            {
                printf("Yes\n");
                return 0;
            }
        }
    }
    printf("No\n");
}


Measured memory_bytes: 256
from sys import stdin
def main():
  from builtins import int, range
  readline = stdin.readline
  n, w = map(int, readline().split())
  t = [-1 for i in range(w + 1)]
  t[w] = 0
  for _ in range(n):
    nw, nv = map(int, readline().split())
    for i in range(nw, w + 1):
      ti = t[i]
      if ti == -1:
        continue
      if t[i - nw] < ti + nv:
        t[i - nw] = ti + nv
  print(max(t))
main()

Measured memory_bytes: 7760
from operator import mul
from functools import reduce


n,p = map(int,input().split())
L = list(map(int,input().split()))

LLeven = map(lambda x: x % 2, L)
LLodd = map(lambda x: x % 2, L)

even = list(LLeven).count(0)
odd = list(LLodd).count(1)

def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under


def pattern(x):
    (choose_even,choose_odd) = (0,0)
    for i in range(x+1):
        if i%2 == 0:
            choose_even += cmb(x,i)
        else:
            choose_odd += cmb(x,i)
    return(choose_even,choose_odd)

if p == 0:
    print(2**even * pattern(odd)[0])
else:
    print(2**even * pattern(odd)[1])

Measured memory_bytes: 3572
import java.util.Arrays;

public class Main {
  private static void solve() {
    char[] s = ns();
    char[] t = ns();
    int n = s.length;
    int m = t.length;

    int[][] next = new int[n * 2 + 1][26];
    for (int[] v : next)
      Arrays.fill(v, -1);
    for (int i = n * 2 - 1; i >= 0; i--) {
      for (int c = 0; c < 26; c++) {
        int d = s[i % n] - 'a';

        if (c == d) {
          next[i][c] = i;
        } else {
          next[i][c] = next[i + 1][c];
        }
      }
    }

    long ret = 0;
    for (int i = 0; i < m; i++) {
      int ptr = (int) (ret % n);


      int c = t[i] - 'a';
      int nex = next[ptr][c];
      if (nex < 0) {
        System.out.println(-1);
        return;
      }
      ret += nex - ptr + 1;

    }
    System.out.println(ret);

  }

  public static void main(String[] args) {
    new Thread(null, new Runnable() {
      @Override
      public void run() {
        long start = System.currentTimeMillis();
        String debug = args.length > 0 ? args[0] : null;
        if (debug != null) {
          try {
            is = java.nio.file.Files.newInputStream(java.nio.file.Paths.get(debug));
          } catch (Exception e) {
            throw new RuntimeException(e);
          }
        }
        reader = new java.io.BufferedReader(new java.io.InputStreamReader(is), 32768);
        solve();
        out.flush();
        tr((System.currentTimeMillis() - start) + "ms");
      }
    }, "", 64000000).start();
  }

  private static java.io.InputStream is = System.in;
  private static java.io.PrintWriter out = new java.io.PrintWriter(System.out);
  private static java.util.StringTokenizer tokenizer = null;
  private static java.io.BufferedReader reader;

  public static 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();
  }

  private static double nd() {
    return Double.parseDouble(next());
  }

  private static long nl() {
    return Long.parseLong(next());
  }

  private static int[] na(int n) {
    int[] a = new int[n];
    for (int i = 0; i < n; i++)
      a[i] = ni();
    return a;
  }

  private static char[] ns() {
    return next().toCharArray();
  }

  private static long[] nal(int n) {
    long[] a = new long[n];
    for (int i = 0; i < n; i++)
      a[i] = nl();
    return a;
  }

  private static int[][] ntable(int n, int m) {
    int[][] table = new int[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[i][j] = ni();
      }
    }
    return table;
  }

  private static int[][] nlist(int n, int m) {
    int[][] table = new int[m][n];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[j][i] = ni();
      }
    }
    return table;
  }

  private static int ni() {
    return Integer.parseInt(next());
  }

  private static void tr(Object... o) {
    if (is != System.in)
      System.out.println(java.util.Arrays.deepToString(o));
  }
}


Measured memory_bytes: 54708
// Optimise
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

// #define MULTI_TEST
#ifdef LOCAL
#define db(...) ZZ(#__VA_ARGS__, __VA_ARGS__);
#define pc(...) PC(#__VA_ARGS__, __VA_ARGS__);
template <typename T, typename U>
ostream &operator<<(ostream &out, const pair<T, U> &p)
{
    out << '[' << p.first << ", " << p.second << ']';
    return out;
}
template <typename Arg>
void PC(const char *name, Arg &&arg)
{
    while (*name == ',' || *name == ' ')
        name++;
    std::cerr << name << " { ";
    for (const auto &v : arg)
        cerr << v << ' ';
    cerr << " }\n";
}
template <typename Arg1, typename... Args>
void PC(const char *names, Arg1 &&arg1, Args &&... args)
{
    while (*names == ',' || *names == ' ')
        names++;
    const char *comma = strchr(names, ',');
    std::cerr.write(names, comma - names) << " { ";
    for (const auto &v : arg1)
        cerr << v << ' ';
    cerr << " }\n";
    PC(comma, args...);
}
template <typename Arg1>
void ZZ(const char *name, Arg1 &&arg1)
{
    std::cerr << name << " = " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void ZZ(const char *names, Arg1 &&arg1, Args &&... args)
{
    const char *comma = strchr(names + 1, ',');
    std::cerr.write(names, comma - names) << " = " << arg1;
    ZZ(comma, args...);
}
#else
#define db(...)
#define pc(...)
#endif

using ll = long long;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define f first
#define s second
#define pb push_back
#define all(v) v.begin(), v.end()
auto TimeStart = chrono::steady_clock::now();
auto seed = TimeStart.time_since_epoch().count();
std::mt19937 rng(seed);
template <typename T>
using Random = std::uniform_int_distribution<T>;

const int NAX = 2e5 + 5, MOD = 1000000007;

using ld = long double;
ld dist(ld a, ld b)
{
    return a * a + b * b;
}
ld x[51], y[51];
ld X, Y, d;

void solveCase(int caseNo)
{
    int n;
    cin >> n;
    for (int i = 0; i < n; i++)
    {
        cin >> x[i] >> y[i];
        X += x[i], Y += y[i];
    }
    X /= n;
    Y /= n;
    ld p = 0.01;
    for (int i = 0; i < 300000; i++)
    {
        int f = 0;
        d = dist(X - x[0], Y - y[0]);
        for (int j = 1; j < n; j++)
        {
            ld e = dist(X - x[j], Y - y[j]);
            if (d < e)
            {
                d = e;
                f = j;
            }
        }
        X += (x[f] - X) * p;
        Y += (y[f] - Y) * p;
        p *= 0.999;
    }
    cout << fixed << setprecision(15);
    cout << sqrtl(d) << '\n';
}

int main()
{
#ifndef LOCAL
    ios_base::sync_with_stdio(0);
    cin.tie(0);
#endif
    int t = 1;
#ifdef MULTI_TEST
    cin >> t;
#endif
    for (int i = 1; i <= t; ++i)
    {
        solveCase(i);
#ifdef TIME
        cerr << "Case #" << i << ": Time " << chrono::duration<double>(chrono::steady_clock::now() - TimeStart).count() << " s.\n";
        TimeStart = chrono::steady_clock::now();
#endif
    }
    return 0;
}


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

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

  std::string S;
  std::cin >> S;

  int f = 0, m = 0;
  for (int i = 0; i < S.size(); i++) {
    auto c = S[i];
    if (c == 'A' || c == 'C' || c == 'G' || c == 'T') {
      f++;
    } else {
      f = 0;
    }
    m = std::max(f, m);
  }

  std::cout << m << std::endl;

  return 0;
}


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

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

  int ans = 0;

  for (int i = a ; i <= b ; i++) {
    string s = to_string(i);
    string s_proto = s;
    reverse(s.begin(), s.end());
    if (s_proto == s) ans++;
  }

  cout << ans << endl;

}

Measured memory_bytes: 256
#include<stdio.h>

int main(){
	char a[150];
	int x=1;
	scanf("%[^\n]", a);
	for (int i=0 ; a[i]!='\0' ; i++){
		if (a[i]==' '){
			if (a[i-1]==a[i+1]){
				continue;
			} else{
				x=0;
				break;
			}
		}
	}
	printf("%s\n", x==1 ? "YES" : "NO");
	return 0;
}

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

using namespace std;

int main(){
    int n, ans = 0, prev = 0;
    cin >> n;
    for(int i = 0; i < n; ++i){
        int tmp; cin >> tmp;
        if(tmp >= prev)ans++;
        prev = max(tmp, prev);
    }
    cout << ans;
    return 0;

}


Measured memory_bytes: 256
<?php
  
fscanf(STDIN,"%d %d",$N,$M);

$ab_li=array();
for($i=0;$i<$N;$i++){
 $ab_li[] = explode(" ",trim(fgets(STDIN)));
}

sort($ab_li);

//print_r($ab_li);
$sum_money=0;
$sum_juce=0;
foreach($ab_li as $ab){
  //全部買いたいとき
  if(($ab[1]+$sum_juce)<=$M){
    $sum_juce+=$ab[1];
    $sum_money+=$ab[0]*$ab[1];
  }else{
    $sum_money+=$ab[0]*($M-$sum_juce);
    $sum_juce+=($M-$sum_juce);
  } 
 
  if($sum_juce>=$M){
    echo $sum_money."\n";
    break;
  }
}
              


Measured memory_bytes: 52084
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7

def make_divisors(n):
    divisors = []
    for i in reversed(range(1, int(n**0.5)+1)):
        if n % i == 0:
            return i

n = INT()
a = make_divisors(n)
print(a + n // a - 2)

Measured memory_bytes: 5316
#include <stdio.h>

int main(){
	int n,x;
    int l[100];
    int i;
    int d=0;
    int count=1;
	scanf("%d %d",&n,&x);
    for(i=0; i<n; i++){
        scanf("%d",&l[i]);
    }
	for(i=0; i<n; i++){
    	d = d + l[i];
        if(d>x) break;
        count++;
    }
    printf("%d",count);
	return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
#define MAX_N 200005

int main() {
    int n,k;
    cin >> n >> k;
    int h[n];
    int ans = 0;
    rep(i,n){
        cin >> h[i];
        if(h[i] >= k)ans++;
    }

    

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


Measured memory_bytes: 640
import std.algorithm;
import std.array;
import std.container;
import std.conv;
import std.math;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

void calc(int[] a) {
    auto p = (a.length - 1) / 2; // 真ん中の位置
    auto s = a.dup.sort();
    foreach (e; a) {
        writeln(e <= s[p] ? s[p + 1] : s[p]);
    }
}

void main() {
    readint;
    auto a = readints;
    calc(a);
}

void scan(T...)(ref T a) {
    string[] ss = readln.split;
    foreach (i, t; T) a[i] = ss[i].to!t;
}
T read(T)() { return readln.chomp.to!T; }
T[] reads(T)() { return readln.split.to!(T[]); }
alias readint = read!int;
alias readints = reads!int;


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

int main() {
    int q, x;
    char com[20];
    list<int> v;
    scanf("%d", &q);
    for (int i = 0; i < q; i++) {
        scanf("%s", com);
        if (com[0] == 'i') {
            scanf("%d", &x);
            v.push_front(x);
        } else if (com[6] == 'L') {
            v.pop_back();
        } else if (com[6] == 'F') {
            v.pop_front();
        } else if (com[0] == 'd') {
            scanf("%d", &x);
            for (list<int>::iterator it = v.begin(); it != v.end(); it++) {
                if (*it == x) {
                    v.erase(it);
                    break;
                }
            }
        }
    }

    int i = 0;
    for (list<int>::iterator it = v.begin(); it != v.end(); it++) {
        if (i++) printf(" ");
        printf("%d", *it);
    }
    printf("\n");

    return 0;
}


Measured memory_bytes: 34460
package main

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

func solve() {
	n := rune(getInt())
	s := getRunes()

	for i, r := range s {
		s[i] = (r-'A'+n)%26 + 'A'
	}

	fmt.Fprintln(wr, string(s))
}

// -----------------------------------------

const (
	inf = 1 << 60
	// mod = 1000000007
)

var (
	sc = bufio.NewScanner(os.Stdin)
	wr = bufio.NewWriter(os.Stdout)
)

func main() {
	// buf := 200001
	// sc.Buffer(make([]byte, buf), buf)
	sc.Split(bufio.ScanWords)
	solve()
	wr.Flush()
}

func getInt() int {
	sc.Scan()
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return i
}

func getIntSlice(n int) []int {
	is := make([]int, n)
	for i := range is {
		is[i] = getInt()
	}
	return is
}

func getString() string {
	sc.Scan()
	s := sc.Text()
	return s
}

func getRunes() []rune {
	return []rune(getString())
}


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

const ll mod = 1000000007;


int main() {
	cin.tie(0);
   	ios::sync_with_stdio(false);
	ll a, b; cin >> a >> b;
	ll x = __gcd(a, b);
	cout << x * (a/x) * (b/x) << endl;
} 

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

bool contains(int n, int x) {
    while (n > 0) {
        int temp = n % 10;
        if (temp == x) return true;
        n /= 10;
    }
    return false;
}

int main() {
    int n, k;
    cin >> n >> k;
    int d[k];
    for (int i = 0; i < k; i++) {
        cin >> d[i];
    }

    for (int i = n; ; i++) {
        int j;
        for (j = 0; j < k; j++) {
            if (contains(i, d[j])) {
                break;
            }
        }
        if (j == k) {
            cout << i << endl;
            return 0;
        }
    }
}


Measured memory_bytes: 256
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using db = double;
using ld = long double;
template<typename T> using V = vector<T>;
template<typename T> using VV = vector<vector<T>>;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(),(v).end()
#define siz(v) (ll)(v).size()
#define rep(i,a,n) for(ll i=a;i<(ll)(n);++i)
#define repr(i,a,n) for(ll i=n-1;(ll)a<=i;--i)
#define ENDL '\n'
typedef pair<int,int> Pi;
typedef pair<ll,ll> PL;
constexpr ll mod = 1000000007;
constexpr ll INF = 1000000099;
constexpr ll LINF = (ll)(1e18 +99);
const vector<ll> dx={-1,1,0,0},dy={0,0,-1,1};
template<typename T,typename U> inline bool chmin(T& t, const U& u){if(t>u){t=u;return 1;}return 0;}
template<typename T,typename U> inline bool chmax(T& t, const U& u){if(t<u){t=u;return 1;}return 0;}
template<typename T> inline T gcd(T a,T b){return b?gcd(b,a%b):a;}

template<typename T,typename Y> inline T mpow(T a, Y n) {
  T res = 1;
  for(;n;n>>=1) {
    if (n & 1) res = res * a;
    a = a * a;
  }
  return res;
}

template<typename T,typename Y>
ostream& operator<<(ostream& os,const pair<T,Y>& p){
   return os<<"{"<<p.fs<<","<<p.sc<<"}";
}
template<typename T> ostream& operator<<(ostream& os,const V<T>& v){
   os<<"{";
  for(auto e:v)os<<e<<",";
  return os<<"}";
}
template<typename ...Args>
void debug(Args&... args){
  for(auto const& x:{args...}){
    cerr<<x<<' ';
  }
  cerr<<ENDL;
}

const int MAX = 2000009;//設定して

long long fac[MAX], finv[MAX], inv[MAX];

void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % mod;
        inv[i] = mod - inv[mod%i] * (mod / i) % mod;
        finv[i] = finv[i - 1] * inv[i] % mod;
    }
}

long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}

long long modpow(long long a, long long n, long long MOD) {//a^n(MOD)を求める
    long long res = 1%MOD;
    while (n > 0) {
        if (n & 1) res = res * a % MOD;
        a = a * a % MOD;//次の準備
        n >>= 1;
    }
    return res;
}

signed main(){
  cin.tie(0);cerr.tie(0);ios::sync_with_stdio(false);
  cout<<fixed<<setprecision(20);
  COMinit();

  ll k;cin>>k;
  string s;cin>>s;

  ll ans=0,tmp;
  rep(i,0,k+1){//bac
    tmp=fac[k-i+siz(s)-1];
    (tmp*=finv[k-i])%=mod;
    (tmp*=finv[siz(s)-1])%=mod;

    tmp*=modpow(25,k-i,mod);
    tmp%=mod;
    tmp*=modpow(26,i,mod);
    tmp%=mod;

    ans+=tmp;
    ans%=mod;
  }
  

  cout<<ans<<ENDL;

}
//! ( . _ . ) ! 
//CHECK overflow,vector_size,what to output?

Measured memory_bytes: 51128
import sys


def main():
    input = sys.stdin.buffer.readline
    n, a, b = map(int, input().split())
    if a + b == 0:
        print(0)
    else:
        q, mod = divmod(n, a + b)
        print(q * a + min(mod, a))


if __name__ == "__main__":
    main()


Measured memory_bytes: 9224
A = []
for _ in range(3):
    A.append(list(map(int, input().split())))

N = int(input())

for n in range(N):
    b = int(input())
    for i in range(3):
        for l in range(3):
            if A[i][l] == b:
                A[i][l] = 0
                
if (
    (A[0][0] == 0 and A[0][1] ==0 and A[0][2] ==0 ) or #横0行目
    (A[1][0] == 0 and A[1][1] ==0 and A[1][2] ==0 ) or #横1行目
    (A[2][0] == 0 and A[2][1] ==0 and A[2][2] ==0 ) or #横2行目
    (A[0][0] == 0 and A[1][0] ==0 and A[2][0] ==0 ) or # 縦
    (A[0][1] == 0 and A[1][1] ==0 and A[2][1] ==0 ) or # 縦
    (A[0][2] == 0 and A[1][2] ==0 and A[2][2] ==0 ) or # 縦
    (A[0][0] == 0 and A[1][1] ==0 and A[2][2] ==0 ) or # ななめ
    (A[0][2] == 0 and A[1][1] ==0 and A[2][0] ==0 )
):
    print("Yes")
else:
    print("No")


Measured memory_bytes: 3064
#include<iostream>
using namespace std;
int main()
{
    int k,s,x,y,z, cnt=0;
    cin>>k>>s;
    for(x=0; x<=k; ++x)
        {
            for(y=0 ; y<=k; ++y)
                {
                    int z;
                    z=s-(x+y);
                    if(z<=k&&z>=0)
                        cnt++;
                }
        }
    cout<<cnt;
    return 0;
}

Measured memory_bytes: 384
# https://atcoder.jp/contests/abc082/submissions/13655878
# D - FT Robot
import sys

sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    s = input()
    gx, gy = map(int, input().split())

    spl = list(map(len, s.split("T")))
    init_x = spl[0]
    is_x = 0
    to_x, to_y = [], []
    for i in range(1, len(spl)):
        if spl[i]:
            to_x.append(spl[i]) if is_x else to_y.append(spl[i])
        is_x ^= 1

    now_x = [init_x]
    for move in to_x:
        nx = set()
        for x in now_x:
            nx.add(x + move)
            nx.add(x - move)
        now_x = nx

    now_y = [0]
    for move in to_y:
        ny = set()
        for y in now_y:
            ny.add(y + move)
            ny.add(y - move)
        now_y = ny

    print("Yes" if gx in now_x and gy in now_y else "No")


if __name__ == '__main__':
    resolve()


Measured memory_bytes: 3816
#include <stdio.h>

int main(void){
  long long N;
  long counter = 0;
  scanf("%lld",&N);
  int ans[1000];

  if(N == 0){
    printf("0\n");
    return 0;
  }
  while(N != 0){
    if(N%(-2) == 0){
      ans[counter] = 0;
    }else{
      ans[counter] = 1;
      N--;
    }
    N /= -2;
    counter++;
  }

  while(counter > 0){
    printf("%d",ans[counter-1]);
    counter--;
  }
  printf("\n");

  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
using namespace std;
const long long INF = 1e7 + 1;
const long long MOD = 1000000007;
const long double PI = 3.1415926;
#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(x) x.begin(),x.end()
#define RALL(x) x.rbegin(),x.rend()
typedef long long int ll;
typedef vector<ll> vi;
typedef vector < pair<ll, ll > > vp;
typedef vector <string> vs;
typedef vector <char> vc;
ll n, m, k, ans = 0, sum = 0, cnt = 0;
string s;
char c;

#define Endl endl

/*--------------------template--------------------*/


int main(){
    cin>>s;
    cout<<s.substr(0,s.size()-8)<<endl;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main() {
    int A,B; cin >> A >> B;
    if (A < 0 || A > 100 || B < 2 || B > 1000 || B % 2 !=0) return 0;
    else {
        if (A >= 13) {}
        else if (A >= 6 && A <= 12) B /= 2;
        else if (A <= 5) B = 0;
    }   cout << B;
    return 0;
}


Measured memory_bytes: 256
import java.io.*
import java.util.*
import java.lang.*
import java.lang.Math.*


fun solve() {
    val N = rd.readInt()
    val S = Array(N){""}
    for (i in 0 until N) {
        S[i] = rd.readString()
    }

    val T = Array(N){""}
    var ans = 0
    for (b in 0 until N) {
        for (i in 0 until N) {
            T[i] = S[i].slice(b until N) + S[i].slice(0 until b)
        }

        var ok = true
        for (i in 0 until N) {
            for (j in i+1 until N) {
                if (T[i][j] != T[j][i]) {
                    ok = false
                    break
                }
            }
            if (!ok) break
        }

        if (ok) ans += N
    }
    

    println(ans)
}


//val rd = debug.Reader("agc", "023", "b", "sample-2")
val rd = Reader()


fun main(args: Array<String>) {
    try {
        var exception: Throwable? = null
        val sth = Thread(null, SolveThread(), "solveThread", 128 * 1024 * 1024)
        sth.setUncaughtExceptionHandler { _, e -> exception = e }
        sth.start(); sth.join()
        if (exception != null) throw exception!!
    } catch (e: Exception) { throw e }
}
const val MOD = 1_000_000_007L; const val INF = Int.MAX_VALUE/2; const val LINF = Long.MAX_VALUE/2
data class IntPair(val first: Int, val second: Int); data class LongPair(val first: Long, val second: Long)
val errPrintln: (Any) -> Unit = { msg -> System.err.println(msg) }
fun rAssert(exp: Boolean, lazyMsg: () -> String = {""}) {
    if (!exp) { val msg = lazyMsg(); errPrintln("EAssert Error: $msg"); throw Error(msg) }
}
fun tAssert(exp: Boolean, lazyMsg: () -> String = {""}) {
    if (!exp) { val msg = lazyMsg(); errPrintln("TAssert Error: $msg"); Thread.sleep(3000) }
}
class SolveThread : Runnable {
    override fun run() { solve() }
}
class Reader {
    private val br = BufferedReader(InputStreamReader(System.`in`))
    val readString: () -> String = { br.readLine() }
    val readInt: () -> Int = { br.readLine().toInt() }
    val readLong: () -> Long = { br.readLine().toLong() }
    val readIntArray: () -> IntArray = { br.readLine().split(' ').map { it.toInt() }.toIntArray() }
    val readLongArray: () -> LongArray = { br.readLine().split(' ').map { it.toLong() }.toLongArray() }
    val readListInt: () -> List<Int> = { br.readLine().split(' ').map { it.toInt() } }
    val readListLong: () -> List<Long> = { br.readLine().split(' ').map { it.toLong() } }
}


Measured memory_bytes: 71748
//satyaki3794
#include <bits/stdc++.h>
#define ff first
#define ss second
#define pb push_back
#define MOD (1000000007LL)
#define LEFT(n) (2*(n))
#define RIGHT(n) (2*(n)+1)
 
using namespace std;
typedef long long ll;
typedef pair<int, int> ii;
typedef pair<ii, int> iii;

ll pwr(ll base, ll p, ll mod){
ll ans = 1;while(p){if(p&1)ans=(ans*base)%mod;base=(base*base)%mod;p/=2;}return ans;
}
 

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


int n, m, cnt[100005];


int main(){

    ios_base::sync_with_stdio(0);
    cin.tie(0);

    cin>>n>>m;
    while(m--){
    	int a, b;
    	cin>>a>>b;
    	cnt[a]++;	cnt[b]++;
    }

    for(int i=1;i<=n;i++)
    	if(cnt[i] & 1){
    		cout<<"NO";
    		return 0;
    	}
    cout<<"YES";
    return 0;
}










Measured memory_bytes: 768
#include <algorithm>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
using namespace std;
#define fst first
#define snd second
using ll = long long;
using I = pair<int, int>;

int main() {
  int N;
  while (cin >> N) {
    string res = N < 1000 ? "ABC" : "ABD";
    cout << res << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <algorithm>
#include <vector>
#include <utility>
#include <queue>
#include <stack>
#include <map>
#include <string>
using namespace std;

bool flg[8] = {};
int  pos[8] = {};

bool chk(int r)
{
    for (int i = 0; i < r; i++)
        if (pos[i] == pos[r] || abs(r - i) == abs(pos[i] - pos[r]))
            return false;
    return true;
}

bool back_track(int r)
{
    if (r == 8) return true;
    for (int c = 0; c < 8; c++) {
        if (flg[r] && c != pos[r])
            continue;
        pos[r] = c;
        if (chk(r) && back_track(r + 1)) return true;
    }
    return false;
}

int main()
{
    int k, r, c, x, y;
    cin >> k;
    while (k--) {
        cin >> r >> c;
        flg[r] = true;
        pos[r] = c;
    }
    back_track(0);
    for (r = 0; r < 8; r++) {
        for (c = 0; c < 8; c++) cout << (pos[r] == c ? 'Q' : '.');
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 3100
import numpy as np

n=int(input())
A=list(map(int,input().split()))
count=0
a_n=np.array(A)
abs_a=np.abs(a_n)
sum_a=np.sum(abs_a)
for x in A:
    if x<0:
        count+=1
if count%2==0:
    print(sum_a)
elif count%2==1:
    sum_b=sum_a-2*np.min(abs_a)
    print(sum_b)

Measured memory_bytes: 23360
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstring>
#include <cstdlib>
#include <cmath>
using namespace std;
using ll = long long;

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

    //1.08倍してN以上になる最小の整数のみが候補
    int x = (n * 100 + 108 - 1) / 108;

    if (x * 108 / 100 == n) {
        cout << x << endl;
    } else {
        cout << ":(" << endl;
    }

    return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
int main()
  {
  int a,b;
  cin>>a>>b;
  if(a+b==15)
    cout<<"+"<<endl;
  else if(a*b==15)
    cout<<"*"<<endl;
  else
    cout<<"x"<<endl;
  }

Measured memory_bytes: 3552
# abc045 B
a = gets.chomp.chars.reverse
b = gets.chomp.chars.reverse
c = gets.chomp.chars.reverse

x = a.pop

loop do
  x = case x
  when 'a'
    if a.empty?
      puts 'A'
      exit
    end
    a.pop
  when 'b'
    if b.empty?
      puts 'B'
      exit
    end
    b.pop
  when 'c'
    if c.empty?
      puts 'C'
      exit
    end
    c.pop
  end
end







Measured memory_bytes: 1788
#include <bits/stdc++.h>
#define pb push_back
#define ll long long
#define md 1000000007
#define ld long double
using namespace std;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    long long n, i = 0, j= 0, k = 0, l = 0, m = 0, a = 0, b = 0, sum = 0, x = 0, y = 0, z = LLONG_MAX, c, p;
    cin >> n >> m >> x;
    ll cost[n];
    ll arr[n][m];
    vector <int> v(n,0);
    for(i = 0; i < n; i++){
        cin >> cost[i];
        for(j = 0; j < m; j++){
            cin >> arr[i][j];
        }
    }
    for(i = 0; i < n; i++){
        vector <int> w;
        //vector <ll> co(m);
        v[n-i-1] = 1;
        w = v;
        do{
            sum = 0;
            vector <ll> co(m,0);
//            for(auto k : w){
//                cout << k << " ";
//            }
            //cout << endl;
            for(j = 0; j < n; j++){
                if(w[j] == 1){
                    sum += cost[j];
                    for(k = 0; k < m; k++){
                        co[k] += arr[j][k];
                    }
                }
            }
            p = 0;
            for(j = 0; j < m; j++){
                if(co[j] < x){
                    p = -1;
                }
            }
            if(p == 0){
                z = min(z,sum);
            }
        }while(next_permutation(w.begin(),w.end()));
        //sort(w.begin(),w.end());
    }
    if(z == LLONG_MAX){
        cout << "-1";
    }
    else{
        cout << z;
    }

    return 0;
}


Measured memory_bytes: 3636
#include"bits/stdc++.h"
#define int long long
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(a);i<(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define itr(i,x) for(auto i=(x).begin();i!=(x).end();++i)
#define All(x) (x).begin(),(x).end()
#define rAll(x) (x).rbegin(),(x).rend()
using namespace std;
typedef pair<int,int> P;
const int mod=1000000007;
int gcd(int x,int y){return y?gcd(y,x%y):x;}
int lcm(int x,int y){return x*y/gcd(x,y);}

signed main(){
	string s;
	cin>>s;
	string ans;
	rep(i,(s.size()+1)/2) ans.push_back(s[2*i]);
	cout<<ans<<endl;
}

Measured memory_bytes: 512
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<string>
#include<cmath>
#include<cstdlib>
using namespace std;
int n,s[111111],ans;
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		int x=0; scanf("%d",&x);
		s[x-1]++; s[x]++; s[x+1]++;
	}
	for(int i=0;i<=100005;i++) ans=max(ans,s[i]);
	printf("%d\n",ans);
}


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


int main()
{
	int a, b;
	cin >> a >> b;
	if (a > b)
		cout << a - 1 << endl;
	else
		cout << a << endl;
		
	return 0;
}

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

#define fRead  freopen("D:\\1805057\\in.txt","r",stdin)
#define fWrite freopen ("D:\\1805057\\out.txt","w",stdout)
#define FAST_READ ios_base::sync_with_stdio(0);cin.tie(0);

#define WATCH(a) cout << (a) << endl;
#define WATCH2(a, b) cout << (a) << " " << (b) << endl;
#define WATCH3(a, b, c) cout << (a) << " " << (b) << " " << (c) << endl;

#define MEM(a) memset(a, 0, sizeof(a))
#define PI acos(-1.0)

#define Equal(a, b) (abs(a-b)<1e-9)
#define WithIn(a, b, c) ((b)<=(a) && (a)<=(c))

#define getbit(n,i) (((n)&(1<<(i)))!=0)
#define setbit0(n,i) ((n)&(~(1<<(i))))
#define setbit1(n,i) ((n)|(1<<(i)))
#define togglebit(n,i) ((n)^(1<<(i)))

#define f first
#define s second
#define pb push_back

#define pii pair<int, int>;
#define vpi vector<pair<int, int> >;

#define SORT12(a) sort(a, a+sizeof(a)/sizeof(a[0]))
#define SORT21(a, type) sort(a, a+sizeof(a)/sizeof(a[0]), greater<type>())

#define amax(a, b) a=max(a, (b));
#define amin(a, b) a=min(a, (b));

/// bitset<size>

typedef long long int li;
typedef unsigned long long lu;

int main()
{
    //int T, CASE=0; cin >> T; while(T--){

    int n, k; cin >> n >> k;

    if(k==1) cout << 0 <<endl;
    else cout << n-k << endl;

    //}

	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#define anD &&
#define oR ||
#define max(a,b) (((a)>(b))?(a):(b))
#define min(a,b) (((a)<(b))?(a):(b))
#define rep(i,n) for((i)=0;(i)<(n);(i)++)

 long long gcd(long long p,long long q) {

	 if(q!=0)return gcd(q, p%q);
	 else return p;
}

int main(void) {
	 long long a, b,aa,bb;
	scanf("%lld %lld", &a, &b);
	aa = max(a, b); bb = min(a, b);
	printf("%lld\n", gcd(aa, bb));
	return 0;
}

Measured memory_bytes: 596
#include <iostream>
#include <cmath>
#include <algorithm>
#include <string>
#include <bitset>
#include <map>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <set>

#define llong long long int

using namespace std;

int num_of_bits(long bits)
{
    bits = (bits & 0x55555555) + (bits >> 1 & 0x55555555);
    bits = (bits & 0x33333333) + (bits >> 2 & 0x33333333);
    bits = (bits & 0x0f0f0f0f) + (bits >> 4 & 0x0f0f0f0f);
    bits = (bits & 0x00ff00ff) + (bits >> 8 & 0x00ff00ff);
    return (bits & 0x0000ffff) + (bits >>16 & 0x0000ffff);
}

int main(int argc, char *argv[]) {
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n; cin >> n;
    if (n == 3 || n == 5 || n == 7) cout <<"YES" << endl;
    else cout << "NO" << endl;
    return 0;
}

Measured memory_bytes: 256
import static java.util.Comparator.comparing;

import java.io.InputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.PriorityQueue;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        PrintWriter out = new PrintWriter(System.out);
        Solver solver = new Solver(System.in, out);
        solver.solve();
        out.close();
    }
}
class Solver {
	Scanner sc;
	PrintWriter out;
    public Solver(InputStream in, PrintWriter out) {
    	sc = new Scanner(in);
    	this.out = out;
    }
    // ==========================================================
    public void solve() {
    	int N = ni();
    	int[] A = ndi(N);
    	long[] wa = new long[N+1];
    	for (int i = 1; i <= N; i++) {	// 累積和
			wa[i] = wa[i-1] + A[i-1];
		}
    	long[][] dp = new long[N+1][N+1];
    	int j;
    	long sv;
    	for (int len = 2; len <= N+1; len++) {
			for (int i = 0; i + len <= N; i++) {
				j = i + len;
				sv = 1000000000000000000L;
				for (int k = i+1; k < j; k++) {
					sv = Math.min(sv, 
							dp[i][k] + dp[k][j] + wa[j] - wa[i]);
//					out.println("i = " + i + "  j = " + j + "  k = " + k
//							+ "  dp[" + i + "][" + k + "] = " + dp[i][k]
//							+ "  dp[" + k + "][" + j + "] = " + dp[k][j]
//							+ "  wa[" + j + "] = " + wa[j] 
//							+ "  wa[" + i + "] = " + wa[i]
//							+ " --> " + (wa[j]-wa[i])
//							+ "  wa[" + i + "][" + j + "] = " + dp[i][j]);
				}
				dp[i][j] = sv;
			}
		}
    	out.println(dp[0][N]);
    }
    // ------------------------------------------
    // 入力
    // ------------------------------------------
    public int ni() {
    	return sc.nextInt();
    }
    public long nl() {
    	return sc.nextLong();
    }
    public String ns() {
    	return sc.next();
    }
    public char[] nc() {
    	return sc.next().toCharArray();
    }
    public int[] ndi(int N) {
    	int[] ans = new int[N];
    	for (int i = 0; i < N; i++) {
			ans[i] = ni();
		}
    	return ans;
    }
    public long[] ndl(int N) {
    	long[] ans = new long[N];
    	for (int i = 0; i < N; i++) {
			ans[i] = nl();
		}
    	return ans;
    }
    public String[] nds(int N) {
    	String[] ans = new String[N];
    	for (int i = 0; i < N; i++) {
			ans[i] = ns();
		}
    	return ans;
    }
    public char[][] ndc(int N) {
    	char[][] ans = new char[N][];
    	for (int i = 0; i < N; i++) {
			ans[i] = nc();
		}
    	return ans;
    }
    public int[][] nddi(int N, int S) {
    	int[][] ans = new int[N][S];
    	for (int i = 0; i < N; i++) {
			for (int j = 0; j < S; j++) {
				ans[i][j] = ni();
			}
		}
    	return ans;
    }
}


Measured memory_bytes: 23892
import java.util.Arrays;
import java.util.Scanner;

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

        int[] input = new int[n];

        for(int i=0;i<n;i++){
            input[i] = sc.nextInt();
        }

        int[] sorted = Arrays.copyOf(input,input.length);
        Arrays.sort(sorted);

        int count = 0;
        int[] different = new int[2];
        for(int i=0;i<n;i++){
            if(input[i] != sorted[i]){
                if(count ==2){
                    System.out.println("NO");
                    return;
                }
                different[count]=i;
                count++;
            }
        }

        if(count ==0){
            System.out.println("YES");
        }else if(count == 1){
            System.out.println("NO");
        }else{
            if(input[different[0]] == sorted[different[1]]){
                System.out.println("YES");
            }else{
                System.out.println("NO");
            }


        }





    }
}

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

int main()
{
    int p, q, r;
    cin >> p >> q >> r;

    int ans = p + q + r;
    int m = max(p, q);
    m = max(m, r);
    ans -= m;
    cout << ans << endl;
  	return 0;
}

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

int main(void){
    double A,B,H,M,d,ch,cm,c;

    scanf("%lf %lf %lf %lf",&A,&B,&H,&M);

    ch = 30.0*H + 0.5*M;
    cm = 6.0*M;

    if(ch>cm){
        if(ch-cm<=180)
        c = ch-cm;
        if(ch-cm>180)
        c = 360.0 - (ch-cm);
    }else if(cm>ch){
        if(cm-ch<=180)
        c = cm-ch;
        if(cm-ch>180)
        c = 360.0 - (cm-ch);
    }

    d = sqrt(A*A + B*B - 2.0*A*B*cos(c*M_PI/180.0));

    printf("%.15f",d);

    return 0;
}

Measured memory_bytes: 2556
#include<bits/stdc++.h> 
using namespace std;
using ll=long long;
const ll mod=1e+9;
typedef pair<int,int> P;
#define fi first
#define se second
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
 ll n;
 cin>>n;
 vector<ll> a(n);
 for(int i=0;i<n;i++)cin>>a.at(i);
 sort(a.begin(),a.end());
 if(n%3==0){
     n/=3;
    if(a.at(0)==a.at(n-1)&&a.at(n)==a.at(2*n-1)&&a.at(2*n)==a.at(3*n-1)&&(a.at(0)^a.at(n)^a.at(2*n))==0)cout<<"Yes"<<endl;
     else cout<<"No"<<endl;
 }
 else{
 if(a.at(n-1)==0)cout<<"Yes"<<endl;
 else cout<<"No"<<endl;
 }
}


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

#define REP(i,n) for(int (i)=0;(i)<(n);++(i))
#define FOR(i,a,b) for(int (i)=(a);i<(b);++(i))
#define ALL(obj) (obj).begin(),(obj).end()
#define space <<" "<<
#define maxs(x,y) (x=max(x,y))
#define mins(x,y) (x=min(x,y))
#define FIX <<fixed<<setprecision(10)<<
using namespace std;

using ll = long long; using ull = unsigned long long;
using vb = vector<bool>; using vvb = vector<vb>;
using vi = vector<int>; using vvi = vector<vi>;
using vl = vector<ll>; using vvl = vector<vl>;
using pii = pair<int,int>; using pll = pair<ll,ll>;

const ll MOD = 1e9+7;

int main(){
int n;
int j;
cin>>n;
vector<int> A(n);
int v;
REP(i,n)cin>>A[i];

REP(i,n){
    v=A[i];
    j=i-1;
    while(j>=0&&A[j]>v){
        A[j+1]=A[j];
        j--;
    }
    A[j+1]=v;
    REP(k,n-1)cout<<A[k]<<" ";
    cout<<A[n-1]<<endl;
}
}


Measured memory_bytes: 3080
#include<iostream>
using namespace std;
int main()
{
	int num[10];
	int temp;
	for(int i=0;i<10;i++)
		cin>>num[i];
	for(int i=0;i<10;i++)
		for(int j=i+1;j<10;j++)
			if(num[j]<num[i])
			{
				temp=num[i];
				num[i]=num[j];
				num[j]=temp;
			}
	for(int i=9;i>6;i--)
		cout<<num[i]<<endl;
	return 0;
}

Measured memory_bytes: 1160
#include<stdio.h>
long long gcd(long long a,long long b){return b?gcd(b,a%b):a;}
int main(){
  int n,a,i,g=0,f=1,c[1000010]={};
  scanf("%d",&n);
  while(n--){
    scanf("%d",&a);
    g=gcd(a,g);//printf("%d\n",g);
    for(i=2;i*i<=a;i++){
      if(a%i)continue;
      if(c[i])f=0;
      c[i]=1;
      while(a%i==0)a/=i;
    }
    if(a==1)continue;
    if(c[a])f=0;
    c[a]=1;
  }
  if(f)printf("pairwise coprime\n");
  else if(g==1)printf("setwise coprime\n");
  else printf("not coprime\n");
  return 0;
}


Measured memory_bytes: 5556
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
#define MOD 1000000007
int main()
{
	long long n;
	cin>>n;
	long long arr[n][3];
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<3;j++)
		{
			cin>>arr[i][j];
		}
	}

	long long dp[n][3];
	dp[0][0]=arr[0][0];
	dp[0][1]=arr[0][1];
	dp[0][2]=arr[0][2];

	for(int i=1;i<n;i++)
	{
		dp[i][0]=(arr[i][0]+max(dp[i-1][1],dp[i-1][2]));
		dp[i][1]=(arr[i][1]+max(dp[i-1][0],dp[i-1][2]));
		dp[i][2]=(arr[i][2]+max(dp[i-1][0],dp[i-1][1]));
		//cout<<dp[i][0]<<" "<<dp[i][1]<<" "<<dp[i][2]<<endl;
	}

	
	cout<<max(dp[n-1][0],max(dp[n-1][1],dp[n-1][2]))<<endl;
	return 0;
}

Measured memory_bytes: 4992
#include<iostream>
#include <stdio.h>
#include <string>
#include <vector>
#include <math.h>
using namespace std;
int tot,a;
	int main(){
		while(cin>>tot){
			if(tot==0){
			break;}
		for(int i=0;i<9;i++){
		cin>>a;tot-=a;}
		cout<<tot<<endl;}
		return 0;}


Measured memory_bytes: 1160
#include <bits/stdc++.h>
#include <math.h>
#define _GLIBCXX_DEBUG
using namespace std;
int main() {

  int N,K;cin>>N>>K;
  int ans=0;
  
  while(N>0){
    N /= K;
    ans ++;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main () {
	int a[4]={6,4,3,2},b,c,i;
	for (i=0;i<4;i++) {
		cin >> b >> c;
		cout << a[b-1]*c*1000 << endl;
		}
    return 0;
    }
	


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

using namespace std;

int main()
{
    long long n,c=0,d=0;
    cin>>n;

    long long h[n];

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

    for(int i=0; i<n; i++)
    {
        if(h[i]>=h[i+1])
        {
            c++;
        }
        else
        {
            c=0;
        }
        
        d = max(d,c);
    }

    cout<<d<<endl;

    return 0;
}


Measured memory_bytes: 1024
#include <iostream>

using namespace std;
bool board[7][7];
bool row[7], col[7];
int h, w, k, tol = 0;

void dfs(int i, int j) {
    if (i < h) {
        col[i] = true;
        dfs(i + 1, j);
        col[i] = false;
        dfs(i + 1, j);
    } else if (j < w) {
        row[j] = true;
        dfs(i, j + 1);
        row[j] = false;
        dfs(i, j + 1);
    }
    if (i == h && j == w) {
        int sum = 0;
        for (int i1 = 0; i1 < h; i1++)
            for (int j1 = 0; j1 < w; j1++)
                sum += !col[i1] && !row[j1] && board[i1][j1];
        tol += sum == k;
    }
}

int main() {
    cin >> h >> w >> k;
    for (int i = 0; i < h; i++)
        for (int j = 0; j < w; j++) {
            char c;
            cin >> c;
            board[i][j] = c == '#';
        }
    dfs(0, 0);
    cout << tol;
    return 0;
}

Measured memory_bytes: 3592