akhauriyash/Code-Regression huggingface dataset:
//------------------------------>> tsukasa_diary's template <<------------------------------//
#include <bits/stdc++.h>
using namespace std;

#define for_(i,a,b) for(int i=(a);i<(b);++i)
#define allof(a) (a).begin(),(a).end()
using lint = long long;
template< typename T > using Vec = vector< T >;

template< typename T > bool inRange(T x, T lb, T ub) { return lb <= x && x < ub; }
template< typename T > bool inRange(T x, T y, T lb, T ub) { return in_range(x, lb, ub) && in_range(y, lb, ub); }
template< typename T > void modAdd(T& a, T b, T mod) { a = (a + b + mod) % mod; }
template< typename T > void modMul(T& a, T b, T mod) { a = (a * b) % mod; }
template< typename T > void minUpdate(T& a, T b) { a = min(a, b); }
template< typename T > void maxUpdate(T& a, T b) { a = max(a, b); }
inline int bitCount(int x) { return __builtin_popcount(x); }
inline int bitCount(lint x) { return __builtin_popcountll(x); }

const int dx[4] = {0,1,0,-1}, dy[4] = {-1,0,1,0};
const int Dx[8] = {0,1,1,1,0,-1,-1,-1}, Dy[8] = {-1,-1,0,1,1,1,0,-1};
const double PI = acos(-1);

//--------------8---------------->> coding space <<-----------------8-------------//
const lint MOD = 1000003;

long long extGCD(long long a, long long b, long long &x, long long &y) {
    if (b == 0) {
        x = 1;
        y = 0;
        return a;
    }
    long long d = extGCD(b, a%b, y, x);
    y -= a / b * x;
    return d;
}

inline lint mod(lint a, lint m) {
    return (a % m + m) % m;
}

lint modinv(lint a, lint m) {
    lint x, y;
    extGCD(a, m, x, y);
    return mod(x, m);
}

lint modPow(lint x, lint k) {
	lint ret = 1;	
	while (k > 0) {
		if (k & 1) modMul(ret, x, MOD);
		modMul(x, x, MOD);
		k >>= 1;
	}
	return ret;
}

const int MAX_I = 1000005;
lint modfact[MAX_I];
lint invfact[MAX_I];

void solve(lint x, lint d, lint n) {
	if (d == 0) {
		cout << modPow(x, n) << endl;
		return;
	}
	lint dn = modPow(d, n);	
	lint base = (x * modinv(d, MOD)) % MOD;
	if (x % MOD == 0 || base == 0 || base + n - 1 >= MOD) {
		cout << 0 << endl;
		return;
	}
	lint ans = modfact[base + n - 1];
	modMul(ans, invfact[base - 1], MOD);
//	for_(i,0,n) {
//		lint ai = (base + i) % MOD;
//		modMul(ans, ai, MOD);
//	}
	modMul(ans, dn, MOD);
	cout << ans << endl;
}

int main() {
	int Q;
	cin >> Q;
	modfact[0] = 1;
	for_(i,1,MAX_I) {
		modfact[i] = (modfact[i-1] * (lint)i) % MOD;
		invfact[i] = modinv(modfact[i], MOD);
	}
	for_(q,0,Q) {
		int x, d, n;
		cin >> x >> d >> n;
		solve(x, d, n);
	}
}
//--------------8---------------->> coding space <<-----------------8-------------//

Measured memory_bytes: 16512
#include<bits/stdc++.h>
using namespace std;
 
int main(){
  int N;
  cin>>N;
  vector<vector<int>> G(N);
  vector<pair<int,int>> vp;
  for(int i=1;i<N;i++){
    int a,b;
    cin>>a>>b;
    a--;b--;
    G[a].emplace_back(b);
    G[b].emplace_back(a);
    vp.emplace_back(a,b);
  }
 
  int K=0;
  map<pair<int,int>,int> I;
  vector<int> cs(N,0); // color of edge between its parent
 
  vector<int> used(N,0);
  queue<int> que;
  used[0]=1;
  que.emplace(0);
  while(!que.empty()){
    int v=que.front();que.pop();
    if(K<(int)G[v].size()) K=G[v].size();
    int cur=1;
    for(int u:G[v]){
      if(used[u]) continue;
      if(cur==cs[v]) cur++;
      cs[u]=I[make_pair(u,v)]=I[make_pair(v,u)]=cur++;
      used[u]=1;
      que.emplace(u);
    }
  }
 
  cout<<K<<endl;
  for(auto p:vp) cout<<I[p]<<endl;
  return 0;
}

Measured memory_bytes: 22892
import sys
input = sys.stdin.readline
from collections import defaultdict
N, K = map(int, input().split())
count = defaultdict(int)
for _ in range(K):
    d = int(input().rstrip())
    A = list(map(int, input().split()))
    for a in A:
        count[a-1] += 1
ans = 0
for i in range(N):
    if count[i] == 0:
        ans += 1
print(ans)

Measured memory_bytes: 9460
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#define lol(i,n) for(int i=0;i<n;i++)
#define mod 1000000007
typedef long long ll;
using namespace std;

int main(){
    ll a,b;cin>>a>>b;
    return cout<<(a*b&1?"Yes":"No")<<endl,0;
}


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

using namespace std;

typedef vector<int> vi;
typedef long long ll;
typedef pair<int, int> pii;

main(){
    string str;
    cin >> str;
    for(int i=0;i<=1;++i){
        for(int j=0;j<=1;++j){
            for(int k=0;k<=1;++k){
                int sum = str[0] - '0';
                if(i==0) sum+= str[1] - '0';
                else sum -= str[1] - '0';
                if(j==0) sum+= str[2] - '0';
                else sum -= str[2] - '0';
                if(k==0) sum+= str[3] - '0';
                else sum -= str[3] - '0';
                if(sum==7){
                    cout << str[0];
                    if(i==0) printf("+%d",str[1]-'0');
                    else printf("-%d",str[1]-'0');
                    if(j==0) printf("+%d",str[2]-'0');
                    else printf("-%d",str[2]-'0');
                    if(k==0) printf("+%d",str[3]-'0');
                    else printf("-%d",str[3]-'0');
                    printf("=7\n");
                    return 0;
                }
            }
        }
    }
}

Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstring>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#define rs(a, b) ((a) >> (b))
#define ls(a, b) ((a) << (b))
#define gcd __gcd
#define lcm(a, b) ((a * b) / gcd(a, b))
#define pq priority_queue
#define um unordered_map
#define us unordered_set
#define lb lower_bound
#define ub upper_bound
#define F first
#define B begin()
#define E end()
#define ln length()
#define sz size()
#define S second
#define em empty()
#define nani(x) cerr << #x << " is " << x << endl;
#define ch(x) (x - 'a' + 1)
#define mp make_pair
#define pb push_back
#define loop(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define scan(x, n) loop(i, 0, n) cin >> x[i];
#define adde(g, u, v) g[u].pb(v), g[v].pb(u);
#define addew(g, u, v, w) g[u].pb({ v, w }), g[v].pb({ u, w });
#define print(x, n) loop(i, 0, n) cout << x[i] << " ";
#define fast ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define inf 10000000000
#define mod 1000000007

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<long> vl;
typedef vector<vi> vvi;
typedef pair<int, int> ii;
typedef pair<long, long> pll;
typedef vector<ii> vii;
typedef vector<pll> vll;
typedef um<int, int> umii;
typedef um<char, int> umci;
typedef map<char, int> mci;
typedef map<int, int> mii;

int main()
{
    fast;
    //freopen("input.txt", "r", stdin);
    int n, d;
    int c = 0;
    cin >> n >> d;
    int a[n][d];
    for (int i = 0; i < n; i++)
        for (int j = 0; j < d; j++)
            cin >> a[i][j];
    for (int i = 0; i < n - 1; i++) {
        for (int j = i + 1; j < n; j++) {
            int s = 0;
            for (int k = 0; k < d; k++) {
                int g = a[i][k] - a[j][k];
                s += g * g;
            }
            float p = sqrt(s);
            if (p == floor(p))
                c++;
        }
    }
    cout << c;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#define _USE_MATH_DEFINES
#include <math.h>
#include <cstring>
#include <numeric>
#include <algorithm>
#include <stdlib.h>
#include <functional>
#include <string>
#include <list>
#include <fstream>
#include <iomanip>
#include <array>
#include <map>
#include <queue>
#include <limits.h>
#include <set>
#include <stack>
#include <random>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <chrono>
#include <bitset>
#define rep(i,s,n) for(int i = (s); (n) > i; i++)
#define REP(i,n) rep(i,0,n)
#define RANGE(x,a,b) ((a) <= (x) && (x) <= (b))
#define DUPLE(a,b,c,d) (RANGE(a,c,d) || RANGE(b,c,d) || RANGE(c,a,b) || RANGE(d,a,b))
#define INCLU(a,b,c,d) (RANGE(a,c,d) && (b,c,d))
#define PW(x) ((x)*(x))
#define ALL(x) (x).begin(), (x).end()
#define MODU 1000000007
#define bitcheck(a,b)   ((a >> b) & 1)
#define bitset(a,b)      ( a |= (1 << b))
#define bitunset(a,b)    (a &= ~(1 << b))
#define MP(a,b) make_pair((a),(b))
#define Manh(a,b) (abs((a).first-(b).first) + abs((a).second - ((b).second))
#define pritnf printf
#define scnaf scanf
#define itn int

#include <nmmintrin.h>
#ifdef _MSC_VER

#define __builtin_popcount _mm_popcnt_u32
#define __builtin_popcountll _mm_popcnt_u64
#endif
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T &val) {
	std::fill((T*)array, (T*)(array + N), val);
}



int main() {
	int a, b;
	cin >> a >> b;
	if (b == 100)b++;
	cout << b;
	
	REP(i, a) cout << "00";
	cout << endl;

	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<string>
#include<cstring>
#include<climits>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<tuple>
#include<list>
#include<unordered_map>
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vii vector<int>
#define vll vector<ll>
#define lb lower_bound
#define pb push_back
#define mp make_pair
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
#define INF (1 << 30) - 1
#define LLINF (1LL << 61) - 1
// #define int ll
using namespace std;
const int MOD = 1000000007;
const int MAX = 510000;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,a,x[60],ans=0;
    cin>>n>>a;
    rep(i,n){
        cin>>x[i];
    }
    ll dp[52][52][2550][2];
    rep(i,52){
        rep(j,52){
            rep(k,2550){
                dp[i][j][k][1]=0;
                dp[i][j][k][0]=0;
            }
        }
    }
    dp[0][0][0][0]=1;
    rep2(i,1,n+1){
        rep(j,n+1){
            rep(k,2510){
                if(dp[i-1][j][k]>0){
                    dp[i][j+1][k+x[i-1]][1]+=(dp[i-1][j][k][1]+dp[i-1][j][k][0]);
                    dp[i][j][k][0]+=(dp[i-1][j][k][1]+dp[i-1][j][k][0]);
                }
            }
        }
    }
    rep2(i,1,n+1){
        rep2(j,1,n+1){
            if(dp[i][j][a*j][1]>0){
              //  cout<<i<<" "<<j<<" "<<dp[i][j][a*j]<<endl;
            }
            ans+=dp[i][j][a*j][1];
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 108032
#include <bits/stdc++.h>
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define SORT(a) sort(a.begin(), a.end())
#define REVERSE(a) reverse(a.begin(), a.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 int long long
#define INF 1000000000000000000
using namespace std;

typedef vector<int> vec;
typedef vector<vec> mat;
typedef pair<int, int> Pii;

#define ANS(f) if(f) cout << "YES" << endl; else cout << "NO" << endl;

template<typename T>
void readv(vector<T> &a){ REP(i, a.size()) cin >> a[i]; }
void readi(vector<int> &a){ REP(i, a.size()){cin >> a[i]; a[i]--;} }



signed main(){

    int N, K; cin >> N >> K;
    vec a(N); readv(a);

    vec s(N + 1, 0);
    REP(i, N) s[i + 1] = s[i] + a[i];

    int n = N * (N + 1) / 2;
    vec A(n);
    int ii = 0;
    REP(l, N){
        FOR(r, l, N){
            A[ii] = s[r + 1] - s[l];
            ii++;
        }
    }
        
    int ans = 0;
    IREP(k, 41){
        int tmp = ans + (1LL << k);
        int c = 0;
        REP(i, n) if((A[i] & tmp) == tmp) c++;
        if(c >= K) ans = tmp;
    }
    cout << ans;
    
    return 0;
}

Measured memory_bytes: 4224
N = int(input())
count = 0
for _ in range(N):
    d1, d2 = input().split()
    if d1 == d2:
        count += 1
        if count >= 3:
            break
    else:
        count = 0

if count >= 3:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 9152
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        char[] s = sc.next().toCharArray();
        int d = s.length / 2;
        boolean flg = true;
        for (int i = 0 ; i < d ; i++) {
            if (s[i] != s[s.length - 1 - i]) {
                flg = false;
            }
        }
        int c = d / 2;
        for (int i = 0 ; i < c ; i++) {
            if (s[i] != s[d - i - 1]) {
                flg = false;
            }
            if (s[i + d + 1] != s[s.length - 1 - i]) {
                flg = false;
            }
        }

        if (flg) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }

}


Measured memory_bytes: 22484
inf = float("inf")

H, W = map(int, input().split())
C = []
for _ in range(10):
    c = [int(s) for s in input().split()]
    C.append(c)
A = []
for _ in range(H):
    a = [int(s) for s in input().split()]
    for ai in a:
        if ai != -1:
            A.append(ai)
for _ in range(9):
    for i in range(10):
        for j in range(10):
            for k in range(10):
                C[i][j] = min(C[i][j], C[i][k] + C[k][j])
ans = sum([C[ai][1] for ai in A])
print(ans)


Measured memory_bytes: 3880
import itertools
N, M, Q = map(int, input().split())
abcd = list()
for i in range(Q):
    a,b,c,d = map(int, input().split())
    abcd.append((a,b,c,d))
iters = itertools.combinations_with_replacement(range(1, M+1), N)
ans = 0
for com in iters:
    sum = 0
    for a,b,c,d in abcd:
        if(com[b-1]-com[a-1] == c):
            sum += d
    if(sum > ans):
        ans = sum
print(ans)

Measured memory_bytes: 9216
#define _USE_MATH_DEFINES
#include<iostream>
#include<fstream>
#include<string>
#include<vector>
#include<utility>
#include<algorithm>
#include<climits>
#include<set>
#include<map>
#include<cmath>
#include<iomanip>
#include<iterator>
#include<queue>
#include<stack>
#include<cctype>
#include<deque>
#include<time.h>
#include<bitset>
#include<random>
#include<unordered_set>
#include<unordered_map>
#include<sstream>
#include<random>
#include<numeric>
//by Skeef79

typedef long long ll;
typedef long double ld;

typedef unsigned long long ull;

#pragma warning(disable : 4996)
#pragma comment(linker, "/STACK:16777216")
#define pb push_back
#define en '\n'
#define for0(i,n) for(int i = 0;i<n;i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define vec vector
#define pii pair<int,int>
#define pll pair<ll,ll>
#define SZ(a) int(a.size())

using namespace std;

const int INF = 2000000000;
const ll LINF = 2000000000000000000;

template<typename T> void print(vector<T>& a)
{
	for (int i = 0; i < a.size(); i++)
		cout << a[i] << ' ';
	cout << en;
}

template<typename T> void print(deque<T>& a)
{
	for (int i = 0; i < a.size(); i++)
		cout << a[i] << ' ';
	cout << en;
}

template<typename T> void print(vector<vector<T>>& a)
{
	for (int i = 0; i < a.size(); i++)
	{
		for (int j = 0; j < a[i].size(); j++)
			cout << a[i][j] << ' ';
		cout << en;
	}
}

template <typename T> void input(vector<T>& a)
{
	for (int i = 0; i < a.size(); i++)
		cin >> a[i];
}

template<typename T> void input(deque<T>& a)
{
	for (int i = 0; i < a.size(); i++)
		cin >> a[i];
}

template<typename T> void input(vector<vector<T>>& a)
{
	for (int i = 0; i < a.size(); i++)
		for (int j = 0; j < a[i].size(); j++)
			cin >> a[i][j];

}

void solve()
{
	ll a, b, c, d;
	cin >> a >> b >> c >> d;
	cout << max({ a*c,a*d,b*c,b*d });

}

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

#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
#endif

	//freopen("input.in", "r", stdin);
	//freopen("output.out", "w", stdout);

	int tst = 1;
	//cin >> tst;

	while (tst--)
		solve();
}


Measured memory_bytes: 3648
#include <cstdio>
#include <algorithm>

using namespace std;

typedef long long ll;

const int MOD = 1000000007;

int n, m;
int a[121];
ll dp[121][100021];

int main() {
    scanf("%d%d", &n, &m);
    for (int i = 1; i <= n; ++i)
        scanf("%d", &a[i]);
    dp[0][0] = 1;
    for (int i = 1; i <= n; ++i) {
        ll pre = 0;
        for (int j = 0; j <= m; ++j) {
            pre += dp[i - 1][j];
            int k = j - a[i] - 1;
            if (k >= 0) pre -= dp[i - 1][k];
            pre = (pre % MOD + MOD) % MOD;
            dp[i][j] = pre;
        }
    }
    printf("%lld\n", dp[n][m] % MOD);
    return 0;
}

Measured memory_bytes: 79232
x,y = map(str, input().split())
a=0
b=0
if x=="A":
  a=10
elif x=="B":
  a=11
elif x=="C":
  a=12
elif x=="D":
  a=13
elif x=="E":
  a=14
elif x=="F":
  a=15
  
  
if y=="A":
  b=10
elif y=="B":
  b=11
elif y=="C":
  b=12
elif y=="D":
  b=13
elif y=="E":
  b=14
elif y=="F":
  b=15

if a<b:
  print("<")
elif a>b:
  print(">")
elif a==b:
  print("=")


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

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

  if (abs(n - m) > 1)
  {
    cout << 0 << endl;
    return 0;
  }
  long long n1 = n;
  long long m1 = m;

  for (i = n - 1; i >= 1; i--)
  {
    n1 = (n1 * i) % (long long)(1e9 + 7);
  }

  for (j = m - 1; j >= 1; j--)
  {
    m1 = (m1 * j) % (long long)(1e9 + 7);
  }

  if (abs(n - m) == 0)
  {
    cout << (2 * n1 * m1) % (long long)(1e9 + 7) << endl;
  }
  else if (abs(n - m) == 1)
  {
    cout << (n1 * m1) % (long long)(1e9 + 7) << endl;
  }
}


Measured memory_bytes: 3632
#include<iostream>
#include<vector>
#include<queue>
#include<map>
#include<cstring>
#define N 100005
using namespace std;
int n,res,cs[N],col[N],vis[N];
pair<int,int> p[N];
queue<int> q;
vector<int> g[N];
map<pair<int,int>,int> mp;
int main(){
	memset(col,0,sizeof(col));
	memset(vis,0,sizeof(vis));
	memset(cs,0,sizeof(cs));
	cin>>n;
	for (int i=0;i<n-1;i++){
		int u,v;
		scanf("%d%d",&u,&v);
		g[u].push_back(v);
		g[v].push_back(u);
		p[i+1]=make_pair(u,v);
	}
	q.push(1); 
	vis[1]=1;
	while (!q.empty()){
		int u=q.front();	q.pop();
		if (res<g[u].size()) res=g[u].size();
		int cur=1;
		for (int i=0;i<g[u].size();i++){
			int v=g[u][i];
			if (vis[v]) continue;
			if (cur==cs[u]) cur++;
			cs[v]=mp[make_pair(u,v)]=mp[make_pair(v,u)]=cur++;
			vis[v]=1;
			q.push(v);
		}
    }
	cout<<res<<endl;
	for (int i=1;i<n;i++)
		cout<<mp[p[i]]<<" ";	
	return 0;
}

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

int n, K, q, A[2005];

int cal(int x){
  
  priority_queue<int,vector<int>,greater<int> > Q, tmp;
    
  for(int i=0;i<n;i++){
    
    if( x <= A[i] ){
      tmp.push( A[i] );
    }
    else{
      
      while( (int)tmp.size() >= K ){
	Q.push( tmp.top() );
	tmp.pop();
      }
      
      while( !tmp.empty() ) tmp.pop();
      
    }
    
  }
  
  while( (int)tmp.size() >= K ){
    Q.push( tmp.top() );
    tmp.pop();
  }
      
  while( !tmp.empty() ) tmp.pop();
  
  int cnt = q;
  
  if( cnt > (int)Q.size() ) return 1e9;
  
  int maxv = 0;
  
  while( cnt-- ){
    maxv = max( maxv, Q.top() );
    Q.pop();
  }
  
  return maxv - x;
}

signed main(){
  
  cin>>n>>K>>q;
  
  for(int i=0;i<n;i++) cin>>A[i];
  
  int ans = 1e9;
  
  for(int i=0;i<n;i++){
    
    ans = min( ans, cal(A[i]) );
    
  }
  
  cout<<ans<<endl;
    
  return 0;
}


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

int main(){
  int n;
  cin>>n;
  vector<int>a(n);
  for(int i=0;i<n;i++)cin>>a[i];
  int suuji=1;
  int i=0;
  while(i<n){
    if(a[i]==suuji)suuji++;
    i++;
  }
  if(suuji==1){
    cout<<-1<<endl;
  }else{
    int kotae=n-suuji+1;
    cout<<kotae<<endl;
  }
  return 0;
}


Measured memory_bytes: 1024
#include<iostream>
#include<vector>
#include<string>
using namespace std;
int main() {
	bool l, r;//true : up ,false : down
	int n;
	vector<int>ll;
	while (cin >> n){
		if (n == 0)break;
		int sum = 0;
		l = false;
		r = false;
		string s;
		for (int i = 0; i < n; i++) {
			const bool bol = l;
			cin >> s;
			if (s == "lu")l = true;
			else if (s == "ld")l = false;
			else if (s == "ru")r = true;
			else if (s == "rd")r = false;
			i++;
			if (i >= n)goto Goto;
			cin >> s;
			if (s == "lu")l = true;
			else if (s == "ld")l = false;
			else if (s == "ru")r = true;
			else if (s == "rd")r = false;
			if (bol != l&&bol != r)sum++;
		}
	Goto:
		ll.push_back(sum);
	}
	for (int i : ll) {
		cout << i << endl;
	}
	char c;
	cin >> c;
	return 0;
}

Measured memory_bytes: 3096
from collections import Counter
N = int(input())
a = list(map(int,input().split()))
count_a = Counter(a)

count = 0
for key in count_a.keys():
    if key < count_a[key]:
        count += count_a[key] - key
    elif key == count_a[key]:
        count += 0
    else:
        count += count_a[key]

print(count)


Measured memory_bytes: 18676
#include<bits/stdc++.h>
#define INF 9003372036854775807LL
#define mod 1000000007
#define fixed fixed<<setprecision(12)
#define abs(x,y) (max(x,y)-min(x,y))
#define lol long long
#define mp make_pair
#define fi first
#define se second
using namespace std;
using pii=pair<int, int > ;
lol a[300010];
signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  string s;
  lol n,m,k,r,x,y,z;
  cin >>n>>m;
  lol sum=0;
  for(int i=0;i<n;i++) cin >>a[i],sum+=a[i];
  if(m==sum){
    cout <<n<<'\n';
    return 0;
  }
  sort(a,a+n);
  int ans=0;
  for(int i=0;i<n;i++){
    if(m>=a[i]) m-=a[i],ans++;
    else {
      ans++;
      break;
    }
  }
  //if(m!=0) ans--;
  cout <<max(ans-1,0)<<'\n';
  return (0);
}


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

#define ll long long //data types used often, but you don't want to type them time by time
#define ull unsigned long long
#define ui unsigned int
#define mod 1000000007
#define us unsigned short
#define IOS ios_base::sync_with_stdio(0); //to synchronize the input of cin and scanf
#define INF LONG_MAX
#define PI 3.1415926535897932384626
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define rep(x,j,n)for(int x=j;x<n;x++)
#define all(x) (x).begin(), (x).end()

typedef vector<pair<ll,ll>> vpi;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef pair<ll,ll> pi;

bool prime(ll n)
{
    if(n<=1)return false;
    if(n<=3)return true;
    if(n%2==0||n%3==0)return false;
    for(ll i=5;i*i<=n;i+=6)
    {
        if(n%i==0||n%(i+2)==0)return false;
    }
    return true;
}

ll modexp(ll a,ll b,ll m)
{
    ll r=1;
    a=a%m;
    while(b>0)
    {
        if(b&1)r=(r*a)%m;
        b = b>>1;
        a=(a*a)%m;
    }
    return r%m;
}
bool comp(pair<ll,ll>a,pair<ll,ll>b)
{
    return a.fi>b.fi;
}


int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    long double r,ans; cin>>r;
    ans = PI*r*2;
    cout<<fixed<<setprecision(10)<<ans<<endl;
    return 0;

}
/*
1
4
4 2
10 3
3 4
9 2
*/


Measured memory_bytes: 3792
#include <iostream>
#include <vector>
using namespace std;
int main(void){
    int n,c;
    int a=0;
    cin>>n>>c;
    vector<int>p(n);
    for(int i=0;i<c;i++){
    cin>>p[i];
    a+=p[i];
    }
    if(a%(n+1)==0){
    cout<<a/(n+1)<<endl;
    }
    else if(a%(n+1)>=1){
        cout<<a/(n+1)+1<<endl;
    }
    
    }
    


Measured memory_bytes: 3116
#include<iostream>
using namespace std;
int a,b,k;
int main(){
	cin>>k>>a>>b;
	for(int i=a;i<=b;i++)
		if(!(i%k)){
			cout<<"OK\n";
			return 0;
		}
	cout<<"NG\n";
	return 0;
} 

Measured memory_bytes: 3620
import java.util.Scanner;
class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    if(a/100 == 7 || (a%100)/10 == 7 || (a%10) == 7) System.out.println("Yes");
    else System.out.println("No");
  }
}

Measured memory_bytes: 35784
//frog1 problem
#include<iostream>
using namespace std;
int mini(int a,int b)
{
	if(a<b) return a;
	else return b;
}
int modo(int a)
{
	if(a>=0) return a;
	else return -1*a;
}
int main()
{
	int n;
	cin>>n;
	int array[n];
	for(int i=0;i<n;i++)
		cin>>array[i];
    int dp[n];
    dp[0]=0;
    dp[1]=modo(array[1]-array[0]);
    for(int i=2;i<n;i++)
    {
    dp[i]=mini((dp[i-2]+modo(array[i]-array[i-2])),(dp[i-1]+modo(array[i]-array[i-1])));
  
} cout<<dp[n-1];
}


Measured memory_bytes: 1024
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <tuple>
#include <cstring>
#include <functional>
using namespace std;
typedef long long ll;
typedef pair<long long, long long> P;
#define rep(i, n) for(long long i=0; i<n; i++)
#define reps(i, s, e) for(long long i=s; i<e; i++)
#define repr(i, n) for(long long i=n-1; i>=0; i--)
#define reprs(i, s, e) for(long long i=e-1; i>=s; i--)

int main(){

    cin.tie(0);
    ios::sync_with_stdio(false);

    string s; cin >> s;

    if(s == "SSS"){
        cout << 0 << endl;
    }
    else if(s == "RSS" || s == "SRS" || s == "SSR" || s == "RSR"){
        cout << 1 << endl;
    }
    else if(s == "RRS" || s == "SRR"){
        cout << 2 << endl;
    }
    else{
        cout << 3 << endl;
    }

    return 0;
}

Measured memory_bytes: 3616
import Data.List

main = do
    n <- getLine
    a <- map read . words <$> getLine
    putStrLn . show $ solve a

solve:: [Int]-> Int
solve a = draw 0 0 $ reverse $ sort a

draw:: Int -> Int -> [Int] -> Int
draw c n [] = n
draw 0 n (a:as) = draw 1 (n + a) as
draw 1 n (a:as) = draw 0 (n - a) as


Measured memory_bytes: 892
#include <cstdio>
#include <algorithm>
int main()
{
	int n, sum1 = 0, sum2 = 0;
	static int w[105];
	scanf("%d", &n);
	for (int i = 1; i <= n; ++i)
		scanf("%d", w + i), sum2 += w[i];
	int ans = 1 << 30;
	for (int i = 1; i < n; ++i)
	{
		sum1 += w[i], sum2 -= w[i];
		ans = std::min(ans, std::abs(sum1 - sum2));
	}
	printf("%d\n", ans);
	return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using ll =long long;
#define all(v) v.begin(),v.end()
 
int main() {
    ll H,W;
    cin>>H>>W;
string S;
for(ll i=0;i<W+2;i++) {
    S+='.';
}
vector<string> vec(H+2);
vec[0]=S;
vec.back()=S;
for(ll i=0;i<H;i++) {
    string A;
    cin>>A;
    A='.'+A+'.';
    vec[i+1]=A;
}
vector<vector<char>> T(H,vector<char>(W));

for(ll i=1;i<=H;i++) {
    for(ll j=1;j<=W;j++) {
        if(vec[i][j]=='.') {
            ll count=0;
            if(vec[i][j+1]=='#') {
                count++;
            }
            if(vec[i][j-1]=='#') {
                count++;
            }
            if(vec[i-1][j]=='#') {
                count++;
            }
            if(vec[i+1][j]=='#') {
                count++;
            }
            if(vec[i+1][j+1]=='#') {
                count++;
            }
            if(vec[i+1][j-1]=='#') {
                count++;
            }
            if(vec[i-1][j+1]=='#') {
                count++;
            }if(vec[i-1][j-1]=='#') {
                count++;
            }

T[i-1][j-1]='0'+count;
        }

        else {
            T[i-1][j-1]='#';
        }
    }
        }

        for(ll i=0;i<H;i++) {
            for(ll j=0;j<W;j++) {
                cout<<T[i][j];
            }
            cout<<endl;
        }
            
}

        


Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
#define pie 3.141592653589793238462643383279
#define mod 1000000007
#define INF LLONG_MAX/5
#define all(v) v.begin(),v.end()
#define P pair<int,int>
#define S second
#define F first
#define f(i,n) for(int i=0;i<n;i++)
#define int long long
signed main(){
	string s,t;
	cin>>s>>t;
	cout<<t+s<<endl;
}


Measured memory_bytes: 764
#include <bits/stdc++.h>
using namespace std;
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define _CRT_SECURE_NO_WARNINGS
#define int long long
int32_t main()
{
    ios::sync_with_stdio(false);cin.tie(0);
    int n;
    cin>>n;
    vector<int> v1(n),v2(n);
    for(int i=0;i<n;i++) cin>>v1[i];
	for(int i=0;i<n;i++) cin>>v2[i];
	for(int i=1;i<n;i++) v1[i] += v1[i-1];
	for(int i=n-2;i>=0;i--) v2[i] += v2[i+1];
	int ans = 0;
	for(int i=0;i<n;i++)
		ans = max(ans,v1[i]+v2[i]);
	cout<<ans;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
long long dp[200001][5];
long long A[200000];

int main() {
    int A, B, C, X, Y;
    cin >> A >> B >> C >> X >> Y;

    int ans = 0;
    int tmp = min(X,Y);
    ans += min(A + B, 2 * C) * tmp;
    X -= tmp;
    Y -= tmp;

    if(Y == 0) ans += min(A, 2 * C) * X;
    if(X == 0) ans += min(B, 2 * C) * Y;

    cout << ans << endl;
}

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

int *S, n, count=0, *L, *R;
void merge(int, int, int);
void mergeSort(int, int);


int main() {
  int i;

  scanf( "%d" , &n );
  S = (int *)malloc((n+1) * sizeof(int));
  for( i=0; i<n; i++ ) scanf( "%d" , &S[i] );
  mergeSort(0, n);
  for( i=0; i<(n-1); i++ ) printf( "%d " , S[i] );
  printf( "%d\n%d\n" , S[n-1] , count );
  
  return 0;
}


void merge(int left, int mid, int right) {
  int n1 = mid - left, n2 = right - mid, i, j=0, k;

  L = (int *)malloc((n1+1) * sizeof(int));
  R = (int *)malloc((n2+1) * sizeof(int));
  for ( i=0; i<n1; i++ ) L[i] = S[left+i];
  for ( i=0; i<n2; i++ ) R[i] = S[mid+i];
  L[n1] = R[n2] = 1000000001;
  i = 0;
  for ( k=left; k<right; k++ ) {
    if ( L[i] <= R[j] ) {
      S[k] = L[i];
      i++;
    }
    else {
      S[k] = R[j];
      j++;
    }
    count++;
  }
}

void mergeSort(int left, int right) {
  int mid, i;

  if ( (left+1) < right ) {
    mid = (left + right) / 2;
    mergeSort(left, mid);
    mergeSort(mid, right);
    merge(left, mid, right);
  }
}




Measured memory_bytes: 64444
using System;
    class Program
    {
        static void Main(string[] args)
        {
            double[] x = new double[1000];
            double[] y = new double[1000];
            int count=-1;
            string str = Console.ReadLine();
            while (!string.IsNullOrEmpty(str))
            {
                count++;
                string[] s = str.Split(' ');
                double a = double.Parse(s[0]);
                double b = double.Parse(s[1]);
                double c = double.Parse(s[2]);
                double d = double.Parse(s[3]);
                double e = double.Parse(s[4]);
                double f = double.Parse(s[5]);
                y[count] = (c * d - a * f) / (b * d - a * e);
                x[count] = (c - b * y[count]) / a;
                str = Console.ReadLine();
            }
            for (int n = 0; n <= count; n++)
                Console.WriteLine(string.Format("{0:0.000}",x[n])+" "+string.Format("{0:0.000}",y[n]));
        }
    }

Measured memory_bytes: 5832
#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>
using namespace std;
typedef long long ll;
const double PI = acos(-1.0);
const double eps = 1e-6;
const int INF = 1000000000;
const int mod = 1e9+7;
const int maxn = 2e5+5;
ll v[maxn];
int main() {
	int n;
	cin>>n;
	for(int i=1;i<=n;i++) cin>>v[i];
	ll ans = 0;
	ll maxx = v[1];
	for(int i=2;i<=n;i++){
		if(v[i]>maxx){
			maxx = v[i];
		}else {
			ans+=(maxx-v[i]);
		}
	}
	cout<<ans<<endl;
	
    return 0;
}



Measured memory_bytes: 5188
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<vector>
#include<set>
#include<map>
#include<string>
#include<functional>
#include<queue>
#include<stack>
#include<math.h>
#define INF ((1<<30)-1+(1<<30))
#define EPS 1.0e-6

using namespace std;

typedef long long ll;

int n,q;
int m[420000];

int init(int m)
{
	int k = 1;
	while (k < m) {
		k *= 2;
	}
	/*for (int i = 0; i < 2 * k; i++) {
		m[i] = INF;
	}
	*/
	return k;
}

//[l,r)???x?????´??°??????.[bottom,top),node??????????????????
void update(int x, int l, int r, int bottom = 0, int top = n, int node = 1)
{
	if (l <= bottom&&top <= r) {
		m[node] = x;
		return;
	}
	
	if (top <= l || r <= bottom)return;

	int mid = (bottom + top) / 2;

	//-INF???????????????????????¨?????????????????????????????¨?????¨???
	if (m[node] != -INF) {
		m[2 * node] = m[node];
		m[2 * node + 1] = m[node];
		m[node] = -INF;
	}
	update(x, l, r, bottom, mid, 2 * node);
	update(x, l, r, mid, top, 2 * node + 1);
}

//[l,r)??§x?????????.[bottom,top),node??????????????????
void add(int x, int l, int r, int bottom = 0, int top = n, int node = 1)
{
	if (l <= bottom&&top <= r) {
		m[node] +=x ;
		return;
	}
	if (top <= l || r <= bottom)return;

	int mid = (bottom + top) / 2;

	add(x, l, r, bottom, mid, 2 * node);
	add(x, l, r, mid, top, 2 * node + 1);
}

int find(int i, int bottom = 0,int top=n,int node=1) {
	if (i < bottom || top <= i)return -INF;
	if (m[node] != -INF)return m[node];
	
	int mid = (bottom + top) / 2;
	int l = find(i, bottom, mid, 2 * node);
	int r = find(i, mid, top, 2 * node + 1);
	return max(l, r);
}

int get(int i,int node = 1) {
	i += n;
	int ans = m[i];
	i /= 2;
	while (i > 0) {
		ans += m[i];
		i /= 2;
	}
	return ans;
}

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

	n=init(n);
	
	int a, s, t, x, k;
	for (int i = 0; i < q; i++) {
		cin >> a;
		if (a == 0) {
			cin >> s >> t >> x;
			s--; t--;
			add(x, s, t + 1);
		}
		if (a == 1) {
			cin >> k;
			k--;
			cout << get(k) << endl;
		}
	}

	return 0;
}

Measured memory_bytes: 3788
#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<string>
#include<vector>
#include<set>
#include<cctype>
#define ld long double
#define ll long long int
#define ull unsigned long long int
using namespace std;
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
const long long INF=1LL<<60;


int main(void){
	ios::sync_with_stdio(false); cin.tie(0);
	
	int n,m,x,y,i,ans;
	cin>>n>>m>>x>>y;
	int xi[n],yi[m];
	for(i=0;i<n;i++)cin>>xi[i];
	for(i=0;i<m;i++)cin>>yi[i];
	sort(xi,xi+n);sort(yi,yi+m);
	int maxxi=max(x,xi[n-1]),minyi=min(yi[0],y);
//	cout<<maxxi<<" "<<minyi<<endl;
	if(maxxi<minyi)cout<<"No War";
	else cout<<"War"<<endl;
	
		
	return 0;
}


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

typedef pair<int, int> pi;

int n, m, l, r, d, dist[100001], vis[100001];
vector<pi> adj[100001];

void dfs(int node){
	vis[node] = 1;
	for(auto it:adj[node]){
		if(vis[it.first] != -1){
			if(dist[it.first] != dist[node]+it.second){ cout << "No"; exit(0); }
			continue;
		}
		vis[it.first] = 1;
		dist[it.first] = dist[node]+it.second;
		dfs(it.first);
	}
}

int main(){
	memset(vis, -1, sizeof(vis));
	cin >> n >> m;
	for(int i = 0; i < m; i++){
		cin >> l >> r >> d;
		adj[l].push_back(pi(r, d));
		adj[r].push_back(pi(l, -d));
	}
	for(int i = 1; i <= n; i++){
		if(vis[i] == -1) dfs(i);
	}
	cout << "Yes";
}

Measured memory_bytes: 11392
def main():
    N, K = map(int, input().split())
    A = list(map(int, input().split()))
    A.sort()


    # [ok, ng) - Maximum
    # (ng, ok] - Minimum
    # ok が 最終的な答え
    ok = N
    ng = -1
    while abs(ok - ng) > 1:
        mid = (ok + ng) // 2
        n = mid
        dp = [0] * (K + 1)
        dp[0] = 1
        for i in range(N):
            a = A[i]
            if i == n or a >= K:
                continue
            for j in range(K, -1, -1):
                dp[min(K, j + a)] |= dp[j]
        rst = any(dp[k] for k in range(max(0, K - A[n]), K))
        if rst:
            ok = mid
        else:
            ng = mid
    print(ok)


main()


Measured memory_bytes: 42068
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
#define rep(i,m,n) for(int i=m;i<n;i++)
ll mod=1e9+7;

int main(){
  int k;
  cin>>k;
  cout<<(k/2)*((k+1)/2)<<endl;
}

Measured memory_bytes: 256
//
//  main.cpp
//  atcoder - flowers
//
//  Created by r on 6/2/19.
//  Copyright © 2019 r. All rights reserved.
//

#include <iostream>
#include <algorithm>
#include <cstring>
#include <iomanip>
#include <fstream>
#include <cmath>
#include <vector>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <map>
#include <stack>
#include <queue>
#include <assert.h>
#include <limits>
#include <cstdio>
using namespace std;

//#define RDEBUG 1
#ifdef RDEBUG
#define D(x) x
#else
#define D(x)
#endif
#define inf 0x7fffffff
#define MOD 1000000007

long long N, h[200010], a[200010], dp[200010];
long long t[900100];

long long findmax(long long v, long long tl, long long tr, long long l, long long r) {
    if (l > r)
        return numeric_limits<long long>::min(); // check negative numbers
    if (l == tl && r == tr) {
        return t[v];
    }
    long long tm = (tl + tr) / 2;
    return max(findmax(v*2, tl, tm, l, min(r, tm)) ,findmax(v*2+1, tm+1, tr, max(l, tm+1), r));
}


void updatemax(long long v, long long tl, long long tr, long long pos, long long new_val) {
    if (tl == tr) {
        t[v] = new_val;
    } else {
        long long tm = (tl + tr) / 2;
        if (pos <= tm)
            updatemax(v*2, tl, tm, pos, new_val);
        else
            updatemax(v*2+1, tm+1, tr, pos, new_val);
        t[v] = max(t[v*2], t[v*2+1]);
    }
}



int main() {
    ios_base :: sync_with_stdio(false);
    cin.tie(nullptr);
    cin >> N;
    for (long long i = 0; i<N; i++) cin >> h[i];
    for (long long i = 0; i<N; i++) cin >> a[i];
    for (long long i = 0; i<N; i++) {
        dp[i] = a[i]+findmax(1, 1, N, 1, h[i]);
        updatemax(1, 1, N, h[i], dp[i]);
    }
    long long best = 0;
    for (int i = 0; i<N; i++) {
        best = max(best, dp[i]);
    }
    cout << best << endl;
    return 0;
}






Measured memory_bytes: 12032
#pragma GCC optimize ("O3")

#include <bits/stdc++.h>
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define bcnt __builtin_popcountll
#define dump(x)  cerr << #x << " = " << (x) << endl
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl

using namespace std;

typedef long long ll;
typedef pair<ll,ll> Pll;
typedef pair<int,int> Pin;

ll INF = 1e16;
int inf = 1e9;
ll MOD = 1e9+7;

template<typename T>
ostream& operator << (ostream& os, const vector<T>& vec) {
    os << "[ ";
    REP(i, vec.size()) {
        os << vec[i] << " ";
    }
    os << "]";

    return os;
}

ll pow_mod(ll a, ll p) {
    ll res = 1;
    while(p) {
        if (p & 1) res = (res * a) % MOD;
        a = (a * a) % MOD;
        p >>= 1;
    }

    return res;
}


ll mod_inv(ll a, ll m) {
    ll b = m, u = 0, v = 1;
    while(a) {
        ll t = b / a;
        swap(b -= t * a, a);
        swap(u -= t * v, v);
    }

    return (u % m + m) % m;
}

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


int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    
    int H, A;
    cin >> H >> A;

    
    cout << fixed << setprecision(20);
    cout << int(ceil(double(H)/A)) << endl;

}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define PI 3.141592
#define LL_INF 9000000000000000000
#define LL_MINF -9000000000000000000
#define INT_INF 2000000000
#define INT_MINF -2000000000
#define all(a) (a).begin(), (a).end()
#define fi first
#define se second

int main(){
    int N;
    cin >> N;
    vector<string> S(N);
    for(int i = 0; i < N; i++) cin >> S[i];
    int M;
    cin >> M;
    vector<string> T(M);
    for(int i = 0; i < M; i++) cin >> T[i];

    map<string, int> S1;
    map<string, int> T1;
    for(string s: S) S1[s]++;
    for(string t: T) T1[t]++;
    int max_n = 0;
    for(auto p : S1){
        max_n = max(max_n, p.se - T1[p.fi]);
    }
    cout << max_n << endl;
}


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

using namespace std;


void solve() {
    string s; cin >> s;
    for (char c:s)if(c=='7'){
        cout << "Yes";  return;
    }
    cout << "No";
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    solve();
    return 0;
}


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

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

	int p,q,r;
	cin >> p >> q >> r;
	cout << min({p + q, q + r, r + p});
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <math.h>
#include <algorithm>
#include <stdio.h>
#include <string>
using namespace std;
int main(void){
   int s;
   cin>>s;
   int count=0;
   for(int i=1;i<=s;i++){
       string a=to_string(i);
       if(a.length()%2==1){
           count++;
       }
   }
   cout<<count<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long int 
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vii vector<int>
#define vll vector<ll>
#define mii map<int,int>
#define mll map<ll,ll>
#define mod 1000000007
#define IOS std::ios::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL);
#define endl "\n"
#define pqmin priority_queue<int,vector<int>,greater<int>>
#define pqmax priority_queue<int>
using namespace std;
int32_t main()
{
    IOS;
   int n;
   cin>>n;
   double c=n-n/2;
   cout<<c/(double)n;
   
    return 0;
}

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

const ll LINF = 1e18;
const int INF = 1e9;
const ll MOD = 1000000007;

int main(){

    string n;
    cin >> n;
    int sum = 0;
    for(int i = 0; i < (int)n.size(); i++){
        sum += n[i] - '0';
    }
    if(sum % 9 == 0) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 3684
a, b, m = map(int, input().split())
aList = list(map(int, input().split()))
bList = list(map(int, input().split()))

List = [min(aList) + min(bList)]

for _ in range(0, m) :
    x, y, c = map(int, input().split())
    List += [aList[x-1] + bList[y-1] - c]

print(min(List))

Measured memory_bytes: 18736
#include <stdio.h>
#include <string.h>
#define M 100005
int a[M];
int b[M];
int c[M];
int main()
{
	
    int i,n,m,temp1,temp2,ans=0;
    for(i=0;i<M;i++) b[i]=1;
    for(i=0;i<M;i++) c[i]=1;
    scanf("%d %d",&n,&m);
    for(i=1;i<=n;i++){
    	scanf("%d",&a[i]);
    }
    for(i=1;i<=m;i++){
    	scanf("%d %d",&temp1,&temp2);
   	   if(a[temp2]==a[temp1]){
  	       b[temp1]=0;
		   c[temp1]=0;
           b[temp2]=0;
		   c[temp2]=0;
   	   }
       else if(a[temp1]>a[temp2]) {
	      if(c[temp1]==1)
		   b[temp1]++;
		   b[temp2]=0;
		   c[temp2]=0;
		}
		else{
 	     if(c[temp2]==1)
		   b[temp2]++;
		   b[temp1]=0;
		   c[temp1]=0;
		}
    }
    
    for(i=1;i<=n;i++) 
       if(b[i]>0) ans++;
   
    printf("%d\n",ans);
    return 0;
    
}

Measured memory_bytes: 2904
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return i
}

func nextFloat64() float64 {
	f, _ := strconv.ParseFloat(next(), 64)
	return f
}

func nextInts(n int) []int {
	slice := make([]int, n)
	for i := 0; i < n; i++ {
		slice[i] = nextInt()
	}
	return slice
}

func max(nums ...int64) int64 {
	ret := nums[0]
	for _, v := range nums {
		if v > ret {
			ret = v
		}
	}
	return ret
}

func main() {
	sc.Split(bufio.ScanWords)
	var a, b, k int64
	fmt.Scan(&a, &b, &k)
	if a >= k {
		fmt.Println(a-k, b)
	} else {
		fmt.Println(0, max(0, b-(k-a)))
	}
}


Measured memory_bytes: 640
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i = 0; i < (n); i++)
#define divup(a,b) ( ( (a) + ( (b) - 1u) ) / (b) ) // a/b の余り切り上げ
// #include <boost/multiprecision/cpp_int.hpp>
// using namespace boost::multiprecision;
ll mod = 1000000007;
ll mod9 = 1000000009;

signed main(){
    ll a,b,c,x,y;
    cin>>a>>b>>c>>x>>y;
    ll sumf = a*x+b*y;
    ll ta,tb,tc,ts,res;
    rep(i,1+2*max(x,y)){
        ta =tb = ts =0;
        ta = max(0LL,x-(i/2));
        tb = max(0LL,y-(i/2));
        ts = ta*a+tb*b+i*c;
        if(!i) res = ts;
        else res = min(res,ts);
    }
    cout<<res<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;
int N, A, B, C;
int l[8];
int totalA[100000];
int totalB[100000];
int totalC[100000];
int point[100000];
int num = 0;
int ans = 100000;

void math(int now){
    if(now == N){
        num++;
    }else{
        int all = 1;
        for(int i= 0; i < N-1-now; i++){
            all*=4;
        }
        for(int j = num; j<num+all; j++){
            totalA[j] += l[now];
            point[j] += 10;
        }
        math(now+1);
        for(int j = num; j<num+all; j++){
            totalB[j] += l[now];
            point[j] += 10;
        }
        math(now+1);
        for(int j = num; j<num+all; j++){
            totalC[j] += l[now];
            point[j] += 10;
        }
        math(now+1);
        math(now+1);
    }
}

int difinite(int x){
    if(x<0){
        return -x;
    }else{
        return x;
    }
}

int main(void) {
    // insert code here...
    cin >> N >> A >> B >> C;
    for(int i = 0; i < N; i++){
        cin >> l[i];
    }
    
    math(0);
    
    for(int i = 0; i < num; i++){
        if(totalA[i]==0 || totalB[i]==0 || totalC[i]==0){
            point[i] = 100000;
        }else{
            point[i] = point[i] + difinite(A-totalA[i]) + difinite(B-totalB[i]) + difinite(C-totalC[i])-30;
        }
    }
    
    for(int i = 0; i < num; i++){
        if(point[i] < ans){
            ans = point[i];
        }
    }
    
    cout << ans <<  endl;
    
    return 0;
}


Measured memory_bytes: 1280
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<bitset>
using namespace std;
//#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define ARDEB(i,X) cout<< #X <<"["<<i<<"]: "<<X[i]<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define ARDEB(i,X) {}
#define END {}
#endif
//typedef long long int ll;
#define int long long
#define sint static int
typedef pair<int,int> P;
struct edge{int to,cost;};
#define REP(i,n) for(int i=0;i<(n);i++)
const int INF=100000000000000000;

int A[200010],B[200010],num[200010];
int N,M,W,C,D,E,G,K;
int ans,ans2,sum,sum2,cnt,cnt2,Max=0,Min=INF;
string S,T;
vector<int> V;
set<int> U;
map<int,int> H;
bool F,Q[200010];

signed main(){
	ans=-INF;
	int a[110][12]={},b[110][12]={},c[110]={};
	cin>>N;
	REP(i,N){
		REP(j,10){
			cin>>a[i][j];
		}
	}
	REP(i,N)REP(j,11){
		cin>>b[i][j];
	}
	REP(Bit,1<<10){
		bool f[12]={};
		F=false;
		REP(i,10){
			if(!(Bit&(1<<i))){
				f[i]=true;
			}
		}
		sum=0;
		REP(i,10){
			if(f[i]==true){
				F=true;
			}
		}
		if(!F){
			continue;
		}
		REP(i,N){
			c[i]=0;
			REP(j,10){
				if(f[j]==true){
					if(a[i][j]==1){
						c[i]++;
					}
				}
			}
		}
		REP(i,N){
			sum+=b[i][c[i]];
		}
		ans=max(ans,sum);
	}
	cout<<ans<<endl;
	return 0;
}


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

int main() {
	vector<int> vec(3);
	for (int i=0; i<3; i++)
		cin >> vec[i];

	int c5 = 0;
	int c7 = 0;
	for (int i=0; i<3; i++) {
		if (vec[i] == 5)
			c5++;
		if (vec[i] == 7)
			c7++;
	}

	if (c5 == 2 && c7 == 1)
		cout << "YES";
	else
		cout << "NO";

	
}

Measured memory_bytes: 3604