akhauriyash/Code-Regression huggingface dataset:
/*
                                Author: Ankit Kaul
**********************Code Belongs to Respective Author Only************************************
*/
 
/*#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")*/
 
#include <bits/stdc++.h>
 
#define endl       '\n'
#define PI          3.141592653589
#define jaldi       ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define M           1000000007
#define int         long long int
#define inf         INT_MAX
#define pb          emplace_back
#define pf          emplace_front
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define rall(a)     (a).rbegin(),(a).rend()
using namespace std;
 
int gcd(int a,int b) { return b == 0 ? a : gcd(b, a % b); }
int power(int x,int n){
    int result=1;
    while(n>0)
    {
        if(n % 2 ==1)
            result=(result * x) % M;
        x=(x*x)% M;
        n=n/2;
    }
    return result % M;
}
signed main()
{   jaldi
    int n;
    cin>>n;
    int a[n],i,mn,mx,count=1;
    for(i=0;i<n;i++)
    cin>>a[i];   
    mn=a[0],mx=a[0];
    for(i=1;i<n;i++)
    {   if(a[i]<mn)
        {   count++;
            mn=a[i];
        }
        if(a[i]>mx)
        mx=a[i];
    }
    cout<<count;
}

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

#define N 1000

int main(){
    int i,j,tl,pl,flag;
    char t[N],p[N];

    scanf("%s",t);
    tl=strlen(t);

    scanf("%s",p);
    pl=strlen(p);

    for(i=0;i<tl;i++){
        if(t[i]==p[0]) flag=0;
        for(j=0;j<pl;j++){
            if(t[i+j]!=p[j]) flag=1;
        }
        if(flag==0) printf("%d\n",i);
    }

    return 0;
}

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

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

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

using namespace std;

#define MOD 1000000007
typedef long long int ll;

int main(){

    ios_base::sync_with_stdio(false);
    cin.tie(0);

    int n;
    cin>>n;
    int a[n]={0};
    for(int i=0;i<n;i++){
    	cin>>a[i];
    }
    bitset<4000010>poss;
    poss[0]=1;
    for(int i=0;i<n;i++){
    	poss|=(poss<<a[i]);
    }
    int sum=0;
    for(int i=0;i<n;i++){
    	sum+=a[i];
    }
    //cout<<sum<<endl;
    for(int i=sum/2+(sum%2);i<=sum;i++){
    	//cout<<i<<endl;
    	if(poss[i]==1){
    		cout<<i<<endl;
    		return 0;
    	}
    }
    

	return 0;
}

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

const int maxV = 90010;
const int maxN = 1e5+10;
const int MOD = 1e9+7;
const ll INF = 1000000000000000010LL;


int a[maxN];
int b[maxN];
int c[maxN];

int main() {
	int x,y;
	scanf("%d%d",&x,&y);
	int ans = max(x-2*y,0);
	cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <math.h>
#include <complex>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <assert.h>
#include <numeric>
#include <iomanip>

using ll = long long;
using P = std::pair<ll, ll>;

#define rep(i, a, b) for (ll(i) = (a); i < (b); i++)
#define all(i) i.begin(),i.end()
#define debug(i) std::cout << i << "\n"



const int INF = 100000000;
const ll MOD = 1000000007;

ll pow_mod(ll x, ll y, ll mod)
{
	if (y == 0)
		return 1;
    if(y%2){
        return (x*pow_mod(x,y-1,mod))%mod;
    }else{
        return pow_mod(x*x,y/2,mod);
    }
}

int main()
{
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	//問題文中の添え字が0-indexか1-indexか確認!

  std::string s;
  std::cin>>s;
  ll n=s.size();
  std::vector<ll> a,ans(n,0);
  char prev='R';
  ll cnt=0;

  rep(i,0,n){
    if(prev!=s[i]){
      a.push_back(cnt);
      cnt=1;
      prev=s[i];
    }else{
      cnt++;
    }
  }

  a.push_back(cnt);

  ll cellnum=a.size();
  ll temp=0;
  rep(i,0,cellnum/2){
    temp+=a[i*2];
    ans[temp-1]=(a[2*i]+1)/2 + a[2*i+1]/2;
    ans[temp]=a[2*i]/2 + (a[2*i+1]+1)/2;
    temp+=a[i*2+1];
  }

  rep(i,0,n)std::cout<<ans[i]<<" ";
	return 0;
}

Measured memory_bytes: 2372
#include <bits/stdc++.h>
#define rep(i,m,n) for(int i=m; i<n; i++)
#define co(n) cout << n << endl
using namespace std;
int main(){
  int x, a, b;
  cin >> x >> a;
  
  if(x%500<=a) co("Yes");
  else co("No");
  
  return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#ifndef err
#define err(...)(void)0
#endif
using namespace std;
using ll = long long;
using ull = decltype(1ull);
template<class T>int size(T&&a) { return a.size(); }
#define REP(t,a)for(typename make_signed<decltype(a.second)>::type t=a.first,_l##t=a.second;t<_l##t;t++)
#define RREP(t,a)for(typename make_signed<decltype(a.second)>::type t=a.second-1,_l##t=a.first;t>=_l##t;t--)
template<class B>pair<int, B>make_pair(B b) { return{ 0,b }; }
#define rep(t,...)REP(t,make_pair(__VA_ARGS__))
#define rrep(t,...)RREP(t,make_pair(__VA_ARGS__))
#define all(a)begin(a),end(a)
#define rall(a)a.rbegin(),a.rend()
#define var(t, ...) t __VA_ARGS__;in,__VA_ARGS__;

void Calc();
int main() {
  ios::sync_with_stdio(false); cin.tie(nullptr);
  cin.exceptions(istream::failbit | istream::badbit);
  cout << fixed << setprecision(15); Calc(); cout.flush(); return 0;
}
template<class A>void amax(A&a, A b) { a = max(a, b); }
template<class A>void amin(A&a, A b) { a = min(a, b); }
template<class A>int comp(A a, A b) { return a < b ? 1 : b < a ? -1 : 0; }
struct Scanner {
  template<class A = string>A Next() { A a; Next(a); return a; }
  template<class A, class B>void Next(pair<A, B>& a) { cin >> a.first >> a.second; }
  template<class A>void Next(A& a) { cin >> a; }
  template<class A = int>vector<A>Array(int n) { vector<A>a(n); for (A&i : a) (*this), i; return a; }
  string Line() const { string s; getline(cin, s); return s; }
  template<class A>Scanner&operator,(A&a) { a = Next<A>(); return *this; }
  template<class A>operator A() { return Next<A>(); }
}in;
/*---------------------------------------------------------------------*/


void Calc() {

  var(ll, n, a, b, c, d);
  n -= 1;
  rep(i, n + 1) {
    ll t = a - i * d + (n - i) * c;
    if (a == 7)err(t, t + n * (d - c));
    if (t <= b && b <= t + n * (d - c)) {
      cout << ("YES") << endl;
      return;
    }
  }
  cout << ("NO") << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int u=2,n;
int main()
{
//	freopen(".in","r",stdin);
//	freopen(".out","w",stdout);
    cin>>n;
    if(n==1)
    {
    	cout<<"1"<<endl;
    	return 0;
    }
    if(n==64||n==4||n==8||n==16||n==32)
    {
    	cout<<n<<endl;
    	return 0;
    }
	for(int i=1;i<=10;i++)
	{
		u=u*2;
		if(u>=n)
		{
			cout<<u/2<<endl;
			return 0;
		}
	} 
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
// const int INF = (1 << 30) - 1;
// const ll LL_INF = (1LL << 62) - 1;
// const ll MOD = 1e9 + 7;

int H, W, K;
char s[300][300];
int ans[300][300];

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> H >> W >> K;
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      cin >> s[i][j];
    }
  }

  // 横に切る
  int num = 1;
  bool first = true;
  for (int i = 0; i < H; i++) {
    int j = 0;
    bool found = false;
    while (j < W) {
      if (!found && s[i][j] == '#') {
        if (first) {
          first = false;
        } else {
          j = 0;
          num++;
        }
        found = true;
      }
      ans[i][j] = num;
      j++;
    }
  }

  // 縦に切る
  int h = 0;
  num = 1;
  while (h < H) {
    int h1 = h;
    int n = ans[h][0];
    while (h + 1 < H && n == ans[h + 1][0]) {
      h++;
      n = ans[h][0];
    }
    bool first = true;
    int j = 0;
    while (j < W) {
      bool found = false;
      for (int i = h1; i <= h; i++) {
        if (!found && s[i][j] == '#') {
          if (first) {
            first = false;
          } else {
            i = h1;
            num++;
          }
          found = true;
        }
        ans[i][j] = num;
      }
      j++;
    }
    h++;
    num++;
  }

  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      if (j != 0) {
        cout << " ";
      }
      cout << ans[i][j];
    }
    cout << endl;
  }
  return 0;
}

Measured memory_bytes: 1280
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();

        int start = a + b;
        if (start >= 24) start = start - 24;

        System.out.println(start);
    }
}


Measured memory_bytes: 23124
n = int(input())
a1 = list(map(int, input().split()))
a2 = list(map(int, input().split()))
for i in range(1, n):
    a1[i] = a1[i] + a1[i-1]
    a2[-i-1] = a2[-i-1] + a2[-i]
ma = 0
for i in range(n):
    ma = max(ma, a1[i] + a2[i])
print(ma)


Measured memory_bytes: 3064
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <fstream>
#include <complex>
#include <math.h>
#include <ctype.h>
using namespace std;
int p,q,a=0;
int main() {
	cin >> p>>q;
if (p > 100) { a += (p - (p % 11)-11)/11*5; p = p % 11 + 11; }
	for (int j = 2; j < p; j++) {
		for (int i = 2; i < 7; i++) {
			if ((7 * (j-1)+i)*9 % 11 == q) 
			{ a++;  }
		}
	}
	cout <<a<<endl; 
	return 0;
}


Measured memory_bytes: 384
#include<iostream>
#include<string>
using namespace std;
int main(){

  string s;
  int ans=0;
  std::cin >> s;
  if(s=="SUN")ans=7;
  if(s=="MON")ans=6;
  if(s=="TUE")ans=5;
  if(s=="WED")ans=4;
  if(s=="THU")ans=3;
  if(s=="FRI")ans=2;
  if(s=="SAT")ans=1;

  std::cout << ans << '\n';


  return 0;
}


Measured memory_bytes: 256
import sys
input=sys.stdin.readline
sys.setrecursionlimit(10 ** 6)
#from collections import defaultdict
#d = defaultdict(int)
#import fractions
#import math
#import collections
#from collections import deque
#from bisect import bisect_left
#from bisect import insort_left
#N = int(input())
#A = list(map(int,input().split()))
#S = list(input())
#S.remove("\n")
#N,M = map(int,input().split())
#S,T = map(str,input().split())
#A = [int(input()) for _ in range(N)]
#S = [input() for _ in range(N)]
#A = [list(map(int,input().split())) for _ in range(N)]
#import itertools
#import heapq
#import numpy as np
N = int(input())
Max = 0
H = list(map(int,input().split()))
s = 0
cur = H[0]
for i in range(1,N):
    if cur >= H[i]:
        s += 1
        cur = H[i]
    else:
        Max = max(s,Max)
        cur = H[i]
        s = 0
Max = max(s,Max)
print(Max)

Measured memory_bytes: 14300
import java.util.Scanner;

public class Main{

	public static void main(String[] args)
	{
		@SuppressWarnings("resource")
		Scanner sc = new Scanner(System.in);

		while(sc.hasNext())
		{
			String[] s = sc.nextLine().split("[\\s]+");
			int value = Integer.parseInt(s[0]);
			int value_2 = Integer.parseInt(s[1]);
			int sum = value + value_2;
			int count = 1;
			while(sum / 10 != 0)
			{
				sum /= 10;
				count++;
			}
			System.out.println(count);
		}
	}
}

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

int n,arr[1000000],val[1000000];

int main(){
	scanf("%d", &n);
	for(int i = 0; i < n; i++){
		scanf("%d", &arr[i]);
	}
	int xam1 = 0;
	int xam2 = 0;
	int num1 = 0;
	int num2 = 0;
	int res = 0;
	for(int i = 0; i < n; i += 2){
		val[arr[i]]++;
		if(val[arr[i]] > xam1){
			if(num1 != arr[i]){
				num2 = num1;
				xam2 = xam1;				
			}
			xam1 = val[arr[i]];
			num1 = arr[i];
		} else if(val[arr[i]] > xam2){
			xam2 = val[arr[i]];
			num2 = arr[i];
		}
	}
	int temp1 = xam1;
	int temp2 = xam2;
	int num2t = 0;
	int num1t = 0;
	xam1 = 0;
	xam2 = 0;
	for(int i = 0; i <= 500000; i++)val[i] = 0;
	for(int i = 1; i < n; i += 2){
		val[arr[i]]++;
		if(val[arr[i]] > xam1){
			if(num1t != arr[i]){
				num2t = num1t;
				xam2 = xam1;				
			}
			xam1 = val[arr[i]];
			num1t = arr[i];
		} else if(val[arr[i]] > xam2){
			xam2 = val[arr[i]];
			num2t = arr[i];
		}
	}
	if(num1 == num1t){
		res = min(n-temp1-xam2, n-xam1-temp2);
	} else {	
		res = n-xam1-temp1;
	}
	printf("%d\n", res);
}

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

using namespace std;

#define ll long long




void solve() {

	int n;
	cin >> n;
	int arr[n];
	for(int i = 0; i < n; i++) {
		cin >> arr[i];
	}
	int cnt = 0;
	for(int i = 0; i < n; i++) {
		if(arr[i] != i + 1) {
			cnt++;
		}
		if(cnt > 2) {
			break;
		}
	}
	if(cnt <= 2) {
		cout << "YES";
	}
	else {
		cout << "NO";
	}

	




	
}

int main() {

	ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	solve();

	return 0;
}

Measured memory_bytes: 3652
#include<bits/stdc++.h>
#define ford(i,a,b) for(int i=(a);i>=b;i--)
#define rep1(i,a,b) for(int i=(a);(i)<=(b);(i)++)
#define rep(i,a,b) for(int i=(a);(i)<(b);(i)++)
#define ll long long
#define mpi map<int,int>
#define N 200005
#define pql priority_queue<ll>
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
using namespace std;
int main() {
	double r;
	cin>>r;
	cout<<r*2*3.14;
	return 0;
}


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

int gcd(int x, int y) {
	if(x < y)
		swap(x, y);
	if(y == 0)
		return x;

	while(x%y != 0) {
		int t = x;
		x = y;
		y = t%y;
	}

	return y;
}

int main() {
	int N,r=0;
	cin >> N;
	vector<int> A(N),g1(N+1,0),g2(N+1,0);

	rep(i,N)
		cin >> A.at(i);
	
	rep(i,N) {
		g1.at(i+1) = gcd(g1.at(i), A.at(i));
		g2.at(N-1-i) = gcd(g2.at(N-i), A.at(N-1-i));
	}

	rep(i,N)
		r = max(r, gcd(g1.at(i), g2.at(i+1)));
	
	cout << r << endl;
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef map<int,int> mii;
typedef map<ll,ll> mll;
typedef vector<pii> vii;
typedef vector<pll> vll;
#define fi first
#define se second
#define pi 3.141592653589793
#define mod 1e9 + 7
#define pb push_back
#define all(v) v.begin(),v.end()
#define rall(v) v.begin(), v.end(), greater<ll>()
#define tc int t;cin>>t;while(t--)
#define pqmax priority_queue<int>
#define pqmin priority_queue<int,vi,greater<int>>
#define fast_io ios_base::sync_with_stdio(0), cin.tie(NULL)
#define tc_g int tt;cin>>tt;for(int ti=1;ti<=tt;ti++)
#define case_g "Case #"<<ti<<": "
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_multiset;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
typedef tree<int, int, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_map;
using namespace std;
int main() {
    ll n;
    cin >> n;
    vl a(n);
    for(auto &it: a) cin >> it;
    ll ct;
    ll mxc = 0;
    for(int i = 0; i < n; ++i) {
        ct = 0;
        ll j = i + 1;
        while(j < n && a[i] >= a[j]) {
            ++ct;
            ++j;
            ++i;
        }
        mxc = max(ct, mxc);
    }
    cout << mxc;
}


Measured memory_bytes: 1024
import collections
import math

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

n = int(input())
str = []
for i in range(n):
    str.append(''.join(sorted(input())))

c = collections.Counter(str)

count = 0
for k, v in c.items():
    if v > 1:
        count += combinations_count(v, 2)

print(count)

Measured memory_bytes: 68776
// Problem : D - Brick Break
// Contest : AtCoder - AtCoder Beginner Contest 148
// URL : https://atcoder.jp/contests/abc148/tasks/abc148_d
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

//#pragma GCC optimize "trapv"//  WA to RE int!!
#include <bits/stdc++.h>
#define FOR(i,n) for(int i=0;i<n;i++)
#define FORR(i,n) for(int i=n;i>=0;i--)
#define pb push_back
#define vint vector<int>
#define sint set<int>
#define mint map<int,int>
#define pint pair< int,int >
#define int long long int 
#define test int tt1234; cin>>tt1234;while(tt1234--)
#define endl "\n"
#define SI(a,n) int a[n];FOR(i,n) cin>>a[i];
#define input(a,n) int n;cin>>n; SI(a,n)
#define all(zz) zz.begin(),zz.end()
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define error(x) cerr << #x <<" is " << x << endl;
#define Error(a,b) cerr<<"( "<<#a<<" , "<<#b<<" ) = ( "<<(a)<<" , "<<(b)<<" )\n";
#define precision(x) cout<<fixed<<setprecision(x);
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
#define present(container, element) (container.find(element)!=container.end())
#define fint fast;test
#define set(a,x) memset(a,x,sizeof(a))
#define L(x)	((x)<<1)
#define R(x)	(((x)<<1)+1)
#define ft first
#define se second
#define MOD 1000000007
using namespace std;
template<typename... T> void rd(T&... args) { ((cin >> args), ...); }
template<typename... T> void pp(T... args) { ((cout << args << " "), ...); cout<<"\n"; }

void solve(){
	input(arr,n);
	int chk=1,cnt=0;
	FOR(i,n){
		if(arr[i]==chk)chk++;
		else cnt++;
	}	
	if(cnt>=n)pp(-1);
	else pp(cnt);
	return;	
}


int32_t main() {
    // fint{
    	fast;
    	solve();
    // }
    return 0;
}


Measured memory_bytes: 5180
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  string s;
  cin>>s;
  int left=0;
  int count=0;
  int right=s.size()-1;
  while(left<right){
  while(left<right && s[left]!='W') left++;
  while(left<right && s[right]!='R') right--;
    if(left<right){
      swap(s[left],s[right]);
      count++;
    }
  }
  cout<<count<<endl;
  return 0;
  }


Measured memory_bytes: 3744
#include <bits/stdc++.h>
using namespace std;
int main(){
    int k;
   string s;
   cin >> k >>s;
   if(s.size() <= k){
       cout << s << endl;
   }else{
       for(int i = 0;i<k;i++){
           cout << s.at(i);
       }
       cout << "..." << endl;
   }
 
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n,m;
    priority_queue<int> q;
    cin>>n>>m;
    for(int i=0;i<n;i++){
            int x;
            cin>>x;
            q.push(x);
    }
    int y;
    while(!q.empty()){
            y=q.top();
            q.pop();
            y/=2;
            q.push(y);
            m--;
            if(m<=0) break;
    }
    long long sum=0;
    while(!q.empty()){
            y=q.top();
            q.pop();
            sum+=y;
    }
    cout<<sum<<endl;
    return 0;

}



Measured memory_bytes: 892
#include <iostream>
#include <string>
#include <vector>
#include <algorithm> 
#include <utility> 
#include <tuple> 
#include <cstdint> 
#include <cstdio> 
#include <map> 
#include <queue> 
#include <set> 
#include <stack> 
#include <deque> 
#include <unordered_map> 
#include <unordered_set> 
#include <bitset> 
#include <cctype> 
#include <cmath>
#include <iomanip>
#include <ctype.h>

using namespace std;
using ll = long long;
using PAIR = pair<int, int>;
using PAIRLL = pair<ll, ll>;
using vi = vector<int>;
using vvi = vector<vi>;

#define TR ","
#define fi first
#define se second
#define rep(i,N) for(ll i=0;i<(ll)N;++i)
#define repe(i,a,b) for(ll i=a;i<(ll)b;++i)
#define all(v) v.begin(), v.end()
#define IO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define INF 100000000

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

ll lcm(ll x, ll y) {
    return x / gcd(x, y) * y;
}

ll waz = 76543217;

ll inv(ll x) {
    if (x == 1) { return 1; }
    if (x == 0) { return 0; }
    else {
        ll a = (waz - inv(waz % x) * (waz / x)) % waz;
        if (a >= 0) { return a; }
        else { return waz + a; }
    }
}

void printVector(const vector<int>& vec) {
    for (int value : vec) {
        cout << value << " ";
    }
    cout << endl;
}

vector<ll> p;

ll phi(ll x) {
    ll a = x;
    ll b = x;
    for (ll k = 0; k != p.size(); ++k) {
        if (a % p[k] == 0) {
            while (a % p[k] == 0) {
                a /= p[k];
            }
            b = b / p[k] * (p[k] - 1);
        }
        if (a == 1) { break; }
    }
    return b;
}

bool my_compare(pair<string, int> a, pair<string, int> b) {
    if (a.first != b.first) {
        return a.first < b.first;
    }

    if (a.second != b.second) {
        return a.second > b.second;
    }
    else {
        return true;
    }
}

int main()
{
    IO;

    ll N; cin >> N;
    deque<ll> a(N,0),h(N);
    rep(i, N) cin >> h[i];

    ll ans = 0;

    if (a == h) {
        cout << ans << endl;
        return 0;
    }

    while (1) {
        ll jj = 0;
        rep(i, N) {
            if (a[i] < h[i]) {
                ++a[i];
                ++jj;
            }
            if (jj > 0 && i < N-1 && a[i+1] == h[i+1]) {
                ++ans;
                break;
            }
            if (i == N - 1) {
                ++ans;
                break;
            }
        }
        if (a == h) {
            cout << ans << endl;
            break;
        }
    }
}

Measured memory_bytes: 256
from math import gcd


def main():
    n = int(input())
    a = [int(i) for i in input().split()]
    m = max(a)
    p = [0] * (m + 1)
    for i in range(2, m + 1):
        if p[i] == 0:
            for j in range(i, m + 1, i):
                p[j] = i
    factors = set()
    for ai in a:
        if ai == 1:
            continue
        f = set()
        while ai > p[ai]:
            f.add(p[ai])
            ai //= p[ai]
        f.add(ai)
        if factors & f:
            break
        factors |= f
    else:
        print("pairwise coprime")
        return
    g = a[0]
    for ai in a[1:]:
        g = gcd(ai, g)
        if g == 1:
            print("setwise coprime")
            return
    print("not coprime")


if __name__ == '__main__':
    main()


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

int main() {
    int a, b, c;
    cin >> a >> b >> c;
    a = a*100 + b*10 + c;
    cout << ( a%4 == 0 ? "YES" : "NO") << endl;
}


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

public class Main {
    public static void main(String[] args) {
        //コード
        Scanner scanner = new Scanner(System.in);
        int n = Integer.parseInt(scanner.next());
        int gohyaku =0, hyaku = 0, gozyu = 0, zyu = 0, go = 0, ichi = 0;
        int sum = 0;
        int uresisa = 0;

        gohyaku = n / 500;
        sum += gohyaku * 500;

        hyaku = (n - sum) / 100;
        sum += (hyaku * 100);

        gozyu = (n - sum) / 50;
        sum += gozyu * 50;

        zyu = (n-sum) / 10;
        sum += zyu * 10;

        go = (n-sum) / 5;
        sum += go * 5;

        ichi = n - sum;
        sum += ichi;


        uresisa += gohyaku * 1000;
        uresisa += hyaku * 100;
        uresisa += gozyu * 50;
        uresisa += zyu * 10;
        uresisa += go * 5;



        System.out.println(uresisa);
    }
}

Measured memory_bytes: 23764
from collections import deque

mod = 10 ** 9 + 7

N, K, *AB = map(int, open(0).read().split())

E = [[] for _ in range(N + 1)]
for a, b in zip(*[iter(AB)] * 2):
    E[a].append(b)
    E[b].append(a)

ans = K
visited = [False] * (N + 1)
Q = deque([1])
while Q:
    v = Q.popleft()
    visited[v] = True

    k = K - 2 if v != 1 else K - 1
    for u in E[v]:
        if visited[u]:
            continue
        Q.append(u)
        ans = (ans * k) % mod
        k -= 1

print(ans)


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

int main() {
    int n, m;
    cin >> n >> m;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    priority_queue<P> q;
    rep(i,n) q.push(make_pair(a[i],1));
    rep(i,m) {
        int c, b;
        cin >> b >> c;
        q.push(make_pair(c, b));
    }
    
    ll ans = 0;
    rep(i,n) {
        auto p = q.top(); q.pop();
        ans += p.first;
        if(p.second>1){
            p.second--;
            q.push(p);
        }
    }
    cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 3828
#include <iostream>
#include <iomanip>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <algorithm>
#include <numeric>
#include <utility>
#include <random>
#include <chrono>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
 
using namespace std;
 
using LL = long long;
using ULL = unsigned long long;
using PII = pair<int, int>;
using PIL = pair<int, LL>;
using PLL = pair<LL, LL>;
// const int mod = 1e9 + 7;
// const int mod = 998244353;
 
inline void quickread() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
}
 
int a[20], b[20];
int n;
 
inline void chkmin(int& x, int y) {
    if (x == -1 || (y != -1 && y < x)) {
        x = y;
    }
}
 
inline int get(int x, int y) {
    return (x - y) & 1 ? b[x] : a[x];
}
 
inline void work() {
    cin >> n;
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }
    for (int i = 0; i < n; ++i) {
        cin >> b[i];
    }
 
    vector<vector<int>> f(1 << n, vector<int>(n, -1));
    for (int i = 0; i < (1 << n); ++i) {
        int c = __builtin_popcount(i);
        if (c == 1) {
            f[i][__builtin_ctz(i)] = 0;
        }
        if (c > 1) {
            int mov = c;
            for (int j = 0; j < n; ++j) {
                if (i & (1 << j)) {
                    --mov;
                    for (int k = 0; k < n; ++k) {
                        if ((i & (1 << k)) && j != k && f[i ^ (1 << j)][k] != -1) {
                            if (get(j, c - 1) >= get(k, c - 2)) {
                                chkmin(f[i][j], f[i ^ (1 << j)][k] + mov);
                            }
                        }
                    }
                }
            }
        }
    }
 
    int ans = -1;
    for (int i = 0; i < n; ++i) {
        chkmin(ans, f[(1 << n) - 1][i]);
    }
    cout << ans << "\n";
}
 
int main() {
    // freopen("input.txt", "r", stdin);
    quickread();
    work();
    return 0;
}

Measured memory_bytes: 26880
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int B, R;
  cin >> B;

  vector<string> blue(B, "");
  
  for(int b = 0; b < B; b++){
    cin >> blue.at(b);
  }
  cin >> R;
  vector<string> red(R, "");
  for(int r = 0; r < R; r++){
    cin >> red.at(r);
  }
  //考えうる最低額をansに代入
  int ans = R * -1;
  
  for(int b = 0; b < B; b++){
    int new_ans = 0;
    //BLUEの中に同じ単語があったら+1
    for(int bl = 0; bl < B; bl++){
      if(blue.at(b) == blue.at(bl)){
        new_ans++;
      }
    }
    //REDの中に同じ単語があったら-1
    for(int r = 0; r < red.size(); r++){
      if(blue.at(b) == red.at(r)){
      	new_ans--;
      }
    }
    //獲得額を更新
    if(new_ans > ans){
      ans = new_ans;
    }
  }
  if(ans < 0){
    cout << "0" << endl;
  }
  else{
    cout << ans << endl; 
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
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; }
using P=pair<long long,long long>;
#define rep(i,n) for(long long i=0; i<(long long)n; i++)
#define FOR(i,a,b) for(long long i=a; i<b; i++)
#define ll long long
#define all(x) (x).begin(), (x).end()
#define SZ(x) ((long long)(x).size())
#define COUT(x) cout << x << endl;
#define PB(x) push_back(x)
#define MP make_pair
#define vint vector<int>
#define vvint vector<vector<int>>
#define vstr vector<string>
long long gcd(long long a,long long b){return b?gcd(b,a%b):a;}
const long long dx[4]={1,0,-1,0};
const long long dy[4]={0,1,0,-1};
const long long INF = 1e9;
const long long MOD = 1e9+7;

int n,m;
vvint g;
vint dist;
vint ans;
void dfs(int s=0){
    queue<int> que;
    dist[s]=0;
    que.push(s);
    while(!que.empty()){
        int v=que.front();
        que.pop();
        for(int nv:g[v]){
            if(dist[nv]!=-1) continue;
            
            dist[nv]=dist[v]+1;
            ans[nv]=v;
            que.push(nv);
        }
    }
}
signed main(){
    cin >> n >> m;
    g.resize(n);
    dist.resize(n);
    ans.resize(n);
    rep(i,n) dist[i]=-1;

    rep(i,m){
        int a,b; cin >> a>>b; a--; b--;
        g[a].PB(b);
        g[b].PB(a);
    }
    dfs();
    cout<<"Yes"<<endl;
    FOR(i,1,n) cout<<ans[i]+1<<endl;
    

}

Measured memory_bytes: 13636
// C++ program to count the Minimum number of 
// increasing subsequences 
#include <bits/stdc++.h> 
using namespace std; 

int ans(int arr[], int n) 
{ 
	multiset<int> last; 

	// last element in each increasing subsequence 
	// found so far 
	for (int i = 0; i < n; i++) { 

		// here our current element is arr[i] 
		multiset<int>::iterator it = last.lower_bound(arr[i]); 

		// iterator to the first element larger 
		// than or equal to arr[i] 
		if (it == last.begin()) 

			// if all the elements in last larger 
			// than or to arr[i] then insert it into last 
			last.insert(arr[i]); 

		else { 
			it--; 

			// the largest element smaller than arr[i] is the number 
			// before *it which is it-- 
			last.erase(it); // erase the largest element smaller than arr[i] 
			last.insert(arr[i]); // and replace it with arr[i] 
		} 
	} 
	return last.size(); // our answer is the size of last 
} 

// Driver program 
int main() 
{ 
	int n;
  cin>>n;
  int arr[n];
  for(int i=0;i<n;i++) cin>>arr[i];
  cout<<ans(arr,n);
} 


Measured memory_bytes: 5376
s = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

b = int(input())
print(s[b-1])

Measured memory_bytes: 3060
require 'pp'
$DEBUG ? define_method(:dpp){|e|pp e} : define_method(:dpp){|e|}

# Nと空白区切の入力値を数値の配列で返却する
def gets_n_and_i_list()
  return gets.chomp.to_i, gets.chomp.split(" ").map(&:to_i)
end
N, a_list = gets_n_and_i_list

total = 0
loop do
  0.upto(N-1) do |i|
    if a_list[i].odd?
      puts total
      exit
    end
    a_list[i] = a_list[i] / 2
  end
  total += 1
end
puts total

Measured memory_bytes: 2044
/*
    Life Before Death, Strength Before Weakness, Journey Before Destination
    ------------------------------------------------------------------------
    You don't become great by trying to be great.
    You become great by wanting to do something,
    and then doing it so hard that you become great in the process.
    */
 
    //#pragma comment(linker, ack:200000000")
    #pragma GCC optimize ("Ofast")
    #pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
    #include <bits/stdc++.h>
    using namespace std;
    
    #define TRACE
    
    #ifdef TRACE
    #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>
    void __f(const char* name, Arg1&& arg1){
      cerr << name << " : " << arg1 << std::endl;
    }
    template <typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
      const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
    }
    #else
    #define trace(...)
    #endif
    
    #define rep(i, n)    for(ll i = 0; i < (n); ++i)
    #define repA(i, a, n)  for(ll i = a; i <= (n); ++i)
    #define repD(i, a, n)  for(ll i = a; i >= (n); --i)
    #define trav(a, x) for(auto& a : x)
    #define all(x) x.begin(), x.end()
    #define sz(x) (int)(x).size()
    #define fill(a)  memset(a, 0, sizeof (a))
    #define fst first
    #define snd second
    //#define mp make_pair
    #define pb push_back
    #define PI           3.141592653589793238462643383279502884197169399  /* pi */
    #define te  ll ti;   cin >> ti;  while(ti--) solve();  
    typedef long double ld;
    typedef long long ll;
    typedef pair<ll, ll> pii;
    typedef vector<ll> vi;
    const int maxN = 100100;

    vi v;

    void solve(){
        ll a[3];
        rep(i, 3) cin >> a[i];
        sort(a, a+3);
        rep(i, 3) if(a[i]%2 == 0){
            cout << 0 << endl;
            return;
        }
        cout << a[0]*a[1] << endl;
    }
 
    int main() {
      cin.sync_with_stdio(0); cin.tie(0);
      cin.exceptions(cin.failbit);
     /*
      #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
      #endif
     */
      //te
      solve();
      return 0;
    } 

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

#include <math.h>
#include <stdlib.h>


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

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


int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    
    ll a ,b ,k;
    cin >> a >> b >> k;

    if(a>=k) cout << a-k << " " << b;
    else if(a+b>=k) cout << 0 << " " << b+a-k << endl;
    else cout << "0 0" << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define F first
#define S second
#define pb push_back
int A[1000000];
int B[1000000];
using namespace std;
int main(){
    int n,m;
  cin>>n>>m;
  int counter=0,counter2=0;
  if(m==1 || m==0)
    counter2=0;
  if(n<=1)
    counter=0;
  if(m>1)
    counter2=(m*(m-1)/2);
  if(n>=2)
    counter=(n*(n-1)/2);
  cout<<counter+counter2<<endl;
    
    
}




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

int main(void) {
    long long X;
    cin >> X;
    long long f[1100];
    for (long long i = 0; i < 1000; i++) {
        f[i] = i * i * i * i * i;
    }
    for (int i = 0; i < 1000; i++) {
        for (int j = 0; j < 1000; j++) {
            if (f[i] - f[j] == X) {
                printf("%d %d\n", i, j);
                return 0;

            } else if (f[i] == X) {
                printf("%d 0\n", i);
            } else if (f[i] + f[j] == X) {
                printf("%d -%d\n", i, j);
                return 0;
            }
        }
    }

    return 0;
}


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

using namespace std;

#define loop(i, n) for(int i = 0;i < int(n);i++)
#define rloop(i, n) for(int i = int(n);i >= 0;i--)
#define range(i, a, b) for(int i = int(a);i <= int(b);i++)
#define SZ(c) int(c.size())
#define ALL(c) c.begin(), c.end()
#define RALL(c) c.rbegin(), c.rend()
#define PI acos(-1)
#define pb push_back
#define mp make_pair
#define fr first
#define sc second
#define sfi1(v) scanf("%d",&v)
#define sfi2(v1, v2) scanf("%d %d",&v1,&v2)
#define sfi3(v1, v2, v3) scanf("%d %d %d",&v1,&v2,&v3)
#define sfll1(v) scanf("%I64d",&v);
#define sfll2(v1, v2) scanf("%I64d %I64d",&v1,&v2)
#define sfll3(v1, v2, v3) scanf("%I64d %I64d %I64d",&v1,&v2,&v3)
#define endl '\n'

typedef vector<int> vi;
typedef vector<pair<int, int> > vii;
typedef long long ll;
typedef pair<int, int> pii;

const int N = 1e5 + 5;
int a[N][3];
set<pii> s[3][3];
int n[3];
ll ans = 0;

void insert(int idx, int cur) {
    ans += a[idx][cur];
    loop(other, 3) {
        if (other == cur)continue;
        s[cur][other].insert({-a[idx][cur] + a[idx][other], idx});
    }
}

void erase(int idx, int cur) {
    ans -= a[idx][cur];
    loop(other, 3) {
        if (other == cur)continue;
        s[cur][other].erase({-a[idx][cur] + a[idx][other], idx});
    }
}

int main() {

#ifndef ONLINE_JUDGE
//    freopen("in.in", "r", stdin);
    //freopen("out.in", "w", stdout);
#endif
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    loop(i, 3)cin >> n[i];
    loop(i, n[0] + n[1] + n[2]) {
        loop(j, 3)cin >> a[i][j];
        if (i < n[0])insert(i, 0);
        else if (i < n[0] + n[1])insert(i, 1);
        else insert(i, 2);
    }

    bool done = true;
    while (done) {
        done = false;
        loop(i, 3) {
            loop(j, 3) {
                if (i == j)continue;
                if (prev(end(s[i][j]))->first + prev(end(s[j][i]))->first > 0) {
                    done = true;
                    int ai = prev(end(s[i][j]))->second;
                    int aj = prev(end(s[j][i]))->second;
                    erase(ai, i);
                    erase(aj, j);
                    insert(ai, j);
                    insert(aj, i);
                }
            }
        }


        loop(i, 3) {
            loop(j, 3) {
                if (i == j)continue;
                loop(k, 3) {
                    if (k == i || k == j)continue;
                    if (prev(end(s[i][j]))->first + prev(end(s[j][k]))->first + prev(end(s[k][i]))->first > 0) {
                        done = true;
                        int ai = prev(end(s[i][j]))->second;
                        int aj = prev(end(s[j][k]))->second;
                        int ak = prev(end(s[k][i]))->second;
                        erase(ai, i);
                        erase(aj, j);
                        erase(ak, k);
                        insert(ai, j);
                        insert(aj, k);
                        insert(ak, i);
                    }
                }
            }
        }
    }

    cout << ans << endl;


    return 0;
}


Measured memory_bytes: 14216
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<array>
#include<map>
#include<iomanip>
#include<assert.h>
#include<bitset>
#include<stack>
#include<memory>
using namespace std;
typedef long long int llint;
typedef long double lldo;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
/*
cout<<setprecision(20);
cin.tie(0);
ios::sync_with_stdio(false);
*/
const llint mod=1000000007;
const llint big=2.19e15+1;
const long double pai=3.141592653589793238462643383279502884197;
const long double eps=1e-15;
template <class T,class U>bool mineq(T& a,U b){if(a>b){a=b;return true;}return false;}
template <class T,class U>bool maxeq(T& a,U b){if(a<b){a=b;return true;}return false;}
llint gcd(llint a,llint b){if(a%b==0){return b;}else return gcd(b,a%b);}
llint lcm(llint a,llint b){if(a==0){return b;}return a/gcd(a,b)*b;}
template<class T> void SO(T& ve){sort(ve.begin(),ve.end());}
template<class T> void REV(T& ve){reverse(ve.begin(),ve.end());}
template<class T>llint LBI(vector<T>&ar,T in){return lower_bound(ar.begin(),ar.end(),in)-ar.begin();}
template<class T>llint UBI(vector<T>&ar,T in){return upper_bound(ar.begin(),ar.end(),in)-ar.begin();}
int main(void){int a;cin>>a;cout<<a-a%500<<endl;return 0;}


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

int main(){
	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;
}

// cout << fixed << setprecision(15) <<  << endl;

Measured memory_bytes: 3600
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
using namespace std;

#define rep(i,x) for(ll i=0;i<x;i++)
#define repn(i,x) for(ll i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 1000000007;
const ll MAX = 1000001;

ll max(ll a, ll b) {
	if (a > b) { return a; }
	return b;
}

ll min(ll a, ll b) {
	if (a > b) { return b; }
	return a;
}

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

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

struct edge {
	ll ind;
	ll fr;
	ll to;
	ll d;
};


///////////////////////////


void Warshall_Floyd(ll N, vector<vector<ll>> &g) {
	repn(k, N) {
		repn(i, N) {
			repn(j, N) {
				g[i][j] = min(g[i][j], g[i][k] + g[k][j]);
			}
		}
	}
}


int main() {

	ll N, M;
	cin >> N >> M;

	cout << N * (N - 1) / 2 + M * (M - 1) / 2;

	system("PAUSE");

}


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

int main(){
    int H, W;
    cin >> H >> W;

    vector<string> s(H);
    for(int i = 0; i < H; i++){
        cin >> s.at(i);
    }
    
    bool can2 = true;
    for(int i = 0; i < H; i++){
        for(int j = 0; j < W; j++){
            if(s.at(i).at(j) == '#'){
                bool can = false;
                if(i - 1 >= 0){
                    if(s.at(i - 1).at(j) == '#'){
                        can = true;
                    }
                }
                if(i + 1 <= H - 1){
                    if(s.at(i + 1).at(j) == '#'){
                        can = true;
                    }
                }
                if(j - 1 >= 0){
                    if(s.at(i).at(j - 1) == '#'){
                        can = true;
                    }
                }
                if(j + 1 <= W - 1){
                    if(s.at(i).at(j + 1) == '#'){
                        can = true;
                    }
                }
                if(can == false){
                    can2 = false;
                    break;
                }
            }
        }
    }
    
    if(can2){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    
    


}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    int Ta = a/d, Ao = c/b;
    if(a%d>0) Ta++;
    if(c%b>0) Ao++;
    if(Ta >= Ao)
        cout << "Yes";
    else
        cout <<"No";
    return 0;
}


Measured memory_bytes: 3636
import java.util.Scanner

object Main extends App {

  val sc = new Scanner(Console.in)

  def nextInt() = sc.next.toInt

  val n = nextInt
  val s = Array.fill(n)(nextInt)

  val q = nextInt
  val t = Seq.fill(q)(nextInt)

  val c = (0 /: t) { (c, e) =>

    def find(xs: Array[Int]): Boolean = {
      def binarySearch(start: Int, end: Int): Boolean = {
        if (start == end)
          e == xs(start)
        else {
          val mid = start + (end - start + 1) / 2
          if (e < xs(mid))
            binarySearch(start, mid - 1)
          else
            binarySearch(mid, end)
        }
      }
      if (xs.length == 0) false
      else binarySearch(0, xs.length - 1)
    }

    if (find(s)) c + 1
    else c
  }
  println(c)
}



Measured memory_bytes: 108652
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cassert>
typedef long long lint;

namespace utils{
	template <class T> inline void apn(T &x,const T y){x=x<y?x:y;}
	template <class T> inline void apx(T &x,const T y){x=x>y?x:y;}
	inline lint nxi(){
		lint x=0;
		char c;
		while(((c=getchar())>'9'||c<'0')&&c!='-');
		const bool f=c=='-'&&(c=getchar());
		while(x=x*10-48+c,(c=getchar())>='0'&&c<='9');
		return f?-x:x;
	}
}
using namespace utils;

int main(){
	lint x=nxi(),y=nxi();
	int ans=1;
	for(; x*2<=y; x<<=1,++ans);
	printf("%d\n",ans);
}


Measured memory_bytes: 256
# 入力文字を取得
input = gets

# Nを取得
N = input.to_i

# 計算用変数
count = 0
candidate = [1,2,3,4,5,6,7,8,9]

# Nを九九に含まれるか判定
candidate.each{|a|
    candidate.each{|b|
        c = a * b
        break if c == N
        count = count + 1
    }
}

# 結果を出力
if count == 81
    print 'No'
else 
    print 'Yes'
end

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

using namespace std;
mt19937_64 rng(58);

bool can(vector<long long> &logs, long long k, long long L) {
    long long t = 0;
    for (auto l : logs) {
        if (l >= L) {
            t += (l / L) - (l % L == 0 ? 1 : 0);
        }
    }
    return t <= k;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    int n;
    long long k;
    cin >> n >> k;
    vector<long long> logs(n);
    long long sum = 0;
    long long max_l = 0;
    for (int i=0; i<n; i++) {
        cin >> logs[i];
        sum += logs[i];
        max_l = max(max_l, logs[i]);
    }
    if (k == 0) {
        cout << max_l << endl;
        return 0;
    }
    long long lb = 0;
    long long ub = max_l;
    while (ub - lb > 1) {
        long long mid = lb + (ub - lb) / 2;
        if (can(logs, k, mid)) {
            ub = mid;
        } else {
            lb = mid;
        }
    }
    cout << ub << endl;
}

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

int main() {
  LL n; cin >> n;
  set<LL> st;
  for (int i = 0; i < n; i ++) {
    LL t; cin >> t;
    st.insert(t);
  }

  if (st.size() % 2 == 1) {
    cout << st.size() << endl;
  } else {
    cout << st.size() - 1 << endl;
  }
}

Measured memory_bytes: 4992
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
using namespace std;

const int N=1e5+10;

int a[N];
int n;
char ch[N];
int b[N];

int check()
{
	for(int i=2;i<n;i++)
	{
		if(b[i])
		{
			if(a[i]) b[i+1]=b[i-1];
			else b[i+1]=1^b[i-1];
		}
		else
		{
			if(a[i]) b[i+1]=1^b[i-1];
			else b[i+1]=b[i-1];
		}
	}
	if(b[1])
	{
		if(a[1]&&b[2]!=b[n]) return 0;
		if(!a[1]&&b[2]==b[n]) return 0;
	}
	else
	{
		if(a[1]&&b[2]==b[n]) return 0;
		if(!a[1]&&b[2]!=b[n]) return 0;
	}
	if(b[n])
	{
		if(a[n]&&b[n-1]!=b[1]) return 0;
		if(!a[n]&&b[n-1]==b[1]) return 0;
	}
	else
	{
		if(a[n]&&b[n-1]==b[1]) return 0;
		if(!a[n]&&b[n-1]!=b[1]) return 0;
	}
	return 1;
}

void P()
{
	for(int i=1;i<=n;i++)
		if(b[i]) putchar('S');
		else putchar('W');
}
	

int main()
{
	scanf("%d",&n);
	scanf("%s",ch+1);
	for(int i=1;i<=n;i++) a[i]=(ch[i]=='o'?1:0);
	b[1]=1;
	b[2]=0;
	if(check())
	{
		P();
		return 0;
	}
	b[2]=1;
	if(check())
	{
		P();
		return 0;
	}
	b[1]=0;
	if(check())
	{
		P();
		return 0;
	}
	b[2]=0;
	if(check())
	{
		P();
		return 0;
	}
	puts("-1");
	return 0;
}
	

Measured memory_bytes: 1280
#include <bits/stdc++.h>
#define HAIRETU(N,A) for(int i=0;i<N;i++) cin >>A[i]
using namespace std;

int main(){
    int N, A[110];
    cin >> N ;
    HAIRETU(N, A);
    sort(A, A+N);
    
    int cnt=1;
    for (int i = 1; i < N; i++) {
        if (A[i]!=A[i-1]) {
            cnt++;
        }
    }
    
    cout << cnt << endl;
    return 0;
}



Measured memory_bytes: 256
N = int(input())
farr = []
parr = []
for i in range(N):
    farr.append(list(map(int,input().split())))
for i in range(N):
    parr.append(list(map(int,input().split())))
paym = -10**10
count = 0
for i in range(1,1<<10):
    pay = 0
    for j in range(N):
        tmp = i
        for k in range(10):
            if farr[j][k] == 1 and (tmp//2**k)%2 == 1:
                count += 1
            if tmp == 0:
                break
        pay += parr[j][count]
        count = 0
        
    if pay > paym:
        paym = pay

print(paym)
            

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int a,b,c;
int main()
{
	//freopen("H:\\c++1\\in.txt","r",stdin);
	//freopen("H:\\c++1\\out.txt","w",stdout);
	cin>>a>>b>>c;
	if(a+b+c>=22)puts("bust");
	else puts("win");
	return 0;
}

Measured memory_bytes: 256