akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
  
int main(void) 
{
  int dice[101][6],subdice[6],i,j,k,l,n,a[6],b[6],subA,subB;
  
  scanf("%d",&n);
  
  for(i = 0; i < n; i++)for(j = 0; j < 6; j++)scanf("%d",&dice[i][j]);
 
  for(i = 0; i < n; i++)
  {
    for(j = i + 1; j < n; j++)
    {
      if(dice[i][0] == dice[j][0]);

      else if(dice[i][0] == dice[j][1] || dice[i][0] == dice[j][4])
      {
        for(k = 0; k < 6; k++)
        {
          subdice[0] = dice[j][4];
          subdice[4] = dice[j][5];
          subdice[5] = dice[j][1];
          subdice[1] = dice[j][0];
          subdice[2] = dice[j][2];
          subdice[3] = dice[j][3];

          for(l = 0; l < 6; l++)
          {
            dice[j][l] = subdice[l];
          }
          
          if(dice[i][0] == dice[j][0])break;
        }
      }
      
      else if(dice[i][0] == dice[j][2] || dice[i][0] == dice[j][3] || dice[i][0] == dice[j][5])
      {
        for(k = 0; k < 6; k++)
        {
          subdice[0] = dice[j][2];
          subdice[2] = dice[j][5];
          subdice[5] = dice[j][3];
          subdice[3] = dice[j][0];
          subdice[1] = dice[j][1];
          subdice[4] = dice[j][4];
          
          for(l = 0; l < 6; l++)
          {
            dice[j][l] = subdice[l];
          }

          if(dice[i][0] == dice[j][0])break;
        }
      }
      for(k = 0; k < 4; k++)
      {
        subdice[1] = dice[j][2];
        subdice[2] = dice[j][4];
        subdice[4] = dice[j][3];
        subdice[3] = dice[j][1];
        for(l = 1; l < 5; l++)
        {
            dice[j][l] = subdice[l];
        }

        if(dice[i][1] == dice[j][1])
        {
          if(dice[i][0] == dice[j][0] && dice[i][2] == dice[j][2] && dice[i][3] == dice[j][3] && dice[i][4] == dice[j][4] && dice[i][5] == dice[j][5])
          {
            printf("No\n");
            return 0;
          }
        }
      }
    }
  }
  if(i == n && j == n)printf("Yes\n");
  return 0;
}


Measured memory_bytes: 2112
#include<bits/stdc++.h>
using namespace std;
int main(){
  string A,B,C;
  cin>>A>>B>>C;
  string ANS="ANS";
  ANS.at(0)=A.at(0)-'a'+'A';
  ANS.at(1)=B.at(0)-'a'+'A';
  ANS.at(2)=C.at(0)-'a'+'A';
  cout<<ANS<<endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

class Main{
    public static void main(String[] args) {
        int res = 700;
        Scanner sc = new Scanner(System.in);
        String input = sc.nextLine();
        for (int i=0; i<3; i++){
            if (input.charAt(i) == 'o')res += 100;
        }

        System.out.println(res);
        
        sc.close();

    }
}

Measured memory_bytes: 21716
#include <bits/stdc++.h>
#define inf 0x3f3f3f3f
using namespace std;
const int N=1e6+10;
char s[N];
int n,m;
struct _SA{
	#define For(i,a,b) for(int i=a;i<=b;i++)
	#define Rof(i,a,b) for(int i=a;i>=b;i--)
	int sa[N],rk[N],ht[N];
	int h[N],y[N],st[N][22];
	inline void getsa()
	{
		m=150;
	    For(i,0,m)h[i]=0;
	    For(i,1,n)rk[i]=y[i]=0;
	    For(i,1,n)++h[rk[i]=s[i]];
	    For(i,2,m)h[i]+=h[i-1];
	    Rof(i,n,1)sa[h[rk[i]]--]=i;
	    int p=0;
	    for(int i=1;p<=n&&i<=n;i<<=1,m=p){
	        p=0;
	        For(j,n-i+1,n)y[++p]=j;
	        For(j,1,n)if(sa[j]>i)y[++p]=sa[j]-i;
	        For(j,0,m)h[j]=0;
	        For(j,1,n)++h[rk[y[j]]];
	        For(j,1,m)h[j]+=h[j-1];
	        Rof(j,n,1)sa[h[rk[y[j]]]--]=y[j];
	        swap(rk,y);
	        p=1;rk[sa[1]]=1;
	        For(j,2,n)
	            rk[sa[j]]=(y[sa[j-1]]==y[sa[j]] && y[sa[j-1]+i]==y[sa[j]+i]?p:++p);
	    }
	}
	inline void getht(){
		For(i,1,n)rk[sa[i]]=i;int k=0;
		For(i,1,n){
			k=k?k-1:0;int j=sa[rk[i]-1];
			while(s[i+k]==s[j+k]&&i+k<=n&&j+k<=n)k++;
			ht[rk[i]]=k;
		}
		ht[0]=0;
        For(i,1,n)st[i][0]=ht[i];
        For(j,1,21)for(int i=1;i+(1<<j)-1<=n;++i)
           	st[i][j]=min(st[i][j-1],st[i+(1<<(j-1))][j-1]);
	}
    inline int lcp(int i,int j){//排名[i-1,j]的最长公共前缀
    	if(i-1>j)return inf;
        int x=log2(j-i+1);
        return min(st[i][x],st[j-(1<<x)+1][x]);
    }
}SA;
priority_queue<int,vector<int>,less<int> >q;
bool check(int x,int k) { 
    while(!q.empty()) q.pop();
    for(int i=1;i<=n+1;i++) {
        if(SA.ht[i]<x) {
            int mi=1e9;
            int gs=0;
            while(!q.empty()) {
                int now=q.top();
                q.pop();
                if(mi>now+x-1) mi=now,gs++;
            }
            if(gs>=k) return 1;
        }
        q.push(SA.sa[i]);
    }
    return 0;
}
int k;
int main()
{
    scanf("%d",&n);
  	k=2;
    scanf("%s",s+1);
    SA.getsa();
    SA.getht();
    //for(int i=1;i<=n;i++) cout<<SA.sa[i]<<endl;
    //for(int i=1;i<=n;i++) cout<<SA.ht[i]<<endl;
    int l=1,r=n/k;
    int ans=0;
    while(l<=r) {
        int mid=(l+r)/2;
        if(check(mid,k)) {
            l=mid+1;
            ans=mid;
        }else {
            r=mid-1;
        }
    }
    printf("%d\n",ans);
}

Measured memory_bytes: 14592
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

X = int(input())
dp = [0]*(X+1)
dp[0] = 1
for i in range(1, X+1):
    for yen in range(100, 106):
        if yen<=i:
            if dp[i-yen]==1:
                dp[i] = 1
if dp[X]:
    print(1)
else:
    print(0)

Measured memory_bytes: 41324
#include<bits/stdc++.h>
#define mp make_pair
#define f first
#define s second
#define VAL 100000
#define ll long long
const int MAX=1e5+8;
using namespace std;
vector<int>adj[MAX];
int vis[MAX];
int cnt[MAX];
int main() 
{ 
	//ios_base::sync_with_stdio(false);
  //  cin.tie(NULL);
//	#ifndef ONLINE_JUDGE
//	freopen("inp.txt" ,"r", stdin );
//	freopen("out.txt", "w", stdout);
//	#endif
	long long int a;
	cin>>a;
	long long int ans=0;
	ans=(a/500);
	ans=ans*1000;
	a=a%500;
	ans=ans+((a/5)*5);
	cout<<ans;
}

Measured memory_bytes: 2560
#include <iostream>
using namespace std;
 
 
int main() {
  int N;
  int d[110] = {0};
  
  cin >> N;
  for(int i=0; i< N; ++i) cin >> d[i];
  
  int num[110] = {0};
  for(int i=0;i<N;++i){
  	num[d[i]]++;
  }
  
  int res = 0;
  for (int i =1 ;i <= 100;++i){
  	if(num[i]){
      ++res;
    }
  }
  cout << res << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <map>
#include <unordered_map>
#include <list>
#include <set>
#include <unordered_set>
#include <vector>
#include <utility>
#include <algorithm>
#include <queue>
#include <cstdint>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <cmath>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

constexpr ll inf = INT64_MAX / 4;
constexpr double pi = asin(1) * 2;
constexpr ll mod = 1000000007;


ll mpow(ll base, ll power) {
    if (power == 0) return 1;
    ll t = mpow(base, power / 2);
    return (t * t * (power % 2 ? base : 1)) % mod;
}

int main() {
    int n, k;
    cin >> n >> k;
    int m = ((n - 1) * (n - 2)) / 2;
    if (k > m) {
        cout << -1 << endl;
        return 0;
    }
    vector<pair<int, int>> v;
    for (int i = 0; i < n - 1; i++) {
        v.emplace_back(1, i + 2);
    }
    int c = m - k;
    for (int i = 2; i <= n; i++) {
        for (int j = i + 1; j <= n; j++) {
            if (c == 0) {
                i = j = n + 1;
                continue;
            }
            v.emplace_back(i, j);
            c--;
        }
    }
    cout << v.size() << '\n';
    for(auto&e:v) cout << e.first << ' ' << e.second << '\n';
}


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

int main() {
  int h,w,d; cin>>h>>w>>d;
  vector<vector<int>> a(h, vector<int>(w));
  rep(i, h) rep(j, w) cin>>a[i][j];
  int q; cin>>q;
  vector<int> l(q),r(q);
  rep(i, q) cin>>l[i]>>r[i];

  int x[90001];
  int y[90001];
  rep(i, h) {
    rep(j, w) {
      x[a[i][j]] = i;
      y[a[i][j]] = j;
    }
  }
  vector<int> ans(h*w+1);
  rep(i, h*w+1) {
    if (i<=d) continue;
    int cost = abs(x[i-d]-x[i])+abs(y[i-d]-y[i]);
    ans[i]=ans[i-d]+cost;
  }
  rep(i, q) printf("%d\n", ans[r[i]]-ans[l[i]]);
  return 0;
}


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

#define REP(i, x, n) for (int i = x; i < (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x.size())
#define popcount(x) __builtin_popcount(x)
#define popcountll(x) __builtin_popcountll(x)
#define uniq(x) x.erase(unique(x.begin(), x.end()), x.end())
#define F first
#define S second
#define mp make_pair
#define eb emplace_back
#define pii pair<int, int>
#define pll pair<ll, ll>

using namespace std;

typedef long long ll;

/* --- INFやMODの値が適切か確認する --- */
// const int INF = 1 << 30;
// const ll INF = 1LL << 60;
// const ll MOD = 1000000007;

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

  int ans = 0;

  rep(i, n) {
    int j = i;
    while (j < n && a[j] == a[i]) j++;
    ans += (j - i) / 2;
    i = j - 1;
  }

  cout << ans << endl;
}


Measured memory_bytes: 256
/**
 *      ABC 42 C
 *      author  : kyomukyomupurin
 *      created : 2018-10-04 00:02:38
**/

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

bool included(int_fast32_t N, int_fast32_t x){
    while (N > 0){
        if (N % 10 == x) return true;
        else N /= 10;
    }
    return false;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int_fast32_t N, K; cin >> N >> K;
    int_fast32_t D[K] = {};
    for (auto i = 0; i < K; ++i) {
        cin >> D[i];
    }

    int_fast32_t ans = 1;

    for (auto i = 0; i < 100000; ++i) {
        bool flag = true;
        for (auto x : D){
            if (included(ans, x)) flag = false;
        }
        if (flag && ans >= N){
            cout << ans << '\n'; return 0;
        }
        else ++ans;    
    }
  
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(){
  int cnt=0,n,i,q,A[100000],j;
  scanf("%d",&n);
  for(i=0;i<n;i++)scanf("%d",&A[i]);
  q=A[n-1];
  for(i=0;i<n;i++){
    if(A[i]<=q){
      j=A[i];
      A[i]=A[cnt];
      A[cnt]=j;
      cnt++;
    }
  }
  for(i=0;i<n;i++){
    if(cnt-1==i)printf("[%d]",A[i]);
    else printf("%d",A[i]);
    if(i!=n-1)printf(" ");
    else printf("\n");
  }
  return 0;
}



Measured memory_bytes: 2144
#include <iostream>

using namespace std;

int main(void){

  int n;
  while( cin >> n , n ){

    while(n--){

      int pm,pe,pj;
      cin >> pm >> pe >> pj;

      if( pm == 100 || pe == 100 || pj == 100 ){
	cout << "A" << endl;
	continue;
      }
      if( (pm + pe) / 2 >= 90 ){
      	cout << "A" << endl;
	continue;
      }
      if( ( pm + pe + pj ) / 3 >= 80 ){
	cout << "A" << endl;
	continue;
      }
      if( ( pm + pe + pj ) / 3 >= 70 ){
	cout << "B" << endl;
	continue;
      }
      if( ( pm + pe + pj ) / 3 >= 50 && ( pm >= 80 || pe >= 80 ) ){
	cout << "B" << endl;
	continue;
      }
      cout << "C" << endl;
    }
  }
  return 0;
}

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

#define rep(i,n) for(int i=0; i<(n); i++)
#define reps(i,x,n) for(int i=x; i<(n); i++)
#define rrep(i,n) for(int i=(n)-1; i>=0; i--)
#define all(X) (X).begin(),(X).end()
#define X first
#define Y second
#define pb push_back
#define eb emplace_back

using namespace std;
typedef long long int ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

template<class A, size_t N, class T> void Fill(A (&a)[N], const T &v){ fill( (T*)a, (T*)(a+N), v ); }

template<class T> ostream& operator<<(ostream &os, const vector<T> &t) {os<<"{"; rep(i,t.size()) {os<<t[i]<<",";} os<<"}"; return os;}
template<class T,size_t n> ostream& operator<<(ostream &os, const array<T,n> &t) {os<<"{"; rep(i,n) {os<<t[i]<<",";} os<<"}"; return os;}
template<class S, class T> ostream& operator<<(ostream &os, const pair<S,T> &t) { return os<<"("<<t.first<<","<<t.second<<")";}

const ll INF = 1e9+7;


int main(){
	ios_base::sync_with_stdio(false);
	double N, M, D;
	double ans=0;

	cin >> N >> M >> D;

	double sum = max(0.0, N-D) * 2.0;
	if( D == 0 ) sum = N;
	ans = sum/N/N * (M-1);

	printf("%.10f\n", ans);

	return 0;
}

Measured memory_bytes: 256
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

fn main() {
    let v = read_vec::<usize>();
    let (n, _) = (v[0], v[1]);
    let mut channels = Vec::new();
    for _ in 0..n {
        let v = read_vec::<u64>();
        channels.push((v[0], v[1], v[2]));
    }
    channels.sort();
    let mut recorders: Vec<(u64, u64)> = Vec::new();

    'outer: for (s, t, c) in channels {
        for recorder in recorders.iter_mut() {
            if (*recorder).0 <= s && (*recorder).1 == c {
                *recorder = (t, c);
                continue 'outer;
            }
            if (*recorder).0 < s {
                *recorder = (t, c);
                continue 'outer;
            }
        }
        recorders.push((t, c));
    }
    println!("{}", recorders.len());
}


Measured memory_bytes: 9336
import sys
def input(): return sys.stdin.readline().strip()


def main():
    n, k = map(int, input().split())
    ans = 0
    if k != 0:
        for b in range(k, n + 1):
            q, r = n // b, n % b
            ans += (b - k) * q + max(0, r - k + 1)
    else:
        ans = n**2
    print(ans)

if __name__ == "__main__":
    main()


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

int main() {
	long A, B, K;
	long ScoreA, ScoreB;
	cin >> A >> B >> K;
	if (A >= K) {
		ScoreA = A - K;
		ScoreB = B;
	} else if (A + B > K) {
		ScoreA = 0;
		ScoreB = B - K + A;
	} else {
		ScoreA = 0;
		ScoreB = 0;
	}
  cout << ScoreA << "\n" << ScoreB << endl;
}


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

using namespace std;

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

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define CHMIN(a,b) a=min((a),(b))
#define CHMAX(a,b) a=max((a),(b))

int h,w,k;
char a[830][830];
int dx[] = {1,0,-1,0};
int dy[] = {0,1,0,-1};
int dist[830][830];

int main(){
  scanf("%d%d%d",&h,&w,&k);
  REP(i,h)scanf("%s",a[i]);
  int sy,sx;
  REP(i,h)REP(j,w)if(a[i][j]=='S'){
    sy = i;
    sx = j;
    a[sy][sx] = '.';
  }
  const int INF = 830252521;
  REP(i,h)REP(j,w)dist[i][j] = INF;
  queue<pii> Q;
  Q.push(pii(sy,sx));
  dist[sy][sx] = 0;
  while(!Q.empty()){
    pii P = Q.front(); Q.pop();
    int y = P.first;
    int x = P.second;
    int dd = dist[y][x]+1;
    REP(d,4){
      int ny = y+dy[d];
      int nx = x+dx[d];
      if(ny<0 || nx<0 || ny>=h || nx>=w)continue;
      if(a[ny][nx]=='#')continue;
      if(dist[ny][nx]<=dd)continue;
      dist[ny][nx] = dd;
      if(dd<k)Q.push(pii(ny,nx));
    }
  }
  int ans = INF;
  REP(i,h)REP(j,w){
    if(dist[i][j]==INF)continue;
    CHMIN(ans,(i+k-1)/k);
    CHMIN(ans,(j+k-1)/k);
    CHMIN(ans,(h-1-i+k-1)/k);
    CHMIN(ans,(w-1-j+k-1)/k);
  }
  printf("%d\n",ans+1);
  return 0;
}


Measured memory_bytes: 3456
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>

int main(void) {
	int a, b;
	scanf("%d %d", &a, &b);
	if (a > b) {
		for (int i = 1; i <= a;i++)
			printf("%d", b);

	}
	else {
		for (int i = 1; i <= b; i++)
			printf("%d", a);
	}
	return 0;
}

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

int main(){
  int N,Y;
  cin >> N >> Y;
  for(int i=0; i<=N; i++){
    for(int j=0; j<=N; j++){
      if(N-i-j>=0){
      if(10000*i+5000*j+1000*(N-i-j)==Y){
        cout << i << " " << j << " " << N-i-j << endl;
        return 0;
      }
      }
    }
  }
  cout << "-1 -1 -1" << endl;
      
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <functional>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <cassert>
#include <exception>
#include <numeric>
using namespace std;
typedef long long ll;
typedef string str;
typedef pair<ll, ll> P;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<char> vc;
typedef vector<str> vs;
typedef vector<P> vp;
typedef vector<bool> vb;
#define rep(i, a, n) for (ll i = (a); i < (n); ++i)
#define rrep(i, a, n) for (ll i = (a); i > (n); --i)
#define erep(i, a, n) for (ll i = (a); i <= (n); ++i)
#define rerep(i, a, n) for (ll i = (a); i >= (n); --i)
#define all(c) (c).begin(), (c).end()
#define pb push_back
#define mp make_pair
#define sz(x) ((int)x.size())
#define max(X) *max_element(all(X))
#define min(X) *min_element(all(X))
#define print(X) cout << (X) << "\n"
#define _ << " " <<
#define Yes print("Yes")
#define No print("No")
static const int INF = 1e+9+7;

int main(){
  str n;
  cin >> n;
  rep(i,0,3){
    if(n[i] == '9') n[i] = '1';
    else if(n[i] == '1') n[i] = '9';
  }

  print(n);

  return 0;
}


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

#define rep(i,j,n) for(int i=j;i<n;++i)
#define all(i) i.begin(),i.end()
#define rall(i) i.rbegin(), i.rend()
#define INF 1e9
#define LINF 1e18
const int mod = 1e9 + 7;

typedef long long i64;
typedef pair<int, int> pi;

template <class T> using vt = vector<T>;
template <class T> using vvt = vector<vector<T>>;

i64 gcd(i64 n, i64 m) {return (m == 0? n : gcd(m, n % m));}
i64 lcd(i64 n, i64 m) {return (n / gcd(n, m) * m);}
int dx[] = {1, 0, -1, 0};
int dy[] = {0, 1, 0, -1};

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

  string s, t;
  cin >> s >> t;

  vvt<int> dp(s.size() + 1, vt<int>(t.size() + 1, 0));
  rep(i, 0, s.size()) {
    rep(j, 0, t.size()) {
      if(s[i] == t[j]) dp[i + 1][j + 1] = max(dp[i + 1][j + 1], dp[i][j] + 1);
      dp[i + 1][j + 1] = max(dp[i + 1][j + 1], max(dp[i + 1][j], dp[i][j + 1]));
    }
  }

  string ans = "";
  int i = s.size(), j = t.size();
  while(i > 0 && j > 0) {
    if(dp[i - 1][j] == dp[i][j]) --i;
    else if(dp[i][j - 1] == dp[i][j]) --j;
    else {
      ans = s[i - 1] + ans;
      --i; --j;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 35584
import math
a, b, x = map(int, input().split())
if a ** 2 * b / 2 <= x:
    f = 2 * (a ** 2 * b - x) / a ** 3
    print(math.degrees(math.atan(f)))
else:
    f = 2 * x / (b ** 2 * a)
    print(90 - math.degrees(math.atan(f)))

Measured memory_bytes: 3060
#include<cstdio>
#include<iostream> 
using namespace std; 
int main(){ 
char a; 

while(1){ 
 scanf("%c",&a);
  if(isalpha(a)){ 
   if(islower(a))cout<<(char)toupper(a);
   else if(isupper(a))cout<<(char)tolower(a);
 }else{
  cout<<a;
 } 
if(a=='\n')break; 
} 

return 0;
} 

 



Measured memory_bytes: 3144
#include <bits/stdc++.h>
using namespace std;
const int maxn = 200200;
int alive[maxn], tot[2][maxn];
vector<int> e[maxn];
int main(){
	int n, m; cin >> n >> m;
	string s; cin >> s;
	for(auto & c : s) c -= 'A';
	for(int i = 0; i < m; i++){
		int x, y; cin >> x >> y; x--; y--;
		e[x].push_back(y);
		e[y].push_back(x);
		tot[s[x]][y]++;
		tot[s[y]][x]++;
	}
	auto getVal = [&](int x){
		int ans = 0;
		if(tot[0][x] > 0) ans += 1;
		if(tot[1][x] > 0) ans += 2;
		return ans;
	};
	set<pair<int,int> > nodes;
	for(int i = 0; i < n; i++){
		alive[i] = 1;
		nodes.insert({getVal(i), i});
	}
	while(!nodes.empty()){
		auto v = *nodes.begin(); nodes.erase(nodes.begin());
		if(v.first == 3) {
			nodes.insert(v);
			break;
		}
		alive[v.second] = 0;
		for(auto nxt : e[v.second]){
			if(alive[nxt]){
				nodes.erase({getVal(nxt), nxt});
				tot[s[v.second]][nxt]--;
				nodes.insert({getVal(nxt), nxt});
			}
		}
	}
	if(nodes.empty()) cout << "No" << endl;
	else cout << "Yes" << endl;
	return 0;
}


Measured memory_bytes: 21636
use std::collections::HashMap;

fn main() {
    let (n, k): (usize, usize) = {
        let mut line = String::new();
        std::io::stdin().read_line(&mut line).unwrap();
        let mut iter = line.split_whitespace();
        (
            iter.next().unwrap().parse().unwrap(),
            iter.next().unwrap().parse().unwrap(),
        )
    };

    let a: Vec<u32> = {
        let mut buf = String::new();
        std::io::stdin().read_line(&mut buf).unwrap();
        buf.split_whitespace().map(|x| x.parse().unwrap()).collect()
    };

    let mut cs: Vec<u32> = vec![0; n + 1];

    for i in 0..n {
        cs[i + 1] = (cs[i] + a[i] - 1) % k as u32;
    }

    let mut map: HashMap<u32, u64> = HashMap::new();

    let mut ans: u64 = 0;

    for (i, x) in cs.iter().enumerate() {
        if i >= k {
            let count = map.entry(cs[i - k]).or_insert(0);
            *count -= 1;
        }

        let count = map.entry(*x).or_insert(0);
        ans += *count;
        *count += 1;
    }

    println!("{}", ans);
}

Measured memory_bytes: 18964
#include <stdio.h>
int main() {
    int n, count, ans = 0, num, cnt;
    scanf("%d", &n);
    for (int i = 105; i <= n; i += 2) {
        count = 1;
        num = i;
        for (int j = 3; j <= i; j++) {
            cnt = 0;
            while (num % j == 0) {
                num /= j;
                cnt++;
            }
            count *= cnt + 1;
        }
        if (count == 8) {
            ans++;
        }
    }
    printf("%d\n", ans);
	return 0;
}

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

using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int n;
    string s;
    cin >> n >> s;
    auto ok = [&](string x, string y) {
        const int MAX = 26;
        vector<int> a(MAX, 0), b(MAX, 0);
        for (char c : x) {
            ++a[c - 'a'];
        }
        for (char c : y) {
            ++b[c - 'a'];
        }
        int res = 0;
        for (int i = 0; i < MAX; i++) {
            res += (a[i] && b[i]);
        }
        return res;
    };
    int ans = 0;
    for (int i = 0; i < n; i++) {
        string foo = s.substr(0, i + 1);
        string bar = s.substr(i + 1, n - i);
        ans = max(ans, ok(foo, bar));
    }
    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 256
# sys.stdin.readline
import collections
import sys

input = sys.stdin.readline


class AtCoder:
    def main(self):
        N = int(input())
        a = list(map(int, input().split()))

        cnt = collections.Counter(a)

        ans = 0
        for x in range(10 ** 5 + 1):
            ans = max(ans, cnt[x - 1] + cnt[x] + cnt[x + 1])
        print(ans)


# Run main
if __name__ == '__main__':
    AtCoder().main()

Measured memory_bytes: 57436
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>
#define speedX ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
using namespace std;
#define ONLINE_JUDGE
#ifndef ONLINE_JUDGE
template<typename T>
void __p(T a) { cout << a << " "; }
template<typename T, typename F>
void __p(pair<T, F> a) { cout << "{ "; __p(a.first); __p(a.second); cout << "}"; }
template<typename T>
void __f(const char* s, T t) { cout << s << " : "; __p(t); }
template<typename T>
void __t(const char* s, const T &x) { cout << s << " : { "; for (auto it : x) __p(it); cout << "} ";}
template<typename T, typename ... F>
void __f(const char* s, T t, F ... f) {
	int i = 0; for (;; ++i) if (s[i] == ',') break;
	cout.write(s, i) << " : "; __p(t); cout << " | "; __f(s + i + 1, f...);
}
#define trace(...) { cout<<"LINE: "<<__LINE__<<" || "; __f(#__VA_ARGS__,__VA_ARGS__); cout<<"\n\n"; }
#define debug(...) { cout<<"LINE: "<<__LINE__<<" || "; __t(#__VA_ARGS__,__VA_ARGS__); cout<<"\n\n"; }
int begtime = clock();
#define end_time() cout << "\n\nTime of execution: " << (clock() - begtime)*1000/CLOCKS_PER_SEC << " ms\n\n";
#else
#define trace(...)
#define debug(...) 
#define end_time()
#endif
 
 
#define int long long 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<pii, int> piii;
typedef vector<int> vi;
typedef vector<pii> vii;

inline bool equals(ld a, ld b) {return fabs(a - b) < 1e-9;}
inline int gcd(int a, int b) { a=abs(a); b=abs(b); while(a>0 && b>0) (a>b?a%=b:b%=a); return (a==0?b:a); } 
inline int power(int x, int n, int m = LLONG_MAX)
    {  int res=1; x = (x%m + m)%m;
       while(n) { if(n&1) res=(res*x)%m;  x=(x*x)%m;  n >>= 1; }  return res;
    }
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define ff first
#define ss second
#define uset unordered_set
#define umap unordered_map
#define all(x) x.begin(), x.end()
#define mod 1000000007
vector<int> v;
int ans = 0;
int n, m, q;
vector<pair<pii,pii>> queries;
int check(){
	int tmp = 0;
	for(auto query : queries){
		int a = query.ff.ff - 1;
		int b = query.ff.ss - 1;
		int c = query.ss.ff;
		int d = query.ss.ss;
		if(v[b]-v[a]==c) tmp+=d;
	}
	return tmp;
}
void go(int idx, int prev){
	if(idx>=n){
		int tmp = check();
		ans = max(ans,tmp);
		debug(v);
		trace(tmp);
		return;
	}
	for(int i = prev; i<=m; i++){
		v.pb(i);
		go(idx+1,i);
		v.pop_back();
	}
	return;
}
void solve(){
	// exit(0);
	v.clear();
	queries.clear();
	cin>>n>>m>>q;
	trace(n,m,q);
	for(int i = 0; i<q; i++){
		int a,b,c,d;
		cin>>a>>b>>c>>d;
		queries.pb(mp(mp(a,b),mp(c,d)));
	}
	go(0,1);
	cout<<ans<<"\n";
}
signed main(){
	speedX;
	#ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
	int t=1;
	//cin>>t;
	for(int i=1;i<=t;++i) {
		//cout<<"Case #"<<i<<": ";
		solve();
	}
	end_time();
	return 0;
}


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

const ll INF = 1001001001;

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

ll f(ll x){
  if(x==1) return 1;
  return f(x/2)*2+1;
}

//再起関数でとく

int main(){
  
  ll h; cin>>h;
  cout<<f(h)<<endl;
  return 0;

  
  
  
}



Measured memory_bytes: 256
from collections import deque
h,w = map(int,input().split())
s_input = [list(input()) for i in range(h)]

mx = [0,0,1,-1]
my = [1,-1,0,0]

ans = 0
for i in range(h):
    for j in range(w):
        if s_input[i][j]=='#':
            continue
        queue = deque()
        queue.append([j,i])

        visited = [[-1]*w for i in range(h)]
        visited[i][j]=0

        res = 0
        while queue:
            x,y = queue.popleft()
            for k in range(4):
                nx = x+mx[k]
                ny = y+my[k]
                if 0<=nx<w and 0<=ny<h:
                    if visited[ny][nx]!=-1:
                        continue
                    if s_input[ny][nx]=='#':
                        continue
                    visited[ny][nx]=visited[y][x]+1
                    queue.append([nx,ny])
                    res = max(res,visited[ny][nx])
        ans = max(ans,res)
print(ans)

Measured memory_bytes: 3316
def examA():
    S = {0:"pon",1:"pon",2:"hon",3:"bon",4:"hon",5:"hon",6:"pon",7:"hon",8:"pon",9:"hon"}
    N = SI()
    ans = S[int(N[-1])]
    print(ans)
    return

def examB():
    ans = 0
    print(ans)
    return

def examC():
    ans = 0
    print(ans)
    return

def examD():
    ans = 0
    print(ans)
    return

def examE():
    ans = 0
    print(ans)
    return

def examF():
    ans = 0
    print(ans)
    return

import sys,bisect,itertools,heapq,math,random
from copy import deepcopy
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def I(): return int(input())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet,_ep
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
_ep = 10**(-12)
alphabet = [chr(ord('a') + i) for i in range(26)]

sys.setrecursionlimit(10**7)

if __name__ == '__main__':
    examA()

"""
142
12 9 1445 0 1
asd dfg hj o o
aidn
"""

Measured memory_bytes: 76556
#include <iostream>
#include <string>
#include <vector>
#include <climits>
#include <algorithm>
#include <set>
#include <unordered_map>
#include <queue>
#include <iomanip>
#include <map>
#include <utility>

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

using namespace std;
int mod = 1000000007;

int sx, sy, tx, ty;

int main() {
  cin >> sx >> sy >> tx >> ty;
  int x = tx-sx;
  int y = ty-sy;

  rep(i, y) {
    cout << 'U';
  }
  rep(i, x) {
    cout << 'R';
  }
  rep(i, y) {
    cout << 'D';
  }
  rep(i, x) {
    cout << 'L';
  }

  cout << 'D';
  rep(i, x+1) {
    cout << 'R';
  }
  rep(i, y+1) {
    cout << 'U';
  }
  cout << 'L';

  cout << 'U';
  rep(i, x+1) {
    cout << 'L';
  }
  rep(i, y+1) {
    cout << 'D';
  }
  cout << 'R';
}


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

using namespace std;

const int N = 2018;

int a[N];

int main() {
  int n, k, q;
  scanf("%d %d %d", &n, &k, &q);
  vector<int> va;
  for (int i = 0; i < n; ++i)
    scanf("%d", a+i), va.push_back(a[i]);
  sort(va.begin(), va.end());
  va.erase(unique(va.begin(), va.end()), va.end());
  int ans = va.back() - va[0];
  for (int mi : va) {
    vector<int> pq;
    int j = 0;
    for (int i = 0; i < n; ++i) {
      if (a[i] < mi) {
        if (j < i && i-j >= k) {
          vector<int> now;
          for (int z = j; z < i; ++z) {
            now.push_back(a[z]);
          }
          sort(now.begin(), now.end());
          for (int z = 0; z <= i-j-k; ++z)
            pq.push_back(now[z]);
        }
        j = i+1;
      }
    }
    if (j < n && n-j >= k) {
      vector<int> now;
      for (int z = j; z < n; ++z) {
        now.push_back(a[z]);
      }
      sort(now.begin(), now.end());
      for (int z = 0; z <= n-j-k; ++z)
        pq.push_back(now[z]);
    }
    if (pq.size() >= q) {
      sort(pq.begin(), pq.end());
      ans = min(ans, pq[q-1] - pq[0]);
    }
  }
  printf("%d\n", ans);
  return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <ctime>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>

using namespace std;

#ifdef _MSC_VER
#define __typeof__ decltype

template <class T>
int __builtin_popcount(T n) { return n ? 1 + __builtin_popcount(n & (n - 1)) : 0; }
#endif

#define foreach(it, c) for (__typeof__((c).begin()) it=(c).begin(); it != (c).end(); ++it)
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define popcount __builtin_popcount

template <class T> void get_max(T& a, const T b) { a = max(a, b); }
template <class T> void get_min(T& a, const T b) { a = min(a, b); }

const double EPS = 1e-10;
typedef long long ll;
typedef pair<int, int> pint;


int m;
void solve()
{
	int cx[256], cy[256];
	for (int i = 0; i < m; ++i)
		scanf("%d%d", cx + i, cy + i);

	int base_x = cx[0], base_y = cy[0];
	for (int i = 0; i < m; ++i)
		cx[i] -= base_x, cy[i] -= base_y;

	int n, x[1024], y[1024];
	map<int, set<int> > memo;
	scanf("%d", &n);
	for (int i = 0; i < n; ++i)
	{
		scanf("%d%d", x + i, y + i);
		memo[x[i]].insert(y[i]);
	}

	for (int i = 0; i < n; ++i)
	{
		bool found = true;
		for (int j = 1; j < m && found; ++j)
			if (!memo[x[i] + cx[j]].count(y[i] + cy[j]))
				found = false;
		if (found)
		{
			printf("%d %d\n", x[i] - base_x, y[i] - base_y);
			return;
		}
	}
}
int main()
{
	while (scanf("%d", &m), m)
	{
		solve();
	}
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
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 ll INF = 1LL << 60;

int main(){
    int a, b;
    cin >> a >> b;
    if(b%a==0){
        cout << a+b << endl;
        return 0;
    }
    else{
        cout << b-a << endl;
        return 0;
    }
}

Measured memory_bytes: 3636
#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() {
  ll n;
  cin>>n;
  string res ="";
  while(n>0){
    n--;
    res += (char)('a'+(n%26));
    n/=26;
  }
  reverse(res.begin(),res.end());
  cout<<res<<endl;
}

Measured memory_bytes: 3612
N, M = map(int,input().split())
L = []
for _ in range(M):
    m = tuple(map(int,input().split()))
    L.append(m)

if(N == 1): lower = 0
else:       lower = 10 ** (N - 1)

for ans in range(lower, 10 ** N ):
    ans = str(ans) 
    for x in L:
        if ans[x[0] - 1] != str(x[1]):
            break
    else: #一度もbreakされてない == 矛盾なし
        print(ans)
        exit()
#ねえよ
print(-1)



Measured memory_bytes: 3064
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;

//No Story
public class Main{
	
	int[] c;
	int n, res;
	
	void dfs(int k, int r){
		if(k==n){
			res+=r; return;
		}
		for(int i=0;i<c[k];i++)dfs(k+1, r);
		dfs(k+1, r*(c[k]+1));
	}
	
	void run(){
		Scanner sc = new Scanner(System.in);
		int N = 1000000;
		boolean[] p = new boolean[N+1];
		Arrays.fill(p, true);
		p[0]=p[1]=false;
		List<Integer> l = new ArrayList<Integer>();
		for(int i=2;i<=N;i++)if(p[i]){
			l.add(i);
			for(int j=i+i;j<=N;j+=i)p[j]=false;
		}
		for(;;){
			long L = sc.nextLong();
			if(L==0)break;
			c = new int[100];
			n = 0;
			int i = 0;
			while(L!=1&&i<l.size()){
				long x = l.get(i);
				if(L%x==0){
					while(L!=1&&L%x==0){
						c[n]++;
						L/=x;
					}
					n++;
				}
				i++;
			}
			if(i==l.size()){
				c[n] = 1; n++;
			}
			res = 0;
			dfs(0, 1);
			System.out.println(++res>>1);
		}
	}
	
	public static void main(String[] args) {
		new Main().run();
	}
}

Measured memory_bytes: 15000
use proconio::*;
#[allow(unused_imports)]
use proconio::marker::{Bytes, Chars};
use std::*;

#[allow(dead_code)]
const MOD: i128 = 100_000_007;

#[fastout]
fn main() {
    input!{
        a : i64,
        b : i64,
        c : i64,
        k : i64
    }
    let ans = if a >= k {
        k
    } else if a + b >= k {
        a
    } else {
        a - (k - a - b)
    };
    println!{"{}",ans};
}


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

int main(){
  string S, T;
  cin >> S >> T;
  int length = S.size();

  int result = 0;
  if(S == T){
    result = 1;
  }else{
    for(int i=1; i<length; i++){
      if( (S.substr(i) +  S.substr(0, i) ) == T){
        result = 1;
        break;
      }
    }
  }

  if(result == 1){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;    
  }
  return 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    
    int a = sc.nextInt();
    int b = sc.nextInt();
    
    if (a >= 13) {
      System.out.println(b);
    } else if (a <= 12 && a >= 6) {
      System.out.println(b / 2);
    } else {
      System.out.println(0);
    }
  }
}

Measured memory_bytes: 21844
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef vector<int> vi;
typedef pair<int,int> ii;
int main()
{
	int n;
	cin>>n;
	ll t=0ll;
	ll a[n];
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
	}
	sort(a,a+n,greater<ll>());
	ll ans = a[0];
	int p = 2;
	for(int i=1;p<n;i++)
	{
		ans += a[i];
		p++;
		if(p==n)	break;
		ans += a[i];
		p++;
	}
	cout<<ans;
}


Measured memory_bytes: 5144
import java.util.*;
import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.util.Arrays;
import java.util.List;
import java.util.ArrayList;
import java.util.ArrayDeque;
import java.util.Deque;
import java.util.Collections;
import java.awt.Point;


public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] nm = br.readLine().split(" ");
        int n = Integer.parseInt(nm[0]);
        int m = Integer.parseInt(nm[1]);
        
        AB[] abs = new AB[n];
        for (int i = 0; i < n; i++) {
            String[] sab = br.readLine().split(" ");
            int a = Integer.parseInt(sab[0]);
            int b = Integer.parseInt(sab[1]);
            AB ab = new AB();
            ab.a = a;
            ab.b = b;
            abs[i] = ab;
        }
        
        Arrays.sort(abs, new Comparator<AB>(){
            public int compare(AB ab1, AB ab2){
              return ab1.a - ab2.a;
            }
        });
        
        long cost = 0;
        int tobuy = m;
        for (int i = 0; i < n; i++) {
            if (abs[i].b <= tobuy) {
                cost += (long)abs[i].a*abs[i].b;
                tobuy -= abs[i].b;
            }
            else {
                cost += (long)abs[i].a*tobuy;
                break;
                //tobuy -= abs[i].b;
            }
        }
        System.out.println(cost);
    }
}

class AB {
    int a;
    int b;
}



Measured memory_bytes: 47216
#include <bits/stdc++.h>
using namespace std;
int a[5000];
int main()
{
    int n;
    while(~scanf("%d",&n))
    {
        long long sum=0;
        for(int i=1;i<=n;i++)
        {
            scanf("%d",&a[i]);
            sum+=a[i]-1;
        }
        printf("%lld\n",sum);
    }
}


Measured memory_bytes: 256
import java.util.Scanner;
class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt(), i = 1;
		while(true){
			if((n*i)%2==0){
				break;
			}
			i+=1;
		}
		System.out.println(n*i);
	}
}

Measured memory_bytes: 22736
#ifdef _DEBUG
#define _CRT_SECURE_NO_WARNINGS
#include "MyLib.h"
#else
#define main_B main
#include "bits/stdc++.h" 
#include <regex>
#define _USE_MATH_DEFINES
#include <math.h>
#define FOR(i,s,e) for (int i = int(s); i < int(e); ++i)
#define REP(i,e) FOR(i,0,e)
#define INF (INT_MAX/2)
#define EPS (1.0e-8)
#define MGN 8
#define LINF (LONG_MAX/2)
using namespace std;
typedef long long ll; typedef unsigned long long ull;
typedef vector<int> vi; typedef vector<vi> vvi; 
typedef vector<ll> vl; typedef vector<vl> vvl;
typedef vector<double> vd; typedef vector<string> vs;
typedef pair<int, int> pii; typedef pair<ll, ll> pll;
typedef vector<bool> vb; typedef vector<vb> vvb;
template <typename T>
using keyVal = pair<string, T>;
template<typename T>
bool val_greater(const keyVal<T>& left, const keyVal<T>& right) {
    return left.second > right.second;}
vs split(string str, char sep) {
    vs v; stringstream ss(str); string t;
    while (getline(ss, t, sep)) v.push_back(t);
    return v;}
vs re_search_g(string s, regex re) {
    vs ret; smatch mc; auto it = s.cbegin();
    while (regex_search(it, s.cend(), mc, re)) {
        ret.push_back(mc[0]);
        it += mc.position(0) + mc.length();}
    return ret;}
#endif

void init_global_B() {}


int main_B() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    string S; cin >> S;
    int N = S.size();

    string ans = "";
    for(int i=0; i<N; i+=2) {
        ans += S[i];
    }

    cout << ans << endl;

    return 0;
}

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

	char a;
	int cnt = 0;
	rep(i,4) {
		cin >> a;
		if (a=='2') {
			cnt++;
		}
	}
	cout << cnt << endl;
	return 0;
}



Measured memory_bytes: 256
# !/usr/bin/python3

"""
https://atcoder.jp/contests/abc151/tasks/abc151_c
Welcome at atcoder
"""


if __name__ == "__main__":
    n, m = list(map(int, input().split()))

    accepted = [False for _ in range(n+5)]
    wrong = [0 for _ in range(n+5)]
    ac = wa = 0

    for _ in range(m):
        p, s = input().split()
        p = int(p)

        if accepted[p]: continue
        elif s == "WA": wrong[p] += 1
        elif s == "AC":
            ac += 1
            wa += wrong[p]
            accepted[p] = True

    print(f"{ac} {wa}")



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

int main() {

	string a, b;
	cin >> a >> b;
	int con = stoi(a + b);

	for (int i = 1; i <= 1000; i++) {
		if (con == i*i) {
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;

	return 0;
}

Measured memory_bytes: 256
# coding: utf-8
import collections

N=int(input())
A=list(map(int,input().split()))

C=collections.Counter(A)

d=0

sA=list(set(A))

for i in range(len(C)):
    d+=C[sA[i]]-1

eat_num=-(-d//2)

ans=N-eat_num*2

print(ans)

Measured memory_bytes: 21084
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const int maxn=1e6+5;
vector<ll> V;
int pre[maxn];
int main() {
    int x;cin>>x;
    if(x>=30) puts("Yes");
    else puts("No");
    return 0;
}

Measured memory_bytes: 3632
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <utility>

#define REP(i,n) for(int i=0;i<n;i++)

typedef long long ll;
using namespace std;

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

  vector<ll> a;
  vector<ll> t;

  REP(i, n) {
    int _a, _t;
    cin >> _a, cin >> _t;
    a.push_back(_a);
    t.push_back(_t);
  }

  // 0 - (N-1)
  ll pa = 1, pt = 1; // 少なくとも1票
  REP(i, n) {
    if (i == 0) {
      pa = a[i];
      pt = t[i];
      continue;
    }

    // TLE, TODO
    int j = 2;
    ll cnt = 1;
    ll na = a[i], nt = t[i];
    if ( (na < pa) || (nt < pt) ) {
      ll x, y;
      if (pa % na == 0) {
        x = pa / na;
      } else {
        x = (ll)(pa / na) + 1;
      }
      if (pt % nt == 0) {
        y = pt / nt;
      } else {
        y = (ll)(pt / nt) + 1;
      }
      cnt = max(x, y);
    }
    // while ( (na < pa) || (nt < pt) ) {
    //   na = a[i] * j, nt = t[i] * j;
    //   j++;
    // }

    pa = na * cnt;
    pt = nt * cnt;
  }

  cout << pa + pt << endl;

  return 0;
}

/*
3
2 3
1 1
3 2

10
------------
5
3 10
48 17
31 199
231 23
3 2

6930
*/

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
using namespace std;
int n,a;
double ans=0.0;
int main(){
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>a;
		ans+=((1/(double)a));
	}
	ans=(1/ans);
	printf("%lf",ans);
	cout<<"\n"; 
	return 0;
}

Measured memory_bytes: 256
S = input()
T = input()
new = list(S)
main = list(T)

thelist = []

for i in range(len(new)):
    if len(new[i:i+len(main)]) < len(main):
        break
    thelist += [new[i:i+len(main)]]

counter = 0

for lists in thelist:
    second_counter = 0
    for i in range(len(main)):
        if main[i] != lists[i]:
            second_counter += 1
    if counter == 0:
        counter = second_counter
    elif second_counter < counter:
        counter = second_counter

print(counter)


Measured memory_bytes: 10636
package main

import "fmt"

func main() {
	var n, a, b int
	fmt.Scan(&n, &a, &b)

	var ans int

	var tmp int

	tmp = a - b
	if tmp < 0 {
		tmp *= -1
		a = b
		b -= tmp
	}

	tmp2 := b
	if n-a+1 < tmp2 {
		tmp2 = n - a + 1
	}

	if tmp%2 == 1 {
		ans = tmp/2 + tmp2
	} else {
		ans = tmp / 2
	}
	fmt.Println(ans)
}


Measured memory_bytes: 512
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define irep(it, stl) for(auto it = stl.begin(); it != stl.end(); it++)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout << (ans) << '\n'
#define STI(s) atoi(s.c_str())
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int;
template <class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;} return 0;}
template <class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;} return 0;}
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);}};
const int INF = INT_MAX;
const ll LLINF = 1LL<<60;
const ll MOD = 1000000007;
const double EPS = 1e-9;



int main(void) {
    
    int n;
    cin>>n;
    vi c(n),s(n),f(n);
    rep(i,n-1)cin>>c[i]>>s[i]>>f[i];
    
    for(int i=0;i<n;i++){
        ll ans=0;
        for(int now=i;now<n-1;now++){
            ll nextt = max(0.0,ceil((ans-s[now])/(double)f[now]));
            nextt = nextt*f[now] + s[now];
            ans=nextt;
            ans+=c[now];
            // if(i==0){
            //     cout<<now<<endl;
            //     cout<<nextt<<endl;
            //     cout<<ans<<endl;
            //     cout<<endl;
            // }
        }
        fin(ans);
    }
}


Measured memory_bytes: 256
/*
ID: rchalam1
LANG: C++14
TASK:
*/
// For train.usaco.org, fill the template above.

// Competitive Coding Template

// GCC OPTIMIAZTION FLAGS
#ifdef ONLINE_JUDGE
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#endif

#include <bits/stdc++.h>

/*
#include <fstream>
#include <iostream>
#include <string>
#include <vector>
*/
// All Includes for Competitive Coding Template

using namespace std;

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

using vi = std::vector<int>;
using vll = std::vector<long long>;
using vull = std::vector<unsigned long long>;

#define FOR(i, a, b) for (auto i = (a); i < (b); ++i)
#define F0R(i, a) FOR(i, 0, a)
#define ROF(i, a, b) for (auto i = (a); i >= (b); --i)
#define R0F(i, a) ROF(i, a, 0)
#define ITR(a, x) for (auto& a: x)

#define FSRT(set) sort((set).begin(),(set).end())
#define RSRT(set) sort((set).rbegin(),(set).rend())
#define CSRT(set, function) sort((set).begin(),(set).end(), (function))
#define TRS(set) sort((set).begin(),(set).end(), greater<>())
#define REV(set) reverse((set).begin(),(set).end());

#define ALL(set) (set).begin(), (set).end()

#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
#define ff first
#define ss second

// For stdio, call setIO() or setIO("").
void setIO(std::ifstream &readFile, std::ofstream &writeFile, const std::string &name = "", bool stdIO = false)
{
	std::ios_base::sync_with_stdio(false);
	std::cin.tie(nullptr);
	std::cout.tie(nullptr);
	if(!name.empty() && !stdIO)
	{
		readFile.open(name + ".in");
		if(readFile.fail()) return;
		writeFile.open(name + ".out");
		std::cin.rdbuf(readFile.rdbuf());
		std::cout.rdbuf(writeFile.rdbuf());
	}
}

// To time program, create object Timer  to start timing, and call Timer.elapsed().
#include <chrono>

class Timer
{
	std::chrono::time_point<std::chrono::high_resolution_clock> m_beg;
public:
	Timer() : m_beg(std::chrono::high_resolution_clock::now())
	{}

	void reset()
	{ m_beg = std::chrono::high_resolution_clock::now(); }

	[[nodiscard]] long double elapsed() const
	{
		return std::chrono::duration_cast<std::chrono::duration<long double, std::ratio<1> >>(
				std::chrono::high_resolution_clock::now() - m_beg).count();
	}
};

// Defines datatype
using dt = int;
// Defines MAXN value
constexpr dt MAXN = 1e5 + 1;
// Defines Modulus
constexpr dt MOD = 1e9 + 7;
// Defines Floating Point Correction
constexpr long double EPS = 1e-9;

//*****
//START CODE BELOW
//*****

int main(int argc, char *argv[])
{
	static std::ifstream readFile;
	static std::ofstream writeFile;
	setIO(readFile, writeFile);
	int n, d, x;
	cin >> n >> d >> x;
	while(n--)
	{
		int a;
		cin >> a;
		for(int i = 1; i <= d; i += a, ++x);
	}
	cout << x << '\n';
}

Measured memory_bytes: 3608