akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <limits>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <vector>
#include <deque>
#include <stack>
#include <queue>
#include <vector>
#include <deque>
#include <cmath>

using namespace std;
int a, b, c, d;
long long max_ans = numeric_limits<long long>::min();

int main() {
    scanf("%d %d", &a, &b);
    scanf("%d %d", &c, &d);
    max_ans = max(max_ans, (long long) a * c);
    max_ans = max(max_ans, (long long) a * d);
    max_ans = max(max_ans, (long long) b * c);
    max_ans = max(max_ans, (long long) b * d);
    printf("%lld\n", max_ans);
    return 0;
}


Measured memory_bytes: 3824
#map(int,input().split())
n=int(input())
s=[]
for i in range(n):
    s.append(input())
s.sort()
g=[]
buf=s[0]
count=0
for i in range(n):
    if buf==s[i]:
        count+=1
    else:
        g.append((count,buf))
        buf=s[i]
        count=1
g.append((count,buf))
g.sort(reverse=True)
idx=g[0][0]
h=[]
import sys
for i,j in g:
    if i==idx:
        h.append(j)
h.sort()
for j in h:
    print(j)

Measured memory_bytes: 99108
import java.io.IOException;

import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) throws IOException {
        try (
            BufferedReader reader = new BufferedReader(
                new InputStreamReader(System.in))) {
            final String s = reader.readLine();

            int N = Integer.parseInt(s);

            int ans = 0;

            for (int i = 1; i <= N; i++) {
                int cnt = 0;
                for (int j = 1; j <= i; j++) {
                    if (i % 2 == 1 && i % j == 0) cnt++;
                }
                if (cnt == 8) ans++;
            }

            System.out.println(ans);
        }
    }
}


Measured memory_bytes: 20692
a,b,c=map(int,input().split(" "))
for i in range(c):
    if a%2==0:
        a,b=a//2,b+a//2
        a,b=b,a
    else:
        a,b=(a-1)//2,b+(a-1)//2
        a,b=b,a
if c%2==0:
    print("{}".format(a)+" "+"{}".format(b))
else:
    print("{}".format(b)+" "+"{}".format(a))
        

Measured memory_bytes: 3444
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define reu(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i))
#define each(it,o) for(auto it= (o).begin(); it != (o).end(); ++ it)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset(m,v,sizeof(m))
#define inrep int t;cin>>t; while(t--)
using namespace std;
using namespace __gnu_pbds; 


typedef long long int ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef vector<pii > vpii;
typedef vector<ll> vll;
typedef pair<ll,ll> pll;
typedef vector<pll > vpll; 
typedef vector<string> vs;
typedef long double ld;
const ll MOD = 1e9+7;
template<typename T> istream& operator>> ( istream &in,vector<T> &v ) {

    for ( unsigned   i=0; i<v.size(); i++ )
        in>>v[i];
    return in;
}
int main()
 {
//     #ifndef ONLINE_JUDGE
//     freopen("input.txt","r",stdin);
//     freopen("output.txt","w",stdout);
//     #endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin>>n;
    double v[n];
    for(int i=0;i<n;i++)
    {
        cin>>v[i];
    }
    sort(v,v+n);double s=v[0];
    for(int i=1;i<n;i++)
    {
        s = (s+v[i])/2;
    }
    cout<<s;
    // #ifndef ONLINE_JUDGE
    //     cout<<"\nTime Elapsed : "<< 1.0*clock() / CLOCKS_PER_SEC << " s\n";
    // #endif
    
    return 0;
}

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

int main()
{


        string S;
        cin >> S;

        int length = S.length();

        int temp = length;
        string sub, sub2;
        int ok = 0;

        while (1) {
        temp--;
        if (temp == 0) {
                break;
        }
        if (temp % 2 == 0) {
                sub = S.substr(0, temp / 2);
                sub2 = S.substr(temp/2, temp/2);
                if (sub == sub2) {
                        ok = 1;
                        break;
                }
        }
        }

        cout << temp << endl;








}


Measured memory_bytes: 256
#include<stdio.h>
    #include<string.h>
    int main(void){
    int A,B,C,a,b,c,d,e,k,i,j,cou,min,v[1000000];
    char S[100000];
    scanf("%d",&a);
    scanf("%d",&b);
    scanf("%d",&c);
    scanf("%d",&d);
    scanf("%d",&e);
    if((a==b)&&(a==c)&&(a==d)&&(a==e)){
        if(a%10!=0){
        a=a/10+1;
        a=a*10;
    }
    if(b%10!=0){
        b=b/10+1;
        b=b*10;
    }
    if(c%10!=0){
        c=c/10+1;
        c=c*10;
    }
    if(d%10!=0){
        d=d/10+1;
        d=d*10;
    }
    printf("%d",a+b+c+d+e);
    }else{
      min=a;
    if((min%10>b%10)&&(b%10!=0)){
        min=b;
    }
    if((min%10>c%10)&&(c%10!=0)){
        min=c;
    }
    if((min%10>d%10)&&(d%10!=0)){
        min=d;
    }
    if((min%10>e%10)&&(e%10!=0)){
        min=e;
    }
    if((a%10!=0)&&(a!=min)){
        a=a/10+1;
        a=a*10;
    }
    if((b%10!=0)&&(b!=min)){
        b=b/10+1;
        b=b*10;
    }
    if((c%10!=0)&&(c!=min)){
        c=c/10+1;
        c=c*10;
    }
    if((d%10!=0)&&(d!=min)){
        d=d/10+1;
        d=d*10;
    }
    if((e%10!=0)&&(e!=min)){
        e=e/10+1;
        e=e*10;
    }
    printf("%d",a+b+c+d+e);
    }return 0;
    }

Measured memory_bytes: 128
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <map>
#include <numeric>
#include <string>
#include <cmath>
#include <iomanip>
#include <queue>
#include <list>
#include <stack>
#include <cctype>
#include <cmath>

using namespace std;

/* typedef */

typedef long long ll;

/* constant */

const int INF = 1 << 30;
const int MAX = 10000;
const int mod = 1000000007;
const double pi = 3.141592653589;
/* global variables */

/* function */
/* main */
int main(){

    int n; cin >> n;
    vector<int> v(n);
    for (int i = 0; i < n; i++) cin >> v[i];
    
    int q; cin >> q;
    int l, m, r;
    for (int i = 0; i < q; i++) {
        cin >> l >> m >> r;
         std::rotate(v.begin() + l, v.begin() + m, v.begin() + r);

    }

    for (int i = 0; i < n; i++) {
        if (i) cout << ' ' ;
        cout << v[i];
    } cout << '\n';

    return 0;
}



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

int main(){
    int n;
    cin >> n;
    vector<int>a(n);
    for(int i=0; i<n; i++){
        cin >> a[i];
    }
    for(int i=n-1; i>=0; i-=2){
        cout << a[i] << ' ';
    }
    if(n%2 == 0){
        for(int i = 0; i<n; i+=2){
            cout << a[i] << ' ';
        }
    }
    else {
        for(int i = 1; i<n; i+=2){
            cout << a[i] << ' ';
        }
    }
}



Measured memory_bytes: 3984
# include <bits/stdc++.h>
# define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
# define reps(i, n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
# define rrep(i, n) for(int i=((int)(n)-1); i>=0; --i)
# define rreps(i, n) for(int i=((int)(n)); i>0; --i)
# define ALL(x) (x).begin(), (x).end()
# define SZ(x) ((int)(x).size())
# define pb push_back
# define optimize_cin() cin.tie(0); ios::sync_with_stdio(false)
# define MSG(x) std::cout << #x << " : " << x << "\n";
using namespace std;
using lint = long long;
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; }

int sum_of(vector<int> values)
{
    int sum = 0;
    for (int i = 0; i < SZ(values); ++i)
    {
        sum += values[i];
    }
    return sum;
}

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

    vector<int> taste;
    for (int i = 1; i <= N; ++i)
    {
        taste.push_back(L + i - 1);
    }

    if (taste[0] >= 0 && taste[N-1] > 0)
    {
        taste[0] = 0;
        cout << sum_of(taste) << "\n";
    }
    else if (taste[0] < 0 && taste[N-1] >= 0)
    {
        cout << sum_of(taste) << "\n";
    }
    else
    {
        taste[N-1] = 0;
        cout << sum_of(taste) << "\n";
    }

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<string>
#include<cstring>
#include<climits>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<set>
#include<stack>
#include<queue>
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pb push_back
#define mp make_pair
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
#define INF 1e9+7
#define LLINF 1e18
// #define int ll
using namespace std;
const int MOD = 1e9 +7;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll r,d,x;
    cin>>r>>d>>x;
    rep(i,10){
        x= r*x-d;
        cout<<x<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
//なんで遅いんだろ
//#include<bits/stdc++.h>
#include<cstdio>
#include<algorithm>
#include<vector>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please

const int cm = 1 << 17;
char cn[cm], * ci = cn + cm, ct;
inline char getcha() {
	if (ci - cn == cm) { fread(cn, 1, cm, stdin); ci = cn; }
	return *ci++;
}
inline int getint() {
	int A = 0;
	while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';
	return A;
}

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


	int N;
	N = getint();
	int A[200000];
	ll B[200001], C;
	B[0] = 0;
	C = 0;

	vector<int> V;
	V.pb(0);
	rep(i, N) A[i] = getint();
	ll mae = A[0];
	rep(i, N) {
		ll a = A[i];
		B[i + 1] = B[i];
		if (mae >= a) {
			a *= 4;
			while (mae >= a) {
				V.pb(0);
				a *= 4;
			}
			V.back()++;
		}
		else {
			while (mae < a) {
				int kari = V.back();
				B[i + 1] += kari;
				if (V.size() > 1) {
					V.pop_back();
					V.back() += kari;
				}
				mae *= 4;
			}
			V.back()++;
		}
		mae = A[i];
	}
	V.clear();
	mae = A[N - 1];
	V.pb(0);
	ll kotae = 2 * B[N] + N;
	for (int i = N - 1; i >= 0; i--) {
		ll a = A[i];
		if (mae >= a) {
			a *= 4;
			while (mae >= a) {
				V.pb(0);
				a *= 4;
			}
			V.back()++;
		}
		else {
			while (mae < a) {
				int kari = V.back();
				C += kari;
				if (V.size() > 1) {
					V.pop_back();
					V.back() += kari;
				}
				mae *= 4;
			}
			V.back()++;
		}
		mae = A[i];
		kotae = min(kotae, B[i] + B[i] + C + C + i);
	}

	printf("%lld", kotae);

	Would you please return 0;
}

Measured memory_bytes: 2688
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<string>
#include<vector>
#include<stack>
#include<bitset>
#include<cstdlib>
#include<cmath>
#include<set>
#include<list>
#include<deque>
#include<map>
#include<queue>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define fr(i,x,n) for(int i=x;i<=n;i++)
#define rf(i,n,x) for(int i=n;i>=x;i--)
#define mst(x,i) memset(x,i,sizeof(x))
#define IOS ios::sync_with_stdio(false),cin.tie(0)
#define PB push_back
#define X first
#define Y second
using namespace std;
typedef long long LL;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<LL,LL> pll;
const int maxn=80+5;
const int maxm=1E5+5;
const int inf=0x3f3f3f3f;
const LL INF=0x3f3f3f3f3f3f3f3f;
const LL mod=1E9+7;
const double eps=1E-6;
const double PI=acos(-1.0);
template<class T>
bool scan(T &ret){
    char c;int sgn;
    if(c=getchar(),c==EOF) return 0;
    while(c!='-'&&(c<'0'||c>'9')) c=getchar();
    sgn=(c=='-')?-1:1;
    ret=(c=='-')?0:(c-'0');
    while(c=getchar(),c>='0'&&c<='9') ret=ret*10+(c-'0');
    ret*=sgn;
    return 1;
}
template<class T>
T gcd(T a,T b){
    return b==0?a:gcd(b,a%b);
}
template<class T>
T qpow(T a,T b,T mod){
    T ret=1;
    a%=mod;
    while(b){
        if(b&1) ret=(a*ret)%mod;
        a=(a*a)%mod;
        b>>=1;
    }
    return ret%mod;
}
void solve(){
    int a,b;cin>>a>>b;
    int cur=1,cnt=0;
    while(cur<b){
        cur=cur-1+a;
        cnt++;
    }
    cout<<cnt<<endl;
}
int main(){
#ifdef LOCAL
    freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
#endif
    IOS;
    int T=1;
    //cin>>T;
    while(T--){
        solve();
    }
    return 0;
}


Measured memory_bytes: 256
#include        <map>
#include      <cmath>
#include      <queue>
#include     <string>
#include     <cstdio>
#include     <vector>
#include    <cstring>
#include   <iostream>
#include  <algorithm>
using namespace std;
#define ll long long
const ll inf = 0x3f3f3f3f3f3f3f3f;
const int maxn = 10000+5;
const ll mod = 1e9+7;

char s[maxn];
int main(){
    int n;
    scanf("%d",&n);
    scanf("%s",s);
    for(int i=0;s[i];i++){
        s[i] = ((s[i]-'A')+n)%26 + 'A';
    }
    puts(s);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define maxch(x,y) x=max(x,y)
#define minch(x,y) x=min(x,y)
#define mp(a,b) make_pair(a,b)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define maxch(x,y) x=max(x,y)
#define minch(x,y) x=min(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
template<class T,class U>inline void chmin(T &t,U f){if(t>f)t=f;}
template<class T,class U>inline void chmax(T &t,U f){if(t<f)t=f;}
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) > (b) ? (b) : (a))

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> PPI;

#define INF INT_MAX/3
#define MAX_N 1000
ll a,b,x;
void solve(){
   cin.tie(0);
  ios::sync_with_stdio(false);
  cin>>a>>b>>x;
  if(a+b >= x && a <= x) cout<<"YES"<<endl;
  else cout<<"NO"<<endl;
}
int main(){
  solve();
  return 0;
}


Measured memory_bytes: 256
N = int(input())
A = list(map(int,input().split()))


absmin = abs(A[0])
m = 0
sum = 0

for i in A:
    if i < 0:
        m += 1
    sum += abs(i)
    absmin = min(abs(i),absmin)


if m%2 == 1:
    sum -= absmin*2

print(sum)

Measured memory_bytes: 14224
N=int(input())
H=[int(i) for i in input().split()]
ans=0
while any(h>0 for h in H):
  itv=1
  for i in range(N-1):
    if H[i]>0 and H[i+1]<=0:
      itv+=1
  if H[-1]<=0:
    itv-=1
  ans+=itv
  H=[h-1 for h in H]
  #print(itv)
print(ans)
      

Measured memory_bytes: 3060
#include <iostream>
#include <cctype>
#include <cstdio>
using namespace std;
int main()
{
  int n;
  cin >> n;
  for(int i=0; i<n; i++){
    string s;
    cin >> s;
    unsigned int num = 0;
    for(int j = 0; j<8; j++){
      num <<= 4;
      if(isdigit(s[j])) num += s[j] - '0';
      else num += (s[j] - 'a') + 10;
    }
    int unit = 5000000;
    int sum = 0;
    for(int i=0; i<7; i++){
      if((num & (0x40 >> i)) != 0){
        sum += unit >> i;
      }
    } 
    char buf[8];
    sprintf(buf,"%07d",sum);
    int id = 6;
    while(id > 0 && buf[id] == '0') id--;
    buf[id+1] = '\0';
    if((num & 0x80000000) != 0) cout << "-";
    cout << ((num >> 7) & 0x00ffffff) << "." << buf << endl;
  }
  return 0;
}

Measured memory_bytes: 1252
//***Little by little one travels far***
 
#include<bits/stdc++.h>
using namespace std;
 
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define ll long long
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i,n) for(i=0;i<n;i++)
#define forn(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define for1(i, n) for (ll i = 1; i <= (ll)(n); ++i)
#define ford(i, n) for (ll i = (ll)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (ll i = (ll)(a); i <= (ll)(b); ++i)
#define fora(it,x) for(auto it:x)
#define PI 3.14159265
#define sync ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define endl "\n"
 
typedef pair<ll, ll> pii;
typedef vector<ll> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long i64;
typedef vector<i64> vi64;
typedef vector<vi64> vvi64;
typedef pair<i64, i64> pi64;
typedef long double ld;
 
template<class T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; }

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

    forn(i,s.length()){
        if(i%2==0){
            if((s[i]!='R')&&(s[i]!='U')&&(s[i]!='D')){
                cout<<"No";
                return 0;
            }
        }
        else{
            if((s[i]!='L')&&(s[i]!='U')&&(s[i]!='D')){
                cout<<"No";
                return 0;
            }
        }
    }
    cout<<"Yes";
}

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



int main(){
    int H,W;
    cin >> H >> W;
    vector<string> moyou(H);
    for(int i = 0;i<H;i++){
        cin >> moyou.at(i);
        cout << moyou.at(i) << endl;
        cout << moyou.at(i) << endl;
    }
}

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

using namespace std;
typedef long long ll;
#define int ll
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef pair<int, int> PII;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define IN(a, b, x) (a<=x&&x<b)
#define MP make_pair
#define PB push_back
#ifdef int
const ll INF = (1LL<<60);
#else
const int INF = (1LL<<30);
#endif
const double PI = 3.14159265359;
const double EPS = 1e-12;
const int MOD = 1000000007;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }

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

// y???real(), x???imag()
//point
typedef complex<double> P;
namespace std {
	bool operator < (const P& a, const P& b) {
		return real(a) != real(b) ? real(a) < real(b) : imag(a) < imag(b);
	}
	bool cmp_y(const P &a, const P &b){
		return a.imag() != b.imag() ? a.imag() < b.imag() : a.real() < b.real();
	}
}
// circle
struct C {
	P p; double r;
	C(const P& p, double r) : p(p), r(r) {}
};

// 2???p1, p2?????????????????????r?????????2?????????
vector<C> calcCircle(P p1, P p2, double r) {
	if(abs(p1-p2) > 2*r) return {};
	P p3 = {(p1.real()+p2.real())/2, (p1.imag()+p2.imag())/2};
	// cout << p3.real() << " " << p3.imag() << endl;
	double l = abs(p1-p3);
	// cout << "l:" << l << endl;
	// ????????????p_1p_2
	P p1p2 = p2-p1;
	double a = p1p2.real(), b = p1p2.imag();
	double dx = b*sqrt((r*r-l*l)/(a*a+b*b)), dy = a*sqrt((r*r-l*l)/(a*a+b*b));
	// cout << "dx:" << dx << " dy:" << dy << endl;
	return {{{p3.real()+dx, p3.imag()-dy}, r}, {{p3.real()-dx, p3.imag()+dy}, r}};
}

// ???p??????c????????¨????????¨??????????????????
bool intersectCP(C c, P p) { return abs(p-c.p) <= c.r + EPS; }

P po[305];
signed main(void)
{
  while(true) {
    int n;
    cin >> n;
    if(!n) break;
    REP(i, n) {
      double x, y;
      cin >> x >> y;
      po[i] = {x, y};
    }

    int ans = 1;
    REP(i, n) FOR(j, i+1, n) {
      vector<C> ret = calcCircle(po[i], po[j], 1);
      if(ret.size() == 0) continue;
      // cout << "i:" << i << " j:" << j << endl;
      // cout << ret[0].p.real() << " " << ret[0].p.imag() << " " << ret[0].r << endl;
      // cout << ret[1].p.real() << " " << ret[1].p.imag() << " " << ret[1].r << endl;
      int num = 0;
      REP(k, n) {
        num += intersectCP(ret[0], po[k])?1:0;
        // if(intersectCP(ret[0], po[k])) cout << k << " ";
      }
      chmax(ans, num);
      // cout << "num:" << num << endl;
      num = 0;
      REP(k, n) {
        num += intersectCP(ret[1], po[k])?1:0;
        // if(intersectCP(ret[1], po[k])) cout << k << " ";
      }
      // cout << "num:" << num << endl;
      chmax(ans, num);
    }

    cout << ans << endl;
  }

  return 0;
}

Measured memory_bytes: 3260
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int taro=0,hanako=0;
		for(int i=0;i<n;i++) {
			String t = sc.next();
			String h = sc.next();
			int duel = t.compareTo(h);
			if(duel>0) {
				taro += 3;
			}else if(duel<0) {
				hanako += 3;
			}else if(duel==0) {
				taro+=1;
				hanako+=1;
			}
		}
		System.out.println(taro+" "+hanako);
	}

}



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

int main() {
  int h,w;
  cin >> h >> w;
  
  string board[50];
  
  for (int i=0; i<h; i++) cin >> board[i];
  
  const int x[8]={1,1,1,0,-1,-1,-1,0};
  const int y[8]={-1,0,1,1,1,0,-1,-1};
  
  for (int i=0; i<h; i++){
    for (int j=0; j<w; j++){
      if (board[i][j]=='#') continue;
      
      int num=0;
      for (int d=0; d<8; d++){
        const int ni =i+x[d];
        const int nj =j+y[d];
        
        if (ni<0 || h<=ni) continue;
        if (nj<0 || w<=nj) continue;
        if (board[ni][nj]=='#') num++;
      }
      
      board[i][j]=char(num+'0');
    }
  }
  
  for (int i=0; i<h; i++) cout << board[i] << endl;
}


Measured memory_bytes: 3600
#include<stdio.h>

int main(){
	int n, a, b;
	scanf("%d %d %d", &n, &a, &b);
	int sum = 0;
	
	for(int i = 0; i <= n; i++){
		int digitSum = 0;
		int temp = i;
		while(temp != 0){
			digitSum = digitSum + (temp % 10);
			temp /= 10;
		}
		if(digitSum <= b && digitSum >= a){
			sum += i;
		}
	}
	printf("%d\n", sum);
	
	return 0;
}

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

using namespace std;

int main(){
    vector<int> h(2);
    vector<int> k(2);
    for(int i = 0; i < 2; i++){
        cin >> h[i];
    }
    for(int i = 0; i < 2; i++){
        cin >> k[i];
    }
    int a;
    int b;
    int c;
    int d;
    cin >> a >> b >> c >> d;
    int hiroshi = (h[0] * a + h[1] * b + (h[0] / 10) * c +(h[1] / 20) * d);
    int kenjiro = (k[0] * a + k[1] * b + (k[0] / 10) * c +(k[1] / 20) * d);
    if(hiroshi > kenjiro){
        cout << "hiroshi" << endl;
    }
    else if(hiroshi < kenjiro){
        cout << "kenjiro" << endl;
    }
    else{
        cout << "even" << endl;
    }
}


Measured memory_bytes: 3120
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class AtCoderA
{
    private static int n;
    private static bool[,] route;

    static void Main()
    {
        var sc = new Scanner();

        n = sc.NextInt();
        int m = sc.NextInt();

        route = new bool[n + 1, n + 1];
        for (int i = 0; i < m; i++)
        {
            int a = sc.NextInt();
            int b = sc.NextInt();
            route[a, b] = true;
            route[b, a] = true;
        }

        int answer = dfs("1");

        Console.WriteLine(answer);
    }

    private static int dfs(string num)
    {
        if (num.Length == n)
        {
            return 1;
        }

        int ret = 0;
        for (int i = 2; i <= n; i++)
        {
            if (num.Contains(i.ToString()))
            {
                continue;
            }
            if (route[int.Parse(num.Substring(num.Length - 1)), i] == false)
            {
                continue;
            }
            ret += dfs(num + i);
        }

        return ret;
    }

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            while (_index >= _line.Length)
            {
                _line = Console.ReadLine().Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            _line = Console.ReadLine().Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}

Measured memory_bytes: 13140
a,b,c = map(int,input().split())
ans = 0

if a == b and a == c and a%2 == 0:
  print("-1")
elif a == b and a == c and a%2 == 0:
  print(0)
else:
  while a%2 == 0 and b%2 == 0 and c%2 == 0:
    ans += 1
    aa = b/2 + c/2
    bb = a/2 + c/2
    cc = a/2 + b/2
    a = aa
    b = bb
    c = cc
  print(ans)

Measured memory_bytes: 38256
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
#define chmin(a, b) ((a)=min((a), (b)))
#define chmax(a, b) ((a)=max((a), (b)))
#define fs first
#define sc second
#define eb emplace_back
using namespace std;

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

const ll MOD=1e9+7;
const ll INF=1e18;
const double pi=acos(-1);
const double eps=1e-10;

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

// A -> 0, G -> 1, C -> 2, T -> 3
ll dp[110][5][5][5];

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

    dp[0][4][4][4] = 1;

    for(int i=0; i<n; i++){
        for(int j=0; j<5; j++){ // i-2
            for(int k=0; k<5; k++){ // i-1
                for(int l=0; l<5; l++){ // i

                    if(dp[i][l][k][j] == 0) continue;

                    for(int m=0; m<4; m++){ // i+1
                        // *AGC 
                        if(k == 0 && l == 1 && m == 2) continue;

                        // *ACG
                        if(k == 0 && l == 2 && m == 1) continue;

                        // *GAC
                        if(k == 1 && l == 0 && m == 2) continue;

                        // A*GC
                        if(j == 0 && l == 1 && m == 2) continue;

                        // AG*C
                        if(j == 0 && k == 1 && m == 2) continue;

                        dp[i+1][m][l][k] += dp[i][l][k][j];
                        dp[i+1][m][l][k] %= MOD;
                    }
                }
            }
        }
    }

    ll ans=0;
    for(int i=0; i<4; i++){
        for(int j=0; j<4; j++){
            for(int k=0; k<4; k++){
                ans += dp[n][i][j][k];
                ans %= MOD;
            }
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define int long long
#define ll long long
using ull = unsigned long long;
using namespace std;
const int INF = 1e10;
const int MOD = 1e9 + 7;
#define dump(x)                             \
    if (dbg) {                              \
        cout << #x << " = " << (x) << endl; \
    }
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define FORR(i, a, b) for (int i = (a); i <= (b); ++i)
#define pb push_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(), (v).end()
#define SZ(x) ((int)(x).size())
#define P pair<int, int>
#define V vector<int>
#define S set<int>
#define itn int
bool dbg = false;
itn H, W;
itn A[100][100];
int B[100][100];
bool dp[100][100][26000];
int C[100][100];
itn X = 13000;
void solve() {

    FOR(i, 0, H) {
        FOR(j, 0, W) {
            C[i][j] = max(A[i][j], B[i][j]) - min(A[i][j], B[i][j]);
        }
    }
    dp[0][0][X + C[0][0]] = 1;
    FOR(i, 0, H) {
        FOR(j, 0, W) {
            FOR(t, 0, X * 2) {
                if (dp[i][j][t]) {
                    dp[i + 1][j][t + C[i + 1][j]] = 1;
                    dp[i + 1][j][t - C[i + 1][j]] = 1;
                    dp[i][j + 1][t + C[i][j + 1]] = 1;
                    dp[i][j + 1][t - C[i][j + 1]] = 1;
                }
            }
        }
    }
    itn ans = INF;
    FOR(i, 0, X * 2) {
        if (dp[H - 1][W - 1][i]) {
            ans = min(ans, abs(i - X));
        }
    }
    cout << ans << endl;
}

signed main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cin >> H >> W;
    FOR(i, 0, H) {
        FOR(j, 0, W) {
            cin >> A[i][j];
        }
    }
    FOR(i, 0, H) {
        FOR(j, 0, W) {
            cin >> B[i][j];
        }
    }
    solve();
    return 0;
}


Measured memory_bytes: 206080
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<numeric>
#include<functional>
#include<algorithm>
#include<bitset>
#include<tuple>
#include<unordered_set>
#include<unordered_map>
#include<random>
#include<array>
#include<cassert>
using namespace std;
#define INF ((1<<30)-1)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()

int n;
int a[200000];


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

	cin >> n;
	rep(i, n)cin >> a[i];

	long long ans = 0;
	int ma = 0;
	rep(i, n) {
		ans += max(0, ma - a[i]);

		ma = max(ma, a[i]);
	}
	cout << ans << endl;



	return 0;
}


Measured memory_bytes: 4420
#include<stdio.h>

int main(){
  int n, p[100], i, j, tmp, large, ans;

  scanf("%d", &n);

  for(i=0; i<n; i++){
    scanf("%d", &p[i]);
  }

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

  for(i=1; i<=n; i++){
    large=0;
    for(j=0; j<n; j++){
      if(p[j]>=i){
	large++;
      }else{
	break;
      }
    }
    if(large>=i){
      ans=i;
    }else if(large<i){
      break;
    }
  }
    

  printf("%d\n", ans);
  
  return 0;
}

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

int main(){
    vector<int> n(10);
    for(int i=0;i<4;i++){
        int a;
        cin >> a;
        n.at(a)++;
    }
    if(n.at(1)==1&&n.at(7)==1&&n.at(9)==1&&n.at(4)==1){
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }
}

Measured memory_bytes: 256
#include <stdint.h>

#include <iostream>

using namespace std;

int64_t f(int64_t h) {
  if (h == 1) return 1;

  return 1 + 2 * f(h / 2);
}

int main(void) {
  int64_t H;
  cin >> H;
  cout << f(H) << endl;
  return 0;
}


Measured memory_bytes: 3636
import math
while True:
    peple = int(input())
    Sum = 0
    Sumhen = 0
    if peple == 0:
        break
    test = [int(x) for x in input().split()]
    for i in range(peple):
        Sum += test[i]
    j = Sum/float(peple)
    for k in range(peple):
        Sumhen += (test[k] - j)**2
    print("{0:.8f}".format(math.sqrt(Sumhen/float(peple))))


Measured memory_bytes: 5716
#include <iostream>
using namespace std;
int main(){
	const string SEG[]={"0111111","0000110","1011011","1001111","1100110","1101101","1111101","0100111","1111111","1101111"};
	int n;
	while(cin>>n){
		if(n==-1)break;
		string current = "0000000";
		for(int i=0;i<n;++i){
			int num;
			cin>>num;
			for(int j=0;j<7;j++)cout<<(current[j]!=SEG[num][j])?"1":"0";
			current = SEG[num];
			cout<<"\n";
		}
	}
}

Measured memory_bytes: 0
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <functional>

using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
int A,B,H;






int main()
{

	cin >> A>>B>>H;



	cout << (long long)(A+B)*H/2 << endl;




}

Measured memory_bytes: 764
#include<bits/stdc++.h>
using namespace std;
int n,m;
int p[100005]; 
int y[100005];
vector<int>v[100005];
int main(){
	scanf("%d%d",&n,&m);
	for(int i=1;i<=m;i++){
		scanf("%d%d",&p[i],&y[i]);
		v[p[i]].push_back(y[i]);
	} 
	for(int i=1;i<=n;i++) sort(v[i].begin(),v[i].end());
	for(int i=1;i<=m;i++){
		printf("%06d",p[i]);
		int k=lower_bound(v[p[i]].begin(),v[p[i]].end(),y[i])-v[p[i]].begin()+1;
		printf("%06d\n",k);
	}
	return 0;
}

Measured memory_bytes: 7808
#include <iostream>
using namespace std;
int main() {
    int f = 111;
    int s = 222;
    int t = 333;
    int o = 444;
    int i = 555;
    int r = 666;
    int n = 777;
    int e = 888;
    int q = 999;

    int x = 0;

    cin >> x;

    if (x <= 111){
        cout << f;
    } else if (x <= 222){
        cout << s;
    } else if (x <= 333){
        cout << t;
    } else if (x <= 444){
        cout << o;
    } else if (x <= 555){
        cout << i;
    } else if (x <= 666){
        cout << r;
    } else if (x <= 777){
        cout << n;
    } else if (x <= 888){
        cout << e;
    } else if (x <= 999){
        cout << q;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
using LL = long long;
const LL LINF = 1e18;
using namespace std;
#define COUT(v) cout<<(v)<<endl
#define CIN(n)  int(n);cin >> (n)
#define LCIN(n) LL(n);cin >> (n)
#define SCIN(n) string(n);cin >> (n)
#define YES(n) cout<<((n)? "YES" : "NO")<<endl
#define Yes(n) cout<<((n)? "Yes" : "No")<<endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) <<endl

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

#define FOREACH(x,a) for(auto& (x) : (a) )

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

#define P pair<LL,LL>
#define I vector<int>
#define S set<int>
#define pb(v) push_back(v)
#define V vector
#define rt return
#define rmsame(a) sort(ALL(a)),a.erase(unique(ALL(a)), a.end())

typedef string::const_iterator State;
class PalseError {};
class Edge{
public:
    LL from,to,value;
    Edge(LL a,LL b,LL c){
        from = a;
        to = b;
        value = c;
    }
    Edge(LL a,LL b){
        from = a;
        to = b;
    }
};
queue<pair<string,int>> que;
int main(){
    CIN(N);
    I s;
    REP(a,N){
        CIN(b);
        s.push_back(b);
    }
    CIN(q);
    I T;
    REP(a,q){
        CIN(b);
        T.push_back(b);
    }
    S w;
    LL ans = 0;
    REP(a,q){
        REP(b,N){
            if(s.at(b)==T.at(a))w.insert(s.at(b));
        }
    }
    COUT(w.size());
    return 0;
}



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

using namespace std;

int main()
{
	int a, b;
	cin >> a >> b;
	if (a >= 1 && a <= 9 && b >= 1 && b <= 9)
		cout << a * b << endl;
	else
		cout << -1 << endl;
	return 0;
}

Measured memory_bytes: 256
extern crate core;

use std::io::{self, Read};

#[macro_export]
macro_rules! input {
  ($s:expr=>$($t:tt)*) => {
    let mut lines=$s.split("\n");
    $(
        line_parse!(lines,$t);
    )*
  };
}

macro_rules! line_parse {
  ($lines:expr,($($name:ident:$t:tt)*)) => {
    let mut line=$lines.next().unwrap().split_whitespace();
    $(value_def!(line,$name,$t);)*
  };

  //複数行
  ($lines:expr,{$n:expr;$name:ident:$t:tt}) => {
    values_def!($lines,$n,$name,$t);
  };
}

macro_rules! value_def {
  ($line:expr, $name:ident, $t:tt) => {
    let $name = value!($line, $t);
  };
}

macro_rules! values_def {
  ($lines:expr, $n:expr, $name:ident, $t:tt) => {
    let $name = {
      let mut vec = Vec::new();
      for i in 0..$n {
        let mut next = $lines.next().unwrap().split_whitespace();
        vec.push(value!(next, $t));
      }
      vec
    };
  };
}

macro_rules! value {
  //配列
  ($line:expr,[$t:tt]) => {
    $line.map(|x|{
      let mut iter=::std::iter::once(x);
      value!(iter,$t)
    }).collect::<Vec<_>>()
  };
  //タプル
  ($line:expr,($($t:tt),*)) => {
    ($(value!($line,$t),)*)
  };
  //文字列
  ($line:expr,#) => {
    $line.next().unwrap()
  };
  //インデックス(-1)
  ($line:expr,@) => {
    $line.next().unwrap().parse::<usize>().unwrap()-1
  };
  //単一値
  ($line:expr,$t:ty) => {
    $line.next().unwrap().parse::<$t>().unwrap()
  };
}

fn main() {
  let mut input = String::new();
  io::stdin().read_to_string(&mut input).unwrap();
  let output = solve(input.trim().to_string());
  println!("{}", output);
}

fn solve(input: String) -> String {
  input!(input=>(a:i64 b:i64 k:i64));
  let mut count = 0;
  for i in 0.. {
    let i = 100 - i;
    if a % i == 0 && b % i == 0 {
      count += 1;
    }
    if count == k {
      return i.to_string();
    }
  }
  1.to_string()
}

macro_rules! tests {
    ($($name:ident: $input:expr=>$output:expr,)*) => {
        mod tests {
            $(
                #[test]
                fn $name() {
                    assert_eq!($output.trim().to_string(),super::solve($input.trim().to_string()));
                }
            )*
        }
    }
}

tests! {
    test1: "8 12 2\n" => "2\n",
    test2: "100 50 4\n" => "5\n",
    test3: "1 1 1\n" => "1\n",
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define MOD 1000000007LL
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

string str;

int main(void){
	int l=0;
	int res=0;
	int flag=0;
	cin >> str;
	for(int i=0;i<str.size();i++){
		if(str[i]=='(' && flag==0){
			l++;
		}
		if(str[i]==')'){
			if(l>0 && flag==1){
				res++;
			}
			if(l>0)l--;
		}
		if(str[i]=='*'){
			flag=1;
		}
	}
	printf("%d\n",res);
	return 0;
}

Measured memory_bytes: 3328
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
int INF = 1e9;
int MOD = 1000000007;
int A[200000];
main(){
    int N,T;
    ll sum = 0;
    cin >> N >> T;
    for(int i = 0;i < N;i++){
        cin >> A[i];
    }
    for(int i = 0;i < N-1;i++){
        if(A[i+1] - A[i] < T)sum += A[i+1] - A[i];
        else sum += T;
    }
    sum += T;
    cout << sum << endl;
}

Measured memory_bytes: 1024
I=input;n,q=map(int,I().split());s=' %s '%I();l,r=0,n+1
for t,_,d in eval('I(),'*q)[::-1]:L,R=d<'R',d>'L';l+=(t==s[l+1])*L-(t==s[l])*R;r+=(t==s[r])*L-(t==s[r-1])*R
print(max(0,r-l-1))

Measured memory_bytes: 220256
#include <cstdint>
#include <iostream>
#include <vector>

using namespace std;
#define GRAPH_SIZE 200001

static vector<uint64_t> graph[GRAPH_SIZE];

int32_t main()
{
  uint64_t N, M;

  cin >> N >> M;

  for (uint32_t i = 0; i < M; i++) {
    uint64_t from, to;
    cin >> from >> to;
    graph[from].push_back(to);
    graph[to].push_back(from);
  }

  for (uint32_t i = 0; i < graph[1].size(); i++) {
    uint64_t to = graph[1][i];
    for (uint32_t j = 0; j < graph[to].size(); j++) {
      if (graph[to][j] == N) {
        cout << "POSSIBLE" << endl;
        return 0;
      }
    }
  }

  cout << "IMPOSSIBLE" << endl;

  return 0;
}


Measured memory_bytes: 12776
s = []
while True:
    try:
        s += input().lower()

    except EOFError:
        break

letters = "a b c d e f g h i j k l m n o p q r s t u v w x y z"
list1 = letters.split()

for j in range(len(list1)):

    print("{0} : {1}".format(list1[j], s.count(list1[j])))






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

using namespace std;

typedef long long ll;

#define sz size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(), (c).end()
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define per(i,a,b) for(ll i=b-1LL;i>=(a);--i)
#define clr(a, b) memset((a), (b) ,sizeof(a))
#define ctos(c) string(1,c)
#define endl "\n"
#define print(x) cout<<#x<<" = "<<x<<endl;

#define MOD 1000000007

ll d[100100];
ll ddd[100100];

ll ans;
vector<vector<ll> > vv;


void dfs(ll a, ll p, ll b, ll c){
  	rep(i,0,vv[a].sz){
    	if(vv[a][i]==p)continue;
    	if(vv[a][i]==b){
    		ans++;
    		return;
    	}
    	if(vv[a][i]==c){
    		return;
    	}
    	if(ddd[vv[a][i]]==1)continue;
    	ddd[a] = 1;
    	dfs(vv[a][i],a,b,c);
  	}
  	return;
}


int main() {
	ans = 0;
	ll n,m;
	cin>>n>>m;
	vector<vector<ll> > vv_(n,vector<ll>());
	vv = vv_;
	rep(i,0,m){
		ll a,b;
		cin>>a>>b;
		a--;b--;
		d[a]++;
		d[b]++;
		vv[a].pb(b);
		vv[b].pb(a);
	}
	ll c = 0;
	ll flag = 0;
	rep(i,0,n){
		if(d[i]%2==1){
			cout << "No" << endl;
			return 0;
		}
		else{
			if(d[i]>3)c++;
			if(d[i]>4)flag = 1;
		}
	}
	if(flag==1){
		cout << "Yes" << endl;
	}
	else if(c>2){
		cout << "Yes" << endl;
	}
	else if(c<2){
		cout << "No" << endl;
	}
	else{
		ll dd[2];
		ll index = 0;
		rep(i,0,n){
			if(d[i]==4){
				dd[index] = i;
				index++;
			}
		}
		clr(ddd,0);
		dfs(dd[0],-1,dd[0],dd[1]);
		clr(ddd,0);
		dfs(dd[1],-1,dd[1],dd[0]);
		if(ans==2){
			cout << "Yes" << endl;
		}
		else{
			cout << "No" << endl;
		}
	}
	return 0;
}

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

constexpr int DIR[] = {1, 0, 0, 1};

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

    int h, w;
    std::cin >> h >> w;
    std::vector<std::string> s(h);
    for (int i = 0; i < h; ++i)
    {
        std::cin >> s[i];
    }
    std::vector<std::vector<int>> dp(h, std::vector<int>(w, INT_MAX));
    dp[0][0] = s[0][0] == '#' ? 1 : 0;
    for (int i = 0; i < h; ++i)
    {
        for (int j = 0; j < w; ++j)
        {
            if (i || j)
            {
                int d = s[i][j] == '#' ? 1 : 0;
                if (i)
                {
                    dp[i][j] = std::min(dp[i][j], dp[i - 1][j] + d);
                    if (s[i][j] == s[i - 1][j ])
                    {
                        dp[i][j] = std::min(dp[i][j], dp[i - 1][j]);
                    }
                }
                if (j)
                {
                    dp[i][j] = std::min(dp[i][j], dp[i][j - 1] + d);
                    if (s[i][j] == s[i][j - 1])
                    {
                        dp[i][j] = std::min(dp[i][j], dp[i][j - 1]);
                    }
                }
            }
        }
    }
    std::cout << dp[h - 1][w - 1];
    return 0;
}

Measured memory_bytes: 384
#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>;

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

int main() {
  int N, X;
  cin >> N >> X;
  vector<int> x(N);
  rep(i, N) cin >> x[i];
  
  ll max_d = abs(X - x[0]);
  for (int i = 1; i < N; ++i) max_d = gcd(max_d, abs(X - x[i]));
  cout << max_d << endl;
  return 0;
}

Measured memory_bytes: 3744
#include <iostream>
#include <vector>
#include <cmath>

using namespace std;

int main() {
	int N,Q;
	string str;
	cin >> N >> Q >> str;

	int left = -1, right = N;

	vector<char>t(Q), d(Q);
	for (int i = 0; i < Q; i++) {
		cin >> t[i] >> d[i];
	}

	for (int i = Q - 1; i >= 0; i--) {
		//左端落下増える
		if(left < N -1 && str[left + 1] == t[i] && d[i] == 'L')left++;
		//左端落下減る
		if (left >= 0 && str[left] == t[i] && d[i] == 'R') left--;
		//右端落下増える
		if(right > 0 && str[right - 1] == t[i] && d[i] == 'R') right--;
		//右端落下減る
		if (right < N && str[right] == t[i] && d[i] == 'L') right++;

		if (right == 0 || left == N -1) break;
	}

	int ans = N - min(left + 1 + N - right, N);
	
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 900
// Mon May 11 18:21:13 IST 2020          
#include <bits/stdc++.h>        
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#define forn(ii,a,b)        for(int ii = (int)a ; ii < (int)b  ; ii++ )
#define debug(x)           cerr << #x << " " << x << " -- \n"
#define I__O               ios::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define int64              long long    
#define MOD                998244353 
#define pb                 push_back
#define f_                 first 
#define s_                 second    
#define all(x)             (x).begin(),(x).end() 
#define precise(x)         cout << fixed << setprecision(12) << x << '\n'; 
#define tough_nut          numeric_limits<int64>::min()
const double pi = 3.141592653589793238;
using namespace std ;     
using namespace __gnu_pbds;
 
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> indexed_set ; 
// const int N = 2e5; 
const int INF = INT_MAX;  
int tests(){
    int A,B,C,K ;
    cin >> A >> B >> C ;
    cin >> K ; 
    if(K <= A )
        return cout << K << '\n',0;
    K -= A ;
    if( K <= B)
        return cout << A << '\n',0;
    K -= B ; 
        return cout << A-K << '\n',0;

    return 0; 
}
int32_t main(){
    I__O ;    
    int cases = 1 ;  
    // cin >> cases ; 
    while(cases--){    
        tests(); 
    }
    return 0 ; 
}
 
// -Wall -Wextra -O2
// -pedantic -std=c++11
// -D_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_PEDANTIC

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

int main(){
  int n;
  long long t;
  long long min = 1000000;
  long long max = -1000000;
  long long sum = 0;
  cin >> n;
  for (int i = 0; i < n; i++)
  {
    cin >> t;
    if ( t<min ) min = t;
    if ( t>max ) max = t;
    sum += t;
  }
  cout << min << " " << max << " " << sum << endl;
  return 0;
}


Measured memory_bytes: 3092
SA = str(input())
SB = str(input())
SC = str(input())
S = [SA, SB, SC]
user = ["A", "B", "C"]
turn = 0
next_turn = "a"

while True:
    if len(S[turn]) == 0:
        break
    else:
        next_turn = S[turn][0]
        S[turn] = S[turn][1:]
        if next_turn == "a":
            turn = 0
        elif next_turn == "b":
            turn = 1
        else:
            turn = 2

print(user[turn])


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

int main() {

    int n; cin >> n;
    string s, t; cin >> s >> t;
    string ans = "";
    for (int i = 0; i < n; i++) {
        ans += s[i];
        ans += t[i];
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3580
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
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; }

bool dp[100500];

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int x;
	cin >> x;
	dp[0] = true;
	rep(i,x){
		if(dp[i]){
			rep(j,6){
				dp[i+100+j] = true;
			}
		}
	}
	if(dp[x]) cout << 1 << endl;
	else cout << 0 << endl;
	return 0;
}

Measured memory_bytes: 384
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while( scanner.hasNextLong() ){
            long a = scanner.nextInt();
            long b = scanner.nextInt();
            long x = a; 
            long y = b;
                while (!(x%y==0)) {     
                long z =x;
                x=y;
                y=z%y;   
                }
            long z = a/y;
            z = z*b;
            System.out.println(y+" "+z);
        }
    }
}



Measured memory_bytes: 25800
#include<iostream>
#include<cstdio>
using namespace std;
#define L 100
long long dp[L+1][11][1001];

main(){
  for ( int i = 0; i <= L; i++ )
    for ( int j = 0; j <= 10; j++ )
      for ( int k = 0; k <= 100; k++ ) dp[i][j][k] = 0;
  
  dp[0][0][0] = dp[0][1][0] = 1;

  for ( int i = 1; i <= L; i++ ){
    for ( int j = 0; j <= 10; j++ ){
      for ( int k = 0; k <= 1000; k++ ){
	dp[i][j][k] = dp[i-1][j][k];
	if ( k - i >= 0 && j > 0 ){
	  dp[i][j][k] += dp[i-1][j-1][k-i];
	}
      }
    }
  }

  int n, s;
  int tcase = 0;
  while(1){
    cin >> n >> s;
    if ( n == 0 && s == 0 ) break;
    tcase++;
    cout << dp[L][n][s] << endl;
  }
}

Measured memory_bytes: 9820
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;
ll n, ans;
int main(){
	scanf("%lld", &n);
	for(ll i = 1; i*(i+1) < n; i++){
		if(n%i == 0) ans += n/i-1;
	}
	printf("%lld\n", ans);
}

Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))

e = 0
for a in A:
    l = 0
    over = a.bit_length()
    while over - l > 1:
        m = (l+over) // 2
        if a % (1<<m) == 0: l = m
        else: over = m
    e += l
print(e)

Measured memory_bytes: 4148