akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, l;
  cin >> n >> m >> l;

  int A[n][m] = {};
  int B[m][l] = {};
  long long tmp;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cin >> tmp;
      A[i][j] = tmp;
    }
  }
  for (int i = 0; i < m; i++) {
    for (int j = 0; j < l; j++) {
      cin >> tmp;
      B[i][j] = tmp;
    }
  }

  for (int i = 0; i < n; i++) {
    for (int j = 0; j < l; j++) {
      tmp = 0;
      for (int k = 0; k < m; k++) {
        tmp += A[i][k] * B[k][j];
      }
      cout << tmp;
      if (j < l - 1) {
        cout << " ";
      }
    }
    cout << endl;
  }
  return 0;
}



Measured memory_bytes: 3160
N, K = map(int, input().split())
Ans0 = [0] * N
Ans1 = [0] * N
Ans2 = list(range(K+2*N, K+3*N))
n = K
for i in range(0, N, 2):
    Ans0[i] = n
    n += 1
for i in range(1, N, 2):
    Ans0[i] = n
    n += 1
for i in range(1, N, 2):
    Ans1[i] = n
    n += 1
for i in range(0, N, 2):
    Ans1[i] = n
    n += 1
Ans = []
for a, b, c in zip(Ans0, Ans1, Ans2):
    if a+b > c:
        print(-1)
        exit()
    Ans.append("{} {} {}".format(a, b, c))
print("\n".join(Ans))


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

int main()
{
  string S;
  cin >> S;
  int cnt = (S.size() + 1)/2 - 1;
  for (int i = cnt; 0 < cnt; --cnt)
  {
    int j = 0;
    for (; j < cnt; ++j)
      if (S[j] != S[j + cnt])
        break;
    if (cnt == j)
    {
      cout << 2*cnt;
      break;
    }
  }
  return 0;
}


Measured memory_bytes: 256
// https://atcoder.jp/contests/arc102/tasks/arc102_a
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
#include <map>
#include <unordered_map>
#include <stack>
#include <queue>
#include <set>
#include <unordered_set>
#include <bitset>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
#define REP(i, n) for(size_t i = 0; i < (n); ++i)

int main()
{
    int N, K;
    scanf("%d %d", &N, &K);
    if (K % 2 == 1)
    {
        ll cnt = 0;
        for (int i = 1; i <= N; ++i)
        {
            if (i % K == 0) ++cnt;
        }
        ll ans = cnt * cnt * cnt;
        printf("%lld\n", ans);
        return 0;
    }
    else
    {
        int k2 = K / 2;
        // cnt : K で割り切れる数の個数
        // cnt2 : Kで割ったときあまりが K / 2 となる数の個数
        ll cnt = 0, cnt2 = 0;
        for (int i = 1; i <= N; ++i)
        {
            if (i % K == 0) ++cnt;
            else if(i % K == k2) ++cnt2;
        }
        ll ans = cnt * cnt * cnt + cnt2 * cnt2 * cnt2;
        printf("%lld\n", ans);
        return 0;
    }
    
    return 0;
}


Measured memory_bytes: 3776
#include <bits/stdc++.h>
using namespace std;
#define int  long long int
#define mod 1000000000000007
#define pb push_back
#define mp make_pair
#define bs binary_search
#define lb lower_bound
#define ub upper_bound
#define gcd __gcd
#define fastio ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define min3(a,b,c) min(a,min(b,c))
#define max3(a,b,c) max(a,max(b,c))
#define all(i) i.begin(),i.end()
#define rep(i,a,b) for(int i=a;i<b;i++)
#define set_bit __builtin_popcount //gives number of set_bits
#define ff first
#define ss second
#define cases(t) int t;cin>>t; rep(casn,1,t+1)
#define el cout<<"\n";
#define deci(n) int n; scanf("%lld",&n);
#define decs(n) string n; cin>>n;
#define sz(v) v.size()
#define repit(m) for(auto it=m.begin();it!=m.end();it++)
// #define find(m,i) (m.find(i)!=m.end())
// #define find(m,i) (m.find(i)==m.end())
#define cYES cout<<"YES\n";
#define cNO cout<<"NO\n";
#define ins insert
#define imax 1000000000000000000
#define imin -1000000000000000000
// #define NP 50000
//  cerr << "\nTime : " << (double)clock() / (double)CLOCKS_PER_SEC << "s\n";
 
//  IIITA
//SUNEET KUMAR -->  ਸੁਨੀਤ
 
// scanning numbers extremely fast/////////
void fs(int &number)
{
    bool negative = false;
    register int c;
    number = 0;
    c = getchar();
    if (c=='-')
    {
        negative = true;
        c = getchar();
    }
    for (; (c>47 && c<58); c=getchar())
        number = number *10 + c - 48;
    if (negative)
        number *= -1;
}
// ========================================
int power(int a,int x)
{
        a%=mod;
    int res=1;
    while(x>0)
    {
        if(x&1)
        res=res*a%mod;
        a=a*a%mod;
        x>>=1;
    }
    return res;
}
int max(int a,int b)
{
    if(a>b)
    {
        return a;
    }
    else
    {
        return b;
    }
}
int min(int a,int b)
{
    if(a>b)
    {
        return b;
    }
    else
    {
        return a;
    }
}
int madd(int a,int b)
{
    int ans;
    ans=(a%mod+b%mod)%mod;
    return ans;
}
int mmult(int a,int b)
{
    int ans=1;
    ans=((a%mod)*(b%mod))%mod;
    return ans%mod;
}
int modinverse(int a)
{
    return power(a,mod-2);
}
int dp[3005][3005],mark[3005];
string lcs(string s,string t)
{
    for(int i=1;i<=s.length();i++)
    {
        for(int j=1;j<=t.length();j++)
        {
            if(t[j-1]==s[i-1])
            {  
                // cout<<"s->"<<i;el
                // cout<<"t->"<<j;el 
                dp[i][j]=1+dp[i-1][j-1];
            }
            else
            {
                dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
            }
        }
    }
    string val="";
    int ls=s.length();
    int lt=t.length();
    int ans=dp[ls][lt];
    while(ls>0&&lt>0)
    {
        if(s[ls-1]==t[lt-1])
        {
            val+=s[ls-1];
            ans--;
            ls--;
            lt--;
        }
        else if(dp[ls-1][lt]>dp[ls][lt-1])
        {
            ls--;
        }
        else
        {
            lt--;
        }
    }
    reverse(val.begin(),val.end());
    return val;
}
void nhi_degi()
{
     string s,t;cin>>s>>t;
     cout<<lcs(s,t);el
}
signed main()
{
    nhi_degi();
}

Measured memory_bytes: 70656
N,M = map(int,input().split())
alist=[]
blist=[]
for i in range(M):
  a,b=map(int,input().split())
  alist.append(a)
  blist.append(b)
father=[i for i in range(N+1)]
rank=[0]*(N+1)
size=[1]*(N+1)

def find(x):
  if x!=father[x]:
    father[x]=find(father[x])
  return father[x]

def union(x,y):
  xfa,yfa=find(x),find(y)
  if xfa==yfa:
    return
  elif rank[xfa]<rank[yfa]:
    father[xfa]=yfa
    size[yfa]+=size[xfa]
  else:
    father[yfa]=xfa
    size[xfa]+=size[yfa]
    if rank[xfa]==rank[yfa]:
      rank[xfa]+=1
      
def samefather(x,y):
  return find(x)==find(y)

ans_list=[]
ans=int(N*(N-1)/2)
for i in range(M):
  ans_list.append(ans)
  a=alist[M-1-i]
  b=blist[M-1-i]
  p,q=size[find(a)],size[find(b)]
  if samefather(a,b):
    continue
  else:
    ans-=p*q
    union(a,b)
for i in range(M):
  print(ans_list[M-1-i])

Measured memory_bytes: 19384
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <iomanip>
#include <map>
using namespace std;

int main() {
	long long cnt = 0, ans = 1, sum = 0;
	string s;
	cin >> s;
	for (int i = 0; i < s.size(); i++) {
		if (s[i] == 'B') {
			cnt++;
		}
		else if (s[i] == 'W') {
			ans = ans * cnt;
			sum = sum + ans;
			ans = 1;
		}
	}
	cout << sum << endl;
}

Measured memory_bytes: 3736
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define all(v) v.begin(), v.end()
using in = int64_t;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
const double PI=3.14159265358979323846;
const in MOD = 1000000007;
const in INF=1e18+7;
const int inf=1e9+7;
using P=pair<int,int>;
vector<int> dx={0,1,-1,0};
vector<int> dy={1,0,0,-1};


int main(){
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
cout << fixed << setprecision(10);
    int n,m,x;
    cin>>n>>m>>x;
    vector<int> c(n);
    vector<vector<int>> a(n,vector<int>(m));
    rep(i,n){
        cin>>c[i];
        rep(j,m) cin>>a[i][j];
    }
    int ans=inf;
    for(int tmp = 0;tmp< (1<<n); tmp++){
        bitset<12> s(tmp);
        int cost=0;
        vector<int> p(m,0);
        rep(i,n){
            if(!s.test(i)) continue;
            cost +=c[i];
            if(c[i]>=ans) break;
            rep(j,m){
                p[j] +=a[i][j];
            }
        }
        bool fl=1;
        rep(i,m){
            if(p[i]<x) fl=0;
        }
        if(fl) ans =min(ans,cost);
    }
    if(ans==inf) ans=-1;
    cout<<ans<<endl;
}/*
./problem.exe
*/

Measured memory_bytes: 3624
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <vector>
#define Rep(i, n) for(int i=0;i<n;++i)
#define rep(i, n) for(int i=1;i<=n;++i)
#define ll long long int
#define INF 100000000
#define INFLL 100000000000
#define MOD 1000000007
#define PI 3.14159265359
#define All(a) (a).begin(), (a).end()

using namespace std;
using P = pair<ll, ll>;
 
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};

struct Edge {
  int to;     
  ll weight; 
  Edge(int t, ll w) : to(t), weight(w) { }
};



int N;
ll W;
ll w[110];
ll v[110];

vector<ll> v0;
vector<ll> v1;
vector<ll> v2;
vector<ll> v3;

ll d0[110];
ll d1[110];
ll d2[110];
ll d3[110];

int main () {
  cin >> N >> W;

  rep(i, N) {
    cin >> w[i] >> v[i];
  }

  ll w1 = w[1];

  rep(i, N) {
    if (w[i] == w1) {
      v0.push_back(v[i]);
    } else if (w[i] == w1 + 1) {
      v1.push_back(v[i]);
    } else if (w[i] == w1 + 2) {
      v2.push_back(v[i]);
    } else {
      v3.push_back(v[i]);
    }
  }

  sort(All(v0), greater<ll>());
  sort(All(v1), greater<ll>());
  sort(All(v2), greater<ll>());
  sort(All(v3), greater<ll>());

  int n0 = v0.size();
  int n1 = v1.size();
  int n2 = v2.size();
  int n3 = v3.size();

  Rep(i, n0) {
    d0[i+1] = d0[i] + v0[i];
  }
  Rep(i, n1) {
    d1[i+1] = d1[i] + v1[i];
  }
  Rep(i, n2) {
    d2[i+1] = d2[i] + v2[i];
  }
  Rep(i, n3) {
    d3[i+1] = d3[i] + v3[i];
  }

  ll ans = 0;

  for (int p=0;p<=n0;++p) {
    for (int q=0;q<=n1;++q) {
      for (int r=0;r<=n2;++r) {
        for (int s=0;s<=n3;++s) {
          ll tmp = d0[p] + d1[q] + d2[r] + d3[s];
          ll tmp_w = w1 * p + (w1 + 1) * q + (w1 + 2) * r + (w1 + 3) * s;
          if (tmp_w <= W) {
            ans = max(ans, tmp);
          }
        }
      }
    }
  }

  cout << ans << "\n";
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<bitset>
#include<string>
#include<cmath>
#include<algorithm>
#include<stack>
#include<list>
#include<queue>
#include<map>
using namespace std;
#define rep(i,x) for(int i=0;i<x;i++)
#define re(i,x,y) for(int i=x;i<y;i++)
int INF=1e9;
const long long mod=1e9+7;
typedef long long ll;

int main(){
  int x,a;
  cin>>x>>a;
  if(x<a){
    cout<<0<<endl;
  }
  else{
    cout<<10<<endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h> //Andrei Alexandru a.k.a Sho10
#define ll long long
#define double long double
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#define all(a) (a).begin(), (a).end()
#define sz size
#define f first
#define s second
#define pb push_back
#define er erase
#define in insert
#define mp make_pair
#define pi pair
#define rc(s) return cout<<s,0
#define endl '\n'
#define mod 1000000007
#define PI 3.14159265359
#define MAXN 100005
#define INF 1000000005
#define LINF 1000000000000000005ll
#define CODE_START  ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
ll n;
int32_t main(){
CODE_START;
cin>>n;
ll ans=0;
for(ll i=1;i<=n;i++)
{
    ll x=(n-1)/i;
    ans+=x;

}
cout<<ans<<endl;
}


Measured memory_bytes: 3644
#include <iostream>
#include <vector>
using namespace std;
const int mod = 1000000007;
int main() {
   int H, W, K;
   cin >> H >> W >> K;
   vector<vector<int> > dp(H + 1, vector<int>(W, 0)); dp[0][0] = 1;
   for (int i = 0; i < H; i++) {
      for (int j = 0; j < W; j++) {
         for (int k = 0; k < 1 << (W - 1); ++k) {
            bool flg = true;
            for (int l = 0; l < W - 2; l++) {
               if (((k >> l) & 1) && ((k >> (l + 1)) & 1)) {
                  flg = false;
               }
            }
            if (flg) {
               if ( j >= 1 && ((k >> (j-1)) & 1)) {
                  dp[i + 1][j - 1] += dp[i][j];
                  dp[i + 1][j - 1] %= mod;
               } else if (j <= W - 2 && ((k >> j) & 1)) {
                  dp[i + 1][j + 1] += dp[i][j];
                  dp[i + 1][j + 1] %= mod;

               } else {
                  dp[i + 1][j] += dp[i][j];
                  dp[i + 1][j] %= mod;
               }
            }
         }
      }
   }
   cout << dp[H][K - 1] << endl;
   return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <sstream>
#include <functional>
#include <map>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <stack>
#include <deque>
#include <set>
#include <list>
#include <numeric>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> P;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const ll INF = 1LL<<29;
const ll mod = 1e9+7;
#define rep(i,n) for(int (i)=0;(i)<(ll)(n);++(i))
#define repd(i,n,d) for(ll (i)=0;(i)<(ll)(n);(i)+=(d))
#define all(v) (v).begin(), (v).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset((m),(v),sizeof(m))
#define chmin(X,Y) ((X)>(Y)?X=(Y),true:false)
#define chmax(X,Y) ((X)<(Y)?X=(Y),true:false)
#define fst first
#define snd second
#define UNIQUE(x) (x).erase(unique(all(x)),(x).end())
template<class T> ostream &operator<<(ostream &os, const vector<T> &v){int n=v.size();rep(i,n)os<<v[i]<<(i==n-1?"":" ");return os;}
#define N 210000
ll inv[N], fact[N], ifact[N];
void init(){
    inv[1] = 1;
    for(int i=2;i<N;i++) inv[i] = inv[mod%i] * (mod - mod/i) % mod;
	fact[0] = ifact[0] = 1;
	for(int i = 1; i < N; i++){
		fact[i] = (fact[i-1]*i)%mod;
		ifact[i]=(ifact[i-1]*inv[i])%mod;
	}
}

ll comb(ll a, ll b){
	return ifact[a]*ifact[b]%mod*fact[a+b]%mod;
}

int main(){
	init();
	ll h, w, a, b;
	cin>>h>>w>>a>>b;
	h--; w--;
	ll res = comb(h, w);
	for(int i = 0; i < min(a, b); i++){
		ll x = h-a+1+i, y = b-1-i;
		res = (res-comb(x, y)*comb(h-x, w-y)%mod)%mod;
	}
	cout<<(res+mod)%mod<<endl;
	return 0;
}


Measured memory_bytes: 5120
#include <iostream>

using namespace std;

int main (void)
{
    char a, b;

    cin >> a >> b;
    if (a == 'H') {
        cout << b << endl;
    } else {
        if (b == 'H') {
            cout << "D" << endl;
        } else {
            cout << "H" << endl;
        }
    }

    return 0;
}

Measured memory_bytes: 256
function Main(input) {
  input=input.split("\n");
  if(input[input.length-1]===''){
    input.pop();
  }
  const N=input[0];
  console.log('x'.repeat(N.length));

}


//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
  



  


Measured memory_bytes: 29552
/*DavitMarg*/
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <cstring>
#include <map>
#include <set>
#include <queue>
#include <iomanip>
#include <stack>
#include <cassert>
#include <iterator>
#include <bitset>
#include <fstream>
#define mod 1000000007ll
#define LL long long
#define LD long double
#define MP make_pair
#define PB push_back
#define all(v) v.begin(),v.end()
using namespace std;

int n,m,d[100005],x[100005],used[100005];
map<pair<int,int>,bool> dir;
vector<int> g[100005],t[100005],odd;
vector<pair<int,int>> p;

void dfs0(int v)
{
	used[v]=1;
    for(int i=0;i<g[v].size();i++)
	{
        int to=g[v][i];
        if(used[to])
			continue;
        t[v].PB(to);
		dfs0(to);
	}
}

void dfs(int v,int p=0)
{
    for(int i=0;i<t[v].size();i++)
	{
        int to=t[v][i];
		dfs(to,v);
		x[v]^=x[to];
	}
	if(p)
	{
        dir[MP(p,v)]^=x[v];
        dir[MP(v,p)]^=x[v];
	}
}

int main()
{
	cin>>n>>m;
    for(int i=0;i<m;i++)
	{
        int a,b;
        scanf("%d%d",&a,&b);
        g[a].PB(b);
        g[b].PB(a);
        dir[MP(a,b)]=1;
        dir[MP(b,a)]=0;
        p.PB(MP(a,b));
	}

    for(int v=1;v<=n;v++)
	{
        for(int j=0;j<g[v].size();j++)
		{
            int to=g[v][j];
            d[v]^=dir[MP(v,to)];
		}
        if(d[v])
            odd.PB(v);
	}

    if(odd.size()%2)
	{
		cout<<"-1"<<endl;
        return 0;
	}

    for(int i=0;i<odd.size();i++)
        x[odd[i]]^=1;
    dfs0(1);
    dfs(1);

    for(int i=0;i<p.size();i++)
    {
        if(!dir[p[i]])
			swap(p[i].first,p[i].second);
        printf("%d %d\n",p[i].first,p[i].second);
    }



	return 0;
}


/*





*/


Measured memory_bytes: 39540
import java.util.*;

public class Main {
	public static void main(String[] args) throws Exception{
	Scanner scn = new Scanner(System.in);
      String check = "Yes";
      int[] a = new int[9];
      for(int i=0; i<a.length; ++i){
        a[i] = scn.nextInt();
      }
      int x1 = a[3] - a[0];
      int x2 = a[6] - a[3];
      
      if(a[4] != a[1]+x1){
        check="No";
      } if(a[5] != a[2]+x1){
        check="No";
      } if(a[7] != a[4]+x2){
        check="No";
      } if(a[8] != a[5]+x2){
        check="No";
      }
      System.out.println(check);
	}
}


Measured memory_bytes: 35648
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define setbits(x) __builtin_popcount(x)
#define setbitsll(x) __builtin_popcountll(x)
//#define endl '\n'
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define se second
#define fi first
#define pai acos(-1)
#define fn(i,x) for(i=0;i<x;i++)
#define fs(i,s,x) for(i=s;i<x;i++)
#define fr(i,x,s) for(i=x;i>=s;i--)
#define fit(itr,s) for(itr=s.begin();itr!=s.end();itr++)
#define W while
#define pp pair<ll,ll>
#define ppi pair<int,int>
#define vl vector<ll>
#define vll vector<pp >
#define vi vector<int>
#define vii vector<ppi>
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define debug(x) cerr<<#x<<" :: "<<x<<endl;
#define debug2(x,y) cerr<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<endl;
#define debug3(x,y,z) cerr<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<endl;
#define debug4(x,y,z,w) cerr<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<"\t"<<#w<<" :: "<<w<<endl;
#define boost  ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
const ll MAX=2e9;
const ll MM=1e16;
const ll mod=1e9+7;
int dx[]={-1,0,1,0};
int dy[]={0,1,0,-1};

ll expo(ll x,ll n,ll M=mod)
{
    ll ans=1;
    while(n>0)
    {
        if(n&1){ans=(ans*x)%M;}
                x=(x*x)%M;
                n>>=1;
    }
    return ans;
}

void solve()
{
  ll n,m;
  cin>>n>>m;
  cout<<n*m<<endl;
}


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


Measured memory_bytes: 3660
//Palindrome-philia
#include <iostream>
#include <vector>
#include <math.h>
#include <string>
#include <map>
#include <stdio.h>
#include <string.h>
#include <initializer_list>
#include <algorithm>
#include <numeric>
#include <iomanip>
#include <queue>
#include <set>

using namespace std;

int main ()
{
    string S;
    cin >> S;
    int count = 0;
    for (int i = 0, j = S.length()-1; i <= j; i++, j--) {
        if (S[i] != S[j]) {
            count++;
        }
    }

    cout << count << endl;
    return 0;
}

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

int main(){
  int N;
  int i,m,n;
  cin >> N;

  while(N>=10){
    N = N % 10;
  }  
  
  switch (N){
  case 2:
  case 4:
  case 5:
  case 7:
  case 9:
    cout << "hon" << endl;
    break;
  case 0:
  case 1:
  case 6:
  case 8:
    cout << "pon" << endl;
    break;
  case 3:
    cout << "bon" << endl;
  }
}


Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
const int sz = 1 << 16;
typedef pair< unsigned short, int > Pi;
vector< Pi > seg[2 * sz + 1];
int x[500000], y[500000];
int sx[20000], sy[20000], tx[20000], ty[20000];
vector< pair< unsigned short, Pi > > buff;
vector< int > nums, nums2;
vector< int > ret;
void InitRange(int k, int l, int r) {
  if(l + 1 >= r) {
    return;
  } else {
    InitRange(2 * k + 1, l, (l + r) >> 1);
    InitRange(2 * k + 2, (l + r) >> 1, r);
    if(k >= 16) {
      seg[k].resize(seg[2 * k + 1].size() + seg[2 * k + 2].size());
      merge(seg[2 * k + 1].begin(), seg[2 * k + 1].end(), seg[2 * k + 2].begin(), seg[2 * k + 2].end(), seg[k].begin());
    }
  }
}
void PrintRange(unsigned short a, unsigned short b, unsigned short low, unsigned short high, int k, int l, int r) {
  if(a >= r || b <= l) {
    return;
  } else if(a <= l && r <= b && k >= 16) {
    for(vector< Pi >::iterator it = lower_bound(seg[k].begin(), seg[k].end(), Pi(low, -1)); it != seg[k].end() && it -> first < high; it++) { 
      ret.push_back(it -> second);
    }
  } else {
    PrintRange(a, b, low, high, 2 * k + 1, l, (l + r) >> 1);
    PrintRange(a, b, low, high, 2 * k + 2, (l + r) >> 1, r);
  }
}
  
int main() {
  int n, q;
  scanf("%d", &n);
  for(int i = 0; i < n; i++) {
    scanf("%d %d", &x[i], &y[i]);
  }
  scanf("%d", &q);
  for(int i = 0; i < q; i++) {
    scanf("%d %d %d %d", &sx[i], &tx[i], &sy[i], &ty[i]);
    nums.push_back(sx[i] - 1);
    nums.push_back(tx[i]);
    nums2.push_back(sy[i] - 1);
    nums2.push_back(ty[i]);
  }
  sort(nums.begin(), nums.end());
  nums.erase(unique(nums.begin(), nums.end()), nums.end());
  sort(nums2.begin(), nums2.end());
  nums2.erase(unique(nums2.begin(), nums2.end()), nums2.end());
  for(int i = 0; i < n; i++) {
    x[i] = lower_bound(nums.begin(), nums.end(), x[i]) - nums.begin();
    y[i] = lower_bound(nums2.begin(), nums2.end(), y[i]) - nums2.begin();
    buff.push_back(make_pair(x[i], make_pair(y[i], i)));
  }
  sort(buff.begin(), buff.end());
  for(int i = 0; i < n; i++) {
    seg[buff[i].first + sz - 1].push_back(buff[i].second);
  }
  InitRange(0, 0, sz);
 
  for(int i = 0; i < q; i++) {
    sx[i] = lower_bound(nums.begin(), nums.end(), sx[i]) - nums.begin();
    tx[i] = upper_bound(nums.begin(), nums.end(), tx[i]) - nums.begin();
    sy[i] = lower_bound(nums2.begin(), nums2.end(), sy[i]) - nums2.begin();
    ty[i] = upper_bound(nums2.begin(), nums2.end(), ty[i]) - nums2.begin();

    PrintRange(sx[i], tx[i], sy[i], ty[i], 0, 0, sz);
    sort(ret.begin(), ret.end());
    for(vector< int >::const_iterator it = ret.begin(); it != ret.end(); it++) {
      printf("%d\n", *it);
    }
    printf("\n");
    ret.clear();
  }
  
}

Measured memory_bytes: 63572
s = list(input())
cnt = 0
for i in range(len(s)):
    if i % 2 == 0:
        if s[i] == 'L':
            print('No')
            break
    else:
        if s[i] == 'R':
            print('No')
            break
    cnt += 1
if cnt == len(s):
    print('Yes')

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#define int long long
int n,s,a;
signed main()
{
	cin>>s>>n;
	for(int i=1;i<=n;i++)
	{
		cin>>a;
		s-=a;
	}
	cout<<max(-1ll,s);
}

Measured memory_bytes: 3596
#ifdef _DEBUG
#include "MyLib.h"
#else
#define main_D 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 LINF (LONG_MAX/2)
const int MGN = 8;
const int ARY_SZ_MAX = 10000000;
using namespace std;
using ll = long long; using ull = unsigned long long;
using vi = vector<int>; using vvi = vector<vi>; using vvvi = vector<vvi>;
using vb = vector<bool>; using vvb = vector<vb>; using vvvb = vector<vvb>;
using vl = vector<ll>; using vvl = vector<vl>;
using vd = vector<double>; using vs = vector<string>;
using pii = pair<int, int>; using pll = pair<ll, ll>;
// functions

#endif

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

    const ll MOD = (ll)1e9 + 7;
    ll N, M; cin >> N >> M;
    vl X(N); REP(i, N) cin >> X[i];
    vl Y(M); REP(i, M) cin >> Y[i];

    vi hx;
    for (int i= -(N-1); i<=N-1; i+=2) {
        hx.push_back(i);
    }
    ll fx = 0;
    REP(i,N) {
        fx += X[i] * hx[i];
        fx %= MOD;
    }

    vi hy;
    for (int i= -(M-1); i<=M-1; i+=2) {
        hy.push_back(i);
    }
    ll fy = 0;
    REP(i,M) {
        fy += Y[i] * hy[i];
        fy %= MOD;
    }

    ll ans = fx*fy % MOD;

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 2936
#include<iomanip>
#include<limits>
#include<thread>
#include<utility>
#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#include<cmath>
#include<numeric>
#include<cassert>
#include<random>
#include<chrono>
#include<unordered_map>
#include<fstream>
#include<list>
#include<functional>
#include<bitset>
#include<complex>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pi;
typedef pair<double,double> pd;
typedef pair<double,ll> pdl;
#define F first
#define S second
const ll E=1e18+7;
const ll MOD=1000000007;






int main(){
    ll n;
    cin>>n;
    vector<ll> a(n);
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    sort(a.begin(),a.end(),greater<ll>());
    vector<bool> used(n,false);
    ll ans=0;
    for(ll k=1LL<<30;k>1;k>>=1){
        ll r=n-1;
        for(int i=0;i<n;i++){
            if(used[i]){continue;}
            while(r>=0 && (used[r] || a[r]+a[i]<k)){r--;}
            if(r<=i){break;}
            if(a[r]+a[i]==k){ans++; used[r]=true; used[i]=true;}
        }
    }
    cout<<ans<<endl;
    
    
    return 0;
}


Measured memory_bytes: 1792
S = input()

N = len(S)

S1 = S[:(N - 1) // 2]
S2 = S[(N + 3) // 2 - 1:]

def check(s):
    #print(s)
    i = 0
    j = len(s) - 1
    while j > i:
        if s[j] != s[i]:
            return False
        j -= 1
        i += 1
    return True


if check(S) and check(S1) and check(S2):
    print("Yes")
else:
    print("No")

Measured memory_bytes: 9036
#include <bits/stdc++.h>
#define endl '\n'
#define int long long

using namespace std;

const int N = 2*1e5;

int n, a[N], dp[N];

int32_t main () {
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);

    cin >> n;

    for (int i = 0; i < n; ++ i)
        cin >> a[i];

    dp[0] = 0;
    dp[1] = abs(a[1]-a[0]);

    for (int i = 2; i < n; ++ i)
        dp[i] = min(dp[i-1] + abs(a[i]-a[i-1]), dp[i-2] + abs(a[i]-a[i-2]));

    cout << dp[n-1] << endl;

    return 0;
}


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

using namespace std;

int numcut(int a,int b){		//aは入力された数、bは切り取りたい桁			
			
			int i,num[5];		
				for(i=0;i<5;i++){
					num[i]=a%10;
					a -= num[i];
					a /= 10;
				}
					return num[b-1];
				} 
				
				
	int main(){
		
		int a,b,f1,f2,num;
		 cin>>a>>b;
		 
		 for(;b>=a;a++){
			 f1=0;
			 f2=0;
			 if(numcut(a,1)==numcut(a,5)) f1=1;
			 if(numcut(a,2)==numcut(a,4)) f2=1;
			 if(f1==1&&f2==1) num++;
		}
				
				cout<<num<<endl;
	}

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

int main(void){
    string s,t = "Yes";
    cin >> s;
    char a[2] = {'L','R'};
    for(int i = 0;i < s.size();i++){
        if(s[i] == a[i%2])t = "No";
    }
    cout << t;
}

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

using namespace std;

typedef long long ll;

int N;
pair<ll, int> A[100000];

int main() {
	cin >> N;
	for (int i = 0; i < N; i++)cin >> A[i].first, A[i].second = i;
	sort(A, A + N);
	int ans = 0;
	for (int i = 0; i < N; i++) {
		if ((i - A[i].second + 114514364) % 2 == 1)ans++;
	}
	cout << ans / 2 << endl;
	return 0;
}

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

using namespace std;

const int N = 3e5 +10, MOD = 1e9 + 7;

int n, m, k, a[N << 2], b[N << 2], c[N << 2], d[N << 2], sum, ans;

int zadd (int a, int b) {return a + b >= MOD ? a + b - MOD : a + b;}
int zsub (int a, int b) {return a - b < 0 ? a - b + MOD : a - b;}
int zmul (int a, int b) {return (long long)a * b % MOD;}

void init ()
{
	scanf ( "%d%d%d" , &n, &m, &k);
	a[0] = b[0] = c[1] = d[0] = 1;
	for (int i = 2; i <= N * 3; ++ i)
		c[i] = zmul (zsub (MOD, MOD / i), c[MOD % i]);
	for (int i = 1; i <= N * 3; ++ i)
	{
		a[i] = zmul (a[i - 1], 3);
		b[i] = zmul (b[i - 1], i);
		d[i] = zmul (d[i - 1], c[i]);
	}
}

int gg (int x, int y){return zmul (b[x], zmul (d[y], d[x - y]) );}

void work ()
{
	if (m < k) swap(m, k); -- n;
	sum = 0, ans = 1;
	for (int i = 0; i <= m + k; ++ i)
	{
		sum = zadd (sum, zmul (gg (n + i, n), zmul (a[m + k - i], ans) ) );
		if (i < k) ans = zmul (ans, 2);
		else if (i < m) ans = zsub (zmul (ans, 2), gg (i, k) );
		else ans = zsub (zmul (ans, 2), zadd (gg (i, m), gg (i, k) ) );
	}
}

void prin ()
{
	printf ( "%d" , sum);
}

int main ()
{
	init ();
	work ();
	prin ();
	return 0;
}

Measured memory_bytes: 18816
use proconio::{fastout, input};

#[fastout]
fn main() {
    let n: i128;
    let x: Vec<i128>;

    input! {n: i128, x: [i128; n]};

    let mut sum: u128 = 1000000000000000000;

    for i in 1..101 {
        let mut tmp_sum: u128 = 0;
        for j in x.iter() {
            tmp_sum += (j - i).pow(2) as u128;
        }
        sum = std::cmp::min(sum, tmp_sum)
    }

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


Measured memory_bytes: 2204
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        while (true) {
            int n = Integer.parseInt(sc.next());
            int s = Integer.parseInt(sc.next());

            if (n == 0 && s == 0) break;

            System.out.println(dfs(0, n, 0, s, -1));
        }
    }

    private static int dfs(int depth, int maxDepth, int sum, int maxSum, int maxNum) {
        if (depth == maxDepth) return ((sum == maxSum)? 1 : 0);

        int ans = 0;
        int lim = Math.min(maxSum - sum, 9);

        for (int i = maxNum + 1; i <= lim; i++) {
            ans += dfs(depth + 1, maxDepth, sum + i, maxSum, i);
        }
        return ans;
    }
}

Measured memory_bytes: 25976
k, n = map(int, input().split())
a = list(map(int, input().split()))

maxdist = 0
for i in range(n-1):
    maxdist = max(maxdist, a[i+1] - a[i])
maxdist = max(maxdist, (k - a[-1]) + a[0])
    
print(k - maxdist)

Measured memory_bytes: 26420
#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)
#define ALL(a)     (a).begin(),(a).end()
#define MOD 1000000007

typedef long long int ll;

const ll INF=(ll)1e19;
//const int INF=(1<<30);


int main(){
  int N,M,X;
  cin >> N >> M >> X;

  vector<int> a(M);

  REP(i,M)cin >> a[i];
  int t = lower_bound(ALL(a),X) - a.begin();
  cout << min(t, M-t) << endl;
}



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

int D;
std::vector<int> c(26);
std::vector<std::vector<int>> s(365, std::vector<int>(26));


void calc_score() {
    for (int i = 0; i < D; i++) {
        int max_idx = 0;
        int max_gain = s[i][max_idx] + c[max_idx];
        for (int j = 1; j < 26; j++) {
            int gain = s[i][j] + c[j];
            if (max_gain < gain) {
                max_idx = j;
            } else if (max_gain == gain) {
                for (int k = i + 1; k < D; k++) {
                    if (s[k][max_idx] + c[max_idx] < s[k][j] + c[j]) {
                        max_idx = j;
                        break;
                    } else if (s[k][max_idx] + c[max_idx] > s[k][j] + c[j]) {
                        break;
                    }
                }
            }
        }
        std::cout << max_idx + 1 << std::endl;
    }
}



int main() {
    std::cin >> D;

    for (int i = 0; i < 26; i++) {
        std::cin >> c[i];
    }

    for (int i = 0; i < D; i++) {
        for (int j = 0; j < 26; j++) {
            std::cin >> s[i][j];
        }
    }

    calc_score();
}


Measured memory_bytes: 3712
/**
 * @author ayaankhan98
 */
#include <bits/stdc++.h>

using namespace std;

#define INF ULLONG_MAX
#define FIO                                                                    \
  ios_base::sync_with_stdio(0);                                                \
  cin.tie(0);                                                                  \
  cout.tie(0);
#define setz(x) memset(x, 0, sizeof(x))
#define seto(x) memset(x, 1, sizeof(x))
#define PI 3.1415926535897932384626

#define logs(a)                                                                \
  {                                                                            \
    cout << #a << " : [";                                                      \
    for (auto &x : a)                                                          \
      cout << x << ", ";                                                       \
    cout << "]\n";                                                             \
  }

#define loga(a)                                                                \
  {                                                                            \
    cout << #a << " :\n[\n";                                                   \
    for (auto x : a)                                                           \
      cout << "  " << x.first << " : " << x.second << "\n";                    \
    cout << "]\n";                                                             \
  }

#define debug(...) (debugPrint(#__VA_ARGS__ " : ", __VA_ARGS__))
template <typename... Args>
void debugPrint(const char *label, Args &&... args) {
  cout << "\n[";
  auto l = [](auto &&arg) {
    std::cout << std::forward<decltype(arg)>(arg) << ", ";
  };
  std::cout << label;
  (l(std::forward<Args>(args)), ...);
  cout << "\b\b]\n";
}

auto ONLINE = []() {
#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif
};

void solve() {
  /// write your code here
  int n;
  cin >> n;
  int cnt = 0;
  int x, y;
  while(n--) {
    cin >> x >> y;
    
    if (x == y) {
      cnt++;
    }
    if (cnt == 3) {
      cout << "Yes";
      return;
    }
    if (x != y) {
      cnt = 0;
    }
  }
  cout << "No";
  return;
}

int main() {
  FIO;
  ONLINE();
  int t = 1;
 // cin >> t;
  while (t--)
    solve();
  return 0;
}


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

#define ll long long
#define mp make_pair
#define pb push_back

#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#define rep(i, n) for (int i = 0; i < (int)(n); ++ i)

int n, a[6005], dp[6005][6005], nex[6005], lst[6005], id[6005], bg[2005];
int extra, ans;

void solve_extra() {
	for (int i = 2; i + 2 < n * 3; i += 3) {
		if (a[i] == a[i + 1] && a[i + 1] == a[i + 2]) {
			++ extra;
			for (int j = i; j + 3 < n * 3; ++ j) a[j] = a[j + 3];
			-- n;
			return solve_extra();
		}
	}
}

bool F(int x, int y, int z) {
	return a[x] == a[y] && a[y] == a[z];
}

void upd(int a, int b, int v) {
	dp[a][b] = max(dp[a][b], v);
}

void extend(int a, int b, int c) {
	if (c == n * 3 - 1) { ans = max(ans, dp[a][b] + F(a, b, c)); return ; }
	int d = c + 1, e = d + 1;
	upd(a, c, dp[a][b] + F(b, d, e));
	upd(a, d, dp[a][b] + F(b, c, e));
	upd(a, e, dp[a][b] + F(b, c, d));
	upd(b, c, dp[a][b] + F(a, d, e));
	upd(b, d, dp[a][b] + F(a, c, e));
	upd(b, e, dp[a][b] + F(a, c, d));
	upd(c, d, dp[a][b] + F(a, b, e));
	upd(c, e, dp[a][b] + F(a, b, d));
	upd(d, e, dp[a][b] + F(a, b, c));
}

int main() {
	scanf("%d", &n);
	rep(i, n * 3) scanf("%d", &a[i]), -- a[i];
//	n = 2000;
//	rep(i, n * 3) a[i] = rand() % n;
	solve_extra();
	id[0] = id[1] = -1;
	rep(i, n) {
		bg[i] = i * 3 + 2;
		for (int j = i * 3 + 2; j <= i * 3 + 4 && j < n * 3; ++ j) id[j] = i;
	}
	rep(i, n) lst[i] = n * 3;
	for (int i = n * 3 - 1; ~i; -- i) {
		nex[i] = lst[a[i]];
		lst[a[i]] = i;
	}
	memset(dp, -0x3f, sizeof(dp));
	dp[0][1] = 0;
	rep(j, n * 3) rep(i, j) {
		extend(i, j, bg[id[j] + 1]);
		if (id[j] < id[nex[i]]) extend(i, j, bg[id[nex[i]]]);
		if (id[j] < id[nex[j]]) extend(i, j, bg[id[nex[j]]]);
	}
	printf("%d\n", ans + extra);
	return 0;
}


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

int f(int n) {
    if (n % 2 == 0) {
        return n / 2;
    }
    return 3 * n + 1;
}

int main(void) {
    int s;
    cin >> s;
    vector<int> a;
    vector<int> cnt(1e6 + 1);
    a.push_back(s);
    cnt.at(s)++;
    for (int i = 1;; i++) {
        int ai = f(a.back());
        a.push_back(ai);
        cnt.at(ai)++;
        for (int ii = 0; ii <= 1e6; ii++) {
            if (cnt.at(ii) > 1) {
                cout << i + 1 << endl;
                return 0;
            }
        }
    }
    return 0;
}

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

#define int long long int

int32_t main()
{
    int n,c,b;
    cin>>n>>c>>b;
    int a[n];
    for(int i=0;i<n;i++)
    cin>>a[i];

    int ans=0;
    for(int i=1;i<n;i++)
    {
        int check=(a[i]-a[i-1])*c;
        if(check>b)ans+=b;
        else
        ans+=check;
    }
    cout<<ans<<endl;
}

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

#define REP(i, m, n) for (int i = (m); i < (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define mp make_pair
typedef long long ll;
const ll INF = 1LL << 60;
const ll mod = 1e9 + 7;
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;
}

ll modpow(ll a, ll p)
{
    if (p == 0)
        return 1;
    if (!(p % 2))
    {
        ll halfP = p / 2;
        ll half = modpow(a, p);
        return half * half % mod;
    }
    else
    {
        return a * modpow(a, p - 1) % mod;
    }
}

ll comb(int a, int b)
{
    if (b > a - b)
        return comb(a, a - b);
    ll ansMul = 1;
    ll ansDiv = 1;
    for (int i = 0; i < b; i++)
    {
        ansMul *= a - i;
        ansDiv *= i + 1;
        ansMul %= mod;
        ansDiv %= mod;
    }
    ll ans = ansMul * modpow(ansDiv, mod - 2) % mod;
    return ans;
}

int main() {
    string s; cin >> s;
    int n = s.size();
    ll dp[101010][13];
    dp[0][0] = 1;
    ll mul = 1;
    rep(i, n) {
        if (s[n-1-i] == '?') {
            rep(k, 10) {
                rep(j, 13) {
                    dp[i+1][(k*mul+j)%13] += dp[i][j];
                    dp[i+1][(k*mul+j)%13] %= mod;
                }
            }
         }
        else {
            int num = int(s[n-1-i] - '0');
            rep(j, 13) {
                dp[i+1][(num*mul+j)%13] += dp[i][j];
                dp[i+1][(num*mul+j)%13] %= mod;
            }
        }
        mul *= 10;
        mul %= 13;
    }
    
    cout << dp[n][5] % mod << endl;

    return 0;
}


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

using namespace std;

class FindBridge {
public:
    explicit FindBridge(const vector<vector<int>>& g) : ord(g.size(), -1), pre(g.size(), -1) {
        int curOrder = 0;
        search_(g, 0, -1, curOrder);
        auto reorder = [](vector<pair<int, int>>& v){
            for(auto& p : v){
                if(p.first > p.second) swap(p.first, p.second);
            }
            sort(v.begin(), v.end());
        };
        reorder(bridge);
        reorder(edge);
    }
private:
    void search_(const vector<vector<int>>& g, int pos, int prev, int& curOrder){
        ord[pos] = pre[pos] = curOrder;
        ++curOrder;
        for(auto& e : g[pos]){
            if(e == prev) continue;
            if(ord[e] == -1) search_(g, e, pos, curOrder);
            if(ord[pos] < pre[e]){
                bridge.emplace_back(pos, e);
            } else {
                edge.emplace_back(pos, e);
            }
            pre[pos] = min(pre[pos], pre[e]);
        }
    }
public:
    const vector<pair<int, int>> getBridge() const { return bridge; }
    const vector<pair<int, int>> getEdge() const { return edge; }
private:
    vector<int> ord;
    vector<int> pre;
    vector<pair<int, int>> bridge;
    vector<pair<int, int>> edge;
};

int main(){
    int n, m;
    while(cin >> n >> m){
        vector<vector<int>> g(n);
        for(int i=0;i<m;i++){
            int a, b; cin >> a >> b;
            g[a].push_back(b);
            g[b].push_back(a);
        }
        FindBridge b(g);
        for(auto& e : b.getBridge()){
            cout << e.first << " " << e.second << endl;
        }
    }
}


Measured memory_bytes: 5292
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin>>n;
	
	long long a[100005],b[100005],c[100005];
	long long dp[100005][3];
	
	for(int i = 0;i < n;i++)
		cin>>a[i]>>b[i]>>c[i];
	
	for(int i = 0;i < 3;i++)
		dp[n][i] = 0;
	
	for(int i = n-1; i >= 0; i--)
	{
		dp[i][0] = a[i] + max(dp[i+1][1],dp[i+1][2]);
		dp[i][1] = b[i] + max(dp[i+1][0],dp[i+1][2]);
		dp[i][2] = c[i] + max(dp[i+1][1],dp[i+1][0]);
	}
	
	long long ans = max(dp[0][0],dp[0][1]);
	ans = max(ans,dp[0][2]);
	cout<<ans;
}

Measured memory_bytes: 4992
#include<iostream>
#include<cmath>

using namespace std;

int main(void)
{
	int n,t,a,h[1005];
	cin >> n >> t >> a;
	for(int i=1;i<=n;i++)
		cin >> h[i-1];
	
	int ans=1;
	double anst=t-h[0]*0.006;

	for(int i=1;i<=n;i++)
	{
		double tmp=t-h[i-1]*0.006;
		if(abs(anst-a)>abs(tmp-a))
		{
			ans=i;
			anst=t-h[i-1]*0.006;
		}
	}

	cout << ans << endl;
}

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


Measured memory_bytes: 256
// トポロジカルソート
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<stack>
#include<algorithm>
#include<iostream>
#include<cmath>
#include<vector>

#include<queue>

using namespace std;

const int MAX_V = 10000;
const int MAX_E = 100000;

const int NO = 0;
const int MID = 1;
const int YES = 2;

// 各辺のつながりを格納する動的配列
vector<int> v_connection[MAX_V];
// 訪問情報を保持する配列
int ary_visit[MAX_V];
// 入力辺の数を格納する配列
int ary_inputEdge[MAX_V];
// トポロジカルソートの結果を格納するキュー
queue<int> topo_que;

void TopologicalSort(int v);

int main(void)
{

    int n, edge;
    int first, second;

    cin >> n >> edge;

    for(int i = 0; i < n; i++)
    {
        // 配列の初期化
        ary_inputEdge[i] = 0;
        ary_visit[i] = NO;
    }

    for(int i = 0; i < edge; i++)
    {
        cin >> first >> second;

        // 入力辺の数を記憶する
        ary_inputEdge[second]++;
        // 各辺のつながりを記憶する
        v_connection[first].push_back(second);
    }

    for(int i = 0; i < n; i++)
    {
        if( ary_visit[i] == NO )
        {
            // 頂点を順番に訪れる
            TopologicalSort(i);
        }
    }

    // 結果の表示
    int size = topo_que.size();

    int *result = new int[size];

    for(int i = size - 1; i >= 0; i--)
    {
        int val = topo_que.front();
        topo_que.pop();

        result[i] = val;
    }

    for(int i = 0; i < size; i++)
    {
        printf("%d\n", result[i]);
    }

    return 0;
}

// トポロジカルソートを実施するためのメソッド
// v : 訪問する頂点
void TopologicalSort(int v)
{
    int connect_v;

    if( ary_inputEdge[v] >= 0 && ary_visit[v] == NO )
    {
        // 訪問途中を記録
        ary_visit[v] = MID;

        for(unsigned int i = 0; i < v_connection[v].size(); i++ )
        {
            // 接続先の頂点No.の格納
            connect_v = v_connection[v][i];

            // vから接続している頂点の入力辺の次数を減算する
            ary_inputEdge[connect_v]--;
            // 接続している頂点を順番に訪れる
            TopologicalSort(connect_v);
        }
    }

    //if( ary_inputEdge[v] == 0 )
    if( ary_visit[v] == MID )
    {
        // 入力辺が無くなった頂点をトポロジカルキューに追加する
        topo_que.push(v);
        ary_inputEdge[v]--;
        ary_visit[v] = YES;
    }

}



Measured memory_bytes: 3976
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <cmath>
#include <iomanip>
#include <ctype.h>

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

#define TR ","
#define rep(i,N) for(int i=0;i<(int)N;++i)

ll GCD(ll x, ll y) {
    if (y == 0) return x;
    else return GCD(y, x % y);
}

ll LCM(ll x, ll y) {
    return x / GCD(x, y) * y;
}

ll wazu = 76543217;

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

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

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

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

    string S;
    cin >> S;

    int a = S.size();

    if (a <= K) { cout << S << endl; }
    else {
        string T = S.substr(0, K) + "...";
        cout << T << endl;
    }
}

Measured memory_bytes: 3632
#if defined(__GNUC__)
#include <bits/stdc++.h>
// __GNUC__
#else
#include "bits/stdc++.h"
#endif
using namespace std;

#define int long long

#if defined(__GNUC__)
#define __int32 __int32_t
#endif // __GNUC__

#define itn __int32
#define REP(i, n) for(itn (i) = 0; (i) < (n); (i)++)
#define REP2(i, x, n) for(itn (i) = x; (i) < (n); (i)++)
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define SORT(x) sort(ALL(x))
#define RSORT(x, T) sort(ALL(x), greater<T>())
#define REVERCE(x) reverce(ALL(x))

#define INT_POW(x, y) [](int a, int b) -> int {int c = a; REP(i, b - 1){c *= a;} return c;}(x, y)
#define INT_POWM(x, y, m) [](int a, int b, int m) -> int {int c = a; REP(i, b - 1){c *= a; c %= m;} return c;}(x, y, m)

itn main() {
	ios::sync_with_stdio(false);

	int n, k;

	cin >> n >> k;

	vector<int> a(n);

	REP(i, n) {
		cin >> a[i];
		a[i]--;
	}

	vector<int> ruiyo(n + 1);
	ruiyo[0] = 0;

	REP(i, n) {
		ruiyo[i + 1] = (ruiyo[i] + a[i]) % k;
	}

	int res = 0;
	
	map<int, int> mp;
	queue<int> q;


	REP(j, n + 1) {
		res += mp[ruiyo[j]];

		q.push(ruiyo[j]);
		mp[ruiyo[j]]++;

		if (q.size() >= k) {
			mp[q.front()]--;
			q.pop();
		}
	}

	cout << res;

	return 0;
}


Measured memory_bytes: 17536