akhauriyash/Code-Regression huggingface dataset:
def main():
    N,K = map(int, input().split())
    p = list(map(int, input().split()))

    temp = 0
    for k in range(K):
        temp += calc_e(p[k])
    res = temp
    for n in range(N-K):
        temp -= calc_e(p[n])
        temp += calc_e(p[n+K])
        if(temp > res): res = temp
    print(res)


def calc_e(pi):
    return(sum(range(1,pi+1))/pi)

if __name__ == "__main__":
    main()


Measured memory_bytes: 71792
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
#define rep(i,n) for(int i = 0; i < ((int)(n)); i++)   // 0-indexed昇順

int main() {
    int N,D;cin >> N >> D;
    vector<vector<int>> X(N, vector<int>(D));
    rep(i,N) {
        rep(j,D) {
            cin >> X[i][j];
        }
    }

    int res = 0;
    rep(i,N) {
        for (int j = i + 1; j < N; j++) {
            int d = 0;
            for (int k = 0; k < D; k++) {
                d += pow(X[i][k] - X[j][k], 2);
            }
            int e = sqrt(d);
            if (d == pow(e,2)) res++;
        }
    }
    cout << res << endl;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Security.Cryptography.X509Certificates;
using System.Text.RegularExpressions;
using Console = System.Console;

namespace Atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var X = int.Parse(Console.ReadLine());
            var A = int.Parse(Console.ReadLine());
            var B = int.Parse(Console.ReadLine());
            Console.WriteLine((X - A) % B);
        }
    }
}

Measured memory_bytes: 11092
using System;

namespace ABC062
{
    class Program
    {
        static void Main(string[] args)
        {
            var groupA = new[] { 1, 3, 5, 7, 8, 10, 12 };
            var groupB = new[] { 4, 6, 9, 11 };

            var s = Console.ReadLine().Split(' ');
            var h = int.Parse(s[0]);
            var w = int.Parse(s[1]);

            Console.WriteLine(new string('#', w + 2));

            for (var i = 0; i < h; i++)
            {
                Console.Write('#');
                Console.Write(Console.ReadLine());
                Console.WriteLine('#');
            }

            Console.WriteLine(new string('#', w + 2));
        }
    }
}


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

#ifdef _DEBUG
#define debug(x) cerr << "line: " << __LINE__ << ", func: " << __func__ << " ->  " << #x << " = " << x << endl
#else
#define debug(x)
#endif

#define all(s) begin(s), end(s)
#define rall(s) rbegin(s), rend(s)
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define rrep(i, a, b) for (int i = ((a)-1); i >= (b); i--)
#define pb push_back
#define sz(a) int((a).size())
#define put(a) ((cout) << (a) << (endl))

using namespace std;

using ll = long long;
using ull = unsigned long long;
using i_i = pair<int, int>;
using ll_ll = pair<ll, ll>;
using d_ll = pair<double, ll>;
using ll_d = pair<ll, double>;
using d_d = pair<double, double>;

static constexpr ll LL_INF = 1LL << 60;
static constexpr int I_INF = 1 << 28;
static constexpr double PI = static_cast<double>(3.14159265358979323846264338327950288);
static constexpr double EPS = numeric_limits<double>::epsilon();

static map<type_index, const char* const> scanType = {
    {typeid(int), "%d"}, {typeid(ll), "%lld"}, {typeid(double), "%lf"}, {typeid(char), "%c"}};

template <class T> static void scan(vector<T>& v);
[[maybe_unused]] static void scan(vector<string>& v, bool isWord = true);
template <class T> static inline bool chmax(T& a, T b);
template <class T> static inline bool chmin(T& a, T b);
template <class A, size_t N, class T> static void Fill(A (&arr)[N], const T& val);

int main(int argc, char* argv[]) {
  ll n, k;
  cin >> n >> k;

  ll edge_max = (n * (n - 1)) / 2;
  if (edge_max - (n - 1) < k) {
    put(-1);
    return 0;
  }

  ostringstream ss;
  ll m = edge_max - k;

  ss << m << endl;
  rep(i, 0, n - 1) { ss << i + 1 << " " << n << endl; }
  m -= n - 1;
  rep(i, 0, n - 1) rep(j, i + 1, n - 1) {
    if (m == 0) break;
    ss << i + 1 << " " << j + 1 << endl;
    m--;
  }

  cout << ss.str();
  return 0;
}

template <class T> static void scan(vector<T>& v) {
  auto tFormat = scanType[typeid(T)];
  for (T& n : v) {
    scanf(tFormat, &n);
  }
}

static void scan(vector<string>& v, bool isWord) {
  if (isWord) {
    for (auto& n : v) {
      cin >> n;
    }
    return;
  }

  int i = 0, size = v.size();
  string s;
  getline(cin, s);

  if (s.size() != 0) {
    i++;
    v[0] = s;
  }

  for (; i < size; ++i) {
    getline(cin, v[i]);
  }
}

template <class T> inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}

template <class T> inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}

template <class A, size_t N, class T> void Fill(A (&arr)[N], const T& val) {
  std::fill((T*)arr, (T*)(arr + N), val);
}


Measured memory_bytes: 384
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <set>
#include <algorithm>
#define ll long long

using namespace std;

int n,a[(int)1e5+10];

int main()
{
    int i,j;
    set<int> s;
    set<int>::iterator itr;
    scanf("%d",&n);
    for(i=0;i<n;i++)
    {
        scanf("%d",&a[i]);
        s.insert(a[i]);
    }
    sort(a,a+n);
    if(s.size()==3)
    {
        int b[3],num[3]={0,0,0};
        itr=s.begin();
        b[0]=*itr++;
        b[1]=*itr++;
        b[2]=*itr;
        for(i=0;i<n;i++)
            for(j=0;j<3;j++)
                if(a[i]==b[j])
                    num[j]++;
        if((b[0]^b[1]^b[2])==0 && num[0]==num[1] && num[1]==num[2])
            puts("Yes");
        else
            puts("No");
    }
    else if(s.size()==1)
    {
        if(a[0]==0)
            puts("Yes");
        else
            puts("No");
    }
    else if(s.size()==2)
    {
        int num[2]={0,0};
        for(i=0;i<n;i++)
        {
            //printf("%d ",a[i]);
            if(a[i]==a[0])
                num[0]++;
            else if(a[i]==a[n-1])
                num[1]++;
        }
        //puts("");
        //printf("%d/%d %d/%d\n",a[0],num[0],a[n-1],num[1]);
        if(a[0]==0 && num[0]*2==num[1])
            puts("Yes");
        else if(a[n-1]==0 && num[1]*2==num[0])
            puts("Yes");
        else
            puts("No");
    }
    else
        puts("No");
    return 0;
}


Measured memory_bytes: 4224
#include <iostream>
#include <stdio.h>

#define LEN 100005
using namespace std;

struct Process {
	char name[10];
	int time;
};

int head, tail;
Process P[LEN];

bool isEmpty(void) {
	return head == tail;
}

//bool isFull(void) {
//	return 
//}

Process deque(void) {
	Process x = P[head];
	head++;
	if (head == LEN) head = 0;
	return x;
}

void enque(Process x) {
//	isFull();
	P[tail] = x;
	tail++;
	if (tail == LEN) tail = 0;
}

int main(void) {
	int n, q;
	Process check;

	scanf("%d %d", &n, &q);
	for (int i = 0; i < n; i++) {
		scanf("%s", P[i].name);
		scanf("%d", &P[i].time);
	}
	head = 0;
	tail = n;

	int now = 0;
	while (!isEmpty()) {
		check = deque();
		if (check.time <= q) {
			now += check.time;
			printf("%s %d\n", check.name, now);
		} else {
			now += q;
			check.time -= q;
			enque(check);
		}
	}


	return 0;
}



Measured memory_bytes: 4724
#include<stdio.h>

int main(void){
	int n;
	int one, two, three;
	
	for(scanf("%d",&n);n!=0;n--){
		scanf("%d %d %d",&one,&two,&three);
		
		if((one*one)+(two*two)==(three*three)){
			printf("YES\n");
		}else if((one*one)+(three*three)==(two*two)){
			printf("YES\n");
		}else if((two*two)+(three*three)==(one*one)){
			printf("YES\n");
		}else{
			printf("NO\n");
		}
	}
	
	return 0;
}

Measured memory_bytes: 0
import java.io.*;
public class Main{
    public static void main(String[] args) throws IOException{
        Reader r = new Reader();      
        int[][] c = new int[3][];
        int sum = 0;
        for(int i = 0; i < 3; i++)
            c[i] = r.ii();
        for(int i = 0; i < 3; i++)
            for(int j = 0; j < 3; j++)
                sum += c[i][j]; 
        boolean flag = true;
        loop:for(int i = 0; i < 3; i++){
            for(int d = 1; d < 3; d++){
                int j = (i+d)%3;
                int k = 3-i-j;
                int s = c[0][i] + c[1][j] + c[2][k];
                if(3*s != sum){
                    flag = false;
                    break loop;
                }
            }
        }
        println(flag ? "Yes" : "No");                
    }
    static void print(Object o){
        System.out.print(o.toString());
    }
    static void println(Object o){
        System.out.println(o.toString());
    }
    static class Reader extends BufferedReader{
        Reader(){
            super(new InputStreamReader(System.in));
        }
        String s() throws IOException{
            return readLine();
        }
        String[] ss() throws IOException{
            return s().split(" ");
        }
        int Int(String s){
            return Integer.parseInt(s);
        }
        int i() throws IOException{
            return Int(s());
        }
        int[] ii() throws IOException{
            String[] ss = ss();
            int size = ss.length;
            int[] ii = new int[size];
            for(int j = 0; j < size; j++) ii[j] = Int(ss[j]);
            return ii;
        }
    }
}

Measured memory_bytes: 21204
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  vector<int> vec(N);
  for(int i = 0; i < N; i++) cin >> vec.at(i);
  sort(vec.begin(),vec.end());
  int ans=0;
  for(int i = 0; i < N-1; i++){
    if(vec.at(i)==vec.at(i+1)) ans++;
  }
  if(ans>0) cout << "NO";
  else cout << "YES";
}

Measured memory_bytes: 1152
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

N, Q = map(int, input().split())
G = [[] for _ in range(N)]
for _ in range(N - 1):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    G[a].append(b)
    G[b].append(a)

val = [0] * (N)
for _ in range(Q):
    p, x = map(int, input().split())
    p -= 1
    val[p] += x

used = [False]*N


def dfs(s):
    stack = []
    stack.append(s)
    while len(stack) > 0:
        now = stack[-1]
        used[now] = True
        stack.pop()
        for nxt in G[now]:
            if used[nxt]:
                continue
            val[nxt] += val[now]
            stack.append(nxt)


dfs(0)

answer = ' '.join(map(str, val[:]))
print(answer)


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

#define rep(i,N) repf(i,0,N)
#define reps(i,N) repfs(i,0,N)
#define repf(i,a,b) for(int i=a;i<b;i++)
#define repfs(i,a,b) for(int i=a+1;i<=b;i++)
#define repr(i,N) for(int i=N-1;i>=0;i--)
#define reprs(i,N) for(int i=N;i>0;i--)

#define d(a) cerr<<#a<<"="<<a<<"."
#define d2(a,b) cerr<<#a<<"="<<a<<","<<#b<<"="<<b<<"."
#define d3(a,b,c) cerr<<#a<<"="<<a<<","<<#b<<"="<<b<<","<<#c<<"="<<c<<"."
#define d4(a,b,c,d) cerr<<#a<<"="<<a<<","<<#b<<"="<<b<<","<<#c<<"="<<c<<","<<#d<<"="<<d<<"."
#define da(arr,N) {{rep(i,N){if(arr[i]==INF)cerr<<"INF ";else cerr<<arr[i]<<" ";} cerr<<endl;}}
#define da2(arr,N,M) {rep(i,N){rep(j,M){if(arr[i][j]==INF)cerr<<" INF";else fprintf(stderr," %3d",arr[i][j]);}cerr<<endl;}}
#define pb push_back
#define pob pop_back

auto chmax =[](int &a,int b){ a = max(a, b);};
auto chmin =[](int &a,int b){ a = min(a, b);};

typedef long long ll;
typedef pair<int,int> P;
const int INF = 100000000;
const int MOD = 1000000007;
const int dx[4] = { 0, 1, 0,-1};
const int dy[4] = { 1, 0,-1, 0};
//--------------------------------------//
int n[100][100];
int a,b,c;
void solve(){
	rep(i,100) rep(j,100) n[i][j]=max(i,j);
	da2(n,100,100);
	if(a+b==c||b+c==a||a+c==b) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
}

int main(){
	cin>>a>>b>>c;
	solve();
	return 0;
}


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

const int N = 2003;
int n, x, y, a[N], d[N];

void nadm(int gw) {
	for(int j = 1; j <= n; ++j) d[j] = 0;
	d[gw] = 1;
	queue<int> q;
	q.push(gw);
	while(q.size()) {
		int dg = q.front();
		if(dg >= gw) ++a[d[dg] - 1];
		q.pop();
		if(dg > 1 && d[dg - 1] == 0) {
			d[dg - 1] = d[dg] + 1;
			q.push(dg - 1);
		}
		if(dg < n && d[dg + 1] == 0) {
			d[dg + 1] = d[dg] + 1;
			q.push(dg + 1);
		}
		if(dg == x && d[y] == 0) {
			 d[y] = d[x] + 1;
			 q.push(y);
		}
		if(dg == y && d[x] == 0) {
			d[x] = d[y] + 1;
			q.push(x);
		}
	}
}

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cin >> n >> x >> y;
	for(int i = 1; i <= n; ++i) {
		nadm(i);
	}
	for(int k = 1; k < n; ++k) {
		cout << a[k] << "\n";
	}
	return 0;
}


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

using namespace std;

int main()
{
	// 入力
	int N, M;
	cin >> N >> M;
	// 好物の配列はM種類、0初期化する。
	vector<int> FavoriteFoodCount(M, 0);
	
	for (int i = 0; i < N; i++)
	{
		int K;
		cin >> K;
		for (int j = 0; j < K; j++)
		{
			int A;
			cin >> A;
			// Aの問題文の出力結果から、indexを出すため1を引く
			A--;
			// 食べ物Aの好物のカウントを1
			FavoriteFoodCount[A]++;
		}
	}
	
	int answer = 0;
	// 好物の配列に対する食べ物の種類
	for (int i = 0; i < M; i++)
	{
		// N人全員の食べ物の場合
		if (FavoriteFoodCount[i] == N)
		{
			answer++;
		}
	}
	
	// 出力
	cout << answer << endl;
	
	return 0;
}

Measured memory_bytes: 256
//#define _CRT_SECURE_NO_WARNINGS
#include "bits/stdc++.h"

#define rep(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007
#define INF (1LL<<60LL)
typedef long long ll;

using namespace std;



int main() {
	ll n, k; cin >> n >> k;
	double ans = 0;
	for (int i = 1; i <= n; i++) {
		ll k2 = i;
		ll res = n;
		while (k2 < k) {
			k2 *= 2;
			res *= 2;
		}
		ans += double(1) / res;
	}
	cout << setprecision(11) << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
const ll mo = 1000000007;
const ll INF = 1LL << 60; //MAX 9223372036854775807
ll ans = 0;

int main()
{
ll n;
cin >> n;
ll t[n] = {};
rep(i, n){
    ll a,b;
    cin >> a >>b;
    t[i]=b*1000000000+a;
}
sort(t,t+n);
ll due=0;
ll now=0;
rep(i,n){
    due=t[i]/1000000000;
    now+=t[i]%1000000000;
    if(due<now){
        cout << "No" << endl;
        return 0;
    }
}

cout << "Yes" << endl;
return 0;
}


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


int main()
{
	
   

    int i;
    string s;
    cin>>s;
    int l = s.length();
    for(i=0;i<l;i++)
        cout<<"x";
    cout<<endl;
    return 0; 

}


Measured memory_bytes: 256
stdin.ReadLine() |> ignore

let hs =
    stdin.ReadLine().Split()
    |> Array.map int
    |> Array.toList

let rec countHotel cnt highest xs =
    match xs with
    | x :: xs ->
        if x >= highest then countHotel (cnt + 1) x xs
        else countHotel cnt highest xs
    | _ -> cnt

countHotel 0 0 hs |> printfn "%d"


Measured memory_bytes: 12764
#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
using namespace std;
#define rep(i,x) for(int i = 0; i < x; i++)
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<vector<vector<int>>> vvvi;
const ll MOD = 1e9+7;
const int n_max = 1e5+10;

void print() {
    cout << endl;
}

template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail) {
    cout << head;
    if (sizeof...(tail) != 0) cout << ' ';
    print(forward<Tail>(tail)...);
}

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

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


int main(){
    string s;cin >> s;
    ll n = s.size() + 1;
    ll INF = INT_MAX;
    vector<ll> a(n, -INF);
    vector<ll> btm;
    rep(i,n-2){
        if(i == 0 && s[i] == '<')btm.push_back(i);
        if(s[i] == '>' && s[i+1] == '<')btm.push_back(i+1);
        if(i == n-3 && s[i+1] == '>')btm.push_back(i+2);
    }
    if(n == 2){
        if(s[0] == '>')btm.push_back(1);
        else btm.push_back(0);
    }
    for(auto i : btm)a[i] = 0;
    // 左に更新
    for(auto i : btm){
        ll temp = 1;
        while(i - temp >= 0 && s[i-temp] == '>'){
            a[i-temp] = temp;
            temp++;
        }
    }
    // 右に更新
    for(auto i : btm){
        ll temp = 1;
        while(i + temp <= n-1 && s[i+temp-1] == '<'){
            a[i+temp] = max(a[i+temp],temp);
            temp++;
        }
    }
    // print(btm);
    // print(a);
    ll res = 0;
    rep(i,n){
        res += a[i];
        assert(a[i] != -INF);
    }
    cout << res << endl;
}

Measured memory_bytes: 5888
import java.util.*;

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

  private void run() {
    final int n = sc.nextInt();
    sc.nextLine();

    for(int i = 0; i < n; i++) {
      System.out.println(sc.nextLine().replaceAll("Hoshino", "Hoshina"));
    }
  }

  private final Scanner sc = new Scanner(System.in);
}

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

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

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

  set<pair<int, int>> s;
  for (int i = 0; i < n; i++)
  {
    cin >> b[i];
    s.insert({b[i], i});
  }

  long long ans = 0;
  while (!s.empty())
  {
    int i = s.rbegin()->second;
    s.erase(*s.rbegin());
    if (b[i] <= a[i])
      continue;

    int sum = b[(i + 1) % n] + b[(i + n - 1) % n];
    int op = (b[i] - a[i]) / sum;
    if (op)
    {
      ans += op;
      b[i] -= op * sum;
      s.insert({b[i], i});
    }
    else
    {
      cout << -1 << endl;
      return 0;
    }
  }

  for (int i = 0; i < n; i++)
    if (a[i] != b[i])
    {
      cout << -1 << endl;
      return 0;
    }

  cout << ans << endl;
}


Measured memory_bytes: 13184
#include <iostream>
using namespace std;
typedef long long ll;

ll N,A,B;
ll X[100010]= {0};

int main(){
	cin >> N >> A >> B;
	ll ans = 0;
	for(int i=1;i<=N;i++){
		cin >> X[i];
		if(i>1) ans += min(A*(X[i]-X[i-1]),B);
	}
	cout << ans << endl;
}

Measured memory_bytes: 1024
package main

import (
	"fmt"
)

var ans = ""

func main() {
	var s string
	fmt.Scan(&s)
	ar := make([]int, 4)

	for i, v := range s {
		ar[i] = int(v - '0')
	}
	f(0, ar[0], s[0:1], ar)
	fmt.Println(ans)
}

func f(n, sum int, s string, ar []int) {
	if n == 3 {
		if sum == 7 {
			ans = s + "=7"
		}
		return
	}
	f(n+1, sum+ar[n+1], s+"+"+fmt.Sprintf("%d", ar[n+1]), ar)
	f(n+1, sum-ar[n+1], s+"-"+fmt.Sprintf("%d", ar[n+1]), ar)
}


Measured memory_bytes: 512
#include <iostream>
#include <iomanip>
#include <cmath>
#include <stack>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <queue>
#include <set>
#include <fstream>
#include <list>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cassert>
#include <ctime>
#include<numeric>


using namespace std;
#define vec vector
#define pb push_back
#define en '\n'
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> pll;
typedef pair<ll, ll> pull;
typedef pair<int, int> pii;
typedef pair<int, ll> pil;
typedef long double ld;
typedef pair<ld, int> pli;
typedef unsigned int ui;
typedef map<int, int> mii;
typedef map<ll, ll> mll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vector<int>> vi2;
typedef vector<vector<ll>> vll2;
typedef vector<vector<ll>> matrix;
typedef vec<vec<vec<int>>> vi3;

#define _DEBUG

#define pb push_back
#define en '\n'
#define for0(i,n) for(int i = 0;i<n;i++)
#define for1(i,n) for(int i = 1;i<n;i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define vec vector
#define pii pair<int,int>
#define pll pair<ll,ll>
#define REP(a,i,b) for (int i = a;i<b;i++);
#pragma warning(disable : 4996)
/*
 #pragma GCC optimize("Ofast")
 #pragma GCC target("avx,avx2,fma")
 */
const int inf = 2e9;
const ll linf = 2e18;
const ld LDINF = 2e18;


void solve()
{
	ll s;
	ll mod = 1e9 + 7;
	cin >> s;
	vector<ll> dp(s + 1, 0);
	dp[0] = 1;
	for0(i, s + 1) {
		for (int j = 3; j <= s - i; j++) {
			dp[i + j] = (dp[i + j] + dp[i]) % mod;
		}
	}
	cout << dp[s] << en;
}


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

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

	int tst = 1;
	//cin >> tst;
	while (tst--)
		solve();
	return 0;
}

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

using namespace std;

int main(int qtd, char* nome[])
{
    ios::sync_with_stdio(false);
    cin.tie(0);

    int a, b;
    cin >> a >> b;

    if(a >= 13)
        cout << b << endl;
    else if(a >= 6)
        cout << b/2 << endl;
    else
        cout << 0 << endl;

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int N,S,A[3000];
const long mod=998244353;
long dp[6030];
main()
{
	cin>>N>>S;
	for(int i=0;i<N;i++)cin>>A[i];
	dp[0]=1;
	for(int i=0;i<N;i++)
	{
		for(int j=S;j>=0;j--)
		{
			(dp[j+A[i]]+=dp[j])%=mod;
			(dp[j]*=2)%=mod;
		}
	}
	cout<<dp[S]<<endl;
}


Measured memory_bytes: 3676
n=int(input())
a=list(map(int,input().split()))
b=[0]*n
x=-1
y=2*10**9
z=(x+y)//2
for i in range(1000):
    b[0]=z
    for j in range(1,n):
        b[j]=a[j-1]*2-b[j-1]
    if b[0]+b[-1]>2*a[-1]:
        y=z
        z=(x+y)//2
    elif b[0]+b[-1]<2*a[-1]:
        x=z
        z=(x+y)//2
    else:
        break
    if z%2==1:
        y+=1
        z+=1
print(*b)

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



void solve()
{
    int n,i,temp1, temp2;
    cin>>n;
    int b[n+5], a[n+5];
    for(i=0; i<n; i++)
    {
        cin>>temp1>>temp2;
        a[i] = temp1;
        b[i] = temp2;
    }
    for(i=0; i<n-2; i++)
    {
        if(a[i] == b[i] && a[i+1]==b[i+1] && a[i+2]==b[i+2])
        {
            cout<<"Yes"<<endl;
            return;
        }
    }
    cout<<"No"<<endl;
}
int main() {
    int t=1;
    //cin>>t;
    while(t--)
    {
      solve();
    }
    return 0;
}

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

#ifdef DEBUG
#define debug(...) fprintf(stderr, __VA_ARGS__)
#else
#define debug(...)
#endif

#ifdef __WIN32
#define LLFORMAT "I64"
#define Rand() ((rand() << 15) + rand())
#else
#define LLFORMAT "ll"
#define Rand() (rand())
#endif

using namespace std;

const int maxn = 110;

int n, a[maxn];

int main() {
	cin >> n;
	for (int i = 1; i <= n; ++i) cin >> a[i];
	int ans = 0;
	for (int i = 1; i <= n; ++i) {
		int j = i; while(j + 1 <= n && a[j + 1] == a[i]) ++j;
		ans += (j - i + 1) >> 1;
		i = j;
	}
	cout << ans << endl;
	return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <cstring>
#include <cstdio>
#include <math.h>
#include <algorithm>
#include <vector>
#include <string>
#include <stdlib.h>
#include <queue>
#include <stack>
#include <utility>
#include <fstream>
#include <random>
#include <map>
#include <unordered_map>
#include <cstdlib>
#include <functional>
#include <random>
#include <time.h>
#include <chrono>
#include <sstream>
#include <iomanip>
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define ll long long
#define INF 1000000001
#define mod 1000000007
#define sort(s) sort(s.begin(), s.end());
#define reverse(s) reverse(s.begin(), s.end());
#define P pair<int,int>
#define valid(x,y,h,w) (0<=x&&x<h&&0<=y&&y<w)
int dx[4] = { 0,1,0,-1 };
int dy[4] = { 1,0,-1,0 };
using namespace std;
int POW(int x, int y) { return int(pow(double(x), double(y))); }
double log(double a, double b) { return log(b) / log(a); }

//2進数を10進数に変換_63個の要素を持つ配列
ll Convert2to10(vector<int> a) {
	ll ans = 0;
	ll j = 1;
	rep(i, a.size()) {
		ans += a[i] * j;
		if (i != a.size() - 1) {
			j *= 2;
		}
	}
	return ans;
}

//10進数を2進数に変換_63個の要素を持つ配列
vector<int> Convert10to2(ll n) {
	vector<int> ans(63);
	rep(i, 63) {
		ans[i] = n % 2;
		n -= n % 2;
		n /= 2;
	}
	return ans;
}

int main() {
	ll a, b;
	cin >> a >> b;
	vector<int> ans;

	if (a % 2 == 1) {
		if ((b - a) % 4 == 2 || (b - a) % 4 == 3) {
			ans.push_back(0);
		}
		else {
			ans.push_back(1);
		}
	}
	else {
		if ((b - a) % 4 == 0 || (b - a) % 4 == 3) {
			ans.push_back(0);
		}
		else {
			ans.push_back(1);
		}
	}

	vector<int> a2 = Convert10to2(a);
	vector<int> b2 = Convert10to2(b);
	int index = 1;
	ll r = 4;
	while (r <= 2000000000000) {
		if (a / r != b / r) {
			ll c = (a / r + 1)*r;
			if (a2[index] == 0) {
				c = a;
			}
			ll d = (b / r)*r;
			if (b2[index] == 0) {
				d = b;
			}
			ll kazu1 = (c - a) + (b - d) ;
			if (b % (r) >= r / 2) {
				kazu1++;
			}

			if (kazu1 % 2 == 0) {
				ans.push_back(0);
			}
			else {
				ans.push_back(1);
			}
		}
		else {
			if (a / (r / 2) == b / (r / 2)) {
				if (b % (r) >= r / 2) {
					ll kazu1 = b - a + 1;
					if (kazu1 % 2 == 0) {
						ans.push_back(0);
					}
					else {
						ans.push_back(1);
					}
				}
				else {
					ans.push_back(0);
				}
				
			}
			else {
				ll kazu1 = b - (a / (r / 2) + 1) * (r / 2) + 1;
				if (kazu1 < 0 || kazu1 % 2 == 0) {
					ans.push_back(0);
				}
				else {
					ans.push_back(1);
				}
			}
		}
		r *= 2;
		index++;
	}
	cout << Convert2to10(ans) << endl;;
}



Measured memory_bytes: 256
K = int(input())

if K % 7 == 0:
    K //= 7

L = 9 * K

ans = -1

r = 10

for i in range(L):
    if r % L == 1:
        ans = i + 1
        break
    else:
        r = 10 * (r % L)

print(ans)

Measured memory_bytes: 9088
#include <bits/stdc++.h>
#define rep(i,N) for (int i = 0; i < (N); ++i)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main(void){
  string a, b, c;
  cin >> a >> b >> c;

  if (a.at(a.size() - 1) == b.at(0) && b.at(b.size() - 1) == c.at(0)){
    cout << "YES" << endl;
  }else{
    cout << "NO" << endl;
  }
}


Measured memory_bytes: 3528
from collections import deque
N,M = map(int,input().split())
l = [[] for _ in range(N+1)]
for _ in range(M):
  a,b = map(int,input().split())
  l[a].append(b)
  l[b].append(a)

ans = 'No'
st = deque([1])
check = [0]*(N+1)
check[1] = 1
mark = [0]*(N+1)

while st:
  s = st.popleft()
  for t in l[s]:
    if check[t] == 0:
      mark[t] = s
      check[t] = 1
      st.append(t)
if sum(check) == N:
  ans = 'Yes'

print(ans)
if ans == 'Yes':
  for i in range(2,N+1):
    print(mark[i])

Measured memory_bytes: 34748
#include<stdio.h>
int main(void)
{
  int a,b;
  char op;
  while(1)
  {
    if(op=='?')
      break;
    scanf("%d %c %d",&a,&op,&b);
    if(op=='+')
      printf("%d\n",a+b);
    if(op=='-')
      printf("%d\n",a-b);
    if(op=='*')
      printf("%d\n",a*b);
    if(op=='/')
      printf("%d\n",a/b);
  }
  return 0;
}



Measured memory_bytes: 2108
/*  -*- coding: utf-8 -*-
 *
 * a.cc: C: pushpush
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int MAX_N = 200000;

/* typedef */

/* global variables */

int as[MAX_N];

/* subroutines */

/* main */

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

  for (int i = 0; i < n; i++) scanf("%d", &as[i]);

  bool cont = false;
  for (int i = n - 1; i >= 0; i -= 2) {
    if (cont) putchar(' ');
    printf("%d", as[i]);
    cont = true;
  }
  for (int i = (n & 1); i < n; i += 2) {
    if (cont) putchar(' ');
    printf("%d", as[i]);
    cont = true;
  }
  putchar('\n');

  return 0;
}


Measured memory_bytes: 2944
s=raw_input()
idx=[[-1] for _ in xrange(26)]
for i in xrange(len(s)):
    idx[ord(s[i])-ord('a')].append(i)
for i in xrange(26):
    idx[i].append(len(s))
ans=float("inf")
for i in xrange(26):
    tmp=0
    if len(idx[i])==2:continue
    for j in xrange(len(idx[i])-1):
        tmp=max(tmp,max(0,idx[i][j+1]-idx[i][j]-1))
    ans=min(ans,tmp)
print ans


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

using namespace std;

int N, M;
int A[1004], B[1004];
int arr[1004][15];
int d[1004][(1 << 12) + 4];

int main(){
    scanf("%d %d", &N, &M);
    for(int i = 1; i <= M; ++i){
        scanf("%d %d", A + i, B + i);
        for(int j = 1; j <= B[i]; ++j){
            scanf("%d", arr[i] + j);
        }
    }
    for(int i = 0; i < 1004; ++i){
        for(int j = 0; j < (1 << 12) + 4; ++j) d[i][j] = (int)1e9;
    }
    d[0][0] = 0;
    for(int i = 1; i <= M; ++i){
        for(int j = 0; j < (1 << N); ++j){
            int val = j;
            for(int x = 1; x <= B[i]; ++x){
                val |= 1 << (arr[i][x] - 1);
            }
            d[i][val] = min(d[i][val], d[i - 1][j] + A[i]);
            d[i][j] = min(d[i][j], d[i - 1][j]);
        }
    }
    if(d[M][(1 << N) - 1] == (int)1e9){
        puts("-1");
    }
    else{
        printf("%d\n", d[M][(1 << N) - 1]);
    }
    return 0;
}


Measured memory_bytes: 16384
#include <bits/stdc++.h>
#define BIT(n) (1LL << (n))
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPB(i, n) for (int i = 0; i < BIT(n); i++)
#define REPS(i, x) for (int i = 1; i <= (int)(x); i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define FORA(i, n) for (auto &&i : n)
#define FORS(i, m, n) for (int i = m; i <= n; i++)
#define DEBUG(x) cerr << #x << ": " << x << "\n"
#define ALL(v) v.begin(), v.end()
#define fst first
#define snd second
#define mp make_pair
#define pb push_back
#define epb emplace_back
#define int long long
using namespace std;
template < class T > using vec = std::vector< T >;
template < class T > void print(T &x) { cout << x << "\n"; }
typedef long long ll;
const int MOD = 1000000007;
const int INF = 1061109567;
const double EPS = 1e-10;
const double PI = acos(-1.0);
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
signed main() {
  cin.tie(0), ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  string S;
  cin >> S;
  int N=S.size();
  int p = S.find('C');
  bool flg = true;
  if (S[0]=='A'&&count(ALL(S),'C')==1 && 2<= p && p <=N-2){
    REP(i,N){
      if (i!=0 && i!=p){
        int val = S[i]-'a';
        if (!(0<=val && val<26)){
          flg = false;
          break;
        } 
      }
    }
  } else{
    flg = false;
  }
  cout <<(flg?"AC":"WA")<<"\n";
  return 0;
}

Measured memory_bytes: 256
//B - Card Game for Two
#include <bits/stdc++.h>
using namespace std;

vector<int> card(100);
int N;
int solve();
void quickSort(vector<int> &vec, int L, int R);
void swap(vector<int> &v, int x, int y);


int main() {

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

  solve();
}

int solve(){
  quickSort(card, 0, N-1);
  int A=0, B =0;
  for(int i =0; i< N; i++){
    if(i % 2 == 0){
      A += card.at(i);
    }else{
      B += card.at(i);
    }
  }
  cout << abs(A-B)<< endl;
  return 0;
}


void quickSort(vector<int> &vec, int L, int R){
  int i, j, mid, piv;
  i = L;
  j = R;
  mid = L+(R-L)/2;
  piv = vec[mid];

  while(i<R || j>L){
    while(vec[i] <piv){
      i++;
    }
    while(vec[j] > piv){
      j--;
    }

    if(i <= j){
      swap(vec, i, j);
      i++;
      j--;
    }else{
      if(i < R){
        quickSort(vec, i, R);
      }
      if(j > L){
        quickSort(vec, L, j);
      }
      return;
    }
  }
}

void swap(vector<int> &v, int x, int y){
  int temp = v[x];
  v[x] = v[y];
  v[y] = temp;
}


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

using namespace std;

typedef long long int ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef pair<int, int> ii;
typedef pair<ll, ll> pll;
typedef vector<ii> vii;
typedef vector<pll> vpll;

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

void print(vi &A) {
	FOR(i, 0, (int)A.size())
		printf("%d ", A[i]);
	cout << endl;
}

int main() {
	ll N, D, A;
	cin >> N >> D >> A;

	ll x, h;
	vpll mon(N);
	FOR(i, 0, N) {
		scanf("%lld %lld", &x, &h);

		mon[i] = make_pair(x, h);
	}

	sort(mon.begin(), mon.end());
	// FOR(i, 0, N)
	// 	printf("%lld %lld\n", mon[i].first, mon[i].second);

	ll ans = 0;

	ll curr = 0;
	vpll aux;
	ll j = 0;
	FOR(i, 0, N) {
		while (j < aux.size() && aux[j].first < mon[i].first) {
			curr -= aux[j].second;
			j++;
		}

		mon[i].second = max(0LL, mon[i].second - curr);

		// int curr_bombs = ceil((float)mon[i].second / (float)A);
		int curr_bombs = (mon[i].second + A - 1) / A;
		if (mon[i].second == 0LL)
			curr_bombs = 0LL;

		ans += curr_bombs;

		curr += curr_bombs * A;
		aux.push_back(make_pair(mon[i].first + 2 * D, curr_bombs * A));
	}

	cout << ans << endl;

	return 0;
}

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

// #include <ext/pb_ds/assoc_container.hpp>
// using namespace __gnu_pbds;
using namespace std;


typedef long long int ll;
typedef vector<int> vi;
typedef pair<int, int> pii;

typedef vector<ll> vl;
typedef pair<ll, ll> pll;

#define St first
#define Nd second
#define Pb push_back
#define print_pair(p) cout<<p.St<<" "<<p.Nd
#define endl "\n"

#define REP(i,a,b) for(int i = a; i <= b; i++)
#define REV(i,a,b) for(int i = a; i >= b; i--)

#define AritSum(a,d,n) ((n)*(2*(a)+((n)-1)*(d)))/2
#define Log(base, num) log2(num)/log2(base)

#define MOD 1000000007
ll binpow(ll x, ll y) {
	ll z = 1;
	while(y > 0) {
		if(y % 2 == 1)
			z = (z*x)%MOD;
		x = (x*x)%MOD;
		y /= 2;
	}
	return z;
}
// a^-1 (mod m) = a^(m-2) (mod m) - m is prime
ll inv(ll x) {return binpow(x, MOD - 2);}
ll divide(ll x, ll y) {return x* inv(y);}

// ************* MAIN *******************



void solve() {
    // a + b = X
    // 2a + 4b = Y
    // 2b = Y - 2*X
    int X, Y;cin>> X>>Y;
    int b2 = Y - 2*X;
    if ((b2&1) || b2 < 0 || X < b2/2) {
        cout << "No" << endl;
        return;
    }

    cout << "Yes" << endl;
}

/*
g++ -std=c++14 -Wall -Wextra -O2 Test.cpp -o Test

./Test < in
*/
int main() {
    int _=1;
    // cin>>_;
    REP(t,1,_) {
        // cout << "Case #" << t << ": ";
        solve();
        // cout << ((solve())? "YES" : "NO") << endl;
        // cout << solve() << endl;
    }
    return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N,K;
  cin>>N>>K;
  vector<int> A(N);
  for(int &i:A)
    cin>>i;
  sort(A.begin(),A.end());
  int j=0;
  for(int i=0;i<K;i++)
    j+=A[i];
  cout<<j<<endl;
}

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

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

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

int main() {
    int n;
    cin >> n;
    vector<int> a(n), b(n), c(n-1);
    for (auto &&i : a) scanf("%d", &i);
    for (auto &&j : b) scanf("%d", &j);
    for (auto &&k : c) scanf("%d", &k);
    ll ans = accumulate(b.begin(),b.end(), 0LL);
    for (int i = 0; i < n-1; ++i) {
        if(a[i+1]-a[i] == 1) ans += c[a[i]-1];
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int (i) = 0; (i) < (int)(n); i++)
 
int main() {
   int n,k,i,j;
   cin>>n>>k;
   char c[n][k],ans[n][k];
   rep(i,n){
     rep(j,k){
     cin>>c[i][j];
     ans[i][j]='0';
     }
   }
   for(i=0;i<n;i++){
     for(j=0;j<k;j++){
     if(c[i][j]=='#'){
      if(i-1>=0&&j-1>=0){
         ans[i-1][j-1]+=1;
         }
         if(i-1>=0){
         ans[i-1][j]+=1;
         }
         if(i-1>=0&&j+1<k){
         ans[i-1][j+1]+=1;
         }
         if(j-1>=0){
         ans[i][j-1]+=1;
         }
         if(j+1<k){
         ans[i][j+1]+=1;
         }
         if(i+1<n&&j-1>=0){
         ans[i+1][j-1]+=1;
         }
         if(i+1<n){
         ans[i+1][j]+=1;
         }
         if(i+1<n&&j+1<k){
         ans[i+1][j+1]+=1;
         }
       }
     }
   }
   rep(i,n){
     rep(j,k){
       if(c[i][j]=='#'){
         ans[i][j]='#';
       }
     }
   }
     rep(i,n){
      rep(j,k){
        cout<<ans[i][j];
      }
       cout<<endl;
     }
     return 0;
}


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

using namespace std;

int main()
{
    string s,t,u;
    int a,b;
    cin>>s>>t>>a>>b>>u;
    if(s==u)
        cout<<a-1<<" "<<b<<"\n";
    else
        cout<<a<<" "<<b-1<<"\n";
    return 0;

}


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

#define INF 0x3f3f3f3f
#define MAXN 100010
#define endl "\n"
#define abs(a, b) ((a > b) ? a-b : b-a)

typedef long long int ll;

/* End */

int n;
ll a[MAXN];
ll pd[MAXN];

ll solve(int i) {
	if (i >= n-1) return 0;
	if (pd[i] != -1) return pd[i];
	return pd[i] = min(solve(i+1) + abs(a[i], a[i+1]),
			   (i < n-2) ?  solve(i+2) + abs(a[i], a[i+2]) : INF);
}

int main() {
	cin.tie(NULL);
	ios_base::sync_with_stdio(false);
	
	memset(pd, -1, sizeof(pd));

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

	cout << solve(0) << endl;

	return 0;
}


Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
#define fresh                  {ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);}

int arr[1000];
void triangular_series(int n)
{
    int i, j = 1, k = 1;

    for (i = 1; i <= n; i++) {
        arr[i-1]=k;
        j = j + 1;
        k = k + j;
    }
}

int main()
{
    fresh;
    int n = 999;
    triangular_series(n);
//    for(int i=0;i<999;i++)cout<<arr[i]<<endl;
    int a,b;
    scanf("%d %d",&a,&b);
    for(int i=0;i<n-1;i++){
        if(abs(arr[i]-a) == abs(arr[i+1]-b) )
            printf("%d\n",abs(arr[i]-a));
    }
    return 0;
}


Measured memory_bytes: 256
/*
    -ensure correct output format
    -ensure printing required output
    -reread the problem statement
  */

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll>pll;
typedef pair<ll,pair<ll,ll>>plll;
#define fastread() (ios_base:: sync_with_stdio(false),cin.tie(NULL));
#define vll(v) v.begin(),v.end()
#define all(x) x.rbegin(),x.rend()
#define min3(a, b, c)   min(a, min(b, c))
#define max3(a, b, c)   max(a, max(b, c))
#define F first
#define S second
#define in  freopen("input.txt", "r", stdin)
#define out  freopen("output.txt", "w", stdout)
#define minheap int,vector<int>,greater<int>
#define pb push_back
#define eb emplace_back
#define ischar(x)  (('a' <= x && x <= 'z') || ('A' <= x && x <= 'Z'))
#define isvowel(ch) ((ch=='a'||ch=='e'||ch=='i'||ch=='o'||ch=='u')||(ch=='A'|| ch=='E' || ch=='I'|| ch=='O'|| ch=='U'))
#define bug cout<<"BUG"<<endl;
const int Max = 2e6 + 10;
const int Mod = 1e9 + 7;
const double PI  =3.141592653589793238463;
bool compare(const pair<ll,ll> &a, const pair<ll,ll> &b)
{
       return (a.first > b.first);
}
ll lcm(ll a,ll b)
{
    if(a==0 || b==0)return 0;

    return a/__gcd(a,b)*b;
}

void input(ll ara[],ll n)
{
    for(ll i=0; i<n; i++)cin>>ara[i];
}
void print(ll ara[],ll n)
{
    for(ll i=0; i<n; i++)
        cout<<ara[i]<<" ";
    cout<<endl;
}


int main()
{

   fastread();

   ll i,j,n,m,p,a,sum=0,k,t,b,c,d,cnt=0,q,l,r,ans=0;

      bool flag=false;

      string str;

      cin>>a>>b;

      ans=max(a,b);

      if(ans==a)a--;

      else b--;

      cout<<max(a,b)+ans<<endl;













}



Measured memory_bytes: 3584
x,y=map(int,input().split())
if(x%y==0):
	print(-1)
else:
	c=2
	a=x
	b=0
	while(a<1000000000000000000 and b==0):
		a=c*x
		if(a%y!=0):
			b=1
		else:
			c+=1	
	if(b==0):
		print(-1)
	else:
		print(a)					

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

using namespace std;

#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define all(a) (a).begin(),(a).end()
#define endl "\n"

#define aim_cpo do{ios::sync_with_stdio(false);\
cin.tie(nullptr);cout.precision(10);cout<<fixed;}while(0)

#define LOCAL_INPUT do{FILE *stream1;\
stream1=freopen("/Users/aim_cpo/CLionProjects/competitive/in.txt","r",stdin);\
if(stream1==nullptr)return 0;}while(0)

#define LOCAL_OUTPUT do{FILE *stream2;\
stream2 = freopen("out.txt", "w", stdout);\
if (stream2 == nullptr) return 0;}while(0)

#ifdef LOCAL_DEFINE
#define show(x) cerr << #x << " = " << x << endl
#else
#define show(x)
#endif

typedef long long ll;
typedef unsigned long long ull;

constexpr const int INT_INF=0x3f3f3f3f; // 1061109567
constexpr const ll LL_INF=0x3f3f3f3f3f3f3f3f; // 4557430888798830399

template <typename T> bool chmin(T &a, T b) {
    if (a > b) {a = b;return true;}return false;
}

template <typename T> bool chmax(T &a, T b) {
    if (a < b) {a = b;return true;}return false;
}

// INT
#define GCD(a, b) __gcd(a, b)
template <typename T> T LCM(T a, T b) {return a / GCD(a, b) * b;}
template <typename T> T EXTGCD(T a, T b, T& x, T& y) {
    T d = a;
    if (b != 0) {d=EXTGCD(b,a%b,y,x);y-=(a/b)*x;}
    else x=1,y=0;
    return d;
}
template <typename T> bool is_prime(T a) {
    for(int i=2;i*i<=a;i++)if(a%i==0)return 1;
    return 0;
}

// MOD
const ll MOD = (ll)1e9 + 7;
#define add(a, b) ((a % MOD) + (b % MOD)) % MOD
#define mul(a, b) ((a % MOD) * (b % MOD)) % MOD
#define sub(a, b) ((a % MOD) + MOD - (b % MOD)) % MOD
template <typename T> T mod_inverse(T a, T mod, bool prime){ // if mod is prime, "prime" is true.
    if(prime){
        T tmp=mod-2,now=a,res=1;while(tmp){if(tmp&1)res=mul(res,now);now=mul(now,now);tmp>>=1;}
        return res;
    }else{T x,y;EXTGCD(a,mod,x,y);return (mod+x%mod)%mod;}
}
#define divide(a, b) ((a % MOD) * (mod_inverse(b, MOD, true))) % MOD

//LLの数値をつかう時は最後にLをつける癖をつけよう
//
//  ┏┓┏┓　┓　┏┓
//  ┏┛┃┃　┃　┗┫
//  ┗┛┗┛　┻　┗┛
//
//   謹┃賀┃新┃年┃
//   ━┛━┛━┛━┛
//WWWWWWWWWWWWWWWWWWWWWW

int n, k;
int a[100001];
ll dp[100001];

int main() {
    aim_cpo; // インタラクティブのときは消すように.
#ifdef LOCAL_DEFINE
    LOCAL_INPUT; // インタラクティブのときは消すように.
//    LOCAL_OUTPUT; // ファイルに出力したいときのみ
    show(MOD);
#endif
    cin >> n >> k;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    for (int i = 1; i < n; i++) {
        dp[i] = INT_INF;
    }
    for (int i = 0; i < n; i++) {
        for (int j = 0; j <= k; j++) {
            if (i + j < n) dp[i + j] = min(dp[i + j], dp[i] + abs(a[i] - a[i + j]));
        }
    }
    cout << dp[n - 1] << endl;
#ifdef  LOCAL_DEFINE
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << "s." << endl;
#endif
    return 0;
}

Measured memory_bytes: 1408
#define _USE_MATH_DEFINES
#include  <iostream>
#include  <algorithm>
#include  <climits>
#include  <vector>
#include  <string>
#include  <cstring>
#include  <stack>
#include  <queue>
#include  <cmath>
#include  <iomanip>
#include  <set>
#include  <map>
#include  <new>

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

using ll = long long;
using Vii = vector<vector<int> >;
using Gjudge = vector<vector<bool>>;
using Vi = vector<int>;
using Vl = vector<ll>;
using Vs = vector<string>;
using Vb = vector<bool>;
using the = pair<int, int>;

const int Mod = static_cast<int>(1e9 + 7);
const int INF = INT_MAX;
const int dx[4] = { -1,0,1,0 };
const int dy[4] = { 0,1,0,-1 };

int main()
{
    ll n, k; cin >> n >> k;

    Vii G(n);
    for (int i = 0; i < n; ++i) {
        int a;
        cin >> a;
        a--;
        G[i].push_back(a);
    }
    // BFS のためのデータ構造
    vector<int> dist(n, -1); // 全頂点を「未訪問」に初期化
    queue<int> que;

    // 初期条件 (頂点 0 を初期ノードとする)
    dist[0] = 0;
    que.push(0); // 0 を橙色頂点にする

    int loop = 0;
    bool f1 = false;
    bool f2 = false;
    ll tsum = 0;
    // BFS 開始 (キューが空になるまで探索を行う)
    while (!que.empty()) {
        int v = que.front(); // キューから先頭頂点を取り出す
        que.pop();

        // v から辿れる頂点をすべて調べる
        for (int nv : G[v]) {
            if (dist[nv] != -1) {
                if (!f1)  loop = nv;
                if (f1) {
                    if (nv == loop) {
                        f2 = true;
                    }
                }
                f1 = true;
            }

            // 新たな白色頂点 nv について距離情報を更新してキューに追加する
            if (!f1)   dist[nv] = dist[v] + 1;
            else  tsum++;
            que.push(nv);
        }
        if (f2)  break;
    }
    tsum--;
    //rep(i, n) {
    //    cout << " "<<dist[i];
    //}
    //cout << tsum << endl;
    //cout << loop << endl;

    ll ssum = 0;
    ssum += dist[loop] - dist[0];
    if (k < ssum) {
        int s = 0;
        rep(i, n) {
            if (dist[i] == k) s = i;
        }
        s++;
        cout << s << endl;
        return 0;
    }
    k -= ssum;
    k %= tsum;

    int ans = loop;
    for (int h = 0; h < k; h++) {
        ans = G[ans][0];
    }
    cout << ++ans << endl;
}


Measured memory_bytes: 14872
#include<bits/stdc++.h>
using namespace std;
int n,c,color[35][35],m[505][505],s[3][35],mn=(1e9);
int main()
{
	cin>>n>>c;
	for(int i=1;i<=3;i++)
		for(int j=1;j<=30;j++)
			s[i][j]=0;
	for(int i=1;i<=c;i++)
		for(int j=1;j<=c;j++)
			cin>>color[i][j];
	for(int i=1;i<=n;i++)
		for(int j=1;j<=n;j++)
		{
			cin>>m[i][j];
			for(int k=1;k<=c;k++)
				s[(i+j)%3][k]+=color[m[i][j]][k];
		}
	for(int i=1;i<=c;i++)
		for(int j=1;j<=c;j++)
			for(int k=1;k<=c;k++)
				if(i!=j&&i!=k&&j!=k)
					mn=min(s[0][i]+s[1][j]+s[2][k],mn);
	cout<<mn<<endl;
	return 0;
}

Measured memory_bytes: 1280
import numpy as np

def a(mat):
    new = []
    tmp_mat = mat.T
    for row in tmp_mat:
        if len(set(row)) == 1 and row[0] == '.':
            continue
        new.append(row)
    new = np.array(new)
    return new.T.tolist()





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

# matrix
results = []



for _ in range(h):
    row = list(input())
    if ''.join(row) == '.'*w:
        continue
    results.append(row)

results = np.array(results)

for row in a(results):
    print(''.join(row))



Measured memory_bytes: 12508
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<bitset>
#include<cstdio>
#include<cmath>
#include<deque>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<sstream>
#include<stack>
#include<string>
#include<tuple>
#include<utility>
#include<vector>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector<vector<long long>> vvll;
typedef vector<vector<int>> vvi;

#define rep(i, a, n)  for(int i=a; i<n; i++)
#define REP(i, n)  for(int i=0; i<(int)(n); i++)
#define REPS(i, n)  for(int i=1; i<=(int)(n); i++)
#define PER(i, n) for(int i=(int)(n)-1; i>= 0; i--)
#define PERS(i, n)  for(int i=(int)(n); i>0; i--)
#define FOR(i, c) for(__typeof((c).begin()) i = (c).begin(); i!=(c).end(); i++)
#define RFOR(i, c)  for(__typeof((c).rbegin()) i=(c).rbegin(); i!=(c).end(); i++)
#define ALL(container)  (container).begin(), (container).end()
#define RALL(container) (container).rbegin(), (container).rend()
#define SZ(container) (container).size()
#define FILL0(n)  setfill('0') << right << setw(n)
#define mp(a, b)  make_pair(a, b)
#define toLower(c)  c+0x20
#define toUpper(c)  c-0x20
#define pb  push_back
#define eb  emplace_back

const int INF = 1e9;
const long long LLINF = 1e18;
const int MOD = 1000000007;
const double Pi = 3.14159265358979323146;

int main(){
  int h, w, n;  cin >> h >> w >> n;
  vector<vector<int>> mas(h, vector<int>(w, 0));
  int my=0, mx=0;
  bool dir = true;
  REP(i, n){
    int a;  cin >> a;
    while(a>0){
      mas[my][mx]=i+1;
      if(dir){
        mx++;
        if(mx==w){
          mx--;
          my++;
          dir=false;
        }
      }else{
        mx--;
        if(mx==-1){
          mx++;
          my++;
          dir=true;
        }
      }
      a--;
    }
  }

  REP(y, h) {
    REP(x, w){
      cout << mas[y][x] << " ";
    }
    cout << endl;
  }
  return 0;
}


Measured memory_bytes: 384