akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int> >;
#define rep(i, n)         for(int i = 0; i < (int)(n); i++)
#define brep(n)           for(int bit=0;bit<(1<<n);bit++)
#define erep(i,container) for (auto i : container)
#define irep(i, n)        for(int i = n-1; i >= (int)0; i--)
#define rrep(i,m,n) for(int i = m; i < (int)(n); i++)
#define reprep(i,j,h,w) rep(i,h)rep(j,w)
#define all(x) (x).begin(),(x).end()
#define aall(x,n) (x).begin(),(x).begin()+(n)
#define VEC(type,name,n) std::vector<type> name(n);rep(i,n)std::cin >> name[i];
#define pb push_back
#define pf push_front
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define itn int
#define mp make_pair
#define sum accumulate
#define keta fixed<<setprecision
#define vvector(name,typ,m,n,a)vector<vector<typ> > name(m,vector<typ> (n,a))
#define vvvector(name,t,l,m,n,a) vector<vector<vector<t> > > name(l, vector<vector<t> >(m, vector<t>(n,a)));
#define vvvvector(name,t,k,l,m,n,a) vector<vector<vector<vector<t> > > > name(k,vector<vector<vector<t> > >(l, vector<vector<t> >(m, vector<t>(n,a)) ));
typedef long long ll;
const int INF = 2000000000;
const ll INF64 = 1000000000000000ll;
const ll MOD = 1000000007LL;
int main(){
    int a,b,c,d;
    std::cin >> a>>b>>c>>d;
    if(a+b>c+d)std::cout << "Left" << std::endl;
    if(a+b==c+d)std::cout << "Balanced" << std::endl;
    if(a+b<c+d)std::cout << "Right" << std::endl;
}

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

using namespace std;

template <typename T> T gcd(T x, T y) {
  if (y == 0)
    return x;
  return gcd(y, x % y);
}

template <typename T> T lcm(T x, T y) {
  if (x == 0 || y == 0)
    return 0;
  return x / gcd(x, y) * y;
}

int main() {
  string S;
  cin >> S;
  int K;
  cin >> K;
  set<string> st;
  int N = S.size();
  for (int i = 0; i < N; i++) {
    for (int j = 1; j <= min(N - i, 5); j++) {
      st.insert(S.substr(i, j));
    }
  }
  int i = 0;
  for (auto x : st) {
    i++;
    if (i == K) {
      cout << x << endl;
      return 0;
    }
  }
}


Measured memory_bytes: 1664
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
typedef long long i64;
int main(){
    int X,A,B;
    cin >> X >> A >> B;
    cout << (B-A<=X ? (A>=B ? "delicious":"safe"):"dangerous") << endl;
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cassert>
#include<algorithm>
#include<vector>
using namespace std;
 
const int N = 4e5;
int a[N+3];
int d[N+3];
int dp[N+3][10];
vector<int> b;
int n;
 
bool cmp(int x,int y) {return x>y;}
 
int main()
{
    scanf("%d",&n);
    for(int i=1; i<=n; i++) scanf("%d",&a[i]);
    sort(a+1,a+n+1,cmp);
    int pos = 0;
    for(int i=1; i<=n; i++)
    {
        if(a[i]>=i && a[i+1]<=i) {pos = i; break;}
    }
//  printf("pos=%d\n",pos);
    int len1 = 0;
    for(int i=pos+1; i<=n; i++) {if(a[i]>pos-1) len1++;}
    int len2 = a[pos]-pos;
//  printf("len1=%d len2=%d\n",len1,len2);
    if((!(len1&1)) && (!(len2&1))) printf("Second");
    else printf("First");
    return 0;
}

Measured memory_bytes: 3608
while True:
    try:
        rawhand = input().split(",")
        hand = [0]*14
        for card in rawhand:
            if card =="A" : hand[1] += 1
            elif card =="J" : hand[11] += 1
            elif card =="Q" : hand[12] += 1
            elif card =="K" : hand[13] += 1
            else: hand[int(card)] += 1
        pairs = 0
        three = False
        four = False
        minone = 0
        for i in range(14):
            ranks = hand[i]
            if ranks == 1 and minone == 0: minone = i
            elif ranks == 2: pairs += 1
            elif ranks == 3: three = True
            elif ranks == 4: four = True; break

        straight = hand[minone]==1 and hand[minone+1]==1 and hand[minone+2]==1 and hand[minone+3]==1 and hand[minone+4]==1
        straight = straight or (hand[1]==1 and hand[10]==1 and hand[11]==1 and hand[12]==1 and hand[13]==1)

        if four: print("four card")
        elif three and pairs == 1: print("full house")
        elif straight: print("straight")
        elif three: print("three card")
        elif pairs == 2: print("two pair")
        elif pairs == 1: print("one pair")
        else: print("null")
    except EOFError:
        break

Measured memory_bytes: 7552
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b,c,k;
  cin>>a>>b>>c>>k;
  if(k<=a) cout<<k<<endl;
  else if(a<k&&k<=a+b) cout<<a<<endl;
  else cout<<2*a+b-k<<endl;

}


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

#define rep(i, n) for (int i = 0; i < (n); i++)
#define repr(i, n) for (int i = (n)-1; i >= 0; i--)
using namespace std;
typedef long long ll;

const int N = 2 * 1e5 + 5;
int n, q, a, b;
vector<vector<int>> r;
vector<int> ans;

void dfs(int v, int p = -1) {
  for (int u : r[v]) {
    if (u == p) continue;
    ans[u] += ans[v];
    dfs(u, v);
  }
}

int main() {
  cin >> n >> q;
  int p, x;
  r.resize(n);
  ans.resize(n);
  rep(i, n - 1) cin >> a >> b, a--, b--, r[a].push_back(b), r[b].push_back(a);
  rep(i, q) cin >> p >> x, p--, ans[p] += x;
  dfs(0);
  rep(i, n) cout << ans[i] << " ";
  cout << endl;
  return 0;
}


Measured memory_bytes: 24276
#include <iostream>
#define rep(i, n) for(i = 0; i < n; i++)
using namespace std;

int dy[4] = {-1, 0, 1, 0};
int dx[4] = {0, 1, 0, -1};
int w, h;
int a[20][20];
int sy, sx, gy, gx;
int ans;

bool outside(int y, int x) {
	if (y < 0 || y >= h || x < 0 || x >= w) return true;
	return false;
}

void dfs(int y, int x, int depth) {
	if (depth >= ans) { return; }
	if (y == gy && x == gx) {
		ans = depth;
		return;
	}
	if (depth >= ans - 1) { return; }
	
	int i;
	rep(i, 4) {
		int py = y + dy[i];
		int px = x + dx[i];
		if (outside(py, px) || a[py][px] == 1) continue;
		while (true) {
			if (outside(py, px)) break;
			if (!outside(py + dy[i], px + dx[i]) && a[py + dy[i]][px + dx[i]] == 1) break;
			if (a[py][px] == 3) break;
			py += dy[i];
			px += dx[i];
		}
		if (outside(py, px)) continue;
		
		if (a[py][px] != 3) { a[py + dy[i]][px + dx[i]] = 0; }
		dfs(py, px, depth + 1);
		if (a[py][px] != 3) { a[py + dy[i]][px + dx[i]] = 1; }
	}
}

int main() {
	while (cin >> w >> h) {
		if (!w) break;
		
		ans = 11;
		
		int i, j;
		rep(i, h) rep(j, w) cin >> a[i][j];
		rep(i, h) {
			rep(j, w) {
				if (a[i][j] == 2) { sy = i; sx = j; }
				if (a[i][j] == 3) { gy = i; gx = j; }
			}
		}
		dfs(sy, sx, 0);
		if (ans == 11) { cout << -1 << endl; }
		else { cout << ans << endl; }
	}
	return 0;
}


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

int main(void){
	
	int w, h, n;
	int x, y, a;
	int count=0;
	int space[100][100]={0};

	cin >> w >> h >> n;

	for(int i=0; i<h; i++){
		for(int j=0; j<w; j++){
			space[i][j]=1;
		}
				
	}
	


	for(int i=0; i<n; i++){
		cin >> x >> y >> a;


		if(a==1){
			for(int i=0; i<h; i++){
				for(int j=0; j<x; j++){
					space[i][j]=0;
				}
				
			}
				
		}
		
		else if(a==2){
			for(int i=0; i<h; i++){
				for(int j=x; j<w; j++){
					space[i][j]=0;
				}
				
			}
		}
		
		else if(a==3){	
				for(int i=0; i<y; i++){
					for(int j=0; j<w; j++){
					space[i][j]=0;
					}	
				}
		}
		
		else if(a==4){
			for(int i=y; i<h; i++){
					for(int j=0; j<w; j++){
					space[i][j]=0;
					}	
				}
		}
	}


	for(int i=0; i<h; i++){
		for(int j=0; j<w; j++){
			if(space[i][j]==1){
				count++;
			}
		}
	}

	cout << count << endl;
	return 0;
}

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

using namespace std;
vector <int> va[103],vb[103],vc[103],vd[103];
int m,act[103],sol,n,q,a,b,c,d;

void solve(int lvl, int val, int sum)
{
    if(lvl==n+1) return;
    for(int i=val;i<=m;++i)
    {
        act[lvl]=i;
        for(int j=0;j<va[lvl].size();++j)
        {
            int a=va[lvl][j];
            int c=vc[lvl][j];
            int d=vd[lvl][j];

            if(act[lvl]-act[a]==c) sum+=d;
        }
        sol=max(sol,sum);
        solve(lvl+1,i,sum);
        for(int j=0;j<va[lvl].size();++j)
        {
            int a=va[lvl][j];
            int c=vc[lvl][j];
            int d=vd[lvl][j];

            if(act[lvl]-act[a]==c) sum-=d;
        }
    }
}

int main()
{
	cin>>n>>m>>q;

	for(int i=1;i<=q;++i)
    {
        cin>>a>>b>>c>>d;
        va[b].push_back(a);
        vc[b].push_back(c);
        vd[b].push_back(d);
    }
    solve(1,1,0);

    cout<<sol;
    return 0;
}


Measured memory_bytes: 3640
n = int(input())
input_list = [list(input()) for i in range(n)]

and_ = set(input_list[0])
for lists in input_list:
    and_ = and_ & set(lists) 
and_ = list(and_)
and_.sort()

ans = ""
for char in and_:
    f = [i.count(char) for i in input_list]
    ans += min(f) * char
print(ans)

Measured memory_bytes: 3060
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#pragma comment(linker, "/STACK:1024000000")
#pragma warning( disable : 6031)
#pragma warning( disable : 4244)
#pragma warning( disable : 26451)
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <cstdint>
#include <climits>
#include <cassert>
#include <string>
#include <vector>
#include <iostream>
#include <map>
#include <stack>
#include <set>
#include <queue>
#include <numeric>
#include <algorithm>
#include <utility>
#include <bitset>
#include <cmath>
#include <sstream>
#include <functional>
#include <iomanip>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <chrono>

#define all(a) (a).begin(),(a).end()
#define sz(a) (int)(a).size()
#define eps (1e-15)

using namespace std;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

typedef long long ll;
typedef vector<int> vi;
typedef vector< vi > vvi;
typedef vector<double> vd;
typedef vector< vd > vvd;
typedef vector< string > vs;
typedef pair< int, int > pii;
typedef vector< pii > vpii;
typedef vector<ll> vl;
typedef vector<vector<long long>> vvl;
typedef tuple<int, int, int> tiii;
const long long mod = int(1e9) + 7;
const int INF = 1e9;




int main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); cout << setprecision(18) << fixed;
#ifdef LOCAL_MACHINE
	freopen("input.txt", "rt", stdin);
	freopen("output.txt", "wt", stdout);
#endif
	int h, n, s = 0;
	cin >> h >> n;
	for (int i = 0; i < n; i++)
	{
		int t;
		cin >> t;
		s += t;
	}
	cout << (s >= h ? "Yes" : "No");
	return 0;
}

Measured memory_bytes: 256
h,w=map(int,input().split())
n=int(input())
a=[int(j) for j in input().split()]
ans=[[0 for i in range(w)] for j in range(h)]
i,j=0,0
for p in range(n):
    for q in range(a[p]):
        ans[i][j]=p+1
        if j==w-1 and i%2==0:
            i+=1
        elif j==0 and i%2==1:
            i+=1
        elif i%2==0:
            j+=1
        elif i%2==1:
            j-=1

for i in ans:
    print(*i)

Measured memory_bytes: 3912
import bisect,collections,copy,heapq,itertools,math,operator,string
def I(): return int(input())
def S(): return input()
def LI(): return list(map(int,input().split()))
def LS(): return list(input().split())
##################################################
S = S()
ans = 1
if 'S' in S:
    if not 'N' in S:
        ans = 0
if 'N' in S:
    if not 'S' in S:
        ans = 0
if 'E' in S:
    if not 'W' in S:
        ans = 0
if 'W' in S:
    if not 'E' in S:
        ans = 0
print({1:'Yes',0:'No'}[ans])


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

using namespace std;
typedef long long ll;
typedef long double ld;
#define MAX 5000000000000000000LL
#define MIN -5000000000000000000LL

ll n;
ll e[1000010];
ll ans;

int main(void)
{
	scanf("%lld", &n);
	
	for(ll i = 1 ; i <= n ; i++)
	{
		for(ll j = i ; j <= n ; j += i)
			e[j]++;
	}
	
	for(ll i = 1 ; i < n ; i++)
		ans += e[i];
	
	printf("%lld", ans);
	return 0;
}

Measured memory_bytes: 11624
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner stdIn = new Scanner(System.in);
        int a = stdIn.nextInt();
        int b = stdIn.nextInt();
        System.out.print("a ");
        if (a > b) {
            System.out.print(">");
        } else if (a < b) {
            System.out.print("<");
        } else {
            System.out.print("==");
        }
        System.out.println(" b");
    }
}

Measured memory_bytes: 12000
#include<bits/stdc++.h>
#include<algorithm>
#define int long long
#define ll long long
#define endl "\n"
#define ff first
#define ss second
#define pb push_back
#define ios ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define bs binary_search
#define mp make_pair
#define pf push_front
#define pof pop_front()
#define pob pop_back()
#define lb lower_bound
#define ld long double
#define meme(a,no)  memset(a,no,sizeof(a))


using namespace std; 

const int INF=1e9+7;
/*
const int N=2*100000+5;

const int mod=998244353;

vector<vector<int>>v(N);

int vis[N]={0};

int level[N];*/

long long binpow(ll a,ll b){
    ll res=1;
    while(b>0){
        if(b&1){
            res=res*a;
        }
        a=a*a;
        b>>=1;
    }
    return res;
}

long long binpow_mod(ll a,ll b,ll c){
    ll res=1;
    while(b>0){
        if(b&1){
            res=res*a%c;
        }
        a=a*a%c;
        b>>=1;
    }
    return res;
}
/*void dfs(int a){
    vis[a]=1;
    for(auto x:v[a]){
        if(!vis[x]){
            dfs(x);
        }
    }
}*/
//vector<bool>v;
//vector<int>isfactor;

/*void Seive(int n){
    v.assign(n+1,true);
    isfactor.assign(n+1,0);
    v[0]=false; v[1]=false;
    for(int i=2;i<=n;i++){
        if(v[i]){
            isfactor[i]=i;
            for(int j=i*i;j<=n;j+=i){
                if(v[j]){
                    v[j]=false;
                    isfactor[j]=i;
                }
            }
        }
    }
    
}*/
int32_t main(){
    ios
    int T;
    //cin>>T;
    T=1;
    while(T--){
        string s;
        cin>>s;
        int sum=0;
        int i;
        for(i=0;i<s.length();i++){
            sum+=s[i]-'0';
        }
        if(sum%9==0){
            cout<<"Yes"<<endl;
        }
        else cout<<"No"<<endl;
    }
    
    
    
    
}

Measured memory_bytes: 3740
#include<bits/stdc++.h>
using namespace std;
int n,t,p[3005],prime[3005],cnt,len;
long long s[100005];
struct num{
	long long ui;
	int vi;
}Num[100005];
int ans;

long long read(){
	long long x=0;char ch=getchar();
	while(!isdigit(ch)) ch=getchar();
	while(isdigit(ch)) x=(x<<3)+(x<<1)+(ch^48),ch=getchar();
	return x;
}

int main(){
	n=read();
	for(int i=1;i<=n;i++) s[i]=read();
	t=2200;
	for(int i=2;i<=t;i++){
		if(p[i]==0) prime[++cnt]=i;
		for(int j=1;j<=cnt&&i*prime[j]<=t;j++){
			p[i*prime[j]]=1;
			if(i%prime[j]==0) break;
		}
	}
	for(int i=cnt;i>=1;i--){
		long long P=1ll*prime[i]*prime[i]*prime[i];
		for(int j=1;j<=n;j++) while(s[j]%P==0) s[j]/=P;
	}
	sort(s+1,s+n+1);
	for(int i=1;i<=n;i++){
		if(s[i]!=s[i-1]) Num[++len].ui=s[i],Num[len].vi=1;
		else Num[len].vi++;
	}
	for(int i=1;i<=len;i++){
		long long Ans=1,si=Num[i].ui,oi;
		if(si==1){ans++;continue;}
		for(int j=1;j<=cnt;j++){
			oi=0;while(si%prime[j]==0) si/=prime[j],oi++;
			if(oi!=0&&Ans!=-1){
				oi=3-oi;
				for(int i=1;i<=oi;i++){
					Ans=1ll*Ans*prime[j];
					if(Ans>=1e10){Ans=-1;break;}
				}
			}
		}
		if(Ans>=1e10||Ans==-1) Ans=-1;
		else if(si!=1){
			int o=sqrt(si);
			if(1ll*o*o==si) Ans=1ll*Ans*o;
			else if(Ans<=(1e10)/(1ll*si*si)) Ans=1ll*Ans*si*si;
			else Ans=-1;
		}
		if(Ans>=1e10||Ans==-1) Ans=-1;
		int l=1,r=len,mid,op=0;
		while(l<=r){
			mid=(l+r)/2;
			if(Num[mid].ui<=Ans) op=max(op,mid),l=mid+1;
			else r=mid-1;
		}
		if(Num[op].ui==Ans&&op>i) ans+=max(Num[op].vi,Num[i].vi);
		else if(Num[op].ui!=Ans) ans+=Num[i].vi;
	}
	printf("%d\n",ans);
	
	return 0;
}

Measured memory_bytes: 2560
function main(input) {
  let args = input.split(/\n/);
  let fruits = args[1].split(/\s/);
  let value = 0;
  function compareFunc(a, b) {
    return a - b;
  };
  fruits.sort(compareFunc);
  for (let i = 0;i < args[0].split(/\s/)[1];i++) {
    value += fruits[i] * 1;
  }
  console.log(value);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 30532
// created: June 11 2020
// author: Tibbarnit

#include <bits/stdc++.h>

using namespace std;
#define maxN 1000000000000000000
int n;
long long a[100020];

int main()
{
//    freopen("B.INP","r",stdin);
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin>>n;
  long long P=1;
  for (int i=1;i<=n;++i)
    {
        cin>>a[i];
        if (a[i]==0) P=0;
    }
    for (int i=1;i<=n;++i)
    {
        if (P==0) break;
        if (maxN/P<a[i])
        {
            cout<<"-1";
            exit(0);
        }
        P*=a[i];
    }
    cout<<P;
 return 0;
}


Measured memory_bytes: 4440
import itertools
S = input()
L = ["dreamer", "eraser", "erase", "dream"]
R = list(itertools.permutations(L))
flag=0
for sg in R:
    T=S
    for i in range(4):
        T=T.replace(sg[i], "")
    if T=="":
        flag=1
        break
if flag==1:
    print("YES")
else:
    print("NO")


Measured memory_bytes: 3188
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
ll mod = 1000000007;
 
int main() {
    int h, w, d, a, q, l, r;
    int X[90010], Y[90010], dist[90010] = {};
    cin >> h >> w >> d;
    rep(i, h) {
        rep(j, w) {
            cin >> a;
            X[a] = i;
            Y[a] = j;
        }    
    }
 
    for(int i = d+1; i <= h*w; i++) {
        dist[i] = dist[i-d] + abs(X[i] - X[i-d]) + abs(Y[i] - Y[i-d]);
    }
 
    cin >> q;
    while(q--) {
        cin >> l >> r;
        cout << dist[r] - dist[l] << "\n";
    }
 
    return 0;
}

Measured memory_bytes: 2176
#include <stdio.h>
int main (void){
    int l[11],v[3],i,a,c=0,ans;
    double b,ll=0,vv;
    while(scanf("%d,",&a)!=EOF){
        l[0]=a;
        for(i=1;i<12;i++){
            scanf("%d,",&a);
            if(i<10){
                l[i]=a;
            }
            else if(i>9){
                v[i-10]=a;
            }
        }
        c=0,ll=0;
        for(i=0;i<10;i++){
            ll=ll+l[i];
        }
        vv=v[0]+v[1];
        b=ll/vv*v[0];
        for(i=0;i<10;i++){
            c=c+l[i];
            if(b<=c){
                ans=i+1;
                break;
            }
        }
        printf("%d\n",ans);
    }
return 0;
}

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

vector<int> a(3);

int main(void) {
	cin >> a.at(0) >> a.at(1) >> a.at(2);
	sort(a.begin(), a.end());
	reverse(a.begin(), a.end());

	cout << a.at(0) * 10 + a.at(1) + a.at(2) << endl;
}

Measured memory_bytes: 256
#!/usr/bin/env python3

H,W = [int(i) for i in input().split()]
F = []
F.append("."*(W+2))
for i in range(H):
    F.append("."+input()+".")
F.append("."*(W+2))

flg = True
for y in range(1,H+1):
    for x in range(1,W+1):
        if F[y][x] == '.':
            continue
        elif F[y-1][x] != '#' and F[y+1][x] != '#' and F[y][x-1] != '#' and F[y][x+1] != '#':
            flg = False
            break
if flg:
    print("Yes")
else:
    print("No")

            



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

int main()
{
    int h, w;
    cin >> h >> w;
    vector<string> vs;
    rep(i, h)
    {
        string s;
        cin >> s;
        vs.push_back(s);
    }
    rep(i, h)
    {
        rep(j, w)
        {
            int adj[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
            bool f = false;
            if (vs[i][j] == '.')
            {
                continue;
            }
            for (size_t k = 0; k < 4; k++)
            {
                int x = i + adj[k][0];
                int y = j + adj[k][1];
                if (x < 0 || x >= h || y < 0 || y >= w)
                {
                    continue;
                }
                else if (vs[x][y] == '#')
                {
                    f = true;
                    break;
                }
            }
            if (!f)
            {
                cout << "No" << endl;
                return 0;
            }
        }
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 256
a,b= gets.split.map(&:to_i)
st=gets.chomp
str=st.split("")
itr=0
for c in str
  itr+=1
  if itr==a+1
    if c!='-'
      puts "No"
      exit
    end
    next
  end
  if c.to_i.to_s!=c.to_s
    puts "No"
    exit
  end
end
puts "Yes"


Measured memory_bytes: 1788
#include <cstdio>
#include <cmath>

int main (){
    int N, T, A;
    scanf("%d %d %d",&N,&T,&A);
    int H[N];
    for (int i = 0; i < N; i++){
        scanf("%d",&H[i]);
    }
    double min = __INT_MAX__;
    double temp;
    int goal=0;
    for (int i = 0; i < N; i++){
        temp = std::abs((T-H[i]*0.006)-A);
        if(temp<min){
            min=temp;
            goal=i;
        }
    }
    printf("%d",goal+1);
}

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

int main() {
	int a,b;
	cin >> a>>b;
	if (a + b == 15) {
		cout << "+" << endl;
	}
	else if (a*b == 15) {
		cout << "*" << endl;
	}
	else {
		cout << "x" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<sstream>
#include<cmath>
#include<numeric>
#include<map>
#include<stack>
#include<queue>
#include<list>
#include<set>
#include<cstring>
using namespace std;

int main() {
  long long int n, p;cin >> n >> p;
  map<long long int, long long int> a;

  for(long long int i=2; i*i<=p; i++) {
    while(p % i == 0){
      a[i]++;
      p /= i;
    }
  }
  if(p != 1) a[p]++;

  long long int ans = 1;
  for(auto i=a.begin(); i!= a.end(); i++) {
    long long int num = i->second / n;
    if(num != 0) {
      for(auto j=0; j<num; j++) ans *= i->first;
    }
  }
  cout << ans << endl;

  return 0;
}



//EOF


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>

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

using namespace std;
#define int long long
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repr(i,n) for(ll i=n;i>=0;i--)
#define P pair<ll, ll>
#define sz(x) (ll)x.size()
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define VE vector<ll>
#define COUT(x) cout<<(x)<<endl
#define MA map<ll,ll>
#define SE set<ll>
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,VE,greater<ll>>
#define COUT(x) cout<<(x)<<endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define EPS (1e-10)
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	unsigned r;
	while ((r = a % b)) {
		a = b;
		b = r;
	}
	return b;
}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
bool prime(ll n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}
map<ll, ll> prime_factor(ll n) {
	map<ll, ll> ret;
	for (ll i = 2; i * i <= n; i++) {
		while (n % i == 0) {
			ret[i]++;
			n /= i;
		}
	}
	if (n != 1) ret[n] = 1;
	return ret;
}

const long long MOD = 1000000007;
//const long long MOD = 998244353;
const long long INF = 1LL << 60;



const long double PI = 3.14159265359;
const int MAX_N = 100010;


signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int k, s; cin >> k >> s;
	int ans = 0;
	rep(i, k + 1) {
		rep(j, k + 1) {
			int tmp = s - i - j;
			if (0 <= tmp && tmp <= k) {
				ans++;
			}
		}
	}
	cout << ans << endl;
	return 0;
}

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

int main(){
    int n,k; cin >> n >> k;
    vector<ll> xnum,ynum;
    vector<P> point;
    rep(i,n){
        ll x,y; cin >> x >> y;
        xnum.push_back(x);
        ynum.push_back(y);
        point.push_back(P(x,y));
    }
    sort(ALL(xnum));
    sort(ALL(ynum));
    ll ans = 4*1e18;
    for(int i = 0;i < n;++i){
        for(int j = i+1;j < n;++j){
            for(int p = 0;p < n;++p){
                for(int q = p+1;q < n;++q){
                    int cnt = 0;
                    rep(r,n){
                        ll x = point[r].first,y = point[r].second;
                        if(xnum[i] <= x && x <= xnum[j] && ynum[p] <= y && y <= ynum[q]) cnt++;
                    }
                    ll s = (xnum[j]-xnum[i])*(ynum[q]-ynum[p]);
                    if(cnt >= k && ans > s) ans = s;
                }
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
def resolve():
    A, B, C, X, Y = map(int, input().split())

    yen = 0
    if A - C + B - C > 0:
        yen += C * 2 * min(X, Y)

        minans = 10 ** 30
        rest = max(X, Y) - min(X, Y)
        for i in range(rest + 1):
            if X > Y:
                minans = min((C*2 * i + (rest - i) * A), minans)
            else:
                minans = min((C*2 * i + (rest - i) * B), minans)

        yen += minans

    else:
        yen = A * X + B * Y

    print(yen)


resolve()

Measured memory_bytes: 38512
#include "bits/stdc++.h"
using namespace std;
#define ff first
#define ss second
vector<vector<pair<int,int>>> dt;
vector<pair<int,int>> Es;
signed main(){
    int n,m,a,b,v,d,c;
    cin >> n >> m;
    dt.resize(n);
    for(auto& x: dt)x.resize(11);
    for(int i = 0; i < m;i++){
        cin >> a >> b;a--;b--;
        Es.push_back({a, b});
    }
    int q;
    cin >> q;
    for(int i = 0; i < q; i++){
        cin >> v >> d >> c;v--;
        dt[v][d] = {i, c};
    }
    for(int d = 10; d > 0; d--){
        for(auto e: Es)
            dt[e.ff][d-1] = max(dt[e.ff][d-1], dt[e.ss][d]),
            dt[e.ss][d-1] = max(dt[e.ss][d-1], dt[e.ff][d]);
        for(auto& x: dt) x[0] = max(x[0], x[d]);
    }
    for(auto& x: dt)cout << x[0].ss << endl;
}


Measured memory_bytes: 13304
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cassert>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define rep(i,n) FOR(i,0,n)
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define vint vector<int>
#define vdouble vector<double>
#define vstring vector<string>
using namespace std;

#include<map>
#include<set>
#include<queue>
#include<climits>

typedef long long ll;
typedef unsigned long long ull;

const int MAX_N = 1000000;
int N;
int a[MAX_N];

int main() {
	cin >> N;
	rep(i, N) cin >> a[i];
	ll sum = 0;
	ll all = 0;
	ll ret = LLONG_MAX;
	rep(i, N) all += a[i];
	rep(i, N){
		sum += a[i];
		ll r = abs((all - sum) - sum);
		if(i < N -1) ret = min(ret, r);
	}

	cout << ret;
}

Measured memory_bytes: 1024
#include <iostream>

using namespace std;

int main(){
	int n, k;
	cin >> n >> k;
	
	int v = 1;
	for(int i = 0;i < n;i++){
		if(v > k){
			v += k;
		}else{
			v *= 2;
		}
	}
	
	cout << v << endl;
	
	return 0;
}

Measured memory_bytes: 256
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
input = sys.stdin.readline
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
	return list(map(int,input().split()))
def m(): #複数文字
	return map(int,input().split())
def onem(): #Nとかの取得
	return int(input())
def s(x): #圧縮
	a = []
	if len(x) == 0:
		return []
	aa = x[0]
	su = 1
	for i in range(len(x)-1):
		if aa != x[i+1]:
			a.append([aa,su])
			aa = x[i+1]
			su = 1
		else:
			su += 1
	a.append([aa,su])
	return a
def jo(x): #listをスペースごとに分ける
	return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
	return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False

def pow_k(x, n):
    ans = 1
    while n:
        if n % 2:
            ans *= x
        x *= x
        n >>= 1
    return ans

"""
def nibu(x,n,r):
	ll = 0
	rr = r
	while True:
		mid = (ll+rr)//2

	if rr == mid:
		return ll
	if (ここに評価入れる):
		rr = mid
	else:
		ll = mid+1
"""

a = l()

b = l()


t = onem()

dis = abs(a[0]-b[0])
if dis == 0:
	print("YES")
else:
	if b[1] - a[1] >= 0:
		print("NO")
	else:
		sp = a[1] - b[1]
		if dis - sp * t <= 0:
			print("YES")
		else:
			print("NO")





Measured memory_bytes: 9488
N, M = map(int, input().split())
A = list(map(int, input().split()))
BC = [list(map(int, input().split())) for _ in range(M)]

am = {}
for a in A:
	if not a in am:
		am[a] = 1
	else:
		am[a] += 1

for b, c in BC:
	if not c in am:
		am[c] = b
	else:
		am[c] += b

al = sorted(am)[::-1]

c, v = N, 0
for k in al:
	if am[k] < c:
		c -= am[k]
		v += am[k] * k
	else:
		v += c * k
		break

print(v)


Measured memory_bytes: 51392
import java.util.*;

public class Main{
	private static final Scanner scan = new Scanner(System.in);

	public static void main(String[] args){
		while(scan.hasNext()){
			double a = scan.nextDouble();
			double b = scan.nextDouble();
			double c = scan.nextDouble();
			double d = scan.nextDouble();
			double e = scan.nextDouble();
			double f = scan.nextDouble();
			double x, y;
			y = (f * a - d * c)/(-d * b + e * a);
			x = (f * b - e * c)/(b * d - e * a);
			if(x == 0)x = 0.;
			if(y == 0)y = 0.;
			System.out.printf("%.3f %.3f\n", x, y);
		}
	}
}

Measured memory_bytes: 28232
import Control.Monad
import Data.Maybe
import qualified Data.ByteString.Char8 as BS
import Data.List

readInt = fst . fromJust . BS.readInt
getInt = readInt <$> BS.getLine

main = do
    k <- getInt
    let s = [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 $ s !! (k - 1)

Measured memory_bytes: 380
import java.util.Arrays;
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		int M = sc.nextInt();
		//故障している階段の段数を入れ込む配列宣言
		//初期値にfalseを入れておく。
		//壊れたところにtrue;
		boolean[] dest = new boolean[N];
		Arrays.fill(dest, false);
		for(int i = 0; i<M;i++) {
			int b = sc.nextInt();
			dest[b-1] = true;
		}
		long waru = 1000000007;
		//登れた階段の通りの値を確保する配列宣言
		//[0]は一段目と数える
		long[] anser = new long[N];

		if(N==1) {
			System.out.println(N);
		}else {
			//1,2段目の処理
			anser[0] = !dest[0]? 1:0;
			anser[1] = !dest[1]? anser[0]+1:0;
			//3段目からN段目までの処理
			for(int i = 2; i<N ; i++) {
				if(!dest[i]) {
					anser[i] = (anser[i-2] + anser[i-1]) % waru;
				}
			}
			System.out.println(anser[N-1]);
		}
	}
}

Measured memory_bytes: 48132
#include<stdio.h>
int main(void)
{
	int n, m, c, i, j;
	scanf("%d%d%d",&n,&m,&c);
	int b[m], a[n][m];
	for(i=0;i<m;i++){
		scanf("%d",&b[i]);
	}
	
	for(i=0;i<n;i++){
		for(j=0;j<m;j++){
			scanf("%d",&a[i][j]);
		}
	}
	int num=0, ans;
	for(i=0;i<n;i++){
		ans = c;
		for(j=0;j<m;j++){
			ans += a[i][j]*b[j];
		}
		if(ans>0)num++;
	}
	printf("%d",num);
	return 0;
}

Measured memory_bytes: 128
while ns = gets do
	n = ns.to_i
	r = 0
	10.times{ |a|
		10.times{ |b|
			10.times{ |c|
				10.times{ |d|
					if (a + b + c + d == n) then
						r += 1
					end
				}
			}
		}
	}
	puts r
end

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

#define ll long long
#define ull unsigned long long

using namespace std;

int main() {
	ll N;
	cin >> N;
	vector <ll> A(N, 0);
	for (int ii = 0; ii < N; ++ii){
		cin >> A[ii];
	}

	vector <ll> seq1(N + 1, 0);
	vector <ll> seq2(N + 1, 0);
	for (ll ii = 0; ii < N; ++ii){
		ll sign1 = 2 * (ii % 2) - 1;
		ll sign2 = 1 - 2 * (ii % 2);
		seq1[ii + 1] = seq1[ii] + sign1 * A[ii]; 
		seq2[ii + 1] = seq2[ii] + sign2 * A[ii]; 
	}

	vector <ll> X(N, 0);
	for (ll ii = 0; ii < N; ++ii){
		if (ii % 2 == 0){
			X[ii] = seq1[ii] + A[ii] + seq2[N] - seq2[ii+1];
		} else {	
			X[ii] = seq2[ii] + A[ii] + seq1[N] - seq1[ii+1];
		}
	}

	for (int ii = 0; ii < N; ++ii){
		cout << X[ii] << " ";
	}
	cout << "\n";

	return 0;
}


Measured memory_bytes: 4480
#include <iostream>
using namespace std;
long long n, i, j, k;
int main() {
	cin>>n;
	for(i=1; i*i<=n; i++)
		if(n%i==0) for(j=n/i, k=0; j; j/=10, k++);
	cout<<k;
	return 0;
}

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

int main(void){
  //入力
  long long int N, K;
  cin >> N >> K;
  //N以下の正整数の組について調べる。
  //modで分ける
  long long int cnt0 = 0, cntHalf = 0;
  for(int i = 1; i <= N; i++){
    if(i % K == 0) cnt0++;
    if(K % 2 == 0 && i % K == K / 2) cntHalf++;
  }
  if(cnt0 == 0 && cntHalf == 0){
    cout << 0 << endl;
  }
  else if(cnt0 != 0 && cntHalf == 0){
    cout << cnt0*cnt0*cnt0 << endl;
  }
  else if(cnt0 == 0 && cntHalf != 0){
    cout << cntHalf*cntHalf*cntHalf << endl;
  }
  else  cout << cnt0*cnt0*cnt0 + cntHalf*cntHalf*cntHalf << endl;
}


Measured memory_bytes: 256
// AtCoder Grand Contest 012
// C - Tautonym Puzzle

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;


const int MAX_C = 100;

ll N;
vector<int> ans;

int main() {

    cin >> N;

    for (int i = 0; ((N + 1) >> i) > 1; i++) {
        if (((N + 1) >> i) & 1) {
            ans.push_back(MAX_C - i);
        }
        ans.push_back(i + 1);
    }
    for (int i = 0; i < MAX_C; i++) {
        ans.push_back(i + 1);
    }

    cout << ans.size() << endl;
    for (int i = 0; i < (int)ans.size(); i++) {
        cout << ans[i] << (i == (int)ans.size() - 1 ? '\n' : ' ');
    }

    return 0;

}


Measured memory_bytes: 384
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <string>
#include <cmath>
#include <iomanip>

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())

typedef long long ll;

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

    if (n < 105)
    {
        cout << 0 << endl;

        return 0;
    }

    ans = 0;

    for (int i = 105; i <= n; i += 2)
    {
        int h = 0;
        for (int j = 1; j <= i; j++)
        {
            if (i % j == 0)
                h++;
        }

        if (h == 8)
        {
            ans++;
            //cout << i << endl;
        }
    }

    cout << ans << endl;

    return 0;
}

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

int n;
string seq;
set<string> D;
map<string, vector<string> > M;
vector<string> ans;

void dfs(int cur, vector<string> path){
    if ( cur == seq.size() ){
	string s = "";
	for ( int i = 0; i < path.size(); i++ ){
	    if ( i ) s += ' ';
	    s += path[i];
	}
	ans.push_back(s);
	return;
    }

    string target = "";
    for ( int i = cur; i < cur + 50 && i < seq.size(); i++ ){
	target +=  seq[i];
	if ( D.find(target) != D.end() ){
	    vector<string> v = M[target];
	    for ( int j = 0; j < v.size(); j++ ){
		vector<string> np = path;
		np.push_back(v[j]);
		dfs(i+1, np);
	    }
	}
    }
}

void compute(){
    cin >> seq;
    vector<string> path;
    ans.clear();

    dfs(0, path);

    for ( int i = 0; i < ans.size(); i++ ){
	cout << ans[i] << "." << endl;
    }
    cout << "--" << endl;
}

string getNumber(string str){
    string num = "";
    for ( int i = 0; i < str.size(); i++ ){
	char ch = str[i];
	if ( 'a' <= ch && ch <='c' ) num += '2';
	if ( 'd' <= ch && ch <='f' ) num += '3';
	if ( 'g' <= ch && ch <='i' ) num += '4';
	if ( 'j' <= ch && ch <='l' ) num += '5';
	if ( 'm' <= ch && ch <='o' ) num += '6';
	if ( 'p' <= ch && ch <='s' ) num += '7';
	if ( 't' <= ch && ch <='v' ) num += '8';
	if ( 'w' <= ch && ch <='z' ) num += '9';
    }
    return num;
}

main(){
    string str, number;
    while( cin >> n && n){
	D.clear();
	M = map<string, vector<string> >();
	for ( int i = 0; i < n; i++ ){
	    cin >> str;
	    number = getNumber(str);
	    D.insert(number);
	    M[number].push_back(str);
	}
	compute();
    }
}

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

int n;
char grid[255][255];
int dp_lu[255][255];	//lu:left up
int dp_u[255][255];		//u:up
int dp_ru[255][255];	//ru:right up
int dp_l[255][255];		//l:left

signed main()
{
	while (true)
	{
		cin >> n;
		if (n == 0) break;
		rep(i,n) cin >> grid[i];

		int ans = 0;

		rep(i,n) rep(j,n)
		{
			if (i == 0)
			{
				if (grid[i][j] == '1')
				{
					dp_lu[i][j] = 1;
					dp_u[i][j] = 1;
					dp_ru[i][j] = 1;
					if (j == 0)
					{
						dp_l[i][j] = 1;
					} else {
						dp_l[i][j] = dp_l[i][j - 1] + 1;
					}
				} else {
					dp_lu[i][j] = 0;
					dp_u[i][j] = 0;
					dp_ru[i][j] = 0;
					dp_l[i][j] = 0;
				}
			} else if (j == 0) {
				if (grid[i][j] == '1')
				{
					dp_lu[i][j] = 1;
					dp_u[i][j] = dp_u[i - 1][j] + 1;
					dp_ru[i][j] = dp_ru[i - 1][j + 1] + 1;
					dp_l[i][j] = 1;
				} else {
					dp_lu[i][j] = 0;
					dp_u[i][j] = 0;
					dp_ru[i][j] = 0;
					dp_l[i][j] = 0;
				}
			} else if (j == n - 1) {
				if (grid[i][j] == '1')
				{
					dp_lu[i][j] = dp_lu[i - 1][j - 1] + 1;
					dp_u[i][j] = dp_u[i - 1][j] + 1;
					dp_ru[i][j] = 1;
					dp_l[i][j] = dp_l[i][j - 1] + 1;
				} else {
					dp_lu[i][j] = 0;
					dp_u[i][j] = 0;
					dp_ru[i][j] = 0;
					dp_l[i][j] = 0;
				}
			} else {
				if (grid[i][j] == '1')
				{
					dp_lu[i][j] = dp_lu[i - 1][j - 1] + 1;
					dp_u[i][j] = dp_u[i - 1][j] + 1;
					dp_ru[i][j] = dp_ru[i - 1][j + 1] + 1;
					dp_l[i][j] = dp_l[i][j - 1] + 1;
				} else {
					dp_lu[i][j] = 0;
					dp_u[i][j] = 0;
					dp_ru[i][j] = 0;
					dp_l[i][j] = 0;
				}
			}
			ans = max(ans, dp_lu[i][j]);
			ans = max(ans, dp_u[i][j]);
			ans = max(ans, dp_ru[i][j]);
			ans = max(ans, dp_l[i][j]);
		}

		printf("%d\n", ans);
	}
}

Measured memory_bytes: 2228
import java.util.*;

public class Main {
  public static void main(String[] args) {
      Scanner sc = new Scanner(System.in);
      int H = sc.nextInt();
      int W = sc.nextInt();
      String a[] = new String[H];
      String lst = "";
      for (int j = 0; j < W+2 ; j++) {
        lst += "#";
      }
      System.out.println(lst);
      for (int i = 0; i < H ; i++) {
        a[i] = sc.next();
        System.out.println("#" + a[i] + "#");
      }
      System.out.println(lst);
  }
}

Measured memory_bytes: 22228
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); i++)
#define ALL(v) (v).begin(),(v).end()
using ll = long long;
using P = pair<int, int>;
const int INF = 1e9;
const long long LINF = 1e18;
const long long MOD = 1e9 + 7;

signed main(){
    string s;
    cin >> s;
    bool a = false, b = false;
    rep(i, 3) {
        if (s[i] == 'A') a = true;
        else
            b = true;
    }
    if(a&&b){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}

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

b1 = 0
for index,i in enumerate(a):
  b1 += i * (-1)**(index)
b = [0]*n
b[0]=b1

for index,i in enumerate(a[:-1]):
  b[index + 1] = 2*i - b[index]
print(" ".join(str(i) for i in b))
  

Measured memory_bytes: 25080
#include <bits/stdc++.h>
using namespace std;
struct Fast {
    Fast() {
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(20);
    }
} fast;

long long mod = 998244353;
#define REP(i, n) for (long long i = 0; i < (n); i++)

long long modpow(long long m, long long n) {
    if (n == 0) return 1;
    if (n % 2 == 0) {
        long long t = modpow(m, n / 2);
        return t * t % mod;
    } else {
        return modpow(m, n - 1) * m % mod;
    }
}

long long moddiv(long long a, long long b) { return (a * modpow(b, mod - 2)) % mod; }

long long nCkmod(long long n, long long k) {
    long long denomi = 1;
    REP(i, n) {
        denomi *= (i + 1);
        denomi %= mod;
    }
    long long numera = 1;
    for (int i = n - k; i > 0; i--) {
        numera *= i;
        numera %= mod;
    }
    REP(i, k) {
        numera *= (i + 1);
        numera %= mod;
    }
    return moddiv(denomi, numera);
}

void print_binary(long long a) {
    for (int i = 31; i >= 0; i--) {
        cout << (a >> i & 1);
    }
    cout << endl;
}

void yes() {
    cout << "Yes" << endl;
    exit(0);
}
void no() {
    cout << "No" << endl;
    exit(0);
}

vector<int> h, memo;

// int dp(int n) {
//     if (memo[n] != -1) {
//         return memo[n];
//     }
//     if (n == 0) {
//         return 0;
//     }
//     if (n == 1) {
//         return abs(h[1] - h[0]);
//     }
//     memo[n] = min(dp(n - 1) + abs(h[n] - h[n - 1]), dp(n - 2) + abs(h[n] - h[n - 2]));
//     return min(dp(n - 1) + abs(h[n] - h[n - 1]), dp(n - 2) + abs(h[n] - h[n - 2]));
// }
signed main() {
    long long k;
    string s;
    cin >> k >> s;
    if (s.size() <= k) {
        cout << s << endl;
    } else {
        REP(i, k) { cout << s[i]; }
        cout << "..." << endl;
    }
}

Measured memory_bytes: 3608
import sys
import math
import heapq
sys.setrecursionlimit(10**7)
INTMAX = 9223372036854775807
INTMIN = -9223372036854775808
DVSR = 1000000007
def POW(x, y): return pow(x, y, DVSR)
def INV(x, m=DVSR): return pow(x, m - 2, m)
def DIV(x, y, m=DVSR): return (x * INV(y, m)) % m
def LI(): return map(int, sys.stdin.readline().split())
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())


def FLIST(n):
    res = [1]
    for i in range(1, n+1):
        res.append(res[i-1]*i % DVSR)
    return res


L, R, d = LI()

res = 0
for i in range(100000):
    v = (L + i)
    if v <= R and v % d == 0:
        res += 1

print(res)


Measured memory_bytes: 9252
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
#include <numeric>
#include <array>
#include <cmath>
#include <memory>
using namespace std;
//変数デバッグ
#define DEB(variable) cout << #variable << '=' << variable << endl

//for簡易表記(引数ミス防止)
#define FOR(LoopVariable,numberOFbegin,numberOFend) for (int LoopVariable = (numberOFbegin); (LoopVariable) < (numberOFend); (LoopVariable)++)
#define DEFOR(LoopVariable,numberOFbegin,numberOFend) for (int LoopVariable = (numberOFbegin)-1; (LoopVariable) >= (numberOFend); (LoopVariable)--)
#define REP(LoopVariable,numberOFend) for(int LoopVariable = 0;(LoopVariable)<(numberOFend);LoopVariable++)

constexpr long long int linf = numeric_limits<long long int>::max()-5;
constexpr int inf= numeric_limits<int>::max()-5;
constexpr long long int mod = 1000000007;

int main(){

    long long int n;
    cin>>n;
    vector<long long int> v(n),w(n);
    REP(i,n){
        cin>>v[i];
    }
    w[0] = 0;
    FOR(i,0,(n)/2){
        w[0] += ((i % 2 == 1) * (-1) + (i % 2 == 0) * (1)) * (v[i] + v[n - i-1]);
      //  cout << w[0] << endl;
    }
    w[0] += (((n / 2) % 2 == 0) * (1) + ((n / 2) % 2 == 1) * (-1)) * v[n / 2];
    //cout << w[0] << endl;
    FOR(i,1,n){
        w[i] = 2*v[i-1] - w[i - 1];
    }
    REP(i,n-1){
        cout << w[i] << " ";
    }
    cout << w[n - 1] << endl;


    return 0;
}


Measured memory_bytes: 2944
import heapq

n, m = map(int,input().split())
hp = map(lambda x: (-1)*int(x), input().split())
hp = list(hp)
heapq.heapify(hp)

for i in range(m):
  item = -1*heapq.heappop(hp)
  # print('item',item)
  item = item //2
  heapq.heappush(hp, -item)
  
print(-1*sum(hp))

Measured memory_bytes: 20260
#include <iostream>
#include<cstdlib>
#include<queue>
#include<set>
#include<vector>
#include<stack>
#include<map>
#include<string>
#include<algorithm>
#include<cstdio>
using namespace std;
#define rep(i,a) for(int i=0;i<a;i++)
#define mp make_pair
#define pb push_back
#define P pair<int,int>
#define ll __int64
#define __int64 long long
const ll M=1000000007;
int n,k,l;
vector<int>G[211111];
vector<int>G2[211111];
	int ans=0;
	map<P,int>cnt;
struct unionFind{
	int n;
	vector<int>par;
	vector<int>rank;
	unionFind(int x){
		n=x;
		par.resize(x);
		rank.resize(x);
		rep(i,n){
			par[i]=i;
			rank[i]=0;
		}
	}
	
	int find(int x){
		if(par[x]==x)return x;
		else return par[x]=find(par[x]);
	}
	bool same(int x,int y){
		return find(x)==find(y);
	}
	
	void unite(int x,int y){//x,yを併合
		x=find(x);
		y=find(y);
		if(x==y)return;
		if(rank[x]<rank[y]){
			par[x]=par[y];
		}
		else{
			par[y]=x;
			if(rank[x]==rank[y])rank[x]++;
		}
	}
};

int main(){
	cin>>n>>k>>l;
	unionFind u1(211111),u2(211111);

	rep(i,k){
		int a,b;
		cin>>a>>b;
		a--;b--;
		G[a].push_back(b);
		G[b].push_back(a);
		u1.unite(a,b);
	}
	rep(i,l){
		int a,b;
		cin>>a>>b;
		a--;b--;
		G2[a].push_back(b);
		G2[b].push_back(a);
		u2.unite(a,b);
	}


	rep(i,n){
		cnt[mp(u1.find(i),u2.find(i))]++;
	}

	rep(i,n){
		cout<<cnt[mp(u1.find(i),u2.find(i))];
		if(i==n-1)cout<<endl;
		else cout<<" ";
	}
	return 0;
}

Measured memory_bytes: 30208
#include <stdio.h>
#include <algorithm>
#include <string>
#include <vector>
#include <numeric>

const int mod = 1000000007;

int main() {
	const char* s[] = { "Sunny", "Cloudy", "Rainy" };
	char S[7];
	scanf("%s", S);
	int d;
	switch (S[0]) {
	case 'S':
		d = 0;
		break;
	case 'C':
		d = 1;
		break;
	case 'R':
		d = 2;
		break;
	}
	printf(s[(d + 1) % 3]);
	return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
const long long int MOD = 1e9 + 7;

vector<long long int> inverse;
vector<long long int> f, f_inverse;

void factorial_Initialize(int max){
    vector<long long int> a(max+1,1);
    inverse = a;
    f = a;
    f_inverse = a;

    for (int i=2; i<=max; i++){
        inverse[i]   = MOD - inverse[MOD % i] * (MOD / i) % MOD;
        f[i]         = f[i-1]         * i          % MOD;
        f_inverse[i] = f_inverse[i-1] * inverse[i] % MOD;
    }
}

long long int nCr(int n, int r){
    if(n < r || r < 0) return 0;
    if (n >= f.size()){
        factorial_Initialize(n);
    }
    return f[n] * f_inverse[r] % MOD * f_inverse[n-r] % MOD;
}

long long int modpow(long long int b, long long int p){// modinv(x) = modpow(x, MOD-2)
    long long int num = 1, power = b;
    for(int i=0; i<=30; i++){
        if((p>>i) & 1){
            num *= power;
            num %= MOD;
        }

        power *= power;
        power %= MOD;
    }
    return num;
}


int main(){
    long long int n, a, b, c, d;
    cin >> n >> a >> b >> c >> d;
    factorial_Initialize(n);

    vector<vector<int>> dp(n+1,vector<int>(n+1));
    dp[a-1][0] = 1;
    for(int i=a; i<=b; i++){
        for(int j=0; j<=n; j++){
            if(dp[i-1][j] == 0) continue;

            dp[i][j] += dp[i-1][j];// k = 0
            dp[i][j] %= MOD;

            for(int k=c; k<=d; k++){
                if(j + i*k > n) break;

                dp[i][j + k*i] += dp[i-1][j]
                               * nCr(n-j,k*i)                 % MOD
                               * f[k*i]                       % MOD
                               * modpow(modpow(f[i],MOD-2),k) % MOD
                               * modpow(f[k],MOD-2)           % MOD;
                dp[i][j + k*i] %= MOD;
            }
        }
    }

    cout << dp[b][n] << endl;
    return 0;
}

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

int main()
{
    int n; cin >> n;
    map<string, ll> mp;
    for (int i = 0; i < n; i++) {
        string s; cin >> s;
        sort(s.begin(), s.end());
        mp[s]++;
    }
    ll ans = 0;
    for(auto& e: mp) {
        ll num = e.second;
        ans += (num * (num - 1)) / 2;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 11136