akhauriyash/Code-Regression huggingface dataset:
#pragma region template
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using vld = vector<ld>;
using vvld = vector<vld>;
using vvvld = vector<vvld>;
using vs = vector<string>;
using pll = pair<ll, ll>;
using vp = vector<pll>;
template <typename T>
using pqrev = priority_queue<T, vector<T>, greater<T>>;
#define rep(i, n) for (ll i = 0, i##_end = (n); i < i##_end; i++)
#define repb(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repr(i, a, b) for (ll i = (a), i##_end = (b); i < i##_end; i++)
#define reprb(i, a, b) for (ll i = (b)-1, i##_end = (a); i >= i##_end; i--)
#define ALL(a) (a).begin(), (a).end()
#define SZ(x) ((ll)(x).size())
//*
constexpr ll MOD = 1e9 + 7;
/*/
constexpr ll MOD = 998244353;
//*/
constexpr ll INF = 1e+18;
constexpr ld EPS = 1e-12L;
constexpr ld PI = 3.14159265358979323846L;
constexpr ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }
constexpr ll LCM(ll a, ll b) { return a / GCD(a, b) * b; }
template <typename S, typename T>
constexpr bool chmax(S &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename S, typename T>
constexpr bool chmin(S &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
#ifdef OJ_LOCAL
#include "dump.hpp"
#else
#define dump(...) ((void)0)
#endif
template <typename T>
bool print_(const T &a) {
  cout << a;
  return true;
}
template <typename T>
bool print_(const vector<T> &vec) {
  for (auto &a : vec) {
    cout << a;
    if (&a != &vec.back()) {
      cout << " ";
    }
  }
  return false;
}
template <typename T>
bool print_(const vector<vector<T>> &vv) {
  for (auto &v : vv) {
    for (auto &a : v) {
      cout << a;
      if (&a != &v.back()) {
        cout << " ";
      }
    }
    if (&v != &vv.back()) {
      cout << "\n";
    }
  }
  return false;
}
void print() { cout << "\n"; }
template <typename Head, typename... Tail>
void print(Head &&head, Tail &&... tail) {
  bool f = print_(head);
  if (sizeof...(tail) != 0) {
    cout << (f ? " " : "\n");
  }
  print(forward<Tail>(tail)...);
}
#pragma endregion

void Pr(bool f){
  cout << (f ? "Yes" : "No") << "\n";
  exit(0);
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(20);
  ll n, k;
  cin >> n >> k;
  vvll a(n, vll(n));
  rep(i, n)rep(j, n) cin >> a[i][j];
  mcf_graph<ll, ll> g(2*n+2), h;
  rep(i, n)rep(j, n) g.add_edge(i, j+n, 1, MOD-a[i][j]);
  rep(i, n){
    g.add_edge(2*n, i, k, 0);
    g.add_edge(i+n, 2*n+1, k, 0);
  }
  h = g;
  auto res = g.slope(2*n, 2*n+1);
  ll ans = -INF;
  ll ansf = 0;
  for(auto&& e: res){
    dump(e.first, e.first*MOD-e.second);
    if(chmax(ans, e.first*MOD-e.second)) ansf = e.first;
  }
  h.flow(2*n, 2*n+1, ansf);
  auto ed = h.edges();
  print(ans);
  vs grid(n, string(n, '.'));
  rep(i, n)rep(j, n){
    if(ed[i*n+j].flow == 1){
      grid[i][j]='X';
    }
  }
  for(auto&& e: grid){
    print(e);
  }
}


Measured memory_bytes: 4212
#include<bits/stdc++.h>
#define REP(i,a,b) for(int i=(a);i<(int)(b);++i)
#define rep(i,n) REP(i,0,n)
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

using namespace std;
typedef long long ll;

int main() {
    int N, i;
    cin >> N >> i;
    cout << N - i + 1 << endl;
    return 0;
}




Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int N=2e3+10;
int main()
{
    int n,p[N],A,B,t,t1,t2,t3;
    t1=t2=t3=0;
    scanf("%d",&n);
    scanf("%d%d",&A,&B);
    for(int i=0;i<n;i++){
        scanf("%d",&t);
        if(t<=A){
            t1++;
        }else if(A+1<=t&&t<=B){
            t2++;
        }else{
            t3++;
        }
    }
    int ans=min(min(t1,t2),t3);
    printf("%d\n",ans);
    return 0;
}


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

int main(){
    string S;
    cin >> S;
    if(S[0] == S[1] && S[1] == S[2]) {
        cout << "No" << endl;
    }
    else if(S[0] == S[1] && S[2] == S[3]) {
        cout << "Yes" << endl;
    }
    else if(S[0] == S[2] && S[1] == S[3]) {
        cout << "Yes" << endl;
    }
    else if(S[0] == S[3] && S[1] == S[2]) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
}


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

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


  if(N / 10 == 9 || N % 10 == 9 ) {
    
    cout <<  "Yes" << endl ;
  }

else {
  
  cout << "No" << endl ;
  
}
}



Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<string.h>
#include<cstdlib>
#include<map>
#include<fstream>
#include<string>
#include<sstream>
#include<iomanip>
#include<cmath>
#include<random>
#include<set>

using namespace std;

long long dp[3][100100] = {};
const long long INF = 1LL << 60;
#define MOD 1000000007
#define Int int64_t


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

/**
* @fn
* 最大値を取ります.Vector<int>を渡すこと.
*/
long long int imax(vector<int> a) {
	int MAX = -10000000;
	for (int i = 0; i < a.size(); i++) {
		if (MAX < a.at(i)) MAX = a.at(i);
	}
	return MAX;
}

/**
* @fn
* 最小値を取ります.Vector<int>を渡すこと.
*/
long long int imin(vector<int> a) {
	int MIN = 1000000000;
	for (int i = 0; i < a.size(); i++) {
		if (MIN > a.at(i)) MIN = a.at(i);
	}
	return MIN;
}

/**
* @fn
* 自然数について、桁数を求める
*/
Int getDigit(Int num) {
	return (Int)(log10(num)) + 1;
}

long long int absmin(vector<int> a, long long int b) {
	int mini = 100000000;
	int d = 0;
	for (int i = 0; i < a.size(); i++) {
		if (mini > abs(a.at(i) - b)) {
			mini = abs(a.at(i) - b);
			d = i;
		}
	}
	return d;
}


long long int absmax(vector<int> a, long long int b) {
	int max = -100000000;
	int d = 0;
	for (int i = 0; i < a.size(); i++) {
		if (max < abs(a.at(i) - b)) {
			max = abs(a.at(i) - b);
			d = i;
		}
	}
	return d;
}

int gcd(int a, int b)
{
	if (a < b) swap(a, b);
	if (b < 1) return -1;
	if (a % b == 0) return b;
	return gcd(b, a % b);
}

void haerobatya(int start, int end, char level) {
	if (start > end) swap(start, end);
	for (int i = start; i <= end; i++) {
		if (i < 100) {
			cout << "https://atcoder.jp/contests/abc0" << i << "/tasks/abc0" << i << "_" << level << endl;
		}
		else {
			cout << "https://atcoder.jp/contests/abc" << i << "/tasks/abc" << i << "_" << level << endl;
		}
	}
}

long long int cntmod(long long int warareru, long long int mod) {
	long long int i = 0;
	for (i = 0;true; i++) {
		if (warareru % mod == 0 && warareru >= mod) {
			warareru /= mod;
		}
		else {
			return i;
		}
	}
}

//ここまでライブラリ
//ここから本文

long long int tpimin(vector<int> a) {
	int MIN = 1000000000;
	int number = 0;
	for (int i = 0; i < a.size(); i++) {
		if (MIN > a.at(i)) MIN = a.at(i);
		number = i;
	}
	return number;
}
int main() {
	string a;
	cin >> a;
	int ai = stoi(a);
	int sum = 0;
	for (int i = 0; i < a.size(); i++) {
		sum += (int)(a.at(i) - '0');
	}
	if (ai % sum == 0) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using Console = System.Console;

namespace Atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var r = Console.ReadLine().Split().Select(int.Parse).ToArray();
            var S = Console.ReadLine();
            int tmp = 0;
            for (int i = 0; i < S.Length; i++)
            {
                if (S[r[0]] != '-')
                {
                    Console.WriteLine("No");
                    return;
                }

                if (i == r[0])
                {
                    continue;
                }

                if (!int.TryParse(S[i].ToString(), out tmp))
                {
                    Console.WriteLine("No");
                    return;
                }
            }
            Console.WriteLine("Yes");
        }
    }
}

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

void sunuke(vector<vector<bool>>& Board, int X, int Y, int a, int &num) {
	int xmin = a == 2 ? X : 0;
	int ymin = a == 4 ? Y : 0;
	int xmax = a == 1 ? X : Board.size();
	int ymax = a == 3 ? Y : Board[0].size();;
	for (int y = ymin; y < ymax; y++) {
		for (int x = xmin; x < xmax; x++) {
			if (Board[x][y]) {
				num--;
				Board[x][y] = false;
			}
		}
	}
}

int main() {
	int W, H, N;
	cin >> W >> H >> N;
	vector<vector<bool>> Board(W, vector<bool>(H, true));

	int num = W * H;
	for (int i = 0; i < N; i++) {
		int X, Y, a;
		cin >> X >> Y >> a;
		sunuke(Board, X, Y, a, num);
	}
	cout << num;
}

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

 using namespace std;
 typedef long long ll;
 #define rep(i, n) for(int i = 0; i < (int)(n); i++)

 int main() {
   int X, x;
   cin >> X;
   x = X % 100;

   int ans = 0;

   for (int i = 0; i <= x / 4; i++) {
     for (int j = 0; j <= x / 3; j++) {
       for (int k = 0; k <= x / 2; k++) {
         for (int l = 0; l <= x; l++) {
             int m = 4 * i + 3 * j + 2 * k + l;
             if ((x - m) % 5 == 0 && x - m >= 0 && i + j + k + l + (x - m) / 5 <= X / 100) {
               ans = 1;
               break;
             }
         }
       }
     }
   }

   cout << ans << endl;
 }


Measured memory_bytes: 256
import java.util.*;
import java.io.*;

public class Main {

	private static void solve(){
		//Implement solution here.
		char[] ca = next().toCharArray();
		int result = 0;
		for(int i = 0; i < ca.length / 2; i++) {
			if(ca[i] != ca[ca.length - 1 -i]) {
				result ++;
			}
		}
		System.out.println(result);
	}

	//Switch input source (stdin/file)
	private static BufferedReader br;
	public static void main(String[] args){
		br = new BufferedReader(new InputStreamReader(System.in));
		String debugDataPath = System.getenv("DD_PATH");        
		if(debugDataPath != null){
			try{
				br = new BufferedReader(new InputStreamReader(new FileInputStream(new File(debugDataPath))));
			}catch(Exception e){
				throw new RuntimeException(e);
			}
		}
		solve();
	}

	//Input read utility
	private static StringTokenizer tokenizer = null;
	public static String next() {
		while (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				tokenizer = new StringTokenizer(br.readLine());
			} catch (Exception e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken();
	}
	//Get next single int
	private static int ni() {
		return Integer.parseInt(next());
	}
	//Get next single long
	private static long nl() {
		return Long.parseLong(next());
	}
	//Get next single double
	private static double nd() {
		return Double.parseDouble(next());
	}
	//Get next int array from one line
	private static int[] na(int n) {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = ni();
		return a;
	}
	//Get next char array from one line
	private static char[] ns() {
		return next().toCharArray();
	}
	//Get next long array from one line
	private static long[] nal(int n) {
		long[] a = new long[n];
		for (int i = 0; i < n; i++)
			a[i] = nl();
		return a;
	}
}

Measured memory_bytes: 20948
from collections import Counter
n,a=map(int,input().split())
X=sorted(list(map(lambda x:int(x)-a,input().split())))
ans=Counter([0])
for x in X:
  tmp=Counter()
  for k,v in ans.items():
    tmp[k+x]+=v
  ans+=tmp
print(ans[0]-1)

Measured memory_bytes: 3572
#![allow(unused_imports, unused_variables, dead_code)]
use std::io::*;
use std::fmt::*;
use std::str::*;
use std::cmp::*;
use std::collections::*;

trait InputValue {
    fn parse(s: &str) -> Self;
}

fn read<T: InputValue>() -> T {
    let mut buf = String::new();
    let _ = stdin().read_line(&mut buf);
    T::parse(&buf.trim())
}

fn readnc<T: InputValue>() -> Vec<T> {
    let mut vec = vec![];
    let line: String = read();
    for token in line.split_whitespace() {
        vec.push(T::parse(token));
    }
    vec
}

fn readn<T: InputValue>(n: usize) -> Vec<T> {
    let mut vec = vec![];
    for _ in 0..n {
        vec.push(read());
    }
    vec
}

macro_rules! parse_single_value {
    ($($t:ty),*) => {
        $(
            impl InputValue for $t {
                fn parse(s: &str) -> $t { s.parse().unwrap() }
            }
        )*
	}
}
parse_single_value!(i32, i64, f32, f64, usize, String);

macro_rules! parse_tuple {
	($($t:ident),*) => {
		impl<$($t),*> InputValue for ($($t),*) where $($t: InputValue),* {
			fn parse(s: &str) -> ($($t),*) {
				let mut tokens = s.split_whitespace();
				let t = ($($t::parse(tokens.next().unwrap())),*);
				t
			}
		}
	}
}
parse_tuple!(A, B);
parse_tuple!(A, B, C);

// ===

fn main() {
    let (n, m): (usize, usize) = read();
    let mut table: Vec<Vec<i32>> = vec![vec![0; n]; n];
    for i in 0..m {
        let (a, b, c): (usize, usize, i32) = read();
        table[a-1][b-1] = c;
        table[b-1][a-1] = c;
    }

    let mut induced_value = vec![0; 1<<n];
    for p in 0..1<<n {
        for i in 0..n {
            for j in i+1..n {
                if table[i][j] >= 1 && p & (1<<i) >= 1 && p & (1<<j) >= 1 {
                    induced_value[p] += table[i][j];
                }
            }
        }
    }

    let all = (1<<(n-1))-1;
    let mut dp = vec![vec![-1; n]; all+1];
    for p in 0..1<<(n-1) {
        let tp = p | 1;
        dp[tp][0] = induced_value[tp];
    }

    let mut best = 0;
    for p in 0..1<<(n-1) {
        for now in 0..n {
            if dp[p][now] == -1 {
                continue
            }
            let base = dp[p][now];

            let sub = all ^ p;
            let mut left = sub;
            while left >= 1 {
                for to in 0..n-1 {
                    if left & (1<<to) == 0 || table[now][to] == 0 {
                        continue
                    }
                    dp[p|left][to] = max(dp[p|left][to], base + induced_value[left] + table[now][to])
                }
                left = (left - 1) & sub;
            }

            if table[now][n-1] >= 1 {
                best = max(best, base + induced_value[sub | (1<<(n-1))] + table[now][n-1])
            }
        }
    }

    let mut total = 0;
    for i in 0..n {
        for j in i+1..n {
            total += table[i][j];
        }
    }

    println!("{}", total-best);
}

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

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

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

    vector<int[3]> dp(n+1);

    for (int i = 0; i < 3; ++i)
    {
        dp[0][i] = 0;
    }

    for (int i = 1; i <= n; ++i)
    {
        dp[i][0] = max(dp[i-1][1]+b[i-1], dp[i-1][2]+c[i-1]);
        dp[i][1] = max(dp[i-1][0]+a[i-1], dp[i-1][2]+c[i-1]);
        dp[i][2] = max(dp[i-1][0]+a[i-1], dp[i-1][1]+b[i-1]);
    }

    cout << max(dp[n][0], max(dp[n][1], dp[n][2])) << "\n";

    return 0;
}   

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

int n, m, ans[105][105];
char a[105][105]; 

int main() {
	cin>>n>>m;
	for(int i = 1; i <= n; i++)
		for(int j = 1; j <= m; j++)
		    cin>>a[i][j];
	memset(ans, 0x3f, sizeof(ans));
	ans[1][1] = (a[1][1] == '.') ? 0:1;
	for(int i = 1; i <= n; i++)
		for(int j = 1; j <= m; j++) {
			if(i == j && i == 1) continue;
			if(a[i][j] == '.')
				ans[i][j] = min(ans[i - 1][j], ans[i][j - 1]);
			else {
				if(a[i - 1][j] == a[i][j]) ans[i][j] = min(ans[i][j], ans[i - 1][j]);
				else ans[i][j] = min(ans[i][j], ans[i - 1][j] + 1);
				if(a[i][j - 1] == a[i][j]) ans[i][j] = min(ans[i][j], ans[i][j - 1]);
				else ans[i][j] = min(ans[i][j], ans[i][j - 1] + 1);
			}
		}
	cout<<ans[n][m]<<endl;
}

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

using namespace std;

int main(){
	
	while(1){
		
		long e;
		cin >> e;
		if(e==0) break;
		long ans=1000000;
		long tz,x;
		
		for(long z=0;e>=z*z*z;z++){
			tz=e-z*z*z;
			for(long y=0;tz>=y*y;y++){
				x=tz-y*y;
				ans=min(ans,x+y+z);
			}
		}
		
		cout << ans << endl;
	}
	return 0;
}


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


public class Main {
	private	static	BufferedReader	br = null;

	static {
		br = new BufferedReader(new InputStreamReader(System.in));
	}
 
    /**
     * @param args
     */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		int	map[] = new int[2001];
		int	num   = -1;

		for(int a = 0; a <= 1000; a++) {
			for(int b = 0; b <= 1000; b++) {
				// 0から2000までの組み合わせをカウント
				map[a+b]++;
			}
		}

		while((num = parseNum()) != -1) {
			long	cnt = 0;
			for(int a = 0; a <= 2000; a++) {
				if (a > num) {
					// 数値Aが目的値を超えたらこれ以上カウントしない
					break;
				}
				for(int b = 0; b <= 2000; b++) {
					if (a + b == num) {
						cnt += (long)map[a]*(long)map[b];
					} else if (a + b > num || num - a > 2000) {
						// 合計が目的値を超えたらこれ以上カウントしない
						// 数値Aに2000を足しても目的値に届かない場合はこれ以上カウントしない
						break;
					}
				}
			}

			System.out.println(cnt);
		}

	}

	private static int parseNum() {
		int		param = -1;
		String	strin = null;

		if ((strin = parseStdin()) != null) {
			param = Integer.parseInt(strin);
		}
 
		return param;
	}

	private static String parseStdin() {
        String  stdin = null;
        
        try {
        	String  tmp = br.readLine();
        	if (tmp != null) {
            	if (!tmp.isEmpty()) {
            		stdin = tmp;
            	}
        	}
        }
        catch (IOException e) {}
 
        return stdin;
	}
}

Measured memory_bytes: 19900
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<ll, P>IP;
typedef vector<ll> V;
typedef vector<V> V2;
typedef vector<vector<P> > G;
void g_dir(G &graph, ll a, ll b, ll w = 1){graph[a].push_back(P(b, w));}
void g_undir(G &graph, ll a, ll b, ll w = 1){g_dir(graph, a, b, w);g_dir(graph, b, a, w);}
#define rep(i, n) for(ll (i) = 0; (i) < (n); (i)++)
#define rep1(i, n) for(ll (i) = 1; (i) <= (n); (i)++)
#define rrep(i, n) for(ll (i) = (n) - 1; (i) >= 0; (i)--)
#define rrep1(i, n) for(ll (i) = (n); (i) >= 1; (i)--)
template<class T> void chmax(T &a, const T &b){if(a < b){a = b;}}
template<class T> void chmin(T &a, const T &b){if(a > b){a = b;}}
const ll INF = 1145141919810893;
const ll MOD = 1000000007;
const ll NUM = 101010;

ll N, M, s, t;
G en(NUM), sn(NUM);
ll tot[NUM], fs[NUM], ans[NUM];

int main(){

    cin >> N >> M >> s >> t;
    rep(i, M){
        ll u, v, a, b;
        cin >> u >> v >> a >> b;
        g_undir(en, u, v, a);
        g_undir(sn, u, v, b);
    }
    rep1(i, N)tot[i] = INF;
    priority_queue<P, vector<P>, greater<P> >Q;
    Q.push(P(0, t));
    while(!Q.empty()){
        ll cost = Q.top().first;
        ll idx = Q.top().second;
        Q.pop();
        if(tot[idx] < INF)continue;
        tot[idx] = cost;
        rep(i, sn[idx].size()){
            ll to = sn[idx][i].first;
            if(tot[to] < INF)continue;
            Q.push(P(sn[idx][i].second + tot[idx], to));
        }
    }
    rep1(i, N)fs[i] = INF;
    Q.push(P(0, s));
    while(!Q.empty()){
        ll cost = Q.top().first;
        ll idx = Q.top().second;
        Q.pop();
        if(fs[idx] < INF)continue;
        fs[idx] = cost;
        rep(i, en[idx].size()){
            ll to = en[idx][i].first;
            if(fs[to] < INF)continue;
            Q.push(P(en[idx][i].second + fs[idx], to));
        }
    }
    rrep1(i, N){
        ans[i] = 1000000000000000LL - fs[i] - tot[i];        
        chmax(ans[i], ans[i + 1]);
    }
    rep1(i, N)cout << ans[i] << endl;
    
    return 0;
}

Measured memory_bytes: 19704
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define pb push_back
#define f(i,x,n) for(int i=x;i<n;i++)
#define all(c) c.begin(),c.end()
#define int ll
using ll = long long;
using pii = pair<int,int>;
const int MOD = 1e9+7, N = 1e5 + 10; 

int32_t main(){
   ios::sync_with_stdio(false);
   cin.tie(NULL);
   int n;
   cin >> n;
   string s;
   cin >> s;
   f(i,0,s.length()){
      int a = s[i]-'A';
      a += n;
      a = a%26;
      cout << char('A'+a);
   }
   return 0;
}


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

int main(){
    int n;
    while(true){
        cin >> n;
        if(n == 0){
            break;
        }

        int dice[6] = {1, 6, 2, 5, 4, 3};
        int ans = 1;
        string s;
        for(int i=0; i<n; i++){
            cin >> s;
            int tmp;
            if(s == "North"){
                tmp = dice[0];
                dice[0] = dice[2];
                dice[2] = dice[1];
                dice[1] = dice[3];
                dice[3] = tmp;
            }else if(s == "East"){
                tmp = dice[0];
                dice[0] = dice[4];
                dice[4] = dice[1];
                dice[1] = dice[5];
                dice[5] = tmp;
            }else if(s == "West"){
                tmp = dice[0];
                dice[0] = dice[5];
                dice[5] = dice[1];
                dice[1] = dice[4];
                dice[4] = tmp;
            }else if(s == "South"){
                tmp = dice[0];
                dice[0] = dice[3];
                dice[3] = dice[1];
                dice[1] = dice[2];
                dice[2] = tmp;
            }else if(s == "Right"){
                tmp = dice[2];
                dice[2] = dice[5];
                dice[5] = dice[3];
                dice[3] = dice[4];
                dice[4] = tmp;
            }else if(s == "Left"){
                tmp = dice[2];
                dice[2] = dice[4];
                dice[4] = dice[3];
                dice[3] = dice[5];
                dice[5] = tmp;
            }
            ans += dice[0];
        }
        cout << ans << endl;
    }
  
  return 0;
}

Measured memory_bytes: 3012
N=int(input())
A = []
for _ in range(N):
    A.append(int(input()))

amax = max(A)
nmax = A.count(amax)
if nmax == 1:
    B = []
    for i in range(N):
        if A[i] != amax:
            B.append(A[i])
    asec = max(B)


for i in range(N):
    if A[i] == amax:
        if nmax > 1:
            ans = amax
        else:
            ans = asec
    else:
        ans = amax
    print(ans)

Measured memory_bytes: 100908
#include <bits/stdc++.h>
#define rep(i,x,n) for(int i=x; i<(int)(n); i++)
#define rep_eq(i,x,n) for(int i=x; i<=(int)(n); i++)
using namespace std;

int main() {
  int X,Y,Z; cin >>X >>Y >>Z;
  int ans=X/(Y+Z);
  if (ans*(Y+Z)+Z<=X) cout <<ans <<endl;
  else cout <<ans-1 <<endl;
  return 0;
}


Measured memory_bytes: 256
#pragma region head
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repp(i, a, b) for (int i = a; i <= (b); ++i)
#define repr(i, a, b) for (int i = a; i >= (b); --i)
#define bit(n) (1LL << (n))
#define len(x) ((ll)(x).size())
#define debug(var) cout << "[" << #var << "]\n" << var << endl
#define int long long
typedef long long ll;
#define double long double
typedef double ld;
const int INF = 1001001001001001001ll;
const ll LINF = 1001001001001001001ll;
const int MOD = 1000000007;
const double EPS = 1e-9;
const double PI = acos(-1.0);

template <typename T>
ostream& operator<<(ostream& s, const vector<T>& v) {
  int len = v.size();
  for (int i = 0; i < len; ++i) {
    s << v[i];
    if (i < len - 1)
      s << ' ';
  }
  return s;
}

template <typename T>
ostream& operator<<(ostream& s, const vector<vector<T>>& vv) {
  int len = vv.size();
  for (int i = 0; i < len; ++i) {
    s << vv[i];
    if (i != len - 1)
      s << '\n';
  }
  return s;
}

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

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


/*
  重み付きUnionFind。
  可換群が乗る（和など）。

  WeightedUnionFind<type> uf(node, unit);
  root(x)
  weight(x)
  issame(x, y)
  diff(x, y) ... Wy - Wx
  merge(x, y, weight) ... Wx + weight = Wy
*/

template <class Abel>
struct WeightedUnionFind {
  vector<int> par, rank;
  vector<Abel> diff_weight;

  WeightedUnionFind(int n = 1, Abel SUM_UNITY = 0) {
    init(n, SUM_UNITY);
  }

  void init(int n = 1, Abel SUM_UNITY = 0) {
    par.resize(n);
    rank.resize(n);
    diff_weight.resize(n);
    for (int i = 0; i < n; ++i)
      par[i] = i, rank[i] = 0, diff_weight[i] = SUM_UNITY;
  }

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

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

  bool issame(int x, int y) {
    return root(x) == root(y);
  }

  bool merge(int x, int y, Abel w) {
    w += weight(x), w -= weight(y);
    x = root(x), y = root(y);
    if (x == y)
      return false;
    if (rank[x] < rank[y])
      swap(x, y), w = -w;
    if (rank[x] == rank[y])
      ++rank[x];
    par[y] = x;
    diff_weight[y] = w;
    return true;
  }

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

/*
https://atcoder.jp/contests/abc087/tasks/arc090_b
*/

signed main() {
  int N, M;
  cin >> N >> M;
  vector<int> L(M), R(M), D(M);
  WeightedUnionFind<int> uf(N, 0);
  rep(i, M) {
    int L, R, D;
    cin >> L >> R >> D;
    L--, R--;

    if (uf.issame(L, R)) {
      if (uf.diff(L, R) != D) {
        cout << "No\n";
        return 0;
      }
    } else {
      uf.merge(L, R, D);
    }
  }
  cout << "Yes\n";
}

Measured memory_bytes: 7296
#include <algorithm>　　　 //STL 通用算法
#include <bitset>　　　　　//STL 位集容器
#include <cctype>         //字符处理
#include <cerrno> 　　　　 //定义错误码
#include <cfloat>　　　　 //浮点数处理
#include <ciso646>         //对应各种运算符的宏
#include <climits> 　　　　//定义各种数据类型最值的常量
#include <clocale> 　　　　//定义本地化函数
#include <cmath> 　　　　　//定义数学函数
#include <complex>　　　　 //复数类
#include <csignal>         //信号机制支持
#include <csetjmp>         //异常处理支持
#include <cstdarg>         //不定参数列表支持
#include <cstddef>         //常用常量
#include <cstdio> 　　　　 //定义输入／输出函数
#include <cstdlib> 　　　　//定义杂项函数及内存分配函数
#include <cstring> 　　　　//字符串处理
#include <ctime> 　　　　　//定义关于时间的函数
#include <cwchar> 　　　　 //宽字符处理及输入／输出
#include <cwctype> 　　　　//宽字符分类
#include <deque>　　　　　 //STL 双端队列容器
#include <exception>　　　 //异常处理类
#include <fstream> 　　　 //文件输入／输出
#include <functional>　　　//STL 定义运算函数（代替运算符）
#include <limits> 　　　　 //定义各种数据类型最值常量
#include <list>　　　　　　//STL 线性列表容器
#include <locale>         //本地化特定信息
#include <map>　　　　　　 //STL 映射容器
#include <memory>         //STL通过分配器进行的内存分配
#include<new>            //动态内存分配
#include <numeric>         //STL常用的数字操作
#include <iomanip> 　　　 //参数化输入／输出
#include <ios>　　　　　　 //基本输入／输出支持
#include <iosfwd>　　　　　//输入／输出系统使用的前置声明
#include <iostream> 　　　//数据流输入／输出
#include <istream>　　　　 //基本输入流
#include <iterator>        //STL迭代器
#include <ostream>　　　　 //基本输出流
#include <queue>　　　　　 //STL 队列容器
#include <set>　　　　　　 //STL 集合容器
#include <sstream>　　　　 //基于字符串的流
#include <stack>　　　　　 //STL 堆栈容器
#include <stdexcept>　　　 //标准异常类
#include <streambuf>　　　 //底层输入／输出支持
#include <string>　　　　　//字符串类
#include <typeinfo>        //运行期间类型信息
#include <utility>　　　　 //STL 通用模板类
#include <valarray>        //对包含值的数组的操作
#include <vector>　　　　　//STL 动态数组容器
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;

const int MAXN=2e5+10;
const int MOD=998244353;

inline int read(){
	int x=0,f=1;char c=getchar();
	while(!isdigit(c)){if(c=='-')f=-1;c=getchar();}
	while(isdigit(c))x=(x<<3)+(x<<1)+c-'0',c=getchar();
	return x*f;
}
inline ll readll(){
	ll x=0;int f=1;char c=getchar();
	while(!isdigit(c)){if(c=='-') f=-1;c=getchar();}
	while(isdigit(c)) x=(x<<3ll)+(x<<1ll)+1ll*(c-'0'),c=getchar();
	return x*f;
}
int gcd(int x,int y){
	return y?gcd(y,x%y):x;
}
ll gcd(ll x,ll y){
	return y?gcd(y,x%y):x;
}

int n;
ll a[MAXN],ans;

int main(){
	n=read();
	for(int i=1;i<=n;i++) a[i]=readll();
	sort(a+1,a+1+n);
	ans=a[n];
	for(int i=1;i<=n-2;i++) ans+=a[n-1-(i-1)/2];
	printf("%lld\n",ans);
	return 0;
}

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

int main() {
	int a, b, c;
	int i = 0;

	cin >> a>>b >> c;

	if (a*b < c) {
		i = a*b;
	}
	else {
		i = c;
	}
	
	


	cout << i << endl;
	

	return 0;
}

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



signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(20);
    
    int n;
    cin>>n;
    ll a[n];
    for(int i=0;i<n;i++){
        cin>>a[i];
    }

    ll INF = 1e18+7;
    ll dp[n+1][n+1]={};
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            dp[i][j] = INF;
            if(i==j) dp[i][j] = 0;
        }
    }
    for(int i=1;i<n;i++) a[i] += a[i-1];
    for(int i=n-1;i>=0;i--){
        for(int j=i;j<n;j++){
            for(int k=i;k<j;k++){
                ll ret = dp[i][k] + dp[k+1][j] + a[j];
                if(i) ret -= a[i-1];
                dp[i][j] = min(dp[i][j], ret);
            }
        }
    }
    cout << dp[0][n-1] << endl;
}

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

int main(){
    int a[3],b[3],c[3];
    for(int i=0;i<3;i++){
        cin>>a[i];
    }
    for(int i=0;i<3;i++){
        cin>>b[i];
    }
    for(int i=0;i<3;i++){
        cin>>c[i];
    }
    int n,ans=0;
    cin>>n;
    int d[n];
    for(int i=0;i<n;i++)
    cin>>d[i];
    for(int i=0;i<3;i++){
        for(int j=0;j<n;j++){
            if(a[i]==d[j])
            a[i]=0;
            if(b[i]==d[j])
            b[i]=0;
            if(c[i]==d[j])
            c[i]=0;
        }
    }
    if(a[0]==0){
        if(a[1]==0&&a[2]==0)
        ans++;
        if(b[0]==0&&c[0]==0)
        ans++;
        if(b[1]==0&&c[2]==0)
        ans++;
    }
    if(a[1]==0&&b[1]==0&&c[1]==0)
    ans++;
    if(a[2]==0&&b[2]==0&&c[2]==0)
    ans++;
    if(b[0]==0&&b[1]==0&&b[2]==0)
    ans++;
    if(c[0]==0&&c[1]==0&&c[2]==0)
    ans++;
    if(a[2]==0&&b[1]==0&&c[0]==0)
    ans++;
    if(ans>0)
    cout<<"Yes"<<endl;
    else
    cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 256
import 'dart:io';

void main() {
  List<String> NandK = stdin.readLineSync().split(' ');
  List<int> P =
      stdin.readLineSync().split(' ').map((x) => int.parse(x)).toList();
  
  int K = int.parse(NandK[1]);
  int ans = 0;

  P.sort();
  for (int i = 0; i < K; i++) {
    ans += P[i];
  }
  print(ans);
}


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

#define Fast ios_base::sync_with_stdio(0);cin.tie(0),cout.tie(0)
#define FO freopen("in.txt", "r", stdin)
#define FC freopen("out.txt", "w", stdout)
#define aise cout<<"aise"<<endl
#define pb push_back
#define mp make_pair
#define ll long long
#define mset(v, a) memset(v, a, sizeof(v))
#define pll pair< ll, ll >
#define pdd pair< double, double >
#define ff first
#define ss second
#define pi acos(-1.0)
#define mxN 100010
#define inf 1e9

int main()
{

    ll n;
    cin >> n;
    bool tf=0;
    for(ll i = 1; i <= 9; i++)
    {

        if(n % i==0)
        {

            ll x = n/i;
            if(x >= 1 && x <= 9) tf=1;
        }
    }
    if(tf) cout << "Yes";
    else cout << "No";
}


Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<vector>
#include<queue>
#define rep(index,num) for(int index=0;index<num;index++)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-15
typedef long long ll;
using namespace std;
typedef pair<int,int> pint;
bool arr[55555];
int Nmax=55555;
vector<int> prime;
void Eratosthenes(){
	for(int i = 0; i < Nmax; i++){
		arr[i] = true;
	}
	arr[0]=false; arr[1]=false;
	for(int i = 2; i < sqrt(Nmax); i++){
		if(arr[i]){
			for(int j = 0; i * (j + 2) < Nmax; j++){
				arr[i *(j + 2)] = false;
			}
		}
	}
	for(int i=2;i<Nmax;i++){
		if(i%5!=1){
			arr[i]=false;
		}
	}
	for(int i=2;i<Nmax;i++){
		if(arr[i]) prime.push_back(i);
	}
}
int main(){
	Eratosthenes();
	int N;
	scan(N);
	rep(i,N){
		printf("%d ",prime[i]);
	}
	kaigyo;
	return 0;
}


Measured memory_bytes: 256
/*@author Vipen Loka*/
#include <bits/stdc++.h>
#define endl '\n'
#define ff first
#define ss second
#define ll long long int
#define vi vector<int>
#define vll vector<ll>
#define vvi vector < vi >
#define pii pair<int,int>
#define pll pair<long long, long long>
#define mod 1000000007
#define inf 1000000000000000001;
#define deb(x) cout << #x << ':' << x << '\n';

using namespace std;

void solve(){
	int i,j;
	int n;
	cin >> n;
	vector<vector<int>> v(n,vector<int>(3));
	for (int i = 0; i < n; ++i)
	{
		for (int j = 0; j < 3; ++j)
		{
			cin >> v[i][j];
		}
	}

	vector<vector<int>> dp(n+1,vector<int>(3,0));

	for (int i = 1; i < n+1; ++i)
	{
		dp[i][0]=max(dp[i-1][1],dp[i-1][2])+v[i-1][0];
		dp[i][1]=max(dp[i-1][0],dp[i-1][2])+v[i-1][1];
		dp[i][2]=max(dp[i-1][0],dp[i-1][1])+v[i-1][2];
		
	}

	printf("%d\n",max({dp[n][0],dp[n][1],dp[n][2]}));




}


int main(){
	int T=1;
	// cin >> T;
	while (T--){
		solve();
	}
}


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

int main(){
    int n,m;
    cin>>n>>m;
    string a[n],b[m];
    bool flag=false;
    for(int i=0; i<n; i++){
        cin>>a[i];
    }
    for(int i=0; i<m; i++){
        cin>>b[i];
    }
    for(int i=0; i<n-m+1; i++){
        for(int j=0; j<n-m+1; j++){
            bool judge=true;
            for(int k=0; k<m; k++){
                for(int l=0; l<m; l++){
                    judge&=(a[i+k][j+l]==b[k][l]);
                    //cout<<a[i+k][j+l]<<endl;
                    //cout<<b[k][l]<<endl;
                }
            }
            if(judge){
                flag=true;
                goto escape;
            }
        }
    }
    escape:;
    if(flag)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    /*
    for(int i=0; i<n; i++){
        for(int j=0; j<n; j++){
            cout<<a[i][j];
        }
        cout<<endl;
    }*/
    /*for(int i=0; i<m; i++){
        for(int j=0; j<m; j++){
            cout<<b[i][j];
        }
        cout<<endl;
    }*/
    return 0;
}



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

int main() {
  int a,b;
  cin>>a>>b;
  vector<int> v(b);
  for(int i=0;i<b;i++){
    cin>>v[i];
  }
  int count=0;
  for(int i=0;i<b;i++){
    count+=v[i];
  }
  if(count>a){
    cout<<-1<<endl;
  }
  else{
    cout<<a-count<<endl;
  }
}

Measured memory_bytes: 3696
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define rep(i, n) for(int i = 0; i < n; i++)
#define REP(i, a, b) for(int i = a; i <= b; i++)
#define all(x) x.begin(), x.end()
#define fi first
#define se second
#define debug(...) cerr<<__LINE__<<" ["<<#__VA_ARGS__<<"]:",debug_out(__VA_ARGS__)
template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec)
{ for (auto v : vec) os << v << ' '; os << '\n'; return os; }
template <typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &pa)
{ os << '(' << pa.first << ',' << pa.second << ')'; return os; }
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail> void debug_out(Head H, Tail... T)
{ cerr << " " << H; debug_out(T...); }
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; }
const int INF = (1<<30) - 1;
const ll LINF = (1LL<<60) - 1;

void solve() {
    int n;
    cin >> n;
    vector<string> S(n);
    rep(i, n) {
        cin >> S[i];
        sort(all(S[i]));
    }
    map<string, ll> mp;
    rep(i, n) mp[S[i]]++;
    ll ans = 0;
    for(auto x : mp) ans += x.se * (x.se - 1) / 2;
    cout << ans << endl;
}

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


Measured memory_bytes: 14244
def main():
    import sys
    input = sys.stdin.readline

    mod = 1000000007
    nmax = 1001  # change here
    fac = [0] * (nmax + 1)
    finv = [0] * (nmax + 1)
    inv = [0] * (nmax + 1)
    fac[0] = 1
    fac[1] = 1
    finv[0] = 1
    finv[1] = 1
    inv[1] = 1
    for i in range(2, nmax):
        fac[i] = fac[i - 1] * i % mod
        inv[i] = mod - inv[mod % i] * (mod // i) % mod
        finv[i] = finv[i - 1] * inv[i] % mod

    N, A, B, C, D = map(int, input().split())

    dp = [[0] * (N+1) for _ in range(B+1)]
    for i in range(B+1):
        dp[i][0] = 1

    for i in range(A, B+1):
        for j in range(N+1):
            dp[i][j] = dp[i-1][j]
        for j in range(N+1):
            if (N-j) // i < C:
                continue
            n_max = min(D, (N-j)//i)
            for n in range(C, n_max+1):
                tmp = (((fac[N-j] * finv[N-j-i*n])%mod * pow(finv[i], n, mod))%mod * finv[n])%mod
                dp[i][j+i*n] = (dp[i][j+i*n] + (dp[i-1][j] * tmp)%mod) % mod
    print(dp[-1][-1])


if __name__ == '__main__':
    main()


Measured memory_bytes: 50268
#include <iomanip>
#include <cmath>
#include <cstdio>
#include <utility>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <stack>
#define NDEBUG
#include <cassert>
#include <bitset>
using namespace std;

#define prv(a)            \
    for (auto x : a)      \
    {                     \
        cout << x << " "; \
    }                     \
    cout << '\n';
#define prvp(a)                                     \
    for (auto x : a)                                \
    {                                               \
        cout << x.first << " " << x.second << '\n'; \
    }                                               \
    cout << '\n';
#define ll long long
#define ld long double
#define INF pow(10, 10)
#define all(v) v.begin(), v.end()
#define bg begin()
#define ed end()
#define tr(it, v) for (auto it = v.bg; it != v.ed; it++)
#define f(a, b) for (ll i = a; i < b; i++)
#define fj(a, b) for (ll j = a; j < b; j++)
#define fb(b, a) for (ll i = b; i > a; i--)
#define deb(x) cout << #x << " " << x << '\n';
#define pr1(x) cout << (x) << " ";
#define pr(x) cout << (x) << endl;
#define pr2(x, y) cout << (x) << " " << (y) << endl;
#define pr3(x, y, z) cout << (x) << " " << (y) << " " << (z) << endl;
#define pp(x) cout << x.first << " " << x.second << endl;
ll min(ll a, ll b) {if(a < b) return a; else return b;} 
ll max(ll a, ll b) {if(a < b) return b; else return a;} 
ll gcd(ll a, ll b)
{
    if (b > a) return gcd(b, a);
    if (b == 0) return a;
    return gcd(b, a % b);
}
const ll N = 1e8;
const ll S = 1e5 + 7;

ll mod(ll n);
ll modM(ll n, ll m);
ll modA(ll n, ll m);
ll modS(ll n, ll m);
ll power(ll a, ll b);
void ipgraph(ll n, ll m);
//==============================================================================================

vector<vector<ll>> v;
vector<bool> vis;

void solve()
{
    ll n;
    cin >> n;
    vector<ll> a(n), dp(n);
    f(0, n) cin >> a[i]; 
    dp[0]=0; 
    dp[1]=abs(a[1]-a[0]);
    f(2, n) dp[i]=min(dp[i-1]+abs(a[i]-a[i-1]),dp[i-2]+abs(a[i]-a[i-2]));  
    pr(dp[n-1])
}   

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

#ifndef ONLINE_JUDGE
    freopen("/Users/aturgupta/Desktop/CP/input.txt", "r", stdin);
    freopen("/Users/aturgupta/Desktop/CP/output.txt", "w", stdout);
#endif

    ll t;
    //cin >> t;
    t=1; 
    while (t--) solve();
    cerr << endl << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
    return 0;
}

void ipgraph(ll n, ll m)
{
    v.assign(n, {});
    vis.assign(n, 0);
    ll x, y;
    f(0, m)
    {
        cin >> x >> y;
        x--, y--;
        v[x].push_back(y);
        v[y].push_back(x);
    }
}

ll power(ll a, ll b)
{
    if (b == 0) return 1;
    ll c = power(a, b / 2);
    if (b % 2 == 0) return modM(c,c);
    else return modM(modM(c,c),a);
}

ll mod(ll n) {return (n % N + N) % N; }
ll modM(ll n, ll m) { return ((n % N * m % N) + N) % N; }
ll modA(ll n, ll m) { return ((n % N + m % N) + N) % N; }
ll modS(ll n, ll m) { return ((n % N - m % N) + N) % N; }


Measured memory_bytes: 4308
/*
??????????????????????????´??° a ??¨ b ??????????????°???????????????????????°?????????????????????????????????
???????????????????????° <= 200
*/

#include <iostream>
#include <string>

using namespace std;
 
int main()
{

	int a, b, calc, strCount = 0;
	string str = "";

	for ( int i = 0; i < 200;  i++ ) {
		a = b = 0;
		
		cin >> a >> b;

		if ( a == 0 && b == 0 ) {
			break;
		}

		calc = a + b;
		str = to_string( calc );
		strCount = str.size();
		
		cout << strCount << endl;
	}

    return 0;
}

Measured memory_bytes: 3124
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<tuple>
#include<map>
#include<queue>
#define rep(i, n) rep2(i,0,n)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
typedef long long ll;
using namespace std;

ll gcd(ll m, ll n) {
	if (n == 0) return abs(m);

	return gcd(n, m%n);
}

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

	ll ans = 1;
	ll G = gcd(a, b);
	
	for (ll i = 2; i*i <= G; ++i) {
		if (G % i == 0) {
			ans++;
			while (G%i == 0) G /= i;
		}
		
	}
	if (G != 1) ++ans;
	cout << ans << endl;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
int main(){
    ios::sync_with_stdio(false);
    int x,n;
    cin >> x >> n;
    vector<int> p(n);
    rep(i,n) cin >> p[i];
    rep(i,210) {
        int ans = x-i;
        bool ok = true;
        rep(i,n) if(p[i] == ans) {
            ok = false;
            break;
        }
        if(ok) {
            cout << ans << endl;
            return 0;
        }
        ans = x+i;
        ok = true;
        rep(i,n) if(p[i] == ans) {
            ok = false;
            break;
        }
        if(ok) {
            cout << ans << endl;
            return 0;
        }
    }
}


Measured memory_bytes: 3660
#include "bits/stdc++.h"
// Begin Header {{{
#define all(x)          (x).begin(), (x).end()
#define rep(i, n)       for (i64 i = 0, i##_limit = (n); i < i##_limit; ++i)
#define reps(i, s, t)   for (i64 i = (s), i##_limit = (t); i <= i##_limit; ++i)
#define repr(i, s, t)   for (i64 i = (s), i##_limit = (t); i >= i##_limit; --i)
#define var(Type, ...)  Type __VA_ARGS__; input(__VA_ARGS__)
#ifndef DBG
#define trace(...)
#endif
using namespace std;
using i64 = int_fast64_t;
using pii = pair<i64, i64>;
template <class T, class U> inline bool chmax(T &a, const U &b) { return b > a && (a = b, true); }
template <class T, class U> inline bool chmin(T &a, const U &b) { return b < a && (a = b, true); }
inline i64  sigma(i64 n)            { return (n * (n + 1) >> 1); }
inline i64  updiv(i64 a, i64 b)     { return (a + b - 1) / b; }
inline i64  sqr(i64 n)              { return n * n; }
inline string to_string(char c)     { return string(1, c); }
constexpr int INF  = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;

template <class T>
inline vector<T> make_v(const T &initValue, size_t sz) {
    return vector<T>(sz, initValue);
}
template <class T, class... Args>
inline auto make_v(const T &initValue, size_t sz, Args... args) {
    return vector<decltype(make_v<T>(initValue, args...))>(sz, make_v<T>(initValue, args...));
}

inline void input() {}
template <class Head, class... Tail>
inline void input(Head &head, Tail&... tail) { cin >> head; input(tail...); }

inline void print() { cout << "\n"; }
template <class Head, class... Tail>
inline void print(Head &&head, Tail&&... tail) {
    cout << head;
    if (sizeof...(tail)) cout << ' ';
    print(forward<Tail>(tail)...);
}

template <class T>
inline ostream& operator<< (ostream &out, const vector<T> &vec) {
    static constexpr const char *delim[] = { " ", "" };
    for (const auto &e : vec) out << e << delim[&e == &vec.back()];
    return out;
}

template <typename Func>
struct FixPoint : Func {
    inline constexpr FixPoint(Func &&f) noexcept : Func(forward<Func>(f)) {}

    template <typename... Args>
    inline decltype(auto) operator()(Args &&... args) const {
        return Func::operator()(*this, forward<Args>(args)...);
    }
};

template< typename Func >
inline decltype(auto) makeFixPoint(Func &&f) {
    return FixPoint< Func >{forward< Func >(f)};
}
// }}} End Header

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

    var(int, N);
    vector<i64> a(N);

    rep(i, N) input(a[i]);

    i64 sumL = 0;
    i64 sumR = accumulate(all(a), 0LL);

    i64 ans = abs(sumL - sumR);

    rep(i, N) {
        sumL += a[i];
        sumR -= a[i];
        chmin(ans, abs(sumL - sumR));
    }

    print(ans);

    return 0;
}


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

int main()
{
  string S;
  cin >> S;
  int ans = 0;
  for (int i = 0; i < S.size() / 2; i++)
  {
    if (S.at(i) != S.at(S.size() - i - 1))
    {
      ans++;
    }
  }
  cout << ans << endl;
}


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

int main(void) {
	
	string S;
	long long int K,tmp;
	cin >> S >> K;
  	for(int i = 0; i < S.size(); i++) {
    	if(S[i] != '1') {
        	tmp = i+1;
         	break;
        }
    }
  
  	if(K < tmp) {
    	cout << 1 << endl;
    }else {
    	cout << S[tmp-1] << endl;
    }
  
	return 0;
}

Measured memory_bytes: 256