akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

#define eb emplace_back
#define pb push_back
#define INF 1LL<<62
#define FLT_INF pow(10.0, 16)

using ll = long long;
using vll = vector<ll>;
using ull = unsigned long long;
using int2 = pair<int, int>;
using int3 = tuple<ll, ll, ll>;

template <typename A> string to_string(const A& v);
string to_string(const string& s) { return '"'+ s + '"'; }
string to_string(const char *s) { return to_string((string)s); }
string to_string(bool b) { return (b ? "true" : "false"); }

template <typename A, typename B> string to_string(const pair<A, B>& p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <typename A, typename B, typename C> string to_string(const tuple<A, B, C>& p) {
  return "(" + to_string(std::get<0>(p)) + ", " + to_string(std::get<1>(p)) +  ", " + to_string(std::get<2>(p)) + ")";
}

template <typename A> string to_string(const A& v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}

template <typename T>
void sort(vector<T>& val) {
  sort(val.begin(), val.end());
}

template <typename T>
void sort_b(vector<T>& val) {
  sort(val.begin(), val.end(), greater<T>());
}

template <typename T>
T mul_mod(T a, T b, T mod) {
  T res = 0;
  a %= mod;
  while (b) {
    if (b & 1) {
      res = (res + a) % mod;
    }
    a = (2 * a) % mod;
    b >>= 1;
  }
  return res;
}

void debug_out() { cerr << endl; }

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

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...);
#endif

#define COMMON_MOD pow(10, 9) + 7
#define PI 3.14159265

// sort(a.begin(), a.end(), less<ll>()); greater<ll>()
// cout<<fixed<<setprecision(20)<<(s/kl)*2;
/* printf("%lld %lld \n", cur_n, m / 2 + 1);
*/

class mytask {
public:
  mytask() { }

  int solve() {

    ll n;
    cin >> n;

    vll a(n+1);
    vll b(n);
    for (int i = 0; i <= n; i++) {
      cin >> a[i];
    }


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

    ll def_monsters = 0;
    for (int i = 0; i < n; i++) {
      ll def_monsters_step = min(a[i], b[i]);
      a[i]-=def_monsters_step;
      b[i]-=def_monsters_step;
      def_monsters += def_monsters_step;
      def_monsters_step = min(a[i+1], b[i]);
      a[i+1]-=def_monsters_step;
      b[i]-=def_monsters_step;
      def_monsters += def_monsters_step;
    }

    cout << def_monsters;




    return 0;
  }
};


int main() {

  ios::sync_with_stdio(false);
  cin.tie(0);

  auto task = mytask();
  task.solve();

  cout << endl;

  return 0;
}


Measured memory_bytes: 1792
// I SELL YOU...! 
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<chrono>
#include<iomanip>
#include<map>
#include<set>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using TP = tuple<ll,ll,ll>;
void init_io(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(18);
}
signed main(){
  init_io();
  ll a,b,v,w,t,dis;
  cin >> a >> v >>b >> w >> t;
  dis = abs(b-a);
  ll tmp = t*v-t*w;
  if(tmp>=dis){
    cout <<"YES\n";
  }else{
    cout <<"NO\n";
  }
}


Measured memory_bytes: 3648
#include<iostream>
#include<algorithm>
using namespace std;
int main() {
  long int N, tmp = 0;
  cin >> N;
  long int d[N];
  for(int i = 0; i < N; i++) {
    cin >> d[i];
  }
  sort(d, d + N);
  if(N % 2 == 0) {
    tmp = d[N / 2] - d[N / 2 - 1];
  }
  cout << tmp << endl;
  return 0;
}

Measured memory_bytes: 1024
function candyDistributionAgain(N, x, a) {
  a.sort(function(a,b) {
    return a - b;
  });
  
  var satisfaction = 0; //  ＼（｀д´）ゝ
  for ( var i = 0; i < a.length; i++ ) {
    x -= a[i];
    if (x >= 0) {
        satisfaction++;
    }
  }
  
  if (x > 0) {
      satisfaction--;
  }
  return satisfaction;
}

function main(input) {
    var input = input.split("\n");
    var Nx = input[0].split(" ");
    var a = input[1].split(" ");
    var N = Nx[0];
    var x = Nx[1];
    console.log(candyDistributionAgain(N, x, a));
}

main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 21064
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.NoSuchElementException;

public class Main {
    // template start ---8<-----------8<---
	FastScanner sc = new FastScanner(System.in);
	static PrintWriter out;

	public static void main(String[] args) throws IOException {
		out = new PrintWriter(System.out);
		new Main().solve();
		out.flush();
	}
	// template end ---8<-----------8<---

	void solve() {
		int ans = 0;
		char[] s = sc.next().toCharArray();
		for (char c : s) {
			if (c == '1') {
				ans++;
			}
		}
		out.println(ans);
	}

    // template start ---8<-----------8<---
	class FastScanner {
		private final InputStream in;
		private final byte[] buffer = new byte[1024];
		private int ptr = 0;
		private int buflen = 0;

		FastScanner(InputStream in) {
			this.in = in;
		}

		private boolean hasNextByte() {
			if (ptr < buflen) {
				return true;
			} else {
				ptr = 0;
				try {
					buflen = in.read(buffer);
				} catch (IOException e) {
					e.printStackTrace();
				}
				if (buflen <= 0) {
					return false;
				}
			}
			return true;
		}

		private int readByte() {
			if (hasNextByte())
				return buffer[ptr++];
			else
				return -1;
		}

		private boolean isPrintableChar(int c) {
			return 33 <= c && c <= 126;
		}

		public boolean hasNext() {
			while (hasNextByte() && !isPrintableChar(buffer[ptr]))
				ptr++;
			return hasNextByte();
		}

		public String next() {
			if (!hasNext())
				throw new NoSuchElementException();
			StringBuilder sb = new StringBuilder();
			int b = readByte();
			while (isPrintableChar(b)) {
				sb.appendCodePoint(b);
				b = readByte();
			}
			return sb.toString();
		}

		public long nextLong() {
			if (!hasNext())
				throw new NoSuchElementException();
			long n = 0;
			boolean minus = false;
			int b = readByte();
			if (b == '-') {
				minus = true;
				b = readByte();
			}
			if (b < '0' || '9' < b) {
				throw new NumberFormatException();
			}
			while (true) {
				if ('0' <= b && b <= '9') {
					n *= 10;
					n += b - '0';
				} else if (b == -1 || !isPrintableChar(b)) {
					return minus ? -n : n;
				} else {
					throw new NumberFormatException();
				}
				b = readByte();
			}
		}

		public int nextInt() {
			long nl = nextLong();
			if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
				throw new NumberFormatException();
			return (int) nl;
		}

		public double nextDouble() {
			return Double.parseDouble(next());
		}
	}

	class Random {
		private long seed;
		private final long multiplier = 0x5DEECE66DL, addend = 0xBL, mask = (1L << 48) - 1;
		int bits, val;

		Random(long seed) {
			this.seed = seed;
		}

		int nextInt(int n) {
			do {
				bits = (int) ((seed = (seed * multiplier + addend) & mask) >>> 17);
				val = bits % n;
			} while (bits - val + (n - 1) < 0);
			return val;
		}

		double nextDouble() {
			return nextInt(10000000) / 10000000.0;
		}
	}

	final double TEMP = 10;
	static final long TL = 5850;
	static boolean submit = true;
    // template end ---8<-----------8<---

}



Measured memory_bytes: 21076
#include<iostream>
#include<bits/stdc++.h>
#include<iomanip>
#include<vector>
#include<cctype>
#include<string>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
std::string line;

int main(){
  string a;
  getline(cin , a);

  rep(i,a.length()){
      if(isalnum(a[i])){
        if(islower(a[i])) a[i] = toupper(a[i]);
        else if(isupper(a[i])) a[i] = tolower(a[i]);
      }    
      cout << a[i];
  }
  cout << endl;


}


Measured memory_bytes: 3200
# coding: utf-8
import time
import os
import time
import re
s=input()
left=s[0:2]
right=s[2:4]
if left[0]==0:
    left=left[1]
if right[0]==0:
    right=right[1]
left=int(left)
right=int(right)
bo=[False for a in range(2)]#YYMM MMYY

#YYMM
if right>0 and right<13:
    bo[0]=True
#MMYY
if left>0 and left<13:
    bo[1]=True

if bo[0]==True and bo[1]==True:
    print("AMBIGUOUS")
elif bo[0]==False and bo[1]==False:
    print("NA")
elif bo[0]==True and bo[1]==False:
    print("YYMM")
else:
    print("MMYY")

Measured memory_bytes: 3184
n = int(input())
xy = [list(map(int,input().split())) for _ in range(n)]

L1 = [i[0] + i[1] for i in xy]
L2 = [i[0] - i[1] for i in xy]

m1 = max(L1) - min(L1)
m2 = max(L2) - min(L2)

print( max(m1, m2) )

Measured memory_bytes: 129020
import java.math.BigInteger;
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String[] arg = sc.nextLine().split(" ");
        int n = Integer.parseInt(arg[0]);
        String d = arg[1];

        int count = 0;
        for (int i = 0; i < n; i++) {
            String[] value = sc.nextLine().split(" ");
            BigInteger x = new BigInteger(value[0]);
            BigInteger y = new BigInteger(value[1]);
            BigInteger xs = x.multiply(x);
            BigInteger ys = y.multiply(y);
            BigInteger comp = xs.add(ys);
            BigInteger dd = new BigInteger(d);
            BigInteger ds = dd.multiply(dd);
            if(comp.compareTo(ds) <= 0) {
                count++;
            }
        }
        System.out.println(count);
    }
}


Measured memory_bytes: 61644
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define SORT(x) sort(x.begin(), x.end())
#define RS(x) rsort(x.begin(),x,end()))
#define REVE(x) reverse(x.begin(), x.end())
#define ALL(x) (x).begin(), (x).end()
int INF = 1e9 + 1;
int MOD = 1e9+7;
struct initon
{
    initon()
    {
        cin.tie(0);
        ios::sync_with_stdio(false);
    };
};
signed main()
{
   int n,ans=0;
   cin >>n;
   vector<int> a(n);
   REP(i,n){
       cin >> a[i];
   }
   REP(i,n){
       if(a[a[i]-1]==i+1){
           ans++;
       }
   }
cout << ans/2;
}

Measured memory_bytes: 1024
<?php
fscanf(STDIN, "%d", $n);

$format = join(' ', array_fill(0, $n, '%s'));
$cards = fscanf(STDIN, $format);

$cards1 = $cards;
bubbleSort($cards1);

$cards2 = $cards;
selectionSort($cards2);

printResult($cards, $cards1);
printResult($cards, $cards2);

function printResult($cards, $sorted_cards)
{
    $result = join(' ', $sorted_cards);

    echo "$result\n";
    echo checkStable($cards, $sorted_cards)."\n";
}

function checkStable($cards, $sorted_cards)
{
    $prev_card = "S0";
    $prev_card_index = -1;

    foreach ($sorted_cards as $card) {
        $card_index = array_search($card, $cards);
        if (cardNum($prev_card) == cardNum($card)) {
            if ($prev_card_index >= $card_index) {
                return 'Not stable';
            }
        }

        $prev_card = $card;
        $prev_card_index = $card_index;
    }

    return 'Stable';
}

function cardNum($card)
{
    return intval(substr($card, 1));
}

function swap(&$cards, $i, $j)
{
    $tmp       = $cards[$i];
    $cards[$i] = $cards[$j];
    $cards[$j] = $tmp;
}

function bubbleSort(&$cards)
{
    $need_to_sort = true;

    while ($need_to_sort) {
        $need_to_sort = false;

        for ($i = count($cards)-1; $i > 0; $i--) {
            if (cardNum($cards[$i-1]) <= cardNum($cards[$i])) {
                continue;
            }

            swap($cards, $i, $i-1);

            $need_to_sort = true;
        }
    }
}

function selectionSort(&$cards)
{
    $N = count($cards);

    for ($i = 0; $i < $N; $i++) {
        $minj = $i;

        for ($j = $i; $j < $N; $j++) {
            if (cardNum($cards[$j]) < cardNum($cards[$minj])) {
                $minj = $j;
            }
        }

        if ($i != $minj) {
            swap($cards, $i, $minj);
        }
    }
}

Measured memory_bytes: 6684
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import math

def is_prime(x):
    for i in range(2, math.floor(math.sqrt(x))+1):
        if x %  i == 0:
            return False
    return True


def main():
    X = int(input())

    while(True):
        if is_prime(X):
            break
        X += 1
    
    print(X)


if __name__ == '__main__':
    main()

Measured memory_bytes: 38768
n = int(input())
a = list(map(int, input().split()))
q = int(input())
bc = [list(map(int, input().split())) for i in range(q)]

sumA = 0
num = [0]*100100
for aa in a:
    num[aa] += 1
    sumA += aa

for b, c in bc:
    sumA = sumA + ((c - b) * num[b])
    num[c] += num[b]
    num[b] = 0
    print(sumA)


Measured memory_bytes: 32344
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <cstring>
#include <math.h>
#include <bitset>
#include <queue>
#include <set>
#include <iomanip>
#include <math.h>
#include <assert.h>
// #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr long long int INFLL = 1001001001001001LL;
constexpr int INF = 1000000007;
const int mod = 1000000007;

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

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

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

//----------------------------------------------------------------

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

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <math.h>
#include <cstdlib>
#include <cmath>

using namespace std;

int main(){
  int n,m;
  cin >> n >> m;
  cout << (n-1)*(m-1) << endl;

  return 0;
}


Measured memory_bytes: 256
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
from collections import deque

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

DR = [1, -1, 0, 0]
DC = [0, 0, 1, -1]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
     
def main():
    N = I()
    A = LI_()
    buka = [0 for i in range(N)]
    for i, a in enumerate(A):
        buka[a] += 1
    for b in buka:
        print(b)



main()



Measured memory_bytes: 34352
N=int(input())
p=list(map(int, input().split()))

i=0
out=0
while i<N-1:
  if p[i]==i+1:
    p[i:i+2]=[p[i+1], p[i]]
    i+=2
    out+=1
  else:
    i+=1
    
if i==N-1 and p[N-1]==N:
  out+=1
print(out)

Measured memory_bytes: 14008
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;
typedef long long ll;

int main() {
    vector<int> vec(3);
    for(int i=0;i<3;i++)
        cin >> vec[i];
    sort(vec.begin(), vec.end());
    cout << vec[0] + vec[1] << endl;

}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <climits>
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <string>
#include <sstream>
#include <vector>
#include <map>
#include <set>
#include <complex>
#include <functional>
#include <utility>
#include <iterator>

#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
#define FOR(i, m, n) for(int i = (m); i < (int)(n); ++i)
#define ALL(x) (x).begin(), (x).end()
#define INF 2000000000

#ifdef LOCAL
  #define dprintf(...) fprintf(stdout, __VA_ARGS__)
#else
  #define dprintf(...) 0
#endif

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef unsigned int uint;


int main() {
  string s;
  cin >> s;

  string ans = "Yes";

  REP(i, s.size()) {
    if(i % 2 == 0 && s[i] == 'L') {
      ans = "No";
    }
    else if(i % 2 == 1 && s[i] == 'R') {
      ans = "No";
    }
  }

  cout << ans << '\n';

  return 0;
}


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

int main(){
  string searchWord, word;
  int count = 0;

  cin >> searchWord;

  for(int i = 0; i < 9; i++){
    if(searchWord[i] == '\0') break;
    searchWord[i] = tolower(searchWord[i]);
  }

  while(cin >> word){
    if(word == "END_OF_TEXT") break;
    for(int i = 0; i < 9; i++){
      if(word[i] == '\0') break;
      word[i] = tolower(word[i]);
    }

    if(word == searchWord) count++;
  }

  cout << count << endl;
  return 0;
}

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

using namespace std;

typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;

typedef pair<int, int> ii;
typedef tuple<int, int, int> iii;

typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<ld> vd;
typedef vector<ll> vl;

typedef set<int> si;
typedef set<ii> sii;
typedef set<ld> sd;
typedef set<ll> sl;

typedef map<int, int> mii;
typedef priority_queue<int> pqi;
typedef queue<int> qi;
 
#define mp make_pair
#define pb push_back
#define f first
#define s second

mt19937 rng((int) std::chrono::steady_clock::now().time_since_epoch().count());

vi dx = {0, 0, 1, -1};
vi dy = {1, -1, 0, 0};

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

    int h, w;
    cin >> h >> w;
    queue<ii> bfs;
    vector<string> a(h);
    vector<vi> d(h, vi(w, numeric_limits<int>::max()));
    for (auto &x : a) cin >> x;
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            if (a[i][j] == '#') {
                d[i][j] = 0;
                bfs.push({i, j});
            }
        }
    }

    int ans = 0;
    while (!bfs.empty()) {
        ii cur = bfs.front();
        bfs.pop();
        ans = max(ans, d[cur.f][cur.s]);
        for (int i = 0; i < 4; i++) {
            if (cur.f + dx[i] < h and cur.f + dx[i] >= 0 and cur.s + dy[i] < w and cur.s + dy[i] >= 0) {
                if (d[cur.f + dx[i]][cur.s + dy[i]] > 1 + d[cur.f][cur.s]) {
                    d[cur.f + dx[i]][cur.s + dy[i]] = 1 + d[cur.f][cur.s];
                    bfs.push({cur.f + dx[i], cur.s + dy[i]});
                }
            }
        }
    }
    cout << ans << endl;
}

/*
USE LONG LONG!!!!

:pray: :fishy15:
:pray: :summitosity:
:pray: :prodakcin:

          .=     ,        =.
  _  _   /'/    )\,/,/(_   \ \
   `//-.|  (  ,\\)\//\)\/_  ) |
   //___\   `\\\/\\/\/\\///'  /
,-"~`-._ `"--'_   `"""`  _ \`'"~-,_
\       `-.  '_`.      .'_` \ ,-"~`/
 `.__.-'`/   (-\        /-) |-.__,'
   ||   |     \O)  /^\ (O/  | .        <-  BESSIE THE COW
   `\\  |         /   `\    /
     \\  \       /      `\ /
      `\\ `-.  /' .---.--.\
        `\\/`~(, '()      ('
         /(O) \\   _,.-.,_)    
        //  \\ `\'`      /
       / |  ||   `""""~"`
     /'  |__||
           `o
*/

Measured memory_bytes: 13456
MOD=998244353
cnt=0; sum=0; prev=nil; can=true; h=Hash.new(0)
def gs() gets.chomp end
def gi() gets.to_i end
def gsmi() gets.chomp.split.map(&:to_i) end

def desc(ar) ar.sort!{|x,y|y<=>x} end
def min(a,b) a<=b ? a : b end
def max(a,b) a>=b ? a : b end
def sum(ar) ar.inject(:+) end

def C(a,b) b==0||a==b ? 1 : (b=a-b if a/2<b;(a-b+1..a).inject(:*)/(1..b).inject(:*)) end

def puts_yesno(can) puts(can ? 'Yes' : 'No') end
def putsend(s) puts s; exit end
def debug(k,v) puts "#{k}:#{v}" end
########### ( ˘ω˘ )ｽﾔｧ… ###########
n=gi
d=gsmi

# 1は0でないとだめ
putsend 0 if d[0]!=0

d.each do |i|
  h[i] += 1
end

# 距離0は1個でないとだめ
putsend 0 if h[0]!=1

# なか抜けはだめ
h1=h.keys.sort
putsend 0 if h1[-1] != h1.size-1
#puts h.to_s

cnt=1
prev=1

h.to_a.sort.each do |k,v|
  next if k==0

  current = (prev**v) % MOD #TODO
  cnt*=current
  cnt%=MOD

  prev=v
end

puts cnt

Measured memory_bytes: 22512
#include<iostream>
using namespace std;
int main(){
  int N, M, P, X[100];
  while(cin >> N >> M >> P , N){
    int sum = 0;
    for(int i = 0 ; i < N ; sum += X[i++] ) cin >> X[i];
    if(X[--M]) cout << sum * (100 - P) / X[M] << endl;
    else cout << 0 << endl;
  }
}

Measured memory_bytes: 1156
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<set>
#include<stack>
#include<queue>
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pb push_back
#define rep(i,n) for(ll i=0;i<n;i++)
#define repr(i,n) for(ll i=n;i>=0;i--)
#define INF 1e9+7
#define LLINF 1e18
using namespace std;
const int MOD = 1e9 +7;


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

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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,m;
    string s,t;
    cin>>n>>m>>s>>t;
    ll l=lcm(n,m),g=gcd(n,m);
    bool can=true;
    rep(i,g){
        if(s[n/g*i] !=t[m/g*i]) can=false;
    }
    if(can) cout<<l<<endl;
    else cout<<-1<<endl;
    return 0;
}

Measured memory_bytes: 640
#include <vector>
#include <math.h>
#include <iostream>
#include <string>
#include <algorithm>
#include <queue>
#include <iomanip>
#include <deque>
#include <map>

typedef long long ll;
#define rep(i, a, n) for(int i = a; i<n; i++)
#define ALL(a) begin(a), end(a)
#define mii map<int, int>
#define msi map<string, int>
#define vi vector<int>
#define vl vector<ll>
#define MOD 1000000007
using namespace std;
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;
}
// Greatest Common Divisor 最大公約数
ll gcd(ll a, ll b) {
    if (b == 0) return a;
    return gcd(b, a % b);
}

// least common multiple 最小公倍数
ll lcm(ll a, ll b) {
    ll g = gcd(a, b);
    return a / g * b;
}
int main() {
    ll A, B;
    cin >> A >> B;
    cout << lcm(A, B) << endl;
    return 0;
}

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

#define ll long long
#define ull unsigned long long
#define N 100005
#define mod 998244353 
#define boost ios_base::sync_with_stdio(false);cin.tie(0)
#define prec(n) fixed<<setprecision(n)

#define mii unordered_map<int,int>
#define mll unordered_map<ll,ll>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define pp pop_back
#define vii vector<int>
#define vll vector<ll>
#define vpp vector<pii>
#define all(c) c.begin(),c.end()
#define tr(it,c) for(it = c.begin() ; it!=c.end() ; it++)
int inf = INT_MAX ;
ll modulo(ll num,ll MOD=mod){ return ((num%MOD)+MOD)%MOD;} // for negative integer
ll power(ll b,ll e,ll MOD=mod){ll ans=1; while(e){if(e%2) ans=(ans*b)%MOD; b=(b*b)%MOD; e/=2;} return ans;}
ll inv(ll num,ll MOD=mod){ return power(modulo(num),MOD-2,MOD); }
ll gcd(ll a,ll b){ return ((b==0) ? a:gcd(b,a%b));}

int main(){
	boost;
	

	int n,k,q;
	cin>>n>>k>>q;
	int a[n+1];
	memset(a,0,sizeof(a));
	a[1] = k;

	for(int i=0;i<q;i++){
		int b;
		cin>>b;
		if(b==1){
			a[b+1]--;
		}else if(b==n){
			a[1]--;
			a[b]++;
		}else{
			a[b+1]--;
			a[1]--;
			a[b]++;
		}

	}

	for(int i=1;i<n+1;i++){
		a[i] = a[i-1] + a[i];
	}

	for(int i=1;i<n+1;i++){
		if(a[i]>0){
			cout<<"Yes"<<"\n";
		}else{
			cout<<"No"<<"\n";
		}
	}
	return 0;
}

Measured memory_bytes: 1024
N=int(input())
*A,=map(int, input().split())
B=[(i+1,a) for i,a in enumerate(A)]
from operator import itemgetter
B.sort(reverse=True, key=itemgetter(1))

dp = [[-1] * (N+1) for _ in range(N+1)]
dp[0][0] = 0
for i in range(1,N+1):
    idx, act = B[i-1]
    for j in range(i+1):
        k = i-j
        if 0<j: dp[j][k] = max(dp[j][k], dp[j-1][k] + act * abs(idx-j))
        if 0<k: dp[j][k] = max(dp[j][k], dp[j][k-1] + act * abs(idx-(N-k+1)))

ans=0
for j in range(N+1):
    ans = max(ans, dp[j][N-j])
print(ans)


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

const int nmax=40,abmax=10,inf = 1000000;

int a[nmax],b[nmax],c[nmax];
int dp[nmax+1][nmax*abmax+1][nmax*abmax+1];

int main(void){
int n,ma,mb;
cin >> n >> ma >> mb;

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

for(int i = 0; i <= n; ++i){
        for(int ca = 0; ca <= nmax*abmax; ++ca){
                for(int cb = 0; cb <= nmax*abmax; ++cb){
                        dp[i][ca][cb]=inf;
                }
        }
}

dp[0][0][0]=0;


for(int i = 0; i < n; ++i){
        for(int ca = 0; ca <= nmax*abmax; ++ca){
                for(int cb = 0; cb <= nmax*abmax; ++cb){
                        if(dp[i][ca][cb]==inf) continue;
                        dp[i+1][ca][cb]=min(dp[i+1][ca][cb],dp[i][ca][cb]);
                        dp[i+1][ca+a[i]][cb+b[i]]=min(dp[i+1][ca+a[i]][cb+b[i]],dp[i][ca][cb]+c[i]);
                }
        }
}

int ans=inf;
for(int ca = 1; ca <= nmax*abmax; ++ca){
        for(int cb = 1; cb <= nmax*abmax; ++cb){
                if(ca*mb==cb*ma) ans=min(ans,dp[n][ca][cb]);
        }
}
        if(ans==inf) ans=-1;
        cout << ans << endl;

        return 0;
}


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

typedef long long ll;
typedef long double ld;
//#define int ll
//#define endl '\n'

// use unique(x) - removec consecutive items, returns vec.begin() + number of items
// for vector: sort(all(vec)); vec.erase(unique(all(vec)), vec.end());
// use iota(all(vec), 0) for filling a vector with 0,1,2...
// use fill(all(vec), 1) for filling a vector with 1,1,1...
// use rotate(vec.begin(), vec.begin() + 1, vec.end()) to rotate a vector | middle arg becomes first
// print number in binary -> cout << bitset<20>(n);

const int N=200010,mod=1e9+7;
ll a[N],sm[N];
int n;
main(){
	cin.tie(0);cin.sync_with_stdio(0);
	cin>>n;
	for(int i=0;i<n;++i)cin>>a[i];
	sm[0]=a[0];
	for(int i=1;i<n;++i)sm[i]=(sm[i-1]+a[i])%mod;
	ll res=0;
	for(int i=0;i<n;++i)res=(res+a[i]*(sm[n-1]-sm[i]+mod)%mod)%mod;
	cout<<res<<endl;
}


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

constexpr int64_t INF = 1'010'000'000'000'000'017LL;
constexpr int64_t MOD = 1'000'000'007LL;
constexpr double EPS = 1e-12;
constexpr double PI = 3.14159265358979323846;

#define FOR(i, start, end) for(uint64_t i=start; i<end; i++)
#define REP(i, n) FOR(i, 0, n)

// 最大公約数gcd
// 最小公倍数lcm=m*n/gcd
uint64_t gcd(uint64_t m, uint64_t n) {
  uint64_t temp;
  while (m % n != 0){
    temp = n;
    n = m % n;
    m = temp;
  }
  return n;
}

uint64_t lcm(uint64_t m, uint64_t n) {
  return (m*n)/gcd(m,n);
}

void comb(vector<vector <uint64_t> > &v){
  for(uint64_t i = 0;i <v.size(); i++){
    v[i][0]=1;
    v[i][i]=1;
  }
  for(uint64_t k = 1;k <v.size();k++){
    for(uint64_t j = 1;j<k;j++){
      v[k][j]=(v[k-1][j-1]+v[k-1][j]);
    }
  }
}

bool is_product_overflow(uint64_t a, uint64_t b) {

	uint64_t prod = a * b;
	
	return (prod / b != a);
}

signed main() {
  uint64_t  n;
  cin >> n;

  uint64_t aMax = 1000000000000000000;
  uint64_t  a = 0;
  uint64_t aMul = 1;
  bool isOver = false;
  bool doesZeroExist = false;
  REP(i,n) {
    cin >> a;
    if(a==0)doesZeroExist = true;
    if(!isOver && aMax/a < aMul){
      isOver = true;
    }
    else {
      aMul *= a;
    }
  }
  if(doesZeroExist) {
    cout << "0" << endl;
    return 0;
  }
  if(isOver){
    cout << "-1" << endl;
    return 0;
  }
  cout << aMul << endl;
  return 0;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repp(i, n) rep(i, 0, n)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define int long long
using namespace std;
typedef pair<int, int> P;

signed main(){
    int n, l;
    cin >> n >> l;
    vector<int> a(n, 0);
    rep(i, 0, n) cin >> a[i];
    int ans = -1;
    rep(i, 0, n - 1){
        if(a[i] + a[i + 1] >= l){
            ans = i; break;
        }
    }
    if(ans == -1) cout << "Impossible" << endl;
    else{
        cout << "Possible" << endl;
        rep(i, 0, ans){
            cout << i + 1 << endl;
        }
        repb(i, n - 2, ans + 1){
            cout << i + 1 << endl;
        }
        cout << ans + 1 << endl;
    }
}

Measured memory_bytes: 1536
#include<math.h>
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define    ll   long long int
#define    py   printf("Yes\n")
#define    pn   printf("No\n")
#define    in   cin>>
using namespace std;

ll hako[200000];
int main()
{
  int n;
  in n;
  bool flag=true;
  int ans=0;
  int i=1;
  while(flag==true){
    ans=111*i;
    if(n<=ans){
      flag=false;
    }
    i++;
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
   int n;
   scanf("%d", &n);
   while(n>0){
	int sum=0;
	int i, min=1000, max=0;
	for(i=0; i<n; i++){
	   int s=0;
	   scanf("%d", &s);
	   sum += s;
	   if(s<=min) min = s;
	   if(s>=max) max = s;
	}
	sum = (sum-min-max)/(n-2);
	printf("%d\n", sum);
	scanf("%d", &n);
   }
   return 0;
}



Measured memory_bytes: 2096
#include <iostream>

int main()
{
	int house[4][3][10];
	for (int i=0; i<4; i++) {
		for (int j=0; j<3; j++) {
			for (int k=0; k<10; k++) house[i][j][k] = 0;
		}
	}
	
	int n;
	int b, f, r, v;
	std::cin >> n;
	for (int i=0; i<n; i++) {
		std::cin >> b >> f >> r >> v;
		house[b-1][f-1][r-1] += v;
	}
	
	for (int i=0; i<4; i++) {
		if (i>0) std::cout << "####################" << std::endl;
		for (int j=0; j<3; j++) {
			for (int k=0; k<10; k++) {
				std::cout << " " << house[i][j][k];
			}
			std::cout << std::endl;
		}
	}

	return 0;
}




Measured memory_bytes: 3084
#include<bits/stdc++.h>
using namespace std;
int main()
{
   int a,b,c;
   cin>>a>>b>>c;
   if((a==5&&b==7&&c==5)||(a==5&&b==5&&c==7)||(a==7&&b==5&&c==5))
   {
       cout<<"YES"<<"\n";
   }
   else
   {
       cout<<"NO"<<"\n";
   }

return 0;}


Measured memory_bytes: 3524
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.nio.Buffer;


class Main {
	
	static long mod=1000000007;

	public static void main(String[] args) throws NumberFormatException, IOException {
		
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		String s="";
		while((s=br.readLine())!=null){
			String[] a=s.split(" ");
			Long x=Long.parseLong(a[0]);
			Long y=Long.parseLong(a[1]);
			System.out.println(pow(x, y));
			
		}
	}

	public static long pow(long b,long p) {
		if(p==0){
			return 1;
		}else if(p%2==0){
			long result=pow(b, p/2);
			return ((result%mod)*(result%mod))%mod ;
		}else{
			long result=pow(b, p-1);
			return ((b%mod)*(result%mod))%mod ;
		}
		
	}

}

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

int main() {

    int a, b;
    cin >> a >> b;
    double x, y;
    x = a;
    y = b;
    printf("%d %d %f\n", a / b, a % b, x / y);

}


Measured memory_bytes: 3224
N=int(input())
v=list(map(int,input().split()))
v_new = sorted(v)
ans=0.0
for i,x in enumerate(v_new):
  if i ==0 or i==1:
    ans += 1/2**(N-1)*x
  else:
    ans += 1/2**(N-i)*x
print(ans)

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

#define _abs(x)((x) < 0 ? (x) * -1 : (x))
#define _max(x, y)(max(0, max((x), (y))))
#define _min(x, y)(max(0, min((x), (y))))

#define pb push_back
#define mp make_pair

static const ll MOD = 1e9 + 7;

void rec(const ll &x, const vector<vector<int> > &table, const int &index, const int &n, ll &ans) {
    if (n <= index) {
        if (x % 2LL == 0LL) ans++;

        return;
    }

    int i, len = table[index].size();

    for (i = 0; i < len; i++) rec(table[index][i] * x, table, index + 1, n, ans);
}

void solve(const vector<vector<int> > &table, const int &n) {
    ll ans = 0LL;

    int i, len = table[0].size();

    for (i = 0; i < len; i++) rec(table[0][i], table, 1, n, ans);

    cout << ans << '\n';
}

int main()
{
    //freopen("in.txt", "r", stdin);
    //freopen("out.txt", "w", stdout);
    //freopen("debug.txt", "w", stderr);

    cin.tie(0);
    ios::sync_with_stdio(false);

    int n;

    cin >> n;

    int a[n];
    vector<vector<int> > table(n);

    int i;

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

        table[i].pb(a[i] - 1);
        table[i].pb(a[i]);
        table[i].pb(a[i] + 1);
    }

    solve(table, n);

    return 0;
}


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

int main() {
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    int N, arr[100001], ans;
    cin >> N;
    for (int i = 0; i < N; i++) {
        cin >> arr[i];
    }
    sort(arr, arr + N);
    int mid = N / 2;
    ans = arr[mid] - arr[mid - 1];
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;
void add_vec(vector<pair<int,int> > &cake,pair<int,int> f,pair<int,int> s){
  if(f.first*f.second < s.first*s.second){
    cake.push_back(f);
    cake.push_back(s);
  }else{
    cake.push_back(s);
    cake.push_back(f);
  }
}
int main(){
  int n,w,d;
  while(cin >> n >> w >> d,n||w||d){
    vector<pair<int,int> > cake(1,pair<int,int>(w,d));
    
    for(int i = 0;i < n;i++){
      int sir = 0;
      cin >> sir;
      int tmp;
      cin >> tmp;
      pair<int,int> cake_size = cake[sir-1];
      /*      cout << cake_size.first*cake_size.second << "dddddd" << endl;
      cout << "---------------" << endl;
      for(int j =0 ;j < cake.size();j++){
	cout << cake[j].first*cake[j].second << endl;
      }
      cout << "---------------" << endl;
      */
      vector<pair<int,int> >::iterator it = cake.begin();
      it += sir-1;
      cake.erase(it);
      /*
      cout << "%%%%%%%%%%%" << endl;
      for(int j =0 ;j < cake.size();j++){
	cout << cake[j].first*cake[j].second << endl;
      }
      cout << "%%%%%%%%%%%" << endl;
      */
      int cnt = 0;
      int flag =0;
      while(cnt <= tmp){
	for(int j = 0;j < cake_size.first;j++){
	  if(cnt == tmp){
	    add_vec(cake,pair<int,int>(j,cake_size.second),pair<int,int>(cake_size.first-j,cake_size.second));
	    flag = 1;
	    break;
	  }
	  cnt++;
	}
	if(flag == 1)break;
	for(int j = 0;j < cake_size.second;j++){
	  if(cnt == tmp){
	    add_vec(cake,pair<int,int>(cake_size.first,j),pair<int,int>(cake_size.first,cake_size.second-j));
	    flag = 1;
	    break;
	  }
	  cnt++;
	}
	if(flag == 1)break;
      }
    }
    vector<int> ans(cake.size(),0);
    for(int i = 0;i < cake.size();i++){
      ans[i] = cake[i].first*cake[i].second;
    }
    sort(ans.begin(),ans.end());
    cout << ans[0];
    for(int i = 1;i < ans.size();i++){
      cout << " "<<ans[i];
    }
    cout << endl;
      
      
  
  }
  return 0;
}

Measured memory_bytes: 1216
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define endl "\n"
#define fast ios::sync_with_stdio(0);cin.tie(NULL);std::cout.tie(NULL);
#define endl "\n"
#define vst vector<char>
#define vll vector<ll>
#define fo(i, x, y)   for (__typeof(x) i = x; i < y; ++i)
#define fr(i, x, y)   for (__typeof(x) i = x; i > y; i--)
#define sort(a) stable_sort(a.begin(),a.end())
#define sortd(a) stable_sort(a.begin(),a.end(),greater<int>())
#define vpr vector<pair<ll,ll>>
#define gcd(a,b) __gcd(a,b)
#define TC ll t; cin>>t; while(t--)
#define F first
#define S second
const ll N=1e9+7;
ll lcm(ll x,ll y){return (x*y*1LL)/gcd(x,y);}
 
ll power(ll x, ll y){ 
    ll res = 1; 
    while (y > 0){
        if (y & 1) 
            res = ((res) * (x));
        res %= N; 
        y = y >> 1; 
        x = ((x) * (x)); 
    }
    return res; 
}
 
ll powmod(ll a,ll b,ll n)
{
    ll x=1, y=a; 
    while (b > 0) 
    {
        if (b%2 == 1) 
        {
            x = (x*y) % n;
        }
        y = (y*y) % n; 
        b /= 2;
    }
    return x % n;
}
ll prime(ll n)
{
    for(ll i=2;i<=sqrt(n);i++)
    {
        if(n%i==0)
        {
            return 0;
        }
    }
    return 1;
}

  

int main()
{
   fast;
   ll n;
   cin>>n;
   ll a[n],b[n],c[n];
   fo(i,0,n)
   {
       cin>>a[i];
       cin>>b[i];
       cin>>c[i];
   }
   ll dp[n][3];
   dp[0][0]=a[0];
   dp[0][1]=b[0];
   dp[0][2]=c[0];
   fo(i,1,n)
   {
       dp[i][0]=a[i]+max(dp[i-1][1],dp[i-1][2]);
       dp[i][1]=b[i]+max(dp[i-1][0],dp[i-1][2]);
       dp[i][2]=c[i]+max(dp[i-1][1],dp[i-1][0]);
   }
   ll ans=max(dp[n-1][0],max(dp[n-1][1],dp[n-1][2]));
   cout<<ans<<endl;
  
    
}  


Measured memory_bytes: 8352
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back

using namespace std;
const long long MOD = (long long)1e9 + 7;

int n, m;

int main()
{
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cin >> n >> m;
    if (n >= 13) cout << m;
    else if (n >= 6) cout << m/2;
    else cout << "0";
    //system("pause");
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define in(x,y,h,w) x >= 0 && x < h && y >= 0 && y < w

#define int long long
//typedef    long long          ll;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      P;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
 
const int INF=1e+18;
const double EPS=1e-9;
const int MOD=1000000007;

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

signed main(){
	int n;
	string s;
	cin >> s;
	n = s.length();
	set<char> st;
	for(int i = 0;i < n;i++) st.insert(s[i]);
	for(int i = 0;i < 26;i++){
		if(!st.count(i + 'a')){
			cout << s << (char)(i + 'a') << endl;
			return 0;
		}
	}
	for(int i = n - 1;i >= 0;i--){
		st.erase(s[i]);
		for(char j = s[i] + 1;j <= 'z';j++){
			if(!st.count(j)){
				st.insert(j);
				cout << s.substr(0,i) << j << endl;
				return 0;
			}
		}
	}
	cout << -1 << endl;
	return 0;
}

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

using namespace std;
using ll=long long;
using ull=unsigned long long;
using pii=pair<int,int>;

#define INF LONG_MAX
#define MOD 1000000007
#define rng(a) a.begin(),a.end()
#define rrng(a) a.end(),a.begin()
#define endl "\n"

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

  int X;
  cin>>X;
  if(X<=599)cout<<8<<endl;
  else if(X<=799)cout<<7<<endl;
  else if(X<=999)cout<<6<<endl;
  else if(X<=1199)cout<<5<<endl;
  else if(X<=1399)cout<<4<<endl;
  else if(X<=1599)cout<<3<<endl;
  else if(X<=1799)cout<<2<<endl;
  else cout<<1<<endl;

  return 0;
}


Measured memory_bytes: 3652
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

// use std::io::{stdout, Write, BufWriter};
//use std::cmp::{max};

const ALPHABETS_L: &'static str = "abcdefghijklmnopqrstuvwxyz";

fn main() {
    input! {
        s: String,
    }

    for c in ALPHABETS_L.chars() {
        if !s.contains(c) {
            println!("{}", c);
            return;
        }
    }
    println!("None");
}


Measured memory_bytes: 4352
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;



int main() {
	int r,d,i;
	cin>>r>>d;
	int a[11];
	cin>>a[0];
	for(i=1;i<11;i++) { a[i] = r*a[i-1]-d; cout<<a[i]<<endl; }
	
	

	return 0;
}

Measured memory_bytes: 256
import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;

public class Main {

	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		int C = sc.nextInt();

		System.out.println(Math.min(B / A, C));
	}

	private static boolean isDebug = System.getProperty("sun.desktop") != null;

	private static void debug(Object... o) {
		if (isDebug) {
			System.err.println(Arrays.deepToString(o));
		}
	}

	public static class Pair {
		private int A;
		private int B;

		public Pair(int a, int b) {
			super();
			A = a;
			B = b;
		}

		public int getA() {
			return A;
		}

		public int getB() {
			return B;
		}
	}

	public static class Scanner {
		private BufferedInputStream inputStream;

		public Scanner(InputStream in) {
			inputStream = new BufferedInputStream(in);
		}

		public int nextInt() throws IOException {
			int num = 0;
			int sign = 1;

			int read = skip();
			if (read == '-') {
				sign = -1;
				read = inputStream.read();
			}

			do {
				num = num * 10 + sign * (read - 0x30);
			} while ((read = inputStream.read()) > 0x20);

			return num;
		}

		public void fill(int[] a) throws IOException {
			for (int i = 0; i < a.length; i++) {
				a[i] = nextInt();
			}
		}

		public void fill(int[] a, int[] b) throws IOException {
			if (a.length != b.length) {
				throw new IllegalArgumentException();
			}

			for (int i = 0; i < a.length; i++) {
				a[i] = nextInt();
				b[i] = nextInt();
			}
		}

		public long nextLong() throws IOException {
			long num = 0;
			int sign = 1;

			int read = skip();
			if (read == '-') {
				sign = -1;
				read = inputStream.read();
			}

			do {
				num = num * 10 + sign * (read - 0x30);
			} while ((read = inputStream.read()) > 0x20);

			return num;
		}

		public void fill(long[] a) throws IOException {
			for (int i = 0; i < a.length; i++) {
				a[i] = nextLong();
			}
		}

		public void fill(long[] a, long[] b) throws IOException {
			if (a.length != b.length) {
				throw new IllegalArgumentException();
			}

			for (int i = 0; i < a.length; i++) {
				a[i] = nextLong();
				b[i] = nextLong();
			}
		}

		public long[] nextLong(int n) throws IOException {
			long[] array = new long[n];
			for (int i = 0; i < n; i++) {
				array[i] = nextLong();
			}

			return array;
		}

		public String next() throws IOException {
			StringBuilder builder = new StringBuilder();

			int read = skip();
			do {
				builder.append((char) read);
			} while ((read = inputStream.read()) > 0x20);

			return builder.toString();
		}

		private int skip() throws IOException {
			int read;
			while ((read = inputStream.read()) <= 0x20)
				;

			return read;
		}
	}
}


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

int main(){
	double a,b,c,d,e,f,x,y;
	while(cin >> a >> b >> c >> d >> e >> f){
		x = (e*c-b*f)/(a*e-b*d);
		y = (-c*d+a*f)/(a*e-b*d);
		if(x == -0) x = 0;
		if(y == -0) y = 0;
		printf("%.3lf %.3lf\n", x, y);
	}
}

Measured memory_bytes: 1224
#include<iostream>
#include<algorithm>
#include<queue>
#include<map>
using namespace std;
typedef pair<int, int> P;
typedef pair<P, int> T;
#define INF (1 << 30)

priority_queue<T, vector<T>, greater<T> > pq;
int ax, ay, bx, by, n, r, p;
int round, area, left_side, right_side, bottom, top;
int imos[3][10500];
int main(){
    while(cin >> n >> r, n | r){
	for(int i = 0;i < 3;i++)
	    fill(imos[i], imos[i] + 10500, 0);
	round = area = 0;
	p = 0;
	left_side = bottom = 10500;
	right_side = top = 1;
	for(int i = 0;i < n;i++){
	    cin >> ax >> ay >> bx >> by;
	    left_side = min(left_side, ++ax);
	    right_side = max(right_side, ++bx);
	    bottom = min(bottom, ++ay);
	    top = max(top, ++by);	    
	    pq.push(T(P(ax, ay), 1));
	    pq.push(T(P(ax, by), -1));
	    pq.push(T(P(bx, ay), -1));
	    pq.push(T(P(bx, by), 1));
	}
	pq.push(T(P(INF, INF), 0));
	for(int i = left_side;i < right_side + 2;i++){
	    for(int j = bottom;j < top + 2;j++){
		imos[i % 3][j] = imos[i % 3][j - 1];
		while(pq.top().first == P(i, j)){
		    imos[i % 3][j] += pq.top().second;pq.pop();
		}
	    }
	    for(int j = bottom;j < top + 2;j++){
		imos[i % 3][j] += imos[(i - 1) % 3][j];
		if(imos[i % 3][j])area++;
		if(!!imos[i % 3][j] != !!imos[i % 3][j - 1])round++;
		if(!!imos[i % 3][j] != !!imos[(i - 1) % 3][j])round++; 
	    }

	}
	pq.pop();
	cout << area << endl;
	if(r == 2)cout << round << endl;
    }
    return 0;
}

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

int main()
{
  int a, b;
  cin >> a;
  cin >> b;
  if (b == 1)
  {
    cout << 0 << endl;
    return 0;
  }
  
  int c = 1;
  for (int i = 1; i < 30; ++i)
  {
    c += a - 1;
    if (c >= b)
    {
      cout << i << endl;
      return 0;
    }
  }
  
  return 1;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin >> n;
    int a, ans = 0;
    for(int i = 0;i < n;i++){
        cin>>a;
        while (a & 1 ^ 1) { // aの1ビット目だけを取って1ビット目を反転(2進数なので1ビット目が0なら2で割れる)
            a >>=1 ; // aを1ビット右にずらす(2進数なので2で割る)
            ans++;
        }
    }
    cout << ans;
}

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

int main(){
    int N;  cin >> N;
    vector<string> S(N);
    map<string, int> mp;
    for(int i=0; i<N; i++){
        cin >> S[i];
        mp[S[i]]++;
    }

    vector<pair<int, string>> P;
    for(auto p : mp){
        P.push_back({p.second, p.first});
    }
    sort(P.begin(), P.end());

    vector<string> cand;
    for(auto p : P){
        if(p.first == P.back().first){
            cand.push_back(p.second);
        }
    }
    sort(cand.begin(), cand.end());
    for(string c : cand){
        cout << c << endl;
    }
}   

Measured memory_bytes: 35436
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<tuple>
#include<sstream>
#define rep(i,n) for(int i =0;i<(int)(n);i++)
typedef long long ll;
using namespace std;
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 ans = 0;
	rep(i, n) {
		for (int j = i + 1; j < n; j++) {
			int norm = 0;
			rep(k, d) {
				int diff = abs(x[i][k] - x[j][k]);
				norm += diff * diff;
			}
			bool flag = false;
			for (int k = 0; k <= norm; k++) {
				if (k*k == norm) {
					flag = true;
				}
			}
			if (flag)++ans;
		}
	}
	cout << ans << endl;
	
	return 0;
}


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

using namespace std;
using ll=long long;
using ull=unsigned long long;
using pii=pair<int,int>;

#define INF LONG_MAX
#define MOD 1000000007
#define rng(a) a.begin(),a.end()
#define rrng(a) a.end(),a.begin()

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

  int a,b,c;
  cin>>a>>b>>c;
  cout<<min({a+b,b+c,c+a})<<endl;
  return 0;
}


Measured memory_bytes: 256