akhauriyash/Code-Regression huggingface dataset:
import sys
import math
import fractions
import bisect
import queue
import heapq
from collections import deque
sys.setrecursionlimit(4100000)

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

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

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

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

改行あり
x = []
y = []
for i in range(N):
    x1,y1=[int(i) for i in input().split()]
    x.append(x1)
    y.append(y1)

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

'''

"""""""""""""""""""""""""""""""""
 最大公約数 O()
"""""""""""""""""""""""""""""""""
# fractions.gcd(a,b)
def gcd(a, b):
    return fractions.gcd(a, b)

"""""""""""""""""""""""""""""""""
 最小公倍数 O()
"""""""""""""""""""""""""""""""""
def lcm(a,b):
    return (a*b) // fractions.gcd(a,b)


N, M = map(int, input().split())
A = list(map(int,input().split()))


twice = 1
while True:
    if A[0] % (twice*2) == 0:
        twice*=2
    else:
        break

for a in A:
    if a%twice != 0:
        print(0)
        sys.exit()
    elif a%(twice*2) == 0:
        print(0)
        sys.exit()


half = 1
for a in A:
    half = lcm(half, a//2)

ans = (M//half + 1) // 2
print(int(ans))





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

int main( void )
{
	int N ;
	scanf( "%d" ,&N ) ;

	int A ,B ;
	scanf( "%d %d" ,&A ,&B ) ;

	if( abs( A - B ) % 2 == 0 )
	{
		puts( "Alice" ) ;
	}
	else
	{
		puts( "Borys" ) ;
	}

	return 0 ;
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <bitset>
#include <random>
#include <chrono>
#include <complex>
#include <algorithm>
#include <utility>
#include <functional>
#include <cmath>
#include <cstring>
#include <cassert>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iomanip> 

using namespace std;

#define sqr(x) ((x)*(x))
#define mp make_pair
#define pb push_back
#define FOR(i,a,b) for (int i = (a); i <= (b); i++)
#define RE(i, n) FOR(i,1,n)
#define REP(i,n) FOR(i, 0, (int)(n)-1)
#define fst first
#define snd second

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;
typedef long double ld;
typedef tuple<int,int,int> iii;

string to_string(string s) {
    return '"' + s + '"';
}
    
string to_string(const char* s) {
    return to_string((string) s);
}
    
string to_string(bool b) {
    return (b ? "true" : "false");
}
    
template <typename A, typename B>
string to_string(pair<A, B> p) {
    return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
    
template <typename A>
string to_string(A v) {
    bool first = true;
    string res = "{";
    for (const auto &x : v) {
        if (!first) {
            res += ", ";
        }
        first = false;
        res += to_string(x);
    }
    res += "}";
    return res;
}

void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
    cerr << " " << to_string(H);
    debug_out(T...);
}

void fastIO() {
    cin.sync_with_stdio(false);
    cin.tie(0);
}


int XMOV[4] = {0, 0, 1, -1};
int YMOV[4] = {1, -1, 0, 0};

//#############################
const int MAXN = 1000005;

int main() {
    deque<char> a, ra;
    int q;
    string s;

    cin >> s >> q;
    REP(i,s.size())
        a.push_back(s[i]), ra.push_front(s[i]);

    map<int, deque<char>> m;
    m[0] = a, m[1] = ra;

    int t, f;
    char x;
    bool cur = 0;
    REP(i, q) {
        cin >> t;
        if (t == 1)
            cur = !cur;
        else{
            cin >> f >> x;
            if (f == 1 && cur == 0){
                m[0].push_front(x);
                m[1].push_back(x);
            }
            else if (f == 2 && cur == 0){
                m[0].push_back(x);
                m[1].push_front(x);
            }
            else if (f == 1 && cur == 1) {
                m[1].push_front(x);
                m[0].push_back(x);
            }
            else{
                m[1].push_back(x);
                m[0].push_front(x);
            }
        }
    }

    while(!m[cur].empty()){
        cout << m[cur].front(), m[cur].pop_front();
    }
    cout << "\n";
    return 0;
}

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

int main(){
  int a, b, c;
  cin >> a >> b >> c;
  if(a == b && a != c) cout << "Yes" << endl;
  else if(a == c && a != b) cout << "Yes" << endl;
  else if(c == b && a != c) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 256
//include
//------------------------------------------
#include <bits/stdc++.h> // only for GCC

using namespace std;

//typedef
//------------------------------------------
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef pair<int, int> pii;
typedef long long ll;
typedef unsigned long long ull;

//container util
//------------------------------------------
#define all(a)  (a).begin(),(a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define pb push_back
#define mp make_pair

//repetition
//------------------------------------------
#define loop(i,a,b) for(ull i=(a);i<ull(b);++i)
#define rep(i,n) loop(i,0,n)
#define iter(i,c) for(auto i=(c).begin(); i!=(c).end(); ++i)
#define riter(i,c) for(auto i=(c).rbegin(); i!=(c).rend(); ++i)

//constant
//--------------------------------------------
const double eps = 1e-10;
const double pi  = acos(-1.0);
const double inf = (int)1e8;

// output vector
// ------------------------------------------
namespace std {
    template<typename T>ostream&operator<<(ostream&os, vector<T>const&v){
        iter(it,v) os<<*it<<(it+1==v.end()?"":",");
        return os;
    }
    template<typename T, typename U>ostream&operator<<(ostream&os,const pair<T,U>&p){
        return os << "[" << p.dirst << "," << p.second << "]";
    }
}

//clear memory
// ------------------------------------------
#define clr(a,i) memset((a), (i) ,sizeof(a))

int main(){
   int n;
   map<int,bool> a;
   rep(i,31) a[i]=true;
   while(cin >> n){
      a[n]=false;
   }
   loop(i,1,31){
      if(a[i]==true) cout << i << endl;
   }
}

Measured memory_bytes: 1188
cnt=0;p=0
N,M,C=map(int,input().split())
B=list(map(int,input().split()))
A=[list(map(int, input().split())) for t in range(N)]
cnt=0;p=C
#print(B)
#print(A)
for i in range(N):
  for j in range(M):
    p=p+A[i][j]*B[j]
  if p>0:
    cnt+=1
  p=C
print(cnt)

Measured memory_bytes: 3064
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>
#include <ctype.h>
#include <stdint.h>
#include <string.h>
#include <wchar.h>

#define N_MAX (100)
#define P_MAX (100)
#define DP_ARRAY_SIZE (N_MAX * P_MAX / 32 + 1)

#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define ABS(a) ((a) < 0 ? -(a) : (a))
#define ABSS(a, b) ((a) > (b) ? (a) - (b) : (b) - (a))

int compare_f(const void *a, const void *b) {
	return *((size_t *)a) < *((size_t *)b) ? -1 : 1;
}

static size_t comb(const size_t n, const size_t r) {
	size_t result = 1;

	for (size_t i = 0; i < r; i++) {
		result *= n - i;
		result /= i + 1;
	}

	return result;
}

static uint64_t gcd(uint64_t m, uint64_t n)
{
	uint64_t temp;

	while (m%n != 0) {
		temp = n;
		n = m % n;
		m = temp;
	}

	return n;
}

size_t dfs(const size_t N, const size_t A, const size_t B, const size_t C, const size_t *l, const size_t idx, const size_t aCur, const size_t bCur, const size_t cCur)
{
	if (idx == N) {
		if (aCur == 0 || bCur == 0 || cCur == 0) {
			return (size_t)1000000;
		}
		else {
			return ABSS(A, aCur) + ABSS(B, bCur) + ABSS(C, cCur);
		}
	}

	const size_t ret0 = dfs(N, A, B, C, l, idx + 1, aCur, bCur, cCur);
	const size_t ret1 = dfs(N, A, B, C, l, idx + 1, aCur + l[idx], bCur, cCur) + 10;
	const size_t ret2 = dfs(N, A, B, C, l, idx + 1, aCur, bCur + l[idx], cCur) + 10;
	const size_t ret3 = dfs(N, A, B, C, l, idx + 1, aCur, bCur, cCur + l[idx]) + 10;

	return MIN(MIN(ret0, ret1), MIN(ret2, ret3));
}

int main(void) {
	size_t A, B;

	scanf("%zu %zu", &A, &B);

	printf("%zu\n", (B%A == 0 ? A + B : B - A));

	return 0;
}


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

#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define rep(i, k, n) for (int i = (int)(k); i < (int)(n); ++i)
#define rrep(i, k, n) for (int i = (int)(n) - 1; i >= (int)(k); --i)

typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<vi> vvi;
typedef vector<vii> vv_ii;
typedef pair<int,ii> i_ii;
typedef vector<i_ii> vi_ii;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;

template <class T>
inline ostream& operator<<(ostream & o, vector<T> const& v) {
    for (int i = 0; i < (int)(v.size()) - 1; ++i)
        o << v[i] << ' ';
    if (!v.empty())
        o << v.back();
    return o;
}

template <class T, class Q>
inline ostream& operator<<(ostream & o, pair<T,Q> const& p) {
    o << "(" << p.fi << "," << p.se << ")";
    return o;
}


int main(){

    ios::sync_with_stdio(false);
    cin.tie(nullptr); cout.tie(nullptr);

    int n;
    string s;
    cin >> n >> s;

    string t = "";
    bool ans = n % 2 == 0;
    for (int i = 0; i < n / 2 && ans; ++i) {
        if (s[i] != s[i + (n / 2)]) {
            ans = false;
            break;
        }
    }
    cout << (ans ? "Yes\n" : "No\n");


    return 0;
}

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


int main(){
    set<pair<int, int> > st;

    int n, m;
    cin >> n;

    int a, b;
    for(int i = 0;i < n;i++){
        cin >> a >> b;
        st.insert(make_pair(a, b));
    }

    cin >> m;
    for(int i = 0;i < m;i++){
        cin >> a >> b;
        st.insert(make_pair(a, b));
    }



    queue<pair<int, int> > que;
    for(auto itr = st.begin();itr != st.end();itr++){
        que.push(make_pair((*itr).first, (*itr).second));
    }

    while(!que.empty()){
        printf("%d:%02d", que.front().first, que.front().second);
        que.pop();
        if(!que.empty()){
            cout << " ";
        }
    }

    cout << endl;
    return 0;

}



Measured memory_bytes: 3180
import sys, bisect, math, itertools, string, queue, copy
# import numpy as np
# import scipy
from collections import Counter,defaultdict,deque
from itertools import permutations, combinations
from heapq import heappop, heappush
input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(input()) # n=1
def inpm(): return map(int,input().split()) # x=1,y=2
def inpl(): return list(map(int, input().split())) # a=[1,2,3,4,5,...,n]
def inpls(): return list(input().split())  # a=['1','2','3',...,'n']
def inplm(n): return list(int(input()) for _ in range(n)) # x=[] 複数行
def inplL(n): return [list(input()) for _ in range(n)]
def inplT(n): return [tuple(input()) for _ in range(n)]
def inpll(n): return [list(map(int, input().split())) for _ in range(n)] # [[1,1,1,1],[2,2,2,2],[3,3,3,3]] 
def inplls(n): return sorted([list(map(int, input().split())) for _ in range(n)]) # [[1,1,1,1],[2,2,2,2],[3,3,3,3]] 
def graph():
    n=inp()
    g=[[] for _ in range(n)]
    for i in range(n):
        a = inp()
        a -= 1
        g[i].append(a)
        g[a].append(i)
    return n,g

def rotation_find(n,m,g): # 迷路を外側からぐるぐると探索 
    did = [[False for _ in range(m+2)] for _ in range(n+2)]
    for i in range(n+2):
        did[i][0]=True
        did[i][m+1]=True
    for i in range(m+2):
        did[0][i]=True
        did[n+1][i]=True
    x = 1
    y = 1
    key = 1
    ans = []
    while True:
        did[x][y] = True
        key1 = 0
        if g[x-1][y-1]%2 != 0:
            key1 = 1
        a,b = x,y
        if key==1:
            x+=1
        elif key==2:
            y+=1
        elif key==3:
            x-=1
        elif key==4:
            y-=1
        if key==1 and did[x][y]:
            x-=1
            y+=1
            key=2
        elif key==2 and did[x][y]:
            y-=1
            x-=1
            key=3
        elif key==3 and did[x][y]:
            x+=1
            y-=1
            key=4
        elif key==4 and did[x][y]:
            x+=1
            y+=1
            key=1
        if did[x][y]:
            break
        if key1:
            g[a-1][b-1] -= 1
            g[x-1][y-1] += 1
            ans.append((a,b,x,y))
    return ans

def main():
    h,w = inpm()
    a = inpll(h)
    ans = rotation_find(h,w,a)
    print(len(ans))
    for i in range(len(ans)):
        print(*ans[i])
 
if __name__ == "__main__":
    main()

Measured memory_bytes: 74968
import heapq
from collections import defaultdict, deque
from math import ceil, factorial, gcd
from itertools import accumulate
import sys
import bisect
import numpy as np

sys.setrecursionlimit(10 ** 7)
INF = float("inf")
MOD = 10 ** 9 + 7

si = lambda: input().strip()
ii = lambda: int(input())
mii = lambda: map(int, input().split())
lmii = lambda: list(map(int, input().split()))
smii = lambda: sorted(map(int, input().split()))

# ----------

N, K = mii()

num = [x for x in range(N+1)]
# num.reverse()

acc = list(accumulate(num))

ans = 0
for i in range(K, N+1):
    if i == 1:
        ans += N + 1
    else:
        tail = acc[N] - acc[N-i]
        head = acc[i-1]
        ans += tail - head + 1
    ans %= MOD

print((ans+1)%MOD)


Measured memory_bytes: 45424
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
  ll N,W; cin >> N >> W;
  ll wt[N], val[N];
  for(int i=0;i<N;i++) {
    ll x, y; cin >> x >> y;
    wt[i] = x; val[i] = y;
  }
  ll K[N+1][W+1];
  for(int i=0;i<=N;i++){
  	for(int j=0;j<=W;j++){
    	if(i==0 || j == 0)
          	K[i][j] = 0;
      else if(wt[i-1] <= j)
        K[i][j] = max(val[i-1]+ K[i-1][j-wt[i-1]], K[i-1][j]);
      else K[i][j] = K[i-1][j];
    }
  }
  cout << K[N][W] << endl;
}

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

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

    if(a == 'D' && b == 'D') cout << 'H' << endl;
    else if(a == 'D' && b == 'H') cout << 'D' << endl;
    else if(a == 'H') cout << b << endl;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text.RegularExpressions;

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

            if (Price < 1000)
            {
                Console.WriteLine(1000 - Price);
            }
            else if (Price > 1000 && Price < 2000)
            {
                Console.WriteLine(2000 - Price);
            }
            else if (Price > 2000 && Price < 3000)
            {
                Console.WriteLine(3000 - Price);
            }
            else if (Price > 3000 && Price < 4000)
            {
                Console.WriteLine(4000 - Price);
            }
            else if (Price > 4000 && Price < 5000)
            {
                Console.WriteLine(5000 - Price);
            }
            else if (Price > 5000 && Price < 6000)
            {
                Console.WriteLine(6000 - Price);
            }
            else if (Price > 6000 && Price < 7000)
            {
                Console.WriteLine(7000 - Price);
            }
            else if (Price > 7000 && Price < 8000)
            {
                Console.WriteLine(8000 - Price);
            }
            else if (Price > 8000 && Price < 9000)
            {
                Console.WriteLine(9000 - Price);
            }
            else if (Price > 9000 && Price < 10000)
            {
                Console.WriteLine(10000 - Price);
            }
            else if (Price > 9000 && Price < 10000)
            {
                Console.WriteLine(10000 - Price);
            }
            else Console.WriteLine('0');
        }
    }
}

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

ll solve() {
    ll N;
    cin >> N;

    vector<ll> ds;
    ds.push_back(1);
    ll x = N-1;
    for ( ll k = 2; k * k <= x; k++ ) {
        if ( x % k == 0 ) {
            ds.push_back(k);
            if ( k*k != x ) ds.push_back(x/k);
        }
    }
    ds.push_back(x);

    for ( ll k = 2; k * k <= N; k++ ) {
        ll n = N;
        for(; n > 0 && (n % k == 0); n /= k ) {
            ll x = n/k - 1;
            if ( x % k == 0 ) {
                ds.push_back(k);
                break;
            }
        }
    }
    ds.push_back(N);

    sort(ds.begin(), ds.end());
    ds.erase(unique(ds.begin(), ds.end()), ds.end());
    ll ans = ds.size() - 1;
    return ans;
}

int main() {
    auto ans = solve();
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();

        if ((a + b) >= c) {
            System.out.println(b + c);
        } else {
            System.out.println(((2 * b) + a + 1));
        }
    }
}

Measured memory_bytes: 23252
n = int(input())
k = int(input())
s = str(n)
d = len(s)
c = 0
if k == 1:
  c += 9*(d-1)
if k == 2:
  c += 9*9*(((d-1)*(d-2))//2)
if k == 3:
  c += 3*9*9*(((d-1)*(d-2)*(d-3))//2)
if k == 1:
  c +=  int(s[0])
  print(c)
  exit()
if k == 2:
  s0 = int(s[0])
  c += (s0-1)*9*(d-1)
  for i in range(1,d):
    if int(s[i]) != 0:
      si = int(s[i])
      c += si + 9*(d-i-1)
      break
  print(c)
  exit()
if k == 3:
  s0 = int(s[0])
  c += (s0-1)*9*9*((d-1)*(d-2)//2)
  mi = 0
  for i in range(1,d):
    if int(s[i]) != 0:
      si = int(s[i])
      c += (si-1)*9*(d-i-1)+9*9*(d-i-1)*(d-i-2)//2
      mi = i
      break
  if mi != 0:
    for j in range(mi+1,d):
      if int(s[j]) != 0:
        sj = int(s[j])
        c += sj + 9*(d-j-1)
        break
  print(c)
  exit()

Measured memory_bytes: 3064
#include <vector>
#include <iostream>
#include <cmath>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <fstream>
#include <unistd.h>
#include <string>
#include <numeric>
#include <queue>
#include <deque>
#include <sstream>
#include <iomanip>
#include <set>
#include <stack>
#include <cassert>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<vvb> vvvb;
typedef vector<vvvb> vvvvb;
typedef vector<string> vs;
typedef vector<vector<string>> vvs;
typedef vector<char> vc;
typedef vector<vector<char>> vvc;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<vvd> vvvd;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
typedef vector<P> vp;
typedef vector<PL> vpl;
typedef vector<vector<P>> vvp;
typedef vector<vector<PL>> vvpl;
const int INF = 1001001001;
const ll LINF = 1e16;
const double pi = 3.1415926535897932;
const string endstr = "\n";
#define FOR(i, a, b) for(ll i = (a); i < b; i++)
#define REP(i, n) for(ll i = 0; i < n; i++)
#define FORMAP(it, m) for(auto it = m.begin(); it != m.end(); it++)
#define ff first
#define ss second
#define pb push_back

template <typename T>
T gcd(T a, T b) {
    return (a == 0) ? b : gcd(b%a, a);
}
template <typename T>
T lcm(T a, T b) {
    return a / gcd(a, b) * b;
}

bool p_comp_fs(const PL p1, const PL p2){ return p1.first < p2.first;};
bool p_comp_fg(const PL p1, const PL p2){ return p1.first > p2.first;};
bool p_comp_ss(const PL p1, const PL p2){ return p1.second < p2.second;};
bool p_comp_sg(const PL p1, const PL p2){ return p1.second > p2.second;};
template <typename T>
vector<T> uniquen(vector<T> vec){
    vec.erase(unique(vec.begin(), vec.end()), vec.end());
    return vec;
}


int main(){
    ll N, M; cin >> N >> M;
    vvl cost(N, vl(N, LINF)); vpl edge;
    REP(i, M){
        ll a, b, c; cin >> a >> b >> c; a--; b--;
        cost[a][b] = c; cost[b][a] = c;
        edge.pb({a, b});
    }
    vvb used(N, vb(N, false));
    
    REP(st, N){
        vl dist(N, LINF); dist[st] = 0;
        priority_queue<PL, vector<PL>, greater<PL>> que;
        que.push({0, st});
        vl prev(N, LINF);
        while(que.size() > 0){
            auto tmp = que.top(); que.pop();
            ll cur = tmp.ss;
            REP(i, N){
                if(cost[cur][i] < LINF){
                    if(dist[i] > dist[cur] + cost[cur][i]){
                        dist[i] = dist[cur] + cost[cur][i];
                        que.push({dist[i], i});
                        prev[i] = cur;
                    }
                }
            }
        }
        REP(j, N){
            if(prev[j] != LINF) used[j][prev[j]] = true;
        }
    }
    ll ans = M;
    REP(i, M){
        ll a = edge[i].ff, b = edge[i].ss;
        if(used[a][b] || used[b][a]) ans--;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define invrepr(i,a,b) for(int i=b-1;i>=a;i--)
#define invrep(i,n) invrepr(i,0,n)
#define repitr(itr,a) for(auto itr=a.begin();itr!=a.end();++itr)
#define P pair<int,ll>
const ll MOD=998244353;
const int INF=1e9;
const double PI=acos(-1);


int main() {
    ios_base::sync_with_stdio(false);

    vector<string> s(3);
    rep(i,3) cin >> s[i];
    rep(i,3) cout << s[i][i];
    cout << endl;

    return 0;

}


Measured memory_bytes: 3576
#include<bits/stdc++.h>
#define ll   long long int
#define pb push_back
#define ff first
#define ss second
#define mp make_pair
#define inf 1000000000000000000LL
#define fast_io	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define mod 1000000007
#define range 2005
#define lg 22
using namespace std;
ll dp[range];
ll red(ll s)
{
	if(s<0)
	return 0;
	if(s==0)
	return 1;
	if(dp[s]!=-1)
	return dp[s]%mod;
	ll x=0;
	for(ll i=3;i<=s;i++)
	{
		x+=red(s-i);
		x%=mod;
	}
	return dp[s]=x%mod;
}
int main()
{
	memset(dp,-1,sizeof(dp));
	ll n;
	cin>>n;
	
	cout<<red(n)<<endl;
}

Measured memory_bytes: 3656
#include <algorithm>
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <string>
#include <sstream>
#include <vector>
#include <set>
#include <stack>
#include <map>
#include <cmath>
#include <queue>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using namespace std;
typedef long long ll;


int main()
{
	int k;
	cin>>k;
	string str;
	cin>>str;
	if( str.length() <= k){
		cout<<str<<endl;
	}else{
		cout<<str.substr(0,k)<<"..."<<endl;
	}
	return 0;
}



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

int main(){
    while(true){
        short n,m,t,p;
        cin>>n>>m>>t>>p;
        if(n==0&&m==0&&t==0&&p==0){
            return 0;
        }
        short Ori[64][64]={{0}};
        for(int y=0;y<m;y++){
            for(int x=0;x<n;x++){
                Ori[y][x]=1;
            }
        }
        for(int i=0;i<t;i++){
            int d,c;
            cin>>d>>c;
            if(d==1){
                for(int x=0;x<c;x++){
                    for(int y=0;y<m;y++){
                        Ori[y][2*c-1-x] += Ori[y][x];
                        Ori[y][x] = 0; 
                    }
                }
                for(int x=0;x<n;x++){
                    for(int y=0;y<m;y++){
                        Ori[y][x]=Ori[y][x+c];
                        Ori[y][x+c]=0;
                    }
                }
            }else{
                for(int y=0;y<c;y++){
                    for(int x=0;x<n;x++){
                        Ori[2*c-1-y][x] += Ori[y][x];
                        Ori[y][x] = 0; 
                    }
                }
                for(int y=0;y<m;y++){
                    for(int x=0;x<n;x++){
                        Ori[y][x]=Ori[y+c][x];
                        Ori[y+c][x]=0;
                    }
                }
            }
        }
        for(int i=0;i<p;i++){
            int x,y;
            cin>>x>>y;
            cout<<Ori[y][x]<<endl;
        }
    }
}


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

int main(void) {
	int i;
	char a[128], b[128];
	int zero = (int)('0');
	int da, db;
	int ifequal;
	int lena, lenb;
	char buf[128], *ch;

	fgets(a, sizeof(buf), stdin);
	fgets(b, sizeof(buf), stdin);

	lena = strlen(a);
	lenb = strlen(b);
	if(a[lena - 1] == '\n') {
		lena -= 1;
		lenb -= 1;
	}
	if(lena > lenb) {
		printf("GREATER\n");
	} else if(lena < lenb) {
		printf("LESS\n");
	} else {
		ifequal = 1;
		for(i = 0; i < lena; i += 1) {
			da = (int)a[i] - zero;
			db = (int)b[i] - zero;
			if(da > db) {
				printf("GREATER\n");
				ifequal = 0;
				break;
			} else if(da < db) {
				printf("LESS\n");
				ifequal = 0;
				break;
			}
		}
		if(ifequal == 1) {
			printf("EQUAL\n");
		}
	}

	return 0;
}


Measured memory_bytes: 1944
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <cmath>
#include <iomanip>
#include <bitset>
#include <string>
#include <stdlib.h>
using namespace std;
//cout <<  << endl;
typedef long long int ll;
typedef long double ld;

int main(){
    ll a,b;
    cin >> a >> b;
    cout << max(max(a+b,a*b),max(a-b,a*b)) << endl;
    return 0;
}


Measured memory_bytes: 256
/* Hardwork allways pays off */
//You never know how close to the solution you are ,so keep practicing
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define endl '\n'
#define mod 1000000007
#define REP(i,n) for(ll i=1;i<=n;i++)
#define tol(s) transform(s.begin(),s.end(),s.begin(),::tolower)
#define tou(s) transform(s.begin(),s.end(),s.begin(),::toupper)
#define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define all(x) (x).begin(), (x).end()
void make_unique(vector<ll> vec)
{
sort(all(vec));
vec.resize(unique(all(vec)) - vec.begin());
}

int main() 
 {   ios;
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    int t=1;
    //  cin>>t; 
    while(t--)
      {ll l,k,p,a,b,c,n,m,i,j,flag=0,count=0,move=0;
       cin>>n;
       for(i=1;i<=(n);i++)
       {  if(i*i<n)
           { if(n%i==0)
             { ll a1=i;
               ll a2=n/i-1;
                count+=2*(a2-a1)+1;
              
             }
            else
             count+=2*((n/i)-i)+1; 
            
            
           }
       }
       cout<<count<<endl;

        
      }
	return 0;
}


Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod = 1e9+7;
ll dp[101][4][4][4];

int main(){
	int N;
	cin >> N;
	dp[0][3][3][3] = 1;
	for(int len=0; len<N; len++){
		for(int c1=0; c1<4; c1++){
			for(int c2=0; c2<4; c2++){
				for(int c3=0; c3<4; c3++){
					for(int c4=0; c4<4; c4++){
						if(c2 == 0 && c3 == 1 && c4 == 2) continue;
						if(c2 == 1 && c3 == 0 && c4 == 2) continue;
						if(c2 == 0 && c3 == 2 && c4 == 1) continue;
						if(c1 == 0 && c3 == 1 && c4 == 2) continue;
						if(c1 == 0 && c2 == 1 && c4 == 2) continue;
						dp[len+1][c2][c3][c4] += dp[len][c1][c2][c3];
						dp[len+1][c2][c3][c4] %= mod;
					}
				}
			}
		}
	}
	ll ans = 0;
	for(int i=0; i<4; i++){
		for(int j=0; j<4; j++){
			for(int k=0; k<4; k++){
				ans += dp[N][i][j][k];
			}
		}
	}
	ans %= mod;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
	// 入力
	int N;
	cin >> N;

	int answer = 0;	
	// 1以上 N以下の奇数で回す
	for (int i = 1; i <= N; i += 2)
	{
		// 約数のカウント
		int divisorCount = 0;
		
		for (int j = 1; j <= i; j++) {
			// 約数をはその数を割ることができる（余りがゼロ）数
			if (i % j == 0) {
				divisorCount++;
			}
		}
		
		// 約数の数が8個の場合
		if (divisorCount == 8)
		{
			answer++;
		}
	}
	
	cout << answer << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<math.h>
#include<queue>

using namespace std;

string s[200];

int n;
vector<int> used;
vector<vector<int>> usededge;
vector<int> v;

int dfs(int k, vector<int> childs){
  int ret = k;
  vector<int> lay;
  for(auto now:childs){
    used[now] = 1;
    for(int i = 0; i < n; i++){
      if(usededge[now][i] || s[now][i] == '0') continue;
      if(v[i] == k) return -1;
      if(used[i]) continue;
      usededge[now][i] = 1;
      usededge[i][now] = 1;
      lay.push_back(i);
      v[i] = k+1;
    }
  }
  if(!lay.empty()) ret = dfs(k+1, lay);
  if(ret == -1) return -1;
  return ret;
}

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

  for(int i = 0; i < n; i++){
    used = vector<int>(n, 0);
    usededge = vector<vector<int>>(n, vector<int>(n,0));
    vector<int> childs = {i};
    v = vector<int>(n, 0);
    ans = max(ans, dfs(1, childs));
  }
  if(ans == 0) cout << -1 << endl;
  else cout << ans << endl;
}


Measured memory_bytes: 788
n = int(input())
h = [int(i) for i in input().split()]
ans = []
tmp = 0
if len(h) == 1:
    print(0)
    exit()

for i in range(1,len(h)):
    if h[i-1] - h[i] >= 0:
        tmp += 1
    else:
        tmp = 0
    ans.append(tmp)

print(max(ans))



Measured memory_bytes: 64228
import sys
sys.setrecursionlimit(10**6)
N, K = map(int, input().split())
MOD = 10**9 + 7

U = [0]; V = []
for x in range(1, int(N**.5)+1):
    U.append(x)
    if x < N//x:
        V.append(N//x)
V.reverse(); U.extend(V)

L = len(U)
S = [1]*L
S[0] = 0
for k in range(K-1, -1, -1):
    T = [0]*L
    r = 0
    for i in range(1, L):
        x = U[i-1]; y = U[i]
        T[i] = r = ((y - x) * S[L-i] + r) % MOD
    S = T
print(S[-1])

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

using ll = long long;
using ull = unsigned long long;
using st = string;
using db = double;
using vll = vector<long long>;
using vvll = vector<vll>;
using vchar = vector<char>;
#define rep(i, m, n) for (int i = (int)(m); i < (int)(n); i++)
#define vrep(i, vec) for(auto& i : vec)
#define vin(vec) for(auto& i : vec) cin >> i
#define all(v) v.begin(), v.end()
ll mod = 1000000007;

int main(){
  ll n;
  cin >> n;
  ll fx = 0;
  ll nn = n;
  while(nn > 0){
    fx += nn % 10;
    nn /= 10;
  }
  cout << (n % fx == 0 ? "Yes" : "No") << endl; 
}

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

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

    int a, b, c, d;
    cin >> a >> b >> c >> d;

    int p[100] = {};
    int r = 0;
    for (int i = a; i < b; i++) {
        p[i]++;
    }
    for (int i = c; i < d; i++) {
        p[i]++;
    }
    for (int i = a; i < b; i++) {
        if (p[i] == 2) r++;
    }

    cout << r << endl;

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int calMax(int Senbei[],int R,int C);

int main(){

	int i,j;
	int R,C;	//1<=R<=10,1<=C<=10000;
	int Senbei[10001];
	int S;
	int max;
	
	while(1){
		scanf("%d %d\n",&R,&C);
		if(R==0 && C==0)break;
		for(i=0;i<C;i++)Senbei[i]=0;
		
		for(j=0;j<R;j++){
		for(i=0;i<C;i++){
			scanf("%d",&S);
			Senbei[i]=Senbei[i]|(S*(0x1<<j));
		}
		}
		
		max=calMax(Senbei,R,C);
		
		printf("%d\n",max);
	}
	return 0;
}



int calMax(int Senbei[],int R,int C){
	int max=0;
	int cnt,cntsum;

	int i,j;
	int mask;
	int calSenbei[10001];
	
	for(mask=0;mask<(0x1<<R);mask++){
		for(i=0;i<C;i++){
			calSenbei[i]=mask^Senbei[i];
		}
		cntsum=0;
		for(i=0;i<C;i++){
			cnt=0;
			for(j=0;j<R;j++){
				cnt+=(0x1& (calSenbei[i]>>j));
			}
			if(cnt<R-cnt)cnt=R-cnt;
			cntsum+=cnt;
		}
		if(cntsum>max)max=cntsum;
	}
	return max;
}

Measured memory_bytes: 680
#include <algorithm>
#include <iostream>
#include <string>
using namespace std;
typedef pair<int, int> P;

const int INF = 100000000;

int main()
{
    string a, b;
    cin >> a >> b;
    int n = a.size();
    bool f = false;
    for(int i = 0; i < n; i++){
        if(b[i] == '1') f = true;
    }
    if(!f){
        for(int i = 0; i < n; i++){
            if(a[i] == '1'){
                cout << -1 << endl;
                return 0;
            }
        }
        cout << 0 << endl;
        return 0;
    }
    int r[2003]{0}, l[2003]{0};
    for(int i = 0; i < n; i++){
        for(int j = 0; j < n; j++){
            if(b[(i + j) % n] == '1'){
                r[i] = j;
                break;
            }
        }
        for(int j = 0; j < n; j++){
            if(b[(i + n - j) % n] == '1'){
                l[i] = j;
                break;
            }
        }
    }
    int ans = INF;
    for(int i = 0; i < n * 2; i++){
        P p[2003];
        int k = 0;
        for(int j = 0; j < n; j++){
            if(a[j] != b[(j + i) % n]){
                if(r[j] <= i) p[j] = P(0, 0);
                else p[j] = P(l[j], r[j] - i);
                k++;
            }
            else{
                p[j] = P(0, 0);
            }
        }
        sort(p, p + n, greater<P>());
        int s = p[0].first;
        int t = p[0].second;
        for(int j = 1; j < n; j++){
            s = min(s, t + p[j].first);
            t = max(t, p[j].second);
        }
        ans = min(ans, s * 2 + i + k);
    }
    for(int i = 0; i < n * 2; i++){
        P p[2003];
        int k = 0;
        for(int j = 0; j < n; j++){
            if(a[j] != b[(j + n * 2 - i) % n]){
                if(l[j] <= i) p[j] = P(0, 0);
                else p[j] = P(r[j], l[j] - i);
                k++;
            }
            else{
                p[j] = P(0, 0);
            }
        }
        sort(p, p + n, greater<P>());
        int s = p[0].first;
        int t = p[0].second;
        for(int j = 1; j < n; j++){
            s = min(s, t + p[j].first);
            t = max(t, p[j].second);
        }
        ans = min(ans, s * 2 + i + k);
    }
    cout << ans << endl;
}


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

int N;
int K;
int H[1000000];

int main() {
    cin >> N >> K;
    for (int i = 0; i < N; ++i) {
        cin >> H[i];
    }
    int ans = 0;
    for (int h : H) {
        if (K <= h) {
            ++ans;
        }
    }
    cout << ans << endl;
    return 0;
}
#endif


Measured memory_bytes: 640
#include <iostream>
#include <climits>
#include <stack>
#include <queue>
#include <string>
#include <random>
#include <utility>
#include <cmath>
#include <string.h>
#include <iomanip>
#include <stdlib.h>
#include <algorithm>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
long long int INF = 1e18;
double Pi = 3.141592653589;
const int mod = 1000000007;
// memset(a,0,sizeof(a)); →全部０にする
 
 
int n,q,k;
int i,j;
std::vector<P> tree[100010];
ll d[100005];
int x[100005],y[100005];


void dfs(int node,ll p){
	d[node]=p;
	for(int i=0;i<tree[node].size();i++){
		if(d[tree[node][i].first]!=INF)continue;
		dfs(tree[node][i].first,p+tree[node][i].second);
	}
}





int main(){
	cin>>n;
	for(i=1;i<=n-1;i++){
		int a,b,c;
		cin>>a>>b>>c;
		tree[a].push_back(P(b,c));
		tree[b].push_back(P(a,c));
	}
	cin>>q>>k;
	for(i=1;i<=q;i++){
		cin>>x[i]>>y[i];
	}
	for(i=1;i<=n;i++){
		d[i]=INF;
	}
	dfs(k,0);
	for(i=1;i<=q;i++){
		cout<<d[x[i]]+d[y[i]]<<endl;
	}
	return 0;
}

Measured memory_bytes: 15104
#!/usr/bin/env ruby

require 'set'

class Hash
  def push(key, value)
    self[key] = [] if self[key] == nil
    self[key].push(value)
  end
end

class Array
  def lower_bound(value)
    left = -1;
    right = self.length;
    while left + 1 < right
      mid = left + (right - left) / 2;
      if self[mid] >= value
        right = mid
      else
        left = mid
      end
    end
    right
  end

  def unique
    res = [self.first]
    each_cons(2) do |a, b|
      if a != b
        res.push(b)
      end
    end
    res
  end
end

def get_ints
  gets.chomp.split.map(&:to_i)
end

def get_ints_minus_one
  get_ints.map { |x| x - 1 }
end

def get_int
  gets.chomp.to_i
end

N, M = get_ints
K = []
A = Array.new(N) { [] }
m = Array.new(M+1) { Set.new }

N.times do |i|
  test = get_ints
  K[i] = test[0]
  A[i] = test[1..]
  A[i].each do |a|
    m[a].add(i)
  end
end

puts m.count { |set| set.length == N }


Measured memory_bytes: 14528
import java.util.Scanner;


public class Main {
    
    boolean[][] map;
    
    void run() {
        Scanner sc = new Scanner(System.in);
        sc.next();
        int t = 1;
        while (sc.hasNext()) {
            map = new boolean[8][8];
            
            for (int y = 0; y < 8; y++) {
                String l = sc.next();
                for (int x = 0; x < 8; x++) {
                    map[y][x] = l.charAt(x) - '0' == 1;
                }
            }
            
            dfs(sc.nextInt() - 1, sc.nextInt() - 1);
            System.out.println("Data " + t++ + ":");
            for (int y = 0; y < 8; y++) for (int x = 0; x < 8; x++) {
                System.out.print((map[y][x] ? '1' : '0') + (x == 7 ? "\n" : ""));
            }
        }
    }
    
    int[] dx = {-1,0,1,0}, dy = {0,-1,0,1};
    void dfs(int x, int y) {
        map[y][x] = false;
        
        for (int i = 0; i < 4; i++) {
            for (int nx = x, ny = y, c = 0; !out(nx, ny) && c <= 3; c++) {
                if (map[ny][nx]) dfs(nx, ny);
                nx += dx[i]; ny += dy[i];
            }
        }
    }
    
    boolean out(int x, int y) {
        return x < 0 || y < 0 || x >= 8 || y >= 8;
    }
    
    public static void main(String[] args) {
        new Main().run();
    }
}

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

#define ll long long
#define ull unsigned long long

using namespace std;

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

	double v = a*a*b;
	double ans = 0;
	if (x >= 0.5*v){
		ans = atan(2.0 * (v - x) / (a*a*a));
	} else {
		ans = atan(a*b*b / (2.0*x));
	}

	double pi = atan(1.0) * 4.0;

	// 出力の桁数を細かくする
	cout << fixed << setprecision(10) << ans * 180.0 / pi << "\n";

	return 0;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
    using namespace std;
    int main()
    {
      long long n,q;
      long long k;
      long long score[100005];
      cin>>n>>k>>q;
      for(int i = 0;i < n;i++)
        score[i] = 0;
      for(int i = 0;i < q;i++)
      {
        int a;
        cin>>a;
        score[a-1]++;
      }
      for(int i = 0;i < n;i++)
      {
        if(score[i] + k > q)
          cout<<"Yes"<<endl;
        else
          cout<<"No"<<endl;
      }
    }

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

long long dp[100001][3];
long long n, h[100001][3];

long long go(long long k, long long jour) {
    if(jour == n) return 0;
    if(dp[jour][k] != -1) return dp[jour][k];
    if(k == 0){
        return dp[jour][k] = max(go(1 , jour+1) + h[jour][1], go(2 ,jour+1) + h[jour][2]);
    } else if(k == 1){
        return dp[jour][k] = max(go(0 , jour+1) + h[jour][0], go(2 ,jour+1) + h[jour][2]);
    } else {
        return dp[jour][k] = max(go(0 , jour+1) + h[jour][0], go(1 ,jour+1) + h[jour][1]);
    }
}

int main(){
    ios::sync_with_stdio(0); cin.tie(0);
    memset(dp, -1, sizeof dp);
    cin >> n;
    for(int i = 0; i < n; i++){
        for(int j = 0; j < 3; j++){
            cin >> h[i][j];
        }
    }
//    if(n == 1) cout << max(h[0][0], max(h[0][1], h[0][2]));
//    else
    cout << max(go(0, 0), max(go(1, 0), go(2, 0)));
}


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

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

	int n, m;
	cin >> n >> m;
	bool status[100001]{false};
	int wc_num[100001]{0};
	int correct = 0, wrong = 0;

	rep(i, m) {
		int num;
		string judge;
		cin >> num >> judge;

		if(judge == "WA") {
			wc_num[num]++;
		} else if(judge == "AC" && status[num] == false) {
			status[num] = true;
			wrong += wc_num[num];
			correct++;
		}
	}
	cout << correct << " " << wrong << endl;
	return 0;
}


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

int main(){
    ll n,w;cin>>n>>w;
    vector<ll> profit(n),weight(n);
    for(ll i=0;i<n;i++)cin>>weight[i]>>profit[i];

    vector<ll> dp(100001,INT_MAX);
    dp[0]=0;
    for(ll j=0;j<n;j++){
        for(ll i=100000;i>0;i--){
            if(i-profit[j]>=0 && dp[i-profit[j]]!=INT_MAX){
                dp[i]=min(dp[i],dp[i-profit[j]]+weight[j]);
            }      
        }
    }
    ll maxi=0;
    for(ll i=0;i<100001;i++){
      // cout<<dp[i]<<" ";
        if(dp[i]<=w){
            maxi=i;
        }
    }
    cout<<maxi<<endl;
}

Measured memory_bytes: 4040
#define _USE_MATH_DEFINES
#include <math.h>
#include <time.h>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <iomanip>
#include <iterator>
#include <algorithm>
#include <functional>
#include <typeinfo>
#include <utility>
#include <tuple>

using namespace std;

#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define reprrev(i, a, b) for (int i = (int)(b) - 1; i >= (int)(a); i--)
#define reprev(i, n) reprrev(i, 0, n)

#define PI M_PI
#define INF 1000000000
#define MOD 1000000007;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll>> vvll;
typedef vector<vector<bool>> vvb;
typedef vector<vector<string>> vvs;

constexpr int dir[4][2] = { { 1, 0 }, { 0, 1 }, { -1, 0 }, { 0, -1 } };

template <typename T>
T Pow(T a, int b) {
	T res = 1;
	rep(i, b) res = res * a;
	return res;
}


/*<ここから>***********************************************************/

int N, M;


int main()
{
	cin >> N >> M;
	int res = (1900 * M + (N - M) * 100) * Pow(2, M);

	cout << res << endl;

	return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		int n = Integer.parseInt(br.readLine());

		int k[][] = new int[10][10];

		for (int i = 1; i <= n; i++) {
			int keta = String.valueOf(i).length();
			int top = i / (int) Math.pow(10, keta - 1);
			int bottom = i % 10;

			k[top][bottom]++;
		}

		int ans = 0;
		for (int i = 0; i < 10; i++) {
			for (int j = 0; j < 10; j++) {
				ans += k[i][j] * k[j][i];
			}
		}

		System.out.println(ans);
	}

}

Measured memory_bytes: 43212
import java.util.Scanner;
public class Main {
	static int MAX_DIGIT = 60;
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.next());
		long k = Long.parseLong(sc.next());
		long[] A = new long [n];

		for(int i=0;i<n;i++) {
			A[i] = Long.parseLong(sc.next());
		}
		sc.close();
		long res = 0;
		for(int d = MAX_DIGIT; d >= -1; --d) { // d = -1 は X = k の場合
	        if (d != -1 && !((k & 1L<<d)!=0)) continue;

	        long tmp = 0;
	        for (int e = MAX_DIGIT; e >= 0; --e) {
	            long mask = 1L<<e;
	            int num = 0;
	            for (int i = 0; i < n; ++i) if ((A[i] & mask)!=0) ++num;

	            if (e > d) {
	                if ((k & mask)!=0) tmp += mask * (n - num);
	                else tmp += mask * num;
	            }
	            else if (e == d) {
	                tmp += mask * num;
	            }
	            else {
	                tmp += mask * Math.max(num, n - num);
	            }
	        }
	        res = Math.max(res, tmp);
	    }
	    System.out.println(res);
	}
}

Measured memory_bytes: 47624
#include <bits/stdc++.h>
using namespace std;
#define INF int(1e-6)
#define MAX int(1e9)
typedef long long ll;
typedef long l;




int main (){
	int a;
	set<int>s;
	for(int i = 0; i<3; i++){
		cin >> a;
		s.insert(a);
	}
	if(s.size() == 2){
		cout << "Yes\n";
	}else{
		cout << "No\n";
	}
	return 0;
}



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

const int INF =1e9;
const int MOD =1e9+7;

using namespace std;

typedef long long ll;

#define REP(i, n) for (int i = 0; i < int(n); i++)
#define REPD(i, n) for (int i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (int i = a; i < int(b); i++)
#define FORD(i, a, b) for (int i = b - 1; i >= int(a); i--)
#define WRAP(y, x, h, w) (0 <= y && y < h && 0 <= x && x < w)

#define ALL(x) (x).begin(), (x).end()

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

int main()
{
string s;
cin>>s;
if(s=="AAA"||s=="BBB")
cout<<"No"<<endl;
else
cout<<"Yes"<<endl;

}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
#define ll long long int
using namespace std;

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

    int n,k;
    cin>>n>>k;
    int d[10]={0};
    for(int i=0;i<k;i++)
    {
        int x;
        cin>>x;
        d[x]=1;
    }
    for(int i=n;i<=100000;i++)
    {
        string s=to_string(i);
        int cnt=0;
        for(int j=0;j<s.size();j++)
        {
            if(d[s[j]-'0']==1)
                break;
            cnt++;
        }
        if(cnt==s.size())
        {
            cout<<i<<endl;
            break;
        }
    }
    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#include<cstring>
#define ll long long
using namespace std;
const ll MOD=1000003;
int q;
ll x,d,n,fact[1000005],inv[1000005];
ll quick_pow(ll x,ll a)
{
	ll ans=1;
	while(a)
	{
		if(a&1)ans=ans*x%MOD;
		x=x*x%MOD;
		a>>=1;
	}
	return ans;
}
int main()
{
	fact[0]=1;
	for(int i=1;i<MOD;i++)fact[i]=fact[i-1]*i%MOD;
	inv[MOD-1]=quick_pow(fact[MOD-1],MOD-2);
	for(int i=MOD-1;i>=1;i--)inv[i-1]=inv[i]*i%MOD;
	scanf("%d",&q);
	while(q--)
	{
		scanf("%lld%lld%lld",&x,&d,&n);
		if(d==0)
		{
			printf("%lld\n",quick_pow(x,n));
			continue;
		}
		ll k=quick_pow(d,MOD-2)*x%MOD;
		if(k+n-1>=MOD)printf("0\n");
		else printf("%lld\n",fact[k+n-1]*inv[k-1]%MOD*quick_pow(d,n)%MOD);
	}
	return 0;
}

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

typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
#define ALL(v) (v).begin(),(v).end()
#define CLR(t,v) memset(t,(v),sizeof(t))
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< ")";}
template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cout<<(*i)<<" ";cout<<endl;}
template<class T>void chmin(T&a,const T&b){if(a>b)a=b;}
template<class T>void chmax(T&a,const T&b){if(a<b)a=b;}

int nextInt() { int x; scanf("%d", &x); return x;}
ll nextLong() { ll x; scanf("%lld", &x); return x;}


ll solve(ll N, ll A, ll B) {
  if (A > B) swap(A, B);
  if ((B-A) % 2 == 0) {
    return (B-A) / 2;
  }
  ll res = N+1;
  if (A != 1) {
    ll d = A;
    ll val = d + solve(N, max(1LL, A-d), max(1LL, B-d));
    res = min(res, val);
  } else {
    B--;
    ll val = 1 + (B-A) / 2;
    res = min(res, val);
  }
  if (B != N) {
    ll d = (N-B+1);
    ll val = d + solve(N, min(A+d, N), min(B+d, N));
    res = min(res, val);
  } else {
    A++;
    ll val = 1 + (B-A) / 2;
    res = min(res, val);
  }
  return res;
}
int main2() {
  ll N = nextLong();
  ll A = nextLong();
  ll B = nextLong();
  ll ans = solve(N, A, B);
  cout << ans << endl;
  return 0;
}

int main() {

#ifdef LOCAL
  for (;!cin.eof();cin>>ws)
#endif
    main2();
  return 0;
}


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

int div2(int n)
{
	int cnt = 0;
	while( (n % 2 ) == 0 ) {
		n /= 2;
		cnt++;
	}
	return cnt;
}

int main() {
	int n;
	int a;
	int ans = 0;

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

	cout << ans << "\n";

	return 0;
}


Measured memory_bytes: 256
n,m=map(int,input().split())
ab=[list(map(int,input().split())) for i in range(m)]
ab=sorted(ab, key=lambda x:x[1])
ans=0
bridge=0
for i in range(m):
    if bridge<ab[i][0]:
        ans+=1
        bridge=ab[i][1]-1
print(ans)

Measured memory_bytes: 65240
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#include<string>
#include<tuple>
#include<utility>
#include<stack>
#include<set>
#include<iomanip>
using ll=long long int;
using namespace std;


int main() {

	string s;
	cin >> s;

	bool ans = true;

	for (int i = 0; i < 3; i++) {
		if (s[i] == s[i + 1]) {
			ans = false;
		}
	}

	if (ans) {
		cout << "Good" << endl;
	}
	else {
		cout << "Bad" << endl;
	}
	return 0;
}





Measured memory_bytes: 256