akhauriyash/Code-Regression huggingface dataset:
#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;
typedef double DOUBLE;
#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; }

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

#define file "I1"

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

const int MAXN = 2e5 + 5;

void solve(){
	ll k, a, b;
	cin >> k >> a >> b;
	ll ans = k + 1;
	if (b > a && k > a - 1) {
		ll cur = 1 + a - 1 + (k - (a - 1)) / 2 * (b - a) + (k - (a - 1)) % 2;
		ans = max(ans, cur);
	}
	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<bits/stdc++.h>
using namespace std;
const int N=105;
int n,sum=0,a[N],ans,pnt=1e9;
int main()
{
	ios::sync_with_stdio(false);
	cin>>n;
	for(int i=0;i<n;i++)cin>>a[i],sum+=a[i];
	for(int i=0;i<n;i++)
	{
		if(pnt>abs(a[i]*n-sum))
		{
			pnt=abs(a[i]*n-sum);
			ans=i;
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>

int main() {
  unsigned long long x;
  std::cin >> x;
  for (unsigned long long i = 1; i <= x; ++i) {
    if (i * (i + 1) / 2 >= x) {
      std::cout << i << std::endl;
      return 0;
    }
  }
  return 0;
}

Measured memory_bytes: 256
h, w = gets.chomp.split(" ").map(&:to_i)
rn = ('A'..'Z').to_a
h.times do |i|
  row = gets.chomp.split(" ")
  col = row.index("snuke")
  if !(col.nil?) then
    puts "#{rn[col]}#{i+1}"
    exit
  end
end

Measured memory_bytes: 1788
fun main(args: Array<String>) {
    val (n, k) = readIntList()
    val a = readIntList()
    var ans = 0
    var i = 0
    while (i < n - 1) {
        i += k - 1
        ans++
    }
    println(ans)
}

// Tools
fun readString() = readLine()!!
fun readInt() = readLine()!!.toInt()
fun readLong() = readLine()!!.toLong()
fun readStringList() = readLine()!!.split(" ")
fun readIntList() = readLine()!!.split(" ").map(String::toInt)

Measured memory_bytes: 49464
#include<stdio.h>
#include<stdlib.h>

typedef struct tree{
  int p,l,r;
}Tr;

Tr T[25];

int H(int);
int n;

int main(){
  int i,j,l,r,id;
  int s[25],deg[25],dep[25],h[25];

  scanf("%d",&n);

  for(i=0;i<n;i++){
    T[i].p=T[i].l=T[i].r= s[i]=-1;
    deg[i]=dep[i]= h[i]=0;
  }

  for(i=0;i<n;i++){
    scanf("%d%d%d",&id,&l,&r);

    if(r!=-1){
      T[r].p=id;
      deg[id]++;
    }
    if(l!=-1){
      T[l].p=id;
      deg[id]++;
    }

    T[id].l=l;
    T[id].r=r;
    s[l]=r;
    s[r]=l;
  }

  for(i=0;i<n;i++){
    j=i;

    while(T[j].p!=-1){
      j=T[j].p;
      dep[i]++;
    }
    h[i]=H(i);
  }

  for(i=0;i<n;i++){
    printf("node %d: parent = %d, sibling = %d, degree = %d, depth = %d, height = %d, ",i,T[i].p,s[i],deg[i],dep[i],h[i]);

    if(T[i].p==-1){
      printf("root\n");
    }else if(T[i].l==-1 && T[i].r==-1){
      printf("leaf\n");
    }else{
      printf("internal node\n");
    }
  }

  return 0;
}

int H(int a){
  int i,c=0,x=0;

  for(i=0;i<n;i++){
    if(T[i].p==a){
      c=H(i)+1;

      if(c>x){
	x=c;
      }
    }
  }

  return x;
}



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

int main(){
   int y,m,d;
   char c,c2;

   cin >> y >> c >>  m >> c2 >>  d;
   if(m<=4){
      cout << "Heisei";
   }else{
      cout << "TBD";
   }
   return 0;
}

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

public class Main {
    public static void main(String[] args){
        Scanner stdIn = new Scanner(System.in);
        int N = stdIn.nextInt();
        int M = stdIn.nextInt();
        int sum_M =0;

        int[] A = new int[N];
        int sum = 0;
        for (int i=0; i<A.length; i++){
            A[i] = stdIn.nextInt();
            sum += A[i];
        }

        Arrays.sort(A);
        /*for(int i=N-1; i>0; i--){
            System.out.print(A[i]+" ");
        }*/

        double AAA = A[N-M];
        double BBB = (double)sum/((double)M*4.0);
        //System.out.println("\n"+AAA+"\n"+BBB+"\n"+(AAA-BBB));
        if(AAA < BBB ){
            System.out.println("No");
        }else{
            System.out.println("Yes");
        }




    }
}

Measured memory_bytes: 23764
#include<bits/stdc++.h>
#define ll long long
#define all(v) v.begin(),v.end()
#define PI 3.1415926535897932384626433832795
#define what(x) cout<<#x<<" is "<<x<<endl;
using namespace std;


template <typename A, typename B>
string to_string(pair<A, B> p);

template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p);

template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p);

string to_string(const string& s) {
  return '"' + s + '"';
}

string to_string(const char* s) {
  return to_string((string) s);
}

string to_string(bool b) {
  return (b ? "true" : "false");
}

string to_string(vector<bool> v) {
  bool first = true;
  string res = "{";
  for (int i = 0; i < static_cast<int>(v.size()); i++) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(v[i]);
  }
  res += "}";
  return res;
}

template <size_t N>
string to_string(bitset<N> v) {
  string res = "";
  for (size_t i = 0; i < N; i++) {
    res += static_cast<char>('0' + v[i]);
  }
  return res;
}

template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}

template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ")";
}

template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")";
}

void debug_out() { cerr << endl; }

template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

// ll powmod(ll a,ll b,ll mod) {
//     ll res=1;a%=mod;
//     //assert(b>=0);
//     for(;b;b>>=1){
//         if(b&1)res=res*a%mod;a=a*a%mod;
//     }
//     return res;
// }

void solve(){
  int n;
  cin>>n;
  vector<int> arr(n);
  ll sum=0;
  for(int i=0;i<n;i++){
    cin>>arr[i];
  }
  sort(all(arr));
  reverse(all(arr));
  // sum+=arr[0];
  for(int i=1;i<n;i++)
  {
    sum+=arr[i/2];
  }

  cout<<sum<<endl;

}


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);
    #endif
    int tc=1;
    // cin>>tc;
    while(tc--)solve();
}


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

int main()
{
  string s,t;
  int i,j,ans=0;
  
  cin >> s >> t ;
  
  for(i=0;i<=2;i++)
    if(s[i]==t[i]) ans++;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
import java.util.*;
class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while(true) {
			int n = sc.nextInt();
			if(n == 0) break;
			
			int[] s = new int[n];
			int sum = 0;
			for(int i = 0; i < n; i++) {
				s[i] = sc.nextInt();
				sum += s[i];
			}
			double m = sum/(double)n;//平均
			
			double a = 0.0;
			for(int i = 0; i < n; i++) {
				a += (s[i] - m)*(s[i] - m);
			}
			a= a/(double)n;
			
			System.out.println(Math.sqrt(a));
			
		}
	}
}



Measured memory_bytes: 31392
n, m = map(int, input().split())
c = []
for i in range(m):#h:高さ
    c.append([int(m) for m in input().split()])
c.sort(key=lambda x:(x[0], x[1]))
root = []
for i in range(n):
    root.append([])
for i in range(m):
    root[c[i][0] - 1].append(c[i][1])
root1 = root[0]
for v in root1:
    if n in root[v - 1]:
        print("POSSIBLE")
        exit()
print("IMPOSSIBLE")

Measured memory_bytes: 59000
n=int(input())
p=list(map(float,input().split()))
dp=[[0 for j in range(n+1)] for i in range(n+1)]

dp[0][0]=1
for i in range(n):
  for j in range(n):
    dp[i+1][j+1]+=dp[i][j]*p[i]
    dp[i+1][j]+=dp[i][j]*(1-p[i])
ans=0
for i in range(n,-1,-1):
  if i>n-i:
    ans+=dp[-1][i]
  else:
    break
print(ans)

Measured memory_bytes: 257672
import std.stdio;
import std.string;
import std.conv;
import std.typecons;
import std.algorithm;
import std.functional;
import std.bigint;
import std.numeric;
import std.array;
import std.math;
import std.range;
import std.container;
import std.ascii;
void times(alias fun)(int n) {
    foreach(i; 0..n) fun();
}
auto rep(alias fun, T = typeof(fun()))(int n) {
    T[] res = new T[n];
    foreach(ref e; res) e = fun();
    return res;
}
// fold was added in D 2.071.0.
template fold(fun...) if (fun.length >= 1) {
    auto fold(R, S...)(R r, S seed) {
        static if (S.length < 2) {
            return reduce!fun(seed, r);
        } else {
            return reduce!fun(tuple(seed), r);
        }
    }
}

long MOD = 10^^9+7;
void main() {
    int N, M;
    readf("%d %d\n", &N, &M);

    long[][][] dp = (M+1).iota.map!(i => (min(i+1, N)+1).iota.map!(j => (j+1).iota.map!(k => 0L).array).array).array;
    dp[0][1][1] = 1;
    foreach(i; 0..M) foreach(j; 0..min(i+1, N)+1) foreach(k; 0..j+1) {
        if (j<N) dp[i+1][j+1][k].add(dp[i][j][k] * (N-j));
        dp[i+1][j][k].add(dp[i][j][k] * (j-k));
        dp[i+1][j][j].add(dp[i][j][k] * k);
    }
    dp.back.back.back.writeln;
}
void add(ref long v1, long v2) {
    v1 = (v1 + v2)%MOD;
}


Measured memory_bytes: 54268
#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> P;

const ll INF = 1ll << 60;
ll MOD = 998244353;

int main()
{

    string s;
    cin >> s;
    map<char, int> mp;
    vector<int> v(s.length(), 0);
    for (int i = 0; i < s.length(); ++i)
    {
        mp[s[i]]++;
    }
    bool ok = true;
    if (mp.size() != 2)
        ok = false;

    for (auto i = mp.begin(); i != mp.end(); ++i)
    {
        if (i->second != 2)
            ok = false;
    }

    if (ok)
        cout << "Yes";
    else
        cout << "No";

    return 0;
}

Measured memory_bytes: 256
#![allow(unused_imports, unused_macros, dead_code)]

macro_rules! min {
    (.. $x:expr) => {{
        let mut it = $x.iter();
        if let Some(z) = it.next() {
            Some(it.fold(z, |x, y| min!(x, y)))
        } else {
            None
        }
    }};
    ($x:expr) => ($x);
    ($x:expr, $($ys:expr),*) => {{
        let t = min!($($ys),*);
        if $x < t { $x } else { t }
    }}
}
macro_rules! max {
    (.. $x:expr) => {{
        let mut it = $x.iter();
        if let Some(z) = it.next() {
            Some(it.fold(z, |x, y| max!(x, y)))
        } else {
            None
        }
    }};
    ($x:expr) => ($x);
    ($x:expr, $($ys:expr),*) => {{
        let t = max!($($ys),*);
        if $x > t { $x } else { t }
    }}
}


macro_rules! ewriteln {
    ($($args:expr),*) => { let _ = writeln!(&mut std::io::stderr(), $($args),*); };
}
macro_rules! trace {
    ($x:expr) => { ewriteln!(">>> {} = {:?}", stringify!($x), $x) };
    ($($xs:expr),*) => { trace!(($($xs),*)) }
}
macro_rules! put {
    (.. $x:expr) => {{
        let mut it = $x.iter();
        if let Some(x) = it.next() { print!("{}", x); }
        for x in it { print!(" {}", x); }
        println!("");
    }};
    ($x:expr) => { println!("{}", $x) };
    ($x:expr, $($xs:expr),*) => { print!("{} ", $x); put!($($xs),*) }
}

const M: i64 = 1_000_000_007;

fn prime_sieve(n: usize) -> Vec<bool> {
    let mut s = vec![true; n];
    s[0] = false; s[1] = false;
    for i in 2..n {
        if i * i > n { break }
        if s[i] {
            for k in 2..(n+i-1)/i { s[k*i] = false }
        }
    }
    s
}

fn n2c(m: usize) -> usize {
    m * (m - 1) / 2
}

fn main() {
    let mut sc = Scanner::new();
    let n: usize = sc.cin();
    let ps = prime_sieve(102);
    let mut counts = vec![0; 102];
    for m in 2..n+1 {
        let mut m = m;
        for p in 2..m+1 {
            if !ps[p] { continue }
            while m % p == 0 {
                counts[p] += 1;
                m /= p;
            }
        }
    }
    let mut ans = 0;
    ans += counts.iter().filter(|&x| *x >= 74).count();
    ans += counts.iter().filter(|&x| *x >= 24).count() * (
        counts.iter().filter(|&x| *x >= 2).count() - 1);
    ans += counts.iter().filter(|&x| *x >= 14).count() * (
        counts.iter().filter(|&x| *x >= 4).count() - 1);
    ans += n2c(counts.iter().filter(|&x| *x >= 4).count()) * (
        counts.iter().filter(|&x| *x >= 2).count() - 2);
    put!(ans);
}

use std::io::{self, Write};
use std::str::FromStr;
use std::collections::VecDeque;

struct Scanner { stdin: io::Stdin, buffer: VecDeque<String>, }
impl Scanner {
    fn new() -> Self { Scanner { stdin: io::stdin(), buffer: VecDeque::new() } }
    fn cin<T: FromStr>(&mut self) -> T {
        while self.buffer.len() == 0 {
            let mut line = String::new();
            let _ = self.stdin.read_line(&mut line);
            for w in line.split_whitespace() {
                self.buffer.push_back(String::from(w));
            }
        }
        self.buffer.pop_front().unwrap().parse::<T>().ok().unwrap()
    }
}


Measured memory_bytes: 4352
#include <iostream>
#include <vector>
#include <algorithm>

int main() {
  size_t N;

  std::cin >> N;

  std::vector<size_t> A(N);

  for (size_t i=0; i<N; i++)
    std::cin >> A[i];

  std::sort(A.begin(), A.end());

  auto i_min = A.begin();
  auto i_max = std::prev(A.end());

  auto i_med = N%2==1 ? std::next(i_min, N/2) : A.end();

  unsigned long long ans = *i_max - *i_min;

  while (true) {
    std::advance(i_max, -1);
    if (i_min == i_max) break;
    if (i_max == i_med) {
      ans += std::max(*i_max - *i_min,
                      *std::next(i_max) - *i_max);
    } else {
      ans += *i_max - *i_min;
    }

    std::advance(i_min, 1);
    if (i_min == i_max) break;
    ans += *std::next(i_max) - *i_min;

    std::advance(i_min, 1);
    if (i_min == i_max) break;
    if (i_min == i_med) {
      ans += std::max(*i_max - *i_min,
                      *i_min - *std::prev(i_min));
    } else {
      ans += *i_max - *i_min;
    }

    std::advance(i_max, -1);
    if (i_min == i_max) break;
    ans += *i_max - *std::prev(i_min);
  }

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

  return 0;
}


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


int main() {
  int n;
  cin >> n;
  vector<int> R(n);

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

  vector<int> minOfRAppearedBefore(n);

  minOfRAppearedBefore[0] = R[0];
  for(int i = 1; i < n; i++) {
    minOfRAppearedBefore[i] = min(minOfRAppearedBefore[i - 1], R[i]);
  }

  int ans = - 1000000000;

  for(int i = 1; i < n; i++) {
    ans = max(R[i] - minOfRAppearedBefore[i - 1], ans);
  }

  cout << ans << endl;
}

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

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

  vector<string> vec(n);
  for (int i = 0; i < n; ++i) cin >> vec[i];

  int a = 0, b = 0, c = 0, d = 0;

  for (int i = 0; i < n; ++i) {
    if (vec[i] == "AC") ++a;
    else if (vec[i] == "WA") ++b;
    else if (vec[i] == "TLE") ++c;
    else ++d;
  }

  cout << "AC" << " x " << a << "\n";
  cout << "WA" << " x " << b << "\n";
  cout << "TLE" << " x " << c << "\n";
  cout << "RE" << " x " << d << "\n";

  return 0;
  
  }

Measured memory_bytes: 6408
#include <bits/stdc++.h>
using namespace std;
using namespace std::chrono;
#define idfc ios_base::sync_with_stdio(false),cin.tie(nullptr),cout.tie(nullptr)
//#define ll long long
#define pb emplace_back
#define mp make_pair
#define nt _ll128
#define ld long double
long double PI =3.14159265358979323846;
using ll = long long;



const ll modo=1e9+7;
const ll inf=LONG_LONG_MAX;
const ll ms=(2e5)+5;

ll ar[ms]={0};
ll br[ms]={0};


ll go(ll x,ll r)
{
    ll l=1;
    ll md;
  //  ll a=0;
    while(l<=r)
    {
        md=(l+r)>>1;
        if(br[md]<=x)
        {
           // a=max(a,md);
            l=md+1;
        }
        else r=md-1;
    }
    return r;
}

int main()
{
    idfc;
    ll n,m,k;
    cin>>n>>m>>k;
    ll i;
    for(i=1;i<=n;i++)
    {
        cin>>ar[i];
        ar[i]+=ar[i-1];
    }
    for(i=1;i<=m;i++)
    {
        cin>>br[i];
        br[i]+=br[i-1];
    }
    ll ans=0;
    ll t;
    for(i=0;i<=n;i++)
    {
        if(ar[i]<=k)
        {
          t=k-ar[i];
          ans=max(ans,i+go(t,m));
        }
        else break;
    }
    cout<<ans;


    return 0;
}

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


int main() {
    int H,W;
    cin>>H>>W;
    vector<vector<char> > S(H, vector<char>(W));

    for(int i=0; i<H; i++) {
        for(int j=0; j<W; j++) {
            cin>>S[i][j];
        }
    }

    for(int i=0; i<H; i++) {
        for(int j=0; j<W; j++) {
            int count=-1;
            if(S[i][j]=='.') {
                count=0;
                for(int x=-1; x<=1; x++) {
                    for(int y=-1; y<=1; y++) {
                        int nx=j+x, ny=i+y;
                        if(0<=ny&&ny<H && 0<=nx&&nx<W) {
                            if(S[ny][nx]=='#') ++count;
                        }
                    }
                }
            }
            if(count==-1) cout<<S[i][j];
            else cout<<count;
        }
        cout<<endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
typedef long long int lli;

int main(){
	int n,a;
	cin >> n >> a;
	vector<vector<lli> > dp(2, vector<lli>(2501, 0));
	dp[0][0] = dp[1][0] = 1;
	int just = 0;
	for(int i=0; i<n; i++){
		int x,s;
		cin >> x;
		if(x==a){
			just++;
			continue;
		}else if(x>a){
			s=0;
		}else{
			s=1;
		}
		x = abs(a-x);
		for(int j=2500; j>=0; j--){
			if(dp[s][j]!=0  && j+x<=2500){
				dp[s][j+x] += dp[s][j];
			}
		}
	}
	lli ans=0;
	for(int i=0; i<=2500; i++){
		ans += dp[0][i]*dp[1][i];
	}
	for(int i=0; i<just; i++){
		ans *= 2;
	}
	cout << ans -1 << endl;
	return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#define rep(i, j) for (int i = 0; i < j; i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
using ull = unsigned long long;

ll gcd(ll x, ll y);
int fac(ll n, vector<int> num);

const int INF = 1001001001;

//mint�p�̒萔 (10��9��)
const int mod = 1000000007;

struct mint {
    ll x; // typedef long long ll;
    mint(ll x = 0) :x((x% mod + mod) % mod) {}
    mint operator-() const { return mint(-x); }
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod - a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this; }
    mint operator+(const mint a) const { return mint(*this) += a; }
    mint operator-(const mint a) const { return mint(*this) -= a; }
    mint operator*(const mint a) const { return mint(*this) *= a; }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t >> 1);
        a *= a;
        if (t & 1) a *= *this;
        return a;
    }

    // for prime mod
    mint inv() const { return pow(mod - 2); }
    mint& operator/=(const mint a) { return *this *= a.inv(); }
    mint operator/(const mint a) const { return mint(*this) /= a; }
};
istream& operator>>(istream & is, const mint & a) { return is >> a.x; }
ostream& operator<<(ostream & os, const mint & a) { return os << a.x; }

int main() {
    int n;
    cin >> n;
    int ans = INF;
    vector<int> a(n);
    rep(i, n) cin >> a[i];

    for (int i = -100; i < 101; i++) {
        int num = 0;
        for (int j = 0; j < n; j++) {
            num += (a[j] - i) * (a[j] - i);
        }
        ans = min(num, ans);
    }
    cout << ans << endl;
    return 0;
}

/*���C�u�����ő����*/
//���[�O���b�h�̌ݏ��@
ll gcd(ll x, ll y) {
    ll num[3];
    num[0] = (x > y) ? x : y;
    num[1] = (x <= y) ? x : y;
    num[2] = num[0] % num[1];

    while (num[2]) {
        num[0] = num[1];
        num[1] = num[2];
        num[2] = num[0] % num[1];
    }

    return num[1];
}

/*�f��������*/
//���색�C�u����
int fac(ll n, vector<int> num) {
    ll kazu = n;
    for (int i = 2; i <= sqrt(n); i++) {
        while (1) {
            if (kazu % i != 0) break;

            kazu /= i;
            num[i]++;
        }
    }
    if (kazu == n && n != 1) return 1;
    int ans = 0;
    if (kazu != 1) ans++;
    for (int i = 2; i <= sqrt(n); i++) {
        for (int j = 1; j <= num[i]; j++) {
            num[i] -= j;
            ans++;
        }
    }
    return ans;
}

Measured memory_bytes: 3724
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main(){
  long long N;
  cin >> N;
  long long ans=N;
  for(long long i=1;i*i<=N;i++){
    if(N%i==0){
      int a = to_string(i).length();
      int b = to_string(N/i).length();
      if(a<b && ans>b){
        ans = b;
      }else if(a>=b && ans>a){
        ans = a;
      }
    }
  }
  cout << ans << endl;
}

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

#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)<(b)?(a):(b))
#define abs(a) max((a),-(a))

typedef long long LL;
typedef long long ll;
typedef pair<int,int> P;
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)

const ll mod=1000000007;
const ll INF=mod*mod;

struct query{int l,r,x,y,ind;};
struct ans{int lx,rx,ly,ry;};
query qq[100000];
int inv[100000];
int tra[100000];
vector<pair<string,int>> v1,v2;
ans z[100000];
int n;
int bit[100001];
int sum(int i){
  if(i==0)return 0;
  int s=0;
  while(i>0){
    s+=bit[i];
    i-=i&-i;
  }
  return s;
}
void add(int i,int x){
  while(i<=n){
    bit[i]+=x;
    i+=i&-i;
  }
}
struct qqu{int loc,ind,c;};
vector<qqu> qquu;
bool comp(qqu a,qqu b){
  return a.loc<b.loc;
}
string tratra(string xx){
  int len=xx.length();
  xx[len-1]++;
  return xx;
}
int main(){
  int q;
  cin >> n >> q;
  vector<string> word(n),word2(n);
  for(int i=0;i<n;i++){
    string in;cin>>in;
    word[i]=in;
    v1.push_back({in,i});
    reverse(in.begin(),in.end());
    word2[i]=in;
    v2.push_back({in,i});
  }
  vector<string> pre(q),suf(q);
  sort(word.begin(),word.end());
  sort(word2.begin(),word2.end());
  sort(v1.begin(),v1.end());
  sort(v2.begin(),v2.end());
  rep(i,n){
    tra[v1[i].second]=i;
  }
  rep(i,n){
    inv[i]=tra[v2[i].second]+1;
  }
  for(int i=0;i<q;i++){
    cin >> pre[i] >> suf[i];
    reverse(suf[i].begin(),suf[i].end());
    int le=lower_bound(word.begin(),word.end(),pre[i])-word.begin();
    int ri=lower_bound(word.begin(),word.end(),tratra(pre[i]))-word.begin();
    int le2=lower_bound(word2.begin(),word2.end(),suf[i])-word2.begin();
    int ri2=lower_bound(word2.begin(),word2.end(),tratra(suf[i]))-word2.begin();
    qq[i]={le,ri,le2,ri2,i};
    qquu.push_back({le2,i,0});qquu.push_back({ri2,i,1});
  }
  sort(qquu.begin(),qquu.end(),comp);
  int now=0;
  int si=2*q;
  rep(i,n+1){
    while(now<si&&qquu[now].loc==i){
      int id=qquu[now].ind;
      if(qquu[now].c==0){
        z[id].lx=sum(qq[id].l);
        z[id].rx=sum(qq[id].r);
      }
      else{
        z[id].ly=sum(qq[id].l);
        z[id].ry=sum(qq[id].r);
      }
      now++;
    }
    if(i<n){
      add(inv[i],1);
    }
  }
  rep(i,q){
    cout<<z[i].ry-z[i].rx-(z[i].ly-z[i].lx)<<endl;
  }
  return 0;
}



Measured memory_bytes: 45920
#include <cstdio>

int main(void) {
  	int N, Y;
  	std::scanf("%d %d", &N, &Y);
  
  	int D = Y / 1000 - N;
  	for(int a = 0; true; ++a) {
      	if(10000 * a > Y)    break;
      	if(a > N)            break;
      
      	int tmp = D - 9*a;
      	if(tmp % 4 == 0) {
          	int b = tmp / 4;
            int c = N - a - b;
            
            if(b < 0) continue;
            if(c < 0) continue;
          
          	std::printf("%d %d %d\n", a, b, c);
          	return 0;
        }
    }
  
  	std::printf("-1 -1 -1\n");
}


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

int main(){ 
    cout << fixed << setprecision(6);
    double a,b,c,d,e;
    cin>>a>>b>>c>>d;
    e=a*b/2.0;
cout << (double)e;
cout<<' ';
if(a/c==2&&b/d==2){
    cout<<1;
}else{
    cout <<0;
}
    return 0;
}



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

using namespace std;

int main() {
    vector<int> src(3), dst{ 5, 5, 7 };
    for (int i = 0; i < 3; ++i) {
        cin >> src[i];
    }
    sort(src.begin(), src.end());
    cout << (src == dst ? "YES" : "NO") << endl;

    return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"

using namespace std;
using ll = long long;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
	REP(i, v.size()) { if (i)os << " "; os << v[i]; }return os;
}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
	REP(i, v.size()) { if (i)os << endl; os << v[i]; }return os;
}

const ll INF = LLONG_MAX;
ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;

#define int long long

inline void my_io() {

	std::ios::sync_with_stdio(false);

	std::cin.tie(0);

	cout << fixed << setprecision(16);

	//cout << setprecision(10) << scientific << ans << endl;
}

signed main() {
	string s;

	cin >> s;

	reverse(s.begin(), s.end());

	vector<vector<ll>> dp(s.size(), vector<ll>(13, 0));

	if (s[0] == '?') {
		REP(i, 10) {
			dp[0][i] = 1;
		}
	}
	else {
		dp[0][(s[0] - '0')] = 1;
	}

	ll now = 10;
	
	FOR(i, 1, s.size()) {
		if (s[i] == '?') {
			REP(j, 10) {
				ll x = (j * now) % 13;
				REP(k, 13) {
					dp[i][k] += dp[i - 1][(k + 13 - x) % 13];
					dp[i][k] %= MOD;
				}
			}
		}
		else {
			ll x = ((s[i] - '0') * now) % 13;
			REP(j, 13) {
				dp[i][j] += dp[i - 1][(j + 13 - x) % 13];
				dp[i][j] %= MOD;
			}
		}

		now *= 10;
		now %= 13;
	}

	cout << dp[s.size() - 1][5] % MOD << endl;
}

Measured memory_bytes: 13696
import math
def s(x):
    r=0
    s=math.sqrt(x)
    s=(int)(s)
    for i in range(2,s+1):
        w=x%i
        if w==0:
            r=r+1
    return r
N=int(input())
A=[0 for i in range(N)]
for i in range(N):
    A[i]=int(input())
t=0
i=2
for i in range(N):
    r=s(A[i])
    if r==0:
        t=t+1
print(t)



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

int main() {
  int a, b, answer;
  string op;
  cin >> a >> op >> b;
  
  if (op == "+") {
    answer = a + b;
  }
  else {
    answer = a - b;
  }
  
  cout << answer << endl;
}


Measured memory_bytes: 256
def abc080_c():
    import numpy as np
    import itertools

    n = int(input())
    f = np.array([list(map(int, input().split())) for _ in range(n)])
    p = np.array([list(map(int, input().split())) for _ in range(n)])
    benefits = np.array([], dtype=int)

    for i in range(1, 11):
        for seq in itertools.combinations([i for i in range(10)], i):
            tmp = 0
            for j in range(n):
                tmp += p[j][sum(f[j][np.array(seq)])]
            benefits = np.append(benefits, tmp)

    print(max(benefits))


abc080_c()

Measured memory_bytes: 14444
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <functional>
#include "math.h"
#include <set>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define VI vector<int>
#define debug(x) cout<<#x<<": "<<x<<endl
#define DEBUG(x) cout<<#x<<": "<<x<<endl
 

string S; 
VI ans;  
int main()
{
  cin >> S;
  ans.resize(S.length());
  int R = 0;
  int L = 0;
  int p = 0;
  bool RL = true;
  REP(i,S.length()){
    if(RL){
      if(S[i] == 'L'){
        R = i-1;
        L = i;
        ans[R] =  1+(p-1)/2;
        ans[L] =  1+(p-1)/2+(p-1)%2;
        RL = false;
      }else{
        p++;
      }
    } else {
      if(S[i] == 'R'){
        p = 1;
        RL = true;
      }else{
        if((i-L)%2==1){
          ans[R]++;
        }else{
          ans[L]++;
        }
      }
    }
  }
    REP(i,S.length()){
      cout << ans[i] << " ";
    }
}


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

int debug = 1;

const int INF = 1001001001;
const int di[]={-1,0,1,0};
const int dj[]={0,-1,0,1};

int main(){
    int h,w;
    cin >> h >> w;
    vector<string> s(h);
    rep(i,h) cin >> s[i];
    int ans =0;
    rep(si,h)rep(sj,w){
        if(s[si][sj]=='#')continue;
        vector<vector<int>> dist(h,vector<int>(w,INF));
        queue<P> q;
        auto update = [&](int i, int j, int x){
            if(dist[i][j] != INF) return;
            dist[i][j]=x;
            q.push(P(i,j)); 
        };
        update(si,sj,0);
        while(!q.empty()){
            int i=q.front().first;
            int j=q.front().second;q.pop();
            rep(dir,4){
                int ni=i+di[dir],nj=j+dj[dir];
                if(ni<0||ni>=h||nj<0||nj>=w)continue;
                if(s[ni][nj]=='#')continue;
                update(ni,nj,dist[i][j]+1);
            }
        }
        rep(i,h)rep(j,w){
            if(dist[i][j]==INF)continue;
            ans = max(ans,dist[i][j]);
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
//#pragma GCC optimize("Ofast")

#pragma GCC optimize("O3")
//#pragma GCC target("avx,avx2,fma")
#include<iostream>
#include<algorithm>
#include<string>
#include<cmath>
#include<cstdlib>
#include<set>
#include<vector>
#include<sstream>
#include<queue>
#include <iomanip>
#include<unordered_set>
#include <stack>
#include <unordered_map>
#include <map>
constexpr auto INF = 9223372036854775807;
typedef long long int ll;
typedef unsigned long long int ull;
typedef unsigned long int ul;
#define f(i,a,b) for(ll i=(ll)a;i<(ll)b;i+=1)
#define rf(i,a,b) for(ll i=(ll)a;i>=(ll)b;i-=1)
#define endl '\n'
#define N 1000000007// prime modulo value 
#define C 1000000001
#define M 998244353
#define all(x) x.begin(),x.end()
using namespace std;
// From Geeksforgeeks
inline ll gcd(ll a, ll b)
{
	if (b == 0)
		return a;
	return gcd(b, a % b);
}
// Power function took from geeksforgeeks
ll power(ll x, ll y)
{
	ll res = 1;

	x = x;
	if (x == 0) return 0;
	while (y > 0)
	{
		if (y & 1)
			res = (res * x);
		y = y >> 1;
		x = (x * x);
	}
	return res;
}
double dist(ll x1,ll y1, ll x2,ll y2)
{
	double ans = sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
	return ans;
}
int main()
{
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	ll a;
	string s;
	cin >> a >> s;
	if (a < 3200)
		cout << "red";
	else
		cout << s;
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cstdlib>
#include<queue>
#include<set>
#include<cstdio>

using namespace std;

#define ll long long
#define rep(i, n) for(int i = 0; i < n; i++)
#define P pair<int, int>

typedef vector<int> vec;
typedef vector<vec> mat;

int main(){
    int a, b;
    cin >> a >> b;
    if(a >= 13) cout << b << endl;
    else if(a <= 5) cout << 0 << endl;
    else cout << b / 2 << endl;
}

Measured memory_bytes: 3568
#define __USE_MINGW_ANSI_STDIO 0
#include <bits/stdc++.h>

using namespace std;
using ll = long long;
#define int ll
using VI = vector<int>;
using VVI = vector<VI>;
using PII = pair<int, int>;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define PB push_back

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const int MOD = 1000000007;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template <typename T> bool IN(T a, T b, T x) { return a<=x&&x<b; }
template<typename T> T ceil(T a, T b) { return a/b + !!(a%b); }
template<class S,class T>
ostream &operator <<(ostream& out,const pair<S,T>& a){
  out<<'('<<a.first<<','<<a.second<<')';
  return out;
}
template<class T>
ostream &operator <<(ostream& out,const vector<T>& a){
  out<<'[';
  REP(i, a.size()) {out<<a[i];if(i!=a.size()-1)out<<',';}
  out<<']';
  return out;
}

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

double dp[505][505];
signed main(void)
{
  cin.tie(0);
  ios::sync_with_stdio(false);

  int n, m;
  cin >> n >> m;
  VI a(n);
  REP(i, n) cin >> a[i];

  VI sum(n);
  sum[0] = a[0];
  FOR(i, 1, n) sum[i] = sum[i-1] + a[i];

  REP(i, 505) REP(j, 505) dp[i][j] = -1;
  REP(i, n) dp[i][1] = (double)sum[i]/(i+1);

  REP(i, n) REP(j, m) {
    if(dp[i][j] == -1) continue;
    FOR(k, i+1, n) {
      chmax(dp[k][j+1], dp[i][j] + (double)(sum[k]-sum[i])/(k-i));
    }
  }

  cout << fixed << setprecision(9) << dp[n-1][m] << endl;

  return 0;
}



Measured memory_bytes: 5304
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define printVec(v) printf("{"); for (const auto& i : v) { std::cout << i << ", "; } printf("}\n");
#define degreeToRadian(deg) (((deg)/360)*2*M_PI)
#define radianTodegree(rad) (((rad)/2/M_PI)*360)
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; }
using namespace std;
using P = pair<int,int>;
using ll = long long;
const ll INF = 1LL<<60;
const int MOD = 1e9 + 7;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

//cin.tie(0);ios::sync_with_stdio(false);
//cout << fixed << setprecision(15) << y << endl;
int main() {
  string s;
  cin >> s;

  if (s.back() == 's') {
    cout << s + "es" << endl;
  } else {
    cout << s + "s" << endl;
  }
  return 0;
}


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

int main(){
    int n, m, u, v;
    while(cin >> n >> m, n+m){
        vector<int> path[n+1], deg(n+1);
        vector<bool> visit(n+1, 0);
        while(m-- > 0){
            cin >> u >> v;
            deg[u]++; deg[v]++;
            path[u].push_back(v);
            path[v].push_back(u);
        }

        bool valid = true;
        for(int i = 1; i <= n; i++){
            if(!visit[i]){
                queue<int> q;
                q.push(i);
                int one = 0, two = 0, more = 0;
                while(!q.empty()){
                    int x = q.front();  q.pop();
                    if(visit[x])    continue;
                    if(deg[x] == 1) one++;
                    if(deg[x] == 2) two++;
                    if(deg[x] > 2)  more++;
                    visit[x] = true;
                    for(int next : path[x]){
                        if(!visit[next])    q.push(next);
                    }
                }
                if(one+two+more == 0 || (one == 2 && more == 0))  continue;
                else valid = false;
            }
        }

        if(valid)   cout << "yes" << endl;
        else        cout << "no" << endl;
    }

    return 0;
}


Measured memory_bytes: 6864
x, n = map(int, input().split())
p = list(map(int, input().split()))

if n == 0:
    print(x)
    exit()

cnt = [0] *10001
ans1 = 0
ans2 = 0

for _p in p:
    cnt[_p] += 1

for i in range(x, 1000):
    if not i in p:
        ans1 = i
        break

for i in range(x-1, -1000, -1):
    if not i in p:
        ans2 = i
        break

if abs(ans1 - x) < abs(ans2 - x):
    print(ans1)
elif abs(ans1 - x) >= abs(ans2 - x):
    print(ans2)

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

using namespace std;

int main(){
    int n;
    cin >> n;
    int dp[n+5][n+5];
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            dp[i][j]=-1;
        }
    }
    for(int i=0;i<n;i++){
        int a;
        cin >> a;
        for(int j=0;j<a;j++){
            int x,y;
            cin >> x >> y;
            x--;
            dp[i][x]=y;
        }
    }
    int m=-1; //正直者の最大値
    for(int i=0;i<(1<<n);i++){
        int t=1;
        for(int j=0;j<n;j++){
             //条件をクリアしているか管理
            if(i>>j&1){ //正直者について確かめる
                for(int k=0;k<n;k++){
                    if(dp[j][k]==-1){
                        continue;
                    }
                    int s=0;
                    if(i>>k&1){
                        s=1;
                    }
                    if(dp[j][k]==s){
                        continue;
                    }
                    else{
                        t=0;
                    }
                }
            }
            
            
            
        }
        if(t==1){
            int cnt=0;
            for(int j=0;j<n;j++){
                if(i>>j&1){
                cnt++;
                    
                }
                
            }
        m=max(cnt,m);
        }
        
    }
    cout << m << endl;
}

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

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

int main() {
    int H, W; cin >> H >> W;
    vector< vector<char> > s(H+2, vector<char>(W+2));
    int cnt = 0;
    for (int i = 0; i < W+2; i++) {
        s[0][i] = s[H+1][i] = '#';
    }
    for (int i = 1; i <= H; i++) {
        s[i][0] = s[i][W+1] = '#';
        for (int j = 1; j <= W; j++) {
            cin >> s[i][j];
            if (s[i][j] == '.') cnt++;
        }
    }
    queue< pair<int, int> > q;
    vector< vector<int> > check(H+2, vector<int>(W+2));
    q.push(make_pair(1,1));
    check[1][1] = 1;
    pair<int, int> tmp;
    while (!q.empty()) {
        tmp = q.front(); q.pop();
        for (int i = 0; i < 4; i++) {
            if (check[tmp.first+dy[i]][tmp.second+dx[i]] == 0 && s[tmp.first+dy[i]][tmp.second+dx[i]] == '.') {
                q.push(make_pair(tmp.first+dy[i], tmp.second+dx[i]));
                check[tmp.first+dy[i]][tmp.second+dx[i]] = check[tmp.first][tmp.second] + 1;
            }
        }
    }
    if (check[H][W] == 0) {
        cout << -1 << endl;
        return 0;
    }
    cout << cnt - check[H][W] << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>
using namespace std;

typedef long long ll;
#define INF ((ll)10000000000)
#define MAX_N (110)
typedef struct {
    ll r;
    ll c;
} Mat;

int n;
Mat M[MAX_N];
ll dp[MAX_N][MAX_N];

ll dfs(int i, int j)
{
    if ( j - i == 1 ) return 0;
    else if ( dp[i][j] ) return dp[i][j];
    else {
	ll ret = INF;
	for ( int k = i + 1; k < j; k++ ) {
	    ret = min(ret, dfs(i, k) + dfs(k, j) + M[i].r * M[k].r * M[j-1].c );
	}

	return dp[i][j] = ret;
    }
}

int main()
{
    scanf("%d", &n);

    for ( int i = 0; i < n; i++ ) {
	scanf("%lld %lld", &M[i].r, &M[i].c);
    }
    
    ll ans = dfs( 0, n );
    printf("%lld\n", ans);

    return 0;
}

Measured memory_bytes: 1120
import java.util.Scanner;

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

        int x = sc.nextInt();
        int y = sc.nextInt();
        if (x == 2 || y == 2)
            System.out.println("No");
        else if ((x == 4 || x == 6 || x == 9 || x == 11) && (y == 4 || y == 6 || y == 9 || y == 11))
            System.out.println("Yes");
        else if ((x == 1 || x == 3 || x == 5 || x == 7 || x == 8 || x == 10 || x == 12)
                && (y == 1 || y == 3 || y == 5 || y == 7 || y == 8 || y == 10 || y == 12))
            System.out.println("Yes");
        else
            System.out.println("No");
    }
}

Measured memory_bytes: 21844
#include<iostream>
#include<math.h>
#include<algorithm>
#define ll long long int
#define FOR(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define REP(i,n) FOR(i,0,n)
#define REP1(i,n) FOR(i,1,n)
  
using namespace std;

int main() {
	int c [ 3 ] [ 3 ];
	int x, y, z;
	REP(i,3) {
		REP(j,3) {
			cin >> c [ i ] [ j ];
		}
	}
	REP1(k,3) {
		x = c [ 0 ] [ 0 ] - c [ k ] [ 0 ];
		y = c [ 0 ] [ 1 ] - c [ k ] [ 1 ];
		z = c [ 0 ] [ 2 ] - c [ k ] [ 2 ];
		if ( x != y || y != z ) {
			cout << "No" << endl;
			return 0;
		} 
	} 
	cout << "Yes" << endl;
	return 0;	
}

Measured memory_bytes: 256
#include<stdio.h>

int main() {
	int a, b;
	int ans;
	char op, ch;
	while (1) {
		scanf("%d %c %d", &a, &op, &b);
		ch = getchar();
		switch (op)
		{
		case '+':
			ans = a + b;
			break;
		case '-':
			ans = a - b;
			break;
		case '*':
			ans = a * b;
			break;
		case '/':
			ans = a / b;
			break;
		case '?':
			return 0;
		default:
			break;
		}
		printf("%d\n", ans);
	}

	return 0;
}


Measured memory_bytes: 2748
#include<iostream>
#include<algorithm>
#include<stack>
#include<queue>
#include<string>
using namespace std;
#define INF 1<<21
#define DIV 1000000007

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

int main() {
  int n;
  string s;
  cin >> s;
  n = s.length();
  int flag = 0;

  for (int i = 1; i < n; i++) {
	for (int j = 0; j < i; j++) {
	  if (s[i] == s[j]) {
		flag = 1;
	  }
	}
  }

  if (flag==1) {
	cout << "no" << endl;
  }
  else {
	cout << "yes" << endl;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
string s;
map<int,int> mp;
long long  p=1,res;
int md[200500];
int main() {
    cin>>s;
    for(int i=s.length()-1;i>=0;i--) {
        md[i] = (md[i+1] + (s[i] - '0')*p) % 2019;
        if(md[i] == 0)
            res++;
        p = (p*10)%2019;
        res += mp[md[i]];
        mp[md[i]]++;
    }
    cout<<res<<endl;
}


Measured memory_bytes: 4536
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <sstream>
#include <unordered_map>
#include <vector>


#define INF 4000000000000000000LL
#define MOD 1000000007
#define ALL(x) std::begin(x), std::end(x)


int main(int argc, char** argv)
{
  std::cin.tie(0);
  std::ios_base::sync_with_stdio(0);

  std::cout << std::fixed << std::setprecision(6);
  std::cerr << std::fixed << std::setprecision(6);

  int N, a, C = 0;

  std::cin >> N;

  for (int i = 1; i <= N; i ++) {
    std::cin >> a;

    if (i % 2 == 1 && a % 2 == 1)
      C ++;
  }

  std::cout << C << std::endl;

  return 0;
}


Measured memory_bytes: 3636
#!/usr/bin/env python3
import sys

YES = "Yes"  # type: str
NO = "No"  # type: str


def solve(N: int, D: "List[List[int]]"):

    flag=0

    for i in range(N):

        if D[i][0] == D[i][1]:
            flag += 1
            if flag >= 3:
                print(YES)
                return
        else:
            flag=0
        
    print(NO)


    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    D = [[int(next(tokens)) for _ in range(2)] for _ in range(N)]  # type: "List[List[int]]"
    solve(N, D)

if __name__ == '__main__':
    main()


Measured memory_bytes: 9200
#include <iostream>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <cstring>
#define maxn 100000
using namespace std;

long long c[maxn+5], s[maxn+5];
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);

    int n;
    cin >> n;
    for(int i = 1; i <= n; i++){
        cin >> c[i];
    }//1-n

    sort(c, c+n+1);
    s[0] = 0;
    for(int i = 1; i <= n; i++){
        s[i] = s[i-1] + c[i];
    }

    int start = 1, k = 0;
    while(start < n && k < n){
        k = start;
        while(k < n && c[k+1] <= 2*s[k]) k++;
        if(k==n) break;
        start = k+1;
    }
    cout << (n-start+1);


    return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <vector>

using namespace std;
typedef long long ll;

int ans = 0;
vector <vector<int> > MAP;

int solve(int locateX,int locateY,int w,int h){
  //!
  if(locateX<0 || locateY<0 || locateX>=h || locateY>=w)return 0;
  //CHECK
  if(MAP[locateX][locateY]==1){
    MAP[locateX][locateY]=0;
    //!--
    solve(locateX,locateY+1,w,h);
    solve(locateX+1,locateY+1,w,h);
    solve(locateX+1,locateY,w,h);
    solve(locateX+1,locateY-1,w,h);
    solve(locateX,locateY-1,w,h);
    solve(locateX-1,locateY-1,w,h);
    solve(locateX-1,locateY,w,h);
    solve(locateX-1,locateY+1,w,h);
    //--!
    return 1;
  }
  return 0;
}

int ope(){
  int w,h;
  ans=0;
  MAP.resize(0);
  cin >> w >> h;
  if(!w&&!h)return 0;
  //INPUT
  for(int i=0;i<h;++i){
    vector<int> temp;
    for(int j=0;j<w;++j){
      int ti;
      cin >> ti;
      temp.push_back(ti);
    }
    MAP.push_back(temp);
  }
  //EXEC
  for(int i=0;i<h;++i)
    for(int j=0;j<w;++j)  
      ans+=solve(i,j,w,h);

  //OUTPUT
  cout << ans << endl;
  return 1;
}
int main(){
  while(ope()){}
}



Measured memory_bytes: 3244
//In the name of God:)
#include <bits/stdc++.h>
#define pb push_back
#define F first
#define S second
#define pii pair<int,int>
#define ll long long int
#define fast  ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
const int MAXN = 1e5 + 10;
# define PI 3.14159265358979323846
int main(){
    double n;
    cin>>n;
    double ans = n * 2 * PI;
    cout<<fixed<<setprecision(20)<<ans<<endl;
}


Measured memory_bytes: 3784
n=int(input())
A=list(map(int,input().split()))
x=A[-1]
i=-1
for j in range(n-1):
	if A[j]<=x:
		i=i+1
		A[i],A[j]=A[j],A[i]
A[i+1],A[-1]=A[-1],A[i+1]
print(*A[:i+1], end=' ')
print(f'[{A[i+1]}]', end=' ')
print(*A[i+2:])


Measured memory_bytes: 16404
import numpy as np

MOD = 1000000007


class Combination:
    def __init__(self, n):
        self.n = n
        self.fac, self.facinv = self.make_fact(n, MOD)

    def cumprod(self, arr,MOD):
        L = len(arr); Lsq = int(L**.5+1)
        arr = np.resize(arr,Lsq**2).reshape(Lsq,Lsq)
        for n in range(1,Lsq):
            arr[:,n] *= arr[:,n-1]; arr[:,n] %= MOD
        for n in range(1,Lsq):
            arr[n] *= arr[n-1,-1]; arr[n] %= MOD
        return arr.ravel()[:L]
    
    def make_fact(self, U,MOD):
        x = np.arange(U,dtype=np.int64); x[0] = 1
        fact = self.cumprod(x,MOD)
        x = np.arange(U,0,-1,dtype=np.int64); x[0] = pow(int(fact[-1]),MOD-2,MOD)
        fact_inv = self.cumprod(x,MOD)[::-1]
        return fact,fact_inv


    def nck(self, n, k):
        if k == 0 or n == k:
            return 1
        return self.fac[n] * self.facinv[k] % MOD * self.facinv[n-k] % MOD;

    def get(n):
        return self.fac[n]
    
    def getinv(n):
        return self.facinv[n]

if __name__ == "__main__":
    N, K = map(int, input().split())
    cb = Combination(100010)
    for i in range(1, K+1):
        ans = cb.nck(K-1, i-1)
        nokori = N - K - i + 1
        if nokori < 0:
            print(0)
            continue
        v = i+1
        ans *= cb.nck(v + nokori - 1, nokori)
        ans %= MOD
        print(ans)
    # X,Y = map(int, input().split())
    # cb = Combination(1000010)
    # if (X+Y) % 3 != 0:
    #     print(0)
    #     exit(0)
    # if X > Y:
    #     if X > 2*Y:
    #         print(0)
    #         exit(0)
    # else:
    #     if Y > 2*X:
    #         print(0)
    #         exit(0)
    # a = (2 * Y - X) // 3
    # b = (2 * X - Y) // 3
    # print(cb.nck(a+b, a))


Measured memory_bytes: 16312