akhauriyash/Code-Regression huggingface dataset:
from itertools import product as pro

h,w,K=map(int,input().split())
C=[]
for _ in range(h):
    C.append(list(str(input())))



L=['0','1']
Sh=list(pro(L,repeat=h))
Sw=list(pro(L,repeat=w))


ans=0
for i in Sh:
    for j in Sw:
        temp=0

        for k in range(h):
            for l in range(w):
                if i[k]=='0' and j[l]=='0':
                    if C[k][l]=='#':
                        temp+=1
        
        if temp==K:
            ans+=1
           

print(ans)


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

#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999
#define MOD 1000000007

using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;

int iy[]={0, 0, 1, -1};
int ix[]={1, -1, 0, 0};

bool kumi[27][27];  
string s, t;
int main(){
	cin >> s >> t;
	for(int i=0;i<s.length();i++){
		kumi[s[i]-'a'][t[i]-'a'] = true;
	}
	bool fl = false;
	for(int i=0;i<26;i++){
		int co = 0;
		for(int j=0;j<26;j++){
			if(kumi[i][j]) co++; 
		}
		if(co>1) fl = true;
		co = 0;
		for(int j=0;j<26;j++){
			if(kumi[j][i]) co++; 
		}
		if(co>1) fl = true;	
	}
	if(fl){
		cout << "No" << endl;
	}else{
		cout << "Yes" << endl;
	}
	return 0;
}

Measured memory_bytes: 776
#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>; // 1 つの証言を表す構造体 // 「人」と「0 or 1」
    using Graph = vector<vector<int>>;
    
    int n;
    vector<vector<P>> s;
    int right(int bit, int n){
        int count = 0;
    	for(int i = 0; i < n; i++){
    		if(bit & (1 << i)){
    			for(pair<int,int> v : s[i]){
    				if(!(bit & (1 << v.first)) && v.second == 1) return 0;
    				if((bit & (1 << v.first)) && v.second == 0) return 0;
    			}
    			count ++;
    		}
    	}
    	return count;
    }
    int main() {
    int n;	cin >> n;
    s.resize(n);
    int a;
    rep(i,n){
    	cin >> a;
    	s[i].resize(a);
    	int x,y;
    	rep(j,a){
    		cin >> x >> y;
    		s[i][j].first = x-1;
    		s[i][j].second = y;
    	}
    }
    int l = 0;
    for(int bit = 0; bit < (1<<n); bit++){
    	int k = right(bit,n);
    	l = max(l,k);
    }
    cout << l << endl; 
    
     return 0;
    }
    

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <math.h>
#include <vector>
#include <set>
#include <queue>

using namespace std;
typedef long long ll;
#define MOD 1000000007

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

    int A[N], sum=0;
    for(int i=0; i<N; i++) {
        cin >> A[i];
        sum += A[i];
    }

    vector<int> D;
    for(int i=1; i*i<sum; i++) {
        if(sum % i == 0) {
            D.emplace_back(i);
            D.emplace_back(sum / i);
        }
    }

    sort(D.begin(), D.end(), std::greater<int>());

    int ans = 1;
    for(auto d: D) {
        vector<int> R;
        int cumsum[N];

        for(int i=0; i<N; i++) R.emplace_back(A[i] % d);
        sort(R.begin(), R.end());
        for(int i=0; i<N; i++) {
            if(i==0) cumsum[i] = R[i];
            else cumsum[i] = R[i] + cumsum[i-1];
        }

        int cnt = 0;
        for(int i=N-1; i>=0; i--) {
            cnt += (d - R[i]);
            if(cumsum[i-1] == cnt) break;
        }

        if(K >= cnt) {
            ans = d;
            break;
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(int argc, const char * argv[]) {

    int x;
    int y;
    
    while (1) {
        scanf("%d %d", &x,&y);
        if (x==0&&y==0) {
            break;
        }
        if (x<y){
            printf("%d %d\n",x,y);
        } else{
            printf("%d %d\n",y,x);
            
        }

    }
    
    return 0;
}

Measured memory_bytes: 600
#include<stdio.h>
int main(){
    int n,a=0;
    scanf("%d",&n);
    for(int i=9;i>0;i--){
        if((n%i==0)&&((n/i)>0)&&(n/i<=9)){
            a++;
            break;
        }
    }
    if(a==1){
        printf("Yes\n");
    }
    else{
        printf("No\n");
    }
    return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
#define LL long long
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPA(i,n) for(int i=1;i<(n);++i)
#define foreach(i, n) for(auto &i:(n))
#define PII pair<int,int>
#define PLI pair<long long, int>
#define PLL pair<long long, long long>
#define MOD ((int)1e9 + 7)
#define INF ((int)1e9+5)
#define INFLL ((LL)4e18)
#define ALL(x) (x).begin(),(x).end()
#define BIT(x) (1 << (x))
using namespace std;

int main(){
	int N;
	int M;
	cin >> N >> M;
	vector<PII> line;
	REP(i, M){
		int a, b;
		cin >> a >> b;
		line.push_back({a, -i-1});
		line.push_back({b-1, i+1});
	}
	int ans = 0;
	set<int> has;
	sort(ALL(line));
	foreach(i, line){
		if(i.second<0){
			has.insert(-i.second);
		}else{
			if(has.count(i.second)){
				++ans;
				has.clear();
			}
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3312
#include<iostream>
#include<string>
#include<cmath>
#include<queue>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<functional>
#include<algorithm>
#include<cstdio>
#include<unordered_map>
using namespace std;
//---------------------------------------------------
//ライブラリゾーン！！！！
#define int long long
#define str string
#define rep(i,j) for(int i=0;i<(int)(j);i++)
typedef long long ll;
typedef long double ld;
const ll inf = 4523372036854775807;
const int inf2 = 1145141919;
const ld pi = 3.14159265358979323846264338327950288419716939937510582097494459230781640628620899;
struct P {
	ll pos, cost;
};
bool operator<(P a, P b) { return a.cost < b.cost; }
bool operator>(P a, P b) { return a.cost > b.cost; }
struct B {//隣接リスト表現
	ll to, cost;
};
struct S {//辺の情報を入れる変数
	int from, to, cost;
};
bool operator<(S a, S b) { return a.cost < b.cost; }
bool operator>(S a, S b) { return a.cost > b.cost; }
struct H {
	int x, y;
};
ll gcm(ll i, ll j) {//最大公約数
	if (i > j) swap(i, j);
	if (i == 0) return j;
	return gcm(j%i, i);
}
ld rad(ld a, ld b, ld c, ld d) {
	return sqrt(pow(a - c, 2) + pow(b - d, 2));
}//rad＝座標上の2点間の距離
 //---------------------------------------------------
 //+++++++++++++++++++++++++++++++++++++++++++++++++++
signed main() {
	set<int>a;
	int n, b;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> b;
		if (a.find(b) != a.end()) 
			a.erase(b);
		else
			a.insert(b);
	}
	cout << a.size()<< endl;
	getchar(); getchar();
}

Measured memory_bytes: 4864
N=int(input())
minz=10**11
minw=10**11
maxz=-10**11
maxw=-10**11
for i in range(N):
 
    a,b=map(int,input().split())
    if  a+b>maxz:
        maxz=a+b

    if a+b<minz:
        minz=a+b

    if  a-b>maxw:
        maxw=a-b

    if a-b<minw:
        minw=a-b

    
 
print(max((maxz-minz),(maxw-minw)))

Measured memory_bytes: 74516
#include <stdio.h>
int main(){
  int i, j, n, num[101], cnt=0, tmp;
  
  scanf("%d", &n);
  for(i = 0 ; i < n ; i++){
    scanf("%d", &num[i]);
  }

  for(i = 0 ; i < n ; i++){
    for(j = n-1 ; j > i ; j--){
      if(num[j] < num[j-1]){
	cnt++;
	tmp = num[j];
	num[j] = num[j-1];
	num[j-1] = tmp;
      }
    }
  }

  for(i = 0 ; i < n ; i++){
    printf("%d%c", num[i], (i == n-1)? '\n':' ');
  }
  printf("%d\n", cnt);

  return 0;
}

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

using namespace std;

int main() {
  int n;
  cin >> n;
  int a;
  deque<int> d;
  for (int i = 0; i < n; i++) {
    cin >> a;
    if (i&1) {
      d.push_back(a);
    } else {
      d.push_front(a);
    }
  }
  if (n&1) {
    for (auto x : d) {
      cout << x << ' ';
    }
  } else {
    while (!d.empty()) {
      a = d.back();
      d.pop_back();
      cout << a << ' ';
    }
  }
}


Measured memory_bytes: 2944
from collections import Counter

n = int(input())
a = list(map(int, input().split()))
c = Counter(a)

over4 = []
over2 = []

for k, v in c.items():
    if v >= 4:
        over4.append(k)
    elif v >= 2:
        over2.append(k)

over4.sort(reverse=True)
over2.sort(reverse=True)

x, y, z = 0, 0, 0
if len(over4) > 0:
    x = over4[0] ** 2
if len(over2) >= 2:
    y = over2[0] * over2[1]
if len(over4) > 0 and len(over2) > 0:
    z = over4[0] * over2[0]

print(max(x, y, z))


Measured memory_bytes: 22060
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<ll ,P> P3;
typedef pair<P ,P> PP;
const ll MOD = 998244353;
const int IINF = INT_MAX;
const ll LLINF = LLONG_MAX;
const int MAX_N = int(3e5 + 5);
const double EPS = 1e-6;
const int di[] = {0, 1, 0, -1}, dj[] = {1, 0, -1, 0};
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define SORT(v) sort((v).begin(), (v).end())
#define SORTR(v) sort((v).rbegin(), (v).rend())
#define ALL(v) (v).begin(), (v).end()

int n, m, r, q, cum[10005][1300];

int main() {
    while(cin >> n >> m, n){
        for(int i=0;i<m;i++){
            fill(cum[i],cum[i]+2000,0);
        }
        cin >> r;
        for(int i=0;i<r;i++){
            int t, a, b, s;
            cin >> t >> a >> b >> s;
            b--;
            if(s){
                cum[b][t+1]++;
            }
            else{
                cum[b][t+1]--;
            }
        }
        for(int i=0;i<m;i++){
            for(int j=0;j<1290;j++){
                cum[i][j+1] += cum[i][j];
            }
            for(int j=0;j<1290;j++){
                cum[i][j+1] = min(1, cum[i][j+1]);
                cum[i][j+1] += cum[i][j];
            }
        }
        cin >> q;
        for(int i=0;i<q;i++){
            int ts, te, b;
            cin >> ts >> te >> b;
            b--;
            cout << cum[b][te] - cum[b][ts] << endl;
        }
    }

    return 0;
}


Measured memory_bytes: 52264
#include <iostream>
#include <vector>

using namespace std;

int main()
{
	int n;
	cin >> n;
	vector<int> p(n);

	for (int k = 0; k < n; k++)
		cin >> p[k];

	int ans = 0;
	int law = p[0];
	for (int i = 0; i < n; i++)
	{
		if (law > p[i])
		{
			law = p[i];
		}

		if (p[i] > law)
			ans += 1;
	}
	ans = n - ans;
	cout << ans;
	return 0;
}

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

int main()
{
  string S ;
  cin>>S ;
  
  vector<pair<string,int>>day ;
  day.push_back(make_pair("SUN",7)) ;
  day.push_back(make_pair("MON",6)) ;
  day.push_back(make_pair("TUE",5)) ;
  day.push_back(make_pair("WED",4)) ;
  day.push_back(make_pair("THU",3)) ;
  day.push_back(make_pair("FRI",2)) ;
  day.push_back(make_pair("SAT",1)) ;
  
  for(int i=0;i<7;i++) if(S==day.at(i).first) cout<<day.at(i).second ; 
  
  return 0 ;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  
  int K;
  
  cin >> K;
  
  vector<int> A;
  
  A = {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};
  
  cout << A[K - 1] << endl;
}
        


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
#define IOS() ios::sync_with_stdio(0);cin.tie(0);
using namespace std;
int st[10000000];
signed main()
{
	IOS();
	//set<int> st;
	int k;
	while(cin>>k)
	{
		if(k==1)
		{
			cout<<0<<"\n";
			continue;
		}
		int ans=0;
		int n=0;
		for(int i=2;i*i<=k;i++)
		{
			//cout<<k<<" "<<st[i]<<"\n";
			if(k<i) break;
			if(k%i) continue;
			int n=0;
			while(k%i==0)
			{
				n++;
				k/=i;
			}
			//cout<<"n"<<n<<"\n";
			ans+=double(-1+sqrt(1+8*n))/2;
			//cout<<ans<<" ";
		} 
		if(k!=1) ans++;
		cout<<ans<<"\n";
	}
} 
//2^12*5^12


Measured memory_bytes: 3696
#include<iostream>
#include<string>
using namespace std;
int main(){
  string str;
  cin >> str;
  while(str[0]!='0'){
    int i,o=0;
    for(i=0;i<str.size();i++){
      o+=str[i]-'0';
    }
    cout << o << endl;
    cin >> str;
  }
  return 0;
}



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


using namespace std;

//conversion
//------------------------------------------
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(); }

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

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

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define EXISTch(s,c) ((((s).find_first_of(c)) != std::string::npos)? 1 : 0)//cがあれば1 if(1)
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  FOR(i,0,n)
#define loop(n) FOR(i,0,n)
#define rrep(i,a,b) for(int i=(a);i>=(b);--i)
//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = (int)1000000007;
const LL MOD = (LL)1000000007;//10^9+7
const LL INF2 = (LL)100000000000000000;//10^18

bool isPrime(int n) {
	if (n == 1)return false;
	if (n == 2)return true;

	for (int i = 2; i*i<= n; i++) {
		if (n%i == 0) {
			return false;
		}
	}

	return true;
}

int main() {

	while (true) {
		int n; cin >> n;
		if (n == 0)return 0;

		int cnt = 0;
		for (int i = n+1; i <=2*n; i++) {
			if (isPrime(i))cnt++;
		}
		
		cout << cnt << endl;
	}

	return 0;
}


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

using ll = long long;

const int mod = 1000000007;
const int INF = 1000000000;
const double EPS = 1e-9;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    int n = s.size();
    reverse(s.begin(), s.end());
    vector<vector<ll>> dp(n + 1, vector<ll>(13, 0));
    vector<ll> mod13(10);
    for (int i = 0; i < 10; ++i) mod13[i] = i;
    // for (int i = 0; i < 10; ++i) dp[0][i] = 1;
    dp[0][0] = 1;
    for (int i = 1; i < n + 1; ++i) {
        for (int j = 0; j < 13; ++j) {
            if (s[i - 1] == '?') {
                for (int k = 0; k < 10; ++k) {
                    dp[i][j] = (dp[i][j] + dp[i - 1][(j + 13 - mod13[k]) % 13]) % mod;
                }
            } else {
                int c = s[i - 1] - '0';
                dp[i][j] = (dp[i][j] + dp[i - 1][(j + 13 - mod13[c]) % 13]) % mod;
            }
        }
        for (int j = 0; j < 10; ++j) mod13[j] = (mod13[j] * 10) % 13;
    }
    cout << dp[n][5] << endl;
}


Measured memory_bytes: 13648
#include<stdio.h>

typedef long long int int64;

int dfs(int64 n,int bit,int up){
  if(n>up) return 0;
  int res=0;
  if(bit==7) res++;
  res+=dfs(10*n+3,bit|1,up);
  res+=dfs(10*n+5,bit|2,up);
  res+=dfs(10*n+7,bit|4,up);
  return res;
}

void run(void){
  int n;
  scanf("%d",&n);
  printf("%d\n",dfs(0,0,n));
}

int main(void){
  run();
  return 0;
}


Measured memory_bytes: 128
import java.util.*;

@SuppressWarnings("unchecked")
public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		String s = in.next();
		Stack<Character> stack = new Stack<>();
		for (int i = 0; i < s.length(); ++i) {
			char ch = s.charAt(i);
			if (ch == 'B') {
				if (!stack.isEmpty()) stack.pop();
			} else {
				stack.push(ch);
			}
		}
		String res = "";
		while (!stack.isEmpty()) {
			res += stack.pop();
		}
		for (int i = res.length() - 1; i >= 0; --i) {
			System.out.print(res.charAt(i));
		}
	}
}

Measured memory_bytes: 38860
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
//#include<boost/multiprecision/cpp_int.hpp>
//#include<boost/multiprecision/cpp_dec_float.hpp>
//namespace mp=boost::multiprecision;
//#define mulint mp::cpp_int
//#define mulfloat mp::cpp_dec_float_100
using namespace std;
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
constexpr int MOD=1000000007;
//constexpr int MOD=998244353;
#define INF (1<<30)
#define LINF (lint)(1LL<<56)
#define endl "\n"
#define rep(i,n) for(lint (i)=0;(i)<(n);(i)++)
#define reprev(i,n) for(lint (i)=(n-1);(i)>=0;(i)--)
#define Flag(x) (1<<(x))
#define Flagcount(x) __builtin_popcountll(x)
#define pint pair<int,int>
#define pdouble pair<double,double>
#define plint pair<lint,lint>
#define fi first
#define se second
typedef long long lint;
int dx[8]={1,1,0,-1,-1,-1,0,1};
int dy[8]={0,1,1,1,0,-1,-1,-1};
const int MAX_N=2e5+5;
//struct edge{lint to,num;};

vector<int> edge[MAX_N];
bool reach[MAX_N];
//int ans[MAX_N];

void dfs(int now){
    if(reach[now]) return;
    reach[now]=true;
}

lint d[300][300]; // MAX_V
void warshallfloyd(int v){ // N
  rep(i,v) rep(j,v) rep(k,v) d[j][k]=min(d[j][k],d[j][i]+d[i][k]);
  return;
}


int main(void){
    int H,W;
    cin >> H >> W;
    rep(i,10) rep(j,10) cin >> d[i][j];
    warshallfloyd(10);
    int ans=0;
    rep(i,H) rep(j,W){
        int N;
        cin >> N;
        if(N==-1) continue;
        ans+=d[N][1];
    }
    cout << ans << endl;
}

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

using namespace std;

typedef long long int ll;
const int INF = 1<<30;
const long long LINF = 1LL<<60;
const long long MOD = (long long)1e9 + 7;

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <vector>
#include <numeric>
#define PI 3.14159265358979323846
#define MAXINF 1e18L
#define INF 1e9L
#define EPS 1e-9
#define REP(i, n) for(int i=0;i<int(n);++i)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define ALL(v) v.begin(),v.end()
#define SORT(v) sort(ALL(v))
#define RSORT(v) sort(ALL(v), greater<int>())S
#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl
#define Yes(n) cout<<((n)?"Yes":"No")<<endl
#define pb push_back
using namespace std;
template<class A>void pr(A a){cout << (a) << endl;}
template<class A,class B>void pr(A a,B b){cout << a << " "  ;pr(b);}
template<class A,class B,class C>void pr(A a,B b,C c){cout << a << " " ;pr(b,c);}
template<class A,class B,class C,class D>void pr(A a,B b,C c,D d){cout << a << " " ;pr(b,c,d);}
typedef long long ll;
typedef pair<int, int> pii;

int main(void)
{
    int x1,y1;
    cin >> x1 >> y1;
    int x2,y2;
    cin >> x2 >> y2;
    int a = x2 - x1, b = y2 - y1;
    pr(x2-b,y2+a,x2-b-a,y2+a-b);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int sumOfEachDigit(int a){
	int sum = 0;
	while(a > 0){
		sum += a % 10;
		a /= 10;
	}
	return sum;
}
int main(){
	int n, a, b;
	cin >> n >> a >> b;
	int sum = 0;
	for(int i = 1; i <= n; i++){
		int sumd = sumOfEachDigit(i);
		if(sumd >= a && sumd <= b) sum += i;
	}
	cout << sum << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <cmath>
#include <map>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep2(i,a,n) for(int i=a;i<n;i++)
#define been(ix) (ix).begin(),(ix).end()
using namespace std;
typedef long long ll; 
typedef vector<int> vi;
typedef vector<long long> vl;
const ll INFL = 1e18;
const int INF = 1001001001; 
typedef pair<int,int> P;
#define foreach(ix,i) for(auto& (ix) : (i))
typedef long double ld;

int main(){
 string s;
 cin>>s;
 int ans =0;
 int cnt =0;
 rep(i,s.length()){
   if(s[i]=='A'||s[i]=='C'||s[i]=='G'||s[i]=='T'){
     cnt++;
     ans=max(ans,cnt);
   }
   else cnt=0;
 }
 cout<<ans<<endl;
}

Measured memory_bytes: 256
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

n,k = inpl()
if k == 1:
    print(0)
else:
    print(n-k)

Measured memory_bytes: 38292
A, B, C, D =  map(int, input().split())
T_count = 0 
A_count = 0
for i in range(100):
    C -= B
    T_count += 1
    if C <= 0:
        break

for j in range(100):
    A -= D
    A_count += 1
    if A <= 0:
        break

if T_count <= A_count:
    print('Yes')
else:print('No')

Measured memory_bytes: 9192
import java.io.*;
import java.util.*;
import java.math.*;
 
class Main {
    public static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    public static PrintWriter pw = new PrintWriter(System.out);
    public static String line;
    public static StringTokenizer st, st2;
    public static ArrayList<ArrayList<Integer>> adjList;
    public static int[] dx = {-1, 0, 1, 0, -1, 1, 1, -1, 0};
    public static int[] dy = {0, 1, 0, -1, 1, 1, -1, -1, 0};
    public static int INF = 0x3f3f3f3f;
    public static int MOD = 1000000007;
    public static long LINF = 0x3f3f3f3f3f3f3f3fL;

    public static void main(String[] args) throws Exception {
        int N = Integer.parseInt(br.readLine());

        int ans = 0;
        int current = N;
        while (ans == 0) {
            boolean isPrime = true;
            for (int i = 2; i * i <= current; i++) {
                if (current % i == 0) {
                    isPrime = false;
                    break;
                }
            }
            if (isPrime) {
                ans = current;
            }
            current++;
        }
        pw.println(ans);

        pw.close();
        br.close();
    }
}

class Pair implements Comparable<Pair>{
    public int a, b;

    Pair(int _a, int _b){
        a = _a;
        b = _b;
    }
 
    public String toString(){
        return a + " " + b;
    }

    public int compareTo(Pair p){
        if (b != p.b) return b < p.b ? -1 : 1;
        if (a != p.a) return a < p.a ? -1 : 1;
        return 0;
    }
}

Measured memory_bytes: 23252
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <unordered_map>
#define ll long long
using namespace std;

unordered_map<ll,ll>mp;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    vector<ll>div;
    ll n,m,k;
    cin>>n>>m>>k;
    for(ll i=1;i*i<=n;i++){
        if(!(n%i)){
            mp[i]=1;
            if(n/i!=i)mp[n/i]=1;
        }
    }
    for(ll i=1;i*i<=m;i++){
        if(!(m%i)){
            if(mp[i])div.push_back(i);
            if(m/i!=i && mp[m/i])div.push_back(m/i);
        }
    }
    sort(div.begin(),div.end(),greater<ll>());
    cout<<div[k-1];
    return 0;
}


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

#define LL long long
#define COIN const int
#define ite iterator
#define PII pair<int,int>
#define PSI pair<string,int>
#define PIS pair<int,string>

#define REP(i,n) for((i)=0;(i)<(int)(n);(i)++)
#define REPD(i,n) for((i)=(n)-1;(i)>=0;(i)--)

#define ALL(c) (c).begin(), (c).end()
#define LEN(s) (s).size()
#define CLEAR(x) memset(x,0,sizeof x);

#define MP make_pair
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define X first
#define Y second

#define VI vector<int>
#define VS vector<string>
#define VII vector<PII>
#define VVI vector<VI>

#define PIII 3.1415926
#define PI 3.14
/*****************************************************************************/

using namespace std;

string s,t,r,i,n,g;

int main()
{
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	cin >>s;
	t=s;
	int len=s.size();
	reverse(ALL(s));
	if (t!=s)
	{
		cout <<"No";
		return 0;
	}
	r=s.substr(0,(len-1)/2);
	i=r;
	reverse(ALL(r));
	if(i!=r)
	{
		cout <<"No";
		return 0;
	}
	n=s.substr((len+3)/2-1,len);
	g=n;
	reverse(ALL(n));
	if (g!=n)
	{
		cout <<"No";
		return 0;
	}
	cout <<"Yes";
	return 0;
}
/******************************************************************************
******************************************************************************/


Measured memory_bytes: 256
// Wed Aug 12 20:03:03 IST 2020   
#include <bits/stdc++.h>        
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#define forn(ii,a,b)       for(int64 ii = (int)a ; ii < (int)b  ; ii++ )
#define debug(x)           cerr << #x << " " << x << " -- \n"
#define I__O               ios::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define int64              long long   
#define all(x)             (x).begin(),(x).end() 
#define ff                 first
#define ss                 second
#define pppp               pair <int,int> 
#define precise(x)         cout << fixed << setprecision(12) << x << '\n'; 
using namespace std ;    
// policy based   
using namespace __gnu_pbds;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> indexed_set ; 
 
const int MOD1 = 1e9+7;
const int MOD2 = 1e9+9;
const double pi = 3.141592653589793238;
const int N = 1e5+7; 
const int INF = 2e9;

struct compare{
    bool operator()(vector <int64> A, vector <int64> B){
        if(A[0] == B[0])
            return A[1] < B[1];
        return A[0] < B[0];
    }
};      
  

int tests(){ 
     string s;
     cin >> s;
  if(s =="RRR")
    	return cout << 3,0;
     if(s[1] == 'R' and s[1] == s[2])
        return cout << 2 ,0;
     if(s[0] == 'R' and s[0] == s[1])
        return cout << 2 ,0;
     sort(all(s));
// 
     if(s[0] == 'R' and s[0] == s[2])
        return cout << 3,0;
  
     if(s[0] == 'R')
        return cout << 1,0;
     cout << 0;
    return 0;
}   
int main(){
    I__O ;      
    int cases = 1 ;  
    // cin >> cases ;
    while(cases--)
        tests(); 
    return 0 ; 
 
}


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

#define pb push_back
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define debug(x)  cerr << #x << " = " << x << endl
using namespace std;

typedef long long ll;
typedef long double ld;
typedef string str;
typedef pair<ll, ll> pll;

const ld PI = 3.14159265359;

const ll MOD = (ll) 998244353ll;
const ll MAXN = (ll) 1e5 + 10;
const ll INF = (ll) 2242545357980376863;
const ld EPS = (ld) 1e-8;

set<ll> G[MAXN];
vector<ll> O[MAXN] ,GP[MAXN];
vector<ll> topo;
ll dp[MAXN], ind[MAXN];
queue<ll> q;

int main(){
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	ll n, m;
	cin >> n >> m;
	ll u , v;
	for(int i = 0; i < m; i++){
		cin >> u >> v;
		O[u].pb(v);
		G[v].insert(u);
		GP[v].pb(u);
	}
	for(int i = 1;i<=n;i++){
		if(G[i].size() == 0) q.push(i);
	}
	ll fr;
	while(q.size()){
		fr = q.front();
		q.pop();
		for(auto adj : O[fr]){
			G[adj].erase(fr);
			if(G[adj].size() == 0) q.push(adj);
		}
		topo.pb(fr);
		ind[fr] = topo.size() - 1;
	}
	dp[0] = 0;
	for(int i = 1;i<n;i++){
		for(auto adj : GP[topo[i]]){
			dp[i] = max(dp[i], dp[ind[adj]] + 1);
		}
	}
	cout << *max_element(dp, dp+ n);
	return 0;
}


/*

                                 ____              ,----..               ,----..
   ,---,                       ,'  , `.           /   /   \             /   /   \
  '  .' \                   ,-+-,.' _ |          /   .     :           /   .     :
 /  ;    '.              ,-+-. ;   , ||         .   /   ;.  \         .   /   ;.  \
:  :       \            ,--.'|'   |  ;|        .   ;   /  ` ;        .   ;   /  ` ;
:  |   /\   \          |   |  ,', |  ':        ;   |  ; \ ; |        ;   |  ; \ ; |
|  :  ' ;.   :         |   | /  | |  ||        |   :  | ; | '        |   :  | ; | '
|  |  ;/  \   \        '   | :  | :  |,        .   |  ' ' ' :        .   |  ' ' ' :
'  :  | \  \ ,'        ;   . |  ; |--'         '   ;  \; /  |        '   ;  \; /  |
|  |  '  '--'          |   : |  | ,             \   \  ',  /          \   \  ',  /
|  :  :                |   : '  |/               ;   :    /            ;   :    /
|  | ,'                ;   | |`-'                 \   \ .'              \   \ .'
`--''                  |   ;/                      `---`                 `---`
                       '---'

*/


Measured memory_bytes: 23028
#include<bits/stdc++.h>
#define F first
#define S second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define REP(n) for(int i = 0; i < n; i++)
#define all(p) p.begin(), p.end()
#define count_1(p) __builtin_popcountll(p)
#define count_0(p) __builtin_ctzll(p)
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
template<class X=int>inline X min(X a,X b,X c){return min(min(a,b),c);}
template<class X=int>inline X min(X a,X b,X c,X d){return min(min(a,b,c),d);}
template<class X=int> inline X max(X a,X b,X c){return max(max(a,b),c);}
template<class X=int> inline X max(X a,X b,X c,X d){return max(max(a,b,c),d);}
template<class X=int> inline X mid(X s,X e){return (s+(e-s)/2);}
template<class X=int> inline X len(X s,X e){return (e-s+1);}
const int MOD = 1e9 + 7;
const int INF = 987654321;
const bool TESTCASES = 0;
const bool CODEJAM = 0;

vvi adj;
vector<bool> vis;
vi dp;

int dfs(int u) {
	if(dp[u] != -1) return dp[u];
	int ret = -1;
	vis[u] = 1;
	for(int v : adj[u]) if(not vis[v]) {
		ret = max(ret, dfs(v));
	}
	vis[u] = 0;
	return dp[u] = ret + 1;
}

void solve() {
	int n, m;
	cin >> n >> m;
	adj = vvi(n);
	vis = vector<bool>(n);
	dp = vi(n, -1);
	REP(m) {
		int u, v;
		cin >> u >> v;
		u--; v--;
		adj[u].push_back(v);
	}
	int ans = 0;
	for(int i = 0; i < n; i++) {
		ans = max(ans, dfs(i));
	}
	cout << ans << "\n";
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
	int T = 1;
	if(TESTCASES) cin >> T;
	for(int t = 1; t <= T; t++) {
		if(CODEJAM) cout << "Case #" << t << ": ";
		solve();
	}
	return 0;
}


Measured memory_bytes: 11804
#include<iostream>
#include<cstdio>

struct P{
	double x, y;
};

P pointToVector(P p1, P p2){
	P p = {p2.x-p1.x, p2.y-p1.y};
	return p;
}

double dotProduct(P p1, P p2){
	return p1.x*p2.x+p1.y*p2.y;
}

int main(){
	P ps[4];
	while(std::cin >> ps[0].x >> ps[0].y, !std::cin.eof()){
		for(int i=1;i<4;i++){
			std::cin >> ps[i].x >> ps[i].y;
		}
		P p1 = pointToVector(ps[0], ps[1]), 
			p2 = pointToVector(ps[2], ps[3]);
		if(dotProduct(p1, p2) == 0){
			puts("YES");
		}else{
			puts("NO");
		}
	}
}

Measured memory_bytes: 1184
/*input
10 4
17 13 13 12 15 20 10 13 17 11
*/

//sometimes it's the people who no one imagines anything of 
//who do the things that no one can imagine.

//code author: iamxlr8

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

#define ll long long
#define N 300005

int main() 
{
    ll n,x,k;
    cin>>n>>k;
    queue<ll> q;
    ll s=0;
    ll ans=INT_MIN;
    for(ll i=0;i<n;i++)
    {
        cin>>x;
        s+=x;
        q.push(x);
        if(i<k)
            ans=s;
        if(i>=k)
        {
            s-=q.front();
            q.pop();
            if(s>ans)
                ans=s;
        }
        // cout<<ans<<endl;
    }
    cout<<setprecision(7);
    cout<<((ans+k)*1.0)/(2.0);
    return 0;
}

Measured memory_bytes: 1920
S = input()
A = int(S[:2])
B = int(S[2:])

if 1<=A<=12 and 1<=B<=12:
  print("AMBIGUOUS")
elif 1<=A<=12:
  print("MMYY")
elif 1<=B<=12:
  print("YYMM")
else:
  print("NA")

Measured memory_bytes: 3060
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.HashSet;
import java.util.Random;
import java.util.Set;

public class Main {

    public static void main(String[] args) throws Exception {
        try (BufferedInputStream in = new BufferedInputStream(System.in);
             PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out))) {

            _Scanner sc = new _Scanner(in);
            int n = sc.nextInt();
            Set<String> strs = new HashSet<>();

            for (int i = 0; i < n; i++) strs.add(sc.next());

            out.println(strs.size());
        }
    }

    private static void reverse(int[] vs) {
        for (int i = 0; i < vs.length / 2; i++) {
            swap(vs, i, vs.length - 1 - i);
        }
    }

    static class _Scanner {
        InputStream is;
        _Scanner(InputStream is) {
            this.is = is;
        }
        byte[] bb = new byte[1 << 15];
        int k, l;
        byte getc() {
            try {
                if (k >= l) {
                    k = 0;
                    l = is.read(bb);
                    if (l < 0) return -1;
                }
                return bb[k++];
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        byte skip() {
            byte b;
            while ((b = getc()) <= 32)
                ;
            return b;
        }

        int nextInt() {
            int n = 0;
            int sig = 1;
            for (byte b = skip(); b > 32; b = getc()) {
                if (b == '-') {
                    sig = -1;
                } else {
                    n = n * 10 + b - '0';
                }
            }
            return sig * n;
        }

        long nextLong() {
            long n = 0;
            long sig = 1;
            for (byte b = skip(); b > 32; b = getc()) {
                if (b == '-') {
                    sig = -1;
                } else {
                    n = n * 10 + b - '0';
                }
            }
            return sig * n;
        }

        public String next() {
            StringBuilder sb = new StringBuilder();
            for (int b = skip(); b > 32; b = getc()) {
                sb.append(((char) b));
            }
            return sb.toString();
        }
    }

    private static void shuffle(int[] ar) {
        Random rnd = new Random();
        for (int i = 0; i < ar.length; i++) {
            int j = i + rnd.nextInt(ar.length - i);
            swap(ar, i, j);
        }
    }

    private static void shuffle(Object[] ar) {
        Random rnd = new Random();
        for (int i = 0; i < ar.length; i++) {
            int j = i + rnd.nextInt(ar.length - i);
            swap(ar, i, j);
        }
    }

    private static void swap(int[] ar, int i, int j) {
        int t = ar[i];
        ar[i] = ar[j];
        ar[j] = t;
    }

    private static void swap(Object[] ar, int i, int j) {
        Object t = ar[i];
        ar[i] = ar[j];
        ar[j] = t;
    }


}


Measured memory_bytes: 59920
#include <stdio.h>
int main(){
	int h,w,i,j;
	while(1){
		scanf("%d %d\n",&h,&w);
		if(h==0 && w==0)	break;
		for(i=0;i<h;i++){
			for(j=0;j<w;j++){
				if((i+j)%2==0)	printf("#");
				else	printf(".");

			}
			printf("\n");
		}
		printf("\n");
	}
	return 0;
}



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

using namespace std;

using ll = long long;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;

int main() {
    ll n, m, i, j, k;
    char c;
    cin >> c;
    cout << char(c+1) << endl;
    return 0;
}

Measured memory_bytes: 256
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}
fn main() {
    input!{
        n: u32,
        c: [(u32, u32, u32); n],
    };
    let mut pt:u32 = 0;
    let mut px:u32 = 0;
    let mut py: u32 = 0;
    for (t, x, y) in c{
        let time = t - pt;
        let dist = if x > px { x - px} else { px - x} + if y > py { y - py}  else { py - y};
        if !(time % 2 == dist % 2) || (dist > time){
            println!("No");
            return;
        }
        px = x;
        py = y;
        pt = t;
    }
    println!("Yes");
}


Measured memory_bytes: 8444
sx, sy, tx, ty = map(int, input().split())
dx = tx - sx
dy = ty - sy
ans = "R" * dx
ans += "U" * dy
ans += "L" * dx
ans += "D" * dy
ans += "D"
ans += "R" * (dx + 1)
ans += "U" * (dy + 1)
ans += "L"
ans += "U"
ans += "L" * (dx + 1)
ans += "D" * (dy + 1)
ans += "R"
print(ans)



Measured memory_bytes: 3064
import java.util.Scanner;
public class Main{
	public static void main(String[] args){

	Scanner sc = new Scanner(System.in);

	int n = sc.nextInt();
	int i=1;
	do{
		int x=i;
		if(x%3==0){
					System.out.print(" "+i);
				}else{
					do{
					if(x%10==3){
						System.out.print(" "+i);
						break;
			}
		x/=10;
		}while(x!=0);
	}

	}while(++i <= n);
		System.out.println();	
}
}

Measured memory_bytes: 28828
from functools import reduce
def gcd(x, y): 
  
   while(y): 
       x, y = y, x % y 
  
   return x 
  


def lcm_list(*numbers):
    return reduce(gcd, numbers)

n=int(input())
inp=input().split(" ")
mons=[int(i) for i in inp]
print(lcm_list(*mons))

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

int main() 
{
    int q; cin >> q;
    while (q--) {
        ll a, b; cin >> a >> b;
        if (a > b) swap(a,b);
        if (a == b || a == b-1) {
            cout << (2*a-2) << "\n";
        }
        else {
            ll c = (ll)sqrt(a*b)-3;
            while ((c+1)*(c+1) < a*b)
              c++;
            if (c*(c+1) >= a*b) {
                cout << 2*c-2 << '\n';
            }
            else {
                cout << 2*c-1 << '\n';
            }
        }
    }
}




Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <string>

int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  std::cout.tie(nullptr);
  int n;
  std::cin >> n;
  std::string s;
  std::map<std::string, int> m;
  for (int i = 0; i < n; ++i) {
    std::cin >> s;
    m[s]++;
  }
  std::cout << "AC x " << m["AC"] << "\n"
            << "WA x " << m["WA"] << "\n"
            << "TLE x " << m["TLE"] << "\n"
            << "RE x " << m["RE"];
}

Measured memory_bytes: 3660
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <cassert>
#include <queue>
#include <map>
#include <set>
using namespace std;
using Int = int64_t;
const Int INF = 1<<30;
const Int MOD = (Int)1e9 + 7;
const Int MAX_N = (Int)1e5 + 5;
#define debug(x) cout << #x << ": " << x << endl
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2>& p) { os << p.first << " " << p.second; return os; }
template<typename T>
ostream &operator<<(ostream &os, const vector<T> &v) { for(int i = 0; i < (int) v.size(); i++) os << v[i] << (i + 1 != v.size() ? " " : ""); return os; }

void solve()
{
    int x; cin >> x;
    int ans = 8;
    for(int i = 599; i < 2000; i += 200)
    {
        if(x <= i)
        {
            cout << ans << endl;
            return;
        }
        ans--;
    }
}

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

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

#define MOD (1000000000+7)
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define all(x) x.begin(), x.end()
#define print(vec,l,r) for(int i = l; i <= r; i++) cout << vec[i] <<" "; cout << endl;
#define forf(i,a,b) for(int i = (a); i < (b); i++)
#define forr(i,a,b) for(int i = (a); i > (b); i--)
#define input(vec,N) for(int i = 0; i < (N); i++) cin >> vec[i];

// template starts
typedef long long int ll;

void solve(){
	// code starts from here
	int N;
	cin >> N;
	int d = N%10;
	if(d == 2 || d == 4 || d == 5 || d == 7 || d== 9) cout << "hon"<< endl;
	else if(d == 0 || d == 1|| d == 6 || d == 8) cout << "pon"<< endl;
	else cout << "bon" << endl;
}

int main(){
 	ios_base::sync_with_stdio(false);
    cin.tie(NULL);

	int T;
	T = 1;
	while(T--){
		solve();
	}

	return 0;
}


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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

const int ISPRIME_SIZE=11111111;
bool isprime[ISPRIME_SIZE];
struct isprime_exec{
    isprime_exec(){
        for(int i=0;i<ISPRIME_SIZE;i++)isprime[i]=true;
        isprime[0]=isprime[1]=false;
        for(int i=2;i<ISPRIME_SIZE;i++){
            if(!isprime[i])continue;
            for(int j=i+i;j<ISPRIME_SIZE;j+=i)isprime[j]=false;
        }
    }
}isprimeexec;

signed main(){
    int N,K;

    for(int n=1000;n<=2000;n++){
        int k=1;
        while(k*(k-1)+1<n)k++;
        if(k*(k-1)+1!=n)continue;
        if(!isprime[k-1])continue;
        N=n;K=k;
        break;
    }

    vector<vint>ans;
    rep(i,K){
        vint v;
        v.pb(N-1);
        rep(j,K-1)v.pb(i*(K-1)+j);
        ans.pb(v);
    }

    rep(i,K-1){
        rep(j,K-1){
            vint v;
            v.pb(i);
            int r=j;
            rep(k,K-1){
                v.pb((k+1)*(K-1)+r);
                r=(r+i)%(K-1);
            }
            ans.pb(v);
        }
    }

    cout<<N<<" "<<K<<endl;
    rep(i,ans.size()){
        rep(j,ans[i].size()){
            if(j)cout<<" ";
            cout<<ans[i][j]+1;
        }cout<<endl;
    }
    return 0;
}


Measured memory_bytes: 11776
#include<iostream>
#include<string>

int main(int argc, char const* argv[])
{
	using namespace std;
	
	
		
	int n;
	string s;
	int k;
	cin >> n >> s >> k;

	const char& sk = s[k-1];
	for (auto& c : s) {
		if(sk==c){
		}
		else{
			c='*';
		}
	};
	
	cout << s << endl;
  
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>

using namespace std;

int gcd(int x, int y);

int main()
{
	string str;
	getline(cin, str);
	stringstream ss_size(str);
	
	int ary[2];
	string buff;
	int cnt = 0;
	while (getline(ss_size, buff, ' ')) {
		stringstream ss(buff);
		ss >> ary[cnt];
		cnt++;
	}

	//insert_sort(str, ary_size);
	cout << gcd(ary[0], ary[1]) << endl;
    return 0;
}
int gcd(int x, int y) {
	if (x < y) {
		int tmp = y;
		y = x;
		x = tmp;
	}
	int q = y;
	int r = x % y;

	if (r == 0) {
		// recursive end
		return y;
	}
	return gcd(q, r);
}

Measured memory_bytes: 3196
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,s,t) for(int i = s; i < t ; i++)
#define SZ(a) (int)a.size()

char img[9][5] = {
	{ '.',',','!','?',' ' },
	{ 'a','b','c' },
	{ 'd','e','f' },
	{ 'g','h','i' },
	{ 'j','k','l' },
	{ 'm','n','o' },
	{ 'p','q','r','s' },
	{ 't','u','v' },
	{ 'w','x','y','z' },
};
int in1[9] = { 5,3,3,3,3,3,4,3,4 };

int main() {
	cin.tie(0);
	ios_base::sync_with_stdio(false);
	int Case;
	cin >> Case;
	FOR(kim, 0, Case) {
		string s;
		cin >> s;
		int i = 0;
		while (i != SZ(s)) {
			int co = 0;
			while (s[i] != '0') {
				co++;
				i++;
			}
			if (co) {
				int target = s[i - 1] - '0' - 1;
				int pos = (co - 1) % (in1[target]);
				cout << img[target][pos];
			}
			i++;
		}
		cout << endl;
	}
}


Measured memory_bytes: 3032
a = [list(map(int, input().split())) for _ in range(3)]
n = int(input())
for _ in range(n):
    b = int(input())
    for i in range(3):
        for j in range(3):
            if a[i][j] == b:
                a[i][j] = 0
                break

flag = False
for i in a:
    if sum(i) == 0:
        flag = True
if flag == False:
    for i in range(3):
        if a[0][i] + a[1][i] + a[2][i] == 0:
            flag = True
if flag == False:
    if a[0][0] + a[1][1] + a[2][2] == 0:
        flag = True
    if a[0][2] + a[1][1] + a[2][0] == 0:
        flag = True
if flag:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3064
import java.util.*;
  
public class Main {
    Scanner sc = new Scanner(System.in);
  
    public static void main(String[] args) {
        new Main(); 
    }
  
    public Main() {
        new aoj1110().doIt();
    }
    class aoj1110{
    	TreeSet<String> ts = new TreeSet<String>();
    	ArrayList<String> array = new ArrayList<String>();
    	String pair(String str,int s,int g,int length){
    		if(str.substring(s,s+1).equals(str.substring(g,g+1))){
    			return str.substring(0,s)+str.substring(s+1,g)+str.substring(g+1,length);
    		}
    		return str;
    	}
    	void doIt(){
    		int n = sc.nextInt();
    		for(int i = 0;i < n;i++){
    			String str ="";
    			for(int j = 0;j < 20;j++){
    				str = str+sc.next();
    			}
//    			System.out.println(str);
    			ts.add(str);
    			array.add(str);
    			int min = 20;
//    			System.out.println(array.size());
    			while(array.size() > 0){
//    				System.out.println(array.size());
    				str = array.remove(0);
    				int length = str.length();
    				min = Math.min(min,length);
    				for(int j = 0;j < length;j++){
    					String str2 = "";
    					if(j + 4 < length){
    						str2 = pair(str,j,j+4,length);
    						if(ts.add(str2)){
    							array.add(str2);
    						}
    					}if(j % 4 != 3 && j + 1 < length){
    						str2 = pair(str,j,j+1,length);
    						if(ts.add(str2)){
    							array.add(str2);
    						}
    					}if(j % 4 != 3 && j + 5 < length){
    						str2 = pair(str,j,j+5,length);
    						if(ts.add(str2)){
    							array.add(str2);
    						}
    					}if(j % 4 != 0 && j + 3 < length){
    						str2 = pair(str,j,j+3,length);
    						if(ts.add(str2)){
    							array.add(str2);
    						}
    					}
    				}
    			}
    			ts.clear();
    			System.out.println(min);
    		}
    	}
    }
}

Measured memory_bytes: 42040
#include <stdio.h>

int A,B,C,D,E,F;
int main(){
        scanf("%d %d %d %d %d %d",&A,&B,&C,&D,&E,&F);
        double maxpercent = 0;
        int maxwater = 0, maxsugar=0;
        for(int a = 0; a <= 30; a++){
                for(int b = 0; b <= (F-a*100)/B/100; b++){
                        int water=a*100*A+b*100*B;
                        if(water == 0 || water > F) continue;
                        for(int c = 0; c <= 1500; c++){
                                for(int d = 0; d <= ((water*E/100)-c*C)/D; d++){
                                        int sugar = c*C+d*D;
                                        if(sugar > water*E/100 || sugar+water > F) continue;
                                        if(maxpercent < (double)sugar/(double)(water+sugar)){
                                                 maxpercent = (double)sugar/(double)(water+sugar);
                                                maxwater=water;
                                                maxsugar=sugar;
                                        }
                                }
                        }
                }
        }
        if(maxsugar == 0){printf("%d %d\n",100*A,0);}
        else printf("%d %d\n",maxsugar+maxwater,maxsugar);

}

Measured memory_bytes: 128