akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<map>
#include<set>
#include<queue>
#include<math.h>
using namespace std;
#define N (1000000000+7)
#define INF 1e16
typedef long long ll;
typedef pair<ll,ll> P;

int p;
int cof[3010][3010];
int b[3010];

int main(void){
    cin>>p;
    vector<int>a(p);
    for(int i=0;i<p;i++)cin>>a[i];
    for(int i=0;i<p;i++){
        if(i==p-1)cof[0][i]=1;
        else{
            if(i==0)cof[0][i]=-1;
            else cof[0][i]=0;
        }
    }
    for(int i=1;i<p;i++){
        for(int j=p-1;j>=0;j--){
            if(j==0)cof[i][j]=0;
            else{
                if(j==p-1)cof[i][j]=1;
                else cof[i][j]=(cof[i][j+1]*i)%p;
            }
        }
    }
    for(int i=0;i<p;i++){
        for(int j=0;j<p;j++){
            b[j]=(b[j]-a[i]*cof[i][j])%p;
        }
    }
    for(int i=0;i<p;i++){
        if(b[i]<0)cout<<p+b[i]<<" ";
        else cout<<b[i]<<" ";
    }
    return 0;
}


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

const int p = 262144;
int n, i;
int h [200001];
int a [200001];
ll tree [p+p];

ll Max (int a, int b)
	{
	a+=p;
	b+=p;
	ll res = 0;
	while (a/2 != b/2)
		{
		if (a%2==0)
			res=max(res,tree[a+1]);
		if (b%2==1)
			res=max(res,tree[b-1]);
		a/=2;
		b/=2;
		}
	return res;
	}

void Insert (int u, ll val)
	{
	u+=p;
	tree[u]=val;
	for (u/=2; u!=0; u/=2)
		tree[u]=max(tree[2*u],tree[2*u+1]);
	}

int main ()
	{
	scanf ("%d",&n);
	for (i=1; i<=n; i++)
		scanf ("%d",&h[i]);
	for (i=1; i<=n; i++)
		scanf ("%d",&a[i]);
	for (i=1; i<=n; i++)
		Insert(h[i], Max(0,h[i])+a[i]);
	printf ("%lld\n",tree[1]);
	return 0;
	}


Measured memory_bytes: 5376
n = int(input())
a = []
b = []
c = []
for i in range(n):
    ai,bi,ci = [int(x) for x in input().split()]
    a.append(ai)
    b.append(bi)
    c.append(ci)

dp = []
for i in range(n):
    dp.append([-float('inf')]*3)

dp[-1][0] = a[-1]
dp[-1][1] = b[-1]
dp[-1][2] = c[-1]

for i in range(n-2,-1,-1):
    dp[i][0] = max(dp[i+1][1],dp[i+1][2])+a[i]
    dp[i][1] = max(dp[i+1][0],dp[i+1][2])+b[i]
    dp[i][2] = max(dp[i+1][0],dp[i+1][1])+c[i]
    
print(max(dp[0][0],dp[0][1],dp[0][2]))


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

using namespace std;

typedef long long ll;

const int INF = 1e9;
const ll LLINF = 1e18;
const ll MOD = (ll)1e9 + 7;

int gcd(int x, int y) {  return y == 0 ? x : gcd(abs(y), abs(x) % abs(y)); }

int main()
{
  int A, B, C; scanf("%d %d %d", &A, &B, &C);
  printf("%s\n", C % gcd(A, B) == 0 ? "YES" : "NO");
  return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;


namespace AtCoderWorkspace
{
    class Program
    {
        static void Main(string[] args)
        {
            var cin = new Scanner();

            var S = cin.next();

            
            var list = new List<int>();
            list.Add(S.Count(s => s.Equals(S[0])));
            list.Add(S.Count(s => s.Equals(S[1])));
            list.Add(S.Count(s => s.Equals(S[2])));
            list.Add(S.Count(s => s.Equals(S[3])));

            foreach (var item in list)
            {
                if(item != 2)
                {
                    Console.WriteLine("No");
                    return;
                }
            }

            Console.WriteLine("Yes");

        }

       
    }

    class Point
    {
        public int x { get; set; }
        public int y { get; set; }
    }


    class Scanner
    {
        string[] s;
        int i;

        char[] cs = new char[] { ' ' };

        public Scanner()
        {
            s = new string[0];
            i = 0;
        }

        public string next()
        {
            if (i < s.Length) return s[i++];
            string st = Console.ReadLine();
            while (st == "") st = Console.ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            if (s.Length == 0) return next();
            i = 0;
            return s[i++];
        }

        public int nextInt()
        {
            return int.Parse(next());
        }
        public int[] ArrayInt(int N, int add = 0)
        {
            int[] Array = new int[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextInt() + add;
            }
            return Array;
        }

        public long nextLong()
        {
            return long.Parse(next());
        }

        public long[] ArrayLong(int N, long add = 0)
        {
            long[] Array = new long[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextLong() + add;
            }
            return Array;
        }

        public double nextDouble()
        {
            return double.Parse(next());
        }


        public double[] ArrayDouble(int N, double add = 0)
        {
            double[] Array = new double[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextDouble() + add;
            }
            return Array;
        }
    }
}

Measured memory_bytes: 11220
#include<iostream>
using namespace std;
int main() {
  int n, k; string s;
  cin >> n >> s >> k;
  char tmp = s[k - 1];
  for (int i = 0; i < s.size(); ++i) {
    if (s[i] != tmp) s[i] = '*';
  }
  cout << s << endl;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,n) for(int i=0;i<n;i++)
#define why(n,x) int n;while(cin >>n,n!=x)
#define iFOR(i,x,n)for(int i=x;i<n;i++)

#define unless(flg) if ( !(flg) )
#define read cin<<
#define echo cout<<
#define fin <<'\n'
#define __ <<" "<<
#define bash push_back
#define alles(x) x.begin(),x.end()
#define SWAP(a,b) ((a != b) && (a += b,b = a - b,a -= b))
#define WF(d,v) FOR(k,v){ FOR(i,v){ FOR(j,v) d[i][j]=min(d[i][j],d[[i][k]+d[k][j]) } }
int dx[]={1,0,-1,0,1,1,-1,-1};
int dy[]={0,-1,0,1,-1,1,-1,1};
const int INF=1 << 30;
bool inside(int x,int y,int w,int h){
  return (x>=0 && y>=0 && x<w && y<h);}
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vit;
typedef map<string,int> mstit;
typedef priority_queue<int> pqit;
 
 
int main(){
  cin.tie(0), ios::sync_with_stdio(false);
  int n;
  int p[10005];
  cin >>n;
  FOR(i,n) cin >>p[i];
  sort(p,p+n,greater<int>());
  ll ans=0;
  ans=p[0]/2;
  iFOR(i,1,n) ans+=p[i];
  cout <<ans fin;
  
  return 0;
}



Measured memory_bytes: 256
import sys
import math
import fractions
import bisect
import queue
import heapq
import collections
import itertools
sys.setrecursionlimit(4100000)

MOD = int(1e9+7)
PI = 3.14159265358979323846264338327950288
INF = 1e18

'''
1行のint=====================================
N, K = map(int, input().split())
N, M = map(int, input().split())
A, B = map(int, input().split())

H, W = map(int, input().split())

L, R = map(int, input().split())

1行のstring=================================
S, T = input().split()

1行の整数配列================================
P = list(map(int,input().split()))

A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
D = list(map(int,input().split()))

L = list(map(int,input().split()))
R = list(map(int,input().split()))

T = list(map(int,input().split()))

改行あり整数==================================
X = []
Y = []
for i in range(N):
    x1,y1=[int(i) for i in input().split()]
    X.append(x1)
    Y.append(y1)

A = []
for i in range(N):
    a=int(input())
    A.append(a)

Pair = []
for i in range(N):
    x1,y1=[int(i) for i in input().split()]
    Pair.append((x1, y1))
    
2次元整数配列=====================================
A = []
for i in range(N):
    tmp = list(map(int,input().split()))
    A.append(tmp)


N行M列の初期化====================================
dp = [[VAL] * RETU for i in range(GYO)]

'''


N = int(input())
S = []
for i in range(N):
    s = input()
    S.append(s)
 

S.sort()

count = collections.Counter(S)

most = count.most_common()[0][1]

ans = []

for c in count.most_common():
    if c[1] == most:
        ans.append(c[0])

ans.sort()
for a in ans:
    print(a)





Measured memory_bytes: 46808
#include <cstdio>
using namespace std;

int main(){

    int n, i, j, m;

    scanf("%d", &n);

    int S[n];

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

        scanf("%d", &S[i]);

    }

    scanf("%d", &m);

    int key[m];
    int count = 0;

    for( i = 0 ; i < m ; i++ ){

        scanf("%d", &key[i]);

        for( j = 0; j < n; j++ ){

            if( S[j] - key[i] == 0 ) {
                   
                count++;
                
                break;

            }

        }

    }

    printf("%d\n", count);

    return 0;

}

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

using namespace std;

int main(){

    string s; cin >> s;

    long long sum = 0;
    int n = (int)s.size()-1;

    for (int bit=0; bit<(1<<n); bit++)
    {
        long long tmp = s[0] - '0';

        for(int i=0; i<n; i++)
        {
            if (bit&(1<<i))
            {
                sum += tmp;
                tmp = s[i+1] - '0';
            }
            else
            {
                tmp *= 10;
                tmp += s[i+1] - '0';
            }
        }
        sum += tmp;
    }

    cout << sum << "\n";

    return 0;
}

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

ll power(ll x, ll y){
    if (x==1) return 1;
    if (y==1) return x;
    if (x>1000000) return 1000000000001;
    if (y>40) return 1000000000001;
    ll res = 1;
    for (ll i=0; i<y; i++){
        if(res>1000000000000) {
            res = 1000000000001;
            break;
        }
        res *= x;
    }
    return res;
}

int main(){
    ll N, P; cin >> N >> P;
    ll ans = 1;
    if(N==1) ans = P;
    else{
        for (ll i=1;power(i,N)<=P;i++){
            if(P%power(i,N))continue;
            ans = i;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>

int main() {
    int c[3][3];
    std::cin >> c[0][0] >> c[0][1] >> c[0][2];
    std::cin >> c[1][0] >> c[1][1] >> c[1][2];
    std::cin >> c[2][0] >> c[2][1] >> c[2][2];

    int a[3], b[3];

    a[0] = 0;
    b[0] = c[0][0];
    b[1] = c[0][1];
    b[2] = c[0][2];
    a[1] = c[1][0] - b[0];
    a[2] = c[2][0] - b[0];

    bool flg = true;
    for (int i = 0; i < 3; i++) {
        for (int j = 0; j < 3; j++) {
            if (a[i] + b[j] != c[i][j]) {
                flg = false;
                break;
            }
        }
    }

    std::cout << (flg ? "Yes" : "No") << std::endl;

    return 0;
}


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

public class Main {
    FastScanner in;
    PrintWriter out;

    void solve() {
        long x = in.nextLong();
        long y =in.nextLong();
        if (x % y == 0) {
            out.println(-1);
        } else {
            out.println(x);
        }
    }

    void run() {
        try {
            in = new FastScanner(new File("Main.in"));
            out = new PrintWriter(new File("Main.out"));

            solve();

            out.close();
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }
    }

    void runIO() {

        in = new FastScanner(System.in);
        out = new PrintWriter(System.out);

        solve();

        out.close();
    }

    class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner(File f) {
            try {
                br = new BufferedReader(new FileReader(f));
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            }
        }

        public FastScanner(InputStream f) {
            br = new BufferedReader(new InputStreamReader(f));
        }

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

        boolean hasMoreTokens() {
            while (st == null || !st.hasMoreTokens()) {
                String s = null;
                try {
                    s = br.readLine();
                } catch (IOException e) {
                    e.printStackTrace();
                }
                if (s == null)
                    return false;
                st = new StringTokenizer(s);
            }
            return true;
        }

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

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

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

    public static void main(String[] args) {
        new Main().runIO();
    }
}

Measured memory_bytes: 21460
/*------------------------------------
........Bismillahir Rahmanir Rahim....
..........created by Abdul Aziz.......
------------------------------------*/
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <cstring>
#include <unordered_map>
#include <queue>
#define   mod  998244353
#define   int  long long 
#define   ld   long double
#define   pb   push_back
#define   vi  vector<int> 
#define   dbg(x)  cerr << #x << " = " << x << '\n'
#define   sz(x)  (int)x.size()
#define   ff   first
#define   ss   second
#define   pii  pair<int,int>
using namespace std;

inline void solve(){
    int n,ans=0; cin>>n; 
    ld T,A; cin >> T >> A ; 
    ld  a[n], dif=10000 ; 
    for (int i=0;i<n;i++) { 
        cin >> a[i] ; 
        ld  h = T-(a[i]*0.006); 
        if (fabs(A-h)<dif){
          dif = fabs(A-h); 
          ans = i+1;
        }
    } 
    cout << ans << endl;
}

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


Measured memory_bytes: 3804
#include <iostream>
#include <cstdio>
#include <vector>
#include <queue>
#include <cmath>
#include <algorithm>
#include <functional>
#include <cassert>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
#define rep1(i,n) for(int i=1;i<=(n);++i)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define fs first
#define sc second
#define show(x) //cout << #x << " = " << x << endl;
int n,mod=2011,inv[2011];
string s[20];
int calcinv(int x){
	int ret=1,tmp=mod-2,p=x;
	rep(i,11){
		if((tmp>>i)&1) ret=ret*p%mod;
		p=p*p%mod;
	}
	inv[x]=ret;
}
int expr(int& top,int& bottom,int& base,int& be);
int frac(int& top,int& bottom,int& base,int& be){
	//cout << "infrac " << s[base][be] << endl;
	int utop=top,ubottom=base-1,ubase=-1,ube=-1;
	int dtop=base+1,dbottom=bottom,dbase=-1,dbe=-1;
	for(int x=be+1;;x++){
		for(int y=utop;y<=ubottom;y++) if(s[y][x]!='.') ubase=y,ube=x;
		if(ubase!=-1) break;
	}
	for(int x=be+1;;x++){
		for(int y=dtop;y<=dbottom;y++) if(s[y][x]!='.') dbase=y,dbe=x;
		if(dbase!=-1) break;
	}
	int u=expr(utop,ubottom,ubase,ube),d=expr(dtop,dbottom,dbase,dbe);
	while(s[base][be]=='-') be++;
	return u*inv[d]%mod;
}
int primary(int& top,int& bottom,int& base,int& be){
	//cout << "inprimary " << s[base][be] << endl;
	int ret;
	if(isdigit(s[base][be])){
		ret=s[base][be]-'0';
		be++;
	}else{
		//cout <<"beforeassert "<< s[base][be] << endl;
		assert(s[base][be]=='(');
		be+=2;
		ret=expr(top,bottom,base,be);
		be+=2;
	}
	//cout << "primary " << ret << endl;
	return ret;
}
int powexpr(int& top,int& bottom,int& base,int& be){
	int ret=primary(top,bottom,base,be);
	if(base>top && isdigit(s[base-1][be])){
		int ex=s[base-1][be]-'0';
		int rett=1;
		rep(i,ex) rett=rett*ret%mod;
		ret=rett;
		be++;
	}
	//cout << "powexpr " << ret << endl;
	return ret;
}
int factor(int& top,int& bottom,int& base,int& be){
	//cout << "infactor "<<s[base][be]<<endl;
	int ret=0;
	if(s[base][be]=='-' && s[base][be+1]=='-'){
		ret=frac(top,bottom,base,be);
	}else if(s[base][be]=='-'){
		be+=2;
		ret=(mod-factor(top,bottom,base,be))%mod;
	}else{
		ret=powexpr(top,bottom,base,be);
	}
	return ret;
}
int term(int& top,int& bottom,int& base,int& be){
	//cout << "interm " << s[base][be]<<endl;
	int ret=factor(top,bottom,base,be);
	while(true){
		if(s[base][be+1]=='*'){
			be+=3;
			ret*=factor(top,bottom,base,be);
			ret%=mod;
		}else break;
	}
	return ret;
}
int expr(int& top,int& bottom,int& base,int& be){
	//cout << "inexpr " << s[base][be] << endl;
	int ret=term(top,bottom,base,be);
	while(true){
		if(s[base][be+1]=='+'){
			be+=3;
			ret+=term(top,bottom,base,be);
			ret%=mod;
		}else if(s[base][be+1]=='-'){
			show(base);
			show(be);
			be+=3;
			ret-=term(top,bottom,base,be);
			ret=(ret+mod)%mod;
		}else break;
	}
	return ret;
}
int main(){
	rep1(i,2010) calcinv(i);
	while(true){
		cin>>n;
		if(n==0) break;
		rep(i,n){
			cin>>s[i];
			s[i]+="$$";
		}
		int top=0,bottom=n-1,base,be=0;
		for(int i=top;i<=bottom;i++) if(s[i][be]!='.') base=i;
		cout << expr(top,bottom,base,be) << endl;
	}
}

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

#define INF 2147483647
#define LINF 9223372036854775807
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(), (v).end()

typedef long long ll;
typedef pair<ll, int> P;

int n,cnt=1;

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

	cin>>n;
	REP(i,n) {
		int a; cin>>a;
		if(a%2==1) {
			cnt*=1;
		}
		else cnt*=2;
	}
	int fct=1;
	REP(i,n) fct*=3;
	cout<<fct-cnt<<endl;

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
bitset<10010> ok[2010];
pair<int,int> p[2][10010];
char s[2010][10010],ans[1000010];
int len[2010],n,k,cnt=0,ncnt=0;
int main()
{
    scanf("%d%d",&n,&k);
    for (int i=1;i<=n;i++) scanf("%s",s[i]+1),len[i]=strlen(s[i]+1);
    ok[n+1][0]=1;
    for (int i=n;i>=1;i--)
        ok[i]=ok[i+1]|(ok[i+1]<<len[i]);//01背包处理可以拼成的长度
    for (int i=1;i<=n;i++)
        if (ok[i+1][k-len[i]]) p[0][++cnt]=make_pair(i,1);//加入，使用滚动数组
    int f=0;
    for (int i=1;i<=k;i++)
    {
        char mi='z';
        for (int j=1;j<=cnt;j++) mi=min(mi,s[p[f][j].first][p[f][j].second]);//贪心选择最小字符
        ans[i]=mi;
        int mx=n+1;//初始化为大值
        ncnt=0;
        for (int j=1;j<=cnt;j++)
        {
            int id=p[f][j].first,pos=p[f][j].second;
            if (s[id][pos]!=mi) continue;
            if (pos==len[id]) mx=min(mx,id);//当前字符串结束，可以选择当前字符串后面的所以字符串
            else p[f^1][++ncnt]=make_pair(id,pos+1);//继续使用这个字符串
        }
        for (int j=mx+1;j<=n;j++)
            if (k-len[j]-i>=0&&ok[j+1][k-len[j]-i]) p[f^1][++ncnt]=make_pair(j,1);//判断是否可以用该字符串
        f^=1;//
        cnt=ncnt;//
    }
    printf("%s\n",ans+1);
}

Measured memory_bytes: 15096
#include <iostream>


using namespace std;


using ll = long long;


int main()
{
    ll ans = 0;
    ll N;
    cin >> N;

    for (ll i = 0; i < N; i++) {
        ll tmp;
        cin >> tmp;
        while (tmp % 2 == 0) {
            ans++;
            tmp /= 2;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define rrep(i,n) for(int i=1;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define maxs(a, b) a = max(a, b)
#define mins(a, b) a = min(a, b)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const ll linf = (1ll << 61);
const int inf = 1001001001;
const int mod = 1000000007;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n, m;
	cin >> n >> m;
	vector<vector<int>> g(n);
	vector<P> rec(m);
	rep(i, m) {
		int a, b;
		cin >> a >> b;
		a--;
		g[a].push_back(b);
		rec[i] = P(a, b);
	}
	map<P, string> mp;
	auto make_number = [&](int a, int b) {
		string ret;
		a++;
		while (b) ret += to_string(b % 10), b /= 10;
		while (ret.size() < 6) ret += '0';
		while (a) ret += to_string(a % 10), a /= 10;
		while (ret.size() < 12) ret += '0';
		reverse(ret.begin(), ret.end());
		return ret;
	};
	rep(i, n) {
		if (g[i].size() == 0) continue;
		sort(g[i].begin(), g[i].end());
		int num = 1;
		for (int c : g[i]) {
			mp[P(i, c)] = make_number(i, num);
			num++;
		}
	}
	rep(i, m) {
		cout << mp[rec[i]] << endl;
	}
	return 0;
}

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

#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a, 0, sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define SIZE(array) (sizeof(array) / sizeof(array[0]))

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

#define MAX_V 100000

#define MOD 1000000007L
#define INF 2147483647

signed main() {
	int N, K, X, Y;
	cin >> N >> K >> X >> Y;
	if (N <= K) {
		cout << N * X << endl;
	} else {
		cout << K * X + (N - K) * Y << endl;
	}
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,m,a[15],s,c;
int main()
{
  cin>>n>>m;
  while(m--){
    cin>>s>>c;
    if(s==1 && c==0 && n!=1){
        cout<<-1;
        return 0;
    }
    if(!a[s-1]) a[s-1]=c;
    else if(a[s-1]!=c){
        cout<<-1;
        return 0;
    }
    
  }
  if(!a[0] && n!=1) a[0]=1;
  for(int i=0;i<n;i++)
    cout<<a[i];
}

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

typedef long long ll;
const ll MOD = 1e9 + 7;

int main() {
  int N;
  cin >> N;
  string s[2];
  for (int i = 0; i < 2; i++) cin >> s[i];

  ll ans = 1;
  int cnt_w = 0, cnt_h = 0;
  for (int i = 0; i < N; i++) {
    if (s[0][i] == s[0][i+1]) {
      if (cnt_w == 0 && cnt_h == 0) {
        ans *= 6;
      } else if (cnt_w == 0) {
        cnt_h = 0;
        ans *= 2;
      } else {
        ans *= 3;
      }
      cnt_w++;
      i++;
    } else if (s[0][i] == s[1][i]) {
      if (cnt_h == 0 && cnt_w == 0) {
        ans *= 3;
      } else if (cnt_h == 0) {
        cnt_w = 0;
        ans *= 1;
      } else {
        ans *= 2;
      }
      cnt_h++;
    }
    ans %= MOD;
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
N, K = list(map(int, input().split(" ")))
E = list(map(int, input().split(" ")))

if K == 0:
  print(sum(E))
  
else:
  E = sorted(E)
  for i in range(K):
    if len(E) == 0:
      break
    E.pop()
  print(sum(E))

Measured memory_bytes: 26024
import heapq
N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

TA = [0]
TB = [0]
na = 0
nb = 0

for i in range(N):
  n = TA[-1]+A[i]
  if n > K:
    break
  TA.append(n)
  na = i + 1
#
for i in range(M):
  n = TB[-1]+B[i]
  if n > K:
    break
  TB.append(n)
  nb = i + 1
#
a = 0
ans = 0

for b in range(nb,-1,-1):
  while TB[b]+TA[a] <= K:
    ans = max(ans,a+b)
    a += 1
    if a > na:
      a -= 1
      break
#
print(ans)

    


Measured memory_bytes: 42652
#include<stdio.h>
int main()
{
    int a,b;
    scanf("%d %d",&a,&b);
    while(a!=0 || b!=0)
    {
        if(a>b)
        {
            printf("%d %d\n",b,a);
        }
        else
        {
            printf("%d %d\n",a,b);
        }
        scanf("%d %d",&a,&b);
    }
    return 0;
}



Measured memory_bytes: 2028
from collections import deque
from heapq import heapify,heappop,heappush,heappushpop
from copy import copy,deepcopy
from itertools import product,permutations,combinations,combinations_with_replacement
from collections import defaultdict,Counter
from bisect import bisect_left,bisect_right
# from math import gcd,ceil,floor,factorial
# from fractions import gcd
from functools import reduce
from pprint import pprint

INF = float("inf")

def myinput():
    return map(int,input().split())

def mylistinput(n):
    return [ list(myinput()) for _ in range(n) ]

def mycol(data,col):
    return [ row[col] for row in data ]

def mysort(data,col,reverse_flag):
    data.sort(key=lambda x:x[col],reverse=reverse_flag)
    return data

def mymax(data):
    M = -1*float("inf")
    for i in range(len(data)):
        m = max(data[i])
        M = max(M,m)
    return M

def mymin(data):
    m = float("inf")
    for i in range(len(data)):
        M = min(data[i])
        m = min(m,M)
    return m

def mycount(ls,x):
    # lsはソート済みであること
    l = bisect_left(ls,x)
    r = bisect_right(ls,x)
    return (r-l)

def myoutput(ls,space=True):
    if space:
        if len(ls)==0:
            print(" ")
        elif type(ls[0])==str:
            print(" ".join(ls))
        elif type(ls[0])==int:
            print(" ".join(map(str,ls)))
        else:
            print("Output Error")
    else:
        if len(ls)==0:
            print("")
        elif type(ls[0])==str:
            print("".join(ls))
        elif type(ls[0])==int:
            print("".join(map(str,ls)))
        else:
            print("Output Error")

n = int(input())

print(0)
s = input()
m = s[0]
if m=="V":
    exit()
else:
    b = m
print(n-1)
s = input()
m = s[0]
if m=="V":
    exit()

for i in range(20):
    if i==0:
        r = 0
        l = n - 1
        q = (r+l)//2
    else:
        q = (r+l)//2
    print(q)
    s = input()
    m = s[0]
    if m=="V":
        exit()
    else:
        if m==b and (q-r+1)%2==1:
            r = q
        elif m==b and (q-r+1)%2==0:
            l = q
        elif m!=b and (q-r+1)%2==1:
            l = q
        elif m!=b and (q-r+1)%2==0:
            r = q
            b = m
        else:
            print("E")
print("End")

Measured memory_bytes: 38852
#include<bits/stdc++.h>
#include<iomanip>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long ll;
// typedef long  l;
typedef pair<int,int> P;
const ll INF=100000000000000001;
const double PI=3.141592653589;

int l[8];
int L[3];
int ans=1000000009;

void dfs(int a,int b, int c,int index,int n,int cost){
  if(index==n){
    if(a!=0&&b!=0&&c!=0){
      // cout<<"cost "<<cost<<endl;
      // cout<<a<<" "<<b<<" "<<c<<endl;
      cost+=abs(L[0]-a)+abs(L[1]-b)+abs(L[2]-c);
      ans=min(ans,cost);
    }
  }else{
    // cout<<"index "<<index<<endl<<a<<" "<<b<<" "<<c<<endl;
    if(a!=0)
    dfs(a+l[index],b,c,index+1,n,cost+10);
    else
    dfs(a+l[index],b,c,index+1,n,cost);
    if(b!=0)
    dfs(a,b+l[index],c,index+1,n,cost+10);
    else
    dfs(a,b+l[index],c,index+1,n,cost);
    if(c!=0)
    dfs(a,b,c+l[index],index+1,n,cost+10);
    else
    dfs(a,b,c+l[index],index+1,n,cost);
    dfs(a,b,c,index+1,n,cost);
  }
}

int main(){
  int n,a,b,c; cin>>n>>a>>b>>c;
  rep(i,n) cin>>l[i];
  L[0]=a; L[1]=b; L[2]=c;
  // int aa=abs(0-b);
  // cout<<-b<<" "<<aa<<endl;
  dfs(0,0,0,0,n,0);
  cout<<ans<<endl;

  return 0;
}


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

void Main()
{
    int h, w;
    cin >> h >> w;
    vector<string> s(h*w);
    int path = 0;
    for (int i = 0; i < h; i++)
    {
        cin >> s[i];
    }
    vector<vector<int>> d(h*w, vector<int>(h*w, 10000000));
    for (int i = 0; i < h*w; i++)
    {
        for (int j = 0; j < h*w; j++)
        {
            if((s[i/w][i%w] == '.' && s[j/w][j%w] == '.') &&
                ((abs(i%w-j%w)<=1 && i/w-j/w==0) || 
                (i%w-j%w==0 && abs(i/w-j/w)<=1))) d[i][j] = 1;
        }
        if(s[i/w][i%w] == '.') d[i][i] = 0;
    }

    for (int k = 0; k < h*w; k++)
    {
        for (int i = 0; i < h*w; i++)
        {
            for (int j = 0; j < h*w; j++)
            {
                d[i][j] = min(d[i][j], d[i][k]+d[k][j]);
            }
        }
    }
    
    int maxl = 0;
    for (int i = 0; i < h*w; i++) {
        for (int j = 0; j < h*w; j++)
        {
            if(d[i][j] != 10000000) {
                maxl = max(maxl, d[i][j]);
            }
        }
    }
 
    
    cout << maxl << endl;
}

int main(int argc, char **argv)
{
    ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    Main();
    return 0;
}


Measured memory_bytes: 3984
#include <iostream>
#include <bitset>
using namespace std;
int n, a, s, i;
bitset<4000000> bs;
int main()
{
    bs[0] = 1;
    cin>>n;
    while(n--)
    {
        cin>>a;
        bs|=(bs<<a);
      //for(int j=0; j<bs.size(); j++)
     //{
     //     cout<<bs[j];
     //}
     //cout<<endl;
       s+=a;
    }
    for(i=(s+1)/2; !bs[i]; i++);
    cout<<i;
    return 0;
}

Measured memory_bytes: 1664
fun main(args: Array<String>) {
    val arr = readLine()!!.split(" ").map { s->s.toInt() }
    val n = arr[0]
    val m = arr[1]
    val unionFind = UnionFind(n)
 
    val bridges = Array(m) {
        readLine()!!.split(" ").map { s->s.toInt()-1 }
    }
    val count:Long = n.toLong()*(n-1)/2
    val result = Array(m){ count }
    for(i in 1 until m){
        val bridge = bridges[m-i]
        if(!unionFind.same(bridge[0],bridge[1])){
            result[i]=result[i-1]-unionFind.size(bridge[0])*unionFind.size(bridge[1])
            unionFind.unite(bridge[0],bridge[1])
        }else{
            result[i]=result[i-1]
        }
    }
    result.reverse()
    result.forEach { println(it) }
}
 
class UnionFind(size:Int){
    private val parents: Array<Int?> =  arrayOfNulls(size)
    private val sizes: Array<Int> =  Array(size) {1}

    /**
     * Returns the root node of `node`.
     */
    fun root(node: Int):Int{
        return parents[node]?.let{
            parents[node]=root(it)
            parents[node]
        }?: node
    }

    /**
     * Unites two groups that contain node `u` and `v`.
     */
    fun unite(u:Int,v:Int){
        var ur = root(u)
        var vr = root(v)
        if(sizes[ur]>sizes[vr]){
            ur = vr .apply{vr=ur}
        }
        parents[ur] = vr
        sizes[vr] += sizes[ur]
    }

    /**
     * Returns if node `u` and `v` are in the same group.
     */
    fun same(u:Int,v:Int):Boolean = root(u)==root(v)

    /**
     * Returns the size of the group which contains node `u`.
     */
    fun size(u:Int):Int = sizes[root(u)]
}

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

class Procon
{
    public Procon() { }
    static void Main(string[] agrs)
    {
        new Procon().Do();
    }

    Scanner cin;

    public void Do()
    {
        cin = new Scanner();

        int N = cin.nextInt();
        int W = cin.nextInt();

        long[] w = new long[N];
        long[] v = new long[N];

        for (int i = 0; i < N; i++)
        {
            w[i] = cin.nextLong();
            v[i] = cin.nextLong();
        }

        long[] DP = new long[W + 1];

        for (int i = 0; i < N; i++)
        {
            for (int j = W; j >= 0; j--)
            {
                if (j + w[i] <= W)
                {
                    DP[j + w[i]] = Math.Max(DP[j + w[i]], DP[j] + v[i]);
                }
            }
        }

        long ans = 0;
        for (int i = 0; i <= W; i++)
        {
            ans = Math.Max(ans, DP[i]);
        }

        Console.WriteLine(ans);
    }
}

class Scanner
{
    string[] s;
    int i;
    int max_i;

    public Scanner()
    {
        s = new string[0];
        max_i = 0;
        i = 0;
    }

    public string nextString()
    {
        if (i >= s.Length)
        {
            s = Console.ReadLine().Split(' ');
            max_i = s.Length;
            i = 0;
            if (max_i == 0)
            {
                return "";
            }
            return s[i++];
        }
        else
        {
            return s[i++];
        }
    }

    public int nextInt()
    {
        return int.Parse(nextString());
    }


    public long nextLong()
    {
        return long.Parse(nextString());
    }

    public double nextDouble()
    {
        return double.Parse(nextString());
    }

    public string[] arrayString()
    {
        return Console.ReadLine().Split(' ');
    }

    public int[] arrayInt()
    {
        string[] str = Console.ReadLine().Split(' ');
        int[] array = new int[str.Length];
        for (int i = 0; i < str.Length; i++)
        {
            array[i] = int.Parse(str[i]);
        }
        return array;
    }

    public long[] arrayLong()
    {
        string[] str = Console.ReadLine().Split(' ');
        long[] array = new long[str.Length];
        for (int i = 0; i < str.Length; i++)
        {
            array[i] = long.Parse(str[i]);
        }
        return array;
    }

    public double[] arrayDouble()
    {
        string[] str = Console.ReadLine().Split(' ');
        double[] array = new double[str.Length];
        for (int i = 0; i < str.Length; i++)
        {
            array[i] = double.Parse(str[i]);
        }
        return array;
    }
}



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

#define rep(i,m,n) for(int (i)=(int)(m);i<(int)(n);++i)
#define rep2(i,m,n) for(int (i)=(int)(n)-1;i>=(int)(m);--i)
#define REP(i,n) rep(i,0,n)
#define REP2(i,n) rep2(i,0,n)
#define FOR(i,c) for(decltype((c).begin())i=(c).begin();i!=(c).end();++i)
#define all(hoge) (hoge).begin(),(hoge).end()
#define en '\n'
using ll = long long;
using ull = unsigned long long;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;
typedef pair<ll, ll> P;
constexpr long long INF = 1LL << 60;
constexpr int INF_INT = 1 << 25;
constexpr long long MOD = (ll) 1e9 + 7;
//constexpr long long MOD = 998244353LL;
using ld=long double;
static const ld pi = 3.141592653589793L;
typedef vector<ll> Array;
typedef vector<Array> Matrix;


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

struct Edge {
	ll to, cap, rev;
	Edge(ll _to, ll _cap, ll _rev) {
	to = _to; cap = _cap; rev = _rev;
	}
};
using Edges = vector<Edge>;
using Graph = vector<Edges>;

void add_edge(Graph& G, ll from, ll to, ll cap, bool revFlag, ll revCap) {
	G[from].push_back(Edge(to, cap, (ll)G[to].size()));
	if (revFlag)G[to].push_back(Edge(from, revCap, (ll)G[from].size() - 1));
}

void solve(){
    ll a,b,c;
    cin>>a>>b>>c;
    ll ans=INF;
    if(a%2==0 or b%2==0 or c%2==0) ans=0;
    ans=min({ans,a*b,b*c,c*a});
    cout<<ans<<en;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
	
	solve();
	//ll t;cin>>t;REP(i,t) solve();

    return 0;
}

Measured memory_bytes: 256
import Control.Applicative
import Control.Monad
import Control.Monad.ST
import Data.Functor
import Data.Function
import Data.Monoid
import Data.Maybe
import Data.List
import Data.Foldable (foldMap)
import Data.List.Split
import Data.Bits
import Data.Char
import Data.Ix
import Data.Ratio
import Data.Ord
import Data.Tuple
import Data.Array
import Data.Array.IO
import Data.Array.ST
import Data.IORef
import Data.STRef
 
readInt = read :: String -> Int
readDouble = read :: String -> Double
getInt = readLn :: IO Int
getInts = map readInt . words <$> getLine
getDouble = readLn :: IO Double
sjoin :: (Show a) => [a] -> String
sjoin = unwords . map show
cond :: a -> a -> Bool -> a
cond t f c = if c then t else f
apply2 :: (a -> a -> b) -> [a] -> b
apply2 f [x,y] = f x y
apply3 :: (a -> a -> a -> b) -> [a] -> b
apply3 f [x,y,z] = f x y z
fnBin :: (b -> c -> d) -> (a -> b) -> (a -> c) -> a -> d
fnBin op f g x = op (f x) $ g x
fnTuple :: (a -> b, a -> c) -> a -> (b, c)
fnTuple (f,g) a = (f a, g a)
replace :: (Eq a) => a -> a -> [a] -> [a]
replace x y = map (\z -> if z==x then y else z)
modifyArray :: (Ix i, MArray a e m) => a i e -> i -> (e -> e) -> m ()
modifyArray arr ix f = readArray arr ix >>= writeArray arr ix . f
-- end of templete

wf :: IOUArray (Int,Int) Int -> [Int] -> IO ()
wf arr range = do
    forM_ range $ \k -> do
        forM_ range $ \i -> do
            forM_ range $ \j -> do
                t <- readArray arr (i, j)
                u <- readArray arr (i, k)
                v <- readArray arr (k, j)
                when (u/=(-1) && v/=(-1)) $ do
                    let w = u + v in when (t==(-1) || w<t) $ writeArray arr (i, j) w
                    return ()

main = do
    n <- getInt
    arr <- newArray ((1,1),(n,n)) (-1) :: IO (IOUArray (Int,Int) Int)
    replicateM_ n $ do
        (r:k:ts) <- getInts
        writeArray arr (r,r) 0
        forM_ ts $ \t -> writeArray arr (r,t) 1
    wf arr [1..n]
    p <- getInt
    replicateM_ p $ do
        [s, d, v] <- getInts
        x <- (+1) <$> readArray arr (s, d)
        putStrLn $ cond (show x) "NA" $ v>=x && x/=0

Measured memory_bytes: 5580
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		// 整数の入力
		int n = sc.nextInt();

		int count = 0;
		int max = 0;

		for(int i=0;i<n;i++){
			int h = sc.nextInt();
			if(h>=max){
				count++;
				max=h;
			}
		}

		// 出力
		System.out.println(count);
	}
}

Measured memory_bytes: 23636
#include <iostream>
#include <algorithm>
#include <queue>
#include <stack>
#include <deque>
#include <climits>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
//#include <tuple>

#define INF INT_MAX>>1 
#define SIZE 100010
#define MOD 1000000007
#define rep(i, n) for(int i=0; i<(int)(n); i++)
#define rep2(i, a, b) for(int i=(a); i<(int)(b); i++)

typedef long long ll;

using namespace std;

struct Point { int x, y; };
struct Edge { int to, cost; };
struct Node { int from, to, cost; };

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

int gcd(int a, int b){ return a % b == 0 ? b : gcd(b, a%b); }
int lcm(int a, int b){ return a * b/ gcd(a, b); }
int extgcd(int a, int b, int& x, int& y){
	int d = a;
	if(b != 0){
		d = extgcd(b, a%b, y, x);
		y -= (a/b) * x;
	} else{
		x = 1; y = 0;
	}
	return d;
}

int main(void){
	int n; cin >> n;
	vector<int> h(n);
	rep(i, n) cin >> h[i];
	bool flag = false;
	for(int i=n-2; i>=0; i--){
		if(h[i] > h[i+1]){
			if(flag){
				cout << "No" << endl;
				return 0;
			} else{
				h[i]--;
				if(h[i] > h[i+1]){
					cout << "No" << endl;
					flag = true;
					return 0;
				}
			}
		}
	}
	cout << "Yes" << endl;
	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define int                     long long int
#define ld                      long double
#define pb                      push_back
#define MOD                     1000000007
#define inf                     3e18
#define vi                      vector<int>
#define vld                     vector<ld>
#define pii                     pair<int,int>
#define mii                     map<int,int>
#define fi                      first
#define se                      second
#define fastIO                  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define db(...)                 __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) { cerr << " "<< name << " : " << arg1 <<'\n'; }
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
    const char* comma = strchr(names + 1, ',');
    cerr.write(names, comma - names) << " : " << arg1 << " | "; __f(comma + 1, args...);
}

void inp_out()
{
	#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	freopen("debug.txt", "w", stderr);
	#endif
}

int dpx[8]={1,1,1,-1,-1,-1,0,0};
int dpy[8]={-1,1,0,1,-1,0,-1,1};

int32_t main()
{
	fastIO
	inp_out();
	int n, m, k; 
	cin >> n >> m >> k;

	vector < string >  a(n); 

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

	int rg1 = pow(2, n); 
	int rg2 = pow(2, m);
	int ans = 0; 
	for(int i = 0; i < rg1;  ++ i)
	{
		for(int j = 0; j < rg2;  ++ j)
		{
			int cnt = 0; 
			for(int k = 0; k < n;  ++ k)
			{
				for(int l = 0; l < m;  ++ l)
				{
					if( (!((i  >>  k) & 1))  && (!((j  >>  l) & 1)))
					{
						if(a[k][l] == '#')
							 ++ cnt; 
					}

				}
			}

			ans += (cnt == k); 

		}
	}  

	cout << ans; 


	return 0;
}

Measured memory_bytes: 4056
//#include <bits/stdc++.h>
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
//#include "boost/multiprecision/cpp_int.hpp"
//typedef boost::multiprecision::cpp_int LL;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
typedef pair<dd,dd> d_d;
ll inf=(ll)1E16;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define fi first
#define se second
#define endl "\n"
#define SORT(v) sort(v.begin(),v.end())
#define ERASE(v) v.erase(unique(v.begin(),v.end()),v.end())
#define POSL(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define POSU(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}
template<class T>
inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}

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


int main(){fastio
    ll a,b,n;cin>>a>>b>>n;
    ll ans=0;
    if(b>n){
        cout<<a*n/b<<endl;
        return 0;
    }else if(b<=1000000){
        rep(x,0,b){
            chmax(ans,a*x/b-a*(x/b));
        }
    }else{
        ll x=b-1;
        chmax(ans,a*x/b-a*(x/b));
    }
    cout<<ans<<endl;
    
    return 0;
}



Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define sz(x) int(x.size())
#define all(x) (x).begin(), (x).end()
#define INF 1e9;
typedef long long ll;
typedef pair<int, int> P;

int main() {
    int m, d;
    cin >> m >> d;

    if (d < 22) {
        cout << 0 << endl;
        return 0;
    }

    int ans = 0;

    for (int i=1; i<=m; i++) {
        for (int j=22; j<=d; j++) {
            int b = j%10;
            int a = (j - b)/10;
            if (b <= 1) continue;
            if (i == a*b) ans++;
        }
    }

    cout << ans << endl;
    
}

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

int main() {
    int n,m;
    int** v1;
    int* v2;

    cin >> n >> m;
    v1 = new int*[n];
    v2 = new int[m];

    for(int i=0;i<n;i++)
    {
        v1[i] = new int[m];
        for(int j=0;j<m;j++)
            cin >> v1[i][j];
    }

    for(int i=0;i<m;i++)
        cin >> v2[i];

    for(int i=0;i<n;i++) {
        int sum = 0;
        for(int j=0;j<m;j++) {
            sum += v1[i][j] * v2[j];
        }
        cout << sum << endl;
    }

    for(int i=0;i<n;i++)
        delete [] v1[i];

    delete [] v1;
    delete [] v2;

    return 0;
}

Measured memory_bytes: 3132
// When you are hungry for something and you're determined and you're focused 
// and you're committed to something it's hard to surrender, isn't it?

#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(), (x).end()
#define endl "\n"
#define ll long long 
#define int ll
#define mod 1000000007
#define mod1 1000000006
#define modi 998244353
#define setbit(x) __builtin_popcount(x)
#define fff(i,n) for(int i=0;i<n;i++)
#define ff first
#define ss second
#define pb push_back
vector<ll> vi[300005];
int color[100005];
ll pa[500005];
ll si[500005];
#define pb push_back
bool visi[1000005]={false};
bool is[100005];
ll fac[10000001];
ll prime[400005];
ll bit[100005];
const long double eps = 1.0e-14;      // allowable error
#define fio ios_base::sync_with_stdio(false); cin.tie(NULL);
 
 
void fact(){
    fac[0]=1;
    for(int i=1;i<=10000000;i++){
        fac[i]=(fac[i-1]*i)%mod;
    }
    return ;
}
void sieve(){
    prime[0]=0;
    prime[1]=0;
    for(int i=2;i<400005;i++){
        prime[i]=1;
    }
    for(int i=2;i*i<400005;i++){
        if(prime[i]==1){
            for(int j=i*i;j<400005;j+=i){
                prime[j]=0;
            }
        }
    }
    
}
 
ll power(ll n , ll p ){
    if(p==0)
        return 1;
    
    ll res = power((n*n)%mod,p/2);
    if(p%2==1)
        res = (n*res)%mod;
    
    return res;
}
 
 
void upd(ll i,ll val,ll n) {
    for(;i<=n;i+=i&(-i))
        bit[i]+=val;
}
 
ll qry(ll i) {
    ll sum=0;
    for(;i>0;i-=i&(-i))
        sum+=bit[i];
    return sum;
}
 
 
ll fin(ll u) {
    if(pa[u]==u)
        return u;
    return fin(pa[u]);
}
 
void uni(ll u,ll v) {
    ll p1=fin(u);
    ll p2=fin(v);
    if(p1==p2)
        return;
    if(si[p1]<si[p2])
        swap(p1,p2);
    si[p1]+=si[p2];
    pa[p2]=p1;
    return;
}
 
int32_t main() {
    fio
    
    cout << fixed << setprecision(15);
    int a,b;cin >> a >> b;
    
    int x=2*b;
    if(x>=a)
    cout << 0;
    else
    cout << a-x;
    
	return 0;
    
}

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

//#pragma GCC optimize("Ofast")
//#pragma comment(linker, "/stack:200000000")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4"

#define mp make_pair
#define pb push_back
#define f first
#define s second
#define ll long long
#define int ll
#define forn(i, a, b) for(int i = (a); i <= (b); ++i)
#define forev(i, b, a) for(int i = (b); i >= (a); --i)
#define VAR(v, i) __typeof( i) v=(i)
#define forit(i, c) for(VAR(i, (c).begin()); i != (c).end(); ++i)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define file(s) freopen(s".in","r",stdin); freopen(s".out","w",stdout);
 
using namespace std;
 
const int maxn = (int)1e5+100;
//const int mod = (int)1e9 + 7;
 
#define inf mod
 
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;   
typedef vector<ll> Vll;               
typedef vector<pair<int, int> > vpii;
typedef vector<pair<ll, ll> > vpll;

int n, mod, dp[maxn],dp1[maxn];
vi g[maxn];
int todel[maxn];
void del(int v, int p = 0){
  forn(i,0,sz(g[v])-1){
    int to=g[v][i];
    if(to==p) todel[v]=i;
    else del(to,v);
  }
}
vi pref[maxn], suf[maxn];
int pos[maxn], pos1[maxn];
void dfs1(int v,int p=0){
  dp[v]=1;
  for(auto to:g[v])
    dfs1(to),dp[v]*=(dp[to]+1),dp[v]%=mod;
  int res=1,it=0;
  for(auto to:g[v]){
    res*=(dp[to]+1);
    res%=mod;
    pos[to]=it;
    pref[v].pb(res);
    it++;
  }
  reverse(all(g[v]));
  res=1,it=0;
  for(auto to:g[v]){
    res*=(dp[to]+1);
    res%=mod;
    suf[v].pb(res);
    pos1[to]=it;
    it++;
  }
}
void dfs2(int v,int p=0){
  if(!p)dp1[v]=1;
  else{
    dp1[v]=1;
    if(pos[v]) dp1[v]*=pref[p][pos[v]-1], dp1[v]%=mod;
    if(pos1[v]) dp1[v]*=suf[p][pos1[v]-1], dp1[v]%=mod;
    dp1[v]*=dp1[p];
    dp1[v]++;
    dp1[v]%=mod;
  }
  for(auto to:g[v])
    dfs2(to,v);
}
main () {
  cin>>n>>mod;
  forn(i,1,n-1){
    int u,v;
    cin>>u>>v;
    g[u].pb(v);
    g[v].pb(u);
  }
  memset(todel,-1,sizeof(todel));
  del(1);
  forn(i,1,n)
    if(todel[i]!=-1)
      g[i].erase(g[i].begin()+todel[i]);
  dfs1(1);
  dfs2(1);
  forn(i,1,n)
    cout<<(dp[i]*dp1[i])%mod<<endl;
}

Measured memory_bytes: 27648
#include<stdio.h>
    #include<stdlib.h>
     
    int main(void){
      int y, m, d;
      int i, j, k;
      
      scanf("%d/%d/%d", &y, &m, &d);
      
      if(y>2019 || (y==2019 && m>4)){
         printf("TBD\n");
         return 0;
      }
      
      printf("Heisei\n");
      return 0;
    }

Measured memory_bytes: 128
t = input()
a = input().split()
a = [int(i) for i in a]
ans = "APPROVED"
for i in range(len(a)):
  if a[i] % 2 == 0:
    if a[i] % 3 == 0 or a[i] % 5 == 0:
      continue
    else:
      ans = "DENIED"
      break
  else:
    continue
print(ans)

Measured memory_bytes: 9092