akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <climits>
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <stack>
#include <algorithm>
#include <iomanip>
#include <map>
#include <queue>
#include <functional>
#include <numeric>
#include <chrono>
#include <cstdlib>
using ll = long long;
using namespace std;

const ll MOD = 1e9 + 7;
#define REP(i, n) for (int(i) = 0; (i) < (n); ++(i))
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
// bool operator<(const pair<int, int> &a, const pair<int, int> &b)
// {
//     if (a.first == b.first)
//         return a.second < b.second;
//     return a.first < b.first;
// };

/*unsigned int xor128(void)
{
    static unsigned int x = 123456789, y = 362436069, z = 521288629, w = 88675123;
    unsigned int t = (x ^ (x << 11));
    x = y;
    y = z;
    z = w;
    return (w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)));
}
unsigned int xor128rnd(unsigned int m)
{
    return xor128() % m;
}*/

/*bool operator<(const pair<int, int> &a, const pair<int, int> &b)
{
    if (a.first == b.first)
    {
        return a.second < b.second;
    }
    return a.first < b.first;
}*/
/*cin.tie(0);
    ios::sync_with_stdio(false);
*/
ll fib[31];
int main()
{
    fib[0] = 0;
    fib[1] = 1;
    fib[2] = 2;
    fib[3] = 4;
    for (int i = 4; i <= 30; ++i)
    {
        fib[i] = fib[i - 1] + fib[i - 2] + fib[i - 3];
    }
    int n;
    while (cin >> n, n)
    {
        cout << ((fib[n] % 3650) ? fib[n] / 3650 + 1 : fib[n] / 3650) << endl;
    }
    return 0;
}


Measured memory_bytes: 3072
/**
*	  Name: Ajay
*	  Institute: IIITH 
*/

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <deque>
#include <vector>
#include <cstdlib>
#include <iomanip>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <ctime>
#include <string.h>
#define LL long long
#define inf 0x7fffffff
#define mod 1000000007
#define pb push_back
#define ppi pair<int,int>
#define vi vector<int>
#define vii vector<ppi>
#define vll vector<LL>
#define mp make_pair
#define fi first
#define se second
using namespace std;

void fastio()
{
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
}
void input()
{
  #ifndef ONLINE_JUDGE
  freopen("input.txt","r",stdin);
  freopen("output.txt","w",stdout);
  #endif
}

int main()
{      
  LL a,b,c,x,y,i;
  cin>>a>>b>>c>>x>>y;
  LL ans=inf;
  ans=min(ans,(a*x+b*y));
  ans=min(ans,2*max(x,y)*c);
  ans=min(ans,2*min(x,y)*(c) +((x-min(x,y))*a + (y-min(x,y))*b));
  cout<<ans;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i, n) for (ll i = 0; i < n; i++)
#define rrep(i, n) for (ll i = n - 1; i >= 0; i--)
#define Rep(i, r, n) for (ll i = r; i < n; i++)
#define RRep(i, r, n) for (ll i = n - 1; i <= r; i--)
#define debug(x) cout << #x << ' ' << '=' << ' ' << (x) << endl;
#define fs first
#define sc second
#define int long long
#define pb push_back
const int dx[] = {0, -1, 0, 1};
const int dy[] = {1, 0, -1, 0};
const int MOD = (1000000007);
//const int MOD = (998244353);
//const int INF = (1 << 30)-1;
const int INF = (1LL << 60)-1;
const double EPS = (1 >> 30);

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

using Graph = vector<vector<pair<int, int>>>;

signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(10);
    //---------------------------------------------
    
    int n;
    cin>>n;
    if(n%2==0){
        cout<<n/2-1<<endl;
    }
    else{
        cout<<n/2<<endl;
    }
    
}

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

const int MOD = 998244353;
constexpr int N = 20;

string s;
int n;

ll f[N + 1][1 << N];


ll go(const vector<int>& a) {
    int k = a.size();
    if (k <= N) {
        int s = 0;
        for (int i = 0; i < a.size(); ++i) {
            s += a[i] << i;
        }

        return f[k][s];
    }

    vector<ll> fs(k + 1, 0);
    fs[0] = 1;

    for (int i = 1; i <= k; ++i) {
        fs[i] = (fs[i - 1] * (a[i - 1] + 1));
        for (int len = 1; len <= i / 2; ++len) {
            vector<int> cur(len);
            copy(a.begin() + i - len, a.begin() + i, cur.begin());
            for (int c = i - 2 * len; c >= 0; c -= len) {
                for (int j = 0; j < len; ++j) {
                    cur[j] &= a[c + j];
                }

                fs[i] += go(cur) * fs[c];
                fs[i] %= MOD;
            }
        }

        fs[i] %= MOD;
    }

    return fs[k];
}



int main() {
#ifdef PAUNSVOKNO
    freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
#endif
    ios_base::sync_with_stdio(false); cout.setf(ios::fixed); cout.precision(20); cout.tie(nullptr); cin.tie(nullptr);
    cin >> s;
    int n = s.length();
    f[0][0] = 1;

    vector<int> v;
    for (char c : s) {
        v.push_back(c == '1');
    }

    for (int ln = 1; ln <= N; ++ln) {
        int ms = (1 << (ln - 1)) - 1;
        for (int j = 0; j < (1 << ln); ++j) {
            int ls = (j >> (ln - 1)) & 1;
            f[ln][j] = f[ln - 1][j - (ls << (ln - 1))] * (ls + 1);
            for (int len = 1; len <= ln / 2; ++len) {
                int msk = (j >> (ln - len));
                for (int c = ln - 2 * len; c >= 0; c -= len) {
                    msk &= (j >> c);
                    f[ln][j] += f[len][msk] * f[c][j & ((1 << c) - 1)];
                    f[ln][j] %= MOD;
                }           
            }
        }
    }

    cout << go(v) << "\n";
}

Measured memory_bytes: 53632
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007

int main() {
  
  long long N,A,B;
  cin >> N >> A >> B;

  long long b = A+B;
  long long num = N/b,rest = N-num*b;

  long long ans = A*num;
  if(rest >= A) ans += A;
  else ans += rest;

  cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=1000005;
const double Pi=acos(-1);
const int P=200003;
int n,m,l,id[maxn],r[maxn<<2];
ll a[maxn];
struct Complex{
	double x,y;
	Complex(double u=0,double v=0){x=u,y=v;}
};
Complex operator + (Complex a,Complex b){
	return Complex(a.x+b.x,a.y+b.y);
}
Complex operator - (Complex a,Complex b){
	return Complex(a.x-b.x,a.y-b.y);
}
Complex operator * (Complex a,Complex b){
	return Complex(a.x*b.x-a.y*b.y,a.x*b.y+a.y*b.x);
}
Complex b[maxn<<2],c[maxn<<2],s[50];

void FFT(Complex *f,int n,int op){
	for(int i=0;i<n;i++)
		if(i<r[i]) swap(f[i],f[r[i]]);
	Complex tmp,buf,x,y;
	for(int len=1;len<n;len<<=1){
		tmp=Complex(cos(Pi/len),op*sin(Pi/len));
		for(int R=len<<1,j=0;j<n;j+=R){
			buf=Complex(1,0);
			for(int k=0;k<len;k++){
				x=f[j+k],y=buf*f[j+k+len];
				f[j+k]=x+y;f[j+k+len]=x-y;
				buf=buf*tmp;
			}
		}
	}
}
int main()
{
	for(int i=0,x=1;i<P-1;i++) id[x]=i,x=x*2%P;
	scanf("%d",&n);
	for(int i=1,x;i<=n;i++)
	{
		scanf("%d",&x);
		if(x==0) continue;
		a[x]++,b[id[x]].x+=1;
//		cout<<id[x]<<endl;
	}
	int lim=1;
	for(;lim<(P<<1);lim<<=1,l++);
	for(int i=0;i<lim;i++) r[i]=(r[i>>1]>>1)|((i&1)<<(l-1));
	FFT(b,lim,1);
	for(int i=0;i<lim;i++) b[i]=b[i]*b[i];
	FFT(b,lim,-1);
	ll ans=0;
	for(ll i=0;i<P;i++) ans-=(i*i%P)*a[i];
//	(a[i]*(a[i]-1)-a[i]*a[i]);
	for(int i=0,val=1;i<lim;i++)
	{
		ans+=(ll)(b[i].x/lim+0.5)*val;
//		if((ll)(b[i].x/lim+0.5)) cout<<val<<' '<<(ll)(b[i].x+0.5)<<endl;
		val=val*2%P;
	}
	printf("%lld\n",ans/2);
	return 0;
}

Measured memory_bytes: 133528
a = [31, 28, 31,30,31,30,31,31,30,31,30,31]
d = {a: 0 for a in xrange(1,13)}

for b in xrange(1,13):
    d[b] = a[b-1]

m1, d1 = map(int, raw_input().split())
m2, d2 = map(int, raw_input().split())

if d1 == d[m1]:
    print 1
else:
    print 0

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

using namespace std;
using ll = long long;

int main() {
	
	int N, tmp;
	vector<int> A;
	double c = 0, s = 0;
	
	cin >> N;
	for(int i=0; i<N; i++) {
		cin >> tmp;
		A.push_back(tmp);
	}
	
	for(int j=0; j<N; j++) {
		c += (double)1 / A[j];
		//cout << c << "\n" << endl;
	}
	
	cout << setprecision(10) << (1/c) << endl;
	
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main(void){
  int N;
  cin >> N;
  int count = 0;
  if(N < 10) count = N;
  else if(N < 100) count = 9;
  else if(N < 1000) count = 9 + N - 99;
  else if(N < 10000) count = 909;
  else if(N < 100000) count = 909 + N - 9999;
  else if(N < 1000000) count = 90909;
  
  
  cout << count;
  
 return 0; 
}

Measured memory_bytes: 256
n = int(input())
m = n
u = []
while(m != 0):
    u.append(m % 26)
    m = m // 26
s = 'abcdefghijklmnopqrstuvwxyz'
for i in range(len(u)-1):
    if(u[i] < 1):
        u[i] += 26
        u[i+1] -= 1
u.reverse()
ans = ''
for ss in u:
    ans += s[ss-1:ss]
print(ans)

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

int N;
string s;


void solve(){
    stack<char> st;
    int len = s.length();
    st.push(s[0]);
    for(int i = 1; i < len; i++){
        if(st.empty()){
            st.push(s[i]);
            continue;
        }
        char tmp_s = st.top();
        if(tmp_s == 'S' and s[i] == 'T'){
            st.pop();
        }else{
            st.push(s[i]);
        }
    }
    cout << st.size() << endl;

    return ;

}
int main(){
    cin >> s;
    solve();
    return 0;
}

Measured memory_bytes: 644
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1e18,MOD = 1e9 + 7;
const int INT_INF = 1e9,INT_MOD=1e9+7;
#define rep(i, N) for(int i = 0; i < N; i++)
typedef pair<int, int> Pi;
typedef pair<double, double> P;
signed main(){
    string s,t;cin>>s>>t;
    rep(i,s.size()){
        if(s[i]!=t[i]){
            cout<<"No"<<endl;
            return 0;
        }
    }
    cout<<"Yes"<<endl;
    return 0;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(ll i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

int main() {
  string st;
  cin >> st;
  ll t = 0, s = 0;
  rep(i, st.size()) {
    if(st[i] == 'T') {
      if(s > 0)
        s--;
      else
        t++;
    } else {
      s++;
    }
  }
  cout << t + s << endl;
}

Measured memory_bytes: 3764
n = int(input())
x = input()

count = x.count("1")

mod1 = 0 # 1少ない
mod2 = 0 # 1多い

#　初回の各桁のbitを反転させた場合のmod結果を格納するリスト
mod1_list = [0]*n
mod2_list = [0]*n

now1 = 1

x = x[::-1]

# mod1の計算
for i in range(n):
    mod1_list[i] = now1
    if x[i] == "1":
        mod1 += now1%(count+1)
    now1 *= 2
    now1 %= (count+1)

mod1 %= (count+1)

now2 = 1

# mod2の計算
if count >= 3:
    for i in range(n):
        mod2_list[i] = now2
        if x[i] == "1":
            mod2 += now2%(count-1)
        now2 *= 2
        now2 %= (count-1)
    
    mod2 %= (count-1)

mod1_list = mod1_list[::-1]
mod2_list = mod2_list[::-1]
x = x[::-1]

for i in range(n):
    total = 1
    if x[i] == "1":
        if count == 1:
            print(0)
            continue
        elif count == 2:
            print(1)
            continue
        now = mod2-mod2_list[i]
        now %= (count-1)
    else:
        now = mod1+mod1_list[i]
        now %= (count+1)

    while now != 0:
        now = now%(bin(now).count("1"))
        total += 1

    print(total)

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


int main(){
    int N;
    long long ans = 0;
    cin >> N;
    for(int i = 0; i < N; i++){
        int a;
        cin >> a;
        while(a % 2 == 0){
            a /= 2;
            ans++;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <cstdio>

long long gcd(long long a,long long b)
{
  return b?gcd(b,a%b):a;
}

int main()
{
  long long n,x;
  scanf("%lld%lld",&n,&x);
  long long d=gcd(n,x);
  printf("%lld\n",(n-d)*3);
  return 0;
}


Measured memory_bytes: 128
A,V = map(int,input().split())
B,W = map(int,input().split())
T = int(input())
result = "NO"
if V <= W:
    print(result)
else:
    D = abs(A-B)
    d = abs(V-W)
    if D > d*T:
        print(result)
    else:
        result = "YES"
        print(result)

Measured memory_bytes: 9192
#include <bits/stdc++.h>
#define MAXN 100005
#define MAXM 65537
#define INF 0x3f3f3f3f
//#define int long long
using namespace std;
inline int read(){
	int x=0,f=1;
	char ch=getchar();
	while (ch<'0'||ch>'9'){
		if (ch=='-') f=-1;
		ch=getchar();
	}
	while (ch>='0'&&ch<='9'){
		x=(x*10)+(ch-'0');
		ch=getchar();
	}
	return x*f;
}
int dp[MAXM];
int val[MAXN],cnt[MAXN];
int dfs(int s){
	//printf("s:%d\n",s);
	if (s==0) return dp[s]=0;
	if (dp[s]!=INF) return dp[s];
	for (register int i=0;i<16;++i){
		if (!(s&(1<<i))) continue;
		for (register int j=0;j<16;++j){
			if (i==j||(!(s&(1<<j)))) continue;
			int p=i^j;
			dp[s]=min(dp[s],dfs(s^(1<<i)^(1<<j)^(1<<p))+1+((s&(1<<p))?1:0));
		}
	}
	return dp[s];
}
//#undef int
int main(){
//#define int long long
	int n=read();
	for (register int i=1;i<n;++i){
		int u=read()+1,v=read()+1,w=read();
		val[u]^=w,val[v]^=w;
	}
	for (register int i=1;i<=n;++i){
		cnt[val[i]]++;
	}
	int ans=0,s=0;
	for (register int i=1;i<16;++i){
		ans+=cnt[i]>>1;
		if (cnt[i]&1) s|=(1<<i);
	}
	//printf("OK\n");
	memset(dp,0x3f,sizeof(dp));
	printf("%d\n",ans+dfs(s));
}

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

using namespace std;

int main()
{
    int n;cin>>n;
    int arr[n];
    for(int i=0; i<n;i++)cin>>arr[i];
    int ans[n];
    ans[0]=0,ans[1]=abs(arr[1]-arr[0]);
    for(int i=2;i<n;i++){
    ans[i]=min(ans[i-1]+abs(arr[i]-arr[i-1]),ans[i-2]+abs(arr[i-2]-arr[i]));
    }
    cout<<ans[n-1]<<endl;
}


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

int H,W,D;
vector<pair<int,pair<int,int>>> placement{};
int Q;
int cost[90010]={};

int main(){
  //input
  cin >> H >> W >> D;
  for(int i=0; i<H; i++){
    for(int j=0; j<W; j++){
      int x; cin >> x;
      placement.push_back(make_pair(x,make_pair(i,j)));
    }
  }
  
  //preprocess
  sort(placement.begin(),placement.end());
  for(int i=1; i<=D; i++){
    int k=i;
    cost[k]=0;
    while(k+D<=H*W){
      cost[k+D]
        +=(cost[k]
           +abs(placement[k+D-1].second.first-placement[k-1].second.first)
           +abs(placement[k+D-1].second.second-placement[k-1].second.second));
      k+=D;
    }
  }
  
  //query
  cin >> Q;
  for(int i=0; i<Q; i++){
    int L,R; cin >> L >> R;
    cout << cost[R]-cost[L] << endl;
  }
}

Measured memory_bytes: 2804
#include <bits/stdc++.h>
#define int long long
using namespace std;
typedef pair<int,int> ii;

int N = 200002;
vector<ii> intervals[200005];

int tree[400015];
int lazy[400025];

void pull(int i){
	if(i >= N) tree[i] = lazy[i];
	else tree[i] = max(tree[i<<1], tree[i<<1|1]) + lazy[i];
}

void push(int i){
	tree[i<<1] += lazy[i];
	lazy[i<<1] += lazy[i];
	tree[i<<1|1] += lazy[i];
	lazy[i<<1|1] += lazy[i];
	lazy[i] = 0;
}

void prop(int i){
	if(i != 1) prop(i >> 1);
	if(i < N) push(i);
}

void update(int L, int R, int v){
	for(int l = L+N, r = R+N;l < r;l >>= 1, r >>= 1){
		if(l&1){
			lazy[l] += v;
			pull(l);
			l++;
		}
		if(r&1){
			r--;
			lazy[r] += v;
			pull(r);
		}
	}
	
	for(L += N;L > 0;L >>= 1) pull(L);
	for(R += N-1;R > 0;R >>= 1) pull(R);
}

int query(int l, int r){
	prop(l+N); prop(r+N-1);
	
	int ans = -10234567891232;
	for(l += N,r += N;l < r;l >>= 1, r >>= 1){
		if(l&1) ans = max(ans, tree[l++]);
		if(r&1) ans = max(ans, tree[--r]);
	}
	return ans;
}

signed main(){
	//freopen("i.txt","r",stdin);
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	
	int n, m; cin >> n >> m;
	for(int i = 0;i < m;i++){
		int l, r, v; cin >> l >> r >> v;
		intervals[r+1].push_back(ii(l,-v));
		intervals[l].push_back(ii(l,v));
	}
	
	int ans = 0;
	for(int i = 1;i <= n;i++){
		for(ii x : intervals[i]) update(0, x.first, x.second);
		
		int dp = 0;
		dp = query(0,i);
		ans = max(ans, dp);
		update(i,i+1,dp);
	}
	
	cout << ans;
}


Measured memory_bytes: 21632
#include <bits/stdc++.h> 
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define size_of_array(array) (sizeof(array)/sizeof(array[0]))
#define DEBUG 0 
#define LIMIT (LONG_MAX / 10)
#define POSITIVE_LAST_D (LONG_MAX % 10)
using ll =long long;
using namespace std;
using Graph=vector<vector<int>>;

int main(){
    int n;
    cin>>n;
    vector<ll> a(n);
    rep(i,n)cin>>a[i];
    vector<ll> csum(n+1,0);
    rep(i,n)csum[i+1]=csum[i]+a[i];
    map<ll,ll> nums;
    rep(i,n+1)nums[csum[i]]++;

    ll ans=0;
    for(auto iter:nums){
        ll  num=iter.second;
        ans+=num*(num-1)/2;
    }
    cout<<ans<<endl;
        
    
}



Measured memory_bytes: 18792
#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.at(i);
  }
  sort(a.begin(),a.end());
  bool ans=true;
  for(int i=0; i<N-1; i++){
    if(a.at(i)==a.at(i+1)){
      ans=false;
      break;
    }
  }
  if(ans) cout<<"YES"<<endl;
  else cout<<"NO"<<endl;
}

Measured memory_bytes: 3972
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int vals[] = new int[n];

		for(int i = 0; i < vals.length; i++) {
			vals[i] = sc.nextInt();
		}

		int count = 0;
		for(int i = 0; i < vals.length; i++) {
			if(isPrime(vals[i])) {
				count++;
			}
		}
		System.out.println(count);
		
	}

	public static boolean isPrime(int x) {
		if(x == 2) {
			return true;
		} else if(x < 2 || x % 2 == 0) {
			return false;
		} else {
			int i = 3;
			while(i <= Math.sqrt(x)) {
				if(x % i == 0) {
					return false;
				}
				i += 2;
			}
			return true;
		}
	}
}



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

#define i64 long long int

int main() {
	int n;
	scanf("%d", &n);
	
	i64 ans = 0LL;
	for(int i=1;i<=n;i++) {
		if(i%3==0 || i%5==0) continue;
		ans += i;
	}
	printf("%lld\n", ans);
	
	return 0;
}

Measured memory_bytes: 3836
//g++ -std=gnu++14 a.cpp
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <iostream>
#include <istream>
#include <iterator>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <tuple>
#include <iomanip>
#include <random>
using namespace std;

#define ll long long
#define rep(i, n) for(ll i = 0; i < (n); i++)
ll MOD = 1e9 + 7;
int INF = 1 << 30;
ll INFL = 1LL << 60;

int main(){
  char C;
  cin >> C;
  cout << char(C+1) <<endl;
}


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

const int MAXN = 111;
const int MAXT = 111;
int N, T, L, B;
int G[MAXN];
double dp[MAXT][MAXN];

int main() {
  while(cin >> N >> T >> L >> B && (N|T|L|B)) {
    memset(G, 0, sizeof(G));
    for(int i = 0; i < L; ++i) {
      int Lose; cin >> Lose;
      G[Lose] = 1;
    }
    for(int i = 0; i < B; ++i) {
      int Back; cin >> Back;
      G[Back] = 2;
    }
    memset(dp, 0, sizeof(dp));
    dp[0][0] = 1.0;
    for(int i = 0; i < T; ++i) {
      for(int j = 0; j <= N; ++j) {
        if(j == N) {
          dp[i+1][j] += dp[i][j];;
          continue;
        }
        for(int k = 1; k <= 6; ++k) {
          int nj = j + k <= N ? j + k : N - (k - (N - j));
          int ni = i + 1;
          if(G[nj] == 1) ++ni;
          else if(G[nj] == 2) nj = 0;
          dp[ni][nj] += dp[i][j] / 6.0;
        }
      }
    }
    printf("%.10f\n", dp[T][N]);
  }
  return 0;
}

Measured memory_bytes: 1288
// https://atcoder.jp/contests/cf17-final/tasks/cf17_final_b
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
#define REP(i, n) for (int i = 0; i < (int)(n); ++i)
#define FOR(i, a, b) for (int i = (a); i < (int)(b); ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLR(obj) (obj).rbegin(), (obj).rend()

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s;
    cin >> s;
    map<char, int> mp;
    for (auto &x : s) {
        mp[x]++;
    }
    vector<int> v;
    for (auto &x : mp) {
        v.push_back(x.second);
    }
    sort(ALL(v));

    if (v.size() == 3 && v[2] - v[0] <= 1 || v.size() == 2 && v[1] == 1 ||
        v.size() == 1 && v[0] == 1) {
        cout << "YES\n";
    } else {
        cout << "NO\n";
    }

    return 0;
}


Measured memory_bytes: 512
import Control.Monad
main :: IO ()
main = do
  a <- readLn :: IO Int
  acs <- replicateM a getLine :: IO [String]
  b <- readLn :: IO Int
  bcs <- replicateM b getLine :: IO [String]
  let ps = [ap-bp | ac <- acs, let ap = length $ filter (==ac) acs, let bp = length $ filter(==ac) bcs]
  print $ if maximum ps <= 0 then 0 else maximum ps

Measured memory_bytes: 636
n = int(input())
ans = 0
if n < 3:
  print(0)
  quit()
  
alis = sorted(list(map(int, input().split())))
for i in range(0, n-2):
  for j in range(i+1, n-1):
    for k in range(j+1, n):
      if alis[i] + alis[j] > alis[k]:
        if alis[i] - alis[j] != 0:
          if alis[j] - alis[k] != 0:
            ans += 1
        
print(ans)

Measured memory_bytes: 9192
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;

int n;
int d[10][10];

bool bound(int k, long long *length, bool used[], int home[], long long c[], const int n)
{
  bool res = false;
  long long lb;                 // ??????????????¢?´¢?????????
  int t = home[k-1];
  lb = c[k-1];

  int m = 0, mm = 99999;
  for (int i=0;i<n;i++)
  {
    if (!used[i])
    {
      m = max(m, d[t][i]);
      //mm = min(mm, d[t][i]);
    }
  }
  if (lb + max(m, n-k+1) >= *length && *length > 0) res = true; // ????????????????????§??????????§£??????????????´???
  return res;
}

void dfs(int k, long long *length, bool used[], int home[], long long c[], const int n)
{
  if (k == n)
  {
    //for (int i=0;i<n;i++) cout << home[i]; cout << ' ' << c[n-1] << endl;
    if (*length > c[n-1] || *length == 0) *length = c[n-1];
    return;
  }
  else if (k > 0 && *length > 0 && bound(k, length, used, home, c, n)) return;
  else
  {
    for (int i=0;i<n;i++)
    {
      if (!used[i])
      {
        used[i] = true;
        home[k] = i;
        if (k == 0) c[k] = 0;
        else
        {
          c[k] = c[k-1] + d[home[k]][home[k-1]];
          for (int j=k-2;j>=0;j--) c[k] = max(c[k], c[j] + d[home[k]][home[j]]);
        }
        dfs(k+1, length, used, home, c, n);
        used[i] = false;
      }
    }
  }
  return ;
}

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

    for (int i=0;i<n;i++) for (int j=0;j<n;j++) cin >> d[i][j];
    for (int i=0;i<n;i++) for (int j=0;j<n;j++) d[i][j] = max(d[i][j], d[j][i]);

    long long length = 0;
    bool used[10] = {false, false, false, false, false, false, false, false, false, false};
    int home[10];
    long long c[10];

    dfs(0, &length, used, home, c, n);
    cout << length << endl;
  }
}

Measured memory_bytes: 1156
#include <stdio.h>
#include <string.h>
int max(int a, int b){
    if(a<b)return b;
    else return a;
}
int min(int a, int b){
    if(a<b)return a;
    else return b;
}
int main(void){
    char s[500000+5];
    scanf("%s", s);
    int n=strlen(s);
    
    long int ans=0;
    int i=0;
    while(i<n){
        int l, r;
        for(l=0 ; s[i]=='<'; i++, l++){}
        for(r=0 ; s[i]=='>'; i++, r++){}

        for(int j=1; j<min(r, l); j++)ans+=j;
        for(int j=1; j<=max(r, l); j++)ans+=j;
    }
    printf("%ld\n", ans);
}


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

#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int getRand(int l, int r)
{
    uniform_int_distribution<int> uid(l, r);
    return uid(rng);
}
  
#define int long long 
#define pb push_back
#define S second
#define F first
#define f(i,n) for(int i=0;i<n;i++)
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define vi vector<int>
#define pii pair<int,int>
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
#define precise(x) fixed << setprecision(x) 

const int MOD = 998244353;

int mod_pow(int a,int b,int M = MOD)
{
    int res = 1;
    
    while(b)
    {
        if(b&1) res=(res*a)%M;
        a=(a*a)%M;
        b>>=1;
    }
    
    return res;
}


void solve()
{
   int n,s;
    cin >> n >> s;
    
   int a[n];
    f(i,n) cin >> a[i];
    
   vector<int> dp(s+1,0);
    
   int i2 = mod_pow(2,MOD-2); 
    
   dp[0] = 1;
    
   for(int i=0;i<n;i++)
   {
       for(int j=s;j>=a[i];j--)
       {
           dp[j]+=(dp[j-a[i]]*i2)%MOD;
           dp[j]%=MOD;
       }
   }
    
   int res = mod_pow(2,n);
    
   res=(res*dp[s])%MOD;
    
   cout << res;    
}

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

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

using namespace std;

using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int a, b, c;
  cin >> a >> b >> c;
  if (b - a == c - b) cout << "YES" << endl;
  else cout << "NO" << endl;
  return 0;
}


Measured memory_bytes: 256
from functools import reduce
from fractions import gcd
import math
import bisect
import itertools
import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline
INF = float("inf")


# 処理内容
def main():
    N = int(input())

    ans = ""
    while N > 0:
        N -= 1
        ans += chr(ord('a') + N % 26)
        N //= 26
    
    print(ans[::-1])


if __name__ == '__main__':
    main()

Measured memory_bytes: 77488
// ABEY SAALE
// QUESTION KHUD KR SOLUTION KYU DEKH RHA H
 
//MAAF KIJIYEGA ME GUSSE ME IDHAR UDHAR NIKAL JATA HU

// Author : Ritik Patel
// Institution: Pandit Deendayal Petroleum University
 
#include <bits/stdc++.h>
using namespace std;

#define FAST ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);
#define sz(a) int((a).size())
#define all(c) (c).begin(),(c).end()
#define tr(c,i) for(typeof((c)).begin() i = (c).begin(); i != (c).end(); i++)
#define present(c,x) ((c).find(x) != (c).end()) 
#define cpresent(c,x) (find(all(c),x) != (c).end()) 
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define what_is(x) cout << #x << " is: " << x << endl;

template<typename T> T fast_power(T x,T y,T m){T ans=1;while(y>0){if(y&1LL) ans=(ans*x)%m;y>>=1LL;x=(x*x)%m;}return ans%m;}
template<typename T>
T extgcd(T a, T b, T &x, T &y) {  //when a and b are coprimes(or gcd(a,b)==1) in ax+by = t*gcd(a,b);
  if (a == 0) {
    x = 0;
    y = 1;
    return b;
  }
  T p = b / a;
  T g = extgcd(b - p * a, a, y, x);
  x -= p * y;
  return g;
}

typedef long long ll;

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


/******************* MAIN PROGRAM ***************/
int main(){
	FAST
	ll n, m;
	cin >> n >> m;
	vl a(n);
	for( auto & i: a) cin >> i;
	sort(all(a));
	ll low = 0, high = 1e6;
	while( high - low > 1){
		ll mid = (low + high) / 2;
		ll cnt = 0;
		for(int i = 0; i < n; ++i){
			cnt += n - ( lower_bound(all(a), mid - a[i]) - a.begin() );
		}
		if(cnt >= m) low = mid;
		else high = mid;
	}

	vl sum(n + 1, 0);
	for ( int i = n -1; i >= 0; --i){
		sum[i] = sum[i + 1] + a[i];
	}

	ll ans = 0, current_pairs = 0;

	for(int i = 0; i < n; ++i){
		ll i0 = lower_bound(all(a), low - a[i]) - a.begin();
		current_pairs += n - i0;
		ans += sum[i0] + a[i]*(n - i0);
	}

	ans = ans - low*(current_pairs - m);

	cout << ans << '\n';
	return 0;
}

Measured memory_bytes: 1792
N = int(input())
A = [int(x) for x in input().split()]
p = A[0]
s = 0
for i in range(N-1):
    p = p*A[i+1]
    if p > 10**18:
        s = -1
        break
if 0 in A:
    print(0)
elif s == -1:
    print(-1)
else:
    print(p)
        
        


Measured memory_bytes: 21492
"use strict"
function Main(stdin){
stdin = stdin.trim().split("\n").reverse();
let stdout = [];
function input(){return stdin.pop()};
function print(x){stdout.push(x)};
function mapint(x){return x.map(n=>parseInt(n))};
function mapfloat(x){return x.map(n=>parseFloat(n))};
function max(x){return x.reduce(function(a,b){ return Math.max(a,b) }) }
function min(x){return x.reduce(function(a,b){ return Math.min(a,b) }) }
function sum(x){return x.reduce(function(a,b){ return a+b }) }
function sorting(x, index){x.sort((a, b) => a[index] - b[index])}
function all(x){return x.reduce(function(a,b){ return a && b }) }
function any(x){return x.reduce(function(a,b){ return a || b }) }
function inlist(x, xs){return xs.includes(x)}
function inset(x, xs){return xs.has(x)}
function list(iterable){return Array.from(iterable)}
function arrayint(iterable){return Array.from(iterable, x => parseInt(x))}
function tile(val, len){return Array(len).fill(val)}
for (let i = 0; i < 10; i++){ break; }
const range = (start, stop, step) => Array.from(
    { length: (stop - start) / step }, (_, i) => start + (i * step));
/*START*/


let tmp = mapint(input().split(" "))
print(tmp[0] * tmp[1] / 2)


/*END*/
stdout = stdout.join("\n");
console.log(stdout);
return stdout
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"))

Measured memory_bytes: 7372
import java.util.Scanner;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    char[] sh = s.toCharArray();
    int n = sh.length;
    int res = 0;
    for(int i = 0; i < n / 2; i++){
      if(!(sh[i] == sh[n - 1 - i])) res++;
    }
    System.out.print(res);
  }
}

Measured memory_bytes: 23764
#include <iostream>
#include <algorithm>
#include <string>
#include <math.h>
#include <numeric>
#include <set>
#include <unordered_set>
#include <queue>
#include <boost/math/constants/constants.hpp>
#include <boost/math/common_factor_rt.hpp>

using namespace std;
#define ll long long
#define rep(i, n) for(int i = 0;i < n;i++)
#define FOR(i, n, m) for(int i=n; i<m; ++i)

int main() {
  ll N, K, R, S, P;
  string T;
  cin >> N >> K >> R >> S >> P >> T;
  
  char x;
  
  ll sum = 0;
  
  rep(i, K){
    for(int j=i;j<N;j+=K){      
      if(j==i){
        x = 'b';
        if(T[j]=='r'){
          sum += P;
        }else if(T[j]=='s'){
          sum += R;
        }if(T[j]=='p'){
          sum += S;
        }
      }else{
        if(T[j] == T[j-K] && x!='a'){
          x = 'a';
        }else if(T[j]=='r'){
          sum += P;
          x = 'r';
        }else if(T[j]=='s'){
          sum += R;
          x = 's';
        }else if(T[j]=='p'){
          sum += S;
          x= 'p';
        }
      }
      //cout << sum << endl;
    }   
  }
  cout << sum << endl;
}

Measured memory_bytes: 512
#include <algorithm>
#include <cstdlib>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
typedef long long LL;

int main() {
  LL N, D; cin >> N >> D;
  LL D2 = D * D;

  int cnt = 0;
  for (int i = 0; i < N; ++i) {
    LL X, Y; cin >> X >> Y;
    if (X * X + Y * Y <= D2) ++cnt;
  }
  cout << cnt << endl;
}


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

using ll = long long;
using P = pair<int, int>;

const int INF = 1e9;
const int MOD = 1e9 + 7;

// 4近傍、8近傍
int dx[] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[] = {0, 1, 0, -1, 1, 1, -1, -1};

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

  cout << r * 2 * 3.141592 << endl;
  return 0;
}

Measured memory_bytes: 3784
N = int(input())
dict1 = {}
for _ in range(N):
  s = input()
  if s in dict1:
    dict1[s] += 1
  else:
    dict1[s] = 1
max_num= max(dict1.values())
list1 = [d[0] for d in dict1.items() if d[1]==max_num]
list1.sort()
for s in list1:
  print(s)


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

int main() {
  int a,b,c,d;
  cin>>a>>b>>c>>d;
  if(abs(c-a)<=d ||(abs(b-a)<=d && abs(c-b)<=d)) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <functional>
  
#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
  
using namespace std;
  
typedef    long long          ll;
typedef    unsigned long long ull;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      pii;
  
const int INF=1<<29;
const double EPS=1e-9;
  
const int dx[]={1,0,-1,0,1,1,-1,-1},dy[]={0,-1,0,1,1,-1,-1,1};

inline set<int>::iterator retNextIterator(set<int>::iterator it) {
    return ++it;
}
inline set<int>::iterator retPreviousIterator(set<int>::iterator it) {
    return --it;
}

int main() {
    int N;
    cin >> N;
    vector<int> A(N);
    vector<int> p(N + 1);
    for(int i = 0; i < N; i++) {
        cin >> A[i];
        p[A[i]] = i;
    }


    set<int> s;
    for (int i = 1; i <= N; i++) {
        s.insert(p[i]);
    }

    long long int sum = 0;
    for (int i = N; i >= 1; i--) {
        int left, right;
        auto pos = s.find(p[i]);
        auto n_pos = retNextIterator(pos), p_pos = retPreviousIterator(pos);
        if (pos != s.begin()) left = *p_pos + 1;
        if (n_pos != s.end()) right = *n_pos - 1;
        if (pos == s.begin()) left = 0;
        if (n_pos == s.end()) right = N - 1;
        sum += 1LL * (p[i] - left + 1) * (right - p[i] + 1) * i;
        //cout << left << ", " << right << endl;
        s.erase(p[i]);
    }
    cout << sum << endl;


    return 0;
}

Measured memory_bytes: 11260
#include<iostream>
using namespace std;
int main(){
    string s1,s2,s3;
    cin>>s1>>s2>>s3;
    cout<<char(s1[0]-'a'+'A');
    cout<<char(s2[0]-'a'+'A');
    cout<<char(s3[0]-'a'+'A');
}

Measured memory_bytes: 3632
N = int(input())
points = []
for i in range(N):
    x, y = map(int, input().split())
    if (x, y) == (0, 0): N -= 1; continue
    points.append((x,y))

if not points:
    print(0)
    quit()
    
PI = 3.14

import math
points.sort(key=lambda x : math.atan2(x[0], x[1]))

def calc(points):
    # Greedy optimality
    l = 0
    h = 1

    xsum = points[0][0]
    ysum = points[0][1]

    highest = xsum ** 2 + ysum ** 2
    while h < len(points):
        nx, ny = xsum - points[l][0], ysum - points[l][1]
        if (not l >= h) and nx ** 2 + ny ** 2 > xsum ** 2 + ysum ** 2 or h - l >= N:
            xsum, ysum = nx, ny
            l += 1
        else:
            xsum += points[h][0]
            ysum += points[h][1]
            h += 1
        highest = max(highest, xsum ** 2 + ysum ** 2)
    return highest

def calc2(points):
    hi = 0
    
    for s in range(N):
        for j in range(1,N+1):
            xt = yt = 0
            for x in range(j):
                xt += points[s+x][0]
                yt += points[s+x][1]
            hi = max(hi, xt ** 2 + yt ** 2)

    return hi ** 0.5

print(calc2(points + points))


Measured memory_bytes: 39024
#include<cstdio>
#define MAX 10000
#define NIL -1

struct Node{int parent ,left,right;};

Node T[MAX];
int n,D[MAX],H[MAX];

void setDepth(int u,int d){//u=root;d=0;
    if(u==NIL)return ;
    D[u]=d;
    setDepth(T[u].left,d+1);
    setDepth(T[u].right,d+1);
}

int setHeight(int u){//u=root;
    int h1=0,h2=0;
    if(T[u].left!=NIL)
        h1=setHeight(T[u].left)+1;
    if(T[u].right!=NIL)
        h2=setHeight(T[u].right)+1;
    return H[u]=(h1>h2?h1:h2);
}

int getSibling(int u){
    if(T[u].parent==NIL)return NIL;
    if(T[T[u].parent].left!=u&&T[T[u].parent].left!=NIL)
        return T[T[u].parent].left;
    if(T[T[u].parent].right!=u&&T[T[u].parent].right!=NIL)
        return T[T[u].parent].right;
return NIL;
}

void print(int u){
    printf("node %d: ", u);
    printf("parent = %d, ",T[u].parent);
    printf("sibling = %d, ",getSibling(u));
    int deg=0;
    if(T[u].left!=NIL)deg++;
    if(T[u].right!=NIL)deg++;
    printf("degree = %d, ", deg);
    printf("depth = %d, ", D[u]);
    printf("height = %d, ", H[u]);

    if(T[u].parent==NIL){
        printf("root\n");
    }else if(T[u].left==NIL&&T[u].right==NIL){
        printf("leaf\n");}
    else {
        printf("internal node\n");
    }
}


int main(){
    int  v,l,r,root=0;
    scanf("%d",&n);

    for(int i=0;i<n;i++)T[i].parent=NIL;

    for(int i=0;i<n;i++){
        scanf("%d %d %d",&v,&l,&r);
        T[v].left=l;
        T[v].right =r;
        if(l!=NIL)T[l].parent =v;
        if(r!=NIL)T[r].parent =v;
    }

    for(int i=0;i<n;i++)if(T[i].parent==NIL)root=i;

    setDepth(root,0);
    setHeight(root);

for(int i=0;i<n;i++)print(i);

return 0;
}

Measured memory_bytes: 2696
#include<stdio.h>
double c(int n){
    int i,sum=0;
    double s,nn;
    for(i=0;i<=n;i++){
      sum+=i;
    }
    s=sum;
    nn=n;
    return (s/nn);
}
int main(void){
  int n,k,i,s;
  double p[200000];
  double sum=0,max=0;
  scanf("%d%d",&n,&k);
  for(i=0;i<n;i++){
    scanf("%d",&s);
    p[i]=c(s);
  //  printf("%d:%lf\n",s,p[i]);
  }
  for(i=0;i<n;i++){
    sum+=p[i];
    if(i>=k){
      sum-=p[i-k];
    }
    if(i>=k-1){
      if(sum>max){
        max=sum;
      }
    }
  }
  printf("%lf\n",max);
}


Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
static const int mod = 1e9 + 7;
long long pow(int p, int q) {
    long long ret = 1;
    for (long long i = 0; i < q; i++) ret = (ret * p) % mod;
    return ret;
}
int solve() {
    int N;
    cin >> N;
    vector<int> A(N);
    for (int& i : A) cin >> i;
    vector<int> cnt((N + 1) / 2, 0);
    if (N % 2) {
        for (int i : A) {
            if (i % 2 == 1) return 0;
            cnt[i / 2]++;
        }
        if (cnt[0] == 1 && all_of(cnt.begin() + 1, cnt.end(), [](int x) { return x == 2; })) return pow(2, N / 2);
    }
    else {
        for (int i : A) {
            if (i % 2 == 0) return 0;
            cnt[(i - 1) / 2]++;
        }
        if (all_of(cnt.begin(), cnt.end(), [](int x) { return x == 2; })) return pow(2, N / 2);
    }
    return 0;
}
int main() {
    cout << solve() << endl;
}

Measured memory_bytes: 768
/* Great things never come from comfort zones,
"whatever the mind of a man can conceive and believe,it can achieve." */
 
#include <bits/stdc++.h>
#define ll long long
#define scf(n) scanf("%d",&n)
#define lscf(n) scanf("%lld",&n)
#define lpri(n) printf("%lld ",n)
#define pri(n) printf("%d ",(int)n)
#define prin(n) printf("%d\n",(int)n)
#define lprin(n) printf("%lld\n",n)
#define rep(i,ini,n) for(int i=ini;i<(int)n;i++)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define inf INT_MAX
#define ninf INT_MIN
#define gcd __gcd
#define bitcount(n) __builtin_popcount(n)
typedef double dd;
using namespace std;
const ll mod =1e9+7;
const int N = 1e6+7;

 
int main()
{
	int t,ctr=0;
	scf(t);

    while(t)
    {
        
        if(t%10==7)
        ctr++;
        
        t/=10;
        
    }
    
    if(ctr)
    printf("Yes");
    
    else
    printf("No");
	
}

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

using namespace std;

/* g++ -g -fsanitize=address -lasan -std=c++11 -Dfoo_ */

/* freopen("input.txt", "rt", stdin); */
/* freopen("output.txt", "wt", stdout); */

#define ALL(c)          (c).begin(), (c).end()
#define ALLR(c)         (c).rbegin(), (c).rend()
#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 FOR_ALL(i,c)    for (__typeof((c).begin()) i=(c).begin();   \
                             i != (c).end(); ++i)
#define FOR_ALLR(i,c)   for (__typeof((c).rbegin()) i=(c).rbegin(); \
                             i != (c).rend(); ++i)
#define SZ(array)       (sizeof(array)/sizeof(array[0]))
#define lc(x)           (x<<1)     /* 2*x */
#define rc(x)           (x<<1 | 1) /* 2*x+1 */
#define lowbit(x)       (x & (-x)) /* 0b10100 -> 0b100 */

typedef long long       LL;
typedef map<int,int>    MII;
typedef pair<int,int>   PII;
typedef set<int>        SI;
typedef vector<bool>    VB;
typedef vector<double>  VD;
typedef vector<int>     VI;
typedef vector<string>  VS;

/* check if a key is in container C */
template <class C>
inline bool in_(const typename C::key_type& k, const C& A)
{ return A.find(k) != A.end(); }
inline bool in_(const string& s, const string& S)
{ return S.find(s) != string::npos; }

const int inf = 1e9+7;

int main()
{
#ifdef foo_
    freopen("foo", "rt", stdin);
#endif
    ios::sync_with_stdio(false);
    cin.tie(0);
    LL k,x,y;
    while (cin >> k >> x >> y) {
        const LL X = abs(x);
        const LL Y = abs(y);
        if (k%2 == 0 && (X+Y)%2)
            cout << -1 << endl;
        else {
            LL n = 0, A,B;
            while (true) {
                if ((B = n*k-X-Y) >= 0 && B%2 == 0) {
                    A = (n*k+X+Y)/2; B = (n*k-X-Y)/2;
                    if (A >= k)
                        break;
                }
                n++;
            }
            LL xx = 0, yy = 0; vector<PII> ans;
            while (B) {
                const LL mv = min(B,k);
                if (mv < k) {
                    const int extra = k-mv;
                    if (yy + extra <= Y)
                        xx -= mv, yy += extra;
                    else
                        yy -= mv, xx += extra;
                    A -= extra;
                }
                else
                    xx -= mv;
                B -= mv;
                ans.push_back(PII(xx,yy));
            }
            while (A) {
                if (xx+k <= X)
                    xx += k;
                else if (yy+k <= Y)
                    yy += k;
                else
                    xx = X, yy = Y;
                A -= k;
                ans.push_back(PII(xx,yy));
            }
            cout << ans.size() << endl;
            FOR_ALL(a,ans) {
                int xx = a->first;
                int yy = a->second;
                if (x < 0)
                    xx *= -1;
                if (y < 0)
                    yy *= -1;
                cout << xx << ' ' << yy << endl;
            }
        }
    }
    return 0;
}


Measured memory_bytes: 3952
#include <bits/stdc++.h>
using namespace std;
int main(){
    char a,b;
    cin>>a>>b;
    if(a=='A'||'B'||'C'||'D'||'E'||'F'){
     a=a-1;
    }
    if(b=='A'||'B'||'C'||'D'||'E'||'F'){
     b=b-1;   
    }
    if(a<b){
     cout<<"<"<<endl;   
    }
    else if(a>b){
     cout<<">"<<endl;   
    }
    else if(a==b){
     cout<<"="<<endl;   
    }
}

Measured memory_bytes: 256
#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 INF 0x3f3f3f3f
using namespace std;
typedef long long ll;
ll qpow(ll a, ll b) {
    ll ans = 1;
    while (b) {
        if (b & 1) ans = ans * a;
        a = a * a;
        b >>= 1;
    }
    return ans;
}
int main(void)
{
    ll n,m,s=0,k,t,T,x,y;
    scanf("%lld",&n);
    while(n)
    {
        n/=2;
        s++;
    }
    printf("%lld\n",qpow(2,s)-1);
    return 0;
}




Measured memory_bytes: 256
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<functional>
#include<iomanip>
#include<iostream>
#include<numeric>
#include<map>
#include<queue>
#include<set>
#include<string>
#include<utility>
#include<vector>

using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll mod = 1000000007;
#define rep(i,n) for(int i=0;i<n;i++)
#define repl(i,s,e) for(int i=s;i<e;i++)
#define reple(i,s,e) for(int i=s;i<=e;i++)
#define revrep(i,n) for(int i=n-1;i>=0;i--)
#define all(x) (x).begin(),(x).end()



class UnionFind
{
	//par[i]：ノードiの親
	//count[i]：iが親の時、iが属するグループのノード数
	vector<int> par;
	vector<int> count;

	int m_groupCount = 0;

public:
	UnionFind(int N)
	{
		par.push_back(0);
		count.push_back(0);

		m_groupCount = N;

		for (int i = 1; i <= N; i++)
		{
			//最初は全てが根であるとして初期化
			par.push_back(i);
			count.push_back(1);
		}
	}

	//データxが属する木の根を再帰で得る：root(x) = {xの木の根}
	int root(int x)
	{
		if (par[x] == x) return x;

		//ついでに親を張り替え
		return par[x] = root(par[x]);
	}

	//xとyの木を併合
	void unite(int x, int y)
	{
		int rx = root(x);
		int ry = root(y);
		if (rx == ry) return;
		//xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
		par[rx] = ry;

		//要素数の変更
		count[ry] += count[rx];
		count[rx] = 0;

		//木の併合によってグループが1つ減る
		m_groupCount--;
	}

	// 2つのデータx, yが属する木が同じならtrueを返す
	bool same(int x, int y)
	{
		return root(x) == root(y);
	}

	//指定したデータxが属するグループの要素数を返す
	int size(int x)
	{
		return count[root(x)];
	}

	//UnionFindのグループの個数を返す
	int groupCount()
	{
		return m_groupCount;
	}
};



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

	UnionFind uf(N);

	vector<set<int>> E(N + 1);
	
	rep(i, M)
	{
		int a, b;
		cin >> a >> b;

		uf.unite(a, b);
		E[a].insert(b);
		E[b].insert(a);
	}

	rep(i, K)
	{
		int c, d;
		cin >> c >> d;

		if (uf.same(c, d))
		{
			E[c].insert(d);
			E[d].insert(c);
		}
	}

	

	reple(i, 1, N)
	{
		ll count = 0;

		int root = uf.root(i);

		count += uf.size(root) - 1;

		for (auto n : E[i])
		{
			if (uf.root(n) != root) continue;
			count--;
		}

		cout << count << " ";
	}

	return 0;
}

Measured memory_bytes: 25460
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<ull> vull;
typedef pair<int, int> pii;
typedef pair<pii, int> piii;
typedef pair<ll, ll> pll;
struct pair_hash {
    template <class T1, class T2>
    size_t operator () (const pair<T1,T2> &p) const {
        auto h1 = hash<T1>{}(p.first);
        auto h2 = hash<T2>{}(p.second);
        return h1 ^ h2;  
    }
};
using Vote = pair<ll,ll>;
using Unordered_map = unordered_map<Vote, int, pair_hash>;
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define FORD(i,a,b) for(ll i=a;i>=b;i--)
#define showvec(arr,a,b) for(ll i=a;i<b;i++) cout<<arr[i]<<" ";
#define read_input(arr,a,b) for(ll i=a;i<b;i++) cin>>arr[i];
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define endl '\n'
#define SmooothOperatorrrrr()                 \
    ios_base::sync_with_stdio(0); \
    cin.tie(0);                    \
    cout.tie(0);                   
#define deci(n) cout<<fixed<<setprecision(n)
const int mod=998244353;
const int mod2=1000000007;
#define M_PI 3.14159265358979323846
#define LL_MAX 9223372036854775807
#define MAXN 2000001
/**************************************************************************************************/

vector<int> adj[200005];
int visited[200005];

int dfs(int i)
{
    int count=1;
    visited[i]=1;
    for(int x:adj[i])
        if(!visited[x])
            count+=dfs(x);
    return count;
}

int main()
{
    SmooothOperatorrrrr();
    int n,m;cin>>n>>m;
    while(m--)
    {
        int u,v;cin>>u>>v;
        u--;v--;
        adj[u].pb(v);
        adj[v].pb(u);
    }
    int maxm=0;
    FOR(i,0,n)
    {
        if(!visited[i])
            maxm=max(maxm,dfs(i));
    }
    cout<<maxm<<endl;
}

Measured memory_bytes: 24620
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;

int main() {
  int N, L;
  cin >> N >> L;
  vector<string> S(N);
  for(int i = 0; i < N; i++) cin >> S[i];
  sort(S.begin(), S.end());
  string ans = "";
  for(int i = 0; i < N; i++) ans += S[i];
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 764
#include <cstdio>
#include <iostream>
#include <string>
#include <algorithm>

int main(void) {
    int n;
    std::scanf("%d", &n);
    int x = 0, y;
    for (int i = 0; i < n; i++) {
        int a, b;
        std::scanf("%d %d", &a, &b);
        if (a > x) {
            x = a;
            y = b;
        }
    }
    std::printf("%d\n", x + y);
    return 0;
}

Measured memory_bytes: 256