akhauriyash/Code-Regression huggingface dataset:
import math
import functools
import itertools
import numpy as np
import sys
MAX_INT = int(10e10)
MIN_INT = -MAX_INT
mod = 1000000007
sys.setrecursionlimit(1000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

# Union-Find #
def init(n):
    for i in range(N):
        par[i]=i
        rnk[i]=0
def find(x):
    if par[x]==x:
        return x
    else:
        par[x]=find(par[x])
        return par[x]
def unite(x,y):
    x=find(x)
    y=find(y)
    if x==y:
        return
    if (rnk[x]<rnk[y]):
        par[x]=y
    else:
        par[y]=x
        if(rnk[x]==rnk[y]):
            rnk[x]+=1
def same(x,y):
    return find(x)==find(y)

N,M = IL()
ab = [IL() for i in range(M)]

cnt = 0
for k in range(M):
    par=[0 for i in range(N)]
    rnk=[0 for i in range(N)]
    init(N)
    for i in range(M):
        if k == i:
            continue
        else:
            a,b = ab[i]
            unite(a-1,b-1)
    tmp = find(0)
    for i in range(1,N):
        if tmp == find(i):
            continue
        else:
            cnt += 1
            break
print(cnt)

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

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


Measured memory_bytes: 3084
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int INF = 1e9;
const int MOD = 1e9 + 7;

int main()
{
  int n;
  cin>>n;
  vector<int>a(n);
  for(auto&e:a)cin>>e;
  int sum=0;
  for(int i=0;i<n;++i)
  {
    sum+=a[i];
  }
  double ave=1.0*sum/n;
  int itr=0;
  for(int i=0;i<n;++i)
  {
    if(abs(1.0*a[itr]-ave)>abs(1.0*a[i]-ave))
    {
      itr=i;
    }
  }
  cout<<itr<<endl;

  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
using namespace std;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 2000000000
bool dead[1001];
int n,m;
int main(){
	while(scanf("%d %d",&n,&m) && n){
		memset(dead,0,sizeof(dead));
		int b=1;
		for(int y=0;y<n-1;y++){
			int cou=0;
		for(int i=b;;i++){
			int r=i%n; if(!r) r=n;
			if(!dead[r]){
				cou++;
				if(cou==m){
					dead[r]=true;
					b=i+1;
					break;
				}
			}
		}
		}
		for(int i=1;i<=n;i++){
			if(!dead[i]){
				printf("%d\n",i);
			}
		}
	}
}

Measured memory_bytes: 1188
N = int(input())
STATUS_LIST = []
count_ac = 0
count_wa = 0
count_tle = 0
count_re = 0

for i in range(N):
    status = input()
    if status == "AC":
        count_ac += 1
    if status == "WA":
        count_wa += 1
    if status == "TLE":
        count_tle += 1
    if status == "RE":
        count_re += 1

print("AC x {}".format(count_ac))
print("WA x {}".format(count_wa))
print("TLE x {}".format(count_tle))
print("RE x {}".format(count_re))

Measured memory_bytes: 74780
#include <bits/stdc++.h>
using namespace std;
int main () {
  long N;
  cin >> N;
  vector<long> data;
  for(int i = 1; i <= 9; i++)data.push_back(i);
  long pl = 0, a;
  while(data.size() < 100000){
    a = data.at(pl) % 10;
    if(a == 0){
      data.push_back(data.at(pl) * 10 + a);
      data.push_back(data.at(pl) * 10 + a + 1);
    } else if(a == 9){
      data.push_back(data.at(pl) * 10 + a - 1);
      data.push_back(data.at(pl) * 10 + a);
    } else {
      data.push_back(data.at(pl) * 10 + a - 1);
      data.push_back(data.at(pl) * 10 + a);
      data.push_back(data.at(pl) * 10 + a + 1);
    }
    pl++;
  }
  cout << data.at(N - 1) << endl;
}

Measured memory_bytes: 1400
import java.util.Scanner;

public class Main {
	public static void main(String [] args){
		//????????£?????????????????????
		Scanner sc = new Scanner(System.in);
		//??£?¨?
		char temp; //char????????????????????´???
		int [] table = new int[26]; //??¢?????????????????????26???????????¨?????????
		//??°?????????
		while(sc.hasNext()){
			//?????????(??±???)?????????
			String line = sc.nextLine();
			//??¨???????????????????°???????????????´
			String lower = line.toLowerCase();
			//?????????????????????
			for(int i =0; i < lower.length(); i++){
				//?°??????????char????????????
				temp = lower.charAt(i);
				//System.out.print(temp+ " ");
				//??¢??????????????????????°???????????????°????????????
				if('a' <= temp  && temp  <= 'z'){
					table[temp - 'a']++;
				}
			}
		}
		//???????????????????????°?????????
		for(int i = 0; i < table.length; i++){
			//?????£??????????????´ a : ??????????????° ??¨???
			System.out.println( (char )('a' + i)+ " : "+ table[i]);
		}
	}
}

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

int main() {
  int N,a,b;
  cin >> N >> a;
  b = N % 500;
  if (a > b || b == 0) {
    cout << "Yes" << endl;
  }
 else {
   cout << "No" << endl;
  }
}



Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include <vector>

using namespace std;
int main()
{
  int n,m;
  for(;cin>>n>>m,n;)
    {
      int s[m],ss[m];
      for(int j=0;j<m;j++)
	s[j]=0,ss[j]=j+1;
      
      for(int i=0;i<n;i++)
	for(int j=0;j<m;j++)
	  {
	    int t;
	    cin>>t;
	    s[j]+=t;
	  }
      
      for(int i=0;i<m;i++)
	for(int j=i+1;j<m;j++)
	  {
	    if(s[i]<s[j] || (s[i]==s[j] &&ss[i]>ss[j]))
	      {
	    int x;
	    x=s[i];
	    s[i]=s[j];
	    s[j]=x;
	    x=ss[i];
	    ss[i]=ss[j];
	    ss[j]=x;
	      }
	  }
      for(int j=0;j<m;j++)
	{
	  cout<<ss[j];
	  if(j==m-1)
	    cout<<endl;
	  else
	    cout<<" ";
	}
    }
}

Measured memory_bytes: 1160
#include<iostream>
#include<string>
using namespace std;
int main(){
  string str;
  int ab[26]={};
  int i;
  while(getline(cin,str)){
    for(i=0;i<str.size();i++){
      if(str[i]>='a'&&str[i]<='z') ab[str[i]-'a']++;
      else if(str[i]>='A'&&str[i]<='Z') ab[str[i]-'A']++;
    }
  //cout << str << endl;
  }
  for(i=0;i<26;i++){
    cout << (char)('a'+i) << " : " << ab[i] << endl;
  }
  return 0;
}



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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
//const ull mod = 1e9 + 7;
const ll mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

// debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

template<class S, class T> ostream& operator << (ostream& os, const pair<S, T> v){
  os << "(" << v.first << ", " << v.second << ")"; return os;
}
template<class T> ostream& operator << (ostream& os, const vector<T> v){
  for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << " ";} os << v[i];} return os;
}
template<class T> ostream& operator << (ostream& os, const vector<vector<T>> v){
  for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os;
}
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; }

// conversion number to bit
string num2bit(ll num, ll len){
  string bit = "";
  REP(i, len){
    bit += char('0'+(num>>i & 1));
  }
  return bit;
}

ll dp[101010][13];

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

    string S;
    cin >> S;
    ll N = S.size();

    dp[0][0] = 1;
    REP(i, N){
    	REP(j, 13){
    		if(S[i] == '?'){
    			REP(k, 10){
    				ll ndx = (j*10+k)%13;
    				dp[i+1][ndx] += dp[i][j];
    				dp[i+1][ndx] %= mod;
    			}
    		}else{
    			ll ndx = (j*10+(S[i]-'0'))%13;
    			dp[i+1][ndx] += dp[i][j];
    			dp[i+1][ndx] %= mod;
    		}
    	}
    }

    cout << dp[N][5] << endl;
    return 0;
}

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

// 型定義
typedef long long ll;
typedef pair<ll, ll> P;

// forループ
#define REP(i,n) for(ll i=0; i<(ll)(n); ++i)

// 定数宣言
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

// グラフ表現
using Graph = vector<vector<int>>;

// グラフの辺表現
using Edge = map<pair<int,int>,int>;

// n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

// 最大公約数
ll gcd(ll a,ll b){
   if (a%b == 0) return(b);
   else return(gcd(b, a%b));
}

// 最小公倍数
ll lcm(ll a, ll b){
    return a*b/gcd(a, b);
}

int main()
{
    cout << fixed << setprecision(15);
    ll A, B, N;
    cin >> A >> B >> N;

    ll x;
    ll ans = 0;
    x = B-1;
    ll count = 0;
    while(x <= N){
        ll a = (A*x)/B;
        ll t = x/B;
        ll b = A*t;
        ans = max(ans, a-b);
        x = x+B;
        count++;
        if(count >= 100000) break;
    }
    ll a = (A*N)/B;
    ll t = N/B;
    ll b = A*t;
    ans = max(ans, a-b);

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3528
#include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <string.h>

using namespace std;

int main() {
  int x;
  cin >> x;
  if(x == 0) cout << 1 << endl;
  else if(x == 1) cout << 0 << endl;
  return 0;
}

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

int main()
{
    string s;
    cin >> s;

    string ans;

    if(s[s.size() - 1] == 's'){
        ans = s + "es";
    }
    else{
        ans = s + "s";
    }
    
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3632
N = int(input())
A = [list(map(int, input().split())) for i in range(N)]
MOD = 10 ** 9 + 7
dp = [0] * (1<<N)
dp[0] = 1
for i in range(1, 1<<N):
    cnt = bin(i).count("1")
    for j in range(N):
        if (i>>j)&1 == 0: continue
        dp[i] += dp[i - (1<<j)] * A[cnt-1][j]
        dp[i] %= MOD
print(dp[-1])


Measured memory_bytes: 90404
#include <cstdio>

const int MAXN = 3e3+3;

double dp[MAXN][MAXN];
int n;
double p[MAXN];

int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    scanf("%lf", p+i);
  }

  dp[0][0] = 1 - p[0];
  dp[0][1] = p[0];
  for (int i = 1; i < n; ++i) {
    dp[i][0] = (1-p[i])*dp[i-1][0];
  }

  for (int i = 1; i < n; ++i) {
    for (int j = 1; j <= n; ++j) {
      dp[i][j] = p[i] * dp[i-1][j-1] + (1 - p[i]) * dp[i-1][j];
    }
  }

  double sol = 0;
  for (int i = n/2+1; i <= n; ++i) {
    sol += dp[n-1][i];
  }

  printf("%.10f\n", sol);
  return 0;
}


Measured memory_bytes: 70528
#include<iostream>
using namespace std;
int N,D[100][2];
main()
{
	cin>>N;
	for(int i=0;i<N;i++)cin>>D[i][0]>>D[i][1];
	for(int i=0;i+2<N;i++)
	{
		if(D[i][0]==D[i][1]&&D[i+1][0]==D[i+1][1]&&D[i+2][0]==D[i+2][1])
		{
			cout<<"Yes"<<endl;
			return 0;
		}
	}
	cout<<"No"<<endl;
}


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

int main(void){
  int A, B, C;
  cin >> A >> B >> C;
  int login = 0, cnt = 0;
  while(1){
    cnt++;
    login += A;
    if(cnt % 7 == 0)
      login += B;
    if(login >= C)
      break;
  }
  cout << cnt << "\n";
  return 0;
}


Measured memory_bytes: 3120
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <cmath>
#define REP(i,n) for(int i=0;i<(n);++i)
using namespace std;
using ll = long long;
constexpr int INF = 1e9;
constexpr int MOD = 1e9 + 7;
template<class T> inline void chmax(T &a,T b){if(a<b)a=b;}
template<class T> inline void chmin(T &a,T b){if(a>b)a=b;}


int main(){
    cin.tie(0); ios_base::sync_with_stdio(false);
    int R,G; cin >> R >> G;
    cout << G*2-R << endl;
    return 0;
}

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

int main()
{
	int n;
	cin >> n;
	vector<int> x(n), y(n);
	for (int i = 0; i < n; i++) {
		cin >> x[i] >> y[i];
	}
	vector<vector<int>> dp(n + 1, vector<int>(n + 1, INT_MAX));
	vector<vector<int>> deg(n + 1, vector<int>(n + 1));
	for (int i = 0; i < n; i++) dp[i][i + 1] = 0, deg[i][i + 1] = i;
	for (int l = 2; l <= n; l++) {
		for (int i = 0; i + l <= n; i++) {
			int j = i + l;
			for (int k = max(i + 1, deg[i][j - 1]); k <= min(j - 1, deg[i + 1][j]); k++) {
				int val = dp[i][k] + dp[k][j] + (x[k] - x[i]) + (y[k - 1] - y[j - 1]);
				if (val < dp[i][j]) {
					dp[i][j] = val;
					deg[i][j] = k;
				}
			}
		}
	}
	cout << dp[0][n] << endl;
	return 0;
}



Measured memory_bytes: 10672
#include<bits/stdc++.h>
    #define ll  long long
    #define speed_up    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    #define rep(i,a,b)  for(ll i=a;i<b;i++)
    #define per(i,a,b)  for(ll i=b-1;i>=a;i--)
    #define pb push_back
    #define Max(x,y,z) max(x,max(y,z))
    #define f first
    #define s second
    #define lbd lower_bound
    #define sz(x)       (ll)x.size()
    #define pi 3.1415926536
    #define mod 1000000007
    #define MOD 998244353
    #define maxi 100000000000000000
    using namespace std;
    const int N=5005;
/*    vector<ll> adj[N];
    bool real_vis[N];
    ll dfs(ll x,bool vis[],bool rec[])
{   //cout<<x<<" ";
    vis[x]=1;
    rec[x]=1;
    for(auto y:adj[x])
        if(!vis[y] && dfs(y,vis,rec)) return true;
        else if(rec[y]) return true;
    rec[x]=false;
    return false;
}*/
    /*bool isprime(ll x)
    {
        for(ll i=2;(i*i)<=x;i++)
        {
            if(x%i==0) return 0;
        }
        return 1;
    }*/
    /*ll power(ll x,ll n)
    {
        ll res=1;
        while(n>0){
        if(n%2) res=(res*x)%mod;
        x=(x*x)%mod;
        n=n/2;}
        return res;
    }*/
    void solve()
    {
                ll n,m,z,h,a,b,c,d,e,x=0,y=0;
                cin>>n;
                ll ar[n-1];
                rep(i,0,n-1) cin>>ar[i];
                ll ans=0;
                rep(i,0,n-2)
                ans+=min(ar[i],ar[i+1]);
                ans+=ar[n-2];
                ans+=ar[0];
                cout<<ans;








    }

            int main()
            {
                speed_up
                ll t=1;
                //cin>>t;
                while(t--)
                    solve();
            }


Measured memory_bytes: 256
#include<stdio.h>

int main(){
  int N;
  char S[100000],t;
  int a,i;
  scanf("%d",&N);
  scanf("%s",S);
  t = S[0];
  a = 1;
  for(i = 1 ; i < N ; i++){
    if(t != S[i]){
      a++;
      t = S[i];
    }
  }
  printf("%d",a);
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<queue>
#include<string>
#include<cmath>
#include<cstdio>
#include<cctype>
#include<cstring>
#include<iomanip>
#include<cstdlib>
#include<ctime>
#include<set>
#include<map>
#include<utility>
#include<vector>
#include<stack>
#include<sstream>
#include<algorithm>
using namespace std;
/****************************/
#define ll long long
#define vi vector<int>
#define pii pair<int,int>
#define vpii vector<pair<int,int> >
#define qi queue<int>
#define mii map<int,int>
#define msi map<string,int>
/****************************/
#define rep(i,n) for(ll i=0;i<(n);i++)
#define rep2(i,n) for(ll i=(n)-1;i>=0;i--)
#define rep3(i,a,n) for(ll i=(a);i<(n);i++)
#define mp make_pair
#define pb push_back
#define st first
#define nd second
#define pi 3.1415926535897932384626433832795
#define zero(n) memset(n,0,sizeof(n));
#define SZ(n) n.size()
#define ss st.st
#define sn st.nd 
/****************************/
using namespace std;

int main() {
    int n, ans = 1e9, i;
    vector <pair<int, int>> v, w;
    map <int, int> mp1, mp2;
    map <int, int>::iterator it;
    
    scanf("%d", &n);
    
    for (i = 0; i < n; i++) {
        int x;
        
        scanf("%d", &x);
        
        if (i % 2 == 0) {
            mp1[x]++;
        } else {
            mp2[x]++;
        }
    }
    
    mp1[1e9] = 0;
    mp2[1e9] = 0;
    
    for (it = mp1.begin(); it != mp1.end(); it++) v.push_back(make_pair(it->second, it->first));
    sort(v.begin(), v.end());
    reverse(v.begin(), v.end());
    
    for (it = mp2.begin(); it != mp2.end(); it++) w.push_back(make_pair(it->second, it->first));
    sort(w.begin(), w.end());
    reverse(w.begin(), w.end());
    
    for (i = 0; i < v.size(); i++) {
        int p = 0;
        
        if (v[i].second == w[0].second) p = 1;
        
        ans = min(ans, n - (v[i].first + w[p].first));
    }
    
    printf("%d\n", ans);
    
    return 0;
}

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

int main(){
    string s;
    cin >> s;
    int n = s.length();
    if(n==1){
        cout << stoi(s) << endl;
    }else if(s.substr(1, n-1) == string(n-1, '9')){
        cout << 9 *(n-1) +(s[0]-'0') << endl;
    }else{
        cout << 9 *(n-1) +(s[0]-'0' -1) << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
  int n;
  cin >> n;

  int a;
  cin >> a;

  int mod;
  mod = n % 500;
  if(mod <= a){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
  return 0;
}


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

int main() {
    int n;
    cin >> n;
    if (n<2) cout << 1 << endl;
    else if (2<=n && n<4) cout << 2 << endl;
    else if (4<=n && n<8) cout << 4 << endl;
    else if (8<=n && n<16) cout << 8 << endl;
    else if (16<=n && n<32) cout << 16 << endl;
    else if (32<=n && n<64) cout << 32 << endl;
    else if (64<=n && n<128) cout << 64 << endl;
    
    return 0;
}

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

using namespace std;
using ll=long long;
using ull=unsigned long long;
using pii=pair<int,int>;

#define INF LONG_MAX
#define MOD 1000000007
#define rng(a) a.begin(),a.end()
#define rrng(a) a.end(),a.begin()

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

  int N,Q;
  cin>>N>>Q;
  vector<vector<int>>e(N);
  for(int i=0;i<N-1;i++){
    int a,b;
    cin>>a>>b;
    a--,b--;
    e[a].push_back(b);
  }
  vector<ll>node(N,0);
  for(int i=0;i<Q;i++){
    int p,x;
    cin>>p>>x;
    p--;
    node[p]+=x;
  }
  queue<pair<int,ll>>q;
  q.push({0,0});
  while(q.size()){
    int now=q.front().first;
    ll num=q.front().second;
    node[now]+=num;
    q.pop();
    for(auto it:e[now]){
      q.push({it,node[now]});
    }
  }
  for(auto it:node)cout<<it<<" ";
  cout<<endl;
  return 0;
}


Measured memory_bytes: 14976
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {
		int N = sc.nextInt();
		if (N == 1) {
			System.out.println(1);
			System.out.println("0");
		} else if (N == 2) {
			System.out.println(2);
			System.out.println("0");
			System.out.println("11");
		} else {
			System.out.println(N - 1);
			for (int i = 2; i <= N; i++) {
				char[] s = new char[i];
				Arrays.fill(s, '1');
				s[0] = s[i - 1] = '0';
				System.out.println(String.valueOf(s));
			}
		}
	}

}


Measured memory_bytes: 27640
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define each(a,x) for(auto a : (x))
#define all(a) (a).begin(),(a).end()
#define chmin(a,b) ((a) = min((a),(b)))
#define chmax(a,b) ((a) = max((a),(b)))
#define in_range(x,l,r) ((l)<=(x) && (x)<(r))
#define fs first
#define sc second
#define pb push_back
#define sz size() 
#define MP make_pair
using namespace std;
typedef long long ll;
typedef double D;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<string> vs;

const static int INF = 1e8;
const static D EPS = 1e-8;

int main(){
  int h,w;
  cin >> h >> w;

  int r=0;
  rep(i,h){
    string s;
    cin >> s;
    int nl=w, nr=0;
    rep(j,w){
      if(s[j] == '#'){
	chmin(nl,j);
	chmax(nr,j);
      }
    }

    if(nl != r){
      cout << "Impossible" << endl;
      return 0;
    }
    r = nr;
  }

  cout << "Possible" << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <deque>
#include <queue>
#include <array>
#include <set>
#include <map>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <cassert>
#include <utility>
#include <functional>
#include <bitset>
#include <cstdint>

using namespace std;
using i64 = int64_t;
using i32 = int32_t;
template<class T, class U> void init_n(vector<T>& v, size_t n, U x) 
{ v = vector<T>(n, x); }
template<class T> void init_n(vector<T>& v, size_t n) { init_n(v, n, T()); }
template<class T> void read_n(vector<T>& v, size_t n, size_t o = 0) 
{ v = vector<T>(n+o); for (size_t i=o; i<n+o; ++i) cin >> v[i]; }
template<class T> void read_n(T a[], size_t n, size_t o = 0)
{ for (size_t i=o; i<n+o; ++i) cin >> a[i]; }
template<class T> T gabs(const T& x) { return max(x, -x); }
#define abs gabs

int main() {
  i64 n = 0;
  cin >> n;
  cout << 180 * (n - 2) << '\n';
  return 0;
}


Measured memory_bytes: 256
import sys
s = sys.stdin.readline().rstrip()
t = sys.stdin.readline().rstrip()

sn = len(s)
tn = len(t)

dp =[[0 for _ in range(tn+1)] for _ in range(sn+1)]

for i in range(sn):
    for j in range(tn):
        if s[i]==t[j]:
            dp[i+1][j+1] =dp[i][j]+1
        else:
            dp[i+1][j+1] = max(dp[i+1][j], dp[i][j+1])
#print(dp)

L =[]
while sn>0 and tn>0:
    if dp[sn][tn] == dp[sn-1][tn]: #縦優先
        sn-=1
    elif dp[sn][tn] == dp[sn][tn-1]:
        tn-=1
    elif dp[sn][tn] == dp[sn-1][tn-1]+1:
        L.append(s[sn-1])
        sn-=1
        tn-=1
        
print(''.join(L[::-1]))

Measured memory_bytes: 119772
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define all(x) x.begin(),x.end()
#define rep(i,j,n) for (long long i = j; i < (long long)(n); i++)
#define _GLIBCXX_DEBUG
#define MOD 1000000007
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; }
//name[i][j]-> vvl name(i,vl(j))
//map<int,int>mp
//余りを切り上げる =>  (a + b - 1) / b 

signed main(){
	int a; cin>>a;
	cout<<(ll)3*a*a<<endl;
	
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    int n, k, i, count = 0;
    scanf("%d %d",&n,&k);
    int a[n];
    for(i=0;i<n;i++)
    {
        scanf("%d",&a[i]);
        if(a[i]>=k)
        {
            count++;
        }
    }
    printf("%d",count);
  return 0;
}


Measured memory_bytes: 512
#include <stdio.h>

int main(void)
{
	int x, y;
	
	while (1) {
		scanf("%d %d", &x, &y);

		if (x == 0 && y == 0) {
			break;
		}


		if (x > y)
			printf("%d %d\n", y, x);
		else
			printf("%d %d\n", x, y);
	}

		return(0);
}


Measured memory_bytes: 2040
/**
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⡀⠀⠀⠀⠀⢀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⡖⠁⠀⠀⠀⠀⠀⠀⠈⢲⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⣼⡏⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢹⣧⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⣸⣿⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⣿⣇⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⣿⣿⡇⠀⢀⣀⣤⣤⣤⣤⣀⡀⠀⢸⣿⣿⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⢻⣿⣿⣔⢿⡿⠟⠛⠛⠻⢿⡿⣢⣿⣿⡟⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⣀⣤⣶⣾⣿⣿⣿⣷⣤⣀⡀⢀⣀⣤⣾⣿⣿⣿⣷⣶⣤⡀⠀⠀⠀⠀
⠀⠀⢠⣾⣿⡿⠿⠿⠿⣿⣿⣿⣿⡿⠏⠻⢿⣿⣿⣿⣿⠿⠿⠿⢿⣿⣷⡀⠀⠀
⠀⢠⡿⠋⠁⠀⠀⢸⣿⡇⠉⠻⣿⠇⠀⠀⠸⣿⡿⠋⢰⣿⡇⠀⠀⠈⠙⢿⡄⠀
⠀⡿⠁⠀⠀⠀⠀⠘⣿⣷⡀⠀⠰⣿⣶⣶⣿⡎⠀⢀⣾⣿⠇⠀⠀⠀⠀⠈⢿⠀
⠀⡇⠀⠀⠀⠀⠀⠀⠹⣿⣷⣄⠀⣿⣿⣿⣿⠀⣠⣾⣿⠏⠀⠀⠀⠀⠀⠀⢸⠀
⠀⠁⠀⠀⠀⠀⠀⠀⠀⠈⠻⢿⢇⣿⣿⣿⣿⡸⣿⠟⠁⠀⠀⠀⠀⠀⠀⠀⠈⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣼⣿⣿⣿⣿⣧⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠐⢤⣀⣀⢀⣀⣠⣴⣿⣿⠿⠋⠙⠿⣿⣿⣦⣄⣀⠀⠀⣀⡠⠂⠀⠀⠀
⠀⠀⠀⠀⠀⠈⠉⠛⠛⠛⠛⠉⠀⠀⠀⠀⠀⠈⠉⠛⠛⠛⠛⠋⠁⠀⠀
 *    author:  Daredevil666
 *    institution: IIT Patna
**/
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define nl cout<<"\n";
#define ll long long int
#define REP(i,a,n) for(i=a;i<=n;i++)
#define F(i,a,b) for(i=a;i<b;i++)
#define RF(i,b,a) for(i=b;i>=a;i--)
#define IOS  ios::sync_with_stdio(false);cin.tie(0);
using namespace std;
const ll mod=1e9+7;
const ll MAXN=100200;
ll i,j,mask,test;
int main()
{
IOS
/*#ifndef ONLINE_JUDGE
   freopen("input.txt","r",stdin);
   freopen("output.txt","w",stdout);
#endif // ONLINE_JUDGE*/
ll n,m;
cin>>n>>m;
vector<ll> v[n+1];
map<pair<ll,ll>,ll > mp;
while(m--)
{
    ll x,y;
    cin>>x>>y;
    if(mp[make_pair(x,y)]==0 && mp[make_pair(y,x)]==0)
    {
        v[x].push_back(y);
        v[y].push_back(x);
        mp[make_pair(x,y)]=1;
        mp[make_pair(y,x)]=1;
    }
}
vector<ll> vis(n+1);
ll maxx=0;
F(j,1,n+1)
{
    if(vis[j]==0)
    {
        queue<ll> q;
        q.push(j);
        vis[j]=1;
        ll cnt=1;
        while(!q.empty())
        {
            ll p=q.front();
            q.pop();
            for(auto x:v[p])
            {
                if(vis[x]==0)
                {
                    vis[x]=1;
                    q.push(x);
                    cnt++;
                }
            }
        }
        maxx=max(maxx,cnt);
    }
}
cout<<maxx;
return 0;
}


Measured memory_bytes: 43692
#!/usr/bin/env python3

A, B, C, X, Y = map(int, input().split())

# ABセット(ABピザ2枚)をi個購入したとき、
# Aをmax(0, X-i)個買い増す必要があり、Bをmax(0, Y-i)個買い増す必要がある。
# 0 <= i <= 10^5 について、全探索し、最小値を求めればよい

price_min = 5000 * 2 * 100000
for i in range(0, 100000+1):
    price = 2*C*i + A * max(0, X-i) + B * max(0, Y-i)
    if price < price_min:
        price_min = price

print(price_min)


Measured memory_bytes: 39536
import java.util.*;
public class Main {
	public static long mod;
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int K = sc.nextInt();
		ArrayDeque<Integer> dq = new ArrayDeque<Integer>();
		for(int i=0;i<N;i++) dq.addLast(sc.nextInt());
		
		long max = 0;
		for(int l=0;l<=K;l++) {
			for(int r=0;r<=K-l;r++) {
				ArrayDeque<Integer> q = dq.clone();
				if(r+l>N) continue;
				int d = K - l - r ;
				int now = 0;
				Queue<Integer> pq = new PriorityQueue<Integer>();
				for (int i=0;i<l;i++) {
					int tmp = q.removeFirst(); 
					now += tmp;
					pq.offer(tmp);
				}
				for (int i=0;i<r;i++) {
					int tmp = q.removeLast();
					now += tmp;
					pq.offer(tmp);
				}
				int t = 0;
				while(t<d && !pq.isEmpty() && pq.peek()<0) {
					now -= pq.poll();
					t++;
				}
				max = Math.max(max, now);
			}
		}
		System.out.println(max);
	}
}

Measured memory_bytes: 24404
#include<bits/stdc++.h>
using namespace std;
#define ll  long long
#define FASTINOUT ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
const ll mod = 1e9+7;
const int N=2e5+9;
int main()
{
    FASTINOUT;
    ll x,k;
    cin>>x>>k;
    x%=k;
    cout<<min(x,k-x)<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<vector>
#include<cmath>
#include<cstdio>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define it ::iterator
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double ESP=1e-10;
using namespace std;
vector<bool>ha(1000010,false);
void hami(vector<bool>& ha,int n){
  if(n*2<=1000000&&!ha[2*n]){ha[2*n]=true;hami(ha,n*2);}
  if(n*3<=1000000&&!ha[3*n]){ha[3*n]=true;hami(ha,n*3);}
  if(n*5<=1000000&&!ha[5*n]){ha[5*n]=true;hami(ha,n*5);}
}
int main(){
  hami(ha,1);
  ha[1]=true;

  int n,m;
  while(cin>>n,n){
    cin>>m;
    int co=0;
    loop(i,n,m+1)if(ha[i])co++;
    cout<<co<<endl;
  }
}

Measured memory_bytes: 1316
while True:
    h, w = map(int, raw_input().split())
    if w == 0 and h == 0:
        break
    tile = []
    for i in range(h):
        tile.append(list(raw_input()))
    x = y = 0
    while True:
        a = tile[y][x]
        tile[y][x] = 0
        if   a == ">": x += 1
        elif a == "<": x -= 1
        elif a == "^": y -= 1
        elif a == "v": y += 1
        elif a == ".": print x,y; break
        else: print "LOOP"; break

Measured memory_bytes: 4308
#include<stdio.h>
int main()
{
	long long int h;
	scanf("%lld", &h);
	int c = 0;
	while (h > 0)
	{
		c++;
		h /= 2;
	}
	long long int ans = 1, v = 2;
	while (c > 0)
	{
		if (c % 2 > 0)
			ans = ans * v;
		v = v * v;
		c /= 2;
	}
	printf("%lld\n", ans - 1);
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
using namespace std;
int main(){
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  int dac = max(a-c, c-a);
  int dab = max(a-b, b-a);
  int dbc = max(b-c, c-b);
  if (dac <= d) cout << "Yes" << endl;
  else if (dab <= d && dbc <= d) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


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

#define pb push_back
#define eb emplace_back

typedef long long ll;
typedef unsigned long long ull;

using namespace std;



void one_case() {
    int n;
    cin >> n;
    cout << 1 - n << "\n";

}


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

    int t = 1;
//    cin >> t;
    while (t--) one_case();
    return 0;
}


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

int main() {
	long long n,k,i,j,mod=998244353;
	cin >> n >> k;
	
	vector<pair<long,long>> d(k);
	for(j=0; j<k; j++){
		cin >> d[j].first >> d[j].second;
	}
	
	vector<long long> ans(n+1+100000,0),cur(n+1+100000,0);
	long long l,r,res;
	
	res=1;
	for(i=1; i<n; i++){
		for(j=0; j<k; j++){
			l=d[j].first; r=d[j].second+1;
			if(i+l>n){
				l=n+1-i;
			}
			if(i+r>n){
				r=n+1-i;
			}
			cur[i+l]+=res; cur[i+r]-=res;
		}
		ans[i+1]=(ans[i]+cur[i+1])%mod;
		res=(ans[i]+cur[i+1])%mod;
	}
	
	ans[n]%=mod;
	if(ans[n]<0){
		ans[n]+=mod;
	}
	cout << ans[n] << endl;
	return 0;
}

Measured memory_bytes: 7952
#include <bits/stdc++.h>
#define N 1006
using namespace std;
int x[N],y[N],z[N],n,m,ans,f[N][N];
int main()
{
	scanf("%d%d",&n,&m);
	memset(f,60,sizeof f);
	for(int i=1;i<=n;i++)f[i][i]=0;
	for(int i=1;i<=m;i++){
		scanf("%d%d%d",&x[i],&y[i],&z[i]);
		f[x[i]][y[i]]=f[y[i]][x[i]]=z[i];
	}
	for(int k=1;k<=n;k++)
		for(int i=1;i<=n;i++)if(k!=i)
			for(int j=1;j<=n;j++)if(j!=i&&j!=k&&f[i][j]>f[i][k]+f[k][j])
				f[i][j]=f[i][k]+f[k][j];
	for(int i=1;i<=m;i++)if(f[x[i]][y[i]]<z[i])ans++;
	printf("%d\n",ans);
}

Measured memory_bytes: 4224
#include <iostream>
#include <string> 
#include <vector> 
#include <algorithm> 
#include <utility> 
#include <tuple> 
#include <cstdint> 
#include <cstdio> 
#include <map> 
#include <queue> 
#include <set> 
#include <stack> 
#include <deque> 
#include <unordered_map> 
#include <unordered_set> 
#include <bitset> 
#include <cctype> 
#include <math.h>
#include <cmath>
using namespace std;

#define int long long
#define endl "\n"
#define all(v)  v.begin(),v.end()
#define fir first
#define sec second
#define fro front
#define m_p make_pair
#define rep(i,n)  for(int i=0; i<(int) (n); i++)
#define vecin(v) for(int i=0; i<(int)v.size(); i++)cin>>v[i];

const int mod = 1000000007;
const int INF = 2000000015;
const int MAX = 510000;
const int MOD = 1000000007;
long long fac[MAX], finv[MAX], inv[MAX];
int jousu(int x00, int y00) {
	int z00 = 1;
	for (int i = 0; i < y00; i++) {
		z00 *= x00;
	}
	return z00;
}
int keta(int x00) {
	int z00 = x00;
	int w00 = 0;
	while (z00 != 0) {
		z00 /= 10;
		w00++;
	}
	return w00;
}
int krag(double xx) {
	return INF - (int)(INF - xx);
}


int modinv(int a, int m) {
	int b = m, u = 1, v = 0;
	while (b) {
		int t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
int modpow(int a, int n) {
	int res = 1;
	while (n > 0) {
		if (n & 1) res = res * a % mod;
		a = a * a % mod;
		n >>= 1;
	}
	return res;
}
int com(int xx, int yy) {
	int zz = 1;
	for (int i = xx; i > xx - yy; i--) {
		zz *= i;
		zz %= mod;
	}
	for (int i = 1; i <= yy; i++) {
		zz *= modinv(i, mod);
		zz %= mod;
	}
	return zz;
}
int gcd(int xx, int yy) {
	int p = xx;
	int q = yy;
	if (q > p)swap(p, q);
	while (p % q != 0) {
		p %= q;
		swap(p, q);
	}
	return q;
}
int lcm(int xx, int yy) {
	return xx * yy / gcd(xx, yy);
}
bool prime(int xx) {
	int a = xx;
	for (int i = 2; i * i <= xx; i++) {
		if (xx % i == 0) {
			return 0;
		}
	}
	return 1;
}


signed main() {
	int a, b;
	cin >> a >> b;
	if (a > 8 || b > 8) {
		cout << ":(" << endl;
	}
	else cout << "Yay!" << endl;
}


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

#define ll long long int
#define ld long double
#define pb push_back
#define eb emplace_back
#define xx first
#define yy second
#define INF 0x3f3f3f3f
#define show(x) cerr<<#x<<" : "<<x<<'\n';
#define yogeshk972() cerr<<"\nTime Taken : "<<(float)(clock()-time_p)/CLOCKS_PER_SEC<<"\n";
clock_t time_p=clock();

using namespace std;
const int N= 1e6+10, mod= 998244353;

int main() {
  ios_base::sync_with_stdio(false);cin.tie(NULL);
/*
  #ifndef ONLINE_JUDGE
  freopen("in.txt","r",stdin);
  freopen("out.txt","w",stdout);
  #endif
*/
  ll k,x;
  cin>>k>>x;
  if( 500*k>=x )cout<<"Yes\n";
  else cout<<"No\n";


  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <utility>
#include <functional>
#include <deque>
#include <cstdlib>

#define REP(i, a, b) for (int i = int(a); i < int(b); i++)
#ifdef _DEBUG_
#define dump(val) cerr << __LINE__ << ":\t" << #val << " = " << (val) << endl
#else
#define dump(val)
#endif

using namespace std;

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

template<typename T>
vector<T> make_v(size_t a, T b) {
    return vector<T>(a, b);
}

template<typename... Ts>
auto make_v(size_t a, Ts... ts) {
    return vector<decltype(make_v(ts...))>(a, make_v(ts...));
}

template<typename T>
void chmax(T &a, T b) {
    a = max(a, b);
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    ll n, d;
    cin >> n >> d;
    vector<ll> v(n), c(n);
    REP(i, 0, n) {
        cin >> v[i] >> c[i];
    }

    auto allEnum = [&](int s, int e) {
        vector<P> res;
        // B - A;
        ll V = 0, C = 0;
        function<void(int)> rec = [&](int i) {
            if (i == e) {
                res.emplace_back(V, C);
                return;
            }
            rec(i + 1);
            // A
            V -= v[i];
            C -= c[i];
            rec(i + 1);
            V += v[i];
            C += c[i];
            // B
            V += v[i];
            C += c[i];
            rec(i + 1);
            V -= v[i];
            C -= c[i];
        };
        rec(s);
        return res;
    };
    auto res1 = allEnum(0, n / 2), res2 = allEnum(n / 2, n);
    sort(res1.rbegin(), res1.rend());
    sort(res2.begin(), res2.end());

    /*
    for (auto &a : res1) {
        cout << a.first << " " << a.second << endl;
    }

    for (auto &a : res2) {
        cout << a.first << " " << a.second << endl;
    }
    //*/

    // スライド最大値?
    deque<P> Deq;
    int t = 0;
    ll ans = 0;
    for (auto &p : res1) {
        // add
        while (t < res2.size() && p.first + res2[t].first <= d) {
            while (Deq.size() && Deq.back().second < res2[t].second) {
                Deq.pop_back();
            }
            Deq.push_back(res2[t]);
            t++;
        }
        while (Deq.size() && abs(p.first + Deq.front().first) > d) {
            Deq.pop_front();
        }

        /*
        cout << "--" << endl;
        for (auto &aa : Deq) {
            cout << aa.first << " " << aa.second << endl;
        }
        //*/

        if (Deq.size() > 0) {
            chmax(ans, p.second + Deq.front().second);
        }
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 489236
import java.util.*

fun main(args: Array<String>) {
    val scanner = Scanner(System.`in`)
    val n = scanner.nextInt()
    val sa = Array<CharArray>(n) { scanner.next().toCharArray() }

    val m = mutableMapOf<String, Long>()
    sa.forEach { ca ->
        ca.sort()
        val s = String(ca)
        val prev = m.get(s) ?: 0
        m.put(s, prev + 1)
    }

    var ret = 0L
    m.forEach { entry ->
        val v = entry.value

        ret += (v - 1) * v / 2
    }

    println(ret)
}

Measured memory_bytes: 56340
#include<bits/stdc++.h>
#define F first
#define S second
#define MP make_pair
#define pb push_back
#define endl '\n'

using namespace std;

typedef long long LL;
typedef pair< int, int > P;
typedef pair< LL, LL > LP;
typedef pair< int, P > iP;
typedef pair< P, P > PP;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1000000007;

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

LL a[100005];

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    LL n, k;
    cin >> n >> k;
    for( int i = 0; i < n; ++i ) {
        LL A, b;
        cin >> A >> b;
        a[A] += b;
    }

    LL cnt = 0;
    LL pos = 0;
    while( cnt < k ) {
        ++pos;
        cnt += a[pos];
        
    }

    cout << pos << endl;
    return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <cstdlib>

int main(int argc, char *argv[]) {
  size_t a, b;

  std::cin >> a >> b;

  if (a >= 13) {
    std::cout << b << "\n";
  } else if (a >= 6) {
    std::cout << b / 2 << "\n";
  } else {
    std::cout << 0 << "\n";
  }

  return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main() {
 char ch;
 int n, i, s, t, rank;
 int card[4][14]={};
 cin >> n;
 for(i=0; i<n; i++){
     cin >> ch >> rank;
     if(ch == 'S') card[0][rank] = 1;
     if(ch == 'H') card[1][rank] = 1;
     if(ch == 'C') card[2][rank] = 1;
     if(ch == 'D') card[3][rank] = 1;
 }
 for(s=0; s<4; s++){
   for(t=1; t<14; t++){
     if(card[s][t]) continue;
     if(s==0) ch = 'S';
     if(s==1) ch = 'H';
     if(s==2) ch = 'C';
     if(s==3) ch = 'D';
     cout << ch << " " << t << endl;
   }
 }
 return 0;
}

Measured memory_bytes: 3120
object Main {
  val sc = new java.util.Scanner(System.in)

  def sin(n: Int): Seq[Int] = Seq.fill(n)(sc.nextInt())

  def main(args: Array[String]): Unit = {
    val m, d = sc.nextInt()
    println(
      (for(a <- 1 to m;
          b <- 1 to d
          if b % 10 >= 2 &&
             b / 10 >= 2 &&
             (b % 10) * (b / 10) == a) yield {1}).length
    )
  }
}

Measured memory_bytes: 25516
import sys

sys.setrecursionlimit(500000)
def input():
    return sys.stdin.readline()[:-1]

class BIT:
            
    def __init__(self, L):
        self.N = len(L)
        self.bit = [0]*self.N
        for i,l in enumerate(L):
            self.add(i,l)

    def add(self, a, w):
        x = a + 1
        for i in range(1000):
            self.bit[x-1] += w
            x += x & -x
            if x > self.N:
                break

    def sum(self, a):
        x = a+1
        ret = 0
        for i in range(1000):
            ret += self.bit[x-1]
            x -= x & -x
            if x <= 0:
                break        
        return ret




def main():
    N,D,A = list(map(int,input().split()))

    enemy = []
    for i in range(N):
        x,h = list(map(int,input().split()))
        if h%A==0:
            enemy.append([x,h//A])
        else:
            enemy.append([x,h//A+1])

    enemy.sort(key=lambda x:x[0])
    def bisect(index):
        x = enemy[index][0]
        if enemy[N-1][0] <= x + 2*D:
            return N-1
        l = index
        r = N-1
        while r-l>1:
            if enemy[(r+l)//2][0] <= x + 2*D:
                l = (r+l)//2
            else:
                r = (r+l)//2
        return l

    bit = BIT([0]*N)

    count1 = 0
    for i in range(N):
        if i>0:
            v = bit.sum(N-1) - bit.sum(i-1)
        else:
            v=0
        if enemy[i][1] - v>0:
            count1 += enemy[i][1] - v
            j = bisect(i)
            bit.add(j,enemy[i][1] - v)

    enemy = enemy[::-1]
    for i in range(N):
        enemy[i][0] = -enemy[i][0]

    bit = BIT([0]*N)

    count2 = 0
    for i in range(N):
        if i>0:
            v = bit.sum(N-1) - bit.sum(i-1)
        else:
            v = 0
        if enemy[i][1] - v>0:
            count2 += enemy[i][1] - v
            j = bisect(i)
            bit.add(j,enemy[i][1] - v)


    print(min(count1,count2))

if __name__ == '__main__':
    main()



Measured memory_bytes: 91868
#include<stdio.h>
int N,H,Q;
int ace[444],in[444],out[444];
int ancestor(int x){return x-ace[x]?ace[x]=ancestor(ace[x]):x;}
bool proc(){
	for(int i=1; i<=H; i++)
		if(out[i] < in[i])return false;
	for(int i=H+1; i<=2*H; i++)
		if(out[i] > in[i])return false;
	for(int i=1; i<=2*H; i++)if(ancestor(i) == i){
		bool val = false, valid = false;
		for(int j=1; j<=2*H; j++)if(ancestor(j) == i){
			if(in[j] == 0 && out[j] == 0)continue;
			val = true;
			if(in[j] != out[j])valid = true;
		}
		if(val && !valid)return false;
	}
	return true;
}
int main(){
	scanf("%d%d",&N,&H);
	for(int i=1; i<=2*H; i++)
		ace[i] = i;
	Q = 2 * H + 1;
	for(int i=0; i<N; i++){
		int A,B,C,D,L,R;
		scanf("%d%d%d%d",&A,&B,&C,&D);
		if(C == 0)L = A;else
			L = Q - C;
		if(D == 0)R = Q - B;else
			R = D;
		in[R] ++;
		out[L] ++;
		ace[ancestor(L)] = ancestor(R);
	}
	//(l1,r1)-(l2,r2) => r1 == l2 || r1 < 0 && l2 > 0
	puts(proc()?"YES":"NO");
	return 0;
}

Measured memory_bytes: 256
#include <iostream>

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

int main() {
    int n, m;
    std::string s;
    std::string ans = "Yes";
    std::cin >> n >> s;
    if (n % 2) ans = "No";
    m = n / 2;
    REP(i, m) if (s[i] != s[m+i]) ans = "No";
    std::cout << ans << std::endl;
    return 0;
}

Measured memory_bytes: 256
s = str(input())
n = len(s)

ans1 = 0
ans2 = 0

for i in range(n):
    if i%2 == 0 and s[i] == '0':
        ans1 +=1
    elif i%2 == 1 and s[i] == '1':
        ans1 += 1

for i in range(n):
    if i%2 == 0 and s[i] == '1':
        ans2 +=1
    elif i%2 == 1 and s[i] == '0':
        ans2 += 1
        
print(min(ans1, ans2))


Measured memory_bytes: 9244
import java.util.*;

public class Main {
	public static void main(String[] args){
    
    Scanner sc = new Scanner(System.in);
		int H = sc.nextInt();
		int N = sc.nextInt();
		
		int[]list  = new int[N];
		int all = 0;
		for(int i=0; i<N; i++){
			list[i] = sc.nextInt();
			all += list[i];
}
	if(H<=all){
		System.out.println("Yes");
	}else{
		System.out.println("No");
	}
}
}


Measured memory_bytes: 51316
#include <bits/stdc++.h>
using namespace std;
int main() {
  // ここにプログラムを追記
  char a,b,c;
  int count=0;
  cin >> a >> b >> c;
  if(a=='1'){
  count++;
  }
  if(b=='1'){
  count++;
  }
  if(c=='1'){
  count++;
  }
  cout << count <<endl;
}

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

int main() {
   
    
    int k;
    cin>>k;
    
    if(k%2==0){
        cout<<(k/2)*(k/2)<<endl;
    }else{
        cout<<(k+1)/2*(k-1)/2<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int num = scan.nextInt();
		if(num == 1) {
			System.out.println(num);
			return;
		}
		int most = 0;
		for(int ind = 1; ind<=num;ind++) {
			if(isRoot2(ind)) most = ind;
		}
		System.out.println(most);
	}
	
	private static boolean isRoot2(int num) {
		for(int ind = 1;ind<=10;ind++) {
			if(num == (Math.pow(2, ind))) return true;
		}
		return false;
	}
}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using vs = vector<string>;
using pll = pair<ll, ll>;
using vp = vector<pll>;
template<class T> using V = vector<T>;
template<class T> using VV = vector<vector<T> >;
#define rep(i, n) for(ll i = 0; i < (n); i++)
#define repb(i, n) for(ll i = (n)-1; i >= 0; i--)
#define repr(i, a, b) for(ll i = (a); i < (b); i++)
#define reprb(i, a, b) for(ll i = (a)-1; i >= (b); i--)
#define ALL(a) (a).begin(), (a).end()
#define SZ(x) ((ll)(x).size())
const ll MOD = 1000000007;
const ll INF = 100000000000000000LL;
inline ll GCD(ll a, ll b){ return b?GCD(b, a % b):a; }
inline ll LCM(ll a, ll b){ return a/GCD(a, b)*b; }
inline ll powint(unsigned long long x, ll y){ ll r=1; while(y){ if(y&1) r*=x; x*=x; y>>=1; } return r; }
inline ll powmod(ll x, ll y, ll m = MOD){ ll r=1; while(y){ if(y&1) r*=x; x*=x; r%=m; x%=m; y>>=1; } return r; }
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(b<a) { a=b; return 1; } return 0; }
#ifdef OJ_LOCAL
#include "dump.hpp"
#else
#define dump(...) ((void)0)
#endif

int main(){
    cin.tie(0); ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    ll n, k, q;
    cin >> n >> k >> q;
    vll a(q);
    rep(i, q){
        cin >> a[i];
        a[i]--;
    }
    vll pt(n, k-q);
    rep(i, q){
        pt[a[i]]++;
    }
    rep(i, n){
        cout << (pt[i] > 0 ? "Yes" : "No") << endl;
    }
    return 0;
}

Measured memory_bytes: 2176
//💭💡🎈fold
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define frd(x) freopen("x","r",stdin)
#define fwt(x) freopen("x","w",stdout)
#define fo(i,a) for(int i=1;i<=(a.n);i++)
#define fup(i,x,y) for(int i=(x);i<=(y);i++)
#define fdn(i,x,y) for(int i=(x);i>=(y);i--)
typedef long long ll;
typedef unsigned long long ull;
using namespace std;

template<int __>
struct ia
{
    int a[__],n;
    ia(int n=0):n(n) {}
    void rev(){reverse(a+1,a+n+1);}
    void hp(){make_heap(a+1,a+n+1);}
    int& operator[](int x){return a[x];}
    void sf(){fup(i,1,n)scanf("%d",a+i);}
    void mem(int x){memset(a,x,sizeof(a));}
    void sup(){sort(a+1,a+n+1,less<int>());}
    void sdn(){sort(a+1,a+n+1,greater<int>());}
    void uq(){this->sup(),n=unique(a+1,a+n+1)-a-1;}
    bool nexp(){return next_permutation(a+1,a+n+1);}
    int lb(int x){return lower_bound(a+1,a+n+1,x)-a;}
    int ub(int x){return upper_bound(a+1,a+n+1,x)-a;}
    void pf(){fup(i,1,n)printf("%d%c",a[i],i==n?'\n':' ');}
    ia operator+(const ia& b)
    {
        ia<__>c(max(n,b.n));c.mem(0);
        fo(i,c)c[i]=a[i]+b.a[i];
        return c;
    }
    ia operator-(const ia& b)
    {
        ia<__>c(max(n,b.n));c.mem(0);
        fo(i,c)c[i]=a[i]-b.a[i];
        return c;
    }
    ia operator*(const ia& b)
    {
        ia<__>c;c.mem(0);
        fo(i,(*this))fo(j,b)
            c.n=max(c.n,i+j-1),c[i+j-1]+=a[i]*b.a[j];
        return c;
    }
};

ia<105>a;

int main()
{
    scanf("%d",&a.n);
    a.sf();
    a.uq();
    printf("%d\n",a.n);
    return 0;
}

Measured memory_bytes: 256
import itertools as itr
S = input().rstrip()

ans = 0
for param in range(2**(len(S)-1)):
	tmp = ""
	for i in range(len(S)):
		tmp += S[i]+ ["","+"][((param >> i)&1) if i != len(S)-1 else 0]
	ans += eval(tmp)

print(ans)

Measured memory_bytes: 3060
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define str to_string
#define endl "\n"
#define PI 3.141592653589
using namespace std;
using lint = long long;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}

//AC(*'ω'*)AC(*'ω'*)AC(*'ω'*)AC(*'ω'*)AC(*'ω'*)AC(*'ω'*)AC
int main(){
    int n;cin>>n;
    string s;cin>>s;
    map<char,int> dic;
    for(char c:s){
        dic[c]++;
    }
    lint ans=1,mod=1000000007;
    for(auto p:dic){
        ans*=(p.second+1);
        ans%=mod;
    }
    if(ans==0)ans=mod-1;
    else ans--;
    cout<<ans<<endl;
}


Measured memory_bytes: 3744
a = int(input())
for i in range(1,a+1):
    x = i
    if i % 3 == 0 or i % 10 == 3:
        print(" {}".format(i), end = "")
    else:
        while int(x) > 0:
            x /= 10
            if int(x) % 10 == 3:
                print(" {}".format(i), end = "")
                break
print()


Measured memory_bytes: 5872
n = int(input())

score_a = 0
score_b = 0

for i in range(n):
        a, b = input().split()
        if a > b:
            score_a += 3
        elif a < b:
            score_b += 3
        else:
            score_a += 1
            score_b += 1

print(score_a, score_b)


Measured memory_bytes: 5596
N = int(input())
X = list(map(int, input().split()))
a = sum(X)
b = sum([x * x for x in X])
if a / N - a // N < 0.5:
  c = a // N
else:
  c = a // N + 1
print(N * c * c - 2 * a * c + b)

Measured memory_bytes: 61852