akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

#include <boost/range/adaptors.hpp>
#include <boost/range/irange.hpp>

using namespace std;
using namespace boost;
using namespace boost::adaptors;

int main() {
    int64_t n;
    cin >> n;

    vector<int64_t> a(n);
    int64_t s = 0;
    for (auto&& aa : a) {
        cin >> aa;
        s += aa;
    }

    constexpr auto M = 998244353L;

    vector<int64_t> dp(s / 2 + 1), dp2(s / 2 + 1);
    dp[0] = 3;
    dp2[0] = 3;
    int64_t ans = 1;
    for (auto aa : a) {
        ans *= 3;
        ans %= M;
        for (auto i : irange(0L, max(0L, s / 2 + 1 - aa)) | reversed) {
            dp[i + aa] += dp[i] * 2;
            dp[i + aa] %= M;
            dp2[i + aa] += dp2[i];
            dp2[i + aa] %= M;
        }
    }

    for (auto i : irange(0L, s / 2 + 1)) {
        ans += M - dp[i];
        ans %= M;
    }

    if (s % 2 == 0) {
        ans += dp2[s / 2];
        ans %= M;
    }

    cout << ans << endl;
}

Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define FOR(i, a, b) for(ll i = (a); i < (b); ++i)
#define REP(i, n) for(ll i = 0; i < (n); ++i)
#define ARRAY_LENGTH(array) sizeof(array)/sizeof(*array)
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; }
const int INF = 1000100100;

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

    ll Nb = 0, Wb = 0, Sb = 0, Eb = 0;
    REP(i, S.length()) {
        if(S[i] == 'N') {
            Nb = 1;
        }
        if(S[i] == 'W') {
            Wb = 1;
        }
        if(S[i] == 'S') {
            Sb = 1;
        }
        if(S[i] == 'E') {
            Eb = 1;
        }
    }

    if(!(Nb ^ Sb) && !(Wb ^ Eb)) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 3576
#include <bits/stdc++.h>
#define FOR(i, a, n) for(int (i) = (int)(a); (i) < (int)(n); ++(i))
#define FORe(i, a, n) for(int (i) = (int)(a); (i) <= (int)(n); ++(i))
#define rFOR(i, a, n) for(int (i) = (int)(n)-1; (i) >= (int)(a); --(i))
#define rFORe(i, a, n) for(int (i) = (int)(n); (i) >= (int)(a); --(i))
#define REP(i, n) FOR((i), 0, (n))
#define REPe(i, n) FORe((i), 1, (n))
#define REPo(i, n) FORe((i), 0, (n))
#define rREP(i, n) rFOR((i), 0, (n))
#define rREPe(i, n) rFORe((i), 1, (n))
#define rREPo(i, n) rFORe((i), 0, (n))
#define rep(i, n) FOR((i), 0, (n))
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define fi first
#define se second
#define dup(x, y) (((x)+(y)-1)/(y))
#define vc(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
using ll = long long;
using P = pair<int,int>;
using pll = pair<ll,ll>;
using T = tuple<int,int,int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vs = vector<string>;
using vp = vector<P>;
using vt = vector<T>;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main() {
  int n;
  cin>>n;
  vi a(n);
  REP(i, n) cin>>a[i];
  int ans = 0;
  for(int i = 0; i < n; i+=2) {
    if(a[i]%2) ans++;
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 3544
#include<cstdio>

int main() {
    int a,b,c,d,e;
    d = 0, e = 0;
    scanf("%d %d %d",&a,&b,&c);
    for(int i = 1;i <= c;i++){
        if(c % i == 0&&i >= a){
            for(int d = a;d <= b;d++){
                if(d % i == 0){
                    e = e + 1;
                    break;
                }
            }
        }
    }
    printf("%d\n",e);


}


Measured memory_bytes: 2740
import java.util.*;

class Main
{
	public static void main(String[] args)
	{
		int N,X,Y,Ans=0;
		Scanner sc = new Scanner(System.in);
		N = sc.nextInt();
		int[] V = new int[N];
		int[] C = new int[N];
		for(int i=0;i<N;i++)
		{
			V[i] = sc.nextInt();
		}
		for(int i=0;i<N;i++)
		{
			C[i] = sc.nextInt();
		}
		int comp;
		for(int i=0;i<N;i++)
		{
			comp = V[i] - C[i];
			if(comp>0) Ans+=comp;
		}
		System.out.println(Ans);
	}
}

Measured memory_bytes: 21460
#include <stdio.h>
#include <stdlib.h>

int main()
{int n,m;
 scanf("%d%d", &n,&m);
 int a[m];
 int total=0;
 for (int i=0; i<m; ++i)
  { scanf("%d", &a[i]);
    total+=a[i];
  }
 int ho= n-total;
 if (ho<0)
  printf("-1");
 else
  printf("%d", ho);
    return 0;
}


Measured memory_bytes: 1744
#include<iostream>
#include<vector>

int main(){

    size_t n;
    std::cin >> n;

    std::vector<size_t> a(n);

    for(auto&& e : a){
        std::cin >> e;
    }

    for(size_t i = n; i > 0; i--){
        std::cout << a.at(i - 1);
        if(i != 1) std::cout << ' ';
    }std::cout << std::endl;

    return 0;
}



Measured memory_bytes: 3088
#include <bits/stdc++.h> //JuniorMonster a.k.a Sho10
#define ll long long
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#define all(a) (a).begin(), (a).end()
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define sz size
#define f first
#define s second
#define pb push_back
#define er erase
#define in insert
#define mp make_pair
#define pi pair
#define rc(s) return cout<<s,0
#define mod 1000000007
#define PI 3.14159265359
#define CODE_START  ios_base::sync_with_stdio();cin.tie();cout.tie();
using namespace std;
ll a,b,c;
int32_t main(){
CODE_START;
cin>>a>>b>>c;
if(a!=b&&a!=c){
    rc(a);
}
if(b!=a&&b!=c){
    rc(b);
}
rc(c);
}

Measured memory_bytes: 256
#include<stdio.h>

void compare(int x[3],int n){
	int i_1, i_2;
	int save;
	for (i_1 = 0; i_1 < n-1;i_1++){
		for (i_2 = 0; i_2 < n-1; i_2 ++){
			if (x[i_2] > x[i_2 + 1]){
				save = x[i_2+1];
				x[i_2 + 1] = x[i_2];
				x[i_2] = save;
			}
		}
	}
}

int main(void){
	int x[3] = { 0 };
	int n = sizeof(x) / sizeof(x[0]);

	int i = 0;
	for (; i < n; i++){
		scanf("%d", &x[i]);
	}
	
	compare(x, n);
	for (i = 0; i < n-1; i++){
		printf("%d ", x[i]);
	}
	printf("%d\n", x[i]);


	return 0;
}


Measured memory_bytes: 2120
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define ll long long
using namespace std;
const int N = 105;

int n;
int a[N], cnt[N];

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

    cin >> n;
    for(int i = 1; i <= n; i++)
    {
        cin >> a[i];
        cnt[a[i]]++;
    }

    sort(a + 1, a + n + 1);

    if(a[1] < (a[n] + 1) / 2)
    {
        cout << "Impossible" << endl;
        return 0;
    }

    for(int i = 0; i <= a[n]; i++)
    {
        int d = max(i, a[n] - i);
        cnt[d]--;

        if(cnt[d] == -1)
        {
            cout << "Impossible" << endl;
            return 0;
        }
    }


    if(cnt[(a[n] + 1) / 2])
        cout << "Impossible" << endl;
    else
        cout << "Possible" << endl;

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<iomanip>       //マニピュレータの使用
using namespace std;

int main()
{
    double a, b ,c ,d ,e ,f;
    double x, y;

    while( cin >> a >> b >> c >> d >> e >> f )
    {
        y = ( c * d - a * f ) / ( d * b - a * e );   //y = (cd - af) / (db - ae)
        x = ( c - b * y ) / a;                       //x = (c -  by) / a

        cout << fixed;      //より正確に小数点以下の桁数を指定する.　setprecision(2)なら小数点3ケタを四捨五入して、小数点2桁きっちり表示
        cout << setprecision(3) << x << " " << y << endl;
    }

    return 0;
}


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

ave = float(sum(a) / n)
min_d = 1e9
ans = 0
for i in range(n):
    if abs(ave-a[i]) < min_d:
        ans = i
        min_d = abs(ave-a[i])

print(ans)

Measured memory_bytes: 3060
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<numeric>
#include<functional>
#include<algorithm>
#include<bitset>
#include<tuple>
#include<unordered_set>
#include<unordered_map>
#include<random>
#include<array>
#include<cassert>
using namespace std;
#define INF ((1<<30)-1)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()




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

	int k;
	cin >> k;
	int x = 7;

	int ans = -1;
	rep(i, k) {
		if (x % k == 0) {
			ans = i + 1;
			break;
		}
		x = (x * 10 + 7) % k;
	}
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 3648
#define _USE_MATH_DEFINES
#include<iostream>
#include<string>
#include<queue>
#include<cmath>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<random>
#include<functional>
#include<algorithm>
#include<stack>
#include<cstdio>
#include<bitset>
#include<unordered_map>
#include<climits>
#include<fstream>
using namespace std;
///////////////////library zone!!!!!!!!!!!!!!!!!!!!!!!!!!!!
typedef long long ll;
typedef long double ld;
#define all(a) (a).begin(),(a).end()
#define EPS (1e-5)
#define bit(n,k) ((n>>k)&1)
const ll Mod = 1000000007;
const ll mod = 998244353;
struct H {
	ll x, y;
	bool operator<(const H &b) const {
		if (x != b.x) return x < b.x;
		return y < b.y;
	}
	bool operator>(const H &b) const {
		if (x != b.x) return x > b.x;
		return y > b.y;
	}
	bool operator==(const H &b) const { return x == b.x&&y == b.y; }
	bool operator!=(const H &b) const { return (*this) != b; }
};
struct P {
	ll pos, cost;
	bool operator<(const P &b) const { return cost < b.cost; }
	bool operator>(const P &b) const { return cost > b.cost; }
};
struct B {
	ll to, cost;
};
struct E {
	ll from, to, cost;
	bool operator<(const E &b) const { return cost < b.cost; }
	bool operator>(const E &b) const { return cost > b.cost; }
};
template<typename T, typename U>
void chmin(T &a, U b) {
	if (a > b) a = b;
}
template<typename T, typename U>
void chmax(T &a, U b) {
	if (a < b) a = b;
}
template<typename T>
T max_0(T a) {
	if (a < 0) return 0;
	return a;
}
template<typename T>
T min_0(T a) {
	if (a > 0) return 0;
	return a;
}
ll read() {
	ll u;
	ll k = scanf("%lld", &u);
	return u;
}
ll gcd(ll i, ll j) {
	if (i > j) swap(i, j);
	if (i == 0) return j;
	return gcd(j%i, i);
}
ll mod_pow(ll x, ll n, ll p) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res * x % p;
		x = x * x % p;
		n >>= 1;
	}
	return res;
}//x^n%p
const ll Inf = 3023372036854775807;
const int inf = 1500000000;
#define int long long
//----------------------------------------------------
int n;
int a[500000];
H b[500000];
int c[500000];
signed main() {
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		b[i] = H{ a[i],i };
	}
	sort(b, b + n);
	for (int i = 0; i < n; i++) {
		c[b[i].y] = i;
	}
	for (int i = 0; i < n; i++) {
		int k = n / 2 - 1;
		if (c[i] <= k) cout << b[k + 1].x << endl;
		else cout << b[k].x << endl;
	}
}

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

int main() {
  int a, b, k;
  cin >> a >> b >> k;
  if (b - a + 1 < 2 * k) {
    rep(i, b - a + 1) {
      cout << a + i << endl;
    }
  }
  else {
    rep(i, k) {
      cout << a + i << endl;
    }
    rep(i, k) {
      cout << b - (k - 1) + i << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 3600
#include <stdio.h>
#include <algorithm>
int x[110];
int main()
{
	int a;
	scanf("%d",&a);
	for(int i=1;i<=a;i++) scanf("%d",&x[i]);
	std::sort(x+1,x+a+1);
	
	int count = 0;
	for(int i=1;i<=a;i++)
	{
		for(int j=i+1;j<=a;j++)
		{
			for(int k=j+1;k<=a;k++)
			{
				if(x[i]==x[j]) continue;
				if(x[j]==x[k]) continue;
				if(x[i]+x[j]>x[k]) count++;
			}
		}
	}
	printf("%d",count);
}

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

using namespace std;

typedef long long ll;

const int N(2e5 + 9);
const double inf(1e18);

int T, n, m, ans;

struct A
{
    double x, y;
    char d;
}a[N];

double calc(double t)
{
    double minx = inf, maxx = -inf, miny = inf, maxy = -inf;
    for (int i = 0; i < n; i++)
    {
        double x = a[i].x;
        double y = a[i].y;
        if (a[i].d == 'L') x -= t;
        else if (a[i].d == 'R') x += t;
        else if (a[i].d == 'U') y += t;
        else if (a[i].d == 'D') y -= t;
        minx = min(minx, x);
        miny = min(miny, y);
        maxx = max(maxx, x);
        maxy = max(maxy, y);
       /* minx = min(minx, t * (a[i].d == 'L' ? -1 : a[i].d == 'R') + a[i].x);
        maxx = max(maxx, t * (a[i].d == 'L' ? -1 : a[i].d == 'R') + a[i].x);
        miny = min(miny, t * (a[i].d == 'D' ? -1 : a[i].d == 'U') + a[i].y);
        maxy = max(maxy, t * (a[i].d == 'D' ? -1 : a[i].d == 'U') + a[i].y);*/

    }
    return (maxx - minx) * (maxy - miny);
}

int main()
{
    cin>>n;
    for (int i = 0; i < n; i++)
    {
        cin>>a[i].x>>a[i].y>>a[i].d;
    }
    double l = 0, r = 1e9, midl, midr;
    for (int i = 0; i< 150; i++)
    {
        midl = (2 * l + r) / 3;
        midr = (2 * r + l) / 3;
        if (calc(midl) < calc(midr))
        {
            r = midr;
        }
        else l = midl;
    }
     cout << fixed << setprecision(9) <<min(calc(0), calc(l)) << endl;
    return 0;
}


Measured memory_bytes: 4352
#include<algorithm>
#include<bitset>
#include<climits>
#include<cmath>
#include<cstdlib>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<string>
#include<time.h>
#include<tuple>
#include<utility>
#include<vector>

using namespace std;
const long mod = 1000000007;
long gcd(long x, long y) { if (x > y) { return gcd(y, x); } long r; while (y != 0) { r = x % y; x = y; y = r; }return x; }
long lcm(long x, long y) { return(x / gcd(x, y)) * y; }

int main() {

	double res = 0;
	long N; cin >> N;
	double v[100]; for (int i = 0; i < N; i++) cin >> v[i];

	sort(v, v + N);
	res = v[0];
	for (int i = 1; i < N; i++) {res = (res + v[i]) / 2;}

	cout << res << endl;
}

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

#define MIN(a,b)  (a<b?a:b)

int main()
{
	int n;
	int a,b;
	int ans,ans1;
	int count=0;
	while(cin>>n)
	{
		ans1=1000000;
		for(int i=1;i<n;i++)
		{
			ans=0;
			a=i;
			b=n-i;

			while(b>0)
			{
				ans+=b%10;
				b/=10;
			}
		
			while(a>0)
			{
				ans+=a%10;
				a/=10;
			}
			ans1=MIN(ans,ans1);

		}
		cout<<ans1<<endl;
	}
	return 0;
}

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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,n,m) for(int i=(int)(n); i<=(int)(m); i++)
#define RFOR(i,n,m) for(int i=(int)(n); i>=(int)(m); i--)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

/* Some Libraries */

//-------------------------------------------------

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,k; cin>>n>>k;
    n%=k;
    cout<<min(n,k-n)<<endl;
    return 0;
}


Measured memory_bytes: 256
import java.io.*;
import java.util.*;
public class Main implements Runnable {
    public void solve() throws Exception {
        MyScanner sc = new MyScanner();
        out = new PrintWriter(new BufferedOutputStream(System.out));
        int n = sc.nextInt();
        String s = Integer.toString(n);
        if (s.contains("7")){
            out.println("Yes");
        }else
            out.println("No");
    }

    //main function//
    public static PrintWriter out;
    public static void main(String[] args) throws Exception {
        new Thread(null, new Main(), "", 1 << 26).start();
    }
    public static class MyScanner {
        BufferedReader br;
        StringTokenizer st;
        public MyScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine(){
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }

    }
    public void run() {
        try {
           solve();
        } catch (Exception ex) {
            throw new RuntimeException(ex);
        } finally {
            out.close();
        }
    }
}


Measured memory_bytes: 32816
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <cstring>
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <cmath>
#include <numeric>
#include <float.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef unsigned long long ll;
// 最大公約数求める関数
int my_gcd(int n , int m){
  if(n < m){
    int tmp = n;
    n = m;
    m = tmp;
  }
  int l  = n % m;
  while(l != 0){
    n = m;
    m = l;
    l = n % m;
}
return m;
}

//char⇒int関数
 int ctoi(char c) {
 	switch (c) {
		case '0': return 0;
		case '1': return 1;
		case '2': return 2;
		case '3': return 3;
		case '4': return 4;
		case '5': return 5;
		case '6': return 6;
		case '7': return 7;
		case '8': return 8;
		case '9': return 9;
		default: return 0;
	}
}



int main(){
int X;cin >> X;
int cnt,ans;
ans = cnt = 1;
for(int i = 2; i <= X/2; i++){
  int a = i;
  while( a <= X){
    a *= i;
  }
  a /= i;
  ans = max(ans,a);
}
cout << ans << endl;
  }

Measured memory_bytes: 256
#include <bits//stdc++.h>
using namespace std;
int in(void){int x;cin>>x;return x;}
#define ll long long int;
#define rep(i,a,b) for(int i=int(a);i<int(b);i++)
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
/*-----------------------------------------------------*/
int main() {
	int a;
	long long int x=0;
	for(long long int i=0;i<4;i++){
		int a=99;
		scanf("%1d",&a);
		if(a==2)x++;
		else if(a==99)break;
	}
	cout<<x<<endl;
	return 0;
}


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

#define REP(i, m, n) for (int i = (m); i < (int)(n); i++)
#define REPS(i, m, n) for (int i = (m); i <= (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define reps(i, n) for (int i = 0; i <= (int)(n); i++)
#define rrep(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
#define rreps(i, x) for (int i = (int)(x); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb push_back
#define fi first
#define se second
typedef long long ll;
typedef pair<int, int> P;
const int inf = INT_MAX;
const ll INF = 1LL << 60;
const ll mod = 1e9 + 7;
const double EPS = 1e-10;
const double PI = acos(-1.0);
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val) { fill( (T*)array, (T*)(array+N), val ); }


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);

    int H, W;
    cin >> H >> W;
    cout << string(W + 2, '#') << endl;
    rep(i, H) {
        string s;
        cin >> s;
        cout << '#' + s + '#' << endl;
    }
    cout << string(W + 2, '#') << endl;
    return 0;
}

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

int main(){
  int i,N,K,a[200000],min=999999999,plus[1000]={0},p;
  char ss[10000];
  scanf("%d",&N);
  for(i=0;i<N;i++){
    scanf("%d",&a[i]);
    plus[i+1]=plus[i]+a[i];
  }
  K=plus[N];
  for(i=0;i<N;i++){
    p=abs(K-plus[i]-plus[i]);
    if(p<min)min=p;
  }
  printf("%d\n",min);
  return 0;
}

Measured memory_bytes: 256
import java.math.BigDecimal;
import java.util.*;

public class Main {
    public static void main(String[] args){
        ABC159C();
    }
    private static void ABC159C() {
        // no comment, no error check
        final int INPUT_LINES_CNT = 1;

        ArrayList<String> inputLines = getStdInMultiLines(INPUT_LINES_CNT);

        if (inputLines.size() == 0) {
            System.out.println(0);
            return;
        }

        String outputStr;
        try {
            List<String> inputLineList = Arrays.asList((inputLines.get(0)));
            double inputNum = Double.valueOf(inputLineList.get(0));
            outputStr = BigDecimal.valueOf((inputNum / 3.0) * (inputNum / 3.0) * (inputNum / 3.0)).toString();
        }
        catch (Exception ex) {
            outputStr = "0";
        }

        System.out.println(outputStr);
        return;
    }

private static int getStdInNum() {
        String line1 = getStdInSingleLine();
        if (isNumber(line1)) {
            return Integer.parseInt(line1);
        }
        return 0;
    }

    private static ArrayList<String> getStdInMultiLines() {
        int cnt = 0; 
        int max = 0;

        Scanner cin = new Scanner(System.in);
        ArrayList<String> list = new ArrayList<String>();
        for (;cin.hasNext();) {
            list.add(cin.nextLine());
            if (cnt++ == 0) {
                max = Integer.parseInt((list.get(0)).split(" ")[0]);
            }
            else if (cnt == max + 1) {
                break;
            }
        }
        cin.close();
        return list;
    }
    private static ArrayList<String> getStdInMultiLines(int inputLinesCnt) {
        int cnt = 0; 

        Scanner cin = new Scanner(System.in);
        ArrayList<String> list = new ArrayList<String>();
        for (;cin.hasNext();) {
            list.add(cin.nextLine());
            if (++cnt == inputLinesCnt) {
                break;
            }
        }
        cin.close();
        return list;
    }

    private static String getStdInSingleLine() {
        Scanner cin = new Scanner(System.in);

        for (;cin.hasNext();) {
            cin.close();
            return cin.nextLine();
        }

        cin.close();
        return "";
    }

    private static boolean isNumber(String val) {
        try {
            Integer.parseInt(val);
            return true;
        }
        catch (NumberFormatException nfex) {
            return false;
        }
    }

}


Measured memory_bytes: 21076
#include <cmath>
#include <vector>
#include <iostream>
#include <limits>
#include <iostream>
#include <vector>
#include <cassert>
#include <complex>
#include <cstdio>
#include <set>
#include <cstring>
#include <map>
#include <cmath>
#include <set>
#include <algorithm>
#include <queue>
#include <bitset>
#include <ctime>
#include <unordered_map>
#include <numeric>
#include <climits>

using namespace std;
typedef long long Long;
typedef long double Double;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef pair<int,int> PII;
typedef pair<Long,Long> PLL;

int read(int &x) { return scanf("%d", &x); }
int read(int &x, int &y) { return scanf("%d%d", &x, &y); }
int read(int &x, int &y, int &z) { return scanf("%d%d%d", &x, &y, &z); }
int read(Long &x) { return scanf("%lld", &x); }
char buff[1000010];
int read(string &s) { int r = scanf("%s", buff); s = buff; return r; }

#define dlog2(n) (31-__builtin_clz(n))

int solve1(vector<PII> V, int M) {
	multiset<PII> S;
	VVI T(100010);
	for (int i = 0; i < V.size(); ++i) {
		int a = V[i].first;
		int b = V[i].second;
		T[a].push_back(b);
	}
	int ans = 0;
	priority_queue<int> PQ;
	for (int i = 0; i <= M; ++i) {
		for(int v : T[i]) PQ.push(v);
		if (PQ.size() > 0) {
			ans += PQ.top();
			PQ.pop();
		}
	}
	return ans;
}
int solve2(vector<PII> V, int M) {
	sort(V.begin(), V.end());
	int mx = 0;
	do {
		int t = 0;
		for (int i = 0; i < M && i < V.size(); ++i) {
			if (M - i >= V[i].first) {
				t += V[i].second;
			}
		}
		mx = max(mx, t);
	} while (next_permutation(V.begin(), V.end()));
	return mx;
}

int main() {

	int N, M;
	read(N, M);
	vector<PII> V(N);
	for (auto &p : V) {
		read(p.first, p.second);
//		p.first = rand() % M;
//		p.second = rand() % M;
	}
	cout << solve1(V, M) << endl;
//	cout << solve2(V, M) << endl;

	return 0;
}

/*
3 -> 2 -> 1
3 -> 1 -> 1
2 -> 1 -> 1
1 -> 2 -> 1
1 -> 1 -> 1



*/

Measured memory_bytes: 7232
//arc071_c.cpp
//Sat Jun  9 10:07:14 2018

#include <iostream>
#include <string>
#include <queue>
#include <unordered_map>
#include <vector>
#include <algorithm>
using namespace std;
using ll=long long;

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

	int alpha[26];
	for (int i=0;i<26;i++){
		alpha[i] = 51;
	}

	int beta[26] = {};

	for (int i=0;i<n;i++){
		string temp;
		cin >> temp;
		for (int j=0;j<temp.size();j++){
			int x = (int) temp[j]-'a';
//			cout << beta[x] << endl;
			beta[x]++;
		}
		for (int k=0;k<26;k++){
			if (alpha[k] > beta[k]){
				alpha[k] = beta[k];
			}
			beta[k] = 0;
		}
	}

	for (int i=0;i<26;i++){
		char c = i+'a';
		while (alpha[i]>0){
			cout << c;
			alpha[i]--;
		}
	}
	printf("\n");
}

Measured memory_bytes: 256
import Control.Monad

main :: IO ()
main = do
  n <- readLn
  if n == 0
    then return ()
    else do
      ls <- replicateM n getLine
      k <- getLine
      let ls' = filter (\x -> [head x] == k) (concatMap words ls)
      putStrLn $ solve ls'
      main

solve :: [String] -> String
solve ls = format (take5 (foldl getName [] (sort (countName ls))))
  where
    getName :: [String] -> (String,Int) -> [String]
    getName acc (name,i) = name:acc

    countName :: [String] -> [(String,Int)]
    countName [] = []
    countName (x:xs) = (x,(count x (x:xs))):(countName (filter (\y -> x /= y) xs))
      where
        count :: String -> [String] -> Int
        count _ [] = 0
        count a (b:bs)
          | a == b = 1 + (count a bs)
          | otherwise = count a bs

    sort :: [(String,Int)] -> [(String,Int)]
    sort [] = []
    sort ((a,b):r) = (sort lower) ++ [(a,b)] ++ (sort higher)
      where
        lower = filter (\(c,d) -> (d < b) || ((d == b) && (c > a))) r
        higher = filter (\(c,d) -> (d > b) || ((b == d) && (c <= a))) r
        
    format :: [String] -> String
    format [x] = x
    format (x:xs) = x ++ " " ++ (format xs)

    take5 :: [String] -> [String]
    take5 [] = ["NA"]
    take5 xs = take5' xs 5
      where
        take5' :: [String] -> Int -> [String]
        take5' [] _ = []
        take5' _ 0 = []
        take5' (x:xs) n = x:(take5' xs (n-1))

Measured memory_bytes: 5448
#include <bits/stdc++.h>
using namespace std;
int main() {
  int A, B;
  cin >> A >> B;
  if (A == 1 && B == 2) {
    cout << 3 << endl;
  }
  else if (A == 1 && B ==3) {
    cout << 2 << endl;
  }
  else if (A == 2 && B == 1) {
    cout << 3 << endl;
  }
  else if (A == 2 && B ==3) {
    cout << 1 << endl;
  }
  else if (A == 3 && B ==1) {
    cout << 2 << endl;
  }
  else if (A == 3 && B ==2) {
    cout << 1 << endl;
  }

}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
	int list[31];
	int num;
	
	for (int i=1; i<=30; i++) list[i] = 0;
	for (int i=0; i<28; i++)
	{
		cin >> num;
		list[num] = 1;
	}
	for (int i=1; i<=30; i++)
	{
		if (list[i] == 0) cout << i << "\n";
	}
	
	return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) begin(v),end(v)
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
using ll = long long;
using pii = pair<int, int>;
constexpr ll INF = 1ll<<30;
constexpr ll longINF = 1ll<<60;
constexpr ll MOD = 1000000007;
constexpr bool debug = 0;
//---------------------------------//

int H, W;
int A[80][80], B[80][80];
bool dp[165][165][165*165];

int main() {
	cin >> H >> W;
	REP(i, H) REP(j, W) scanf("%d", &A[i][j]);
	REP(i, H) REP(j, W) scanf("%d", &B[i][j]);
	
	int mx = 165 * 165;
	int bias = mx / 2;
	REP(i, 2) dp[0][0][bias + (A[0][0] - B[0][0]) * (i ? -1 : 1)] = true;
	REP(i, H) REP(j, W) REP(k, mx) {
		REP(l, 2) {
			int prek = k - (A[i][j] - B[i][j]) * (l ? -1 : 1);
			if (prek < 0 || prek >= mx) continue;
			if (i && dp[i - 1][j][prek]) dp[i][j][k] = true;
			if (j && dp[i][j - 1][prek]) dp[i][j][k] = true;
		}
	}
	
	int ans = mx;
	REP(i, mx) if (dp[H-1][W-1][i]) chmin(ans, abs(i - bias));
	cout << ans << endl;
	
	return 0;
}


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

int main()
{
    int N;
    cin >> N;
    map<string, int> M;
    for (int i = 0; i < N; ++i)
    {
        string S;
        cin >> S;
        M[S]++;
    }

    // 最大の書かれた回数
    int writtenTimeMax = 0;
    for (auto &e : M)
    {
        if (writtenTimeMax < e.second)
            writtenTimeMax = e.second;
    }

    for (auto &e : M)
    {
        if (writtenTimeMax == e.second)
            cout << e.first << endl;
    }

    return 0;
}


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

int main()
{
  int n;
  cin >> n;
  vector<int> l(n);
  int i;
  for(i = 0; i < n; i++)
  {
    cin >> l.at(i);
  }
  int max = 0;
  int pick = 0;
  for(i = 0; i < n; i++)
  {
    if(l.at(i) > max)
    {
      max = l.at(i);
      pick = i;
    }
  }
  int sum = 0;
  for(i = 0; i < n; i++)
  {
    if(i != pick)
    {
      sum += l.at(i);
    }
  }
  if(max < sum)
  {
    cout << "Yes" << endl;
  }
  else
  {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
//#include<ext/pb_ds/assoc_container.hpp>
//#include<ext/pb_ds/tree_policy.hpp>
//
//    #pragma GCC optimize("unroll-loops")
//    #pragma GCC optimize("Ofast")
//    #pragma GCC optimize("-O3")
//    #pragma GCC optimize("no-stack-protector")
//    #pragma GCC optimize("fast-math")
//#define LOCAL
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cout<< *x, 0);
sim > char dud(...);
struct debug {
#ifndef LOCAL
~debug() { cout << endl; }
eni(!=) cout << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
	*this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define fi first
#define f first
#define se second
#define s second
#define vi_a vector<int>a;
#define p_b push_back
////////////////////////////////???????????????CHECK THIS OUT???????????????//////////////////////////////
#define ll long long
////////////////////////////////???????????????CHECK THIS OUT???????????????//////////////////////////////
#define ld long double
#define pll pair<ll,ll>
#define pii pair<int,int>
#define m_p make_pair
#define fast_io cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(0);
#define all(x) x.begin(),x.end()
#define getfiles    ifstream cin("input.txt");ofstream cout("output.txt");
#define pw(x) (1ll << x)
#define sz(x) (ll)x.size()

#define rall(x) x.rbegin(),x.rend()
#define len(a) (ll)a.size()
#define rep(x,l,r) for(ll x=l;x<r;x++)

//using namespace __gnu_pbds;
ld eps = (ld)1 / 1e6;
const ld pi=3.14159265359;
ll inf = 1e18,mod1=1e9+7;
ll sqr(ll a) { return a * a; }
ll qb(ll a) { return a * a * a; }
ll gcd(ll a, ll b) { return !a ? b : gcd(b % a, a); }
ll binpow(ll a, ll b, ll mod) { return b ? (b % 2 ? (a * (sqr(binpow(a, b / 2, mod)) % mod)) % mod : sqr(binpow(a, b / 2, mod)) % mod) : 1; }
ll binmult(ll a, ll b, ll mod) { return b ? (b % 2 ? (2 * binmult(a, b / 2, mod) + a) % mod : (2 * binmult(a, b / 2, mod)) % mod) : 0; }
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
const ll R=1e4;
const ll tx[4]={0,0,-1,1};
const ll ty[4]={-1,1,0,0};
const char rev_to[4]={'E','W','N','S'};
const int N=3e6+1;
const int M=1e9+7;

signed main(){
    fast_io;
    ll a;
    cin>>a;
    cout<<(1000-a%1000)%1000;
    return 0;
}
///stuff you should look for :
/*


	* int overflow, array bounds
	* special cases (n=1?)
	* do smth instead of nothing and stay organized
	* read the conditions carefully
	* WRITE STUFF DOWN
*/


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

typedef long long int ll;
typedef double d;

#define tt int t; cin>>t; while(t--)
#define lo(i, a, b) for(int i=a; i<b; i++)
#define rlo(i, a) for(int i=a; i>0; i--)

#define be(a) a.begin(),a.end()
#define sz(x) x.size()

#define nl cout<<"\n";
#define sp cout<<" ";

#define su ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define file() freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);

int main()
{
    su;
    ll n,k,cnt=0;
    cin>>n>>k;
    while(n>0)
    {
       cnt++;
       n/=k;
    }
    cout<<cnt;
    nl;
    return 0;
}


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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;
typedef vector<vpii> vvpii;

#define mt make_tuple
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sqr(x) ((ll)(x) * (x))

int n;

int minimalna(vpii &v)
{
    vi temp(n);

    for(int i = 0; i < n; ++i)
        temp[i] = v[i].fi;

    sort(all(temp));

    if(n % 2 == 0)
    {
        return temp[n/2-1]+temp[n/2];
    }
    else
    {
        return temp[(n+1)/2-1];
    }
}

int maksimalna(vpii &v)
{
    vi temp(n);

    for(int i = 0; i < n; ++i)
        temp[i] = v[i].se;

    sort(all(temp));

    if(n % 2 == 0)
    {
        return temp[n/2-1]+temp[n/2];
    }
    else
    {
        return temp[(n+1)/2-1];
    }
}

int main()
{
    cin >> n;

    vpii v(n);

    for(int i = 0; i < n; ++i)
    {
        int a, b;
        cin >> a >> b;
        v[i] = mp(a, b);
    }

    cout << maksimalna(v) - minimalna(v) + 1 << '\n';

    return 0;
}


Measured memory_bytes: 5508
import bisect, collections, copy, heapq, itertools, math, string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int, sys.stdin.readline().rstrip().split())
def LI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())

n = I()
S = LI()
q = I()
T = LI()
ans = 0
for t in T:
    if t in S:
        ans += 1
print(ans)



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

using namespace std;

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

main(){
	int n; cin >> n;
	ll arr[n];
	for(int i = 0;i<n;++i) cin >> arr[i];
	for(int i=0;i<n-1;++i){
		if(arr[i]<0){
			arr[i] = -1LL*arr[i];
			arr[i+1] = -1LL*arr[i+1];
		}
	}
	int sum = 0;
	ll total = 0;
	//for(int i=0;i<n;i++) cout << arr[i] << " ";
	//cout << endl;
	for(int i=0;i<n;++i){
		if(arr[i]<0){
			sum++; arr[i] = -1LL*arr[i];
		}
		total += arr[i];
	}
	sort(arr,arr+n);
	for(int i=0;i<sum;++i) {
		total -= 2LL*arr[i];
	}
	cout << total << endl;
}

Measured memory_bytes: 1024
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;

namespace PaizaTest
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());

            var ST = Console.ReadLine().Split(' ');
            var builder = new StringBuilder();
            for (int i = 0; i < N; i++)
            {
                builder.Append(ST[0][i]);
                builder.Append(ST[1][i]);
            }

            Console.WriteLine(builder.ToString());
        }
    }
}



Measured memory_bytes: 11092
H,W = map(int,input().split())
a = [list(input()) for _ in range(H)]

#行
r = [0]*H  #行ごとの#の数
for i in range(H):
    r[i]=a[i].count('#')
#列
c = [0]*W  #列ごとの#の数
for i in a:
    for j in range(W):
        if i[j]=='#':
            c[j]+=1
            
for i in range(H):
    a[i] = [a[i][j] for j in range(W) if c[j]!=0]


for i in range(H):
    if r[i]!=0:
        print(''.join(a[i]))

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

int main() {
        int d,g, ans=1000;
        cin >> d >> g;
        vector<pair<int,int> > score(d);
        vector<int> scoreSum(d);
        for(int i=0; i<d; i++) {
                cin >> score[i].first >> score[i].second;
                scoreSum[i]=score[i].first*(i+1)*100+score[i].second;
        }
        // d種類の問題について、完全に解くか解かないかを全探索
        for(int i=0; i<pow(2,d); i++) {
                bitset<10> isComplete(i);
                int hardest=d;
                int solved=0;
                int myScore = 0;
                for(int j=d-1; j>=0; j--) {
                        if(isComplete.test(j)) {
                                myScore+=scoreSum[j];
                                solved+=score[j].first;
                                if(hardest==j+1) hardest--;
                        }
                }
                // 現時点でのスコアが目標値以下ならば、どれか1種を中途半端に解けば良い
                if(myScore>=g) ans=min(ans,solved);
                else
                if(myScore<g) {
                        int numNotComplete = (int)(g-myScore+(hardest*100-1))/(hardest*100);
                        if(numNotComplete<score[hardest-1].first) {
                                solved+=numNotComplete;
                                ans=min(ans,solved);
                        }
                }
        }
        cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using uint = unsigned int;
using ll = long long;
using ld = long double;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define dbg(x) cerr<<#x": "<<(x)<<endl
#define dbg_p(x) cerr<<#x": "<<(x).first<<' '<<(x).second<<endl
#define dbg_v(x, n) {cerr<<#x"[]: ";for(long long _=0;_<n;++_)cerr<<(x)[_]<<' ';cerr<<endl;}
#define all(v) v.begin(), v.end()
#define fi first
#define se second

template<typename T1, typename T2>
ostream& operator <<(ostream &out, const pair<T1, T2> &item) {
	out << '(' << item.first << ", " << item.second << ')';
	return out;
}

template <typename T>
ostream& operator <<(ostream &out, const vector<T>& v) {
	for(const auto &item : v) out << item << ' ';
	return out;
}

const int N = 500010;

int a[N];
string s;

int main()
{
	ios_base::sync_with_stdio(false);
	
	cin >> s;
	for(int i = 0; i < s.length(); ) {
		int j;
		for(j = i; j < s.length() && s[i] == s[j]; ++j);

		if(s[i] == '<') {
			for(int k = i; k <= j; ++k) a[k] = k - i;
		} else {
			a[i] = max(a[i], j - i);
			int x = j - i;
			for(int k = i + 1; k <= j; ++k) a[k] = x - 1, --x;
		}

		i = j;
	}

	ll ans = 0;
	for(int i = 0; i <= s.length(); ++i) ans += a[i];

	cout << ans << '\n';

	return 0;
}


Measured memory_bytes: 2844
N = int(input())
s = [input() for _ in range(N)]

k = sum(t.count('AB') for t in s)
ab = sum(t[-1] == 'A' and t[0] == 'B' for t in s)
a = sum(t[-1] == 'A' and t[0] != 'B' for t in s)
b = sum(t[-1] != 'A' and t[0] == 'B' for t in s)
ans = k
isA = False
if a > 0:
    a -= 1
    isA = True
if ab > 0:
    if isA:
        ans += ab
    else:
        ans += ab - 1
    isA = True
if isA:
    if b > 0:
        ans += 1
        b -= 1
    ans += min(a, b)
else:
    ans += min(a, b)
print(ans)


Measured memory_bytes: 48216
#include<cstdio>
#include<algorithm>
using namespace std;
int i,n,m,a,b,ans;
int main()
{
	ans=1<<30;
	scanf("%d%d",&n,&m);
	for (i=1;i<=n;++i)
	{
		scanf("%d%d",&a,&b);
		if (b<=m)
			ans=min(ans,a);
	}
	if (ans==1<<30)
		printf("TLE");
	else
		printf("%d",ans);
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
 
int main(void){
	int n,i,num=0;
	cin >> n;
	vector<int>a(n+1);
	for(i=1;i<=n;i++)cin >> a.at(i);
	for(i=1;i<=n;i++){
		if((i%2==1) && (a.at(i)%2==1))num++;
	}
	cout <<num<< endl;
	
	
	return 0;
}

Measured memory_bytes: 3628
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cmath>
using namespace std;

const int maxn = 1005;
int n,k,ans;

int main()
{
    while(scanf("%d%d",&n,&k) != EOF)
    {
        ans = k * pow(k - 1,n - 1);
        printf("%d\n",ans);
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <iomanip> // cout<<setprecision(n)
#include <functional> // std::function<void(int)>
using namespace std;
#define All(v) (v).begin(),(v).end()
const long long mod = 1000000007;
const long long inf = mod*mod;
const double EPS=1e-10;
const double INF=1e+10;
const double PI=acos(-1.0);
signed main(){
    string s;
    cin>>s;
    long long k;
    cin>>k;
    if(k>100){
        for(int i=0;i<s.size();i++){
            if(s[i]!='1'){
                cout<<s[i]<<endl;
                return 0;
            }
        }
    }
    else{
        s+="11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111";
        for(int i=0;i<k;i++){
            if(s[i]!='1'){
                cout<<s[i]<<endl;
                return 0;
            }
        }
    }
    cout<<'1'<<endl;
    
}

Measured memory_bytes: 256
L, R = map(int, input().split())

listX = []
for i in range(1, 990590):
  listX.append(i*2019)

sw = 0
for n in range(len(listX)):
  if L < listX[n] and R > listX[n]:
    sw += 1

if sw > 0:
  print(0)

elif sw == 0:
  idx1 = 0
  listA = []
  for idx1 in range(L, R):
    for idx2 in range(idx1 + 1, R + 1):
      listA.append(idx1 * idx2)
 
  idx3 = 0
  listB = []
  for idx3 in range(len(listA)):
    listB.append(listA[idx3] % 2019)
 
  print(min(listB))

Measured memory_bytes: 211132
import java.util.Scanner;

class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int min = a + b;
		if (min > a + c) {
			min = a + c;
		}
		if (min > b + c) {
			min = b + c;
		}
		System.out.println(min);
	}
}

Measured memory_bytes: 23252
#include <bits/stdc++.h>
using namespace std;
int main () {
int n;
int dig;
int sum = 0;
scanf("%d",&n);
int num = n;
while(n){
dig = n % 10;
sum += dig;
n = n / 10;
}

if(num % sum == 0){
cout << "Yes" << endl;
}else{
cout << "No" << endl;
}
return 0;
}

Measured memory_bytes: 256
$N=<>+0;
/ /,${$`}{$'+0}=${$'+0}{$`}=1for<>;
@q=1;
$d[1]=0;
while($q=shift@q){
	$d[$_]//($d[$_]=$d[$q]+1,push@q,$_)for keys%$q
}
@q=$N;
$D[$N]=0;
$S=1;
while($q=shift@q){
	$D[$q]+1<$d[$_]and
	$D[$_]//(++$S,$D[$_]=$D[$q]+1,push@q,$_)for keys%$q
}
print$S*2<$N?Fennec:Snuke


Measured memory_bytes: 89728
l, r = map(int, input().split())

mod_min = l * r
for i in range(l, r + 1):
    if mod_min == 0:
        break
    for j in range(i + 1, r + 1):
        mod_tmp = (i * j) % 2019
        if mod_tmp < mod_min:
            mod_min = mod_tmp
        if mod_min == 0:
            break

print(mod_min)

Measured memory_bytes: 3060
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>

int main(){

    int problemas[111];
    int total=0,problem,bebidas,segundo,n,m,aux=0;

    scanf("%d",&n);

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

    for(int i=0;i<n;i++){
      total=problemas[i]+total;
    }
    aux=total;
    scanf("%d",&m);

    for(int i=0;i<m;i++){
      scanf("%d %d",&bebidas,&segundo);
      total=(total-problemas[bebidas-1])+segundo;
      printf("%d\n", total);
      total=aux;
    }

    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
using ll = long long;
using P = pair<int, int>;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(), v.end()
#define sz(x) ((int) x.size())
#define pb push_back
#define mp make_pair
#define F first
#define S second
typedef vector<ll> vi;
const int MOD = 1000000007;
template<class T> void print(const T& t){ cout << t << endl; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main(){
  ll x, a, b;
  cin >> x >> a >> b;
  if(b<=a){
    print("delicious");
  }
  else if(b<=x+a){
    print("safe");
  }
  else{
    print("dangerous");
  }
}

Measured memory_bytes: 256
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
b.reverse()
c = []
cs = -1
e = -1
for i in range(n):
  if a[i] > b[i]:
    c.append(1)
  elif a[i] == b[i]:
    c.append(0)
    e = a[i]
    if cs == -1:
      cs = i
  else:
    c.append(-1)
#print(a)
#print(b)
#print(c)
ans = 0
db = 0
for i in range(n):
  if a[i] == e:
    ans += 1
  if b[i] == e:
    ans += 1
  if a[i] == b[i]:
    db += 1
if ans > n:
  print('No')
  exit()
print('Yes')
cnt = 0
#print(b)
#print(cs,db)
for i in range(n):
  if cnt == db:
    break
  #print(i,a[i],b[i])
  if a[i] != e and b[i] != e:
    b[i],b[cs+cnt] = b[cs+cnt],b[i]
    cnt += 1
    #print(b)
print(' '.join(map(str,b)))

Measured memory_bytes: 119536
import bisect

n = int(input())
a = list(map(int, input().split( )))
b = list(map(int, input().split( )))
c =  list(map(int, input().split( )))
a.sort()
b.sort()
c.sort()


ans = 0

b_a = [0]
for i in range(n):
    bsct = bisect.bisect_left(a,b[i])
    b_a.append(bsct)
b_a_sum = [0]
sm = 0
for i in range(1,n+1):
    sm += b_a[i]
    b_a_sum.append(sm)
ans = 0
for i in range(n):
    mid =  bisect.bisect_left(b,c[i])
    ans += b_a_sum[mid] 
print(ans)

Measured memory_bytes: 24692
#include <iostream>
#include <math.h>
#include <string>
#include <vector>

using namespace std; 

int main(void)
{
	string s;

	cin >> s;
	
	if (s == "Sunny") {
		cout << "Cloudy";
	}

	else if (s == "Cloudy") {
		cout << "Rainy";
	}
	
	else {
		cout << "Sunny";
	}

	return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cmath>
#include<vector>
#include<string>
#include<algorithm>

using namespace std;

int main()
{
	int a;
	string s;
	char input[20];

	scanf("%d", &a);
	scanf("%s", input);
	s = input;

	if (a >= 3200)
	{
		printf("%s\n", s.c_str());
	}

	else
	{
		printf("red\n");
	}

	return 0;
}


Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var N int
	fmt.Scan(&N)

	c := 0
	for i := 0; i < N; i++ {
		var a int
		fmt.Scan(&a)
		for (a % 2 == 0)&&(a != 0) {
			a = a / 2
			c++
		}
	}

	fmt.Print(c)
}

Measured memory_bytes: 1280