akhauriyash/Code-Regression huggingface dataset:
/**
 *    author:  otera    
**/
#include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<deque>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

#define int long long
typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef long double ld;
const int inf=1e9+7;
const ll INF=1LL<<60 ;
const ll mod=1e9+7 ;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<int, int> P;
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
#define debug(x)  cerr << #x << " = " << (x) << endl;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

void solve() {
	int n, k, c; cin >> n >> k >> c;
    string s; cin >> s;
    string t = s;
    reverse(all(t));
    vector<int> left(n + 1, 0), right(n + 1, 0);
    vector<bool> used(n, 0);
    int i = 0;
    for(; i < n;) {
        if(s[i] == 'o') {
            used[i] = 1;
            left[i + 1] = left[i] + 1;
            int j = i;
            ++ i;
            while(i < n && i <= j + c) {
                left[i + 1] = left[i];
                ++ i;
            }
        } else {
            left[i + 1] = left[i];
            ++ i;
        }
    }
    i = 0;
    for(; i < n;) {
        if(t[i] == 'o') {
            right[i + 1] = right[i] + 1;
            int j = i;
            ++ i;
            while(i < n && i <= j + c) {
                right[i + 1] = right[i];
                ++ i;
            }
        } else {
            right[i + 1] = right[i];
            ++ i;
        }
    }
    rep(i, n) {
        //cerr << left[i + 1] << endl;
    }
    if(left[n] > k) {
        cout << endl;
        return;
    }
    rep(i, n) {
        if(used[i]) {
            if(left[i] + right[n - 1 - i] < k) {
                //cerr << left[i] + right[n - 1 - i] << endl;
                cout << i + 1 << endl;
            }
        }
    }
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(10);
	//int t; cin >> t; rep(i, t)solve();
	solve();
    return 0;
}

Measured memory_bytes: 5140
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define inf 1e+9
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T, class C> void chmax(T& a, C b){ a>b?:a=b; }
template<class T, class C> void chmin(T& a, C b){ a<b?:a=b; }

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

    int n,k,ans=0;
	string s;
	cin >> n >> k;

	rep(i,inf){
		if(abs(n-i)==abs(k-i)){
			cout << i << endl;
			return 0;
		}
	}



	cout << "IMPOSSIBLE" << endl;
}

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

int main() {
  int n,m,sum=0;
  cin>>n>>m;
  vector<int> a(n);
  for (int i=0;i<n;i++){
    cin>>a[i];
    sum+=a[i];
  }
  int num=0;
  for(int i=0;i<n;i++){
    if(a[i]*4*m>=sum){
      num++;
    }
  }
  string ans="No";
  if(num>=m){
    ans="Yes";
  }  
  cout<<ans<<endl; 
}


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

input = sys.stdin.readline


def S():
    return input().rstrip()


def I():
    return int(input())


def MI():
    return map(int, input().split())


s = S()

if "RRR" in s:
    print(3)
elif "RR" in s:
    print(2)
elif "R" in s:
    print(1)
else:
    print(0)


Measured memory_bytes: 9032
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl;
#define mod 1000000007
using ll=long long;
const int INF=1000000000;
const ll LINF=1001002003004005006ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
// ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return true;}return false;}

struct IOSetup{
    IOSetup(){
        cin.tie(0);
        ios::sync_with_stdio(0);
        cout<<fixed<<setprecision(12);
    }
} iosetup;

template<typename T1,typename T2>
ostream &operator<<(ostream &os,const pair<T1,T2>&p){
    os<<p.first<<" "<<p.second;
    return os;
}

template<typename T>
ostream &operator<<(ostream &os,const vector<T>&v){
    for(int i=0;i<(int)v.size();i++) os<<v[i]<<(i+1==v.size()?"":" ");
    return os;
}


signed main(){
    int n,k;cin>>n>>k;
    vector<ll> a(n);
    rep(i,n) cin>>a[i];

    if(k==0){
        cout<<*max_element(ALL(a))<<endl;
        return 0;
    }

    auto check=[&](ll m){
        ll cnt=0;
        rep(i,n){
            cnt+=(a[i]+m-1)/m-1;
        }
        return cnt<=k;
    };


    ll lw=1,hi=LINF,res;
    while(lw<=hi){
        ll mid=(lw+hi)/2;
        if(check(mid)){
            res=mid;
            hi=mid-1;
        }else{
            lw=mid+1;
        }
    }
    cout<<res<<endl;
    return 0;
}


Measured memory_bytes: 4780
#include<stdio.h>
int main(){
  int b1[3][10],b2[3][10],b3[3][10],b4[3][10];
  int n,b,f,r,v;
  scanf("%d",&n);
  for (int i = 0; i < 3; i++)
  {
    
    for (int j = 0; j < 10; j++)
    {
      b1[i][j] = 0;
      b2[i][j] = 0;
      b3[i][j] = 0;
      b4[i][j] = 0;
    //  printf("%d",b1[i][j]);
    }
  //  printf("\n");
    
  }
  for (int s = 0; s < n; s++)
  {
    scanf("%d %d %d %d",&b,&f,&r,&v);
    if(b == 1)b1[f-1][r-1] += v;
    else if(b == 2)b2[f-1][r-1] += v;
    else if(b == 3)b3[f-1][r-1] += v;
    else if(b == 4)b4[f-1][r-1] += v;
  }
  
    for (int i = 0; i < 3; i++)
  {
    
    for (int j = 0; j < 10; j++)
    {
      printf(" %d",b1[i][j]);
    }
    printf("\n");
  }
  printf("####################\n");
      for (int i = 0; i < 3; i++)
  {
    
    for (int j = 0; j < 10; j++)
    {
      printf(" %d",b2[i][j]);
    }
    printf("\n");
  }
   printf("####################\n");
         for (int i = 0; i < 3; i++)
  {
    
    for (int j = 0; j < 10; j++)
    {
      printf(" %d",b3[i][j]);
    }
    printf("\n");
  }
  printf("####################\n");
           for (int i = 0; i < 3; i++)
  {
    
    for (int j = 0; j < 10; j++)
    {
      printf(" %d",b4[i][j]);
    }
    printf("\n");
  }
   return 0;
}


Measured memory_bytes: 2032
#include <bits/stdc++.h>
using namespace std;
long long n,t[150],m,p[150],x[150],y,sum,k;
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);cout.tie(0);
cin>>n;
for(int i=1;i<=n;i++){
    cin>>t[i];
}
cin>>m;
for(int i=1;i<=m;i++){
    cin>>p[i]>>x[i];
}
for(int j=1;j<=m;j++){

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

    if(p[j]==i){


        sum+=x[j];
        k++;
    }
    else sum+=t[i];
   }
    if(k>0){
    cout<<sum<<endl;
    sum=0;}
}

return 0;

}


Measured memory_bytes: 3644
# coding: utf-8
# Your code here!

from collections import deque

N = int(input())
S = deque(input())
A = []
ctr = 0

for i in range(N):
    tmp = S.popleft()
    if A == [] or A[-1] != tmp:
        ctr += 1
    A.append(tmp)
print(ctr)

Measured memory_bytes: 5144
H, W = map(int, input().split())
S = [[[] for i in range(W + 2)] for j in range(H + 2)]
for i in range(H):
    S[i + 1][1: W + 1] = list(input()[:])
for i in range(H):
    for j in range(W):
        if S[i + 1][j + 1] == '.':
            print([S[i][j], S[i][j+1], S[i][j+2], S[i+1][j], S[i+1][j+2],\
                    S[i+2][j], S[i+2][j+1], S[i+2][j+2]].count('#'), end = '')
        else:
            print('#', end = '')
    print('')

Measured memory_bytes: 3572
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] P = new int[N+1];
		for(int i = 1;i <= N;i++){
			P[i] = sc.nextInt();
		}
		sc.close();
		int ans = 1;
		int min = P[1];
		for(int i = 2;i <= N;i++){
			min = Math.min(min, P[i]);
			if(P[i] <= min){
				ans++;
			}
		}
		System.out.println(ans);
	}
}

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

int main(){
    int N;
    cin >> N;
    vector<int> p(N);
    for(int i=0; i<N; i++){
        cin >> p.at(i);
    }
    int mmax=0;
    int sum=0;
    for(int i=0; i<N; i++){
        mmax = max(mmax, p.at(i));
        sum = sum + p.at(i);
    }
    cout << sum - mmax /2  << endl;
}

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

public class Main {
    static ArrayList<Integer>adj[];
    public static void main(String[] args) throws IOException {
        Scanner sc = new Scanner(System.in);
        PrintWriter pw = new PrintWriter(System.out);
        int n = sc.nextInt();
        int[]a= new int[n];
        for (int i =0;i<n;i++)a[i]=sc.nextInt();
        int min=0;
        boolean is=true;
        for (int i =0;i<n;i++){
            if (a[i]<min)is=false;
            min=Math.max(min,a[i]-1);
        }
        if (is)pw.println("Yes");
        else pw.println("No");
        pw.flush();
    }
    static int max;
    static int start;
    static class SufT{
        static class Node{Node[]nxt= new Node[26];int val=0;int dis=0;};
        Node root= new Node();
        void put(char[]s){
            Node cur = root;
            for (char c:s){
                Node nxt=cur.nxt[c-'a'];
                if (nxt==null){
                    nxt=cur.nxt[c-'a']= new Node();
                    nxt.dis=cur.dis+1;
                }
                cur=nxt;
                cur.val++;
            }
        }
        void search(){
            Queue<Node>q= new LinkedList<>();
            ((LinkedList<Node>) q).add(root);
//            boolean[][]vis= new boolean[26][200];
            while (!q.isEmpty()) {
                Node x = q.poll();
                for (int i =0;i<26;i++){
                    Node nxt=x.nxt[i];
                    if (nxt!=null){
                        ((LinkedList<Node>) q).add(nxt);
//                        vis[i][nxt.dis]=true;
                    }
                }
                if (x.val>=3){
                    max=x.val;
                    start=Math.max(start,x.dis);
                }
            }
        }
    }

    static long modPow(long a ,int e ,int mod){
        a%=mod;
        long res=1;
        while (e>0){
            if ((e%2)==1){
                res=(res*a)%mod;
            }
            a=(a*a)%mod;
            e>>=1;
        }
        return res%mod;
    }
    static class Scanner{
        StringTokenizer st;
        BufferedReader br;
        public  Scanner(InputStream s){
            br = new BufferedReader(new InputStreamReader(s));
        }
        public String next() throws IOException{
            while (st==null||!st.hasMoreTokens())st= new StringTokenizer(br.readLine());
            return st.nextToken();
        }
        public String nextLine() throws IOException {return br.readLine();};
        public int nextInt() throws IOException {return Integer.parseInt(next());}
        public long nextLong() throws IOException {return Long.parseLong(next());}

    }
}


Measured memory_bytes: 38428
package main

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

func main() {
	sc := bufio.NewScanner(os.Stdin)

	sc.Scan()
	S := sc.Text()

	sum := 0
	for i := 0; i < pow(2, len(S)-1); i++ {
		remain := 0
		for j := 0; j < len(S)-1; j++ {
			if i>>uint(j)&1 == 1 {
				sum += remain + int(S[j]) - 48
				remain = 0
			} else {
				remain = 10 * (remain + int(S[j]) - 48)
			}
		}

		sum += remain + int(S[len(S)-1]) - 48
	}
	fmt.Println(sum)
}

func pow(el, n int) int {
	res := 1
	for i := 0; i < n; i++ {
		res *= el
	}
	return res
}


Measured memory_bytes: 640
package main

import "fmt"

func max(i, j int) int {
	if i > j {
		return i
	}
	return j
}

func min(i, j int) int {
	if i < j {
		return i
	}
	return j
}

func main() {
	var a, b, c, d int
	fmt.Scan(&a, &b, &c, &d)
	fmt.Println(max(min(b, d)-max(a, c), 0))
}


Measured memory_bytes: 512
#include<iostream>
#include<algorithm>
#include<vector>
#include<numeric>
#include<string>
#include<cmath>
#include<set>
#include<queue>
#include<deque>
#include<bitset>
#include<iomanip>
#include<cctype>
#include<map>
#include<cstring>
#include<bitset>
#include<cassert>

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep2(i,a,b) for (int (i)=a;(i)<(b);(i)++)
#define all(x) (x).begin(),(x).end()

using namespace std;
using ll = long long int;

const int inf = 1001001000;
const long long int Inf = 1001001001001001000;



void print(vector<vector<int>> a){
	for (int i = 0; i < a.size(); i++)
	{
		for (int j=0;j<a[i].size();j++){
			cout << a[i][j] << " ";
		}
		cout << endl;
	}
}

void print(vector<vector<long long int>> a){
	for (int i=0;i<a.size();i++){
		for (int j=0;j<a[i].size();j++){
			cout << a[i][j] << " ";
		}
		cout << endl;
	}
}

void print(vector<int> a){
    int n = a.size();
    for (int j=0;j<n;j++) {
        if (j != n-1) cout << a[j] << " ";
        else cout << a[j] << endl;
    }
}

void print(vector<long long int> a){
    int n = a.size();
    for (int j=0;j<n;j++) {
        if (j != n-1) cout << a[j] << " ";
        else cout << a[j] << endl;
    }
}

void print(set<int> a){
	for (auto x:a)
		cout << x << " ";
	cout << endl;
}



int main(){
	ll n;
	cin >> n;
	vector<ll> a(n), b(n);
	rep(i, n)
	{
		cin >> a[i] >> b[i];
	}
	sort(all(a));
	sort(all(b));
	ll mi, ma;
	if(n % 2 == 0){
		mi = (a[n / 2 - 1] + a[n / 2]);
		ma = (b[n / 2 - 1] + b[n / 2]);
	}
	else
	{
		mi = a[n / 2];
		ma = b[n / 2];
	}
	cout << ma - mi + 1 << endl;

	return 0;
}

Measured memory_bytes: 6436
import itertools
S = list(itertools.accumulate([0] + [int(_) for _ in input()]))
N = len(S) - 1
for i in range(N, 0, -1):
    if 2 * i < N:
        break
    if S[i] - S[N - i] in [0, 2 * i - N]:
        break
print(i)


Measured memory_bytes: 8460
//include
//--------------------------------------------------
#include<vector>
#include<list>
#include<map>
#include<set>
#include<deque>
#include<stack>
#include<bitset>
#include<algorithm>
#include<functional>
#include<numeric>
#include<utility>
#include<sstream>
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<cctype>
#include<string>
#include<cstring>
#include<ctime>
#include<cassert>

using namespace std;

#define int long long

//conversion
//--------------------------------------------------
inline int toInt(const string &s){
    int v;istringstream sin(s);sin>>v;
    return v;
}
template<class T> inline string toString(T x){
    ostringstream sout;sout<<x;
    return sout.str();
}

//math
//--------------------------------------------------
template<class T> inline T sqr(T x){return x*x;}

//typedef
//--------------------------------------------------
typedef vector<int>VI;
typedef vector<VI>VVI;
typedef vector<string>VS;
typedef pair<int,int>PII;
typedef long long LL;

//container util
//--------------------------------------------------
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin())i=(c).begin();i!=(c).end();i++)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//--------------------------------------------------
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RREP(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define RFOR(i,a,b) for(int i=(a)-1;i>=(b);i--)

//clear memory
//--------------------------------------------------
#define CLR(a) memset((a),0,sizeof(a))
#define CLRM(a) memset((a),-1,sizeof(a))
//end-----------------------------------------------



int bit_n,dat[10000];
void init(int n){bit_n=n;CLR(dat);}
void add(int k,int x){for(k++;k<=bit_n;k+=k&-k)dat[k]+=x;}
int sum(int k){int ret=0;for(k++;k;k-=k&-k)ret+=dat[k];return ret;}
int del(int k){int v=sum(k)-sum(k-1);add(k,-v);}

const int mod=1e9+7;
int N,L;
int x[5000],a[5000];
signed main(){
    cin>>N>>L;
    REP(i,N)cin>>x[i];
    REP(i,N)cin>>a[i];

    init(L+114);
    add(L,1);
    RREP(i,N){
        REP(j,L+1){
            del(j);
            if(j<x[i]||(a[i]==0&&j!=x[i])||(j-x[i])%a[i])continue;
            int v=sum(L)-sum(j);
            add(j,v%mod);
        }
    }

    cout<<sum(L)%mod<<endl;
    return 0;
}

Measured memory_bytes: 1320
#include<iostream>
#include<cmath>
using namespace std;
int main(){
	double a[2],b[2],c[2],p[2];
	double matrix[2][2],ans[2],reverse[2][2],det,x,y;
	while(cin >>a[0]>>a[1]>>b[0]>>b[1]>>c[0]>>c[1]>>p[0]>>p[1]){
		b[0] = b[0]-a[0];
		b[1] = b[1]-a[1];
		c[0] = c[0]-a[0];
		c[1] = c[1]-a[1];
		p[0] = p[0]-a[0];
		p[1] = p[1]-a[1];
		matrix[0][0] = b[0];
		matrix[1][0] = c[0];
		matrix[0][1] = b[1];
		matrix[1][1] = c[1];
		ans[0] = p[0];
		ans[1] = p[1];
		det = matrix[0][0]*matrix[1][1]-matrix[0][1]*matrix[1][0];
		reverse[0][0] = matrix[1][1]/det;
		reverse[1][0] = -matrix[1][0]/det;
		reverse[0][1] = -matrix[0][1]/det;
		reverse[1][1] = matrix[0][0]/det;
		x = ans[0]*reverse[0][0]+ans[1]*reverse[1][0];
		y = ans[0]*reverse[0][1]+ans[1]*reverse[1][1];
		if(x>0 && y>0 && x+y<1){cout <<"YES"<<endl;}
		else{cout <<"NO"<<endl;}
	}
	return 0;
}

Measured memory_bytes: 0
S = input()
nwse = [0, 0, 0, 0]

for x in S:
    if x == "N":
        nwse[0] += 1
    elif x == "W":
        nwse[1] += 1
    elif x == "S":
        nwse[2] += 1
    elif x == "E":
        nwse[3] += 1

if nwse[0] > 0 and nwse[2] > 0 or nwse[0] == 0 and nwse[2] == 0:
    if nwse[1] > 0 and nwse[3] > 0 or nwse[1] == 0 and nwse[3] == 0:
        print("Yes")
    else:
        print("No")
else:
    print("No")


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define bit(n) (1<<(n))
#define ii(x) int x; cin >> (x)
#define ii2(x, y) int x, y; cin >> (x) >> (y)
#define ii3(x, y, z) int x, y, z; cin >> (x) >> (y) >> (z)
#define yn(x, ok, ng) cout << ((x)?(ok):(ng)) << endl
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
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;}
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 const INF = 1001001001;


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

int a,b,c,d,e,f;
cin >> a >> b >> c >> d >> e >> f;

ld res = 0;
int answ = 100*a, anss = 0;
rep(i,31) {
    rep(j,31) {
        int w = 100 * (a * i + b * j);
        if(w > f) continue;
        int lim = min(f - w, w / 100 * e);
        rep(p,1500) {
            rep(q,1500) {
                int s = c * p + d * q;
                if(s > lim) continue;
                if(chmax(res, (ld)s / (ld)(s+w))) answ = w, anss = s;
            }
        }
    }
}
cout << answ + anss << ' ' << anss << endl;
return 0;
}

Measured memory_bytes: 256
import numpy as np
n,k,q = map(int, input().split())
p = np.full(n, k, dtype=np.int)
first = 0
for i in range(q):
    a = int(input())
    p -= 1
    p[a-1] += 1
for i in p:
    if i <= 0:
        print("No")
    else:
        print("Yes")

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

int main() {
    string N;
    long long int sum = 0;
    cin >> N; 
    for (int i = 0; i < N.size(); ++i) {
        sum += (N.at(i) - '0');
    }
    if (sum % 9 == 0) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 3716
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int A = sc.nextInt();
    int B = sc.nextInt();
    int C = sc.nextInt();
    
    if (A%2 == 0 && A == B && B == C) {
      System.out.println(-1);
      return;
    }
    
    int ans = 0;
    while (A%2 == 0 && B%2 == 0 && C%2 == 0) {
      int AA = (B+C)/2;
      int BB = (C+A)/2;
      int CC = (A+B)/2;
      A = AA;
      B = BB;
      C = CC;
      ans++;
    }
    
    System.out.println(ans);
  }
}

Measured memory_bytes: 21844
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp6
{
    class Program
    {
        static void Main(string[] args)
        {
            var  nums = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();

            Array.Sort(nums);

            int ans = 0;
            for (int i = 0; i < nums.Length; i++)
            {
                if (i == 0) continue;
                ans += Math.Abs(nums[i] - nums[i - 1]);
            }

            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 13396
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <cmath>
#include <iomanip>
using namespace std;
typedef long long ll;

int main() {
    int N, M; cin >> N >> M;
    
    vector<string> A(N), B(M);
    for(int i = 0; i < N; i++) cin >> A[i];
    for(int i = 0; i < M; i++) cin >> B[i];
    for(int i = 0; i <= N - M; i++){
        for(int j = 0; j <= N - M; j++){
            bool flag = true;
            for(int k = 0; k < M; k++){
                if(!flag) break;
                for(int l = 0; l < M; l++){
                    if(A[k+i][l+j] != B[k][l]) {
                        flag = false;
                        break;
                    }
                }
            }
            if(flag){
                cout << "Yes" << endl;
                return 0;
            }
        }
    }
    cout << "No" << endl;
}

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

int main (){
    
    int N;
    cin >> N;
    
    int i=N/2;
    
    if (N%2 != 0) i++;
    
    float a = (float) i/N;
    
    cout << a << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef tuple<ll,ll,ll> T;
const long long INF = 1LL<<60;
const int MOD = 1000000000+7;
#define rev(s) (string((s).rbegin(), (s).rend()))
template < typename T > inline string toString( const T &a ) { ostringstream oss; oss << a; return oss.str(); };
// cout << fixed << setprecision(10) << ans << endl;
// *min_element(c + l, c + r) *max_element(c + l, c + r)
// int dx[8]={1,1,0,-1,-1,-1,0,1};
// int dy[8]={0,1,1,1,0,-1,-1,-1};
// int dx[4]={1,0,-1,0};
// int dy[4]={0,1,0,-1};
// struct Edge {
//   int to, id;
//   Edge(int to, int id): to(to), id(id) {}
// };

ll a[200020];

int main() {
  int n;cin>>n;
  rep(i,n) cin>>a[i];
  ll p=a[0],q=0,r=a[1]+a[2],s=0;
  ll ans = 1LL<<60;
  int c1=0,c2=2;
  rep(i,n-3) s+=a[i+3];
  for(int i = 1;i<n-2;i++){
    q+=a[i];
    r-=a[i];
    while(c1+1<i&&abs(q-p)>abs(p+2*a[c1+1]-q)){
      c1++;
      p+=a[c1];
      q-=a[c1];
    }
    while(c2+1<n-1&&abs(r-s)>abs(r+2*a[c2+1]-s)) {
      c2++;
      r+=a[c2];
      s-=a[c2];
    }
    ll mn=1000000000000000,mx=-1;
    mn=min(mn,p);
    mn=min(mn,q);
    mn=min(mn,r);
    mn=min(mn,s);
    mx=max(mx,p);
    mx=max(mx,q);
    mx=max(mx,r);
    mx=max(mx,s);
    ans = min(ans,mx-mn);
  }
  cout<<ans<<endl;
}



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

using namespace std;
#define N 100010
ll n,k,h[N],f[N];
int main(){
    cin>>n>>k;
    for(int i=0;i<n;i++)cin>>h[i];
    f[0]=0;
    for(int i=1;i<n;i++){
        f[i]=1e17;
        for(int j=1;j<=k;j++){
         if(i-j>=0){
             f[i]=min(f[i],f[i-j]+abs(h[i]-h[i-j]));   
         }
        }
    }
    cout<<f[n-1]<<endl;
 return 0;   
}

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

#define lli long long int
#define REP(i,s,n) for(int i=s;i<n;i++)
#define NUM 2520
#define INF (1LL<<50)
#define DEBUG 0
#define mp(a,b) make_pair(a,b)
#define SORT(V) sort(V.begin(),V.end())
#define PI (3.141592653589794)
#define TO_STRING(VariableName) # VariableName
#define LOG(x) if(DEBUG)cout<<TO_STRING(x)<<"="<<x<<" "<<endl;
#define LOG2(x,y) if(DEBUG)cout<<TO_STRING(x)<<"="<<x<<" "<<TO_STRING(y)<<"="<<y<<endl;
#define LOG3(x,y,z) if(DEBUG)cout<<TO_STRING(x)<<"="<<x<<" "<<TO_STRING(y)<<"="<<y<<" "<<TO_STRING(z)<<"="<<z<<endl;

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

lli dp[6000][6000];

void func(long long N, std::string S){

    lli ans = 0;
    for(lli i=N;i>0;i--){
        for(lli j=N;j>i;j--){
            if(S[i-1] == S[j-1])chmax(dp[i-1][j-1],dp[i][j]+1);
            chmax(ans,min(dp[i-1][j-1],j-i));
        }
    }

    cout<<ans<<endl;

}

int main(){
    // cout << fixed << setprecision(5);

    long long N;
    scanf("%lld",&N);
    std::string S;
    std::cin >> S;
    func(N, S);
    return 0;
}


Measured memory_bytes: 235648
import sys,queue,math,copy,itertools,bisect,collections,heapq

def main():
    sys.setrecursionlimit(10**7)
    INF = 10**18
    MOD = 10**9 + 7
    LI = lambda : [int(x) for x in sys.stdin.readline().split()]
    _LI = lambda : [-int(x) for x in sys.stdin.readline().split()]
    NI = lambda : int(sys.stdin.readline())
    SI = lambda : sys.stdin.readline().rstrip()
    DD = ((1,0),(0,1),(-1,0),(0,-1))

    S = SI()
    print(S[:3])

if __name__ == '__main__':
    main()

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

using namespace std;

using ll = long long;

#define rep(i,a,b) for(int i=(a);i<(b);++i)
#define repn(i,n)  rep(i,0,n)

const double EPS = 1e-5;
const int MOD = 1e9+7;

const int N = 20;
int a[N+1];
int b[N+1];
int c[N];
int n;

int main(){
  cin >> n;

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

  ll res = 0;
  for(int i = 1; i < n+1; i++){
    res+=b[a[i]];

    if(i >=2 && a[i-1] + 1 == a[i]){
      res+=c[a[i-1]];
    }
  }

  cout << res << endl;

  return 0;

}


Measured memory_bytes: 384
import math

n=int(input())
a=[int(input()) for _ in range(n)]
if n==1:
  print(a[0])
elif n==2:
  print(a[0]*a[1]//math.gcd(a[0],a[1]))
else:
  r=a[0]*a[1]//math.gcd(a[0],a[1])
  for i in a:
    r=r*i//math.gcd(r,i)
  print(r)

Measured memory_bytes: 9136
using System;
using System.Collections.Generic;
using System.Linq;

public class Hello
{
    private const int MOD_N = 1000000000 + 7;

    public static void Main()
    {
        var s = Console.ReadLine();

        var sum = 15 - s.Length;
        for (int i = 0; i < s.Length; ++i)
        {
            if (s[i] == 'o')
                ++sum;
        }

        Console.WriteLine(sum >= 8 ? "YES" : "NO");
    }

    private static int Comb(int m, int n)
    {
        var t = m - n;
        if (n > t)
            n = t;

        long numerator = 1;
        for (int i = 0; i < n; ++i)
        {
            numerator *= m - i;
            numerator %= MOD_N;
        }
        long denominator = 1;
        for (; n != 0; --n)
        {
            denominator *= n;
            denominator %= MOD_N;
        }

        var inv_denominator = ModInv((int)denominator, MOD_N);
        var ret = (int)(numerator * inv_denominator % MOD_N);

        return ret >= 0 ? ret : ret + MOD_N;
    }

    private static int ModInv(int a, int m)
    {
        int b = m, x = 1, y = 0;
        while (b != 0)
        {
            var t = a / b;
            a -= t * b;
            Swap(ref a, ref b);
            x -= t * y;
            Swap(ref x, ref y);
        }
        x %= m;
        return x >= 0 ? x : x + m;
    }

    private static void Swap<T>(ref T a, ref T b)
    {
        var t = a;
        a = b;
        b = t;
    }
}


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

using vec = vector<pair<int, int64_t>>;
using graph = vector<vec>;
constexpr int64_t inf = 1e18;

int main() {
  int n, m, s;
  cin >> n >> m >> s;
  vector<int> u(m), v(m), a(m), b(m), c(n), d(n);
  for (int i = 0; i < m; i++) {
    cin >> u.at(i) >> v.at(i) >> a.at(i) >> b.at(i);
    u.at(i)--;
    v.at(i)--;
  }
  for (int i = 0; i < n; i++) {
    cin >> c.at(i) >> d.at(i);
  }
  graph to(50 * n * n);
  for (int i = 0; i < m; i++) {
    for (int j = a.at(i); j < 50 * n; j++) {
      to.at(50 * n * u.at(i) + j).emplace_back(50 * n * v.at(i) + j - a.at(i), b.at(i));
      to.at(50 * n * v.at(i) + j).emplace_back(50 * n * u.at(i) + j - a.at(i), b.at(i));
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < 50 * n; j++) {
      int next = min(50 * n - 1, j + c.at(i));
      to.at(50 * n * i + j).emplace_back(50 * n * i + next, d.at(i));
    }
  }
  vector<int64_t> cost(50 * n * n, inf);
  priority_queue<pair<int64_t, int>> q;
  q.emplace(0, min(s, 50 * n - 1));
  while (!q.empty()) {
    auto x = q.top();
    q.pop();
    if (cost.at(x.second) < inf) continue;
    cost.at(x.second) = -x.first;
    for (auto next : to.at(x.second)) {
      if (cost.at(next.first) < inf) continue;
      q.emplace(x.first - next.second, next.first);
    }
  }
  for (int i = 1; i < n; i++) {
    int64_t ans = inf;
    for (int j = 0; j < 50 * n; j++) {
      ans = min(ans, cost.at(50 * n * i + j));
    }
    cout << ans << endl;
  }
}


Measured memory_bytes: 25776
#include<stdio.h>
#define N 10000

int linerSearch(int [],int,int);
int main(){
    int A[N],i,n,q,key,x,count=0;
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%d",&A[i]);
    }
    scanf("%d",&q);
    for(i=0;i<q;i++){
        scanf("%d",&key);
        x= linerSearch(A,n,key);
        if(x!=n+1) count++;
    }
    printf("%d\n",count);
    
    return 0;
}
 
    
  int  linerSearch(int A[],int n, int key){
        int i=0;
        A[n]=key;
        while(A[i]!=key){
            i++;
        }
        if(i==n) return n+1;
        else return i;
    }


Measured memory_bytes: 2112
import java.util.*;
class Main
{
    public static void main (String[] args)
    {
        Scanner sc = new Scanner(System.in);
        long n = sc.nextLong();
        long a = 0;
        for(int i = (int)Math.sqrt(n);i > 0 ; i--){
            if(n % i == 0){
                a = i;
                break;
            }
        }
        int cnt = 0;
        a = n / a;
        while(a > 0){
            a /= 10;
            cnt++;
        }
        System.out.println(cnt);
    }
}

Measured memory_bytes: 21716
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
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(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll a, b;
    cin >> a >> b;
    ll k = llabs(a + b);
    if(k%2 == 0) cout << k/2 << endl;
    else cout << "IMPOSSIBLE" << endl;
    return 0;
}

Measured memory_bytes: 3584
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
using namespace std;
int main()
{
	int a,b,c;
	cin>>a>>b>>c;
	int flag=0;
	if(a>b){
		if(c>=b&&c<=a){
			printf("Yes\n");
		}
		else{
			printf("No\n");
		}
	}
	if(a<b){
		if(c>=a&&c<=b){
			printf("Yes\n");
		}
		else{
			printf("No\n");			
		}
	}
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<unordered_map>
#include<bitset>
using namespace std;
//#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define ARDEB(i,X) cout<< #X <<"["<<i<<"]: "<<X[i]<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define ARDEB(i,X) {}
#define END {}
#endif
typedef long long ll;
#define int ll
#define uset unordered_set
#define umap unordered_map
typedef pair<int,int> P;
struct edge{int to,cost;};
#define REP(i,n) for(int i=0;i<(n);i++)
const int INF=100000000000000000;
const int MOD=1000000007;

int N,A[10];
int ans=0;

int Ceil(int a,int b){return ((a%b==0)?a/b:a/b+1);}

signed main(){
	cin>>N;
	REP(i,5){
		cin>>A[i];
	}
	int Min=*min_element(A,A+5);
	cout<<5+Ceil(N,Min)-1<<endl;
	return 0;
}


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

string F[10];
int W[10], S[10];

int main() {
  ios::sync_with_stdio(false);
  while(true) {
    int N; cin >> N;
    if(N == 0) break;
    for(int i = 0; i < N; ++i) {
      cin >> F[i] >> W[i] >> S[i];
    }
    vector<int> ord(N);
    for(int i = 0; i < N; ++i) ord[i] = i;
    double ansG = 1e9;
    vector<int> ansOrd;
    do {
      bool ok = true;
      for(int i = 0; i < N; ++i) {
        int w = 0;
        for(int j = i + 1; j < N; ++j) w += W[ord[j]];
        if(w > S[ord[i]]) ok = false;
      }
      if(ok) {
        int g = 0;
        for(int i = 0; i < N; ++i) {
          g += (i + 1) * W[ord[i]];
        }
        double G = 1.0 * g / accumulate(W, W + N, 0);
        if(ansG > G) {
          ansG = G;
          ansOrd = ord;
        }
      }
    } while(next_permutation(ord.begin(), ord.end()));
    for(int item : ansOrd) {
      cout << F[item] << endl;
    }
  }
}

Measured memory_bytes: 1212
#include <bits/stdc++.h>
#define fastio() ios_base::sync_with_stdio(false);
using namespace std;
typedef long long ll;
typedef long double ld;

const int maxn = 2e5+5;
int a[maxn];

int main(){
	fastio();
	int n; cin >> n;
	for(int i = 0; i<n; i++) cin >> a[i];
	int nxt = 1;
	for(int i = 0; i<n; i++) if (a[i] == nxt) nxt++;
	if (nxt == 1) puts("-1");
	else printf("%d\n", n-nxt+1);
	return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <iomanip>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
 
using namespace std;
 
#define pb push_back
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL)
 
typedef long long ll;
typedef long double ld;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
 
const int INF = 1e9 + 10, A = 5e3 + 10;
int main() {
    fast_cin();
    int n;
    scanf("%d",&n);
    vector<int>dp(3);
    for(int days=0;days<n;days++) {
            vector<int>curr(3);
            vector<int>newdp(3,0);
            for(int i=0;i<3;i++) {
                    scanf("%d",&curr[i]);
            }
            for(int i=0;i<3;i++) {
                    for(int j=0;j<3;j++) {
                            if(i!=j) {
                                    newdp[j]=max(newdp[j],dp[i]+curr[j]);
                            }
                    }
            }
            dp=newdp;
    }  
        cout<<max(dp[0],max(dp[1],dp[2]));    
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#define INF 0x3f3f3f3f
#include <cstdio>
#include <iostream>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>
#include <cctype>
#include <utility>
 
using namespace std;
 
typedef long long ll;
typedef pair <int,int> P;
typedef pair <int,P > PP;
 
int tx[] = {0,1,0,-1};
int ty[] = {-1,0,1,0};
 
static const double EPS = 1e-8;

class State {
public:
  string cost;
  int pos;
  bool operator<(const State& s) const{
    return cost < s.cost;
  }
  bool operator>(const State& s) const{
    return cost > s.cost;
  }
  State() : cost(""),pos(0) {}
  State(const string& _c,int _p) : cost(_c),pos(_p) {}
};

int main(){
  int total_nodes;
  int total_arrows;
  int star_node_idx;
  int gold_node_idx;
  while(~scanf("%d %d %d %d",
	       &total_nodes,
	       &total_arrows,
	       &star_node_idx,
	       &gold_node_idx)){
    if(total_nodes == 0
       && total_arrows == 0
       && star_node_idx == 0
       && gold_node_idx == 0) break;

    string dp[total_nodes][401];
    vector<string> nodes[total_nodes][total_nodes];
    
    for(int i=0;i<total_nodes;i++){
      for(int j=0;j<=400;j++){
	dp[i][j] = string(1000,'~');
      }
    }

    for(int arrow_idx = 0; arrow_idx < total_arrows; arrow_idx++){
      int from,to;
      string word;
      cin >> from >> to >> word;
      nodes[from][to].push_back(word);
    }

    priority_queue<State,vector<State>,greater<State> >  que;
    que.push(State("",star_node_idx));
    dp[star_node_idx][0] = "";

    string res(1000,'~');
    while(!que.empty()){
      State s = que.top();
      que.pop();
      if(s.cost >= res) continue;

      for(int to=0;to<total_nodes;to++){
	for(int str_idx = 0; str_idx < nodes[s.pos][to].size(); str_idx++){
	  string next_cost = s.cost + nodes[s.pos][to][str_idx];
	  if(next_cost >= res) continue;
	  if(next_cost.size() >= 400) continue;

	  if(next_cost < dp[to][next_cost.size()]){
	    dp[to][next_cost.size()] = next_cost;
	    if(to == gold_node_idx
	       && res > next_cost){
	      res = next_cost;
	    }
	    que.push(State(next_cost,to));
	  }
	}
      }
    }

    if(res.size() > total_nodes * 6){
      cout << "NO" << endl;
    }
    else{
      cout << res << endl;
    }
  }
}

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

#define fst first
#define snd second
#define ll long long
#define ld long double
#define pb push_back
#define emp emplace_back
#define pii pair<int, int>
#define usg unsigned
#define sg signed

using namespace std;

void setIO(){
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
}

const ld PI = 4*atan((ld)1);
const int INF = 1e9+7;

map<string, int>mp;

int main(){
	setIO();
	int n; cin >> n;
	for (int i = 0; i < n; i++){
		string s; cin >> s;
		mp[s]++;
	}
	cout << "AC x " << mp["AC"] << endl;
	cout << "WA x " << mp["WA"] << endl;
	cout << "TLE x " << mp["TLE"] << endl;
	cout << "RE x " << mp["RE"] << endl;
}

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

typedef long long ll;
struct edge {int to, cost; };
 
int main(){
  int n, a;
  cin >> n >> a;
  string ans = "No";
  for(int i=0; i<=a; i++){
    if(n%500==0) ans = "Yes";
    n--;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <iostream>
using namespace std;


int main()
{
    char a[101];
    scanf("%s",a);
    int check=0;
    size_t len=strlen(a);
    for(int i=0;i<len-1;i++){
        for(int j=i+1;j<len;j++){
            if(a[i]=='C'&&a[j]=='F'){
                printf("Yes\n");
                check=1;
                break;
            }
        }
        if(check==1)break;
    }

    if(check==0)printf("No\n");
    return 0;
}

Measured memory_bytes: 384
class MergeSort:
    def __init__(self, array):
        self._arr = array
        self._cnt = 0

    def _merge(self, left, mid, right):
        arr1 = self._arr[left:mid] + [float('inf')]
        arr2 = self._arr[mid:right] + [float('inf')]

        i, j = 0, 0
        for k in range(left, right):
            if arr1[i] <= arr2[j]:
                self._arr[k] = arr1[i]
                i += 1
            else:
                self._arr[k] = arr2[j]
                j += 1

        self._cnt += right - left
        return

    def _merge_sort(self, left, right):
        if right <= left + 1:
            return

        mid = (left + right) // 2
        self._merge_sort(left, mid)
        self._merge_sort(mid, right)
        self._merge(left, mid, right)
        return

    def sort(self):
        self._merge_sort(0, len(self._arr))
        return

    def print(self):
        print(*self._arr)
        print(self._cnt)

n = int(input())
arr = [int(s) for s in input().split()]

alg = MergeSort(arr)
alg.sort()
alg.print()



Measured memory_bytes: 61676
def numberofblues(N,A,B): 
    
    if A==0:
        return 0
    elif N<=A:
         return N
    else:
        k=(N-A)//(A+B)
        l=N-A-k*(A+B)
        if l<=B:
            return A+k*A
        else:
            return A+k*A+l-B
   
N,A,B=map(int, input().split())
print(numberofblues(N,A,B))

Measured memory_bytes: 3060
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <vector>

using namespace std;
using ll = long long;

// inf
constexpr ll infl = 10000000000000000LL;
constexpr int inf = 1000000000;

int dist[201][201];
bool visited[201];
int N, M, R;

int solve(int cur, int vcnt, const vector<int> &r) {
    if (vcnt == R)
        return 0;

    int ans = inf;
    visited[cur] = true;
    for (int i : r) {
        if (!visited[i])
            ans = min(ans, dist[cur][i] + solve(i, vcnt + 1, r));
    }
    visited[cur] = false;
    return ans;
}

int main() {
    cin >> N >> M >> R;
    vector<int> r(R);
    for (int i = 0; i < R; ++i) {
        cin >> r[i];
    }
    fill((int *)dist, (int *)(dist + 201), inf);
    for (int i = 0; i < M; ++i) {
        int a, b, c;
        cin >> a >> b >> c;
        dist[a][b] = dist[b][a] = c;
    }
    for (int k = 1; k <= N; ++k) {
        for (int i = 1; i <= N; ++i) {
            for (int j = 1; j <= N; ++j) {
                dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
            }
        }
    }
    for (int i = 1; i <= N; ++i) {
        dist[0][i] = 0;
    }
    cout << solve(0, 0, r) << endl;
    return 0;
}

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

using namespace std;

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

typedef long long LL;
typedef vector<int> VI;

int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A[i];
    if (A[i] % 2 == 0) {
      if (!(A[i] % 3 == 0 || A[i] % 5 == 0)) {
        cout << "DENIED" << endl;
        return 0;
      }
    }
  }
  cout << "APPROVED" << endl;
  return 0;
}


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

#define REP(i, x, n) for (int i = x; i < (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x.size())
#define popcount(x) __builtin_popcount(x)
#define popcountll(x) __builtin_popcountll(x)
#define uniq(x) x.erase(unique(x.begin(), x.end()), x.end())
#define F first
#define S second
#define mp make_pair
#define eb emplace_back
#define pii pair<int, int>
#define pll pair<ll, ll>

using namespace std;

typedef long long ll;

/* --- INFやMODの値が適切か確認する --- */
// const int INF = 1 << 30;
// const ll INF = 1LL << 60;
// const ll MOD = 1000000007;

int main() {
  vector<int> v(3);
  rep(i, 3) cin >> v[i];
  sort(all(v));
  cout << v[0] + v[1] << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define MAXN 100005
typedef long long LL;

LL pre[MAXN], cur[MAXN];

int main()
{
	int n, w, wei, val;
	cin >> n >> w;
	
	fill(pre+1, pre+w+1, -LLONG_MAX);
	
	for (int i = 1; i <= n; i++)
	{
		cin >> wei >> val;
		
		copy(pre, pre+w+1, cur);
		
		for (int j = wei; j <= w; j++)
		{
			cur[j] = max(pre[j], pre[j-wei]+val);
		}
		
		copy(cur, cur+w+1, pre);
	}
	
	cout << *max_element(cur+1, cur+w+1) << "\n";
}

Measured memory_bytes: 1792
#define _USE_MATH_DEFINES
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <string>
#include <vector>
#include <utility>
#include <complex>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <deque>
#include <tuple>
#include <bitset>
#include <limits>
#include <algorithm>
#include <array>
#include <random>
#include <complex>
#include <regex>
#include <iomanip>
using namespace std;
typedef long double ld;
typedef long long ll;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define fcout cout << fixed << setprecision(10)
#define rep(i,n)    for(int i=0; i<(int)n; i++)
#define mp(a,b) make_pair(a,b)
#define pb push_back
#define all(x) x.begin(), x.end()
#define F first
#define S second
const ll inf = 1e18;
const ll mod = 1e9 + 7;

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

// mod. m での a の逆元 a^(-1) を計算する。
ll modinv(ll a, ll m) {
    ll b = m, u = 1, v = 0;
    while (b) {
        ll t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

ll modpow(ll a, ll n){
    ll res = 1;
    while(n>0){
        if(n&1){
            res = res * a % mod;
        }
        a = a * a % mod;
        n >>=1;
    }
    return res;
}



int main(){
    string s;
    cin >> s;
    cout << s[0] << s[1] << s[2] << endl;
}



Measured memory_bytes: 3604
#include <stdio.h>

#define MAX 100005
#define NIL -1

typedef struct{
  int p;
  int l;
  int r;
}Node;

Node T[MAX];

int n, D[MAX];

void print(int u){
  int i, c;

  printf("node %d: parent = %d, depth = %d, ", u, T[u].p, D[u]);
  if(T[u].p==NIL) printf("root, ");
  else if(T[u].l==NIL) printf("leaf, ");
  else printf("internal node, ");

  printf("[");

  for(i=0, c=T[u].l; c!=NIL; i++, c=T[c].r){
    if(i>0) printf(", ");
    printf("%d", c);
  }
  printf("]\n");
}

int rec(int u, int p){

  D[u]=p;
  if(T[u].r != NIL) rec(T[u].r, p);
  if(T[u].l != NIL) rec(T[u].l, p+1); 

}

int main(){
  int i, j, d, v, c, l, r;

  scanf("%d",&n);

  for(i=0; i<n; i++) T[i].p=T[i].l=T[i].r=NIL;

  for(i=0; i<n; i++){
    scanf("%d%d",&v, &d);
    for(j=0; j<d; j++){
      scanf("%d", &c);
      if(j==0) T[v].l = c;
      else T[l].r = c;
      l=c;
      T[c].p=v;
    }
  }
  for(i=0; i<n; i++){
    if(T[i].p==NIL) r=i;
  }

  rec(r,0);

  for(i=0; i<n; i++) print(i);

  return 0;
}

Measured memory_bytes: 5296
#include <bits/stdc++.h>
#pragma GCC optimize("O3")

#define fi first
#define se second
#define ep emplace
#define eb emplace_back
#define mp make_pair
#define pi pair<int,int>
#define vi vector<int>
#define vpi vector<pair<int,int>>
#define vll vector<ll>
#define vpll vector<pair<ll,ll>>
#define endl '\n'

#define si(v) int((v).size())
#define all(v) (v).begin(), (v).end()
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i) 
#define rep2(i, n, m) for (ll i = n; i <= (ll)(m); ++i)
#define rep3(i, n, m) for (ll i = n; i >= (ll)(m); --i)

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

using ll = long long;
using ld = long double;
using namespace std;

constexpr ll MOD = 1000000007;

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

  int n, m, c; cin >> n >> m >> c;
  vi b(m);

  rep(i, m) cin >> b[i];
  int ans = 0;

  rep(i, n) {
    int score = 0;

    rep(j, m) {
      int a; cin >> a;
      score += a * b[j];
    }

    if (score + c > 0) ++ans;
  }

  cout << ans << endl;

  return (0);
}


Measured memory_bytes: 3656
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;
int main(){
	string s;	cin>>s;
	int a=0,z=s.size()-1;
	while(s[a]!='A')	a++;
	while(s[z]!='Z')	z--;
	cout<<z-a+1<<endl;
	return 0;
}


Measured memory_bytes: 640