akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = a; i < (b); i++)
#define rrep(i, a, b) for (int i = a; i >= (b); i--)
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
using P = pair<int, int>;
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;
}
void hr() { cerr << "--------------" << endl; }
const int INF = 1001001001;
const int MOD = 1e9 + 7;

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

   int n;
   cin >> n;
   vector<int> a(n);
   rep(i, 0, n) { cin >> a[i]; }
   vector<int> b(n);
   rep(i, 0, n) { cin >> b[i]; }
   vector<int> c(n);
   rep(i, 0, n) { cin >> c[i]; }
   sort(a.begin(), a.end());
   sort(c.begin(), c.end());
   ll ans = 0;
   rep(i, 0, n) {
      ll l = lower_bound(a.begin(), a.end(), b[i]) - a.begin();
      ll r = c.end() - upper_bound(c.begin(), c.end(), b[i]);
      ans += l * r;
   }
   cout << ans << endl;
   return 0;
}

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

int main(){
  int m, f, r;
  while (true) {
    cin >> m >> f >> r;
    if (m==-1 && f==-1 && r==-1) break;
    if (m==-1 || f==-1) cout << 'F' << endl;
    else if (m+f>=80) cout << 'A' << endl;
    else if (m+f>=65) cout << 'B' << endl;
    else if (m+f>=50) cout << 'C' << endl;
    else if (m+f< 30) cout << 'F' << endl;
    else if (r  >=50) cout << 'C' << endl;
    else cout  << 'D' << endl;
  }
  return 0;
}

Measured memory_bytes: 3088
import math
import time
from collections import deque
from collections import defaultdict
from copy import deepcopy
import heapq

mod = 10 ** 9 + 7
t = time.time()



def iip():
    ret = [int(i) for i in input().split()]
    if len(ret) == 1:
        return ret[0]
    return ret


def main():
    N, M = iip()
    values = iip()
    if type(values) == int:
        values = [values]
    values = [-i for i in values]
    heapq.heapify(values)

    for i in range(M):
        v = heapq.heappop(values)
        v = -v
        vv = v//2
        heapq.heappush(values, -vv)

    ans = 0
    #print(values)
    for value in values:
        ans += value
    ans = ans * -1
    print(ans)



main()

Measured memory_bytes: 76520
#include<iostream>
#include<stdio.h>
#include<stdlib.h>


using namespace std;

int main()
{
char S[1000];int x=0,N,y;
cin>>N;
cout<<endl;
for(int j=0;j<N;j++)
{cin>>S[j];}
y=x;
for(int i=0;i<N;i++)
{
if(S[i]=='I')
{x+=1;}
else if(S[i]=='D')
{x-=1;}
if(x>y)
{y=x;}

}
cout<<y;
return 0;
}


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

int main()
{
  int n,d;
  cin >> n >> d;
  d=d*2+1;
  int i=1;
  while(true){
    if(d*i>=n){
      cout << i;
      return 0;
    }
    ++i;
  }
}

Measured memory_bytes: 256
from math import gcd

from math import factorial as f

from math import ceil,floor,sqrt


import bisect
import re
import heapq


from copy import deepcopy
import itertools

from sys import exit

ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))

yes = "Yes"
no = "No"

def main():
    n = input()
    for i in n:
        if i == '7':
            print(yes)
            exit()
    print(no)


main()




Measured memory_bytes: 9892
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n) ;i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define sz(x) ((int)(x).size())
using ll=long long;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define MOD  1000000007
const ll INF=1e18;
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 argc, char const *argv[]) {
  int n,d;
  cin >> n >> d;
  int x[20][20];
  int ans=0;

  rep(i,n){
    rep(j,d){
      cin >> x[i][j];
    }
  }
  for(int i=0; i<n; i++){
    for(int j=0; j<n; j++){
      if(i==j) break;
      double sum=0;
      for(int k=0; k<d; k++){
        sum+=(x[i][k]-x[j][k])*(x[i][k]-x[j][k]);
      }
      sum=sqrt(sum);
      int sumi=(int)sum;
      if(sum-sumi==0) ans++;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <vector>
#include <queue>
#include <iostream>
#include <set>
#include <map>
#include <string>
#include <algorithm>

using namespace std;

typedef long long int ll;
typedef pair<int, int> Pii;
typedef pair<int, double> Pid;
typedef pair<double, int> Pdi;
typedef pair<double, double> Pdd;
typedef pair<ll, ll> P;
typedef pair<P, ll> PP;

const ll mod = 1e9+7;
const int INF = 2e9;
const double epsilon = 1e-7;
const double PI = 3.1415926535;

set <int> s;
int main(void){
    int n, x; cin >> n >> x;
    if(x == 1 || x == 2*n-1){cout << "No" << endl; return 0;}
    cout << "Yes" << endl;
    if(x == 2*n-2){
        for(int i = 1;i <= n-1;i++)printf("%d\n", i);
        cout << x << endl; cout << x+1 << endl;
        for(int i = n;i <= x-1;i++)printf("%d\n", i);
    }else{
        int c = 0; int d = 0;
        while(true){
            c++;
            if(c == x-1)c += 4;
            d++; printf("%d\n", c); if(d == n-2)break;
        }
        cout << x+1 << endl; cout << x << endl; cout << x-1 << endl; cout << x+2 << endl;
        if(n == 3)return 0;
        c = 2*n;
        while(true){
            c--;
            if(c == x+2)c -= 4;
            d++; printf("%d\n", c); if(d == 2*n-5)break;
        }
    }
 	return 0;
}


Measured memory_bytes: 1536
s = input()
#s = '9' * 200000

mod = [1] + [0]*2018
t = 0
a = 1
n = len(s)
s = s[::-1]
for i in range(n):
    t = (t + int(s[i])*a) % 2019
    a = a * 10 % 2019
    mod[t] += 1
ans = 0
for i in range(2019):
    ans += mod[i]*(mod[i]-1)//2
print(ans)

Measured memory_bytes: 9344
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
#include<stdio.h>
#include<string.h>
#include <bitset>

using namespace std;
#define int long long

#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
#define MEM_SIZE 10000
#define DEBUG_OUT true
#define ALL(x) (x).begin(), (x).end()

template<typename T> void DEBUG(T e){if(DEBUG_OUT == false)return; std::cout << e <<" ";}
template<typename T> void DEBUG(const std::vector<T>& v){if(DEBUG_OUT == false)return;for(const auto& e : v){std::cout<< e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){if(DEBUG_OUT == false)return;for(const auto& v : vv){ DEBUG(v); } }
template<class T,class... Ts> void DEBUG(T d, Ts... e){if(DEBUG_OUT == false)return;DEBUG(d);DEBUG(e...);}
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; abort();}}
template< typename T1, typename T2 > inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 > inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }
//SOLVE

void solve (void)
{
  int N,K;
  cin>>N>>K;
  vector<int> vec (N,0);
  for (int i = 0; i < N; i++)
  {
    int X;cin>>X;
    X--;
    vec[i] = X;
  } 
  vector<int> cnt (N,0);
  int pos = 0;
  cnt[pos]++;
  vector<int> loop;
  vector<int> first;
  first.push_back(0);
  for (int i = 0; i < 2*N; i++)
  {
    pos = vec[pos];
    if(cnt[pos] == 0) first.push_back(pos);
    if(cnt[pos] == 1) loop.push_back(pos);
    if(cnt[pos] == 2)break;
    cnt[pos]++;
  }
  if(K<= first.size() -1)
  {
    cout<<first[K]+1<<endl;
  }
  else
  {
    K -= (int)first.size();
    K %= (int)(loop.size());
    cout<<loop[K]+1<<endl;
  }
  
  

  return; 
}

int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  std::cout << std::fixed;
  std::cout << std::setprecision(9);
  solve();

  return 0;
}


Measured memory_bytes: 10760
const input = require("fs").readFileSync("/dev/stdin", "utf8")
let cin = input.split(/ |\n/), cid = 0
const next = () => cin[cid++]
const nexts = (n) => cin.slice(cid, cid+=n).map(i=>parseInt(i))

const K = next()
const S = next()

if (S.length <= parseInt(K)) {
    console.log(S)
} else {
    console.log(S.slice(0, parseInt(K)) + '...')
}


Measured memory_bytes: 29644
#include<iostream>
#include<queue>
#include<string>
#include<stack>
#include<cstdio>
#include<algorithm>

using namespace std;

int main(void)
{
  stack <int> n;
  int a;

  while(scanf("%d", &a)!=EOF)
    {
      if(a==0)
	{
          cout<<n.top()<<endl;
          n.pop();
	}

      else
        n.push(a);
    }
}

Measured memory_bytes: 1212
#include<bits/stdc++.h>
#pragma GCC optimize("Ofast")

using namespace std;
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
typedef long long ll;
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REP(i,num,n) for(int i=num, i##_len=(n); i<i##_len; ++i)
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 (b<a) { a=b; return 1; } return 0; }
#define print(x) (cout << (x) << endl)
#define pb push_back
#define mp make_pair
#define sz(x) int(x.size())
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
#define fs first
#define sc second
// 多倍長
#include <boost/rational.hpp>
#include <boost/multiprecision/cpp_int.hpp>
using boost::rational;
using boost::multiprecision::cpp_int;

const int INF = 1e9;
const ll LLINF = 1e16;
const ll MOD = 1e9+7;
template<class T> inline void add(T &a, T b){a = ((a+b) % MOD + MOD) % MOD;};

template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}
 
template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}
 

// 指定した文字cが文字列に何文字入ってるか
ll stringcount(string s, char c) {
    return count(s.cbegin(), s.cend(), c);
}


// 割り算の切り上げ処理
template<typename T>
T rp(T a, T b) {
  return (a + b - 1) / b;
}

// 桁和
template<typename T>
T digsum(T n) {
    T res = 0;
    while(n > 0) {
        res += n%10;
        n /= 10;
    }
    return res;
}

// 回文判定
bool kai (string s) {
    string t{s};
    reverse(begin(t), end(t));
    return s == t;
}

using pint = pair<int, int>;
using pll = pair<ll, ll>;

bool dp[10100000];

int main(void)
{
    cout.tie(0);
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    int x;
    cin >> x;
    dp[100] = true;
    dp[101] = true;
    dp[102] = true;
    dp[103] = true;
    dp[104] = true;
    dp[105] = true;
    REP(i, 100, x + 1){
      if(!dp[i + 100]) dp[i + 100] = dp[i];
      if(!dp[i + 101]) dp[i + 101] = dp[i];
      if(!dp[i + 102]) dp[i + 102] = dp[i];
      if(!dp[i + 103]) dp[i + 103] = dp[i];
      if(!dp[i + 104]) dp[i + 104] = dp[i];
      if(!dp[i + 105]) dp[i + 105] = dp[i];
    }
    print(dp[x]);
    

}



Measured memory_bytes: 3700
#include<bits/stdc++.h>
#define pa pair<int,int>
#define maxn 100005
using namespace std;
priority_queue<pa>q;
vector<int>v[maxn];
int A,B,a[maxn];
bool used[maxn],has[maxn];
int main(){
    int n;scanf("%d",&n);for(int i=1;i<n;i++){
        scanf("%d%d",&A,&B);
        v[A].push_back(B);
        v[B].push_back(A);}
    int k;scanf("%d",&k);for(int i=0;i<k;i++){
        scanf("%d%d",&A,&B);
        a[A]=B;has[A]=1;q.push(pa(-B,A));}
    while(!q.empty()){
        B=-q.top().first,A=q.top().second;q.pop();
        used[A]=1;for(int i=0;i<(int)v[A].size();i++)
        if(!used[v[A][i]]&&has[v[A][i]]&&a[v[A][i]]!=B+1){puts("No");return 0;}
        else if(!used[v[A][i]]) used[v[A][i]]=1,a[v[A][i]]=B+1,q.push(pa(-B-1,v[A][i])),has[v[A][i]]=1;}
    puts("Yes");
    for(int i=1;i<=n;i++)printf("%d\n",a[i]);
    return 0;
}

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

using namespace std;

int main() {
	int n;
	cin >> n;
	vector<char>a(n);

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

	int count=0;

	for (int i = 0; i < n-2; i++) {
		if (a[i] == 'A' && a[i + 1] == 'B' && a[i + 2] == 'C')count++;
			
	}
	
	cout << count << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll,ll>;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep2(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
const ll INF = 1LL<<60;
const ll MOD = 1e9+7;


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n; cin>>n;
    bool b = false;
    for(int i=0; i<3; i++){
        if(n%10==7)b=true;
        n/=10;
    }
    cout<<(b?"Yes":"No");
    
    return 0;
}

Measured memory_bytes: 3636
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <cstring>
#include <map>
#include <cstdlib>
#include <bitset>
#include <assert.h>
//defines
#define f first
#define s second
#define ll long long
#define ull unsigned long long
#define mp make_pair
#define pb push_back
#define vi vector <int>
#define ld long double
#define pii pair<int, int>
//const int N = int(3e5), mod = int(1e9)  + 7; 
//functions


using namespace std;    



int main () {
#ifndef ONLINE_JUDGE
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
#endif
    int n,x;
    cin>>n>>x;
    int mn = (int)1e6+123;
    int res = 0;
    while(n--){
    	int a;
    	cin>>a;
    	mn = min(mn,a);
    	if(n>=0){
    		x-=a;
    		res++;
    	}
    }
    cout<<res + (x/mn);
return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>


using namespace std;

bool wall[11][11];

class Cbot{
private:

public:
	int x, y;
	int direc;
	string log;

	Cbot();
	int Start();

};

Cbot::Cbot(){
	x = 2;
	y = 0;
	direc = 1;
	log = "";
}

int Cbot::Start(){

	int rx[4] = { 1, 0, -1, 0 };
	int ry[4] = { 0, 1, 0, -1 };
	int fx[4] = { 0, 1, 0, -1 };
	int fy[4] = { -1, 0, 1, 0 };
	int dx[4] = { 0, 2, 0, -2 };
	int dy[4] = { -2, 0, 2, 0 };
	char logd[4] = { 'U', 'R', 'D', 'L' };

	int cnt = 0;

	while (1){

		//????????§??????
		if (wall[y + ry[direc]][x + rx[direc]] == 1){
			//????????§??????
			log += logd[direc];
			if (wall[y + fy[direc]][x + fx[direc]] == 0){
				//??????
				x += dx[direc];
				y += dy[direc];
			}
			else{
				//?????????
				if (direc == 0)direc = 3;
				else direc--;
			}
		}
		else{
			//?????????+??????
			if (direc == 3)direc = 0;
			else direc++;
			x += dx[direc];
			y += dy[direc];
		}

		//??´????????????
		if (x == 0 && y == 2 && direc == 3) break;
		if (x == 0 && y == 0 && direc == 0) break;
		if (cnt++ > 100) return 0;
	}

	return 1;
}

int main(){

	int index = 1;
	char buf;
	Cbot bot;

	for (int i = 0; i < 11; i++){
		for (int j = 0; j < 11; j++){
			wall[i][j] = 0;
		}
	}

	//??????????????????
	while (1){
		for (int i = 0; i < 4; i++){
			cin >> buf;
			wall[index][(i + 1) * 2] = buf - '0';
		}
		index++;
		if (index == 10)break;

		for (int i = 0; i < 5; i++){
			cin >> buf;
			wall[index][i * 2 + 1] = buf - '0';
		}
		index++;
	}

	bot.Start();

	cout << bot.log << endl;

	return 0;
}

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

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

typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<long long> VL;
typedef vector<vector<long long>> VVL;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef tuple<int,int,int> tpl;

#define ALL(a)  (a).begin(),(a).end()
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())
#define EXIST(m,v) (m).find((v)) != (m).end()
#define LB(a,x) lower_bound((a).begin(), (a).end(), x) - (a).begin()
#define UB(a,x) upper_bound((a).begin(), (a).end(), x) - (a).begin()

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RFOR(i,a,b) for(int i=(a)-1;i>=(b);--i)
#define RREP(i,n) RFOR(i,n,0)

#define en "\n"

constexpr double EPS = 1e-9;
constexpr double PI  = 3.1415926535897932;
constexpr int INF = 2147483647;
constexpr long long LINF = 1LL<<60;
constexpr long long MOD = 1000000007; // 998244353;

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

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

ll digit(ll x){
    ll ret = 0;
    while(x){
        ret++; x /= 10;
    }
    return ret;
}

long double S(ll x){
    long double ret = 0;
    while(x){
        ret += x%10; x /= 10;
    }
    return ret;
}

void Main(){
    ll K; cin >> K;
    ll x = 1;
    VL p(19,1); REP(i,18) p[i+1] = p[i]*10;
    REP(_,K){
        cout << x << en;
        x++;
        ll d = digit(x);
        long double mn = 1e17;
        REP(i,d){
            long double n = (x/p[i]+1)*p[i]-1;
            if(chmin(mn, n/S(n))) x = (ll)round(n);
        }
    }
    return;
}

int main(void){
    cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(0);cout<<fixed<<setprecision(15);
    int t=1; //cin>>t;
    REP(_,t) Main();
    return 0;
}

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

int main() {
	int N;
	cin >> N;
	vector<int> a(N);
	vector<int> pushed(N);
	int cnt = 0;
	int now_btn = 1;
	for (int n = 0; n < N; n++) {
		cin >> a.at(n);
	}
	for (int n = 0; n < N; n++) {
		if (now_btn == 2) {
			cout << cnt << endl;
			return 0;
		}
		pushed.at(now_btn - 1)++;
		now_btn = a.at(now_btn - 1);
		cnt++;
	}
	cout << -1 << endl;
	return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<cstdio>
#include<queue>
using namespace std;
typedef pair<int,int>P;
const int TIMES = 5;
int main(){
  int day;
  int cost[30];
  int satisfied[370][30];
  int i,j;
  priority_queue<P>pq_s[370];
  
  long long score=1000000;
  long long cost_sum=0;
  long long sub=0;
  int last[370]={0};
  
  scanf("%d",&day);
  
  for(i=1;i<=26;i++){
    scanf("%d ",&cost[i]);
    cost_sum+=cost[i];
  }
  
  for(i=1;i<=day;i++){
    for(j=1;j<=26;j++){
      scanf("%d ",&satisfied[i][j]);
      pq_s[i].push(P(satisfied[i][j],j));
    }
  }
  
  //  int array[]={0,1,17,13,14,13};
  for(i=0;i<TIMES;i++){
    
  }
  for(i=1;i<=day;i++){
    //    int contest=(i+25)%26+1;
    int contest=pq_s[i].top().second;
    printf("%d\n",contest);
    score+=satisfied[i][contest];
    sub+=cost_sum-(i-last[contest])*cost[contest];
    score-=sub;
    last[contest]=i;
  }
  //printf("%lld\n",score);
  return(0);
}

Measured memory_bytes: 3940
/*** akshaykumar99 ***/
 
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
 
using namespace std;
using namespace __gnu_pbds;
 
template<typename T> using id_set = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update> ;
  
const long long MOD = 1e9+7;
const long double PI = acos(-1);
const long long N = 1e5+1;
 
typedef long long ll;
typedef long double ld;

void test_case()
{
    ll h, w, k, i, j, jj, jjj, ans = 0;
    cin >> h >> w >> k;
    string s[h];
    vector<vector<ll>> a(h, vector<ll> (w));
    for(i = 0; i < h; i++)
    {
        cin >> s[i];
        for(j = 0; j < w; j++)
        {
            a[i][j] = (s[i][j] == '.') ? 0 : 1;
        }
    }
    ll x = pow(2,h), y = pow(2,w);
    for(i = 0; i < x; i++)
    {
        vector<vector<ll>> v = a;
        for(j = 0; j < h; j++)
        {
            if(i & (1ll << j))
            {
                for(jj = 0; jj < w; jj++)
                {
                    v[j][jj] = 2;
                }
            }
        }
        for(j = 0; j < y; j++)
        {
            vector<vector<ll>> vv = v;
            for(jj = 0; jj < w; jj++)
            {
                if(j & (1ll << jj))
                {
                    for(jjj = 0; jjj < h; jjj++)
                    {
                        vv[jjj][jj] = 2;
                    }
                }
            }
            ll tot = 0;
            for(jj = 0; jj < h; jj++)
            {
                for(jjj = 0; jjj < w; jjj++)
                {
                    if(vv[jj][jjj] == 1)
                        tot++;
                }
            }
            if(tot == k)
                ans++;
        }
    }
    cout << ans << '\n';
}
 
int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL); 
    int tc=1;
    // cin>>tc;
    while(tc--)
        test_case();
    return 0;
}

Measured memory_bytes: 4076
import sys
import itertools
# import numpy as np
import time
import math
import heapq
from collections import defaultdict
sys.setrecursionlimit(10 ** 7)
 
INF = 10 ** 9 + 7
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

# map(int, input().split())

S = input()
if "RRR" in S:
    print(3)
elif "RR" in S:
    print(2)
elif "R" in S:
    print(1)
else:
    print(0)

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

int main() {
  int W, a, b;
  cin >> W >> a >> b;
  int a_W = a + W;
  int b_W = b + W;
  if (a <= b && b <= a_W || a <= b_W && b_W <= a_W) {
    cout << 0 << endl;
  } else if (a_W < b) {
    int dif = b - a_W;
    cout << dif << endl;
  } else if (b_W < a) {
    int dif = a - b_W;
    cout << dif << endl;
  }
}

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

int calc(int a, int b) {
	if (!b)return a;
	return calc(b, a%b);
}
int main() {
	int a, b;
	while (cin >> a >> b) {
		int gcd = calc(max(a, b), min(a, b));
		a /= gcd; b /= gcd;
		cout << gcd << ' ' << gcd*a*b << endl;
	}
	return 0;
}

Measured memory_bytes: 1160
using System;
using System.Linq;

namespace AtCoder
{
    class Program2
    {

        static void Main(string[] args)
        {
            //lee una linea con numeros
            var cantidades = Console.ReadLine();
            bool es = cantidades.Contains("7");
            if (es)
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }
        }
    }
}

Measured memory_bytes: 25688
fun main(arr:Array<String>) {
    val ab = (1..2).map { readLine()!! }
    val len = ab.map { it.length }.max()!!
    var fixAB = ab.map { (0 until (len - it.length)).joinToString(""){"0"} + it }
    if(fixAB[0] > fixAB[1]) {
        println("GREATER")
    } else if(fixAB[0] < fixAB[1]) {
        println("LESS")
    } else {
        println("EQUAL")
    }
}

Measured memory_bytes: 36644
#include <bits/stdc++.h>
#define repp(i,l,r)for(long long i=(l);i<(r);i++)
#define rep(i,n) for (long long i = 0; i < (n); ++i)
#define per(i,n) for (long long i = (n); i >= 0; --i)
const int INF = 2147483647;//int max
const long long int MOD = 1000000007;
using namespace std;
using ll = long long;
using P = pair<int,int>;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
//ミョ(-ω- ?)
int main() {
    int k;
    string s;
    cin >> k >> s;
    if(s.length() > k)cout << s.substr(0,k) << "...\n";
    else cout << s << endl;
    return 0;
}

Measured memory_bytes: 3588
/// Rustで競技プログラミングの入力をスッキリ記述するマクロ
///
/// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[inline]
#[allow(dead_code)]
fn gcd(mut m: u64, mut n: u64) -> u64 {
    if m < n {
        std::mem::swap(&mut m, &mut n);
    }

    loop {
        let k = m % n;
        if k == 0 {
            return n;
        }

        m = n;
        n = k;
    }
}

#[inline]
#[allow(dead_code)]
fn lcm(m: u64, n: u64) -> u64 {
    m / gcd(m, n) * n
}

macro_rules! eprint(
    ($($arg:tt)*) => { {
        use std::io::Write;
        let r = write!(&mut ::std::io::stderr(), $($arg)*);
        r.expect("failed printing to stderr");
    } }
);

macro_rules! eprintln(
    ($($arg:tt)*) => { {
        use std::io::Write;
        let r = writeln!(&mut ::std::io::stderr(), $($arg)*);
        r.expect("failed printing to stderr");
    } }
);

macro_rules! dbg {
    ($val:expr) => {
        // Use of `match` here is intentional because it affects the lifetimes
        // of temporaries - https://stackoverflow.com/a/48732525/1063961
        match $val {
            tmp => {
                eprintln!(
                    "[{}:{}] {} = {:#?}",
                    file!(),
                    line!(),
                    stringify!($val),
                    &tmp
                );
                tmp
            }
        }
    };
}

fn main() {
    input! {
        a: i64,
        b: i64,
        c: i64,
        k: u64,
    }

    let ab = a - b;
    let answer = if k % 2 == 0 { ab } else { -ab };

    println!("{}", answer);
}


Measured memory_bytes: 4352
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using u64 = unsigned long long;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

template <class T, class U>
vector<T> make_v(U size, const T& init){ return vector<T>(static_cast<size_t>(size), init); }

template<class... Ts, class U>
auto make_v(U size, Ts... rest) { return vector<decltype(make_v(rest...))>(static_cast<size_t>(size), make_v(rest...)); }

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

template <class T, size_t I, size_t... J>
struct ArrType { using t = std::array<typename ArrType<T, J...>::t, I>; };
template <class T, std::size_t I>
struct ArrType<T, I> { using t = std::array<T, I>; };
template <class T, std::size_t N, std::size_t... M>
using Arr = typename ArrType<T, N, M...>::t;

int main() {
    int r, c, k;
    cin >> r >> c >> k;
    static Arr<ll, 3001, 3001, 4> dp;
    for (int i = 0; i < 3001; ++i) {
        for (int j = 0; j < 3001; ++j) {
            for (int l = 0; l < 4; ++l) {
                dp[i][j][l] = 0;
            }
        }
    }
    auto v = make_v(r, c, 0);
    for (int i = 0; i < k; ++i) {
        int a, b, cc;
        scanf("%d %d %d", &a, &b ,&cc);
        v[a-1][b-1] = cc;
    }
    dp[0][0][1] = v[0][0];
    for (int i = 0; i < r; ++i) {
        for (int j = 0; j < c; ++j) {
            for (int k = 0; k <= 3; ++k) {
                if(i+1 < r) {
                    chmax(dp[i+1][j][1], dp[i][j][k]+v[i+1][j]);
                    chmax(dp[i+1][j][0], dp[i][j][k]);
                }
                if(j+1 < c) {
                    if(k < 3) chmax(dp[i][j+1][k+1], dp[i][j][k]+v[i][j+1]);
                    chmax(dp[i][j+1][k], dp[i][j][k]);
                }
            }
        }
    }
    cout <<  *max_element(begin(dp[r-1][c-1]),end(dp[r-1][c-1])) << "\n";

    return 0;
}

Measured memory_bytes: 319904
#include<bits/stdc++.h>
using namespace std;
int main(){
    string s,t;cin>>s>>t;
    int len = s.length();
    bool key=false;
    for(int i=0;i<len;i++){
        char tmp=s[0];
        for(int j=0;j<len-1;j++){
            s[j]=s[j+1];
        }
        s[len-1]=tmp;
        if(s==t){
            key=true;
        }
    }
    if(key) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

Measured memory_bytes: 256
import java.util.*;

class Main {
	public static void main (String[] args) {
    	Scanner sc = new Scanner(System.in);
      	int n = sc.nextInt();
      	String s;
      
      	int c0 = 0;
      	int c1 = 0;
      	int c2 = 0;
      	int c3 = 0;
      	for (int i=0; i<n; i++) {
          s = sc.next();
          if (s.equals("AC")) {c0++;}
          else if (s.equals("WA")) {c1++;}
          else if (s.equals("TLE")) {c2++;}
          else {c3++;}
        }
      
      	System.out.println("AC" + " x " + c0);
      	System.out.println("WA" + " x " + c1);
      	System.out.println("TLE" + " x " + c2);
      	System.out.println("RE" + " x " + c3);
    }
}

Measured memory_bytes: 58576
#include <algorithm>
#include <bitset>
#include <cmath>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>
#define ll long long
using namespace std;
const int MOD = 1000000007;
const long long INF = 1LL << 60;

map<ll, ll> factorize(ll num) {
  map<ll, ll> primary_map;
  for (ll i = 2; i * i <= num; i++) {
    if (num % i != 0) continue;
    ll ex = 0;
    while (num % i == 0) {
      ex++;
      num /= i;
    }
    primary_map[i] += ex;
  }
  if (num != 1) primary_map[num] += 1;
  return primary_map;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n;
  cin >> n;
  vector<ll> a(n);
  map<ll, ll> fac;
  for (ll i = 0; i < n; i++) {
    cin >> a[i];
    map<ll, ll> f = factorize(a[i]);
    auto begin = f.begin();
    auto end = f.end();
    for (auto iter = begin; iter != end; iter++) {
      fac[iter->first]++;
    }
  }
  auto begin = fac.begin();
  auto end = fac.end();
  ll flag_pair = true;
  ll all_flag = false;
  for (auto iter = begin; iter != end; iter++) {
    if (iter->second >= 2) {
      flag_pair = false;
    }
    if (iter->second >= n) {
      all_flag = true;
    }
  }
  if (flag_pair) {
    cout << "pairwise coprime" << endl;
    return 0;
  }
  if (!all_flag) {
    cout << "setwise coprime" << endl;
    return 0;
  }
  cout << "not coprime" << endl;
}

Measured memory_bytes: 15836
N=int(input())
T,A=map(int,input().split())
H=list(map(int,input().split()))
U=[]
for i in range(N):
    U.append(abs(A-(T-0.006*H[i])))
for i in range(N):
    if U[i]==min(U):
        print(i+1)
        break

Measured memory_bytes: 65116
import kotlin.comparisons.compareBy
import kotlin.comparisons.thenByDescending

fun main(args: Array<String>) {
    val N = readLine()!!.toInt()
    Array(N) { readLine()!!.split(" ").let { Pair(it[0], it[1]) } }.mapIndexed { i, p ->
        Triple(i + 1, p.first, p.second.toInt())
    }.sortedWith(compareBy<Triple<Int, String, Int>> { it.second }.thenByDescending { it.third })
        .joinToString(System.lineSeparator()) { it.first.toString() }
        .let(::println)
}

Measured memory_bytes: 36068
minv = 9
time = 0
count = 0
for i in range(5):
    p = int(input())
    if p%10 >0:
        minv = min(minv,p%10)
        q = (p//10)*10+10
        time += q
    else:
        time += p
        count+=1
time -= 10-minv
print(time+1 if count == 5 else time )

Measured memory_bytes: 3060
n = 0
A = []
q = 0
M = []
D = [[-1 for j in range(2000 + 1)] for i in range(20 + 1)]


def solve(i, m):
    # can m be formed in A[i:]?
    global n, A
    if m == 0:
        return 1
    if m < 0:
        return 0
    # m > 0 here
    if i == n:
        return 0
    # m > 0 and i < n here
    if D[i][m] != -1:
        return D[i][m]

    D[i][m] = solve(i + 1, m) or solve(i + 1, m - A[i])
    return D[i][m]


if __name__ == '__main__':
    n = int(raw_input())
    A = map(int, raw_input().split())
    q = int(raw_input())
    M = map(int, raw_input().split())
    for m in M:
        if solve(0, m):
            print "yes"
        else:
            print "no"


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

int findSumOfDigits(int n)
{
    int sum = 0;
    while (n > 0)
    {
        sum += n % 10;
        n /= 10;
    }
    return sum;
}

int lcm(ll a, ll b)
{
    return a * b / __gcd(a, b);
}

vector<string> field;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

int main()
{
    int A,B;
    cin >> A >> B;
    int ans = 0;
    if(A == B){
        cout << A * 2 << endl;
    }
    else{
        ans += max(A, B);
        ans += max(A, B) - 1;
        cout << ans << endl;
    }
}

Measured memory_bytes: 256
package main

import (
	"fmt"
)


func main() {
	for i := 0; ; i++ {
		var op string
		var x, y int
		fmt.Scan(&x, &op, &y)
		if op == "?" {
			break
		}

		switch op {
		case "+":
			fmt.Println(x + y)
		case "-":
			fmt.Println(x - y)
		case "*":
			fmt.Println(x * y)
		case "/":
			fmt.Println(x / y)
		default:
			fmt.Println("no")
		}
	}
}


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

int main()
{
  int x1,x2,y1,y2;

  cin >> x1 >> y1 >> x2 >> y2;
  
  cout << x2-(y2-y1) << " " << y2+(x2-x1) << " " << x1-(y2-y1) << " " << y1+(x2-x1) << endl;

  return 0;
}

Measured memory_bytes: 256
from math import gcd

n = int(input())
a = list(map(int, input().split()))
g = a[0]
for aa in a:
    g = gcd(aa, g)
if g != 1:
    print('not coprime')
    exit()


def Eratosthenes_sieve(n):
    table = [True] * (n + 1)
    table[0] = False
    table[1] = False
    for i in range(n + 1):
        if table[i]:
            for j in range(2 * i, n + 1, i):  # 素数の倍数は非素数
                table[j] = False
    return table


primes = [i for i, p in enumerate(Eratosthenes_sieve(1000)) if p]
# print(primes)
s = set()
for aa in a:
    if aa == 1:
        continue
    if aa in s:
        print('setwise coprime')
        exit()
    for pp in primes:
        if aa < pp:
            break
        if aa % pp == 0:
            if pp in s:
                print('setwise coprime')
                exit()
            s.add(pp)
            aaa = aa // pp
            if aaa > 1000:
                if aaa in s:
                    print('setwise coprime')
                    exit()
                s.add(aaa)
    s.add(aa)
print('pairwise coprime')


Measured memory_bytes: 181436
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AOJ1_11_A
{
    class Program
    {
        static int[] _dice = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
        static void Main(string[] args)
        {
            string orders = Console.ReadLine();
            string[] order = new string[orders.Length];
            for (int i = 0; i < orders.Length; ++i)
            {
                order[i] = orders.Substring(i, 1);
            }
            for (int i = 0; i < orders.Length; ++i)
            {
                Dice.RollDice(_dice, order[i]);
            }
            Console.WriteLine(_dice[0]);
        }
    }
    class Dice
    {
        internal static void RollDice(int[] a_Dice, string order)
        {
            int tmp = a_Dice[0];
            if (order == "E")
            {
                a_Dice[0] = a_Dice[3];
                a_Dice[3] = a_Dice[5];
                a_Dice[5] = a_Dice[2];
                a_Dice[2] = tmp;
                a_Dice[1] = a_Dice[1];
                a_Dice[4] = a_Dice[4];
            }
            else if (order == "N")
            {
                a_Dice[0] = a_Dice[1];
                a_Dice[1] = a_Dice[5];
                a_Dice[5] = a_Dice[4];
                a_Dice[4] = tmp;
                a_Dice[2] = a_Dice[2];
                a_Dice[3] = a_Dice[3];
            }
            else if (order == "S")
            {
                a_Dice[0] = a_Dice[4];
                a_Dice[4] = a_Dice[5];
                a_Dice[5] = a_Dice[1];
                a_Dice[1] = tmp;
                a_Dice[2] = a_Dice[2];
                a_Dice[3] = a_Dice[3];
            }
            else
            {
                a_Dice[0] = a_Dice[2];
                a_Dice[2] = a_Dice[5];
                a_Dice[5] = a_Dice[3];
                a_Dice[3] = tmp;
                a_Dice[1] = a_Dice[1];
                a_Dice[4] = a_Dice[4];
            }
        }
    }
}


Measured memory_bytes: 18452
#include <bits/stdc++.h>
 
using namespace std ;
 
char s[ 100010 ] ;
 
int main() {
	scanf( "%s" , s + 1 ) ;
	int n = strlen( s + 1 ) ;
	for( int i = 1 ; i <= n ; i ++ ) {
		if( s[ i ] == s[ i + 2 ] ) {
			printf( "%d %d\n" , i , i + 2 ) ;
			return 0 ;
		}
		if( s[ i ] == s[ i + 1 ] ) {
			printf( "%d %d\n" , i , i + 1 ) ;
			return 0 ;
		}
	}
	puts( "-1 -1" ) ;
	return 0 ;
}

Measured memory_bytes: 384
X, K, D = map(int, input().split())
X = abs(X)
if(D * K < X):
    print(X - D * K)
else:
    N = (X + D - 1) // D
    if N % 2 == K % 2:
        print(abs(X - N * D))
    else:
        print(abs(X - (N - 1) * D))


Measured memory_bytes: 9176
#include <bits/stdc++.h>
using namespace std;
int main(){
  cin.tie(NULL);
  ios::sync_with_stdio(false);
  int a,b,c=0,d=0;
  while(true){
    cin>>a>>b;
    if(a==0 && b==0) break;
    else if(a==1 && b==1){
      cout<<"#"<<"\n";
    }
    else{
    for(int i=1;i<a+1;i++){
      for(int j=0;j<b;j++){
      if(i%2!=0){
	if(c==0){
	  cout<<"#";
	  c++;
	}
	else if(c==1){
	  cout<<".";
	  c-=c;
	}
      }
      else if(i%2==0){
	if(d==0){
	  cout<<".";
	  d++;
	}
	else if(d==1){
	  cout<<"#";
	  d-=d;
	}
      }
      
      }
      c-=c;
      d-=d;
      cout<<"\n";
    }
    
   
    }
    cout<<"\n";
  }
	      
  return 0;
}



Measured memory_bytes: 3116
n, t = gets.split.map(&:to_i)
a = gets.split.map(&:to_i)

min = a[0]
max = 0
values = []
1.upto(n - 1) do |i|
  value = a[i] - min
  values << value

  max = [max, value].max
  min = [min, a[i]].min
end

puts values.count { |x| x == max }

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

int main() {
	int d,n; cin >> d >> n;
	if(d==0) {
      if(n==100) cout << 101 << endl;
      else cout << n;
    }
	else if(d==1) {
      if(n==100) cout << 101*100 << endl;
      else cout << n*100 << endl;
    }
	else {
      if(n==100) cout << 101*10000 << endl;
      else cout << 10000*n << endl;
    }
}

Measured memory_bytes: 3548
#include<stdio.h>

int main() {
    int h1,m1,h2,m2,k;
    int time_1;
    int i;

    scanf("%d %d %d %d %d", &h1, &m1, &h2, &m2,&k);
    time_1 = (h2 - h1) * 60 + (m2 - m1);
    printf("%d\n", time_1 - k);
    return 0;
}

Measured memory_bytes: 1736
#include<iostream>

using namespace std;

int main()
{
	int Place[101][101];
	int W,H,N;
	int x,y,a;
	int ans = 0;

	cin >> W >> H >> N;

	for(int i=0;i<W+1;i++)
	{
		for(int j=0;j<H+1;j++)
		{
			Place[j][i] = 0;
		}
	}

	for(int i=0;i<N;i++)
	{
		cin >> x >> y >> a;
		if( a == 1 )
		{
			for(int i=0;i<x+1;i++)
			{
				for(int j=0;j<H+1;j++)
				{
					Place[j][i] = 1;
				}
			}
		}

		if( a == 2 )
		{
			for(int i=x+1;i<W+1;i++)
			{
				for(int j=0;j<H+1;j++)
				{
					Place[j][i] = 1;
				}
			}
		}

		if( a == 3 )
		{
			for(int i=0;i<y+1;i++)
			{
				for(int j=0;j<W+1;j++)
				{
					Place[i][j] = 1;
				}
			}
		}

		if( a == 4 )
		{
			for(int i=y+1;i<H+1;i++)
			{
				for(int j=0;j<W+1;j++)
				{
					Place[i][j] = 1;
				}
			}
		}
	}

	for(int i=1;i<H+1;i++)
	{
		for(int j=1;j<W+1;j++)
		{
			if(Place[i][j] == 0)ans++;
		}
	}

	cout << ans << endl;

	return 0;
}

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

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

    int ans=0;
    for(int i=1;i<=N;i+=2){
        int count=0;
        for(int j=1;j<=i;j++){
            if(i%j==0) count++;
        }
        if(count==8) ans++;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>

int Baseball()
{
    int num_of_runner = 0, num_of_out = 0, point = 0;
    std::string event;
    while(num_of_out != 3){
        std::cin >> event;
        if(event == "HIT"){
            if(num_of_runner == 3)
                ++point;
            else
                ++num_of_runner;
        }
        else if(event == "HOMERUN"){
            point += 1 + num_of_runner;
            num_of_runner = 0;
        }
        else
            ++num_of_out;
    }
    
    return point;
}

int main()
{
    u_int num_of_inning;
    std::cin >> num_of_inning;
    
    for(u_int i = 0; i < num_of_inning; ++i){
        std::cout << Baseball() << std::endl;
    }
    
    return 0;
}

Measured memory_bytes: 1208
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <utility>
#include <iomanip>
#include <tuple>
#include <numeric>
#include <cstdio>
#include <cmath>
#include <cstdlib>
using namespace std;
using ll = long long;
const int INF = 1e9;

int main() {
    string s, t; cin >> s >> t;
    int rtn = 0;
    for (int i = 0; i < s.size(); i++) {
       if (s[i] != t[i]) rtn++;
    }
    cout << rtn << endl;
}


Measured memory_bytes: 3464
#include <bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define EACH(i, c) for (typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define EXIST(s, e) ((s).find(e) != (s).end())
#define SORT(c) sort((c).begin(), (c).end())
#define dump(x) cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" \
                      << " " << __FILE__ << endl;
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define ll long long

using namespace std;



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

    int n;
    cin >> n;

    while (n%111 != 0){
        n++;
    }

    cout << n;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
int main() {
  string S, T;
  cin >> S >> T;
  int N = size(S);
  bool ans = true;
  for (int i = 0; i < N; i++){
    if(S[i] == T[i]){
      continue;
    }else{
      ans = false;
      break;
    }
  }
  if(ans){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 3624
use std::io::{stdin, Read};


fn main() {
    let mut buffer = String::new();
    let mut stdin = stdin();

    stdin.read_to_string(&mut buffer).unwrap();
    let rows: Vec<&str> = buffer.split('\n').collect();
    let s: String = String::from(rows[0]);

    println!("{}", s.replace("?", "D"));
}



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

public class Shain
{
    public int bango { get; set; }
    public long uriage { get; set; }
}


public class hello
{
    public static void Main()
    {
        while (true)
        {
            var n = int.Parse(Console.ReadLine().Trim());
            if (n == 0) break;
            var shains = new List<Shain>();
            for (int i = 0; i < n; i++)
            {
                string[] line = Console.ReadLine().Trim().Split(' ');
                var shainno = int.Parse(line[0]);
                long uriage = int.Parse(line[1]) * int.Parse(line[2]);
                var a1 = new Shain { bango = shainno, uriage = uriage };
                shains.Add(a1);
            }
            var count = 0;
            var groups = shains.GroupBy(b => b.bango);
            foreach (var x in groups)
            {
                var mm = x.Sum(z => z.uriage);
                if (mm >= 1000000)
                {
                    count++;
                    Console.WriteLine(x.Key);
                }
            }
            if (count == 0) Console.WriteLine("NA");

        }
    }
}

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

typedef long long ll;
typedef long double ld;

using namespace std;

void INeedIt() {
	ios_base::sync_with_stdio(0);
    cin.tie(0);		
    cout.tie(0);
}
int main() {
	INeedIt();
	int a, b;
	cin>>a>>b;
	if (a<10 && b<10) cout<<a*b;
	else cout<<"-1";
	return 0;
}

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

int main()
{
  long long n,m,i,sum=0;
  cin>>n>>m;
  long long A[m];
  for(i=0;i<m;i++)
  {
      cin>>A[i];
      sum+=A[i];
  }
  if(sum>n) cout<<"-1"<<endl;
  else cout<<n-sum<<endl;
 return 0;

}


Measured memory_bytes: 3708
package main

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

var mod = math.Pow10(9) + 7

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Scan()
	n, _ := strconv.Atoi(sc.Text())

	u := Pow(10, n, mod)

	a := Pow(9, n, mod)
	b := Pow(9, n, mod)
	c := Pow(8, n, mod)

	ans := u - a - b + c
	ans = math.Mod(ans, mod)
	ans = math.Mod(ans+mod, mod)

	fmt.Println(int(ans))
}

func Pow(x, y int, mod float64) float64 {
	var ans = float64(1)
	for i := 0; i < y; i++ {
		ans = math.Mod(ans*float64(x), mod)
	}
	return ans
}


Measured memory_bytes: 1788
def outputTable (table):
  r = len(table)
  c = len(table[0])
  for i in range(r):
    for j in range(c-1):
      print(str(table[i][j])+' ',end='')
    print(str(table[i][j+1]))


r, c = map(int, input().split())

ans_r = r+1
ans_c = c+1

table = [[0 for i in range(ans_c)] for j in range(ans_r)]
for i in range(r):
  inputRow = list(map(int,input().split()))
  for j in range(c):
    table[i][j] = inputRow[j]
  table[i][c] = sum(inputRow)

for i in range(ans_c):
  table[r][i] = sum([row[i] for row in table[:][:r]])
outputTable(table)


Measured memory_bytes: 6220
import numpy as np
import math

xyzk=input().split()
X=int(xyzk[0])
Y=int(xyzk[1])
Z=int(xyzk[2])
K=int(xyzk[3])
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
xy_size = min(3000,X*Y)
xy = np.zeros((X,Y))
for i in range(X):
    xy[i,:] += A[i]
for i in range(Y):
    xy[:,i] += B[i]
xy = np.sort(xy.reshape(-1))[::-1][:xy_size]
#print(xy)

xyz = np.zeros((xy_size,Z))
for i in range(xy_size):
    xyz[i,:] += xy[i]
for i in range(Z):
    xyz[:,i] += C[i]

xyz = np.sort(xyz.reshape(-1))[::-1][:K]
#print(xyz)
for num in xyz:
    print(int(num))

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

#define ll long long

ll x;

int main(){
	scanf("%lld", &x);
	ll l = 0, r = 1e9, ans;
	while(l <= r){
		ll m = l + r >> 1;
		if(m * (m + 1) / 2 >= x){
			ans = m;
			r = m - 1;
		}
		else{
			l = m + 1;
		}
	}
	printf("%I64d\n", ans);
	return 0;
}

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

int N;
int ans = 2147364000;
int main (){
    cin >> N;
    for(int i=0; i<N; i++){
        int a;
        int cnt = 0;
        cin >> a;
        while( a % 2 == 0) {
            a /= 2;
            cnt++;
        }
        ans = min( ans, cnt);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256