akhauriyash/Code-Regression huggingface dataset:
package main

import (
	"bufio"
	"bytes"
	"fmt"
	"io"
	"os"
	"strconv"
)

var (
	readString func() string
	readBytes  func() []byte
	stdout     *bufio.Writer
)

func init() {
	readString, readBytes = newReadString(os.Stdin)
	stdout = bufio.NewWriter(os.Stdout)
}

func newReadString(ior io.Reader) (func() string, func() []byte) {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	f1 := func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
	f2 := func() []byte {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Bytes()
	}
	return f1, f2
}

func readInt() int {
	return int(readInt64())
}

func readInt64() int64 {
	i, err := strconv.ParseInt(readString(), 10, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readFloat64() float64 {
	f, err := strconv.ParseFloat(readString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

func printf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(stdout, f, args...)
}

func println(args ...interface{}) (int, error) {
	return fmt.Fprintln(stdout, args...)
}

func eprintln(args ...interface{}) (int, error) {
	return fmt.Fprintln(os.Stderr, args...)
}

func eprintf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(os.Stderr, f, args...)
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func min64(a, b int64) int64 {
	if a < b {
		return a
	}
	return b
}

func max(a, b int) int {
	if a < b {
		return b
	}
	return a
}

func max64(a, b int64) int64 {
	if a < b {
		return b
	}
	return a
}

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

func abs64(a int64) int64 {
	if a < 0 {
		return -a
	}
	return a
}

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

func gcd64(a, b int64) int64 {
	if b == 0 {
		return a
	}
	return gcd64(b, a%b)
}

// readString() string
// readInt() int
// readInt64() int64
// readFloat64() float64

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

func main() {
	defer stdout.Flush()
	s := readBytes()
	s = bytes.Replace(s, []byte("BC"), []byte("D"), -1)
	var ans int
	for i := 0; i < len(s); {
		if s[i] == 'A' {
			j := i
			for ; j < len(s) && (s[j] == 'A' || s[j] == 'D'); j++ {
			}
			ans += countReverse(s, i, j)
			i = j
		} else {
			i++
		}
	}
	println(ans)
}

func countReverse(s []byte, start, end int) int {
	var res int
	d := start
	for i := d; i < end; i++ {
		if s[i] == 'D' {
			res += i - d
			d++
		}
	}
	return res
}

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


Measured memory_bytes: 1280
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
     
using namespace std;
     
typedef long long ll;
typedef pair<ll, int> pii;
     
#define fi first
#define se second
#define mp make_pair
#define fastIO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
     
mt19937 rnd(chrono::steady_clock().now().time_since_epoch().count());

int main(){
    fastIO;
    int n;
    cin >> n;
    int p;
    cin >> p;
    int c0 = 0, c1 = 0;
    int a;
    for(int i = 0 ; i < n; i ++ ){
        cin >> a;
        if(a % 2 == 0)
            c0 ++ ;
        else
            c1 ++ ;
    }
    if(p==1 && c1 == 0){
        cout << 0;
        return 0;
    }
    ll res = (1ll << c0);
    if(c1 > 0)
        res *= (1ll << (c1 - 1));
    cout << res;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define repr(i,from,to) for(int (i)=(from);(i)<(to);(i)++)
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
// const bool debug=true;
const bool debug=false;
#define DEBUG if(debug==true)
#define vprint(x) for(auto a:(x)) cout << x << endl;
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll 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;
}
int main(void) {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,m;cin>>n>>m;
    vector<vector<int>> nbs(n);
    vector<pair<int,int>> cand;
    rep(i,m) {
        int s,t;cin>>s>>t;
        s--;t--;
        nbs[s].push_back(t);
    }
    int xx=0,yy=0;
    vector<double> memo(n,-1);
    function<double(int)> rec = [&](int k) {
        double mx = 0;
        double res = 0;
        if(k == n-1)return memo[k] = 0.0;
        if(memo[k] != -1) return memo[k];
        bool flg = false;
        for(auto x:nbs[k]) {
            if (xx==k&&yy==x)flg = true;
        }
        for(auto x:nbs[k]) {
            if(xx==k&&yy==x) {continue;}

            if(memo[x] == -1)rec(x);
        }
        for(auto x:nbs[k]) {
            if(xx==k&&yy==x) {
                continue;
            }
            double tmp = memo[x];
            chmax(mx,tmp);
            res += tmp * 1.0 / (nbs[k].size() - int(flg));
        }
        res++;
        return memo[k] = res;
    };
    rec(0);
    rep(i,n) {
        if(nbs[i].size() > 1) {
            double mn = 1e+12;
            int to;
            for(auto x:nbs[i]) {
                if(chmin(mn, memo[i]-memo[x])) {
                    to = x;
                }
            }

            cand.emplace_back(i, to);
        }
    }
    double res = memo[0];
    DEBUG{
        for(auto x:memo) cout << x << " ";
        cout << endl;
    }
    for(auto x:cand) {
        xx=x.first;yy=x.second;
        rep(i,n) {
            memo[i] = -1;
        }
        chmin(res, rec(0));
    }
    printf("%.10lf\n",res);
    return 0;
}


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

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using pint = pair<int, int>;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
const int MOD = 1000000009;
const long long INF = 1LL << 60;

int bfs(vector<string> &S, int x, int y) {
    int H = S.size(), W = S[0].length();
    vector<vector<int>> dist(H, vector<int>(W, -1));
    dist[x][y] = 0;
    queue<pair<int, int>> que;
    que.push({x, y});
    int res = 0;
    while (!que.empty()) {
        int x = que.front().first, y = que.front().second;
        res = max(res, dist[x][y]);
        que.pop();
        for (int i = 0; i < 4; ++i) {
            int nx = x + dx[i], ny = y + dy[i];
            if (nx < 0 || nx >= H || ny < 0 || ny >= W) continue;
            if (S[nx][ny] == '#') continue;
            if (dist[nx][ny] != -1) continue;
            dist[nx][ny] = dist[x][y] + 1;
            que.push({nx, ny});
        }
    }
    return res;
}

int main() {
    int H, W;
    cin >> H >> W;
    vector<string> S(H);
    for (int i = 0; i < H; ++i) cin >> S[i];
    int res = 0;
    for (int x = 0; x < H; ++x) {
        for (int y = 0; y < W; ++y) {
            if (S[x][y] == '#') continue;
            res = max(res, bfs(S, x, y));
        }
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 3612
#include <iostream>
#include<cstdlib>
#include<queue>
#include<set>
#include<vector>
#include<string>
#include<cmath>
#include<algorithm>
#include<stack>
#include<map>
#include<deque>
#include<cstdio>
#include<cstdio>
#include<time.h>
using namespace std;
#define rep(i,a) for(int i=0;i<a;i++)
#define pd(a,n) for(int i=0;i<n;i++)cout<<a[i]<<((i==n-1)?"\n":" ")
#define pdd(a,n,m)for(int i=0;i<m;i++)pd(a,m)
#define mp make_pair
#define pb push_back
#define ll __int64
#define __int64 long long
#define P pair<int,int>
#define PP pair<P,int>

ll x;

int main(){
  cin>>x;
  while(true){
    bool f=1;
    for(int i=2;i*i<=x;i++)if(x%i==0)f=0;
    if(f){
      cout<<x<<endl;
      return 0;
    }
    x++;
  }
  return 0;
}


Measured memory_bytes: 256
/******************************************************************************

                              Online C++ Compiler.
               Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

#include <iostream>

using namespace std;

int main()
{
    int n;
    cin>>n;
    int arr[n];
    int dp[n];
    for(int i = 0; i < n; i++) {
        cin>>arr[i];
    }
    if(n == 1) {
        cout<<0<<"\n";
        return 0;
    }
    dp[0] = 0;
    dp[1] = abs(arr[1] - arr[0]);
    for(int i = 2; i < n; i ++) {
        dp[i] = min(dp[i - 1] + abs(arr[i] - arr[i - 1]), dp[i - 2] + abs(arr[i] - arr[i - 2]));
    }
    cout<<dp[n - 1]<<"\n";

    return 0;
}


Measured memory_bytes: 1024
#![allow(unused)]

//input
//use std::io::Read;

//collections
//use std::collections::BTreeMap;
//use std::collections::BTreeSet;
//use std::collections::HashMap;
//use std::collections::HashSet;


//入力マクロここから
//https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

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

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

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

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

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

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

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}
//入力マクロここまで

fn main() {
    input! {
        a: i64,
        b: i64,
        c: i64,
    }
    if (a == b && a != c) || (a == c && a != b) || (b == c && b != a){
        println!("Yes");
    } else {
        println!("No");
    }
}

Measured memory_bytes: 4352
#include <iostream>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>
#include <complex>
#include <functional>
#include <numeric>
#include <iomanip>

// output
#define SPBR(w, n) std::cout<<(w + 1 == n ? '\n' : ' ');
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
// utility
#define ALL(i) (i).begin(), (i).end()
#define FOR(i, a, n) for(int i=(a);i<(n);++i)
#define RFOR(i, a, n) for(int i=(n)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<int(n);++i)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define IN(a, x, b) (a<=x && x<b)
#define OUT(a, x, b) (x<a || b<=x)
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; }

// type/const
#define int ll
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const int MOD = 1000000007;
/* const int MOD = 998244353; */
const int INF = 1e18;
const double PI = acos(-1);

using namespace std;
struct INIT { INIT(){
  cin.tie(0); ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
}}INIT;

vector<pair<int, int>> primeFact(int n) {
  vector<pair<int, int>> res;
  for (int i = 2; i * i <= n; i++) {
    int divcnt = 0;
    if (n % i == 0) {
      do {
        divcnt++;
        n /= i;
      } while (n % i == 0);
      res.emplace_back(i, divcnt);
    }
  }
  if (n != 1)
    res.emplace_back(n, 1);
  return res;
}

int lcm(int x, int y){
  return x/__gcd(x, y)*y;
}

int powMod(int n, int p) {
  int res = 1;
  while (p) {
    if (p & 1) (res *= n) %= MOD;
    (n *= n) %= MOD;
    p >>= 1;
  }
  return res;
}
int invMod(int n) {
  return powMod(n, MOD - 2);
}

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

  vector<int> A(N);
  REP(i, N) cin >> A[i];

  map<int, int> m;
  REP(i, N){
    auto p = primeFact(A[i]);
    for(auto v : p){
      chmax(m[v.first], v.second);
    }
  }

  int l = 1;
  for(auto p : m){
    (l *= powMod(p.first, p.second)) %= MOD;
  }

  int ans = 0;
  REP(i, N){
    (ans += l*invMod(A[i])) %= MOD;
  }

  cout << ans << "\n";

  return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vii = vector<vi>;
using vs = vector<string>;
using in6 = int64_t;
using ind = double;
using pii = pair<int,int>;
using psi = pair<string,int>;
using vpi = vector<pii>;
using vps = vector<psi>;
#define rep(i, n) for (in6 i = 0; i < (in6)(n); i++)
#define repa(i,a,n) for(in6 i = a; i < (in6)(n); i++)
#define repdown(i,n) for(in6 i = n; i > 0; i--)
#define kyun ios::sync_with_stdio(false)
#define hinata cout << "\n"
#define all(c) (c).begin(), (c).end()
#define pb push_back
#define inf 2147483647
#define dset(n) cout << fixed << setprecision(n)

void yes() {
  cout << "Yes";
}

void no() {
  cout << "No";
}

int main() {
  kyun;
  in6 x,n;
  cin >> x >> n;
  vi data(n);
  rep(i,n) cin >> data[i];
  bool check = 1;
  in6 i = 0;
  in6 ans;
  while(check) {
    rep(j,2) {
      in6 anscand;
      if(j == 0) anscand = x - i;
      else anscand = x + i;
      bool roop = 1;
      rep(k,n) if(data[k] == anscand) roop = 0;
      if(roop) {
        check = 0;
        ans = anscand;
        break;
      }
    }
    i++;
  }
  cout << ans;
  hinata;
}

Measured memory_bytes: 3604
#include <cstring>
#include <cstdio>
#include <cmath>
#include <algorithm>
using namespace std;

const int MAXN = 100010;
const int MAXK = 1010;
int N, K, pref[MAXK][MAXK];
struct item { int x, y; char c; } A[MAXN];

inline void add(int x1, int x2, int y1, int y2) {
    if(x1 > x2 || y1 > y2) return;
    pref[x1][y1]++, pref[x2 + 1][y1]--, pref[x1][y2 + 1]--, pref[x2 + 1][y2 + 1]++;
}
inline int getCh(int x) { return K - (x % K); }
inline int work() {
    memset(pref, 0, sizeof(pref));
    //Calc
    int i, x, y;
    for(i = 1; i <= N; i++) {
        int chX = getCh(A[i].x), chY = getCh(A[i].y);
        bool org = ( (A[i].x / K) + (A[i].y / K) ) & 1;
        if(org == A[i].c) add(0, chX - 1, 0, chY - 1), add(chX, K - 1, chY, K - 1);
        else add(0, chX - 1, chY, K - 1), add(chX, K - 1, 0, chY - 1);
    }
    //Prefsum & Getans
    int ret = 0;
    for(x = 0; x < K; x++) for(y = 1; y < K; y++) pref[x][y] += pref[x][y - 1];
    for(y = 0; y < K; y++) for(x = 1; x < K; x++) pref[x][y] += pref[x - 1][y];
    for(x = 0; x < K; x++) for(y = 0; y < K; y++) ret = max(ret, pref[x][y]);
    return ret;
}

char str[5];
int main() {
    int i;
    scanf("%d%d", &N, &K);
    for(i = 1; i <= N; i++) scanf("%d%d%s", &A[i].x, &A[i].y, str), A[i].c = (str[0] == 'B') ? 0 : 1;

    int Ans = work();
    for(i = 1; i <= N; i++) A[i].c = !A[i].c;
    Ans = max(Ans, work());

    printf("%d", Ans);
}

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

int main()
{
  int N, M;
  int sum = 0;
  vector<int> a;
  cin >> N >> M;

  for (int i = 0; i < M; i++)
  {
    int x;
    cin >> x;
    a.push_back(x);
  }

  for (int i = 0; i < M; i++)
  {
    sum += a[i];
  }

  if (sum > N)
  {
    cout << "-1" << endl;
  }
  else if (sum == N)
  {
    cout << "0" << endl;
  }
  else
  {
    cout << N - sum << endl;
  }
}

Measured memory_bytes: 3696
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
using namespace std;
int main ()
{
	char s[100009];
	int k;
	scanf("%s",&s);
	scanf("%d",&k);
	int cnt = k;
	int len = strlen(s);
	for (int i = 0; i < len; i++)
	{
		while (s[i] != 'a' && i != len-1){
			int d = 26 - (s[i]  - 'a');
			if (cnt - d >= 0){
				cnt -= d;
				s[i] = 'a';
			}
			else break;
		}
		if (i == len-1) {
			if (s[i] + cnt <= 'z')
			s[i] = s[i] + cnt;
			else s[i] = s[i] + (cnt%26) - 26;
			if (s[i] < 'a') s[i] += 26;
		}
	}
	printf("%s",s);
	return 0;
}

Measured memory_bytes: 384
import java.util.Scanner;

class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        String[] s = new String[N];
        for (int i = 0; i < N; i++) {
            s[i] = scanner.next();
        }
        int ans = 0;
        int cntB = 0;
        int cntA = 0;
        boolean flag = false;
        for (int i = 0; i < N; i++) {
            if (s[i].charAt(0) == 'B') {
                cntB++;

                if (s[i].charAt(s[i].length() - 1) != 'A') {
                    flag = true;
                }
            }
            if (s[i].charAt(s[i].length() - 1) == 'A') {
                cntA++;

                if (s[i].charAt(0) != 'B') {
                    flag = true;
                }
            }
            for (int j = 0; j < s[i].length() - 1; j++) {
                if (s[i].substring(j, j + 2).equals("AB")) {
                    ans++;
                }
            }
        }
        if (!flag && cntA == cntB) {
            if (cntA != 0) {
                ans += cntA - 1;
            }
        } else {
            ans += Math.min(cntA, cntB);
        }
        System.out.println(ans);
    }

}


Measured memory_bytes: 32588
import java.util.Scanner;

public class Main {

	Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		new Main().run();
	}

	void run() {
		while (true) {
			int n = sc.nextInt();
			if (n == 0)
				break;
			long ds[] = new long[n];
			long vs[] = new long[n];
			for (int i = 0; i < n; i++) {
				ds[i] = sc.nextLong();
				vs[i] = sc.nextLong();
			}
			long dl = ds[0];
			for (int i = 0; i < n; i++)
				dl = lcm(dl, ds[i]);
			long rs[] = new long[n];
			for (int i = 0; i < n; i++)
				rs[i] = dl / ds[i] * vs[i];
			long rg = rs[0];
			for (int i = 0; i < n; i++)
				rg = gcd(rg, rs[i]);
			for (int i = 0; i < n; i++) {
				rs[i] = rs[i] / rg;
				System.out.println(rs[i]);
			}
		}
	}

	long gcd(long x, long y) {
		if (y == 0)
			return x;
		return gcd(y, x % y);
	}

	long lcm(long x, long y) {
		return x * y / gcd(x, y);
	}
}

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

//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
//using namespace __gnu_pbds;

const double pi = 3.141592653589793;

#define xx          first
#define yy          second
#define mp          make_pair
#define intl        long long
#define filein      freopen("input.txt", "r", stdin)
#define fileout     freopen("output.txt", "w", stdout)
#define debug       cout << "YES" << endl
#define what_is(x)  cout << #x << " is " << x << endl
#define pb          push_back
#define pii         pair<int, int>

//find_by_order(int) and order_of_key(int)
//typedef tree < intl , null_type ,less<intl>,rb_tree_tag,tree_order_statistics_node_update > ordered_set;
const int M = 345678;
int n, sz, allow[12], k;

int dijktra()
{
    queue<int>pq;
    pq.push(0);
    while( !pq.empty() )
    {
        int d = pq.front();
        if( (-d) >= n ) return -d;
        pq.pop();
        for( int i = 0; i < sz; i++ )
        {
            int z = allow[i];
            if( d == 0 && z == 0 ) continue;
            pq.push( -((-d)*10+z ));
        }
    }
}

int ara[12];


int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    //filein;
    int a;
    cin >> n >> k;
    for( int i = 0; i < k; i++ )
    {
        cin >> a;
        ara[a] = 1;
    }
    for( int i = 0; i < 10; i++)
    {
        if( ara[i] == 0 )
        {
            allow[sz++] = i;
        }
    }
    int ans = dijktra();
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 512
//~#pragma GCC optimize("Ofast","unroll-loops","omit-frame-pointer","inline") //Optimization flags
//~#pragma GCC option("arch=native","tune=native","no-zero-upper") //Enable AVX
//~#pragma GCC target("avx2")  //Enable AVX
#include<bits/stdc++.h>
using namespace std;

#define all(a) a.begin(),a.end()
#define F first
#define S second
#define pb push_back
#define ll long long
#define vi vector<int>
#define pi pair<int,int>
#define mp make_pair
 
#ifdef LOCAL
#include "debug.h"
#else
#define debug(...) 42
#endif
 
const int mod=1e9+7;
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
int mul(int a,int b)
{
	return ((a)*1ll*(b))%mod;
}
 
void add(int &a,int b)
{
	a+=b;
	if(a>=mod)a-=mod;
}
 
int sub(int a,int b){
	a-=b;
	if(a<0){
		a+=mod;
	}
	return a;
}
 
int powz(int a,int b)
{
	int res=1;
	while(b)
	{
		if(b&1){
			res=mul(res,a);
		}
		b/=2;
		a=mul(a,a);
	}
	return res;
}
 
template <typename A, typename B>
istream& operator>>(istream& input,pair<A,B>& x) {
	input>>x.F>>x.S;
	return input;
}
 
template <typename A>
istream& operator>>(istream& input,vector<A>& x) {
	for(auto& i:x)
		input>>i;
	return input;
}
 
template<typename A>
ostream& operator<<(ostream& output,vector<A>& x) {
	for(auto& i:x)
		output<<i<<' ';
	return output;
}
 
const int N=1000002;

void solve(){
	string s;
	cin>>s;
	for(int i=0;i<s.length();i++){
		cout<<'x';
	}
}
 
signed main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int tc=1;
	//~cin>>tc;
	for(int _=0;_<tc;_++){
		//~ cout<<"Case #"<<_+1<<": ";
		solve();
		if(_!=tc-1)
		cout<<"\n";
	}
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define MOD 1000000007
#define print(A,n) for(ll i=0;i<n;++i)cout<<A[i]<<' ';cout<<endl;
#define take(A,n) for(ll i=0;i<n;++i)cin>>A[i];
//    for(auto& it : m)
void fastio(){ios_base::sync_with_stdio(false);cin.tie(NULL);}
//  priority_queue<ll int> pq;
//  priority_queue <ll int, vector<ll int>, greater<ll int> > pq;
//  vector<ll int> v;
//  vector< pair<ll int,ll int> > v;
//  set<ll int>::iterator it=s.begin();
//  unordered_map<  pair<ll int,ll int>, ll int> mp;

ll int power(ll int x, ll int y, ll int p)  
{  
   ll int res = 1;     // Initialize result  
  
    x = x % p; // Update x if it is more than or  
                // equal to p 
   
    if (x == 0) return 0; // In case x is divisible by p; 
  
    while (y > 0)  
    {  
        // If y is odd, multiply x with result  
        if (y & 1)  
            res = (res*x) % p;  
  
        // y must be even now  
        y = y>>1; // y = y/2  
        x = (x*x) % p;  
    }  
    return res;  
}  
 
int main()
{
  fastio();
ll int T;
T=1;

while(T--)
{
ll int n,k;
cin>>n>>k;
map<ll int , ll  int> mp;
ll int i,j,count=0;
for(i=0;i<k;i++)
{
  ll int x;
  cin>>x;
  for(j=0;j<x;j++)
  {
    ll int b;
    cin>>b;
    mp[b]++;
  }
}
for(i=1;i<=n;i++)
{
  if(mp[i]==0)
    count++;
}
cout<<count<<endl;

}






    return 0;
}

Measured memory_bytes: 3656
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef long double ld;
const double pi=acos(-1.0);
const ll mod=pow(10,9)+7;
const ll INF=pow(2,31)-1;
typedef pair<int,int> P;
typedef vector<int> vi;

ll gcd(ll a,ll b){
    ll v0=a,v1=b,v2=a%b;
    while(v2!=0){
        v0=v1;
        v1=v2;
        v2=v0%v1;
    }
    return v1;
}

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

int main(){
    ios::sync_with_stdio(false);
    int  n; cin >> n;
    ll ans=pow(n,3);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3292
#include<stdio.h>
#include<string.h>
char  a[20],b[20];
int c, d;
char e[20];
int main()
{
	scanf("%s", a);
	scanf("%s", b);
	scanf("%d %d", &c, &d);
	scanf("%s", e);
	int flag=0,i;
	for (i = 0;i<=strlen(b); i++)
	{
		if (b[i] != e[i])
			break;
	}
	if (i == strlen(b) + 1)
		flag = 1;
	if (flag == 0)
	{
		printf("%d %d", --c, d);
	}
	else
	{
		printf("%d %d", c, --d);
	}
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <fstream>
#include <sstream>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <limits>
#include <random>
#include <complex>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <string.h>
#include <iomanip>
using namespace std;

#define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define RREP(i,n) for(int (i)=(int)(n)-1;i>=0;i--)
#define REMOVE(Itr,n) (Itr).erase(remove((Itr).begin(),(Itr).end(),n),(Itr).end())
typedef long long ll;

int main() {

    string S; cin >> S;

    if (S.find("YAKI") == 0) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 764
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>

using namespace std;

int main(){
  int N; cin >> N;
  vector<int> A(N/2); vector<int> B(N/2);
  int kindA[100010] = {0}; int kindB[100010] = {0};
  
  for(int i = 0; i < N; i++){ int v; cin >> v;
    if( i % 2 == 0){ kindA[v]++; }
    else{ kindB[v]++; }  }
  
  
  int maxa,maxa2,maxb,maxb2; int a,b;
  
  for(int i = 1; i <= 100000; i++){
    if( kindA[i] > maxa){ maxa2 = maxa; maxa = kindA[i]; a = i;}
    else if( kindA[i] > maxa2){ maxa2 = kindA[i];}}
  
  for(int j = 0; j < 100000; j++){
    if(kindB[j] > maxb){ maxb2 = maxb; maxb = kindB[j]; b = j;}
    else if( kindB[j] > maxb2){ maxb2 = kindB[j];}}
  
  if( a != b){ cout << N - maxa - maxb << endl;}
  else{
    cout<< min(( N - maxa - maxb2),(N-maxa2 - maxb)) << endl;}
  
  return 0;}
    
    
                             


Measured memory_bytes: 1408
#include<stdio.h>
int main(){
    int a[100000]={},i,n,max,min;
    long long int sum;
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%d",&a[i]);
    }
    max=a[0];
    for(i=1;i<n;i++){
        if(max<a[i]){
            max=a[i];
        }
    }
    min=a[0];
    for(i=1;i<n;i++){
        if(min>a[i]){
            min=a[i];
        }
    }
    sum=a[0];
    for(i=1;i<n;i++){
        sum+=a[i];
    }
    printf("%d %d %lld\n",min,max,sum);
    return 0;
}


Measured memory_bytes: 2240
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <bitset>
#include <cmath>
#include <string>
#include <fstream>
#define FI first
#define SE second
#define VE vector<int>
#define PB push_back
#define PA pair<int,int>
#define MA make_pair
#define LL long long
#define LI long int
#define LLI long long int
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define ROF(i,a,b) for(int i=b-1;i>=a;i--)
#define YES(i) cout<<(i?"YES":"NO")<<endl
#define Yes(i) cout<<(i?"Yes":"No")<<endl
#define POS(i) cout<<(i?"POSSIBLE":"IMPOSSIBLE")<<endl
using namespace std;
//
const int INF=1e9+7;
const int LINF=1e18;
const int MOD=1e9+7;
//
int gcd(int m,int n);
int gcd(int m,int n){
    if(m==0||n==0) return m+n;
    if(m>n) return gcd(m%n,n);
    if(m<n) return gcd(m,n%m);
}

int main(){
    int n,k; cin>>n>>k;
    int m=0,g=0;
    FOR(i,0,n){
        int a; cin>>a;
        m=max(m,a);
        g=max(gcd(g,a),0);
    }
    POS(k<=m&&k%g==0);
    return 0;
}

Measured memory_bytes: 256
<?php
$N = (int)fgets(STDIN);

$mod_10 = $N % 10;
if ($mod_10 === 3) {
    echo 'bon';
    return;
}

if ($mod_10 === 0 || $mod_10 === 1 || $mod_10 === 6 || $mod_10 === 8) {
    echo 'pon';
    return;
}

echo 'hon';

Measured memory_bytes: 16072
// Problem : A - Calc
// Contest : AtCoder - AtCoder Beginner Contest 172
// URL : https://atcoder.jp/contests/abc172/tasks/abc172_a
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

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

int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	long long int a;
	cin>>a;
	long long int ans = a;
	ans += (a*a);
	ans += (a*a*a);
	cout<<ans;
	return 0;
}

Measured memory_bytes: 3608
#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
#define double long double
//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-6;
const int MOD=1000000007;

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

signed main(){
	int n,m,dp[200010] = {1};
	bool broken[200010] = {};
	cin >> n >> m;
	for(int i = 0;i < m;i++){
		int t;
		cin >> t;
		broken[t] = true;
	}
	for(int i = 0;i <= n;i++){
		if(!broken[i + 1]) (dp[i + 1] += dp[i]) %= MOD;
		if(!broken[i + 2]) (dp[i + 2] += dp[i]) %= MOD;
	}
	cout << dp[n] << endl;
}

Measured memory_bytes: 2048
#include <bits/stdc++.h>
#define MN 210000
using namespace std;
struct na{int l,r;}p[MN];
bool cmpl(na a,na b){return a.l==b.l?a.r>b.r:a.l<b.l;}
priority_queue<int,vector<int>,greater<int> > q,_q;
int n,m,mmh;
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    cin >> n >> m;
    mmh = n;
    for (int i=1;i<=n;i++) cin >> p[i].l >> p[i].r;
    sort(p+1,p+1+n,cmpl);
    for (int i=1;i<=n;i++)
    if (p[i].l==q.size()) q.push(p[i].r),_q.push(q.top()),q.pop();else q.push(p[i].r),mmh--;
    for (int i=q.size()+1;i<=m&&!_q.empty();i++) if (_q.top()<=i) _q.pop(),mmh--;
    cout << mmh << endl;
}

Measured memory_bytes: 3320
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <stdio.h>
#include <list>
#include <numeric>
#include <stack>
#include <queue>
#include <tuple>
#include <bitset>
#include <map>
#include <math.h>
//ceil(a/b)   (a + (b - 1))/ b
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); i++)
typedef long long ll;
typedef pair<int,int> P;
const int inf=1000000007;
const ll mod=1000000007;
const double PI=3.14159265358979323846;
int dx[] = {1,-1,0,0};
int dy[] = {0,0,1,-1};

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

int cans(bool f){
  if(f) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}





int main(){
  vector<ll> mp(100010,0);
  ll N,Q;
  cin >> N;
  ll A[N];
  ll sum = 0;
  rep(i,N) {
	cin >> A[i];
	mp[A[i]] += 1;
	sum += A[i];
  }
  cin >> Q;
  vector<ll> ans;

  

  rep(i,Q) {
	ll b,c;
	cin >> b >> c;
	ll mul = mp[b];
	mp[c] += mp[b];
	mp[b] = 0;
	sum = sum + (c-b) * mul;
	ans.push_back(sum);
  }
  rep(i,Q) cout << ans[i] << endl;
	
  return 0;
}




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

typedef long long ll;
typedef pair<int, int> ii;

int n;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n;
  string s;
  unordered_set<string> seen;
  int res = 0;
  for (int i = 0; i < n; ++i) {
    cin >> s;
    if (!seen.count(s)) {
      seen.insert(s);
      ++res;
    }
  }
  cout << res << endl;
  
  return 0;
}


Measured memory_bytes: 17704
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0; i<(int)(n); ++i)

using namespace std;
typedef long long LL;

class LowerEnvelope{ typedef long long LL; int s, t; vector<LL> deq_a; vector<LL> deq_b; inline bool check(LL a1, LL b1, LL a2, LL b2, LL a3, LL b3) const { return (a2 - a1) * (b3 - b2) >= (b2 - b1) * (a3 - a2); } public: LowerEnvelope(int n) : s(0), t(0), deq_a(n), deq_b(n) {} inline void push(LL a, LL b){ while(s + 1 < t && check(deq_a[t - 2], deq_b[t - 2], deq_a[t - 1], deq_b[t - 1], a, b)) t--; deq_a[t] = a; deq_b[t++] = b; } inline LL minimum(LL x){ assert(s < t); while(s + 1 < t && deq_a[s] * x + deq_b[s] >= deq_a[s + 1] * x + deq_b[s + 1]) s++; return deq_a[s] * x + deq_b[s]; } }; 
const LL INF = 10000000000000000LL;

int main(){
    int N, M, D, X;
    cin >> N >> M >> D >> X;
    vector<int> p(N);
    REP(i, N) cin >> p[i];
    vector<vector<int>> right(D);
    for(int i = 0; i < M; i++){
        int a, b;
        cin >> a >> b;
        int x = a;
        int y = abs(b);
        for(int d = 0; d < D; d++){
            right[d].push_back(x - y);
            x += X;
        }
    }
    REP(d, D) sort(right[d].begin(), right[d].end());
    int memo[101][10001];
    memset(memo, -1, sizeof(memo));
    auto w = [&](int d, int i) -> int {
        if(memo[d][i] != -1) return memo[d][i];
        auto itr = lower_bound(right[d].begin(), right[d].end(), p[i]);
        return memo[d][i] = M - (itr - right[d].begin());
    };
    vector<LL> cur(N, INF);
    cur[0] = 0;
    for(int d = 0; d < D; d++){
        vector<LL> next(N, INF);
        LowerEnvelope lowenv(N);
        for(int i = 0; i < N; i++){
            if(cur[i] < INF){
                lowenv.push(w(d, i), cur[i] - (long long)w(d, i) * p[i]);
            }
            next[i] = lowenv.minimum(p[i]);
        }
        cur.swap(next);
    }
    cout << cur[N - 1] << endl;
    return 0;
}

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

using namespace std;

int main() {
    std::ios::sync_with_stdio(false);
    int n;
    cin>>n;
    vector<int> v;
    for(int i=0;i<n;i++){
        int k;
        cin>>k;
        v.push_back(k);
    }
    sort(v.begin(),v.end());
    vector<int> cost;
    for(int i=-100;i<=100;i++){
        int ans=0;
        for(int j=0;j<n;j++){
            ans+=(v[j]-i)*(v[j]-i);
        }
        cost.push_back(ans);
    }
    sort(cost.begin(),cost.end());
    cout<<cost[0];
    return 0;
}


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

#define ll long long

using namespace std;

int main()
{
    ll a, b, k;
    cin >> a >> b >> k;
    if(k<=a){
        cout<<a-k<<" "<<b<<endl;
    }
    else if(k<=(a+b)){
        cout<<"0"<<" "<<b-(k-a)<<endl;
    }
    else{
        cout<<"0"<<" "<<"0"<<endl;
    }


}


Measured memory_bytes: 256
N, M = map(int, input().split())
A = [input() for i in range(N)]
B = [input() for i in range(M)]

ans = 'No'

for i in range(N - M + 1):
    for j in range(N - M + 1):
        check = 0
        for ind, s in enumerate(B):
            #print(s)
            #print(A[i + ind][j])
            if s != A[i + ind][j: j+M]:

                check = 1
        if check == 0:
            ans = 'Yes'

print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#include <unordered_map>
#include <unordered_set>
using namespace std;
#define endl '\n'
#define PI acos(-1)
typedef long long ll;
//  Table is the complete reverse of dp
//  Always think of the pattern (LCM, GCD)
//  Be careful of unsigned
//  double epsilon = FLT_EPSILON;
//	Think of a solution that gets TLE and optimize it
int n, *x;
ll **dp[2], flag;
ll solve(bool turn = 0, int i = 0, int j = n - 1)
{
	if(i == j)
		return dp[turn][i][j] = (turn? -1: 1) * x[i];
	ll &ret = dp[turn][i][j];
	if(ret != flag)
		return ret;
	if(!turn)
		return ret = max(x[i] + solve(!turn, i + 1, j), x[j] + solve(!turn, i, j - 1));
	else
		return ret = min(-x[i] + solve(!turn, i + 1, j), -x[j] + solve(!turn, i, j - 1));
}
int main()
{
    cin.tie(nullptr); cout.tie(nullptr); ios_base::sync_with_stdio(false);
    cin >> n;
    memset(&flag, -127, 8);
    x = new int[n];
    dp[0] = new ll *[n];
    dp[1] = new ll *[n];
    for(int i = 0; i < n; i++)
    {
    	cin >> x[i];
    	dp[0][i] = new ll[n];
    	dp[1][i] = new ll[n];
    	memset(dp[0][i], -127, n * 8);
    	memset(dp[1][i], -127, n * 8);
    }
    cout << solve();
}


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

int main(){
  
  int N, K;
  cin >> N >> K;
  
  if (N <= K - 1) {
    cout << 1 << endl;
    return 0;
  }
  
  for (int64_t i = 2; i <= 100; i++ ){
    
    
    if (pow(K, i) - 1 >= N) {
      
      cout << i << endl;
      return 0;
    }
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <bitset>
#include <queue>
#include <stack>
#include <string>
#include <ctime>
#include <stdio.h>
#include <string.h>

using namespace std;

#define re return
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int) (x).size())
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repm(i, n) for (int i = 1; i <= (n); i++)
#define rrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define vi vector<int>
#define vl vector<long>
#define vll vector<ll>
#define vvi vector<vi>
#define pii pair<int,int>
#define vpii vector< pair<int,int> >
#define ll long long
#define ld long double 
#define str string
// freopen("firesafe.in", "r", stdin);
// freopen("firesafe.out", "w", stdout);
vector<pair<int,int> >a;
vector<pair<int,int> >b;
//map<ll,ll>mmap;
vector<pair<int , pair<int,int> > >g;
vector<int> p;

int dsu_get (int v) {
  return (v == p[v]) ? v : (p[v] = dsu_get (p[v]));
}

void dsu_unite (int a, int b) {
  a = dsu_get (a);
  b = dsu_get (b);
  if (rand() & 1)
    swap (a, b);
  if (a != b)
    p[a] = b;
}
int main(){
   int n;
   cin>>n;
   for(int i=0;i<n;i++){
    int aa,bb;
    cin>>aa>>bb;
    a.pb(mp(aa,i));
    b.pb(mp(bb,i));
   }
   sort(a.begin(),a.end());
   sort(b.begin(),b.end());
   for(int i=n-1;i>0;i--){
      g.pb(mp((a[i].fi-a[i-1].fi),mp(a[i].se,a[i-1].se)));
      g.pb(mp((a[i].fi-a[i-1].fi),mp(a[i-1].se,a[i].se)));
   }
   for(int i=n-1;i>0;i--){
      g.pb(mp((b[i].fi-b[i-1].fi),mp(b[i].se,b[i-1].se)));
      g.pb(mp((b[i].fi-b[i-1].fi),mp(b[i-1].se,b[i].se)));
   }
   

 int cost = 0;
    vector < pair<int,int> > res;

    sort (g.begin(), g.end());
    p.resize (n);
    for (int i=0; i<n; ++i)
      p[i] = i;
          for (int i=0; i<sz(g); ++i) {
            int a = g[i].second.first,  b = g[i].second.second,  l = g[i].first;
            if (dsu_get(a) != dsu_get(b)) {
              cost += l;
              res.push_back (g[i].second);
              dsu_unite (a, b);
            }
          }
    cout<<cost<<endl;
}

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

using namespace std;

using ll = long long;
using Vi = vector<int>;
using Vl = vector<ll>;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

//===

//const ll mod = static_cast<int>(1e9 + 7);



int main() {
	int A, B;
	cin >> A >> B;

	int ans = A + B;
	ans = max(ans, A - B);
	ans = max(ans, A * B);
	cout << ans << endl;
}


Measured memory_bytes: 256
import static java.lang.String.*;

import java.util.Scanner;
public class Main{
	public static void main(String[] args){
		Scanner scan = null;
		try{
			scan =new Scanner(System.in);
			int a ,b;
			a = scan.nextInt();b = scan.nextInt();
			int d = a/b;
			int r = a %b;
			double f = (double)a / (double)b;
			System.out.printf("%d %d %f\n",d,r,f);
			}finally{
			if(scan !=null)scan.close();
		}

	}
}

Measured memory_bytes: 17372
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<cstring>
#include<map>
#include<vector>
#include<queue>
#include<stack>
#include<climits>
#include<set>
#include<utility>
#include<typeinfo>
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
typedef set<int> S;
#define rep(i, n) for(int i=0; i<n; i++)
const ll MOD=1e9+7;

int main(){

	int a, b, k;
	cin >> a >> b >> k;
	for(int i=min(a, b); 0<i; i--){
		if(a%i==0 && b%i==0){
			k--;
		}
		if(!k){
			cout << i << endl;
			return 0;
		}
	}

	return 0;
}

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

public class Main{
    public static void main(String[] args){
	Scanner scan = new Scanner(System.in);

	int[] num = new int[3];
	for(int i = 0; i < 3; i++){
	    num[i] = scan.nextInt();
	}
	int k = scan.nextInt();

	Arrays.sort(num);
	for(int i = 1; i <= k; i++){
	    num[2] *= 2;
	}

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

	System.out.println(sum);
    }
}


Measured memory_bytes: 22612
import java.util.*;

public class Main {
    public static void main(String[] args) {
        final Scanner sc = new Scanner(System.in);
        final int N = sc.nextInt();
        final String S = sc.next();
        Set<String> set = new HashSet<>();
        for (int i = 0; i < 10; i++) {
            int iin = S.indexOf(String.valueOf(i));
            if (iin == -1) {
                continue;
            }
            for (int j = 0; j < 10; j++) {
                int jin = S.substring(iin+1).indexOf(String.valueOf(j));
                if (jin == -1) {
                    continue;
                }
                for (int k = iin+jin+2; k < N; k++) {
                    set.add(S.substring(iin,iin+1) + S.substring(iin+jin+1,iin+jin+2) + S.substring(k,k+1));
                }
            }
        }
        System.out.println(set.size());
    }
}

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

int main(){
 long long  int n;
  cin >> n;
 
  vector<long long int> a(n),b(n),c(n);
  
  for(int i=0;i<n;i++)
    cin >>a.at(i);
  for(int i=0;i<n;i++)
    cin >>b.at(i);
  for(int i=0;i<n;i++)
    cin >>c.at(i);
  
  sort(a.begin(),a.end());
  sort(c.begin(),c.end());
  
  long long int ans=0;
  for(int i=0;i<n;i++){
    
   long long  int ant,anu;
    
    auto iter1=lower_bound(a.begin(),a.end(),b.at(i));
    auto iter2=upper_bound(c.begin(),c.end(),b.at(i));
    
    ant=iter1-a.begin();
    anu=c.end()-iter2;
    
    ans+=ant*anu;
 }
  cout << ans <<endl;
}


Measured memory_bytes: 2688
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
using namespace std;
#define	REP(i,n) for(int i = 0;	i < (int)(n); i++)
typedef	long long ll;

int main() {
  int A, B;
  cin>>A>>B;
  int ans = A+B;
  ans =	max(ans, max(A-B, A*B));
  cout << ans << endl;
  return 0;
}


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

using namespace std;

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

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


int main(){

  int n;
  cin>>n;
  string tmpp;
  getline(cin,tmpp);
  for(int i = 0; i < n; i++){
    string str1,str2;
    getline(cin,str1);
    getline(cin,str2);
    // if(str1.size()==0&&str2.size()==0){
    //   cout<<"true"<<endl;
    //   string s;
    //   getline(cin,s);
    // }
    // else if(str1.size()==0||str2.size()==0){
    //   cout<<"false"<<endl;
    //   string s;
    //   getline(cin,s);
    // }
    
    // str1ツづーidx=0ツづ堕鳴づァツつケツづゥ
    vector<pair<int,int> > spii;
    pair<int,int> cp;
    cp.first=cp.second=0;
    spii.push_back(cp);
    for(int i = 0; i < str1.size(); i++){
      int idx=(str1[i]-'a')%6;
      cp.first+=dy[idx];
      cp.second+=dx[idx];
      spii.push_back(cp);
    }
    pair<int,int> base;
    sort(spii.begin(),spii.end());
    base=spii[0];
    for(int i = 0; i < spii.size(); i++){
      spii[i].first-=base.first;
      spii[i].second-=base.second;
    }
    bool isMatch=false;
    for(int j = 0; j < 6; j++){
      vector<pair<int,int> > spii2;
      cp.first=cp.second=0;
      spii2.push_back(cp);
      for(int i = 0; i < str2.size(); i++){
	int idx=(str2[i]-'a'+j)%6;
	cp.first+=dy[idx];
	cp.second+=dx[idx];
	spii2.push_back(cp);
      }
      pair<int,int> base2;
      sort(spii2.begin(),spii2.end());
      base2=spii2[0];
      for(int i = 0; i < spii2.size(); i++){
	spii2[i].first-=base2.first;
	spii2[i].second-=base2.second;
      }
      if(spii==spii2){
	isMatch=true;
	break;
      }
    }
    if(isMatch)
      cout<<"true"<<endl;
    else
      cout<<"false"<<endl;
    string s;
    getline(cin,s);
  }
  return 0;
}

Measured memory_bytes: 0
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define cinf(n,x) for(int i=0;i<(n);i++)cin>>x[i];
#define ft first
#define sc second
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(),(v).end()
#define mod 1000000007
using namespace std;
typedef long long ll;
template<class T> using V=vector<T>;
using Graph = vector<vector<int>>;
using P=pair<ll,ll>;
typedef unsigned long long ull;
typedef long double ldouble;
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; }
//V,P(大文字)使用不可
//乗算の際にオーバーフローに注意せよ！！（適切にmodをとれ）
//制約をよく読め！

const ll INF=1e18;

signed main(){
    int k;
    cin>>k;
    V<int> a={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51
};
cout<<a[k-1]<<endl;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import sys
from collections import deque
from collections import defaultdict
from itertools import accumulate

import heapq
import collections
import itertools
import bisect
import copy
import math
sys.setrecursionlimit(10**6)

# lis_of_lis = [[] for _ in range(N)]


def zz(): return list(map(int, sys.stdin.readline().split()))


def z(): return int(sys.stdin.readline())


def S(): return sys.stdin.readline()[:-1]


def C(line): return [sys.stdin.readline() for _ in range(line)]


def get_sieve_of_eratosthenes(n):
    if not isinstance(n, int):
        raise TypeError('n is int type.')
    if n < 2:
        raise ValueError('n is more than 2')
    prime = [2]
    limit = int(n**0.5)
    data = [i + 1 for i in range(2, n, 2)]
    while True:
        p = data[0]
        if limit <= p:
            return prime + data
        prime.append(p)
        data = [e for e in data if e % p != 0]


max_ = pow(10, 5) + 2
primes = get_sieve_of_eratosthenes(max_)
num_lile2017 = [0]*max_
primes2 = []
for prime in primes:
    primes2.append(2*prime-1)
like2017 = sorted(list(set(primes2) & set(primes)))
for i in range(3, max_, 2):
    if (i in like2017):
        num_lile2017[i] = 1
num_lile2017 = list(accumulate(num_lile2017))
# print(num_lile2017)

Q = z()
for i in range(Q):
    l, r = zz()
    print(num_lile2017[r] - num_lile2017[l-1])


Measured memory_bytes: 14524
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cassert>
#include <cstdint>
#include <numeric>
#include <bitset>

using namespace std;

using ll =  long long;
using Pll = pair<ll, ll>;
using Pii = pair<int, int>;

constexpr ll MOD = 1000000007;
constexpr long double EPS = 1e-10;
constexpr int dyx[4][2] = {
    { 0, 1}, {-1, 0}, {0,-1}, {1, 0}
};

int main() {
    std::ios::sync_with_stdio(false); cin.tie(0);
    int n, i_prev, i_next;
    cin >> n;
    vector<ll> a(n), b(n);
    priority_queue<Pll> que;
    bool is_same = true;
    for(int i=0;i<n;++i){
        cin >> a[i];
    }
    for(int i=0;i<n;++i){
        cin >> b[i];
    }
    for(int i=0;i<n;++i){
        if(b[i] != a[i]) {
            i_prev = (i == 0)?n-1:i-1;
            i_next = (i == n-1)?0:i+1;
            is_same = false;
            que.push(Pii(b[i], i));
        }
    }

    if(is_same) {
        cout << 0 << endl;
        return 0;
    }

    ll ans = 0, bi_current, bi_prev;
    int i;
    while(!que.empty()) {
        tie(bi_current, i) = que.top();
        que.pop();

        i_prev = (i == 0)?n-1:i-1;
        i_next = (i == n-1)?0:i+1;

        int x = (bi_current - a[i]) / (b[i_prev] + b[i_next]);
        if(x <= 0) {
            ans = -1;
            break;
        }

        bi_prev = bi_current - x * (b[i_prev] + b[i_next]);
        b[i] = bi_prev;
        ans += x;

        if(b[i] != a[i]) {
            que.push(Pii(b[i], i));
        }
    }

    cout << ans << endl;

}


Measured memory_bytes: 9584