akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <vector>
#include <iostream>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <sstream>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define SZ(x) (int)(x.size())
#define F0(i,n) for(int i=0;i<n;i++)
#define F1(i,n) for(int i=1;i<=n;i++)
#define CL(a,x) memset(x, a, sizeof(x));
#define P(x) cerr << #x << "=" << x << endl

const int MOD = 998244353;
const double pi = atan(1.0)*4.0;
const double eps = 1e-8;
ll gcd(ll x, ll y) { return y ? gcd(y, x%y) : x; }
int bc(int n) { return n ? bc((n-1)&n)+1 : 0; }

int i, j, k, m, n, l, D1, D2;
string s;

void solve() {
    ll ans = 0;
    ll b = 0;
    for (char c : s) if (c == 'W') ans += b; else b++;
    cout << ans << endl;
}

int main() {
    //freopen("x.in", "r", stdin);
    while (cin >> s) {
        solve();
    }
    return 0;
}


Measured memory_bytes: 1152
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <string>
#include <cstring>
#include <cmath>
#include <complex>
#include <map>
#include <climits>
#include <sstream>
using namespace std;

#define reep(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) reep((i),0,(n))
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define EPS 1e-8
#define F first
#define S second
#define mkp make_pair

static const double PI=6*asin(0.5);
typedef long long ll;
typedef complex<double> CP;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vint;
static const int INF=1<<24;

template <class T>
void initvv(vector<vector<T> > &v,int a,int b, const T  &t = T()){
	v.assign(a,vector<T>(b,t));
}

//v.erase(unique(v.begin(),v.end()),v.end());


int main(){
	int n;
	while(cin>>n){
		n%=39;
		if(n==0){
			n=39;
		}
		
		printf("3C%02d\n",n);

	}
}

Measured memory_bytes: 1160
#include<cstdio>
#include<vector>
#include<algorithm>


using namespace std;
using ll=long long;
using vi=vector<int>;
using vvi=vector<vi>;
using vll=vector<ll>;
using vvll=vector<vll>;


int main(void)
{
	vi a(4);

	while(scanf("%d%d%d%d", &a[0], &a[1], &a[2], &a[3])==4)
	{
		sort(a.begin(), a.end());
		int ans=1;
		if(a[0]!=1) ans=0;
		if(a[1]!=4) ans=0;
		if(a[2]!=7) ans=0;
		if(a[3]!=9) ans=0;

		printf("%s\n", ans?"YES":"NO");
	}

	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i, n) FOR(i, 0, (n))
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define LAR(a, b) ((a)=max((a),(b)))
#define SML(a, b) ((a)=min((a),(b)))
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pair<int, int>> vpii;
typedef pair<int, int> pii;
#define PB push_back
#define EB emplace_back
#ifdef LOCAL_DEBUG
#define DEBUG(...) printf(__VA_ARGS__)
#else
#define DEBUG(...)
#endif

#define N 112345
ll a[N];
vector<pair<ll, int>> v;

int main(){
	int n, m; scanf("%d%d", &n, &m);
	REP(i, n) scanf("%lld", a+i);
	REP(i, m){
		ll b; int c; scanf("%d%lld", &c, &b);
		v.EB(b, c);
	}
	sort(v.begin(), v.end(), greater<pair<ll, int>>());
	sort(a, a+n);
	int k=0;
	for(auto &p : v){
		int t = min(k+p.second, n);
		FOR(i, k, t) LAR(a[i], p.first);
		k=t;
		if(t==n) break;
	}
	ll ans = 0;
	REP(i, n) ans+=a[i];
	REP(i, n) DEBUG("%lld ", a[i]);
	printf("%lld\n", ans);
}


Measured memory_bytes: 3188
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef double db;
typedef std::string str;
#define sei set<int>
#define sell set<ll>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pld pair<ld,ld>
#define vi vector<int>
#define vll vector<ll>
#define vvi vector<vi>
#define vvll vector<vll>
#define vld vector<ld>
#define vstr vector<str>
#define vpii vector<pii>
#define vpll vector<pll>
#define all(v) v.begin(),v.end()
#define foa(i,v) for(auto i : v)
#define fo(i,a,b) for(int i=a;i<b;i++)
#define fo_(i,a,b) for(int i=a;i>b;i--)
#define M(a) memset(a,0,sizeof a)
#define M_(a) memset(a ,-1,sizeof a)
#define deb(x)  cerr << #x << " = " << x << endl
#define pb push_back
#define pob pop_back
#define F first
#define S second
#define OK order_of_key
#define FO find_by_order
#define nmax 1000100
const ld PI = 3.141592653589793238462643383279;
const ll inf = std::numeric_limits<ll>::max();
const int infint = std::numeric_limits<int>::max();
const ll mod = 998244353;
using namespace __gnu_pbds;
using namespace std;
#pragma GCC optimization ("unroll-loops")
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,avx,avx2")
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

vi v[nmax];
ll t[nmax],t2[nmax];
int a[nmax];
vi kol[nmax];

int main(){
    ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int n;
    cin >> n;
    fo(i,0,n) cin >> a[i];
    fo(i,1,nmax){
        for(int j = i; j < nmax; j+=i) v[j].pb(i);
    }

    fo(i,0,n) foa(j,v[a[i]]) kol[j].pb(i);

    fo(i,1,nmax){
        ll jam = 0;
        foa(j,kol[i]) jam += a[j];
        ll calc = 0;
        foa(j,kol[i]){
            jam -= a[j];
            calc += a[j]/i*jam%mod;
        }
        calc %= mod;
        t2[i] = calc;
    }

    fo_(i,nmax/2,0){
        for(int j = i+i; j < nmax; j += i) t2[i] -= t2[j]*(j/i)%mod;
    }

    ll ans = 0;
    fo(i,1,nmax) ans += t2[i]%mod;
    ans = (ans%mod + mod)%mod;
    cout << ans;

    return 0;
}



Measured memory_bytes: 190984
import java.util.Scanner;

public class Main {
	public static final int MAX = 60000;
	public static boolean[] isPrime = new boolean[MAX + 1];
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		eratos();
		
		int n;
		while (sc.hasNextInt()) {
			n = sc.nextInt();
			
			for (int i = n - 1; i > 0; i--) {
				if (isPrime[i] == true) {
					System.out.print(i + " ");
					break;
				}
			}
			
			for (int i = n + 1; i < MAX; i++) {
				if (isPrime[i] == true) {
					System.out.println(i);
					break;
				}
			}
		}
	}
	
	public static void eratos() {
		for (int i = 0; i < MAX + 1; i++) {
			isPrime[i] = true;
		}
		
		isPrime[0] = isPrime[1] = false;
		for (int i = 2; i <= Math.sqrt(MAX); i++) {
			if (isPrime[i] == true) {
				for (int j = i + i; j <= MAX; j += i) {
					isPrime[j] = false;
				}
			}
		}
	}
}

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

using namespace std;
/*
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")*/
#define int long long
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);


/*void solve(string s){
    for(int i =0; i<s.size() ;i++){
        if(s[i]=='g' && s[i+1] =='o' && s[i+2] == 'o' && s[i] == 'g'){
                ans++;
                ans%=m;
               i+=2;

        }
        if(i==s.size()-1)break;
    }
    cout << ans << endl;
    }*/
map <int,int> m;
signed main(){
    IOS;
    int a,b,c;
    cin >> a>> b >> c;
    if(a>=b+c)cout << 0 << endl;
    else cout << b+c-a <<endl;
return 0;}
///...


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

void cas(int i,char ch) {
    cout<<"Case "<<i<<":"<<ch;
}

typedef vector<int> vi;
typedef vector<long long> vll;
typedef pair<int,int> pii;
typedef vector< pii > vii;

#define ll          long long
#define ff          first
#define ss          second
#define pb          push_back
#define mkp         make_pair
#define sz          size()

#define forf(a,b,c)    for(int i=a;i<=b;i+=c)
#define forr(a,b,c)    for(int i=a;i>=b;i-=c)
#define all(a)      a.begin(),a.end()
#define mem(a,b)    memset(a,b,sizeof(a))
#define pi          2*acos(0.0)
#define End         return 0;

#define scan1(a)    scanf("%d",&a)
#define scan2(a,b)  scanf("%d %d",&a,&b)
#define scan3(a,b,c)  scanf("%d %d %d",&a,&b,&c)
#define scanl(a)    scanf("%lld",&a)
#define scanll(a,b) scanf("%lld %lld",&a,&b)
#define scanlll(a,b,c) scanf("%lld %lld %lld",&a,&b,&c)

#define print1(a)    printf("%d",a)
#define print2(a,b)  printf("%d %d",a,b)
#define print3(a,b,c)  printf("%d %d %d",a,b,c)
#define printl(a)    printf("%lld",a)
#define printll(a,b) printf("%lld %lld",a,b)
#define printlll(a,b,c) printf("%lld %lld %lld",a,b,c)

#define MAXN        100000007
#define INF 0x3f3f3f3f
//int dx[]={+1,-1,+0,+0};///Four Directions
//int dy[]={+0,+0,+1,-1};///Four directions
//int dx [] = {+1,-1,+0,+0,-1,-1,+1,+1};///Eight Directions
//int dy [] = {+0,+0,+1,-1,+1,-1,-1,+1};///Eight Directions

//int mark[10007];vi prime;void seive(){for(int i=2;i<10000;i++){if(mark[i]==0){prime.pb(i);for(int j=i+i;j<=10000;j+=i)mark[j]=1;}}}

//freopen("input.txt", "r", stdin);
string ss;
bool calc(int st,int en) {

    while(st<en)    {
        if(ss[st]!=ss[en]){
            return false;
        }
        st++;en--;
    }
    return true;
}
int main()
{
   ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    string s;
    cin>>s;
    ll n=s.sz;
    ss=" "; ss+=s;
    ll st=0,en=n/2-1;

    if(calc(1,n)==false){
        cout<<"No"<<endl;
        return 0;
    }
    if(calc(1,(n-1)/2)==false){
        cout<<"No"<<endl;
        return 0;
    }
    if(calc((n+3)/2,n)==false){
        cout<<"No"<<endl;
       return 0;
    }

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


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <complex>
#include <cstring>
#include <cstdlib>
#include <string>
#include <cmath>
#include <queue>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
const int INF = 1<<29;

typedef long long ll;

int main() {
  ll n,k;
  cin >> n >> k;
  while(k--) {
    ll a,b;
    cin >> a>> b;
    if (a + b - 1 > n) {
      a = n - a + 1;
      b = n - b + 1;
    }
    if (a>b) swap(a,b);
    if (a%3 == 0)
      cout << 3 << endl;
    else
      cout << a%3 << endl;
  }
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
vector<int> v[500];
vector<pair<int,int> > ans;
int S[1000],D[1000];
 
void dfs(int p,int d,int pr){
  D[p]=d;
  for(int i=0;i<v[p].size();i++){
    int np=v[p][i];
    if(pr==np)continue;
    if(!D[np]){
      dfs(np,d+1,p);
      if(!S[np])ans.push_back(make_pair(min(p,np),max(p,np)));
      S[p]+=S[np];
    }
    else if(D[p]>D[np])S[np]--,S[p]++;
  }
}
 
int main(){
  int V,E;
  cin>>V>>E;
  for(int s,t,i=0;i<E;i++){
    cin>>s>>t;
    s--;
    t--;
    v[s].push_back(t);
    v[t].push_back(s);
  }
  dfs(0,1,-1);
  sort(ans.begin(),ans.end());
  cout << ans.size() << endl;
 
  return 0;
}


Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var s string
	fmt.Scan(&s)

	week := map[string]int{
		"SUN": 7,
		"MON": 6,
		"TUE": 5,
		"WED": 4,
		"THU": 3,
		"FRI": 2,
		"SAT": 1,
	}

	fmt.Println(week[s])
}


Measured memory_bytes: 512
n, m = gets.split.map(&:to_i)
array_a = Array.new(n)
array_b = Array.new(m)

n.times do |i|
  array_a[i] = gets.split.map(&:to_i)
end

m.times do |j|
  array_b[j] = gets.to_i
end

array_a.each do |a_sub|
  summary = a_sub.each_with_index.reduce(0) do |sum, (a, i)|
    sum += a * array_b[i]
  end
  puts summary
end


Measured memory_bytes: 6984
import sys
from collections import deque
input = sys.stdin.buffer.readline

N, u0, v0 = map(int, input().split())
adj = [[] for _ in range(N+1)]
for _ in range(N-1):
    a, b = map(int, input().split())
    adj[a].append(b)
    adj[b].append(a)

que = deque()
que.append(u0)
du = [-1] * (N+1)
du[u0] = 0
while que:
    v = que.popleft()
    for u in adj[v]:
        if du[u] == -1:
            du[u] = du[v] + 1
            que.append(u)

que = deque()
que.append(v0)
dv = [-1] * (N+1)
dv[v0] = 0
while que:
    v = que.popleft()
    for u in adj[v]:
        if dv[u] == -1:
            dv[u] = dv[v] + 1
            que.append(u)

duv = [du[i] - dv[i] for i in range(N+1)]

ans = 0
#flg = 1 if duv[v] % 2 == 1 else 0
for i in range(1, N+1):
    if duv[i] < 0:
        ans = max(ans, dv[i] - 1)
print(ans)


Measured memory_bytes: 67104
import itertools

# 再起回数上限変更
# sys.setrecursionlimit(1000000)

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

ans = 0
for a, b in list(itertools.combinations(range(N), 2)):
    ans += d[a] * d[b]

print(ans)


Measured memory_bytes: 38640
#include "bits/stdc++.h"
using namespace std;

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

    vector<int> D(K);
    for (int i = 0; i < K; i++) {
        cin >> D[i];
    }

    for (int i = N; i < 10 * N; i++) {
        int t = i;
        vector<int> kt = {};
        while (t != 0) {
            kt.push_back(t % 10);
            t /= 10;
        }

        bool flag = true;
        for (int j = 0; j < K; j++) {
            for (int k = 0; k < kt.size(); k++) {
                if (D[j] == kt[k]) {
                    flag = false;
                }
            }
        }

        if (flag) {
            cout << i << endl;
            i += 10 * N;
        }
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
vector <int> v;
vector <double> vd;

vector <char> vc;
vector <string> vs;
map <string,int> sm;
map <int,int> mp;
map <char,int>cm;
//int string_to_int(string s){stringstream x(s);double a=0; x>>a; return a;}
//long long int gcd(long long int a, long long int b){if(a%b==0)return b;return gcd(b, a%b);}
//long long int lcm(long long int a, long long int b){return (a*b)/gcd(a, b);}
//int string_sum(string s){int b = 0;auto k =s.size();for(int j=0; j<k; j++){b +=(s[j]-48);}return b;}
//long long int factorial(long long int n){if (n == 0)return 1;return n * factorial(n - 1);}

//int cnt =0;
//
//void SieveOfEratosthenes(int n)
//{
//   // v.push_back(1);
//
//    bool prime[n+1];
//    memset(prime, true, sizeof(prime));
//
//    for (int p=2; p*p<=n; p++)
//    {
//
//        if (prime[p] == true)
//        {
//
//            for (int i=p*p; i<=n; i += p)
//                prime[i] = false;
//        }
//    }
//
//
//    for (int p=2; p<=n; p++)
//       if (prime[p])
//          v.push_back(p);
//}
//

//int mod(string num, int a)
//{
//    // Initialize result
//    int res = 0;
//
//    // One by one process all digits of 'num'
//    for (int i = 0; i < num.length(); i++)
//         res = (res*10 + (int)num[i] - '0') %a;
//
//    return res;
//}
long long int mx = 1000000000000000000;

long long int power(long long int base, long long int powerRaised)
{
    if (powerRaised != 0)
        return (base*power(base, powerRaised-1));
    else
        return 1;
}


int main() {
    
    
    int a,b,c,n,cnt=0;
    string s,p;
    char ch;
    
    cin >> a;
    
    for(int i=1; i<=9; i++)
    {
        for(int j=1; j<=9; j++)
        {
            b = i*j;
            if(b==a)
            {
                cout << "Yes" << endl;
                return 0;
            }
        }
    }
    cout << "No" << endl;
    
    return 0;
}
 
 
 


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

int main() {
    string S;
    string T;
    cin >> S;
    cin >> T;
    
    int ans = 0;
    for (int i = 0; i < 3; ++i){
        if (S[i] == T[i]){
            ans += 1;
        }
    }
    cout << ans << endl;
    return 0;
}

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

int main(){
    int x,y;
    cin>>x>>y;
    cout<<endl;
    for(int i=0; i<y+2;i++){
        cout<<"#";
    }
    cout<<endl;
    char code;
    for(int i=0;i<x;i++){
        cout<<"#";
        for(int j=0; j<y;j++){
            cin>>code;
            cout<<code;
        }
        cout<<"#"<<endl;
    }
    for(int i=0; i<y+2;i++){
        cout<<"#";
    }
    cout<<endl;
    return 0;
}

Measured memory_bytes: 256
#ifdef __APPLE__
#include <iostream>
#include <vector>
#include <utility>
#include <stack>
#include <queue>
#include <set>
#include <algorithm>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <random>
#else
#include <bits/stdc++.h>
#endif

using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
#define tc(t) for (int tc=1; tc<=t; tc++)
typedef vector<int> VI;
typedef vector<long long int> VLLI;
typedef vector<pair<int, int> > VPI;
typedef long long ll;
typedef pair<int,int> PII;
typedef pair<ll, ll> PLL;
mt19937 mrand(random_device{}()); 
const ll mod=1000000007;
int rnd(int x) { return mrand() % x;}
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
ll modInverse (ll a) {ll p = mod - 2; return powmod(a, p);}
// head

int main() {
    int a, b, m;
    cin >> a >> b >> m;
    vector<int> aa(a), ab(b);
    int mina = INT_MAX, minb = INT_MAX; 
    for (auto &x : aa)
        cin >> x, mina = std::min(mina, x);
    for (auto &x : ab)
        cin >> x, minb = std::min(minb, x);

    vector<pair<pair<int, int>, int>> d(m);
    for (auto &x : d)
        cin >> x.fi.fi >> x.fi.se >> x.se;

    int ans = mina + minb;
    for (auto x : d) {
        ans = std::min(ans, aa[x.fi.fi-1] + ab[x.fi.se-1] - x.se);
    }
    cout << ans << "\n";
}



Measured memory_bytes: 2176
s = input()
t = input()
memo = []
 
for i in range(len(s)-len(t)+1):
    p = s[i:(i+len(t))]
    flag = True
    for j in range(len(t)):
        if p[j] != "?" and p[j] != t[j]:
            flag = False
            break
    if flag:
        memo.append((s[0:i]+t+s[(i+len(t)):len(s)]).replace("?","a"))
 
if len(memo) == 0:
    print("UNRESTORABLE")
else:
    print(min(memo))

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
using namespace std;
#define REP(i,m,n) for(int i=(m);i<(n);i++)
#define rep(i,n) REP(i,0,n)
#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
using namespace std;
#define REP(i,m,n) for(int i=(m);i<(n);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define all(a) a.begin(),a.end()
#define rall(c) (c).rbegin(),(c).rend()
#define mp make_pair
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll inf=1e9+7;
const ll mod=998244353;
int main(){
    ll n;cin>>n;
    string s,t;cin>>s>>t;
    rep(i,n){
        cout<<s[i]<<t[i];
    }
    cout<<endl;
}

Measured memory_bytes: 256
S=input()
L=len(S)
l=[0]*L
b=0
while 1:
    t=1
    while 1:
        b+=1
        if S[b]=="R":
            t+=1
        else:
            break
    l[b]+=t//2
    l[b-1]+=t-t//2
    t=1
    while 1:
        if b==L-1:
            b+=1
            break
        b+=1
        if S[b]=="L":
            t+=1
        else:
            break
    l[b-t-1]+=t//2
    l[b-t]+=-(-t//2)
    if b==L:
        break
for i in l:
    print(i,end=" ")

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

int main() {
  int N, x;
  cin >> N >> x;
  vector<int> a(N);
  for (int i = 0; i < N; i++) cin >> a.at(i);
  
  sort(a.begin(), a.end());
  
  int c = 0, d = 0;
  for (int i = 0; i < N; i++) {
    c += a.at(i);
    if (c <= x){
      d++;
    } else break;
    if (i == N - 1 && c < x) d--;
  }
  cout << d << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(long long i=0; i<(n); i++)
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }


int main(){
    ll k,s; cin>>k>>s;
    ll res=0;
    rep(i,k+1){
        rep(j,k+1){
            if(i+j<s-k || i+j>s) continue;
            res++;
        }
    }
    cout<<res<<endl;
    return 0;
}

Measured memory_bytes: 256
use std::f64::consts::PI;
fn main() {
    proconio::input! {
        a: f64,
        b: f64,
        h: f64,
        m: f64,
    }
    let c = (h+m/60.0)*PI/6.0 - m*PI/30.0;
    println!("{}",(a*a+b*b-2.0*a*b*c.cos()).sqrt());
}

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

typedef pair<int,int>P;
const int S = 0;
const int G = 5;
P Gr[6];

void make(){

  Gr[0] = P(2,1);
  Gr[1] = P(2,-1);
  Gr[2] = P(-1,3);
  Gr[3] = P(4,5);
  Gr[4] = P(5,1);
  Gr[5] = P(1,2);
}

bool solve(string str){
  int now = S;
  for(int i = 0 ; i < str.size() ; i++){
   if(str[i] == '0'){
      if(Gr[now].first == -1)return false;
      now = Gr[now].first;
    }
    else {
      if(Gr[now].second == -1)return false;
      now = Gr[now].second;
    }
  }
  return now == G;
}

int main(){
  make();
  string str;
  while(cin >> str,str != "#")cout << (solve(str)?"Yes":"No") << endl;
  return 0;
}

Measured memory_bytes: 1188
import java.io.*;
import java.util.*;
import static java.lang.Math.*;

public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.solve(args);
    }

    public void solve(String[] args) {
        MyScanner scanner = new MyScanner();
        int A = scanner.nextInt();
        if (("" + A).indexOf('9') != -1) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }

    private class MyScanner {
        String[] s;
        int i;
        BufferedReader br;
        String reg = " ";

        MyScanner () {
            s = new String[0];
            i = 0;
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        public String next() {
            try {
                if (i < s.length) return s[i++];
                String line = br.readLine();
                while (line.equals("")) {
                    line = br.readLine();
                }
                s = line.split(reg, 0);
                i = 0;
                return s[i++];
            } catch (Exception e) {
                e.printStackTrace();
            }
            return null;
        }

        public int nextInt() {
            try {
                return Integer.parseInt(next());
            } catch (Exception e) {
                e.printStackTrace();
            }
            return -1;
        }

        public double nextDouble() {
            try {
                return Double.parseDouble(next());
            } catch (Exception e) {
                e.printStackTrace();
            }
            return -1;
        }

        public long nextLong()  {
            try {
                return Long.parseLong(next());
            } catch (Exception e) {
                e.printStackTrace();
            }
            return -1;
        }
    }
}


Measured memory_bytes: 21204
from collections import deque
from sys import stdin, stdout
input = lambda: stdin.readline().rstrip()
write = stdout.write

def main():
    S = input()
    T = input()

    s = deque(S)
    for _ in range(len(S)):
        if ''.join(s) == T:
            print('Yes')
            break
        s.rotate(1)
    else:
        print('No')

main()


Measured memory_bytes: 3444
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<algorithm>
using namespace std;
char a[100005];

int main(){
	scanf("%s",a+1);
	int len = strlen(a+1);
	int flag = 0;
	for(int i =1; i <= len; i++){
		if(a[i] == a[i + 1]){ 
			printf("%d %d\n",i,i+1);
			flag = 1;
			break;
		}
		if(a[i] == a[i + 2]){
			printf("%d %d\n",i,i + 2);
			flag = 1;
			break;
		}
	}
	if(!flag) printf("-1 -1\n");
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 99999999999999999
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;



int main(){

	int N;
	scanf("%d",&N);

	int tmp;
	priority_queue<int> Q;

	for(int loop = 0; loop < N; loop++){

		scanf("%d",&tmp);
		Q.push(tmp);
	}

	int A = 0,B = 0;
	int is_A = 1;

	while(Q.empty() == false){

		tmp = Q.top();
		Q.pop();

		if(is_A == 1){

			A += tmp;

		}else{

			B += tmp;
		}

		is_A = 1-is_A;
	}

	printf("%d\n",A-B);

	return 0;
}


Measured memory_bytes: 256
from heapq import heappop, heappush

N, M, S, T = map(int, input().split())
K = 10**15
S -= 1
T -= 1

edgesYen = [[] for _ in range(N)]
edgesSun = [[] for _ in range(N)]

for _ in range(M):
    fr, to, yen, sun = map(int, input().split())
    fr -= 1
    to -= 1
    edgesYen[fr].append((to, yen))
    edgesYen[to].append((fr, yen))
    edgesSun[fr].append((to, sun))
    edgesSun[to].append((fr, sun))

def calcMinDist(edges, start):
    minDist = [10**18] * N
    minDist[start] = 0
    que = [(0, start)]
    while que:
        dist, now = heappop(que)

        if minDist[now] < dist:
            continue

        for to, d in edges[now]:
            if minDist[to] > dist + d:
                heappush(que, (dist + d, to))
                minDist[to] = dist + d

    return minDist

minDistYenS = calcMinDist(edgesYen, S)
minDistSunT = calcMinDist(edgesSun, T)

ans = [0] * N
for mid in range(N):
    ans[mid] = K - minDistYenS[mid] - minDistSunT[mid]

for mid in range(N - 1)[::-1]:
    ans[mid] = max(ans[mid], ans[mid + 1])

print(*ans, sep='\n')


Measured memory_bytes: 81464
#include <bits/stdc++.h> 
using namespace std; 
#define io ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define rep(i,n) for (int i = 0; i < (n); ++i)

int main(void) {
    io;
    int n,m; cin >> n >> m;
    cout << ((n == m) ? "Yes":"No");
    return 0;
}



Measured memory_bytes: 3616
import java.util.*;

public class Main {
    
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        long ans = 0;
        for (int i = 1; i*i < N; i++) {
            int a = ((N-i*i-i+(i-1))/i)*2+1;
            if (0 < a) {
                ans += a;
            } else {
                ans++;
            }               
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 35704
#include <bits/stdc++.h>
#define pii              pair <ull,int>
#define pll              pair <long long,long long>
#define sc               scanf
#define pf               printf
#define Pi               2*acos(0.0)
#define ms(a,b)          memset(a, b, sizeof(a))
#define pb(a)            push_back(a)
#define MP               make_pair
#define db               double
#define ll               long long
#define ull              unsigned long long
#define f                first
#define s                second
#define sqr(x)           (x)*(x)
#define VI               vector <int>
#define DBG              pf("Hi\n")
#define MOD              1000000007
#define SZ(a)            (int)a.size()
#define sf(a)            scanf("%d",&a)
#define sfl(a)           scanf("%lld",&a)
#define sff(a,b)         scanf("%d %d",&a,&b)
#define sffl(a,b)        scanf("%lld %lld",&a,&b)
#define sfff(a,b,c)      scanf("%d %d %d",&a,&b,&c)
#define sfffl(a,b,c)     scanf("%lld %lld %lld",&a,&b,&c)
#define loop(i,n)        for(int i=0;i<n;i++)
#define loop1(i,n)       for(int i=1;i<=n;i++)
#define REP(i,a,b)       for(int i=a;i<b;i++)
#define RREP(i,a,b)      for(int i=a;i>=b;i--)
#define intlim           2147483648
#define ull              unsigned long long
#define gcd(a, b)        __gcd(a, b)
#define lcm(a, b)        ((a)*((b)/gcd(a,b)))
#define mk(x1,y1) make_pair(x1, y1)
#define maxl 100010
#define psz 20
using namespace std;
ll n,k;
ll a[maxl+2];
ll dp[maxl+2];

ll Dp(int pos)
{
    if(pos+1 == n) return 0;
    if(pos+1 > n) return 1e18+3;

    if(dp[pos] != -1) return dp[pos];

    ll ans=1e18+2;

    for(int i=1; i<=k; i++)
    {
        if(pos+i<n) 
        {
            ll ans1 = abs(a[pos]-a[pos+i])+Dp(pos+i);
            ans=min(ans,ans1);
           // cout<<"A  "<<ans<<endl;
        }
    }
    return dp[pos]=ans;
}

int main()
{
    scanf("%lld %lld",&n,&k);
    memset(dp,-1,sizeof dp);

    for(int i=0; i<n; i++)
    {
        scanf("%lld",&a[i]);
    }

    printf("%lld\n",Dp(0));


    return 0;
}

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

ll max (ll a, ll b) {
  if (a <= b) return b;
  else return a;
}

int main() {
  int k, n;
  cin >> k >> n;
  vector<int> a(n);
  rep(i, n) cin >> a.at(i);
  a.push_back(a.at(0)+k);
  
  int M;
  rep (i, n) {
    M=max(M, a.at(i+1)-a.at(i));
  }
cout << k-M << endl; 
}

Measured memory_bytes: 1792
n=int(input())
v=list(map(int,input().split()))

for i in range(n):
    min1=v.pop(v.index(min(v)))
    min2=v.pop(v.index(min(v)))
    new=(min1+min2)/2
    v.append(new)
    if len(v)==1:
        print(new)
        exit()
#for i in range(n):


Measured memory_bytes: 38512
#![allow(unused_imports)]
#![allow(unused_macros)]

use std::cell::RefCell;
use std::cmp::{max, min, Ordering};
use std::collections::*;
use std::fmt::{Debug, Formatter, Write as FmtWrite};
use std::io::{stderr, stdin, BufRead, Write};
use std::mem::{replace, swap};
use std::ops::*;
use std::rc::Rc;


//
// Macro debug!
//

#[cfg(debug_assertions)]
include!{"./procon/debug.rs"}

#[cfg(not(debug_assertions))]
macro_rules! debug {
    ($($arg:expr),*) => {};
}


//
// Macro input!
//

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}


//
// IteratorExt
//

trait IteratorExt: Iterator + Sized {
    fn vec(self) -> Vec<Self::Item> {
        self.collect()
    }
}

impl<T: Iterator> IteratorExt for T {}


//
// Main
//

fn main() {
    input! {
        n: usize,
        xss: [chars; n],
    }

    let mut map = HashMap::new();

    for xs in xss {
        let mut counts = vec![0; 26];
        for x in xs {
            counts[(x as usize) - ('a' as usize)] += 1;
        }

        *map.entry(counts).or_insert(0) += 1;
    }

    let ans = map.values().fold(0, |a: u64, &x| a + f(x));
    println!("{}", ans);
}

fn f(x: usize) -> u64 {
    let x = x as u64;
    (x * (x-1)) / 2
}


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

const int N = 200005;
double ara[N];

int main( )
{
    int n, k, i, j, l;
    cin >> n >> k;
    for (i = 1; i <= n; i++) {
        cin >> j;
        ara[i] = ((j * (j + 1)) / 2) / (j * 1.0);
    }
    for (i = 2; i <= n; i++) {
        ara[i] += ara[i - 1];
    }
    double mx = 0;
    for (i = k; i <= n; i++) {
        mx = max(mx, ara[i] - ara[i - k]);
    }
    cout << setprecision(10) << mx << '\n';
    return 0;
}


Measured memory_bytes: 1792
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LS()
    return l
sys.setrecursionlimit(1000000)
mod = 1000000007

#A
def A():
    x,n = LI()
    if x < n:
        print(0)
    else:
        print(10)
    return

#B
def B():
    n,x = LI()
    l = LI()
    d = 0
    ans = 1
    for i in range(n):
        d += l[i]
        if d <= x:
            ans += 1
    print(ans)
    return

#C
def C():
    w,h,x,y = LI()
    ans = w*h/2
    k = 0
    if x == w/2 and y == h/2:
        k = 1
    print(ans,k)
    return

#D
def D():
    n,k = LI()
    a = LI()
    b = [a[i] for i in range(n)]
    for i in range(n-1):
        b[i+1] += b[i]
    b.insert(0,0)
    ans = 0
    for l in range(n):
        r = bisect.bisect_left(b,b[l]+k)
        ans += n-r+1
    print(ans)
    return

#E
def E():
    n,m = LI()
    s = LI()
    t = LI()
    dp = [[0 for i in range(m+1)] for j in range(n+1)]
    for i in range(n+1):
        dp[i][0] = 1
    for j in range(m+1):
        dp[0][j] = 1
    for i in range(1,n+1):
        for j in range(1,m+1):
            if s[i-1] == t[j-1]:
                dp[i][j] += dp[i-1][j]+dp[i][j-1]
            else:
                dp[i][j] += dp[i-1][j]+dp[i][j-1]-dp[i-1][j-1]
            if dp[i][j] >= mod:
                dp[i][j] %= mod
    print(dp[n][m]%mod)
    return

#F
def F():
    n = I()
    x = [None for i in range(n)]
    y = [None for i in range(n)]
    f = [None for i in range(n)]
    for i in range(n):
        a,b,d = LS()
        a = int(a)
        b = int(b)
        x[i] = a
        y[i] = b
        if d == "R":
            f[i] = (1,0)
        elif d == "L":
            f[i] = (-1,0)
        elif d == "U":
            f[i] = (0,1)
        else:
            f[i] = (0,-1)
    dx = max(x)-min(x)
    dy = max(x)-min(y)
    ans = dx*dy
    if ans == 0:
        print(0)
        quit()
    l = 0
    r = 100000000
    while r-l > 0.5:
        m = (l+r)/2
        px = [x[i]+f[i][0]*m for i in range(n)]
        py = [y[i]+f[i][1]*m for i in range(n)]
        dx = max(x)-min(x)
        dy = max(x)-min(y)
        if dx*dy < ans:
            ans = dx*dy

    return

#Solve
if __name__ == "__main__":
    E()


Measured memory_bytes: 702464
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define s(x) (x).begin(),(x).end();
using namespace std;
typedef long long ll; 
typedef vector<int> vi;
int main(){
  int D,G;
  cin>>D>>G;
  vi p(D),c(D);
  rep(i,D)cin>>p[i]>>c[i];
  ll ans = 1000000000;
  rep(bit,1<<D){
    ll sm = 0;
    ll total = 0;
    rep(i,D){
      if(bit & 1<<i){
        total+=p[i]*100*(i+1)+c[i];
        sm += p[i];
      }
    }
    if(total>=G){ans=min(ans,sm);}
    else{
      bool f = false;
      for (int j = D-1; j >=0; j--)
      {
        if(bit & 1<<j)continue;
        for(int k = 0;k<p[j];k++){
          if(total>=G){f=true;break;}
          total += (j+1)*100;
          sm++;
        }
        if(f)ans = min(ans,sm);break;
      }
    }
    
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
class UnionFind:
    def __init__(self,N):
        self.parent = [i for i in range(N)]
        self.rank = [0] * N
        self.count = 0
    def root(self,a):
        if self.parent[a] == a:
            return a
        else:
            self.parent[a] = self.root(self.parent[a])
            return self.parent[a]
    def is_same(self,a,b):
        return self.root(a) == self.root(b)
    def unite(self,a,b):
        ra = self.root(a)
        rb = self.root(b)
        if ra == rb: return
        if self.rank[ra] < self.rank[rb]:
            self.parent[ra] = rb
        else:
            self.parent[rb] = ra
            if self.rank[ra] == self.rank[rb]: self.rank[ra] += 1
        self.count += 1

N,M = map(int, input().split())
P = list(map(int, input().split()))

"""
ペアの整数をたどって目的のindexまでたどり着ければよい。
全ての数字についてやるとTLE待ったなしなので、UnionFindで同じ集合に含まれていればたどり着けるよね、という感じ
"""

uf = UnionFind(N)
for _ in range(M):
    x,y = map(int, input().split())
    uf.unite(x-1, y-1)

ans = 0
for i,p in enumerate(P):
    if p-1 == i or uf.is_same(p-1, i):
        ans += 1

print(ans)

Measured memory_bytes: 13812
# input
S = input()

# check
fl = True
for i, s in enumerate(S):
    if (
            ((i + 1) % 2 == 0 and s not in ["L", "U", "D"]) or
            ((i + 1) % 2 == 1 and s not in ["R", "U", "D"])
    ):
        fl = False
        break
        
if fl is True:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 2940
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

#define F first
#define S second
#define int long long
#define ll long long
//#define int  unsigned long long
#define pb push_back
//#define double long double

using namespace std;
using namespace __gnu_pbds;
typedef  tree< int , null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
const int mod = 998244353;
const int N = 160000;
const int K = 20000;
int r[N], used1[N], used2[N], v1, v2, c[N], n, m, k;
vector < pair < int, int > > gc[N], gr[N];
void dfs(int v){
    used1[v] = 1;
    if (r[v] == -1e18){
        r[v] = 0;
    }
    v1 = min(v1, r[v]);
    queue < int > q;
    for (auto u: gr[v]){
        if (used2[u.F]) continue;
        c[u.F] = u.S - r[v];
        v2 = min(c[u.F], v2);
        used2[u.F] = 1;
        for (auto u2: gc[u.F]){
            if (used1[u2.F]) continue;
            r[u2.F] = u2.S - c[u.F];
            v1 = min(v1, r[u2.F]);
            q.push(u2.F);
            used1[u2.F] = 1;
        }
    }
    while(!q.empty()){
        dfs(q.front());
        q.pop();
    }
}
main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    //freopen("input.txt", "r", stdin);
    cin >> n >> m;
    cin >> k;
    for (int i = 1; i <= n; i++) r[i] = -1e18;
    for (int j = 1; j <= m; j++) c[j] = -1e18;
    for (int i = 1; i <= k; i++){
        int r, c, val;
        cin >> r >> c >> val;
        gc[c].pb({r, val});
        gr[r].pb({c, val});
    }
    for (int i = 1; i <= n; i++){
        v1 = v2 = 1e18;
        if (!used1[i]){
            dfs(i);
        }
        if (v1 + v2 < 0){
            cout << "No";
            return 0;
        }
    }
    for (int i = 1; i <= n; i++){
        for (auto j: gr[i]){
            if (r[i] + c[j.F] != j.S){
                cout << "No";
                return 0;
            }
        }
    }
    cout << "Yes";
}


Measured memory_bytes: 60672
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//イテレータあるけど順序保持しないmap
#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列

using namespace std;
typedef long long ll;

//マクロ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#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 ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define INF 1000000000000 //10^12
#define MOD 10000007 //10^9+7
#define PB push_back

template<typename T, typename U, typename Comp=less<>>
bool chmax(T& xmax, const U& x, Comp comp={}) {
    if(comp(xmax, x)) {
        xmax = x;
        return true;
    }
    return false;
}

template<typename T, typename U, typename Comp=less<>>
bool chmin(T& xmin, const U& x, Comp comp={}) {
    if(comp(x, xmin)) {
        xmin = x;
        return true;
    }
    return false;
}

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

//scanf("%lld", &);
//cin >> ;
//cout << ans << endl;

ll N, M, K, i, j, k, l, ans, cnt = 0;
string s;

int main(){
    //cin >> ;
    //cout << ans << endl;

    scanf("%lld", &N);
    scanf("%lld", &K);
    ll d, A;

    vector<bool> have(N, false);
    REP(i, K){
        scanf("%lld", &d);
        REP(i, d){
            scanf("%lld", &A);
            have.at(A - 1) = true;
        }
    }
    REP(i, N){
        if(have.at(i) == false){
            cnt++;
        }
    }
    //cout << ;
    cout << cnt;
    cout << endl;
    return 0;
}

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

int main() {
    int n;
    string s;
    cin >> n >> s;
    int l = -1, r = n;
    for (int i = 0; i < n; i++) {
        if (s[i] == '>') {
            r = min(r, i);
        } else {
            l = max(l, i);
        }
    }
    cout << max(n - r, l + 1) << endl;
    return 0;
}


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

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

        string n = sc.Next();

        string answer = n.Contains('7') ? "Yes" : "No";

        Console.WriteLine(answer);
    }

    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: 25900
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N, K, number;
  cin >> N >> K;
  number = 1;
  for ( int i = 0; i < N; i++ ) {
    if ( number*2 < number+K ) {
      number += number;
    }
    else {
        number += K;
    }
  }
  cout << number;
}

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

typedef long long ll;
#define pii pair<int , int>
#define _FastIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define MAXX 1005

ll r , d , x;

int main()
{
    _FastIO;
    cin >> r >> d >> x;
    for(ll i = 0; i < 10; i++){
        x *= r;
        x -= d;
        cout << x << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>


int main()
{
	long i,k,ans;
	char S[110];
	i=0;
	scanf("%s",S);
	k=strlen(S);
	
	for(i=0;i<k;i++){
		printf("x");
	}
	
	printf("\n");
	return 0;
}

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

int A, B, N, H, W;
int main()
{
	cin >> N >> H >> W;
	int ans = 0;
	for (int i = 1; i <= N; i++)
	{
		cin >> A >> B;
		if (A >= H && B >= W)
			ans++;
	}
	cout << ans << endl;
	cin >> ws;
	return 0;
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
)

type Pair struct {
	a, b int
}

func main() {
	N, K := ReadInt(), ReadInt()
	pairs := make([]*Pair, N)
	for i := 0; i < N; i++ {
		pairs[i] = &Pair{
			a: ReadInt(),
			b: ReadInt(),
		}
	}
	sort.Slice(pairs, func(i, j int) bool {
		return pairs[i].a < pairs[j].a
	})
	s := 0
	for i := 0; i < N; i++ {
		s += pairs[i].b
		if s >= K {
			fmt.Println(pairs[i].a)
			return
		}
	}
}

var reader = bufio.NewReader(os.Stdin)

func Scan(a ...interface{}) {
	if _, err := fmt.Fscan(reader, a...); err != nil {
		panic(err)
	}
}
func ReadInt() (i int)       { Scan(&i); return }
func ReadString() (s string) { Scan(&s); return }
func ReadInts(n int) []int {
	v := make([]int, n)
	for i := 0; i < n; i++ {
		Scan(&v[i])
	}
	return v
}


Measured memory_bytes: 6996
#pragma target("avx")
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef unordered_map<ll, ll> U_MAP;
typedef priority_queue<ll> pq;
typedef priority_queue<ll, vector<ll>, greater<ll>> rpq;
constexpr ll INF = 1e9, MOD = 1e9 + 7, ohara = 1e6 + 10;
constexpr ll LINF = 1e18;

#define rep(i, n) for (ll(i) = 0; (i) < (int)(n); (i)++)
#define rrep(i, a, b) for (ll i = (a); i < (b); i++)
#define rrrep(i, a, b) for (ll i = (a); i >= (b); i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout << (x) << endl
#define doublecout(a) cout << fixed << setprecision(15) << a << endl;
#define fi first
#define se second
#define m_p make_pair
#define p_b push_back
string to_string(string s) { return '"' + s + '"'; }
string to_string(const char* s) { return to_string((string)s); }
string to_string(bool b) { return (b ? "true" : "false"); }
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto& x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

//------ Believe yourself as a genius!!!!!! ------

int dy[] = {1, 0, -1, 0};
int dx[] = {0, 1, 0, -1};
// int dy[]={-1,0,1,-1,1,-1,0,1};int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"), s;
ll n, cnt, ans, a, b, c, d, tmp, m, h, w, x, y, sum, k, q;

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

  cin >> k >> a >> b;
  ans = 1;
  rep(i, k) {
    if (ans >= a) {
      if (i + 1 <= k - 1) {
        ans -= a;
        ans += b;
        i++;
      } else {
        ans++;
      }
    } else {
      ans++;
    }
  }
  ans = max(ans, 1 + k);
  Cout(ans);
  return 0;
}

Measured memory_bytes: 256