akhauriyash/Code-Regression huggingface dataset:
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
#[allow(unused_imports)]
use std::io::{Write, BufWriter};

// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

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

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

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

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

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

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

fn main() {
    input!(
        n: usize,
        a: [i64; n],
    );

    let mut ans = 1i64<<62;

    for sign in 0..2 {
        let mut tmp = 0;
        let mut sum = 0;
        for i in 0..n {
            if (sign + i) % 2 == 0 {
                if 1i64 * (sum + a[i]) > 0 {
                    sum += a[i];
                } else {
                    tmp += (sum + a[i]).abs() + 1;
                    sum = 1;
                };
            }
            else {
                if -1i64 * (sum + a[i]) > 0 {
                    sum += a[i];
                }
                else {
                    tmp += (sum + a[i]).abs() + 1;
                    sum = -1;
                }
            }
//            println!("tmp, sum = {}, {}", tmp, sum);
        }
        ans = min(ans, tmp);
    }
    println!("{}", ans);
}

Measured memory_bytes: 4352
A,B,C,X,Y = map(int, input().split())

if X <= Y:
  S = B
  Z = X
  W = Y
else:
  S = A
  Z = Y
  W = X
  
if 2*C > A+B:
  print(A*X+B*Y)

elif 2*C > S:
  print((2*C-S)*Z + S*W)
  
else:
  print(2*C*W)
  

Measured memory_bytes: 9168
#include"bits/stdc++.h"

using namespace std; 

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef vector<PII> VPII;
typedef long long LL;
typedef priority_queue<int> PQ_DESC;
typedef priority_queue<int, vector<int>, greater<int>> PQ_ASC;
typedef priority_queue<PII> PQ_DESC_PII;
typedef priority_queue<PII, vector<PII>, greater<PII>> PQ_ASC_PII;

#define ALL(c) (c).begin(),(c).end()
#define PB push_back
#define MP make_pair
#define SORT_ASC(c) sort(ALL(c))
#define SORT_DESC(c) sort(ALL(c), greater<typeof(*((c).begin()))>())
#define SIZE(a) int((a).size())

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

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int LARGE_INT = 1e9+100;
const int INF = 2e9+100;

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

VVI e;
int n,k; 
const int mod = 1e9+7;
bool fuka = false;

LL calc(int me, int pa){
	//int colors;
	//int size;
	int color_num;
	int child_num;
	if(pa == -1){
		color_num = k-1;
		child_num = SIZE(e[me]);
	}
	else{
		color_num = k-2;
		child_num = SIZE(e[me])-1;
	}
	dump(me);
	dump(pa);
	dump(child_num);
	dump(color_num);

	if(child_num > color_num){
		fuka = true;
		return 0;
	}

	//if(child_num ==0 ){
	//	return 1;
	//}
	//if(child_num ==1 ){
	//	return color_num;
	//}

	LL c = 1;
	REP(i,child_num){
		c *= (color_num-i);
		c %= mod;
	}
	

	dump(c);
	LL result = c;

	REP(i,SIZE(e[me])){
		int next = e[me][i];
		if(next == pa){
			continue;
		}
		//result += c * (calc(next,me)-1) % mod;
		result *= calc(next,me);
		result %= mod;
	}

	
	dump(result)

	return result%mod;



}

void Main()
{
	cin>>n>>k;
	e.resize(n);
	
	REP(i,n-1){
		int a,b; cin>>a>>b;
		a--; b--;
		e[a].push_back(b);
		e[b].push_back(a);
	}

	LL result = k * calc(0,-1) % mod;

	if(fuka){
		cout << 0 << endl;
		return;
	}

	cout << result%mod << endl;

	return;
}

int main()
{
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
    return 0;
}

Measured memory_bytes: 11648
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#define SF scanf
#define PF printf
#define MAXN 900010
#define MOD 1000000007
using namespace std;
typedef long long ll;
ll inv[MAXN],fac[MAXN],pow3[MAXN];
ll fsp(ll x,int y){
    ll res=1;
    while(y){
        if(y&1)
            res=res*x%MOD;
        x=x*x%MOD;
        y>>=1;  
    }
    return res;
}
ll C(int x,int y){
    return fac[x]*inv[y]%MOD*inv[x-y]%MOD;
}
int main(){
    pow3[0]=1;
    fac[0]=1;
    for(int i=1;i<=900000;i++){
        pow3[i]=pow3[i-1]*3ll%MOD;  
        fac[i]=fac[i-1]*i%MOD;
    }
    inv[900000]=fsp(fac[900000],MOD-2);   
    for(int i=900000;i>0;i--)
        inv[i-1]=inv[i]*i%MOD;
    int n,m,k;
    while(SF("%d%d%d",&n,&m,&k)!=EOF){
	    n--;
	    if(m<k)
	        swap(m,k);
	    ll j=1,ans=0;
	    for(int i=0;i<=m+k;i++){
	        ans=(ans+C(n+i,n)*pow3[m+k-i]%MOD*j)%MOD;   
	        if(i<k)
	            j=j*2ll%MOD;
	        else if(i<m)
	            j=(j*2ll-C(i,k))%MOD;
	        else    
	            j=(j*2ll-C(i,k)-C(i,m))%MOD;
	    }
	    ans=(ans+MOD)%MOD;
	    PF("%lld\n",ans);
	}
}

Measured memory_bytes: 21248
#include<bits/stdc++.h>
using namespace std;
#define rep(i,x,y) for(int i=x;i<y;i++)
#define range(a) (a).begin(),(a).end()
#define print(A,n) rep(i,0,n){cout<<(i ? " ":"")<<A[i];}cout<<endl;
#define pprint(A,m,n) rep(j,0,m){print(A[j],n);}
const long mod=1e9+7;
const int size=1e5;
const long inf=1e9;
int main(){
	int N,K;cin>>N>>K;
	long X[N+1],Y[N+1]; X[0]=0; Y[0]=0;
	map<long,map<long,int>> cnt;
	rep(i,1,N+1){
		cin>>X[i]>>Y[i]; X[i]+=inf; Y[i]+=inf;
		cnt[X[i]][Y[i]]++;
	}
	sort(X,X+N+1); sort(Y,Y+N+1);
	rep(i,1,N+1)rep(j,1,N+1){
		long x=X[i],y=Y[j];
		cnt[x][y]+=cnt[X[i-1]][y]+cnt[x][Y[j-1]]-cnt[X[i-1]][Y[j-1]];
	}
	long ans=4e18;
	rep(i,1,N+1)rep(j,1,N+1){
		rep(k,i+1,N+1)rep(l,j+1,N+1){
			int temp=cnt[X[k]][Y[l]]-cnt[X[i-1]][Y[l]]-cnt[X[k]][Y[j-1]]+cnt[X[i-1]][Y[j-1]];
			if(temp>=K) ans=min(ans,(X[k]-X[i])*(Y[l]-Y[j]));
		}
	}cout<<ans<<endl;
}

Measured memory_bytes: 384
n=int(input())
a=list()
for i in range(n):
    x,y=map(str,input().split())
    y=int(y)
    if x=="S":
        a.append(y+0)
    elif x=="H":
        a.append(y+13)
    elif x=="C":
        a.append(y+26)
    elif x=="D":
        a.append(y+39)
for i in range(1,53):
    if not (i in a):
        if i<=13:
            print("S {}".format(i-0))
        elif i<=26 :
            print("H {}".format(i-13))
        elif i<=39 :
             print("C {}".format(i-26))
        else:
             print("D {}".format(i-39))


Measured memory_bytes: 5592
#include <iostream>
#include <vector>
#include <string>
#include <functional>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <queue>
#include <stack>

using namespace std;

int main(){
  int N;
  cin >> N;
  vector<int> d(N);
  for(int i=0;i<N;i++){
    cin >> d[i];
  }
  sort(d.begin(),d.end());
  int ans=0;
  ans = d[N/2] - d[N/2-1];
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 640
n = int(input())
x = list(map(int, input().split()))
y = list(map(int, input().split()))

n_dis = [0 for _ in range(3)]
elem_dis = [abs(x[i]-y[i]) for i in range(n)]

for p in range(3):
    for i in range(n):
        n_dis[p] += elem_dis[i]**(p+1)
    n_dis[p] = n_dis[p]**(1/(p+1))
    print(n_dis[p])
    
index = [i for i, j in enumerate(elem_dis) if j == max(elem_dis) ]
print(elem_dis[index[0]])


Measured memory_bytes: 5648
#include <iostream>
#include <iomanip>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <utility>
#include <string>
#include <cmath>
#include <cstdlib>
#include <cstring>

using namespace std;

typedef uint64_t u64;
typedef int64_t s64;
typedef uint32_t u32;
typedef int32_t s32;
typedef vector<s32> vs32;
typedef vector<u32> vu32;
typedef vector<s64> vs64;
typedef vector<u64> vu64;

const double PI=3.14159265358979323846;

#define MAX(x, y) ((x) < (y) ? (y) : (x))
#define MIN(x, y) ((x) > (y) ? (y) : (x))

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

#define CEIL(x, y) (((x) + (y) - 1) / (y))
#define MOD 1000000007ULL

#define IN(l, r, x) ((l) <= (x) && (x) < (r))

bool field[1010][1010];

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

    int h, w;
    cin >> h >> w;
    queue< pair<int, int> > q;
    rep (i, h)
    {
        string s;
        cin >> s;
        rep (j, w)
        {
            if (s[j] == '#')
            {
                q.push(pair<int, int>{i, j});
                field[i][j] = true;
            }
        }
    }

    int ans = -1;
    int dy[] = {-1, 0, 1, 0};
    int dx[] = {0, -1, 0, 1};
    while (!q.empty())
    {
        ++ans;
        int s = q.size();
        rep (j, s)
        {
            pair<int, int> p = q.front(); q.pop();
            int y = p.first;
            int x = p.second;
            rep (i, 4)
            {
                int ny = y + dy[i];
                int nx = x + dx[i];
                if (IN(0, h, ny) && IN(0, w, nx) && !field[ny][nx])
                {
                    q.push(pair<int, int>{ny, nx});
                    field[ny][nx] = true;
                }
            }
        }
    }

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



Measured memory_bytes: 9488
#include<iostream>
#include<cstdio>
#include<deque>
using namespace std;
deque<int> l,r;
long long n;
int tot;
void solve(long long x)
{
	if(x==1) return;
	solve(x>>1);
	l.push_front(++tot);
	r.push_front(tot);
	if(x&1)
	{
		l.push_front(++tot);
		r.push_back(tot);
	}
}
int main()
{
	cin>>n;
	solve(n+1);
	cout<<l.size()+r.size()<<endl;
	for(int i=0;i<l.size();i++)
		cout<<l[i]<<' ';
	for(int i=0;i<r.size();i++)
		cout<<r[i]<<' ';
}

Measured memory_bytes: 256
from bisect import bisect

s=input()

r_inx=[]
l_inx=[]
for i in range(len(s)):
  if s[i]=='R':
    r_inx.append(i)
  else:
    l_inx.append(i)

ans=[0 for i in range(len(s))]

for r in r_inx:
  inx=bisect(l_inx,r)
  dist=l_inx[inx]-r
  if dist%2==0:
    ans[l_inx[inx]]+=1
  else:
    ans[l_inx[inx]-1]+=1

for l in l_inx:
  inx=bisect(r_inx,l)
  inx-=1
  dist=l-r_inx[inx]
  if dist%2==0:
    ans[r_inx[inx]]+=1
  else:
    ans[r_inx[inx]+1]+=1

print(*ans)

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

long long d[1009][1009];
string s[1009];

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	int n, m; cin >> n >> m;
	for (int i = 0; i < n; i++) 
		cin >> s[i];
	d[0][0] = 1;
	for (int i = 0; i < n; i++)
		for (int j = 0; j < m; j++) {
			if (s[i][j] == '#') continue;
			if (i > 0 && s[i - 1][j] == '.') d[i][j] = (d[i][j] + d[i - 1][j]) % 1000000007LL;
			if (j > 0 && s[i][j - 1] == '.') d[i][j] = (d[i][j] + d[i][j - 1]) % 1000000007LL;
		}
	cout << d[n - 1][m - 1] << '\n';
	return 0;
}

Measured memory_bytes: 9216
N = int(input())
SPn =[]
for i in range(N):
    SP = input().split(' ')
    S = SP[0]
    P = int(SP[1])
    SPn.append([S,P,i+1])
SPn.sort()
first_val = SPn[0][0]
current_list = [SPn[0]]
for i in range(1,N):
    if first_val == SPn[i][0]:
        current_list.append(SPn[i])
    else:
        current_list.sort(key=lambda x:(x[1]), reverse=True)
        for val in current_list:
            print(val[2])
        current_list = [SPn[i]]
        first_val = SPn[i][0]
current_list.sort(key=lambda x:(x[1]), reverse=True)
for val in current_list:
    print(val[2])

Measured memory_bytes: 3064
#include<iostream>
 #include<string>
 #include<algorithm>
 #include<map>
 using namespace std;
  
 int main()
 {
    map<string,int>mp;
    int m,n;
    string s;
    cin>>m;
    for(int i=0;i<m;i++) 
    {
    	cin>>s;
    	mp[s]++;
	}
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>s;
		mp[s]--;
	 } 
	 int maxs=-105;
	 map<string,int>::iterator iter;
	 for(iter=mp.begin();iter!=mp.end();iter++)
	 {
	 	if(maxs<iter->second) maxs=iter->second;
	 }
	 if(maxs<0) cout<<"0"<<endl;
	 else cout<<maxs<<endl;
 	return 0;
 }
 
 
 
 
 
 
 

Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        if(a < b){
            System.out.println("a < b");
        }else if(a==b){
            System.out.println("a == b");
        }else{
            System.out.println("a > b");
        }
    }
}


Measured memory_bytes: 26384
n,m = map(int, input().split())
x = list(map(int, input().split()))
x.sort()
if m == 1:
    print(0)
else:
    u = [0] * (100010)
    for i in range(m-1):
        u[i] = x[i+1]-x[i]
    u.sort(reverse=True)
    c = 0
    for i in range(n-1):
        c += u[i]
    print(sum(u)-c)

Measured memory_bytes: 20456
L = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(L[int(input()) - 1])

Measured memory_bytes: 38384
#include <stack>
#include <iostream>
#include <string>
#include <cstdlib>
#include <stdio.h>
#include <stdlib.h>
using namespace std;
string s;
stack<int> S;
int main(){
  while (cin >> s) {
    if (s == "+") {
        int b = S.top();
        S.pop();
        int a = S.top();
        S.pop();
        S.push(a + b);
    }
    else if (s == "*")
    {
      int b = S.top();
      S.pop();
      int a = S.top();
      S.pop();
      S.push(a * b);
    } else if (s == "-") {
        int b = S.top();
        S.pop();
        int a = S.top();
        S.pop();
        S.push(a - b);
    } else {
        S.push(atoi(s.c_str()));
    }
  }
  cout << S.top() << endl;
}
 
 




Measured memory_bytes: 3176
#include<iostream>
#include<vector>
#include<string>
#include<sstream>
using namespace  std;
int toInt(string s)
{
	int ret;
	stringstream ss;
	ss << s;
	ss >> ret;
	return ret;
}
int main()
{
	int w, n;
	vector<pair<int, int> > v;
	cin >> w >> n;
	for (int i = 0; i < n; i++)
	{
		string s;
		cin >> s;
		int index = s.find(',',0);
		int a = toInt(s.substr(0, index));
		int b = toInt(s.substr(index + 1));
		v.push_back(make_pair(a, b));
	}
	int numbers[40];
	for (int i = 0; i < w; i++)numbers[i] = i + 1;
	for (int i = 0; i < v.size(); i++)
	{
		int tmp = numbers[v[i].first - 1];
		numbers[v[i].first - 1] = numbers[v[i].second - 1];
		numbers[v[i].second - 1] = tmp;
	}
	for (int i = 0; i < w; i++)cout << numbers[i] << endl;
	return 0;
}

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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;

#define each(i,a) for (auto&& i : a)
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
#define pb push_back
#define all(a) (a).begin(),(a).end()
#define chmin(x,v) x = min(x, v)
#define chmax(x,v) x = max(x, v)

const ll linf = 1e18;
const int inf = 1e9;
const double eps = 1e-12;
const double pi = acos(-1);

template<typename T>
istream& operator>>(istream& is, vector<T>& vec) {
    each(x,vec) is >> x;
    return is;
}
template<typename T>
ostream& operator<<(ostream& os, const vector<T>& vec) {
    rep(i,vec.size()) {
        if (i) os << " ";
        os << vec[i];
    }
    return os;
}
template<typename T>
ostream& operator<<(ostream& os, const vector< vector<T> >& vec) {
    rep(i,vec.size()) {
        if (i) os << endl;
        os << vec[i];
    }
    return os;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll T; cin >> T;
    while (T--) {
        ll p, q; cin >> p >> q;
        auto solve = [&]() {
            ll cnt = 0;
            rep(n, -200, 200+1) rep(m, -200, 200+1) {
                ll a = abs(m*p + n*q);
                ll b = abs(m*q - n*p);
                ll r = m*m + n*n;
                if (r == 0) continue;
                if (a % r == 0 && b % r == 0) {
                    ++cnt;
                }
            }
            if (cnt == 8) return "P";
            assert(cnt > 8);
            return "C";
        };
        cout << solve() << endl;
    }
}

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

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
using ll = long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vvvi = vector<vector<vector<int>>>;
using mii = map<int, int>;
using msi = map<string, int>;
using pii = pair<int, int>;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << std::fixed << std::setprecision(10);

    int a, b;
    cin >> a >> b;
    int ans;
    if (a == b)
        ans = a * 2;
    else
        ans = max(2 * a - 1, 2 * b - 1);
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target ("avx")
#include <bits/stdc++.h>
constexpr int INF = 2147483647;
constexpr long long int INF_LL = 9223372036854775807;
constexpr int MOD = 1000000007;
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;

struct edge {
	int to;
	int cost;
};
typedef pair<int, int> P;
vector<int> d;

template<typename T > class RadixHeapInt64 {
private:
	using uint = unsigned long long;
	vector< pair<uint,T> > v[65];
	ll last, size;
	int bsr(uint x) {
		if (x == 0)return -1;
		return 64 - __builtin_clzll(x);
	}
public:
	RadixHeapInt64() {
		last = size = 0;
	}
	bool empty() {
		return size == 0;
	}
	//p = {priority,value}
	void push(uint priority, const T& value) {
		size++;
		v[bsr(priority ^ last) + 1].emplace_back(priority,value);
	}
	pair<uint,T> pop() {
		if (!v[0].size()) {
			int i = 1;
			while (!v[i].size())i++;
			last = (*min_element(v[i].begin(), v[i].end())).first;
			for (int j = 0; j < v[i].size(); j++) {
				v[bsr(v[i][j].first ^ last) + 1].push_back(v[i][j]);
			}
			v[i].clear();
		}
		size--;
		auto ret = v[0].back();
		v[0].pop_back();
		return ret;
	}
};

void dijkstra(int s, vector<vector<edge>>& g) {
	RadixHeapInt64<int> q;
	d = vector<int>(g.size(), INF);
	d[s] = 0;
	q.push(0, s);

	while (!q.empty()) {
		P p = q.pop();
		int v = p.second;
		if (d[v] < p.first)continue;
		for (int i = 0; i < g[v].size(); i++) {
			edge e = g[v][i];
			if (d[e.to] > d[v] + e.cost) {
				d[e.to] = d[v] + e.cost;
				q.push(d[e.to], e.to);
			}
		}
	}
}

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

	int V, E, s;
	cin >> V >> E >> s;
	vector<vector<edge>> g(V);
	for (int i = 0; i < E; i++) {
		int a, b, c;
		cin >> a >> b >> c;
		g[a].push_back(edge{ b,c });
	}
	for(int i = 0; i < 100; i++)dijkstra(s, g);
	for (int i = 0; i < V; i++) {
		if (d[i] == INF)cout << "INF" << endl;
		else cout << d[i] << endl;
	}
}


Measured memory_bytes: 15808
#include <iostream>
#include <string>
#include <string.h>
#include <math.h>
#include <cmath>
#include <vector>
#include <algorithm>
#define ll long long

using namespace std;

const long long mod = 1e9+7;

struct bc{
    ll b;
    ll c;
};

int main(){
    ll n, m;
    ll* a;
    bc* bcs;
    cin >> n >> m;
    a = new ll[n];
    bcs = new bc[m];
    for(ll i = 0; i < n; i++){
        cin >> a[i];
    }
    for(ll i = 0; i < m; i++){
        cin >> bcs[i].b >> bcs[i].c;
    }

    sort(a, a+n);
    sort(bcs, bcs+m, [](bc &x, bc &y){return x.c > y.c;});

    ll sum = 0;
    ll count = 0;
    for(ll i = 0; (i < m) && (count < n); i++){
        for(ll j = count; (j < count+bcs[i].b) && (j < n); j++){
            if(a[j] < bcs[i].c){
                a[j] = bcs[i].c;
            }else{
                count = j;
                break;
            }
        }
        count += bcs[i].b;
    }

    for(ll i = 0; i < n; i++){
        sum += a[i];
    }


    cout << sum << endl;
}

Measured memory_bytes: 2560
using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
class Solve{
    public Solve(){}
    StringBuilder sb;
    public static int Main(){
        new Solve().Run();
        return 0;
    }
    void Run(){
        sb = new StringBuilder();
        Calc();
        Console.Write(sb.ToString());
    }
    void Calc(){
        string S = Console.ReadLine();
        string T = Console.ReadLine();
        int[] SA = new int[S.Length];
        int[] SB = new int[S.Length];
        for(int i=0;i<S.Length;i++){
            if(S[i] == 'A'){
                SA[i] = i == 0 ? 1 : SA[i-1] + 1;
                SB[i] = i == 0 ? 0 : SB[i-1];
            }
            else{
                SA[i] = i == 0 ? 0 : SA[i-1];
                SB[i] = i == 0 ? 1 : SB[i-1] + 1;
            }
        }
        int[] TA = new int[T.Length];
        int[] TB = new int[T.Length];
        for(int i=0;i<T.Length;i++){
            if(T[i] == 'A'){
                TA[i] = i == 0 ? 1 : TA[i-1] + 1;
                TB[i] = i == 0 ? 0 : TB[i-1];
            }
            else{
                TA[i] = i == 0 ? 0 : TA[i-1];
                TB[i] = i == 0 ? 1 : TB[i-1] + 1;
            }
        }
        int Q = int.Parse(Console.ReadLine());
        for(int q=0;q<Q;q++){
            string[] str = Console.ReadLine().Split(' ');
            int a = int.Parse(str[0])-1;
            int b = int.Parse(str[1])-1;
            int c = int.Parse(str[2])-1;
            int d = int.Parse(str[3])-1;
            int s = SA[b] + SB[b]*2 - (a == 0 ? 0 : (SA[a-1] + SB[a-1]*2));
            int t = TA[d] + TB[d]*2 - (c == 0 ? 0 : (TA[c-1] + TB[c-1]*2));
            if(s % 3 == t % 3){
                sb.Append("YES\n");
            }
            else{
                sb.Append("NO\n");
            }
        }
    }
}

Measured memory_bytes: 19008
import copy

s=str(input())
t=str(input())
ls=len(s)
lt=len(t)
S=list(s)
T=list(t)
#print(S,T)


def fill(List):
    for j in range(len(List)):
        if List[j]=='?':
            List[j]='a'
    return List


def change1(index):
    global lt

    cS=copy.copy(S)
    cT=copy.copy(T)
    for k in range(index+1,index+lt):
        if cS[k]=='?':
            cS[k]=cT[k-index]
        elif cS[k]==cT[k-index]:
            pass
        else:
            return False,''
            break
    else:
        return True,''.join(fill(cS))

def change2(index):
    global lt

    cS=copy.copy(S)
    cT=copy.copy(T)
    cS[index]=cT[0]
    for k in range(index+1,index+lt):
        if cS[k]=='?':
            cS[k]=cT[k-index]
        elif cS[k]==cT[k-index]:
            pass
        else:
            return False,''
            break
    else:
        return True,''.join(fill(cS))



L=[]
for i in range(ls-lt+1):
    #print(ls-lt)
    if S[i]==T[0]:
        #print('Yes')
        if change1(i)[0]:
            L.append(change1(i)[1])
    elif S[i]=='?':
        if change2(i)[0]:
            L.append(change2(i)[1])
    


if L:
    L.sort()
    print(L[0])
else:
    print('UNRESTORABLE')

Measured memory_bytes: 3444
import java.util.*;
public class Main {
    public static void main(String[] args){
      // 入力
      Scanner sc = new Scanner(System.in);
      String S = sc.next();
      
      // 判定
      char c3 = S.charAt(2);
      char c4 = S.charAt(3);
      char c5 = S.charAt(4);
      char c6 = S.charAt(5);
      
      String result = "No";
      if(c3 == c4 && c5 == c6){
        result = "Yes";
      }
      
      // 出力
      System.out.println(result);
    }
    
}

Measured memory_bytes: 21844
# -*- coding: utf-8 -*-
"""
AtCoder A
"""

import sys, math, random
import numpy as np

# N = int(input())
# A = list(map(int,input().split())) # N row 1 column
# A = [int(input()) for _ in range(N)] # 1 row N column
# S = str(input()) # str(input()) == input() -> 'abc'
# S = list(input()) # abc -> ['a','b','c']
# S.replace('ABC','X') # "testABCABC" -> "testXX"

inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()


def main():
    N=I()
    P = list(map(int,input().split()))
    Pl=P.copy()
    P.sort()
    miss=0
    for i in range(N):
        # print(P[i],Pl[i])
        if P[i]!=Pl[i]:
            miss+=1
    # print(miss)
    if miss==2 or miss==0:
        print("YES")
    else:
        print("NO")


if __name__ == "__main__":
    main()

Measured memory_bytes: 24560
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int i,a,n,x,c=0;
  cin>>a>>n;
  for(i=0;i<n;i++)
  {
    cin>>x;
    c+=x;
  }
  if(c>=a)
    cout<<"Yes"<<endl;
  else
    cout<<"No"<<endl;
  return 0;
}
     

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <numeric>
#include <functional>
#include <set>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cctype>
#include <climits>
#include <fstream>
#include <bitset>
#include <time.h>
#include <assert.h>
#include <random>

#define LL long long
#define VI vector<int>
#define VL vector<long long>
#define FOR(i,a,b) for(int i= (a); i<((int)b); ++i)
#define RFOR(i,a) for(int i=(a); i >= 0; --i)
#define FOE(i,a) for(auto i : a)
#define ALL(c) (c).begin(), (c).end()
#define RALL(c) (c).rbegin(), (c).rend()
#define DUMP(x)  cerr << #x << " = " << (x) << endl;
#define SUM(x) std::accumulate(ALL(x), 0LL)
#define MIN(v) *std::min_element(v.begin(), v.end())
#define MAX(v) *std::max_element(v.begin(), v.end())
#define EXIST(v,x) (std::find(v.begin(), v.end(), x) != v.end())
#define BIT(n) (1LL<<(n))
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
#define EPS 1e-14


using namespace std;


pair<int, long long> getFarthestNode(int from, vector<bool> &visited, const vector<vector<pair<int, int>>> &tree) {
    visited[from] = true;

    int farthestNode = from;
    long long farthestDistance = 0;

    for(pair<int, int> p : tree[from]) {
        int to = p.first;
        int w = p.second;
        if (visited[to]) { continue; }

        pair<int, long long> n_l = getFarthestNode(to, visited, tree);

        // node -> to -> n_l.firstの距離
        long long distance = w + n_l.second;

        if (distance > farthestDistance) {
            farthestNode = n_l.first;
            farthestDistance = distance;
        }
    }

    return { farthestNode, farthestDistance };
}


long long tree_diameter(unsigned int num_of_node, const vector<vector<pair<int, int>>> &tree) {
    vector<bool> visited(num_of_node, false);
    pair<int, long long> p1 = getFarthestNode(0, visited, tree);

    visited = vector<bool>(num_of_node, false);
    pair<int, long long> p2 = getFarthestNode(p1.first, visited, tree);

    return p2.second;
}

int main(int argc, char *argv[]) {
    cin.tie(0);
    ios::sync_with_stdio(false);


    int n;
    cin >> n;

    vector<vector<pair<int, int>>> tree(n);

    FOR(i, 0, n - 1) {
        int s, t, w;
        cin >> s >> t >> w;
        tree[s].emplace_back(make_pair(t, w));
        tree[t].emplace_back(make_pair(s, w));
    }

    cout << tree_diameter(n, tree) << endl;

    return 0;
}


Measured memory_bytes: 15852
#include <stdio.h>
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>

#define uint unsigned int
#define ll long long
#define ull unsigned long long
#define ld long double
#define rep(i, l, r) for (int i = l; i < r; i++)
#define repb(i, r, l) for (int i = r; i > l; i--)
#define sz(a) (int)a.size()
#define fi first
#define se second

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 N = 100000;
const int inf = (int)1e9 + 1;
const ll big = (ll)1e18 + 1;
const int P = 31;
const int MOD = (int)1e9 + 7;
const int MOD1 = (int)1e9 + 9;
const int MAX_INT = (1 << 31) - 1;
const double eps = 1e-6;
const double pi = atan2(0, -1);

/*void print(vector<auto> &a)
{
    for (auto i : a)
        cout << i << " ";
    cout << endl;
}*/

int main()
{
    //freopen("lamps.in", "r", stdin);
    //freopen("lamps.out", "w", stdout);
    //ios_base::sync_with_stdio(0);
    //cin.tie(0);
    //cout.precision(20);
    //int TL = 0.95 * CLOCKS_PER_SEC;
    //clock_t time = clock();
    ll n;
    cin >> n;
    ll ans = n / 11 * 2;
    n %= 11;
    if (n)
    {
        if (n <= 6)
            ans++;
        else
            ans += 2;
    }
    cout << ans << endl;
    return 0;
}


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 MOD7 1000000007
#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
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

int main(){
    int N, M;
    cin >> N >> M;
    vector<int> A(M);
    for(int i = 0; i < M; i++) cin >> A[i];
    vector<ll> move(N + 1, -1);//0段目からN段め
    move[0] = 1;
    move[1] = 1;
    for(int a : A) move[a]=0;
    for(int i = 2; i < N + 1; i++){
        if(move[i] == -1){
             move[i] = move[i - 1] + move[i - 2];
             move[i] %= MOD7;
        }
    }
    if(move.back() == -1) puts("0");
    else cout << move.back() << endl;

}

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

#ifdef _DEBUG
#define debug(x) cerr << "line: " << __LINE__ << ", func: " << __func__ << " ->  " << #x << " = " << x << endl
#else
#define debug(x)
#endif

#define all(s) begin(s), end(s)
#define rall(s) rbegin(s), rend(s)
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define rrep(i, a, b) for (int i = ((a)-1); i >= (b); i--)
#define pb push_back
#define sz(a) int((a).size())
#define put(a) ((cout) << (a) << (endl))
#define putf(a, n) ((cout) << (fixed) << (setprecision(n)) << (a) << (endl))
#define deg2rad(x) (((x)*PI) / (180.0))
#define rad2deg(x) (((x) * (180.0)) / PI)

using namespace std;

using ll = long long;
using ull = unsigned long long;
using i_i = pair<int, int>;
using ll_ll = pair<ll, ll>;
using d_ll = pair<double, ll>;
using ll_d = pair<ll, double>;
using d_d = pair<double, double>;

static constexpr ll LL_INF = 1LL << 60;
static constexpr int I_INF = 1 << 28;
static constexpr double PI = static_cast<double>(3.14159265358979323846264338327950288);
static constexpr double EPS = numeric_limits<double>::epsilon();
static constexpr const char* YES = "Yes";
static constexpr const char* NO = "No";

static map<type_index, const char* const> scanType = {
    {typeid(int), "%d"}, {typeid(ll), "%lld"}, {typeid(double), "%lf"}, {typeid(char), "%c"}};

template <class T> static void scan(vector<T>& v);
[[maybe_unused]] static void scan(vector<string>& v, bool isWord = true);
template <class T> static inline bool chmax(T& a, T b);
template <class T> static inline bool chmin(T& a, T b);
template <class T> static inline T gcd(T a, T b);
template <class T> static inline T lcm(T a, T b);
template <class A, size_t N, class T> static void Fill(A (&arr)[N], const T& val);
template <class T> T mod(T a, T m);

int main(int argc, char* argv[]) {
  long long N;
  scanf("%lld", &N);
  std::string S;
  std::cin >> S;

  if (N % 2 == 1) {
    put(NO);
    return 0;
  }

  rep(i, 0, N / 2) {
    if (S[i] == S[i + (N / 2)]) continue;
    put(NO);
    return 0;
  }

  put(YES);
  return 0;
}

template <class T> static void scan(vector<T>& v) {
  auto tFormat = scanType[typeid(T)];
  for (T& n : v) {
    scanf(tFormat, &n);
  }
}

static void scan(vector<string>& v, bool isWord) {
  if (isWord) {
    for (auto& n : v) {
      cin >> n;
    }
    return;
  }

  int i = 0, size = v.size();
  string s;
  getline(cin, s);

  if (s.size() != 0) {
    i++;
    v[0] = s;
  }

  for (; i < size; ++i) {
    getline(cin, v[i]);
  }
}

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;
}

template <class T> inline T gcd(T a, T b) { return __gcd(a, b); }

template <class T> inline T lcm(T a, T b) { return (a * b) / gcd(a, b); }

template <class A, size_t N, class T> void Fill(A (&arr)[N], const T& val) {
  std::fill((T*)arr, (T*)(arr + N), val);
}

template <class T> T mod(T a, T m) { return (a % m + m) % m; }


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) \
  for (ll i = static_cast<int>(a); i < static_cast<int>(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, ) (__VA_ARGS__)  // NOLINT
#define chmax(x, a)  do { x = max(x, a); } while(0)
#define chmin(x, a)  do { x = min(x, a); } while(0)

using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef pair<ll,ll> PLL;

void solve() {
  ll n, ans = 0;
  cin >> n;
  for (ll a = 1; a <= n; a++) {
    ll nb;
    if (n % a == 0) {
      nb = (n / a) - 1;
    } else {
      nb = n / a;
    }
    ans += nb;
  }
  cout << ans << endl;
}

int main() {
  //ll T;
  //cin >> T;
  //rep(_,T)
    solve();
  return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
typedef pair<int,int> P;
typedef long long ll;
const int INF = 1001001001;
const ll INFL = 1e17;
const int MOD = 1e9+7;


int main(){
    int n,m;
    cin >> n >> m;
    vector<int> G[n];
    for(int i=0; i<m; i++){
        int a,b;
        cin >> a >> b;
        --a; --b;
        G[a].push_back(b);
        G[b].push_back(a);
    }

    vector<int> E(n,-1);
    for(int i=0; i<n; i++){
        queue<int> que;
        if(E[i] != -1) continue;
        E[i] = i;
        que.push(i); 
        while(!que.empty()){
            int now = que.front(); que.pop();
            for(int j=0; j<(int)G[now].size(); j++){
                if(E[G[now][j]] != -1) continue;
                E[G[now][j]] = E[i];
                que.push(G[now][j]);
            }
        }
    }
    int dep = 0;
    for(int i=0; i<n; i++){
        if(E[i]==i) dep++; 
    }
    cout << dep-1 << endl;
    return 0;
}

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

#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i, c) for (typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define EXIST(s, e) ((s).find(e) != (s).end())
#define SORTASC(c) sort((c).begin(), (c).end())
#define SORTDESC(c, t) sort((c).begin(), (c).end(), std::greater<t>());
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define dump(x) cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" \
                      << " " << __FILE__ << endl;

const double PI = acos(-1.0);

using ll = long long;
using namespace std;

int main()
{
    FOR(i, 1, 10){
        FOR(j, 1, 10){
            cout << i << "x" << j << "=" << i*j << endl;
        }
    }

    return 0;
}


Measured memory_bytes: 3024
#include<bits/stdc++.h>
#define int long long int
#define MP make_pair
#define PB push_back
#define F first
#define S second
using namespace std;
typedef vector<int, int> VI;
typedef pair<int, int> PII;
typedef vector<PII> VP;
typedef pair<double, int> PDI;
typedef vector<PDI> VD;

string s;
signed main()
{
  cin >> s;
  
  if(s[0] == s[s.size() - 1]){
    if(s.size() & 1){
      cout << "Second" << endl;
    }
    else{
      cout << "First" << endl;
    }
  }
  else{
    if(s.size() & 1){
      cout << "First" << endl;
    }
    else{
      cout << "Second" << endl;
    }
  }
  return 0;
}


Measured memory_bytes: 512
import java.util.Scanner

object Main {
  def main(args: Array[String]) {
    val result = solve(new Scanner(System.in))
    if (result.length > 0) println(result)
  }

  def solve(in: String): String = solve(new Scanner(in))

  def solve(sc: Scanner): String = {
    val N = sc.nextInt
    val T = sc.nextInt
    val ct = Array.fill(N)(sc.nextInt, sc.nextInt)

    val routes = ct.filter(_._2 <= T)
    if (routes.length == 0) "TLE" else
      routes.minBy(_._1)._1.toString
  }
}


Measured memory_bytes: 25808
#include <bits/stdc++.h>
using namespace std;int main(){cin.tie(0);ios::sync_with_stdio(false);long long i,a,N,s,A=INT_MAX,l=0,r=0,S[100002]={0};cin>>N>>s;for(i=1;i<=N;i++){cin>>a;S[i]+=S[i- 1]+a;}for(;;){if(S[r]-S[l]>=s){A=min(A,r-l);l++;}else(r++);if(r>N){if(A==INT_MAX)A=0;cout<<A<<endl;return 0;}}}

Measured memory_bytes: 3948
H,W = map(int,input().split())
lis = ['.' +input()+'.' for _ in range(H)]
lis.insert(0,'.'*(W+2))
lis.append('.'*(W+2))
for i in range(1,H+1):
    for j in range(1,W+1):
        if lis[i][j] == '#':
            if lis[i+1][j]=='#' or lis[i-1][j]=='#' or lis[i][j+1]=='#' or lis[i][j-1] == '#':
                continue
            else:
                print('No')
                exit()
print('Yes')

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()

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

    // start
    char x, y;
    cin >> x >> y;
    if (x == y)
        cout << "=" << endl;
    if (x < y)
        cout << "<" << endl;
    if (x > y)
        cout << ">" << endl;
    // end

    return 0;
}


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

int main() {
	int N; cin >> N;
	int a[100010];
	for(int i=1; i<=N; ++i) cin >> a[i];
	int S=0;
	for(int i=1; i<=N; ++i) if(a[a[i]]==i) ++S;
	cout << S/2 << endl;
	return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
int gcd (int a, int b) {
    while (a!=0 && b!=0) {
        if (a>b) {
            a=a%b;
        }
        else b=b%a;
    }
    return a+b;
}
int a[3009];
int main()
{
    int q,i,n,j,maxx = 0 , summ = 0;
    cin >> n;
    for(i=0;i<n;i++)
    cin>>a[i];
   sort(a , a + n);
   for(i=0;i<n;i++)
   {
       summ += a[i];
   }
   summ-=n;
   cout << summ;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define pll pair<ll,ll>
using namespace std;
const int maxn = 100100;
ll dp[maxn], h[maxn], n;

int main() {
	cin>>n;
	cin>>h[1];
	for(int i=2;i<=n;i++) {
		cin>>h[i];
		if(i == 2) dp[i] = abs(h[2]-h[1]);
		else dp[i] = min((dp[i-1] + abs(h[i] - h[i-1])), (dp[i-2] + abs(h[i] - h[i-2])));
	}
	cout<<dp[n]<<"\n";
}

Measured memory_bytes: 1792
/*
                   _ooOoo_
                  o8888888o
                  88" . "88
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . __
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
         fozubaoyou    pass System Test!
*/

#include <algorithm>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;
typedef pair<int, int> P;
const long long LINF = 1000000000000000018ll;
const int INF = 1000000009;
const int mod = 1000000007;
const int mod2 = 998244353;

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

int main() {
  std::cin.tie(0);
  ios::sync_with_stdio(false);
  std::cout << std::setprecision(20) << std::fixed;

  string s; cin >> s;
  if (s[0] == '7' || s[1] == '7' || s[2] == '7') {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }

  return 0;
}

Measured memory_bytes: 3604
N = int(input())
l = [[0] * 9 for i in range(9)]
for i in range(1, N+1):
    if int(str(i)[-1]) != 0:
        l[int(str(i)[0])-1][int(str(i)[-1])-1] += 1

ans = 0
for i in range(9):
    for j in range(9):
        ans += l[i][j]*l[j][i]
print(ans)


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

int main (){
    int N = 0;
    cin >> N;
    vector<string> A(N);
    for (size_t i = 0; i < N; i++)
    {
        cin >> A.at(i);
    }
    
    vector<int> B(4);
    for (size_t i = 0; i < N; i++)
    {
        if (A.at(i) == "AC")
        {
            B.at(0)++;
            /* code */
        }else  if (A.at(i) == "WA")
        {
            B.at(1)++;
            /* code */
        }else if (A.at(i) == "TLE")
        {
            B.at(2)++;
            /* code */
        }else if (A.at(i)==  "RE")
        {
            B.at(3)++;
            /* code */
        }
        
    }
    cout << "AC x " << B.at(0) << endl;
    cout << "WA x " << B.at(1) << endl;
    cout << "TLE x " << B.at(2) << endl;
    cout << "RE x " << B.at(3) << endl;
    

    
}

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

int main() {
  int N, M;
  cin >> N >> M;
  vector <vector<int>> research(N,vector<int>(M));
  
  for (int i = 0; i < N; i++){
    int k;
    cin >> k;
    for (int j = 0; j < k; j++) cin >> research.at(i).at(j);
  }
  int count = 0;
  for (int i = 0; i < M; i++){
    bool ans1 = true;
    for (int j = 0; j < N; j++){
      bool ans2 = false;
     for (int l = 0; l < M; l++){
       if (research.at(j).at(l) == i+1)  ans2 = true;
     }
      if (!ans2) ans1 = false; 
    }
    if(ans1) count++;
  }
  cout << count << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))
#define INF ((1LL<<62)-(1LL<<31))
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
#define bit(n,m)(((n)>>(m))&1)
int upll(const void*a, const void*b){return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;}
int downll(const void*a, const void*b){return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;}
void sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}
void sortdown(ll*a,int n){qsort(a,n,sizeof(ll),downll);}
ll pom(ll a,ll n,int m){ll x=1;for(a%=m;n;n/=2)n&1?x=x*a%m:0,a=a*a%m;return x;}
//#define MOD 998244353
#define MOD 1000000007
#define invp(a,p)pom(a,p-2,p)

//行列累乗
void matpom(ll*mat,int size,ll n,int m){
	ll*temp=(ll*)malloc(size*size*sizeof(ll));
	ll*ans=(ll*)malloc(size*size*sizeof(ll));

	rep(i,0,size)rep(j,0,size)ans[i*size+j]=i==j;
	while(n){
		if(n%2){
			rep(i,0,size*size)temp[i]=0;
			rep(i,0,size)rep(j,0,size)rep(k,0,size)temp[i*size+j]=(temp[i*size+j]+ans[i*size+k]*mat[k*size+j])%m;
			rep(i,0,size*size)ans[i]=temp[i];
		}
		rep(i,0,size*size)temp[i]=0;
		rep(i,0,size)rep(j,0,size)rep(k,0,size)temp[i*size+j]=(temp[i*size+j]+mat[i*size+k]*mat[k*size+j])%m;
		rep(i,0,size*size)mat[i]=temp[i];
		n/=2;
	}
	rep(i,0,size*size)mat[i]=ans[i];

	free(temp);
	free(ans);
}

ll a[50][50];
int main(){
	ll size,n;
	scanf("%lld%lld",&size,&n);
	rep(i,0,size)rep(j,0,size)scanf("%lld",&a[i][j]);
	matpom((ll*)a,50,n,MOD);
	ll ans=0;
	rep(i,0,size)rep(j,0,size)ans=(ans+a[i][j])%MOD;
	printf("%lld\n",ans);
	return 0;
}

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

#define F first
#define S second
#define MP make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
#define lcm(a, b) (a)/__gcd((a),(b))*(b)
#define CEIL(a, b) (a)/(b)+(((a)%(b))?1:0)
#define endl '\n'

using namespace std;

typedef long long LL;
typedef pair<int, int> P;
typedef pair<LL, LL> LP;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1000000007;
static const int SIZE = 200005;

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

vector<int> Div(int n) {
    vector<int> ret;
    for(int i = 1; i * i <= n; ++i) {
        if(n % i == 0) {
            ret.pb(i);

            if(i * i != n) ret.pb(n / i);
        }
    }
    sort(all(ret));
    return ret;
}

set<LL> st;
void dfs(int dig, LL num, int ap) {
    st.insert(num);
    if(dig == 0) {
        return;

    }

    dfs(dig - 1, num * 10 + ap, ap);
    if(ap > 0) {
        dfs(dig - 1, num * 10 + (ap - 1), ap - 1);

    }
    if(ap < 9) {
        dfs(dig - 1, num * 10 + (ap + 1), ap + 1);

    }

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

    int k;
    cin >> k;

    for(LL i = 0; i <= 9; ++i) {
        dfs(10, i, i);

    }

    auto it = st.begin();
    while(k--) {
        ++it;

    }
    cout << *it << endl;
    return 0;
}



Measured memory_bytes: 27520
#include <stdio.h>
#include <math.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <numeric>
#include <string>
#include <map>
#include <stack>
//#include <bits/stdc++.h>
using namespace std;
typedef long long int lli;
#define urept(soeji, start, n) for (int soeji = start; soeji < n; soeji++)
#define drept(soeji, start, n) for (int soeji = start; soeji > n; soeji--)
int main(void)
{
    lli N;
    cin >> N;
    vector<int> x;
    while (N > 0)
    {
        lli am = (N - 1) % 26;
        N--;
        x.push_back(am);
        N -= (am);
        N /= 26;
    }
    vector<char> moji;
    for (char c = 'a'; c <= 'z'; c++)
    {
        moji.push_back(c);
    }
    for (int i = x.size() - 1; i >= 0; i--)
    {
        cout << moji[x[i]];
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
#include <iostream>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <algorithm>
int main() {
  int N,A,B,i,a,b,c,d;
  a=0;
  b=0;
  c=0;
  cin>>N>>A>>B;
  int P[N]={0};
  A++;
  B++;
  for(i=0;i<N;i++){
  cin>>P[i];
    if(P[i]<A){
    a++;
    }else if(P[i]<B){
    b++;
    }else{
    c++;
    }
    
  }
  d=min(a,b);
  d=min(d,c);

  cout<<d<<endl;
}

Measured memory_bytes: 256
n, k = [int(i) for i in input().split(" ")]
x = [int(i) for i in input().split(" ")]

l = 0
r = 0

for li in reversed(range(0, n)):
    if x[li] < 0:
        l += 1
        if l == k:
            break

for ri in range(0, n):
    if x[ri] > 0:
        r += 1
        if r == k:
            break
    
c = 10**9

def t(a, b):
    if a * b < 0:
        return min(abs(a) * 2 + abs(b), abs(a) + abs(b) * 2)
    else:
        return max(abs(a), abs(b))

for i in range(li, ri + 2 - k):
    ci = t(x[i], x[i + k - 1])
    
    if ci < c:
        c = ci
            
print(c)

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

using namespace std;

int main(void)
{
    int A, B, C, K;
    cin >> A >> B >> C >> K;

    int sum = 0;

    while(A > 0 && K > 0) {
        A--;
        sum++;
        K--;
    }
    while(B > 0 && K > 0) {
        B--;
        K--; 
    }
    while(C > 0 && K > 0) {
        C--;
        sum--;
        K--; 
    }
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 3628