akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;

int main()
{
	int n;
	while (cin >> n, n) {
		vector<string> go(n), come(n);
		go.reserve(n); come.reserve(n);
		for (int i = 0; i < n; i++) {
			cin >> go[i];
			cin >> come[i];
		}
		sort(go.begin(), go.end());
		sort(come.begin(), come.end());
		int res = 0, tmp = 0, g = 0, c = 0;
		while (g != n || c != n) {
			if (g == n) {
				c++;
				tmp--;
			}
			else if (c == n) {
				g++;
				tmp++;
			}
			else {
				if (go[g] < come[c]) {
					g++;
					tmp++;
				}
				else {
					c++;
					tmp--;
				}
			}
			if (tmp > res)
				res = tmp;
		}
		cout << res << endl;
	}
	return 0;
}

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

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

  vector <int> mass(N);
  vector <int> move_mass(N, 0);
  int cnt=0;
  int max_move=0;

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

  for (int i=0; i<N-1;) {
    cnt=0;
    for ( int j=i; j<N-1; j++) {
      if (mass[j] >= mass[j+1]) {
        cnt++;
      }
      else break;
    }
    move_mass[i] = cnt;
    i+=cnt+1;
  }


  for (int i=0; i<N; i++) {
    if (max_move < move_mass[i]) {
      max_move = move_mass[i];
    }
  }

  cout << max_move << endl;

    
  return 0;
}


Measured memory_bytes: 1024
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<math.h>
#include<queue>
#include<map>
#include<bitset>
#include<stack>
#include<set>
#include<vector>
#include <time.h>
#include<string.h>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <ll, int> pli;
typedef pair <db, db> pdd;

const int maxn = 3e3+5;
const int Mod=1000000007;
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
const double e=exp(1);
const db PI = acos(-1);
const db ERR = 1e-10;

#define Se second
#define Fi first
#define pb push_back
#define dbg(x) cout<<#x<<" = "<< (x)<< endl
#define dbg2(x1,x2) cout<<#x1<<" = "<<x1<<" "<<#x2<<" = "<<x2<<endl
#define dbg3(x1,x2,x3) cout<<#x1<<" = "<<x1<<" "<<#x2<<" = "<<x2<<" "<<#x3<<" = "<<x3<<endl
ll dp[maxn];//dpi,j 表示前i个数合法，第i个数排名j的合法方案数
char str[maxn];
ll pre[maxn],suf[maxn];
int main()
{
    int n;
    scanf("%d",&n);
    scanf("%s",str+1);
    dp[1]=1;
    pre[1]=1;
    suf[1]=1;
    for(int i=2;i<=n;i++)
    {
        for(int j=1;j<=i;j++)
        {
            if(str[i-1]=='<') dp[j]=pre[j-1];
            else dp[j]=suf[j];
        }
        for(int j=1;j<=i;j++) pre[j]=(pre[j-1]+dp[j])%Mod;
        for(int j=i;j>=1;j--) suf[j]=(suf[j+1]+dp[j])%Mod;
    }
    ll ans=0;
    for(int i=1;i<=n;i++) ans=(ans+dp[i])%Mod;
    printf("%lld\n",ans);
    //cout << "time: " << (long long)clock() * 1000 / CLOCKS_PER_SEC << " ms" << endl;
    return 0;
}


Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ld long double
#define al(a) (a).begin(),(a).end()
#define mk make_pair
#define check cout<<"?"<<endl;

ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;

int main(){
    int n,ans=inf,cnt,l,r; cin>>n;
    int x=1,y=1;
    rep(i,7){
        x*=6; y*=9;
    }
    rep(i,n+1){
        l=i; r=n-i; cnt=0;
        int a=x, b=y;
        rep(j,8){
            cnt+=l/a; l%=a; a/=6;
            cnt+=r/b; r%=b; b/=9;
        }
        ans=min(ans,cnt);
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
import java.io.*;

public class Main {

	final static long MOD = 1000000007;
	public static void main(String[] args) throws Exception {
		// TODO 自動生成されたメソッド・スタブ

		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		String S = in.readLine();
		String T ="";
		String[] A = {"dream","dreamer","erase","eraser"};
		String[] B = {"eam","mer","ase","ser"};
		int i = S.length();
		String sfx="";
		String ans = "YES";
		boolean flg=true;
		while(flg){
			sfx=S.substring(i-3,i);
			for(int x=0;x<B.length;x++){
				if(sfx.equals(B[x])){
					if(A[x].equals(S.substring(i-A[x].length(),i))){
						i=i-A[x].length();
						sfx=null;
						break;
					}else{
						ans="NO";
						flg=false;
						break;
					}
				}
			}
			if(sfx!=null){
				ans="NO";
				break;
			}
			if(i==0){
				break;
			}
			if(i-3<0){
				ans="NO";
				break;
			}
		}

		System.out.println(ans);
	}
}


Measured memory_bytes: 25556
#include<vector>
#include<cmath>
#include<map>
#include<cstdlib>
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<set>
#include<stack>
#include<bitset>
#include<functional>
#include<ctime>
#include<queue>
#include<deque>
#include<complex>
using namespace std;
#define pb push_back
#define pf push_front
typedef long long lint;
typedef complex<double> P;
#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
vector<int> gr[114514];
int par[114514];
int out=0,k;
int dfs(int v){
	int d=0;
	rep(i,gr[v].size()){
		d=max(d,dfs(gr[v][i]));
	}
	if(d==k-1 && v!=0 && par[v]!=0){
		out++;return 0;
	}
	else return d+1;
}
int main()
{
	int n;
	scanf("%d %d",&n,&k);
	rep(i,n){
		scanf("%d",&par[i]);par[i]--;
		if(i==0 && par[i]>0){
			out++;par[i]=0;
		}
		if(i>0) gr[par[i]].pb(i);
	}
	dfs(0);
	cout<<out<<endl;
}


Measured memory_bytes: 12672
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int w = sc.nextInt();
        int h = sc.nextInt();
        int n = sc.nextInt();
        int[] a = new int[4];
        a[1] = w;
        a[3] = h;
        for (int i = 0; i < n; i++) {
            int x = sc.nextInt();
            int y = sc.nextInt();
            int b = sc.nextInt()-1;
            if(b == 0 && a[0] < x) a[0] = x;
            if(b == 1 && x < a[1]) a[1] = x;
            if(b == 2 && a[2] < y) a[2] = y;
            if(b == 3 && y < a[3]) a[3] = y;
        }
        int xlen = Math.max(0, a[1]-a[0]);
        int ylen = Math.max(0, a[3]-a[2]);
        System.out.println(xlen * ylen);
        sc.close();

    }

}


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

struct UnionFind {
    vector<int> par;
    vector<int> rank;

    UnionFind(int N) : par(N), rank(N) {
        for (int i = 0; i < N; i++) {
            par[i] = i;
            rank[i] = 0;
        }
    }

    int root(int x) {
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) {
        int rx = root(x);
        int ry = root(y);
        if (rx == ry) return;
        if (rank[rx] < rank[ry]) swap(rx, ry);
        par[ry] = rx;
        if (rank[rx] == rank[ry]) rank[rx]++;
    }

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

int main() {
    int N, M; cin >> N >> M;
    vector<int> h(N);
    for (int i = 0; i < N; i++) {
        cin >> h[i];
    }
    vector<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<bool> memo(N, true); 
    int ans = 0;
    for (int i = 0; i < N; i++) {
        int x = h[i];
        int ok = true;
        if (memo[i] = true) {
            for (auto v : G[i]) {
                if (x > h[v]) {
                    memo[v] = false;
                }
                if (x <= h[v]) {
                    memo[i] = false;
                    ok = false;
                }
            }
            if (ok) ans ++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 8804
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <stack>
#include <string>
using namespace std;

int main(){
    int N;
    cin>>N;
    int minx=1061109567;
    int temp;
    int res=0;
    while(N--){
        cin>>temp;
        minx=min(temp,minx);
        if(temp<=minx){
            res++;
        }
    }
    cout<<res<<endl;
}

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

int main() {
    int q;
    std::cin >> q;

    std::vector<int> vec{};
    for (int i = 0; i < q; ++i) {
        int kind;
        std::cin >> kind;

        switch (kind) {
            case 0:
                int x;
                std::cin >> x;
                vec.push_back(x);
                break;
            case 1:
                int p;
                std::cin >> p;
                std::cout << vec.at(p) << std::endl;
                break;
            case 2:
                vec.pop_back();
                break;
            default:
                std::cerr << "strange kind";
        }
    }
}


Measured memory_bytes: 3880
input_lines = input().split()
a = int(input_lines[0])
b = int(input_lines[1])
c = int(input_lines[2])
d = int(input_lines[3])

flag = 0
if abs(c - a) > d:
    if abs(b - a) > d or abs(c - b) > d:
        flag = 1

if flag == 0:
    print("Yes")
else:
    print("No")


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

using namespace std;

int main()
{
    string S;
    cin>>S;
    S.push_back('R');
    int r=1,l=0,C=0;
    int Cr=0,Cl=0;
    vector<int>ans(S.size()+1,0);
    for(int i=0;i<S.size();i++){
        if(S.at(i)=='L'&&Cl==0){
            Cr=0;
            Cl=1;
            C=i;
        }
        if(Cr==1){
            r++;
        }
        if(S.at(i)=='R'){
            Cr=1;
            if(Cl==1){
                if(i!=0){
                   
                    ans[C]=r/2+r%2+l/2;
                    ans[C-1]=r/2+l%2+l/2;
                    if((r+l)%2!=0){
                        swap(ans[C],ans[C-1]);
                    }
                }
                Cr=1;
                Cl=0;
                r=1;
                l=0;
            }
        }
        if(Cl==1){
            l++;
        }
    }
    for(int i=0;i<S.size()-1;i++){
        cout<<ans[i]<<" ";
    }
}

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

int main() {
    ll a,b,c,d;

    cin >> a >> b >> c >> d;

    ll x,y;

    x = max(a*c,a*d);
    y = max(b*c,b*d);
    ll ans = max(x,y);

    cout << ans << endl;
    
}

Measured memory_bytes: 3632
#include <iostream>

using namespace std;

int main()
{
   int a, b, c, i, ans;
   cin >> a >> b >> c;
   ans = 0; 
   for(i=a; i<=b; i++)
   {
        if( c % i == 0 )
          ans = ans+1;
       
   }
   cout << ans << endl;
   
}


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

int main() {
  int N;
  cin>>N;
  vector<int> v(N);
  for(int i=0;i<N;i++){
    cin>>v.at(i);
  }
  sort(v.begin(),v.end());
  int sumA=0,sumB=0;
  for(int i=0;i<N;i+=2){
    sumA+=v.at(i);
  }
  for(int i=1;i<N;i+=2){
    sumB+=v.at(i);
  }
  if(sumA>=sumB)cout<<sumA-sumB<<endl;
  else cout<<sumB-sumA<<endl;
}


Measured memory_bytes: 256
x,n = map(int,input().split())

p = list(map(int,input().split()))

#if x in p == False:
    #print(x)


for i in range(101):
    if ((x-i) in p) == False:
        print(x-i)
        break
    elif ((x+i) in p) ==False:
        print(x+i)
        break

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

int main() {
  long long n,x; cin>>n;
  int c=1;
  long double t=sqrt(n);
  x=t;
  while(c==1){
    if(n%x==0){
      long long y=n/x;
      cout<<x+y-2<<endl;
      c=0;
    }
    x-=1;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
#define FI(i, a, b) for (int i = (a); i <= (b); ++i)
#define FD(i, b, a) for (int i = (b); i >= (a); --i)
#define DEBUG(x) cerr << #x << ": " << (x) << endl;
 
int main() {
  int n, m, v, p;
  cin >> n >> m >> v >> p;
  vector<ll> a(n), s(n);
  for (int i = 0; i < n; ++i) scanf("%lld", &a[i]);
  sort(a.begin(), a.end(), greater<ll>());
  partial_sum(a.begin(), a.end(), s.begin());
  int ans = p;
  for (int i = p; i < n; ++i) {
    ll x = a[i];
    ll y = x + m;
    if (y < a[p - 1]) break;
    int w = v - (p - 1) - (n - i - 1);
    ll max_val = y * (i - p + 2);
    ll sum = s[i] - (p == 1 ? 0 : s[p - 2]);
    if (max_val - sum >= 1ll * w * m) ++ans;
    else break;
  }
  printf("%d\n", ans);
}


Measured memory_bytes: 1920
#include <iostream>
#include <iomanip>

using namespace std;

int main(void)
{
    unsigned int a, b, d, r;
    double f;

    cin >> a >> b;
    
    d = a / b;
    r = a % b;
    f = (double)a / b;

    cout << d << " " << r << " " << fixed << setprecision(6) << f << endl;
}


Measured memory_bytes: 3268
#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
using str = string;
using P = pair<int, int>;
using Pll = pair<ll, ll>;
const double PI = 3.141592653589793238;
const ll mod = 1000000007;
#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define REP(i, m, n) for (int i = m; i < (int)n; i++)
#define all(a) (a).begin(), (a).end()
#define allg(a) (a).begin(), (a).end(), greator<>()
#define d20 std::setprecision(20)
#define veci vector<int>
#define vecll vector<long long int>
#define vecb vector<bool>
#define vecd vector<double>
template <typename T>
T lcm(T a, T b)
{
	return a / __gcd(a, b) * b;
}

int main()
{
	int n;
	cin >> n;
	vecll a(n);
	rep(i, n) cin >> a[i];
	ll ans = INT_MAX;
	rep(i, n - 1)
	{
		ans = min(ans, __gcd(a[i], a[i + 1]));
	}
	cout
		<< ans << endl;
	return 0;
}

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

#ifndef ONLINE_JUDGE
    #define gc getchar
    #define pc putchar
#else
    #define gc getchar_unlocked
    #define pc putchar_unlocked
#endif

using namespace std;

#define vi vector<int>
#define si set<int>
#define vs vector<string>
#define pii pair<int,int>
#define vpi vector<pii>
#define pri priority_queue<int>
#define rev_pri priority_queue<int,vector<int>,greater<int> >
#define mpi map<int,int>
#define i64 long long int
#define endl '\n'
#define pi acos(-1)
#define all(v) v.begin(),v.end()
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define inf INT_MAX/2
#define infll LLONG_MAX/3
#define For(i,n) for(int i=0;i<n;i++)
#define Fre(i,a,b) for(int i = a; i < b; i++)
#define sf(n) scanf("%d", &n)
#define sff(a,b) scanf("%d %d", &a, &b)
#define sfff(a,b,c) scanf("%d %d %d", &a, &b, &c)
#define pfn(n) printf("%d\n", n)
#define pfs(n) printf("%d ", n)
#define eps 1e-8
#define ff first
#define ss second
#define mem(a,b) memset(a,b,sizeof(a))
#define READ freopen("in.txt", "r", stdin)
#define WRITE freopen("out.txt", "w", stdout)
#define sz size()
#define dbg(i) printf("yo %d\n", i)
#define foreach(i,c) for(__typeof((c).begin()) i = (c).begin(); i != (c).end(); i++)
#define sqr(a) (a) * (a)
#define clr clear()
#define CASE(a) printf("Case %d: ",a)

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


i64 gcd(i64 a,i64 b){if(!b)return a;return gcd(b,a%b);}

//inline void fastRead(int *a){register char c=0;while(c<33)c=gc();*a=0;while(c>33){*a=*a*10+c-'0';c=gc();}}

//inline void fastWrite(int a){char snum[20];int i=0;do{snum[i++]=a%10+48;a=a/10;}while(a!=0);i=i-1;while(i>=0)pc(snum[i--]);pc('\n');}

//i64 bigmod(i64 num,i64 n){if(n==0)return 1;i64 x=bigmod(num,n/2);x=x*x%mod;if(n%2==1)x=x*num%mod;return x;}

//i64 modinverse(i64 num){return bigmod(num,mod-2)%mod;}

//i64 po(i64 a,i64 b){i64 ans=1;while(b--)ans *= a;return ans;}

//i64 ncr(i64 n,i64 r){if(n==r)return 1;if(r==1)return n;if(dp[n][r]!=-1)return dp[n][r];return dp[n][r]=ncr(n-1,r)+ncr(n-1,r-1);}


// bit manipulations

//bool checkbit(int mask,int bit){return mask & (1<<bit);}

//int setbit(int mask,int bit){ return mask  (1<<bit) ; }

//int clearbit(int mask,int bit){return mask & ~(1<<bit);}

//int togglebit(int mask,int bit){return mask ^ (1<<bit);}


i64 lcm(i64 a,i64 b)
{
        return (a/gcd(a,b))*b;
}


int main()
{

        i64 n,inp , ans;

        cin >> n >> ans;
        n--;

        while(n--)
        {
                cin >> inp;
                ans = lcm(ans,inp);
        }

        cout << ans << endl;












        return 0;
}



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

int main()
{
    int h,w,k;
    cin >> h >> w >> k;
    vector<vector<int>> s(h, vector<int>(w, 0));
    rep(i,h) {
        string si;
        cin >> si;
        rep(j,w)
            if(si[j] == '1') s[i][j] = 1;
    }

    vector<bool> cut_h(h-1, false);
    int ans = h+w-2;
    function<void(int)> dfs;
    dfs = [&](int cur){
        if(cur == h-1) {
            int m = 1;
            for(auto ci:cut_h)
                if(ci) ++m;
            vector<int> white_sum(m, 0);
            int cut_cnt = m-1;

            rep(j,w) {
                vector<int> white_sum_j(m, 0);
                int l = 0;
                rep(i,h) {
                    if(s[i][j]) white_sum_j[l]++;
                    if(i<h-1 && cut_h[i]) ++l;
                }

                bool need_cut = false;
                rep(l,m) {
                    if(white_sum_j[l] > k) return;
                    white_sum[l] += white_sum_j[l];
                    if(white_sum[l] > k) need_cut = true;
                }
                    
                if(need_cut) {
                    rep(l,m) white_sum[l] = white_sum_j[l];
                    cut_cnt++;
                }
            }

            ans = min(ans, cut_cnt);
            return;
        }

        dfs(cur+1);
        cut_h[cur] = true;
        dfs(cur+1);
        cut_h[cur] = false;
    };

    dfs(0);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using vb=vector<bool>;
using vvb=vector<vb>;
using pii = pair<int,int>;
using pli = pair<ll,int>;
using pll = pair<ll,ll>;
using vpii = vector<pii>;
using vpli = vector<pli>;
using vpll = vector<pll>;

#define rep(i, n) for(int i=0;i<(int)n;i++)
#define rep2(i, s, n) for(int i=(s);i<(int)n;i++)
int INF=1e9+7;

int main() {
  int N;
  cin >> N;
  vi A(N);
  rep(i,N) cin >> A[i];
  
  vi x(N);
  ll sum=0;
  rep(i,N/2) sum+=A[2*i]-A[2*i+1];
  sum+=A[N-1];
  x[0]=sum/2;
  rep(i,N-1) x[i+1]=A[i]-x[i];
  
  rep(i,N) cout << 2*x[i] << ' ';
  cout << endl;
}

Measured memory_bytes: 4032
#include <algorithm>
#include <iomanip>
#include <iostream>
#include <set>
#include <string>
#include <vector>
#define SORT(a) sort((a).begin(), (a).end())
#define RSORT(a) sort((a).rbegin(), (a).rend())
#define REP(i, n) for (int i = 0; i < n; i++)
#define ALL(a) a.begin(), a.end()
using namespace std;

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

    int a, b;
    cin >> a >> b;

    int ans = a * b - (a + b - 1);

    cout << ans << endl;

    return 0;
}

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

using ll=long long;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  double R;
  cin >> R;
  cout << 2*R*3.141592 <<endl;
}

Measured memory_bytes: 3784
#include<stdio.h>

int main(void){
    int a,b;
  
    scanf("%d %d",&a,&b);
  
    if(a < 10 && b < 10)
    { 
        printf("%d\n",a * b);
    }    
    else
    { 
        printf("-1\n");
    }

    return 0;
}    
    

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll,ll> pll;
const ll mod=1e9+7;
//const ll mod=998244353;
const ll inf=5e18;

int main() {
  ll a,b;
  cin >> a >> b;
  ll tmp=10;
  while(tmp<=b) {
    tmp*=10;
  }
  tmp=a*tmp+b;
  for(ll i=1;i*i<=100100;i++) {
    if(i*i==tmp) {
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <cstring>
#include <map>
#include<vector>
#include<queue>
#include<bits/stdc++.h>
#define debug(x) cout <<#x<<" = "<<x<<endl
#define debug2(x, y) cout<<x<<" "<<y<<endl
#define gg cout <<"---------------QAQ---------------"<<endl
#define fi first
#define SZ(x) (int)x.size()
#define se second
#define pb push_back
#define inf 0x3f3f3f3f3f3f3f3f
#define lson l, m, rt<<1
#define rson m+1, r, rt<<1|1
#define PI acos(-1)
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pii;
typedef pair<pii, ll> Pii;
template<class T> inline void read(T &x){
    x=0; char c=getchar(); int f=1;
    while (!isdigit(c)) {if (c=='-') f=-1; c=getchar();}
    while (isdigit(c)) {x=x*10+c-'0'; c=getchar();} x*=f;
}
const int N = 366666, maxn = 1666666;
void FAST(){ios::sync_with_stdio(false);cin.tie(0);}
const ll mod = 7;

int n, m;

void solve()
{
    string s;
    cin>>s;
    if(s.find('7')==s.npos) puts("No");
    else puts("Yes");
}
int main()
{

//    int _;scanf("%d", &_);while(_--)
//    while(~scanf("%d", &n))
    solve();
	return 0;
}


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

#define ll long long
#define sd(x) scanf("%d", &(x))
#define pii pair<int, int>
#define F first
#define S second

#define TRACE

#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
	cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
	const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

const int N = 100005;

vector<int> con[N];
int deg[N];
int vis[N];
vector<int> vec;
int num = 0;
void dfs(int s){
	vis[s] = 1;
	for(int v : con[s]){
		if(v == vec[1]) num++;
		if(!vis[v]) dfs(v);
	}
}

int main(){
	int n; sd(n);
	int m; sd(m);
	for(int i = 1; i <= m; i++){
		int a, b;
		sd(a); sd(b);
		con[a].push_back(b);
		con[b].push_back(a);
		deg[a]++;
		deg[b]++;
	}
	for(int i = 1; i <= n; i++) if(deg[i] & 1){
		printf("No\n");
		return 0;
	}

	for(int i = 1; i <= n; i++){
		// trace(i, deg[i]);
		if(deg[i] > 4){
			printf("Yes\n");
			return 0;
		} else if(deg[i] == 4) vec.push_back(i);
	}

	if((int)vec.size() < 2){
		printf("No\n");
		return 0;
	}

	if((int)vec.size() > 2){
		printf("Yes\n");
		return 0;
	}
	assert((int)vec.size() == 2);
	vis[vec[1]] = 1;
	dfs(vec[0]);
	// trace(num, vec[0], vec[1]);
	printf(num == 4 ? "No\n" : "Yes\n");

}

Measured memory_bytes: 7296
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;

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

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

// Self settings
// clang-format off
#define MAX_N 3000
#define REP(i, N) for (int i = 0; i < (int)(N); ++i)
#define SLN(i,N) (i == N-1 ? "\n" : " ")
ll gcd(ll a,ll b){if(b==0)return a;return gcd(b,a%b);}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
const ll MOD = 1e9+7;
const ll INF = 1LL << 60;
const int inf = 1 << 31;
// clang-format on

int N;
ll a[MAX_N];

int main(void)
{
  cin >> N;
  REP(i, N) cin >> a[i];

  ll f = 0;
  REP(i, N) f += (a[i] - 1);
  cout << f << endl;

  return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
  
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        Deque<Integer> deq = new ArrayDeque<>();
        for (int i = 0; i < N; i++) {
            if (i%2 == 0) {
                deq.addLast(sc.nextInt());
            } else {
                deq.addFirst(sc.nextInt());
            }            
        }
        StringBuilder sb = new StringBuilder();
        if (N%2 == 0) {
            while (!deq.isEmpty()) {
                sb.append(deq.pollFirst() + " ");
            }
        } else {
            while (!deq.isEmpty()) {
                sb.append(deq.pollLast() + " ");
            }
        }
        System.out.println(sb);
    }
}


Measured memory_bytes: 66172
import std.conv, std.functional, std.range, std.stdio, std.string;
import std.algorithm, std.array, std.bigint, std.bitmanip, std.complex, std.container, std.math, std.mathspecial, std.numeric, std.regex, std.typecons;
import core.bitop;

class EOFException : Throwable { this() { super("EOF"); } }
string[] tokens;
string readToken() { for (; tokens.empty; ) { if (stdin.eof) { throw new EOFException; } tokens = readln.split; } auto token = tokens.front; tokens.popFront; return token; }
int readInt() { return readToken.to!int; }
long readLong() { return readToken.to!long; }
real readReal() { return readToken.to!real; }

bool chmin(T)(ref T t, in T f) { if (t > f) { t = f; return true; } else { return false; } }
bool chmax(T)(ref T t, in T f) { if (t < f) { t = f; return true; } else { return false; } }

int binarySearch(alias pred, T)(in T[] as) { int lo = -1, hi = cast(int)(as.length); for (; lo + 1 < hi; ) { const mid = (lo + hi) >> 1; (unaryFun!pred(as[mid]) ? hi : lo) = mid; } return hi; }
int lowerBound(T)(in T[] as, T val) { return as.binarySearch!(a => (a >= val)); }
int upperBound(T)(in T[] as, T val) { return as.binarySearch!(a => (a > val)); }




void main() {
  try {
    for (; ; ) {
      const m1 = readInt();
      const d1 = readInt();
      const m2 = readInt();
      const d2 = readInt();
      writeln((m1 != m2) ? 1 : 0);
    }
  } catch (EOFException e) {
  }
}


Measured memory_bytes: 256
mod = 10**9+7

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

#N!をmodで割った余りを前計算(Mまで)
R = [1]*(M+1)
for i in range(2,M+1):
    R[i] = R[i-1]*i
    R[i] %= mod

ans = 0

for k in range(N+1):
    a = (-1)**k
    a *= R[N]*R[M]*R[M-k]
    a %= mod
    a *= pow(R[k],mod-2,mod)
    a *= pow(R[N-k],mod-2,mod)
    a %= mod
    a *= (pow(R[M-N],mod-2,mod))**2
    a %= mod
    ans += a

print(ans%mod)


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

void Main() {
  int n, k;
  cin >> n >> k;
  int ans = 0;
  while (n > 0) {
    n /= k;
    ans++;
  }
  cout << ans << endl;
}

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


Measured memory_bytes: 256
n=int(input())
a=list(map(int,input().split()))

if n//2==1:
    print(max(a))
    exit()

if n%2==0:
    

    #iは桁数、jはそれまでに余計に飛ばした数
    #dp[i][j]
    dp=[[-10**9]*2 for _ in range(n)]

    for i in range(n):
        if i<2:
            dp[i][0]=a[i]

        if i>=2:
            dp[i][0]=dp[i-2][0]+a[i]
        
        if i>=3:
            dp[i][1]=max(dp[i-2][1]+a[i],dp[i-3][0]+a[i])

    #print(dp)
    print(max([dp[-1][1],dp[-1][0],dp[n-2][0]]))
    

else:
    

    #iは桁数、jはそれまでに余計に飛ばした数
    #dp[i][j]
    dp=[[-10**9]*3 for _ in range(n)]

    for i in range(n):
        if i<2:
            dp[i][0]=a[i]

        if i>=2:
            dp[i][0]=dp[i-2][0]+a[i]
        
        if i>=3:
            dp[i][1]=max(dp[i-2][1]+a[i],dp[i-3][0]+a[i])
            
        if i>=4:
            dp[i][2]=max([dp[i-2][2]+a[i],dp[i-3][1]+a[i],dp[i-4][0]+a[i]])
    #print(dp)
    print(max([dp[-1][2],dp[-1][1],dp[-1][0]-a[0],dp[-1][0]-a[-1]]))


Measured memory_bytes: 131752
#include<iostream>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

const int inf = 999999999;
const double pi = acos(-1);

#define rep(i,m,n) for(int i = (m); i < (n); i++)
#define mod(i) (i%(ll)(1e9 + 7))


int main(){
	int n,ans = 0;;
	cin >> n;
	rep(i,1,n+1)ans += i;
	cout << ans <<endl;
	
	return 0;
}

Measured memory_bytes: 256
import math
import sys
sys.setrecursionlimit(10**9)

def main():
    N,M,X = map(int,input().split())
    book = [[] for _ in range(N)]
    for i in range(N):
        book[i] = list(map(int,input().split()))

    INF = 10**20
    ans = INF
    for i in range(2**N):
        cost = 0
        algs = [0]*M
        for j in range(N):
            if (i >> j) & 1:
                cost += book[j][0]
                for k in range(M):
                    algs[k] += book[j][k+1]

        ng = False
        for alg in algs:
            if alg < X:
                ng = True

        if not ng:
            ans = min(ans,cost)

    if ans == INF:
        print(-1)
    else:
        print(ans)


if __name__ == "__main__":
  main()


Measured memory_bytes: 68216
#include <iostream>
#include <algorithm>
#include <string>
#include <math.h>
#include <bitset>
#include <vector>
#include <queue>
#include <map>
#include <set>

#define i64 int64_t
#define ff(ii,nn,mm) for(int ii=nn;ii<mm;ii++)
#define st(vvv) sort(vvv.begin(),vvv.end())
#define rvs(vvv) reverse(vvv.begin(),vvv.end())
int inf = 1000000007;
i64 giant = 4000000000000000000;

using namespace std;



int main() {
	int n;
	cin >> n;
	if (n == 2) {
		cout << 2 << endl;
		return 0;
	}
	ff(i, n, n + 1000) {
		int a = 0;
		ff(j, 2, sqrt(i) + 1) {
			if (i % j == 0) {
				break;
			}
			if (j > sqrt(i)) {
				a=1;
				break;
			}
		}
		if (a==1) {
			cout << i << endl;
			return 0;
		}
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
	long long A, B, V, W, T;
	cin >> A >> V;
	cin >> B >> W;
	cin >> T;

	bool Y = true;
	if (A > B) {
		Y = B - T*W >= A - T*V ? true : false;
	} else {
		Y = A + T*V >= B + T*W ? true : false;
	}

	cout << (Y ? "YES" : "NO") << endl;
}


Measured memory_bytes: 3036
#include <iostream>
#include <cmath>
#include <vector>
#include <iomanip>
using namespace std;
using ll = long long;

const long double PI = acos(-1);
const int MOD = 1e9 + 7;

int main() {
    ll n, k;
    ll r, s, p;
    string t;
    cin >> n >> k >> r >> s >> p >> t;

    // 剰余類
    vector<string> rem(k);

    ll ans = 0;
    for(ll i = 0; i < n; i++) {
        rem[i%k].push_back(t[i]);
        /*
        if(t[i] == 'r') ans += p;
        if(t[i] == 's') ans += r;
        if(t[i] == 'p') ans += s;
         */
    }

    /*
    for(int i = 0; i < k; i++) {
        cout << rem[i] << endl;
    }
     */

    for(int i = 0; i < k; i++) {
        int size = rem[i].size();
        ll cnt = 1;
        for(int j = 0; j < size - 1; j++) {
            if(rem[i][j] == rem[i][j + 1]) {
                cnt++;
            } else {
                if(rem[i][j] == 'r') {
                    ans += p * ((cnt + 1) / 2);
                    // cout << i << ": get " << (cnt + 1) / 2 << " times by paper." << endl;
                }
                if(rem[i][j] == 's') {
                    ans += r * ((cnt + 1) / 2);
                    // cout << i << ": get " << (cnt + 1) / 2 << " times by rock." << endl;
                }
                if(rem[i][j] == 'p') {
                    ans += s * ((cnt + 1) / 2);
                    // cout << i << ": get " << (cnt + 1) / 2 << " times by sessor." << endl;
                }
                cnt = 1;
            }
        }
        if(rem[i][size-1] == 'r') {
            ans += p * ((cnt + 1) / 2);
            // cout << i << ": get " << (cnt + 1) / 2 << " times by paper." << endl;
        }
        if(rem[i][size-1] == 's') {
            ans += r * ((cnt + 1) / 2);
            // cout << i << ": get " << (cnt + 1) / 2 << " times by rock." << endl;
        }
        if(rem[i][size-1] == 'p') {
            ans += s * ((cnt + 1) / 2);
            // cout << i << ": get " << (cnt + 1) / 2 << " times by sessor." << endl;
        }
    }

    std::cout << ans << endl;

    return 0;
}

Measured memory_bytes: 5120
#include <iostream>
#include <algorithm>
#include<math.h>
using namespace std;
int main(){
  /*
  int a,b;
  cin>>a>>b;
  if(a>8||b>8){
    cout<<":("<<endl;
  }
  else{
    cout<<"Yay!"<<endl;
  }
  */
  int a,b,tmp1,tmp2=0;
  cin>>a>>b;
  /*
  int i=0,check=0;
  while(1){
    i++;
    if((i%100)%100==0&&(i/100)/100!=0){
      check++;
    }
    if(check==b){
      cout<<i<<endl;
      break;
    }
  }
  */
  if(b==100&&a==0){
    tmp2=101;
  }
  else if(b==100&&a==1){
    tmp2=10100;
  }
  else if(b==100&&a==2){
    tmp2=1010000;
  }
  else{
    tmp1=pow(100,a);
    for(int i=1;i<=b;i++){
        tmp1=pow(100,a);
        tmp2=i*tmp1;
        //cout<<tmp2<<endl;
    }
  }
  cout<<tmp2<<endl;
  /*
  int n;
  cin>>n;
  int a[n];
  for(int i=0;i<n;i++){
    cin>>a[i];
  }
  for(int i=0;i<n;i++){
    if(a[i]%2==0){
    }
  }
  int kisuu[n];
  for(int i=0;i<n;i++){
    if(a[i]%2==0){
      kisuu[i]=0;
    }
    else{
      kisuu[i]=1;
    }
    //cout<<kisuu[i]<<endl;
  }
  for(int i=n;i>0;i--){
    if(kisuu[i]==0){
      a[i]=a[i]/2;
    }
  }
  */
  return 0;
}


Measured memory_bytes: 256
//自称高知能系Vtuberの高井茅乃です。
//Twitter: https://twitter.com/takaichino
//YouTube: https://www.youtube.com/channel/UCTOxnI3eOI_o1HRgzq-LEZw

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

#define INF 1999999999
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define MODA 1000000007 

int main() {
    int ans = 0;
    int tmp;
    int n;
    string s;
    cin >> n >> s;
    REP(i, s.length()){
        cout << (char)('A' + ((s[i] - 'A' + n) % 26));
    }
    cout << endl;
}

Measured memory_bytes: 256
#include<algorithm>
#include<bitset>
#include<cmath>
#include<complex>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>

using namespace std;
typedef long long ll;

#define REP(i, n) for(ll i=0;i<(ll)(n);i++)
#define RREP(i, n) for(ll i=(ll)(n-1);i>=0;i--)
#define FOR(i, a, b) for(ll i=(ll)(a); i<=(ll)(b); i++)
#define RFOR(i, a, b) for(ll i=(ll)(a);i>=(ll)(b); i--)
#define ALL(x) (x).begin(),(x).end()
#define SIZE(x) ((ll)(x).size())
#define INF 1000000000000
#define MOD 10000007
#define PB push_back
#define MP make_pair
#define F first
#define S second

int c[7][7];

signed main()
{
	int H, W, K;
	cin >> H >> W >> K;
	int ans = 0;
	REP(i, H){
		REP(k, W){
			char tmp;
			cin >> tmp;
			if(tmp == '#'){
				c[i][k] = 1;
			}else{
				c[i][k] = 0;
			}
		}
	}
	int maxbit = pow(2, H+W);
	for(int i=0; i<maxbit; i++){
		bool Hmask[7] = {true, true, true, true, true, true, true};
		bool Wmask[7] = {true, true, true, true, true, true, true};
		int tmp = i;

		for(int k=0; k<W; k++){
			if(tmp %2 == 1){
				Wmask[k] = false;
			}
			tmp /= 2;
		}

		for(int k=0; k<H; k++){
			if(tmp %2 == 1){
				Hmask[k] = false;
			}
			tmp /= 2;
		}
		int ktmp = 0;

		REP(h, H){
			REP(w, W){
				bool tmptmp = (Hmask[h] and Wmask[w]) and (c[h][w] == 1);
				if(tmptmp){
					ktmp++;
				}
			}
		}

		if(ktmp == K){
			ans++;
		}

	}
	cout << ans << endl;
}


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

#define debug(a) cout << #a << " " << a << endl;
#define _debug(a, i) cout << #a << "[" << i << "]" << " = " << a[i] << endl;
#define fastio ios_base::sync_with_stdio(false); \
		cin.tie(0);							     \
		cout.tie(0);
#define sz(arr) (int)arr.size()

using namespace std;
using ll = long long;
const ll MOD = 998244353;
const ll INF = 1e9 + 9;
const double PI = 4.0 * atan(1.0);

ll powmod(ll a, ll b,const ll MOD) { ll res = 1; a %= MOD; assert(b >= 0); for (; b; b >>= 1) { if (b & 1)res = res * a % MOD; a = a * a % MOD; } return res; }
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll modInverse(ll n, const ll p) { return powmod(n, p - 2, p);}


ll dp[200005];


int main() {
	
		//  ======= FAST I/O =========
	fastio;
	//  ==========================
	int n;
	cin >> n;
	cout << (n + 1) / 2;
	
	
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;


int main()
{
    int K;
    string S;
    cin >> K >> S;

    if(S.size() <= K){
        cout << S << endl;
    }else{
        for(int i = 0;i < K;i ++){
            cout << S.at(i);
        }
        cout << "..." << endl;
    }
    return 0;
    

}

Measured memory_bytes: 3128
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;

class Program
{
    static void Main(string[] args)
    {
        long A = long.Parse(Console.ReadLine());
        long B = long.Parse(Console.ReadLine());
        long C = long.Parse(Console.ReadLine());
        long X = long.Parse(Console.ReadLine());
        long ans = 0;
        for (long i = 0; i <= A; i++)
        {
            for (long j = 0; j <= B; j++)
            {
                if (i * 500 + j * 100 <= X && (X - (i * 500 + j * 100)) / 50 <= C)
                {
                    ans++;
                }
            }
        }
        Console.WriteLine(ans);
    }
}

Measured memory_bytes: 13140
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
#define rep(i,n) for (int i=0; i<(n); i++)
#define reps(i,s,n) for (int i=(s); i<(n); i++)
#define rep1(i,n) for (int i=1; i<=(n); i++)
#define repr(i,s,n) for (int i=(s)-1; i>=(n); i--)
#define print(a) cout << (a) << endl
#define all(v) v.begin(), v.end()
#define rsort(v) sort(v.rbegin(), v.rend())


int main() {
  int N;
  cin >> N;
  vector<ll> A(N+1);
  rep(i,N) {
    cin >> A[i];
  }
  A[N] = 0;
  ll ans = 1000, m = 0, cnt = 0;
  rep(i,N) {
    if (cnt != 0) {
      if (A[i]>A[i+1]) {
        ans += (A[i]-m)*cnt;
        cnt = 0;
      }
    } else {
      if (A[i]<A[i+1]) {
        cnt = ans/A[i];
        m = A[i];
      }
    }
  }
  print(ans);
  return 0;
}

Measured memory_bytes: 3616
from math import ceil
n = int(input())
num = list(map(int, input().split()))

sol = 10 ** 15
for i in range(-100, 101):
	tmp = 0
	for j in range(n):
		tmp += (num[j] - i) ** 2  
	sol = min(sol, tmp)
print(int(sol))

Measured memory_bytes: 3060
<?php

fscanf(STDIN, "%d%d", $m, $d);

if($d < 10){
    echo 0;
    exit;
}
$ans =0;
for($i=11; $i <= $d; $i++){
    $one = ($i % 10);
    $ten = intdiv($i, 10);
    if($one < 2|| $ten < 2){
        continue;
    }
    $today = $one * $ten;
    for($j =1; $j<=$m;$j++){
        if($today == $j){
            $ans++;
        }

    }
}

echo $ans;

Measured memory_bytes: 4728
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  int l, r;
  int total = 0;
  for (int i = 0; i < N; i++){
    cin>>l>>r;
    total += (r-l)+1;
  }
  cout << total << endl;
}

Measured memory_bytes: 256
<?php
fscanf(STDIN, "%s", $s);
fscanf(STDIN, "%s", $t);
$sarr = str_split($s);
$tarr = str_split($t);
$answer = 0;
for($i = 0; $i < 3; $i++){
     if($sarr[$i] === $tarr[$i]){
    $answer++;
     }
}
  echo $answer;
?>

Measured memory_bytes: 4604
package main

import "fmt"

// 図形

func main() {
	var w, h, x, y float64
	fmt.Scan(&w, &h, &x, &y)
	// どっちが小さいか
	num := 0
	if w==x*2 && h==y*2 {
		num = 1
	}
	fmt.Println(w*h/2, num)

}


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

int main() {
    int input, n, a, sum = 0;
    cin >> input;
    n = input;
    while (n >= 1) {
        a = n % 10;
        if (n / 10 < 1) {
            sum += n;
        } else {
            sum += a;
        }
        n /= 10;
    }
    if (input % sum == 0) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 384
// ヒント：最小公倍数 - 1

#include <bits/stdc++.h>

using namespace std;

int main() {
  int N;
  long ans = 0;
  
  cin >> N;
  
  for (int i = 0; i < N; i++) {
    int in;
    
    cin >> in;
    
    ans += in - 1;
  }
  
  cout << ans << endl;
  
  return 0;
}

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

using namespace std;

bool a[1000000];

int main()
{
    memset(a, true, sizeof(a));

    for (int i = 2; i < 1000000; i += 1 + (i & 1)) {
        if (!a[i]) continue;
        for (int j = i*2; j < 1000000; j += i) a[j] = false;
    }

    int n;
    while (~scanf("%d", &n)) {
        int cnt = 0;
        for (int i = 2; i <= n; ++i) cnt += a[i];
        printf("%d\n", cnt);
    }
}

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

using namespace std;

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

#ifdef DBG
#define log(item) cout << #item << " " << item << endl
#define loga(array, val) cout << #array << "[" << val << "] " << array [ val ] << endl
#else
#define log(item)
#define loga(array, val)
#endif

int gcd(int number1,int number2){
	int m = number1;
	int n = number2;

	if(number2 > number1){
		m = number2;
		n = number1;
	}

	while(m != n){
		int temp = n;
		n = m - n;
		m = temp;
	}

	return m;
}
int lcm(int number1,int number2){
	return number1 * number2 / gcd(number1,number2);	
}

//--------------------


signed main()
{
    int A, B;
    cin >> A >> B;
    
    cout << max(A - B, max(A + B, A * B)) << endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    int k,i,j,l,m,st;
    scanf("%d",&k);
    int u=0;
    for(i=1;i<=k;i++)
    {
        for(j=1;j<=k;j++)
        {
            for(l=1;l<=k;l++)
            {
                st=i<j?(i<l?i:l):(j<l?j:l);
                for (m=st;m>=1;m--)
                {
                    if (i%m==0&&j%m==0&&l%m==0)
                    {
                        u=u+m;
                        break;
                    }
                }
            }
        }
    }

    printf("%d",u);

}

Measured memory_bytes: 2152
import java.util.*;
import java.io.*;

public class Main {
    public static void main(String[] args) throws Exception {

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
        
        int r = Integer.parseInt(br.readLine());
        
        out.println(r * r);
        out.close();
        
    }
}

Measured memory_bytes: 32864
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repr(i, a, b) for(int i = a; i >= b; i--)
#define int long long
#define all(a) a.begin(), a.end()
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e15;

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, ans = 0;
    cin >> n;
    int a = 4, b = 7;
    rep(i, 0, n){
        rep(j, 0, n){
            if(a * i + b * j == n) ans++;
        }
    }
    if(ans) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String[] w  = sc.next().split("");
		if(w.length %2 !=0) {
			System.out.println("No");
			return;
		}
		Arrays.sort(w);
		int count = 1;
		String compare = w[0];
		for(int i =1;i <w.length;i++) {
			if(!compare.equals(w[i])) {
				if(count %2 !=0) {
					System.out.println("No");
					return;
				}
				compare = w[i];
				count =1;
			}else {
				count++;
			}
			if(i == w.length-1) {
				if(count %2 !=0) {
					System.out.println("No");
					return;
				}
			}
		}
		System.out.println("Yes");
	}
}

Measured memory_bytes: 23892
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader r = new BufferedReader(new InputStreamReader(System.in));
		int n = readInt(r);
		String[] numArrayStr = r.readLine().split(" ");

		List<Card> cardListBubble = makeCardList(numArrayStr);
		bubbleSort(cardListBubble);
		String[] cardArrayBubble = listToArray(cardListBubble);
		printBlank(cardArrayBubble);
		System.out.println("Stable");


		List<Card> cardListSlect = makeCardList(numArrayStr);
		selectSort(cardListSlect);
		String[] cardArraySlect = listToArray(cardListSlect);
		printBlank(cardArraySlect);

		if(compareAry(cardArrayBubble,cardArraySlect)){
			System.out.println("Stable");
		}else{
			System.out.println("Not stable");
		}
	}

	public static boolean compareAry(String[] cardArrayBubble,String[] cardArraySlect){
		for(int i = 0 ; i < cardArrayBubble.length; i++){
			if(!cardArrayBubble[i].equals(cardArraySlect[i])){
				return false;
			}
		}
		return true;
	}

	public static int readInt(BufferedReader r) throws Exception{
        return Integer.parseInt(r.readLine());
    }

	public static List<Card> makeCardList(String[] numArrayStr){
		List<Card> cardList = new ArrayList<>();
		for(int i = 0; i < numArrayStr.length; i++){
			Card card = new Card(numArrayStr[i].substring(0,1),
					Integer.parseInt(numArrayStr[i].substring(1)));
			cardList.add(card);
		}
		return cardList;
	}

	public static String[] listToArray(List<Card> cardList){
		String[] cardArray = new String[cardList.size()];
		for(int i = 0; i < cardList.size(); i++){
			cardArray[i] = cardList.get(i).c + String.valueOf(cardList.get(i).num);
		}
		return cardArray;
	}

	public static void printBlank(String[] numArrayStr){
		StringBuilder builder = new StringBuilder();
		for(int i = 0; i < numArrayStr.length; i++){
			builder.append(numArrayStr[i]);
			builder.append(" ");
		}

		System.out.println(builder.toString().trim());
	}


	public static void bubbleSort(List<Card> cardListBubble){
		boolean flag = true;
		while(flag){
			flag = false;
			for(int i = cardListBubble.size() - 1; i > 0 ; i-- ){
				if(cardListBubble.get(i).num < cardListBubble.get(i - 1).num){
					Card tempCard = cardListBubble.get(i);
					cardListBubble.set(i,cardListBubble.get(i - 1));
					cardListBubble.set(i - 1,tempCard);
					flag = true;
				}
			}
		}
	}

	public static void selectSort(List<Card> cardListSlect){
		for(int i = 0 ; i < cardListSlect.size(); i++){
			int miny = i;
			for(int y = i; y < cardListSlect.size() ; y++){
				if(cardListSlect.get(y).num < cardListSlect.get(miny).num){
					miny = y;
				}
			}
			if(miny != i){
				Card tempCard = cardListSlect.get(i);
				cardListSlect.set(i,cardListSlect.get(miny));
				cardListSlect.set(miny,tempCard);
			}
		}
	}


}

class Card{
	Card(String c,int num){
		this.c = c;
		this.num = num;
	}
	String c;
	int num;
}

Measured memory_bytes: 24420
import sys
import  math
import fractions
from collections import defaultdict
stdin = sys.stdin
     
ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))


N,D=nm()
ans=0
for i in range(N):
    X,Y=nm()
    if((X*X+Y*Y)<=(D*D)):
        ans+=1

print(ans)

Measured memory_bytes: 10468
A, B, C = map(int, input().split())
ABC = sorted([A,B,C])
X, Y = ABC[2]-ABC[0], ABC[2]-ABC[1]
ans = 0
ans += X//2 + Y//2
if X%2 == 1 and Y%2 == 1:
  ans += 1
elif (X%2 == 0 and Y%2 == 1) or (X%2 == 1 and Y%2 == 0):
  ans += 2
print(ans)

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

int main()
{
  int64_t N ;
  cin>>N ;
  
  if(N%2!=0) cout<<0<<endl ;
  else{
    int64_t D=10 ;
    int64_t ans=N/D ;
    while(D*5<=N){
      D*=5 ;
      ans+=N/D ;
    }
    cout<<ans<<endl ;
  }
  
  return 0 ;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
using namespace std;

// 入力
int N, M;
vector<vector<int>> G; // グラフ

// メモ化再帰
int dp[100100];
int rec(int v) {
    if (dp[v] != -1) return dp[v]; // 既に更新済み

    int res = 0;
    for (auto nv : G[v]) {
        chmax(res, rec(nv) + 1);
    }
    return dp[v] = res; // メモしながらリターン
}


int main() {
    // 入力受け取り
    cin >> N >> M;
    G.assign(N, vector<int>());
    rep(i,M) {
        int x, y; cin >> x >> y;
        --x, --y; // 0-indexed にする
        G[x].push_back(y);
    }

    // 初期化
    rep(v,N) dp[v] = -1;

    // 全ノードを一通り更新しながら答えを求める
    int res = 0;
    rep(v,N) chmax(res, rec(v));
    cout << res << endl;
}


Measured memory_bytes: 8192