akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define gc getchar
#define pb push_back
#define eb emplace_back
#define all(x) (x).begin(),(x).end()
#define x1 uvuvwevwevwe
#define y1 onyetenyevwe
#define x2 ugwemubwem
#define y2 ossas
typedef long long LL;
typedef long double LD;
typedef pair<int,int> pii;
template <typename T> void scan(T &angka){
	angka=0;char input=gc();T kali=1;
	while(!(48<=input&&input<=57)){	if(input=='-')	kali=-1;input=gc();}
	while(48<=input&&input<=57)	angka=(angka<<3)+(angka<<1)+input-48,input=gc();angka*=kali;
}
template <typename T1,typename T2> void scan(T1 &angka1,T2 &angka2){
	scan(angka1);scan(angka2);
}
int n;
const LL mods=998244353;
struct point{
	int x,y;
	point (int _x,int _y){
		x=_x;
		y=_y;
	}
	point(){
	}
};
struct M{
	LL x;
	M(LL angka){
		if(angka>=mods||angka<=-mods)
			angka%=mods;
		if(angka<0)
			angka+=mods;
		x=angka;
	}
	M(){
		x=0;
	}
	M operator*(const M &other) const{
		return M(x*other.x);
	}
	M operator+(const M &other) const{
		return M(x+other.x);
	}
	M operator-(const M &other) const{
		return M(x-other.x);
	}
	M operator-(){
		return M(-x);
	}
};
point plist[205];
vector <pii> urutan;
M pangkat[205],ans;
int fpb(int a,int b){
	if(b==0)
		return a;
	return fpb(b,a%b);
}
pii kecilkan(pii pecah){
	if(pecah.fi==0)
	{
		assert(pecah.se!=0);
		return mp(0,1);
	}
	if(pecah.se==0)
	{
		assert(pecah.fi!=0);
		return mp(1,0);
	}
	int bagi=fpb(abs(pecah.fi),abs(pecah.se));
	pecah.fi/=bagi;
	pecah.se/=bagi;
	if(pecah.fi*pecah.se<0)		//minus selalu di first
	{
		pecah.fi=-abs(pecah.fi);
		pecah.se=abs(pecah.se);
	}
	else
	{
		pecah.fi=abs(pecah.fi);
		pecah.se=abs(pecah.se);
	}
	return pecah;
}
void isipangkat(){
	pangkat[0]=1;
	for(int i=1;i<=n;i++)
		pangkat[i]=pangkat[i-1]*2;
}
void hitungansawal(){
	ans=pangkat[n]-1-n;
}
int main()
{
	scan(n);
	isipangkat();
	hitungansawal();
	for(int i=1;i<=n;i++)
	{
		scan(plist[i].x,plist[i].y);
	}
	//hitung ans modif
	for(int i=1;i<n;i++)
	{
		urutan.clear();
		for(int j=i+1;j<=n;j++)
			urutan.pb(kecilkan(mp(plist[j].x-plist[i].x,plist[j].y-plist[i].y)));
		sort(all(urutan));
		int totalkembar=0;
		pii last=urutan[0];
		for(auto isi:urutan)
		{
			if(isi!=last)
			{
				last=isi;
				ans=ans-(pangkat[totalkembar]-1);
				totalkembar=0;
			}
			totalkembar++;
		}
		ans=ans-(pangkat[totalkembar]-1);
	}
	cout<<ans.x<<endl;
}

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

#define INF 2000000005

int hsize=0;
int A[250];

int getPK(int i){
  if (i==0)return -INF;
  return A[(i-1)/2];
}

int getLK(int i){
  if (i*2+1>=hsize)return -INF;
  return A[i*2+1];
}

int getRK(int i){
  if (i*2+2>=hsize)return -INF;
  return A[i*2+2];
}

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

  for (int i=0;i<hsize;i++){
    cout << "node "<< i+1 <<": key = "<< A[i] <<", ";
    if (getPK(i)>-INF)cout << "parent key = "<< getPK(i) <<", ";
    if (getLK(i)>-INF)cout << "left key = "<< getLK(i)<<", ";
    if (getRK(i)>-INF)cout << "right key = "<< getRK(i) <<", ";
    cout << endl;
  }
  return 0;
}

Measured memory_bytes: 3096
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>

using namespace std;

int main()
{
    int n;
    
    scanf("%d",&n);
    
    int arr[n],sum=0;
    
    for(int i=0;i<n;i++)
    {
        scanf("%d",&arr[i]);
        sum+=arr[i];
    }
    
    int m;
    
    scanf("%d",&m);
    
    for(int i=0;i<m;i++)
    {
        int x,y;
        
        scanf("%d%d",&x,&y);
        
        x--;
        
        printf("%d\n",sum-arr[x]+y);
    }
    
    return 0;
}

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

int main() {
    int n;
    cin >> n;
    vector<string> texts;
    string s;
    rep(i,n) {
        cin >> s;
        sort(s.begin(), s.end());
        texts.push_back(s);
    }
    sort(texts.begin(), texts.end());
    string temp=texts[0];
    int count = 1;
    ll ans = 0;
    rep(i,n-1) {
        if (temp != texts[i+1]){
            ans += (ll)count*(count-1)/2;
            count = 1;
            temp = texts[i+1]; 
        }else{
            count++;
        }
    }
    ans += (ll)count*(count-1)/2; 
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 5748
#include<bits/stdc++.h>
#define ll long long
#define db double
#define pb push_back
#define rep(i,a,b)  for(ll i=a;i<=b;i++)
#define all(a) a.begin(),a.end()
using namespace std;

 ll mod=1e9 +7;
const ll M=500006;
ll f[M],inv[M];
ll expo(ll base,ll exponent){
    ll ans=1;
    while(exponent!=0){
        if(exponent&1) ans=(1LL*ans*base)%mod;
        base=(1LL*base*base)%mod;
        exponent>>=1;
    }
    return ans%mod;
}
void compute(){
    f[0]=1;
    rep(i,1,M-1){
        f[i]=(1LL*i*f[i-1])%mod;
    }
    inv[M-1]=expo(f[M-1],mod-2);
    for(ll i=M-2;i>=0;i--){
        inv[i]=(1LL*(i+1)*inv[i+1])%mod;
    }
}
ll C(ll n,ll r){
    return (1LL*((1LL*f[n]*inv[r])%mod)*inv[n-r])%mod;
}

vector<bool>  prime(1000002,true);
void Sieve() 
{ 
   
    for (int p=2; p*p<=1000001; p++) 
    { 
        // If prime[p] is not changed, then it is a prime 
        if (prime[p] == true) 
        { 
            for (int i=p*p; i<=1000001; i += p) 
                prime[i] = false; 
        } 
    } 
}

vector<ll>a(2000000);
ll func(ll val,ll n)
{
	ll cnt=0;
	for(ll i=0;i<n;i++)
	{
		ll tmp=a[i]/val;
		if(a[i]%val==0) tmp--;
		cnt+=tmp;
	}
	return cnt;
}

int main()
{
	// #ifndef ONLINE_JUDGE
 //    // for getting input from input.txt
    // freopen("alchemy_input.txt", "r", stdin);
 //    // for writing output to output.txt
    // freopen("output.txt", "w", stdout);
 //    #endif
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    // compute();
    ll tests=1,t=1;
   // cin>>tests;
    while(tests--)
    {
    	ll i,j,n,k;
    	cin>>n>>k;
    	ll mx=0;
    	rep(i,0,n-1) {cin>>a[i];mx=max(mx,a[i]);}
    	if(k==0) {cout<<mx; return 0;}
    	ll lo=1,hi=1e9;
    	while(hi>=lo)
    	{
    		ll mid=(lo+hi)/2;
    		ll tmp=func(mid,n);
    		// cout<<tmp<<"\n";
    		if(tmp>k) lo=mid+1;
    		else hi=mid-1;
    	}
    	cout<<lo;

    }

	return 0;
}

Measured memory_bytes: 18828
#![allow(unused_imports)]
use std::cmp::*;
use std::collections::*;
use itertools::Itertools;
use num::clamp;
use proconio::{input, marker::*, fastout};
use superslice::*;

#[fastout()]
fn main() {
    input! {
        n: usize,
        a: [i64; n]
    }

    let mut plus = Vec::new();
    let mut minus = Vec::new();
    let mut zeros = Vec::new();
    for v in a {
        match v.cmp(&0) {
            Ordering::Less => minus.push(v),
            Ordering::Equal => zeros.push(v),
            Ordering::Greater => plus.push(v),
        }
    }
    plus.sort();
    minus.sort();
    minus.reverse();
    let mut opes = Vec::new();
    if plus.is_empty() {
        zeros.append(&mut minus);
        minus = zeros;
        let mut prev = minus[0];
        for &v in minus.iter().skip(1) {
            opes.push((prev, v));
            prev -= v;
        }
    } else if minus.is_empty() {
        zeros.append(&mut plus);
        plus = zeros;
        let mut prev = plus[0];
        for &v in plus.iter().take(plus.len() - 1).skip(1) {
            opes.push((prev, v));
            prev -= v;
        }
        opes.push((*plus.last().unwrap(), prev));
    } else {
        zeros.append(&mut minus);
        minus = zeros;
        let mut prev = minus[0];
        for &v in plus.iter().take(plus.len() - 1) {
            opes.push((prev, v));
            prev -= v;
        }
            opes.push((*plus.last().unwrap(), prev));
            prev = *plus.last().unwrap() - prev;
        for &v in minus.iter().skip(1) {
            opes.push((prev, v));
            prev -= v;
        }
    }

    let (x, y) = *opes.last().unwrap();
    println!("{}", x - y);
    for (x, y) in opes {
        println!("{} {}", x, y);
    }
}


Measured memory_bytes: 6368
#include <bits/stdc++.h>
using namespace std;
///////////////////////////////////////////
const long long int INF = 1LL<<60;
const long long int Mod = 1000000007;
using ll = long long int; using ci = const int;
using vi = vector<int>;  using Vi = vector<long long int>;
using P = pair<int, int>;  using PLL = pair<ll, ll>;
using matrix = vector<vector<ll>>;
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define rp(i,N) for(ll i = 0; i < (ll)N; i++)
#define repi(i,a,b) for(ll i = ll(a); i < ll(b); ++i)
template<class T>bool chmax(T &former, const T &b) { if (former<b) { former=b; return true; } return false; }
template<class T>bool chmin(T &former, const T &b) { if (b<former) { former=b; return true; } return false; }
template<class T>T sqar(T x){ return x*x; }//sqrt(x)は平方根;
#define Sort(v) std::sort(v.begin(), v.end(), std::greater<decltype(v[0])>()) //降順でVをソート
#define p_queue(v) priority_queue<v, vector<v>, greater<v> >
template<class T> inline void princ(T x){cout<<x<<" ";}; 
template<class T> inline void print(T x){cout<<x<<"\n";};
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
///////////////////////////////////////////////////////////////////////////////////

int dcount(int x){
    int c=0;
    while(x>0){
        x/=2;
        c++;
    }
    return c;
}
int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    std::cout<<std::fixed<<std::setprecision(30);
    int L;
    cin >> L;
    int d=dcount(L);
    cout << d << " " << d*2-3+__builtin_popcount(L) << endl;
    repi(i,1,d){
        cout << i << " " << i+1 << " " << (1<<(d-1-i)) << endl;
        cout << i << " " << i+1 << " " << 0 << endl;
    }
    int sum=(1<<(d-1));
    for(int i=d-2; i>=0; i--){
        if(L&(1<<i)){
            cout << 1 << " " << d-i << " " << sum << endl;
            sum += (1<<i);
        }
    }
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO.Pipes;

namespace cswork
{
    class Program
    {
        public Program() { }

        Scanner cin;
        const int MAXIN = 1024;
        bool[] used = new bool[MAXIN];
        int[] perm = new int[MAXIN];

        List<int[]> permList = new List<int[]>();

        void Omame()
        {
            cin = new Scanner();
            int n = cin.nextInt();

            long ans = 0;

            long a = 2;
            long b = 1;

            for (int i = 1; i < n; i++)
            {
                long tmp = a + b;
                a = b;
                b = tmp;
            }

            Console.WriteLine(b);
        }

 
        static void Main(string[] args)
        {
            new Program().Omame();
        }

        public void Permutation(int pos, int n, int length)
        {
            if (pos == n)
            {
                permList.Add((int[])perm.Clone());
            }

            for (int i = 0; i < n; i++)
            {
                if (!used[i])
                {
                    perm[pos] = i;
                    used[i] = true;
                    Permutation(pos + 1, n, length);
                    used[i] = false;
                }
            }
        }
    }

    class Scanner
    {
        string[] s;
        int i;

        char[] cs = new char[] { ' ' };

        public Scanner()
        {
            s = new string[0];
            i = 0;
        }

        public string next()
        {
            if (i < s.Length) return s[i++];
            string st = Console.ReadLine();
            while (st == "") st = Console.ReadLine();

            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            i = 0;
            return next();
        }

        public int nextInt()
        {
            return int.Parse(next());
        }

        public long nextLong()
        {
            return long.Parse(next());
        }

        public double nextDouble()
        {
            return double.Parse(next());
        }
    }
}

Measured memory_bytes: 11220
n=gets.to_i
x=[];y=[];z=[]
kai=0
n.times{|i|x[i],y[i],z[i]=gets.split.map &:to_i;kai=i if z[i]>0}
ans1=0
ans2=0
for i in 0..100
  for j in 0..100
    ans=1
    h=0
    ans3=0
    h=z[kai]+(i-x[kai]).abs+(j-y[kai]).abs
    n.times{|g|
      next if z[g]==0
      ans3+=1
      if h != z[g]+(i-x[g]).abs+(j-y[g]).abs
        ans=0
      end
    }
    if ans==1
      if ans3<=1
        ans1=x[kai]
        ans2=y[kai]
        hai=z[kai]
        break
      else
      ans1=i
      ans2=j
      hai=h
      break
    end
  end
  end
end
printf("%d %d %d",ans1,ans2,hai)


Measured memory_bytes: 14204
#define _GLIBCXX_DEBUG
#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++)
#define ALL(v) v.begin(),v.end()
using ll = long long;
using pii = pair<int,int>;
using vi = vector<int>;
using vs = vector<string>;
using vb = vector<bool>;
using vll = vector<long long>;
using vpii = vector<pair<int,int>>;
using vivi = vector<vector<int>>;
using vbvb = vector<vector<bool>>;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
const int mod = 1000000007;
const int inf = 1001001001;



int main(void) {
  ll n;
  cin >> n;
  vector<pair<ll,ll>> a;
  for(ll i = 1;i*i<=n;i++){
    if(n%i==0)a.emplace_back(make_pair(i,n/i));
    
  }
  int ans = inf;
  for(auto p:a){
    
    ll s = p.first;
    ll t = p.second;
    int cnt= 0;
    int cnta = 0;
    while(s>=1){
      cnt++;
      s/=10;
    }
    while(t>=1){
      cnta++;
      t/=10;
    }
    ans = min(ans,max(cnt,cnta));
  }
  cout << ans << endl;
  
}




Measured memory_bytes: 256
n = int(input())
s = input().rstrip()

def solve(n, s):
    # 全探索
    cnt = 0
    for v in range(0, 1000):
        v = str(v)
        v = "0" * (3 - len(v)) + v
        idx = 0
        for i in range(len(s)):
            if s[i] == v[idx]:
                idx += 1
            if idx == 3:
                cnt += 1
                break
    print(cnt)
solve(n, s)

Measured memory_bytes: 40944
#include <iostream>
#include <algorithm>
#include <cmath>
#include <bitset>
#include <cstring>
#include <string.h>
#include <sstream>
#include <iomanip>
#include <queue>
#include <stack>
#include <deque>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <tuple>
#include <vector>
#include <stdio.h>
#include <stdlib.h>
using namespace std;
 
typedef unsigned long ul;
typedef unsigned long long ull;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
 
const ll MOD = 1e9+7;
const ll CFMOD = 998244353;
const double PI  = 3.14159265358;
const double EPS = 1e-8;
 
#define INT_MX 2147483647
#define INF ((int)1e9)
#define LLINF ((ll)1e18)
#define F first
#define S second
#define MP(x,y) make_pair(x,y)
#define sz(v) ((int)v.size())
#define rs(n) resize(n)
#define ALL(v) v.begin(),v.end()
#define reset(v) memset((v),0,sizeof(v))
#define EB emplace_back
#define PB push_back
#define PF push_front
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define REP(i,n,m) for(int i=(n);i<(m);i++)
#define vec vector
#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);

void solve(){
    int n, k;
    
    cin >> n >> k;
    vec<int> v(n), dp(n);

    rep(i,n)    cin >> v[i];
    dp[0] = 0;
    
    rep1(i,n-1) dp[i] = INF;
    
    rep1(i,n-1)  rep1(j,min(i,k))
        dp[i] = min(dp[i], dp[i-j] + abs(v[i] - v[i-j]));
        
    cout << dp[n-1] << '\n';
    
    
}
 
int main(){
    int t = 1;
    
    while(t--){
        solve();
    }
}


Measured memory_bytes: 1024
from collections import defaultdict
H,W=map(int,input().split())
c=defaultdict(int)
for i in range(H):
  s=input()
  for j in range(W):
    c[s[j]]+=1

if H%2==0 and W%2==0:
  for v in c.values():
    if v%4!=0:
      print("No")
      exit()
elif H%2==0 or W%2==0:
  k=0
  for v in c.values():
    if v%2!=0:
      print("No")
      exit()
    else:
      k+=v//4
  if k<(H//2)*(W//2):
    print("No")
    exit()
else:
  k=0
  f=0
  for v in c.values():
    if v%2!=0:
      if f==0:
        k+=v//4
        f=1
      else:
        print("No")
        exit()
    else:
      k+=v//4
  if k<(H//2)*(W//2):
    print("No")
    exit()
  
print("Yes")    

Measured memory_bytes: 40656
#include <iostream>
#include <vector>
#define INF 10000000
using namespace std;
int main(void) {
  int n, m, x;
  cin >> n >> m >> x;
  vector<int> c(n);
  vector<vector<int> > a(n, vector<int>(m));
  for (int i = 0; i < n; i++) {
    cin >> c[i];
    for (int j = 0; j < m; j++) {
      cin >> a[i][j];
    }
  }
  int ans = INF;
  for (int z = 1; z < 1 << n; z++) {
    vector<int> u(m, 0);
    int money = 0;
    for (int i = 0; i < n; i++) {
      if (z >> i & 1) {
        money += c[i];
        for (int j = 0; j < m; j++) {
          u[j] += a[i][j];
        }
      }
    }
    bool check = true;
    for (int i = 0; i < m; i++) {
      if (u[i] < x) {
        check = false;
      }
    }
    if (check && money < ans) ans = money;
  }
  if (ans == INF) {
    cout << -1 << endl;
  } else {
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 3628
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author TM
 */


#include <bits/stdc++.h>

using namespace std;

class CVacation {
public:
  void solve(std::istream &cin, std::ostream &cout) {
    int64_t n;
    cin >> n;
    vector<vector<int64_t>> vec(3, vector<int64_t>(n+1, 0));
    for (int i = 0; i < n; ++i) {
      int64_t a, b, c;
      vector<int64_t> input(3);
      for (int in = 0; in < 3; ++in) cin >> input[in];
      for (int j = 0; j < 3; ++j) { // 前日やったこと
        for (int k = 0; k < 3; ++k) { // 今日やること
          if(j == k)continue;
          vec[k][i+1] = max(vec[k][i+1] , vec[j][i] + input[k]);
        }
      }
    }
    cout << max({vec[0][n], vec[1][n], vec[2][n]}) << endl;
  }
};


int main() {
    CVacation solver;
    std::istream& in(std::cin);
    std::ostream& out(std::cout);
    solver.solve(in, out);
    return 0;
}


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

int main(){
 string S;
  cin >> S;
  bool k = true;
  for (int i = 0; i<3;i++){
   if (S.at(i) == S.at(i+1)) {
   k = false;
     break;
   }
  }
      if(k){
       cout << "Good" <<endl;
      }else{
        cout << "Bad" <<endl;
      }
}

Measured memory_bytes: 256
#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 main() {
   vector<int> vec={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  int k;
  cin >> k;
  cout << vec[k-1] << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <cmath>

using namespace std;
typedef pair<int, int> P;
typedef pair<P, int> PI;


void solve()
{
	int T, X;
	cin >> T >> X;
	printf("%.10f\n", (double)T / X);
}

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

Measured memory_bytes: 256
function Main(input) {
  input = input.split("\n");
  a = input[1].split(" ").map(Number);
  var odd = true;
  var ans = 0;
  while(odd){
    if(a.every(a=>a%2==0)){
      ans++;
      a = a.map(item=>item/2);
    }else{
      odd = false;
    }
  }
  console.log(ans);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7500
#include <bits/stdc++.h>
#define kyopro ios::sync_with_stdio(false);cin.tie(NULL)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define rep(i, s, N) for(ll i{s}; i < N; i++)
#define rem(i, N, s) for(ll i{N}; i > s; i--)
using namespace std;using ll = long long int;using ld = long double;using P = pair<ll,ll>;const int MOD = (int)1e9+7;const string rt = "\n";const string sp = " ";/* 最大公約数 */template<typename T> T gcd(T a, T b){return b != 0 ? gcd(b, a % b) : a;}/* UnionFind */template<typename T> struct UnionFind{vector<T> par;UnionFind(T n) : par(n, -1){}void init(T n){par.assign(n, -1);}T root(T x){if (par[x] < 0) return x;else return par[x] = root(par[x]);}bool issame(T x, T y){return root(x) == root(y);}bool merge(T x, T y){x = root(x); y = root(y);if(x == y) return false;if(par[x] > par[y]) swap(x, y);par[x] += par[y];par[y] = x;return true;}int size(int x) {return -par[root(x)];}};/* コンビネーション */template<typename T> ll combpm(T N_, T C_) {const int NUM_=400001;static ll fact[NUM_+1],factr[NUM_+1],inv[NUM_+1];if (fact[0]==0) {inv[1]=fact[0]=factr[0]=1;for (int i=2;i<=NUM_;++i) inv[i] = inv[MOD % i] * (MOD - MOD / i) % MOD;for (int i=1;i<=NUM_;++i) fact[i]=fact[i-1]*i%MOD, factr[i]=factr[i-1]*inv[i]%MOD;}if(C_<0 || C_>N_) return 0;return factr[C_]*fact[N_]%MOD*factr[N_-C_]%MOD;}/* 多次元ベクター */template<class T>vector<T> multi_vector(size_t a){return vector<T>(a);}template<class T, class... Ts>auto multi_vector(size_t a, Ts... ts){return vector<decltype(multi_vector<T>(ts...))>(a, multi_vector<T>(ts...));}/* テスト関数 */void test(ll n){cout << "test" << n << endl;}/* 小数点以下 */void fixsp(ll n){cout << fixed << setprecision(n);}void defsp(ll n){cout << defaultfloat << setprecision(n);}

/* ここからコード開始 */

int main(){
  kyopro;
  ll N, A, B;
  cin >> N >> A >> B;
  cout << min(N*A, B) << rt;
  
}

Measured memory_bytes: 256
DICT = {
  'C' => 0, 'C#' => 1, 'D' => 2, 'D#' => 3, 'E' => 4, 'F' => 5,
  'F#' => 6, 'G' => 7, 'G#' => 8, 'A' => 9, 'A#' => 10, 'B' => 11,
}

def check(stairs, music, k)
  music.size.downto(1) do |i|
    return false unless 1 <= k && k <= stairs.size && k <= i * 2
    tone = music[i - 1]
    stair = stairs[k - 1]
    case (tone - stair) % 12
    when 1
      k -= 2
    when 0
      k -= 1
    when 11
      k += 1
    else
      return false
    end
  end
  k == 0
end

def work(stairs, music)
  check(stairs, music, stairs.size - 1) || check(stairs, music, stairs.size)
end

s = STDIN.gets.to_i
s.times do
  STDIN.gets
  stairs = STDIN.gets.split.map!{|x| DICT[x]}
  music = STDIN.gets.split.map!{|x| DICT[x]}
  puts work(stairs, music) ? 'Yes' : 'No'
end

Measured memory_bytes: 17448
#include <iostream>
using namespace std;
int main (){
while (1){
long n,dset[5000],temp=0,max;
cin>>n;
if (n==0)break;
for (int i=0;i<n;i++){
        cin>>dset[i];
}
max=-1000000;
for (int i=0;i<n;i++){
        for (int j=i;j<n;j++){
                temp=temp+dset[j];
                if (max<temp){
                        max=temp;
                }
        }
temp=0;
}
cout<<max<<endl;
}
return 0;
}

Measured memory_bytes: 3096
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
const int N = 3010;
ll dp[N][N];
PII pre[N][N];
string s, t;

int main() {
    cin >> s >> t;
    int n = s.size();
    int m = t.size();
    for(int i = 1; i <= n; i ++) {
        for(int j = 1; j <= m; j ++) {
            if(dp[i][j-1] > dp[i-1][j]) {
                dp[i][j] = dp[i][j-1];
                pre[i][j] = {i, j-1};
            } else {
                dp[i][j] = dp[i-1][j];
                pre[i][j] = {i-1, j};
            }
            if(s[i-1] == t[j-1]) {
                if(dp[i-1][j-1] + 1 > dp[i][j]) {
                    dp[i][j] = dp[i-1][j-1] + 1;
                    pre[i][j] = {i-1, j-1};
                }
            }
        }
    }
    string res;
    int x = n;
    int y = m;
    while(x!=0 && y != 0) {
        int x_prev = pre[x][y].first;
        int y_prev = pre[x][y].second;
        if(x_prev != x && y_prev != y) {
            res += s[x_prev];
        }
        x = x_prev;
        y = y_prev;
    }
    reverse(res.begin(), res.end());
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 141568
#pragma GCC optimize(2)
#pragma GCC optimize(3)
#pragma GCC optimize("Ofast")
#pragma GCC optimize("inline")
#pragma GCC optimize("-fgcse")
#pragma GCC optimize("-fgcse-lm")
#pragma GCC optimize("-fipa-sra")
#pragma GCC optimize("-ftree-pre")
#pragma GCC optimize("-ftree-vrp")
#pragma GCC optimize("-fpeephole2")
#pragma GCC optimize("-ffast-math")
#pragma GCC optimize("-fsched-spec")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("-falign-jumps")
#pragma GCC optimize("-falign-loops")
#pragma GCC optimize("-falign-labels")
#pragma GCC optimize("-fdevirtualize")
#pragma GCC optimize("-fcaller-saves")
#pragma GCC optimize("-fcrossjumping")
#pragma GCC optimize("-fthread-jumps")
#pragma GCC optimize("-funroll-loops")
#pragma GCC optimize("-fwhole-program")
#pragma GCC optimize("-freorder-blocks")
#pragma GCC optimize("-fschedule-insns")
#pragma GCC optimize("inline-functions")
#pragma GCC optimize("-ftree-tail-merge")
#pragma GCC optimize("-fschedule-insns2")
#pragma GCC optimize("-fstrict-aliasing")
#pragma GCC optimize("-fstrict-overflow")
#pragma GCC optimize("-falign-functions")
#pragma GCC optimize("-fcse-skip-blocks")
#pragma GCC optimize("-fcse-follow-jumps")
#pragma GCC optimize("-fsched-interblock")
#pragma GCC optimize("-fpartial-inlining")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("-freorder-functions")
#pragma GCC optimize("-findirect-inlining")
#pragma GCC optimize("-fhoist-adjacent-loads")
#pragma GCC optimize("-frerun-cse-after-loop")
#pragma GCC optimize("inline-small-functions")
#pragma GCC optimize("-finline-small-functions")
#pragma GCC optimize("-ftree-switch-conversion")
#pragma GCC optimize("-foptimize-sibling-calls")
#pragma GCC optimize("-fexpensive-optimizations")
#pragma GCC optimize("-funsafe-loop-optimizations")
#pragma GCC optimize("inline-functions-called-once")
#pragma GCC optimize("-fdelete-null-pointer-checks")

#include <map>
#include <list>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#define endl '\n'
#define fast ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
using namespace std;
int n5,n7;
int main()
{
	for (register int i=1;i<=3;i++)
	{
		int x;
		cin>>x;
		if (x==5)
		   n5++;
		else if (x==7)
		   n7++;
	}
	if (n5==2 && n7==1)
	   cout<<"YES\n";
	else
	   cout<<"NO\n";
	return 0;
} 

Measured memory_bytes: 256
s = input()
ind = 0
len_s = len(s)
string = ""
cnt = 0
ans = 0
while ind < len_s:
    _s = s[ind]
    if _s == "A":
        cnt += 1
        ind += 1
    elif _s == "B" and ind + 1 < len_s and s[ind + 1] == "C":
        ind += 2
        ans += cnt
    else:
        cnt = 0
        ind += 1

print(ans)

Measured memory_bytes: 41564
# include <iostream>
using namespace std;
int main()
{
    int n;
    cin>>n;
    int*a=new int[n+1];
    int*b=new int[n+1];
    int*c=new int[n];
    for(int i=1;i<=n;i++) cin>>a[i];
    for(int i=1;i<=n;i++) cin>>b[i];
    for(int i=1;i<=n-1;i++) cin>>c[i];
    a[0]=-1;
    unsigned int ans=0;
    for(int i=1;i<=n;i++){
        if(a[i]-a[i-1]==1)ans+=c[a[i-1]];
        ans+=b[i];
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main() {
	int a, b;

	scanf("%d %d", &a, &b);

	if (a >= 13) {
		printf("%d\n", b);
	}
	else if (a >= 6) {
		printf("%d\n", b / 2);
	}
	else {
		printf("0\n");
	}

	return 0;
}

Measured memory_bytes: 128
N, M = list(map(int, input().split()))
X = list(map(int, input().split()))

X.sort()
x = [0]*(M-1)

for i in range(len(X)-1):
    x[i] = X[i+1] - X[i]

x.sort()

ans = 0
for j in range(0, len(x)-(N-1)):
    ans += x[j]

print(ans)


Measured memory_bytes: 13968
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;

#define all(v) v.begin(), v.end()

const ll mod=1000000007;

ll countBits(ll in){
  int res=0;
  for(;in>0;in>>=1){
    if((in&0x01)!=0){
      res++;
    }
  }
  return res;
}

template<typename T>
void show2dVector(vector<vector<T>>& v){
  for(int i=0;i<v.size();i++){
    int m=v[i].size();
    cout<<i<<" : ";
    for(int j=0;i<m;i++){
      cout<<v[i][j]<<" ";
    }
    cout<<endl;
  }
}

void bfs(const vector<vector<int>>&g, int v, vector<bool>& seen){
  seen[v]=true;
  cout<<v<<" ";
  for(auto next: g[v]){
    if(seen[next]){
      continue;
    }
    bfs(g,next,seen);
  }
}

bool dfs(vector<vector<int>> &g,int start,int goal,vector<bool>&seen){
  bool res=false;
  seen[start]=true;
  if(start==goal){
    return true;
  }
  for(auto next: g[start]){
    if(seen[next]){
      continue;
    }
    res=dfs(g,next,goal,seen);
    if(res){
      break;
    }
  }
  return res;
}

ll gcd(ll a,ll b) {
  return b? gcd(b,a%b): a;  
}
ll lcm(ll a,ll b) {
  return a*b/gcd(a,b);
}
bool isLowerCase(char c){
  return (c>='a'&&c<='z');
}

ll powm(ll a,ll n, ll m){
  ll ret=1;
  while(n>0){
    if(n%2==1){
      ret=(ret*a)%m;
    }
    n>>=1;
    a=(a*a)%m;
  }
  return ret;
}

const string yesno(bool ans){
  return (ans?"Yes":"No");
}
int main() {
  int n;cin>>n;
  int ans=n*(n+1)/2;
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <iomanip> // setprecision
#include <complex> // complex
#include <math.h> 
#include <climits> 
#include <assert.h>
#define rep(i,n) for(int i=0; i<(n); i++)
using namespace std;
using ll = long long;
using P = pair<int,int>;
constexpr ll INF = 1e18;
constexpr int inf = 1e9;
constexpr ll mod = 1000000007;
constexpr ll mod2 = 998244353;
const double PI = 3.1415926535897932384626433832795028841971;
const int dx[8] = {1, 0, -1, 0,1,1,-1,-1};
const int dy[8] = {0, 1, 0, -1,1,-1,1,-1};
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; }
// ---------------------------------------------------------------------------


int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll N;
    cin >> N;
    vector<ll> cnt(N+1,0);
    for(int i=1; i<=N; i++){
        for(int j=i; j<=N; j+=i){
            cnt[j]++;
        }
    }
    ll sum = 0;
    for(int i=1; i<=N; i++){
        sum += (ll)i*cnt[i];
    }
    cout << sum << "\n";
    return 0;
}

Measured memory_bytes: 81340
a = list(map(int,input().split()))
cnt = [0,] *(a[1]+1)
for i in range(a[0]):
    suki = list(map(int,input().split()))
    for j in range(1, len(suki)):
        cnt[suki[j]]+=1
ans = 0
for i in range(1, a[1]+1):
    if cnt[i] == a[0]:
        ans+=1
print(str(ans))

Measured memory_bytes: 3064
import heapq
import queue

n,m=map(int,input().split())
L=[]
for inp in range(n):
    a,b=map(int,input().split())
    L.append((a,b))
L.sort(reverse=True)

pq=[]
heapq.heapify(pq)

    
ans=0
for i in range(1,m+1):
    while len(L)>0 and L[-1][0]==i:
        heapq.heappush(pq,L.pop()[1]*-1)
    #print(pq)
    if len(pq)==0:
        continue
    else:    
        ans-=heapq.heappop(pq)

print(ans)




Measured memory_bytes: 18016
#include <iostream>
#include <queue>
#include <vector>
#include <algorithm>
#include <set>
#include <cmath>
#include <tuple>
#include <cstring>
#include <map>
#include <iomanip>
#include <ctime>
#include <complex>
#include <cassert>
#include <climits>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define _ << " " <<
#define all(X) (X).begin(), (X).end()
#define len(X) (X).size()
#define Pii pair<int, int>
#define Pll pair<ll, ll>
#define Tiii tuple<int, int, int>
#define Tlll tuple<ll, ll, ll>

ll gcd(ll a, ll b) {
    if (a < b) swap(a, b);
    ll r = a % b;
    while (r != 0) {
        a = b;  b = r;
        r = a % b;
    }
    return b;
}


vector<Pll> PF(ll n) {
    vector<Pll> fs;
    ll base = n;
    for (ll i = 2; i * i <= base; i++) {
        if (base % i == 0) {
            int cnt = 0;
            while (base % i == 0) {
                base /= i;
                cnt++;
            }
            fs.emplace_back(i, cnt);
        }
    }
    if (base > 1) fs.emplace_back(base, 1);
    return fs;
}


int main() {
    int p, q;
    cin >> p >> q;
    int g = gcd(p, q);
    vector<Pll> fs = PF(q / g);
    int ans = 1;
    for (auto &i : fs) ans *= i.first;
    cout << ans << endl;

}


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

int main() {

  int N, M;
  cin >> N >> M;

  vector<int> a(M);
  vector<int> b(M);

  for ( int i = 0; i < M; i++ ){
    cin >> a.at(i) >> b.at(i);
  }

  vector<int> d(N);

  for ( int i = 0; i < N; i++ ){
    for ( int j = 0; j < M; j++){
       if ( a.at(j) == i + 1 || b.at(j) == i + 1){
         d.at(i) += 1;
       }
    }
   
   cout << d.at(i) << endl;
  }
  
}

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

int main(){
  int n,f[100][10],p[100][11];
  cin>>n;
  for(int i=0;i<n;i++){
    for(int j=0;j<10;j++){
      cin>>f[i][j];
    }
  }
  for(int i=0;i<n;i++){
    for(int j=0;j<11;j++){
      cin>>p[i][j];
    }
  }
  long long ans=-(1<<30);
  for(int bit=1;bit<(1<<10);bit++){
    long long array[10]={},kaiten[n]={};
    long long rieki=0;
    for(int i=0;i<10;i++){
      if(bit&(1<<i)){
        array[i]++;
      }
    }
    for(int i=0;i<n;i++){
      for(int j=0;j<10;j++){
        if(array[j]==1&&f[i][j]==1){
          kaiten[i]++;
        }
      }
    }
    for(int i=0;i<n;i++){
      rieki+=p[i][kaiten[i]];
    }
    ans=max(rieki,ans);
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<stdio.h>
int dx[4] = {0,1,0,-1};
int dy[4] = {1,0,-1,0};

typedef struct{
  int B[4][4];
}board;

board P;

int heustric(){
  int i,j,x,y,sum=0;

  for(i=0;i<4;i++){
    for(j=0;j<4;j++){
      if(P.B[i][j] == 0) continue;
      x = (P.B[i][j] -1)%4 - j;
      y = (P.B[i][j] -1)/4 - i;

      if(x < 0) sum -= x;
      else sum += x;

      if(y < 0) sum -=y;
      else sum+= y;
    }
  }

  return sum;
}

int DFS(int x,int y,int max,int cnt,int n){
  int i,temp,x0,y0,time,h;

  h = heustric();
  if(h == 0) return cnt;
  else if(cnt + h > max) return -1;

  for(i=0;i<4;i++){
    x0 = x + dx[i];
    y0 = y + dy[i];

    if((i == (n +2)%4 && n!= -1) || (x0 < 0 || 4<= x0 || y0 < 0 || 4 <= y0)) continue;
    temp = P.B[y][x];
    P.B[y][x] = P.B[y0][x0];
    P.B[y0][x0] = temp;

    time = DFS(x0,y0,max,cnt+1,i);

    if(time != -1) return time;
    temp = P.B[y][x];
    P.B[y][x] = P.B[y0][x0];
    P.B[y0][x0] = temp;
  }

  return -1;
}

int main(){
  int i,j,x,y,time;
  board S;
  
    for(i=0;i<4;i++){
      for(j=0;j<4;j++){
	scanf("%d",&P.B[i][j]);
	if(P.B[i][j] == 0){
	  x = j;
	  y = i;
	}
      }
    }

    S = P;

    for(i=1;i<46;i++){
      P = S;

      time = DFS(x,y,i,0,-1);
      if(time != -1){
	printf("%d\n",time);
	break;
      }
    }

    return 0;
}
	  



Measured memory_bytes: 2140
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<iostream>
#include<queue>
#include<vector>
#include <bitset>
#include <cmath>
#include <limits>
#include <iostream>
#include<stack>
#include<tuple>
using namespace std;
#define INF 1100000000000
#define MAX 100000
#define MOD 1000000007
typedef long long ll;
typedef pair<int,int> P;
typedef pair<pair<int,int>,int> p;
typedef pair< pair<int,int>, int> p; 
#define bit(n,k) ((n>>k)&1) /*nのk bit目*/
#define rad_to_deg(rad) (((rad)/2/M_PI)*360)


int main(){
    int N; cin>>N;
    string s; cin>>s;
    if(N%2==1){
        cout<<"No"<<endl;
        return 0;
    }
    if(s.substr(0,N/2)==s.substr(N/2,N/2)) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}



Measured memory_bytes: 256
import heapq # 優先度付きキュー(最小値取り出し)
n,m = map(int, input().split())
a = list(map(int, input().split()))
a = list(map(lambda x: x*(-1), a))  # 各要素を-1倍

heapq.heapify(a)
for i in range(m):
    tmp = heapq.heappop(a)*(-1)   # 最大値の取り出し
    heapq.heappush(a, (-1)*(tmp//2)) # 1/2倍して最大値更新
print(-sum(a))

Measured memory_bytes: 73196
using System;
using System.IO;
using System.Collections.Generic;

class Program
{
    static void Main(string[] args)
    {
        new Program().Solve(new Input(Console.In));
    }

    public void Solve(Input input)
    {
        var a = input.ReadInt;
        var b = input.ReadInt;
        if ((a * b) % 2 == 0) Console.WriteLine("Even");
        else Console.WriteLine("Odd");
    }
}


public class Input
{
    private TextReader Stream { get; }
    private char Separator { get; }
    private Queue<string> InputStream { get; }

    public Input(TextReader stream, char separator = ' ')
    {
        Stream = stream;
        Separator = separator;
        InputStream = new Queue<string>();
    }

    public string Read
    {
        get
        {
            if (InputStream.Count != 0) return InputStream.Dequeue();
            string[] tmp = Stream.ReadLine().Split(Separator);
            for (int i = 0; i < tmp.Length; ++i)
                InputStream.Enqueue(tmp[i]);
            return InputStream.Dequeue();
        }
    }

    public string ReadLine => Stream.ReadLine();
    public int ReadInt => int.Parse(Read);
    public long ReadLong => long.Parse(Read);
    public double ReadDouble => double.Parse(Read);
}


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

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

using ll = long long;

const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int INF = 1<<30;
const double pi = 3.141592653589793;

int main() {
  int A,B,H,M;
  cin>>A>>B>>H>>M;
  int T = H*60+M;
  double ans = A*A+B*B-2*A*B*cos(11*T*pi/360);
  cout<<fixed<<setprecision(11);
  cout<<sqrt(ans)<<endl;
}

Measured memory_bytes: 4228
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define debug(x) cerr << "[(" << __LINE__ << ") " << (#x) << "]: " << x << endl;

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

    int d;
    cin >> d;
    
    int c[26];
    for (int& e: c) cin >> e;

    int s[d][26];
    for (int i=0; i<d; i++) {
        for (int j=0; j<26; j++) {
            cin >> s[i][j];
        }
    }

    int last[26] = {};
    ll cur = 0;
    for (int i=0; i<d; i++) {
        ll mx = -1e18, mi = 0;
        for (int j=0; j<26; j++) {
            ll tcur = cur;
            tcur += s[i][j];
            for (int k=0; k<26; k++) {
                if (k != j) tcur -= (i-last[k]+1) * c[k];
            }
            if (tcur > mx) {
                mx = tcur;
                mi = j+1;
            }
        }
        last[mi-1] = i+1;
        cout << mi << "\n";
    }
}


Measured memory_bytes: 3608
#include <bits/stdc++.h>
#define _for(i,b,e) for (common_type_t<decltype(b),decltype(e)> i = (b), i ## __end = (e); i < i ## __end; ++ i)
#define FOR(...)   _for (__VA_ARGS__)
#define rep(i,n)   FOR (i, size_t{}, n)
#define ALL(x)     begin (x), end (x)
using namespace std;
using ll = int64_t;

template <typename T>
auto make_vector (T && v)
{
  return forward <T> (v);
}

template <typename ... Args>
auto make_vector (size_t n, Args && ... args)
{
  auto value = make_vector (forward <Args> (args) ...);
  using T = decay_t <decltype (value)>;
  return vector <T> (n, move (value));
}

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

  auto a = make_vector (3, 3ull, 0);
  auto t = make_vector (3, 3ull, false);
  rep (i, 3) rep (j, 3) cin >> a[i][j];
  size_t n;
  cin >> n;
  rep (i_, n)
  {
    int b;
    cin >> b;
    rep (i, 3) rep (j, 3)
    {
      if (a[i][j] == b)
      {
        t[i][j] = true;
      }
    }
  }

  auto bingo = [&] ()
  {
    bool flag = true;
    rep (i, 3) flag = (flag && t[i][0]);
    if (exchange (flag, true)) return true;
    rep (i, 3) flag = (flag && t[i][1]);
    if (exchange (flag, true)) return true;
    rep (i, 3) flag = (flag && t[i][2]);
    if (exchange (flag, true)) return true;
    rep (i, 3) flag = (flag && t[0][i]);
    if (exchange (flag, true)) return true;
    rep (i, 3) flag = (flag && t[1][i]);
    if (exchange (flag, true)) return true;
    rep (i, 3) flag = (flag && t[2][i]);
    if (exchange (flag, true)) return true;
    rep (i, 3) flag = (flag && t[i][i]);
    if (exchange (flag, true)) return true;
    rep (i, 3) flag = (flag && t[i][2 - i]);
    if (exchange (flag, true)) return true;
    return false;
  };
  auto ans = bingo();
  cout << array <string, 2> {"No", "Yes"}[ans] << endl;
}


Measured memory_bytes: 256
use std::io;

fn procon_read<T: std::str::FromStr>() ->  Vec<T> {
	let mut buf = String::new();
	io::stdin().read_line(&mut buf).expect("");
	let iter = buf.split_whitespace();
	let mut v: Vec<T> = Vec::new();
	for i in iter {
		v.push(i.parse().ok().unwrap());
	}
	v
}

fn main() {
	let v: Vec<f64> = procon_read();
	let t = v[0];
	let x = v[1];
	println!("{}", t/x);
}

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

int main()
{
    int64_t N;
    vector<char> ans;
    cin >> N;
    while(N > 0){
        N -= 1;
        ans.push_back('a' + N % 26);
        N /= 26;
    }

    for (int i = ans.size() - 1; i >= 0; i--)
    {
        cout << ans[i];
    }
}

Measured memory_bytes: 3608
def resolve():
    W, H, N = list(map(int, input().split()))
    XYA = [list(map(int, input().split())) for i in range(N)]
    xmin, xmax, ymin, ymax = 0, W, 0, H
    for xya in XYA:
        if xya[2] == 1:
            xmin = max(xmin, xya[0])
        elif xya[2] == 2:
            xmax = min(xmax, xya[0])
        elif xya[2] == 3:
            ymin = max(ymin, xya[1])
        elif xya[2] == 4:
            ymax = min(ymax, xya[1])
    print(max(max(0,(xmax-xmin))*max((ymax-ymin), 0), 0))

if '__main__' == __name__:
    resolve()

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

int main() {
  string s;
  cin>> s;
  
  vector<char> mao(4);
  for (int i=0; i<4; i++) {
    mao.at(i) = s.at(i);
  }
  
  sort(mao.begin(),mao.end());
  
  if (mao.at(0)==mao.at(1) && mao.at(1)!=mao.at(2) && mao.at(2)==mao.at(3)) {
    cout<< "Yes"<<endl;
  }
  else {
    cout<< "No"<<endl;
  }
}


Measured memory_bytes: 256
mod = 10 ** 9 + 7
s = input()
n = len(s)
q = s.count('?')
dp = [[0] * (n + 1) for i in range(4)]

for i in range(n, -1, -1):
    for j in range(3, -1, -1):
        if i == n:
            if j == 3:
                dp[j][i] = 1
            else:
                dp[j][i] = 0

        else:
            if s[i] == '?':
                dp[j][i] = 3 * dp[j][i + 1]
            else:
                dp[j][i] = dp[j][i + 1]

            if j < 3 and (s[i] == '?' or s[i] == 'ABC'[j]):
                dp[j][i] += dp[j + 1][i + 1]

            dp[j][i] %= mod

print(dp[0][0])

Measured memory_bytes: 19016
using System;

namespace AIZUJudge {
    class Factorial {
        static void Main(string[] args) {
            string tmp = Console.ReadLine();
            if (string.IsNullOrEmpty(tmp)) {
                return;
            }
            int size_Set = int.Parse(tmp);

            for (int iter = 0; iter < size_Set; iter++) {
                Bigint[] data = new Bigint[2];
                for (int i = 0; i < 2; i++) {
                    data[i] = new Bigint(Console.ReadLine());
                }
                if (string.IsNullOrEmpty(data[0].actualNumber) || string.IsNullOrEmpty(data[1].actualNumber)) {
                    continue;
                }
                if (data[0].actualNumber.Length > 80 || data[1].actualNumber.Length > 80) {
                    Console.WriteLine("overflow");
                    continue;
                }
                if (data[0].actualNumber.Length < data[1].actualNumber.Length) {
                    Bigint tempo = data[0];
                    data[0] = data[1];
                    data[1] = tempo;
                }

                string solution = data[0].summention(data[1]);
                
                if (solution.Length > 80) {
                    Console.WriteLine("overflow");
                    continue;
                }
                Console.WriteLine(solution);
            }
       }
    }
    public class Bigint{
        public string actualNumber;
        public Bigint(string number) {
            actualNumber = number;
        }
        public string summention(Bigint opponent) {
            string solution = "";
            bool isNeedMoveUp = false;
            for (int i = actualNumber.Length - 1; i >= 0; i--) {
                int sum = 0;
                if (i - (actualNumber.Length - opponent.actualNumber.Length) < 0) {
                    sum = int.Parse(actualNumber.Substring(i, 1));
                } else sum = int.Parse(actualNumber.Substring(i, 1)) + int.Parse(opponent.actualNumber.Substring(i - (actualNumber.Length - opponent.actualNumber.Length), 1));


                if (isNeedMoveUp) {
                    sum++;
                    isNeedMoveUp = false;
                }

                if (sum >= 10) {
                    isNeedMoveUp = true;
                    solution = sum.ToString().Substring(1, 1) + solution;
                    continue;
                }
                solution = sum.ToString() + solution;
            }
            if (isNeedMoveUp) {
                solution = "1" + solution;
            }
            return solution;
        }
    }
}

Measured memory_bytes: 9168
/************************* In the name of Allah *************************/
#include <bits/stdc++.h>
using namespace std;

typedef long long       ll;
typedef long double     ld;
typedef string          str;
typedef pair<ll,ll>     pll;

#define F               first
#define S               second
#define pb              push_back
#define sep             ' '
#define endl            '\n'
#define fast_io         ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);

const ll MOD = 1e9 + 7,
         INF = 1e18,
         MAXN = 1e5 + 10;

const int N = 50;

bool cnt[N];

int a[N], b[N], c[N];

int main(){
    fast_io
    int n, m;
    cin >> n;
    for (int i = 0; i < n; i ++)
        cin >> a[i];
    int ans = 0;
    for (int i = 0; i < n; i ++)
    {
        cin >> m;
        ans += m;
    }
    for (int i = 1; i < n; i ++)
        cin >> c[i];
    for (int i = 1; i < n; i ++)
    {
        if (a[i] == a[i - 1] + 1)
        {
            ans += c[a[i] - 1];
        }
    }
    cout << ans;

    return 0;
}

/*
 __  __       _         _ _  _____ _           _                __ _
|  \/  |     | |       | (_)/ ____| |         | |              / _(_)
| \  / | __ _| |__   __| |_| (___ | |__   ___ | | _____  _   _| |_ _
| |\/| |/ _` | '_ \ / _` | |\___ \| '_ \ / _ \| |/ / _ \| | | |  _| |
| |  | | (_| | | | | (_| | |____) | | | | (_) |   < (_) | |_| | | | |
|_|  |_|\__,_|_| |_|\__,_|_|_____/|_| |_|\___/|_|\_\___/ \__,_|_| |_|
*/


Measured memory_bytes: 256
from bisect import *
N = int(input())
A = sorted(map(int, input().split()))
B = sorted(map(int, input().split()))
C = sorted(map(int, input().split()))

cnt = []

for b in B:
    cnt.append(bisect_left(A, b) * (N - bisect_right(C, b)))
print(sum(cnt))


Measured memory_bytes: 29508
# encoding: utf-8
S = input()

state = ""

for i, char in enumerate(S):
    # print(char,state)
    # error path
    if state == "":
        if char == "A": state = "A"
        else: state = "WA"
    elif state == "A":
        if char == "C" and i < 2: state = "WA"
        elif char == "C": state = "C"
        elif char.isupper(): state = "WA"
        else: continue
    elif state == "C":
        if char == "C": state = "WA"
        elif char.isupper(): state = "WA"
        else: state = "AC"
    else: # AC
        if char.isupper(): state = "WA"
    
else:
    if state == "AC": print("AC")
    else: print("WA")


Measured memory_bytes: 3064
# AOJ Volume6 0652
# http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0652

A, B, C = list(map(int, input().split()))

coins = 0
day = 0
while coins < C:
    day += 1
    coins += A
    if day % 7 == 0:
        coins += B
print(day)


Measured memory_bytes: 5596