akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<algorithm>
#include<bits/stdc++.h>
using namespace std;
/*---------------------DEBUGGING--------------------------------------------*/
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
/*-------------------------------------------------------------------------------------*/
#define mp make_pair
#define pb push_back
#define ll long long
#define pii pair<int,int>
#define pcc pair<char,char>
#define F first
#define S second
#define int long long
#define pi 3.141592653589793238462643383279502
#define M  1000000007
#define rep(i,a,n) for(int i=a;i<n;i++)
#define N 300005
#define vi vector<int>
#define all(v) v.begin(),v.end()

signed main()
{
   ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
   int n;
   cin>>n;
   string s,t;
   cin>>s>>t;
   string ans="";
   for(int i=0;i<n;i++)
   {
       ans+=s[i];
       ans+=t[i];
   }
   cout<<ans<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define st first
#define nd second
#define pb push_back
#define ppb pop_back
#define umax(x,y) x=max(x,y)
#define umin(x,y) x=min(x,y)
#define ll long long
#define ii pair<int,int>
#define iii pair<ii,int>
#define iiii pair<ii,ii>
#define sz(x) ((int) x.size())
#define orta ((bas+son)>>1)
#define all(x) x.begin(),x.end()
#define dbgs(x) cerr<<(#x)<<" --> "<<(x)<<" "
#define dbg(x) cerr<<(#x)<<" --> "<<(x)<<endl;getchar()
#define pw(x) (1<<(x))
#define inf 2000000000000303030
#define MOD 1000000007
#define N 200005
#define MAX 5000000
#define LOG 100
#define KOK 333
using namespace std;

int n,a,b;
ll pre[N];
ll ans=inf;
vector<pair<int,pair<int,int> > > gen;
vector<int> pos[N];

int main() {

	//freopen("input.txt","r",stdin);

	scanf("%d",&n);

	gen.pb({-1,{-1,-1}});

	for(int i=1;i<=n;i++) {

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

		gen.pb({a,{i,0}});
		gen.pb({b,{i,1}});

	}

	sort(all(gen));

	int ty=-1;
	bool flag=0;

	for(int i=1;i<=sz(gen)/2;i++) {

		if(ty==-1) ty=gen[i].nd.nd;
		else if(ty!=gen[i].nd.nd) flag=1;

	}

	if(!flag) {

		ll sum=0;

		for(int i=1;i<=sz(gen)/2;i++) sum+=gen[i].st;

		umin(ans,sum);

	}

	for(int i=1;i<sz(gen);i++) {

		pos[gen[i].nd.st].pb(i);

		pre[i]=pre[i-1]+gen[i].st;

	}

	for(int i=1;i<=n;i++) {

		int fi=pos[i][0]-1;
		int se=pos[i][1]-pos[i][0]-1;
		int th=2*n-pos[i][1];

		if(fi+2>=n) {

			umin(ans,pre[n-2]+1ll*gen[fi+1].st+1ll*gen[fi+se+2].st);

		}
		else if(fi+se+2>=n) {

			umin(ans,pre[n-1]+1ll*gen[fi+se+2].st);

		}
		else {

			umin(ans,pre[n]);

		}

	}

	printf("%lld",ans);

}

Measured memory_bytes: 12656
#include <bits/stdc++.h>
#define int long long
using namespace std;

signed main() {
  int N;
  cin >> N;
  vector<int> T(N);
  int total = 0;
  for( int i = 0; i < N; i++ ){
    cin >> T.at(i);
    total += T.at(i);
  }
  
  int M;
  cin >> M;
  vector<int> P(M);
  vector<int> X(M);
  for( int i = 0; i < M; i++ ){
    cin >> P.at(i) >> X.at(i);
  }
  
  int ans = 0;
  for( int i = 0; i < M; i++ ){
    ans = total - T.at(P.at(i)-1) + X.at(i);
    cout << ans << endl;
  }
  
}


Measured memory_bytes: 256
using System;
class Program
{
    static void Main(string[] args)
    {
        int count = 1;
        string data;
        while (true)
        {
            data = Console.ReadLine();
            if (data == "0")
            {
                break;
            }
            Console.WriteLine("Case " + count.ToString() + ": " + data);
            count++;
        }
    }
}

Measured memory_bytes: 5708
#include<bits/stdc++.h>
using namespace std;
int a, b, sx, sy, ex, ey, color[1050][1050], dis[1000050];
int direx[4] = {1, 0, -1, 0};
int direy[4] = {0, 1, 0, -1};
string str[1050];
void bfs(int x, int y)
{
	queue<int> Q; Q.push(x); Q.push(y);
	while(!Q.empty())
	{
		int tx = Q.front(); Q.pop();
		int ty = Q.front(); Q.pop();
		for(int i=0; i<4; i++)
		{
			int dx = tx + direx[i];
			int dy = ty + direy[i];
			if(dx < 0 || dx >= a || dy < 0 || dy >= b) continue;
			if(str[dx][dy] == '#') continue;
			if(color[dx][dy]) continue;
			color[dx][dy] = color[tx][ty];
			Q.push(dx); Q.push(dy); 
		}
	}
}
vector<int> V[1000050];
void cal(int now)
{
	queue<int> Q;
	Q.push(now);
	while(!Q.empty())
	{
		int top = Q.front(); Q.pop();
		for(int x : V[top])
		{
			if(dis[x] != 2e9) continue;
			dis[x] = dis[top] + 1;
			Q.push(x);
		}
	}
}
int main()
{
	cin >> a >> b >> sx >> sy >> ex >> ey;
	sx --; sy --; ex --; ey --;
	for(int i=0; i<a; i++)
		cin >> str[i];
	int now = 1;
	for(int i=0; i<a; i++)
	{
		for(int j=0; j<b; j++)
		{
			if(color[i][j] || str[i][j] == '#') continue;
			color[i][j] = now ++;
			bfs(i, j);
		}
	}
	for(int i=0; i<a; i ++)
	{
		for(int j=0; j<b; j++)
		{
			if(str[i][j] == '#') continue;
			for(int k=i - 2; k <= i + 2; k ++)
			{
				for(int l=j - 2; l <= j + 2; l ++)
				{
					if(k < 0 || k >= a || l < 0 || l >= b) continue;
					if(str[k][l] == '#') continue;
					if(color[i][j] == color[k][l]) continue;
					V[color[i][j]].push_back(color[k][l]);
				}
			}
		}
	}
	for(int i=1; i<now; i++)
		dis[i] = 2e9;
	dis[color[sx][sy]] = 0;
	cal(color[sx][sy]);
	if(dis[color[ex][ey]] == 2e9) dis[color[ex][ey]] = -1;
	cout << dis[color[ex][ey]];
	return 0;
}

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

namespace _0119
{
    public class Program

    {
        public static void Main(string[] args)
        {
            int m = RInt();
            int n = RInt();

            List<Tuple<int, int>> testimonies = new List<Tuple<int, int>>(n);
            for (int i = 0 ; i < n ; i++)
            {
                int[] items = RIntAr();
                testimonies.Add(new Tuple<int, int>(items[0], items[1]));
            }

            HashSet<int> enteringRoomOrder = new HashSet<int>();
            while (testimonies.Count > 0)
            {
                for (int i = 1 ; i <= m ; i++)
                {
                    if(!testimonies.Any(x => x.Item2 == i))
                    {
                        enteringRoomOrder.Add(i);
                        testimonies.RemoveAll(x => x.Item1 == i);
                    }
                }
            }
            enteringRoomOrder.Add(2);

            foreach (var item in enteringRoomOrder) Console.WriteLine(item);            
        }

        static string RSt() { return Console.ReadLine(); }
        static int RInt() { return int.Parse(Console.ReadLine().Trim()); }
        static long RLong() { return long.Parse(Console.ReadLine().Trim()); }
        static double RDouble() { return double.Parse(Console.ReadLine()); }
        static string[] RStAr(char sep = ' ') { return Console.ReadLine().Trim().Split(sep); }
        static int[] RIntAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => int.Parse(e)); }
        static long[] RLongAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => long.Parse(e)); }
        static double[] RDoubleAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => double.Parse(e)); }
        static string WAr<T>(IEnumerable<T> array, string sep = " ") { return string.Join(sep, array.Select(x => x.ToString()).ToArray()); }
    }

}



Measured memory_bytes: 18560
#include<iostream>
#include<algorithm>
#include<vector>
#include<utility>
using namespace std;
long long ans;
int main(){
  int n,m; cin >> n >> m;
  vector<pair<long long,long long>> v(n);
  for(int i=0;i<n;++i){
    long long a,b; cin >> a >> b;
    v[i] = make_pair(a, b);
  }
  sort(v.begin(), v.end());
  long long left = m;
  for(int i=0;i<n;++i){
    ans += v[i].first * min(v[i].second, left);
    left -= min(v[i].second, left);
    if(left<=0){
      cout << ans << endl;
      return 0;
    }
  }
}

Measured memory_bytes: 1792
#include <iostream>
#include <string>
using namespace std;
int main(){
int a[256];fill(a,a+256,0);
string line;
 while(getline(cin,line))
  for(int i=0;i<line.length();++i)
	a[tolower(line[i])]++;
 for(char i='a';i<='z';++i)
cout<<i<<" : "<<a[i]<<endl;
return 0;
}

Measured memory_bytes: 1184
#include<stdio.h>
int main(){
  int h[250];
  int i,j,k,n;
  scanf("%d",&n);
  for(i=1;i<=n;i++){
    scanf("%d",&h[i]);
  }
  for(i=1;i<=n;i++){
    printf("node %d: key = %d, ",i,h[i]);
    if(i>1)printf("parent key = %d, ",h[i/2]);
    if(n>=(i*2))printf("left key = %d, ",h[i*2]);
    if(n>=(i*2+1))printf("right key = %d, ",h[i*2+1]);
    printf("\n");
  }
  return 0;
}



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

int main(void) {
  int a,b,n;cin >> a >> b;
  
  for (int i=1;i<4;i++) {
    if ((a*b*i)%2 == 0) {
      n=0;
    } else {
      n=1;
    }
  }
  if (n == 0) {
      cout << "No" << endl;
    } else {
      cout << "Yes" << endl;
    }
  return 0;
}

Measured memory_bytes: 256
use std::io::stdin;
use std::vec::Vec;

mod utils {
    use std::io::BufRead;
    use std::str::{self, FromStr};

    pub struct StdinReader<R: BufRead> {
        reader: R,
        buf: Vec<u8>,
    }

    impl<R: BufRead> StdinReader<R> {
        pub fn new(reader: R) -> StdinReader<R> {
            StdinReader {
                reader: reader,
                buf: Vec::new(),
            }
        }

        #[allow(unused)]
        #[inline]
        pub fn reads<T: FromStr>(&mut self) -> T {
            self.read_until(b' ')
        }

        #[allow(unused)]
        #[inline]
        pub fn readl<T: FromStr>(&mut self) -> T {
            self.read_until(b'\n')
        }

        #[allow(unused)]
        #[inline]
        pub fn read_vec<T: FromStr>(&mut self) -> Vec<T> {
            return self.read_until::<String>(b'\n').trim().split_whitespace().map(|c| c.parse().ok().unwrap()).collect();
        }

        #[inline]
        pub fn read_until<T: FromStr>(&mut self, delim: u8) -> T {
            loop {
                self.buf.clear();
                let len = self.reader
                    .read_until(delim, &mut self.buf)
                    .expect("failed reading bytes");
                match len {
                    0 => panic!("early eof"),
                    1 if self.buf[0] == delim => (),
                    _ => {
                        if self.buf[len - 1] == delim {
                            self.buf.truncate(len - 1);
                        }
                        break;
                    }
                }
            }

            let elem = unsafe { str::from_utf8_unchecked(&self.buf) };
            elem.parse().unwrap_or_else(|_| panic!(format!("failed parsing: {}", elem)))
         }
    }
}


fn main(){
    let stdin = stdin();
    let mut r = utils::StdinReader::new(stdin.lock());
    let n:String = r.readl();
    let k:usize = r.readl();
    let mut dp = vec![vec![[0;2];k + 1];n.len() + 1];
    //  init
    dp[0][0][1] = 1;
    let mut n_chars = n.chars();
    for i in 1..(n.len() + 1) {
        let i_char = match n_chars.next() {
            None => continue,
            Some(c) => c
        };
        let i_num = i_char as i32 - 48;
        for j in 0..(k + 1) {
            if(j == 0){
                dp[i][j] = [1,0];
            }else{
                if(i_num > 0){
                    dp[i][j] = [
                        dp[i-1][j-1][0] * 9 + dp[i-1][j-1][1] * (i_num - 1) + dp[i-1][j][0] + dp[i-1][j][1],
                        dp[i-1][j-1][1]
                    ];

                }else{
                    dp[i][j] = [
                        dp[i-1][j-1][0] * 9 + dp[i-1][j][0],
                        dp[i-1][j][1]
                    ];
                }
            }

        }
    }
    let mut res = 0;
    // count
    // for i in 0..(n.len() + 1) {
    //     for j in 0..(k + 1) {
    //         print!("[0:{},1:{}], ",dp[i][j][0], dp[i][j][1]);
    //     }
    //     println!("");
    // }
    println!("{}",dp[n.len()][k][0] + dp[n.len()][k][1]);
}


Measured memory_bytes: 4352
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<string>
using namespace std;
typedef long long ll;
ll pi[15]={0},ci[15]={0};
int main(){
  ll d,g;
  cin>>d>>g;
  ll ans=17441744174417;
  for(int i=0;i<d;i++) cin>>pi[i]>>ci[i];
  for(int b=0;b<(1<<d);b++){
    priority_queue<ll> pque;
    ll cnt=0,pnt=0;
    for(int i=0;i<d;i++){
      if(((b>>i)&1)==1){
        cnt+=pi[i];
        pnt+=pi[i]*(i+1)*100+ci[i];
      }
      else{
        for(int j=0;j<pi[i];j++){
          pque.push((i+1)*100);
        }
      }
    }
    while(pnt<g&&!pque.empty()){
      pnt+=pque.top();
      pque.pop();
      cnt++;
    }
    ans=min(ans,cnt);
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cmath>
#include<string>
#include<iostream>
#include<algorithm>
#include<utility>
#include<vector>
#include<map>
#include<set>
#include<limits>
#include<bitset>
#include<array>
#include<numeric>
#include<iomanip>
#include<functional>
#include<deque>

using namespace std;
typedef long long int ll;

#define C cout<<
#define E <<endl
#define CE cout<<endl
#define pb push_back

ll n,m,a,b,c,x,y,z,aa[200010],ab[200010],ac[1010];
bool r,ra,rb,rc[200010];
string s,sa,sb,sc;
char ca,cb,cc,cd[1010][1010];
vector<ll> va,vb,vc,vd,ve,vaa,vbb;
set<int> st;


int main(){
    cin>>n;
    for(int i=0;i<n-1;i++){
        cin>>aa[i];
    }
    m=0;
    for(int i=0;i<n-2;i++){
        m+=min(aa[i],aa[i+1]);
    }
    C m+aa[0]+aa[n-2];

}

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

using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */

int m[500000];
int n[500000];
int N;
int M;
int init()
{
	int i;
	scanf("%d",&N);
	for(i=0;i<N;i++)
		scanf("%d",&n[i]);
	scanf("%d",&M);
	for(i=0;i<M;i++)
		scanf("%d",&m[i]);
		
}
int Sort()
{
	sort(n,N+n);
	sort(m,m+M);
	return 0;
}
int search()
{
	int nn,mm;
	mm=0;
	nn=0;
	if(N<M)
		return 1;
	while(mm<M)
	{
		if(m[mm]<n[nn])
		{
		return 1;
		}
		else if(m[mm]==n[nn])
		{
			mm++;
			nn++;
		}
		else
		{
			nn++;
		}
	}
	return 0;
}
int output(int i)
{
	if(i==0)
		printf("YES");
	else
		printf("NO");
	return 0;
}
int main(int argc, char *argv[]) 
{
	int KKKK;
	
	init();
	Sort();
	KKKK = search();
	output(KKKK);	
	return 0;
}

Measured memory_bytes: 1792
N = int(input())

def dfs(s): # 文字列 s で始まる七五三数の個数
  if int(s) > N:
  	return 0
  ret = 1 if all(s.count(c) > 0 for c in '753') else 0 # s 自体が七五三数なら +1
  for c in '753':
  	ret += dfs(s + c)
  return ret

print(dfs('0')) # 本当は dfs('') と書きたいが 4 行目でのエラーを防ぐため仕方なく


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

long long gcd(long long x, long long y){ return y ? gcd(y,x%y) : x;}

vector<pair<long long, int>> factorize(long long n){
    vector<pair<long long, int>> res;
    for(long long i = 2; i*i <= n; ++i){
        if(n%i) continue;
        res.emplace_back(i, 0);
        while(n%i == 0){
            n /= i;
            res.back().second++;
        }
    }
    if(n != 1) res.emplace_back(n, 1);
    return res;
}
int main(){
    long long a, b;
    cin >> a >> b;
    long long g = gcd(a, b);
    auto f = factorize(g);
    int ans = f.size() + 1;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-8;
const ll mod=1e9+7;
const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

ll n;
vl a;

int main(){
	cin>>n;
	a=vl(n);
	for(auto &i:a) cin>>i;
	vector<map<ll,ll>> dp(n+1);
	dp[0][0]=0;
	for(int i=1;i<=n;i++){
		int cnt=0;
		for(int j=(i+1)/2;j>0;j--){
			ll tmp=-INF;
			for(int k=1;k<=5;k++) if(i-k>=0&&dp[i-k].find(j-1)!=dp[i-k].end()){
				if(i>1&&k==1) continue;
				tmp=max(tmp,dp[i-k][j-1]+a[i-1]);
			}
			dp[i][j]=tmp;
			if(cnt==10) break;
			cnt++;
		}
	}
	ll res=-INF;
	for(int i=0;i<=n;i++) if(dp[i].find(n/2)!=dp[i].end()) res=max(res,dp[i][n/2]);
	cout<<res<<endl;
}

Measured memory_bytes: 151624
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int mod = 1000000007;

int main() {
    ios::sync_with_stdio(false);
    int a, b;
    cin >> a >> b;
    if (a <= 0 && b >= 0) cout << "Zero";
    else if (b < 0) {
        if (b % 2 == a % 2) cout << "Negative";
        else cout << "Positive";
    } else if (a < 0) {
        if (a % 2) cout << "Negative";
        else cout << "Positive";
    } else cout << "Positive";
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define all(x) (x).begin(),(x).end()
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
typedef long long ll;
const long long INF = 1LL << 60;
typedef pair<int, int> P;
int main()
{
    int sx, sy, tx, ty;
    cin >> sx >> sy >> tx >> ty;
    string ans = "";

    repd(i, sx, tx) {
        ans += "R";
    }
    repd(i, sy, ty) {
        ans += "U";
    }
    repd(i, sx, tx) {
        ans += "L";
    }
    repd(i, sy, ty) {
        ans += "D";
    }
    ans += "D";
    repd(i, sx, tx + 1) {
        ans += "R";
    }
    repd(i, sy, ty + 1) {
        ans += "U";
    }
    ans += "LU";
    repd(i, sx, tx + 1) {
        ans += "L";
    }
    repd(i, sy, ty + 1) {
        ans += "D";
    }
    ans += "R";
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))
ans=int(0)
for i in range(N):
  ans+=B[A[i]-1]
  if i>=1 and A[i-1]+1==A[i]:
    ans+=C[A[i-1]-1]
  else:
    continue
print(ans)


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

#define REP(i, n) for(int64_t i = 0; i < n; i++)
#define REPR(i, n) for(int64_t i = n; i >= 0; i--)
#define FOR(i, m, n) for(int64_t i = m; i < n; i++)
#define FORR(i, m, n) for(int64_t i = m; i >= n; i--)
#define ALL(v) v.begin(), v.end()
typedef long long ll;
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    fill( (T*)array, (T*)(array+N), val );
}
template<class T>
inline bool chmax(T &a, T b) {if(a < b) {a = b;return true;}return false;}
template<class T>
inline bool chmin(T &a, T b) {if(a > b) {a = b;return true;}return false;}
const ll INF= 1ll << 60;
const ll MOD = 1000000007;
double EPS = 1e-10;
//----------------------------------------------------------

int H, A;

int main(){
    cin >> H >> A;
    if(H%A==0)cout << H/A << endl;
    else cout << H/A+1 << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int x;
  cin>>x;
  for(int i=x;i>=1;i--){
    int f=0;
    for(int j=2;j<i;j++){
      int t=i;
      while(t%j==0)t/=j;
      if(t==1){
	cout<<i<<endl;
	return 0;
      }
    }
  }
  cout<<1<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>

using namespace std;

#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,N) for(long long i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define fi first
#define se second

#define PI acos(-1.0)
#define INF 1000000007

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<string, ll> PS;
typedef vector<ll> V;

double g, cost;

/*void solve(int a, int b, int c, int j, int mincost){
	if (j > g)return;
	if (a % 5 == 0 && a)mincost *= 0.8;
	if (b % 4 == 0 && b)mincost *= 0.85;
	if (c % 3 == 0 && c)mincost *= 0.88;
	if (j == g){
		cost = min(cost, mincost);
		return;
	}
	cout << mincost << endl;
	solve(a + 1, b, c, j + 200, mincost + 380);
	solve(a, b + 1, c, j + 300, mincost + 550);
	solve(a, b, c + 1, j + 500, mincost + 850);
}*/

int main(){
	while (cin >> g&&g){
		cost = INF;
		int co1 = 0, co2 = 0, co3 = 0;
		for (int i = 0; i <= 5000; i += 200){
			co1 = i / 200;
			for (int j = 0; i+j <= 5000; j += 300){
				co2 = j / 300;
				for (int k = 0; i + j + k <= 5000; k += 500){
					co3 = k / 500;
					if (i + j + k == g){
						cost = min(cost, 380*(co1-co1%5)*0.8+380*(co1%5)
							+550*(co2-co2%4)*0.85+550*(co2%4)
							+850*(co3-co3%3)*0.88+850*(co3%3));
					}
				}
			}
		}
		cout << cost << endl;
	}
}

Measured memory_bytes: 1272
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)

bool check_upper(char c) {
  return c >= 'A' && c <= 'Z';
}

bool solve(string s) {
  if (s.front() != 'A') return false; // 1番目の条件
  int upper_cnt{};
  for (char c : s) {
    if (check_upper(c)) ++upper_cnt;
  }
  if (upper_cnt != 2) return false; // 3番目の条件
  string mid = s.substr(2, s.size() - 3);
  // cout << mid << endl;
  int c_cnt{};
  for (char c : mid) {
    if (c == 'C') ++c_cnt;
  }
  if (c_cnt != 1) return false; // 2番目の条件
  return true;
}

int main() {
  string s;
  cin >> s;
  if (solve(s)) {
    cout << "AC" << endl;
  } else {
    cout << "WA" << endl;
  }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
long long inf = 1000000000000;
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
int main() {
	int n;
	cin >> n;
	int i, a[20];
	int w[20][20];
	bool h[20][20];
	for (i = 0; i < n; i++) {
		cin >> a[i];
		for (int j = 0; j < a[i]; j++) {
			cin >> w[i][j] >> h[i][j];
			w[i][j]--;
		}
	}
	int bit;
	int ans = 0;
	for (bit = 1; bit < (1 << n); bit++) {
		bool honest[20] = {};
		bool cheak = true;
		int count = 0;
		for (i = 0; i < n; i++) {
			if (1 & (bit >> i)) {
				honest[i]++;
				count++;
			}
		}
		for (i = 0; i < n; i++) {
			if (!honest[i]) continue;
			for (int j = 0; j < a[i]; j++) {
				if (honest[w[i][j]] != h[i][j]) cheak = false;
			}
		}
		if (cheak) {
			ans = max(ans, count);
		}
	}
	cout << ans;
	return(0);
}

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

#define pb push_back
#define eb emplace_back
#define all(v) (v).begin(), (v).end() 
#define sz(v) (int)((v).size())
#define fs first
#define sd second

typedef long long ll;

typedef pair < int, int > pi;
typedef pair < pi, int > ppi;

typedef vector < int > vi;
typedef vector < vector < int > > vvi;
typedef vector < pi > vpi;
typedef vector < vpi > vvpi;
typedef vector < ppi > vppi;

void fast() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
}

vector<string> vec_splitter(string s) {
	s += ',';
	vector<string> res;
	while(!s.empty()) {
		res.push_back(s.substr(0, s.find(',')));
		s = s.substr(s.find(',') + 1);
	}
	return res;
}

void debug_out(
vector<string> __attribute__ ((unused)) args,
__attribute__ ((unused)) int idx, 
__attribute__ ((unused)) int LINE_NUM) { cerr << endl; } 
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T) {
	if(idx > 0) cerr << ", "; else cerr << "Line(" << LINE_NUM << ") ";
	stringstream ss; ss << H;
	cerr << args[idx] << " = " << ss.str();
	debug_out(args, idx + 1, LINE_NUM, T...);
}

#ifdef LOCAL
#define debug(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)
#else
#define debug(...) 42
#endif

double get_time() {
	return 1.0 * clock() / CLOCKS_PER_SEC;
}

int main() {
	int n;
	long long d;
	int res = 0;
	cin >> n >> d;
	for(int i = 0; i < n; i++) {
		long long x, y;
		cin >> x >> y;
		if(x * x + y * y <= d * d)
			res++;
	}
	cout << res << '\n';
}


Measured memory_bytes: 3624
def B():
    a = [list(map(int,input().split())) for i in range(3)]
    n = int(input())
    #b = [list(map(int,input().split())) for i in range(n)]
    for bingo in  (int(input()) for _ in range(n)):
        for i in range(3):
            for j in range(3):
                if a[i][j] == bingo:
                    a[i][j] = 0
    if (a[0][0] == a[1][1] == a[2][2] == 0) or (a[0][2] == a[1][1] == a[2][0] == 0):
        print("Yes")
        return
    for i in range(3):
        if all(a[i][j] == 0 for j in range(3)) or all(a[j][i] == 0 for j in range(3)):
            print("Yes")
            return
    print("No")
B()

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

int main() {
	int N, M, B;
	cin >> N >> M;
	vector<int> A(N), a(N);
	for (int& i : A) cin >> i;
	for (int i = 0; i < M; ++i) {
		cin >> B;
		int b = 0;
		while (A[b] > B) ++b;
		++a[b];
	}
	cout << 1 + max_element(a.begin(), a.end()) - a.begin() << endl;
}


Measured memory_bytes: 3084
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.List;
import java.util.Queue;

public class Main {
	static List<Integer> path;

	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		List<List<Integer>> list = new ArrayList<List<Integer>>(n);
		for (int i = 0; i < n; i++) {
			list.add(new ArrayList<Integer>());
		}
		for (int i = 0; i < n - 1; i++) {
			String[] sa = br.readLine().split(" ");
			int a = Integer.parseInt(sa[0]) - 1;
			int b = Integer.parseInt(sa[1]) - 1;
			list.get(a).add(b);
			list.get(b).add(a);
		}
		br.close();

		List<Integer> path2 = new ArrayList<Integer>();
		path2.add(0);
		dfs(list, path2, n - 1);
		int x = (path.size() + 1) / 2;

		boolean[] flg1 = new boolean[n];
		flg1[path.get(x)] = true;
		int cnt1 = 0;
		Queue<Integer> que1 = new ArrayDeque<Integer>();
		for (int i = 0; i < x; i++) {
			int o = path.get(i);
			que1.add(o);
			flg1[o] = true;
			cnt1++;
		}
		while (!que1.isEmpty()) {
			Integer cur = que1.poll();
			for (int o : list.get(cur)) {
				if (!flg1[o]) {
					que1.add(o);
					flg1[o] = true;
					cnt1++;
				}
			}
		}

		boolean[] flg2 = new boolean[n];
		flg2[path.get(x - 1)] = true;
		int cnt2 = 0;
		Queue<Integer> que2 = new ArrayDeque<Integer>();
		for (int i = x; i < path.size(); i++) {
			int o = path.get(i);
			que2.add(o);
			flg2[o] = true;
			cnt2++;
		}
		while (!que2.isEmpty()) {
			Integer cur = que2.poll();
			for (int o : list.get(cur)) {
				if (!flg2[o]) {
					que2.add(o);
					flg2[o] = true;
					cnt2++;
				}
			}
		}

		if (cnt1 > cnt2) {
			System.out.println("Fennec");
		} else {
			System.out.println("Snuke");
		}
	}

	static void dfs(List<List<Integer>> list, List<Integer> path, int n) {
		int cur = path.get(path.size() - 1);
		if (cur == n) {
			List<Integer> path2 = new ArrayList<Integer>();
			path2.addAll(path);
			Main.path = path2;
		}

		int pre = 0;
		if (path.size() > 1) {
			pre = path.get(path.size() - 2);
		}
		for (int i : list.get(cur)) {
			if (i != pre) {
				path.add(i);
				dfs(list, path, n);
				path.remove(path.size() - 1);
			}
		}
	}
}


Measured memory_bytes: 82292
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
#define llt long long int

int main(){
	int n;
	cin>>n;
	//int count=0;
	//cout<<n<<endl;
	int i,j,k,l,ans;
	for(i=1;i<=n;i++){
		//cout<<"HII";
		int count=0;
		for(j=1;j<99;j++){
			for(k=1;k<99;k++){
				for(l=1;l<99;l++){
					ans=(j*j)+(k*k)+(l*l)+(k*j)+(l*k)+(j*l);
					if(ans>i){
						break;
					}
					if(ans==i){
						count++;
					}
				}
			}
		}
		cout<<count<<endl;
	}
	return 0;
}

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

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, k;
    cin >> n >> k;
    vector<int> p(n);
    for (int i = 0; i < n; i++) {
        cin >> p[i];
    }
    sort(p.begin(), p.end());
    int ans = 0;
    for (int i = 0; i < k; i++) {
        ans += p[i];
    }
    cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 3656
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int l,r,d; cin>>l>>r>>d;
	int ans=0;
	for(int i=l;i<=r;i++){
		if(i%d==0) ans++;
	}
	cout<<ans<<"\n";
	return 0;
}

Measured memory_bytes: 3588
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<stack>
#include<cmath>
using namespace std;
typedef long long ll;
ll MOD = 1e9+7;
#define rep(i,n) for(int i = 0; i < (n); ++i)
int main() {
    ll a, b, n;
    cin >> n >> a >> b;
    ll sum = 0;
    ll apb = a + b;
    ll num = n / apb;
    ll ans = 0;
    if ( n - num * apb >= a ) ans = ( n / apb ) * a + a;
    else                      ans = ( n / apb ) * a + ( n - num * apb );  
    cout << ans << endl;
    return 0;
}


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

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

    set<int> st;
    for (int i = a; i < a + k && i <= b; ++i)
        st.insert(i);

    for (int i = b; i > b - k && i >= a; --i)
        st.insert(i);

    for (auto ans : st)
        cout << ans << " ";
    cout << endl;

    return 0;
}

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

const int Mod = 1000000007;
class mll {
public:
	long long x;
	mll(long long x = 0) : x((x% Mod + Mod) % Mod) {};
	void operator += (const mll& a) {
		if ((x += a.x) >= Mod) x -= Mod;
	}
	void operator -= (const mll& a) {
		if ((x += Mod - a.x) >= Mod) x -= Mod;
	}
	void operator *= (const mll& a) {
		(x *= a.x) %= Mod;
	}
	void operator /= (const mll& a) {
		mll b = a.inv();
		(x *= b.x) %= Mod;
	}
	mll operator * (const mll& a) const {
		mll ans = *this;
		ans *= a;
		return ans;
	}
	mll inv() const {
		long long a = x, b = Mod, u = 1, v = 0;
		while (b) {
			long long t = a / b;
			a -= t * b; swap(a, b);
			u -= t * v; swap(u, v);
		}
		u %= Mod;
		if (u < 0) u += Mod;
		a = u;
		return mll(a);
	}
};
mll comb(long long n, long long m) {
	mll ans = 1;
	if (n - m < m) m = n - m;
	for (long long i = n; i > n - m; i--) ans *= i;
	for (long long i = 1; i <= m; i++) ans /= i;
	return ans;
}

int main() {
	long long n, k;
	cin >> n >> k;
	mll ans = comb(n + n - 1, n - 1);
	if (k < n - 1) {
		mll dif = 0;
		mll mdif = comb(n, k+1) * comb(n - 1, k+1);
		dif += mdif;
		for (long long i = k + 2; i < n; i++) {
			mdif *= (n - i + 1);
			mdif /= i;
			mdif *= (n - i);
			mdif /= i;
			dif += mdif;
		}
		ans -= dif;
	}
	cout << ans.x << endl;
}


Measured memory_bytes: 3560
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
using namespace std;
const int Maxn = 100000 + 100;
const int Mod = 1000000000 + 7;
int n,l,cnt,ans,a[Maxn];
string S;
bool f = false;
int main()
{
    cin>>n;
    for (int i = 0; i < n; i++)
        cin>>a[i];
    sort(a,a+n);
    cnt = 1;
    ans = 0;
    for (int i = 0; i < n; i++)
    {
        if(a[i] != a[i+1])
        {
            if(cnt > a[i])
                ans += abs(a[i] - cnt);
            else
                if(cnt < a[i])
                    ans += cnt;
            cnt = 1;
        }
        else
            cnt++;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 640
from fractions import gcd
import sys 
input = sys.stdin.readline

def pow_mod(x,n):
    if n==0:
        return 1
    
    K = 1
    while n>1:
        if n%2 != 0:
            K *= x
            K %= mod
        x *= x
        x %= mod
        n //= 2

    return K*x

mod=10**9+7
N = int(input())
A = list(map(int,input().split()))

if N==1:
    print(1)
    exit()

Gcd = gcd(A[0],A[1])
ans = (A[0]//Gcd+A[1]//Gcd)%mod
temp = A[0]//Gcd

for i in range(1,N-1):
    #Gcd = lcm(A[i],A[i+1])
    Gcd = gcd(A[i],A[i+1])
    #temp2 = Gcd//A[i]
    temp2 = A[i+1]//Gcd
    #Gcd2 = lcm(temp,temp2)
    Gcd2 = gcd(temp,temp2)

    #a = Gcd2//temp
    a = temp2//Gcd2
    #b = Gcd2//temp2
    b = temp//Gcd2

    temp = A[i]//Gcd*b

    a %= mod
    b %= mod
    ans *= a
    ans %= mod


    Gcd %= mod #注意
    c = A[i]
    c %= mod
    d = c*pow_mod(Gcd,mod-2)
    #d = Gcd//c
    d %= mod


    e = b*d%mod
    ans += e
    #ans += Gcd//A[i+1]*b
    ans %= mod


print(ans)




Measured memory_bytes: 71396
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<stack>
#include<queue>
#include<deque>
#include<map>
#include<set>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
#define FOR(i,n) for(int (i)=0;(i)<(n);(i)++)
#define FOR1(i,n) for(int (i)=1;(i)<(n);(i)++)
#define eFOR(i,n) for(int (i)=0;(i)<=(n);(i)++)
#define eFOR1(i,n) for(int (i)=1;(i)<=(n);(i)++)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i) sort((i).begin(),(i).end(), greater<int>());
#define YES(i) cout << ((i) ? "Yes" : "No") << endl;
constexpr auto INF = 1000000000;
constexpr auto LLINF = 1LL << 62;
constexpr auto mod = 1000000007;
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() {
    string s;
    cin >> s;
    FOR(i, s.length() - 1) {
        if (s[i] == 'B' && s[i + 1] == 'C') {
            if (i == 0)s = 'D' + s.substr(i + 2, s.length() - i - 2);
            else if (i == s.length() - 2)s = s.substr(0, i) + 'D';
            else s = s.substr(0, i) + 'D' + s.substr(i + 2, s.length() - i - 2);
        }
    }
    vector<string> t;
    FOR(i, s.length()) {
        if (s[i] == 'A' || s[i] == 'D') {
            for (int j = i; j < s.length(); j++) {
                if (s[j] == 'B' || s[j] == 'C') {
                    t.push_back(s.substr(i, j - i));
                    i = j;
                    break;
                }
                if (j == s.length() - 1) {
                    t.push_back(s.substr(i, j - i + 1));
                    i = j;
                }
            }
        }
    }
    ll ans = 0;
    for (string i : t) {
        int cnt = 0;
        FOR(j, i.length()) {
            if (i[j] == 'A') {
                ans += (int)i.length() - j - 1;
                cnt++;
            }
        }
        FOR1(j, cnt)ans -= j;

    }
    cout << ans << endl;
}


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

using namespace std;

#ifdef DEBUG_MODE
	#define DBG(n) n;
#else
	#define DBG(n) ;
#endif
#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define rep(i,s,g) for(ll (i) = (s);(i) < (g);++i)
#define rrep(i,s,g) for(ll (i) = (s);i >= (g);--(i))
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {for(int W = 0;W < (n);W++)cerr << v[W] << ' ';cerr << endl << endl;}
#define SHOW2d(v,i,j) {for(int aaa = 0;aaa < i;aaa++){for(int bbb = 0;bbb < j;bbb++)cerr << v[aaa][bbb] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define MOD 1000000007

typedef long long ll;
typedef pair<ll,ll> P;

int main(){
	
	string str;cin >> str;
	int n;cin >> n;
	
	REP(i,str.size()){
		if(i % n == 0){
			cout << str[i];
		}
	}
	
	cout << endl;
	
	return 0;
}


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

int main(){
     string s;
     cin >> s;
     if(s=="ABC") cout << "ARC" << endl;
     else cout << "ABC" << endl;
 }

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

int main(){
    int a,b,k;
    cin>>a>>b>>k;
    int i=min(a,b);
    int c=0;
    while(c<k){
        if(a%i==0&&b%i==0){
            ++c;
        }
        --i;
    }
    cout<<i+1<<endl;
}


Measured memory_bytes: 256
/*
ID: wangjun30
TASK:
LANG: C++
*/
#include<iostream>
using namespace std;
int main(){
	int n;
	cin>>n;
	if(n==25){
		cout<<"Christmas";
	}
	else
		if(n==24)
			cout<<"Christmas Eve";
		else
			if(n==23)
				cout<<"Christmas Eve Eve";
			else
				cout<<"Christmas Eve Eve Eve";
	return 0;
}

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

#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)

void FIO()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
}

int32_t main()
{
	FIO();
	int n, x, t; cin >> n >> x >> t;
	if (x == 1)
	{
		cout << (n * t) << '\n';
	}
	else
	{
		int ans = 0;
		while (1)
		{
			if (n <= x)
			{
				ans = ans + t;
				break;
			}

			n = n - x;
			ans = ans + t;
		}
		cout << ans << '\n';
	}
	return 0;
}

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

//C++14 (GCC 5.4.1)

#define LLINF (1LL<<60)
typedef long long ll;
#define mod 1000000007

#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define rrepd(i,a,b) for(int i=(a);i>=(b);i--)

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

template < typename T > inline string toString( const T &a ) { ostringstream oss; oss << a; return oss.str(); }

#define dbg_v1(i,V) do{cout<<"-v1----\n";rep(i,V.size())cout<<" "<<i<<"\t:"<<V[i]<<endl;cout<<endl;}while(0)
#define dbg_v2(i,k,V) do{cout<<"-v2----\n";rep(i,V.size()){rep(k,V[0].size())cout<<" "<<V[i][k];cout<<endl;}}while(0)

int main() {
    ios::sync_with_stdio(false);//stdoutとcoutの同期解除
    cin.tie(nullptr);//cinとcoutの同期解除
    
    ll N;
    cin >>N;

//Nの約数探し
vector<ll> divisors;
for (ll i = 1; i * i <= N; i++) {
    if (N % i) continue;
    divisors.push_back(i);
}
    
    ll ans=LLONG_MAX;
    rep(i,divisors.size())
        chmin(ans,(divisors[i]+N/divisors[i]-2));


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

Measured memory_bytes: 384
#include<stdio.h>
#include<string.h>
int main()
{
    int j,len=0,cheak,m;
    char a[100];
        cheak=0;
        m=0;
        scanf("%s",a);
        len=strlen(a);
        for(j=0; j<len; j++)
        {
            if(a[j]=='o')
            {
                cheak++;
            }
            else if(a[j]=='x')
            {
                m++;
            }
        }
        if((cheak>=7) && (m<8))
        {
            printf("YES\n");
        }
        else if(((cheak+m)<15) && (m<8))
        {
            printf("YES\n");
        }
        else
        {
            printf("NO\n");
        }
    return 0;
}



Measured memory_bytes: 128
#include <algorithm>
#include <map>
#include <iostream>
#include <string>
#include <set>
#include <queue>
#include <cmath>
#include <iterator>
#include <array>
#include <iomanip>
typedef long long int ll;
using namespace std;
#define maxN 200005
#define mod 1000000007
#define pi 3.14159265358979323846264338327950

void solve()
{
    ll a, b, c, k, ans = 0;
    cin >> a >> b >> c >> k;
    if (k >= a)
    {
        ans += a, k -= a;
    }
    else
    {
        cout << k << endl;
        return;
    }
    if (k >= b)
    {
        k -= b;
    }
    else
    {
        cout << ans << endl;
        return;
    }
    if (k >= c)
    {
        k -= c;
        ans -= c;
    }
    else
    {
        cout << ans - k << endl;
        return;
    }
    cout << ans << endl;
}

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

Measured memory_bytes: 3612
from collections import Counter
N=int(input())
XY=[tuple(map(int, input().split())) for _ in range(N)]
PQ=[(x1-x2,y1-y2) for x1,y1 in XY for x2,y2 in XY if x1!=x2 or y1!=y2]
C=Counter(PQ)
print(N-C.most_common(1)[0][1] if N!=1 else 1)

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

#define ll long long
#define REP(i, n) for(int i = 0;i < (int)(n);i++)

int main() {
  int N, Q;
  ll S = 0;
  map<int, int> v;
  cin >> N;
  REP(i, N) {
    int n;
    cin >> n;
    v[n]++;
    S += n;
  }
  cin >> Q;
  REP(i, Q) {
    int b, c;
    cin >> b >> c;
    S += (c - b) * v[b];
    v[c] += v[b];
    v[b] = 0;
    cout << S << endl;
  }
}

Measured memory_bytes: 7864
#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<iostream>
using namespace std;
int main()
{
	long long int n,h,i,t,m;
	scanf("%lld%lld",&h,&n);
	while(n--){
		scanf("%lld",&t);
		h-=t;
	}
	if(h<=0)printf("Yes\n");
	else printf("No\n");
}

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

public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		int itemCount = scan.nextInt();
		int maxWait = scan.nextInt();

		int[][] itemArray = new int[itemCount + 1][2];

		for (int i = 1; i < itemCount + 1; i++) {

			// 重さ
			itemArray[i][0] = scan.nextInt();

			// 価値
			itemArray[i][1] = scan.nextInt();
		}

		// 個数 × 価値の合計
		long[][] dp = new long[itemCount + 1][100000 + 1];
		
		for(long[] array : dp) {

			Arrays.fill(array, Long.MAX_VALUE);
		}

		for (int i = 1; i < itemCount + 1; i++) {

			for (int v = 0; v < 100000 + 1; v++) {
				
				if (itemArray[i][1] >= v) {
					
					dp[i][v] = Math.min(
							itemArray[i][0],
							dp[i - 1][v]);
				} else {
					
					if (dp[i - 1][v - itemArray[i][1]] != Long.MAX_VALUE) {
						
						dp[i][v] = Math.min(
								dp[i - 1][v - itemArray[i][1]] + itemArray[i][0],
								dp[i - 1][v]);
					}
				}
				
				if (dp[i][v] != Long.MAX_VALUE && dp[i][v] > maxWait) {
					
					dp[i][v] = Long.MAX_VALUE;
				}
			}
		}
		
		for (int v = 100000; v >= 0; v--) {
			
			if (dp[itemCount][v] != Long.MAX_VALUE) {
				
				System.out.println(v);
				break;
			}
		}
	}
}


Measured memory_bytes: 128980
#include<stdio.h>
#include<string.h>
int main()
{
    int i,j,t;
    char a[100010];
    gets(a);
    t=strlen(a);
    for(i=j=0;i<t;i=i+2)
    {
        a[j++]=a[i];
    }
    a[j]='\0';
    puts(a);
    return 0;
}

Measured memory_bytes: 256
n, x = map(int, input().split())
l = list(map(int, input().split()))
total = 0

for i in range(n - 1):
    diff = l[i] + l[i+1] - x
    if diff > 0:
        total += diff
        if diff > l[i+1]:
            l[i+1]=0
        else:
            l[i+1] -= diff

print(total)

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

#define fast                     ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll                       long long 
#define mk                       make_pair
#define pb                       push_back
#define pob                      pop_back
#define pii                      pair<int,int>
#define vi                       vector<int>
#define vii                      vector<pii>
#define mi                       map<int,int>
#define mii                      map<pii,int>
#define all(a)                   (a).begin(),(a).end()
#define x                        first
#define y                        second
#define sz(x)                    (int)x.size()
#define endl                     '\n'
#define MOD                      1000000007
#define loop(i,a,b)              for(int (i)=(a);(i)<(b);(i)++)
#define rloop(i,a,b)             for(int (i)=(a);(i)>=(b);(i)--)
#define Unique(A)                (A).resize(distance((A).begin(),unique(all((A)))));
#define mxe(A)                   *max_element(all(A))
#define mne(A)                   *min_element(all(A))
#define debv(x)                  for(auto i : (x)) cout << i << ' ';cout << endl;
#define SP(x,y)                  cout << fixed << setprecision((y)) << (x) << endl;
#define setBits(x)               __builtin_popcountll(x)
#define zroBits(x)               __builtin_ctzll(x)
#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
#define Max(x,y,z)               max(x,max(y,z))
#define Min(x,y,z)               min(x,min(y,z))
#define clr(x)                   memset(x,0,sizeof(x)) // not sure work for 2D arrya or not

using namespace std;

const int N = 110000;
int A[N],B[N],C[N],dp[N][3];

int main(){
    int n ; cin >> n ;
    loop(i,0,n) cin >> A[i] >> B[i] >> C[i];
    if(n==1){
        cout << Max(A[0],B[0],C[0]) << endl;
        return 0;
    }
    dp[0][0] = A[0]; dp[0][1] = B[0]; dp[0][2] = C[0];
    loop(i,1,n){
        dp[i][0] = A[i] + max(dp[i-1][1],dp[i-1][2]);
        dp[i][1] = B[i] + max(dp[i-1][0],dp[i-1][2]);
        dp[i][2] = C[i] + max(dp[i-1][0],dp[i-1][1]);
    }
    cout << Max(dp[n-1][0],dp[n-1][1],dp[n-1][2]) << endl;
    return 0;
}                                      

Measured memory_bytes: 2560