akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <stdlib.h>

int **G;
int *u, *k, **v;
int n;

void input() {
	int i, j;

	scanf("%d", &n);

	k = (int *)malloc(sizeof(int) * (n + 1));
	u = (int *)malloc(sizeof(int) * (n + 1));
	G = (int **)malloc(sizeof(int *) * (n + 1));
	v = (int **)malloc(sizeof(int *) * (n + 1));

	for (i = 1; i <= n; i++) {
		scanf("%d%d", &u[i], &k[i]);
		G[i] = (int *)malloc(sizeof(int) * (n + 1));
		v[i] = (int *)malloc(sizeof(int) * (k[i] + 1));
		for (j = 1; j <= k[i]; j++) {
			scanf("%d", &v[i][j]);
		}
	}

	for (i = 1; i <= n; i++) {
		for (j = 1; j <= n; j++) {
			G[i][j] = 0;
		}
	}
}

void createAdjacencyMatrix(int a) {
	int i, j;
	for (i = 1; i <= k[a]; i++) {
		for (j = 1; j <= n; j++) {
			if (u[j] == v[a][i])
				G[a][u[j]] = 1;
		}
	}
}

void output() {
	int i, j;
	for (i = 1; i <= n; i++) {
		for (j = 1; j <= n; j++) {
			createAdjacencyMatrix(i);
			if (j != 1) printf(" ");
			printf("%d", G[i][j]);
		}
		puts("");
		free(G[i]);
		free(v[i]);
	}
	free(u);
	free(k);
	free(G);
	free(v);
}

main () {

	input();
	output();

	return 0;
}

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

int main() {

  int N, M;
  cin >> N >> M;
  
  if(N==0&&M==0){
    cout << "0" << endl;
    return 0;
  }
  
  if(N==0&&M==1){
    cout << "0" << endl;
    return 0;
  }
  
  if(N==0&&M>1){
    int ansB = M*(M-1);
    int ans = ansB/2;
    cout << ans << endl;
    return 0;
  }

  if(N==1&&M==1){
    cout << "0" << endl;
    return 0;
  }

  if(N==1&&M>1){
      int ansB = M*(M-1);
      int ans = ansB/2;
      cout << ans << endl;
      return 0;
  }

  if(N>1){
    int ansNB = N*(N-1);
    int ansMB = M*(M-1);
    int ans = ansNB/2 + ansMB/2;
    cout << ans << endl;
  }

  return 0;

  
}

Measured memory_bytes: 256
import scala.collection.mutable
import scala.io.StdIn

/**
  * AOJ
  */
object Main {

  def main(args: Array[String]): Unit = {

      val in = StdIn.readLine().split(" ").map(_.toInt)
      val sheet = readCells(in(0),0,List.empty[List[Int]])

      for(row <- sheet){
        println(row.mkString(" ") + " " + row.sum)
      }
      val columnSummary = getColumnSummary(sheet,List.fill(in(1))(0))
      println(columnSummary.mkString(" ") + " " + columnSummary.sum)
  }

  def readCells(r:Int,i:Int,sheet:Seq[List[Int]]):Seq[List[Int]] = {
    if(r == i){
      sheet
    } else {
      readCells(r,i + 1,sheet :+ StdIn.readLine().split(" ").map(_.toInt).toList)
    }
  }

  def getColumnSummary(sheet:Seq[List[Int]],sum:List[Int]):List[Int] = {
    if(sheet.size == 0){
      sum
    } else {
      getColumnSummary(sheet.tail,(sum,sheet.head).zipped.map(_ + _))
    }
  }
}

Measured memory_bytes: 49440
while line = gets
	n, x = line.split( " " ).map { | val | val.to_i }
	break if 0 == n && 0 == x

	cnt = 0
	for i in ( 1 .. n-2 )
		break if x < 3*(i+1)
		for j in ( i+1 .. n-1 )
			break if x < i+j
			for k in ( j+1 .. n )
				s = ( i + j + k )
				if x < s
					break
				elsif x == s
					cnt += 1
					break
				end
			end
		end
	end
	
	puts( cnt )
end

Measured memory_bytes: 6108
#include <iostream>
#include <fstream>
#include <vector>
#include <queue>
#include <string>
#include <limits>
#include <algorithm>
#include <map>
#include <sstream>
#include <unordered_map>

using ll = long long;
using ull = unsigned long long;
using uint = unsigned int;
static ull tenq = 1000000000;
static ull mod = tenq + 7;

using namespace std;

int main()
{
  string sp, t, s;
  cin >> sp >> t;
  s = "";
  if (s.find(t) != string::npos) {
    for (ll j = 0; j < sp.size(); j++) {
      if (sp[j] == '?') s += 'a';
      else s += sp[j];
    }
  } else {
    for (ll i = sp.size() - t.size(); i >= 0; i--) {
      ll num_match = 0;
      for (ll j = 0; j < t.size(); j++) {
        if (sp[i + j] == '?' || sp[i + j] == t[j]) num_match++;
      }
      if (num_match == t.size()) {
        for (ll j = 0; j < i; j++) {
          if (sp[j] == '?') s += 'a';
          else s += sp[j];
        }
        s += t;
        for (ll j = i + t.size(); j < sp.size(); j++) {
          if (sp[j] == '?') s += 'a';
          else s += sp[j];
        }
        break;
      }
    }
  }

  cout << (s.size() == 0 ? "UNRESTORABLE" : s) << endl;

  return 0;
}


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

#define int long long
#define For(i, a, b) for (int i = (a); i <= static_cast<int>(b); i++)
#define Forr(i, a, b) for (int i = (a); i >= static_cast<int>(b); i--)
#define rep(i, n) For(i, 0, n - 1)
#define repall(i, arr) for (auto& i : (arr))
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define dump(x) cerr << #x << " = " << (x) << '\n'
#define dump2(x, y) \
    cerr << #x << " = " << (x) << " " << #y << " = " << (y) << '\n'

template <typename T>
using pq = priority_queue<T>;
template <typename T>
using pqr = priority_queue<T, vector<T>, greater<T>>;
const int INF = INT_MAX / 2;
constexpr int MOD = 1e9 + 7;
using P = pair<int, int>;
using vec = vector<int>;
using mat = vector<vec>;

template <typename T1, typename T2>
ostream& operator<<(ostream& stream, const pair<T1, T2>& p) {
    return stream << p.first << " " << p.second;
}
template <typename T>
void print(const vector<vector<T>> matrix) {
    repall (vec, matrix)
        print(vec);
}
template <typename T>
void print(const vector<T> vec) {
    unsigned int len = vec.size();
    rep (i, len - 1)
        cout << vec[i] << ' ';
    cout << vec[len - 1] << '\n';
}
template <typename Arg>
void print(const Arg arg) {
    cout << arg << '\n';
}
template <typename Head, typename... Args>
void print(const Head head, const Args... args) {
    cout << head << " ";
    print(args...);
}
template <typename T>
T sum_(vector<T> vec, T init = 0) {
    return std::accumulate(all(vec), T(init));
}

void yn(bool tf) { print(tf ? "Yes" : "No"); }
void YN(bool tf) { print(tf ? "YES" : "NO"); }

template <typename T>
void init(vector<T>& v) {
    rep (i, v.size())
        cin >> v[i];
}

template <typename T, typename U>
void init(vector<T>& v, vector<U>& w) {
    assert(v.size() == w.size());
    rep (i, v.size())
        cin >> v[i] >> w[i];
}

int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }

// -------------------------------------------------------------------
// sort 1 2 3 4

bool in(char c) { return c == 'A' or c == 'T' or c == 'G' or c == 'C'; }

signed main() {
    cin.tie(0), cout.tie(0), ios::sync_with_stdio(false);
    int n, q;
    cin >> n >> q;
    string s;
    cin >> s;
    vec l(q), r(q);
    init(l, r);

    vec v(n);
    rep (i, n) {
        if (!i) continue;
        v[i] = v[i - 1];
        if (s[i - 1] == 'A' and s[i] == 'C') v[i]++;
    }

    rep (i, q)
        print(v[r[i] - 1] - v[l[i] - 1]);

    return 0;
}


Measured memory_bytes: 3408
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
ans = sum(B)
for i, j in zip(A, A[1:]):
    if j == i+1:
        ans += C[i-1]
print(ans)

Measured memory_bytes: 3060
n = int(input())
to1 = [[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0]]
to2 = [[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0]]
to3 = [[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0]]
to4 = [[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0]]

tolist = [to1,to2,to3,to4]

for i in range(n):
    to,kai,heya,hito = map(int,input().split(" "))
    tolist[to-1][kai-1][heya-1] += hito

for i in range(4):
    for j in range(3):
        news = " "
        newl = " ".join(map(str,tolist[i][j]))
        print(news + newl)
    if i != 3:
        print("####################")


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

int main() {
  ll r,d,x; cin >>r >>d >>x;
  for (int i=0; i<10; i++){
    x = r*x-d;
    cout <<x <<endl;
  }
  
  //cout <<ans;
  cout <<endl;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
// #define endl '\n'
// #define double long double
#define int long long
// int MOD = 1000 * 1000 * 1000 + 7;
// int MOD = 998244353;

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


int gcd(int a, int b, int c) {
	return gcd(gcd(a, b), c);
}

signed main() {
	
	int k;
	cin >> k;
	int sm = 0;
	for (int i=1; i<=k; i++) {
		for (int j=1; j<=k; j++) {
			for (int l=1; l<=k; l++) {
				sm += gcd(i, j, l);
			}
		}
	}
	cout << sm << endl;
	
}


Measured memory_bytes: 3632
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <complex>
#include <stdio.h>
#include <time.h>
#include <numeric>
#include <random>
#include <unordered_map>
#include <unordered_set>
#define all(a) a.begin(),a.end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define pb push_back
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll, ll> P;
typedef complex<ld> com;
constexpr int inf = 1000000010;
constexpr ll INF = 1000000000000000010;
constexpr ld eps = 1e-12;
constexpr ld pi = 3.141592653589793238;
template<class T, class U> inline bool chmax(T &a, const U &b) { if (a < b) { a = b; return true; } return false; }
template<class T, class U> inline bool chmin(T &a, const U &b) { if (a > b) { a = b; return true; } return false; }


signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(20);

	int a, b;
	cin >> a >> b;
	cout << a * b << '\n';
}

Measured memory_bytes: 3652
import numpy as np

h, w = list(map(int, input().split()))

aaa = [list(map(int, input().split())) for _ in range(h)]
bbb = [list(map(int, input().split())) for _ in range(h)]
aaa = np.array(aaa, dtype=np.int8)
bbb = np.array(bbb, dtype=np.int8)
diff = abs(aaa - bbb)


def merge_new_can(d, can, prev_can):
    if d == 0:
        can |= prev_can
    else:
        can[d:] |= prev_can[:-d]
        can[:-d] |= prev_can[d:]


prev_row = [None] * w

can = np.zeros(25601, dtype=np.int8)
can[diff[0][0] + 12800] = 1
prev_row[0] = can

for j in range(1, w):
    d = diff[0][j]
    can = np.zeros(25601, dtype=np.int8)
    prev_can = prev_row[j - 1]
    merge_new_can(d, can, prev_can)
    prev_row[j] = can

for i in range(1, h):
    curr_row = [None] * w

    d = diff[i][0]
    prev_can = prev_row[0]
    can = np.zeros(25601, dtype=np.int8)
    merge_new_can(d, can, prev_can)
    curr_row[0] = can

    for j in range(1, w):
        d = diff[i][j]
        can = np.zeros(25601, dtype=np.int8)
        prev_can1 = prev_row[j]
        prev_can2 = curr_row[j - 1]
        merge_new_can(d, can, prev_can1)
        merge_new_can(d, can, prev_can2)
        curr_row[j] = can

    prev_row = curr_row

goal = prev_row[-1]
goal[12801:] |= goal[:12800][::-1]
goal = goal[12800:]
print(np.argmax(goal))


Measured memory_bytes: 18500
from sys import exit

N,K=map(int,input().split())
a={} #{種類:美味しさ}
b=[] #[[種類,美味しさ],...]

for _ in range(N):
    t,d=map(int,input().split())
    b.append([t,d])
    try:
        a[t].append(d)
    except KeyError:
        a[t]=[d]
b.sort(key=lambda x:-x[1])

f=[0]*(N+1)
x=0
point=0
pointsum=[]

for [t,d] in b[:K]:
    if f[t]==0: x+=1
    f[t]+=1
    point+=d
maxpoint=point+x*x

h=K-1
for [t,d] in b[K:]:
    if f[t]==0:
        f[t]=1
        x+=1
        point+=d
        for i in range(h,-2,-1):
            if i==-1:
                print(maxpoint)
                exit()
            t=b[i][0]
            d=b[i][1]
            if f[t]>1:
                f[t]-=1
                point-=d
                h=i-1
                break
        maxpoint=max(maxpoint,point+x*x)
print(maxpoint)

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

int main() {
  int N, M;
  cin >> N >> M;
  vector<int> A(M);
  for (int i = 0; i < M; ++i) {
    cin >> A[i];
  }
  int sum_day = 0;
  for (int i = 0; i < M; ++i) {
    sum_day += A[i];
  }
  cout << (N >= sum_day ? N - sum_day : -1) << endl;
}

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

string ans[3] = {"GREATER", "LESS", "EQUAL"};

int main(){
  string a, b;
  cin >> a;
  cin >> b;
  int u = 2;
  int al = a.size();
  int bl = b.size();
  if (al > bl) u = 0;
  else if (al < bl) u = 1;
  else {
    for (int i = 0; i < al; i++){
      if (u != 2) break;
      if (a[i] > b[i]) u = 0;
      if (b[i] > a[i]) u = 1;
    }
  }
  cout << ans[u] << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,j,k) for(int i = (int)j;i <= (int)k;i ++)
#define debug(x) cerr<<#x<<":"<<x<<endl
#define pb push_back

typedef long long ll;
typedef pair<int,int> pi;
const int MAXN = (int)1e6+7;

char s[MAXN];

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

    cin >> s+1;
    int len = strlen(s+1);
    int cnt = 0;
    rep(i,1,len) {
        if (s[i] != s[len-i+1]) cnt ++;
    }
    cout << cnt/2 <<endl;

}




Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
int main(void){
	unsigned long N,M;
	scanf("%lu%lu",&N,&M);
	if(N > 1 && M > 1)printf("%lu\n", (N-2)*(M-2));
	else if(N==1 && M >1) printf("%lu\n", (M-2));
	else if(N>1 && M ==1) printf("%lu\n", (N-2));
	else printf("%d\n",1);
	return 0;
}

Measured memory_bytes: 128
using System;

namespace ARC096
{
    class C
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split();
            int A = int.Parse(input[0]);
            int B = int.Parse(input[1]);
            int C = int.Parse(input[2]);
            int X = int.Parse(input[3]);
            int Y = int.Parse(input[4]);

            int sum = 0;

            if (2 * C <= A + B)
            {
                while (0 < X && 0 < Y)
                {
                    sum += 2 * C;
                    X--; Y--;
                }
            }

            while (0 < X)
            {
                if (2 * C < A) sum += 2 * C;
                else sum += A;
                X--;
            }

            while (0 < Y)
            {
                if (2 * C < B) sum += 2 * C;
                else sum += B;
                Y--;
            }
            Console.WriteLine(sum);
        }
    }
}


Measured memory_bytes: 13140
main=do
 [n,y]<-map read.words<$>getLine
 let(a,b,c)=head$[(i,j,k)|i<-[0..n],j<-[0..n-i],let k=n-i-j,10000*i+5000*j+1000*k==y]++[(-1,-1,-1)]
 putStrLn$unwords$map show[a,b,c]

Measured memory_bytes: 892
#include <stdio.h>

int main() {
	int n;
	scanf("%d",&n);
	int vetor[n];
	for(int x=0;x<n;++x)
        scanf("%d",&vetor[x]);
	int m,a,b;
	scanf("%d",&m);
	for(int y=0;y<m;++y){
	    int val=0;
	    scanf("%d %d",&a,&b);
	    for(int z=0;z<n;++z){
	        if(z==(a-1))
	            val+=b;
            else
                val+=vetor[z];
	        
	    }
	    printf("%d\n",val);
	}
	return 0;
}

Measured memory_bytes: 128
n = input()
if n[0] == n[1] == n[2]:
    print(int(n))
elif n[0] == n[1] and n[0] > n[2]:
    print(int(n[0]+n[1]+n[1]))
elif n[0] > n[1]:
    print(int(n[0]+n[0]+n[0]))
else:
    m = int(n[0])+1
    print(100*m+10*m+m)


Measured memory_bytes: 3060
H,W,K = map(int,input().split())
C = [list(input()) for h in range(H)]
ans = 0

for h in range(2**H):
  for w in range(2**W):
    c = 0
    for i in range(H):
      for j in range(W):
        if (h>>i)&1==0 and (w>>j)&1==0 and C[i][j]=="#":
          c+=1
    if c==K:
      ans+=1

print(ans)

Measured memory_bytes: 9104
#include <cstdio>
#include <cstring>
#define SIZE 100001
using namespace std;

struct process {
  char name[11];
  int time;
};

class Queue {
  int head, tail;
  process *p;

public:
  Queue() {
    head = 0;
    tail = 0;
    p = new process[SIZE];
  }
  ~Queue() { delete[] p; }
  void enqueue(process s) {
    p[tail] = s;
    if (tail + 1 == SIZE) {
      tail = 0;
    } else {
      tail++;
    }
  }
  process dequeue() {
    process tmp = p[head];
    if (head + 1 == SIZE) {
      head = 0;
    } else {
      head++;
    }
    return tmp;
  }

  bool isFull() { return head == (tail + 1) % SIZE; }
  bool isEmpty() { return head == tail; }
};

int main() {
  int n, quant, cnt;
  cnt = 0;
  scanf("%d%d", &n, &quant);
  Queue q;
  for (int i = 0; i < n; i++) {
    process tmp;
    scanf("%s%d", tmp.name, &tmp.time);
    q.enqueue(tmp);
  }

  while (!q.isEmpty()) {
    process tmp = q.dequeue();
    if (tmp.time > quant) {
      process p;
      strcpy(p.name, tmp.name);
      p.time = tmp.time - quant;
      cnt += quant;
      q.enqueue(p);
    } else {
      cnt += tmp.time;
      printf("%s %d\n", tmp.name, cnt);
    }
  }

  return 0;
}



Measured memory_bytes: 3940
import sys
N = int(input())
S = input()

X = [''] * (N + 1)
X[0] = 'S'
X[1] = 'S'
for i in range(1, N):
    if X[i] == 'S':
        if S[i] == 'o':
            X[i + 1] = X[i - 1]
        else:
            if X[i - 1] == 'S':
                X[i + 1] = 'W'
            else:
                X[i + 1] = 'S'
    else:
        if S[i] == 'x':
            X[i + 1] = X[i - 1]
        else:
            if X[i - 1] == 'S':
                X[i + 1] = 'W'
            else:
                X[i + 1] = 'S'
if X[-1] == 'S':
    if (X[-2] == 'S' and S[0] == 'o') or (X[-2] == 'W' and S[0] == 'x'):
        X.pop()
        for x in X:
            print(x, end='')
        print('')
        sys.exit()

X = [''] * (N + 1)
X[0] = 'S'
X[1] = 'W'
for i in range(1, N):
    if X[i] == 'S':
        if S[i] == 'o':
            X[i + 1] = X[i - 1]
        else:
            if X[i - 1] == 'S':
                X[i + 1] = 'W'
            else:
                X[i + 1] = 'S'
    else:
        if S[i] == 'x':
            X[i + 1] = X[i - 1]
        else:
            if X[i - 1] == 'S':
                X[i + 1] = 'W'
            else:
                X[i + 1] = 'S'
if X[-1] == 'S':
    if (X[-2] == 'S' and S[0] == 'x') or (X[-2] == 'W' and S[0] == 'o'):
        X.pop()
        for x in X:
            print(x, end='')
        print('')
        sys.exit()

X = [''] * (N + 1)
X[0] = 'W'
X[1] = 'S'
for i in range(1, N):
    if X[i] == 'S':
        if S[i] == 'o':
            X[i + 1] = X[i - 1]
        else:
            if X[i - 1] == 'S':
                X[i + 1] = 'W'
            else:
                X[i + 1] = 'S'
    else:
        if S[i] == 'x':
            X[i + 1] = X[i - 1]
        else:
            if X[i - 1] == 'S':
                X[i + 1] = 'W'
            else:
                X[i + 1] = 'S'
if X[-1] == 'W':
    if (X[-2] == 'S' and S[0] == 'x') or (X[-2] == 'W' and S[0] == 'o'):
        X.pop()
        for x in X:
            print(x, end='')
        print('')
        sys.exit()

X = [''] * (N + 1)
X[0] = 'W'
X[1] = 'W'
for i in range(1, N):
    if X[i] == 'S':
        if S[i] == 'o':
            X[i + 1] = X[i - 1]
        else:
            if X[i - 1] == 'S':
                X[i + 1] = 'W'
            else:
                X[i + 1] = 'S'
    else:
        if S[i] == 'x':
            X[i + 1] = X[i - 1]
        else:
            if X[i - 1] == 'S':
                X[i + 1] = 'W'
            else:
                X[i + 1] = 'S'
if X[-1] == 'W':
    if (X[-2] == 'S' and S[0] == 'o') or (X[-2] == 'W' and S[0] == 'x'):
        X.pop()
        for x in X:
            print(x, end='')
        print('')
        sys.exit()

print('-1')

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

bool is_range(int a, int b, int c)
{
    return a < b && b < c;
}

int main()
{
    int a, b, c;
    cin >> a >> b >> c;
    cout << (is_range(a, b, c) ? "Yes" : "No")  << endl;

    return 0;
}

Measured memory_bytes: 1156
#include <cstdio>
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <map>
#include <set>

#define ll long long
#define pll pair<ll, ll>

#define reps(i, f, n) for (int i = (f); i < (int)(n); i++)
#define rep(i, n) reps(i, 0, n)

const int INF = 1111111111;
const double EPS = 1e-9;

using namespace std;

void init()
{
}

void solve()
{
	string s, t;
	cin >> s >> t;

	int cnt = 0;
	rep(i, s.size())
	{
		if (s[i] != t[i])
			cnt++;
	}
	cout << cnt << endl;
}

int main()
{
	init();
	solve();
}


Measured memory_bytes: 3584
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		long mod=1000000007;
		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt();
		char[] s1=sc.next().toCharArray();
		char[] s2=sc.next().toCharArray();
		long sol = (s1[0]==s2[0])?3:6;
		for(int i=1;i<n;i++){
			if(s1[i]==s2[i]&&s1[i-1]==s2[i-1] && s1[i]!=s1[i-1]&&s2[i]!=s2[i-1]){
				sol=(sol*2)%mod;
			}else if(s1[i]!=s2[i]&&s1[i-1]==s2[i-1] && s1[i]!=s1[i-1]&&s2[i]!=s2[i-1]){
				sol=(sol*2)%mod;				
			}else if(s1[i]!=s2[i]&&s1[i-1]!=s2[i-1] && s1[i]!=s1[i-1]&&s2[i]!=s2[i-1]){
				sol=(sol*3)%mod;				
			}
		}
		System.out.println(sol);
	}
}


Measured memory_bytes: 23764
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, n) for (int i = 1; i < (int)(n); i++)
#define Sort(a) sort(a.begin(), a.end())
typedef long long int ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
template <class T> inline bool chmax(T& a,T b){if(a<b){a=b;return true;} return false;}
template <class T> inline bool chmin(T& a,T b){if(a>b){a=b;return true;} return false;}

int main(){
    int a, b, c, x, y;
    cin >> a >> b >> c >> x >> y;
    ll sum = 0;
    if(a+b > 2*c){
        sum += 2*c*min(x, y);
        int tmp = min(x, y);
        x = x - tmp;
        y = y - tmp;
        if(max(x*a, y*b) > 2*c*max(x, y)){
            sum += 2*c*max(x, y);
            x = 0;
            y = 0;
        }
    }
    sum += x*a + y*b;
    cout << sum << endl;
    return 0;
}

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

using namespace std;

int main()
{
	int a, b;
	cin >> a >> b;

	if ((a * b) % 2 == 0) {
		cout << "Even" << endl;
	}
	else {
		cout << "Odd" << endl;
	}
}

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

typedef long long ll;
typedef long double ld;

ll res;
ll sz[1000005];
int parent[1000005];
ll a[1000005];
ll b[1000005];

int root(int v){
    if(parent[v] == v) return v;
    return parent[v] = root(parent[v]);
}

int main(){
    ios_base::sync_with_stdio(false);
    cout.precision(10);
    cout<<fixed;

    int n, m;
    cin >> n >> m;
    for(int i=1; i<=m; i++){
        cin >> a[i] >> b[i];
    }
    for(int i=1; i<=n; i++){
        parent[i] = i;
        sz[i] = 1;
    }
    reverse(a+1, a+1+m);
    reverse(b+1, b+1+m);
    res = (ll)n*(n-1)/2;
    stack <ll> resenja;
    for(int i=1; i<=m; i++){
        resenja.push(res);
        int a1 = root(a[i]);
        int b1 = root(b[i]);
        if(a1 == b1){
            continue;
        }
        res -= sz[a1]*sz[b1];
        if(sz[a1] < sz[b1]){
            swap(a1, b1);
        }
        parent[b1] = a1;
        sz[a1] += sz[b1];
    }
    while(!resenja.empty()){
        cout << resenja.top() << "\n";
        resenja.pop();
    }
    return 0;
}


Measured memory_bytes: 10908
#include <iostream>
#include <sstream>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <deque>
#include <queue>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <stdio.h>

using namespace std;

#define fo(i,n) for(int i=0; i<(int)n; i++)
#define rep(it,s) for(__typeof((s).begin()) it=(s).begin();it!=(s).end();it++)
#define mp(a,b) make_pair(a,b)
#define pb(x) push_back(x)
#define pii pair<int,int>

int n,s,w,q;
int v[100010];
int sum[100010];
map<int,int> all;
long long p[100010];

int main() {

    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);

	while (scanf("%d%d%d%d",&n,&s,&w,&q) && n!=0) {
		int g = s;
		for (int i=0; i<n; i++) {
			v[i] = (g/7)%10;
			if (g%2==0) g = g/2;
			else g = (g/2) ^ w;
		}
		all.clear();
		int ans = 0;
		if (v[n-1]%q==0 && v[n-1]!=0) ans++;
		sum[n-1] = v[n-1]%q;
		p[n-1] = 1;
		all[sum[n-1]]++;
		if (q!=2 && q!=5) all[0]++;
		for (int i=n-2; i>=0; i--) p[i] = (10*p[i+1])%q;
		for (int i=n-2; i>=0; i--) {
			if (q==2) {
				all[v[i]%2]++;
				if (v[i]!=0) ans += all[0];
			}
			else if (q==5) {
				all[v[i]%5]++;
				if (v[i]!=0) ans += all[0];
			}
			else {
				sum[i] = (sum[i+1] + (v[i]*p[i])%q)%q;
			
				if (v[i]!=0) ans += all[sum[i]];
			
				all[sum[i]]++;
			}
		}
		
		cout<<ans<<endl;
	}

    return 0;

}

Measured memory_bytes: 6832
#include<stdio.h>

long long int A,B,K,ansA,ansB;
int main(){
    scanf("%lld%lld%lld",&A,&B,&K);
    if(K>=A+B)ansA=0,ansB=0;
    else if(K>=A)ansA=0,ansB=A+B-K;
    else ansA=A-K,ansB=B;
    printf("%lld %lld\n",ansA,ansB);
}

Measured memory_bytes: 1724
#include <stdio.h>

int main(void)
{
  int i, j, tmp, array[5];

  for(i = 0; i < 5; ++i)
    {
      scanf("%d", array + i);
    }
  for(i = 0; i < 5; ++i)
    {
      for(j = i + 1; j < 5; ++j)
	{
	  if(array[i] < array[j])
	    {
	      tmp = array[i];
	      array[i] = array[j];
	      array[j] = tmp;
	    }
	}
    }
  printf("%d %d %d %d %d\n", array[0], array[1], array[2], array[3], array[4]);
  return 0;
}

Measured memory_bytes: 0
import java.util.Scanner;
 
public class Main {
  static int k;
  static String s;
    
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    s = scanner.nextLine();
    k = scanner.nextInt();
    scanner.close();
 
    char[] c = s.toCharArray();
    for (int i = 0; i < s.length(); i++) {
        if (k == 0) {
            break;
        }
        if (c[i] == 'a') {
            continue;
        }
        if ((int) c[i] + k > 122) {
            k -= (123 - (int) c[i]);
            c[i] = 'a';
        }
    }
    k = k % 26;
    c[s.length() - 1] = (char) (c[s.length() - 1] + k);
    s = String.valueOf(c);
    System.out.println(s);
  }
}

Measured memory_bytes: 14768
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for(i=a;i<=n;i++)
#define test(a) cout << "*" << a << endl
int main (){
  int i,j;
  int N,M,X,Y;
  int x[120];
  int y[120];
  int xMax = -9999;
  int yMin = 9999;
  bool peace = false;
  
  cin >> N >> M >> X >> Y;
  
  rep(i,1,N){
    cin >> x[i];
    xMax = max(xMax,x[i]);
  }
    
  rep(i,1,M){
    cin >> y[i];
    yMin = min(yMin,y[i]);
  }
  
  /*rep(i,1,N)
    test(x[i]);
  cout << "*" << endl;
  rep(i,1,M)
    test(y[i]);*/
  
  for(i=xMax+1;i<=yMin;i++){
    if(X<i && i<=Y){
      peace = true;
      break;
    }
  }
    
  
  /*for(i=Y;i>X+1;i--){
    if(xMax<i && i<=yMin){
      peace = true;
      break;
    }
    else{
      peace = false; 
    }
  }*/
  if(peace==true)
    cout << "No War" << endl;
  else if(peace==false)
    cout << "War" << endl;
  
  
}

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

#define all(s) s.begin(), s.end()
#define vi vector<int>
#define pb push_back
#define ii pair<int, int>
#define x first
#define y second

const int N = 400005;

int n, a[N], b[N];
int xorA[N], xorB[N];

const int P1 = 1000000007;
const int P2 = 1000000009;
const int BASE = 1000001;

ii operator + (ii x, ii y) {
    return {(x.x + y.x) % P1, (x.y + y.y) % P2};
}

ii operator - (ii x, ii y) {
    return {(x.x - y.x + P1) % P1, (x.y - y.y + P2) % P2};
}

ii operator * (ii x, int y) {
    return {(1LL * x.x * y) % P1, (1LL * x.y * y) % P2};
}

ii operator * (ii x, ii y) {
    return {(x.x * 1LL *  y.x) % P1, (x.y * 1LL * y.y) % P2};
}

ii pwBase[N];
vector<ii> hsA, hsB;

ii getHashA(int l, int r) {
    return hsA[l] - hsA[r] * pwBase[r - l];
}

ii getHashB(int l, int r) {
    return hsB[l] - hsB[r] * pwBase[r - l];
}

int main() {
    ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    cin >> n;
    pwBase[0] = {1, 1};
    for (int i = 1; i <= 2 * n + 1 ; i++) {
        pwBase[i] = pwBase[i - 1] * BASE;
    }
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
        a[n + 1] = a[1];
    }
    for (int i = 1; i <= n; i++) {
        cin >> b[i];
        b[i + n] = b[i];
    }
    for (int i = 1; i <= n; i++) {
        xorA[i] = a[i] ^ a[i + 1];
    }
    for (int i = 1; i < 2 * n; i++) {
        xorB[i] = b[i] ^ b[i + 1];
    }
    hsA.resize(N, {0, 0});
    hsB.resize(N, {0, 0});
    for (int i = n; i >= 1; i--) {
        hsA[i] = hsA[i + 1] * BASE + make_pair(xorA[i], xorA[i]);
    }
    for (int i = 2 * n; i >= 1; i--) {
        hsB[i] = hsB[i + 1] * BASE + make_pair(xorB[i], xorB[i]);
    }
    vector<ii> ans;
    for (int i = 0; i < n; i++) {
        if (getHashA(1, n) == getHashB(1 + i, n + i)) {
            if (i != 0) ans.pb({n - i, a[1] ^ b[1 + i]});
            else ans.pb({0, a[1] ^ b[1 + i]});
        }
    }
    sort(all(ans));
    for (ii u : ans) {
        cout << u.x << ' ' << u.y << '\n';
    }
    return 0;
}

Measured memory_bytes: 20080
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
    	try {
    		final int N = sc.nextInt();
    		double[] array = new double[N];
    		for (int i=0; i<array.length; i++) {
    			array[i] = sc.nextDouble();
    		}
    		Arrays.sort(array);

    		double initial = (array[0] + array[1]) / 2;
    		for (int i=2; i<array.length; i++) {
    			initial = (initial + array[i]) / 2;
    		}
    		System.out.println(initial);

    	} finally {
    		sc.close();
    	}
    }
}



Measured memory_bytes: 23252
#include<iostream>
using namespace std;
long long n,m,a,s;
int main()
{
    cin>>n>>m;
    for(int i=1;i<=m;i++)
    {
    	cin>>a;
    	s+=a;
	}
	if(n<s)
	{
		cout<<"-1"<<endl;
		return 0;
	}
	cout<<n-s<<endl;
    return 0;
}

Measured memory_bytes: 3612
// Bismillahir Rahmanir Rahim
// AtCoder-

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

int main(){
 int n; cin>>n;
 long long ans = 0;
 for(int i = 1; i <= n; ++i){
  for(int j = 1; j <= n; ++j){
   for(int k = 1; k <= n; ++k){
   	  ans += __gcd(i,__gcd(j,k));
   }
 }
}
   cout<<ans<<endl;
 return 0;
}


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

int main(){
  int N;
  int a[100];
  cin >> N;
  for (int i=0; i<N; ++i) cin >> a[i];
  sort(a, a+N, greater<int>());
  
  int Alice = 0;
  int Bob = 0;
  for (int i=0; i<N; ++i){
    if (i%2 == 0){
      Alice += a[i];
    }else{
      Bob += a[i];
    }
  }
  
  cout << Alice - Bob << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007

int main() {
	ll x,y;
	cin>>x>>y;
	ll stop=y/x;
	ll ans=0;
	ll sum=1;
	while(sum<=stop){
		ans++;
		sum*=2;
	}
	cout <<ans;
	// your code goes here
	return 0;
}

Measured memory_bytes: 256
n,m=map(int,input().split())
x=list(map(int,input().split()))
y=list(map(int,input().split()))
# ブロックの数は(m-1)*(n-1)
mod=pow(10,9)+7
ypoint=0
for i in range(m-1):
  ypoint+=(y[i+1]-y[i])*(m-i-1)*(i+1)
  ypoint%=mod
ans=0
for i in range(n-1):
  ans+=ypoint*(x[i+1]-x[i])*(n-i-1)*(i+1)
  ans%=mod
print(ans)

Measured memory_bytes: 18576
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define Yes                \
    cout << "Yes" << endl; \
    return 0;
#define No                \
    cout << "No" << endl; \
    return 0;
using namespace std;
using ll = long long;
const int INF = 1001001001;
const int MOD = 1000000007;
typedef long long ll;

template <typename T>
void print(const T &v);

int main()
{
    int N, M;
    cin >> N;
    map<string, int> mp;
    rep(i, N)
    {
        string ipt;
        cin >> ipt;
        mp[ipt]++;
    }
    cin >> M;
    rep(i, M)
    {
        string ipt;
        cin >> ipt;
        mp[ipt]--;
    }
    int maxi = 0;
    for (auto m : mp)
    {
        maxi = max(maxi, m.second);
    }
    cout << maxi << endl;
    return 0;
}

// Use For Debug
template <typename T>
void print(T const &v)
{
    for (int i = 0; i < v.size(); i++)
    {
        if (i)
            cout << " ";
        cout << v[i];
    }
    cout << endl;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <sstream>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <cstring>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <algorithm>
#include <iterator>
#include <bitset>
#include <ctime>
#include<unordered_set>
#include<complex>
#include <cassert>

using namespace std;

#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define RFOR(i,b,a) for (int i = (b)-1; i >= (a); i--)
#define ITER(it,a) for (__typeof(a.begin()) it = a.begin(); it != a.end(); it++)
#define FILL(a,value) memset(a, value, sizeof(a))

#define SZ(a) (int)a.size()
#define ALL(a) a.begin(), a.end()
#define PB push_back
#define MP make_pair

typedef long long LL;
typedef vector<int> VI;
typedef pair<int, int> PII;

const double PI = acos(-1.0);
const int INF = 1000 * 1000 * 1000 + 7;
const LL LINF = INF * (LL)INF;

const int MAX = 200 + 7;
LL A[MAX];
string s;
int n;

vector<LL> B;
LL getRem(LL a) {
    FOR(i, 0, SZ(B)) {
        if ((B[i] ^ a) < a) a ^= B[i];
    }

    return a;
}

void add(LL a) {
    LL b = getRem(a);
    B.push_back(b);
    sort(ALL(B));
    reverse(ALL(B));
}

void solve() {
    cin >> n;
    FOR(i, 0, n) cin >> A[i];
    cin >> s;
    
    B.clear();
    RFOR(i, n, 0) {
        if (s[i] == '0') {
            add(A[i]);
            continue;
        }

        if (getRem(A[i])) {
            cout << 1 << endl;
            return;
        }
    }

    cout << 0 << endl;
}

int main()
{
    //freopen("in.txt", "r", stdin);
    //freopen("out.txt", "w", stdout);
    ios::sync_with_stdio(false); cin.tie(0);
    int t;
    cin >> t;
    while (t--) {
        //cout << "!" << t << endl;
        solve();
    }
}

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

int main() {
    string s;
    cin >> s;
    int K;
    cin >> K;
    map<string, int> ma;
    int N = s.size();
    for (int i = 0; i < N; i++) {
        for (int j = 1; j <= K; j++) {
            string ss = s.substr(i, j);
            ma[ss] = 1;
        }
    }

    int i = 0;
    for (auto m : ma) {
        if (i == K - 1) {
            cout << m.first << endl;
            return 0;
        }
        i++;
    }
}

Measured memory_bytes: 1920
#include<stdio.h>
#include<tuple>
#include<string>
#include<algorithm>
#include<iostream>
#include<map>
#include<string.h>
#include<vector>
#include<math.h>
#include<stdlib.h>
#include<set>
#include<ctype.h>
using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<double, double> pdd;
typedef tuple<int,int,int> t3;

const int MX = 200005;
const int MM = 924844033;

int A[MX];

int main()
{
	int N, K;
	scanf("%d%d", &N, &K);
	if( K == 1 || K == 2*N-1 ) return !printf("No\n");
	int cnt = 0;
	A[N-1] = K-1;
	A[N] = K;
	A[N+1] = K+1;
	for(int i = 1; i <= 2*N-1; i++){
		if( i == N-1 || i == N || i == N+1 ) continue;
		cnt += 1;
		while(cnt == K-1 || cnt == K || cnt == K+1 ) cnt++;
		A[i] = cnt;
	}

	printf("Yes\n");
	for(int i = 1; i <= 2*N-1; i++) printf("%d\n", A[i]);
}


Measured memory_bytes: 2304
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  
  int A,B;
  cin >>A >>B;
  
  int i=A,j=0;
  while(i <=B){
    bool a=0, b=0;
    a = (i%10 == (i - i%10000)/10000);
    b = ((i%100 - i%10)/10 == (i%10000 - i%1000)/1000);
    
    if(a && b){
      j++;
      i++;
    }
    else{
      i++;
    }
  }
  
  cout <<j <<endl;
  
}


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

int n;
bool is_composite[1000001];

int main() {
  while (1) {
    if (scanf("%d", &n) != 1) break;

    fill(is_composite, &is_composite[n+1], false);
    
    int cnt = 0;
    for (int i=2; i<=n; i++) {
      if (!is_composite[i]) {
        cnt++;
        for (int j=i+i; j<=n; j+=i) is_composite[j] = true;
      }
    }

    printf("%d\n", cnt);
  }
}

Measured memory_bytes: 3544
import java.util.Scanner;

public class Main {

    public static void main( String[] args ){

        Scanner in = new Scanner(System.in);
        int s = Integer.parseInt(in.nextLine());
        int big = s/100;
        int small = s%100;

        boolean bigIsMM = big != 0 && big <= 12;
        boolean smallIsMM = small != 0 && small <= 12;

        if( bigIsMM && smallIsMM ){
            System.out.println("AMBIGUOUS");
        }
        else if( bigIsMM && !smallIsMM){
            System.out.println("MMYY");
        }
        else if( !bigIsMM && smallIsMM ){
            System.out.println("YYMM");
        }
        else {
            System.out.println("NA");
        }
    }
}

Measured memory_bytes: 23892
#include <bits/stdc++.h>
using namespace std;
int main(){
	int a[7] = {1,3,5,7,8,10,12};
	int b[7] = {0,0,0,4,6,9,11};
	int c,x,y;
	cin >> x >> y;
	c=2;
	for (int i=0;i<=6;i++){
		for(int j=0;j<=6;j++){
			if((x==a[i]&&y==a[j])||(x==b[i]&&y==b[j])||(x==c&&y==c)){
				cout << "Yes" << endl;
				return 0;
			}
		}
      }		
	cout << "No" <<endl;
	return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <iomanip>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <stack>
#include <queue>

#define FOR(i, b, e) for(ll i = (ll)(b); i < (ll)(e); ++i)
#define RFOR(i, b, e) for(ll i = (ll)(e-1); i >= (ll)(b); --i)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) RFOR(i, 0, n)
#define REPC(x,c) for(const auto& x:(c))
#define VS vector<string>
#define VL vector<long long>
#define VI vector<int>
#define VVI vector<vector<int>>
#define VVL vector<vector<ll>>
#define ALL(x) (x).begin(),(x).end()
#define SORT(x) sort(ALL(x))
#define RSORT(x) sort((x).rbegin(),(x).rend())
#define PAIR pair<ll,ll>
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

using  ll = long long;
constexpr ll MOD = 1000000007;
using std::cout;
using std::endl;
using std::cin;
using std::sort;
using std::pair;
using std::string;
using std::stack;
using std::vector;
using std::list;
using std::map;
using std::unordered_map;
using std::multimap;
using std::unordered_multimap;
using std::set;
using std::unordered_set;
using std::multiset;

ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
ll pow(ll a, ll b) {
	ll ans = 1;
	while (b > 0) {
		if (b % 2 == 1) {
			ans *= a;
			ans %= MOD;
		}
		b /= 2;
		a *= a;
		a %= MOD;
	}
	return ans;
}
ll comb(ll a, ll b) {
	if (a - b < b) { return comb(a, a - b); }
	ll c = 1;
	FOR(i, a - b + 1, a + 1) {
		c *= i;
		c %= MOD;
	}
	ll k = 1;
	FOR(i, 2, b + 1) {
		k *= i;
		k %= MOD;
	}
	c *= pow(k, MOD - 2);
	return c % MOD;
}
multiset<ll> prime_decomposition(ll n) {
	ll i = 2;
	multiset<ll> table{};
	while (i * i <= n) {
		while (n % i == 0) {
			n /= i;
			table.emplace(i);
		}
		++i;
	}
	if (n > 1) {
		table.emplace(n);
		return table;
	}
	return table;
}
/*
-- bit --
REP(i, (1 << n)) {
	REP(j, n) {
		cout << (1 & (i >> j));
	}
	cout << endl;
}
*/
int main() {
	int n = 0;
	cin >> n;
	VVL f;
	f.reserve(n);
	REP(i, n) {
		VL v(10);
		REP(j, 10) { cin >> v[j]; }
		f.emplace_back(v);
	}
	VVL p;
	p.reserve(n);
	REP(i, n) {
		VL v(11);
		REP(j, 11) { cin >> v[j]; }
		p.emplace_back(v);
	}

	ll max = -1e10;
	FOR(i, 1, (1 << 10)) {
		ll tmp = 0;
		REP(k, n) {
			ll c = 0;
			REP(j, 10) {
				//cout << (1 & (i >> j));
				if (1 & (i >> j)) {
					if (f[k][j]==1) {
						++c;
					}
				}
			}
			tmp += p[k][c];
		}
		max = std::max(max, tmp);
	}
	cout << max << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <numeric>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <cassert>
#include <cstdarg>
#include <sys/time.h>
#include <fstream>
//#include "cout.h"

using namespace std;

#define SZ(x) ((int)x.size())
#define MSET(x,a) memset(x, a, (int)sizeof(x))
#define PB push_back
#define VI vector < int >
#define PII pair < int, int >
#define LL long long
#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(), (v).end()
#define FIT(it,v) for (__typeof((v).begin()) it = (v).begin(); it != (v).end(); it++)
#define OUT(A) cout << #A << " = "<< (A) << endl
#define OUT2(A, B) cout << "(" << #A << ", " << #B << ") = (" << (A) << ", "<< (B) << ")" << endl
template<class T> void chmin(T &t, T f) { if (t > f) t = f; }
template<class T> void chmax(T &t, T f) { if (t < f) t = f; }

#define present(c, e) ((c).find((e)) != (c).end())
#define cpresent(c, e) (find(ALL(c), (e)) != (c).end())



void init() {

}

void input() {

}

void solve() {
    int a, b, c;
    cin >> a >> b >> c;
    int res = 0;
    chmax(res, a*10 + b + c);
    chmax(res, a + b*10 + c);
    chmax(res, a + b + c*10);
    cout << res << endl;
}

int main() {
	init();
	input();
	solve();
	return 0;
}


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

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

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

using namespace std;

unsigned long long getXorFromZero(unsigned long long n) {
    if (n % 2) {
        return (n + 1) / 2 % 2;
    } else {
        return n ^ ((n / 2 % 2) ? 1 : 0);
    }
}

int main() {
    unsigned long long i, j; cin >> i >> j;
    cout << (getXorFromZero(i - 1) ^ getXorFromZero(j)) << endl;
}

Measured memory_bytes: 256
// This file is a "Hello, world!" in Java language by OpenJDK for wandbox.
import java.util.*;
import java.io.*;
import java.math.BigInteger;

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

	void run() {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int K = sc.nextInt();
		int[] p = new int[3];
		for (int i = 0; i < 3; ++i)
			p[i] = sc.nextInt();
		char[] T = sc.next().toCharArray();
		long[][] dp = new long[N / K + 1][3];
		long ans = 0;
		for (int mod = 0; mod < K; ++mod) {
			for (int i = 0; i < dp.length; ++i)
				for (int j = 0; j < dp[i].length; ++j)
					dp[i][j] = 0;
			int last = 0;
			for (int i = 0; i * K + mod < N; ++i) {
				for (int j = 0; j < 3; ++j) {
					for (int k = 0; k < 3; ++k) {
						if (j == k)
							continue;
						long add = 0;
						if (T[i * K + mod] == 'r' && j == 0)
							add += p[2];
						else if (T[i * K + mod] == 's' && j == 1)
							add += p[0];
						else if (T[i * K + mod] == 'p' && j == 2)
							add += p[1];
						dp[i][j] = Math.max(dp[i][j], (i > 0 ? dp[i - 1][k] : 0) + add);
					}
				}
				last = i;
			}
			ans += Math.max(dp[last][0], Math.max(dp[last][1], dp[last][2]));
		}
		System.out.println(ans);
	}

	void tr(Object... objects) {
		System.out.println(Arrays.deepToString(objects));
	}
}

// OpenJDK reference:
//   http://openjdk.java.net/

// Java language references:
//   http://docs.oracle.com/javase


Measured memory_bytes: 30504
#include <iostream>
using namespace std;
int main(void){
    int a,b,c;
    cin>>a>>b>>c;
    if(a<c&&c<b)
    cout<<"Yes"<<endl;
    else if(a>c&&c>b)
    cout<<"Yes"<<endl;
    else
    cout<<"No"<<endl;
    
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n, b;
	bool card[4][14];
	char a;
	//初期化
	for (int i=0; i < 4; i++){
		for(int j=1; j<=13; j++){
			card[i][j] = false;
		}
	}

   cin >> n;
    for(int i = 0; i < n; i++){
       cin >> a >> b;
       if (a == 'S') card[0][b] = true;
       if (a == 'H') card[1][b] = true;
       if (a == 'C') card[2][b] = true;
       if (a == 'D') card[3][b] = true;
    }

    for(int i = 0; i < 4; i++){
       for(int j = 1; j<= 13; j++){
            if(card[i][j] == false){
                if( i == 0)   a = 'S';
                if( i == 1)   a = 'H';
                if( i == 2)   a = 'C';
                if( i == 3)   a = 'D';
            cout << a << " " << j << endl;
            }
            else continue;
       }

   }

   return 0;
}


Measured memory_bytes: 3092
#include <iostream>
#include <set>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
using ll = long long;

ll n;
ll a[100010];
ll l[100010];

ll index(ll x){
    ll rt;
    if(x<0){
        rt=0;
    }else if(x>100000){
        rt=n+1;
    }else{
        rt=x;
    }

    return rt;
}

int main(void){
    cin>>n;
    rep(i,n){
        cin>>a[i+1];
        l[a[i+1]]=i+1;
    }

    set<ll> s;
    s.insert(100010+2);
    s.insert(100010+1);
    s.insert(-1);
    s.insert(-2);
    
    s.insert(l[n]);
    ll c,w,x,y,z;
    ll ans=0;
    rep(i,n-1){
        ll ii=n-1-i;
        ll j=l[ii];
        s.insert(j);
        auto it=s.find(j);
        it--;
        it--;
        w=index(*it);
        it++;
        x=index(*it);
        it++;
        c=index(*it);
        it++;
        y=index(*it);
        it++;
        z=index(*it);
        
        ans+=ii*((x-w)*(y-c)+(c-x)*(z-y));
    }
    cout<<ans;
    
}





Measured memory_bytes: 6528
import java.io.IOException;
import java.io.InputStream;
import java.util.Scanner;

class Main
{
	public static void main(String[] args) throws Exception
	{
		invoke(System.in);
	}

	public static void	invoke(InputStream is) throws IOException
	{
		try (Scanner in = new Scanner(is))
		{
			int n = in.nextInt();
			int a = in.nextInt();
			int b = in.nextInt();


			int	diff = b - a;
			if (diff % 2 == 0)
			{
				System.out.println("Alice");
			}
			else
			{
				System.out.println("Borys");
			}
		}
	}

}


Measured memory_bytes: 21844
#include <iostream>
#include <string>
#include <sstream>
using namespace std;

int main ()
{
    string str;
    getline(cin,str);
    stringstream ss;
    for (int i = 0; i < str.size(); i++) {
        if (str[i] == '.' || str[i] == ',') str[i] = ' ';
    }
    ss << str;
    bool flag = false;
    while (ss >> str) {
        if (str.size() < 7 && str.size() > 2) {
            if (flag) cout << " ";
            flag = true;
            cout << str;
        }
    }
    cout << endl;

    return 0;
}

Measured memory_bytes: 1196
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp> // <-- add!!!
#define rep(i,n) for(int i = 0; i < n; i++)
#define REP(i,s,n) for(int i = s; i < n; i++)
#define INF 1000000007
typedef long long ll;
using namespace std;
using namespace boost::multiprecision;
using Graph = vector<vector<int>>;
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll lcm(ll a, ll b) { return (a * b) / gcd(a,b); }
ll ceil(const ll a, const ll b) { return (a + b - 1) / b; }
int main(){
  int n;
  cin >> n;
  cpp_int ans = 1;
  bool ok = false,zero = false;
  rep(i,n){
    cpp_int num;
    cin >> num;
    if(0 == num)zero = true;
    if(!ok)ans *= num;
    if(ans > 1000000000000000000){
      ok = true;
    }
  }
  if(zero){
    cout << 0 << endl;
    return 0;
  }
  else if(ok)cout << -1 << endl;
  else cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3696
/*
これを入れて実行
g++ code.cpp
./a.out
 */

#include <iostream>
#include <vector>
#include <string>
#include <queue>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <cmath>
#include <tuple>
#include <iomanip>

using namespace std;
typedef long long ll;
typedef long double ld;

int dy4[4] = {-1, 0, +1, 0};
int dx4[4] = {0, +1, 0, -1};
int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
int dx8[8] = {0, 1, 1, 1, 0, -1, -1, -1};

const long long INF = 1LL << 60;
const ll MOD = 1e9 + 7;

bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
    return f.second > s.second;
}

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

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

ll nCr(ll n, ll r){
    if(r == 0 || r == n){
        return 1;
    } else if(r == 1){
        return n;
    }
    return (nCr(n - 1, r) + nCr(n - 1, r - 1));
}

ll nPr(ll n, ll r){
    r = n - r;
    ll ret = 1;
    for (ll i = n; i >= r + 1; i--) ret *= i;
    return ret;
}

//-----------------------ここから-----------

int main(void){
    int a, b;
    cin >> a >> b;

    if(a + b >= 10){
        cout << "error" << endl;
    } else {
        cout << a + b << endl;
    }
}

Measured memory_bytes: 256