akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0,i##_max=(N);i<i##_max;++i)
#define repp(i,l,r) for(int i=(l),i##_max=(r);i<i##_max;++i)
#define per(i,N) for(int i=(N)-1;i>=0;--i)
#define perr(i,l,r) for(int i=r-1,i##_min(l);i>=i##_min;--i)
#define all(arr) (arr).begin(), (arr).end()
#define SP << " " <<
#define SPF << " "
#define SPEEDUP cin.tie(0);ios::sync_with_stdio(false);
#define MAX_I INT_MAX //1e9
#define MIN_I INT_MIN //-1e9
#define MAX_UI UINT_MAX //1e9
#define MAX_LL LLONG_MAX //1e18
#define MIN_LL LLONG_MIN //-1e18
#define MAX_ULL ULLONG_MAX //1e19
  typedef long long ll;
  typedef pair<int,int> PII;
  typedef pair<char,char> PCC;
  typedef pair<ll,ll> PLL;
  typedef pair<char,int> PCI;
  typedef pair<int,char> PIC;
  typedef pair<ll,int> PLI;
  typedef pair<int,ll> PIL; 
  typedef pair<ll,char> PLC; 
  typedef pair<char,ll> PCL; 

inline void YesNo(bool b){ cout << (b?"Yes" : "No") << endl;}
inline void YESNO(bool b){ cout << (b?"YES" : "NO") << endl;}
inline void Yay(bool b){ cout << (b?"Yay!" : ":(") << endl;}

struct tri{
  ll f,s,t;
};

int main(void){
  SPEEDUP
  cout << setprecision(15);
  int N;ll K;cin >> N >> K;
  vector<PII> v(N);
  ll b;
  b = K+2*N-1;
  int index = 0;
  if(2*K-1>N){
    cout << -1 << endl;
    return 0;
  }
  repp(x,K,K+N){
    if((x&1)==0)continue;
    v[index].first = x+b;
    v[index].second = x;
    ++index;
    --b;
  }
  repp(x,K,K+N){
    if(x&1)continue;
    v[index].first = x+b;
    v[index].second = x;
    ++index;
    --b;
  }

  sort(all(v));
  ll c = K+2*N;
  queue<tri> que;
  rep(i,N){
    que.push({v[i].second,v[i].first-v[i].second,c});
    ++c;
  }
  while(!que.empty()){
    tri t = que.front();que.pop();
    cout << t.f SP t.s SP t.t << endl;
  }
  return 0;
}


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

using namespace std;
typedef long long ll;
typedef pair<int, int> P;

//マクロ
#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REPD(i, n) for (ll i = (ll)(n)-1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define FORD(i, a, b) for (ll i = (a); i >= (b); i--)
#define ALL(x) (x).begin(), (x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size())      //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))
#define INF 1000000000000 //10^12
#define MOD 10000007      //10^9+7
#define PB push_back
#define MP make_pair
#define F first
#define S second

int main(int argc, char const *argv[])
{
    int p,q,r;
    cin >> p >> q >> r;
    int ans = min({p + q, q + r, r + p});
    cout << ans << endl;
    return 0;
}


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

a_set = set(a)

if len(a_set) == 1:
    if sum(a_set) == 0:
        print('Yes')
    else:
        print('No')
elif len(a_set) == 2:
    x, y = sorted(a_set)
    if x == 0:
        if a.count(x) * 3 == n:
            print('Yes')
        else:
            print('No')
    else:
        print('No')
elif len(a_set) == 3:
    x, y, z = a_set
    if a.count(x) == a.count(y) and a.count(y) == a.count(z):
        if x ^ y == z:
            print('Yes')
        else:
            print('No')
    else:
        print('No')
else:
    print('No')


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

#define rep(i,s,n) for (int i = (int)s; i < (int)n; i++)
#define ll long long
#define ld long double
#define pb push_back
#define eb emplace_back
#define All(x) x.begin(), x.end()
#define Range(x, i, j) x.begin() + i, x.begin() + j
#define lbidx(x, y) lower_bound(x.begin(), x.end(), y) - x.begin()
#define ubidx(x, y) upper_bound(x.begin(), x.end(), y) - x.begin()
#define llbidx(x, y, z) lower_bound(x.begin(), x.end(), z) - lower_bound(x.begin(), x.end(), y) // 二要素間の距離
#define deg2rad(deg) ((((double)deg)/((double)360)*2*M_PI))
#define rad2deg(rad) ((((double)rad)/(double)2/M_PI)*(double)360)
#define Find(set, element) set.find(element) != set.end()
#define Decimal(x) printf("%.10f\n", x) // 小数点を10桁まで表示
// debug用
#define PrintVec(x) for (auto elementPrintVec: x) { cout << elementPrintVec << " "; } cout << "\n";
#define debug(x) cerr << #x << ": " << (x) << "\n";
#define endl "\n"
// gcj print用
#define Case(x) printf("Case #%d: ", x);

typedef pair<int, int> PI;
typedef pair<ll, ll> PLL;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<vector<vector<int>>> vvvi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<vector<int>>> vvvl;
typedef vector<PI> vpi;
typedef vector<vector<PI>> vvpi;
typedef vector<vector<vector<PI>>> vvvpi;
typedef vector<PLL> vpl;
typedef vector<vector<PLL>> vvpl;
typedef vector<vector<vector<PLL>>> vvvpl;

int POWINT(int x, int n) {
  int ret = 1;
  while (n > 0) {
    if (n & 1) ret *= x;
    x *= x;
    n >>= 1;
  }
  return ret;
};

ll POWLL(ll x, int n) {
  ll ret = 1;
  while (n > 0) {
    if (n & 1) ret *= x;
    x *= x;
    n >>= 1;
  }
  return ret;
};

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

void print() {
  cout << endl;
}

template <class T>
void print(vector<T> &vec) {
  for (auto& a : vec) {
    cout << a;
    if (&a != &vec.back()) cout << " ";
  }
  cout << endl;
}

template <class T>
void print(vector<T> &vec, ll k){
   ll n = vec.size();
   k = min(k, n);
   rep(i, 0, k-1) cout << vec[i] << " ";
   cout << vec[k-1] << endl;
}

template <class T>
void print(vector<vector<T>> &df) {
  for (auto& vec : df) {
    print(vec);
  }
}

template<class T, class U>
void print(pair<T,U> &p){
  cout << p.first << " " << p.second << "\n";
}

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

  int N;
  cin >> N;
  int ans;
  rep(i, N, 1000) {
    int h = i/100;
    int t = (i%100)/10;
    int f = (i%10);
    if (h == t && t == f) {
      ans = i;
      break;
    }
  }

  cout << ans << endl;

  return 0;
};


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

void function(int board[14][14],int x,int y,int n){


	if(n == 1){
		board[x-1][y]++;
		board[x+1][y]++;
		board[x][y]++;
		board[x][y-1]++;
		board[x][y+1]++;
	}

	else if (n == 2){
		for(int i=-1;i<2;i++){
			for(int  j = -1;j<2;j++){
				board[x+i][y+j]++;
			}
		}
	}

	else{
		for(int i=-1;i<2;i++){
			for(int  j = -1;j<2;j++){
				board[x+i][y+j]++;
			}
		}
		board[x+2][y]++;
		board[x-2][y]++;
		board[x][y-2]++;
		board[x][y+2]++;
	}
}

int main(){

	int board[14][14];
	int max=0;
	int sum=0;

	for(int i=0;i<14;i++){
		for(int j=0;j<14;j++){
			board[i][j] = 0;
		}
	}

	char str[10];

	while(cin>>str){
		/*
		if(str[0]=='a'){
			break;
		}
		*/

		function(board,(int)(str[0]-'0'+2),(int)(str[2]-'0'+2),(int)(str[4]-'0'));

	}

	for(int i=2;i<12;i++){
		for(int j=2;j<12;j++){
			if(board[i][j]==0){
				sum++;
			}
			if(max<=board[i][j]){
				max = board[i][j];
			}
		}
	}
	/*
	for(int i=0;i<14;i++){
		for(int j=0;j<14;j++){
			printf("%d ",board[i][j]);
		}
		printf("\n");
	}
	*/

	cout<<sum<<endl;
	cout<<max<<endl;

	return 0;
}

Measured memory_bytes: 0
#include <cstdio>
#include <cmath>
#include <complex>
using namespace std;

typedef complex<double> Point;

#define X real()
#define Y imag()

int n;
double ans;
Point ps[1000000];

double cross(Point a, Point b) {
  return (conj(a)*b).Y;
}

int main() {
  for (n=0; ; n++) {
    double x, y;
    if (scanf("%lf,%lf", &x, &y) != 2) break;
    ps[n] = Point(x, y);
  }

  for (int i=1; i<n-1; i++) {
    ans += abs(cross(ps[i+1]-ps[0], ps[i]-ps[0]));
  }

  printf("%f\n", ans/2);
}

Measured memory_bytes: 18188
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define REP(i,n) for (ll i = 0; i < (n); ++i)
#define RREP(i, n) for (ll i = (n) - 1; i >= 0; --i)
#define ALL(v) (v).begin(), (v).end()
template<class T>
using reverse_priority_queue = priority_queue<T, vector<T>, greater<T>>;

ll popcount(ll x){
    ll ret = 0;
    while(x > 0){
        ret += x % 2;
        x /= 2;
    }
    return ret;
}


int main(){
    ll n;
    cin >> n;
    string x;
    cin >> x;
    ll num1 = 0;
    for(char c : x){ num1 += c == '1'; }

    vector<ll> f(num1 + 1, 0);
    for(ll y = 1; y <= num1; ++y){
        f.at(y) = 1 + f.at(y % popcount(y));
    }

    const ll m1 = num1 - 1;
    const ll m2 = num1 + 1;

    vector<ll> p2m1(n, 1), p2m2(n, 1);
    for(ll i = 1; i < n; ++i){
        if(m1 > 0){
            p2m1.at(i) = (2 * p2m1.at(i - 1)) % m1;
        }
        p2m2.at(i) = (2 * p2m2.at(i - 1)) % m2;
    }

    ll xm1 = 0, xm2 = 0;
    REP(i, n){
        if(x.at(n - 1 - i) == '1'){
            if(m1 > 0){
                xm1 = (xm1 + p2m1.at(i)) % m1;
            }
            xm2 = (xm2 + p2m2.at(i)) % m2;
        }
    }

    REP(i, n){
        if(x.at(i) == '1'){
            if(num1 == 1){
                cout << 0 << endl;
            }else{
                ll tmp = (xm1 - p2m1.at(n - 1 - i)) % m1;
                if(tmp < 0){
                    tmp = (tmp + m1) % m1;
                }
                cout << 1 + f.at(tmp) << endl;
            }
        }else{
            ll tmp = (xm2 + p2m2.at(n - 1 - i)) % m2;
            cout << 1 + f.at(tmp) << endl;
        }
    }
    return 0;
}


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

int main() {
    int p[4] = {};
    for (int i = 0; i < 3; i++) {
        int a, b;
        cin >> a >> b;
        a--; b--;

        p[a]++;
        p[b]++;
    }

    int b = 1;
    for (int i = 0; i < 4; i++) {
        if (p[i] > 2) b = 0;
    }

    cout << (b ? "YES" : "NO") << endl;

    return 0;
}

Measured memory_bytes: 256
while 1:
	n=int(input())
	if n==0: break
	a=[int(input()) for i in range(n)]
	temp = 0
	most = -999999999
	for i in range(n):
		temp = 0
		for j in range(i,n):
			temp +=	a[j]
			if temp > most:
				most = temp
	print(most)


Measured memory_bytes: 5716
from sys import stdin
di = {}
n = int(stdin.readline())
a = map(int,stdin.readline().split())
for i in a:
 di[i] = di.get(i,0) + 1
 di[i-1] = di.get(i-1,0) + 1
 di[i+1] = di.get(i+1,0) + 1
ans = -5
for i in di:
 if di[i] > di.get(ans,0):
  ans = i
print di[ans]

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

int n, l[1005], ans;

int main () {

cin >> n;

for (int i = 1; i <= n * 2; ++i){
    cin >> l[i];
}

sort(l, l + (2 * n) + 1);


for (int i = n * 2; i >= 2; i -= 2){
    ans += min(l[i], l[i - 1]);
}

cout << ans;

return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
#define F(i,s,e) for(int i=s;i<e;++i)

int n;
int a[20];

bool solve(int i,int m){
    if(m==0) return true;
    if(i>=n || m<0) return false;
    return solve(i+1,m) || solve(i+1,m-a[i]);
}

int main()
{
    cin >> n;
    F(i,0,n) cin >> a[i];
    int q;
    cin >> q;
    F(i,0,q){
        int m;
        cin >> m;
        if(solve(0,m)){
            cout << "yes" << endl;
        }
        else{
            cout << "no" << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 3088
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=2e5+10;
const int mod=1e9+7;
const int inf=0x3f3f3f3f;
ll n,cnt=0;
ll a[N],sum[N];
string s1,s2;
int main() {
//    freopen("../in.in", "r", stdin);
//    freopen("../out.out","w",stdout);
    ios::sync_with_stdio(false);
    ll t, i, j = 0;
    ll m, x, y,k;
    cin>>n;
    for(i=1;i<=n;i++){
        cin>>a[i];
    }
    for(i=n;i>0;i--) sum[i]=(sum[i+1]+a[i])%mod;
//    for(i=1;i<=n;i++) cout<<sum[i]<<endl;
    ll ans=0;
    for(i=1;i<n;i++){
//        cout<<a[i]<<":"<<sum[n-i]<<endl;
        ans=(ans+a[i]*sum[i+1]%mod)%mod;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 6772
from sys import stdin, stdout

INF = float('inf')
s = stdin.readline().strip()
f = stdin.readline().strip()

n, m = len(s), len(f)
dp = [[0 for i in range(m + 5)] for j in range(n + 5)]


for i in range(n):
    for j in range(m):
        if s[i] == f[j]:
            dp[i][j] = dp[i - 1][j - 1] + 1
        else:
            dp[i][j] = max(dp[i - 1][j], dp[i][j - 1])

n -= 1
m -= 1
ans = ''

while n >= 0 and m >= 0:
    if s[n] == f[m]:
        ans += s[n]
        n -= 1
        m -= 1
    elif dp[n - 1][m] > dp[n][m - 1]:
        n -= 1
    else:
        m -= 1
        
stdout.write(ans[::-1])

Measured memory_bytes: 120028
#include <bits/stdc++.h>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
#define rep(i,s,e) for (int64_t i=s; i<e; i++)
#define pi 3.14159265358979323846264338327950L
using namespace std;

int main() {
  int64_t A, B, C, X, Y, O=0;
  cin >> A >> B >> C >> X >> Y;
  vector<int64_t> P(100001);
  rep(i,0,100001) {
    P[i]=2*i*C+max((X-i),O)*A+max((Y-i),O)*B;
  }
  sort(P.begin(),P.end());
  cout << P[0] << endl;
}

Measured memory_bytes: 4028
a = input()
if a[-1] == "2" or a[-1] == "4" or a[-1] == "5" or a[-1] == "7" or a[-1] == "9":
    print('hon')
elif a[-1] == "0" or a[-1] == "1" or a[-1] == "6" or a[-1] == "8":
    print('pon')
else:
    print('bon')

Measured memory_bytes: 9060
#include<stdio.h>

int main() {
	int i,x;

	i = 1;

	//??????????????????????????¨??????Case i: x????????¢?????§??????
	while (scanf("%d", &x), x != 0) {
		printf("Case %d: %d\n", i, x);
		i++;
	}

	return 0;
}

Measured memory_bytes: 600
#include<iostream>
#include<string>
#include<iomanip>
using namespace std;
#define int long long
#define rep(i,n) for(int i = 0; i < n; i++)
#define INF (long long)(1e18)
#define MOD (int)(1e9+7)
#define MAX_N 103
#define MAX_V 10
#define MAX_M 101
#define yn(f) (f?"Yes":"No")
#define YN(f) (f?"YES":"NO")
#define pro "はいプロ　世界一○○が上手　○○界のtourist　○○時代の終焉を告げる者　実質○○　○○するために生まれてきた男"

signed main(){
	cout<<fixed<<setprecision(7);
	
	int n, k, ans=INF, temp = 1;
	
	cin>>n>>k;
	
	for(int i = 0;i <= n; i++, temp*=2){
		
		ans = min(temp+ k*(n-i), ans);
	}
	
	cout<<ans<<endl;
	
	
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl; 
#define INF 1000000000
#define mod 1000000007
typedef long long ll;
const ll LINF = 1001002003004005006ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
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; }

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    
    ll n;cin>>n;
    ll k;
    for(k=1;;k++){
        if(k*(k+1)>=2*n){
            break;
        }
    }
    vector<ll> ans;
    for(ll i=k;i>0;i--){
        if(n-i>=0){
            ans.push_back(i);
            n-=i;
        }
    }
    for(auto x:ans) cout<<x<<endl;
    return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <cassert>
#include <queue>
#include <map>
#include <set>
using namespace std;
using Int = int64_t;
const Int INF = 1<<30;
const Int MOD = (Int)1e9 + 7;
const Int MAX_N = (Int)1e5 + 5;
#define debug(x) cout << #x << ": " << x << endl
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2>& p) { os << p.first << " " << p.second; return os; }
template<typename T>
ostream &operator<<(ostream &os, const vector<T> &v) { for(int i = 0; i < (int) v.size(); i++) os << v[i] << (i + 1 != v.size() ? " " : ""); return os; }

void solve()
{
    int n; cin >> n;
    vector<int> v(n);
    int cnt = 0;
    for(int i = 0; i < n; i++)
    {
        cin >> v[i];
        if(v[i] % 2 == 0) continue;
        if((i + 1) % 2 == 0) continue;
        cnt++;
    }
    cout << cnt << endl;
}

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

Measured memory_bytes: 3652
#include<bits/stdc++.h>
using  namespace std;
typedef long long ll;
#define MOD (long long)(1e9+7)
#define _(i,a,n) for(int i=a;i<n;i++)
#define zero(a) a[0]=0
bool cmp(int x,int y)
{
    return x>y;
}
int main()
{
int n;
cin>>n;
ll ans=0;
int z,t;
cin>>z;
_(i,1,n)
{
    cin>>t;
    if(t<=z)
        ans+=z-t,t=z;
        z=t;
}
cout<<ans<<endl;
}


Measured memory_bytes: 3628
import math
a,b,x=map(int,input().split())
if x>=a*a*b/2:
  c=(-2*x/(a*a)+2*b)/a
else:
  c=(a*b*b)/(2*x)
#print(c)
asin=math.degrees(math.atan(c))
print(asin)

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

#define REP(i,num) for(int i=0;i<(num);++i)
#define LOOP(i) while(i--)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto& x:c){cout<<x<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

class UnionFind{
	vector<ll> rank;
	vector<ll> diff_weight;
	vector<ll> num;
public:
	vector<ll> par;

	UnionFind(ll N):par(N),num(N),rank(N),diff_weight(N){
		for(ll i=0;i<N;i++){
			par[i]=i;
			num[i]=1;
			rank[i]=0;
			diff_weight[i]=0;
		}
	}

	ll root(ll x){
		if(par[x]==x){
			return x;
		}
		ll r = root(par[x]);
		diff_weight[x]+=diff_weight[par[x]];
		return par[x]=r;
	}

	void unite(ll x,ll y){
		ll rx = root(x);
		ll ry = root(y);
		if (rx == ry) return;
		if(rank[rx]<rank[ry]) swap(rx,ry);
		if(rank[rx]==rank[ry]) ++rank[rx];
		par[ry] = rx;
		num[rx] += num[ry];
	}

	void relate(ll x,ll y,ll w){
		w+=weight(x),w-=weight(y);
		ll rx = root(x);
		ll ry = root(y);
		if (rx == ry) return;
		if(rank[rx]<rank[ry]){
			swap(rx,ry);
			w = -w;
		}
		if(rank[rx]==rank[ry]) ++rank[rx];
		par[ry] = rx;
		diff_weight[ry] = w;
		num[rx] += num[ry];
	}

	bool same(ll x,ll y){
		ll rx = root(x);
		ll ry = root(y);
		return rx == ry;
	}

	ll getsize(ll x){
		return num[root(x)];
	}

	ll weight(ll x){
		root(x);
		return diff_weight[x];
	}

	ll diff(ll x,ll y){
		return weight(y)-weight(x);
	}
};

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	vector<vector<int>> M(12,vector<int>(12));

	string S;
	while(cin>>S){
		REP(i,12){
			M[0][i]=S[i]-'0';
		}
		REP(i,11){
			cin>>S;
			REP(j,12){
				M[i+1][j]=S[j]-'0';
			}
		}
		UnionFind uf(144);
		REP(i,12){
			REP(j,12){
				if(M[i][j]){
					if(i>0&&M[i-1][j]){
						uf.unite(j+i*12,j+(i-1)*12);
					}
					if(j>0&&M[i][j-1]){
						uf.unite(j+i*12,j-1+i*12);
					}
				}
			}
		}
		int sum = 0;
		set<int> h;
		REP(i,144){
			h.insert(uf.root(i));
		}
		for(auto& x:h){
			int u=x%12,v=x/12;
			if(M[v][u]){
				sum++;
			}
		}
		
		out(sum);
	}
	return 0;
}


Measured memory_bytes: 3088
#include  <iostream>
#include  <algorithm>
#include  <climits>
#include  <string>

using namespace std;

#define rep(i, n) for(int i = 0; i < n; i++)
#define lrep(i, n, m) for(int i = n; i < m; i++)

typedef long long ll;
const int MAX = INT_MAX;

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

	ll sum = 0;
	lrep(i, 1, n + 1) {
		if (i % 3 != 0 && i % 5 != 0)  sum += i;
	}
	cout << sum << endl;
}


Measured memory_bytes: 3636
b = int(input());
n = b;
a = []
while n % 2 == 0:
    a.append(2)
    n //= 2
f = 3
while f * f <= n:
    if n % f == 0:
        a.append(f)
        n //= f
    else:
        f += 2
if n != 1:
    a.append(n)

print("{}:".format(b),end = '');
for i in range(0,len(a)):
    print('',a[i],end = '');
print();


Measured memory_bytes: 5600
import java.util.Scanner

object Main {
  def main(args: Array[String]): Unit = {
    val sc = new Scanner(System.in)
    val s = sc.next
    val shownStrings = scala.collection.mutable.Stack[String]()
    s.foreach(w => if (w.toString == "B"){
      if (shownStrings.nonEmpty) shownStrings.pop()
    }
    else shownStrings.push(w.toString))
    println(shownStrings.mkString.reverse)
  }
}


Measured memory_bytes: 26944
#include<bits/stdc++.h>
#define test int t; cin>>t; while(t--)
typedef long long ll;
using namespace std;
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
   char a;
   cin>>a;
   if(a>='A'&&a<='Z')
    cout<<"A"<<endl;
   else
    cout<<"a"<<endl;



 return 0;
}


Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<(n);i++)
#define rrep(i,m,n) for(ll i=(m);i<(n);i++)
#define fore(i,a) for(auto &i:a)
#define debug(a,b) cout << "debug : " << a << " , "<< b << endl
using ll=long long;
typedef pair<ll,ll> pll;
typedef vector<ll> vll;
const ll INF=1LL<<60;
const ll mod=1E9+7;


int main(){
  string s,t;
  cin >> s >> t;
  int cnt=0;
  rep(i,s.length()){
    if(s[i]!=t[i])cnt++;
  }
  cout << cnt;
}



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

// macro
#define rep(i,n) for(i=0;i<n;i++)
#define ll long long
#define all(v) v.begin(), v.end()

// code starts
#define MOD 1000000007

int main()
{
  ll n,m,k;cin>>n>>m>>k;
  vector<int> p(m);
  ll i,j,l;
  rep(i,m)cin>>p[i];
  ll num=1;
  ll needs=0;
  while(num<=k)
  {
    num*=2;
    needs++;
  }
  vector<vector<ll>> con(needs+2,vector<ll>(n,0));
  rep(i,m)
  {
    con[0][p[i]%n]++;
  }
  con[0][0]++;
  for(i=1;i<=needs+1;i++)
  {
    rep(j,n)
    {
      rep(l,n)
      {
        con[i][(j+l)%n]+=con[i-1][l]*con[i-1][j];
        con[i][(j+l)%n]%=MOD;
      }
    }
  }
  ll left=k;
  ll nowi=0;
  vector<ll> ans(n,0);
  ans[0]=1;
  vector<ll> nans(n,0);
  while(left>0)
  {
    if(left%2==1)
    {
      rep(j,n)
      {
        rep(l,n)
        {
          nans[(j+l)%n]+=con[nowi][l]*ans[j];
          nans[(j+l)%n]%=MOD;
        }
      }
      rep(j,n)
      {
        ans[j]=nans[j];
        nans[j]=0;
      }
    }
    left/=2;
    nowi++;
  }
  rep(j,n)cout<<ans[j]<<endl;
}



Measured memory_bytes: 3272
#include <bits/stdc++.h>
typedef long long ll;
#define ALL(vec) vec.begin(), vec.end()
#define rep(i, n) for (ll i = 0; i < n; ++i)
#define repc(bit, k, n) for (ll bit = (1 << k) - 1; bit < (1 << n); bit = next_combination(bit))
#define repi(itr, vec) for (auto itr = vec.begin(); itr != vec.end(); ++itr)
using namespace std;

ll GCD(ll a, ll b)
{
  if (b == 0)
    return a;
  return GCD(b, a % b);
}
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  ll n;
  cin >> n;
  ll lcm = 1;
  rep(i, n)
  {
    ll t;
    cin >> t;
    lcm = lcm / GCD(max(lcm, t), min(lcm, t)) * t;
  }
  cout << lcm << endl;

  return 0;
}


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

#define int long long
#define ffor(i,n) for(int i = 0;i < (n); ++i)
#define all(v) v.begin(),v.end()
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int,int>
#define vpii vector<pii>
#define ff first
#define ss second


signed main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
    int n;
    cin >> n;
    cout << (n - 1)/2 + 1;
}		

Measured memory_bytes: 256
package main

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

func configure(scanner *bufio.Scanner) {
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 1000005), 1000005)
}
func getNextString(scanner *bufio.Scanner) string {
	scanned := scanner.Scan()
	if !scanned {
		panic("scan failed")
	}
	return scanner.Text()
}
func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}
func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}
func getNextFloat64(scanner *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(scanner), 64)
	return i
}
func main() {
	fp := os.Stdin
	wfp := os.Stdout
	extra := 0
	if os.Getenv("I") == "IronMan" {
		fp, _ = os.Open(os.Getenv("END_GAME"))
		extra = 100
	}
	scanner := bufio.NewScanner(fp)
	configure(scanner)
	writer := bufio.NewWriter(wfp)
	defer func() {
		r := recover()
		if r != nil {
			fmt.Fprintln(writer, r)
		}
		writer.Flush()
	}()
	solve(scanner, writer)
	for i := 0; i < extra; i++ {
		fmt.Fprintln(writer, "-----------------------------------")
		solve(scanner, writer)
	}
}
func solve(scanner *bufio.Scanner, writer *bufio.Writer) {
	n := getNextInt(scanner)
	w := cint(getNextInt64(scanner))
	vv := make([]cint, n)
	ww := make([]cint, n)
	for i := 0; i < n; i++ {
		vv[i] = cint(getNextInt64(scanner))
		ww[i] = cint(getNextInt64(scanner))
	}
	pp1 := halfdp(n>>1, vv[:n>>1], ww[:n>>1])
	pp2 := halfdp(n-n>>1, vv[n>>1:], ww[n>>1:])
	var ans cint
	r := len(pp2) - 1
	for i := 0; i < len(pp1); i++ {
		for r >= 0 && pp1[i][0]+pp2[r][0] > w {
			r--
		}
		if r < 0 {
			break
		}
		ans.maxAs(pp1[i][1] + pp2[r][1])
	}
	fmt.Fprintln(writer, ans)
}

type pair [2]cint

func halfdp(n int, vv, ww []cint) []pair {
	pp := make([]pair, 1)
	for i := 0; i < n; i++ {
		pp = merge(vv[i], ww[i], pp)
	}
	for i := 1; i < len(pp); i++ {
		pp[i][1].maxAs(pp[i-1][1])
	}
	return pp
}
func merge(v, w cint, pp1 []pair) []pair {
	n := len(pp1)
	pp2 := make([]pair, n)
	for i := 0; i < n; i++ {
		pp2[i][0] = pp1[i][0] + w
		pp2[i][1] = pp1[i][1] + v
	}
	i := 0
	i1 := 0
	i2 := 0
	pp := make([]pair, n<<1)
	for i1 < n || i2 < len(pp2) {
		if i1 == n {
			pp[i][0] = pp2[i2][0]
			pp[i][1] = pp2[i2][1]
			i++
			i2++
			continue
		}
		if i2 == n {
			pp[i][0] = pp1[i1][0]
			pp[i][1] = pp1[i1][1]
			i++
			i1++
			continue
		}
		if pp1[i1][0] == pp2[i2][0] {
			if pp1[i1][1] < pp2[i2][1] {
				pp[i][0] = pp1[i1][0]
				pp[i][1] = pp1[i1][1]
				i++
				i1++
			} else {
				pp[i][0] = pp2[i2][0]
				pp[i][1] = pp2[i2][1]
				i++
				i2++
			}
			continue
		}
		if pp1[i1][0] < pp2[i2][0] {
			pp[i][0] = pp1[i1][0]
			pp[i][1] = pp1[i1][1]
			i++
			i1++
			continue
		}
		pp[i][0] = pp2[i2][0]
		pp[i][1] = pp2[i2][1]
		i++
		i2++
	}
	return pp
}

type cint int64

func (ct *cint) minAs(x cint) *cint {
	*ct = ct.min(x)
	return ct
}
func (ct *cint) maxAs(x cint) *cint {
	*ct = ct.max(x)
	return ct
}
func (ct cint) min(x cint) cint {
	if ct > x {
		return x
	}
	return ct
}
func (ct cint) max(x cint) cint {
	if ct < x {
		return x
	}
	return ct
}



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

using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef pair<int, int> PII;

#define FOR(i, a, n) for (int i = (int)a; i < (int)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define MOD 1000000007
#define INF 1000000000
#define PI 3.14159265359
#define EPS 1e-12

int main(void) {
  while (true) {
    int n, q;
    cin >> n >> q;
    if (!n && !q)
      break;
    int date[105] = {0};
    REP(i, n) {
      int m;
      cin >> m;
      REP(j, m) {
        int d;
        cin >> d;
        date[d]++;
      }
    }

    int maxd = -INF, ans = 0;
    REP(i, 101) {
      //cout << "d:" << date[i] << endl;
      if (date[i] >= q && maxd < date[i]) {
        maxd = date[i];
        ans = i;
      }
    }

    cout << ans << endl;
  }

  return 0;
}

Measured memory_bytes: 3032
#include <cstdio>
#include <map>
using namespace std;
int N; map<string, int> A; char s[12];
int main() {
  scanf("%d", &N);
  for(int i = 0, c; i < N; i++) {
    scanf("%s", s);
    c = A.count(s);
    if(c < 1) A[s] = 1;
    else if(c == 1) A.erase(s);
  }
  printf("%d", A.size());
}

Measured memory_bytes: 11136
#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 10;
typedef long long ll;
int n;
int a[maxn];
ll ans[maxn];
struct Node
{
	int val, pos, cnt;
	Node & operator += (const Node & rhs)
	{
		pos = min(pos, rhs.pos);
		cnt += rhs.cnt;
		return *this;
	}
}b[maxn];
bool cmp(const Node & a, const Node & b) { return a.val < b.val;}
int main()
{
	scanf("%d", &n);
	for(int i = 1; i <= n; ++i) 
	{
		scanf("%d", &a[i]);
		b[i].val = a[i];
		b[i].pos = i;
		b[i].cnt = 1;
	}
	sort(b + 1, b + n + 1, cmp);
	int tot = 1;
	for(int i = 2; i <= n; ++i)
		if(b[i].val != b[tot].val)
			b[++tot] = b[i];
		else
			b[tot] += b[i];
	for(int i = tot; i; --i)
	{
		ans[b[i].pos] += 1ll * b[i].cnt * (b[i].val - b[i - 1].val);
		b[i - 1] += b[i];
	}
	for(int i = 1; i <= n; ++i)
		printf("%lld\n", ans[i]);
	return 0;
}
			
	
	 
	 

Measured memory_bytes: 3456
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CSharp_AtCoder
{


    class Program
    {

        static long GCD(long big, long smoll)
        {
            if (big < smoll)
            {
                long tmp = big;
                big = smoll;
                smoll = tmp;
            }

            while (smoll > 0)
            {
                long amari = big % smoll;
                big = smoll;
                smoll = amari;
            }

            return big;
        }

        static long LCM(long a, long b)
        {
            return (long)a / GCD(a, b) * b;
        }

        static void Main(string[] args)
        {
            long[] input = Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToArray();

            Console.WriteLine(LCM(input[0], input[1]));

        }
    }
}


Measured memory_bytes: 13396
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cassert>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
#include <cassert>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
int a[2005][2005],rui[2005][2005];
int ruit[2005][2005],ruiy[2005][2005];
int n,m,q;
int cnt(int a,int c,int b,int d){
	return rui[b][d]-rui[a-1][d]-rui[b][c-1]+rui[a-1][c-1];
}
int cntt(int a,int c,int b,int d){
	return ruit[b-1][d]-ruit[a-1][d]-ruit[b-1][c-1]+ruit[a-1][c-1];
}
int cnty(int a,int c,int b,int d){
	return ruiy[b][d-1]-ruiy[a-1][d-1]-ruiy[b][c-1]+ruiy[a-1][c-1];
}
int main(){
	scanf("%d%d%d",&n,&m,&q);
	for(int i=1;i<=n;i++){
		{
		    string s; cin >> s;
			for(int j=1;j<=m;j++) a[i][j] = (s[j-1]-'0');
		}
	}
	for(int i=1;i<=n;i++) for(int j=1;j<=m;j++){
		rui[i][j]=rui[i][j-1]+rui[i-1][j]-rui[i-1][j-1]+a[i][j];
	}
	//cout << rui[3][4] << endl;
	for(int i=1;i<n;i++) for(int j=1;j<=m;j++){
		ruit[i][j] = ruit[i-1][j]+ruit[i][j-1]-ruit[i-1][j-1];
		ruit[i][j] += (a[i][j] == 1 && a[i+1][j] == 1);
	}
	//cout << ruit[2][4] << endl;
	for(int i=1;i<=n;i++) for(int j=1;j<m;j++){
		ruiy[i][j] = ruiy[i-1][j]+ruiy[i][j-1]-ruiy[i-1][j-1];
		ruiy[i][j] += (a[i][j] == 1 && a[i][j+1] == 1);
	}
	//cout << ruiy[3][3] << endl;
	rep(i,q){
		int a,b,c,d; scanf("%d%d%d%d",&a,&b,&c,&d);
		int ret = cnt(a,b,c,d);
		ret -= cntt(a,b,c,d);
		ret -= cnty(a,b,c,d);
		printf("%d\n",ret);
	}
}

Measured memory_bytes: 64640
N = int(input())
D, X = map(int, input().split())
A = []
for _ in range(N):
    A.append(int(input()))
answer = 0
for i in range(N):
    j = 0
    while True:
        if j * A[i] + 1 <= D:
            answer += 1
        else:
            break
        j += 1

answer += X
print(answer)

Measured memory_bytes: 3064
use std::io::Read;

fn run() {
    let mut s = String::new();
    std::io::stdin().read_to_string(&mut s).unwrap();
    let mut it = s.trim().split_whitespace();
    let n: usize = it.next().unwrap().parse().unwrap();
    let a: Vec<Vec<i64>> = (0..n).map(|_| (0..n).map(|_| it.next().unwrap().parse().unwrap()).collect()).collect();
    let mut dp = vec![0; 1 << n];
    for i in 1..(1 << n) {
        let mut local = 0;
        for j in 0..n {
            for k in 0..j {
                if (i >> j) & 1 == 1 && (i >> k) & 1 == 1 {
                    local += a[j][k];
                }
            }
        }
        let mut x = (i - 1) & i;
        while x > 0 {
            local = std::cmp::max(local, dp[x] + dp[i ^ x]);
            x = (x - 1) & i;
        }
        dp[i] = local;
    }
    println!("{}", dp[(1 << n) - 1]);
}

fn main() {
    run();
}

Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
int n,m,a,b;
bool vis[100003];
vector<int>v[100003],path,path2;
void dfs(int x){
	vis[x]=1;
	path.push_back(x);
	for(int i=0;i<v[x].size();i++)
		if(!vis[v[x][i]])
		{
			dfs(v[x][i]);
			return ;
		}
}
int main(){
	cin>>n>>m;
	for(int i=0;i<m;i++){
		cin>>a>>b;
		v[a].push_back(b);
		v[b].push_back(a);
	}
	dfs(1);
	swap(path,path2);
	dfs(1);
	cout<<path2.size()+path.size()-1<<endl;
	for(int i=path2.size()-1;i>0;i--)
		cout<<path2[i]<<' ';
	for(int i=0;i<path.size();i++)
		cout<<path[i]<<' ';
}

Measured memory_bytes: 9720
//
//  main.cpp

#include <iostream>
using namespace std;


int main(){	
	bool checked[31] = {};
	for(int i=0;i<28;i++){
		int input;
		cin >> input;
		checked[input] = true;
	}
	for(int i=1;i<=30;i++){
		if(!checked[i]){
			cout << i << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 3088
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll N,X,T;
void solve()
{
    cin>>N>>X>>T;
    ll ans=ceil((N*1.0)/X) * T;
    cout<<ans<<"\n";
   
}
signed main() 
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    solve();
}

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

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

#define FOR(i, n, m) for (ll(i) = (m); (i) < (n); ++(i))
#define REP(i, n) FOR(i, n, 0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll)1e15;

int main()
{
    int M;
    cin >> M;
    cout << 48 - M << endl;
    return 0;
}

Measured memory_bytes: 256
from collections import deque
n,x,y=map(int,input().split())
edge=[[] for _ in range(n)]
edge[x-1].append(y-1)
edge[y-1].append(x-1)
for i in range(n-1):
  edge[i].append(i+1)
  edge[i+1].append(i)
visited=[[-1]*n for _ in range(n)]
def bfs(s):
  q=deque([s])
  visited[s][s]=0
  while q:
    x=q.popleft()
    for nx in edge[x]:
      if visited[s][nx]==-1:
        visited[s][nx]=visited[s][x]+1
        q.append(nx)
for i in range(n):
  bfs(i)
ans=[0]*n
for i in range(n):
  for j in range(n):
    if i<j:
      continue
    if visited[i][j]>=1:
      ans[visited[i][j]]+=1
for i in range(1,n):
  print(ans[i])

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

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define all(a) (a).begin(), (a).end()
#define bit32(x) (1 << (x))
#define bit64(x) (1ll << (x))
#define sz(v) ((int) v.size())

using namespace std;

using i64 = long long;
using f80 = long double;
using vi32 = vector<int>;
using vi64 = vector<i64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

void yes() { cout << "Yes" << endl; exit(0); }
void no() { cout << "No" << endl; exit(0); }
template <typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template <typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template <typename T> void amax(T &x, T y) { x = max(x, y); }
template <typename T> void amin(T &x, T y) { x = min(x, y); }
template <typename T> T exp(T x, i64 n, T e = 1) { T r = e; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template <typename T> istream& operator>>(istream &is, vector<T> &v) { for (auto &x : v) is >> x; return is; }
template <typename T> ostream& operator<<(ostream &os, vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }

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

void solve() {
  int n;
  cin >> n;
  vi32 a(n);
  vi32 b(n);
  cin >> a >> b;
  using T = tuple<int, int>;
  pqdesc<T> q;
  rep(i, n) {
    q.emplace(b[i], i);
  }
  i64 ans = 0;
  while (sz(q)) {
    int _, i;
    tie(_, i) = q.top();
    q.pop();
    int prev = (i - 1 + n) % n;
    int next = (i + 1) % n;
    int div = b[prev] + b[next];
    int c = (b[i] - max(div, a[i]) + div - 1) / div;
    if (c <= 0) continue;
    b[i] -= div * c;
    ans += c;
    if (a[i] >= b[i]) continue;
    q.emplace(b[i], i);
  }
  if (a == b) {
    cout << ans << endl;
  } else {
    cout << -1 << endl;
  }
}


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


Measured memory_bytes: 2100
#include <bits/stdc++.h>
#include <vector>
using namespace std;
int x, y;
int main(){
	for(int x = 1; x <= 9; x++){
		for(int y = 1; y <= 9; y++){
			cout << x << "x" << y << "=" << x*y <<"\n";
		}
	}
	return 0;
}

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

class Program
{
    static bool F(char c)
    {
        return (c == 'A' || c == 'T' || c == 'G' || c == 'C' ? true : false);
    }

    public static void Main()
    {
        string s = Console.ReadLine();
        int max = 0;
        for(int i = 0; i < s.Length; i++)
        {
            int m = 0;
            for (int j = i; j < s.Length; j++)
            {
                if (!F(s[j]))
                    break;
                else
                    m++;
            }
            max = Math.Max(max, m);
        }
        Console.WriteLine(max);
    }
}

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

const int INF = 1<<30;

int main(){
    int n, cost[9999], dum[2][10010], *dp[2];
    fill(dum[0], dum[0]+10010, INF);
    fill(dum[1], dum[1]+10010, INF);
    dp[0] = dum[0]+5005;
    dp[1] = dum[1]+5005;
    scanf("%d", &n);
    for(int x = 0; x < n-1; x++){
        scanf("%d", cost+x);
    }
    dp[0][1] = 0;
    for(int x = 0; x < n-1; x++){
        for(int y = -n/2; y <= n/2; y++){
            dp[-~x&1][y+1] = min(dp[x&1][y], dp[x&1][-y]+cost[x]);
        }
    }
    printf("%d\n", dp[1][0]);
    return 0;
}

Measured memory_bytes: 1144
using System;

namespace ABC131 {
	class Program {
		static void Main(string[] args) {
			// 入力
			Int64[] array = Array.ConvertAll(Console.ReadLine().Split(' '), Int64.Parse);
			Int64 A = array[0];
			Int64 B = array[1];
			Int64 C = array[2];
			Int64 D = array[3];
			// 処理
			// for文回してちんたらやってると余裕でTLEする
			// CとDの最小公倍数をnとすると、kn<=x<(k+1)nのxにはC,Dで割り切れない数がn-(C/n)-(D/n)+1個だけ存在する
			// そんなめんどいことしなくても、C,D,nで割り切れるものの個数を求めれば問題ない。
			// 1<=A<=x<=Bのxで、yで割り切れるものの個数は((切り捨て)B/y)-((切り捨て)(A-1)/y)である
			// 最小公倍数の求め方は、最大公約数をpとすればC*D/pである
			// ユークリッドの互除法で、最大公約数pを求める
			Int64 p, remaind;
			if (C < D) {
				p = D;
				remaind = C;
			} else {
				p = C;
				remaind = D;
			}
			while (remaind != 0) {
				Int64 tmp = p % remaind;
				p = remaind;
				remaind = tmp;
			}
			// 答えを求める
			Int64 N = C * D / p;
			Int64 totalCount = B - A + 1;
			Int64 cDivedCount = (B / C) - ((A - 1) / C);
			Int64 dDivedCount = (B / D) - ((A - 1) / D);
			Int64 nDivedCount = (B / N) - ((A - 1) / N);
			Int64 ans = totalCount - cDivedCount - dDivedCount + nDivedCount;
			Console.WriteLine(ans);
		}
	}
}

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

using namespace std;

typedef long long LL;
typedef vector<int>    VI;
typedef vector<bool>   VB;
typedef vector<string> VS;

#define MP make_pair
#define PB push_back
#define ALL(x)  (x).begin(),(x).end()
#define rep(i, N)  for (int i = 0; i < (int)(N); i++)
#define REP(i, init, N)  for (int i = (init); i < (int)(N); i++)
#define DUMP( x ) cerr << #x << " = " << ( x ) << endl

int n;
VI ks;
string s;

int main(void) {
	string alpha;
	rep (i, 26) {
		alpha += 'a' + i;
	}
	rep (i, 26) {
		alpha += 'A' + i;
	}
	reverse(ALL(alpha));
	while (1) {
		ks.clear();
		cin >> n;
		if (n == 0) break;
		rep (i, n) {
			int k;
			cin >> k;
			ks.PB(k);
		}
		cin >> s;
		string ans;
		rep (i, s.size()) {
			int idx = 0;
			rep (j, alpha.size()) {
				if (s[i] == alpha[j]) {
					idx = j;
					break;
				}
			}
			ans += alpha[(idx + ks[i % ks.size()]) % alpha.size()];
		}
		cout << ans << endl;
	}
    return 0;
}

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

int N, M;

int main() {
    cin >> N >> M;
    vector<string> v(N);
    for (int i = 0; i < N; i++) cin >> v[i];

    vector<bool> h(N, false), w(M, false);
    for (int i = 0; i < N; i++)
        for (int j = 0; j < M; j++)
            if (v[i][j] != '.') h[i] = true, w[j] = true;

    for (int i = 0; i < N; i++) {
        if (i > 0 && !h[i] && h[i-1]) {
            h[i] = true;
            i++;
        }
    }
    for (int i = 0; i < M; i++) {
        if (i > 0 && !w[i] && w[i-1]) {
            w[i] = true;
            i++;
        }
    }


    vector<string> V;
    for (int i = 0, count = 0; i < N; i++) {
        if (!h[i]) continue;
        V.push_back("");
        for (int j = 0; j < M; j++) {
            if (w[j]) V[V.size() - 1] += v[i][j];
        }
    }

    int ans = 0;
    while (1) {
        int pre = ans;

        for (int i = 0, H = V.size(); i < H; i++) {
            for (int j = 0, W = V[i].size(); j < W; j++) {
                if (V[i][j] != '.') continue;
                int up = i, down = i, left = j, right = j;
                while (up >= 0 && V[up][j] == '.') up--;
                while (down < H && V[down][j] == '.') down++;
                while (left >= 0 && V[i][left] == '.') left--;
                while (right < W && V[i][right] == '.') right++;

                string tmp;
                if (up >= 0) tmp += V[up][j];
                if (down < H) tmp += V[down][j];
                if (left >= 0) tmp += V[i][left];
                if (right < W) tmp += V[i][right];

                string same;
                for (int k = 0; k < tmp.size(); k++) {
                    for (int l = k + 1; l < tmp.size(); l++) {
                        if (tmp[k] == tmp[l]) same += tmp[k];
                    }
                }

                if (up >= 0 && same.find(V[up][j]) != string::npos) V[up][j] = '.';
                if (left >= 0 && same.find(V[i][left]) != string::npos) V[i][left] = '.';
                if (down < H && same.find(V[down][j]) != string::npos) V[down][j] = '.';
                if (right < W && same.find(V[i][right]) != string::npos) V[i][right] = '.';

                ans += same.size() * 2;
            }
        }

        if (ans == pre) break;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3360
#include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>

using namespace std;
using ll = long long;

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

    vector<pair<ll, ll> > S(N);
    for (int i = 0; i < N; ++i) {
        ll a, b; cin >> a >> b;
        S[i].first = a;
        S[i].second = b;
    }

    sort(S.begin(), S.end());

    ll ans = 0LL;
    int cnt = 0;
    int j = 0;
    while (true) {
        if ((cnt + S[j].second) >= M) {
            ans += (M - cnt) * S[j].first;
            break;
        }
        else {
            cnt += S[j].second;
            ans += S[j].first * S[j].second;
            ++j;
        }
    }

    cout << ans << endl;
    
    return 0;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
#define F first
#define S second
#define ll long long

#define fast ios_base::sync_with_stdio(false)
#define itt cin.tie(0)
#define now cout.tie(0)

using namespace std;

int n,k,d,x,ans;
bool s[102];

int main()
{
	cin>>n>>k;
	memset(s,0,sizeof(s));
	for(int i=0;i<k;i++)
	{
		cin>>d;
		for(int j=0;j<d;j++)
		{
			cin>>x;
			s[x]=true;
		}
	}
	int i=1;
	for(ans=0;i<=n;i++)
	{
		if(!s[i])
			ans++;
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 3652
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  for(int i=0;i<(n);++i)
#define REPr(i,n) for(int i=(n)-1;i>=0; --i)
#define FORq(i, m, n) for(int i = (m);i <= (n);++i)
#define FORqr(i, m , n) for(int i = (n);i >=(m);--i)
#define SCD(n) scanf("%d",&n)
#define SCD2(m,n) scanf("%d%d",&m,&n)
#define SCD3(m,n,k) scanf("%d%d%d",&m,&n,&k)
#define SCLLD(n) scanf("%lld",&n)
#define SCLLD2(m,n) scanf("%lld%lld",&m,&n)
#define SCLLD3(m,n,k) scanf("%lld%lld%lld",&m,&n,&k)
#define PB push_back
#define MP make_pair
#define ARSCD(A,N) REP(i,N){SCD(A[i]);}
#define ARSCD1(A,N) FORq(i,1,N){SCD(A[i]);}
#define VSCD(v,N) REP(i,N){int (x); SCD(x); v.PB(x);}
#define VSCLLD(v,N) REP(i,N){long long (x); SCLLD(x); v.PB(x);}
#define PRINTD(n) printf("%d\n",n)
#define PRINTLLD(n) printf("%lld\n",n)
#define DEBUG printf("%s\n","debug")
#define fst first
#define snd second
#define SIN(x,S) (S.count(x) != 0)
#define M0(x) memset(x,0,sizeof(x))
#define FILL(x,y) memset(x,y,sizeof(x))
#define MM(x) memset(x,-1,sizeof(x))
#define ALL(x) (x).begin(),(x).end()
using namespace std;
typedef pair<int,int> PII;
typedef pair<long long,long long> PLL;
typedef vector<int> VI;
typedef vector < VI > VVI;
typedef vector<long long> VL;
typedef long long ll;
typedef long long integer;
///////////////////////////////////////////////
const ll MOD = 1000000007;
ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}

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 N,M,R;
    SCD3(N,M,R);
    vector<int> r(R);
    REP(i,R){
        SCD(r[i]);
    }

    sort(ALL(r));

    int cost[302][302]={};
    REP(i,302){
        REP(j,302){
            cost[i][j] = 1e8;
            if (i==j) cost[i][j] = 0;
        }
    }

    REP(i,M){
        int A,B;
        int C;
        SCD3(A,B,C);
        cost[A][B] = C;
        cost[B][A] = C;
    }

    FORq(k,1,N){
        FORq(j,1,N){
            FORq(i,1,N){
                cost[i][j] = min(cost[i][j],cost[i][k] + cost[k][j]);
            }
        }
    }
    int ans = 1e8;
    do {
        int nans = 0;
        REP(k,R){
            if (k == 0) continue;
            nans += cost[r[k-1]][r[k]];
        }

        chmin(ans,nans);
    } while (next_permutation(ALL(r)));

    cout << ans << "\n";
}


Measured memory_bytes: 640
import java.util.*;
import java.lang.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String hiddenKey = sc.next();
        String part = sc.next();

        SortedSet<String> validKeys = new TreeSet<>();
        for(int place=0; place<=hiddenKey.length()-part.length(); place++){
            boolean valid = true;
            for(int j=0; j<part.length(); j++){
                if(hiddenKey.charAt(place+j)!='?' && hiddenKey.charAt(place+j)!=part.charAt(j)){
                    valid=false;
                    break;
                }
            }
            if(valid){
                String key = "";
                for(int i=0; i<hiddenKey.length(); i++){
                    if(i>=place && i<place+part.length()){
                        key = key + part.charAt(i-place);
                    }else{
                        key = key + (hiddenKey.charAt(i)=='?' ? 'a' : hiddenKey.charAt(i));
                    }
                }
                validKeys.add(key);
            }
        }
        if(validKeys.isEmpty()) System.out.println("UNRESTORABLE");
        else System.out.println(validKeys.first());
    }
}


Measured memory_bytes: 21844