akhauriyash/Code-Regression huggingface dataset:
//#define _GLIBCXX_DEBUG

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

#define endl '\n'
#define lfs cout<<fixed<<setprecision(10)
#define ALL(a)  (a).begin(),(a).end()
#define ALLR(a)  (a).rbegin(),(a).rend()
#define spa << " " <<
#define fi first
#define se second
#define MP make_pair
#define MT make_tuple
#define PB push_back
#define EB emplace_back
#define rep(i,n,m) for(ll i = (n); i < (ll)(m); i++)
#define rrep(i,n,m) for(ll i = (ll)(m) - 1; i >= (ll)(n); i--)
using ll = long long;
using ld = long double;
const ll MOD1 = 1e9+7;
const ll MOD9 = 998244353;
const ll INF = 1e18;
using P = pair<ll, ll>;
template<typename T1, typename T2>bool chmin(T1 &a,T2 b){if(a>b){a=b;return true;}else return false;}
template<typename T1, typename T2>bool chmax(T1 &a,T2 b){if(a<b){a=b;return true;}else return false;}
ll median(ll a,ll b, ll c){return a+b+c-max({a,b,c})-min({a,b,c});}
void ans1(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
void ans2(bool x){if(x) cout<<"YES"<<endl;else cout<<"NO"<<endl;}
void ans3(bool x){if(x) cout<<"Yay!"<<endl;else cout<<":("<<endl;}
template<typename T1,typename T2>void ans(bool x,T1 y,T2 z){if(x)cout<<y<<endl;else cout<<z<<endl;}  
template<typename T>void debug(vector<vector<T>>&v,ll h,ll w){for(ll i=0;i<h;i++){cout<<v[i][0];for(ll j=1;j<w;j++)cout spa v[i][j];cout<<endl;}};
void debug(vector<string>&v,ll h,ll w){for(ll i=0;i<h;i++){for(ll j=0;j<w;j++)cout<<v[i][j];cout<<endl;}};
template<typename T>void debug(vector<T>&v,ll n){if(n!=0)cout<<v[0];for(ll i=1;i<n;i++)cout spa v[i];cout<<endl;};
template<typename T>vector<vector<T>>vec(ll x, ll y, T w){vector<vector<T>>v(x,vector<T>(y,w));return v;}
ll gcd(ll x,ll y){ll r;while(y!=0&&(r=x%y)!=0){x=y;y=r;}return y==0?x:y;}
vector<ll>dx={1,-1,0,0,1,1,-1,-1};vector<ll>dy={0,0,1,-1,1,-1,1,-1};
template<typename T>vector<T> make_v(size_t a,T b){return vector<T>(a,b);}
template<typename... Ts>auto make_v(size_t a,Ts... ts){return vector<decltype(make_v(ts...))>(a,make_v(ts...));}
template<typename T1, typename T2>ostream &operator<<(ostream &os, const pair<T1, T2>&p){return os << p.first << " " << p.second;}
template<typename T>ostream &operator<<(ostream &os, const vector<T> &v){for(auto &z:v)os << z << " ";cout<<"|"; return os;}
//mt19937 mt(chrono::steady_clock::now().time_since_epoch().count());

int main(){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  ll res=0,buf=0;
  bool judge = true;
  ll x;cin>>x;
  cout<<(x^1)<<endl;
  return 0;
}

Measured memory_bytes: 3648
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner cin = new Scanner(System.in);
        int n, q, i, count = 0;
        int[] S, T;
        n = cin.nextInt();
        S = new int[n];
        for (i = 0; i < n; i++) {
            S[i] = cin.nextInt();
        }
        q = cin.nextInt();
        T = new int[q];
        for (i = 0; i < q; i++) {
            T[i] = cin.nextInt();
        }
        for (i = 0; i < q; i++) {
            if (bSearch(S, n, T[i]) != -1) {
                count++;
            }
        }
        System.out.println(count);
    }
    static int bSearch(int[] A, int len, int key) {
        int left = 0, right = len, mid;
        while (left < right) {
            mid = (left + right) / 2;
            if (A[mid] == key) 
                return mid;
            if (A[mid] < key) 
                left = mid + 1;
            else 
                right = mid;
        }
        return -1;
    }
}


Measured memory_bytes: 67956
using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static void Main(string[] args)
    {
        var AB = sc.ReadInt();
        var BC = sc.ReadInt();
        var CA = sc.ReadInt();
        var ans = AB * BC / 2;
        Console.WriteLine(ans);
    }
    static int MOD = (int)1e9 + 7;
    static int INF = (int)1e7 + 1;
    static long LINF = (long)1e13 + 1;
    static Scanner sc = new Scanner();
}

class Scanner
{
    string[] S = new string[0];
    int Index = 0;
    char[] Separators = new char[] { ' ' };

    public string Next()
    {
        if (this.Index < this.S.Length) return this.S[this.Index++];
        var line = "";
        while (line == "") line = Console.ReadLine();
        this.S = line.Split(this.Separators, StringSplitOptions.RemoveEmptyEntries);
        if (this.S.Length == 0) return this.Next();
        this.Index = 0;
        return this.S[this.Index++];
    }
    public string ReadStr()
    {
        return this.Next();
    }
    public char ReadChar()
    {
        return this.Next()[0];
    }
    public int ReadInt()
    {
        return int.Parse(this.Next());
    }
    public uint ReadUInt()
    {
        return uint.Parse(this.Next());
    }
    public long ReadLong()
    {
        return long.Parse(this.Next());
    }
    public double ReadDouble()
    {
        return double.Parse(this.Next());
    }
    public int[] ReadIntArray(int n)
    {
        var array = new int[n];
        for (int i = 0; i < array.Length; i++)
        {
            array[i] = this.ReadInt();
        }
        return array;
    }
    public long[] ReadLongArray(int n)
    {
        var array = new long[n];
        for (int i = 0; i < array.Length; i++)
        {
            array[i] = this.ReadLong();
        }
        return array;
    }
    public double[] ReadDoubleArray(int n)
    {
        var array = new double[n];
        for (int i = 0; i < array.Length; i++)
        {
            array[i] = this.ReadDouble();
        }
        return array;
    }
    public char[] ReadCharArray(int n)
    {
        var array = new char[n];
        for (int i = 0; i < array.Length; i++)
        {
            array[i] = this.ReadChar();
        }
        return array;
    }
    public string[] ReadStrArray(int n)
    {
        var array = new string[n];
        for (int i = 0; i < array.Length; i++)
        {
            array[i] = this.ReadStr();
        }
        return array;
    }
}

class Debug
{
    public static void Dump<T>(T[,] array)
    {
#if !DEBUG
        return;
#endif
        Console.WriteLine();
        var h = array.GetLength(0);
        var w = array.GetLength(1);

        for (int r = 0; r < h; r++)
        {
            for (int c = 0; c < w; c++)
            {
                Console.Write(array[r, c]);
                Console.Write(" ");
            }
            Console.WriteLine();
        }
        Console.WriteLine();
    }
    public static void Dump<T>(T[] array)
    {
#if !DEBUG
        return;
#endif
        Console.WriteLine();
        Console.WriteLine(string.Join(" ", array));
        Console.WriteLine();
    }
}

Measured memory_bytes: 11092
#include <iostream>
#include <math.h>
#include <algorithm>
#include <cstdio>
#include <set>
#include <stack>
#include <vector>
#include <queue>
#include <map>
#include <string.h>
#include <bitset>
#include <array>

using namespace std;

const int maxn=1e5+5;
typedef long long ll;

int br[maxn];

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int n;
	cin >> n;
	ll sum=0;
	int a;
	for(int i=0; i<n; i++){
		cin >> a;
		sum+=a;
		br[a]++;
	}
	int q;
	cin >> q;
	int b;
	for(int i=0; i<q; i++){
		cin >> a >> b;
		sum-=(ll)br[a]*a;
		sum+=(ll)br[a]*b;
		br[b]+=br[a];
		br[a]=0;
		cout << sum << '\n';
	}
	return 0;
}

Measured memory_bytes: 4004
#include<cstdio>
int main()
{
    int mo,da;
    int cal[12]={0,31,29,31,30,31,30,31,31,30,31,30};
    while(scanf("%d%d",&mo,&da),mo)
    {
        int nu=0;
        for(int i=0;i<mo;i++)nu+=cal[i];
        nu+=da;
        if(nu%7==1)printf("Thursday\n");
        else if(nu%7==2)printf("Friday\n");
        else if(nu%7==3)printf("Saturday\n");
        else if(nu%7==4)printf("Sunday\n");
        else if(nu%7==5)printf("Monday\n");
        else if(nu%7==6)printf("Tuesday\n");
        else if(nu%7==0)printf("Wednesday\n");
    }
    return 0;
}

Measured memory_bytes: 1012
import java.util.*;

public class Main {

  static Scanner scan = new Scanner(System.in);

  public static void main(String[] args) {
    int k = scan.nextInt();
    String str = scan.next();

    int n = str.length();

    if (n <= k) {
      System.out.println(str);
      return;
    }

    System.out.println(str.substring(0, k) + "...");
  }
}

Measured memory_bytes: 27084
open Printf open Scanf
open Array

let () = scanf " %s" @@ fun s ->
  let r,b = ref 0,ref 0 in
  String.iter (fun c -> if c = '0' then
    r := !r + 1 else b := !b + 1) s;
  print_int @@ 2 * min !r !b

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

int main() {
    bool flag = true;
    string S;
    cin >> S;

    rep(i, S.size() / 2) {
        if (S[i] != S[S.size() - i - 1])
            flag = false;
    }

    rep(i, ((S.size() - 1) / 2) / 2) {
        if (S[i] != S[S.size() - i - 1])
            flag = false;
    }

    S = S.substr((S.size() + 3) / 2 - 1);
    rep(i, S.size() / 2) {
        if (S[i] != S[S.size() - i - 1])
            flag = false;
    }

    flag ? cout << "Yes" : cout << "No";
    cout << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <numeric>
#include <algorithm>
#include <cstring>
#include <map>
#include <set>
#include <cmath>
#include <cstdlib>
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define INF 1145141919
typedef long long int ll;
using namespace std;

ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }

ll lcm(ll m, ll n)
{
    if ((0 == m) || (0 == n))
        return 0;
    return ((m / gcd(m, n)) * n);
}

ll llpow(ll x, ll y)
{
    ll ans = 1;
    REP(i, y)
    ans *= x;
    return ans;
}

int ctoi(char c)
{
    if (c >= '0' && c <= '9')
    {
        return c - '0';
    }
    return 0;
}

////////////////////////////////////////////////////////////////////

int main()
{
    int N; cin >> N;
    vector<ll> a(3*N);
    REP(i,3*N) cin >> a[i];

    sort(a.begin(), a.end(), greater<int>());

    ll ans=0;

    REP(i,2*N){
        if(i%2!=0){
            ans+=a[i];
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 2560
using System;

namespace B
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine(solver() ? "Yes" : "No");
        }
        static bool solver()
        {
            var S = Console.ReadLine();
            for (int i = 0; i < (S.Length - 1) / 2; i++)
            {
                if (S[i] != S[S.Length - 1 - i]) return false;
            }
            for (int i = 0; i < (S.Length - 1) / 2; i++)
            {
                if (S[i] != S[(S.Length - 1) / 2 - i - 1]) return false;
            }
            return true;
        }
    }
}


Measured memory_bytes: 11092
#include<bits/stdc++.h>
#define REP(i,x,y) for(ll i=x; i<=y; i++)
#define BIT(t) ((long long 1) << t)
#define PER(i,y,x) for(ll i=y; i>=x; i--)
#define vll vector<ll>
#define vvll vector<vector<ll>>
using namespace std;
typedef long long ll;

ll const MAX = 1e5;
int main(){
	ll n;
	cin >> n;
	vll v(n+5);
	REP(i,1,n){
		cin >> v[i];
	}	
	sort(v.begin()+1, v.begin() + 1 + n);
	bool flag = 1;
	REP(i,1,n){
		if(0 != v[i]){
			flag = 0;
		}
	}
	if(flag){
		cout << "Yes" << endl;
		return 0;
	}
	if(n % 3 == 0){
		bool flag  = 1;
		ll m = n / 3;
		REP(i,1,n){
			if(v[((i-1) / m) * m + 1] != v[i]){
				flag = 0;
			}	
		}	
		if((v[m] ^ v[m*2] ^ v[m*3]) != 0){
			flag = 0;
		}
		if(flag){
			cout << "Yes" << endl;
			return 0;
		}

	}
	cout << "No" << endl;
}

Measured memory_bytes: 1024
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;

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

int ch[400000][26];
int sz;
char mz[22][22];
char str[N], ans[N];
int la;
int n, m;

void getstr(int sx, int sy, int d, char *s) {
    int len = 0;
    int x = sx, y = sy;
    do {
        s[len++] = mz[x][y];
        x += dx[d]; x = (x + n) % n;
        y += dy[d]; y = (y + m) % m;
    } while (x != sx || y != sy);
    s[len] = 0;
}

char t[N];
int lt;
void insert(char *s) {
//puts(s);
    int u = 0;
    t[lt = 0] = 0;
    bool ok = true;
    for (int i = 0; s[i]; i++) {
        int d = s[i] - 'A';
        if (ch[u][d] == 0) {
            memset(ch[sz], 0, sizeof(ch[sz]));
            ch[u][d] = sz++;
            ok = false;
        }
        u = ch[u][d];
        if (ok) {
            t[lt++] = s[i]; t[lt] = 0;
        }
    }
}

void work() {
    memset(ch[0], 0, sizeof(ch[0]));
    sz = 1;
    for (int i = 0; i < n; i++) scanf("%s", mz[i]);
    ans[la = 0] = 0;
    for (int i = 0; i < n; i++)
        for (int j = 0; j < m; j++) {
            for (int d = 0; d < 8; d++) {
                getstr(i, j, d, str);
                insert(str);
                if (lt > la) {
                    la = lt;
                    strcpy(ans, t);
                } else if (lt == la && strcmp(t, ans) < 0) {
                    strcpy(ans, t);
                }
            }
        }
    if (la <= 1) puts("0");
    else puts(ans);
}

int main() {
//freopen("data.in", "r", stdin);
//freopen("data.out", "w", stdout);
    while (scanf("%d%d", &n, &m), n || m) {
        work();
    }
    return 0;
}

Measured memory_bytes: 17408
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
inline void readInt(int &x) {
	x=0;int f=1;char ch=getchar();
	while(!isdigit(ch)){if(ch=='-')f=-1;ch=getchar();}
	while(isdigit(ch))x=x*10+ch-'0',ch=getchar();
	x*=f;
}
inline void readLong(ll &x) {
	x=0;int f=1;char ch=getchar();
	while(!isdigit(ch)){if(ch=='-')f=-1;ch=getchar();}
	while(isdigit(ch))x=x*10+ch-'0',ch=getchar();
	x*=f;
}
/*================Header Template==============*/
string s;
int main() {
	cin>>s;
	string tmp=s.substr(0,4);
	if(tmp=="YAKI")
		puts("Yes");
	else
		puts("No");
	return 0;
} 

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    static Scanner sc = new Scanner(System.in);
    static int V;
    static int[][] G = new int[105][105];
    static final int INF = 1 << 31 - 1;

    public static void main(String[] args) {
        V = sc.nextInt();

        int v;
        for (int i = 0; i < V; i++) {
            for (int j = 0; j < V; j++) {
                v = sc.nextInt();
                G[i][j] = v != -1 ? v : INF;
            }
        }

        int ans = solvePrim();
        System.out.println(ans);
    }

    /*
    This function find the Minimum Spanning Tree (MST) in O(V^2).

      V: Number of vertexes.
      G: Costs between two vertexes (values of edges). If the edge does not exists, INF should be set.

    Return the total cost of the MST, T.
    */
    public static int solvePrim() {

        int[] cost = new int[V];  // the cost for adding vertex v in G - T to T
        boolean[] used = new boolean[V];  // whether the vertex v exists in T

        for (int i = 0; i < V; i++) {
            cost[i] = INF;
            used[i] = false;
        }

        cost[0] = 0;
        int ret = 0;

        while (true) {
            int v = -1;
            for (int u = 0; u < V; u++) {
                if (used[u]) {
                    continue;
                }
                if (v == -1 && cost[u] != INF) {
                    v = u;
                    continue;
                }
                if (cost[u] < cost[v]) {
                    v = u;
                }
            }

            if (v == -1) break;

            used[v] = true;
            ret += cost[v];

            for (int u = 0; u < V; u++) {
                cost[u] = Math.min(cost[u], G[u][v]);
            }
        }

        return ret;
    }
}

Measured memory_bytes: 40544
//author:luckYrat(twitter:@luckYrat_)
//#include <bits/stdc++.h>

//def
#include <iostream>

#include <cmath>
#include <algorithm>
#include <iomanip>

//array
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <utility>
#include <climits>



using namespace std;

using ll = long long;
using P = pair<ll,ll>;

#define anyfill(n,s) setw(n) << setfill(s)
#define loop(s) for(int i = 0; s > i; i++)
#define rep(i,q) for(int i = 0; (q) > i; i++)
#define repp(i,n,q) for(int i = n; (q) > i; i++)
#define dep(i,q) for(int i = (q); 0 < i; i--)


#define MAX 1000000000
const int mod = 1000000007;
#define EPS (1e-10)

#define pb push_back
#define fir first
#define scn second
#define ednl endl

#define YesNo(a) (a?"Yes":"No")
#define YESNO(a) (a?"YES":"NO")
#define yesno(a) (a?"yes":"no")


P ar4[4] = {{0,1},{0,-1},{1,0},{-1,0}};
P ar8[8] = {{-1,-1},{-1,0},{-1,1},{0,-1},{0,1},{1,-1},{1,0},{1,1}};
/*
確認ポイント
cout << fixed << setprecision(n) << 小数計算//n桁の小数表記になる
vector.unique()は隣接した同じ要素を削除するので先にソートをする

計算量は変わらないが楽できるシリーズ
C++11以降でmin({a,b,c...})で複数個のmic,maxを処理できる
min(max)_element(iter,iter)で一番小さい(大きい)値のポインタが帰ってくる
count(iter,iter,int)でintがiterからiterの間にいくつあったかを取得できる

*/
__attribute__((constructor))
void initial() {
 cin.tie(0);
 ios::sync_with_stdio(false);
}



int main(){
  int a,b,c;cin>>a>>b>>c;
  cout << c/a*b << endl;
}


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

int main()
{
    long long N;
    std::cin >> N;

    std::vector<long long> A(N);
    for (long long i=0; i<N; i++) 
        std::cin >> A.at(i);

    long long ans = 0;
    // {}で0で初期化
    // https://tt4cs.hatenadiary.org/entry/20120219/1329636595
    long long cnt[200005] = {};
    for (int i=0; i<N; i++)
    {
        // j-A_j==i+A_i. j-A_j<=N, i+A_i>0
        if (i-A.at(i)>0) ans += cnt[i-A.at(i)];
        
        // i+A_i>Nは考えなくていい
        if (i+A.at(i)<=N) cnt[i+A.at(i)]++;
    }
    std::cout << ans;

}

Measured memory_bytes: 6392
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <map>
#include <list>
#include <iterator>
#include <queue>
#include <stack>
#include <deque>
#include <sstream>
#include <algorithm>
#include <numeric>
#include <string>
#include <cmath>
#include <complex>
#include <functional>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cassert>
#include <cstdlib>
#include <cctype>

#define REP(i,m,n) for(int i=m;i<(int)n;i++)
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define rrep(i,n) for(int i = 1; i <= n; i++)
#define drep(i,n) for(int i = n; i >= 0; i--)
#define rp(i,c) rep(i,(int)c.size())
#define fr(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define mp make_pair
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define rall(u) (u).rbegin(),(u).rend()
#define dbg(x) cerr<<#x<<" = "<<(x)<<endl
#define v_delete(a,b) (a).erase(remove((a).begin(), (a).end(), b), (a).end())
#define v_unique(a) (a).erase(unique((a).begin(), (a).end()), (a).end())
#define VV(T) vector<vector< T > >
#define init(a,b) memset((a), (b), sizeof((a)))
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
const int inf=1<<28;
const double INF=1e10,EPS=1e-9;


template<class T>int SIZE(T a){return a.size();}
template<class T>string IntToString(T num){string res;stringstream ss;ss<<num;return ss.str();}
template<class T>T StringToInt(string str){T res=0;for(int i=0;i<SIZE(str);i++)res=(res*10+str[i]-'0');return res;}
template<class T>T gcd(T a,T b){if(b==0)return a;return gcd(b,a%b);}
template<class T>T lcm(T a,T b){return a/gcd(a,b)*b;}

template <class T> void input(T& a, int n) { for (int i = 0; i < n; ++i) cin >> a[i]; }
template <class T> void input(T* a, int n) { for (int i = 0; i < n; ++i) cin >> a[i]; }

int dp[4002][4002];
int main(){
	string a,b;
	while(cin >> a >> b){
        for(int i=0;i<4001;i++)dp[i][0]=dp[0][i]=0;
	int as=a.size();
	int bs=b.size();
	int ans=0;
	for(int i=1;i<=as;i++){
		for(int j=1;j<=bs;j++){
			if(a[i-1]==b[j-1]){
				dp[i][j]=dp[i-1][j-1]+1;
			}else{
				dp[i][j]=0;
			}
			ans=max(ans,dp[i][j]);

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

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

int n, x;

int main(void){
	cin >> n >> x;
	vector<int> a(n);
	for(int i = 0; i < n; i++) cin >> a[i];
	sort(a.begin(), a.end());
	int ans = 0;
	for(int i = 0; i < n; i++){
		if(i == n-1){
			if(x == a[i]) ans++;
			break;
		}
		if(x - a[i] < 0) break;
		else{
			x-=a[i];
			ans++;
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3628
import java.util.*;
public class Main {
   static Scanner sc = new Scanner(System.in);
   static Scanner sc2 = new Scanner(System.in);
   public static void main(String[] args) {
      int N = sc.nextInt();
      if (N == 1) {
         System.out.println("Hello World");
      } else {
         int A = sc.nextInt();
         int B = sc.nextInt();
         System.out.println(A + B);
      }

   }

   public static void swap (int[] array, int i, int j) {
      int temp = array[i];
      array[i] = array[j];
      array[j] = temp;
   }

}

Measured memory_bytes: 23892
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define pp pair<pair<ll, ll>,pair<ll, ll>>
#define pll pair<ll,ll>
#define ppll pair<ll,pll>
#define pdd pair<double,double>
#define vii vector<int>
#define vll vector<ll>
#define mat vector<vector<ll>>
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define eb emplace_back
#define fi first
#define sc second
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
#define sz(x) (ll) (x).size()
#define pq priority_queue<ll>
#define pqg priority_queue<ll,vector<ll>,greater<ll>>
#define LB(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define UB(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
#define ERASE(v) sort(v.begin(),v.end());v.erase(unique(v.begin(),v.end()),v.end())
#define int ll
// #define ll int
using namespace std;
const ll INF = (1 << 30 ) - 1;
const ll LLINF = (1LL << 60LL);
const ll MOD = 1000000007;
// const ll mod = 998244353;
const ll MAX = 2100000;
const double pi = acos(-1);
const double eps = 1e-10;
ll dx[8] ={1,0,-1,0,1,-1,1,-1};
ll dy[8] ={0,1,0,-1,1,-1,-1,1};
 
template<class T> 
inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> 
inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }






void solve() {
    ll n,k,c;
    cin>>n>>k>>c;
    string s;
    cin>>s;
    ll dp[200010]={},dp2[200010]={};
    ll now=-1,now2=n+1;
    rep(i,n){
        if(i>0) dp[i]=dp[i-1];
        // cout<<i<<" "<<s[i]<<" "<<now<<endl;
        if(s[i]=='o' && now<i){
            dp[i]++;
            now=i+c;
        }
    }
    repr(i,n){
        dp2[i]=dp2[i+1];
        if(s[i]=='o' && now2 >i){
            dp2[i]++;
            now2=i-c;
        }
    }

    // rep(i,n) cout<<dp[i]<<",";
    // cout<<endl;
    // rep(i,n) cout<<dp2[i]<<",";
    // cout<<endl;


    rep(i,n){
        bool ok=false;
        if(i==0){
            if(dp2[i+1]<k) ok=true;
        }
        else if(i==n-1){
            if(dp[i-1]<k) ok=true;
        }
        else{
            if(dp[i-1]+dp2[i+1]<k) ok=true;
        }
        if(ok) cout<<i+1<<endl;
    }
    cout<<endl;
}




signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);


    solve(); 


    return 0;
}


Measured memory_bytes: 6872
def ex(x):
    return (x+1)/2
 
n, k = map(int, input().split())
lst = list(map(int, input().split()))
source = [ex(i) for i in range(1, 1001)]
exlst = [source[l-1] for l in lst]
maxmum = -1

cumulative = [0]
total = 0
for ex in exlst:
    total += ex
    cumulative.append(total)

maxmum = -1
for i in range(n-k+1):
    sum_ = cumulative[i+k] - cumulative[i]
    if sum_ > maxmum:
        maxmum = sum_
print(maxmum)

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

#define ll long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vll vector<ll>
#define vpii vector<pair<int,int>>
#define vpll vector<pair<ll,ll>>
#define fr(i,k,n) for (int i = k; i < n; ++i)
#define fri(i,k,n) for (int i = k; i >= n; --i)
#define INF (int)1e9
#define MOD 1000000007
#define pb push_back
#define mp make_pair
#define all(arr) arr.begin(),arr.end()

void boost(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
}

const int N=2e5+5;
ll arr[N];

void solve(){
	int n;
	cin>>n;
	fr(i,0,n){
		cin>>arr[i];
	}
	sort(arr,arr+n);
	ll ans=0;
	if(n==2){
		ans=arr[n-1];
	}
	else if(n==3){
		ans=(arr[n-1]+arr[n-2]);
	}
	else if(n==4){
		ans=(arr[n-1]+arr[n-2]+arr[n-2]);
	}
	else{
		ans=arr[n-1];
		int i=n-2;
		int rem=n-2;
		while(rem>1){
			ans+=(2*arr[i]);
			i--;
			rem-=2;
		}
		if(rem==1)
			ans+=arr[i];
	}
	cout<<ans<<endl;
	return;
}

int main()
{
	boost();
	
	int tc=1;
	//cin>>tc;
	while(tc--)
		solve();
	return 0;
}

Measured memory_bytes: 5220
#include <bits/stdc++.h>
#define REP(i,n,N) for(int i=n;i<N;i++)
#define p(S) cout<<S<<endl
using namespace std;


int main(){
	int n;
	string list ="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
	while(cin>>n,n){
		int k[101];
		string str;
		REP(i,0,n){
			cin>>k[i];
		}
		cin>>str;
		int key=0;
		for(unsigned int i=0;i<str.size();i++){
			for(unsigned int j=0;j<list.size();j++){
				if(list[j]==str[i]){
					if((int)j-k[key]<0){
						j+=list.size();
					}
					j-=k[key];
					key++;
					if(key==n){
						key=0;
					}
					cout<<list[j];
					break;
				}
			}
		}
		p("");
	}
	return 0;
}

Measured memory_bytes: 3164
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br =
            new BufferedReader(new InputStreamReader(System.in), 1);
        String s;
        while(true){
        	s = br.readLine();
        	String[] xy = s.split(" ");
        	int x = Integer.parseInt(xy[0]);
        	int y = Integer.parseInt(xy[1]);
        	if (x==0 && y==0)
        		return;
        	System.out.println(Math.min(x, y) + " " + Math.max(x, y));
        }
    }
}

Measured memory_bytes: 35192
#include<bits/stdc++.h>
using namespace std;
signed  main()
{
  long long a,b,c=-1;
  cin>>a>>b;
  for(int i=2;i<=1000000;i++){
    if(a*i%b!=0&&c==-1) c=a*i;
  }
  cout<<c<<"\n";
}


Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#include<iostream>
#include<cstring>
#include<vector>
#include<map>
#include<queue>
using namespace std;
typedef long long ll;
const ll INF = 1000000000000000;
int N,M;
ll H[100001];
ll X;
struct edge{
int to;
ll c;
edge(int to,ll c) : to(to),c(c) {}
};
typedef pair<ll,int> P;
vector<edge> G[100001];
ll h[100001];
ll solve(){
priority_queue< P, vector<P>, greater<P> > q;
for(int i=0;i<=N;i++) h[i] = INF;
q.push( P( 0, 1 ) );
h[1] = 0;
while( !q.empty() ){
P p = q.top(); q.pop();
ll t = p.first;
int id = p.second;
// printf("t = %lld\nid=%d\n",t,id);
for(int i=0;i<(int)G[id].size();i++){
edge e = G[id][i];
ll cost = e.c+t;
if( X - t - e.c > H[e.to] ){
cost += X-t-e.c-H[e.to];
}
if( h[e.to] > cost ){
h[e.to] = cost;
q.push( P(h[e.to],e.to) );
}
}
}
return h[N];
}
 
int main(){
scanf("%d %d %lld",&N,&M,&X);
for(int i=1;i<=N;i++){
scanf("%lld",&H[i]);
}
for(int i=0;i<M;i++){
int a,b;
ll c;
scanf("%d %d %lld",&a,&b,&c);
if( H[a] - c >= 0 )
G[a].push_back(edge(b,c));
if( H[b] - c >= 0 )
G[b].push_back(edge(a,c));
}
ll ret = solve();
// printf("%lld\n%lld\n",ret,INF);
if( ret == INF ){
puts("-1");
} else {
ll res = H[N] - (X - ret) + h[N];
printf("%lld\n",res);
}
}

Measured memory_bytes: 20732
import heapq as h
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
e6 = 10**6
q = [-b[i]*e6-i for i in range(n)]
h.heapify(q)
cnt = 0
while q:
  w = -h.heappop(q)
  v,i = w//e6, w%e6
  u = b[(i-1)%n] + b[(i+1)%n]
  if v < u or a[i] == v: continue
  elif a[i] > v: print(-1); exit(0)
  t = (v-a[i])//u
  if not t: print(-1); exit(0)
  cnt += t
  b[i] -= t*u
  if b[i] > a[i]:
    h.heappush(q,-b[i]*e6-i)
print(cnt if a==b else -1)

Measured memory_bytes: 121884
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int k;
    string s;
    cin>>k>>s;
    if(k>=s.size()){
        cout<<s<<'\n';
    }else{
        for(int i=0; i<k; i++){
            cout<<s[i];
        }
        cout<<"..."<<'\n';
    }

    return 0;

}

Measured memory_bytes: 3596
n, t = map(int, input().split())
w = []
v = []
for i in range(n):
    a, b = map(int, input().split())
    w.append(a)
    v.append(b)
w, v = zip(*sorted(zip(w, v)))
dp = [[0] * (t + 1) for i in range(n + 1)]
for i in range(n):
    for j in range(t):
        if j >= w[i]:
            dp[i + 1][j] = max(dp[i][j - w[i]] + v[i], dp[i][j])
        else:
            dp[i + 1][j] = dp[i][j]
    dp[i + 1][t] = dp[i + 1][t] = max(dp[i][t - 1] + v[i], dp[i][t])
print(dp[n][t])


Measured memory_bytes: 116568
word = input()
if len(word) != 4:
  print('No')
else:
  letters = {word[0]: 1}
  for l in word[1:]:
    if l in letters:
      letters[l] += 1
    else:
      letters[l] = 1
  if list(letters.values()) == [2, 2]:
    print('Yes')
  else:
    print('No')

Measured memory_bytes: 3060
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define E "\n"

using namespace std;
const long long MOD = (long long)1e9 + 7;

int n, u, v;
vector<int> vec[100009], ans[2], sp;
bool mk[100009];

bool ck(int x, bool fst)
{
	int cnt = 0;
	mk[x] = true;
	for (int i = 0; i < (int)vec[x].size(); i++) {
		if (!mk[vec[x][i]]) {
			if (!ck(vec[x][i], false)) return false;
			cnt++;
			if (cnt > 1 && !fst) return false;
			if (cnt > 2 && fst) return false;
		}
	}
	if (cnt == 0) sp.pb(x);
	if (cnt == 1 && fst) sp.pb(x);
	return true;
}

void fun(int cur, int cur2, int id)
{
	int cnt = vec[cur].size() - 1;
	if (cur2 < n) cnt--;
	int tmp = cur2 + 1;
	mk[cur] = true;
	while (cnt) {
		ans[id].pb(tmp);
		tmp++;
		cnt--;
	}
	ans[id].pb(cur2);
	if (tmp <= n) {
		for (int i = 0; i < (int)vec[cur].size(); i++) {
			if (!mk[vec[cur][i]]) {
				fun(vec[cur][i], tmp, id);
				break;
			}
		}
	}
}

int main()
{
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> n;
	for (int i = 0; i < n - 1; i++) {
		cin >> u >> v;
		vec[u].pb(v);
		vec[v].pb(u);
	}
	if (n == 2) {
		cout << "1 2" << E;
		return 0;
	}
	for (int i = 1; i <= n; i++) {
		if (vec[i].size() == 1) mk[i] = true;
	}
	bool ok = true;
	for (int i = 1; i <= n; i++) {
		if (!mk[i]) {
			ok = ck(i, true);
			break;
		}
	}
	if (!ok) {
		cout << -1 << E;
	}
	else {
		if (sp.size() == 1) sp.pb(sp[0]);
		memset(mk, 0, sizeof(mk));
		for (int i = 1; i <= n; i++) {
			if (vec[i].size() == 1) mk[i] = true;
		}
		ans[0].pb(1);
		fun(sp[0], 2, 0);
		ans[0].pb(n);
		memset(mk, 0, sizeof(mk));
		for (int i = 1; i <= n; i++) {
			if (vec[i].size() == 1) mk[i] = true;
		}
		ans[1].pb(1);
		fun(sp[1], 2, 1);
		ans[1].pb(n);
		int tmp = 0;
		for (int i = 0; i < n; i++) {
			if (ans[1][i] == ans[0][i]) continue;
			if (ans[1][i] < ans[0][i]) {
				tmp = 1;
				break;
			}
			else break;
		}
		for (int i = 0; i < n; i++) cout << ans[tmp][i] << " ";
	}
	//system("pause");
	return 0;
}


Measured memory_bytes: 16632
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b,c,k;
  long long sum=0;
  cin>>k;
  for(a=1;a<=k;a++){
    for(b=1;b<=k;b++){
        for(c=1;c<=k;c++) sum+=__gcd(__gcd(a,b),c);
    }
  }
  cout<<sum;
  return 0;
}


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

ll q(ll n){
  if(n%4==1) return 1;
  if(n%4==2) return n+1;
  if(n%4==3) return 0;
  if(n%4==0) return n;
}

int main(){
  ll a,b;
  cin>>a>>b;
  ll ra,rb;
  ra=q(a-1);
  rb=q(b);
  ll ans;
  if(a==0) ans=rb;
  else ans=rb^ra;
  cout<<ans<<endl;
}

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

#define REP(i, x, n) for (int i = x; i < (int)(n); i++)
#define rep(i, n) REP (i, 0, n)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x.size())
#define popcount(x) __builtin_popcount(x)
#define popcountll(x) __builtin_popcountll(x)
#define uniq(x) x.erase(unique(x.begin(), x.end()), x.end())
#define F first
#define S second
#define mp make_pair
#define eb emplace_back

using namespace std;

typedef long long ll;

// const int INF = 1 << 30;
// const ll INF = 1LL << 60;
// const int MOD = 1000000007;

class UnionFindTree {
private:
  int nodeSize;
  vector<int> parent;
  vector<int> rank;
  vector<int> treeSize;

public:
  UnionFindTree(int ns) {
    nodeSize = ns;
    parent = vector<int>(nodeSize);
    rank = vector<int>(nodeSize, 0);
    treeSize = vector<int>(nodeSize, 1);

    for(int i = 0; i < nodeSize; i++) {
      parent[i] = i;
    }
  }

  int find(int x) {
    if (parent[x] == x) {
      return x;
    } else {
      return parent[x] = find(parent[x]);
    }
  }

  bool unite(int x, int y) {
    x = find(x);
    y = find(y);

    if (x == y) {
      return false;
    }

    if (rank[x] < rank[y]) {
      parent[x] = y;
      treeSize[y] += treeSize[x];
    } else {
      parent[y] = x;
      treeSize[x] += treeSize[y];
      if (rank[x] == rank[y]) {
        rank[x]++;
      }
    }

    return true;
  }

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

  int getSize(int x) {
    return treeSize[find(x)];
  }
};

int main() {
  int N, K, L;
  cin >> N >> K >> L;

  UnionFindTree a(N), b(N);

  rep (i, K) {
    int p, q;
    cin >> p >> q;
    a.unite(p - 1, q - 1);
  }

  rep (i, L) {
    int r, s;
    cin >> r >> s;
    b.unite(r - 1, s - 1);
  }

  vector<pair<int, int>> vp(N);
  map<pair<int, int>, int> cnt;

  rep (i, N) {
    vp[i] = mp(a.find(i), b.find(i));
    cnt[vp[i]]++;
  }

  rep (i, N) cout << (i == 0 ? "" : " ") << cnt[vp[i]];
  cout << endl;
}


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

#define ll long long
#define ld long double
#define COIN const int
#define ite iterator
#define PII pair<int,int>
#define PSI pair<string,int>
#define PIS pair<int,string>

#define REP(i,n) for((i)=0;(i)<(int)(n);(i)++)
#define REPD(i,n) for((i)=(n)-1;(i)>=0;(i)--)

#define ALL(c) (c).begin(), (c).end()
#define sz(s) (s).size()
#define CLEAR(x) memset(x,0,sizeof x);

#define MP make_pair
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define X first
#define Y second

#define VI vector<int>
#define VS vector<string>
#define VII vector<PII>
#define VVI vector<VI>

#define PIII 3.1415926
#define PI 3.14
/*****************************************************************************/

using namespace std;

int main()
{
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
    string s; cin >> s;
    int i,j;
    const string k="keyence";
    for (i=0;i<=k.size();i++) {
        bool f=1;
        for (j=0;j<i;j++) {
            if (s[j]!=k[j]) {
                f=0;
                break;
            }
        }
        if (!f) {
            continue;
        }
        for (j=0;j<k.size()-i;j++) {
            if (s[s.size()-1-j]!=k[k.size()-1-j]) {
                f=0;
                break;
            }
        }
        if (f) {
            cout <<"YES" <<endl;
            return 0;
        }
    }
    cout <<"NO" <<endl;
    return 0;
}
/******************************************************************************
******************************************************************************/


Measured memory_bytes: 256
n,m=map(int,input().split())
a=[list(map(int,input().split())) for i in range(n)]
b=sorted(a, key=lambda x: x[0])

sum=0
k=0

for j in range(m):
    if(b[k][1]==0):
        k+=1
    sum+=b[k][0]
    b[k][1]-=1

print(sum)

Measured memory_bytes: 29796
#include <algorithm>
#include <climits>
#include <cmath>
#include <iostream>
#include <numeric>
#include <queue>
#include <unordered_map>
#include <vector>

const int mod = 1e9 + 7;
const int kmax = 510000;

long long fact[kmax], fact_inv[kmax], inv[kmax];

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

    return gcd(b, a % b);
}

void init_comb()
{
    fact[0] = fact[1] = 1;
    fact_inv[0] = fact_inv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < kmax; i++) {
        fact[i] = fact[i - 1] * i % mod;
        inv[i] = mod - inv[mod % i] * (mod / i) % mod;
        fact_inv[i] = fact_inv[i - 1] * inv[i] % mod;
    }
}

long long comb(int n, int r)
{
    if (n < r) {
        return 0;
    }

    if (n < 0 || r < 0) {
        return 0;
    }

    return fact[n] * (fact_inv[r] * fact_inv[n - r] % mod) % mod;
}

template <typename T, T N>
class UnionFind {
    T parent_[N];
    T rank_[N];
    T size_[N];

public:
    UnionFind();
    T Root(T idx);
    bool IsSame(T x, T y);
    void Unite(T x, T y);
    T GetSize(T idx);
};

template <typename T, T N>
UnionFind<T, N>::UnionFind()
{
    for (T i = 0; i < N; i++) {
        parent_[i] = i;
        rank_[i] = 0;
        size_[i] = 1;
    }
}

template <typename T, T N>
T UnionFind<T, N>::Root(T idx)
{
    return parent_[idx] == idx ? idx : parent_[idx] = Root(parent_[idx]);
}

template <typename T, T N>
bool UnionFind<T, N>::IsSame(T x, T y)
{
    return Root(x) == Root(y);
}

template <typename T, T N>
void UnionFind<T, N>::Unite(T x, T y)
{
    x = Root(x);
    y = Root(y);
    if (x == y) {
        return;
    }

    if (rank_[x] < rank_[y]) {
        parent_[x] = y;
        size_[y] += size_[x];
    } else {
        parent_[y] = x;
        size_[x] += size_[y];
        if (rank_[x] == rank_[y]) {
            rank_[x]++;
        }
    }
}

template <typename T, T N>
T UnionFind<T, N>::GetSize(T idx)
{
    return size_[Root(idx)];
}

int main(void)
{
    int n, q;
    std::cin >> n >> q;

    std::vector<std::vector<int>> edges(n);

    for (int i = 0; i < n - 1; i++) {
        int a, b;
        std::cin >> a >> b;
        a--;
        b--;

        edges[a].push_back(b);
        edges[b].push_back(a);
    }

    std::vector<long long> values(n);

    for (int i = 0; i < q; i++) {
        int p, x;
        std::cin >> p >> x;
        p--;

        values[p] += x;
    }

    auto dfs = [&](auto f, int idx, int parent) -> void {
        for (auto edge : edges[idx]) {
            if (edge == parent) {
                continue;
            }

            values[edge] += values[idx];
            f(f, edge, idx);
        }
    };

    dfs(dfs, 0, -1);
    for (auto value : values) {
        std::cout << value << std::endl;
    }
}


Measured memory_bytes: 30592
<?php
while ( ! feof(STDIN) ) {
  $stdin = trim(fgets(STDIN));
        $line[] = $stdin;
}
$num = 0;
for($a=0;$a<=$line[0];$a++){
  $tmp1 = $a*500;
  for($b=0;$b<=$line[1];$b++){
    $tmp2 = $b*100;
    for($c=0;$c<=$line[2];$c++){
      $tmp3 = $c*50;
      $sum = $tmp1 + $tmp2 + $tmp3;
      if($sum == $line[3])
        $num++;
      }
}
}
echo $num;
?>
 
  

Measured memory_bytes: 3828
using System;
class Program
{
  static void Main(string[] args)
  {
    // スペース区切りの整数の入力
    // int N = int.Parse(Console.ReadLine());
    // string[] input = Console.ReadLine().Split(' ');
    // int[] a = new int[N];
    // int [] c = new int[30];
    string s = Console.ReadLine();
    // for(int i=0;i<30;i++){
    //   c[i]=0;
    // }

    // for(int i=0;i<N;i++){
    //   a[i]= int.Parse(input[i]);
    //   c[a[i]]++;
    // }

    // string s="";
    // for(int i=0;i<29;i++){
    //   s+=""+c[i]+" ";
    // }
    // s+=""+c[29];
    int count=700;

    if (s[0]=='o')count+=100;
    if (s[1]=='o')count+=100;
    if (s[2]=='o')count+=100;
    Console.WriteLine(count);

  }
}

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

Measured memory_bytes: 61240
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
 
int main(){
  ll N;
  cin>>N;
  
  string ans="";
  while(N){
    N-=1;
    ans.push_back('a'+N%26);
    N/=26;
  }
  reverse(ans.begin(),ans.end());
  cout<<ans<<endl;
}

Measured memory_bytes: 3632
a,b,k=map(int,input().split())
if b-a+1>2*k:
  ans=sorted(list(set([i for i in range(a,a+k)]+[i for i in range(b-k+1,b+1)])))
else:
  ans=[i for i in range(a,b+1)]
for i in ans:
  print(i)

Measured memory_bytes: 3060
n, k = map(int, input().split())
H = list(map(int, input().split()))
dp = [0] * n
for i in range(1, n):
    dp[i] = min(dp[i - j - 1] + abs(H[i] - H[i - j - 1]) for j in range(min(k, i)))

print(dp[n - 1])


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

int main() {
  int N;
  cin >> N;
  int a, b, c;
  a=N/100;
  b=(N%100)/10;
  c=N%10;
  
  if (a==7||b==7||c==7){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
  
}


Measured memory_bytes: 3560
#include <iostream>
#include <algorithm>
#include <vector>
#include <math.h>
using namespace std;
typedef long long ll;

int main() {
    int n, k;
    cin >> n >> k;

    char s[n + 5];
    cin >> s;

    vector<int> v;
    int idx = 0;
    while (idx < n) {
        int sub = 0;
        while (idx + sub < n && s[idx] == s[idx + sub]) sub++;
        v.push_back(sub);
        idx += sub;
    }

    int sm[n + 5];
    for (int i = 0; i <= v.size(); i++) {
        if (i == 0) sm[i] = 0;
        else {
            sm[i] = sm[i - 1] + v[i - 1];
        }
    }

    int mx = 0, mxi;
    for (int i = 0; i + 2 * k + 1 <= v.size(); i++) {
        //cout << sm[i + 2 * k + 1] - sm[i] << endl;
        if (mx < sm[i + 2 * k + 1] - sm[i]) mxi = i;
        mx = max(mx, sm[i + 2 * k + 1] - sm[i]);
    }

    if (v.size() / 2 <= k) {
        cout << n - 1 << endl;
        return 0;
    }
    
    int ans = 0;
    for (int i = 0; i < v.size(); i++) {
        if (i < mxi) ans += v[i] - 1;
        else if (i < mxi + 2 * k + 1) ;
        else ans += v[i] - 1;
    }
    cout << ans + mx - 1 << endl;
}

Measured memory_bytes: 1272
#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
#include <set>
#include <queue>
#include <stack>
#include <utility>
#include <tuple>
#include <random>
#include <map>
using namespace std;

const double pi = acos(-1);
#define nyan cout << "(=^•ω•^=)" << endl;
#define int long long
#define rep(i, n) for(int i = 0; i < n; i++)
#define loop while(true)

signed main(){
	int n;cin>>n;
	if(n==3){
		cout<<"2"<<endl;
		cout<<"1 3"<<endl;
		cout<<"2 3"<<endl;
		return 0;
	}
	else if(n%2==0){
		cout<<n*n/2-n<<endl;
		for(int i=1;i<=n;i++){
			for(int j=i+1;j<=n;j++){
				if(i+j==n+1)continue;
				cout<<i<<" "<<j<<endl;
			}
		}
	}
	else{
		cout<<((n-1)*(n-1))/2<<endl;
		for(int i=1;i<=n-1;i++){
			for(int j=i+1;j<=n-1;j++){
				if(i+j==n)continue;
				cout<<i<<" "<<j<<endl;
			}
		}
		for(int i=1;i<=n-1;i++)cout<<i<<" "<<n<<endl;
	}
	return 0;
}

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

#define rep(i,a,b) for(int i=a;i<b;i++)
#define INF INT_MAX/2
#define EPS 1e-10

int K;
double R, L, P, E, T;

double delta;

int fastpow(int x, int n)
{
	int ret = 1;
	while (0 < n)
	{
		if ((n % 2) == 0)
		{
			x *= x;
			n >>= 1;
		}
		else
		{
			ret *= x;
			--n;
		}
	}
	return ret;
}

double dfs(double r, double l, int k)
{
	double h = (r + l) / 2;
	if (k == K)
	{
		if (abs(h - T) <= E + EPS)
			return 1;
		else
			return 0;
	}

	if (l - delta < T - E - EPS)
		return 0;
	if (T + E < r + delta - EPS)
		return 0;
	if (T - E <= r + delta + EPS && l - delta <= T + E + EPS)
		return 1;

	if (h >= T)
		return dfs(r, h, k + 1) * (1 - P) + dfs(h, l, k + 1)*P;
	else
		return dfs(r, h, k + 1) * P + dfs(h, l, k + 1)*(1-P);
}

int main()
{
	cin >> K >> R >> L >> P >> E >> T;

	delta = (L - R) / (double)fastpow(2, K+1);

	printf("%.6f\n", dfs(R, L, 0));
}

Measured memory_bytes: 3276
/*                          The four Truths of Life

                                    CKMKB
                                    PKMKB

                                    CKMKC
                                    PKMKC
*/


#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <climits>
#include <iomanip>
#include <unordered_map>
#include <unordered_set>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#define ll long long int
#define ull unsigned long long int
#define pb push_back
#define mp make_pair
#define ye cout<<"YES";
#define no cout<<"NO";
#define ln cout<<"\n";
// cout<<"Case #"<<ts<<": “;
//priority_queue < pair<ll, ll>, vector<pair<ll, ll>>, greater<pair<ll, ll>>> pq;


using namespace std;

ll mod(ll x, ll m) {
	return (x % m + m) % m;
}

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

#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	ll t = 1, r, n, a, d, c, b, x, y, sum, cnt, i, j, k, m, l, q, maxx, minn, temp, ans, flag, g, ts;
	ll mod = 1000000007;
	char ch, chh;
	double dans;
	string str, ttr;

	//cin >> t;


	for (ts = 1; ts <= t; ts++)
	{
		flag = 0; sum = 0; cnt = 0; ans = 0; k = 0; maxx = 0; minn = 0; a = 0; b = 0; temp = 0;

		cin >> n >> k;
		ll arr[n]; for (i = 0; i < n; i++) {cin >> arr[i];}

		sort(arr, arr + n);

		for (i = 0; i < k; i++)
			sum += arr[i];

		cout << sum;




		ln
	}
	return 0;
}


Measured memory_bytes: 3652
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int count = 0;
		String line1 = sc.next().toUpperCase();
		while (sc.hasNext()) {
			String line2 = sc.next().toUpperCase();

			if(line2.equals(line1)) {
				count++;
			}

		}
		System.out.println(count);

	}

}

Measured memory_bytes: 26288
n = int(input())
ans = 0
i = 0
while 4*i <= n:
    j = 0
    while 4*i+7*j <= n:
        if 4*i+7*j == n:
            ans = 1
        j += 1
    i += 1
if ans:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3060
#include<bits/stdc++.h>
const double PI=3.14159265358979323846;
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "

int main(void){
    string s;cin>>s;
    bool can=true;
    rep(i,s.size()){
        if(i%2==0)can=((s[i]=='R')||(s[i]=='U')||(s[i]=='D'));
        if(i%2==1)can=((s[i]=='L')||(s[i]=='U')||(s[i]=='D'));
        if(!can){co("No");return 0;}
    }
    co("Yes");
}

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

#define forn(i,n) for(int i=0;i<n;i++)
#define pb push_back
typedef long long ll;

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	int k;
	cin>>k;
	string s;
	cin>>s;
	int i=(int)s.length();
	if(i<=k){
        cout<<s<<endl;
	}
	else{
        string s1=s.substr(0,k);
        s1+="...";
        cout<<s1<<endl;
	}
}


Measured memory_bytes: 3652
/*
 Author: LargeDumpling
 Email: LargeDumpling@qq.com
 Edit History:
	2017-09-16	File created.
*/

#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
using namespace std;
int n,A[305][305],B[305][305];
long long totlen=0;
bool check()
{
	for(int i=1;i<=n;i++)
		for(int j=1;j<=n;j++)
			if(B[i][j]!=A[i][j])
				return false;
	return true;
}
int main()
{
	bool flag;
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
		for(int j=1;j<=n;j++)
		{
			scanf("%d",&A[i][j]);
			B[i][j]=A[i][j];
		}
	for(int k=1;k<=n;k++)
		for(int i=1;i<=n;i++)
			for(int j=1;j<=n;j++)
				B[i][j]=min(B[i][j],B[i][k]+B[k][j]);
	if(!check()) printf("-1");
	else
	{
		for(int i=1;i<=n;i++)
			for(int j=i+1;j<=n;j++)
			{
				flag=true;
				for(int k=1;k<=n&&flag;k++)
					if(A[i][j]==A[i][k]+A[k][j]&&k!=j&&k!=i)
						flag=false;
				if(flag)
					totlen+=A[i][j];
			}
		printf("%lld",totlen);
	}
	fclose(stdin);
	fclose(stdout);
	return 0;
}


Measured memory_bytes: 1024