akhauriyash/Code-Regression huggingface dataset:
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.NoSuchElementException;

import java.util.*;

public class Main{
  static int n;
  static int[] a;

  public static void main(String[] args){
    FastScanner sc = new FastScanner();
    n = sc.nextInt();
    a = new int[n];
    for(int i = 0; i < n; i++){
      a[i] = sc.nextInt();
    }

    Map< Integer, Integer > count =
      new HashMap< >();
    for(int i = 0; i < n; i++){
      if(count.containsKey(a[i])){
        count.put(a[i], count.get(a[i]) + 1);
      }
      else{
        count.put(a[i], 1);
      }
    }

    int sum = 0;
    for(Map.Entry< Integer, Integer > me: count.entrySet()){
      int k = me.getKey(), v = me.getValue();
      if(k < v){
        sum += v - k;
      }
      else if(k > v){
        sum += v;
      }
    }

    System.out.println(sum);
  }
}

class FastScanner {
  private static final InputStream in = System.in;
  private static final PrintWriter out = new PrintWriter(System.out);
  private final byte[] buffer = new byte[2048];
  private int p = 0;
  private int buflen = 0;

  public FastScanner(){
  }

  private boolean hasNextByte() {
    if(p < buflen){
      return true;
    }
    p = 0;
    try{
      buflen = in.read(buffer);
    }catch (IOException e) {
      e.printStackTrace();
    }
    if(buflen <= 0){
      return false;
    }
    return true;
  }

  public boolean hasNext() {
    while(hasNextByte() && !isPrint(buffer[p])){
      p++;
    }
    return hasNextByte();
  }

  private boolean isPrint(int ch) {
    if(ch >= '!' && ch <= '~'){
      return true;
    }
    return false;
  }

  private int nextByte() {
    if(!hasNextByte()){
      return -1;
    }
    return buffer[p++];
  }

  public String next() {
    if(!hasNext()){
      throw new NoSuchElementException();
    }
    StringBuilder sb = new StringBuilder();
    int b = -1;
    while(isPrint((b = nextByte()))){
      sb.appendCodePoint(b);
    }
    return sb.toString();
  }

  public int nextInt() {
    return Integer.parseInt(next());
  }

  public long nextLong() {
    return Long.parseLong(next());
  }

  public double nextDouble() {
    return Double.parseDouble(next());
  }
}


Measured memory_bytes: 41656
// {{{ by unolight
#include <bits/stdc++.h>
#include <unistd.h>
#pragma GCC diagnostic ignored "-Wunused-result"
#pragma GCC diagnostic ignored "-Wunused-function"
#define SZ(x) ((int)(x).size())
#define ALL(x) begin(x),end(x)
#define RALL(x) rbegin(x),rend(x)
#define REP(i,n) for ( int i=0; i<int(n); i++ )
#define REP1(i,a,b) for ( int i=(a); i<=int(b); i++ )
#define MP make_pair
#define PB push_back
using namespace std;
typedef int64_t LL;
typedef pair<int,int> PII;
typedef vector<int> VI;

namespace { namespace unolight {
// Read Input
template<class T> void _R( T &x ) { cin>>x; }
void _R( int &x ) { scanf("%d",&x); }
void _R( int64_t &x ) { scanf("%" PRId64,&x); }
void _R( double &x ) { scanf("%lf",&x); }
void _R( char &x ) { scanf(" %c",&x); }
void _R( char *x ) { scanf("%s",x); }
void R() {}
template<class T, class... U> void R( T& head, U&... tail ) { _R(head); R(tail...); }
// Write Output
template<class T> void _W( const T &x ) { cout<<x; }
void _W( const int &x ) { printf("%d",x); }
void _W( const int64_t &x ) { printf("%" PRId64,x); }
void _W( const double &x ) { printf("%.16f\n",x); }
void _W( const char &x ) { putchar(x); }
void _W( const char *x ) { printf("%s",x); }
template<class T> void _W( const vector<T> &x ) { for (auto i = x.begin(); i != x.end(); _W(*i++)) if (i != x.cbegin()) putchar(' '); }
void W() {}
template<class T, class... U> void W( const T& head, const U&... tail ) { _W(head); putchar(sizeof...(tail)?' ':'\n'); W(tail...); }

#ifdef UNOLIGHT
#include "dump.hpp"
#else
#define dump(...)
#endif

template<class T> inline bool chmax( T &a, const T &b ) { return b>a ? a=b,true : false; }
template<class T> inline bool chmin( T &a, const T &b ) { return b<a ? a=b,true : false; }
template<class T> using MaxHeap = priority_queue<T>;
template<class T> using MinHeap = priority_queue<T, vector<T>, greater<T>>;
template<class T, class F=less<T>> void sort_uniq( vector<T> &v, F f=F() ) {
    sort(begin(v),end(v),f);
    v.resize(unique(begin(v),end(v))-begin(v));
}
// }}}


void main() {
    int a,b;
    R(a,b);
    if ( a+b==15 ) W("+");
    else if ( a*b==15 ) W("*");
    else W("x");   
}

}} // {{{ main
int main() { unolight::main(); return 0; }
// }}}

Measured memory_bytes: 3744
#include <iostream>
#include <iomanip>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <queue>
#include <numeric>
#include <random>
#include <algorithm>
#include <functional>
#include <cassert>

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

const int INF = (1 << 30) - 1;
const ll INFLL= (1LL << 61) - 1;
const int MOD = 1000000007;
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)

int main(){
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int N,M;
  cin>>N>>M;
  vector<int> wa(N),ac(N);
  int ans=0;
  REP(i,M){
    int p;
    string s;
    cin>>p>>s;
    p--;
    if(s=="AC"){
      ac[p]++;
    }else{
      if(ac[p]==0){
        wa[p]++;
      }
    }
  }

  int accnt=0,wacnt=0;
  REP(i,N){
    if(ac[i]==0)continue;
    accnt++;
    wacnt+=wa[i];
  }

  cout<<accnt<<' '<<wacnt<<endl;
}


Measured memory_bytes: 1024
N = int(input())
A = [[int(x) for x in input().split()] for _ in range(N)]
A = sorted(A,key= lambda x: x[1])
#A =  sorted(A,key= lambda x: x[0])
#print(A)
ans = 0
for i in range(N):
  ans += A[i][0]
  if ans>A[i][1]:
    print("No")
    exit()
print("Yes")

Measured memory_bytes: 89688
#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() {
    string s;
    cin >> s;
    map<char, int> mp;
    mp['a']; mp['b']; mp['c'];
    rep(i,s.size()) {
        mp[s[i]]++;
    }
    bool ok = true;
    int min_cnt = 1001001001;
    int max_cnt = -1;
    for(auto itr = mp.begin(); itr != mp.end(); itr++) {
        min_cnt = min(itr->second, min_cnt);
        max_cnt = max(itr->second, max_cnt);
    }
    if (max_cnt - min_cnt >= 2) ok = false;
    string ans = "NO";
    if (ok) ans = "YES";
    cout << ans << endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
 
int N,M;
int dp[1<<8][10];
int edge[20][20];
 
int main(){
 
cin>>N>>M;
 
for(int i=0; i<M; i++){
    int a,b; scanf("%d %d",&a,&b); a--; b--;
    edge[a][b]++; edge[b][a]++;
}
 
dp[0][0]=1;
 
for(int i=0; i<(1<<N); i++){
    for(int v=0; v<N; v++){
        if(i>>v&1) continue;
        for(int u=0; u<N; u++){
      
                if(edge[u][v]) dp[i|(1<<v)][v]+=dp[i][u];
    
        }
    }
}
 
 int ans=0;
for(int i=0; i<N; i++) ans+=dp[(1<<N)-2][i];

cout<<ans<<endl;
 
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 100000 + 10;
const int M = 1000000007;
const double PI = atan(1) * 4;
const int oo = 1000000000;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> ii;
#define pb push_back 
#define all(c) (c).begin(),(c).end()
int v[5010],n,k;
ll dp[5010];
bool is(int t){
	for(int i=0; i<=k; ++i)
		dp[i]=0;
	dp[0]=1;
	for(int i=0; i<n; ++i){
		if(i==t)continue;
		for(int j=k-v[i]; j>=0; --j)
			dp[j+v[i]]+=dp[j];
	}
	bool f=v[t]>=k;
	for(int i=max(k-v[t],0); !f&&i<k; ++i)
		f|=dp[i]!=0;
	return !f;
}
int main(){
	cin>>n>>k;
	for(int i=0; i<n; ++i)
		cin>>v[i];
	sort(v,v+n);
	int ans=0,mn=-1,lo=0,hi=n-1,md;
	while(lo<=hi){
		md=(lo+hi)/2;
		if(is(md)){
			mn=max(mn,md);
			lo=md+1;
		}else
			hi=md-1;
	}
	cout<<mn+1<<endl;
}




Measured memory_bytes: 256
#include <iostream>
#include <bits/stdc++.h>
#define US unsigned short
#define UI unsigned int
using namespace std;

#include <cstdlib>
int main(int argc, char const *argv[])
{
    US N;
    UI out = 0;
    cin >> N;
    short L[N];
    for (size_t i = 0; i < N; i++)
        cin >> L[i];

    sort(L, L + N);
    for (size_t i = 0; i < N; i++)
        for (size_t j = i + 1; j < N; j++)
        {
            short ind = lower_bound(L + j + 1, L + N, L[i] + L[j]) - L;
            out += max(short(ind - j - 1), short(0));
        }

    cout << out << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 2e5 + 5;
string s;
int main() {
    ios::sync_with_stdio(false); cin.tie(0);
    cin >> s;
    int n = s.length();
    string t = "";
    for(int i = 0; i < n; i++) {
        if(i & 1) t += "0";
        else t += "1";
    }
    int ans = n + 1;
    int cur = 0;
    for(int i = 0; i < n; i++) {
        if(s[i] != t[i]) ++cur;
    }
    ans = cur;
    cur = 0;
    t = "";
    for(int i = 0; i < n; i++) {
        if(i & 1) t += "1";
        else t += "0";
    }
    for(int i = 0; i < n; i++) {
        if(s[i] != t[i]) ++cur;
    }
    ans = min(ans, cur);
    cout << ans;
    return 0;
}


Measured memory_bytes: 592
#include<iostream>
#include<string>
using namespace std;
 
int main()
{
	string r,g,b;
	string combine;
	int n;
 
	cin >> r >> g >> b;
	combine = r + g+b;
	n = atoi(combine.c_str());
 
	if (n % 4 == 0)
	{
		cout << "YES" << endl;
	}
	else
	{
		cout << "NO" << endl;
	}
	
	system("pause");
	return 0;
}

Measured memory_bytes: 504
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cmath>
#include <algorithm>
#include <climits>
#include <iomanip>
#define endl "\n"
#define debug(x) cout << #x << " : " << x << endl;
#define FASTIO ios_base::sync_with_stdio(false),cin.tie(0);
typedef long long ll;
using namespace std;

bool valid[1000010];
int main()
{
	#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	#endif

	FASTIO

	ll n;
	cin >> n;

	vector <ll> v(n);
	unordered_map <ll, ll> cnt;
	for(ll i = 0; i < n; i ++)
	{
		cin >> v[i];
		cnt[v[i]] ++;
	}	

	sort(v.begin(), v.end());
	ll count = 0;
	for(ll i = 0; i < n; i ++)
	{
		if(valid[v[i]] == false)
		{
			count ++;
			for(ll j = 2; v[i] * j <= 1000010; j ++)
			{
				valid[v[i] * j] = true;
			}
			if(cnt[v[i]] > 1)
			{
				valid[v[i]] = true;
				count --;
			}
		}
	}

	cout << count << endl;
}

Measured memory_bytes: 13980
# coding: utf-8
# Your code here!
import sys

sys.setrecursionlimit(10**6)

def killme(num,lis):
    visited[num]=1
    if num==N-1:
        lis.append(num)
        for index,item in enumerate(lis):
            highway[item]=index
    else:
        for next_n in way[num]:
            if visited[next_n]==0:
                lis.append(num)
                killme(next_n,lis)
                lis.pop(-1)
    return 

def dfs(num,root):
    visited[num]=1
    cluster[root].append(num)
    for next_n in way[num]:
        if visited[next_n]==0 and highway[next_n]==-1:
            #print(next_n,root)
            dfs(next_n,root)
    return 

N=int(input())

way=[[] for i in range(N)]
visited=[0]*N
highway=[-1]*N

for _ in range(N-1):
    a,b=map(int,input().split())
    way[a-1].append(b-1)
    way[b-1].append(a-1)

killme(0,[])

#print(way)
#print(visited)
#print(highway)

visited=[0]*N
cluster=[[] for i in range(highway[-1]+1)]

for index,item in enumerate(highway):
    if item!=-1:
        dfs(index,item)

F=0
S=0
for i in range(highway[-1]+1):
    if i<=highway[-1]//2:
        F+=len(cluster[i])
    else:
        S+=len(cluster[i])

if F>S:
    print("Fennec")
else:
    print("Snuke")
#print(F,S)
    



Measured memory_bytes: 149280
#include <iostream>



bool judge(int year);

int main() 
{
	int start, end;
	int number = 0;
	
	while (true) {
		int check = 0;
		
		std::cin >> start >> end;
		
		if (start == 0 && end == 0) {
			break;
		}
		
		if (number != 0) {
			std::cout << std::endl;
		}
		
		number = 1;
		
		for (int i = start; i <= end; i++) {
			if (judge(i)) {
				std::cout << i << std::endl;
				check = 1;
			}
		}
		
		if (check == 0) {
			std::cout << "NA" << std::endl;
		}
		

	}
	return 0;
}


bool judge(int year){
	if ((year % 4 == 0 && !(year % 100 == 0)) || year % 400 == 0) {
		return true;
	} else {
		return false;
	}
}

Measured memory_bytes: 1160
n = int(input())
s_l = [input() for _ in range(n)]

count = 0
xxxa = 0
bxxx = 0
bxxxa = 0
for st in s_l:
    if 'AB' in st:
        count += st.count('AB')
    if st.endswith('A'):
        if st.startswith('B'):
            bxxxa += 1
        else:
            xxxa += 1
    elif st.startswith('B'):
        bxxx += 1

if max(xxxa,bxxx) == 0:
    count += max(0, bxxxa - 1)
    print(count)
    exit()

while min(xxxa,bxxx,bxxxa) > 0:
    xxxa -= 1
    bxxx -= 1
    bxxxa -= 1
    count += 2
count += bxxxa
count += min(xxxa,bxxx)
print(count)

Measured memory_bytes: 3700
N=int(input())
a_list=list(map(int,input().split()))
K=1000//a_list[0]
L=1000-K*a_list[0]
sum=K*a_list[0]+L
for i in range(N-1):
    if   a_list[i]<a_list[i+1]:
        sum=K*a_list[i+1]+L
        #print(i,K,L,sum)
    elif a_list[i]>a_list[i+1]:
        K=sum//a_list[i+1]
        L=sum-K*a_list[i+1]
print(sum)

Measured memory_bytes: 9192
def f(i, l, r)
  return true if i == 10
  return f(i+1, $b[i], r) if l < $b[i]
  return f(i+1, l, $b[i]) if r < $b[i]
  return false
end

gets.to_i.times do
  $b = gets.split.map(&:to_i)
  puts f(0,0,0) ? "YES" : "NO"
end

Measured memory_bytes: 6100
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
template<class T> bool umin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool umax(T &a, T b) { return a < b ? (a = b, true) : false; }
#define ALL(x) (x).begin(), (x).end()
LL POW(LL a,LL p,LL M){ if(!p) return 1LL;LL T = POW(a,p/2,M);T = T*T%M; if(p&1) T=T*(a%M)%M; return T; }
LL SQRT(LL a) { LL b = (LL)sqrtl(((double)a)+0.5); while(b*b<a) ++b; while(b*b>a) --b; return (b*b==a)?b:-1; }
//endl
//<------------------------edits---------------------------------------------->
const LL MOD = 1e9+7;//998244353
// #define LOCAL LDD
// #define int LL

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.precision(10);cout << fixed;
#ifdef LOCAL
  freopen("input.txt", "rt", stdin);
#endif
  int n;cin >> n;
  vector<int> v(n);
  map<int,LL> mm;
  for(int i=0;i<n;i++){
    cin >> v[i];
    mm[v[i]]++;
  } 
  LL ans = 0;
  for(auto it:mm){
    ans += it.second*(it.second-1)/2;
  }
  for(int i=0;i<n;i++){
    LL h = ans;
    h -= mm[v[i]]-1;
    cout << h << endl;
  }
  cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s\n";
  return 0;
}

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

#define gz register 
#define ljw inline
#define tql(x,y) for(gz int x=1;x<=y;x++)

using namespace std;

ljw void read(int &x){int f=1;    x=0;    char c=getchar();    while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}    while(c>='0'&&c<='9'){x=(x<<1)+(x<<3)+(c^48);c=getchar();}    x*=f;}
ljw void read(int &x,int &y){    read(x);read(y);}
ljw void read(int &x,int &y,int &z){    read(x);read(y);read(z);}

ljw void read(long long &x){int f=1;    x=0;    char c=getchar();    while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}    while(c>='0'&&c<='9'){x=(x<<1)+(x<<3)+(c^48);c=getchar();}    x*=f;}
ljw void read(long long &x,long long &y){    read(x);read(y);}
ljw void read(long long &x,long long &y,long long &z){    read(x);read(y);read(z);}


signed main()
{
string str;
cin>>str;
bool c=0,f=0;
for(int i=0;i<str.length();i++)
{
	if(!c)
	{
		if(str[i]=='C')
		{
			c=1;
			continue;
		}
	}
	if(c&&(!f))
	{
		if(str[i]=='F')
		{
			f=1;break;
		}
	}
}
if(c&&f)cout<<"Yes";
else cout<<"No";
cout<<endl; 
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    int N, M;
    cin >> N >> M;
    int64_t n, m;
    if (N < 3) n = N % 2;
        else n = N - 2;
    if (M < 3) m = M % 2;
        else m  = M - 2;
    cout << n * m << endl;
}

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

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

  int n;
  cin>>n;
  std::vector<int> v(n), vl(n), vr(n);
  for(int i=0;i<n;i++){
    cin>>v[i];
  }
  vl[0]=v[0];
  vr[n-1]=v[n-1];
  for(int i=1;i<n;i++){
    vl[i]=__gcd(vl[i-1],v[i]);
  }
  for(int i=n-2;i>=0;i--){
    vr[i]=__gcd(vr[i+1],v[i]);
  }
  int ans=0;
  for(int i=0;i<n;i++){
    if(i==0)ans = max(ans, vr[1]);
    else if (i==n-1) ans = max(ans, vl[n-2]);
    else ans = max(ans, __gcd(vl[i-1], vr[i+1]));
  }
  cout<<ans<<endl;

  return 0;
}


Measured memory_bytes: 1408
#include <vector>
#include <list>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <functional>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
using namespace std;
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define EACH(t,i,c) for(t::iterator i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
const double EPS = 1e-10;
const double PI  = acos(-1.0);

int main(){
	int n,m,s,g1,g2;
	while(cin>>n>>m>>s>>g1>>g2,n){
		vvi cost(n,vi(n,INT_MAX/10));
		REP(i,n){
			cost[i][i]=0;
		}
		REP(i,m){
			int b1,b2,c;
			cin>>b1>>b2>>c;
			cost[b1-1][b2-1]=c;
		}
		REP(k,n)
			REP(i,n)
				REP(j,n){
					cost[i][j]=min(cost[i][j],cost[i][k]+cost[k][j]);
		}
		int best=INT_MAX;
		REP(i,n){
			best=min(best,cost[s-1][i]+cost[i][g1-1]+cost[i][g2-1]);
		}
		cout<<best<<endl;
	}
}

Measured memory_bytes: 944
#ifndef HOME
#pragma GCC optimize "-O3"
#endif

#include <bits/stdc++.h>

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

const int MX = 200 * 1000 + 7;

bool win[MX];
vector<int> g[MX];

pair<int, int> f(int v, int p) {
    pair<int, int> ans(1, v);
    for (int to : g[v]) {
        if (to != p) {
            auto g = f(to, v);
            g.first++;
            ans = max(ans, g);
        }
    }
    return ans;
}

int main() {
    ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
    win[0] = false;
    win[1] = true;
    win[2] = false;

    for (int i = 3; i < MX; i++) {
        if (!win[i - 1] || !win[i - 2]) {
            win[i] = true;
        }
    }

    int n;
    cin >> n;
    for (int i = 1; i < n; i++) {
        int u, v;
        cin >> u >> v;
        g[u].push_back(v);
        g[v].push_back(u);
    }

    auto f1 = f(1, -1);
    auto f2 = f(f1.second, -1);
    if (win[f2.first]) {
        cout << "First\n";
    } else {
        cout << "Second\n";
    }
    return 0;
}



Measured memory_bytes: 20480
H,W = map(int,input().split())
s = []
for i in range(H):
    s.append(list(input()))
for i in range(H):
    for j in range(W):
        if s[i][j] == "#":
            if i == 0:
                if j == 0:
                    if s[i][j+1] == "." and s[i+1][j] == ".":
                        print("No")
                        exit()
                elif j == W-1:
                    if s[i][j-1] == "." and s[i+1][j] == ".":
                        print("No")
                        exit()
                else:
                    if s[i][j+1] == "." and s[i][j-1] == "." and s[i+1][j] == ".":
                        print("No")
                        exit()
            elif i==H-1:
                if j==0:
                    if s[i][j+1] == "." and s[i-1][j] == ".":
                        print("No")
                        exit()
                elif j == W-1:
                    if s[i][j-1] == "." and s[i-1][j] == ".":
                        print("No")
                        exit()
                else:
                    if s[i][j+1] == "." and s[i][j-1] == "." and s[i-1][j] == ".":
                        print("No")
                        exit()
            elif j == 0:
                    if s[i][j+1] == "." and s[i-1][j] == "." and s[i+1][j] == ".":
                        print("No")
            elif j == W-1:
                    if s[i][j-1] == "." and s[i-1][j] == "." and s[i+1][j] == ".":
                        print("No")
            else:
                if s[i][j+1] == "." and s[i][j-1] == "." and s[i-1][j] == "." and s[i+1][j] == ".":
                    print("No")
                    exit()
print("Yes")


Measured memory_bytes: 3188
<?php
$k = trim(fgets(STDIN));
[$a, $b] = explode(' ', trim(fgets(STDIN)));

for ($i = $a; $i <= $b; $i++) {
    if ($i % $k == 0) {
        echo 'OK';
        $flg = 1;
        break;
    } else {
        $flg = 0;
        continue;
    }
}

if ($flg == 0) {
    echo 'NG';    
}

Measured memory_bytes: 16244
#include<bits/stdc++.h>
using namespace std;
template<typename T>
inline void read(T &x){
	char ch=0; x=0;
	bool sign=false;
	while(ch<'0'||'9'<ch) sign|=ch=='-',ch=getchar();
	while('0'<=ch&&ch<='9') x=(x<<3)+(x<<1)+(ch^48),ch=getchar();
	x=sign?-x:x;
}
int e[4],n;
double dp[305][305][305];
inline void dfs(int a,int b,int c){
	if(dp[a][b][c]!=-1) return;
	double v[4]={0,0,0,0};
	if(a) dfs(a-1,b,c),v[0]=dp[a-1][b][c];
	if(b) dfs(a+1,b-1,c),v[1]=dp[a+1][b-1][c];
	if(c) dfs(a,b+1,c-1),v[2]=dp[a][b+1][c-1];
	dp[a][b][c]=(v[0]*a/n+v[1]*b/n+v[2]*c/n+1.0)/((a+b+c)*1.0/n);
}
int main(){
	read(n);
	for(int i=0;i<305;++i)
	for(int j=0;j<305;++j)
	for(int k=0;k<305;++k)
		dp[i][j][k]=-1;
	dp[0][0][0]=0;
	for(int i=0,j;i<n;++i){
		read(j),++e[j];
	}
	dfs(e[1],e[2],e[3]);
	cout<<fixed<<setprecision(11)<<dp[e[1]][e[2]][e[3]]<<endl;
	return 0;
}


Measured memory_bytes: 221952
#C
N = int(input())
ans = []

now = 1
while N != 0:
    if N%(abs(now)*2) == 0:
        ans.append("0")
    else:
        ans.append("1")
        N-=now
    
    now*=(-2)
    
if ans == []:
    print(0)
else:
    out = ""
    ans = ans[::-1]
    
    for a in ans:
        out+=a
        
    print(out)
    

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

using ll = long long;
using ull = unsigned long long;
using namespace std;
constexpr int inf = 1<<30;
constexpr int mo = 1e9+7;
constexpr ll infl = 1ll<<60;


int main(){
    cin.tie(nullptr);
    std::ios::sync_with_stdio(false);
    
    int t1,t2;
    cin>>t1>>t2;
    ll a1,a2,b1,b2;
    cin>>a1>>a2>>b1>>b2;
    ll diff1 = (a1 - b1)*t1;
    ll diff2 = (a2 - b2)*t2;
    ll diff = diff1 + diff2;
    if(diff == 0){
        cout << "infinity" << endl;
    }else if((diff1 < 0 and diff < 0) or (diff1 > 0 and diff > 0)){
        cout << 0 << endl;
    }else {
        diff1 = abs(diff1);
        diff = abs(diff);
        if(diff1%diff == 0){
            cout << diff1/diff*2 << endl;
        }else {
            cout << 1 + diff1/diff*2 << endl;
        }
    }
    return 0;
    
}

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

const long long INF = 1e18;

int n, a, b;
int f[5001];
long long dp[5001][5001];

long long solve(int i, int prv) {
	if (i == n) return 0;
	if (dp[i][prv] != -1) return dp[i][prv];

	long long ans = INF;
	if (f[i] < prv) {
		ans = min(ans, solve(i+1, prv) + b);
	} else {
		ans = min(ans, solve(i+1, f[i]));
		ans = min(ans, solve(i+1, prv) + a);
	}
	return dp[i][prv] = ans;
}

signed main() {
	ios::sync_with_stdio(0); cin.tie(0);
	
	cin >> n >> a >> b;
	for (int i = 0; i < n; i++) {
		cin >> f[i];
	}
	memset(dp, -1, sizeof(dp));
	cout << solve(0, 0) << '\n';
 
	return 0;
}

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

using namespace std;

using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;

long long P = 1000000007;

class C {
public:
  int n;
  vector<long long> fac, inv, facInv;

  long long power(long long e, long long x) {
    if (x == 0)
      return 1;
    if (x == 1)
      return e;
    if (x % 2 == 0)
      return power((e * e) % P, x / 2);
    return (e * power(e, x - 1)) % P;
  }

  C(int n_) {
    n = n_;
    fac.resize(n + 1);
    inv.resize(n + 1);
    facInv.resize(n + 1);
    fac[0] = fac[1] = 1;
    for (int i = 2; i <= n; i++)
      fac[i] = (i * fac[i - 1]) % P;
    inv[0] = inv[1] = 1;
    for (int i = 2; i <= n; i++)
      inv[i] = power(i, P - 2);
    facInv[0] = facInv[1] = 1;
    for (int i = 2; i <= n; i++)
      facInv[i] = (inv[i] * facInv[i - 1]) % P;
  }

  long long comb(int N, int K) {
    if (N < K || K < 0 || N < 0)
      return 0;
    if (N == 0 || K == 0 || K == N)
      return 1;
    return ((fac[N] * facInv[K]) % P * facInv[N - K]) % P;
  }

  long long hcomb(int N, int K) {
    if (N == 0 && K == 0)
      return 1;
    return comb(N + K - 1, K);
  }

  long long mul(long long a, long long b) { return (a * b) % P; }

  long long add(long long a, long long b) { return (a + b) % P; }

  // find c
  // where a^c = b (mod P)
  long long dlp(long long a, long long b) {
    long long m = ceil(sqrt(P));
    map<long long, long long> mp;
    for (int i = 0; i < m; i++)
      mp[power(a, i)] = i;
    long long ainvm = power(power(a, m), P - 2);
    cout << m << endl;
    for (int i = 0; i < m; i++) {
      if (mp.find(b) != mp.end()) {
        return i * m + mp[b];
      }
      b = mul(b, ainvm);
    }
    return -1;
  }
};

int n, k;
vector<vector<int>> p;
C cmb(101010);

ll dfs(int i, int from, int rest, int parentc) {
  int child = p[i].size() - (from >= 0);
  ll ret = (cmb.fac[rest + parentc - 1] * cmb.facInv[rest + parentc - child - 1]) % P;
  if (rest + parentc - child - 1 < 0) return 0;
  for (auto &j : p[i]) {
    if (j == from) continue;
    ret *= dfs(j, i, rest - 1 - (child - 1) + parentc, child - 1 + (from >= 0));
    ret %= P;
  }
  return ret;
}

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cin >> n >> k;
  p.resize(n);
  for (int i = 0; i < n - 1; i++) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    p[a].push_back(b);
    p[b].push_back(a);
  }
  cout << (dfs(0, -1, k, 0) * k) % P << endl;
  return 0;
}


Measured memory_bytes: 13952
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long ll;
typedef pair<ll,ll> P;
const ll mod=1000000007;
const ll LINF=1LL<<60;
const int INF=1<<30;

int main(){
	string S;
	cin >> S;
	int n = S.size();
	int c,ans,i;
	c = 0;
	ans = 0;
	for (i = 0;i < n;i++)
	{
		if (S[i] == 'A' || S[i] == 'T' || S[i] == 'G' || S[i] == 'C')
			c++;
		else{
			ans = max(ans,c);
			c = 0;
		}
	}
	ans = max(ans,c);
	cout << ans;


	return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;


public class Main {
	static ArrayList<Integer> list = new ArrayList<Integer>();

	public static void main(String[] args) throws Exception {
		BufferedReader br;
		if( args.length > 0 && args[0].equals("File") == true ) {
			br = getReader("C:\\Users\\USER\\Downloads\\ALDS1_4_A-in8.txt");
		} else {
			br = getReader();
		}
		int snum = getInt(br);
		int[] snumAry = getIntAry(br);
		int tnum = getInt(br);
		int[] tnumAry = getIntAry(br);
		int count = 0;
		for( int t = 0; t < tnumAry.length ; t++ ) {
			if ( member(tnumAry[t], snumAry) == true ) {
				slist(tnumAry[t]);
//				break;
			}
		}
		count = list.size();
//		System.out.println("");
		System.out.println(count);
	}
	public static boolean member( int t, int[] num ) {
		int i = 0;
		int j = num.length-1;
		int k = i + (j-i)/2 ;
		while(i<=j) {
			if (t == num[k]) {
				return true;
			} else if ( t > num[k]) {
				i = k+1;
			} else {
				j = k-1;
			}
			k = i + (j-i)/2;
		}
		return false;
	}
	public static void slist(int v) {
		boolean insert = false;
		for( int i = 0 ; i < list.size() ; i++ ) {
			if ( list.get(i) == v) {
				insert = true;
				break;
			} else if ( list.get(i) > v ) {
				list.add(i,v);
				insert = true;
				break;
			}
		}
		if ( insert == false ) {
			list.add(v);
		}
	}
	public static BufferedReader getReader() {
		return( new BufferedReader(new InputStreamReader(
				System.in)));
	}
	public static BufferedReader getReader(String path) throws Exception{
		return( new BufferedReader(new InputStreamReader(
				new FileInputStream(path))));
	}
	public static int getInt(BufferedReader br)throws Exception {
		String line = br.readLine();
		return Integer.valueOf(line);
	}
	public static String[] getAry(BufferedReader br)throws Exception {
		String line = br.readLine();
		String[] nstr = line.split(" ");
		return nstr;
	}
	public static int[] getIntAry(BufferedReader br)throws Exception {
		String line = br.readLine();
		String[] nstr = line.split(" ");
		int[] n = new int[nstr.length];
		for( int i=0 ; i < nstr.length ; i++ ) {
			n[i] = Integer.valueOf(nstr[i]);
		}
		return n;
	}
	public static int[] getAryMl(BufferedReader br)throws Exception {
		int n = getInt(br);
		int[] ary = new int[n];
		for( int i=0 ; i < n ; i++ ) {
			ary[i] = getInt(br);
		}
		return ary;
	}
	public static void putAry(int[] ary, int num) {
		for( int i = 0; i < num ; i++ ) {
			System.out.print(ary[i]);
			if ( i < num-1) {
				System.out.print(" ");
			}
		}
		System.out.println("");
	}
	public static void putAry(int[] ary) {
		putAry(ary, ary.length ) ;
	}
	public static boolean isPrime(int n) {
		int r = (int)Math.sqrt((double)n)+1;
		for( int j = 2 ; j < r ; j += 1) {
			if ( n%j == 0 ) {
				return false;
			}
		}
		return true;
	}

}

Measured memory_bytes: 44624
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int main(){
    ios::sync_with_stdio(0);   cin.tie(0);
    string s;
    cin >> s;
    int ans = 0;
    bool flg = false;
    reverse(s.begin(), s.end());
    int n = s.size();
    int cur = 0;
    for(int i = 0;i < n;i++)
    {
		int a = s[i] - '0';
        a += cur;
        if(a < 5){
            ans += a;
            cur = 0;
        }
        else if(a > 5){
            ans += 10 - a;
            cur = 1;
        }
        if(a == 5){
            if(i < n - 1 && s[i+1] - '0' >= 5){
                ans += 10 - a;
                cur = 1;
            }
            else{
                ans += a;
                cur = 0;
            }
        }
    }
    if(cur > 0) ans++;
    cout << ans << endl;
}

Measured memory_bytes: 1948
from collections import defaultdict

N = int(input())
ans = dict()
for _ in range(N):
    k = str(input())
    if k in ans:
        ans[k] += 1
    else:
        ans.update({k: 1})
groupedByValue = defaultdict(list)
for key, value in sorted(ans.items()):
    groupedByValue[value].append(key)
l = groupedByValue[max(groupedByValue)]
for i in l:
    print(i)

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

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            var b = ReadIntArray().ToList();
            var a = new List<int>();
            for (int i = 0; i < b.Count() - 1; i++)
            {
                a.Add(Math.Min(b[i], b[i + 1]));
            }
            a.Add(b.First());
            a.Add(b.Last());
            Console.WriteLine(a.Sum());
        }

        public static int[] ReadIntArray()
        {
            return Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
        }

        public static int ReadInt()
        {
            return int.Parse(Console.ReadLine());
        }
    }
}


Measured memory_bytes: 13396
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    a,b=INTM()
    if a<=5:
        print(0)
    elif a<= 12:
        print(b//2)
    else:
        print(b)
if __name__ == '__main__':
    do()

Measured memory_bytes: 3060
#include <iostream>

int main()
{
	int input;
	int hours, minutes, seconds;

	std::cin >> input;

	hours = input / 3600;
	minutes = input / 60 - hours * 60;
	seconds = input - (hours * 3600 + minutes * 60);
	
	std::cout << hours << ":" << minutes << ":" << seconds << std::endl;

	return 0;
}




Measured memory_bytes: 3100
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <string>
#include <iomanip>
#include <map>
#include <set>
#include <cmath>
#include <cstdio>
#include <cstdint>
using namespace std;
#define rep(i, n) for(int(i) = 0; (i) < (n); (i)++)
#define FOR(i, m, n) for(int(i) = (m); (i) < (n); (i)++)
#define All(v) (v).begin(), (v).end()
#define pb push_back
#define MP(a, b) make_pair((a), (b))
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const int INF = 1 << 30;
const ll LINF = 1LL << 60;
const int MOD = 1e9 + 7;

int main() {
    ll N;
    cin >> N;
    ll ma = 0;
    for(ll i = 1; i <= N; i++) {
        if(i * (i + 1) / 2 >= N) {
            ma = i;
            break;
        }
    }
    vector<int> res;
    int sum = 0;
    for(int i = ma; i >= 1; i--) {
        if(sum + i <= N) {
            res.pb(i);
            sum += i;
        }
    }
    rep(i, res.size()) { cout << res[i] << endl; }
    return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}

int main() {
    string s;
    cin >> s;
    cout << "2018/01/" + s.substr(8,2) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/range/adaptor/reversed.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
typedef long long int ll;

#define PI (acos(-1))
#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define dumparr(x) cerr << #x ; for(auto elem: x){cerr << " " << elem;} cerr << endl;
#define dumppairs(x) cerr << #x ; for(auto elem: x){cerr << "(" << elem.first << " " << elem.second << ") ";} cerr << endl;
#define dumpline cerr << "**********************" << endl;
#define dumpwline(x) cerr << "******** " << #x << "=" << (x) << " ********" << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))

ll d = 1e9 + 7;

ll modpow(ll x, ll y){
    return x*y % d;
}

ll ppow(ll x, ll p){
    ll ret = 1;
    ll bai = x;
    while(p > 0){
        if (p % 2 == 1){
            ret = modpow(bai, ret);
        }
        bai = modpow(bai, bai);
        p /= 2;
    }
    return ret;
}



ll gyaku(ll x){
    ll bai = x;
    ll e = d-2;
    ll ret = 1;
    while (e > 0){
        if (e % 2 == 1){
            ret = modpow(bai, ret);
        }
        bai = modpow(bai, bai);
        e /= 2;
    }
    return ret;
}

vector <ll> kaijos = {1};
vector <ll> gyakus;
ll cmb(ll x, ll y){
    if (y > x){
        return 0;
    }
    if (y == 0){
        return 1;
    }
    return modpow(modpow(kaijos[x], gyakus[y]), gyakus[x-y]);
}

int main(void){
    ll n; cin >> n;
    ll k; cin >> k;
    REP(i, n+5){
        kaijos.push_back(modpow(kaijos[i], i+1));
    }
    for(auto ka: kaijos){
        gyakus.push_back(gyaku(ka));
    }
    vector <ll> kuuhakus;
    REP(i, n+1){
        ll base = cmb(n, i);
        ll bai = cmb(n-1, i);
        kuuhakus.push_back(modpow(base, bai));
    }
    ll ans = 0;
    REP(i, min(k+1, n)){
        ans += kuuhakus[i];
        ans %= d;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 6384
#include<iostream>
typedef unsigned long long LL;
using namespace std;
int main(void){
    std::string s;
    std::cin >> s;

    LL  sum = 0;
    int n = s.size();
    for(int bit=0;bit<(1<<n-1);bit++){
        LL t=s[0]-'0';
        for(int i=0;i<n-1;i++){
            if(bit & (1<<i)){
                sum+=t;
                t=s[i+1]-'0';
            }
            else {
                t*=10;
                t+=s[i+1]-'0';
            }
        }
        sum+=t;

    }
cout<<sum<<endl;
    return 0;
}

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

int main() {
  int n;
  cin >> n;
  
  int y = 10000 - n;
  
  while(true){
    if(y < 1000) break;
    y -= 1000;
  }
  
  cout << y << endl;
  return 0;
}

Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
int main()
{
   int a,b,c;cin>>a>>b>>c;
   for(int i=a;i<10000;i+=a)
   {
       if(i%b==c)
       {
           cout<<"YES\n";
           return 0;
       }
   }
   cout<<"NO\n";
}


Measured memory_bytes: 3580
fn c() {
    let mut input = String::new();
    std::io::stdin().read_line(&mut input).unwrap();
    let kn: Vec<usize> = input.split_whitespace()
        .map(|s| s.parse::<usize>().unwrap())
        .collect();

    let mut input = String::new();
    std::io::stdin().read_line(&mut input).unwrap();
    let mut an: Vec<i32> = input.split_whitespace()
        .map(|s| s.parse::<i32>().unwrap())
        .collect();

    let tail = kn[0] as i32 + an[0];
    an.push(tail);
    let dist: Vec<i32> = an.iter().enumerate()
        .take(kn[1])
        .map(|(i, v)| (an[i + 1] - v).abs())
        .collect();
    let sm: i32 = dist.iter().sum();
    let mx = dist.iter().max().unwrap();
    println!("{}", sm - mx);
}

fn main() {
    c();
}

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

const long long M = 1000000007;

vector<long long> fac(300001);
vector<long long> ifac(300001);

long long mpow(long long x, long long n){
    long long ans = 1;
    while(n != 0){
        if(n&1) ans = ans*x % M;
        x = x*x % M;
        n = n >> 1;
    }
    return ans;
}

long long comb(long long a, long long b){ //aCbをmod計算
    if(a == 0 && b == 0)return 1;
    if(a < b || a < 0)return 0;
    long long tmp = ifac[a-b]* ifac[b] % M;
    return tmp * fac[a] % M;
}

int main() {
  int n, k; cin >> n >> k;


  fac[0] = 1;
  ifac[0] = 1;
  for(long long i = 0; i<300000; i++){
      fac[i+1] = fac[i]*(i+1) % M; // n!(mod M)
      ifac[i+1] = ifac[i]*mpow(i+1, M-2) % M; // k!^{M-2} (mod M) ←累乗にmpowを採用
  }

  long long ans = 0;
  for(int i=1; i<=k; ++i){
    ans = comb(n-k+1, i) * comb(k - i + i-1, i-1) % M;
    printf("%lld\n", ans);
  }
}


Measured memory_bytes: 4992
#include  <stdio.h>
#include  <stdlib.h>
int main()
{
	int a,b,c;
	scanf("%d%d%d",&a,&b,&c);
	if(a==b&&a!=c)
		printf("Yes");
	else if(a==c&&a!=b)
		printf("Yes");
	else if(b==c&&a!=b)
		printf("Yes");
	else
		printf("No");
	return 0;
}

Measured memory_bytes: 128
#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;
  string s, t;
  cin >> N;
  cin >> s >> t;
  
  int len=s.size() + t.size();
  rep(i,s.size()) {
    if (t.find(s.substr(i)) != string::npos) {
      len -= (s.size() - i);
      break;
    }
  }
  
  cout << len << endl;
  return 0;
}


Measured memory_bytes: 3612
#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;
    vector<int> a(n);
    rep(i, n) cin >> a[i];
    rep(i, n-k) {
        if (a[i] < a[i + k]) {
            cout << "Yes" << endl;
        }
        else {
            cout << "No" << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 3980
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
int main() {
	int x,y;
	scanf("%d%d",&x,&y);
	for (int i=1;i<=3;++i) {
		int t=x*i*y;
		if (t&1) {
			puts("Yes");
			return 0;
		}
	}
	puts("No");
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a),i##formax=(b);i<i##formax;i++)
#define FORR(i,a,b) for(int i=(a),i##formax=(b);i>=i##formax;i--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define pcnt __builtin_popcount
#define sz(x) (int)(x).size()
#define maxs(x,y) x=max(x,y)
#define mins(x,y) x=min(x,y)
#define show(x) cout<<#x<<" = "<<x<<endl;
#define all(a) (a.begin()),(a.end())
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define perm(c) sort(all(c));for(bool c##p=1;c##p;c##p=next_permutation(all(c)))
#define bitComb(a,n,k) for(int a##x,a##y,a=(1<<k)-1;a<(1<<n);a##x=a&-a,a##y=a+a##x,a=(((a&~a##y)/a##x)>>1)|a##y)
#define uniq(v) sort(all(v));v.erase(unique(all(v)), v.end())
#define bit(n) (1LL<<(n))
#define randInt(l,r) (uniform_int_distribution<ll>(l,r)(rnd))
#define randDouble(l,r) (uniform_real_distribution<double>(l,r)(rnd))
#define dout(d) printf("%.12f\n",d)

typedef long long ll;
typedef __int128_t lll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
template<class T>using V=vector<T>;
template<class T>using VV=V<V<T>>;
template<class T,class Y>ostream& operator<<(ostream& o,const pair<T,Y>& p){return o<<"("<<p.fi<<", "<<p.se<<")";}
template<typename A,size_t N,typename T>void Fill(A (&array)[N],const T&v){fill((T*)array,(T*)(array+N),v);}
lll gcd(lll a,lll b,lll &x,lll &y){if(!b){x=1;y=0;return a;}lll d=gcd(b,a%b,y,x);y-=a/b*x;return d;}
ll gcd(ll a,ll b){lll x=0,y=0;return gcd(a,b,x,y);}
ll modInv(ll a,ll m){lll x,y;gcd(a,m,x,y);return (x%m+m)%m;}
ll modPow(lll a,lll n,ll m){if(!a)return a;lll p=1;for(;n>0;n>>=1,a=a*a%m)if(n&1)p=p*a%m;return(ll)p;}
bool isPrime(ll n){if(n<2||n%2==0)return n==2;lll t=n-1,d=t/(t&-t);for(lll a:{2,325,9375,28178,450775,9780504,1795265022})if(a%n){for(t=d,a=modPow(a,t,n);t!=n-1&&a!=1&&a!=n-1;a=a*a%n,t=t*2%n);if(a!=n-1&&t%2==0)return 0;}return 1;}
const int IINF = 1e9+6;
const ll LINF = 1e18;
const int MOD = 1e9+7;
const double PI = acos(-1);
const double EPS = 1e-10;
static random_device rd;
static mt19937 rnd(rd());

const int N = 1e5;
int n;
main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> n;
  cout << n*800-n/15*200 << endl;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline
n,m = map(int,input().split())
C = [list(map(int,input().split())) for i in range(m)]

class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def size(self, x):
        return -self.parents[self.find(x)]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x == y:
            return
        if self.parents[x] > self.parents[y]:
            x, y = y, x
        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def n_cc(self):  # 連結成分の数
        A = [i for i in self.parents if i < 0]
        return len(A)

U = UnionFind(n+1)
for i in range(m):
    U.union(C[i][0], C[i][1])

ans = 0
for i in range(n+1):
    # print(i)
    ans = max(ans, U.size(i))
print(ans)

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

int main() {
  int x[3];
  cin >> x[0] >> x[1] >> x[2];

  sort(x, x+3, greater<int>());

  cout << x[0] * 10 + x[1] + x[2] << endl;

  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main(){
    #ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
    #endif
    int n;
    cin>>n;
    if(n<1200) cout<<"ABC";
   	else if(n<2800) cout<<"ARC";
   	else cout<<"AGC";
  	return 0;
}

Measured memory_bytes: 3576
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <utility>
#include <functional>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_map>
#include <iomanip>
#include <numeric>
#include <complex>

using namespace std;
using ll = long long;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
const int INF = (1<<30);
const ll INFL = (1LL<<62);
const ll MOD = 1000000007;
template<class T> bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template<class T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
template<class T> ll mod_pow(ll a, ll n, T mod) { mod=(ll)mod; ll res=1, p=a%mod; while(n){ if(n&1) res=res*p%mod; p=p*p%mod; n>>=1; } return res; }

vector<char> m = {'S', 'H', 'C', 'D'};

int main() {
    int n;
    cin >> n;
    vector<vector<int>> card(4, vector<int>(13, 0));
    while(n--){
        char mark;
        int rank;
        cin >> mark >> rank;
        card[find(all(m), mark)-m.begin()][rank-1] = 1;
    }
    rep(i, 4)rep(j, 13){
        if(!card[i][j]) printf("%c %d\n", m[i], j+1);
    }
    return 0;
}


Measured memory_bytes: 3204
'use strict'
const Main = (arg) => {
  let input = arg.trim().split('\n');
  let X = input[0].split(' ').map(Number)[0];
  let A = input[0].split(' ').map(Number)[1];

  let Ans = X >= A ? 10 : 0;
  console.log(Ans);

}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 7372
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<cctype>
#include<iostream>
#include<stack>
#include<string>
#include<vector>
#include<queue>
#include<deque>
#include<algorithm>
#include<utility>
#include <map>
#include <set>

using namespace std;

#define REP(i,x) for(int i=0; i<(int)(x); i++)       // 0 <= i < x
#define REPS(i,x) for(int i=1; i<=(int)(x); i++)     // 0 < i <= x
#define RREP(i,x) for(int i=((int)(x)-1); i>=0; i--) // x > i >= 0
#define RREPS(i,x) for(int i=((int)(x)); i>0; i--)   // x >= i > 0
#define INF 100000000

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

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

int main(void){
	int N;
    cin >> N;
    
    int f = 0;
    int temp = N;
    while(temp > 0){
        f += temp % 10;
        temp = temp / 10;
    }

    if(N % f == 0){
        cout << "Yes\n";
        return 0;
    }

    cout << "No\n";
    return 0;
}


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

int main(){
    string s, t;
    cin >> s >> t;
    if(s.size() != t.size()-1){
        cout << "No" << endl;
        return 0;
    }
    for(int i = 0; i < s.size(); i++){
        if(s[i] != t[i]){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
}

Measured memory_bytes: 3624
from math import ceil

N = int(input())
A = [int(x) for x in input().split()]
B = [int(x) for x in input().split()]

suma = sumb = num = 0
for i in range(N):
    suma += A[i]
    sumb += B[i]
    if A[i] < B[i]:
        num += ceil((B[i] - A[i]) / 2)

if A == B:
    print("Yes")
else:
    if suma >= sumb:
        print("No")
    else:
        if num > sumb - suma:
            print("No")
        else:
            print("Yes")


Measured memory_bytes: 4596
import java.util.*;
class Main
{
    public static void main(String args[])
    {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        String s1=sc.next();
        String s2=sc.next();
        String ans="";
        for(int i=0;i<n;i++)
        {
            ans=ans+s1.charAt(i)+s2.charAt(i);
        }
        System.out.println(ans);
        

    }
}

Measured memory_bytes: 20948