akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std ;
typedef long long ll ;
const int mod=1000000007 ;

int visited[21][21] ;
int dist[21][21] ;
char grid[21][21] ;

pair<int,int> directions[4]={{1,0},{0,1},{-1,0},{0,-1}} ;

bool valid(int x,int y,int h,int w){

	return x>=0 && y>=0 && x<h && y<w ;
}

int bfs(int sx,int sy,int h,int w){

	queue<pair<int,int>> q ;
	q.push({sx,sy}) ;
	dist[sx][sy]=0 ;
	visited[sx][sy]=1 ;

	int ans=0 ; 

	while(!q.empty()){

		int row=q.front().first ;
		int col=q.front().second ;

		q.pop() ;

		for(auto dir:directions){

			int new_row=row+dir.first ;
			int new_col=col+dir.second ;

			if(valid(new_row,new_col,h,w) && visited[new_row][new_col]==0 && grid[new_row][new_col]=='.'){

				q.push({new_row,new_col}) ;
				dist[new_row][new_col]=dist[row][col]+1 ;
				visited[new_row][new_col]=1 ;
				ans=max(ans,dist[new_row][new_col]) ;
			}


		}


	}

	return ans ;

}

void solve(){
	
	int h,w ;
	cin>>h>>w ;

	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			cin>>grid[i][j] ;
		}
	}

	int answer=0 ;

	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			if(grid[i][j]=='.')
			{	
				memset(visited,0,sizeof(visited)) ;
				memset(dist,0,sizeof(dist)) ;
				answer=max(answer,bfs(i,j,h,w)) ;
			}
		}
	}

	cout<<answer ;

}

int main(){
	
	int y ;

	y=1 ;
	//cin>>y ;

	while(y--)
	{	
		solve() ;
	}

}


Measured memory_bytes: 3568
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <string>
#include <vector>
using namespace std;
// #include "prettyprint.hpp"

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

  for (int i = 0; i < N; i++) h[i] = -h[i];

  int totalCount = 0;

  for (int i = 0; i <= 100; i++) {
    for (int j = 0; j < N; j++) {
      if (h[j] < 0) {
        h[j] += 1;
        if (h[j + 1] >= 0 || j + 1 == N) {
          totalCount += 1;
        }
      }
    }
  }

  cout << totalCount << endl;

  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define mod 2019
using namespace std;

int main(){
    ll l,r; cin>>l>>r;
    ll a=l%mod, b=l/mod;
    ll ans=LLONG_MAX;
    
        ll p=max(l,b*mod);
        ll q=min(r, (b+1)*mod);
        //cout<<p<<" "<<q<<endl;
        for(ll i=p; i<q; i++){
            for(ll j=i+1; j<=q; j++){
                ll prod=i*j;
                ll rem=prod%mod;
                ans=min(ans, rem);
            }
        }
        
    cout<<ans<<endl;
}

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

#S0*1-S1*2+S2*4-S3*8+S4*16-S5*32... = N
#N=2N1+S0とする
#-S1*2+S2*4-S3*8+S4*16-S5*32... = 2N1
#-S1+S2*2-S3*4+S4*8-S5*16... = N1
#N1=2N2-S1とする
#S2*2-S3*4+S4*8-S5*16... = 2N2
#S2-S3*2+S4*4-S5*8... = N2
#N2=2N3+S2とする
#-S3*2+S4*4-S5*8... = 2N3
#-S3+S4*2-S5*4... = N3
#...
#S0=abs(N)%2, N1=N//2
#S1=abs(N1)%2, N2=ceil(N/2)
#...

i=0
S=''
while N:
    s=N&1
    S=str(s)+S
    if i:
        N=N//2+(s*N//N)
    else:
        N=N//2
    i^=1
print(S if S else 0)

Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#define REP(i, n) for (int i = 0; i < (n); i++)
using namespace std;

const string YES = "Yes";
const string NO = "No";

void solve(long long N, long long M, std::vector<std::string> A, std::vector<std::string> B){
    bool ans = false;
    REP(i, N - M + 1) REP(j, N - M + 1) {
        int count = 0;
        REP(y, M) REP(x, M)
            if (A[i + y][j + x] == B[y][x]) count++;
        if (count == M * M) ans = true;
    }
    if (ans) cout << YES << '\n';
    else cout << NO << '\n';
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    long long N;
    cin >> N;
    long long M;
    cin >> M;
    std::vector<std::string> A(N);
    for(int i = 0 ; i < N ; i++) std::cin >> A[i];
    std::vector<std::string> B(M);
    for(int i = 0 ; i < M ; i++) std::cin >> B[i];
    solve(N, M, std::move(A), std::move(B));
    return 0;
}


Measured memory_bytes: 256
from itertools import product
from collections import Counter
N, C = map(int, input().split())
D = [tuple(map(int, input().split())) for _ in range(C)]

color = [[] for _ in range(3)]
for i in range(N):
    inp = tuple(map(int, input().split()))
    for j, c in enumerate(inp):
        color[(i + j) % 3].append(c-1)

cnt = [Counter(color[i]) for i in range(3)]


def point(d, col):
    res = 0
    for k, v in d.items():
        res += D[k][col] * v
    return res


ans = 10**9
for xyz in product(range(C), repeat=3):
    if len(set(xyz)) != 3:
        continue
    tmp = sum(point(cnt[i], xyz[i]) for i in range(3))
    ans = min(ans, tmp)

print(ans)


Measured memory_bytes: 5488
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		java.util.Scanner sc = new Scanner(System.in); 
		while(true){
			int n = sc.nextInt();
			int sum = 0;
			int avg = 0;
			int count = 0;
				if(n == 0){
					break;
				}
				int box[] = new int[n];
				for(int i=0;i<n;i++){
					int a = sc.nextInt();
					box[i] = a;
					sum += box[i];
				}
				avg = sum/n;
				for(int i = 0;i<n;i++){
					if(box[i] <= avg){
						count++;
					}
				}
				System.out.println(count);
		}
		sc.close();
	}

}


Measured memory_bytes: 58964
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define FOF(i,a,b) for(int i=a;i< b;i++)
using namespace std;
const int N=505;
int n,P,m,L,R,T,ans,w[N],f[N<<1][N];
struct ele{
	int x,y;
	ele(int _x=0,int _y=0){x=_x,y=_y;}
	bool operator < (const ele&a){return x!=a.x?x<a.x:y<a.y;}
}q[N];
void chk(int&x){x-=P;x+=(x>>31)&P;}
void work(int s){
	memset(f,0,sizeof f);
	f[0][0]=1;
	FOR(i,1,m)FOR(j,0,w[i])if(f[i-1][j]){
		int l=q[i].x-i+j+1,d=q[i].y-n-s-j;
		if(q[i].y){
			if(l>0) chk(f[i][j+0]+=1ll*f[i-1][j]*l%P);
			if(d>0) chk(f[i][j+1]+=1ll*f[i-1][j]*d%P);
		}
		else if(l>0) chk(f[i][j]+=1ll*f[i-1][j]*l%P);
	}
	chk(ans+=1ll*(s&1?P-1:1)*f[m][n-s]%P);
}
int main(){
	//freopen("1.in","r",stdin);
	scanf("%d%d",&n,&P);m=n<<1;
	FOF(i,0,m){
		L=i<n?ceil(sqrt(n*n-i*i))+0.1:0;
		R=floor(sqrt(m*m-i*i))+0.1;
		R=min(m-1,R);
		q[++T]=i<n?ele(L,R+1):ele(R+1,0);
	}
	sort(q+1,q+m+1);
	//FOR(i,1,m) cout<<q[i].x<<' '<<q[i].y<<'\n';
	FOR(i,1,m) w[i]=w[i-1]+(q[i-1].y!=0);
	FOR(s,0,n) work(s);
	cout<<ans<<'\n';
}

Measured memory_bytes: 2304
#include<stdio.h>
#include<bits/stdc++.h>
const int mod = 1e9+7;
int ad(int x,int y) { x+=y; return x>=mod?x-mod:x; }
int sb(int x,int y) { x-=y; return x<0?x+mod:x; }
int mu(int x,int y) { return 1ll*x*y%mod; }
void up(int &x,int y) { x+=y; if(x>=mod)x-=mod; }
using namespace std;
vector<int>ve[5005];
int f[5005][5005];
int RT;
int n;
int V[5005],TT,sz[5005];
void dfs(int x,int ba) {
	sz[x] = 1; 
	int sso = 0;
	for(auto y:ve[x]) {
		if(y==ba) continue;
		dfs(y,x);
		sso = max(sso,sz[y]);
		sz[x] += sz[y];
	}
	sso = max(sso,n-sz[x]);
	if(sso<=n/2) RT = (RT?-1:x);
}
int fac[5005],inv[5005];
int A(int x,int y) {
	return mu(fac[x],inv[x-y]);
}
int C(int x,int y) {
	return mu(fac[x],mu(inv[x-y],inv[y]));
}

int main() {
	scanf("%d",&n);
	for(int i=1;i<n;i++) {
		int x,y; scanf("%d%d",&x,&y);
		ve[x].push_back(y);
		ve[y].push_back(x);
	}
	fac[0] = 1;
	for(int i=1;i<=n;i++) fac[i] = mu(fac[i-1],i);
	inv[0] = inv[1] = 1;
	for(int i=2;i<=n;i++) inv[i] = mu(inv[mod%i],mod-mod/i);
	for(int i=2;i<=n;i++) inv[i] = mu(inv[i-1],inv[i]);
	dfs(1,0);
	if(RT==-1) {
		printf("%d",mu(fac[n/2],fac[n/2]));
		return 0;
	}
	if(RT!=1) V[++TT] = n-sz[RT];
	for(auto y:ve[RT]) {
		if(sz[y]<sz[RT]) V[++TT] = sz[y];
	}
	f[0][0] = 1;
	int tot = 0;
	for(int i=1;i<=TT;i++) {
		tot += V[i];
		for(int j=0;j<=tot;j++) {
			for(int k=0;k<=min(V[i],j);k++) {
				up(f[i][j],mu(f[i-1][j-k],mu( C(V[i],k),A(V[i],k) )));
			}
		}
	}
	int ans = 0;
	for(int i=0;i<n;i++) {
		if(i&1) ans = sb(ans,mu(f[TT][i],fac[n-i]));
		else ans = ad(ans,mu(f[TT][i],fac[n-i]));
	}
	printf("%d",ans);
}

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

const int MAXN = 1 << 18; // 2.6e5
int n, N = 200005, a[200005];
ll seg[2 * MAXN]; // root is seg[1]

vector<int> adj[200005];

void update(int p, ll val)
{
    for (seg[p += N] = val; p > 0; p >>= 1)
        seg[p >> 1] = max(seg[p], seg[p ^ 1]);
}

ll query(int l, int r)
{
    ll res = 0;
    for (l += N, r += N; l <= r; l >>= 1, r >>= 1)
    {
        if (l & 1)
            res = max(res, seg[l++]);
        if (!(r & 1))
            res = max(res, seg[r--]);
    }
    return res;
}

int sol[200005];

void dfs(int x, int p)
{
    int old = query(a[x], a[x]);
    update(a[x], 1 + query(0, a[x] - 1));
    sol[x] = seg[1];
    for (int y : adj[x])
    {
        if (y == p) continue;
        dfs(y, x);
    }
    update(a[x], old);
}

int b[200005];
int c[200005];

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

    for (int i = 1; i < n; ++i)
    {
        int u, v;
        cin >> u >> v;
        adj[u].push_back(v);
        adj[v].push_back(u);
    }
    dfs(1, -1);
    for (int i = 1; i <= n; ++i)
        cout << sol[i] << '\n';
}


Measured memory_bytes: 35000
#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 count = 0;
  for(int i=0;i<N;i++){
    if(p.at(i)!=i+1){
      count++;
    }
  }
  if(count<=2){
    cout<<"YES"<<endl;
  }
  else{
    cout<<"NO"<<endl;
  }
  return 0;
}
      

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <cmath>
#include <iomanip>
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) (int)(x).size()
using namespace std;
using ll = long long;
constexpr ll INF = 3000000000000000000;

int main() {
    ll X, Y;
    cin >> X >> Y;
    if (X - Y >= -1 && X - Y <= 1) cout << "Brown\n";
    else cout << "Alice\n";
    return 0;
}


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

int main(){
  int a,b;

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

  if(a == 1 && b == 2) printf("3\n");
  if(a == 1 && b == 3) printf("2\n");
  if(a == 2 && b == 3) printf("1\n");
  if(a == 3 && b == 2) printf("1\n");
  if(a == 3 && b == 1) printf("2\n");
  if(a == 2 && b == 1) printf("3\n");

  return 0;
}

Measured memory_bytes: 128
//
//  main.hpp
//  HelloWorld
//
//  Created by Vipul Sharma on 2/17/18.
//  Copyright © 2018 Vipul Sharma. All rights reserved.
//  vipsharmavip@gmail.com [' . '] :)

#include<bits/stdc++.h>
#include<iostream>
#include<vector>
#include<string>
#include<cmath>
#include<set>
#include<map>
#include<algorithm>
#include<cstdio>
#include<stack>
#include<queue>
#include<cstring>
#define up 1
#define right 2
#define down 3
#define left 4
#define mod 1000000007
#define ll long long

using namespace std;

string x;
int k;
int dp[300][300][301];

int go(int i, int j, int k){
    if(i > j) return 0;
    if(i == j) return 1;
    if(dp[i][j][k] != -1) return dp[i][j][k];
    int ans = 0;
    if(x[i] == x[j])  ans = 2 + go(i + 1, j - 1, k); else
    {
        ans = max(go(i + 1, j, k), go(i, j - 1, k));
        if(k)
            ans = max(ans, 2 + go(i + 1, j - 1, k - 1));
    }
    return dp[i][j][k] = ans;
}

int main(){
    
    cin.sync_with_stdio(false);
    cin >> x >> k;
    memset(dp, -1, sizeof dp);
    cout << go(0, x.size() - 1, k);
}


Measured memory_bytes: 106240
/**
       **********    ************
	  Author : Avi J Patel
	  University : DAIICT
       **********    ************
**/
#include<bits/stdc++.h>
#include<fstream>
using namespace std;
#define ll long long
#define ull unsigned long long
#define ld long double
#define pb push_back
#define pf push_front
#define mp make_pair 
#define mt make_tuple
#define ff first
#define ss second
#define si size()
#define MOD 1000000007
#define Mod 998244353
#define N 200001
#define large 1844674407370955161
#define For(i,m,n) for(long long i=m;i<n;i++)
#define st(x) sort(x.begin(),x.end())
#define re(x,i) reverse(x.begin()+i,x.end())
#define FAST ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);srand(time(NULL));
#define min_heap priority_queue<int, vector<int>, greater<int>>
#define max_heap priority_queue<int>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
#define pp pair<pair<ll,ll>,pair<ll,ll>>
using namespace __gnu_pbds; 
#define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> 

bool sortbysec(const pair<int,int> &a, const pair<int,int> &b) 
{ 
    if(a.ss < b.ss) return true; 
	else return false;
}
bool sortbyboth(const pair<int,int> &a, const pair<int,int> &b)
{
	if(a.ff>b.ff) return true;
	else if(a.ff==b.ff) return a.ss<b.ss;
	else return false;
} 
bool sortff_resortss(const pair<int,int> &a, const pair<int,int> &b)
{
	if(a.ff<b.ff) return true;
	else if(a.ff==b.ff) return a.ss>b.ss;
	else return false;
}
bool sortbystring(const string &a, const string &b)
{
	string c=a+b;
	string d=b+a;
	if(c>=d) return true;
	else return false;
}

ll modi(ll a, ll m) 
{ 
    ll m0 = m; 
    ll y = 0, x = 1; 
    if (m == 1) 
      return 0; 
    while (a > 1) 
    { 
        ll q = a / m; 
        ll t = m; 
        m = a % m, a = t; 
        t = y; 
        y = x - q * y; 
        x = t; 
    } 
    if (x < 0) 
       x += m0; 
    return x; 
} 
ll Logn(ll  n, ll r) 
{ 
    return (n > r - 1) ? 1 + Logn(n / r, r) : 0; 
} 

ll power(ll x, ll y, ll p) 
{ 
    ll res = 1;      // Initialize result 
    x = x % p;  // Update x if it is more than or 
    while (y > 0) 
    { 
        if (y & 1) 
            res = (res*x) % p; 
        y = y>>1; // y = y/2 
        x = (x*x) % p; 
    } 
    return res; 
} 

ll modinv(ll n, ll p) 
{ 
    return power(n, p-2, p); 
} 

int cal[2005][2005];
int b[2005][10];

int solve(int loc, int k,int n)
{
	if(loc==n)
	{
		return 	k==0? 1:0;
	}	
	int cur=cal[loc][k];
	if(cur!=-1) return cur;
	cur=0;
	for(int i=0;i<10;i++)
	{
		if(b[loc][i]<=k)
		{
			cur=cur|solve(loc+1,k-b[loc][i],n);
		}
	}
	return cal[loc][k]=cur;
}

void traverse(int loc,int k,int n)
{
	if(loc==n) return;
	
	for(int i=9;i>=0;i--)
	{
		if(k-b[loc][i]>=0)
		{
			if(solve(loc+1,k-b[loc][i],n))
			{
				cout<<i;
				return traverse(loc+1,k-b[loc][i],n);
			}
		}
	}
}

int main()
{
	FAST
	int t=1;
//	cin>>t;
	while(t--)
	{
		int k;
		cin>>k;
		int a,b;
		cin>>a>>b;
		int r=(a/k)*k;
		if(a%k) r+=k;
		if(r<=b)
		{
			cout<<"OK";
		}
		else
		{
			cout<<"NG";
		}
	}
	return 0;
}


















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

public class Main {
	public static void main(String[] args)
			throws java.io.IOException{
		Scanner scan = new Scanner(System.in);
		int n= scan.nextInt();
		scan.nextLine();
		for(int i =0;i<n;i++){
			String str = scan.nextLine();
			System.out.println(str.replaceAll("Hoshino","Hoshina"));
		}
	}
}

Measured memory_bytes: 12000
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
#define mod 2019
int main()
{
  ll a,b;
  cin>>a>>b;
  if((a-1)/mod != b/mod)
  cout<<0;
  else
  {
  a=a%mod;b=b%mod;
  ll p=0;
  ll mini=2019;
  for(ll i=a; i<b ;i++)
  {
    for(ll j=i+1; j<=b ; j++)
    {
    mini=min(mini,(i*j)%mod);
    p++;
	}
  }

  cout<<mini;
}
 return 0;
}
  

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

#define CH(N,A,B) (A<=N&&N<B)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define RREP(i,a,b) for(int i=(b-1);a<=i;i--)

using namespace std;

int main() {

  string A, B, C;
  cin>>A>>B>>C;
  if(A[A.size()-1] == B[0] && B[B.size()-1] == C[0]) cout <<"YES"<<endl;
  else cout <<"NO"<<endl;

  return 0;
}


Measured memory_bytes: 764
fun main(args:Array<String>){
    val line = readLine()!!.split(" ").map{it.toLong()}
    val a = line[0]
    val b = line[1]
    val c = line[2]
    val d = line[3]
    val e = a-1
    val lcm = c*d/gcd(c,d)
    val result = b-a+1L-((b/c + b/d - b/lcm)-(e/c + e/d - e/lcm))
    println(result)
}
fun gcd(c:Long,d:Long):Long{
    return if(d>0)gcd(d,c%d)else c
}

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

#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define RFOR(i, b, a) for(int i = (b) - 1; i >= (a); --i)
#define REP(i, N) FOR(i, 0, N)
#define RREP(i, N) RFOR(i, N, 0)
#define FILL(A,value) memset(A,value,sizeof(A))
#define endl '\n'

#define ALL(V) V.begin(), V.end()
#define SZ(V) (int)V.size()
#define watch(x) cout << (#x) << " is " << (x) << endl
#define pb push_back
#define mp make_pair
#define Pi 3.14159265358979
#define A first
#define B second

typedef long long ll;
typedef vector <int> vi;
typedef vector<ll> vl;
typedef pair <int, int> pi;
typedef pair <ll, int> pl;
typedef pair <ll, ll> pll;
typedef pair <double, double> pd;

//change these according to prob constraints
const int INF = 0x3f3f3f3f;
const int MAX = 100005;
const int MAX1 = 1005;
const int MAX2 = 105;
const int LEN = 105;
const int BASE = 1000000000;
const double EPS = 1e-7;
const int MOD = 1000000007;
//g++ -std=c++11 your_file.cpp -o your_program

ll mypow(ll a, ll b){
	ll ans=1;
	while(b){
		if(b&1)
			ans=(ans*a)%MOD;
		b/=2;
		a=(a*a)%MOD;
	}
	return ans;
}

int main(void){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	ifstream in("");
	ofstream out("");
	clock_t begin = clock();
	int n;
	cin >> n;
	int arr[55];
	REP(i, n) cin >> arr[i];
	sort(arr, arr + n, greater<int>());
	double sum = arr[n - 1];
	RREP(i, n - 1){
		sum = (sum + (double)arr[i]) / 2.0;
	}
	cout << sum << endl;
	clock_t end = clock();
    double esecs = double(end - begin) / CLOCKS_PER_SEC;
    //cout << esecs << " seconds" << endl;
	return 0;	
}

Measured memory_bytes: 256
#WIP
a,b,c=map(int,input().split())
# Ax%B=C
# A(x+B)%B = Ax+AB%B = Ax%B
isOk=False
for i in range(b+1):
  if a*i%b==c:
    isOk=True
    break
print('YES' if isOk else 'NO')


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

int main()
{
  int N, K;
  while (cin >> N >> K) {
    if ((N|K) == 0)
      break;

    vector<int> S(K), B(K, 0);
    for (int i = 0; i < K; ++i)
      cin >> S[i];

    for (int i = 0; i < N; ++i) {
      for (int j = 0; j < K; ++j) {
	int tmp;
	cin >> tmp;
	B[j] += tmp;
      }
    }

    bool valid = true;
    for (int i = 0; i < K && valid; ++i) {
      if (S[i] < B[i])
	valid = false;
    }

    if (valid)
      cout << "Yes" << endl;
    else
      cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 0
//  Created by conan1024hao on 2019/11/26.
//  Copyright © 2019 conan1024hao. All rights reserved.
//  専用ライブラリです、自由にコピーして構いません。
//  感谢看我的代码！Wechat:conan1024hao QQ:810396815
#pragma GCC optimize ("O3")
#include <iostream>
#include <iomanip>
#include <istream>
#include <ostream>
#include <sstream>
#include <iterator>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <utility>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <ctime>
#include <cctype>
#include <cstdlib>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll>P;
#define INF 10e16
#define MOD 1000000007
#define rep(i, a, n) for (ll i = a; i < (ll)(n); i++)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define mmax(x,y)(x>y?x:y)
#define mmin(x,y)(x<y?x:y)
#define chmax(x,y) x=mmax(x,y)
#define chmin(x,y) x=mmin(x,y)
#define all(x) (x).begin(),(x).end()
#define siz(x) (ll)(x).size()
#define PI acos(-1.0)
long long GCD(long long a, long long b) { return b ? GCD(b, a%b) : a; }
long long LCM(long long a, long long b)  {return a/GCD(a,b)*b;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
ll cmp(pair<ll,string>a,pair<ll,string> b){
        if(a.fi!=b.fi)
        return a.fi<b.fi;
        else
        return a.se<b.se;
}
//---------------------------------------------------------------------------

//---------------------------------------------------------------------------
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    //------------------------------
    ll n,k;
    cin>>n>>k;
    vector<ll>a(n);
    for(int i=0;i<n;i++)
        cin>>a[i];
    ll ans=(n-1)/(k-1);
    if((n-1)%(k-1)!=0)
        ans++;
    cout<<ans<<endl;
    //-------------------------------
    return 0;
}
//---------------------------------------------------------------------------




Measured memory_bytes: 1024
#%%
n = int(input())

i = 0
s = 0

while True:
    s += i
    if s > n:
        key = s - i
        key2 = n - key
        key3 = i - 1
        break
    else:
        i += 1

#print(key, key2, key3)

ans = []
j = 1
for i in range(key3):
    if i >= key3-key2:
        ans.append(j+1)
    else:
        ans.append(j)
    j += 1


for i in range(len(ans)):
    print(ans[i])


Measured memory_bytes: 3572
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>

using namespace std;
#define ll long long
#define rep(i, s, n) for(int i = s; i < n; i++)

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

    sort(a.begin(), a.end());
    vector<int> c(100001, 0);
    rep(i, 0, n) {
        c[a[i]]++;
    }
    int ans = 0;
    rep(i, 0, 100000-1) {
        ans = max(ans, c[i]+c[i+1]+c[i+2]);
    }
    cout << ans << endl;
    return 0;
}

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

int main(void)
{
	int W, H, x, y, r;
	bool flg = false;

	cin >> W;
	cin >> H;
	cin >> x;
	cin >> y;
	cin >> r;

	if ((x+r) <= W) {
		if ((x-r) >= 0) {
			if ((y+r) <= H) {
				if ((y-r) >= 0) {
					cout << "Yes" << endl;
					flg = true;
				}
			}
		}
	}
	if (flg == false) {
		cout << "No" << endl;
	}
	return 0;
}



Measured memory_bytes: 3108
#include<bits/stdc++.h>
#define rep(i,n) for(int i = 0;i<n;i++)
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
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() {
    int a;
    cin >> a;
    cout << a+ pow(a,2) + pow(a,3) << endl;
    
}



Measured memory_bytes: 4192
#include<stdio.h>
int main()
{
	int a,b,c;
	while(~scanf("%d %d %d",&a,&b,&c))
	{if((a*100+b*10+c)%4==0)
	printf("YES\n");
	else
	printf("NO\n");
	}
	return 0;
}

Measured memory_bytes: 128
def do_round_robin(process, tq):
    # ???????¨????
    from collections import deque
    q = deque()
    elapsed_time = 0  # ??????????????????????§??????????????????????
    finished_process = []  # ????????????????????????????????????????????¨??????????????????????????§?????????
    for process_name, remaining_time in process:
        q.append([process_name, int(remaining_time)])  # ?????\?????????????????????????????????
        
    # ?????????????????????????????§??????????????????????????????
    while True:
        try:
            process_name, remaining_time = q.pop()
        except IndexError:  # ??????????????£???????????????????????????????????£???
            break
        else:
            elapsed_time += min(remaining_time, tq)
            remaining_time -= tq
            if remaining_time > 0:
                q.appendleft([process_name, remaining_time])  # ?????\??????????°??????????
            else:
                finished_process.append((process_name, elapsed_time))  # ???????????????????????????????????¨??????????¨????
    return finished_process


if __name__ == '__main__':
    # ??????????????\???
    # ????????????????????????????????????????????????????°??????????????????????????????¨
    data = [int(x) for x in input().split(' ')]
    num_of_process = data[0]
    time_quantum = data[1]
    process_table = []
    for i in range(num_of_process):
        process_table.insert(0, [x for x in input().split(' ')])

    # ??????
    results = do_round_robin(process_table, time_quantum)

    # ???????????????
    for process_name, finish_time in results:
        print('{0} {1}'.format(process_name, finish_time))

Measured memory_bytes: 23968
#include<iostream>
using namespace std;
string s;
int m, h, a;
main() {
	while (cin >> s, s != "-") {
		cin >> m;
		a = 0;
		for (int i = 0; i < m; i++) {
			cin >> h;
			a += h;
		} 
		s += s;
		cout << s.substr(a % (s.size()/2), s.size()/2) << endl;
	}
}


Measured memory_bytes: 3216
#include <bits/stdc++.h>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/range/irange.hpp>
#include <boost/range/adaptor/indexed.hpp>

using namespace std;
using namespace boost::adaptors;
using namespace std::string_literals;
using ll = int64_t;
using vecint = vector<int>;
using vecll = vector<ll>;
using boost::irange;
constexpr ll MOD = 1000000007;

// a^-1 mod p
ll inv(ll a,ll p){
  return ( a == 1 ? 1 : (1 - p*inv(p%a,a)) / a + p );
}

int main()
{
  constexpr int mx = 3000000;
  vecll fact(mx+1);
  vecll factinv(mx+1);
  fact[0] = 1;
  for(auto&& i:irange(0,mx)) {
    fact[i+1] = fact[i] * (i+1) % MOD;
  }
  factinv[mx] = inv(fact[mx], MOD);
  for(auto&& i:irange(0,mx)) {
    int j = mx - i - 1;
    factinv[j] = factinv[j+1] * (j+1) % MOD;
  }
  ll r1,c1,r2,c2;
  cin>>r1>>c1>>r2>>c2;
  --r1;--c1;
  auto comb = [&](ll n, ll k) {
    return fact[n] * factinv[k] % MOD * factinv[n-k] % MOD;
  };
  auto g = [&](ll r, ll c) {
    ll s = r+c;
    return comb(s+2, r+1) % MOD;
  };
  ll ans = g(r2, c2) + (MOD - g(r1, c2)) + (MOD - g(r2, c1)) + g(r1, c1);
  ans %= MOD;
  cout<<ans<<endl;
  return 0;
}


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

int main() {
  int k, n;
  cin >> k >> n;
  vector<int> A(n+2, 0);
  vector<int> d(n, 0);
  rep(i, n+1) {
    cin >> A[i+1];
  }
  A[n+1] = k;
  
  rep(i, n+1) {
    if (i != n) d[i] = A[i+1] - A[i];
    else d[0] += A[i+1] - A[i];
  }
  sort(d.begin(), d.end());
  int ans = 0;
  rep(i, d.size()-1) {
    ans += d[i];
  }
  cout << ans << endl;
}

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

#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <algorithm>

#include <bits/stdc++.h>
#include <cmath>
#include <limits>

using namespace std;
typedef long long LL;
using Graph = vector<vector<int>>;

static long long INF = (1LL<<62);
static LL P = 1000000007LL;

const int MAX = 510000;
long long fac[MAX], finv[MAX], inv[MAX];

void COMBinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % P;
        inv[i] = P - inv[P%i] * (P / i) % P;
        finv[i] = finv[i - 1] * inv[i] % P;
    }
}

long long COMB(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % P) % P;
}

long long GCD(long long x, long long y){
	long long r=0;

	if( x<y ) swap(x, y);
	r = x % y;
	while(r!=0){
		x = y;
		y = r;
		r = x % y;
	}
    return y;
}

LL S;

//項数がkの場合の数列の数を返す
LL f(LL k){
	LL a = S - (3*k);
	if(a < 0){
		return 0;
	}
	if(a == 0){
		return 1;
	}
	LL b = k - 1;
	LL c = a + b;
	// c!/(a!*b!)が求めるもの
	LL ret = fac[c];
	ret *= finv[a];
	ret %= P;
	ret *= finv[b];
	ret %= P;
	if(ret < 0){
		ret += P;
	}
	return ret;
}

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

	cin >> S;
	COMBinit();

	if(S < 3){
		printf("0\n");
		return 0;
	}

	LL ans = 0;
	for(int i=1; i<S; i++){
		if(3*i > S){
			break;
		}
		ans += f(i);
		ans %= P;
	}
	printf("%lld\n", ans);
	return 0;
}


Measured memory_bytes: 15724
#include<iostream>
#include<iomanip>
#include<math.h>
#include<cstdlib>
#include<algorithm>
#include<string>
#include<set>
#include<vector>
using namespace std;

#define INF 1<<21
#define MOD 1000000007

int main(){
    long long x;
    long long p,q;
    cin>>x;
    p=x/11;
    q=x%11;
    if(q==0){
        cout<<p*2<<endl;
        return 0;
    }
    cout<<((q>6)?p*2+2:p*2+1)<<endl;
    return 0;
}


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


namespace CSTest
{
    class Program
    {
        static void Main(string[] args)
        {
            var strings = Console.ReadLine().Split(' ');
            var N = int.Parse(strings[0]);
            var M = int.Parse(strings[1]);
            var C = int.Parse(strings[2]);
            var B = Console.ReadLine().Split(' ').Select(val => int.Parse(val)).ToArray();
            int count = 0;
            for (int i = 0; i < N; i++)
            {
                var vals = Console.ReadLine().Split(' ').Select(val => int.Parse(val)).ToArray();
                int sum = C;
                for (var r = 0; r < vals.Length; r++)
                {
                    sum += vals[r] * B[r];
                }

                if (sum > 0) count++;
            }

            Console.WriteLine(count);
        }
    }
}

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

int main() {
	int n,T,sum=0;
	cin >>n >>T;
	vector<int> t(n);
	t[0] = 0;
	for (int i = 1; i <= n; i++) cin >> t[i];
	for (int i = 1; i <= n-1; i++) {
		sum += min((t[i+1] - t[i]), T);
	}
	cout << sum+T << endl;
	return 0;
}

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

long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

int main(){
  string s;
  cin >> s;
  if(s[0]=='7' or s[1]=='7' or s[2]=='7')
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}


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

int main()
{
    string S;
    cin>>S;
    int c = 0,mx=0;
    for(int i=0; i<S.size(); i++)
    {
        if(S[i]=='R')
            c++;
        else 
        {
            mx = max(mx,c);
            c = 0;   
        }    
    }
  	if(mx==0)
      mx =c;
    cout<<mx;
}

Measured memory_bytes: 3592
n = int(input())
lr = [None]*100000
rmax = 0
for i in range(n):
    lr[i]= list(map(int,input().split()))
    if lr[i][1] > rmax:
        rmax = lr[i][1]

p = [1]*(rmax+1)
p[0]=0
p[1]=0
        

for j in range(2,int(rmax**0.5+1)):
    if p[j] == 0:
        continue
    for i in range(2,rmax+1):
        if i!=j and i%j == 0:
            p[i] = 0
for i in range(rmax, 1,-2):
    if p[int((i+1)/2)] == 0:
        p[i] = 0
p[2] = 0
for i in range(2,rmax):
    p[i+1] += p[i]  

for i in range(n):
    print(p[lr[i][1]] - p[lr[i][0]-1])

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

typedef long long ll;
ll gcd(ll a,ll b){ return __gcd(a,b); }
ll lcm(ll a,ll b){ return a/gcd(a,b)*b; }

ll mod=15;

ll add(ll a,ll b){
  return (a+b)%mod;
}

ll mul(ll a,ll b){
  return (a*b)%mod;
}

ll mod_pow(ll a,ll b){
  if(b==0)return 1;
  ll res=mod_pow( mul(a,a) ,b/2);
  if(b&1)res=mul(res,a);
  return res;
}

ll euler(ll n){
  ll res=n;
  for(ll i=2;i*i<=n;i++){
    if(n%i==0){
      res=res/i*(i-1);
      while(n%i==0)n/=i;
    }
  }
  if(n!=1)res=res/n*(n-1);
  return res;
}

bool isP(ll x){
  for(ll i=2;i*i<=x;i++){
    if(x%i==0)return false;
  }
  return (x>=2);
}

ll solve(ll a,ll b){
  ll cnt=0,k=a;
  while(1){
    k=(k*a)%b;
    cnt++;
    if(k==a){
      break;
    }

    if(cnt>1e8){
      cnt=euler(b);
      break;
    }
  }
  return cnt;
}

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

  if(isP(n)){
    cout<<1<<endl;
    return 0;
  }
  
  vector<ll> s;

  for(ll i=2;i*i<=n;i++){
    if(n%(i*i)==0){
      cout<<-1<<endl;return 0;
    }
    if(n%i==0){
      s.push_back(i);
      s.push_back(n/i);
    }
  }
  ll ans=1;
  
  for(int i=0;i<(int)s.size();i++){
    ll num= euler(n/s[i]);
    ans=lcm(ans, num );
  }
  


  if( n%ans== 0 || __gcd(n,ans) !=1){
    cout<< -1 <<endl;
    return 0;
  }
  
  ll k=1,cnt=0;
  while(1){
    k=(k*n)%ans;
    cnt++;
    if(k==1){
      break;
    }
    if(cnt>1e8){
      cnt=euler(ans);
      break;
    }
  }
  cout<<cnt<<endl;


  /*
  ll C=1;
  for(ll i=0;i<n;i++){
    ll k=solve( i , n );
    C=lcm(k,C);
  }
  */
  //  cout<<C<<' '<<ans<<endl;
  
  return 0;
}

Measured memory_bytes: 1216
#print#!/usr/bin/env python3
#%% for atcoder uniittest use
import sys
input= lambda: sys.stdin.readline().rstrip()
sys.setrecursionlimit(10**9)
def pin(type=int):return map(type,input().split())
def tupin(t=int):return tuple(pin(t))
def lispin(t=int):return list(pin(t))
#%%code

#なお、任意の整数 M に対して M の −2 進数表現が一意に定まることが証明できます。
#2桁ごとに見るとよかった（もう実験したよ）
def resolve():
    a,b=pin(str)
    s=a+b
    for i in range(1000):
        if i**2==int(s):
            print("Yes")
            break
    else:print("No")

#%%submit!
resolve()

Measured memory_bytes: 38256
while True:
    H,W = list(map(int, input().split()))
    if W == 0 and H == 0:
        break
    w = 0
    h = 0
    for h in range(H):
        if h % 2 == 0:
            for w in range(W):
                if w % 2 == 0:
                    print("#", end="")
                else:
                    print(".", end="")
            print()
        else:
            for w in range(W):
                if w % 2 == 0:
                    print(".", end="")
                else:
                    print("#", end="")
            print()
    print()



Measured memory_bytes: 7004
#include <iostream>
#include <fstream>
#include <cstdlib>
#include <math.h>
#include <utility>
#include <algorithm>
#include <functional>
#include <vector>
#include <numeric>
#include <bits/stdc++.h>

#define int long long

struct edge {
    int to;
    int cost;
};

using namespace std;
using vi = vector<int>;
using vii = vector<vector<int>>;
using vb = vector<bool>;
using qi = queue<int>;
using P = pair<int, int>;
using graph = vector<vector<edge>>;
// using graph = vector<vector<int>>;


#define FOR(i, a, b) for (int i = a; i < (b); i++)
#define REP(i,n) for(int i=0;i<n;i++)
#define delim(i, n) cout << (i == n-1 ? "\n" : " ");

struct UnionFind {
    vi par;
    UnionFind(int n) : par(n) {
        REP(i, n) par[i] = i;
    }

    int root(int x) {
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) {
        int rx = root(x);
        int ry = root(y);
        par[rx] = ry;
    }

    bool same(int x, int y) {
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

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

const int inf = 1LL << 60;
// const int inf = 100000000;
const int mod = 1000000007;

const int maxn = 50;
int n, m;
vi a(maxn), b(maxn);

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

    cin >> n >> m;
    REP(i, m) cin >> a[i] >> b[i];
    REP(i, m) {a[i]--; b[i]--;}

    int cnt = 0;
    REP(i, m) {
        UnionFind tree(n);
        REP(j, m) {
            if (j != i) tree.unite(a[j], b[j]);
        }
        if (!tree.same(a[i], b[i])) cnt++;
    }
    cout << cnt << "\n";
}

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


int main(){

  int a , b ;
  
  cin >> a >> b ;
  
  if (a < 6){
    cout << 0 ;
  }
  else if( a > 12 ) {
	cout << b ;
  }
	else {
    cout << b/2 ;
    }
  
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-

A_list=[[int(j) for j in input().split()] for i in range(3)]
N = int(input().strip())
b_list=[int(input().strip()) for _ in range(N)]
#-----

for num in b_list:
    for ai in range(3):
        for aj in range(3):
            if num == A_list[ai][aj]:
                A_list[ai][aj] = "O"

Flag=False
for i in range(3):
    if A_list[i][0]==A_list[i][1]==A_list[i][2]=="O":
        Flag = True
    if A_list[0][i]==A_list[1][i]==A_list[2][i]=="O":
        Flag = True

if A_list[0][0]==A_list[1][1]==A_list[2][2]=="O":
    Flag = True
if A_list[2][0]==A_list[1][1]==A_list[0][2]=="O":
    Flag = True

if Flag:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int N=1e6+5;
struct edge{int to,len,nxt;}e[N<<1];
int h[N],tot=1,n,m,col[N],sum[4],f1=0,f2=0,sz=0,ss;
ll ans=0;
void adde(int x,int y,int z){e[tot]=(edge){y,z,h[x]};h[x]=tot++;}
void dfs(int u){
    sz++,sum[col[u]]++;
    for(int i=h[u];i;i=e[i].nxt){
        int v=e[i].to;if(e[i].len==1)ss++;
        if(!col[v])col[v]=(col[u]+e[i].len-1)%3+1,dfs(v);
        else if(col[v]!=(col[u]+e[i].len-1)%3+1)f2=1;
    }
}
int main(){
    scanf("%d%d",&n,&m);
    for(int i=1;i<=m;i++){int x,y;scanf("%d%d",&x,&y),adde(x,y,1),adde(y,x,2);}
    for(int i=1;i<=n;i++){
        if(col[i])continue;
        col[i]=1,f1=f2=sz=sum[1]=sum[2]=sum[3]=ss=0;dfs(i);
        //cout<<f1<<" "<<f2<<endl;
        if(f2)ans+=1ll*sz*sz;
        else if(sum[1]&&sum[2]&&sum[3])ans+=sum[1]*1ll*sum[2]+sum[2]*1ll*sum[3]+sum[3]*1ll*sum[1];
        else ans+=ss;
    }
    printf("%lld\n",ans);
}


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

int main(){
  ll N, i, patern = 1;
  cin >> N;
  double x[N], y[N], dis, tot = 0;
  rep(i, N){
    cin >> x[i] >> y[i];
    patern *= (i+1);
  }
  for (i = 0; i < N; i++){
    for(int j = i + 1; j < N; j++){
      dis = sqrt((x[i] - x[j])*(x[i] - x[j]) + (y[i] - y[j])*(y[i] - y[j]));
      tot += dis;
    }
  }
  ll q = 1;
  for (i = 1; i <= N - 2; i++){
    q *= i;
  }

  printf("%.6lf", tot * 2 * (N - 1) * q/patern);
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    int a, i, c1=0, c2=0, c3=0, c4=0;
    scanf("%d",&a);
    for(i=1; i<=a; i++)
    {
        if(1<=i &&i <=9)
        {
            c1++;
        }
        else if(100<=i && i<=999)
        {
            c2++;
        }
        else if(10000<=i && i<=99999)
        {
            c3++;
        }
        else if(1000000<=i && i<=9999999)
        {
            c4++;
        }
    }
    printf("%d",c1+c2+c3+c4);
    return 0;
}

Measured memory_bytes: 1724
// AOJ_C++.cpp : アプリケーションのエントリ ポイントを定義します。
//
#include <iostream>
#include <math.h>

int main()
{
	int a, b, c;
	std::cin >> a >> b >> c;
	if (a < b && b < c) {
		std::cout << "Yes" << std::endl;
	}
	else {
		std::cout << "No" << std::endl;
	}
	
    return 0;
}


Measured memory_bytes: 3096
import java.util.Scanner;

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

		int a = sc.nextInt();
		int b = sc.nextInt();
		if (a % 2 != b % 2) {
			System.out.println("IMPOSSIBLE");
		} else {
			int ans = (b - a) / 2 + a;
			System.out.println(ans);
		}
	}
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<long long> vll;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef pair<int, int> pii;
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define vv(type, c, m, n, i) vector<vector<type>> c(m, vector<type>(n, i))
#define mat(type, c, m, n) vector<vector<type>> c(m, vector<type>(n));for(auto& r:c)for(auto& i:r)cin>>i;
#define rep(i,a,n) for(int i=(a), i##_len=(n); i<i##_len; ++i)
#define rrep(i,a,n) for(int i=(a), i##_len=(n); i>i##_len; --i)
#define each(x,y) for(auto &(x):(y))
#define var(type, ...)type __VA_ARGS__;Scan(__VA_ARGS__);
template<typename T> void Scan(T& t) { cin >> t; }
template<typename First, typename...Rest>void Scan(First& first, Rest&...rest) { cin >> first; Scan(rest...); }
#define vec(type, c, n) vector<type> c(n);for(auto& i:c) cin>>i;
#define len(x) ((int)(x).size())
#define mp make_pair
#define eb emplace_back
#define em emplace
#define pb pop_back
#define fi first
#define se second
#define get(a, i) get<i>(a)
#define bit_count __builtin_popcount
#define mt make_tuple
inline string zero(int a,string s,char c='0'){return string(a-len(s),c)+s;}
inline string zero(int a,int t,char c='0'){return zero(a, to_string(t), c);}
inline string zero(int a,ll t,char c='0'){return zero(a, to_string(t), c);}
#define mini min_element
#define maxi max_element
#define sum accumulate
#define chmax(a,b) if(a<b)a=b
#define chmin(a,b) if(a>b)a=b
template <class T> inline void print(T t){cout << t << '\n';}
template <class H, class... T> inline void print(H h, T... t){cout << h << " ";print(t...);}
int solve() {
	var(int, n);
	vec(int, a, n);
	int ans = 0;
	rep(i, 1, n) {
		if (a[i - 1] == a[i]) {
			++ans;
			++i;
		}
	}
	return ans;
}
int main() {
	print(solve());
	return 0;
}


Measured memory_bytes: 256
#include<iostream>

using namespace std;

#define MAX 2000000

int H, A[MAX + 1];

void maxHeapify(int i) {
  int left, right, largest;
  left = 2 * i;
  right = 2 * i + 1;

  if (left <= H && A[left] > A[i]) {
    largest = left;
  } else {
    largest = i;
  }

  if (right <= H && A[right] > A[largest]) {
    largest = right;
  }

  if (largest != i) {
    swap(A[i], A[largest]);
    maxHeapify(largest);
  }
}

int main() {
  cin >> H;
  for (int i = 1; i <= H; i++) {
    cin >> A[i];
  }

  for (int i = H / 2; i >= 1; i--) {
    maxHeapify(i);
  }

  for (int i = 1; i <= H; i++) {
    cout << " " << A[i];
  }
  cout << endl;

  return 0;
}


Measured memory_bytes: 5036
s=input()
q=int(input())
muki=True
a=[[_ for _ in input().split()] for i in range(q)]
front=""
back=""
for i in a:
    if i[0]=="1":
        muki=not muki
        continue
    if (i[1]=="1" and muki) or (i[1]=="2" and not muki):
        front=i[2]+front
    else:
        back+=i[2]
if muki:
    print(front+s+back)
else:
    print((front+s+back)[::-1])

Measured memory_bytes: 28100
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
int main()
{
    int a;
    string s;
    cin >> a >> s;
    if(a>=3200)
        cout << s << endl;
    else
        cout << "red" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <string>
#include <vector>
#include <limits>
#include <algorithm>
#include <utility>
#include <sstream>
#include <numeric>
#include <iterator>

using namespace std;

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

int main(int argc, const char * argv[]) {
  int n, m;
  cin >> n >> m;
  int res = 0;
  rep(i, m){
    int a;
    cin >> a;
    res += a;
  }
  if(res > n){
    cout << -1 << endl;
  }else{
    cout << n - res << endl;
  }

  return 0;
}


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

#define ll long long
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define vi vector<int>
#define vl vector<long long>
#define sz size()
#define x first
#define y second
#define pii pair<int, int>
#define pll pair<ll, ll>
#define ld long double

using namespace std;

string s;

bool is_pal(string s) {
	for(int i = 0; i < s.sz; i++) {
		if(s[i] != s[s.sz - i - 1]) return 0;
	}
	return 1;
}

int main() {

	cin >> s;

	if(is_pal(s)) cout << "Yes\n";
	else cout << "No\n";
	return 0;
}

Measured memory_bytes: 256
// 153

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

int main() {
    int h, a;

    int ans;

    cin >> h >> a;

    ans = h / a;
    if (h % a != 0) {
        ans = ans + 1;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import collections
import numpy as np

N = int(input())
xy = [list(map(int, input().split())) for _ in range(N)]

xy = np.array(xy)

dic_xy = {}

for i in range(N):
    for j in range(N):
        if i != j:
            diff_xy = xy[i] - xy[j]
            diff_xy = tuple(diff_xy)
            
            if dic_xy.get(diff_xy) is None:
                dic_xy[diff_xy] = 1
            else:
                dic_xy[diff_xy] += 1

max_diff = 0
for x in dic_xy:
    max_diff = max(max_diff, dic_xy[x])
    
print(N - max_diff)

Measured memory_bytes: 12628
#include <iostream>

using namespace std;

int main() {
	int D,N;

	cin >> N;
	int count;
	for (int i = 0; i < N; i++) {
		int a;
		cin >> a;
		while (a % 2 == 0) {
			a /= 2;
			count++;
		}
	}

	cout << count << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <functional>
#include <limits.h>
#include <set>
#include <map>
#include <tuple>
using namespace std;

#define ll long long
#define ull unsigned long long
#define rep(i,N) for (ll i=0;i<N;i++)
#define loop(i,N,M) for(ll i=N;i<M;i++)
#define MAX(v) *max_element(v.begin(),v.end())
#define MIN(v) *min_element(v.begin(),v.end())
#define SORTL2S(type,v) sort(v.begin(),v.end(),greater<type>())
#define SORTS2L(type,v) sort(v.begin(),v.end())
#define SORTMF(v,func) sort(v.begin(),v.end(),func)

template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T &val) {
	std::fill((T*)array, (T*)(array + N), val);
}

//�ϐ�
ll A,B,C;

//��@
void solve() {
	cin >> A>> B>> C;
	cout << (A+B+C) - max(A,max(B,C));

	return;
}

int main() {

	//����

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

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <list>
#include <numeric>
#include <utility>
#include <ctime>
#define INF 100000000
#define LINF 9000000000000000000
#define mod 1000000007
 
#define rep(i,n) for(int i=0;i<int(n);i++)
#define rrep(i,n) for(int i=(n);i>=0;i--)
#define REP(i,a,b) for(int i=(a);i<int(b);i++)
#define all(x) (x).begin(),x.end()
#define pb push_back
#define mp make_pair
#define MOD(x) (x%(mod))

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int,int> pi;
 
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
bool debug=false;
/*---------------------------------------------------*/

int h,w;
char c[55][55];
int ddx[8]={0,1,1,1,0,-1,-1,-1};
int ddy[8]={1,1,0,-1,-1,-1,0,1};

int check(int y,int x){
  int cnt=0;
  rep(i,8){
    if(c[y+ddy[i]][x+ddx[i]]=='#')cnt++;
  }
  return cnt;
}

int main(){
  cin>>h>>w;
  rep(i,h){
    rep(j,w){
      cin>>c[i][j];
    }
  }

  rep(i,h){
    rep(j,w){
      if(c[i][j]=='.')cout<<check(i,j);
      else cout<<'#';
    }
    cout<<endl;
  }
  
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
vector<long long >v;
int main()
{
    long long t,n,c,x,p;
    string s;
    cin>>s;
    if(s.size()<6)
        cout<<"No";
    else
    {
        if(s[2]==s[3] && s[4]==s[5])
            cout<<"Yes";
        else
            cout<<"No";
    }


}


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

int main()
{
    int t;
    cin>>t;
    int cpt = 0,d =0;
    while(t--)
    {
    	int a,b;
    	cin>>a>>b;
    	if(a == b)
		{
			d++;
			if(d==3)cpt =3;
	   }
    	else d=0;
	}
	if(cpt == 3) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 3632
#include<stdio.h>

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

  int i=0, count=0;

  if(str[1] != '\0'){
    while(str[i+1] != '\0'){
      if(str[i] != str[i+1]){
        count++;
      }
      i++;
    }
  }

  printf("%d\n", count);

  return 0;

}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int sum;
int main(void)
{
    int mon,n;
    cin >> mon >> n;
    while(n--)
    {
        int temp;
        cin >> temp;
        sum+=temp;
    }
    if(sum>=mon)
        cout<< "Yes";
    else cout << "No";
}


Measured memory_bytes: 256
var b=[String:Int]()
for _ in 0..<Int(readLine()!)!{
    let s=readLine()!
    if b[s]==nil{
        b[s]=1
    }else{
        b[s]=b[s]!+1
    }
}
var r=[String:Int]()
for _ in 0..<Int(readLine()!)!{
    let s=readLine()!
    if r[s]==nil{
        r[s]=1
    }else{
        r[s]=r[s]!+1
    }
}
var ans=0
for (s,_) in b{
    ans=max(b[s]!-(r[s] ?? 0),ans)
}
print(ans)

Measured memory_bytes: 6000