akhauriyash/Code-Regression huggingface dataset:
S = int(input())
result = {
    "AC"  : 0,
    "WA"  : 0,
    "TLE" : 0,
    "RE"  : 0
}
for _ in range(S):
    i = input()
    result[i] += 1
    
for key, value in result.items():
    print(f'{key} x {value}')

Measured memory_bytes: 9192
from collections import deque

n = int(input())
dq = deque([])
for _ in range(n):
    L = input().split()
    if L[0] == 'insert':
        dq.appendleft(L[1])
    elif L[0] == 'delete':
        if L[1] in dq: dq.remove(L[1])
    elif L[0] == 'deleteFirst':
        dq.popleft()
    else:
        dq.pop()

print(' '.join(dq))


Measured memory_bytes: 69732
#include<cstdio>
#include<bitset>
using namespace std;
const int N=410,M=1e5+10;
int n,m,ans;
int x[M],y[M],die[N];
bitset<N> s[N];
int main(){
    scanf("%d%d",&n,&m);
    for(int i=1;i<=m;i++)scanf("%d%d",&x[i],&y[i]);
    for(int i=1;i<=n;i++){
        s[i][i]=1;
        for(int j=m;j;j--)
            if(s[i][x[j]]&&s[i][y[j]]){die[i]=1;break;}
            else if(s[i][x[j]])s[i][y[j]]=1;
            else if(s[i][y[j]])s[i][x[j]]=1;
    }
    for(int i=1;i<=n;i++)
        if(!die[i])
            for(int j=i+1;j<=n;j++)
                if(!die[j]&&(s[i]&s[j]).none())++ans;
    printf("%d\n",ans);
}


Measured memory_bytes: 1024
void main() {
    int n = readln.chomp.to!int;
    long[] lucas = new long[n+1];
    lucas[0] = 2, lucas[1] = 1;
    foreach (i; 2 .. n+1) {
        lucas[i] = lucas[i-1] + lucas[i-2];
    }
    lucas[n].writeln;
}

import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.range;
import std.math;
import std.numeric;
import std.container;
import std.typecons;
import std.ascii;
import std.uni;

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

int main(){
int n;
cin >> n;
if(n%1000==0){
cout << 0 << endl;
return 0;
}else{
cout << 1000 - n%1000 << endl;
return 0;
}
 }    

Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
using P = pair<int,int>;
/* ちゃんと考えてわかって実装 */

int main(void){
    ll h, n;
    cin >> h >> n;
    int hiss = 0;
    for(int i=0; i<n; i++){
        int a; cin >> a;
        hiss += a;
    }

    if(hiss >= h) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

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

#define rep(i,s,n) for (int i = (int)s; i < (int)n; i++)
#define ll long long
#define pb push_back
#define All(x) x.begin(), x.end()
#define Range(x, i, j) x.begin() + i, x.begin() + j
#define lbidx(x, y) lower_bound(x.begin(), x.end(), y) - x.begin()
#define ubidx(x, y) upper_bound(x.begin(), x.end(), y) - x.begin()
#define BiSearchRangeNum(x, y, z) lower_bound(x.begin(), x.end(), z) - lower_bound(x.begin(), x.end(), y)
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
};

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

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


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int uli;
const int mx=1e5+10;
vector<pair<int,int> >g[mx];
int sz[mx];
uli s[mx];
int p[mx];
uli ans[mx];
void dfs(int u,int pu=0){
  p[u]=pu;
  sz[u]=1;
  for(auto e:g[u]){
    int v=e.first;
    if(v!=pu){
      dfs(v,u);
      sz[u]+=sz[v];
    }
  }
}
uli s0=0;
int bad=-1;
void go(int u,int pu){
  for(auto e:g[u]){
    int v=e.first;
    if(v==pu)continue;
    int idx=e.second;
    if(idx!=bad){
      s0+=ans[idx]*uli(sz[v]);
    }
    if(v!=pu)go(v,u);    
  }
}
int main(){
  int n;
  scanf("%d",&n);
  vector<pair<int,int> > edges;
  for(int i=0;i<n-1;i++){
    int u,v;
    scanf("%d %d",&u,&v);
    g[--u].push_back({--v,i});
    g[v].push_back({u,i});
    edges.push_back({u,v});
  }
  dfs(0,0);
  for(int i=0;i<n;i++){
    scanf("%lld",s+i);    
  }
  int i=0;
  for(;i<int(edges.size());i++){
    auto e=edges[i];
    int u=e.first,v=e.second;
    if(v==p[u])swap(u,v);
    uli sv=sz[v],su=n-sz[v];
    if(su==sv){
      bad=i;      
      continue;
    }
    uli w=(s[v]-s[u])/(su-sv);
    ans[i]=w;
  }
  if(bad!=-1){
    go(0,0);
    int u=edges[bad].first;
    int v=edges[bad].second;
    if(v==p[u])swap(u,v);
    ans[bad]=(s[0]-s0)/sz[v];
  }
  for(int i=0;i<n-1;i++){
    printf("%lld\n",ans[i]);
  }
  return 0;
}


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

using namespace std;
#define N 100100
#define SIGMA 26
#define MOD 1000000007LL

long long n, k, ans, i;
long long compute (long long X){
    long long A = X * n - (X - 1) * X + 1;
    return A % MOD;
}
int main()
{
    cin >> n >> k;
    ans = 0;
    for (i = k; i <= n + 1; ++i){
        ans += compute(i);
        if (ans >= MOD)
            ans -= MOD;
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 3636
import std.stdio, std.conv, std.functional, std.string;
import std.algorithm, std.array, std.container, std.range, std.typecons;
import std.numeric, std.math, std.random;
import core.bitop;

string FMT_F = "%.10f";

static string[] s_rd;
T RD(T = long)() { while(!s_rd.length) s_rd = readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
string RDR()() { return readln.chomp; }
T[] ARR(T = long)(in string str, T fix = 0) { auto r = str.split.to!(T[]); r[] += fix; return r; }
size_t[] MAKE_IDX(alias less = "a < b", Range)(Range range) { auto idx = new size_t[](range.length); makeIndex!(less)(range, idx); return idx;}
size_t MIN_POS(alias less = "a < b", Range)(Range range) { auto r = minPos!(less)(range); return range.length - r.length; }

bool inside(T)(T x, T b, T e) { return x >= b && x < e; }
long lcm(long x, long y) { return x * y / gcd(x, y); }

long mod = 10^^9 + 7;
//long mod = 998244353;
//long mod = 1_000_003;
void moda(ref long x, long y) { x = (x + y) % mod; }
void mods(ref long x, long y) { x = ((x + mod) - (y % mod)) % mod; }
void modm(ref long x, long y) { x = (x * y) % mod; }

void main()
{
	auto N = RD;
	auto M = RD;
	auto edges = new long[][](N);
	//auto edges2 = new long[][](N);
	foreach (i; 0..M)
	{
		auto u = RD-1;
		auto v = RD-1;
		edges[u]  ~= v;
		//edges2[v] ~= u;
	}
	auto S = RD-1;
	auto T = RD-1;

	/*auto d = new bool[3][](N);
	{
	d[S][0] = true;
	long[2][] open = [[S, 0]];
	while (!open.empty)
	{
	auto n    = open.back; open.popBack;
	auto from = n[0];
	auto c    = n[1];
	foreach (to; edges[from])
	{
	auto nc = (c+1) % 3;
	if (d[to][nc]) continue;
	d[to][nc] = true;
	open ~= [to, nc];
	}
	}
	}*/

	long ans;
	auto cost = new long[][](N, 3);
	foreach (ref e; cost)
		e.fill(long.max);
	cost[S][0] = 0;
	long[2][] open = [[S, 0]];
	while (!open.empty)
	{
		auto n    = open.front; open.popFront;
		auto from = n[0];
		auto c    = n[1];
		foreach (to; edges[from])
		{
			auto nc  = c + 1;
			auto cnt = nc % 3;
			//if (d[to][pc] == false) continue;
			if (nc < cost[to][cnt])
			{
				cost[to][cnt] = nc;
				open         ~= [to, nc];
			}
		}
	}
	debug writeln(cost);

	if (cost[T][0] == long.max)
	{
		writeln(-1);
	}
	else
	{
		writeln(cost[T][0] / 3);
	}

	stdout.flush();
	debug readln();
}


Measured memory_bytes: 18812
#include <iostream>
#include <iomanip>
#include <vector>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <cstring>
#define rep(i, N) for (int i = 0; i < (int)N; i++)
using namespace std;
typedef long long ll;
const ll LLINF = 9223372036854775807;
const int MOD = 1000000007;

int main() {
  int H, W; cin >> H >> W;
  int a[H][W]; rep(i, H) rep(j, W) cin >> a[i][j];

  int i = 0, j = 0;
  bool flg = false;
  vector<vector<int>> result;
  while(i < H){
    int ni = i, nj = j;
    if (i%2==0) { if (j==W-1) ni++; else nj++; }
    else { if (j==0) ni++; else nj--; }
    if (ni==H) break;

    if (a[i][j]%2==1) flg = !flg;
    if (flg) result.push_back({i, j, ni, nj});
    i = ni; j = nj;
    // cout << i << " " << j << endl;
  }

  cout << result.size() << endl;
  for (auto x: result) cout << x[0]+1 << " " << x[1]+1 << " " << x[2]+1 << " " << x[3]+1 << endl;
  return 0;
}

Measured memory_bytes: 9904
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector> 
#include<limits>
#include<numeric>
#include<type_traits>
#include<math.h>
using namespace std;
typedef long long ll;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i = (int)(a); i < (int)(b); i++)
#define in(x) cin >> x
#define out(str) cout << str << endl

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

int N,a,aa,pos,maxi,ans;

int main(){
    cin>>N;
    pair<int,int> r[N],b[N];
    bool done[N];
    rep(i,N){
        cin>>a>>aa;
        r[i]=make_pair(a,aa);
    }
    rep(i,N){
        cin>>a>>aa;
        b[i]=make_pair(a,aa);
        done[i]=false;
    }
    sort(r,r+N);
    sort(b,b+N);
    rep(i,N){
        pos=-1;
        maxi=-1;
        rep(j,N){
            if(!done[j]){
                if(b[i].first>r[j].first&&b[i].second>r[j].second){
                    if(r[j].second>maxi){
                        maxi=r[j].second;
                        pos=j;
                    }
                }
            }
        }
        if(pos!=-1){
            done[pos]=true;
            ans++;
        }

    }
    out(ans);
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<string>
#include<map>
#define ll          long long
#define pb          push_back
#define mp          make_pair
#define pii         pair<int,int>
#define pll         pair<ll,ll>
#define vii         vector<pair<ll,ll> >
#define vi          vector<int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (int)x.size()
#define hell        1000000007
#define endl        '\n'
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define rep1(i,a,b) for(ll i=a;i<= b;i++)
#define PI          3.14159
#define MAX         100000001
#define fast_io      ios_base::sync_with_stdio(false);  cin.tie(0); cout.tie(0);
#define scan(var)    scanf("%lld",&var)
#define print(var)   printf("%lld\n", var);
#define BLOCK 317
#define double       long double
#define mod          998244353
using namespace std;
ll dp[101][100001];
ll n,k;
pair<ll,ll>arr[101];
ll solvedp(ll index,ll weight)
{
  if(index == -1 && weight != 0)
  {
    return INT_MAX;
  }
  if(weight == 0)
  {
    return 0;
  }
  if(dp[index][weight] != -1)
  {
    return dp[index][weight];
  }
  dp[index][weight] = INT_MAX;
  if(weight >= arr[index].S)
  {
    dp[index][weight] = min(arr[index].F + solvedp(index - 1,weight - arr[index].S),solvedp(index - 1,weight));
  }
  else
  {
    dp[index][weight] = solvedp(index - 1,weight);
  }
  return dp[index][weight];
}
bool comp(pll p1,pll p2)
{
  return p1.first < p2.first;
}
int main()
{
  fast_io
  cin >> n;
  ll w;
  cin >> w;
  memset(dp,-1,sizeof(dp));
  ll sumvalue = 0;
  rep(i,0,n)
  {
    cin >> arr[i].F >> arr[i].S;
    sumvalue += arr[i].S;
  }
  //cout << sumvalue << endl;
  //sort(arr,arr + n,comp);
  ll ans = INT_MIN;
  ll maxweight = 0;
  rep(i,0,sumvalue + 1)
  {
    ll tmp = solvedp(n - 1,i);
    if(tmp <= w)
    {
      ans = max(ans,i);
    }
  }
  cout << ans << endl;
  return 0;
}



Measured memory_bytes: 79232
import math
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline

a, b, h, m = map(int, readline().split())

rad_h = 90 - (h + (m/60))*30
rad_m = 90 - m*6

ax = a * math.cos(math.radians(rad_h))
ay = a * math.sin(math.radians(rad_h))

bx = b * math.cos(math.radians(rad_m))
by = b * math.sin(math.radians(rad_m))

ans = ((bx - ax)**2 + (by - ay)**2)**0.5

print(ans)


Measured memory_bytes: 9584
#include <cstdlib>
#include <cstring>
#include <iostream>
using namespace std;

constexpr int NUMBER_OF_DIRECTIONS = 4;
const string direction = "ESWN";
constexpr int dx[NUMBER_OF_DIRECTIONS] = {1, 0, -1, 0};
constexpr int dy[NUMBER_OF_DIRECTIONS] = {0, 1, 0, -1};

struct state {
	int x, y, d;
	state(int x = 0, int y = 0, int d = 0):x(x), y(y), d(d){}
};

ostream& operator<<(ostream& os, const state& s) {
	return os << s.y + 1 << " " << s.x + 1 << " " << direction[s.d];
}

const int MAX_SIZE = 100;
string field[MAX_SIZE];
int h, w;
long long l;

int label[MAX_SIZE][MAX_SIZE][NUMBER_OF_DIRECTIONS];
state states[MAX_SIZE * MAX_SIZE * NUMBER_OF_DIRECTIONS];

inline bool out(int x, int y) {
	return x < 0 || x >= w || y < 0 || y >= h;
}

inline bool verify(int x, int y) {
	return !out(x, y) && field[y][x] != '#';
}

state solve(int x, int y, int d) {
	memset(label, -1, sizeof(label));
	for(int i = 0; i < l; ++i) {
		if(label[y][x][d] != -1) {
			const long long T = i - label[y][x][d];
			const long long rest = l - i;
			return states[label[y][x][d] + rest % T];
		}

		label[y][x][d] = i;
		states[i] = state(x, y, d);

		while(!verify(x + dx[d], y + dy[d])) d = (d + 1) % NUMBER_OF_DIRECTIONS;
		x += dx[d];
		y += dy[d];
	}

	return state(x, y, d);
}

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

	while(cin >> h >> w >> l && h) {
		for(int i = 0; i < h; ++i) {
			cin >> field[i];
		}

		state start;
		for(int i = 0; i < h; ++i) {
			for(int j = 0; j < w; ++j) {
				if(isalpha(field[i][j])) {
					start.x = j;
					start.y = i;
					start.d = direction.find(field[i][j]);
					goto end;
				}
			}
		}

	end:;

		cout << solve(start.x, start.y, start.d) << endl;
	}

	return EXIT_SUCCESS;
}

Measured memory_bytes: 1876
#include<bits/stdc++.h>
#define int long long
#define mod 1000000007
#define trace(x) cerr<<#x<<": "<<x<<" "<<endl
#define trace2(x, y) cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z) cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define sa(a,n) for(int i =0 ; i<n ; i++) cin>>a[i]
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define pb push_back
#define inf 2e18
#define scan() int n; cin>>n ; int a[n]; for(int i = 0 ; i<n ; i++) cin>>a[i]
#define print(a,n) for(int i = 0 ; i < n ; i++) cout<<a[i]<<' '
#define mem(a,v) memset(a,v,sizeof(a))
#define pii pair<int,int>
#define mkp make_pair
using namespace std;
#define N 2e5+5


int32_t main(){
        ios_base::sync_with_stdio(false);
        cin.tie(NULL);
        cout.tie(NULL);
      
        int n;
        cin >> n;
        int i,a[n+1];
        for(i=1; i<=n; i++) cin >> a[i];
        int x,y;
        for(i=n-1; i>=1; i--){
            if(a[i+1]<a[i]){
                a[i]--;
            }
        }
        for(i=1; i<n; i++){
            if(a[i+1]<a[i]){
                cout << "No" << '\n';
                return 0;
            }
        }
        cout << "Yes" << '\n';
        return 0;
        

}

Measured memory_bytes: 1024
#include <stdio.h>
#include <string.h>
   
int main() {
          int A;
          int B;
          scanf("%d %d", &A, &B);
          
          
  if(A % 3 ==0 || B % 3 == 0 || (A + B) % 3 ==0){
  printf("Possible ");
  } else {
  printf("Impossible ");
  } 
  return 0;  


}

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

int main(){
  int ans;
  char s[4];
  for(int i=0; i<4; ++i) cin >> s[i];
  for(int i=0; i<4; ++i){
    if(s[i]=='+') ans += 1;
    else ans -= 1;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,x,n) for(int i=x;i<n;i++)
#define pb push_back
#define MAX 100005
#define int long long
using namespace std;
const int MOD=1000000007;
const int INF=1000000009;


vector<int> LIS(const vector<int> &a){
  vector<int> dp(a.size(),INF);
  rep(i,a.size()){
    *lower_bound(dp.begin(),dp.end(),a[i])=a[i];
  }
  return vector<int>(dp.begin(),lower_bound(dp.begin(),dp.end(),INF));
}


signed main(){
  int n;
  cin>>n;
  vector<int> a(n);
  rep(i,n)cin>>a[i];

  vector<int> b=LIS(a);
  cout<<b.size()<<endl;

  return 0;
}

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

using namespace std;

#define DEBUG(...) fprintf(stderr, __VA_ARGS__)
#define mp make_pair
#define fst first
#define snd second
#define SZ(u) ((int) (u).size())
#define ALL(u) (u).begin(), (u).end()

inline void proc_status()
{
	ifstream t("/proc/self/status");
	cerr << string(istreambuf_iterator<char>(t), istreambuf_iterator<char>()) << endl;
}

template<typename T> inline bool chkmin(T &a, const T &b) { return a > b ? a = b, 1 : 0; }
template<typename T> inline bool chkmax(T &a, const T &b) { return a < b ? a = b, 1 : 0; }
template<typename T> inline T read()
{
	register T sum(0), fg(1);
	register char ch(getchar());
	for(; !isdigit(ch); ch = getchar()) if(ch == '-') fg = -1;
	for(;  isdigit(ch); ch = getchar()) sum = sum * 10 - '0' + ch;
	return sum * fg;
}

typedef long long LL;
typedef pair<int, int> pii;

const int MAXN = 100;

int n;

vector<int> a;

inline void input()
{
	n = read<int>();
	for(int i = 1; i <= n; ++i) a.push_back(read<int>() - 1);
}

inline void solve()
{
	static vector<int> ans;

	while(!a.empty())
	{
		bool fg = 0;
		for(int i = SZ(a) - 1; i >= 0; --i) if(a[i] == i)
		{
			a.erase(a.begin() + i);
			ans.push_back(i + 1);
			fg = 1;
			break;
		}
		if(!fg) break;
	}

	if(!a.empty()) puts("-1");
	else
	{
		reverse(ALL(ans));
		for(auto i : ans) printf("%d\n", i);
	}
}

int main()
{
#ifndef ONLINE_JUDGE
//	freopen("A.in", "r", stdin);
//	freopen("A.out", "w", stdout);
#endif

	input();
	solve();

	return 0;
}



Measured memory_bytes: 256
# coding=UTF-8
from collections import deque
from operator import itemgetter
from bisect import bisect_left, bisect
import itertools
import sys
import math
import numpy as np
import time
sys.setrecursionlimit(10**6)
input = sys.stdin.readline


def main():
    x, y = map(int, input().split())
    flg = 0
    for i in range(x+1):
        if 2 * (i) + 4 * (x - i) == y:
            flg = 1
            break
    if flg == 1:
        print("Yes")
    else:
        print("No")


if __name__ == '__main__':
    main()


Measured memory_bytes: 27104
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <queue>
#include <vector>
#include <utility>
#define maxn 100005
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int n;
ll K,a[maxn];
int main(){
	scanf("%d%lld",&n,&K);
	for(int i = 1;i <= n;i++) scanf("%lld",&a[i]);
	ll x = 0,ans = 0;
	for(int i = 39;i >= 0;i--){
		int cnt1 = 0;
		for(int j = 1;j <= n;j++){
			if(a[j] & 1ll << i) cnt1++;
		}
		if(cnt1 < n - cnt1 && (x | 1ll << i) <= K){
			x |= 1ll << i;
			ans += ll(n - cnt1) << i;
		}else{
			ans += ll(cnt1) << i;
		}
	}
	printf("%lld\n",ans);
	return 0;
}


Measured memory_bytes: 1024
#include <algorithm>
#include <cmath>
#include <iostream>
#include <vector>

using namespace std;

#define ll long long

int a[25] = {};

int main() {
	int n;
	int ans = 1;
	cin >> n;

	for (int i = 0; i < n; i++)
	{
		cin >> a[i];
	}

	for (int i = 1; i < n; i++)
	{
		if (a[i] < a[0]) {
			continue;
		}
		int num = 0;
		for (int j = 0; j < i; j++)
		{
			if (a[i] >= a[j]) {
				num++;
			}
		}

		if (i == num) {
			ans++;
		}
	}

	cout << ans << endl;


}


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

int main() {
	int n;
    cin >> n;
    int a[n];
    int ans(0);
    for (int i = 0; i < n; ++i) cin >> a[i];
    sort(a, a+n);
    //for (int i = 0; i < n; ++i) cout << a[i];
    for (int i = 0; i < n; ++i)
    for (int j = i + 1; j < n; ++j)
    for (int k = j + 1; k < n; ++k)
    if (a[i] != a[j] && a[j] != a[k] && a[i] + a[j] > a[k] && a[k] + a[j] > a[i] &&
    a[k] + a[i] > a[j] && abs(a[k]-a[j]) < a[i]
    && abs(a[k]-a[i]) < a[j] && abs(a[i]-a[j]) < a[k]) ans++;
    cout << ans << endl;
};

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

typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<long long> VL;
typedef vector<vector<long long>> VVL;
typedef pair<int,int> P;
typedef tuple<int,int,int> tpl;

#define ALL(a)  (a).begin(),(a).end()
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())
#define EXIST(m,v) (m).find((v)) != (m).end()
#define LB(a,x) lower_bound((a).begin(), (a).end(), x) - (a).begin()
#define UB(a,x) upper_bound((a).begin(), (a).end(), x) - (a).begin()

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

#define en "\n"

constexpr double EPS = 1e-9;
constexpr double PI  = 3.1415926535897932;
constexpr int INF = 2147483647;
constexpr long long LINF = 1LL<<60;
constexpr long long MOD = 1000000007; // 998244353;

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

struct mint {
    long long x;
    mint(long long x=0):x((x%MOD+MOD)%MOD){}
    mint operator-() const { return mint(-x);}
    mint& operator+=(const mint a) {
        if ((x += a.x) >= MOD) x -= MOD;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += MOD-a.x) >= MOD) x -= MOD;
    	return *this;
    }
    mint& operator*=(const mint a) {
    	(x *= a.x) %= MOD;
    	return *this;
    }
    mint operator+(const mint a) const {
        mint res(*this);
        return res+=a;
    }
    mint operator-(const mint a) const {
        mint res(*this);
        return res-=a;
    }
    mint operator*(const mint a) const {
        mint res(*this);
        return res*=a;
    }
    mint pow(long long t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
    	if (t&1) a *= *this;
        return a;
    }
    // for prime MOD
    mint inv() const {
        return pow(MOD-2);
    }
    mint& operator/=(const mint a) {
    	return (*this) *= a.inv();
    }
    mint operator/(const mint a) const {
        mint res(*this);
        return res/=a;
    }
};

struct combination {
    vector<mint> fact, ifact;
    combination(long long n):fact(n+1),ifact(n+1) {
        assert(n < MOD);
        fact[0] = 1;
        for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
        ifact[n] = fact[n].inv();
        for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
    }
    mint operator()(long long n, long long k) {
        if (k < 0 || k > n) return 0;
        return fact[n]*ifact[k]*ifact[n-k];
    }
};

void Main(){
    int N; cin >> N;
    if(N == 1){
        cout << 0 << en;
        return;
    }
    mint all = mint(10).pow(N);
    mint zero = all - mint(9).pow(N), nine(zero.x);
    mint zeronine = all - mint(8).pow(N); // 0 or 9
    mint ans = zero + nine - zeronine;
    cout << ans.x << en;
    return;
}

int main(void){
    cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(0);cout<<fixed<<setprecision(15);
    int t=1; //cin>>t;
    REP(_,t) Main();
    return 0;
}

Measured memory_bytes: 3660
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pii;
const ll inf  = 1e6+5;
vector<int> freq (5);
int main() {
  int num, digits; cin >> num >> digits;
  set<char> nums;
  for (int i = 0; i < digits; i++){
      char a = 0; cin >> a; nums.insert(a);
  }
  for (int i = num; true; i++){
      string s = to_string(i);
      bool valid = true;
      for (char j : s){
          if (nums.find(j) != nums.end()){
              valid = false;
              break;
          }
      }
      if (valid == true){
          cout << i;
          exit(0);
      }
  }
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); ++i)
int main(void) {
  int n;
  cin >> n;
  vector<double> a(n);
  rep(i, n) cin >> a[i];
  rep(i, n) a[i] = 1.0 / a[i];
  double sum = 0;
  rep(i, n) sum += a[i];
  double ans = 1.0 / sum;
  printf("%.10f", ans);
  return 0;
}

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

int main() {
    int n, a;
    cin >> n;
    vector<int> x(n);
    int left = 10000;
    int right = -10000;
    for (int i = 0; i < n; ++i) {
        cin >> a;
        left = min(left, a);
        right = max(right, a);
        x[i] = a;
    }
    auto f = [&](int p, int x) {
        return (x - p) * (x - p);
    };
    ll ans = 1001001001001001001;
    ll cnt = 0;
    for (int j = left; j <= right; ++j) {
        for (int i = 0; i < n; ++i) {
            cnt += f(x[i], j);
        }
        ans = min(ans, cnt);
        cnt = 0;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
a, b, k = readline.split.map(&:to_i)
if a + k - 1 < b - k + 1 then
	for i in 1..k do
		print(a + i - 1, "\n")
	end
	for i in 1..k do
		print(b - k + i, "\n")
	end
else
	for i in a..b do
		print(i, "\n")
	end
end

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

//#define int long long
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<n;++i)
#define exrep(i, a, b) for(ll i = a; i < b; i++)
#define out(x) cout << x << endl
#define EPS (1e-7)
#define gearup ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<bool> > vvb;
typedef vector<vector<double> > vvd;
typedef vector<vector<string> > vvs;
typedef vector<ll> vl;
typedef vector<vector<ll> > vvl;
typedef vector<vector<vector<ll> > > vvvl;
ll MOD = 1000000007;
const long long L_INF = 1LL << 60;
const int INF = 2147483647; // 2^31-1
const double PI = acos(-1);
//cout<<fixed<<setprecision(10);

template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
template<class T> void debug(T v){rep(i,v.size()) cout<<v[i]<<" ";cout<<endl;}
const ll dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};
//以降 cin の入力元が 'input.txt' になる
//std::ifstream in("input.txt");
//std::cin.rdbuf(in.rdbuf());

signed main()
{   
    gearup;
    ll n; cin >> n;
    ll res = L_INF;
    rep1(i,11){
        ll now = 1000*i;
        if(now >= n)res = min(res,now-n);
    }
    out(res);
}

Measured memory_bytes: 3648
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <math.h>
#include <string.h>
#include <map>
#include <numeric>
#include <random>

using namespace std;

const int MOD = 1000000007;
typedef long long ll;

int main()
{
  ll N,ans1=0ll,l1=0ll,l2=0ll;
  cin>>N;
  vector<ll> A(N);
  for(int i=0;i<N;i++){
    cin>>A[i];
  }
  sort(A.rbegin(),A.rend());

  for(int i=0;i<N-3;i++){
    if(A[i]==A[i+1] && A[i]==A[i+2] && A[i]==A[i+3]){
      ans1=A[i]*A[i];
      break;
    }
  }

  for(int i=0;i<N-1;i++){
    if(A[i]==A[i+1]){
      if(l1==0){
        l1=A[i];
      }else{
        if(A[i]!=l1)l2=A[i];
      }
    }
    if(l2!=0)break;
  }
  cout<<max(ans1,l1*l2)<<endl;
}


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

struct Fast {Fast() {std::cin.tie(0); ios::sync_with_stdio(false);}} fast;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;
using vll = vector<long long>;
using pll = pair<ll, ll>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define MOD 1000000007

struct UnionFind {
    vector<int> par, rank;

    UnionFind(int n) : par(n , -1), rank(n, 0) { }
    void init(int n) { par.assign(n, -1), rank.assign(n, 0); }

    int root(int x) {
        if (par[x] == -1) return x;
        else return par[x] = root(par[x]); //ここで経路圧縮
    }

    bool same(int x, int y) {
        return root(x) == root(y);
    }

    bool unite(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (rank[x] < rank[y]) swap(x, y);
        if (rank[x] == rank[y]) ++rank[x];
        par[y] = x;
        return true;
    }
};

int main() {
    ll N, M; cin >> N >> M ;
    UnionFind tree(2 * N);
    rep(i, M) {
        int a, b; cin >> a >> b;
        a--; b--;
        tree.unite(a, b + N);
        tree.unite(a + N, b);
    }
    bool g = true;
    rep(i, N) {
        if (tree.same(i, i + N)) {
            g = false;
            break;
        }
    }
    if (!g) {
        cout << N*(N - 1) / 2 - M << endl;
    }
    else {
        ll l = 0;
        rep(i, N) {
            if (tree.same(0, i)) l++;
        }
        cout << l*(N - l) - M << endl;
    }

}


Measured memory_bytes: 1792
#include <iostream>

using namespace std;

int main(int argc, char const* argv[]) {
    int n;
    cin >> n;
    while (n >= 0) {
        if (n % 4 == 0) {
            cout << "Yes" << endl;
            return 0;
        }
        n -= 7;
    }

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


Measured memory_bytes: 256
#!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from itertools import permutations
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    n,a,b = LI()
    s = a+b
    k = n//s
    n -= k*s
    n = min(n,a)
    print(k*a+n)
    return

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


Measured memory_bytes: 38384
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <vector>
#include <cmath>
using namespace std;

int p[110];

int main() {
    int x, n;
    scanf("%d%d", &x, &n);
    for(int i = 0; i < n; i++) {
        int a;
        scanf("%d", &a);
        p[a] = 1;
    }
    int now = 0;
    while(1) {
        if(x - now <= 0) {
            printf("%d\n", x - now);
            return 0;
        }
        if(p[x - now] == 0) {
            printf("%d\n", x - now);
            return 0;
        }
        if(p[x + now] == 0) {
            printf("%d\n", x + now);
            return 0;
        }
        now++;
    }

	return 0;
}


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

using namespace std;

#define G getline
#define SZ size()
#define C clear()
#define B begin()
#define F front()
#define T top()
#define E end()
#define EM empty()
#define V vector
#define Q queue
#define DQ deque
#define PQ priority_queue
#define ST stack
#define FI first
#define SE second
#define PI acos(-1)
#define PS push
#define PP pop()
#define PSF push_front
#define PSB push_back
#define PPF pop_front()
#define PPB pop_back()
#define LL long long
#define ULL unsigned long long
#define PII pair<int,int>
#define PSI pair<string,int>
#define PIS pair<int,string>
#define PLI pair<long long int,int>
#define PLL pair<long long int,long long int>
#define MII map<int,int>
#define MSI map<string,int>
#define MIS map<int,string>
#define MLI map<long long int,int>
#define FAST() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)





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




LL ans[100002];
map<LL,int>mp;

int main()
{
    FAST();
    LL i,j,m,n,x,cnt=0,cnt2=0,finalAns;
    cin >> n >> x >> m;
    ans[1]=x;
    mp[x]=1;
    for(i=2; ;i++)
    {
        ans[i]=(ans[i-1]*ans[i-1])%m;
        if(mp[ans[i]])break;
        mp[ans[i]]=i;
    }
    finalAns=0;
    x=mp[ans[i]];
    for(j=1;j<x;j++)finalAns+=ans[j];
    n-=x-1;
    for(j=x;j<i;j++)++cnt,cnt2+=ans[j];
    finalAns+=(n/cnt)*cnt2;
    n%=cnt;
    i=mp[ans[i]];
    while(n--)finalAns+=ans[i++];
    cout << finalAns;
    return 0;
}


Measured memory_bytes: 7116
import java.util.Scanner;

public class Main {

  public static final long mod7 = 1000000007L;
  static int[][] map;
  static int sx, sy, ex, ey, h, w;
  static int[][] dir = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    while (run(sc)) {

    }
  }
  static boolean run(Scanner sc) {
    w = sc.nextInt();
    h = sc.nextInt();
    if (w + h == 0) {
      return false;
    }
    map = new int[h][w];
    for (int i = 0; i < h; i++) {
      for (int j = 0; j < w; j++) {
        int v = sc.nextInt();
        if (v == 2) {
          sx = j;
          sy = i;
          map[i][j] = 0;
        } else if (v == 3) {
          ex = j;
          ey = i;
          map[i][j] = 3;
        } else {
          map[i][j] = v;
        }
      }
    }
    int res = rep(sx, sy, 10);
    if (res == Integer.MAX_VALUE) {
      System.out.println(-1);
    } else {
      System.out.println(res);
    }
    return true;
  }

  static int rep(int px, int py, int t) {
    if (t == 0) {
       return Integer.MAX_VALUE;
    }
    int m = Integer.MAX_VALUE;
    for (int di = 0; di < 4; di++) {
      int[] d = dir[di];
      int nx = px;
      int ny = py;
      int by = -1;
      int bx = -1;
      boolean cant = false;
      for (int i = 0; i < 30; i++) {
        int ty = ny + d[1];
        int tx = nx + d[0];
        if (ty < 0 || ty >= h || tx < 0 || tx >= w) {
          cant = true;
          break;
        }
        if (map[ty][tx] == 1) {
          if (i == 0) {
            cant = true;
            break;
          }
          by = ty;
          bx = tx;
          map[by][bx] = 0;
          break;
        }
        if (map[ty][tx] == 3) {
          return 10 - t + 1;
        }
        ny = ty;
        nx = tx;
      }
      if (cant) {
        continue;
      }
      m = Math.min(m, rep(nx, ny, t - 1));
      if (bx != -1) {
        map[by][bx] = 1;
      }
    }
    return m;
  }
}

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

using namespace std;

int main()
{
    int n,i,x,arr[100005];
    cin>>n;
    for(i=1;i<=n;i++){
        cin>>x;
        arr[x] = i;
    }
    for(i=1;i<=n;i++)cout<<arr[i]<<' ';
    cout<<endl;
    return 0;
}


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

signed main() {
  int N, K;
  cin >> N >> K;
  vector<int> A(N);
  for( int i = 0; i < N; i++ ){
    cin >> A.at(i);
    A.at(i)--;
  }
  
  int roop = -1;
  vector<bool> check(N+1, 0);
  vector<int> michi;
  int now = 0;
  while( true ){
    if( check.at(now) == 1 ){
      roop = now;
      break;
    }
    check.at(now) = 1;
    michi.push_back(now);
    now = A.at(now);
  }
  
  for( int i = 0; i < michi.size(); i++ ){
    if( michi.at(i) == roop ){
      roop = i;
      break;
    }
  }
  
  //for( int i = 0; i < michi.size(); i++ ) cout << michi.at(i) << endl;
  
  if( michi.size() > K ){
    cout << michi.at(K)+1 << endl;
  }else{
    int B = (int)michi.size();
    if( roop == 0 ){
      cout << michi.at(K%B)+1 << endl;
      return 0;
    }
    vector<int> newv;
    for( int i = roop; i < michi.size(); i++ ) newv.push_back(michi.at(i));
    //for( int i=0; i < newv.size(); i++ ) cout << newv.at(i) << " ";
    cout << newv.at((K-roop)%newv.size())+1 << endl;
  }
  
}


Measured memory_bytes: 8652
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
    int N;
    cin>>N;
    ll dp[2020][2020],ans=0;
    vector<pair<ll,int>> A(N);
    for(int i=0;i<N;i++){
        cin>>A.at(i).first;
        A.at(i).second=i;
    }
    sort(A.begin(),A.end(),greater<pair<ll,int>>());
    for(int j=1;j<=N;j++){
        dp[0][j]=dp[0][j-1]+A.at(j-1).first*(N-j-A.at(j-1).second);
    }
    for(int i=1;i<=N;i++){
        dp[i][0]=dp[i-1][0]+A.at(i-1).first*(A.at(i-1).second-i+1);
        for(int j=1;j<=N-i;j++){
            dp[i][j]=max(dp[i][j-1]+A.at(i+j-1).first*(N-j-A.at(i+j-1).second),dp[i-1][j]+A.at(i+j-1).first*(A.at(i+j-1).second-i+1));
        }
        ans=max(ans,dp[i][N-i]);
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 26320
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
#define ll long long
#define dd double
#define MOD1 1000000007
#define MOD2 998244353
#define nl cout<<endl
#define rt ll Q[100005]={0}
#define mp make_pair
#define test() ll t;cin>>t;while(t--)
#define pb push_back
#define ff first    
#define ss second
#define all(v) v.begin(),v.end()
#define s(ar,n) sort(ar,ar+n)
#define rs(ar,n) sort(ar, ar+n, greater<ll>()) 
#define oa(a,n) for(ll i=0;i<n;i++)cout<<a[i]<<" ";nl
#define cn(a,n) for(ll i=0;i<n;i++)cin>>a[i];
#define ov(a,n) for(ll i=n-1;i>=0;i--)cout<<a[i]<<" ";nl
#define ovp(a,n) for(ll i=0;i<n;i++)cout<<a[i].ff<<" "<<a[i].ss<<endl;
#define maxa(ar,N) *max_element(ar,ar+N)
#define mina(ar,N) *min_element(ar,ar+N)
#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
typedef pair<ll,ll> pii;
ll powe(ll n,ll m){if(m==0)return 1;ll t=powe(n,m/2);if(m%2==0)return (t*t);return (((t*t))*n);}
ll mpowe(ll n,ll m,ll MOD){if(m==0)return 1;ll t=mpowe(n,m/2,MOD);t%=MOD;if(m%2==0)return (t*t)%MOD;return (((t*t)%MOD)*n)%MOD;}
ll logtwo(ll n){if(n==1)return 0;if(n==0) return -1;return logtwo(n/2)+1;}
ll gcd(ll a, ll b) 
{ 
    if (b == 0) 
        return a;
    if(a==0)
        return b; 
    return gcd(b, a % b);  
      
}
int main()
{
    fastio();
   
    int t=1;
    //
    while(t--)
    {
       ll x;
       cin>>x;
       ll ans = gcd(x,360ll);
       ans = 360/ans;
       cout<<ans<<endl;

    }
    
}

Measured memory_bytes: 3612
#include <iostream>
#include <vector>

using namespace std;

int main(){
  int N;
  cin>>N;
  
  int max=0,max_num=1;

  for(int i=1;i<=N;i++){
    int num=i;
    int cnt=0;
    while(num%2==0){
      cnt++;
      num/=2;
    }
    if(cnt>max){
      max=cnt;
      max_num=i;
    }
  }

  cout <<max_num<<endl;

  return 0;
}


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

ll power(ll x,ll y,ll p)  
{  
    ll res = 1;     // Initialize result  
    if(y == 0)
        return(1 % p);
    
    x = x % p; // Update x if it is more than or  
                // equal to p 
    if (x == 0)
        return 0; // In case x is divisible by p; 
  
    while (y > 0)  
    {   
        // If y is odd, multiply x with result  
        if (y & 1LL)  
            res = (res * x) % p;  
  
        // y must be even now  
        y = y >> 1LL; // y = y/2  
        x = (x * x) % p;  
    }
    
    return res;  
}

ll solve(ll N) //N is of order 1e5
{
    ll c = 1;
    while(N)
    {
        ll set = __builtin_popcount(N);
        N = N % set;
        c++;
    }
    
    return(c);
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    ll T = 1;
    while(T--)
    {
        ll N; cin>>N;
        ll ans = 0;
        
        for(ll i=0;i<N;++i)
        {
            ll val; cin>>val;
            if(i%2 == 0 && val%2)
                ans++;
        }
        
        cout<<ans<<endl;
    }
}

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

int main(){
  int n;
  cin>>n;
  string taro,hana;
  int p_taro=0;
  int p_hana=0;
  for(int i=0;i<n;i++){
    cin>>taro>>hana;
    if(taro>hana){
    p_taro += 3;
    }else if(taro<hana){
    p_hana += 3;
    }else{
    p_taro += 1;
    p_hana += 1;
    }  
  }
  cout<<p_taro<<' '<<p_hana<<endl;
  return 0;
}

Measured memory_bytes: 3168
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define pb push_back
#define mp make_pair
#define ss(x) (int) x.size()
#define fi first
#define se second
#define cat(x) cerr << #x << " = " << x << endl
#define rep(i, j, n) for (int i = j; i <= n; ++i)
#define per(i, j, n) for (int i = n; j <= i; --i)
#define all(x) x.begin(), x.end()
 
using namespace std;

int main() {		
	int n;
	cin >> n;
	bool ok = 0;
	while (n > 0) {
		ok |= (n % 10 == 7);
		n /= 10;
	}
	if (ok) printf ("Yes\n");
	else printf ("No\n");	
	
	
	return 0;
}


Measured memory_bytes: 3592
/*bismillah ->                                                                                                         << Suirkhanov Meyirlan >>
  GL HF


                                                                                                                      42

    bless my code =)
                                                                                                            NEVER FOLLOW YOUR RULES :D HAHAHAHA
*/


///scanf ("%d%d", &x, &y);
///printf("%d", &a)

#include <bits/stdc++.h>

#define fast ios_base::sync_with_stdio();   cin.tie(0);   cout.tie(0);
#define randoperation srand(time(0));
#define pii pair < int , int >
#define pll pair < ll, ll >
#define pb push_back
#define pf psuh_front
#define mp make_pair
#define fi first
#define se second
#define fast ios_base::sync_with_stdio();   cin.tie(0);   cout.tie(0);
#define randoperation srand(time(0));
#define eb emplace_back

using namespace std;

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

const ll N = 2 * 1e3 + 7;
const ld pi = 3.14159265359;
const int INF = 1e20 + 7;
const double eps = 1e-9;

const int xi[4] = {-1, 0, +1, 0};
const int yj[4] = {0, +1, 0, -1};
const int xxi[4] = {+1, 0, -1, 0};
const int yyj[4] = {0, -1, 0, +1};

ll n, k, x, y, ans;

int main(){

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

  fast
  randoperation;

  ///           ||
  ///start here \/

  cin >> n >> k >> x >> y;

  if(n <= k){
    cout << n * x;
    return 0;
  }

  cout << k * x + (n - k) * y;
}


Measured memory_bytes: 256
def main():
    N, X = map(int, input().split())
    L = list(map(int, input().split()))

    d = [0] + [l for l in L]
    for i in range(1, len(d)):
        d[i] = d[i-1] + L[i-1]
    a = [x for x in d if x <= X]
    print(len(a))


if __name__ == '__main__':
    main()

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
ll dp[301][301][301];
vector<vector<pair<int,int> > >v;
int main()
{
    int n,m;
    cin>>n>>m;
    vector<pair<int,int> > vec;
    v.insert(v.begin(),n+2,vec);
    for(int i=0;i<m;i++)
    {
        int l,r,x;
        cin>>l>>r>>x;
        v[r].push_back(make_pair(l,x));
    }
    dp[0][0][0]=1;
    ll brojac=0;
    for(int i=0;i<=n;i++)
    {
        for(int j=0;j<=n;j++)
        {
            for(int k=0;k<=n;k++)
            {
                if(!dp[i][j][k])
                    continue;
                if(i&&j&&k)
                {
                    if(i==k||i==j||j==k)
                        continue;
                }
                int maxi=max(i,max(j,k));
                bool cc=true;
                for(int g=0;g<v[maxi].size();g++)
                {
                    int br=0;
                    if(v[maxi][g].first<=i)
                        br++;
                    if(v[maxi][g].first<=j)
                        br++;
                    if(v[maxi][g].first<=k)
                        br++;
                    if(br!=v[maxi][g].second)
                    {
                        cc=false;
                        break;
                    }
                }
                if(!cc)
                    continue;
                dp[i][j][k]%=mod;
                if(maxi==n)
                {
                    brojac+=dp[i][j][k];
                    brojac%=mod;
                    continue;
                }
                dp[maxi+1][j][k]+=dp[i][j][k];
                dp[maxi+1][j][k]%=mod;
                dp[i][maxi+1][k]+=dp[i][j][k];
                dp[i][maxi+1][k]%=mod;
                dp[i][j][maxi+1]+=dp[i][j][k];
                dp[i][j][maxi+1]%=mod;
            }
        }
    }
    cout<<brojac<<endl;
    return 0;
}

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

int main(){
  int n;
  cin >> n;
  string s;
  cin >> s;
  s.push_back('#');
  int ans = 0;
  rep(i,n){
    if(s[i]!=s[i+1]) ans++;
  }
  
  cout << ans << endl;
}


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

int main() {
  int N;
  cin >> N;
  map<int,int> m;
  for(int i=0; i<N; i++){
    m[i]=0;
  }
  vector<int> a(N-1);
  for(int i=0; i<N-1; i++){
    cin >> a.at(i);
    m[a.at(i)-1] += 1;
  }
  
  for(int i=0; i<N; i++){
    cout << m[i] << endl;
  }
  
}

Measured memory_bytes: 13552
n = int(input())
t, a = map(int, input().split())
h = [int(_) for _ in input().split()]
p = 1
num = abs(a - (t - h[0] * 0.006))
for i in range(1,n):
    if num > abs(a - (t - h[i] * 0.006)):
        p = i + 1
        num = abs(a - (t - h[i] * 0.006))
print(p)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define all(c) begin(c), end(c)
#define dump(x) cerr << __LINE__ << ":\t" #x " = " << (x) << endl

int main() {
    int n, T;
    while (cin >> n >> T) {
        int ans = 1e9;
        rep(i, n) {
            int c, t;
            cin >> c >> t;
            if (t <= T) {
                ans = min(ans, c);
            }
        }
        if (ans == 1e9) {
            cout << "TLE";
        } else {
            cout << ans;
        }
        cout << endl;
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define VIEW(x) do {cerr << #x << ": "; for(auto i : x) cerr << i << " "; cerr << endl;} while(0)

signed main() {
  int n; cin >> n;
  vector<int> a(n);
  rep(i,n) {
    cin >> a[i];
    a[i] -= i + 1;
  }
  sort(a.begin(), a.end());
  int b = n%2 ? a[n/2] : (a[n/2] + a[n/2-1]) / 2;
  ll ans = 0;
  rep(i,n) ans += abs(a[i] -b);
  cout << ans << endl;
}


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

int main()
{
    int a, b;
    cin >> a >> b;

    if(!(a * b % 2))
    {
        cout << "Even" << "\n";
    } else 
    {
        cout << "Odd" << "\n";
    }

    return 0;
}

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

int main() {
	double r;
	cin >> r;
	printf("%.10lf",2 * r * 3.14159265);
	return 0;
}


Measured memory_bytes: 3764
N = int(input())
ans = int(input())


def gcd(x, y):
    x, y = max(x, y), min(x, y)
    if x % y == 0:
        return y
    else:
        return gcd(y, x % y)


for i in range(N-1):
    x = int(input())
    g = gcd(ans, x)
    ans *= x
    ans //= g
print(ans)


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

int main(void)
{
    int N, Q;
    string S;
    cin >> N >> Q >> S;
    vector<int> l(Q), r(Q);
    for (int i = 0; i < Q; i++)
    {
        cin >> l[i] >> r[i];
    }

    vector<int> acCount(N);
    acCount[0] = 0;
    for (int i = 1; i < N; i++)
    {
        if(S[i] == 'C' && S[i-1] == 'A'){
            acCount[i] = acCount[i-1]+1;
        } else {
            acCount[i] = acCount[i-1];
        }
    }
    
    for (int i = 0; i < Q; i++)
    {
        cout << acCount[r[i]-1] - acCount[l[i]-1] << endl;
    }
    
    
    return 0;
}


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


using namespace std;






int main()
{
   
string s;
cin >> s;
if (s=="SUN") cout << "7"; else
if (s=="MON") cout << "6"; else
if (s=="TUE") cout << "5"; else
if (s=="WED") cout << "4"; else    
if (s=="THU") cout << "3"; else
if (s=="FRI") cout << "2"; else
cout << "1";





}


Measured memory_bytes: 256