akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <deque>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <cassert>
#include <iostream>
#include <stdio.h>
#include <time.h>
 
using namespace std;

typedef long long ll;
 
#define sz size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(), (c).end()
#define rep(i,a,b) for(int i=(a);i<(b);++i)
#define clr(a, b) memset((a), (b) ,sizeof(a))
 
#define MOD 1000000007

int main(){
  string s;
  cin>>s;
  if(s[s.sz-1]=='s'){
    cout << s+"es" << endl;
  }
  else{
    cout << s+"s" << endl;
  }
  return 0;
}

Measured memory_bytes: 3628
K, N = gets.split.map(&:to_i)
A = gets.split.map(&:to_i)

m = 0

(A << (K + A.first)).each_cons(2) do |a, b|
  m = b - a < m ? m : b - a 
end

(A << (K + A.first)).reverse.each_cons(2) do |a, b|
  m = (b - a).abs < m ? m : (b - a).abs
end

puts K - m

Measured memory_bytes: 16900
#include <iostream>

using namespace std;

int main (){
  int A,B;
  cin >> A >> B;
  A-=1;
  B-=1;
  if(A==0){
    A=13;
  }
  if(B==0){
    B=13;
  }
  //cout << A << " " << B <<endl;
  if(A==B){
    cout <<"Draw" <<endl;
  }else if(A<B){
    cout << "Bob"<<endl;
  }else{
    cout <<"Alice"<<endl;
  }
  return 0;
}


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

unit = a + b

if n >= unit:
  # c: 商
  # d: 余り
  c = n // unit
  d = n % unit
  num = c * a
  if d >= a:
    num += a
  else:
    num += d
else:
  d = n % unit
  if d >= a:
    num = a
  else:
    num = d
    
print(num)

Measured memory_bytes: 3060
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner in = new Scanner(System.in);

        int A = in.nextInt();   // 赤のカード
        int B = in.nextInt();   // 緑のカード
        int C = in.nextInt();   // 青のカード
        int K = in.nextInt();   // 操作回数
        int count = 0;
        
        while( B <= A ){
            B*=2;
            count+=1;
        }

        while( C <= B ){
            C*=2;
            count+=1;
        }

        if( count > K ){
            System.out.println("No");
        }else {
            System.out.println("Yes");
        }
    }
}

Measured memory_bytes: 35668
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define boost ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define loop(i,a,n) for(ll i=a;i<n;i++)
#define all(x) x.begin(),x.end()
#define bs binary_search
#define gcd(a,b) __gcd(a,b)
#define PI acos(-1)
#define lp lower_bound
#define up upper_bound
#define minimum(a)	*min_element(a.begin(), a.end())
#define maximum(a)	*max_element(a.begin(), a.end())
#define UNIQUE(x) (x).resize(unique(all(x))-(x).begin())
#define bp(x)  __bulitin_popcount(x)
using namespace std;
ll power(ll a, ll n) {ll p = 1;while (n > 0) {if(n%2) {p = p * a;} n >>= 1; a *= a;} return p;}
ll power(ll a, ll n, ll mod) {ll p = 1;while (n > 0) {if(n%2) {p = p * a; p %= mod;} n >>= 1; a *= a; a %= mod;} return p % mod;}
 
const int MOD = 1000000007;
const int FMOD = 998244353;
const double eps = 1e-9;
int main()
{
boost
ll n,m,k;
cin>>n>>m>>k;
ll a[n+1],b[m+1];
loop(i,1,n+1)cin>>a[i];
loop(i,1,m+1)cin>>b[i];
ll ca=LLONG_MAX,cb=LLONG_MAX;
loop(i,1,n+1)ca=min(a[i],ca);
loop(i,1,m+1)cb=min(b[i],cb);

ll ans=ca+cb;
loop(i,1,min(n,m)+1){
    
    ans=min(a[i]+b[i],ans);
}
ll j=k;
while(j--){
    ll x,y,c;
    cin>>x>>y>>c;
    if(x<=n&&y<=m){
        ans=min(ans,a[x]+b[y]-c);
    }
}
if(ans>=0)
cout<<ans;
else cout<<0;
return 0;
}


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

using namespace std;

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

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


int main()
{
  string a, b;
  cin >> a >> b;
  if(a < b) cout << "<" << endl;
  else if(a > b) cout << ">" << endl;
  else cout << "=" << endl;

}

Measured memory_bytes: 256
// ABC058
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>

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

using namespace std;
typedef long long ll;

const ll INF = 1e10;
const ll MOD = 1e9+7;



int main()
{
    string o, e;
    cin >> o >> e;

    int i;
    for(i = 0; i < min(o.size(), e.size()); i++)
    {
        cout << o[i];
        cout << e[i];
    }
    for(int j = i; j < o.size(); j++) cout << o[j];
    for(int j = i; j < e.size(); j++) cout << e[j];
    cout << endl;

    return 0;
}


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

using namespace std;

struct node
{
    char name[200];
    int score;
    int data;
}a[105];
int cmp(node a,node b)
{
    if(strcmp(a.name,b.name)==0)
        return a.score>b.score;
    else
        return strcmp(a.name,b.name)<0;
}
int main( )
{
    int n;
    scanf("%d",&n);
    for(int i=0;i<n;i++)
        cin>>a[i].name>>a[i].score,a[i].data=i;
    sort(a,a+n,cmp);
    for(int i=0;i<n;i++)
        cout<<a[i].data+1<<endl;
}


Measured memory_bytes: 256
using System;
using System.Linq;//リストの使用
using System.Collections.Generic;
using System.Text;//テキストの高速出力に必要
class Program
{
	static void Main()
	{
		int n = int.Parse(Console.ReadLine());
    long[][] vertexes = new long[n][];
    long p = 0;
    long q = 0;
    long answer = 50;
    if(n == 1) answer = 1;
    for(long i = 0; i < n; i++)
    {
      long[] nums = Array.ConvertAll(Console.ReadLine().Split(' '),long.Parse);
      vertexes[i] = new long[3];
      vertexes[i][0] = nums[0];
      vertexes[i][1] = nums[1];
    }
    var sorted = vertexes.OrderBy(a => a[0]).ThenBy(a => a[1]).ToList();

    for(int i = 0; i < n-1; i++)
    {
      for(int j = i+1; j < n; j++)
      {
        p = sorted[i][0] - sorted[j][0];
        q = sorted[i][1] - sorted[j][1];
        long answerMemo = 0;
        for(int k = 0; k < n; k++) sorted[k][2] = 0;

        for(int k = 0; k < n; k++)//全てのボールを確認
        {
          answerMemo++;
          for(int l = 0; l < n; l++)
          {
            if(sorted[l][2] == 1)
            {
              if(sorted[l][0] - sorted[k][0] == p && sorted[l][1] - sorted[k][1] == q)
              {
                answerMemo--;
                break;
              }
            }
          }
          sorted[k][2] = 1;
        }
        answer = Math.Min(answer,answerMemo);
      }
    }

		Console.WriteLine(answer);
	}
}

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

def profit(R):
    minv = R[0]
    maxv = min(R) - max(R)
    for i in range(1, len(R)):
        if maxv < R[i] - minv:
            maxv = R[i] - minv
        if minv > R[i]:
            minv = R[i]
    return maxv

n = int(input())
R = []
for _ in range(n):
    R.append(int(input()))
    
print(profit(R))


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

int main(void) {
    int n,a,b;
    int c1,c2,c;

    cin >> n >> a >> b;
    c1 = a * n;
    c2 = b;

    c = min(c1,c2);
    
    cout << c << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
// マクロ
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
// 型エイリアス
using ll = long long;
using vi = vector<int>;
using vs = vector<string>;
using vvi = vector<vi>;
using vvs = vector<vs>;

bool IsPrime(ll num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            // 素数ではない
            return false;
        }
    }

    // 素数である
    return true;
}

ll gcd(ll a, ll b) {
    if (b == 0) {
        return a;
    }
    else return gcd(b, a % b);
}


int main() {
    ll a, b;
    cin>>a >> b;
    vector<ll> divab;
    ll gcdab = gcd(a,b);
    ll ans = 1;
    int x = sqrt(gcdab);
    for(int i = 1; i <= x; i++) {
        if(gcdab % i == 0) {
            divab.push_back(i);
            divab.push_back(gcdab/i);
        }
    }
    bool ch = true;
    ll size = divab.size();
    sort(divab.begin(), divab.end());
    rep(i,size) {
if(IsPrime(divab[i])) ans++;
}
    cout << ans << endl;
}


Measured memory_bytes: 384
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<stdexcept>
#include<cmath>
#include<fstream>
#include<memory>
#include<algorithm>
#include<cstring>
#include<ctime>
#include<deque>
#include<sstream>
#include<iomanip>
#include<sstream>
#include<vector>
#include<queue>
#include<stack>
#include<string>
#include<climits>
#include<map>
#include<set>
#include<list>
#include<cassert>
#include<deque>
#define REP(i,s,n) for(int i=s;i<n;i++)
#define rep(i,n) REP(i,0,n)
#define INF 1<<27
#define all(n) n.begin(),n.end()
#define insert(a,b,c,d) PP(P(a,b),P(c,d))
#define F first
#define iter(c) __typeof__((c).begin())
#define foreach(i,c) for(iter(c) i=(c).begin();i!=(c).end();++i)
#define S second
#define pb push_back
#define pf push_front
#define LIM 100000
using namespace std;
typedef pair<int,int> P;
typedef pair<P,P> PP;
typedef long long ll;
typedef unsigned long long ull;

int di[3] = {3600,60,1};

int getTime(string s){
  rep(i,s.length())if(s[i] == ':')s[i] = ' ';
  stringstream ss;
  ss << s;
  int ret = 0;
  for(int i=0;i<3;i++){
    string pre;
    ss >> pre;
    int tim = (atoi)(pre.c_str());
    ret += tim*di[i];
  }
 
  return ret;
}

int main(){
  int n;

  while(true){
    cin >> n;
    if(n == 0)break;
    string star,endar;
    vector<P> vec;
    rep(i,n){
      cin >> star >> endar;
      int st,ed;
      st = getTime(star);
      ed = getTime(endar);
      vec.pb(P(st,ed));
    }
    sort(all(vec));
    int cnt = 0;
    int mex = 0;
   
    rep(i,n){
      cnt = 1;
      for(int j=i-1;j>=0;j--){
	if(vec[j].S <= vec[i].F)continue;
	cnt++;
      }
      mex = max(cnt,mex);
    }

    cout << mex << endl;

  }
return 0;
}

Measured memory_bytes: 1368
#include <iostream>
#include <algorithm>
#include <numeric>
#include <utility>
#include <map>
#include <vector>
#include <climits>
#include <cmath>
#include <stdlib.h>

#define max_n 100001

using namespace std;

int main()
{
    long long a, b, c, d; 
    cin >> a >> b >> c >> d;
    long long ans = -1e18;
    ans = max(ans, a * c); 
    ans = max(ans, a * d); 
    ans = max(ans, b * c); 
    ans = max(ans, b * d); 
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3620
open System

let [| n; a; b |] =
    stdin.ReadLine().Split(' ') |> Array.map int

let ns = [| 1 .. n |]

ns
|> Array.map
    (string
     >> Seq.map (fun x -> int x - int '0')
     >> Seq.sum)
|> Array.mapi (fun i x -> if (a <= x && x <= b) then ns.[i] else 0)
|> Array.sum
|> printfn "%d"


Measured memory_bytes: 16476
import java.util.*;

public class Main{
    public static void main(String args[]){
        Scanner sn = new Scanner(System.in);
        String S = sn.next();
        String s = "";
        int flag = 0;
        for(int i=0; i<S.length()/2; i++){
            s += "hi";
            if(s.equals(S)) {
                flag++;
                System.out.println("Yes");
                break;
            }
        }
        if(flag == 0) System.out.println("No");
        
    }
}

Measured memory_bytes: 21844
n = int(input())
buka = [[] for _ in range(n)]
a = [int(x) for x in input().split()]

for i in range(n-1):
    # 社員 i の上司が a[i]-1
    buka[a[i]-1].append(i+1)

for i in range(n):
    print(len(set(buka[i])))


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

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

    int count_two = 0;
    int count_four = 0;
    int a;
    for (int i = 0; i < N; i++)
    {
        cin >> a;
        if (a % 4 == 0)
        {
            count_four++;
        }
        else if (a % 2 == 0)
        {
            count_two++;
        }
    }
    int count_other = N - count_two - count_four;
    if (count_two > 0)
    {
        if (count_other <= count_four)
        {
            cout << "Yes" << endl;
        }
        else
        {
            cout << "No" << endl;
        }
    }
    else
    {
        if (count_other <= count_four + 1)
        {
            cout << "Yes" << endl;
        }
        else
        {
            cout << "No" << endl;
        }
    }
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include <cmath>
#include <algorithm>
#include <vector>
#define MOD 1000000007
using namespace std;
typedef long long ll;

const int MAXN = 100100;
int tree[MAXN];
int p[MAXN];
vector <int> child;

int root(int i){
if(i == tree[i]){
 for(int j = 0; j < child.size(); j++)
  tree[child[j]] = i;
  child.clear(); 
  return i;                    // 根ノードならおわり //
 }
else{
 child.push_back(i);
 return i = root(tree[i]);           // 親ノードをたどる //
 }
}

int unit(int x,int y){
x = root(x);
y = root(y);
tree[max(x,y)] = min(x,y);     //  根ノードをもう片方の根ノードに連結 //
}

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

int main(){

int n,m;

cin >> n >> m;

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

for(int i = 0; i < m; i++){
 int a,b;
 cin >> a >> b;
 unit(a,b);
}

int ans = 0;

for(int i = 0; i < n; i++)
 if(isUnit(p[i],i+1)) ans++;

cout << ans << endl; 

return 0;
}

Measured memory_bytes: 1024
s = list(input())
k = int(input())
for i in range(len(s)):
    if s[i] != "a" and (123-ord(s[i])) <= k:
        k -= (123-ord(s[i]))
        s[i] = "a"
    if i == len(s)-1:
        s[i] = (chr((((ord(s[i])+(k%26))-97)%26)+97))
print("".join(s))

Measured memory_bytes: 4276
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<n;++i)
typedef long long ll;
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;}

int main(){
   int N,W;
   cin >> N >> W;
   ll w[N],v[N];
   rep(i,N) cin >> w[i] >> v[i];
   ll dp[N][W+1];
   rep(k,N)rep(i,W+1)dp[k][i] = 0;

   rep(i,N){rep(k,W+1){
      if(k>=w[i]){
         if(!i) dp[i][k] = v[i];
         else chmax(dp[i][k],max(dp[i-1][k],dp[i-1][k-w[i]]+v[i]));
      }else{ if(i)dp[i][k]=dp[i-1][k]; }
      }
   }

   cout << dp[N-1][W] << endl;
  
   return 0;
}


Measured memory_bytes: 78336
#include<iostream>
#include <stdio.h>
#include <string>
#include <string.h>
#include <algorithm>
#include <functional>
#include <vector>

using namespace std;
int main()
{
	long long i = 0;
	long long ans = 1;
	cin >> i;

	for (long long j = 1; j < i+1; j++) {
		ans = (ans*j) % (1000000000 + 7);
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int main(){
	int n,q;
	cin>>n>>q;
	int s[n],t[n],x[n];
	rep(i,n)cin>>s[i]>>t[i]>>x[i];
	set<pair<int,int>> st;
	rep(i,q){
		int a;
		cin>>a;
		st.insert({a,i});
	}
	st.insert({inf,-1});
	vector<int> ord(n);
	iota(ord.begin(),ord.end(),0);
	sort(ord.begin(),ord.end(),[&](int u,int v){
		return x[u]<x[v];
	});
	vector<int> ans(q,-1);
	for(auto i : ord){
		auto itr=st.lower_bound({-x[i]+s[i],-1});
		while(itr->first<-x[i]+t[i]){
			ans[itr->second]=x[i];
			itr=st.erase(itr);
		}
	}
	for(auto e : ans)cout<<e<<endl;
	return 0;
}

Measured memory_bytes: 16128
import java.util.Scanner;
public class Main{
    public static void main(String[]argc){
        Scanner sc = new Scanner(System.in);
        int[] card1 = new int[50];
        int[] card2 = new int[50];
        while(true){
            int n = sc.nextInt();
            int r = sc.nextInt();
            if(n==0&&r==0)
                break;
            for(int i=0;i<n;i++){
                card1[i] = n-i;
            }
            for(int x=0;x<r;x++){
                int p = sc.nextInt();
                int c = sc.nextInt();
                for(int j=0;j<p-1;j++){
                    card2[j] = card1[j];
                }
                for(int k=0;k<c;k++){
                    card1[k] = card1[k+p-1];
                }
                for(int m=c;m<c+p-1;m++){
                    card1[m] = card2[m-c];
                }
            }
            System.out.println(card1[0]);
        }
    }
}


Measured memory_bytes: 37460
#include <iostream>
  
int main(int argc, const char *argv[]) {
    int n;
    std::cin >> n;
    int r, rmin, rmax, rtmp;
    std::cin >> rmin;
    std::cin >> rmax;
    rtmp = std::min(rmax, rmin);
    for (int t = 2; t < n; t++) {
        std::cin >> r;
        if (rmax >= rmin) {
            if (r > rmax) {
                rmax = r;
                rmin = rtmp;
            } else if (rtmp > r) {
                rtmp = r;
            } else {
                if (r - rtmp > rmax - rmin) {
                    rmax = r;
                    rmin = rtmp;
                }
            }
        } else {
            if (r >= rtmp) {
                rmax = r;
                rmin = rtmp;
                rtmp = rmin;
            } else {
                if (rtmp - r > rmin - rmax) {
                    rtmp = r;
                } else {
                    rmax = r;
                    rmin = rtmp;
                    rtmp = rmax;
                }
            }
        }
    }
    std::cout << (rmax - rmin) << std::endl;
    return 0;
}

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

int main() {
    int abc[3];
    cin >> abc[0] >> abc[1] >> abc[2];
    sort(abc, abc + 3);

    int ans = 0;
    while (abc[0] < abc[2] && abc[1] < abc[2]) {
        abc[0]++; abc[1]++; ans++;
    }
    while (abc[0] < abc[2]) {
        abc[0] += 2; ans++;
    }
    if (abc[0] > abc[2]) ans++;

    cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define mt              make_tuple
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define range(a,b)		substr(a,b-a+1)
#define w(x)            int x; cin>>x; while(x--)
#define trace(x) 		cerr<<#x<<": "<<x<<" "<<endl;
#define FIO             ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;

int32_t main()
{
	FIO;
	int n; cin >> n;
	mk(arr, n, int);

	for (int i = 0; i < n; ++i)
		cin >> arr[i];

	sort(arr, arr + n);

	int ans = 0;

	for (int i = n / 2 ; i + 1 < n; ++i)
		ans += 2 * arr[i + 1];

	ans -= arr[n - 1];
	ans += arr[n / 2];

	if (!(n % 2))
		ans += arr[n / 2];

	//(n+1)/2 will come and get some comfort;
	//then, rest, 1st will get a[n-2], then a[n-3] .. 2 times a[n/2];

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

Measured memory_bytes: 5228
#include <bits/stdc++.h>
using namespace std;
typedef long long int lld;
typedef vector<int> vi;
typedef pair<int,int> pi;
#define F first
#define S second
#define MOD 1000000007
#define PB push_back
#define MP make_pair
#define rep(i,a,b) for (int i = a; i < b; i++)
static lld r,j,a,m,b,l,x,y,n,s,q,i,z,p,k,c,d,t;string s1,s2,s3;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin>>n;
    cout<<24+abs(n-24);
}

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


int main(void){
  int h,w;
  cin >> h >> w;
  vector<vector<char>>coordinate(h,vector<char>(w));
  for (int i = 0;i < h;i++){
    for (int j = 0; j < w;j++){
      cin >> coordinate[i][j];
    }
  }
  const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
  const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
  for (int i = 0; i < h; i++){
    for (int j = 0; j < w ; j++){
      int num = 0;
      if (coordinate[i][j] == '#'){
        cout << '#' ;
        if (j == w-1){
        cout << endl;
        }
        continue;
      }
      else{
        for (int k = 0; k < 8; k++){
          
          int ni = i + dy[k];
          int nj = j + dx[k];
          if (ni < 0 || ni >= h)
            continue;
          if (nj < 0 || nj >= w)
            continue;
          
          if (coordinate[ni][nj] == '#'){
            num++;
            
          }
        }//else内for 終了
      cout << num ;
        if (j == w-1){
        cout << endl;
        }
    }//else終了
     
  }//for -j 終了
  }
}

    
    
    
          
              
          
                       
       

        


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

int main() {
    int N; cin >> N;
    rep(i, N) cout << "ACL";
    cout << endl;
    return 0;
}

Measured memory_bytes: 3592
N,K,C = map(int,input().split())
S = str(input())
works1 = 0
works2 = 0
l1 = []
l2 = []
i = 0
while i < N and works1 < K:
  if S[i] == "o":
    l1.append(i+1)
    i = i+C+1
    works1 += 1
  else:
    i = i+1
i = N-1
while i > -1 and works2 < K:
    if S[i] == "o":
      l2.append(i+1)
      i = i-C-1
      works2 = works2+1
    else:
      i = i-1

for i in range(len(l1)):
  if l1[i] == l2[-i-1] :
    print(l1[i])

Measured memory_bytes: 20620
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(), (x).end()
using namespace std;
using VI = vector<int>;
using VB = vector<bool>;
using Graph = vector<vector<int>>;
using ll = long long;
using P = pair<int, int>;

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n, m;
  cin >> n >> m;
  vector<bool> ac(n, false);
  vector<int> wa(n);

  rep(i, m)
  {
    int p;
    cin >> p;
    string s;
    cin >> s;

    p--;
    if (ac[p])
      continue;
    if (s == "AC")
      ac[p] = true;
    else if (s == "WA" && !ac[p])
      wa[p]++;
  }

  int AC = 0;
  int WA = 0;
  rep(i, n){
    AC += ac[i];
    // acした時のみ、ペナルティーが加算されることに注意
    if (ac[i]) WA += wa[i];
  }

  cout << AC << endl;
  cout << WA << endl;
}

Measured memory_bytes: 640
def solution(a, b):
    total = a + b
    if total % 3 == 0:
        print('Possible')
    elif a % 3 == 0:
        print('Possible')
    elif b % 3 == 0:
        print('Possible')
    else:
        print('Impossible')

A, B = input().split(' ')
A, B = int(A), int(B)

solution(A, B)

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

int main(){
    int N;
    bool isPrime[1001000];
    for(int i=0; i<=1000010; i++)isPrime[i]=true;
    isPrime[0]=false;
    isPrime[1]=false;
    for(int i=2; i<=1000010; i++){
        if(isPrime[i]){
            for(int j=2*i; j<=1000010; j+=i)isPrime[j]=false;
        }
    }
    while(cin>>N){
        int cnt=0;
        for(int i=2; i<=N; i++){
            if(isPrime[i])cnt++;
        }
        cout<<cnt<<endl;
    }
}


Measured memory_bytes: 4016
n,m = map(int, input().split())
h = list(map(int, input().split()))
a = [0]*m
b = [0]*m
for i in range(m):
    a[i],b[i] = map(int, input().split())
good = [1]*n
for i in range(m):
    if h[a[i] - 1] > h[b[i] - 1]:
        good[b[i] - 1] = 0
    if h[a[i] - 1] < h[b[i] - 1]:
        good[a[i] - 1] = 0
    if h[a[i] - 1] == h[b[i] - 1]:
        good[a[i] - 1] = 0
        good[b[i] - 1] = 0
print(sum(good))

Measured memory_bytes: 21744
import sys

h,w = [int(i) for i in input().split()]

sys.setrecursionlimit(100000)

s = [['#']*(w+2)] + [['#']+list(input())+['#'] for _ in range(h)] + [['#']*(w+2)]
#print(s)

cost = [[-1 if s[y][x] == '#' else float('inf') for x in range(w+2)] for y in range(h+2)]
cost[1][1] = 0
#print(cost)

move_que = [[1,1]]

def list_flatten(nested_list):
  flat_list = []
  fringe = [nested_list]
  
  while len(fringe) > 0:
    node = fringe.pop(0)
    if isinstance(node, list):
      fringe = node + fringe
    else:
      flat_list.append(node)

  return(flat_list)
      
def move(place):
  y,x = place
  if cost[y+1][x] != -1 and cost[y+1][x] == float('inf'):
      cost[y+1][x] = cost[y][x]+1
      move_que.append([y+1,x])       
      
  if cost[y-1][x] != -1 and cost[y-1][x] == float('inf'):
      cost[y-1][x] = cost[y][x]+1
      move_que.append([y-1,x])
  
  if cost[y][x+1] != -1 and cost[y][x+1] == float('inf'):
      cost[y][x+1] = cost[y][x]+1
      move_que.append([y,x+1])
  
  if cost[y][x-1] != -1 and cost[y][x-1] == float('inf'):
      cost[y][x-1] = cost[y][x]+1
      move_que.append([y,x-1])
  
while len(move_que) != 0:
  move(move_que[0])
  move_que = move_que[1:]

#print(cost)

if cost[h][w] == float('inf'):
  print(-1)
else:
  while_num = list_flatten(s).count('.')
  print(while_num - (cost[h][w]+1))


Measured memory_bytes: 3192
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
struct P{
  int c,n;
  P(int c,int n):c(c),n(n){}
};
vector<P> g;
int main(void)
{
  while(1){
    int n;
    cin >> n;
    if(!n)break;
    g.clear();

    for(int i = 1; i <= n; i++){
      int b;
      cin >> b;
      if(i % 2){
	if(!g.size()){
	  g.push_back(P(b,1));
	}else if(g[g.size()-1].c == b){
	  g[g.size()-1].n++;
	}else{
	  g.push_back(P(b,1));
	}
      }else{
	if(g[g.size()-1].c == b){
	  g[g.size()-1].n++;
	}else{
	  if(g.size() >= 2){
	    g[g.size()-2].n += g[g.size()-1].n + 1;
	    g.pop_back();
	  }else{
	    g[g.size()-1].n += 1;
	    g[g.size()-1].c = b;
	  }
	}
      }  

      /*
      cout << endl;
      for(int i = 0; i < (int)g.size(); i++){
	cout << g[i].c << ":" << g[i].n << endl;
      }
      cout << endl; 
      */

    }
    int ret = 0;
    //cout << endl;
    for(int i = 0; i < (int)g.size(); i++){
      //cout << g[i].c << ":" << g[i].n << endl;
      if(!g[i].c) ret += g[i].n;
    }
    //cout << endl;
    cout << ret << endl;
  }
}

Measured memory_bytes: 1196
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));

	   int n = Integer.parseInt( br.readLine() );
	   String[] string =  br.readLine().split(" ");
       int[] S = new int[n];


       for(int i = 0; i < n; i++ ){

    	   S[i] = Integer.parseInt( string[i] );

       }

       int q = Integer.parseInt( br.readLine() );
	   String[] stringq =  br.readLine().split(" ");
       int[] T = new int[q];


       for(int i = 0; i < q; i++ ){

    	   T[i] = Integer.parseInt( stringq[i] );

       }


       int answer = 0;

       for(int i = 0; i < q ; i++ ){
    	   for(int j = 0; j < n ;  j++ ){
    		   if( S[j] == T[i]  ){
    			   answer++;
    			   break;
    		   }
    	   }

       }

     System.out.println(answer);


   }


}

Measured memory_bytes: 27612
#include<iostream>
#include<map>
#include<string>
#include<algorithm>

using namespace std;

int main()
{
    int N; cin >>N;
    map<string,int> m;

    for(int i=0;i<N;++i)
    {
        string s;cin >> s;
        m[s]++;
    }
    int maxv=0;
    for(map<string,int>::iterator i = m.begin();i !=m.end();++i)
    {
        if(maxv<i->second)
        {
            maxv=i->second;
        }
    }
    for(map<string,int>::iterator i=m.begin();i !=m.end();++i)
    {
        if(maxv==i->second)
        {
            cout << i->first << endl;
        }
    }
}


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

using namespace std;

const int N = 1e6+6,M=1e9+7,OO=0x3f3f3f3f;

int n,m,k,dots;
string s;

int main(){
    scanf("%d%d%d",&n,&m,&k);
    if(n+m+k<22)
        printf("win");
    else
        printf("bust");
    return 0;
}


Measured memory_bytes: 256
def main():
    N, M, *PY = map(int, open(0).read().split())
    lst = []
    ans = [""] * M
    for k, py in enumerate(zip(*[iter(PY)] * 2)):
        lst.append((py[0], py[1], k))
    lst.sort()
    pre, num = lst[0][0], 1
    for cur, y, i in lst:
        if pre != cur:
            num = 1
        ans[i] = "{:06}{:06}".format(cur, num)
        num += 1
        pre = cur
    print("\n".join(ans))
    return


main()


Measured memory_bytes: 32976
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var isProduct = false

func isKaibun(s string) bool {
	runes := []rune(s)
	for i, j := 0, len(runes)-1; i < j; i, j = i+1, j-1 {
		if runes[i] != runes[j] {
			return false
		}
	}
	return true

}

func main() {

	nextReader = newScanner()

	s := nextString()

	n := len(s)

	if isKaibun(s) {

		s = s[0 : (n-1)/2]

		if isKaibun(s) {
			fmt.Println("Yes")
			return
		}

	}
	fmt.Println("No")
}

/* --------------------------------------------------------------------------
 *  std.io
 * ------------------------------------------------------------------------- */
var nextReader func() string

func newScanner() func() string {
	r := bufio.NewScanner(os.Stdin)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)
	return func() string {
		r.Scan()
		return r.Text()
	}
}
func nextString() string {
	return nextReader()
}
func nextInt64() int64 {
	v, _ := strconv.ParseInt(nextReader(), 10, 64)
	return v
}
func nextInt() int {
	v, _ := strconv.Atoi(nextReader())
	return v
}
func nextInts(n int) []int {
	r := make([]int, n)
	for i := 0; i < n; i++ {
		r[i] = nextInt()
	}
	return r
}
func nextInt64s(n int) []int64 {
	r := make([]int64, n)
	for i := 0; i < n; i++ {
		r[i] = nextInt64()
	}
	return r
}
func nextFloat64() float64 {
	f, _ := strconv.ParseFloat(nextReader(), 64)
	return f
}

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

func abs(x int) int {
	if x < 0 {
		return -x
	}
	return x
}


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

typedef long long ll;
const ll INF = 1LL<<60, MOD = 1e9 + 7;
const double EPS = 1e-9, PI = 3.141592653589793;
#define REP(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
#define all(v) (v).begin(), (v).end()

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  ll n,s1,s2,ans=INF;
  cin >> n;
  vector<ll> w(n);
  rep(i,n) cin >> w[i];
  rep(i,n-1){
    s1 = s2 = 0;
    ll tmp1 = i;
    ll tmp2 = i;
    while(tmp2>=0){
      s1 += w[tmp2];
      tmp2--;
    }
    REP(j,tmp1+1,n){
      s2 += w[j];
    }
    ans = min(ans,abs(s1-s2));
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define ll long long
#define pb push_back
#define mp make_pair
bool isPrime(ll n) 
{ 
    
    if (n <= 1)  return false; 
    if (n <= 3)  return true; 
   
    if (n%2 == 0 || n%3 == 0) return false; 
  
    for (ll i=5; i*i<=n; i=i+6) 
        if (n%i == 0 || n%(i+2) == 0) 
           return false; 
  
    return true; 
} 
int minthis(int a, int b){
if(a < b){
return a;
}
return b;
}
int maxthis(int a, int b){
if(a > b){
return a;
}
return b;
}
int gcd(int a, int b){
    if( a<0 ) a = -a;
    if( b<0 ) b = -b;
    while( b!=0 ){
        a %= b;
        if( a==0 ) return b;
        b %= a;
    }
    return a;
}
 
int findLargestDivisor(int n) 
{ 
	int max = 1;
    for (int i = 2; i < n; i++) {        
        if(n %(i) == 0) { 
            max = i;
        } 
    }
    return max;     
} 
 
 
ll power(ll x, ll y)  
{  
    ll temp;  
    if(y == 0)  
        return 1;  
    temp = power(x, y / 2);  
    if (y % 2 == 0)  
        return temp * temp;  
    else
    {  
        if(y > 0)  
            return x * temp * temp;  
        else
            return (temp * temp) / x;  
    }  
}  
 /*
const int mxN = 200005;
int father[mxN] = {}, level[mxN] = {}, subtree[mxN] = {}, count_sons[mxN] = {};vector<int> e[mxN];priority_queue<pair<int,int>> pq; 
 
 
void dfs(int node, int fr){
	father[node] = fr;
	for(auto x : e[node]){
		if(x != fr){
			count_sons[node]++;
			level[x] = level[node]+1;
			dfs(x,node);
		}
	}
	if(count_sons[node] == 0){
		
		pq.push({node, level[node]});
		cout << node << endl;
	}
} 
	
 */
 
const int mxN = 2e5;
vector<int> arr[mxN];
void solve(){	
int n;
cin >> n;ll ans = 0;
for(int i = 1 ; i <= n ; i++){
	ans += (i)*(ll)(n-i+1);
}
for(int i = 1; i < n ;i++){
	int u,v;
	cin >> u >> v;
	int min = minthis(u,v);int max = maxthis(u,v);
	ans -= (min)*(ll)(n-max+1);
}
	cout << ans << "\n";
}
  
int main(){ 
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int t = 1;    
    //cin >> t;
    while(t--){
		solve();
	}
    return 0; 
}


Measured memory_bytes: 8304
#include<bits/stdc++.h>
using namespace std;
int a[10000],b;
int main()
{
    cin>>a[1]>>a[2]>>a[3];
    sort(a+1,a+4);
    if(a[2]-a[1]==a[3]-a[2])
    {
        cout<<"YES"<<endl;
    }
    else
    {
        cout<<"NO"<<endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
  int A , B , C , D;
  int L , R;
  cin >> A >> B >> C >> D;
  L = A + B;
  R = C + D;

        if  (L > R) {cout << "Left";
  } else if (L == R){cout << "Balanced";
  } else if (L < R) {cout << "Right";
  }
}


Measured memory_bytes: 3540
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

template<class T> inline T sqr(T x) {return x*x;}

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

#define CLR(a) memset((a), 0 ,sizeof(a))

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

/* 0-indexed only */
class SegmentTree{
private:
  int *stree;
  int n;
public:
  SegmentTree(int N);
  ~SegmentTree();
  void add(int i, int x);
  int getSum(int s, int t);
  int query(int s, int t, int k, int l, int r);
  int ope(int x, int y);
};

SegmentTree::SegmentTree(int N){
  int leading_zero = __builtin_clz(N);

  /* find nearest power of 2 for given N */
  if(__builtin_popcount(N) == 1) n = 1<<(sizeof(int)*8-leading_zero-1);
  else n = 1<<(sizeof(int)*8-leading_zero);

  /* initializing nodes as INF */
  stree = new int[2*n-1];
  for(int i=0;i<2*n-1;i++){
    stree[i] = 0;
  }

}

SegmentTree::~SegmentTree(){
  delete [] stree;
}

int SegmentTree::ope(int x, int y){
  return x+y;
}

void SegmentTree::add(int i, int x){
  int j;

  /* deepest number of nodes */
  j = i + n - 1;
  stree[j] += x;

  while(j>0){
    /* number of upper node */
    j = (j-1)/2;
    stree[j] = ope(stree[2*j+1], stree[2*j+2]);
  }
}

int SegmentTree::getSum(int s, int t){
  return query(s, t+1, 0, 0, n);
}

/* query gives the minimum of [s, t) */
int SegmentTree::query(int s, int t, int k, int l, int r){
  if(r <= s || t <= l) return 0;
  if(s <= l && r <= t) return stree[k];
  else{
    int vl = query(s, t, 2*k+1, l, (l+r)/2);
    int vr = query(s, t, 2*k+2, (l+r)/2, r);
    return ope(vl, vr);
  }
}

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

  SegmentTree seg(n);

  for(int i=0;i<q;i++){
    int com, x, y;
    cin >> com >> x >> y;
    if(com == 0){
      x--;
      seg.add(x, y);
    }
    if(com == 1){
      x--;
      y--;
      cout << seg.getSum(x, y) << endl;
    }
  }

  return 0;
}

Measured memory_bytes: 2060
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define repr(i, n) REPR(i, n, 0)
#define REPR(i, s, e) for(int i=(int)(s-1); i>=(int)(e); i--)
#define pb push_back
#define all(r) r.begin(),r.end()
#define rall(r) r.rbegin(),r.rend()
#define fi first
#define se second

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const ll INF = 1e18;
const ll MOD = 1e9 + 7;
const double EPS = 1e-8;

template<typename T> T chmax(T& a, const T& b){return a = (a > b ? a : b);}
template<typename T> T chmin(T& a, const T& b){return a = (a < b ? a : b);}

int main(){
    int n, m;
    cin >> n >> m;
    vector<vi> s(m);
    rep(i, m) {
        int k;
        cin >> k;
        s[i].resize(k);
        rep(j, k) {
            cin >> s[i][j];
            s[i][j]--;
        }
    }
    vi p(m);
    rep(i, m) cin >> p[i];
    int ans = 0;
    rep(mask, 1<<n) {
        bool f = true;
        rep(i, m) {
            int cur = 0;
            for(auto&& j: s[i]) if(mask&(1<<j)) cur ^= 1;
            f &= cur == p[i];
        }
        if(f) ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
N, Q = map(int, input().split())
S = input()
t=[0]*(N+1)

for i in range(N):
  t[i + 1] = t[i] + (1 if S[i : i + 2] == 'AC' else 0)
for i in range(Q):
  l, r = map(int, input().split())
  print(t[r-1] - t[l-1])

Measured memory_bytes: 7748
integer N,tmp
integer(8)ans
integer NumOfPrime(168),primenumbers(168)
read*,N
NumOfPrime=0
call getprime(1000,primenumbers)
do i=2,N
  tmp=i
  do j=1,168
    do while(mod(tmp,primenumbers(j))==0)
      NumOfPrime(j)=NumOfPrime(j)+1
      tmp=tmp/primenumbers(j)
    end do
  end do
end do
ans=1
do i=1,168
  ans=mod(ans*(NumOfPrime(i)+1),10**9+7)
end do
print"(i0)",ans
contains
subroutine getprime(N,array)
  integer N
  integer,dimension(:)::array
  integer ind
  logical pr
  array(1)=2;ind=1
  do i=3,N
    pr=.true.
    do j=1,ind
      if(mod(i,array(j))==0)then
        pr=.false.
        exit
      endif
    end do
    if(pr)then
      array(ind+1)=i;ind=ind+1
    endif
  end do
end subroutine
end

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

int main(){
    int N, count4n=0, count2n=0, counto=0, tmp=0;
    cin >> N;
    int a[N];
    for(int i=0;i<N;i++){
      cin >> a[i];
      if(a[i]%4==0){
        count4n += 1;
      }else if(a[i]%4==2){
        count2n += 1;
      }else{
        counto += 1;
      }
    }
    if(count2n == 0){
      tmp = 0;
    }else{
      tmp = 1;
    }

    if(count4n + 1 >= counto + tmp){
      cout << "Yes" << endl;
    }else{
      cout << "No" << endl;
    }
}

Measured memory_bytes: 640
#include<iostream>
#include<set>
#include<queue>
using namespace std;

const int N = 100005;
char col[N];
int x, y, f[N], ans, sum, n, vis[N];
set<int>g[N];
queue<int>q;

int dfs(int x, int fa = -1) {
	int mx = 0;
	for (int i : g[x])
		if (i != fa) {
			int u = dfs(i, x);
			ans = max(ans, f[x] + u + mx);
			mx = max(mx, u);
		}
	return mx + f[x];
}
int main() {
	scanf("%d", &n);
	for (int i = 1; i < n; i++) {
		scanf("%d%d", &x, &y);
		g[x].insert(y);
		g[y].insert(x);
	}
	scanf("%s", col + 1);
	for (int i = 1; i <= n; i++)
		if (col[i] == 'B' && (int)g[i].size() <= 1)q.push(i), vis[i] = 1;
	while (!q.empty()) {
		int x = q.front(); q.pop();
		for (int i : g[x]) {
			g[i].erase(x);
			if ((int)g[i].size() <= 1 && col[i] == 'B' && !vis[i])q.push(i), vis[i] = 1;
		}
		g[x].clear();
	}
	int rt = 0;
	for (int i = 1; i <= n; i++) {
		sum += g[i].size();
		if ((col[i] == 'W') ^ (g[i].size() & 1))sum++, f[i] = 2;
		else f[i] = 0;
		if (col[i] == 'W')rt = i;
	}
	if (rt)dfs(rt);
	printf("%d\n", sum - ans);
	
  	return 0;
}

Measured memory_bytes: 20992
#include <stdio.h>

int main() {
	int a, kara, e, k;

	scanf("%d %d %d %d %d %d", &a, &kara, &kara, &kara, &e, &k);

	if (k >= e - a) {
		printf("Yay!\n");
	}
	else {
		printf(":(\n");
	}

	return 0;
}

Measured memory_bytes: 128
/*
 
                              Jai Shree Krishna !!
                                 Radhe Radhe !!
                                 
             उद्यमेन हि सिद्ध्यन्ति कार्याणि न मनोरथैः। नहि सुप्तस्य सिंहस्य मुखे प्रविशन्ति मृगाः।।
             
*/
   
   
#include <bits/stdc++.h>
using namespace std;
 
#define int long long
typedef long long ll;
#define loop(i,n)  for(int i=0;i<n;i++)
#define ford(i,a,b) for(int i=b;i>=a;i--)
#define read(a) int a; cin >>a;
#define readarr(a,n) int a[n] ; for(int i=0;i<n;i++) cin >> a[i];
#define readmat(a,n,m) int a[n][m]; for(int i=0;i<n;i++) for(j=0;j<m;j++) cin >> a[i][j];
#define pb push_back
#define ff first
#define ss second
#define vi vector<int>
#define pi pair<int,int>
#define vii vector<vector<int>>
#define sti set<int>
#define vpi vector<pair<int,int>>
#define print(a,n) for(int i=0;i<n;i++) cout<<a[i]<<" "; cout<<endl;
#define printmat(a,n,m) for(int i=0;i<n;i++) {for(j=0;j<m;j++) cout<<a[i][j]<<" "; cout<<endl;}
#define fast ios_base::sync_with_stdio(false);  cin.tie(NULL);
#define endl "\n"
#define mp make_pair
const ll inf = 1e18;
const ll mod = 1e9 + 7;
 
vii ans;
void allPossibleSubset(int arr[],int n)
{
	int  count = pow(2,n);
	// The outer for loop will run 2^n times to print all subset .
	// Here variable i will act as a binary counter
	for (int i = 0; i < count; i++)
	{
		// The inner for loop will run n times , As the maximum number of elements a set can have is n
		// This loop will generate a subset
		vi v;
		for (int j = 0; j < n; j++)
		{
			// This if condition will check if jth bit in binary representation of  i  is set or not
			// if the value of (i & (1 << j)) is greater than 0 , include arr[j] in the current subset
			// otherwise exclude arr[j]
			if ((i & (1 << j)) > 0)
				v.pb(arr[j]);
		}
		ans.pb(v);
	}
	
}

signed main()
{
 
    fast;
     int n,m,x;
     cin >> n >> m >> x;
     vi v[n],c(n);
     for(int i=0;i<n;i++){
     	cin >> c[i];
     	loop(j,m) {
     		int x;
     		cin >> x;
     		v[i].pb(x);
     	}
     }
     int a[n];
     int an=inf;
     for(int i=0;i<n;i++) a[i]=i; 
     allPossibleSubset(a,n);
     for(int i=0;i<ans.size();i++){
     	int ct=0,cc=0;
     	for(int r=0;r<m;r++){
     		int s=0;
     	for(auto j:ans[i]){
     		s+=v[j][r];
     	}
     	if(s>=x) ct++;
      }
      if(ct==m) {
      	for(auto j:ans[i]) cc+=c[j];
      	an = min(cc,an);
      }
     }
     if(an==inf) cout<<"-1"<<endl;
     else
     cout<<an<<endl;
    return 0;
}
 
/* Pooja Yadav */

Measured memory_bytes: 4444
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << x << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
typedef long long ll;
ll a[100010];
ll b[100010];
ll c[100010];
ll s[100010];
ll m[100010];
ll gcd(ll x,ll y){
	if(y==0) return x;
	return gcd(y,x%y);
}
ll ex(ll x,ll p,ll mod){
	ll a=1;
	while(p){
		if(p%2) a=a*x%mod;
		x=x*x%mod;
		p/=2;
	}
	return a;
}
ll geo(ll x,ll p,ll mod){	//1+x+..+x^(p-1)
	if(p==0) return 0;
	ll a=0,s=1,t=1;
	while(p){
		if(p%2){
			a=(a+s*t)%mod;
			s=s*x%mod;
		}
		t=t*(1+x)%mod;
		x=x*x%mod;
		p/=2;
	}
	return a;
}
typedef pair<int,int> P;
ll getord(ll M,ll a){
	ll H=sqrt(M)+1;
	vector<P> babies;
	ll p=1;
	rep(i,H){
		babies.pb(P(p,i));
		p=p*a%M;
	}
	ll q=p;
	sort(all(babies));
	rep1(i,H){
		int pos=upper_bound(all(babies),P(p,H))-babies.begin()-1;
		if(pos>=0&&babies[pos].fs==p) return i*H-babies[pos].sc;
		p=p*q%M;
	}
}
ll pre,parg;
void getnext(ll M,ll L,int id){
	ll p=L;
	ll gs[101];
	gs[0]=1;
	rep(i,100){
		gs[i+1]=gcd(p,M);
		if(gs[i]==gs[i+1]){
			a[id]=i;
			s[id]=geo(L,i,M);
			ll g=gs[i];
			c[id]=ex(L,i,M);
			M/=g;
			break;
		}
		p=p*L%M;
	}
	if(M==pre){
		m[id]=parg;
		return;
	}
	ll o=getord(M,L);
	ll ss=geo(L,o,M);
	m[id]=M/gcd(M,ss)*o;
	pre=M,parg=m[id];
}
ll getans(ll b,ll M,ll L){
	return (2*ex(L,b,M)+M-1)%M;
}
int solve(ll N,ll M,ll L){
	pre=-1;
	if(N==0) return 1;
	if(N==1) return L%M;
	if(N==2) return getans(1,M,L);
	if(N==3) return getans(2,M,L);
	if(N==4) return getans(2*(L+1),M,L);
	N++;
	m[N]=M;
	for(ll x=N-1;x>=4;x--){
		getnext(m[x+1],L,x);
	}
	b[4]=2*(L+1)%m[4];
	for(ll x=4;x<N;x++){
		ll p=(b[x]-a[x])%m[x];
		if(p<0) p+=m[x];
		b[x+1]=2*(s[x]+c[x]*geo(L,p,m[x+1]))%m[x+1];
	}
	return (b[N]*(L-1)+1)%M;
}
int main(){
	for(int t=1;;t++){
		ll N,M,L;
		cin>>N>>M>>L;
		if(M==0) break;
		printf("Case %d: %d\n",t,solve(N,M,L));
	}
}

Measured memory_bytes: 5524
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
typedef vector<ll> vl;
typedef vector<int> vi;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> vvl;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvec;
typedef vector<vector<bool>> vveb;
typedef vector<vector<string>> vves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define fs first
#define sc second
#define pb push_back
#define pp pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
typedef long long int64;
#define dame { puts("-1"); return 0;}
#define YES { cout << "YES" << endl; return 0; }
#define NO { cout << "NO" << endl; return 0; }
#define Yes { cout << "Yes" << endl; return 0; }
#define No { cout << "No" << endl; return 0; }
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 (a > b) { a = b; return 1; } return 0; }
#include <chrono>

int fibonacci(int n) {
	if (n < 0)return -1;
	if (n == 0)return 0;
	if (n == 1)return 1;
	return fibonacci(n - 1) + fibonacci(n - 2);
}
int d_fibonacci(int n) {
	int a, b, c;
	a = 0;
	b = 1;
	if (n == 0)return a;
	if (n == 1)return b;
	rep(i, n) {
		c = a + b;
		a = b;
		b = c;
	}
	return c;
}
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);

	int X, Y, Z;
	cin >> X >> Y >> Z;
	cout << Z << " " << X << " " << Y;

	return 0;
}


Measured memory_bytes: 892
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back

using namespace std;
const long long MOD = (long long)1e9 + 7;
unsigned long long a, b;
unsigned long long fun(long long x)
{
	int cur = 0;
	unsigned long long tmp = x;
	bitset<64> bst;
	if (tmp%2) {
		if (tmp % 4 == 1 || tmp % 4 == 2) bst[0] = 1;
	}
	else {
		return fun(x - 1) ^ tmp;
	}
	return bst.to_ullong();
}

int main()
{
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> a >> b;
	unsigned long long c;
	b = fun(b);
	if (a) {
		a = fun(a - 1);
		c = a ^ b;
	}
	else c = b;
	cout << c << "\n";
	//system("pause");
	return 0;
}

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

int main()
{
  string s;int flag=0;
  cin>>s;
  for(int i=0;i<3;i++)
  {
	if(s[i]=='7')
    {
      flag=1;
      break;
    }
  }
  if(flag)
  cout<<"Yes";
  else cout<<"No";
}

Measured memory_bytes: 3592