akhauriyash/Code-Regression huggingface dataset:
def move(a,b):
    aa = a[:]
    bb = b[:]
    bb.append(aa.pop(-1))
    return aa,bb

def move_is_True(a,b):
    if len(a) == 0:
        return False
    elif len(b) == 0 or a[-1]>b[-1]:
        return True
    return False

def search(abc_first, n):
    counts = [10**10]
    abcs = [(abc_first, abc_first, 0)]
    while True:
        if len(abcs) == 0 or min(counts) < sorted(abcs, key=lambda x:x[2])[0][2]:
            break
        new_abcs = []
        for abc, last_abc, count in abcs:
            abc_copy = abc[:]
            #print("abc", abc)
            a = abc_copy[0]
            b = abc_copy[1]
            c = abc_copy[2]
            if len(a) == n or len(c) == n:
                counts.append(count)
            else:
                movements = [(a,b), (b,a), (c,b), (b,c)]
                can_move = [move_is_True(a,b) for a,b in movements] #a2b, b2a, c2b, b2c
                #print("can_move", can_move)
                for i in range(4):
                    if can_move[i]:
                        new_count = count+1
                        x,y = movements[i]
                        x,y = move(x,y)
                        if i == 0:
                            new_abc = [x,y,c]
                        elif i == 1:
                            new_abc = [y,x,c]
                        elif i == 2:
                            new_abc = [a,y,x]
                        elif i == 3:
                            new_abc = [a,x,y]
                        #print(abc, new_abc, new_count, n)
                        if new_abc != last_abc:
                            if new_count < 15000000:
                                new_abcs.append((new_abc, abc, new_count))
            abcs = new_abcs[:]
    return min(counts)

n, m = map(int, input().split())
while (m!=0 or n!=0):
    abc = []
    for i in range(3):
        abc.append(list(map(int, input().split()))[1:])
    ans = search(abc, n)
    if ans <= m:
        print(ans)
    else:
        print(-1)
    n, m = map(int, input().split())



Measured memory_bytes: 5628
import numpy as np

takoyaki_num = int(input())
oishisa_list = input().split(" ")

oishisa_vec = np.array(oishisa_list, dtype=int)

# 計算
oishisa_outer_sum = np.sum(np.outer(oishisa_vec, oishisa_vec))
oishisa_dot = np.dot(oishisa_vec, oishisa_vec)

total_heal_int = int((oishisa_outer_sum - oishisa_dot) / 2)
print(total_heal_int)

Measured memory_bytes: 12472
#include <iostream>
#include <math.h>
#include<algorithm>
typedef unsigned long long longer;

using namespace std;

int main(int argc, const char * argv[]) {
    
    long N,K;
    cin>>N>>K;
    
    longer * array=new longer[N];
    
    
    long a,b;
    for (long i = 0; i < N; i++) {
        cin >>a>>b;
        array[i]=b;
        array[i]|=(a<<32);
    }
    sort(array, array+N);
    long count = 0;
    for (long i = 0; i < N; i++) {
        count+=(array[i]&0xFFFFFFFF);
        if(count>=K) {
            cout<<(array[i]>>32)<<endl;
            return 0;
        }
    }
    
    delete[] array;
    
    return 0;
}


Measured memory_bytes: 1024
#define _USE_MATH_DEFINES
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <limits.h>  
#include <stdbool.h>   
#define inf (INT_MAX-1)
#define INF 9223372036854775807;
#define PI 3.14159265358979323846;
#define EPS 1e-10
#define sq(n) ((n)*(n))
#define rep(i,n) for(i=0;i<n;i++)
#define rev(i,n) for(i=n-1;i>=0;i--)
/*
#define sort(a,n) qsort(a,n,sizeof(TYPE),cmp)
#define sort_r(a,n) qsort(a,n,sizeof(TYPE),cmp_r)
*/
#define chsort(s,n) qsort(s,n,sizeof(char),cmp)
#define chsort_r(s,n) qsort(s,n,sizeof(char),char_cmp_r)
#define TYPE long long
#define ll long long
#define MEMSET(a) memset(a,0,sizeof(a))
#define MEMSET_U(a) memset(a,-1,sizeof(a))
#define bool    _Bool
const int mod = (int)1e09 + 7;

//#define DEBUG1
//#define DEBUG2
//#define DEBUGF
#define DUMMY

int in(void) { int i; scanf("%d", &i); return i; }
long long llin(void) { long long i; scanf("%lld", &i); return i; }
double din(void) { double i; scanf("%lf", &i); return i; }
void chin(char s[]) { scanf("%s", s); }

void print(int a) { printf("%d\n", a); }
void llprint(long long a) { printf("%lld\n", a); }
void dprint(double a) { printf("%.10f\n", a); }
void print2(int a, int b) { printf("%d %d\n", a, b); }
int Max(int a, int b) { if (a > b) { return a; }return b; }
int Min(int a, int b) { if (a < b) { return a; }return b; }
long long llmax(long long a, long long b) { return a > b ? a : b; }
long long llmin(long long a, long long b) { return a < b ? a : b; }
double dmax(double a, double b) { return a > b ? a : b; }
double dmin(double a, double b) { return a < b ? a : b; }
//long long llmax(long long a, long long b) { return a > b ? a : b; }
//long long llmin(long long a, long long b) { return a < b ? a : b; }
//double dmax(double a, double b) { return a > b ? a : b; }
int cmp(const void *a, const void *b) { return *(TYPE *)a - *(TYPE *)b; }
int cmp_r(const void *a, const void *b) { return *(TYPE *)b - *(TYPE *)a; }
int char_cmp(const void *a, const void *b) { return strcmp((char *)a, (char *)b); }
int char_cmp_r(const void *a, const void *b) { return strcmp((char *)b, (char *)a); }
void swap(int *a, int *b) { int t = *a; *a = *b; *b = t; }

int main() {
	long long int N, ans = 0;
	char S[12];
	long long int c[5] = { 0 };
	char Y[6] = "MARCH";
	scanf("%lld", &N);
	for (int i = 0; i < N; i++) {
		scanf("%s", S);
		for (int j = 0; j < 5; j++) {
			if (S[0] == Y[j]) {
				c[j]++;
			}
		}
	}
	for (int i = 0; i < 5; i++) {
		for (int j = i + 1; j < 5; j++) {
			for (int k = j + 1; k < 5; k++) {
				ans += c[i] * c[j] * c[k];
			}
		}
	}
	printf("%lld\n", ans);

#ifdef DEBUGF
	getch();
#endif
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define  vi vector<long long int>
#define  set1 set<long long int>
#define  pb push_back
#define  map1 map<long long int,long long int>
#define  ll  long long int
#define  inf INT_MAX
#define  minf INT_MIN
#define setbits(x) __builtin_popcountll(x)
#define pres(x,y) fixed<<setprecision(y)<<x
#define pair1 pair<long long int,long long int>
#define mk(arr,n,type) type *arr=new type[n];
#define mod 1000000007
#define w(t) long long int t;t=1; while(t--)


ll func(ll a[], ll n, ll k) {


	ll dp[n + 1], m = inf;
	dp[1] = 0;

	for (ll i = 2; i <= n; i++) {
		m = inf;
		for (ll j = i - 1; j >= 1 && j >= i - k; j--) {
			m = min(m, dp[j] + abs(a[j] - a[i]));
		}
		dp[i] = m;
	}

	return dp[n];
}

void solve() {

	ll n, k;
	cin >> n >> k;
	ll a[n + 1];
	for (ll i = 1; i <= n; i++) {
		cin >> a[i];
	}
	cout << func(a, n, k);


}
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	w(t) {
		solve();
	}
	return 0;
}

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

int main()
{
   string s ;
   cin>>s;
   int k ;
   cin>>k;
   int le = s.size() ;
   set<string> st;
   vector<int>g[26];
    
    for(int i = 0 ; i < le ; i++ )
    {
        g[s[i]-'a'].push_back(i);
    }
    
    for( int i=0 ; i<26  && st.size() < k ; i++ )
    {
        int len = g[i].size () ;
         if(len) 
         st.insert(s.substr(g[i][0] , 1 ));
              for ( int j = 0 ; j < len ; j++ )
              {
                  for( int  xx = g[i][j] + 1 ; xx < min( g[i][j] + 5,le ) ; xx++ )
                  {
                      st.insert ( s.substr( g[i][j] , xx- g[i][j] + 1 ));
                  }
              }
        
    }
        
    
    int cnt=1;
    for( auto it = st.begin() ; it!= st.end() ; ++it )
    {
        if(cnt == k)
        {
            
            cout<<*it<<endl;
            break;
        }
        cnt++;
    }
    
    return 0;
}

Measured memory_bytes: 384
def pbox(n,a):
    count = 0
    result = []
    x=[0]*n
    for i in xrange(n,0,-1):
        total = 0
        for j in xrange(i,n+1,i):
            total += x[j-1]
        if  total % 2 != a[i-1]:
            x[i-1]=1
            result.append(i)
        else:
            pass
 
    print len(result)
    print ' '.join(map(str,result))
 
if __name__ == '__main__':
    n = int(raw_input())
    a = map(int,raw_input().split())
 
    pbox(n,a)

Measured memory_bytes: 17428
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main(){


ll a,b,c,d,ans,t;
while(cin>>a>>b>>c>>d){
ans=a*c;
t=a*d;
ans=max(ans,t);
t=b*c;
ans=max(t,ans);
t=b*d;
ans=max(ans,t);
cout<<ans<<endl;


}





return 0;}



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

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

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
        
        String[] input = br.readLine().split(" ");
        int l = Integer.parseInt(input[0]);
        int r = Integer.parseInt(input[1]);
        int d = Integer.parseInt(input[2]);
        int ans = 0;
        
        for(int i = l; i <= r; i++){
            if(i % d == 0){
                ans++;
            }
        }
        
        out.println(ans);
        out.close();
        
    }
}

Measured memory_bytes: 32736
while True:
    n, x = [int(i) for i in input().split()]

    if n == x == 0:
        break

    count = 0
    for s in range(1, n - 1):
        for m in range(s + 1, n):
            for e in range(m + 1, n + 1):
                if x == sum([s, m, e]):
                    count += 1

    print(count)

Measured memory_bytes: 7648
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using static System.Console;
using static System.Math;
using static MyIO;
using static MyUtil;

public class C { public static void Main() => (new Solver()).Solve(); }

public class Solver
{
	public void Solve()
	{
		long N = GetLong();
		var A = GetLongs(N);

		long max = 0;
		long cnt = 0;
		for(long i = 0; i < N; i++)
		{
			cnt += Max(0, max - A[i]);
			chmax(ref max, A[i]);
		}
		WriteLine(cnt);
	}
}

public static class MyIO
{
	private static string[] args = new string[0];
	private static int cnt = 0;
	private static IEnumerable<string> getArgs(long N) => Range(0, N).Select(_ => getArg());
	private static string getArg()
	{
		if(cnt == args.Length) { args = Console.ReadLine().Split(); cnt = 0; }
		return args[cnt++];
	}

	public static int GetInt() => int.Parse(getArg());
	public static long GetLong() => long.Parse(getArg());
	public static double GetDouble() => double.Parse(getArg());
	public static decimal GetDecimal() => decimal.Parse(getArg());
	public static string GetString() => getArg();
	public static char GetChar() => getArg()[0];
	public static int[] GetInts(long N) => getArgs(N).Select(int.Parse).ToArray();
	public static long[] GetLongs(long N) => getArgs(N).Select(long.Parse).ToArray();
	public static double[] GetDoubles(long N) => getArgs(N).Select(double.Parse).ToArray();
	public static decimal[] GetDecimals(long N) => getArgs(N).Select(decimal.Parse).ToArray();
	public static string[] GetStrings(long N) => getArgs(N).ToArray();
}

public static class MyUtil
{
	public static void chmax<T>(ref T x, T y) where T : IComparable<T> { if(x.CompareTo(y) < 0) x = y; }
	public static void chmin<T>(ref T x, T y) where T : IComparable<T> { if(x.CompareTo(y) > 0)	x = y; }
	public static void swap<T>(ref T x, ref T y) { T tmp = x; x = y; y = tmp; }
	public static long rightShift(long x, long y) => (x >> (int)y);
	public static long leftShift(long x, long y) => (x << (int)y);
	public static bool contains(long s, long x) => (rightShift(s, x) & 1L) == 1L;
	public static long gcd(long x, long y) => (y == 0) ? x : gcd(y, x % y);
	public static long lcm(long x, long y) => (x / gcd(x,y)) * y;	
	public static IEnumerable<int> Range(long start, long count) => Enumerable.Range((int)start, (int)count);
	public static void Sort(this List<string> source) => source.Sort(StringComparer.Ordinal);
}


Measured memory_bytes: 47648
#include <bits/stdc++.h> 
#define int long long
#define quickie ios_base::sync_with_stdio(false); cin.tie(NULL);
#define rep(i, a, b) for(int i=a; i<b; i++)
#define rep1(i, a, b) for(int i=a; i<=b; i++)
#define repp(i, a, b) for(int i=b-1; i>=a; i--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
#define db double
#define mi map<int, int>
#define vi vector<int>
#define MI(x) power(x, mod-2)
#define test int t; cin >> t;
#define mod 1000000007LL
#define pi 3.141592653589
//#define mod 998244353 
using namespace std;

int power(int x, int y) ;
int gcd(int a, int b) ;

/*___________________________TEMPLATE END______________________________*/

signed main() {
    quickie
    int a, b ;
    cin >> a >> b ;
    a *= b ;
    cout << a << "\n" ;
}

int power(int x, int y) {
    int res = 1; x %= mod;
    while (y > 0) {
        if (y & 1)
            res = (res*x) % mod;
        y = y>>1;
        x = (x*x) % mod;
    }
    return res%mod;
}

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

Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define all(container) container.begin(),container.end()
#define fast ios::sync_with_stdio(0); cin.tie(0)
// #ifndef ONLINE_JUDGE
// #include "debug.cpp"
// #endif
#define int long long
const int mod = 1e9+7;  
int power(int a,int b) { if(b==0) return 1; int res = power(a,b/2); if(b&1) return res * res * a; else return res * res; }


int32_t main(){
    
  fast;
  int n; cin >> n;
  int ar[n];

  vector<int> even;

  for(int i=0;i<n;i++){
    int x; cin >> x;
    if(x%2==0) even.pb(x);
  }

  int cnt = 0;
  for(auto k : even){
    if(k%3==0||k%5==0) cnt++;
  }

  if(cnt==even.size()) cout << "APPROVED";
  else cout << "DENIED";



  

  return 0;
}

Measured memory_bytes: 256
from sys import stdin

w,a,b = [int(x) for x in stdin.readline().rstrip().split()]

if b > a+w:
    print(b-a-w)
elif a <= b <= a+w:
    print(0)
elif b <= a <= b+w:
    print(0)
else:
    print(a-b-w)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define INF 1e9;
using namespace std;
using ll = long long;
int main() {
    int r , g;
    cin >> r >> g;
    cout << 2 * g - r << endl;
}


Measured memory_bytes: 3588
// AOJ 0560: Planetary Exploration
// 2017.9.30 bal4u@uu

#include <stdio.h>

int sum[3][1002][1002];
char buf[1002];
char tr['Z'];

int main()
{
	int m, n, k, i, r, c, r1, c1, r2, c2, ans;
	char *b;

	tr['J'] = 0, tr['O'] = 1, tr['I'] = 2;
	scanf("%d%d%d", &m, &n, &k);
	for (r = 1; r <= m; r++) {
		scanf("%s", buf);
		for (b = buf, c = 1; c <= n; c++, b++) {
			for (i = 0; i < 3; i++)
				sum[i][r][c] = sum[i][r-1][c] + (i == tr[*b]);
		}
	}
	while (k-- > 0) {
		scanf("%d%d%d%d", &r1, &c1, &r2, &c2);
		for (i = 0; i < 3; i++) {
			if (i > 0) putchar(' ');
			for (ans = 0, c = c1; c <= c2; c++) 
				ans += sum[i][r2][c] - sum[i][r1-1][c];
			printf("%d", ans);
		}
		putchar('\n');
	}
	return 0;
}

Measured memory_bytes: 13344
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define watch(x) cout <<(#x)<<" is "<<(x)<<endl
#define debug cout <<"hi"<<endl
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
const int MOD=1e9+7;
const int INF32=1<<30;
const ll INF64=1LL<<60;

void solve(){
  int a,p; cin >>a >>p;
  cout <<(3*a+p)/2;
}

int main(){
  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  solve();
return 0;}

Measured memory_bytes: 3604
#include "bits/stdc++.h"
using namespace std;
#define dbg(var) cout<<#var<<"="<<var<<" "
#define nl cout<<"\n"
#define fr(i,n) for(int i=0;i<n;i++)
#define rep(i,a,n) for(int i=a;i<=n;i++)
#define fast ios::sync_with_stdio(false);cin.tie(0);
#define vi vector<int>
#define vvi vector<vi>
#define pb push_back
#define fa(v) for(auto &i:v)
#define all(v) v.begin(),v.end()
#define sz(v) (int)(v.size())
//#define int long long
int32_t main()
{
	string s; cin >> s;s += '#';
	int cnt = 0,prev = -1, ans = 0;
	for(char c: s){
		if(prev != c) cnt=0;
		cnt++;
		prev = c;
		if(c == 'R') ans = max(ans, cnt);
	}
	cout << ans;
}

Measured memory_bytes: 3608
#define _USE_MATH_DEFINES
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <string>
#include <vector>
#include <utility>
#include <complex>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <deque>
#include <tuple>
#include <bitset>
#include <limits>
#include <algorithm>
#include <array>
#include <random>
#include <complex>
#include <regex>
#include <iomanip>
using namespace std;
typedef long double ld;
typedef long long ll;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define fcout cout << fixed << setprecision(10)
#define rep(i,n)    for(int i=0; i<(int)n; i++)
#define mp(a,b) make_pair(a,b)
#define pb push_back
#define all(x) x.begin(), x.end()
#define F first
#define S second
const ll inf = 1e18;
const ll mod = 1e9 + 7;

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

// mod.m での a の逆元 a^(-1) を計算する。
ll modinv(ll a, ll m) {
    ll b = m, u = 1, v = 0;
    while(b){
        ll t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

ll modpow(ll a, ll n){
    ll res = 1;
    while(n>0){
        if(n&1){
            res = res * a % mod;
        }
        a = a * a % mod;
        n >>=1;
    }
    return res;
}


int main(){
    int n;
    cin >> n;
    vll xpy, xmy;
    rep(i,n){
        ll x, y;
        cin >> x >> y;
        xpy.pb(x+y);
        xmy.pb(x-y);
    }
    sort(all(xpy));
    sort(all(xmy));
    ll ans = max(xpy[n-1] - xpy[0], xmy[n-1] - xmy[0]);
    cout << ans << endl;
}



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

#define ll long long
const int N = 1e5 + 5;

int A[N];

int main(){
	int n;
	scanf("%d", &n);
	for(int i = 1; i <= n; i++){
		scanf("%d", &A[i]);
	}

	ll res = LLONG_MAX;

	for(int big = 0; big <= 1; big++){
		ll ans = 0, sum = 0;
		for(int i = 1; i <= n; i++){	
			sum += A[i];
			if((i % 2) == big){
				if(sum <= 0){
					ans += (-sum + 1);
					sum = 1;
				}
			}
			else{
				if(sum >= 0){
					ans += (sum + 1);
					sum = -1;
				}
			}
		}
		res = min(res, ans);
	}
	cout<<res<<endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#include <algorithm>
#include <map>
#include <cstdlib>
#include <cmath>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long ll;

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

int main(){
    int n;
    string s;
    cin >> n >> s;
    int ans=0;
    for(int i=1;i<n;i++){
        string x=s.substr(0,i);
        string y=s.substr(i);
        set<char> st;
        int tmp=0;
        for(int a=0;a<x.size();a++) st.insert(x[a]);
        for(auto p:st){
            if(y.find(p)!=string::npos) ++tmp;
        }
        ans=max(ans,tmp);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
typedef boost::multiprecision::cpp_int bigint;

int main() {
  bigint A, B;
  cin >> A >> B;

  if (A > B)
    cout << "GREATER" << endl;
  else if (A < B)
    cout << "LESS" << endl;
  else
    cout << "EQUAL" << endl;
}

Measured memory_bytes: 256
r, c = (int(x) for x in input().split())
A = [[int(x) for x in input().split()] for row in range(r)]

for row in range(r):
  A[row].append(sum(A[row]))

list = []
for col in range(c + 1):
  sum = 0
  for row in range(r):
    sum += A[row][col]
  list.append(sum)

A.append(list)
for row in range(r + 1):
  for col in range(c + 1):
    if(col == c): print(A[row][col])
    else: print(A[row][col], "", end = "")


Measured memory_bytes: 6672
n,m=map(int,input().split(" "))
points=list(map(int,input().split(" ")))
points.sort()
score=0
#score=points[-1]-points[0]
sas=[]

for i in range(0,m-1):
  sas.append(points[i+1]-points[i])
sas.sort()

#score-=sum(sas[-n+1:]) 
if n>=m:
  print(0)
  exit()
else:
  print(sum(sas[:m-n]))

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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int a, b, c;
  cin >> a >> b >> c;
  if(a * b * c == 5 * 7 * 5)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
  return 0;
}

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

using namespace std;

char mp[10][10];

int main()
{
	int n,m,k;
	cin>>n>>m>>k;
	for(int i=0;i<n;i++) cin>>mp[i];
	int ans=0;
	for(int i=0;i< 1<<n;i++){
		for(int j=0;j < 1<<m;j++){
			int x[10],y[10],sum=0;
			for(int k=0;k<n;k++) x[k] = 1&(i>>k);
			for(int k=0;k<m;k++) y[k] = 1&(j>>k);
			for(int l=0;l<n;l++)
				for(int r=0;r<m;r++)
				if(mp[l][r]=='#'&&!x[l]&&!y[r]) sum++;
			if(sum==k) ans++;
		}
	}
	cout<<ans<<endl;
	return 0;
 } 

Measured memory_bytes: 3576
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <math.h>
#include <cmath>
#include <limits.h>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <functional>
#include <stdio.h>
using namespace std;

long long MOD = 1000000007;

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

    int p[55556] = {0};

    for ( int i = 2; i < 55556; i++ ) {
        if ( p[i] == 0 ) {
            for ( int j = i*2; j < 55556; j+=i ) {
                p[j] = 1;
            }
        }
    }

    vector<int> V;
    for ( int i = 2; i < 55556; i++ ) {
        if ( p[i] == 0 && i%5 == 1 ) { V.push_back(i); }
    }
    for ( int i = 0; i < N; i++ ) {
        cout << V[i];
        if ( i != N-1 ) { cout << " "; }
    }
    cout << endl;

    return 0;
}

Measured memory_bytes: 512
#include <stdio.h>

int main(void){
  char x,y;
  int a,b;
  scanf("%c %c", &x, &y);
  a = x - '0';
  b = y - '0';
  if(a == b){
    printf("=\n");
  }else if(a > b){
    printf(">\n");
  }else{
    printf("<\n");
  }
  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <string>
using namespace std;

int main(void) {
  int n, k, q;
  cin >> n >> k >> q;
  vector<int> a(n, k);
  
  for (int i = 0; i < q; ++i) {
    int qq;
    cin >> qq;
    a[qq - 1]++;
  }
  
  for (int i = 0; i < n; ++i) {
    a[i] -= q;
    if (a[i] > 0) cout << "Yes" << endl;
    else cout << "No" << endl;
  }
  
  return 0;
}

Measured memory_bytes: 1024
'use strict';
(function(stdin) {
  //declare function
  var sort = function(array) {
    return array.map(function(array) {
      return array.sort(function(a, b) {
        return a - b;
      }).join(' ');
    }).join('\n');
  };

  //declare variable
  var inputs = stdin.toString().trim().split('\n');
  var cols = inputs.splice(0, inputs.indexOf('0 0'));
  cols = cols.map(function(a) {
    return a.split(' ').map(Number);
  });
  //main

  //display
  console.log(sort(cols));
})(require('fs').readFileSync('/dev/stdin', 'utf8'))

Measured memory_bytes: 18576
def main():
    n = input()
    ab = []
    for _ in xrange(n):
        a, b = map(int, raw_input().split())
        ab.append([a, b])
    ab.sort(key=lambda x: x[0] + x[1], reverse=True)
    x = sum(a[0] for a in ab[0::2])
    y = sum(a[1] for a in ab[1::2])
    print x - y


if __name__ == '__main__':
    main()


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

#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define ALL(v) (v).begin(), (v).end()
#define p(s) cout<<(s)<<endl
#define p2(s, t) cout << (s) << " " << (t) << endl
#define br() p("")
#define pn(s) cout << (#s) << " " << (s) << endl

template < typename T >
void vprint(T &V){
	for(auto v : V){
    	cout << v << " ";
	}
	cout << endl;
}

int main(){
    ll N; cin >> N;
    vector<ll> A(N);
    FOR(i, 0, N){
        cin >> A[i];
    }
    sort(ALL(A));

    ll M; cin >> M;
    vector<ll> B(M);
    FOR(i, 0, M){
        cin >> B[i];
    }
    sort(ALL(B));

    ll count = 0;
    for(ll b : B){
        if(binary_search(ALL(A), b)){
            count++;
        }
    }

    p(count);
    
    return 0;
}


Measured memory_bytes: 3920
#include <bits/stdc++.h>
using namespace std;
/*#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template<typename T> using gpp_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T, typename L> using gpp_map = tree<T, L, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T> using gpp_multiset = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;*/
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define all(v) v.begin(),v.end()
#define SZ(v) ((int)v.size())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define Max(a, b) a = max(a, b)
#define Min(a, b) a = min(a, b)
#define bit(n) (1LL<<(n))
#define bit_exist(x, n) ((x >> n) & 1)
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v) { cout << #v << "=" << endl; REP(i_debug, v.size()){ cout << v[i_debug] << ","; } cout << endl; }
#define mdebug(m) { cout << #m << "=" << endl; REP(i_debug, m.size()){ REP(j_debug, m[i_debug].size()){ cout << m[i_debug][j_debug] << ","; } cout << endl;} }
#define Return(ans) { cout << (ans) << endl; return 0; }
#define pb push_back
#define f first
#define s second
#define int long long
#define INF 1000000000000000000
template<typename T> istream &operator>>(istream &is, vector<T> &v){ for (auto &x : v) is >> x; return is; }
template<typename T> ostream &operator<<(ostream &os, vector<T> &v){ for(int i = 0; i < v.size(); i++) { cout << v[i]; if(i != v.size() - 1) cout << endl; }; return os; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, pair<T1, T2> p){ cout << '(' << p.first << ',' << p.second << ')'; return os; }
template<typename T> void Out(T x) { cout << x << endl; }
template<typename T1, typename T2> void Ans(bool f, T1 y, T2 n) { if(f) Out(y); else Out(n); }
 
using vec = vector<int>;
using mat = vector<vec>;
using Pii = pair<int, int>;
using PiP = pair<int, Pii>;
using PPi = pair<Pii, int>;
using bools = vector<bool>;
using pairs = vector<Pii>;
 
//int dx[4] = {1,0,-1,0};
//int dy[4] = {0,1,0,-1};
//char d[4] = {'D','R','U','L'};
 
const int mod = 1000000007;
//const int mod = 998244353;
//#define Add(x, y) x = (x + (y)) % mod
//#define Mult(x, y) x = (x * (y)) % mod


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

signed main(){
    int N,M; cin>>N>>M;
    int K;
    vector<int> ans(M,0);
    REP(i,N) {
        cin>>K;
        REP(j,K){
            int A; cin>>A;
            ans[A-1]++;
        }
    } 
    int answ=0;
    REP(i,M){
        if(ans[i]==N) answ++;
    }
    cout<<answ<<endl;
}

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

using namespace std;

int main()
{
    long long N, Z, W, a[2000];

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

    if(N == 1)
    {
        cout << abs(a[0] - W) << endl;
    }
    else
    {
        cout << max(abs(a[N - 1] - W), abs(a[N - 2] - a[N - 1])) << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cmath>
#include<string>
#include<iostream>
#include<algorithm>
#include<utility>
#include<vector>
#include<map>
#include<set>
#include<limits>
#include<bitset>
#include<array>
#include<numeric>
#include<iomanip>
#include<functional>

using namespace std;
typedef long long int ll;

#define C cout<<
#define E <<endl

ll n,m,a,b,c,x,y,z,aa[100010],ba[100010];
bool r,ra,rb,rc;
string s,sa,sb,sc;
char ca,cb,cc,cd[1000][1000];
vector<ll> va,vb,vc;

int main(){
    cin>>s;
    r=true;
    for(int i=0;i<s.size();i++){
        r=r and ba[s[i]]==0;
        ba[s[i]]=1;
    }
    C (r ? "yes":"no") E;
    
}

Measured memory_bytes: 256
//***Little by little one travels far***
 
#include<bits/stdc++.h>
using namespace std;
 
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define ll long long
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i,n) for(i=0;i<n;i++)
#define forn(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define for1(i, n) for (ll i = 1; i <= (ll)(n); ++i)
#define ford(i, n) for (ll i = (ll)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (ll i = (ll)(a); i <= (ll)(b); ++i)
#define fora(it,x) for(auto it:x)
#define PI 3.14159265
#define sync ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define endl "\n"
 
typedef pair<ll, ll> pii;
typedef vector<ll> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long i64;
typedef vector<i64> vi64;
typedef vector<vi64> vvi64;
typedef pair<i64, i64> pi64;
typedef long double ld;
 
template<class T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; }

int main(){
    char ch;
    cin>>ch;

    if(ch=='A') cout<<"T";
    else if(ch=='T') cout<<"A";
    else if(ch=='G') cout<<"C";
    else cout<<"G";
}

Measured memory_bytes: 256
#include <stdio.h>
int main()
{    
int h, w;    
int i, j;    
while(1)
{       
 scanf("%d %d ", &h, &w);        
if(h==0&&w==0)break;        
for(i=0;i<h;i++){            
for(j=0;j<w;j++){                
if((i%2==0&&j%2==0)||(i%2==1&&j%2==1)){                    
printf("#");                }else{                   
 printf(".");                
}            
}            
printf("\n");        
}        
printf("\n");    
}    
return 0;
}


Measured memory_bytes: 2064
import java.io.*;
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
 
  //   String[] nyu=sc.nextLine().split(" ");

     String nyu=sc.nextLine();
//int A=Integer.parseInt(nyu[0]);
//int B=Integer.parseInt(nyu[1]);
//int C=Integer.parseInt(nyu[2]);
//int D=Integer.parseInt(nyu);

//StringBuffer sb = new StringBuffer(nyu);
//		String dst = sb.reverse().toString();

//     String nyu2=sc.nextLine();
//int E=Integer.parseInt(nyu2);



//double A=Double.parseDouble(nyu[0]);
//double B=Double.parseDouble(nyu[1]);
/*
switch(C){
case 7:
case 5:
case 3:
System.out.println("YES") ;
break;
default:
System.out.println("NO") ;

break;
}
*/

//int res=Math.min((A*B),C);

//for(String tem:nyu){
//if(tem.equals("1"))res++;
//}
//int res=0;
//for(int i=0;i<300;i++){
//if(num[i]==1)res=i;
//}

//char[] c = nyu.toCharArray();


//System.out.println(nyu+"-"+line_r_2+"-"+nyu2+"-"+line_r_1);


//if(nyu.equals(dst)){
//double res=Math.ceil((AB)/2);

System.out.println("ABC"+nyu);
//}else if((int)c[0]>(int)c[2]){
//System.out.println(">");

//}else{
//System.out.println("No");

//}




	}
}

Measured memory_bytes: 23252
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <string>
#include <cmath>
#include <vector>
#include <queue>
typedef long long ll;
using namespace std;

int main(void){
  int n,k,q,i,a;
  int score[100001]={};

  cin>>n>>k>>q;
  for(i=0;i<q;i++){
    cin>>a;
    score[a]++;
  }

  int border=q-k;
  for(i=1;i<=n;i++){
    if(score[i]>border){
      cout<<"Yes"<<endl;
    }
    else{
      cout<<"No"<<endl;
    }
  }

  return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define mod2 998244353 
#define PI 3.14159265
#define ll long long
#define ld long double
#define pi pair<ll,ll>
#define pb push_back
#define vi vector<ll>
#define sz size()
#define fi first
#define se second
#define lz length()
#define all(x) (x).begin(),(x).end()
#define scf(x) scanf("%lld",&x)
#define rep(i,n) for(ll i=0;i<n;i++)
const int INF = (int)1e9;
const ll IINF=1LL<<62;
const int maxn=10000005;
int divr[maxn];
/*ll modexpo(ll a,ll b)
{
     ll res=1LL;
     while(b>0)
     {
          if(b&1)res=(res*a)%mod;
          a=(a*a)%mod;
          b>>=1;
     }
     return res;
}*/
void divisor()
{for(int i=2;i<sqrt(maxn);i++)
     {
          if(!divr[i])
          {
               for(int j=i*i;j<maxn;j+=i)if(!divr[j])divr[j]=i;     
          }
     }
     for(int i=1;i<maxn;i++)if(!divr[i])divr[i]=i;
}
 
/*const int N=1000005;
ll n;
struct line {
    long long m, c;
    long long eval(long long x) { return m * x + c; }
    long double intersectX(line l) { return (long double) (c - l.c) / (l.m - m); }
};
vector<pair<pi,ll>> rect;
deque<line> dq;
*/
 
 
 
 
 



















int main()
{
     string x;
     cin>>x;
     int t=0,s=0;
     int ct=0;
     for(int i=0;i<x.length();i++)
     {
          if(x[i]=='T'&&s!=0)
          {
               ct++;s--;
          }
          else if(x[i]=='S')s++;
          
     }
     cout<<x.length()-2*ct;
}
 
 
 

















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

using namespace std;
typedef long long ll;
#define REP(i,n) for (ll i = 0; i < (n); ++i)

int main(){
    vector<ll> n(3);
    REP(i, 3){
        cin >> n.at(i);
    }
    sort(n.begin(), n.end());
    if(n.at(0) == 5 && n.at(1) == 5 && n.at(2) == 7){
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
n, m = map(int, input().split())
cnt = [0]*n
wrong_cnt = [0]*n
wrong = 0
for i in range(m):
    p, s = map(str, input().split())
    p = int(p)-1
    if cnt[p] != 0:
        continue
    if s == "WA":
        if wrong_cnt[p] == 0:
            wrong_cnt[p] = 1
            continue
        elif s == "WA" and wrong_cnt[p] == -1:
            continue
        else:
            wrong_cnt[p] += 1
            continue
    cnt[p] = 1
    wrong += wrong_cnt[p]
    wrong_cnt[p] = -1

correct = 0
for i in cnt:
    correct += i

print(correct, wrong)

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

int main(){

    //cout << "HEL" <<endl ;
    int x ,y,z;
    cin >> x >>y>>z ;
    int cnt = 0;
    for(int i = x;i<=y;i++){
        if( z%i == 0)  cnt++;
    }

    cout << cnt <<endl ;

    return 0;

}



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

int main() {
  
  int n ;
  cin >> n ;
  vector<int> vec(n) ; 
  for ( int i = 0 ; i < n ; i++ ) cin >> vec.at(i);
  
  sort(vec.begin() , vec.end()) ; 
  reverse(vec.begin() , vec.end()) ;
  
  int ans = 1 ;
  int maxi = vec.at(0) ; 
  for ( int i = 0 ; i < vec.size() ; i++) {
      if ( vec.at(i) < maxi ) {
      	maxi = vec.at(i) ;
        ans++ ;
      }
        
  }
  cout <<  ans << '\n' ;   
}


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

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(),v.end()
#define _GLIBCXX_DEBUG

using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using vd = vector<double>;
using vvi = vector<vi>;
using vvll = vector<vll>;
using vvd = vector<vd>;
using vvvi = vector<vvi>;
using vvvll = vector<vvll>;
using vvvd = vector<vvd>;

const double pi=3.141592653589793;

int main() {
    ll n,c;
    cin>>n>>c;
    ll d[c+1][c+1];
    rep(i,c){
        rep(j,c){
            cin>>d[i+1][j+1];
        }
    }
    vll c1(c+1,0);//(i+j)%3=1の色の数
    vll c2(c+1,0);
    vll c3(c+1,0);
    for (int i=1;i<n+1;i++){
        for (int j=1;j<n+1;j++){
            ll col;
            cin>>col;
            if ((i+j)%3==1){
                c1[col]+=1;
            }
            else if ((i+j)%3==2){
                c2[col]+=1;
            }
            else{
                c3[col]+=1;
            }
        }
    }
    ll ans=10000000000000000;
    for (int i=1;i<c+1;i++){
        for (int j=1;j<c+1;j++){
            if (i==j){
                continue;
            }
            for (int k=1;k<c+1;k++){
                if (i==k || j==k){
                    continue;
                }
                ll ans1=0;
                for (int l=1;l<c+1;l++){
                    ans1+=c1[l]*d[l][i]+d[l][j]*c2[l]+d[l][k]*c3[l];        
                }
                ans=min(ans,ans1);
                
            }
        }
    }
    cout<<ans<<endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include<cmath>
#define N 100005
#define A 1000005
#define MOD 1000000007 // //100000000 998244353 //
#define inf 1000000000000000000
#define ll long long
//#define M_PI 3.141592653589793238463

using namespace std;

#define pii pair<ll, ll>
#define piii pair<ll, pii>
#define ft first
#define sd second
#define pb push_back
#define rep(i, n) for(ll i = 0; i < n; i++)
#define repr(i, n) for(ll i = n-1; i >= 0; i--)
#define itr(it, x) for(auto it = x.begin(); it != x.end(); it++)
#define mem(a, b) memset(a, (ll)b, sizeof(a))
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
#define edge(v, x, y) v[x].pb(y); v[y].pb(x);
#define popcount __builtin_popcount
#define ANS(s) {cout << s << "\n"; return;}

//~~~~~~fancy print~~~~~~~//
#define printpii(a) cout << a.ft << " " << a.sd << endl;
#define printpiii(a) cout << a.ft << " " << a.sd.ft << " " << a.sd.sd << endl;
#define print(a, n) rep(i, n) cout << a[i] << " "; cout << endl;
#define printv(v) for(auto x: v)cout << x << " "; cout << endl;
#define printm(a, n, m) rep(i, n) { rep(j, m) cout << a[i][j] << "\t"; cout << endl;}

ll lx[4] = {0, 0, 1, -1};
ll ly[4] = {1, -1, 0, 0};
ll dx[8] = {0, 0, 1, -1, 1, -1, 1, -1};
ll dy[8] = {1, -1, 0, 0, 1, 1, -1, -1};
void fast(){ios_base::sync_with_stdio(false);cin.tie(0);cout << setprecision(12) << fixed;}
ll lcm(ll a, ll b) {return (a*b)/__gcd(a, b); }

void solve()
{
    ll n;
    cin >> n;
    ll g = 0;
    rep(i, n)
    {
        ll x; cin >> x; g = __gcd(g, x);
    }
    cout << g;
}
int main(){
    /*#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif*/
    fast();
    ll t = 1; //cin >> t;
    while(t--){
        solve();
    }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
#define fr(i,n) for(int i=0;i<(n);++i)
#define Fr(i,n) for(int i=1;i<=(n);++i)
#define ifr(i,n) for(int i=(n)-1;i>=0;--i)
#define iFr(i,n) for(int i=(n);i>0;--i)

int main(void) {
  int n;cin>>n;
  vector<int> f(n, 0);
  fr(i,n) {
    int a = 1;
    fr(j, 10){
      int x;cin>>x;
      f[i] += a*x;
      a *= 2;
    }
  }
  vector<vector<int>> p(n, vector<int>(11));
  fr(i, n) fr(j, 11) cin>>p[i][j];
  int v = -1000000000;
  Fr(i, 1023){
    int v_temp = 0;
    fr(j, n) {
      int t = 0;
      int a = i&f[j];
      while(a) {
        if(a%2) t++;
        a /= 2;
      }
      v_temp +=p[j][t];
    }
  v = max(v, v_temp);
  }
  cout << v << endl;
  return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>

using namespace std;

const int inf=1<<29;
int memo[6][4][4][4][4];

int main(){
	const int score[]={0,60,70,80};

	int t;	scanf("%d",&t);
	while(t--){
		int field[5][5];
		for(int i=0;i<5;i++)for(int j=0;j<5;j++)	scanf("%d",field[i]+j);

		for(int i=0;i<4;i++)for(int j=0;j<4;j++)for(int k=0;k<4;k++)for(int l=0;l<4;l++)
			memo[0][i][j][k][l]=-inf;
		memo[0][0][0][0][0]=0;

		for(int row=1;row<=5;row++){
			for(int i=0;i<4;i++)for(int j=0;j<4;j++)for(int k=0;k<4;k++)for(int l=0;l<4;l++){
				memo[row][i][j][k][l]=-inf;
				for(int p=0;p<4;p++)for(int q=0;q<4;q++)for(int r=0;r<4;r++)for(int s=0;s<4;s++){
					int cnt[5]={};
					cnt[0]=i+p;
					cnt[1]=i+j+p+q;
					cnt[2]=j+k+q+r;
					cnt[3]=k+l+r+s;
					cnt[4]=l+s;
					int rowscore=0;
					for(int m=0;m<5;m++){
						if(field[row-1][m]>0)	rowscore+=score[(field[row-1][m]-1+cnt[m])&3];
					}
					memo[row][i][j][k][l]=max(memo[row][i][j][k][l],
						memo[row-1][p][q][r][s]+rowscore);
				}
			}
		}

		printf("%d\n",memo[5][0][0][0][0]);
	}

	return 0;
}

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

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

void solve(void) {
  ll n, a, b; cin >> n >> a >> b;

  cout << (n / (a + b)) * a + min(n % (a + b), a) << endl;
  return;
}

int main(void) {
  solve();
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
    int N, K;
    char S[11];
    char c;

    scanf("%d\n%s\n%d", &N, S, &K);

    c = S[K - 1];
    for (int i = 0; i < N; i++) {
        if (S[i] == c) {
            printf("%c", c);
        } else {
            printf("*");
        }
    }
    printf("\n");

    return 0;
}


Measured memory_bytes: 128
/// Bismillahir Rahmanir Rahim
/* Mohammad Morsalin
   Dept of ICE, NSTU
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ll long long
#define pb push_back
#define mp make_pair
#define endl "\n"
#define int long long
#define f0(n) for(int i=0;i<n;i++)
#define ms(x) memset(x,0,sizeof(x))
#define ms2d(x,m,n) memset(x, 0, sizeof(x[0][0]) * m * n)
#define uniq(vec) vec.resize(distance(vec.begin(),unique(vec.begin(),vec.end())))
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define pi pair<int,int>
#define tc(t) int t;cin>>t;while(t--)
#define bits(n) __builtin_popcount(n)
#define maxpq priority_queue<int>
#define minpq priority_queue<int, vector<int>, greater<int> >
#define ins insert
#define ALL(v) v.begin(),v.end()
#define highest(x) numeric_limits<x>::max()
#define lowest(x) numeric_limits<x>::min()
#define Inf INFINITY
#define minv(v) *min_element(v.begin(),v.end())
#define maxv(v) *max_element(v.begin(),v.end())
#define fi first
#define se second
#define PI acos(-1)
#define sz(a) (int)a.size();
#define IOS ios::sync_with_stdio(false);
using namespace std;
int gcd(int a, int b) { if (a == 0) return b; return gcd(b % a, a);}
typedef tree<pair<int, int>,null_type,less<pair<int, int>>,rb_tree_tag,tree_order_statistics_node_update> ordered_multiset;
int dx8[] = {0, 0, 1, 1, 1, -1, -1, -1};
int dy8[] = {1,-1, 1, -1, 0, 0, -1, 1};
int dx4[] = {0, 0, 1, -1};
int dy4[] = {1, -1, 0, 0};
const long long MOD = 1000000007;
double sq(double x) {return x*x;}
template<typename T>inline T Bigmod(T base, T power, T MOD){
    T ret=1;
    while(power)
    {
        if(power & 1)ret=(ret*base)%MOD;
        base=(base*base)%MOD;
        power>>=1;
    }
    return ret;
}

bool sortinrev(const pair<int,int> &a,
               const pair<int,int> &b)
{
       return (a.first > b.first);
}
signed main()
{
    IOS
    int a;
    cin>>a;
    cout << a+(a*a)+(a*a*a)<<endl;
    return 0;
}
///Alhamdulillah


Measured memory_bytes: 3608
#include<bits/stdc++.h>
using namespace std;
 
int main(){
	int a,b;
	cin>>a>>b;

	int neg=0;
	for (int i = a; i <= b ; i++){
		if(i==0){
			cout<<"Zero"<<endl;
			return 0;
		}else if(i<0)
			neg++;


	}

	if(neg%2)
		cout<<"Negative"<<endl;
	else
		cout<<"Positive"<<endl;

}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        int s, t;
        try(Scanner scn = new Scanner(System.in)) {
            s = sum(scn.nextLine().split(" "));
            t = sum(scn.nextLine().split(" "));
        }
        System.out.println(s > t ? s : t);
    }

    private static int sum(String... scores) {
        int rslt = 0;
        for(String score : scores) {
            rslt += Integer.parseInt(score);
        }
        return rslt;
    }
}

Measured memory_bytes: 26364
#include "bits/stdc++.h"

using namespace std;

#define sp(x) cout<<setprecision(x);
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define all(a) (a).begin(), (a).end()
#define inf 10000000
#define linf INT64_MAX*0.99
#define print(s) cout<<(s)<<endl
#define lint long long
#define yes "Yes"
#define no "No"

typedef pair<int, int> P;
 
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int a, b; cin>>a>>b;
    if(a>=13) print(b);
    else if(a<=5) print(0);
    else print(b/2);
    return 0;
}

Measured memory_bytes: 256
n = int(input())

def fact(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

if n == 1:
    print(1)
    exit()

arr = [0 for _ in range(1001)]

for i in range(1,n+1):

    for j in range(len(fact(i))):
        arr[fact(i)[j][0]] += fact(i)[j][1]

ans = 1
for i in range(2,1001):
    if arr[i] > 0:
        ans *= arr[i] +1
    if ans > 1000000007:
        ans % 1000000007

print(ans % 1000000007)


Measured memory_bytes: 44904
#include <bits/stdc++.h>
#define all(vec) vec.begin(), vec.end()
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
template <class T>
using V = vector<T>;
template <class T>
inline void chmin(T &a, const T &b) { a = min(a, b); }
template <class T>
inline void chmax(T &a, const T &b) { a = max(a, b); }
template <class T>
inline bool kbit(const T &x, const int &k) { return ((x >> k) & 1LL); }
inline int popcount(const int &n) { return __builtin_popcount(n); }
inline ll popcountll(const ll &n) { return __builtin_popcountll(n); }
inline ll mask(const ll &k) { return (1LL << k) - 1LL; }
template <class T>
void zip(V<T> &v) {
    sort(all(v));
    v.erase(unique(all(v)), v.end());
}
template <class T>
int lwb(V<T> &v, const T &x) { return lower_bound(all(v), x) - v.begin(); }
void dump() {
    cerr << '\n';
}
template <class Head, class... Tail>
void dump(Head &&head, Tail &&... tail) {
    cerr << head << (sizeof...(Tail) == 0 ? " " : ", ");
    dump(std::move(tail)...);
}
template <class T>
void print(const vector<T> &v) {
    for (int i = 0; i < v.size(); i++) cout << v[i] << (i + 1 == v.size() ? '\n' : ' ');
}
template <class T>
void read(vector<T> &v) {
    for (int i = 0; i < v.size(); i++) cin >> v[i];
}
constexpr char sp = ' ', newl = '\n';
constexpr int dx[4] = {0, 1, 0, -1}, dy[4] = {1, 0, -1, 0};
constexpr ll INF = (1LL << 30) - 1LL;
constexpr ll MOD = 1e9 + 7;
//////////////////////////////////////////////INSERT ABOVE HERE
int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    string s = "";
    ll n;
    cin >> n;
    --n;
    ll t = 1;
    for (ll i = 0; i < 1000; i++) {
        s.push_back('a' + (n % 26LL));
        n /= 26LL;
        --n;
        if (n < 0) break;
    }
    reverse(all(s));
    cout << s << newl;
}

Measured memory_bytes: 3652