akhauriyash/Code-Regression huggingface dataset:
N = int(input())

# if N < 7:
#     print(-1)
#     exit()
if N % 2 == 0 or N % 5 == 0:
    print(-1)
    exit()
i = 0
num = 0
while True:
    num = (num * 10 + 7) % N
    i += 1
    if num == 0:
        print(i)
        exit()

K = int(input())

if K % 2 == 0 or K % 5 == 0:
    print(-1)
    exit()

i = 0
ai = 0
while True:
    ai = (ai * 10 + 7) % K
    i += 1
    if ai == 0:
        break
print(i)

Measured memory_bytes: 9152
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, o, n) for (auto i = (o); (i) < (n); ++(i))
#define FOR1(i, n) FOR(i, 1, n+1)
#define REP(i, n) FOR(i, 0, n)
#define REPR(i, n) for (auto i = (n)-1; (i) >= 0; --i)
#define REPI(itr, v) for (auto itr = v.begin(); itr != v.end(); ++itr)
#define REPIR(itr, v) for (auto itr = v.rbegin(); itr != v.rend(); ++itr)
#define fi first
#define se second
#define ll long long
#define int long long
#define V2(name, h, w) vector<vector<int> > name((h), vector<int>(w));
#define myCeil(dividend, divisor) ceil((double)(dividend) / (double)(divisor))
#define myFloor(dividend, divisor) floor((double)(dividend) / (double)(divisor))
#define calcDigits(num) floor(log10(num))+1

#define dl(line) cerr << "RUN: until " << (line) << "th line." << endl;
#define dv(name, value) cerr << (name) << " is " << (value) << endl;
#define da(v)  cerr << "["; REPI(itr, v){cerr << *itr << (itr != --v.end() ? ", " : "");} cerr << "]" << endl;
#define dpa(v) cerr << "[ " << endl;REPI(itr, v) { cerr << "  [" << (*itr).first << ", " << (*itr).second << ']' << (itr != --v.end() ? "," : "") << endl; } cerr << "]" << endl;


void solve(long long N, std::vector<long long> d){
  int sum = 0;
  REP(x, N) {
    FOR(y, x+1, N) {
      sum += d.at(x) * d.at(y);
      dv("x", x);
      dv("x", y);
      cerr << endl;
    }
  }
  cout << sum << endl;
}

signed main(){
  long long N;
  scanf("%lld",&N);
  std::vector<long long> d(N);
  for(int i = 0 ; i < N ; i++){
    scanf("%lld",&d[i]);
  }
  solve(N, std::move(d));
}


Measured memory_bytes: 256
def solve(N, M, Xs):
    Xs = sorted(Xs)
    diffs = sorted([Xs[i+1] - Xs[i] for i in range(M-1)], reverse=True)
    return Xs[-1] - Xs[0] - sum(diffs[:N-1])


if __name__ == "__main__":
    N, M = tuple(map(int, input().split(" ")))
    Xs = list(map(int, input().split(" ")))
    print(solve(N, M, Xs))


Measured memory_bytes: 13960
/*
AUTHOR: Aman Raj
LANG: C++
*/

using namespace std;

typedef   long long ll;
#include <bits/stdc++.h>


//setbase - cout << setbase (16); cout << 100 << endl; Prints 64
//setfill -   cout << setfill ('x') << setw (5); cout << 77 << endl; prints xxx77
//setprecision - cout << setprecision (14) << f << endl; Prints x.xxxx
//cout.precision(x)  cout<<fixed<<val;  // prints x digits after decimal in val
#define fast  ios_base::sync_with_stdio(false); cin.tie(0);  cout.tie(0);
#define all(a) a.begin(),a.end()
//#define mod 998244353
#define mod 100000007
#define inf 1e18
//#define mod 3
#define flush fflush(stdout)

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
typedef cc_hash_table<ll, ll, hash<ll> > ht;

// find_by_order()  // order_of_key
typedef tree<
    int,
    null_type,
    less<long long int>,
    rb_tree_tag,
    tree_order_statistics_node_update>
    ordered_set;






ll power1(ll a, ll b)//a raised to power b
   {  if(b<=0) return 1; if(b==1) return a;
       ll c=power1(a,b/2);
        c*=c;c=c%mod;if(b%2==1) c*=a;c=c%mod;
        return c;
   }
   ll mi(ll a,ll m)
   { ll c= power1(a,m-2);

     return c;
   }



 struct less_then_greater {
    template<typename T, typename U>
    bool operator()(T const& lhs, U const& rhs) const {
        if (lhs.first < rhs.first) return true;
        if (rhs.first < lhs.first) return false;
        return lhs.second > rhs.second;
    }
};
 /*std::priority_queue<std::pair<int, int>,
                    std::vector<std::pair<int, int>>,
                    less_then_greater
                   > pq;*/



  int main()
{    fast;
   ll n;cin>>n;
     ll a=n%10;
       set<ll> s1={2,4,5,7,9},s2={0,1,6,8};
        if(s1.count(a))cout<<"hon";
        else if(s2.count(a))cout<<"pon";
        else cout<<"bon"<<endl;

        return 0;
}


Measured memory_bytes: 3628
#![allow(non_snake_case)]
#![allow(unused_variables)]
#![allow(dead_code)]

fn main() {
    let (A, op, B): (i64, String, i64) = {
        let mut line: String = String::new();
        std::io::stdin().read_line(&mut line).unwrap();
        let mut iter = line.split_whitespace();
        (
            iter.next().unwrap().parse().unwrap(),
            iter.next().unwrap().to_string(),
            iter.next().unwrap().parse().unwrap()
        )
    };

    let ans = if op.as_str() == "+" {
        A + B
    } else {
        A - B
    };

    println!("{}", ans);
}

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

#define rep(i, n) rep2(i, 0, n)
#define rep2(i, m, n) for (ll i = m; i < (n); i++)

using ll = long long;
using pii = pair<int, int>;
using Vi = vector<int>;

int main() {
  string n;
  cin >> n;
  rep(i,3){
    if(n[i]=='1') cout << 9;
    else cout << 1;
  }
  
}      

Measured memory_bytes: 3572
package main

import "fmt"

func main() {
	var s string
	fmt.Scanf("%s\n", &s)
	ans := make([]int, len(s))
	var rcount, lcount, point int

	for i, l := range s {

		if (lcount == 0) && (string(l) == "L") {
			point = i
		}

		if ((lcount > 0) && (string(l) == "R")) || i == len(s)-1 {
			if i == len(s)-1 {
				lcount++
			}

			ans[point-1] = rcount/2 + lcount/2 + rcount%2
			ans[point] = rcount/2 + lcount/2 + lcount%2
			rcount, lcount = 0, 0
		}

		if string(l) == "R" {
			rcount++
		} else {
			lcount++
		}

	}

	for _, i := range ans {
		fmt.Printf("%d ", i)
	}
}


Measured memory_bytes: 4200
#include <iostream>
#include <cstdio>

struct Node {
    int parent;
    int left;
    int right;
};

void CalcParent(Node *node_list, int n)
{
    for (int i = 0; i < n; i++) {
        // i is target node id
        int left = node_list[i].left;
        int right = node_list[i].right;
        if (left != -1) {
            node_list[left].parent = i;
        }
        if (right != -1) {
            node_list[right].parent = i;
        }
    }
}

int GetRoot(Node *node_list, int n)
{
    for (int i = 0; i < n; i++) {
        if (node_list[i].parent == -1) {
            return i;
        }
    }
    return -1;
}

void PrintPreorder(int root, Node *node_list)
{
    std::cout << " " << root;
    if (node_list[root].left != -1) {
        PrintPreorder(node_list[root].left, node_list);
    }
    if (node_list[root].right != -1) {
        PrintPreorder(node_list[root].right, node_list);
    }
}

void PrintInorder(int root, Node *node_list)
{
    if (node_list[root].left != -1) {
        PrintInorder(node_list[root].left, node_list);
    }
    std::cout << " " << root;
    if (node_list[root].right != -1) {
        PrintInorder(node_list[root].right, node_list);
    }
}

void PrintPostorder(int root, Node *node_list)
{
    if (node_list[root].left != -1) {
        PrintPostorder(node_list[root].left, node_list);
    }
    if (node_list[root].right != -1) {
        PrintPostorder(node_list[root].right, node_list);
    }
    std::cout << " " << root;
}

int main(int argc, char *argv[])
{
    int n;
    scanf("%d", &n);

    // Init
    Node *node_list = (Node *)malloc(sizeof(Node) * n);
    for (int i = 0; i < n; i++) {
        node_list[i].parent = -1;
        node_list[i].left = -1;
        node_list[i].right = -1;
    }

    // Make node_list
    for (int i = 0; i < n; i++) {
        int id, left, right;
        scanf("%d", &id);
        scanf("%d", &left);
        scanf("%d", &right);
        node_list[id].left = left;
        node_list[id].right = right;
    }
    CalcParent(node_list, n);
    int root = GetRoot(node_list, n);

    std::cout << "Preorder" << std::endl;
    PrintPreorder(root, node_list);
    std::cout << std::endl;
    std::cout << "Inorder" << std::endl;
    PrintInorder(root, node_list);
    std::cout << std::endl;
    std::cout << "Postorder" << std::endl;
    PrintPostorder(root, node_list);
    std::cout << std::endl;

    // Free node_list
    free(node_list);
    return 0;
}


Measured memory_bytes: 3164
import java.util.Scanner;

public class Main {
    public static void main(String args[]){
        Scanner stdIn = new Scanner(System.in);
		
        int sosu[] = new int[1100000]; 
        int num = 1; 
        sosu[0] = 2;
        sosu[1] = 3; 
        int b = 0;
		
        for(int c = 3; c <= 1100000; c += 2) {
            for (int a = 1; sosu[a] * sosu[a] <= c; a++) { 
                if ( c % sosu[a] == 0) { 
                    b = 1; 
                    break;
                }
            }
            
            if(b == 0) { 
                sosu[num++] = c; 
            }
            
            b = 0;
        }
        
        
        while(stdIn.hasNext()){
            int kazu = stdIn.nextInt();
            int count = 0;
            
            for(int i = 0; ; i++){
                if(sosu[i] == kazu){
                    count = i + 1;
                    break;
                }else if(sosu[i] > kazu){
                    count = i;
                    break;
                }
            }
            
            //if(stdIn.hasNext()){
            	System.out.println(count);
            //}else{
                //System.out.print(count);
            //}
        }
		stdIn.close();
    }
}


Measured memory_bytes: 31096
#include <bits/stdc++.h>
using namespace std;
 
int main(){
    int N;
    cin >> N;

    int a[N];

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

    int cnt = 0;
    for (int i = 0; i < N; i++){
        int i_like = a[i];
        int j_like = a[i_like-1];
        if (i+1 == j_like) {
            cnt++;
        }
    }

    cout << cnt/2 << endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define REP(i, n) for (int (i) = 0; (i) < (int)(n); i++) 
#define FOR(i, a, b) for(int (i) = a; (i) < (int)b; i++)
#define RREP(i, n) for(int (i)=((int)(n)-1); (i)>=0; i--)
#define RFOR(i, a, b) for(int (i) =((int)(b)-1); (i)>=(int)a; i--)
#define ALL(v) (v).begin(),(v).end()
#define MOD 1000000007
#define FT first
#define SC second

using namespace std ;
typedef long long ll;
typedef vector<int> vint;
typedef vector<vint> vvint;
typedef pair<int, int> pint;
const int INF = 1e9;
const double EPS = 1e-9;



int main()
{
  ll n ;
  cin >> n ;
  cout << n*(n-1)/2 <<endl ;

  return 0 ;
}



Measured memory_bytes: 256
N = int(input())
a_list = list(map(int,input().split()))

min_sum = 100000000
temp_sum = 0
ans = 0
for i in range(-100,101):
    for j in range(N):
        temp_sum += pow(i-a_list[j],2)
        if j==N-1:
            if temp_sum < min_sum:
                min_sum = temp_sum
            temp_sum = 0
print(min_sum)

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

int main()
{
	int a,b;
	cin >> a >> b;
	
	if(a == 1) {
		a = 14;
	}
	if(b == 1) {
		b = 14;
	}
	if(a == b) {
		cout << "Draw" << endl;
		return 0;
	}
	if(a > b) {
		cout << "Alice" << endl;
		return 0;
	}
	if(a < b) {
		cout << "Bob" << endl;
		return 0;
	}
}

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

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)n; ++i)
#define REP(i, a, b) for (int i = (int)a; i < (int)b; ++i)
#define each(i,c) for(__typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define all(v) v.begin(), v.end()
#define mset(a, n) memset(a, n, sizeof(a))

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

const int INF = 1000000000;
const int MOD = 1000000007;
const double eps = 1e-9;

int main(int argc, char *argv[]) {
    // cin.tie(0);
    // ios::sync_with_stdio(false);
    string s; cin >> s;
    int c = 1000, f = 0;
    rep(i, s.size()) {
        if (s[i] == 'C') c = min(c, i);
        if (s[i] == 'F') f = max(f, i);
    }

    if (c < f) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define ioS            ios::sync_with_stdio(false);cin.tie(0);
#define li             long int
#define ll            long li
#define ull            unsigned ll
#define pi             pair<int,int>
#define vi             vector<int>
#define vli            vector<li>
#define vll           vector<ll>
#define vvi            vector<vector<int>>
#define pb             push_back
#define mp             make_pair
#define forn(i,s,n)    for(auto i=s;i<n;++i)               
#define forr(i,s,n)    for(auto i=s;i>=n;--i) 
const ll MOD = 1e9+7;
const li mx = 1e9; 

void solve()
{
    int l,r,d;
    cin>>l>>r>>d;
    int count=0;
    for(int i=l;i<=r;i++)
    {
        if(i%d==0)  count++;
    }
    cout<<count<<endl;
}
int32_t main()
{
    ioS
    int t;
    // cin>>t;
    // while(t--)
        solve();
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
 
#define clr(i, j)     memset(i, j, sizeof(i))
#define pb            push_back
 
typedef long long     ll;
 
//-*-*-*-*-*-*-*-*-
 
  
 
ll m,k,x,y,z;
ll dp[9999999];
ll a[999999];ll c[99];map<ll,ll>mp;
map<ll,ll>mpp;  ll t=0;
ll b[9999999];ll p[9999999];set<ll>s;
int main()
{
   ll l=0;//ll s=0;ll mn=0;
   ll n,k;    cin>>n;
   ll ans=0;
 
    for(ll j=1;j<=n;j++){
       cin>>z;
    mp[z]++;s.insert(z);
   }  for(auto h:s){
      if(mp[h]>h){
   ans+=mp[h]-h;}else if(mp[h]<h){ans+=mp[h];}
 }
     cout<<ans;
      
   

  
   }

Measured memory_bytes: 12800
program answer
  implicit none

  character(len=2*100000) :: S,T
  integer :: n, i, count

  read(*,*) S
  read(*,*) T

  n=len_trim(S)

  count = 0
  do i = 1, n
     if(S(i:i)/=T(i:i)) then
        count = count + 1
     end if
  end do

  write(*,*) count

  stop
 end program answer

Measured memory_bytes: 3392
//package Qo
import java.util.*
import java.math.*
import java.lang.Math.*

private val readString: ()->String = {readLine()!!}
private val readInt: ()->Int = {readLine()!!.toInt()}
private val readLong: ()->Long = {readLine()!!.toLong()}
private val readIntArray: ()->IntArray = {readLine()!!.split(' ').map{it.toInt()}.toIntArray()}
private val readLongArray: ()->LongArray = {readLine()!!.split(' ').map{it.toLong()}.toLongArray()}
private val errPrintln: (String)->Unit = {msg -> System.err.println(msg)}
private val MOD = 1e9.toLong()+7
private val INF = Int.MAX_VALUE/2
private val LINF = Long.MAX_VALUE/2


fun solveO(A: Array<IntArray>): Long {
    val N = A.size

    //val dp = Array(N+1){LongArray(0b01 shl N){0}}
    // dp[i][j] := [0,i) までの男が女と組み、女の選択状態が j となる通り数
    var dp = LongArray(0b01 shl N){0}

    //dp[0][0] = 1L
    dp[0] = 1L
    for (i in 0 until N) {
        val ndp = LongArray(0b01 shl N){0}

        for (j in 0 until (0b01 shl N)) {
            //if (dp[i][j] == 0L) continue
            if (dp[j] == 0L) continue

            for (k in 0 until N) {
                if (A[i][k] == 0) continue

                if ((j shr k) and 0b01 == 1) continue

                val nj = j or (0b01 shl k)
                //dp[i+1][nj] += dp[i][j]
                //dp[i+1][nj] %= MOD
                ndp[nj] += dp[j]
                ndp[nj] %= MOD
            }
        }
        dp = ndp
    }

    //return dp[N][(0b01 shl N)-1]
    return dp[(0b01 shl N)-1]
}


fun main(args: Array<String>) {
    val N = readInt()
    val A = Array(N){IntArray(N){0}}
    for (i in 0 until N) {
        A[i] = readIntArray()
    }

    val ans = solveO(A)

    println(ans)
}

Measured memory_bytes: 229768
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <iterator>
#pragma warning(disable:4996)
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define MOD 1000000007
using namespace std;

ll  a[100005];

int main(int argc, char* argv[])
{
    long n;
    scanf("%ld", &n); 

    long i;
    a[0]=2;
    a[1]=1;
    for(i=2; i<=n; i++) {
        a[i]=a[i-2]+a[i-1];
    }
    printf("%lld\n", a[n]);
      
 
    return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int main(void){
    int n,k;

    cin>>n>>k;
    vector<int> h(n),dp(n+1);

    for(int i=0;i<n;i++){
        cin>>h[i];
        dp[i]=INT_MAX;
    }
    dp[0]=0;
    dp[1]=abs(h[1]-h[0]);
    for(int i=0;i<n;i++){
        for(int j=1;j<=k;j++){
            int a=dp[i]+abs(h[i+j]-h[i]);
            if(dp[i+j]>a){
                dp[i+j]=a;
            }
        }
    }
    cout<<dp[n-1]<<endl;
    return 0;
}

Measured memory_bytes: 1024
//Name-Deepesh Bhatt
//Institute-IIT Dhanbad

#include <bits/stdc++.h>
using namespace std;
typedef  long long int ll;
ll MOD =1000000007;
ll gcd(ll a,ll b)
{
    if(b==0)
        return a;
    else
        return gcd(b,a%b);
}
ll lcm(ll a ,ll b)
{
    return a/gcd(a,b)*b;
}
ll power(ll a,ll n)
{
    if (n == 0)
        return 1;
    ll p = power(a, n / 2);
    p = (p * p);
    if (n % 2)
        return (p * a);
    else
        return p;
}
int main()
{
    ios_base::sync_with_stdio(false);    //for fast I/O operation
    cin.tie(NULL);
    ll n,k;
    cin>>n>>k;
    vector<ll>sum(200001,0);
    for(ll i=0;i<200001;i++){
        if(i==0)
            sum[i]=0;
        else
            sum[i]=i+sum[i-1];
    }
    /*for(auto x:sum){
        cout<<x<<" ";
    }*/
    ll d=0;
    for(ll i=k;i<=n;i++){
        ll min_sum=sum[i-1];
        ll max_sum=(sum[n]-sum[n-i]);
        d+=max_sum-min_sum+1;
        d=d%MOD;
    }
    d++;
    cout<<d%MOD;
    return 0;
}

Measured memory_bytes: 4784
#include <iostream>
#include <stdio.h>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
#include <set>
#include <map>
#include <deque>
#include <math.h>
#include <string>
#include <iomanip>
#include <locale>
#include <list>
#include <bitset>
#include <tuple>
using namespace std;
#define FORN(i,m,n) for(int i=(m); i<int(n); i++)
#define PRINTVEC(v) FORN(i,0,v.size()) cout<<v[i]<<" "; cout<<endl
#define PRINTMAT(m) FORN(j,0,m.size()) {PRINTVEC(m[j]);}
typedef long long ll;

int gcd(int a, int b){ return b ? gcd(b,a%b) : a; }

int main(){
  ios_base::sync_with_stdio(false); cin.tie(NULL);
  int n; cin>>n;
  string s, t = "BGR"; cin>>s;
  vector<int> cnt[26];
  FORN(i,0,n) cnt[s[i]-'A'].push_back(i);
  ll ans = 0;
  do{
    for(int a : cnt[t[0]-'A']){
      for(int b : cnt[t[1]-'A']){
	if(a < b){
	  int c = t[2] - 'A';
	  ans += (cnt[c].end() - upper_bound(cnt[c].begin(), cnt[c].end(), b));
	  if((b+b-a) < n && s[b+b-a] == t[2]) ans--;
	}
      }
    }
  } while(next_permutation(t.begin(), t.end()));
  cout<<ans<<endl;
}

Measured memory_bytes: 3180
package main

import (
	"fmt"
)

func main() {
	var n int
	var m,sum,standard float64
	fmt.Scan(&n,&m)
	
	votes := make([]float64,n)
	for i,_ := range votes {
		fmt.Scan(&votes[i])
		sum += votes[i]
	}
	standard = sum * (1 / (4 * m))
  	cnt := 0.0
	for i,_ := range votes {
		fmt.Scan(&votes[i])
		if votes[i] >= standard {
			cnt++
		}
	}
	
	if cnt >= m {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}

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

using namespace std;

const int N = 3e5 +1 , mod = 1e9 +7 ;
int n;
map<string , int > mp;
int mx;
int main()
{
    cin>>n;

    for(int i = 0;i<n;i++)
    {
        string s ;
        cin>>s;
        mp[s]++;
        mx = max(mx , mp[s]);
    }
    for(auto u : mp)
    {
        if(u.second==mx)
            cout<<u.first<<"\n";
    }
    return 0;
}


Measured memory_bytes: 25216
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <functional>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <cassert>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int,int> P;
#define rep(i,a,n) for(ll i = (a);i < (n);i++)
#define per(i,a,n) for(ll i = (a);i > (n);i--)
#define lep(i,a,n) for(ll i = (a);i <= (n);i++)
#define pel(i,a,n) for(ll i = (a);i >= (n);i--)
#define clr(a,b) memset((a),(b),sizeof(a))
#define pb push_back
#define mp make_pair
#define all(c) (c).begin(),(c).end()
#define sz size()
#define print(X) cout << (X) << endl
const ll INF = 1e+9+7;
ll n,m,l;
string s,t;
ull d[100000],dp[100][100];

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

int main(){
  cin >> n >> m;
  rep(i,0,n)cin >> d[i];
  sort(d,d+n);
  l = d[0];
  pel(i,n-1,0)l = gcd(d[i],l);
  if(m % l == 0 && m <= d[n-1])puts("POSSIBLE");
  else puts("IMPOSSIBLE");
  return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include <cstring>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int main(){
  string S; cin >> S;
  int N = S.size();
  rep(i, N){
    cout << 'x';
  }
  cout << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;

int main() {
    int m, d;
    cin >> m >> d;

    int ans = 0;
    for(int i = 1; i <= m; i++) {
        for(int j = 1; j <= d; j++) {
            int d10 = j/10;
            int d1 = j%10;

            if(d1 >= 2 && d10 >= 2 && d1*d10 == i) {
                ans++;
            }
        }
    }

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define all(x) (x).begin(),(x).end()
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; }
typedef long long ll;
const long long INF = 1LL << 60;
typedef pair<int, int> P;
int main()
{
    string S;
    cin >> S;
    int ans = 0;
    int len = (int)S.size();
    rep(i, S.size()) {
        if (S[i] != S[len - i - 1]) ans++;
    }

    cout << ans / 2 << endl;
    return 0;
}

Measured memory_bytes: 256
from collections import Counter


def main():
    N = int(input())
    S = [input() for _ in range(N)]
    c = Counter(S).most_common()
    ans = []
    for item in c:
        if c[0][1] == item[1]:
            ans.append(item[0])
        else:
            break
    ans.sort()

    for i in ans:
        print(i)


if __name__ == "__main__":
    main()


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

ll n,m;
ll a[111111];
ll b[111111];
ll res[111111];

struct UnionFind {
    vector<int> par;
    
    UnionFind(int n) : par(n, -1) { }

    int root(int x) {
        if (par[x] < 0) return x;
        else return par[x] = root(par[x]);
    }
    
    bool issame(int x, int y) {
        return root(x) == root(y);
    }
    
    bool merge(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (par[x] > par[y]) swap(x, y);
        par[x] += par[y];
        par[y] = x;
        return true;
    }
    
    int size(int x) {
        return -par[root(x)];
    }
};

int main(){
    cin >> n >> m;
    for(ll i=0;i<m;i++){
        cin >> a[i] >> b[i];
        a[i]--;
        b[i]--;
    }
    UnionFind tree(n);
    res[m]=n*(n-1)/2;
    for(ll i=m-1;i>=0;i--){
        if(tree.issame(a[i],b[i])){
            res[i]=res[i+1];
        }
        else{
            res[i]=res[i+1]-(tree.size(a[i])*tree.size(b[i]));
        }
        tree.merge(a[i],b[i]);
    }
    for(ll i=1;i<=m;i++){
        cout << res[i] << endl;
    }
    return 0;
}  


Measured memory_bytes: 5936
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define irep(i, n) for (int i = (n); i >= 0; i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = 1 << 30;
 
int main() {
  int n;
  cin >> n;
  vector<int> o(100010), e(100010);
  rep(i,n) {
    int v; cin >> v;
    if (i%2 == 1) o[v]++;
    else e[v]++;
  }
  int i = max_element(e.begin(),e.end()) - e.begin();
  int j = max_element(o.begin(), o.end()) - o.begin();
  if (i != j) {
    cout << n-e[i]-o[j] << endl;
  } else {
    sort(e.begin(),e.end(),greater<int>());
    sort(o.begin(),o.end(),greater<int>());
    int an = min(n-e[0]-o[1],n-e[1]-o[0]);
    cout << an << endl;
  }
  return 0;
}


Measured memory_bytes: 4056
#include<stdio.h>
#include<math.h>
#include<string.h>
#include<iostream>
#include<algorithm>
using namespace std;
int main() {
	int n,i,j;
	int con[8];
	for(j=0; j<8; j++)	con[j] = 0;
	scanf("%d",&n);
	int highnum = 0;
	for(i=0; i<n; i++) {
		int x;
		scanf("%d",&x);
		bool whigh = true;
		if(x>=3200)	highnum++;
		else {
			for(j=0; j<8; j++) {
				if(x>=j*400 && x<400*(j+1)) {
					con[j]++;
					whigh = false;
					break;
				}
			}
		}
	}
	int num = 0;
	for(j=0; j<8; j++)	if(con[j]>0)	num++;
	
	if(num == 0) {
		printf("%d %d",1,highnum);
	} else {
		printf("%d %d",num,num+highnum);
	}
	return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
#define Nmax 200010
#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define RFOR(i,a,b) for(long long i = (b-1);i>=a;i--)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define RITR(itr,mp) for(auto itr = (mp).rbegin(); itr != (mp).rend(); ++itr)
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
typedef long long ll;
typedef pair<ll,ll> P;
typedef vector<P> Graph;
 
int main() {
	int n,m;
	cin >> n >> m;
	ll a[52],b[52],c[52],d[52];
	REP(i,n) cin >> a[i] >> b[i];
	REP(i,m) cin >> c[i] >> d[i];
	ll mina;
	int o;
	REP(i,n){
      	mina=MOD;
		RREP(j,m){
			ll kyori=abs(a[i]-c[j])+abs(b[i]-d[j]);
			mina=min(mina, kyori);
			if(mina==kyori) o = j+1;
		}
		cout << o << endl;
	}
	return 0;
}

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

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

  int *apple;
  apple = (int *)malloc(sizeof(int) * n);

  int abs_min = 100;
  int eat = 0;
  for(i = 0; i < n; i++) {
    apple[i] = l + i;
    if(abs_min > abs(apple[i])) {
      abs_min = abs(apple[i]);
      eat = i;
    }
  }

  apple[eat] = 0;
  int taste = 0;
  for(i = 0; i < n; i++) {
    taste+= apple[i];
  }

  printf("%d\n", taste);

  return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define mod 1000000007
#define mod1 998244353
#define timepass 1073741824
#define MAXN 200000 + 5
#define LOGN 20
using namespace std;
#define N 505

/*#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
/*template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;*/

#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(arr) arr.begin() , arr.end()
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define rep(i , a , n) for(int i = a ; i < n ; i++)
#define rrep(i , n , a) for (int i = n - 1 ; i >= a ; i--)
#define ms(arr , val) memset(arr , val , sizeof(arr))
#define sp(a , x) cout << fixed << setprecision(a) << x << endl; 
#define siz(temp) (ll)temp.size()
#define len(temp) (ll)temp.length()
#define int ll
#define s(arr) sort(all(arr))
#define r(arr) reverse(all(arr))
#define rs(arr) s(arr) ; r(arr)
#define pi acos(-1)
#define con continue
#define endl "\n"
#define w(q) while(q--)

//debug
#define trace1(x)                cout<<#x<<": "<<x<<endl
#define trace2(x, y)             cout<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cout<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
#define trace7(a, b, c, d, e, f , g) cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<< f << " | "<< #g <<": "<<g<<endl
#define trace8(a, b, c, d, e, f , g , h) cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<< f << " | " << #g <<": "<< g <<" | "<<#h<< ": " << h << endl

typedef pair<int , int> pii;
typedef pair<int , pii> piii;
typedef vector<int> vi;
typedef vector<pii> vpii;
typedef vector<piii> vpiii;

signed main()
{
    FAST;
    int x;
    cin >> x;
    int ans = (x / 500) * 1000;
    int val = x % 500;
    ans = ans + (val / 5) * 5;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
#define pb push_back
int dy[]={0, 0, 1, -1, 1, 1, -1, -1};
int dx[]={1, -1, 0, 0, 1, -1, -1, 1};

#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define mp make_pair
#define fi first
#define sc second
typedef pair<ll,ll> P;
ll h,w,n,a[200000],b[200000];
set<P> s,used;
vector<ll> x,y;
ll c[10];

int main() {
	cin >> h >> w >> n;
	REP(i,n) {
		cin >> a[i] >> b[i];
		s.insert(P(a[i],b[i]));
	}

	REP(i,n) {
		FOR(p,-2,1) {
			FOR(q,-2,1) {
				ll y = a[i] + p;
				ll x = b[i] + q;
				if(y < 1 || y + 2 > h)
					continue;
				if(x < 1 || x + 2 > w)
					continue;

				auto it = used.find(P(y,x));
				if(it != used.end()) {
					continue;
				}
				used.insert(P(y,x));

				ll cc = 0;
				REP(k,3) {
					REP(l,3) {
						if(s.find(P(y + k,x + l)) != s.end()) {
							cc++;
						}
					}
				}
				c[cc]++;
			}
		}
	}
	ll sum = 0;
	FOR(i,1,10) {
		sum += c[i];
	}

	cout << (h - 2) * (w - 2) - sum << endl;

	FOR(i,1,10) {
		cout << c[i] << endl;
	}
	return 0;
}


Measured memory_bytes: 64256
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <vector>
#include <set>

#define mod 1000000007
#define MAX_N 100000

using namespace std;

int main()
{
    int N, i, D, counter, X, Y;

    scanf("%d%d", &N, &D);

    counter = 0;
    for(i = 0; i < N; ++i){
        scanf("%d%d", &X, &Y);
        if(X * 1LL * X + Y * 1LL * Y <= D * 1LL * D)
            ++counter;
    }

    printf("%d", counter);

    return 0;
}


Measured memory_bytes: 1728
#include <iostream>
#include <vector>
#include <queue>

using namespace std;

struct wie
{
    int a, r;
};

int main()
{
    ios_base::sync_with_stdio(0);
    int n, m;
    cin >> n >> m;
    vector< vector<int> > G(n);
    for (int i = 0; i < m; ++i)
    {
        int a, b;
        cin >> a >> b;
        --a;
        --b;
        G[a].push_back(b);
    }
    int x, y;
    cin >> x >> y;
    --x;
    --y;
    queue<wie> Q;
    vector< vector<int> > odl(n, vector<int>(3, -1));
    Q.push({x, 0});
    odl[x][0] = 0;
    while (!Q.empty())
    {
        wie akt = Q.front();
        Q.pop();
        for (int i = 0; i < G[akt.a].size(); ++i)
        {
            wie nowy = {G[akt.a][i], (akt.r + 1) % 3};
            if (odl[nowy.a][nowy.r] == -1)
            {
                odl[nowy.a][nowy.r] = odl[akt.a][akt.r] + 1;
                Q.push(nowy);
            }
        }
    }
    if (odl[y][0] == -1)
        cout << "-1";
    else
        cout << odl[y][0] / 3;
    return 0;
}


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

int main() {
  int R,G,B,N;
  cin >> R >> G >> B >> N;
  int pattern = 0;
  for(int i=0;R*i<=N;i++){
      for(int j=0;R*i+G*j<=N;j++){
          if((N-(R*i+G*j))%B==0){
              pattern ++;
          }
      }
  }
  cout << pattern << endl;
}


Measured memory_bytes: 256
n,m = [int(x) for x in input().split()]
ans = [0]*(n+1)
w = [0]*(n+1)
for _ in range(m):
    a,b = input().split()
    a = int(a)
    if ans[a] == 1:
        continue
    if b == "AC":
        ans[a] = 1
    else:
        w[a] += 1

aa = 0
ww = 0
for i in range(1,n+1):
    if ans[i]==1:
        aa += 1
        ww += w[i]
print(aa,ww)


Measured memory_bytes: 45528
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <numeric>
#include <utility>
#include <string>

using namespace std;

const int inf = 2e9;

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

	vector<int> h(n + k, inf);
	for (int i = 0; i < n; i++) {
		cin >> h[i];
	}

	vector<int> dp(n + k, inf);
	dp[0] = 0;
	for (int i = 0; i < n - 1; i++) {
		for (int j = 1; j <= k; j++) {
			dp[i+j] = min(dp[i+j], dp[i] + abs(h[i+j] - h[i]));
		}
	}

	cout << dp[n-1] << endl;
	return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
const long long INF = LLONG_MAX/2;
#define FOR(i, r, n) for(int i=(r); i<(n); i++) 
#define REP(i, n) FOR(i, (0), n)
#define ll long long int
template<typename T>
void remove(std::vector<T>& vector, unsigned int index)
{
	vector.erase(vector.begin() + index);
}

using namespace std;
ll ans=0, sum = 0, n;

ll l;
vector<string> v;
string s;

int main()
{
	cin >> n >> l;
	REP(i, n)
	{
		cin >> s;
		v.push_back(s);
	}
	sort(v.begin(), v.end());
	REP(i, n)
	{
		cout << v[i];
	}
	cout << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll,ll>;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep2(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
const ll INF = 1LL<<60;
const ll MOD = 998244353;


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll n,s;cin>>n>>s;
    vector<ll> a(n);rep(i,n)cin>>a[i];
    vector<vector<ll>> dp1(n+1,vector<ll>(s+1,0));
    vector<vector<ll>> dp2(n+1,vector<ll>(s+1,0));
    //dp1[i][j]:N=i,S=jに対するl*(n-r+1)の和
    //dp2[i][j]:N=i,S=jに対するlの和
    
    for(int i=0; i<=n; i++){
        if(i==0)continue;
        ll A = a[i-1];
        for(int j=0; j<=s; j++){
            if(A>j){
                dp1[i][j]=dp1[i-1][j]+dp2[i-1][j];
                dp2[i][j]=dp2[i-1][j];
            }else if(A==j){
                dp1[i][j]=dp1[i-1][j]+dp2[i-1][j]+i;
                dp2[i][j]=dp2[i-1][j]+i;
            }else{
                dp1[i][j]=dp1[i-1][j]+dp2[i-1][j]+dp2[i-1][j-A];
                dp2[i][j]=dp2[i-1][j]+dp2[i-1][j-A];
            }
            dp1[i][j]%=MOD;
            dp2[i][j]%=MOD;
        }
    }

    cout<<dp1[n][s];
    return 0;
}

Measured memory_bytes: 141184
using System;
using System.Diagnostics;
using System.IO;
using System.Text;
using System.Linq;
using System.Collections.Generic;

class Program
{
    const string Yes = "Yes";
    const string No = "No";
    const long Mod = 1000000007;
    static void Main(string[] args) {
#if DEBUG
        MyDebugger.Test(process, "../TextFile1.txt");
        //MyDebugger.Test(process, "../TextFile2.txt");
        //MyDebugger.MakeTestCase("../TextFile2.txt");
#else
        object ret = process(new StreamReader(Console.OpenStandardInput()));
        Console.WriteLine(ret);
#endif
    }

    static object process(TextReader input) {
        var spl   = input.ReadLine().Split(' ');
        var x1     = int.Parse(spl[0]);
        var y1     = int.Parse(spl[1]);
        var x2     = int.Parse(spl[2]);
        var y2     = int.Parse(spl[3]);

        var xsub = x2 - x1;
        var ysub = y2 - y1;

        var x3 = x2 - ysub;
        var y3 = y2 + xsub;
        var x4 = x3 - xsub;
        var y4 = y3 - ysub;

        return x3 + " " + y3 + " " + x4 + " " + y4;
    }
}

Measured memory_bytes: 13140
def gcd(a, b):
    a, b = max(a, b), min(a, b)
    if b == 0:
        return a
    return gcd(b, a % b)


def main():
    N, M = map(int, input().split())
    s = input()
    t = input()
    d = gcd(N, M)
    for i in range(d):
        if s[i*N//d] != t[i*M//d]:
            print(-1)
            return
    print(N*M//d)


if __name__ == "__main__":
    main()


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

#define int long long  

using namespace std;

int N, W, dp[100005], ans, u[100005];

main(){
	cin >> N >> W;
	for(int i = 1; i <= N; i++){
		int w , c;
		cin >> w >> c;
		u[0] = 1;
		for(int j = W; j >= 0; j--){
			if(u[j] == 1 && j + w <= W){
				u[j + w] = 1;
				dp[j + w] = max(dp[j] + c , dp[j + w]);
				ans = max(ans, dp[j + w]);
			}
		}            
	}
	cout << ans;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
int main(){
    string n;
    int i;
    cin>>n;
    bool yes=false;
    for(i=0;i<3;i++){
        if(n[i]=='7'){
            yes=true;
            cout<<"Yes"<<endl;
            break;
        }

    }
    if(yes==false){
        cout<<"No"<<endl;
    }


    return 0;
}


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

using namespace std;

typedef long long ll;
#define pb push_back
#define dbg(x) cerr << #x << " " << x << "\n"


ll D;
ll cost[6];
map <ll, ll> dp;
ll go (ll n);

ll call (ll n, ll i) {
    ll l = n - (n % i);
    ll r = l + i;
    if (l == n)
        r = n;
    return min (go (l / i) + cost[i] + (n - l) * D, go (r / i) + cost[i] + (r - n) * D);
}

const ll INF = 1e18;

ll go (ll n) {
    if (dp.find (n) != dp.end ())
        return dp[n];
    ll ans = INF;
    if (ans / D > n)
        ans = D * n;
    ans = min (ans, call (n, 2));
    ans = min (ans, call (n, 3));
    ans = min (ans, call (n, 5));
    dp[n] = ans;
    return dp[n];
}

void solveTest () {
    ll n;
    cin >> n >> cost[2] >> cost[3] >> cost[5] >> D;
    dp.clear ();
    dp[0] = 0;
    dp[1] = D;
    cout << go (n) << "\n";
}

int main() {
    int t;
    cin >> t;
    while (t--) solveTest ();
    return 0;
}


Measured memory_bytes: 4408
#include<bits/stdc++.h>
#define mod 1000000007
using namespace std;
typedef long long int ll;
#define f(i, n) for(int i = 0; i < n; ++i)
#define pb push_back


void input(){
    int a, b, c;
    cin >> a >> b >> c;
    int d = a - b;
    cout << max(0, c - d) << endl;
}
int main()
{
 input();
 return 0;
}


Measured memory_bytes: 256
n = int(input())
a = list(map(int,input().split()))
a_eve = [i for i in a if i%2 == 0]
a_ans = [i for i in a_eve if i%3 != 0 and i%5 != 0]
if a_ans == []:
    print('APPROVED')
else:
    print('DENIED')

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

#define int long long
int n, mn, a[51], b[51];
typedef pair<int, int> ii;
map<ii, int> mp;
map<ii, int> duo;

int ans(int p, int q){
    map<ii, int> mp2;
    mp2 = mp;
    int cnt = 0;
    for(map<ii, int>::iterator it = mp2.begin(); it != mp2.end(); it++){
        if(it->second == 0) continue;
        cnt++;
        int tmp1 = it->first.first, tmp2 = it->first.second;
        while(mp2[{tmp1 + p, tmp2 + q}] == 1){
            mp2[{tmp1 + p, tmp2 + q}] = 0;
            tmp1 += p;
            tmp2 += q;
        }
    }
    return cnt;
}

signed main(){
    cin >> n;
    for(int i = 1; i <= n; i++){
        int x, y;
        cin >> x >> y;
        mp[{x, y}] = 1;
        a[i] = x;
        b[i] = y;
    }
    for(int i = 1; i <= n; i++){
        for(int j = 1; j < i; j++){
            duo[{a[i] - a[j], b[i] - b[j]}]++;
        }
    }
    mn = n;
    for(map<ii, int>::iterator it = duo.begin(); it != duo.end(); it++) mn = min(mn, ans(it->first.first, it->first.second));
    cout << mn;
}

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

int main()
{
    int a=0,b=0,o=0,ab=0;
    int n;
    char t;
    string s;
    while(cin >> n >> t >> s)
    {
        if(s=="A"){a++;continue;}
        if(s=="B"){b++;continue;}
        if(s=="O"){o++;continue;}
        if(s=="AB"){ab++;continue;}
    }
    cout <<a <<endl;
    cout <<b <<endl;
    cout <<ab <<endl;
    cout <<o <<endl;

    return 0;
}

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

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

    string ans = "";
    char temp = s[k-1];

    for(int i =0 ; i<s.size();i++)
    {
        if(s[i]==temp)
            ans = ans + temp;
        else
        {
                ans = ans + "*";
        }
        
    }
    cout<<ans;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>
using namespace std;
const int mod = 1000000007;
int mul(long long a, long long b){
	return a * b % mod;
}
const int maxn = 202;
const int maxx = 100001;
int a[maxn], f[maxn][maxx];
int main(){
	int n, x; scanf("%d %d", &n, &x);
	for(int i = 0; i < maxx; i++) f[0][i] = i;
	for(int i = 1; i <= n; i++) scanf("%d", a + i);
	sort(a + 1, a + 1 + n);
	for(int i = 1; i <= n; i++){
		int v = a[i];
		for(int j = 0; j < maxx; j++){
			f[i][j] = mul(f[i-1][j], i - 1) + f[i - 1][j % v];
			if (f[i][j] >= mod) f[i][j] -= mod;
		}
	}
	printf("%d\n", f[n][x]);
	return 0;
}



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

#define REP(i,n) for(int i=0; i < (n); ++i)
#define REPR(i,n) for(int i=(n); i >= 0; --i)
#define FOR(i, m, n) for(int i = (m); i < (n); ++i)

#define INF 1e9


int main(){ 
  ll N, A, B;
  cin >> N >> A >> B;
  if(A > B){
    cout << 0 << endl;
  }
  else if(N == 1){
    if(A != B){
      cout << 0 << endl;
    }
    else{
      cout << B - A + 1 << endl;
    }
  }
  else{
    ll mins = A * (N-1) + B, maxs = A+ B * (N-1);
    cout << maxs - mins +1 << endl;
  }
  return 0;
}

Measured memory_bytes: 256
H, W, K = map(int, input().split())
c = []
for i in range(H):
    c.append(list(input()))

ans = 0

for mass_H in range(1 << H):
    for mass_W in range(1 << W):
        black = 0
        for i in range(H):
            for j in range(W):
                if ((mass_H >> i) & 1) == 0 and ((mass_W >> j ) & 1) == 0 and c[i][j] == '#':
                    black += 1
        if black == K:
            ans += 1

print(ans)


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

int main() {
  string a, b;
  cin >> a >> b;
  if (a[0]==b[2]&&a[1]==b[1]&&a[2]==b[0]) cout << "YES" << endl;
  else cout << "NO" << endl;
  return 0;
}
  


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
#include <fstream>
#include <bitset>
#include <time.h>
#include <tuple>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef complex<double> Point;

#define PI acos(-1.0)
#define EPS 1e-10
const ll INF = 1e12;
const ll MOD = 1e9 + 7;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,N) for(int i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )
#define fi first
#define se second
#define N_SIZE (1LL << 20)
#define NIL -1

ll sq(ll num) { return num*num; }
ll mod_pow(ll x, ll n) {
	if (n == 0)return 1;
	if (n == 1)return x%MOD;
	ll res = sq(mod_pow(x, n / 2));
	res %= MOD;
	if (n % 2 == 1) {
		res *= x;
		res %= MOD;
	}
	return res;
}
ll mod_add(ll a, ll b) { return (a + b) % MOD; }
ll mod_sub(ll a, ll b) { return (a - b + MOD) % MOD; }
ll mod_mul(ll a, ll b) { return a*b % MOD; }

int n, a, b;

int main() {
	cin >> n >> a >> b;
	cout << min(n*a, b) << endl;
}

Measured memory_bytes: 768
#include <algorithm>
#include <iostream>
#include <string.h>
#include <stdio.h>
#include <vector>
#include <queue>
#include <cmath>
#include <map>
#include <set>

#define pii pair <int, int>
#define pb push_back
#define ll long long
#define ss second
#define ff first
#define N 100010

using namespace std;

int a, b;

int main()
{
	cin >> a >> b;
	
	int ans = 0;
	for(int i = a; i <= b; i++) {
		int c = i;
		
		string s;
		while(c)
			s += (char)(c%10+'0'), c /= 10;
		
		string t = s;
		
		reverse(s.begin(), s.end());
		
		if(s == t) {
			
			ans++;
		}
	}
	
	cout << ans;
}

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

using namespace std;

typedef long long LL;
const int MAXN=1<<18;
LL dp[MAXN],a[32][32];
LL n;

int loc(int x){
	int cnt=0;
	while(x>1){
		x>>=1;
		cnt++;
	}
	return cnt;
}

int lowbit(LL x){
	return x&-x;
}

LL cal(LL x,LL y){
	int lx=loc(x);
	LL tot=0;
	while(y){
		int ly=loc(lowbit(y));
		y-=lowbit(y);
		tot+=a[lx][ly];
	}
	return tot;
}

void init(){
	cin>>n;
	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
			cin>>a[i][j];
		}
	}
	for(int i=3,up=2;i<(1<<n);i++){
		if(up==i>>1) up<<=1;
		dp[i]=dp[i-up]+cal(up,i-up);
	}
}

void work(){
	for(int i=1;i<(1<<n);i++){
		for(int j=1;j<=i;j++){
			if((i|j)==i){
				dp[i]=max(dp[i],dp[j]+dp[i^j]);
			}
		}
	}
	cout<<dp[(1<<n)-1]<<endl;
}

int main(){
	init();
	work();
	return 0;
}


Measured memory_bytes: 768
#include<bits/stdc++.h>
using namespace std;
using LL=long long;
#define rep(i,n) for(int i=0; i<n; i++)
#define rep1(i,n) for(int i=1; i<n; i++)
#define all(a) (a).begin(),(a).end()

int main(){
  int n,k;
  cin >> n >> k;
  vector<LL> h(n);
  rep(i,n) cin >> h[i];
  sort(all(h));
  LL ans = 101010101010;
  rep(i, n-k+1){
    ans = min(ans, h[k-1+i] - h[i]);
  }
  cout << ans << endl;
}


Measured memory_bytes: 1024
def get_i() #空白区切の入力を数値(整数)の配列で返す
  return gets.chomp.split(" ").map(&:to_i)
end
def get_f() #空白区切の入力を数値(実数)の配列で返す
  return gets.chomp.split(" ").map(&:to_f)
end
def get() #空白区切の入力を文字列の配列で返す
  return gets.chomp.split(" ")
end
def get_nsp() #入力されたものを一文字ずつに区切った文字列の配列で返す
  return gets.chomp.split("")
end
def yn_judge(bool,y="Yes",n="No") #boolに真偽を投げることで、trueならy、falseならnの値を出力する
  return bool ? y : n 
end
def array(size1,init=nil,size2=-1) #size2に二次元配列時の最初の要素数、size1に次の配列の大きさ、initに初期値を投げることでその配列を返す
  if size2==-1
    return Array.new(size1){init}
  else
    return Array.new(size2){Array.new(size1){init}}
  end
end

N,K,S=get_i
ans=array(N)
K.times do|i|
    ans[i]=S
end
K.upto(N-1) do|i|
    ans[i]=S+1
    if ans[i]>10**9
        ans[i]=10**9-1
    end
end
puts ans.join(" ")

Measured memory_bytes: 6780
using System;
using System.Collections.Generic;
using System.Text;

namespace mondai0007
{
    class Program
    {
        static double rishi = 0.05;

        static int Main(string[] args)
        {
            double gankin = 100000;
            double input = double.Parse(Console.ReadLine());
            int zougaku = 0;

            for (int i = 0; i < input; i++)
            {
                zougaku = (int)(gankin * rishi);

                if (zougaku % 1000 != 0)
                {
                    zougaku = (int)Math.Ceiling((double)zougaku / 1000) * 1000;
                }

                gankin += zougaku;
            }

            Console.WriteLine(gankin.ToString());

            return 0;

        }

    }
}

Measured memory_bytes: 5740