akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
 
int main(){
    int k, a, b;
    cin >> k >> a >> b;
    for(int i = a;i <= b;i++){
        if(i % k == 0){
            cout << "OK" << endl;
            break;
        }
        if(i == b){
            cout << "NG" << endl;
        }
    }  

    return 0;
}

Measured memory_bytes: 3608
#include<iostream>
using namespace std;
int main()
{
    char a[5];
    cin>>a;
    for(int i=0;i<3;i++)
    {
        if(a[i]=='7')
        {
            cout<<"Yes"<<endl;
            return 0;
        }
    }
    cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 3620
class triangle():
    def __init__(self,a,b,c):
        self.a = a
        self.b = b
        self.c = c

    def calc(self):
        a = int(self.a**2)
        b = int(self.b**2)
        c = int(self.c**2)

        if (a+b == c) or (b+c == a) or (a+c == b):
            return True
        else:
            return False

    def print(self):
        ans = self.calc()
        if ans:
            print("YES")
        else:
            print("NO")

def main():
    data = []
    array_size = int(input())

    for i in range(array_size):
        n = input().split()
        a = int(n[0])
        b = int(n[1])
        c = int(n[2])

        data.append(triangle(a,b,c))

    for array in data:
        array.print()

if __name__ == "__main__":
    main()

Measured memory_bytes: 5848
#include <iostream>
#include <iomanip>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>

using namespace std;

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

  int N = S.length();

  vector<char> stack;
  int ct = 0;
  for (int i = 0; i < N; i++) {
    if (stack.size() == 0 || stack.back() == S[i]) {
      stack.push_back(S[i]);
    } else {
      stack.pop_back();
      ct += 2;
    }
  }
  
  cout << ct << endl;

  return 0;
}



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

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

Measured memory_bytes: 256
def isCLKWISE(ph) : return not ((ph[-1][0] - ph[-3][0])*(- ph[-3][1] + ph[-2][1]) - (ph[-2][0] - ph[-3][0])*(- ph[-3][1] + ph[-1][1] ) < 0)
      
def ConvexHullScan(P) :
 P = sorted(P)
 phU = [P[0],P[1]]
 for p in P[2:] :
  phU.append(p)
  if isCLKWISE(phU) : continue
  while(True):
   del phU[-2]
   try:
    if isCLKWISE(phU) : break
   except IndexError : break
 phL = [P[-1],P[-2]]
 for p in P[-3::-1] :
  phL.append(p)
  if isCLKWISE(phL) : continue
  while(True) :
   del phL[-2]
   try:
    if isCLKWISE(phL) : break
   except IndexError : break
 del phL[0]
 del phL[-1]
 ph = phU + phL
 return ph
  
n = range(int(input()))
P = [[int(x) for x in input().split()] for _ in n]
P = ConvexHullScan(P)
P.reverse()
print(len(P))
idx = min([[x[1][1],x[1][0],x[0]] for x in enumerate(P)])[2]
for p in P[idx:] + P[:idx] : print(p[0],p[1])

Measured memory_bytes: 33288
import numpy as np
n = int(input())
A = input()
a = list(map(int,A.split(" ")))
a = np.array(a)
even= a[1::2]
odd= a[0::2]
if n%2 == 0:
    b = np.append(even[::-1],odd)
else:
    b = np.append(odd[::-1],even)
 
import sys
for d in b[:-1]:
    sys.stdout.write(str(d)+ " ")
sys.stdout.write(str(b[-1])+"\n")

Measured memory_bytes: 36088
//#pragma optimization_level 3
//#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include<bits/stdc++.h>
/*
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace __gnu_pbds;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>ordset;
*/

#define fr first
#define sc second
#define vec vector
#define pb push_back
#define pii pair<int, int>
#define fo(x,y) for(int x = 1 ; x <= y ; ++x)
#define fast cin.tie(0);cout.tie(0);cin.sync_with_stdio(0);cout.sync_with_stdio(0);
using namespace std;

typedef long long ll;
typedef unsigned int uint;
const int nmax = 200005;
const ll linf = LLONG_MAX;
const ll mod = 1e9+7;
const int inf = INT_MAX;
#define pll pair<ll,ll>

ll r1, r2, c1 , c2;

ll inv(ll x){
    ll rez = 1;
    ll pw = x;
    for(ll t = 0 ; (1<<t) <= mod - 2; t++){
        if((mod-2)&(1<<t)){
            rez *= pw;
            rez %= mod;
        }
        pw *= pw;
        pw %= mod;
    }
    return rez;
}

ll f(ll x, ll y){
    ll rez = 1;
    for(ll k = 2; k <= x + y ; k++){
        rez *= k;
        rez %= mod;
        ll rv = inv(k);
        if(k <= x){
            rez *= rv;
            rez %= mod;
        }
        if(k <= y){
            rez *= rv;
            rez %= mod;
        }
    }
    assert((rez + mod - 1)%mod <= mod);
    return (rez + mod - 1)%mod;

}


int main(){
    cin >> r1 >> c1 >> r2 >> c2;
    r1++;
    r2++;
    c1++;
    c2++;
    cout << (f(r2,c2)-f(r1-1,c2)-f(r2,c1-1)+f(r1-1,c1-1)+3*mod)%mod<< '\n';

}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main()
{
	int n;
	long int a[51];
	long int b[51];
	int c[51];
	long int d;
	long int countt = 0;
	int e;
	cin >> n;
	for(int i=0;i < n;i++)
	{
		cin >> a[i];
	}
	while(1)
	{
		d = 0;
		e = 1;
		for(int i=0;i < n;i++)
		{
			b[i] = a[i] / n;
			d+=b[i];
			if(b[i] != 0)
			{
				e = 0;
			}
		}
		if(e)
		{
			break;
		}
		for(int i=0;i < n;i++)
		{
			a[i]-=(b[i] * n);
			a[i]+=(d - b[i]);
		}
		countt+=d;
	}
	cout << countt << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <iomanip>
#include <stdio.h>
#include <queue>
#include <string.h>
#include <algorithm>
#define endl '\n'
#define pb push_back
#define mp make_pair
#define LL long long
#define INF 0x3f3f3f3f
#define Inf 1000000000000000000LL
#define F first
#define S second
using namespace std;
typedef pair<int,int>pii;
int n,k;
int a[200010];
double p[200010];
double cur,mx;
int main(){
	cin>>n>>k;
	for(int i=1;i<=n;i++)cin>>a[i],p[i]=(double)(a[i]+1)/2.0;
	for(int i=1;i<=k;i++)cur+=p[i];
	mx=cur;
	for(int i=k+1;i<=n;i++){
		cur+=p[i]-p[i-k];
		mx=max(mx,cur);
	}
	cout<<fixed<<setprecision(10)<<mx<<endl;
	return 0;
}
//expected value!!!

Measured memory_bytes: 2560
#include<bits/stdc++.h>
using namespace std;
#define FastRead ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long int
#define endl '\n'
#define ld long double
#define FOR(i,a,n) for (ll i=(a);i<=(n);++i)
#define RFOR(i,a,n) for (ll i=(n);i>=(a);--i)
#define FI(i,n) for (ll i=0; i<(n); ++i)
#define ZERO(a) memset((a),0,sizeof((a)))
#define MINUS(a) memset((a),-1,sizeof((a)))
#define f first
#define s second
#define pb push_back
#define mk make_pair
#define all(g) g.begin(),g.end()
int fastMax(int x, int y) { return (((y-x)>>(32-1))&(x^y))^y; }
int fastMin(int x, int y) { return (((y-x)>>(32-1))&(x^y))^x; }
 
// I want to be the very best, like no one ever was, I will battle everyday to claim my rightful place
// Not gonna give up until it's over
// #include <ext/pb_ds/assoc_container.hpp> // Common file
// #include <ext/pb_ds/tree_policy.hpp>     // Including tree_order_statistics_node_updat
// using namespace __gnu_pbds;
// typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
 
// I am questioning life and universe and 
// everything else after looking at this

const ll MAXN = 404;
ll a[MAXN],prefix[MAXN];
ll dp[MAXN][MAXN];
ll n;

ll rec(ll s,ll e){
    if(s >= e) return 0;

    ll &ans = dp[s][e];

    if(ans != -1) return ans;

    ans = 1e18;

    FOR(i,s,e-1){
        ll fh = rec(s,i),sh = rec(i+1,e);
        ans = min(ans,fh + prefix[i] - prefix[s-1] + sh + prefix[e] - prefix[i]);
    }

    return ans;
}

void solve(){
    cin>>n;
    FOR(i,1,n) cin>>a[i];

    FOR(i,1,n) prefix[i] = prefix[i-1] + a[i];

    MINUS(dp);
    cout<<rec(1,n)<<endl;
}

signed main(){
 
   FastRead;    
 

    ll t;
    t = 1; 
    // cin>>t;
    FOR(i,1,t){
        // cout<<"Case #"<<i<<": ";
        solve();
    }
}

Measured memory_bytes: 1536
#include <bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < n; i++)
#define REPR(i, n) for(ll i = n - 1; i >= 0; i--)
#define FOR(i, m, n) for(ll i = m; i <= n; i++)
#define FORR(i, m, n) for(ll i = m; i >= n; i--)
#define SORT(v, n) sort(v, v+n)
#define MAX 100000
#define inf 1000000007
using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll, ll>;

int main() {
    //cin高速化
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll a;
    cin >> a;
    a = a%10;

    if(a == 2||a == 4||a == 5||a == 7||a == 9)cout << "hon" <<"\n";
    else if(a == 0||a == 1||a == 6||a == 8)cout << "pon" <<"\n";
    else cout << "bon" <<"\n";
	return 0;
}

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

#define EB emplace_back
#define int long long
#define F first
#define S second
#define N 100005
#define ALL(x) x.begin(),x.end()
#define endl '\n'
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)


using namespace std;


int32_t main()
{
    IOS;

    int tt=1;
    //cin>>tt;
    while(tt--)
    {
        string str;
        cin>>str;
        int qq;
        cin>>qq;
        int flag = 0;
        string ttt = "";
        while (qq--)
        {
            int a;
            cin>>a;
            a -= 1;
            if(a == 0)
            {
                flag ^= 1;
                //		cout<<"reverse"<<endl;
            }
            else
            {
                int f;
                cin>>f;
                f -= 1;
                char c;
                cin>>c;
                if(flag == 1) f ^=1;
                if (f == 0)
                {
                    //		cout<<"front"<<endl;
                    ttt +=c;
                }
                else
                {
                    //			cout<<"back"<<endl;
                    str += c;
                }
            }
        }
        reverse(ALL(ttt));
        ttt += str;
        if(flag == 1) reverse(ALL(ttt));
        cout<<ttt;
    }
    return 0;

}


Measured memory_bytes: 1144
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<queue>
#include<stack>
#include<cassert>
#include<numeric>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
using namespace std;
const int INF = 1001001001;
const long long LINF = 1001002003004005006ll;
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; }
typedef long long ll;
typedef pair<int,int> P;

class UnionFind {
public:
	//親の番号を格納する。親だった場合は-(その集合のサイズ)
	vector<int> Parent;

	//作るときはParentの値を全て-1にする
	//こうすると全てバラバラになる
	UnionFind(int N) {
		Parent = vector<int>(N, -1);
	}

	//Aがどのグループに属しているか調べる
	int root(int A) {
		if (Parent[A] < 0) return A;
		return Parent[A] = root(Parent[A]);
	}

	//自分のいるグループの頂点数を調べる
	int size(int A) {
		return -Parent[root(A)];//親をとってきたい
	}

	//AとBをくっ付ける
	bool connect(int A, int B) {
		//AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
		A = root(A);
		B = root(B);
		if (A == B) {
			//すでにくっついてるからくっ付けない
			return false;
		}

		//大きい方(A)に小さいほう(B)をくっ付けたい
		//大小が逆だったらひっくり返しちゃう。
		if (size(A) < size(B)) swap(A, B);

		//Aのサイズを更新する
		Parent[A] += Parent[B];
		//Bの親をAに変更する
		Parent[B] = A;

		return true;
	}
};
//UnionFind Uni(N);
//Uni.connect;

int main(){
  int n,m;
  cin >> n >> m;
  int a[m],b[m];
  rep(i,m)cin >> a[i] >> b[i];
  rep(i,m)a[i]--,b[i]--;

  UnionFind uni(n);
  rep(i,m)uni.connect(a[i],b[i]);
  
  int ans = 0;
  rep(i,n){
    chmax(ans,uni.size(i));
  }
  cout << ans << endl;
}

Measured memory_bytes: 5636
#include <bits/stdc++.h>
using namespace std;
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
typedef pair<int, int> P;
typedef pair<int64_t, int64_t> Pll;
  
int main() {
    int N, D, X, ans = 0;
    cin >> N >> D >> X;
    for (int i = 0; i < N; i++) {
        int a;
        cin >> a;
        for (int j = 0; 1 + j * a < D + 1; j++) {
            ans++;
        }
    }
    cout << ans + X << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>

int GetDigit(int n)
{
    int d = 1;
    while(n >= 10){
        n /= 10;
        ++d;
    }
    return d;
}
int main()
{
    while(true){
        int a, b;
        std::cin >> a >> b;
        if(std::cin.eof()) break;
        std::cout << GetDigit(a+b) << std::endl;
    }
    return 0;
}

Measured memory_bytes: 3016
#include <bits/stdc++.h>
#define int long long
#define boost() ios_base :: sync_with_stdio(0); cin.tie(); cout.tie(); cout << fixed; cout << setprecision(15); srand(time(NULL))
#define all(x) x.begin(), x.end()
using namespace std;

const int mod = (int)1e9 + 7;
int n, k, res = 0;
int a[2010];
int x[2010];
int y[2010];

int add (int i, int j) {
  return (i + j) % mod;
}

int mul (int i, int j) {
  return (i * j) % mod;
}

signed main () {
  cin >> n >> k;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      if (a[i] > a[j]) {
        x[i]++;
        y[i] += (i < j);
      }
    }
    // cout << x[i] << " " << y[i] << endl;
  }
  for (int i = 0; i < n; i++) {
    // res = res + x[i] * k * (k - 1) / 2 + y[i] * k;
    int sum = (k  * (k - 1) / 2) % mod;
    res = add (res, mul (x[i], sum));
    res = add (res, mul (y[i], k));
    // cout << res << endl;
  }
  cout << res << endl;
  return 0;
} 

Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
	int d,m1,m2,m3,i;
	  m1=0;
	  m2=0;
	  m3=0;
	for(i=0;i<10;i++){
	 scanf("%d",&d);
	 if(d>m1){
	  m3=m2;
 	  m2=m1;
	  m1=d;
        }else if(d>m2){
	  m3=m2;
	  m2=d;
	}else if(d>m3){
	  m3=d;
	 }
        }
	printf("%d\n%d\n%d\n",m1,m2,m3);
	return 0;
}

Measured memory_bytes: 600
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        if (scanner.hasNextLine()) {
            String[] array = scanner.nextLine().split(" ");
            int N = Integer.parseInt(array[0]);
            int M = Integer.parseInt(array[1]);
            int X = Integer.parseInt(array[2]);

            String[] Ms = scanner.nextLine().split(" ");
            int count = 0;
            while (count < M) {
                if (Integer.parseInt(Ms[count]) < X) {
                    ++count;
                } else {
                    break;
                }
            }
            if (count > M - count) {
                count = M - count;
            }
            System.out.println(count);
        }
    }
}

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

long long calcNumTale(long long const& n,long long const& m) {
    if(n == 1 && m == 1) {
        return 1;
    }
    
    if(n == 1) {
        return m - 2;
    } else if(m == 1) {
        return n - 2;
    }
    
    return (n - 2) * (m - 2);
}

int main(int argc, const char * argv[]) {
    long long N, M; cin >> N >> M;
    cout << calcNumTale(N, M) << endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(){
	int a,b;
	int hasil1, hasil2, hasil3;
	scanf("%d", &a);
	if(a<1200){
		printf("ABC\n");
	} else if(a<2800 && a>=1200){
		printf("ARC\n");
	} else {
		printf("AGC\n");
	}
}

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

const int MOD = 998244353;

int A[3003];
int dp[3003][3003];

int solve(int n, int s)
{
    if (n == 0)
        return (s == 0);

    if (dp[n][s] != -1)
        return dp[n][s];
    
    long long ans = solve(n-1, s) * 2LL;

    if (s >= A[n])
        ans += solve(n-1, s - A[n]);

    return dp[n][s] = ans % MOD;
}

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

    int n, s;
    cin >> n >> s;

    for (int i=1; i<=n; i++)
        cin >> A[i];

    memset(dp, -1, sizeof(dp));
    cout << solve(n, s) << "\n";
    return 0;
}


Measured memory_bytes: 38952
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(v) v.begin(),v.end()
#define len(x) (ll)(x).length()
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const int INF=1e9;
const int di[] = {-1,0,1,0};
const int dj[] = {0,-1,0,1};
 
int main(){
  int n;
  cin>>n;
  map<int,int> mp;
  int cnt=0;
  int ans=0;
  int ans2=0;
  rep(i,n){
    int p;
    cin>>p;
    if(1<=p&&p<400) mp[1]++;
    if(400<=p&&p<800) mp[2]++;
    if(800<=p&&p<1200) mp[3]++;
    if(1200<=p&&p<1600) mp[4]++;
    if(1600<=p&&p<2000) mp[5]++;
    if(2000<=p&&p<2400) mp[6]++;
    if(2400<=p&&p<2800) mp[7]++;
    if(2800<=p&&p<3200) mp[8]++;
    if(3200<=p) cnt++;
  }
  ans=mp.size();
  ans2=ans+cnt;
  if(ans==0){
    ans=1;
  }
  cout<<ans<<" "<<ans2<<endl;
}


Measured memory_bytes: 3596
#include <iostream>
using namespace std;
int main(void){
    int N,X,L[100],A,i;
    cin>>N>>X;
    for(i=1;i<=N;i++){cin>>L[i];}
    A=0;
    for(i=1;i<=N;i++){A+L[i];
        
        A=A+L[i];
        if(A>X)break;
        
    }
    cout<<i<<endl;
    
}


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

#define ll long long


int main()
{
	string s;
	cin >> s;

	if (s[0] == s[1] || s[1] == s[2] || s[2] == s[3])
	{
		cout << "Bad" << endl;
	}
	else
	{
		cout << "Good" << endl;
	}
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
	int as,kl,o,n,m,hun,p;
	String op;
	Scanner sc = new Scanner(System.in);
	public void solve() {	
n=sc.nextInt();
m=sc.nextInt();
p=sc.nextInt();
hun=sc.nextInt();
for(o=0;o<hun+1;o++) {
	if(n<m) {
		if(m<p) {
		System.out.println("Yes");
		return;
		}else {
			p=p*2;
			//System.out.println(p);
		}
	}
	if(n>=m) {
		m=m*2;
		//System.out.println(m);
	} 
	
}
System.out.println("No");
	}
	public static void main(String[] args) {
		new Main().solve();
	
	}
}

Measured memory_bytes: 35828
#include<bits/stdc++.h>
using namespace std;
#define INIT  ios_base :: sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define mp make_pair
#define pb push_back
#define ft first
#define sc second
#define ll long long
#define pii pair<int, int>
#define count_bits __builtin_popcount
#define int ll

int t, n, m, k, a[300010], q, l, r, x;
string s;
int32_t main(){
INIT
cin>>s;
int m=0;
int pw=1;
for(int i=((int)s.length()-1); i>=0; i--){
    m=(m+pw*(s[i]-'0') )%9; pw=(pw*10)%9;
}
if(m==0){cout<<"Yes";}
else{cout<<"No";}

return 0;
}





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

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

using ll = long long;
using lb = long double;
using P = pair<ll,ll>;
using graph = vector<vector<ll>>;
using V = vector<ll>;

const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const ll INF = 1LL<<60;
const ll mod = 1000000007LL;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
ll hcnt[300005],wcnt[300005];

int main() {
  ll N;
  cin>>N;
  ll a,b,c;
  rep(i,3501){
    rep(j,3501){
      if(i==0||j==0) continue;
      ll p = N*i*j;
      ll q = 4LL*i*j-N*(i+j);
      if(q<=0) continue;
      if(p%q==0) {
        a=i;
        b=j;
        c=p/q;
        break;
      }
    }
  }
  cout<<a<<" "<<b<<" "<<c<<endl;
}

Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
#define io ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
int main()
{
io
int k;
    string s;
    cin>>k>>s;
    int ls=s.length();
    if (ls<=k)
        cout<<s<<endl;
    else
        cout<<s.substr(0,k)+"...";
}


Measured memory_bytes: 3672
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using namespace std;
using ll=long long;
using ld=long double;
//#define int long long
#define _CRT_SECURE_NO_WARNINGS
#define rep(i, n) for (int i = 0; i < n; i++)
#define _GLIBCXX_DEBUG
#define ALL(x) (x).begin(), (x).end()
const int MOD = 1e9 + 7;
const int INF = 1e18 + 9;
constexpr long double pi = 3.141592653589793238462643383279;
int fact(int i) {
    if (i == 0) return 1;
    return (fact(i - 1)) * i;
}
int gcd(int a, int b) {
    if (b == 0) return a;
    return gcd(b, a % b);
}
int lcm(int a, int b) {
    return a * b / gcd(a, b);
}
int keta(int n) {
    if (n == 0) return 1;
    int count = 0;
    while (n != 0) {
        n /= 10;
        count++;
    }
    return count;
}
int ketasum(int n) {
    int sum = 0;
    while (n != 0) {
        sum += n % 10;
        n /= 10;
    }
    return sum;
}
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;
}
char toSmall(char c) { // 大文字を小文字へ
    return (c + 0x20);
}
char toLarge(char c) { // 小文字を大文字へ
    return (c - 0x20);
}
float myPower(int a, int n) { // aのn乗の計算
    float x = 1;
    while (n > 0) { // 全てのbitが捨てられるまで
        if (n & 1) { // 一番右のbitが１のとき
            x *= a;
        }
        a *= a;
        n >>= 1; // bit全体を右に1つシフトして一番右を捨てる
    }
    return x;
}
bool is_prime(const unsigned n) {
    switch (n) {
    case 0: // fall-through
    case 1: return false;
    case 2: // fall-through
    case 3: return true;
    } // n > 3 が保証された

    if (n % 2 == 0 || n % 3 == 0) return false;
    // n は 2 と 3 のいずれの倍数でもないことが保証された
    // これより n は (6の倍数)-1 か (6の倍数)+1 である
    // 6の倍数前後の数を使って試し割りをする
    for (unsigned i = 5; i * i <= n; i += 6) {
        if (n % i == 0) return false; // (6の倍数)-1
        if (n % (i + 2) == 0) return false; // (6の倍数)+1
    }

    return true;
}
int sum;
int main(void){
    sum = 1;
    int n;
    cin >> n;
    while (n >= sum) {
        sum *= 2;
    }
    cout << sum / 2 << endl;
    return 0;
}

Measured memory_bytes: 3588
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <queue>
#include <array>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <cassert>
#include <utility>
#include <functional>
#include <random>

using namespace std;
using lli = long long int;
template<class T, class U> void init_n(vector<T>& v, size_t n, U x) 
{ v = vector<T>(n, x); }
template<class T> void init_n(vector<T>& v, size_t n) { init_n(v, n, T()); }
template<class T> void read_n(vector<T>& v, size_t n, size_t o = 0)
{ v = vector<T>(n+o); for (lli i=o; i<n+o; ++i) cin >> v[i]; }
template<class T> void read_n(T a[], size_t n, size_t o = 0)
{ for (lli i=o; i<n+o; ++i) cin >> a[i]; }
template<class T> T gabs(const T& x) { return max(x, -x); }
#define abs gabs

lli a, b, q, x[100001];
vector<lli> t, s;
int main() {
  cin >> a >> b >> q;
  read_n(s, a); read_n(t, b); read_n(x, q);

  for (lli i=0; i<q; ++i) {
    lli y = x[i];
    auto its = lower_bound(begin(s), end(s), y);
    auto itt = lower_bound(begin(t), end(t), y);
    lli sl = its==begin(s) ? 1e12 : abs(*(its-1) - y),
        sr = its==end(s) ? 1e12 : abs(*its - y),
        tl = itt==begin(t) ? 1e12 : abs(*(itt-1) - y),
        tr = itt==end(t) ? 1e12 : abs(*itt - y);

    lli a0 = max(sl, tl),
        a1 = max(sr, tr),
        a2 = sl + tr + min(sl, tr),
        a3 = tl + sr + min(tl, sr);
    lli ans = min({a0, a1, a2, a3});
    
    cout << ans << '\n';
  }
  return 0;
}


Measured memory_bytes: 3712
package main

import "fmt"

func main() {
	var nPairs int
	fmt.Scanln(&nPairs)

	var a, b string
	for i := 0; i < nPairs; i++ {
		fmt.Scanln(&a)
		fmt.Scanln(&b)
		fmt.Println(lcsSize(a, b))
	}
}

func lcsSize(sa, sb string) int {
	dp := make([][]int, len(sa)+1)
	for i := 0; i <= len(sa); i++ {
		dp[i] = make([]int, len(sb)+1)
	}

	for a := 1; a <= len(sa); a++ {
		for b := 1; b <= len(sb); b++ {
			if sa[a-1] == sb[b-1] {
				dp[a][b] = dp[a-1][b-1] + 1
			} else {
				dp[a][b] = max(dp[a][b-1], dp[a-1][b])
			}
		}
	}

	return dp[len(sa)][len(sb)]
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}



Measured memory_bytes: 19048
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rng(i, a, b) for (int i = int(a); i < int(b); i++)
#define rep(i, b) rng(i, 0, b)
#define gnr(i, a, b) for (int i = int(b) - 1; i >= int(a); i--)
#define per(i, b) gnr(i, 0, b)
#define bg begin()
#define ed end()
#define all(x) x.bg, x.ed
#define vi vector<int>
template <class t, class u>
bool chmax(t &a, u b)
{
    if (a < b)
    {
        a = b;
        return true;
    }
    return false;
}
template <class t, class u>
bool chmin(t &a, u b)
{
    if (b < a)
    {
        a = b;
        return true;
    }
    return false;
}

//ll mod = 1000000007;
ll mod = 998244353;

signed main()
{
    int n, x, y;
    cin >> n >> x >> y;
    vector<vector<int>> e(n);
    rep(i, n - 1)
    {
        e[i].push_back(i + 1);
        e[i + 1].push_back(i);
    }
    e[x - 1].push_back(y - 1);
    e[y - 1].push_back(x - 1);
    vector<int> ans(n);
    rep(i, n)
    {
        vector<int> visited(n, -1);
        queue<int> q;
        q.push(i);
        visited[i] = 0;
        while (q.size() > 0)
        {
            int a = q.front();
            q.pop();
            for (auto &j : e[a])
            {
                if (visited[j] == -1)
                {
                    visited[j] = visited[a] + 1;
                    q.push(j);
                }
            }
        }
        rep(j, n)
        {
            ans[visited[j]]++;
        }
    }
    rep(i, n - 1)
    {
        cout << ans[i + 1] / 2 << endl;
    }
    return 0;
}

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

int main() {
    string s; cin >> s;
    set<char> t;
    for (int i = 0; i < s.size(); i++)
    {
        t.insert(s[i]);
    }

    for (char i = 'a'; i <= 'z'; i++)
    {
        if(t.count(i)==0){
            cout << i << endl;
            return 0;
        }
    }
    cout << "None" << endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define MAX_N 10000
#define INF 1e9

using namespace std;

typedef int long long ll;
typedef int long l;
typedef pair<int, int> Pii;


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    int t, o;
    t = a / d;
    o = c / b;
    if (a % d != 0) {
        t++;
    }
    if (c % b != 0) {
        o++;
    }

    if (t >= o) {
        cout << "Yes";
    } else {
        cout << "No";
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 3612
s=input()+"R"

ans=[0]*(len(s)-1)
r_num=0
l_num=0
r_place=0
l_place=0

for i in range(1,len(s)):
    if s[i-1]=="R" and s[i]=="L":
        r_num+=1
        r_place=i-1
        l_place=i
        ans[r_place]+=r_num-r_num//2
        ans[l_place]+=r_num//2
    elif s[i-1]==s[i] and s[i-1]=="R":
        r_num+=1
    elif s[i-1]==s[i] and s[i-1]=="L":
        l_num+=1
    elif s[i-1]=="L" and s[i]=="R":
        l_num+=1
        ans[r_place]+=l_num//2
        ans[l_place]+=l_num-l_num//2
        r_num=0
        l_num=0
print(*ans)

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

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"
#define PI 3.14159265358979
#define MOD 1000000007 // = 10^9 + 7

using namespace std;
using ll = long long;


void solve()
{
	int a, b;
	cin >> a >> b;
	for(int i = 0; i < 30; ++i)
	{
		if ((a - 1) * i + 1 >= b)
		{
			cout << i;
			return;
		}
	}

}

int main()
{
	fastio;
	solve();

	return 0;
}

Measured memory_bytes: 3660
fun main (args:Array<String>){
    val str = readLine()!!
    val strLen = str.length
    val strRev = str.reversed()
    var count = 0
    for(i in 0..strLen/2 - 1){
        if(str[i] != strRev[i]) count++
    }
    print(count)
}

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

int main(){
  ll a, b, c, d, e; cin>>a>>b>>c>>d>>e;
  if(a==0) cout<<1<<endl;
  if(b==0) cout<<2<<endl;
  if(c==0) cout<<3<<endl;
  if(d==0) cout<<4<<endl;
  if(e==0) cout<<5<<endl;
}

Measured memory_bytes: 3616
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Globalization;
using System.Diagnostics;
using Pair = System.Collections.Generic.KeyValuePair<int, int>;

class Program
{
    static void Main()
    {
        //Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });
        new Program().Solve();
        Console.Out.Flush();
    }
    Scanner cin = new Scanner();


    void Solve()
    {
        int N = cin.Nextint;
        int M = cin.Nextint;
        var A = cin.Scanlong;
        var B = new long[N + 1];
        for (int i = 0; i < N; i++)
        {
            B[i + 1] = A[i] + B[i];
        }


        var dp = new double[N + 1][][];
        for (int i = 0; i < N + 1; i++)
        {
            dp[i] = new double[N + 1][];
            for (int j = 0; j < N + 1; j++)
            {
                dp[i][j] = new double[N + 1];
                for (int k = 0; k < N + 1; k++)
                {
                    dp[i][j][k] = int.MinValue;
                }
            }
        }
        dp[0][0][0] = 0;

        for (int i = 0; i <= N - 1; i++)
        {
            for (int j = 0; j <= i; j++)
            {
                for (int k = 0; k <= i; k++)
                {
                    dp[i + 1][j][k] = Math.Max(dp[i][j][k], dp[i + 1][j][k]);
                    dp[i + 1][j + 1][i + 1] = Math.Max(
                        dp[i][j][k] + (B[i + 1] - B[k]) / (double)(i + 1 - k), dp[i + 1][j + 1][i + 1]);
                }
            }
        }

        //double ans = 0;
        //for (int i = 0; i <= N; i++)
        //{
        //    Console.WriteLine(dp[N, i, N]);
        //    if (i <= M) ans = Math.Max(ans, dp[N, i, N]);
        //}
        Console.WriteLine(dp[N][M][N].ToString("F7"));
    }

}

class Scanner
{
    string[] s; int i;
    char[] cs = new char[] { ' ' };
    public Scanner() { s = new string[0]; i = 0; }
    public string[] Scan { get { return Console.ReadLine().Split(); } }
    public int[] Scanint { get { return Array.ConvertAll(Scan, int.Parse); } }
    public long[] Scanlong { get { return Array.ConvertAll(Scan, long.Parse); } }
    public double[] Scandouble { get { return Array.ConvertAll(Scan, double.Parse); } }
    public string Next
    {
        get
        {
            if (i < s.Length) return s[i++];
            string st = Console.ReadLine();
            while (st == "") st = Console.ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            i = 0;
            return Next;
        }
    }
    public int Nextint { get { return int.Parse(Next); } }
    public long Nextlong { get { return long.Parse(Next); } }
    public double Nextdouble { get { return double.Parse(Next); } }
}


Measured memory_bytes: 1045148
#define MST(a, b) memset(a,b,sizeof(a))
#define ALL(v) (v).begin(),(v).end()
#include <bits/stdc++.h>

using namespace std;
typedef pair<int, int> pii;

#include <ext/pb_ds/priority_queue.hpp>

using namespace __gnu_pbds;
typedef __gnu_pbds::priority_queue<pii, greater<>, pairing_heap_tag> heap;
typedef heap::point_iterator iter;
typedef long long LL;
typedef unsigned long long ULL;
//typedef __int128 LL128;

void init_all(int t = 0) {
    if (t & 1) {
        ios::sync_with_stdio(0);
        cin.tie(0);
        cout.tie(0);
    }
#ifdef LOCAL
    if ((t >> 1) & 1) freopen("input", "r", stdin);
    if ((t >> 2) & 1) freopen("output", "w", stdout);
#endif
}

const int N = 2e5+19;

int n;
LL A[N],B[N],ans,P;

int check(int num) {
    for(int i = 1 ; i <= num ; ++i) B[i] = A[i]-P;
    for(int i = num+1 ; i <= n ; ++i) B[i] = A[i];
    sort(B+1,B+n+1);
    ans = -P;
    for(int i = 1 ; i <= n/2 ; ++i) {
        if(B[i]+B[n-i+1] < 0) return 0;
        ans = max(ans,B[i]+B[n-i+1]);
    }
    return 1;
}

void solve() {
    cin >> n >> P;n *= 2;
    for(int i = 1 ; i <= n ; ++i) {
        cin >> A[i];
        A[i] = A[i] % P;
    }
    sort(A+1,A+n+1,greater<int>());
    int l = 0, r = n+1;
    for(int mid = l+r>>1 ; l < r-1 ; mid = l+r>>1)
        if(check(mid)) l = mid;
        else r = mid;
    check(l);
    cout << ans << endl;
}

signed main() {
    srand((int)time(0));
    init_all(3);
    int T = 1;
    //cin >> T;
    while(T--) solve();
    return 0;
}

Measured memory_bytes: 3328
#include <bits/stdc++.h>
#define debug(x) cerr << #x << " " << (x) << endl
using namespace std;

const int N = 200005;
const long long inf = 1000000000000000000ll;

int n, cnt1 = 0, cnt2 = 0, cnt = 0;
long long a[N], b[N], c[N], k;


long long check (long long mid) {
	long long ans = 0ll;
	if (mid < 0ll) {
		ans = 1ll * cnt1 * cnt2;
		for (int i = 1, j = cnt; i <= cnt; i++) {
			j = max(j, i);
			while (j > i && c[i] * c[j] >= -mid) j--;
			ans -= j - i;
		}
		for (int i = 1, j = cnt1; i <= cnt1; i++) {
			j = max(j, i);
			while (j > i && a[i] * a[j] >= -mid) j--;
			ans += j - i;
		}
		for (int i = 1, j = cnt2; i <= cnt2; i++) {
			j = max(j, i);
			while (j > i && b[i] * b[j] >= -mid) j--;
			ans += j - i;
		}
		return ans;
	}

	for (int i = 1, j = cnt1; i <= cnt1; i++) {
		j = max(j, i);
		while (j > i && a[i] * a[j] > mid) j--;
		ans += j - i;
	}
	for (int i = 1, j = cnt2; i <= cnt2; i++) {
		j = max(j, i);
		while (j > i && b[i] * b[j] > mid) j--;
		ans += j - i;
	}
	ans += 1ll * cnt1 * cnt2 + 1ll * (n - cnt1 - cnt2) * (cnt1 + cnt2);
	ans += 1ll * (n - cnt1 - cnt2) * (n - cnt1 - cnt2 - 1) / 2;
	return ans;
}

int main () {
	scanf("%d%lld", &n, &k);
	for (int i = 1; i <= n; i++) {
		long long x;
		scanf("%lld", &x);
		if (x < 0) a[++cnt1] = -x;
		if (x > 0) b[++cnt2] = x;
		if (x) c[++cnt] = max(x, -x);
	}
	sort(a + 1, a + cnt1 + 1);
	sort(b + 1, b + cnt2 + 1);
	sort(c + 1, c + cnt + 1);

	long long l = -inf, r = inf;
	while (l < r) {
		long long mid = l + (r - l) / 2;
		if (check(mid) >= k) r = mid;
		else l = mid + 1;
	}
	printf("%lld\n", l);
	return 0;
}

Measured memory_bytes: 4224
/******************************************
* AUTHOR : RAJAGOPALAN *
* NICK : ARNO *
* INSTITUTION : VIT *
******************************************/
#include <bits/stdc++.h>
#include <ext/pb_ds/detail/standard_policies.hpp>
#define ll long long
#define ull unsigned long long
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define alli(a, n, k) (a+k),(a+n+k)
#define FP(i, a, b, k) for(__typeof(a) i = a;i < b;i += k)
#define FS(i, a, b, k) for(__typeof(a) i = a;i > b;i -= k)
#define IT(it, a) for(__typeof(a.begin()) it = a.begin();it != a.end(); ++it)
#define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
#define eps 1e-6
#define pi 3.141592653589793
using namespace std;
using namespace __gnu_pbds;

template<class T> inline T gcd(T x, T y) { if (!y) return x; return gcd(y, x%y);}
typedef vector<int> VII;
typedef vector<ll> VLL;
typedef pair<int, int> PII;
typedef vector< pair<int, int> > VPII;
typedef vector< pair<int, PII > > VPPI;
const int MOD = 1e9 + 7;
const int INF = 1e9;

inline ll modulo(ll a, ll m)
{
    return (a % m + m) % m;
}

inline ll modInverse(ll a, ll m)
{
    assert(__gcd(a, m) == 1);
    ll m0 = m;
    ll y = 0, x = 1;

    if (m == 1)
        return 0;

    while (a > 1)
    {
        ll q = a / m;
        ll t = m;

        m = a % m, a = t;
        t = y;

        y = x - q * y;
        x = t;
    }

    if (x < 0)
        x += m0;

    return x;
}

inline ll modPow(ll x, ll y, ll m)
{ //x^y % m
    if (y == 0)
        return 1LL;
    else if (y == 1)
        return x;
    else
    {
        ll ans = modPow(x, y / 2, m) % m;
        if (y & 1)
        {
            return (((ans * ans) % m) * x) % m;
        }
        else
        {
            return (ans * ans) % m;
        }
    }
}

int main(int argc, char* argv[])
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    string s;
    cin>>s;
    set<char> st(all(s));
    if(st.size()==2)
    cout<<"Yes";
    else cout<<"No";
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma GCC optimize("O2")
using namespace std;
#define FASTIO ios_base::sync_with_stdio(false), cin.tie(0)
//#define MULTI_TEST
//#define GOOGLE
#ifdef LOCAL
#include "debugger.h"
#else
#define db(...)
#endif
#define ll long long
#define v32 vector<int>
#define v64 vector<ll>
#define s32 set<int>
#define s64 set<ll>
#define p32 pair<int, int>
#define p64 pair<ll, ll>
#define sz(v) (ll)(v).size()
#define fi first
#define se second
#define ln '\n'
const ll MOD = 1e9 + 7;
inline ll add(ll a, ll b, ll m) { return (((a % m + b % m) % m + m) % m); }
inline ll mul(ll a, ll b, ll m) { return (((a % m * b % m) % m + m) % m); }

void solve()
{
	ll n;
	cin >> n;
	if (n == 2)
	{
		cout << 1 << ln;
		return;
	}
	// for (int x = 2; x <= n; x++)
	// {
	// 	int temp = n;
	// 	while (temp >= x)
	// 	{
	// 		if (temp % x == 0)
	// 			temp /= x;
	// 		else
	// 			temp -= x;
	// 	}
	// 	if (temp == 1)
	// 		cout << x << " ";
	// }
	// cout << "lol\n";
	s64 ans;
	ans.insert(n);
	for (ll i = 2; i * i <= n; i++)
	{
		if (n % i == 0)
		{
			ll temp = n;
			while (temp % i == 0)
			{
				temp /= i;
			}
			if (temp % i == 1)
				ans.insert(i);
			temp = n;
			ll j = n / i;
			while (temp % j == 0)
				temp /= j;
			if (temp % j == 1)
				ans.insert(j);
		}
	}
	ans.insert(n - 1);
	for (ll i = 2; i * i <= (n - 1); i++)
	{
		if ((n - 1) % i == 0)
		{
			ans.insert(i);
			ans.insert((n - 1) / i);
		}
	}
	cout << sz(ans) << ln;
	return;
}

int main()
{
#ifndef LOCAL
	FASTIO;
#endif
	int t = 1;
#ifdef LOCAL
	clock_t start, stop;
	start = clock();
#endif
#ifdef MULTI_TEST
	cin >> t;
#endif
	for (int tc = 1; tc < t + 1; tc++)
	{
#ifdef GOOGLE
		cout << "Case #" << tc << ": ";
#endif
		solve();
	}
#ifdef LOCAL
	stop = clock();
	cerr << "Time :" << fixed << setprecision(5) << double(stop - start) / double(CLOCKS_PER_SEC) << "s" << ln;
#endif
	return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <cmath>
#include <ctime>
#include <vector>
#include <algorithm>
#include <cstdlib>
#include <set>
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;

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

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

}

Measured memory_bytes: 3624
// Problem : A - Lucky 7
// Contest : AtCoder Beginner Contest 162
// URL : https://atcoder.jp/contests/abc162/tasks/abc162_a
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

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

#define ll long long
#define endl "\n"
#define lb "lower_bound"
#define ub "upper_bound"
#define bs "binary_search"

int dif(int a,int b){if(a > b)return a - b;else return b - a;}
int min(int a,int b){if(a > b)return b;else return a;}
int max(int a,int b){if(a > b)return a;else return b;}
int gcd(int a,int b){if(a == 0)return b;else return (a%b,b);}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL),cout.tie(NULL);
    string s;
    cin>>s;
    int i = 0;
    while(s[i] != '\0')
    {
    	if(s[i] == '7')
    	{
    		cout<<"Yes";
    		return 0;
    	}
    	i++;
    }
    cout<<"No";
	return 0;
}


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

template <class T> using V = vector<T>;
template <class S, class T> using P = pair<S, T>;
template <class... T> using TP = tuple<T...>;

using ll = long long;
using db = double;
using ldb = long db;
using str = string;
using vll = V<ll>;
using vvll = V<V<ll>>;
using pll = P<ll,ll>;
using tpll = TP<ll,ll,ll>;
using vpll =V<pll>;
using vst = V<str>;
using vch = V<char>;

#define FOR(i,a,b) for(ll i=(a);i<(ll)(b);i++)
#define rFOR(i,a,b) for(ll i=(b);i>(ll)(a);i--)
#define oFOR(i,a,b) for(ll i=(a);i<(ll)(b);i+=2)
#define bgn begin()
#define en end()
#define SORT(a) sort((a).bgn,(a).en)
#define REV(a) reverse((a).bgn,(a).en)
#define fi first
#define se second
#define sz size()
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) __lcm(a,b)
#define co(a) cout<<a<<endl
#define ci(a) cin>>a
#define pb(a) push_back(a)
#define pob pop_back()
#define mp make_pair
#define mt make_tuple
#define pbmp(a,b) push_back(mp(a,b))
#define subs(a,b) substr(a,b)
#define INF 1e16
#define mod 1e9+7


int main() {
  str s;
  cin>>s;
  ll count;
  FOR(i,0,s.sz){
    if(s[i]=='x')count++;
  }
  if(count>=8)co("NO");
  else co("YES");
}


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

int n, h[MAX+1], ans = 0;

void exec(int l, int r, int height){
  if ( l > r) return;

  int minIdx = 0;
  for ( int i = l; i <= r; i++){
    if ( h[minIdx] > h[i]){
      minIdx = i;
    }
  }
  ans += h[minIdx] - height;

  height = h[minIdx];

  exec(l, minIdx-1, height);
  exec(minIdx+1, r, height);
}

int main(){
  cin >> n;
  h[0] = MAX;
  for ( int i = 1; i <= n; i++){
    cin >> h[i];
  }

  exec(1, n, 0);

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

# E - Red and Green Apples

x, y, a, b, c = map(int, input().split())
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))
assert len(p) == a and len(q) == b and len(r) == c

p.sort(reverse=True)
q.sort(reverse=True)
r.sort(reverse=True)

pi = x - 1
qi = y - 1
ri = 0
while ri < c:
    if pi >= 0 and qi >= 0 and p[pi] <= q[qi] < r[ri]:
        p[pi] = r[ri]
        pi -= 1
        ri += 1
    elif pi >= 0 and qi >= 0 and q[qi] <= p[pi] < r[ri]:
        q[qi] = r[ri]
        qi -= 1
        ri += 1
    elif pi >= 0 and p[pi] < r[ri]:
        p[pi] = r[ri]
        pi -= 1
        ri += 1
    elif qi >= 0 and q[qi] < r[ri]:
        q[qi] = r[ri]
        qi -= 1
        ri += 1
    else:
        break

print(sum(p[:x] + q[:y]))


Measured memory_bytes: 105444
import sys
input=sys.stdin.readline
sys.setrecursionlimit(10**9)
n=int(input())
A=list(map(int,input().split()))
a,b=max(A),min(A)
if a-b>1:
    print('No')
elif a==b:
    print('Yes' if a<=n//2 or a==n-1 else 'No')
else:
    c=A.count(b)
    print('Yes' if 1<=a-c<=(n-c)//2 else 'No')

Measured memory_bytes: 13304
#include<map>
#include<set>
#include<list>
#include<cmath>
#include<queue>
#include<stack>
#include<cstdio>
#include<string>
#include<vector>
#include<complex>
#include<cstdlib>
#include<cstring>
#include<numeric>
#include<sstream>
#include<iostream>
#include<algorithm>
#include<functional>

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

using namespace std;

typedef    long long          ll;
typedef    unsigned long long ull;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      pii;

const int INF=1<<29;
const double EPS=1e-9;

const int dx[]={1,0,-1,0},dy[]={0,-1,0,1};
int m;//辺の数
/*プリム法*/
const int MAX_V = 110;
int cost[MAX_V][MAX_V];//cost[u][v]は辺e=(u,v)のコスト(存在しない場合はINF)
int mincost[MAX_V];//集合Xからの辺の最小コスト
bool used[MAX_V];//頂点iがXに含まれているか
int V;//頂点の数

int prim(){
	for(int i = 0;i < V;i++){
		mincost[i] = INF;
		used[i] = false;
	}
	mincost[0] = 0;
	int res = 0;
	while(true){
		int v = -1;
		//Xに属さない頂点のうちXからの辺のコストが最小になる頂点を探す
		for(int u = 0;u < V;u++){
			if(!used[u]&&(v==-1||mincost[u]<mincost[v])){
				v = u;
			}
		}
		if(v==-1)
			break;
		used[v] = true;//頂点vをXに追加
		res +=mincost[v];//辺のコストを加える
		for(int u = 0;u < V;u++){
			mincost[u] = min(mincost[u],cost[v][u]);
		}
	}
	return res;
}
int main(){
	while(cin>>V,V){
		cin>>m;
		rep(i,V){
			rep(j,V){
				cost[i][j] =INF;
				if(i==j){
					cost[i][j] = 0;
				}
			}
		}
		rep(i,m){
			int a,b,c;
			scanf("%d,%d,%d",&a,&b,&c);
			cost[a][b] =(c-100)/100;
			cost[b][a] =(c-100)/100;
		}
		cout <<prim()<<endl;
	}
	return 0;
}

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

int main() {
    int N, X;
    int m[100];

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

    sort(m, m + N);

    for (int i = 0; i < N; i++){
        X -= m[i];
    }

    int ans = N;

    ans += X/m[0];   

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define mod 1000000007
#define sp ' '
#define intmax 2147483647
#define llmax 9223372036854775807
#define nyan "(=^･ω･^=)"
#define mkp make_pair
#define mkt make_tuple
#define lP pair<ll, ll>
#define iP pair<int,int>
typedef long long ll;
using namespace std;

int N, a, cnt[100002], ans;

int main(){
	cin >> N;
	for (int i = 0; i != N; ++i) {
		cin >> a;
		a = min(N + 1, a);
		++cnt[a];
	}
	for (int i = 1; i != N + 2; ++i) {
		if (cnt[i] >= i)ans += cnt[i] - i;
		else ans += cnt[i];
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main(){
    ll h,w,one=1;
    cin >> h >> w;//h>=Wとしてよい
    if(w>h){
        swap(h,w);
    }//hが長辺

    if((h*w)%3 == 0){
        cout << 0 << endl;
    }else{
        ll ans1=10000000002,ans2=10000000002,ans3=10000000002;
        for(ll i=max((h/3)-1,one);i <= (h+3)/3;i++){
            for(ll j=max((2*h/3)-1,one);j <= (2*h+1)/3;j++){
                ans1= min(ans1,max(w*i,max(w*(j-i),w*(h-j)))-min(w*i,min(w*(j-i),w*(h-j))));
            }
        }//長辺側から３分割する場合

        for(ll i=max((h/3)-1,one) ;i <= (h+3)/3;i++){
            for(ll j=max((w/2)-1,one);j <= (2+w)/2 ;j++){
                ans2=min(ans2,max(w*i,max((h-i)*(w-j),(h-i)*j))-min(w*i,min((h-i)*(w-j),(h-i)*j)));
            }   
        }//まず長辺側で切り、次に短辺側で切る

        swap(h,w); 

        for(ll i=max((h/3)-1,one);i <= (h+3)/3;i++){
            for(ll j=max((w/2)-1,one);j <= (w+2)/2;j++){
                ans3=min(ans3,max(w*i,max((h-i)*(w-j),(h-i)*j))-min(w*i,min((h-i)*(w-j),(h-i)*j)));
            }   
        }//まず短辺側で切り、次に長辺側で切る

        cout << min(ans1,min(ans2,ans3)) << endl;
    }
}


Measured memory_bytes: 256
from collections import Counter
D = int(input())
c = list(map(int, input().split()))
s = []
for i in range(D):
    temp_s = list(map(int, input().split()))
    s.append(temp_s)
my_count = Counter()
t = list(int(input()) for i in range(D))
c_sum = sum(c)
my_sum = 0
my_minus = 0
for d in range(D):
    my_count [t[d]] = c[t[d] - 1] * (d + 1)
    my_sum += s[d][t[d] - 1]
    my_minus += sum(dict(my_count).values()) - c_sum * (d + 1)
    print(my_sum + my_minus)

Measured memory_bytes: 9748