akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> pi;
#define debug(x) cerr << #x << ": " << x << endl;
#define debug2(x, y) debug(x) debug(y);
#define repn(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(i, a) for(int i = 0; i < (int)(a); i++)
#define all(v) v.begin(), v.end() 
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define sq(x) ((x) * (x))

template<class T> T gcd(T a, T b){ return ((b == 0) ? a : gcd(b, a % b)); }

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	//freopen("input.in", "r", stdin);
	//freopen("output.out", "w", stdout);
	ll n, m, v, p;
	cin >> n >> m >> v >> p;
	vector<ll> a(n + 1);
	repn(i, 1, n + 1) cin >> a[i];
	sort(a.begin() + 1, a.end());
	reverse(a.begin() + 1, a.end());
	//repn(i, 1, n + 1) cout << a[i] << " ";
	//cout << endl;
	vector<ll> sum(n + 1, 0LL);
	sum[0] = 0LL;
	repn(i, 1, n + 1) sum[i] = 1LL * (sum[i - 1] + a[i]);
	ll ans = p;
	for(ll i = p + 1; i <= n; i++){
		if((a[i] + m) < a[p]) continue; //no way
		if((n - i + 1) >= v){
			ans++;
			continue;
		}
		ll num = max(0LL, (v - ((n - i) + 1)));
		num -= (p - 1);
		if(num <= 0){
			ans++;
			continue;
		}
		ll tmp = (ll)((ll)((a[i] + m) * (i - p)) - (ll)(sum[i - 1] - sum[p - 1]));
		if(tmp >= (num * m)) ans++;
	}
	cout << ans << endl;
	return 0;
}
/*
Things to look out for:
	- Integer overflows
	- Array bounds
	- Special cases
Be careful!
*/


Measured memory_bytes: 1792
import java.util.Scanner;

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

        int count = 0;
        for(char x : results.toCharArray()){
            if(x == 'x'){
                count++;
            }
        }

        if(count < 8){
            System.out.println("YES");
        }else{
            System.out.println("NO");
        }


    }
}


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

int main() {
	int N,M,X; cin >>N>>M>>X;
	vector<int> Gates(N+1,0);
	for(int i = 0 ; i < M ; i++){
		int k; cin >>k;
		Gates[k]++;
	}
	int ans = 0;
	for(int i = 0 ; i < X ; i++){
		ans += Gates[i];
	}
	cout << min(ans,M-ans) << endl;
}

Measured memory_bytes: 256
import java.util.*;

class Main{
    static Scanner sc = new Scanner(System.in);
    public static void main(String args[]){
        int H=sc.nextInt(),W=sc.nextInt(),K=sc.nextInt(),res=0;
        char[][] c=new char[H][W];
        for(int i=0;i<H;i++){
            String t=sc.next();
            for(int j=0;j<W;j++){
                c[i][j]=t.charAt(j);
            }
        }
        for(int i=0;i<1<<H;i++){
            for(int j=0;j<1<<W;j++){
                int d=0;
                for(int k=0;k<H;k++){
                    for(int l=0;l<W;l++){
                        if((((i>>k)&1)==0)&&(((j>>l)&1)==0)&&c[k][l]=='#'){
                            d++;
                        }
                    }
                }
                if(d==K){
                    res++;
                }
            }
        }
        System.out.println(res);
    }
}


Measured memory_bytes: 35720
#include<bits/stdc++.h>
#define ull usigned long long
#define ll long long
#define pii pair < int, int >
#define pll pair < ll, ll >
#define pb push_back
#define maxn 100005
using namespace std;

int main()
{
    int n;

    cin >> n;

    string s = to_string(n);

    for(int i = 0; i < s.size(); i++){
        if(s[i] == '7'){
            cout << "Yes" << endl;

            return 0;
        }
    }

    cout << "No" << endl;

    return 0;
}


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

using namespace std;

#define REP(i, n)   for(int i = 0; i < (n); i++)
#define REPS(i, n)  for(int i = 1; i <= (n); i++)
#define RREP(i, n)  for(int i = (n)-1; i >= 0; i--)
#define RREPS(i, n) for(int i = (n); i > 0; i--)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
#define mp make_pair
#define mt make_tuple
#define pb push_back

using ll  = long long;
using pi  = pair<int, int>;
using pl  = pair<ll, ll>;
using vi  = vector<int>;
using vl  = vector<ll>;
using vs  = vector<string>;
using vb  = vector<bool>;
using vvi = vector<vi>;
using vvl = vector<vl>;

const int MOD = 1e9 + 7;
const int INF = 1e9 + 7;
const ll  INFL = 1e18;
const double PI = 3.141592653589793;
const double EPS = 1e-9;

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(a > b) { a = b; return true; } return false; }

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

    char a, b; cin >> a >> b;
    if(a == b) cout << 'H' << endl;
    else cout << 'D' <<endl;
}

Measured memory_bytes: 3632
#include <iostream>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<(n);++i)

ll gcd(ll a, ll b) {
  return b != 0 ? gcd(b, a % b) : a;
}

int main(){
  int n;cin>>n;
  ll t,s,ans=1;
  rep(i,n){
    scanf("%lld",&t);
    s=gcd(t,ans);
    ans=ans/s*t;
  }
  cout<<ans<<endl;    
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <tuple>
#include <cmath>
#include <queue>
#include <vector>
#include <map>
using namespace std;

#define ll int64_t
const long MOD = 1e9 + 7;


ll gcd( ll m, ll n )
{
  // 引数に０がある場合は０を返す
  if ( ( 0 == m ) || ( 0 == n ) )
    return 0;

  // ユークリッドの方法
  while ( m != n )
  {
    if ( m > n ) m = m - n;
    else         n = n - m;
  }
  return m;
}//gcd

ll lcm( ll m, ll n )
{
  // 引数に０がある場合は０を返す
  if ( ( 0 == m ) || ( 0 == n ) )
    return 0;

  return ((m / gcd(m, n)) * n); // lcm = m * n / gcd(m,n)
}//lcm

int main()
{
  ll n;
  priority_queue<ll> v;

  cin >> n;
  vector <ll> a(n, 0);
  // vector <ll> a;
  vector <ll> b(n, 0);
  // priority_queue<ll> v;



  for (ll i = 0; i < n; i++) {
    cin >> a[i];
    v.push(a[i]);
    // cout << a[i] << endl;
  }

  // for (ll i = n - 1; i >= 0; i--) { //b0は大きい
  //   b[i] = v.top();
  //   v.pop();
  //   // cout << b[i] << endl;
  // }
  // // cout << n<<endl;

  // // for (ll i = 0; i < n; i++) {
  // //   cout << b[i] << endl;
  // // }


  // long lcmnv = b[0];
  // for (ll i = 1; i < n; i++) {
  //   lcmnv = lcm(lcmnv, b[i]);
  // }



  // lcmnv--;
  // cout << lcmnv << endl;
  ll ans = 0;
  for (ll i = 0; i < n; i++) {
    // ans += lcmnv % b[i];
    ans += a[i]-1;
  }


  cout <<  ans;

  return 0;
}






Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()

typedef long long lint;
int main(){
    int n,m;
    cin >> n;
    cin >> m;
    cout << n * (n - 1) / 2 + m * (m - 1) / 2<< endl;
}

Measured memory_bytes: 256
#include<stdio.h>
void cookie(int *x,int *y){
    *y=*y+*x/2;
    *x=*x/2;
}
int main(){
  int a,b,k;
  scanf("%d %d %d",&a,&b,&k);
  int i;
  for(i=0;i<k;i++){
    if(i%2==0) cookie(&a,&b);
    if(i%2==1) cookie(&b,&a);
  }
  printf("%d %d\n",a,b);
}

Measured memory_bytes: 128
import sys
def input(): return sys.stdin.readline().rstrip()
import math
def is_prime(n):
    if n==1:return False
    for k in range(2,int(math.sqrt(n))+1):
        if n%k==0:
            return False
    return True
def main():
    x=int(input())
    while True:
        if is_prime(x)==True:
            print(x)
            break
        x+=1
if __name__=='__main__':
    main()

Measured memory_bytes: 3064
c = [[int(_) for _ in input().split()] for i in range(3)]
ans = True
for x in range(2):
    c0 = c[x+1][0] - c[x][0]
    c1 = c[x+1][1] - c[x][1]
    c2 = c[x+1][2] - c[x][2]
    if c0 != c1 or c1 != c2 or c2 != c0:
        ans = False
for y in range(2):
    c0 = c[0][y+1] - c[0][y]
    c1 = c[1][y+1] - c[1][y]
    c2 = c[2][y+1] - c[2][y]
    if c0 != c1 or c1 != c2 or c2 != c0:
        ans = False
if(ans):
    print('Yes')
else:
    print('No')

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

int main() {
 int A,B,C,K;//赤　緑　青
  cin>>A>>B>>C>>K;
  
  int count=0,ans=0;
  while(B<=A){
    B=B*2;
    count++;
  }
  while(C<=B){
    C=C*2;
    count++;
  }
  if(count<=K) cout<<"Yes";
  else cout<<"No";
  //cout<<count<<" "<<A<<B<<C;;
}

Measured memory_bytes: 3628
using System;
using System.Collections.Generic;
using System.Collections;
using System.Linq;
using System.Numerics;




namespace contest
{

    class contest
    {


        static void Main(string[] args)
        {


            //int n = int.Parse(Console.ReadLine());
            //var input = Console.ReadLine().Split().Select(int.Parse).ToArray();

            //var num = Console.ReadLine().Split().Select(int.Parse).ToArray();



            //int n = int.Parse(Console.ReadLine());


            //int n = int.Parse(Console.ReadLine());
            //var array = Console.ReadLine().Split().Select(int.Parse).ToArray();

            string s = Console.ReadLine();

            

            //bool check = true;
            string tmp = "";
            for(int i=s.Length-1; i>=0; i--)
            {
                tmp += s[i];

                if (tmp.Length == 5 && (tmp == "maerd" || tmp == "esare"))
                {
                    tmp = "";
                }
                else if (tmp.Length == 6 && tmp == "resare")
                {
                    tmp = "";
                }
                else if (tmp.Length == 7 && tmp == "remaerd")
                {
                    tmp = "";
                }
                else if (tmp.Length > 7) break;
                

            }

            if (tmp =="") Console.WriteLine("YES");
            else Console.WriteLine("NO");
           







        }

       
       

    }

 
    
}


Measured memory_bytes: 7128
#define dbg(fmt,...) fprintf(stderr,fmt,__VA_ARGS__)
#define dpri(x) dbg(#x ": %d\n", x)
#define dprs(x) dbg(#x ": %s\n", x)
#include <stdio.h>
typedef long long ll;
const int MYINF = 1e9+7;
typedef int bool;
bool true = 1;
bool false = 0;

int n, k;
int w[100010];

bool check(int capa) {
	int i, j, c;
	for (i = 0, j = 0; j < k; j++) {
		c = capa;
		while ((c - w[i]) >= 0) {
			c -= w[i];
			i++;
			if (i == n) {
				return true;
			}
		}
	}
	if (i == n) return true;
	return false;
}

int search(int l, int r) {
	int i, m;
	if (r - l < 5) {
		for (i = l - 1; i <= r + 1; i++) {
			if (check(i)) return i;
		}
	}
	m = (l + r) / 2;
	if (check(m)) {
		return search(l, m - 1);
	} else {
		return search(m + 1, r);
	}
}

int main(int argc, char **argv)
{
	int i, maxw, pd, d;
	scanf("%d %d", &n, &k);
	maxw = -1;
	for (i = 0; i < n; i++) {
		scanf("%d", &w[i]);
		if (maxw < w[i]) maxw = w[i];
	}

	if (k >= n) {
		printf("%d\n", maxw);
		return 0;
	}

	for (pd = d = maxw; !check(d); pd = d, d *= 2)
		;
	printf("%d\n", search(pd, d));

	return 0;
}

Measured memory_bytes: 984
#include <bits/stdc++.h>
#include <iomanip>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define fi first
#define se second
#define mp make_pair
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;

ll N,M,H,W,K,A,B;
string S;
string alpha = "abcdefghijklmnopqrstuvwxyz";
string ALPHA = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";

int main(){
    cin>>N;
    vec a(N,0);
    rep(i,N) cin>>a.at(i);
    sort(a.begin(),a.end());
    bool yes = false;
    if(a.at(N-1) == 0) yes = true;
    if((!yes) && N%3 != 0){
        cout<<"No"<<endl;
        return 0;
    }
    N /= 3;
    vec l(3,0), u(3,0);
    rep(i,3){
        l.at(i) = a.at(i*N);
        u.at(i) = a.at((i+1)*N-1);
    }
    if((l[0]==0) && (u[0] == 0) && (l[1] == u[2])) yes = true;
    rep(i,3){
        if(l[i] != u[i]) break;
        if(i == 2){
            if((l[0]^l[1]) == l[2]) yes = true;
        }
    }
    cout<<(yes ? "Yes" : "No")<<endl;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;
using ll = long long ;
using P = pair<int,int> ;
using pll = pair<long long,long long>;
constexpr int INF = 1e9;
constexpr long long LINF = 1e17;
constexpr int MOD = 1000000007;

int main(){
    int n;
    cin >> n;
    vector<ll> A(n),B(n);
    rep(i,n) cin >> A[i];
    rep(i,n){
        B[i] = (i+1) - A[i];
        A[i] = A[i] + (i+1);
    }
    map<ll,int> mp;
    ll ans = 0;
    for(int i=n-1;i>=0;i--){
        ans += mp[A[i]];
        mp[B[i]] ++;
    }
    cout << ans << endl;
    return 0;
}

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

int main() {
  int n,l;
  string ans = "";
  cin >> n >> l;
  vector<string> s(n);
  for(int i = 0; i < n; i++){
    cin >> s.at(i);
  }
  sort(s.begin(),s.end());
  for(int i = 0; i < n; i++){
    ans += s.at(i);
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#pragma comment(linker, "/STACK:102400000,102400000")
#include <bits/stdc++.h>
using namespace std;
#define vi vector<int>
#define pii pair<int,int>
#define pb push_back
#define mp make_pair
#define all(x) x.begin(),x.end()
#define SZ(x) (int)(x.size())
#define rep(i,a,b) for(int i=a;i<b;i++)
#define per(i,a,b) for(int i=b-1;i>=a;i--)
#define inf 1000000007
#define mod 1000000007
#define x first
#define y second
#define pi acos(-1.0)
#define DBG(x) cerr<<(#x)<<"="<<x<<"\n";
//#define dprintf(...) 
#define hash _hash
#define next _next
//#define dprintf(...) fprintf(outFile,__VA_ARGS__)
 
#define FOREACH(it,x) for(__typeof(x.begin()) it=x.begin();it!=x.end();it++)
#define ull unsigned long long
#define ll long long
#define N 300010
 
template <class T,class U>inline void Max(T &a,U b){if(a<b)a=b;}
template <class T,class U>inline void Min(T &a,U b){if(a>b)a=b;}
 
//FILE* outFile;
inline void add(int &a,int b){a+=b;while(a>=mod)a-=mod;}


int pow(int a,int b){
    int ans=1;
    while(b){
        if(b&1)ans=ans*(ll)a%mod;
        a=(ll)a*a%mod;b>>=1;
    }
    return ans;
}

vi g[N];
struct node{
    int t,u,d;
    bool operator <(const node&a)const{
        if(d!=a.d)return d<a.d;
        return t<a.t;
    }
}a[N];
int vis[N][12],b[N];
int main(){
    //freopen("A.in","r",stdin);
    //freopen("A.out","w",stdout);
    //cout<<setprecision(9)<<fixed;
    int T,i,j,k,ca=0,m,K,n;
    scanf("%d%d",&n,&m);
    while(m--){
        scanf("%d%d",&i,&j);i--,j--;
        g[i].pb(j);
        g[j].pb(i);
    }
    scanf("%d",&m);
    priority_queue<node>q;
    rep(i,1,m+1){
        scanf("%d%d%d",&a[i].u,&a[i].d,&b[i]);a[i].u--;
        a[i].t=i;
        q.push(a[i]);
        vis[a[i].u][a[i].d]=i;
    }
    while(!q.empty()){
        node e=q.top();q.pop();
        if(vis[e.u][e.d]!=e.t)continue;
        if(e.d==0)continue;
        for(auto v:g[e.u]){
            if(vis[v][e.d-1]<e.t){
                vis[v][e.d-1]=e.t;
                q.push((node){e.t,v,e.d-1});
            }
        }
    }
    rep(i,0,n){
        int K=0;
        rep(j,0,11)Max(K,vis[i][j]);
        printf("%d\n",b[K]);
    }
    //cerr<<clock()*1./CLOCKS_PER_SEC<<"ms\n";
    return 0;
}

Measured memory_bytes: 28396
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define ls (o<<1)
#define rs (o<<1|1)
#define pb push_back
const double PI= acos(-1.0);
const int M = 1e5+7;
/*
int head[M],cnt;
void init(){cnt=0,memset(head,0,sizeof(head));}
struct EDGE{int to,nxt,val;}ee[M*2];
void add(int x,int y,int z){ee[++cnt].nxt=head[x],ee[cnt].to=y,ee[cnt].val=z,head[x]=cnt;}
*/


int main()
{
	ios::sync_with_stdio(false);
  	cin.tie(0);
  	ll n,m;
  	cin>>n>>m;
  	ll ans=n*m;
  	if(n==1||m==1)
  	{
  		cout<<1<<endl;
  		return 0;
	  }
  	if((n%2==1)&&(m%2==1))cout<<(ans+1)/2<<endl;
  	else cout<<ans/2<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ll long long int
const int INF = 2147483647;

using namespace std;

int main()
{
  int n;
  cin >> n;
  vector<ll> a(3 * n);
  REP(i, 3 * n)
  {
    cin >> a[i];
  }
  sort(a.begin(), a.end());
  ll ans = 0;
  REP(i, n)
  {
    ans += a[n + i * 2];
  }
  cout << ans << endl;
}


Measured memory_bytes: 2560
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,l,r) for(long long i=(l);i<(r);++i)
#define REP(i,n) FOR(i,0,n)
#define int long long
#define _GLIBCXX_DEBUG
const int INF=1e15;

signed main(){
    int N;
    cin>>N;
    for(int i=1;i<1e5;i++){
      	if(i*(i+1)/2<=N&&(i+1)*(i+2)/2>N){
            if(i*(i+1)/2==N)cout<<i<<endl;
          	else cout<<i+1<<endl;
            break;
        }
    }
}

Measured memory_bytes: 256
mod = 10**9+7
n, K = map(int, input().split())
a = [[int(x) for x in input().split()] for _ in range(n)]

A = [a]

i = 1
while 2**i <= K:
    mtrix = []
    for j in range(n):
        raw = []
        for l in range(n):
            tmp = 0
            for k in range(n):
                tmp += A[-1][j][k] * A[-1][k][l]
            raw.append(tmp % mod)
        mtrix.append(raw)
    A.append(mtrix)
    i += 1

bit_max = i

ans = [[[0]*n for _ in range(n)]]
for i in range(n):
    for j in range(n):
        if i == j:
            ans[-1][i][j] = 1

for i in range(bit_max):
    if (K >> i) & 1:
        mtrix = []
        for j in range(n):
            raw = []
            for l in range(n):
                tmp = 0
                for k in range(n):
                    tmp += ans[-1][j][k] * A[i][k][l]
                raw.append(tmp % mod)
            mtrix.append(raw)
        ans.append(mtrix)

ans = sum(map(lambda x: sum(x) % mod, ans[-1]))

print(ans % mod)


Measured memory_bytes: 70236
while 1:
    n,a,b=map(int,input().split())
    if n==a==b==0:break
    c=0;d=[1]+[0]*1000000
    for i in range(0,n+1):
        if d[i]:
            if i+a<=n:d[i+a]=1
            if i+b<=n:d[i+b]=1
        else:c+=1
    print(c)

Measured memory_bytes: 30956
#include <iostream>
#include <stdlib.h>
//#include <string.h>

using namespace std;

int main()
{
    long n,m,a[29][29],b[50],i,j,c,sum,count=0;
    cin>>n>>m>>c;
    for(i=0;i<m;i++)
        cin>>b[i];
    for(i=0;i<n;i++)
    {
        for(j=0;j<m;j++)
            cin>>a[i][j];
    }


    for(i=0;i<n;i++)
    {
        sum=0;
        for(j=0;j<m;j++)
        {
            sum=sum+a[i][j]*b[j];
        }
        if((sum+c)>0)
            count++;
    }
    cout<<count;

    return 0;
}


Measured memory_bytes: 3616
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<cstdio>
#include<cmath>
#include<deque>
#include<numeric>
#include<queue>
#include<stack>
#include<cstring>
#include<limits>
#include<functional>
#include<unordered_set>
#include<iomanip>
#include<cassert>
#include<regex>
#include<bitset>
#include<complex>
#include<chrono>
#include<random>
#define rep(i,a) for(int i=(int)0;i<(int)a;++i)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(),x.end()
using ll=long long;
constexpr ll mod = 1e9 + 7;
constexpr ll INF = 1LL << 60;

ll gcd(ll n, ll m) {
	ll tmp;
	while (m!=0) {
		tmp = n % m;
		n = m;
		m = tmp;
	}
	return n;
}

ll lcm(ll n, ll m) {
	return abs(n * m) / gcd(n, m);//gl=xy
}
 
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;
}
 
using namespace std;
//ここから

void solve(){
  ll n,m;
  cin>>n>>m;
  ll x=(m-2*n)/2;
  chmax(x,0LL);
  cout<<min(n+x/2,(m-x)/2);
}

int main(){
	ios::sync_with_stdio(false);
  cin.tie(0);
	cout<<fixed<<setprecision(15);
  solve();
	return 0;
}


Measured memory_bytes: 256
H,W = map(int,input().split())
s = [list(input()) for _ in range(H)]
flag = True

def check(x,y):
    global flag
    for dx,dy in ((-1,0),(1,0),(0,-1),(0,1)):
        sx = x + dx
        sy = y + dy
        if sx < 0 or sx >= W or sy < 0 or sy >= H:
            continue
        if s[sy][sx] == '#':
            break
    else:
        flag = False
    return flag

for y in range(H):
    for x in range(W):
        if s[y][x] == '.':
            continue
        flag = check(x,y)
print('Yes' if flag else 'No')

Measured memory_bytes: 3064
#include <queue>
#include <cstring>
#include <iostream>
using namespace std;

const int N = 1111;
const int cx[] = {0, 0, 1, -1}, cy[] = {1, -1, 0, 0};
char maze[N][N];
int step[N][N];
int h, w, n, sx, sy, ans;

int bfs(int cheese){
    memset(step, -1, sizeof(step));
    queue<pair<int, int> > que;
    que.push(make_pair(sx, sy));
    step[sx][sy] = 0;
    while(!que.empty()){
        int x = que.front().first, y = que.front().second;
        que.pop();
        for(int i = 0; i < 4; ++i){
            int nx = x + cx[i], ny = y + cy[i];
            if(nx < 0 || h <= nx || ny < 0 || w <= ny || maze[nx][ny] == 'X' || step[nx][ny] != -1) continue;
            step[nx][ny] = step[x][y] + 1;
            if(maze[nx][ny] - '0' == cheese){
                sx = nx;
                sy = ny;
                return step[nx][ny];
            }
            que.push(make_pair(nx, ny));
        }
    }
    return 0;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    while(cin >> h >> w >> n){
        for(int i = 0; i < h; ++i)
            for(int j = 0; j < w; ++j){
                cin >> maze[i][j];
                if(maze[i][j] == 'S'){
                    sx = i;
                    sy = j;
                }
            }
        ans = 0;
        for(int i = 1; i <= n; ++i)
            ans += bfs(i);
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 8960
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <sstream>
#include <algorithm>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <list>
#include <cstdio>
#include <iostream>
#include <cmath>
#include <climits>
#include <bitset>
#include <functional>
#include <numeric>
#include <ctime>
#include <cassert>
#include <cstring>
#include <fstream>

using namespace std;

int main() {
	int a, b, c, d, e;
	cin >> a >> b >> c >> d >> e;
	int k;
	cin >> k;
	if (e - a > k)
		cout << ":(" << endl;
	else
		cout << "Yay!" << endl;

	return 0;
}

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

class dice{
    public :
    int d[6] ;
    void in(vector<int> &a){
        for(int i=0;i<6;i++) d[i] = a.at(i) ;
    }
    void roll(char c){
        if(c=='N'){
            int sub = d[0] ;
            d[0] = d[1] ;
            d[1] = d[5] ;
            d[5] = d[4] ;
            d[4] = sub ;
        }
        if(c=='S'){
            int sub = d[0] ;
            d[0] = d[4] ;
            d[4] = d[5] ;
            d[5] = d[1] ;
            d[1] = sub ;
        }
        if(c=='E'){
            int sub = d[0] ;
            d[0] = d[3] ;
            d[3] = d[5] ;
            d[5] = d[2] ;
            d[2] = sub ;
        }
        if(c=='W'){
            int sub = d[0] ;
            d[0] = d[2] ;
            d[2] = d[5] ;
            d[5] = d[3] ;
            d[3] = sub ;
        }
    }
    int serch(int n){
        for(int i=0;i<6;i++){
            if(d[i]==n) return i ;
        }
    }
} ;

bool check(dice d1,dice d2,vector<vector<int>> &uall,int u){
    vector<int> a(6) ;
    vector<int> b(6) ;
    for(int i=0;i<6;i++){
        a.at(i) = d1.d[i] ;
        b.at(i) = d2.d[i] ;
    }
    sort(a.begin(),a.end()) ;
    sort(b.begin(),b.end()) ;
    if(a!=b) return false ;
    bool ok = false ;
    if(u==1) d1.roll('N') ;
    if(u==2) d1.roll('W') ;
    if(u==3) d1.roll('E') ;
    if(u==4) d1.roll('S') ;
    if(u==5){
        d1.roll('N') ;
        d1.roll('N') ;
    }
    for(int i=0;i<4;i++){
        if(d1.d[u]==d2.d[u]) break ;
        d2.roll('N') ;
    }
    for(int i=0;i<4;i++){
        if(d1.d[u]==d2.d[u]) break ;
        d2.roll('E') ;
    }
    if(d1.d[u]!=d2.d[u]) return false ;
    for(int i=0;i<4;i++){
        if(d1.d[uall.at(u).at(1)]==d2.d[uall.at(u).at(1)]) break ;
        d2.roll('N') ;
        d2.roll('W') ;
        d2.roll('S') ;
    }
    if(d1.d[uall.at(u).at(1)]==d2.d[uall.at(u).at(1)]&&d1.d[uall.at(u).at(2)]==d2.d[uall.at(u).at(2)]&&d1.d[uall.at(u).at(3)]==d2.d[uall.at(u).at(3)]&&d1.d[uall.at(u).at(4)]==d2.d[uall.at(u).at(4)]) ok = true ;
    return ok ;
}

int main(){
    vector<vector<int>> ufr = 
    {
        {-1,2,4,1,3,-1},
        {3,-1,0,5,-1,2},
        {1,5,-1,-1,0,4},
        {4,0,-1,-1,5,1},
        {2,-1,5,0,-1,3},
        {-1,3,1,4,2,-1},
    } ;
    vector<vector<int>> uall =
    {
        {0,1,2,3,4,5},
        {1,0,3,2,5,4},
        {2,0,1,4,5,3},
        {3,0,4,1,5,2},
        {4,0,2,3,5,1},
        {5,1,3,2,4,0},
    };
    int n ; cin >> n ;
    vector<dice> d(n) ;
    for(int i=0;i<n;i++){
        vector<int> a(6) ;
        for(int j=0;j<6;j++) cin >> a.at(j) ;
        d.at(i).in(a) ;
    }
    for(int i=0;i<n-1;i++){
        for(int j=i+1;j<n;j++){
            for(int k=0;k<6;k++){
                if(check(d.at(i),d.at(j),uall,k)){
                    cout << "No" << endl ;
                    return 0 ;
                }
            }
        }
    }
    cout << "Yes" << endl ;
}


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

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

static const int MAX=100100;
static const ll INF=1e15;

ll d[MAX];

struct edge{
    int to,cost;
};

vector<edge> g[MAX];

void daijkstra(int s){
    priority_queue<P,vector<P>,greater<P> > que; //小さいものから取り出す
    fill(d,d+MAX,INF);
    que.push(P(0,s));
    d[s]=0;
    while(!que.empty()){
        P p=que.top(); que.pop();
        int v=p.second;
        if(d[v]<p.first) continue;
        for(int i=0;i<g[v].size();i++){
            edge e=g[v][i];
            if(d[e.to]>d[v]+e.cost){
                d[e.to]=d[v]+e.cost; //よりコストの小さい辺があれば張りなおす
                que.push(P(d[e.to],e.to));
            }
        }
    }
}

//g[a].push_back(edge{b,c}); //入力例
//g[b].push_back(edge{a,c});

int main(){
    int N,M; cin >> N >> M;
    for(int i=0;i<M;i++){
        int l,r,c; cin >> l >> r >> c;
        l--;r--;
        g[l].push_back({r,c});
    }
    for(int i=N-1;i>=1;i--){
        g[i].push_back({i-1,0});
    }
    daijkstra(0);
    if(d[N-1]>=INF) cout << -1 << endl;
    else cout << d[N-1] << endl;
}


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

int main() {
	int N, K; cin >> N >> K;
	string S; cin >> S;

	if (S[K-1] == 'A') {
		S[K-1] = 'a';
	}
	else if (S[K-1] == 'B') {
		S[K-1] = 'b';
	}
	else if(S[K-1]=='C'){
		S[K-1] = 'c';
	}

	cout << S << endl;
}

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

fun solve(n: Int, a: LongArray){
    var ans1 = 0L
    var ret1 = 0L
    var ans2 = 0L
    var ret2 = 0L
    for(i in 0 until n){
        ret1 += a[i]
        ret2 += a[i]
        if(i % 2 == 0 && ret1 <= 0){
            ans1 -= ret1 - 1
            ret1 = 1L
        }else if(i % 2 == 1 && ret1 >= 0){
            ans1 += ret1 + 1
            ret1 = -1L
        }
        if(i % 2 == 0 && ret2 >=0){
            ans2 += ret2 + 1
            ret2 = -1L
        }else if(i % 2 == 1 && ret2 <= 0){
            ans2 -= ret2 - 1
            ret2 = 1L
        }
    }
    println(Math.min(ans1, ans2))
    return
}


fun main(args: Array<String>) {
    fun StringArray(size: Int, init: (Int) -> String = { "\u0000" }): Array<String> {
        return Array<String>(size, init)
    }
    class Scanner(stream: InputStream) {
        private val reader = BufferedInputStream(stream).bufferedReader()
        private var st: StringTokenizer? = null
        fun next(): String {
            while (!(st?.hasMoreTokens() ?: false)) st = StringTokenizer(reader.readLine())
            return st!!.nextToken()
        }
    }
    val sc = Scanner(System.`in`)
    val n = sc.next().toInt()
    val a = LongArray(n)
    for (i in 0 until n) {
        a[i] = sc.next().toLong()
    }
    solve(n, a)
}



Measured memory_bytes: 44164
s = input()

ans = 10 ** 9
a = 0
for i, j in enumerate(s):
    if i % 2 != int(j):
        a += 1
ans = min(ans, a)

a = 0
for i, j in enumerate(s):
    if i % 2 == int(j):
        a += 1
ans = min(ans, a)

print(ans)


Measured memory_bytes: 41132
H, W, K = list(map(int, input().split()))
table = []

for _ in range(H):
    w_list = input()
    table.append(w_list)

cut_table = []
k_no = 1
first_cut_str = ""
skip_count = 0
for h, w_list in enumerate(table):
    cut_str = ""
    cake_count = 0
    if "#" not in w_list:
        # 1列上にケーキが1個もない場合
        if first_cut_str:
            # 上の段までにすでにケーキが登場している場合
            # 上の段の区切りに合わせる
            cut_str = cut_table[-1]
            cut_table.append(cut_str)
        else:
            # 未登場の場合、下の段に合わせる
            # 後からスキップした回数分追加する
            skip_count += 1
        continue

    for w, item in enumerate(w_list):

        if item == "#":
            cake_count += 1
            if cake_count >= 2:
                k_no += 1
        cut_str += str(k_no) + " "
    cut_str = cut_str.rstrip() + "\n"
    if not first_cut_str:
        first_cut_str = cut_str
    k_no += 1
    cut_table.append(cut_str)

cut_table_str = "".join(cut_table)

if skip_count > 0:
    cut_table_str = first_cut_str * skip_count + cut_table_str

ans = cut_table_str
print(ans)


Measured memory_bytes: 5236
#include <iostream>
#include <string>
#include <cstdlib>
#include <vector>
#include <array>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#define _USE_MATH_DEFINES
#include <cmath>
#include <climits>
#include <cstdio>
#include <iomanip>
#include <utility>
#include <unordered_map>

using namespace std;
typedef long long int ll;

#define SP(x) setprecision((int)x)
#define SW(x) setw(x)    // 桁数指定
#define SF(c) setfill(c) // 埋め文字指定('0')
#define ALL(v) v.begin(), v.end()

int main(int argc, char const *argv[])
{
    ll n;
    cin >> n;
    n %= 10;
    if (n == 3)
    {
        cout << "bon" << endl;
    }
    else if (n == 0 || n == 1 || n == 6 || n == 8)
    {
        cout << "pon" << endl;
    }
    else
    {
        cout << "hon" << endl;
    }
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
const long long MAX=200005;
const long long M=998244353;

long long x_y(long long x,long long y){
  if(y==0) return 1;
  if(y==1) return x;
  if(y%2==0) return x_y(x,y/2)*x_y(x,y/2)%M;
  if(y%2==1) return x*x_y(x,y-1)%M;
}
long long A(long long n,long long m,long long k){
  long long ans=m;
  ans*=x_y(m-1,n-k-1);
  ans%=M;
  return ans;
}

long long a[MAX],b[MAX];
void kai(){
  a[0]=a[1]=1;
  b[0]=b[1]=1;
  for(long long i=2;i<MAX;i++){
    a[i]=a[i-1]*i%M;
    b[i]=x_y(a[i],M-2);
  }
}
long long nCr(long long n,long long r){
  return a[n]*b[r]%M*b[n-r]%M;
}

int main() {
  long long n,m,k;
  cin>>n>>m>>k;
  long long sum=0;
  long long Q=A(n,m,k);
  kai();
  for(long long i=k;i>=0;i--){
    long long x=Q*nCr(n-1,i)%M;
    Q=Q*(m-1)%M;
    sum+=x;
    sum%=M;
  }
  cout<<sum<<endl;
}
  
 



Measured memory_bytes: 6764
#include <bits/stdc++.h>
using namespace std;
int main()
{
  int n;
  cin >> n;
  vector<float> u(n);
  for (int i = 0; i < n; i++) {
    cin >> u[i];
  }
  sort(u.begin(), u.end());
  for (int i = 1; i < n; i++) {
    u[0] = (u[0] + u[1]) / 2;
    u[1] = 1000;
    sort(u.begin(), u.end());
  }
  cout << setprecision(100) << u[0];
}

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

def factorial(num):
    if num == 1:
        return 1
    return num * factorial(num - 1)

def count_order(group):
    numbers = [i for i in range(1, N + 1)]
    res = 1
    for i in range(len(group) - 1):
        num = group[i]
        res += numbers.index(num) * pattern[-(i + 1)]
        numbers.pop(numbers.index(num))
    return res


P = list(map(int, input().split()))
Q = list(map(int, input().split()))

pattern = [factorial(i) for i in range(1, N)]
res_p = count_order(P)
res_q = count_order(Q)

print(abs(res_p - res_q))


Measured memory_bytes: 38384
#include <bits/stdc++.h>
using namespace std;
int main()
  {int N, K; cin >> N >> K;
  vector<int> ps(N); for (auto &p : ps) cin >> p; sort(begin(ps), end(ps));
  int ans = 0; for (int i = 0; i < K; ++i) ans += ps[i];
  cout << ans << endl;}

Measured memory_bytes: 3608
#include <algorithm>
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <string>
#include <sstream>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <queue>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using namespace std;
typedef long long ll;

int main()
{
	int n;
	cin>>n;
	vector<int> a(n);
	vector<int> x(n);
	ll sum = 0;
	for(int i = 0; i < n; i++){
		cin>>a[i];
		if( i % 2 == 0){
			sum += a[i];
		}else{
			sum -= a[i];
		}
	}
	x[0] = sum / 2;
	for(int i = 1; i < n; i++){
		x[i] = a[i-1] - x[i-1];
	}
	for(int i = 0; i < n; i++){
		cout<<2*x[i]<<" ";
	}
	cout<<endl;
	return 0;
}



Measured memory_bytes: 3592
s=list(input())
a=["A","C","G","T"]
c=""
for x in s:
    if x in a:c+="o"
    else:c+="x"

if c.count("oooooooooo"):print(10)
elif c.count("ooooooooo"):print(9)
elif c.count("oooooooo"):print(8)
elif c.count("ooooooo"):print(7)
elif c.count("oooooo"):print(6)
elif c.count("ooooo"):print(5)
elif c.count("oooo"):print(4)
elif c.count("ooo"):print(3)
elif c.count("oo"):print(2)
elif c.count("o"):print(1)
else:print(0)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
int N,M;
int L,R;
int ans=0;
int main(){
    cin >> N >> M;
    vector<int> le(M+1);
    vector<int> ri(M+1);
    for(int i=0;i<M;i++){
        cin >> le.at(i) >> ri.at(i);
    }
    L=le.at(0);
    R=ri.at(0);
    for(int i=1;i<M;i++){
       if(ri.at(i)>=L || le.at(i)<=R){
            if(L<le.at(i)){
                L=le.at(i);
            }
            if(R>ri.at(i)){
                R=ri.at(i);
            }
        }
    }
    if(L<=R){
        ans=R-L+1;
    }
    cout << ans;
}


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

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

const ll INF = 1LL << 60;
ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;

#define int long long

inline void my_io() {

	std::ios::sync_with_stdio(false);

	std::cin.tie(0);

	cout << fixed << setprecision(16);

}

signed main() {
	string s;

	cin >> s;

	REP(i, s.size()) {
		if (s[i] == '1') {
			s[i] = '9';
		}
		else {
			s[i] = '1';
		}
	}

	cout << s << endl;
}

Measured memory_bytes: 256
// https://atcoder.jp/contests/abc096/tasks/abc096_a
#include <bits/stdc++.h>
using namespace std;
using P = pair<int, int>;
using ll = long long;
#define REP(i, n) FOR(i, 0, n)
#define FOR(i, s, n) for (int i = (s), i##_len = (n); i < i##_len; ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLR(obj) (obj).rbegin(), (obj).rend()

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int a, b;
    cin >> a >> b;
    if (a <= b) {
        cout << a << endl;
    } else {
        cout << a - 1 << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <utility>
#include <cctype>
#include <vector>
#include <string>
#include <cfloat>
#include <algorithm>
#include <cmath>
using namespace std;

#ifdef __linux
#define _U(s) s##_unlocked
#else
#define _U(s) _##s##_nolock
#define _CRT_DISABLE_PERFCRIT_LOCKS
#endif
#define gcu _U(getchar)
#define pcu _U(putchar)
#define _DEF(r, n, ...) inline r n(__VA_ARGS__) noexcept
#define _T template <typename T>
#define _HT template <typename H,typename... T>
#define _OP(t) inline operator t()
struct _in {
#ifdef _GLIBCXX_STRING
	_OP(string){string s;for(char c;c=gcu(),c!=' '&&c!='\n'&&c!=EOF;)s+=c;return s;}
#define _S
#endif
	_OP(char){char c=gcu();gcu();return c;}
	_OP(double){double d; scanf("%lf",&d); gcu();return d;}
	_T _OP(T){T n{},m{1},c;while(isspace(c = gcu()));if(c=='-')m=-1,c=gcu();do{n=10*n+(c-'0'),c=gcu();}while(c>='0'&&c<='9');return m*n;}
} in;
#define _SCAN(...) _DEF(bool,scan,__VA_ARGS__)
#ifdef _S
_SCAN(string &o) {int c{gcu()};if(c==EOF)return false;else{ungetc(c,stdin);string t=move(in);o=t;return true;}}
#endif
_T _SCAN(T &o) {int c{gcu()};return c==EOF?false:(ungetc(c,stdin),o=in,true);}
_HT _SCAN(H &h,T&&... t){return scan(h)&&scan(t...);}
#define _OUT(...) _DEF(void,out,__VA_ARGS__)
#define _OUTL(...) _DEF(void,outl,__VA_ARGS__)
_OUT(bool b){pcu('0'+b);}
_OUT(const char *s){while(*s)pcu(*s++);}
_OUT(char c){pcu(c);}
#ifdef _S
_OUT(string &s){for(char c:s)pcu(c);}
#endif
_T _OUT(T n){static char b[20];char *p=b;T m=n<0?pcu('-'),-1:1;
	if(!n)*p++='0';else while(n)*p++=(char)(n%10*m+'0'),n/=10;while(p!=b)pcu(*--p);}
_OUTL(){out('\n');}
#ifdef _GLIBCXX_VECTOR
	_T _OUT(vector<T> &v){for(T &x:v)out(&x == &v[0]?"":" "),out(x);}
#endif
	_HT _OUT(H &&h, T... t){out(h);out(t...);}
	template <typename... T> _OUTL(T... t){out(t...);outl();}
	struct range{
		int e,b=0,s=1;range(int _b,int _e,int _s):e(_e),b(_b),s(_s){} range(int _b,int _e): e(_e), b(_b){} range(int _e):e(_e){}
		struct it{int v,s; it(int _v,int _s):v(_v),s(_s){} operator int()const{return v;} operator int&(){return v;}int operator*()const{return v;}
			it& operator++(){v+=s;return *this;} }; it begin(){return {b,s};} it end(){return {e,s};}};
#define times(i,n) for(int i=n;i;i--)

struct C {
	int r, g, b;
};

int sq(int n) {
	return n * n;
}

int main() {
	vector<C> t {{0x00, 0x00, 0x00}, {0x00, 0x00, 0xff}, {0x00, 0xff, 0x00}, {0x00, 0xff, 0xff},
		{0xff, 0x00, 0x00}, {0xff, 0x00, 0xff}, {0xff, 0xff, 0x00}, {0xff, 0xff, 0xff}};
	vector<string> S{"black", "blue", "lime", "aqua", "red", "fuchsia", "yellow", "white"};
	for (int r, g, b; scanf("#%2x%2x%2x\n", &r, &g, &b);) {
		double m {DBL_MAX}, i {};
		for (int j: range(t.size())) {
			double s = sqrt(sq(r - t[j].r) + sq(g - t[j].g) + sq(b - t[j].b));
			if (s < m)
				m = s, i = j;
		}
		outl(S[i]);
	}
}


Measured memory_bytes: 2732
import java.util.*;

class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    
    int x = sc.nextInt();
    int y = sc.nextInt();
    int z = sc.nextInt();
    
    int free = x;
    x = y;
    y = free;
    free = x;
    x = z;
    z = free;
    
    System.out.println(x+" "+y+" "+z);
  }
}

Measured memory_bytes: 21972
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int N = in.nextInt();
		int K = in.nextInt();
		int[] count = new int[K];
		for (int i = 1; i <= N; i++) {
			count[i % K]++;
		}
		long ans = 0;
		for (int a = 0; a < K; a++) {
			int b = (K - a) % K;
			int c = (K - a) % K;
			if ((b + c) % K != 0) {
				continue;
			}
			ans += (long) count[a] * count[b] * count[c];
		}
		System.out.println(ans);
		in.close();
	}
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
void ABC60(void);
void ABC61(void);
void ABC62(void);
void ABC63(void);
void ABC64(void);
void ABC65(void);
void ABC66(void);
void ABC67(void);
void ABC68(void);
void ABC69(void);

int main(void){
    ABC61();
}

void ABC61(){
    int n,m;
    cin>>n>>m;
    vector<int> vec(2*m);
    for(int i=0;i<2*m;i++){
        cin>>vec[i];
    }
    for(int i=1;i<=n;i++){
        cout<<count(vec.begin(),vec.end(),i)<<endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fo(i, a, b) for (int i = a; i < b; i++)
#define re(i, n) fo(i, 0, n)
using namespace std;
typedef long long ll;
typedef vector<int> vi;
int main()
{
  int a, b;
  cin >> a >> b;

  int c = 0;
  if (b < 10) c = a * 10 + b;
  else if (b < 100) c = a * 100 + b;
  else c = a * 1000 + b;

  int s = sqrt(c);
  if (s * s == c) cout << "Yes" << endl;
  else cout << "No" << endl;

  return 0;
}


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

int main() {
  int a,b,c,d,e,k;
  cin >> a >> b >> c >> d >> e >> k;
  
  int m = max(max(max(max(a,b),c),d),e);
  int n = min(min(min(min(a,b),c),d),e);
  
  if(m - n <= k){
    cout << "Yay!" << endl;
  }
  
  else{
    cout << ":(" << endl;
  }
}

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

int main(){
    char s[12];
    scanf("%s",s);

    s[0]='2';
    s[1]='0';
    s[2]='1';
    s[3]='8';
    //strcpy(s,"2018");

    printf("%s",s);

    return 0;
}

Measured memory_bytes: 128
def is_kaibun(s):
    i, j = 0, len(s)-1
    while i < j:
        if s[i] != s[j]:
            return False
        i += 1
        j -= 1
    return True


S = input()
N = len(S)
if is_kaibun(S) and is_kaibun(S[:N//2]) and is_kaibun(S[(N+2)//2:]):
    print("Yes")
else:
    print("No")

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

struct edge {int from;int to;ll cost;};
vector<edge> es;

ll dist[2505];
ll inf=1ll<<50;
vector<int> rev_g[2505];
int ok[2505];
ll n,m,p;

void bfs(int v) {
  ok[v]=1;
  for(auto u : rev_g[v]) {
    if(ok[u])continue;
    bfs(u);
  }
}

void solve_bf(){
  dist[0]=0;
  for(int i=0;i<n;i++){
    bool update = 0;
    for(auto e : es) {
      if(ok[e.to] && dist[e.from] != inf && dist[e.to]>dist[e.from]+e.cost){
        dist[e.to]=dist[e.from]+e.cost;
        update=1;
      }
    }
    if(!update)break;
    if(i==n-1){
      cout<<-1<<endl;
      exit(0);
    }
  }
}

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

  for(int i=0;i<2505;i++)dist[i]=inf;

  cin>>n>>m>>p;
  for(int i=0;i<m;i++){
    int a,b;ll c;cin>>a>>b>>c;a--;b--;
    es.push_back({a,b,-c+p});
    rev_g[b].push_back(a);
  }

  bfs(n-1);
  solve_bf();

  cout<<max(dist[n-1]*-1, 0ll)<<endl;

  return 0;
}


Measured memory_bytes: 640
N = int(input())
A = list(map(int,input().split()))
A.sort()
A.reverse()

if A.count(0) > 0:
  print(0)
else:
  ans = A[0]
  flag = 0
  for i in range(1,N):
    ans *= A[i]
    if ans > 10 ** 18:
      print(-1)
      flag += 1
      break
  if flag == 0:
    print(ans)

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


int main(){
    int N, X; cin >> N >> X;
    vector<int> L(N); for (int i = 0; i < N; i ++) cin >> L[i];

    int dist = 0;
    int ans = 1;
    for (int i = 0; i < N; i++) {
        dist += L[i];
        if (dist <= X) ans++;
    }

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


Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
	int n,s[1001],p[1001],q[1001],r[1001],c[1001],w,x,y,z,i,flg;
	while(1){
		scanf("%d",&n);
		if(n==0)	break;
		for(i=0;i<n;i++){
			scanf("%d %d %d %d",&s[i],&p[i],&q[i],&r[i]);
			c[i]=p[i]*4+q[i]*9+r[i]*4;
		}
		scanf("%d %d %d %d",&w,&x,&y,&z);
		flg=1;
		for(i=0;i<n;i++){
			if(p[i]<=w&&q[i]<=x&&r[i]<=y&&c[i]<=z){
				printf("%d\n",s[i]);
				flg=0;
			}
		}
		if(flg==1)	printf("NA\n");
	}
	return 0;
}
			


Measured memory_bytes: 2028
#include<bits/stdc++.h>
#define int long long 
using namespace std;
int a,b,c;
signed main ( void ) {
	cin>>a>>b>>c;
	int las=a-b;

		int ans = c-las;
		if(ans<0)
			ans=0;
		cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#define N 2000
int comb(int,int);
int n,A[N],q,m[N],i;
int main() {
  scanf("%d",&n);
  for(i=0;i<n;i++)scanf("%d",&A[i]);
  scanf("%d",&q);
  for(i=0;i<q;i++)scanf("%d",&m[i]);
  for(i=0;i<q;i++){
    if(comb(0,m[i])==1)printf("yes\n");
    else printf("no\n");
  }
  return 0;
}
int comb(int a,int key){
    if(key==0)return 1;
    if(a>=n)return 0;
    return comb(a+1,key)||comb(a+1,key-A[a]);
}



Measured memory_bytes: 1988
#include <stdio.h>
int main(void);

int main(void){
    
    int a, b;
    
    scanf("%d", &a);    scanf("%d", &b);
    
    if(a > b){
        printf("a > b\n");
    } else if(a < b){
        printf("a < b\n");
    } else {
        printf("a == b\n");
    }
    
    return 0;
    
}


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

//Function Macros:
#define rep(i, n) for(int(i) = 0; (i) < (n); (i)++)
#define all(v) (v).begin(), (v).end()
#define setpre(n) cout << fixed << setprecision(n)

//Type / Class / Struct Definitions:
using ll = long long;
using ull = unsigned long long;

//Constants:
const int INF = (1ll << 30) - 1;  //nearly 1.07e9
const ll INFLL = 1ll << 60;       //nearly 1.15e18
const int MOD = 1e9 + 7;
const long double EPS = 1.0e-14;

//Global Variables:

//Prototype Declarations:
int gcd(int, int);
template <class T>
inline bool chmin(T&, T);
template <class T>
inline bool chmax(T&, T);

//================ Main Loop ================
int main() {
    string s;
    cin >> s;
    if(s[2] == s[3] && s[4] == s[5]) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}
//===========================================

//Functions:
int gcd(int a, int b) {
    return b ? gcd(b, a % b) : a;
}

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


Measured memory_bytes: 256
N = int(input())
A = []
for i in range(N):
  temp = int(input())
  A.append(temp)
#print(A)
L = [A[0]]
for i in range(1,N):
  if L[-1] >= A[i]:
    L.append(A[i])
  else:
    if L[0] < A[i]:
      L[0] = A[i]
    else:
      s = len(L)
      ok = s
      ng = 0
      while abs(ok-ng)>1:
        mid = (ok+ng)//2
        if L[mid] < A[i]:
          ok = mid
        else:
          ng = mid
      L[ok] = A[i]
  #print(L)
ans = len(L)
print(ans)

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

int main()
{
    char S[12], T[12];
    int flag = 0;
    scanf("%s", S);
    scanf("%s", T);

    for(int i = 0; i < strlen(S); i++){
        if(S[i] != T[i]){
            flag = -1;
            break;
        }
    }

    if(flag == 0){
        printf("Yes\n");
    }
    else{
        printf("No\n");
    }

    return 0;
}



Measured memory_bytes: 3764
package main

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

func main(){
        //read array, set into strset
        scanner := bufio.NewScanner(os.Stdin)
        i := 1
        for scanner.Scan(){
                key := (scanner.Text())
                if key != "0" {
                        fmt.Printf("Case %d: %s\n",i,key)
                        i++
                }else{
                        break
                }
        }
}


Measured memory_bytes: 1420
#include<stdio.h>

int main(void){
  int N,M;scanf("%d%d",&N,&M);
  int L=0,R=100000;
  for(int i=0;i<M;i++){
    int temp_l,temp_r;
    scanf("%d%d",&temp_l,&temp_r);
    if(temp_l>L){
      L=temp_l;
    }
    if(temp_r<R){
      R=temp_r;
    }
  }

  if(R-L+1>=1){
    printf("%d\n",R-L+1);
  }else{
    printf("0\n");
  }
  return 0;
}


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

int main() {
	int H,A,B; cin>>H>>A>>B;
	int ans=0;
	for(int i=A; i<=B; ++i){
		if(H%i==0){
			++ans;
		}
	}
	cout<<ans<<endl;
}


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

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            string a = Console.ReadLine();
            int num = int.Parse(a);
            int flag=0;

            if (num % 10 == 1) { flag++; }//１桁目

            if ((num/10) % 10 == 1) { flag++; }//２桁目

            if ((num/100) == 1) { flag++; }//３桁目

            Console.WriteLine(flag);


        }
    }
}


Measured memory_bytes: 11092
#include<bits/stdc++.h>
using namespace std;
int main()
{
    map<string,int>mp;
    int a,b,c,i,j;
    string s,ss;
    cin>>a;
    vector<string>v(a);
    for(i=0;i<a;i++)
    {
        cin>>v[i];
        mp[v[i]]++;
    }
    cout<<mp.size()<<endl;
    return 0;
}


Measured memory_bytes: 25172